How to use Version class of junit.runner package

Best junit code snippet using junit.runner.Version

Source:OWL2.java Github

copy

Full Screen

1package conformancetests;2/* This file is part of the JFact DL reasoner3 Copyright 2011-2013 by Ignazio Palmisano, Dmitry Tsarkov, University of Manchester4 This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.5 This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.6 You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA*/7import org.junit.Test;8import testbase.TestBase;9@SuppressWarnings("javadoc")10public class OWL2 extends TestBase {11 @Test12 public void testowl2_rl_anonymous_individual() {13 String premise = "<rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:owl=\"http://www.w3.org/2002/07/owl#\" xmlns:j.0=\"http://owl2.test/rules#\">\n"14 + " <owl:Ontology />\n"15 + " <owl:ObjectProperty rdf:about=\"http://owl2.test/rules#op\"/>\n"16 + " <owl:NamedIndividual rdf:about=\"http://owl2.test/rules#I\"/>\n"17 + " <owl:NamedIndividual>\n"18 + " <j.0:op rdf:resource=\"http://owl2.test/rules#I\"/></owl:NamedIndividual></rdf:RDF>";19 String conclusion = "";20 String id = "owl2_rl_anonymous_individual";21 TestClasses tc = TestClasses.valueOf("CONSISTENCY");22 String d = "OWL 2 RL allows anonymous individual.";23 JUnitRunner r = new JUnitRunner(premise, conclusion, id, tc, d);24 r.setReasonerFactory(factory());25 r.run();26 }27 @Test28 public void testowl2_rl_invalid_leftside_allvaluesfrom() {29 String premise = "<rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:owl=\"http://www.w3.org/2002/07/owl#\" xmlns:rdfs=\"http://www.w3.org/2000/01/rdf-schema#\">\n"30 + " <owl:Ontology />\n"31 + " <owl:Class rdf:about=\"http://owl2.test/rules#C\"/>\n"32 + " <owl:Class rdf:about=\"http://owl2.test/rules#C1\"/>\n"33 + " <owl:ObjectProperty rdf:about=\"http://owl2.test/rules#op\"/>\n"34 + " <owl:Restriction>\n"35 + " <owl:allValuesFrom rdf:resource=\"http://owl2.test/rules#C1\"/>\n"36 + " <owl:onProperty rdf:resource=\"http://owl2.test/rules#op\"/>\n"37 + " <rdfs:subClassOf rdf:resource=\"http://owl2.test/rules#C\"/></owl:Restriction></rdf:RDF>";38 String conclusion = "";39 String id = "owl2_rl_invalid_leftside_allvaluesfrom";40 TestClasses tc = TestClasses.valueOf("CONSISTENCY");41 String d = "OWL 2 RL does not allow left side allValuesFrom in a subClassOf axiom.";42 JUnitRunner r = new JUnitRunner(premise, conclusion, id, tc, d);43 r.setReasonerFactory(factory());44 r.run();45 }46 @Test47 public void testowl2_rl_invalid_leftside_maxcard() {48 String premise = "<rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:owl=\"http://www.w3.org/2002/07/owl#\" xmlns:rdfs=\"http://www.w3.org/2000/01/rdf-schema#\">\n"49 + " <owl:Ontology />\n"50 + " <owl:Class rdf:about=\"http://owl2.test/rules#C\"/>\n"51 + " <owl:ObjectProperty rdf:about=\"http://owl2.test/rules#op\"/>\n"52 + " <owl:Restriction>\n"53 + " <rdfs:subClassOf rdf:resource=\"http://owl2.test/rules#C\"/>\n"54 + " <owl:maxCardinality rdf:datatype=\"http://www.w3.org/2001/XMLSchema#nonNegativeInteger\">2</owl:maxCardinality>\n"55 + " <owl:onProperty rdf:resource=\"http://owl2.test/rules#op\"/></owl:Restriction></rdf:RDF>";56 String conclusion = "";57 String id = "owl2_rl_invalid_leftside_maxcard";58 TestClasses tc = TestClasses.valueOf("CONSISTENCY");59 String d = "Invalid OWL 2 RL due to maxCardinality usage.";60 JUnitRunner r = new JUnitRunner(premise, conclusion, id, tc, d);61 r.setReasonerFactory(factory());62 r.run();63 }64 @Test65 public void testowl2_rl_invalid_oneof() {66 String premise = "<rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:owl=\"http://www.w3.org/2002/07/owl#\">\n"67 + " <owl:Ontology />\n"68 + " <owl:Class rdf:about=\"http://owl2.test/rules#Cb\">\n"69 + " <owl:oneOf rdf:parseType=\"Collection\">\n"70 + " <owl:Thing rdf:about=\"http://owl2.test/rules#X\"/>\n"71 + " <owl:Thing rdf:about=\"http://owl2.test/rules#Y\"/></owl:oneOf></owl:Class>\n"72 + "</rdf:RDF>";73 String conclusion = "";74 String id = "owl2_rl_invalid_oneof";75 TestClasses tc = TestClasses.valueOf("CONSISTENCY");76 String d = "OWL 2 RL does not permit owl:oneOf to define a named class (it can be used as a subclass expression).";77 JUnitRunner r = new JUnitRunner(premise, conclusion, id, tc, d);78 r.setReasonerFactory(factory());79 r.run();80 }81 @Test82 public void testowl2_rl_invalid_owlreal() {83 String premise = "<rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:owl=\"http://www.w3.org/2002/07/owl#\" xmlns:rdfs=\"http://www.w3.org/2000/01/rdf-schema#\">\n"84 + " <owl:Ontology />\n"85 + " <owl:Class rdf:about=\"http://owl2.test/rules#C_Sub\">\n"86 + " <rdfs:subClassOf>\n"87 + " <owl:Restriction>\n"88 + " <owl:allValuesFrom rdf:resource=\"http://www.w3.org/2002/07/owl#real\"/>\n"89 + " <owl:onProperty>\n"90 + " <owl:DatatypeProperty rdf:about=\"http://owl2.test/rules#p\"/></owl:onProperty></owl:Restriction></rdfs:subClassOf>\n"91 + " </owl:Class></rdf:RDF>";92 String conclusion = "";93 String id = "owl2_rl_invalid_owlreal";94 TestClasses tc = TestClasses.valueOf("CONSISTENCY");95 String d = "Invalid OWL 2 RL because owl:real is used.";96 JUnitRunner r = new JUnitRunner(premise, conclusion, id, tc, d);97 r.setReasonerFactory(factory());98 r.run();99 }100 @Test101 public void testowl2_rl_invalid_rightside_somevaluesfrom() {102 String premise = "<rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:rdfs=\"http://www.w3.org/2000/01/rdf-schema#\" xmlns:owl=\"http://www.w3.org/2002/07/owl#\">\n"103 + " <owl:Ontology />\n"104 + " <owl:Class rdf:about=\"http://owl2.test/rules#C_Sub\">\n"105 + " <rdfs:subClassOf>\n"106 + " <owl:Restriction>\n"107 + " <owl:someValuesFrom>\n"108 + " <owl:Class rdf:about=\"http://owl2.test/rules#C1\"/></owl:someValuesFrom>\n"109 + " <owl:onProperty>\n"110 + " <owl:ObjectProperty rdf:about=\"http://owl2.test/rules#p\"/></owl:onProperty></owl:Restriction></rdfs:subClassOf>\n"111 + " </owl:Class></rdf:RDF>";112 String conclusion = "";113 String id = "owl2_rl_invalid_rightside_somevaluesfrom";114 TestClasses tc = TestClasses.valueOf("CONSISTENCY");115 String d = "This is not a valid OWL 2 RL because someValuesFrom shows up on the right hand side of a SubClassOf axiom.";116 JUnitRunner r = new JUnitRunner(premise, conclusion, id, tc, d);117 r.setReasonerFactory(factory());118 r.run();119 }120 @Test121 public void testowl2_rl_invalid_rightside_unionof() {122 String premise = "<rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:owl=\"http://www.w3.org/2002/07/owl#\" xmlns:rdfs=\"http://www.w3.org/2000/01/rdf-schema#\">\n"123 + " <owl:Ontology />\n"124 + " <owl:Class rdf:about=\"http://owl2.test/rules#C_Sub\">\n"125 + " <rdfs:subClassOf>\n"126 + " <owl:Class>\n"127 + " <owl:unionOf rdf:parseType=\"Collection\">\n"128 + " <owl:Class rdf:about=\"http://owl2.test/rules#C1\"/>\n"129 + " <owl:Class rdf:about=\"http://owl2.test/rules#C2\"/></owl:unionOf></owl:Class></rdfs:subClassOf>\n"130 + " </owl:Class></rdf:RDF>";131 String conclusion = "";132 String id = "owl2_rl_invalid_rightside_unionof";133 TestClasses tc = TestClasses.valueOf("CONSISTENCY");134 String d = "Incorrect OWL 2 RL syntax. unionOf shows up at the right hand side of a SubClassOf axiom.";135 JUnitRunner r = new JUnitRunner(premise, conclusion, id, tc, d);136 r.setReasonerFactory(factory());137 r.run();138 }139 @Test140 public void testowl2_rl_invalid_unionof() {141 String premise = "<rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:owl=\"http://www.w3.org/2002/07/owl#\">\n"142 + " <owl:Ontology />\n"143 + " <owl:Class rdf:about=\"http://owl2.test/rules#C\">\n"144 + " <owl:unionOf rdf:parseType=\"Collection\">\n"145 + " <owl:Class rdf:about=\"http://owl2.test/rules#C1\"/>\n"146 + " <owl:Class rdf:about=\"http://owl2.test/rules#C2\"/></owl:unionOf></owl:Class>\n"147 + "</rdf:RDF>";148 String conclusion = "";149 String id = "owl2_rl_invalid_unionof";150 TestClasses tc = TestClasses.valueOf("CONSISTENCY");151 String d = "OWL 2 RL does not allow owl:unionOf to define a named class (it can be used as a subclass expression).";152 JUnitRunner r = new JUnitRunner(premise, conclusion, id, tc, d);153 r.setReasonerFactory(factory());154 r.run();155 }156 @Test157 public void testowl2_rl_rules_fp_differentFrom() {158 String premise = "<rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:owl=\"http://www.w3.org/2002/07/owl#\" xmlns:j.0=\"http://owl2.test/rules/\">\n"159 + " <owl:Ontology />\n"160 + " <owl:FunctionalProperty rdf:about=\"http://owl2.test/rules/fp\">\n"161 + " <rdf:type rdf:resource=\"http://www.w3.org/2002/07/owl#ObjectProperty\"/></owl:FunctionalProperty>\n"162 + " <owl:NamedIndividual rdf:about=\"http://owl2.test/rules/Y2\">\n"163 + " <j.0:fp>\n"164 + " <owl:NamedIndividual rdf:about=\"http://owl2.test/rules/X2\"/></j.0:fp></owl:NamedIndividual>\n"165 + " <owl:NamedIndividual rdf:about=\"http://owl2.test/rules/X1\">\n"166 + " <owl:differentFrom rdf:resource=\"http://owl2.test/rules/X2\"/></owl:NamedIndividual>\n"167 + " <owl:NamedIndividual rdf:about=\"http://owl2.test/rules/Y1\">\n"168 + " <j.0:fp rdf:resource=\"http://owl2.test/rules/X1\"/></owl:NamedIndividual></rdf:RDF>";169 String conclusion = "<rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:owl=\"http://www.w3.org/2002/07/owl#\">\n"170 + " <owl:Ontology />\n"171 + " <owl:NamedIndividual rdf:about=\"http://owl2.test/rules/Y2\"/>\n"172 + " <owl:NamedIndividual rdf:about=\"http://owl2.test/rules/Y1\">\n"173 + " <owl:differentFrom rdf:resource=\"http://owl2.test/rules/Y2\"/></owl:NamedIndividual></rdf:RDF>";174 String id = "owl2_rl_rules_fp_differentFrom";175 TestClasses tc = TestClasses.valueOf("POSITIVE_IMPL");176 String d = "This test checks the interaction between an OWL functional property and differentFrom assertions.";177 JUnitRunner r = new JUnitRunner(premise, conclusion, id, tc, d);178 r.setReasonerFactory(factory());179 r.run();180 }181 @Test182 public void testowl2_rl_rules_ifp_differentFrom() {183 String premise = "<rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:owl=\"http://www.w3.org/2002/07/owl#\" xmlns:j.0=\"http://owl2.test/rules/\">\n"184 + " <owl:Ontology />\n"185 + " <owl:InverseFunctionalProperty rdf:about=\"http://owl2.test/rules/ifp\">\n"186 + " <rdf:type rdf:resource=\"http://www.w3.org/2002/07/owl#ObjectProperty\"/></owl:InverseFunctionalProperty>\n"187 + " <owl:NamedIndividual rdf:about=\"http://owl2.test/rules/Y2\">\n"188 + " <j.0:ifp>\n"189 + " <owl:NamedIndividual rdf:about=\"http://owl2.test/rules/X2\"/></j.0:ifp></owl:NamedIndividual>\n"190 + " <owl:NamedIndividual rdf:about=\"http://owl2.test/rules/X1\"/>\n"191 + " <owl:NamedIndividual rdf:about=\"http://owl2.test/rules/Y1\">\n"192 + " <owl:differentFrom rdf:resource=\"http://owl2.test/rules/Y2\"/>\n"193 + " <j.0:ifp rdf:resource=\"http://owl2.test/rules/X1\"/></owl:NamedIndividual></rdf:RDF>";194 String conclusion = "<rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:owl=\"http://www.w3.org/2002/07/owl#\">\n"195 + " <owl:Ontology />\n"196 + " <owl:NamedIndividual rdf:about=\"http://owl2.test/rules/X1\">\n"197 + " <owl:differentFrom>\n"198 + " <owl:NamedIndividual rdf:about=\"http://owl2.test/rules/X2\"/></owl:differentFrom></owl:NamedIndividual>\n"199 + "</rdf:RDF>";200 String id = "owl2_rl_rules_ifp_differentFrom";201 TestClasses tc = TestClasses.valueOf("POSITIVE_IMPL");202 String d = "This test checks the interaction between inverse functional property and differentFrom assertions.";203 JUnitRunner r = new JUnitRunner(premise, conclusion, id, tc, d);204 r.setReasonerFactory(factory());205 r.run();206 }207 @Test208 public void testowl2_rl_valid_mincard() {209 String premise = "<rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:owl=\"http://www.w3.org/2002/07/owl#\" xmlns:rdfs=\"http://www.w3.org/2000/01/rdf-schema#\" xmlns:j.0=\"http://owl2.test/rules#\">\n"210 + " <owl:Ontology rdf:about=\"http://org.semanticweb.ontologies/Ontology1232054810511161000\"/>\n"211 + " <owl:Class rdf:about=\"http://owl2.test/rules#C\">\n"212 + " <rdfs:subClassOf>\n"213 + " <owl:Restriction>\n"214 + " <owl:minCardinality rdf:datatype=\"http://www.w3.org/2001/XMLSchema#nonNegativeInteger\">1</owl:minCardinality>\n"215 + " <owl:onProperty>\n"216 + " <owl:ObjectProperty rdf:about=\"http://owl2.test/rules#OP\"/></owl:onProperty></owl:Restriction></rdfs:subClassOf></owl:Class>\n"217 + " <owl:Class rdf:about=\"http://www.w3.org/2002/07/owl#Thing\"/>\n"218 + " <j.0:C rdf:about=\"http://owl2.test/rules#c\">\n"219 + " <rdf:type rdf:resource=\"http://www.w3.org/2002/07/owl#Thing\"/></j.0:C></rdf:RDF>";220 String conclusion = "";221 String id = "owl2_rl_valid_mincard";222 TestClasses tc = TestClasses.valueOf("CONSISTENCY");223 String d = "OWL 2 RL does not allow min cardinality";224 JUnitRunner r = new JUnitRunner(premise, conclusion, id, tc, d);225 r.setReasonerFactory(factory());226 r.run();227 }228 @Test229 public void testowl2_rl_valid_oneof() {230 String premise = "<rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:rdfs=\"http://www.w3.org/2000/01/rdf-schema#\" xmlns:owl=\"http://www.w3.org/2002/07/owl#\">\n"231 + " <owl:Ontology />\n"232 + " <owl:Class rdf:about=\"http://owl2.test/rules#Cb\"/>\n"233 + " <owl:NamedIndividual rdf:about=\"http://owl2.test/rules#X\"/>\n"234 + " <owl:NamedIndividual rdf:about=\"http://owl2.test/rules#Y\"/>\n"235 + " <rdf:Description>\n"236 + " <rdfs:subClassOf rdf:resource=\"http://owl2.test/rules#Cb\"/>\n"237 + " <owl:oneOf rdf:parseType=\"Collection\">\n"238 + " <owl:NamedIndividual rdf:about=\"http://owl2.test/rules#X\"/>\n"239 + " <owl:NamedIndividual rdf:about=\"http://owl2.test/rules#Y\"/></owl:oneOf></rdf:Description>\n"240 + "</rdf:RDF>";241 String conclusion = "";242 String id = "owl2_rl_valid_oneof";243 TestClasses tc = TestClasses.valueOf("CONSISTENCY");244 String d = "A valid usage of oneOf in OWL 2 RL";245 JUnitRunner r = new JUnitRunner(premise, conclusion, id, tc, d);246 r.setReasonerFactory(factory());247 r.run();248 }249 @Test250 public void testowl2_rl_valid_rightside_allvaluesfrom() {251 String premise = "<rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:rdfs=\"http://www.w3.org/2000/01/rdf-schema#\" xmlns:owl=\"http://www.w3.org/2002/07/owl#\">\n"252 + " <owl:Ontology />\n"253 + " <owl:Class rdf:about=\"http://owl2.test/rules#C\">\n"254 + " <rdfs:subClassOf>\n"255 + " <owl:Restriction>\n"256 + " <owl:onProperty>\n"257 + " <owl:ObjectProperty rdf:about=\"http://owl2.test/rules#op\"/></owl:onProperty>\n"258 + " <owl:allValuesFrom>\n"259 + " <owl:Class rdf:about=\"http://owl2.test/rules#C1\"/></owl:allValuesFrom></owl:Restriction></rdfs:subClassOf>\n"260 + " </owl:Class></rdf:RDF>";261 String conclusion = "";262 String id = "owl2_rl_valid_rightside_allvaluesfrom";263 TestClasses tc = TestClasses.valueOf("CONSISTENCY");264 String d = "Valid RL usage of allValuesFrom.";265 JUnitRunner r = new JUnitRunner(premise, conclusion, id, tc, d);266 r.setReasonerFactory(factory());267 r.run();268 }269 @Test270 public void testNew_Feature_AnnotationAnnotations_001() {271 String premise = "<?xml version=\"1.0\"?>\n"272 + "<rdf:RDF\n"273 + " xml:base = \"http://example.org/\" xmlns = \"http://example.org/\" xmlns:owl = \"http://www.w3.org/2002/07/owl#\" xmlns:rdf = \"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:rdfs= \"http://www.w3.org/2000/01/rdf-schema#\">\n"274 + '\n'275 + "<owl:Ontology rdf:about=\"http://example.org/\"/>\n"276 + '\n'277 + "<rdf:Description rdf:about=\"http://example.org/\">\n"278 + " <rdfs:label>An example ontology</rdfs:label></rdf:Description>\n"279 + '\n'280 + "<owl:Annotation>\n"281 + " <owl:annotatedSource rdf:resource=\"http://example.org/\" />\n"282 + " <owl:annotatedProperty rdf:resource=\"http://www.w3.org/2000/01/rdf-schema#label\" />\n"283 + " <owl:annotatedTarget>An example ontology</owl:annotatedTarget>\n"284 + " <author>Mike Smith</author>\n" + "</owl:Annotation>\n"285 + '\n' + "<owl:AnnotationProperty rdf:about=\"author\" />\n"286 + "<owl:NamedIndividual rdf:about=\"i\" />\n" + '\n'287 + "</rdf:RDF>";288 String conclusion = "";289 String id = "New_Feature_AnnotationAnnotations_001";290 TestClasses tc = TestClasses.valueOf("CONSISTENCY");291 String d = "Demonstrates annotation of an annotation. Adapted from an example in the Mapping to RDF Graphs document.";292 JUnitRunner r = new JUnitRunner(premise, conclusion, id, tc, d);293 r.setReasonerFactory(factory());294 r.run();295 }296 @Test297 public void testNew_Feature_AsymmetricProperty_001() {298 String premise = "<?xml version=\"1.0\"?>\n"299 + "<rdf:RDF\n"300 + " xml:base = \"http://example.org/\" xmlns = \"http://example.org/\" xmlns:owl = \"http://www.w3.org/2002/07/owl#\" xmlns:rdf = \"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n"301 + '\n' + "<owl:Ontology/>\n" + '\n'302 + "<owl:ObjectProperty rdf:about=\"parentOf\" />\n"303 + "<owl:AsymmetricProperty rdf:about=\"parentOf\" />\n" + '\n'304 + "<rdf:Description rdf:about=\"Peter\">\n"305 + " <parentOf rdf:resource=\"Stewie\" />\n"306 + "</rdf:Description>\n" + '\n'307 + "<rdf:Description rdf:about=\"Stewie\">\n"308 + " <parentOf rdf:resource=\"Peter\" />\n"309 + "</rdf:Description>\n" + '\n' + "</rdf:RDF>";310 String conclusion = "";311 String id = "New_Feature_AsymmetricProperty_001";312 TestClasses tc = TestClasses.valueOf("INCONSISTENCY");313 String d = "Demonstrates use of an asymmetric object property axiom to cause a trivial inconsistency based on the example in the Structural Specification and Functional-Style Syntax document.";314 JUnitRunner r = new JUnitRunner(premise, conclusion, id, tc, d);315 r.setReasonerFactory(factory());316 r.run();317 }318 @Test319 public void testNew_Feature_AxiomAnnotations_001() {320 String premise = "<?xml version=\"1.0\"?>\n"321 + "<rdf:RDF\n"322 + " xml:base = \"http://example.org/\" xmlns = \"http://example.org/\" xmlns:owl = \"http://www.w3.org/2002/07/owl#\" xmlns:rdf = \"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:rdfs=\"http://www.w3.org/2000/01/rdf-schema#\">\n"323 + '\n'324 + "<owl:Ontology/>\n"325 + '\n'326 + "<owl:Class rdf:about=\"Child\" />\n"327 + "<owl:Class rdf:about=\"Person\" />\n"328 + '\n'329 + "<rdf:Description rdf:about=\"Child\">\n"330 + " <rdfs:subClassOf rdf:resource=\"Person\" /></rdf:Description>\n"331 + '\n'332 + "<owl:Axiom>\n"333 + " <owl:annotatedSource rdf:resource=\"Child\" />\n"334 + " <owl:annotatedProperty rdf:resource=\"http://www.w3.org/2000/01/rdf-schema#subClassOf\" />\n"335 + " <owl:annotatedTarget rdf:resource=\"Person\" />\n"336 + " <rdfs:comment>Children are people.</rdfs:comment></owl:Axiom>\n"337 + '\n' + "</rdf:RDF>";338 String conclusion = "";339 String id = "New_Feature_AxiomAnnotations_001";340 TestClasses tc = TestClasses.valueOf("CONSISTENCY");341 String d = "Demonstrates axiom annotation based on an example in the Mapping to RDF Graphs document. The axiom being annotated here generates a main triple when mapped to RDF.";342 JUnitRunner r = new JUnitRunner(premise, conclusion, id, tc, d);343 r.setReasonerFactory(factory());344 r.run();345 }346 @Test347 public void testNew_Feature_BottomDataProperty_001() {348 String premise = "<?xml version=\"1.0\"?>\n"349 + "<rdf:RDF\n"350 + " xml:base = \"http://example.org/\" xmlns = \"http://example.org/\" xmlns:owl = \"http://www.w3.org/2002/07/owl#\" xmlns:rdf = \"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n"351 + '\n'352 + "<owl:Ontology/>\n"353 + '\n'354 + "<rdf:Description rdf:about=\"i\">\n"355 + " <rdf:type>\n"356 + " <owl:Restriction>\n"357 + " <owl:onProperty rdf:resource=\"http://www.w3.org/2002/07/owl#bottomDataProperty\" />\n"358 + " <owl:someValuesFrom rdf:resource=\"http://www.w3.org/2000/01/rdf-schema#Literal\" /></owl:Restriction></rdf:type>\n"359 + "</rdf:Description>\n" + '\n' + "</rdf:RDF>";360 String conclusion = "";361 String id = "New_Feature_BottomDataProperty_001";362 TestClasses tc = TestClasses.valueOf("INCONSISTENCY");363 String d = "Demonstrates use of the bottom data property to create an inconsistency.";364 JUnitRunner r = new JUnitRunner(premise, conclusion, id, tc, d);365 r.setReasonerFactory(factory());366 r.run();367 }368 @Test369 public void testNew_Feature_BottomObjectProperty_001() {370 String premise = "<?xml version=\"1.0\"?>\n"371 + "<rdf:RDF\n"372 + " xml:base = \"http://example.org/\" xmlns = \"http://example.org/\" xmlns:owl = \"http://www.w3.org/2002/07/owl#\" xmlns:rdf = \"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n"373 + '\n'374 + "<owl:Ontology/>\n"375 + '\n'376 + "<rdf:Description rdf:about=\"i\">\n"377 + " <rdf:type>\n"378 + " <owl:Restriction>\n"379 + " <owl:onProperty rdf:resource=\"http://www.w3.org/2002/07/owl#bottomObjectProperty\" />\n"380 + " <owl:someValuesFrom rdf:resource=\"http://www.w3.org/2002/07/owl#Thing\" /></owl:Restriction></rdf:type>\n"381 + "</rdf:Description>\n" + '\n' + "</rdf:RDF>";382 String conclusion = "";383 String id = "New_Feature_BottomObjectProperty_001";384 TestClasses tc = TestClasses.valueOf("INCONSISTENCY");385 String d = "Demonstrates use of the bottom object property to create an inconsistency.";386 JUnitRunner r = new JUnitRunner(premise, conclusion, id, tc, d);387 r.setReasonerFactory(factory());388 r.run();389 }390 @Test391 public void testNew_Feature_DisjointObjectProperties_001() {392 String premise = "<?xml version=\"1.0\"?>\n"393 + "<rdf:RDF\n"394 + " xml:base = \"http://example.org/\" xmlns = \"http://example.org/\" xmlns:owl = \"http://www.w3.org/2002/07/owl#\" xmlns:rdf = \"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n"395 + '\n'396 + "<owl:Ontology/>\n"397 + '\n'398 + "<owl:ObjectProperty rdf:about=\"hasFather\" />\n"399 + "<owl:ObjectProperty rdf:about=\"hasMother\" />\n"400 + '\n'401 + "<rdf:Description rdf:about=\"hasFather\">\n"402 + " <owl:propertyDisjointWith rdf:resource=\"hasMother\" /></rdf:Description>\n"403 + '\n' + "<rdf:Description rdf:about=\"Stewie\">\n"404 + " <hasFather rdf:resource=\"Peter\" />\n"405 + "</rdf:Description>\n" + '\n'406 + "<rdf:Description rdf:about=\"Stewie\">\n"407 + " <hasMother rdf:resource=\"Lois\" />\n"408 + "</rdf:Description>\n" + '\n' + "</rdf:RDF>";409 String conclusion = "<?xml version=\"1.0\"?>\n"410 + "<rdf:RDF\n"411 + " xml:base = \"http://example.org/\" xmlns = \"http://example.org/\" xmlns:owl = \"http://www.w3.org/2002/07/owl#\" xmlns:rdf = \"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n"412 + '\n'413 + "<owl:Ontology/>\n"414 + '\n'415 + "<rdf:Description rdf:about=\"Peter\">\n"416 + " <owl:differentFrom rdf:resource=\"Lois\" /></rdf:Description>\n"417 + '\n' + "</rdf:RDF>";418 String id = "New_Feature_DisjointObjectProperties_001";419 TestClasses tc = TestClasses.valueOf("POSITIVE_IMPL");420 String d = "Demonstrates use of a disjoint object properties axiom to infer that two individuals are different based on the example in the Structural Specification and Functional-Style Syntax document.";421 JUnitRunner r = new JUnitRunner(premise, conclusion, id, tc, d);422 r.setReasonerFactory(factory());423 r.run();424 }425 @Test426 public void testNew_Feature_DisjointObjectProperties_002() {427 String premise = "<?xml version=\"1.0\"?>\n"428 + "<rdf:RDF\n"429 + " xml:base = \"http://example.org/\" xmlns = \"http://example.org/\" xmlns:owl = \"http://www.w3.org/2002/07/owl#\" xmlns:rdf = \"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n"430 + '\n'431 + "<owl:Ontology/>\n"432 + '\n'433 + "<owl:ObjectProperty rdf:about=\"hasFather\" />\n"434 + "<owl:ObjectProperty rdf:about=\"hasMother\" />\n"435 + "<owl:ObjectProperty rdf:about=\"hasChild\" />\n"436 + '\n'437 + "<owl:AllDisjointProperties>\n"438 + " <owl:members rdf:parseType=\"Collection\">\n"439 + " <rdf:Description rdf:about=\"hasFather\" />\n"440 + " <rdf:Description rdf:about=\"hasMother\" />\n"441 + " <rdf:Description rdf:about=\"hasChild\" /></owl:members></owl:AllDisjointProperties>\n"442 + '\n'443 + "<rdf:Description rdf:about=\"Stewie\">\n"444 + " <hasFather rdf:resource=\"Peter\" />\n"445 + "</rdf:Description>\n"446 + '\n'447 + "<rdf:Description rdf:about=\"Stewie\">\n"448 + " <hasMother rdf:resource=\"Lois\" />\n"449 + "</rdf:Description>\n"450 + '\n'451 + "<rdf:Description rdf:about=\"Stewie\">\n"452 + " <hasChild rdf:resource=\"StewieJr\" />\n"453 + "</rdf:Description>\n" + '\n' + "</rdf:RDF>";454 String conclusion = "<?xml version=\"1.0\"?>\n"455 + "<rdf:RDF\n"456 + " xml:base = \"http://example.org/\" xmlns = \"http://example.org/\" xmlns:owl = \"http://www.w3.org/2002/07/owl#\" xmlns:rdf = \"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n"457 + '\n'458 + "<owl:Ontology/>\n"459 + '\n'460 + "<owl:AllDifferent>\n"461 + " <owl:distinctMembers rdf:parseType=\"Collection\">\n"462 + " <rdf:Description rdf:about=\"Peter\" />\n"463 + " <rdf:Description rdf:about=\"Lois\" />\n"464 + " <rdf:Description rdf:about=\"StewieJr\" /></owl:distinctMembers></owl:AllDifferent>\n"465 + '\n' + "</rdf:RDF>";466 String id = "New_Feature_DisjointObjectProperties_002";467 TestClasses tc = TestClasses.valueOf("POSITIVE_IMPL");468 String d = "A modification of test New-Feature-DisjointObjectProperties-001 to demonstrate a ternary disjoint object properties axiom.";469 JUnitRunner r = new JUnitRunner(premise, conclusion, id, tc, d);470 r.setReasonerFactory(factory());471 r.run();472 }473 @Test474 public void testNew_Feature_DisjointUnion_001() {475 String premise = "<?xml version=\"1.0\"?>\n"476 + "<rdf:RDF\n"477 + " xml:base = \"http://example.org/\" xmlns = \"http://example.org/\" xmlns:owl = \"http://www.w3.org/2002/07/owl#\" xmlns:rdf = \"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n"478 + '\n'479 + "<owl:Ontology/>\n"480 + '\n'481 + "<owl:Class rdf:about=\"Child\" />\n"482 + "<owl:Class rdf:about=\"Boy\" />\n"483 + "<owl:Class rdf:about=\"Girl\" />\n"484 + '\n'485 + "<rdf:Description rdf:about=\"Child\">\n"486 + " <owl:disjointUnionOf rdf:parseType=\"Collection\">\n"487 + " <rdf:Description rdf:about=\"Boy\" />\n"488 + " <rdf:Description rdf:about=\"Girl\" /></owl:disjointUnionOf></rdf:Description>\n"489 + '\n'490 + "<Child rdf:about=\"Stewie\" />\n"491 + "<rdf:Description rdf:about=\"Stewie\">\n"492 + " <rdf:type>\n"493 + " <owl:Class>\n"494 + " <owl:complementOf rdf:resource=\"Girl\" /></owl:Class></rdf:type>\n"495 + "</rdf:Description>\n" + '\n' + "</rdf:RDF>";496 String conclusion = "<?xml version=\"1.0\"?>\n"497 + "<rdf:RDF\n"498 + " xml:base = \"http://example.org/\" xmlns = \"http://example.org/\" xmlns:owl = \"http://www.w3.org/2002/07/owl#\" xmlns:rdf = \"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n"499 + '\n' + "<owl:Ontology/>\n" + '\n'500 + "<owl:Class rdf:about=\"Boy\" />\n" + '\n'501 + "<Boy rdf:about=\"Stewie\" />\n" + '\n' + "</rdf:RDF>";502 String id = "New_Feature_DisjointUnion_001";503 TestClasses tc = TestClasses.valueOf("POSITIVE_IMPL");504 String d = "Demonstrates a disjoint union axiom based on the example in the Structural Specification and Functional-Style Syntax document.";505 JUnitRunner r = new JUnitRunner(premise, conclusion, id, tc, d);506 r.setReasonerFactory(factory());507 r.run();508 }509 @Test510 public void testNew_Feature_IrreflexiveProperty_001() {511 String premise = "<?xml version=\"1.0\"?>\n"512 + "<rdf:RDF\n"513 + " xml:base = \"http://example.org/\" xmlns = \"http://example.org/\" xmlns:owl = \"http://www.w3.org/2002/07/owl#\" xmlns:rdf = \"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n"514 + '\n' + "<owl:Ontology/>\n" + '\n'515 + "<owl:ObjectProperty rdf:about=\"marriedTo\" />\n"516 + "<owl:IrreflexiveProperty rdf:about=\"marriedTo\" />\n"517 + '\n' + "<rdf:Description rdf:about=\"Peter\">\n"518 + " <marriedTo rdf:resource=\"Peter\" />\n"519 + "</rdf:Description>\n" + '\n' + "</rdf:RDF>";520 String conclusion = "";521 String id = "New_Feature_IrreflexiveProperty_001";522 TestClasses tc = TestClasses.valueOf("INCONSISTENCY");523 String d = "Demonstrates use of an irreflexive object property axiom to cause a trivial inconsistency based on the example in the Structural Specification and Functional-Style Syntax document.";524 JUnitRunner r = new JUnitRunner(premise, conclusion, id, tc, d);525 r.setReasonerFactory(factory());526 r.run();527 }528 @Test529 public void testNew_Feature_NegativeDataPropertyAssertion_001() {530 String premise = "<?xml version=\"1.0\"?>\n"531 + "<rdf:RDF\n"532 + " xml:base = \"http://example.org/\" xmlns = \"http://example.org/\" xmlns:owl = \"http://www.w3.org/2002/07/owl#\" xmlns:rdf = \"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n"533 + '\n'534 + "<owl:Ontology/>\n"535 + '\n'536 + "<owl:DatatypeProperty rdf:about=\"hasAge\" />\n"537 + '\n'538 + "<owl:NegativePropertyAssertion>\n"539 + " <owl:sourceIndividual rdf:resource=\"Meg\" />\n"540 + " <owl:assertionProperty rdf:resource=\"hasAge\" />\n"541 + " <owl:targetValue rdf:datatype=\"http://www.w3.org/2001/XMLSchema#integer\">5</owl:targetValue></owl:NegativePropertyAssertion>\n"542 + '\n'543 + "<rdf:Description rdf:about=\"Meg\">\n"544 + " <hasAge rdf:datatype=\"http://www.w3.org/2001/XMLSchema#integer\">5</hasAge></rdf:Description>\n"545 + '\n' + "</rdf:RDF>";546 String conclusion = "";547 String id = "New_Feature_NegativeDataPropertyAssertion_001";548 TestClasses tc = TestClasses.valueOf("INCONSISTENCY");549 String d = "Demonstrates use of a negative data property assertion to create a trivial inconsistency based on an example in the Structural Specification and Functional-Style Syntax document.";550 JUnitRunner r = new JUnitRunner(premise, conclusion, id, tc, d);551 r.setReasonerFactory(factory());552 r.run();553 }554 @Test555 public void testNew_Feature_NegativeObjectPropertyAssertion_001() {556 String premise = "<?xml version=\"1.0\"?>\n"557 + "<rdf:RDF\n"558 + " xml:base = \"http://example.org/\" xmlns = \"http://example.org/\" xmlns:owl = \"http://www.w3.org/2002/07/owl#\" xmlns:rdf = \"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n"559 + '\n'560 + "<owl:Ontology/>\n"561 + '\n'562 + "<owl:ObjectProperty rdf:about=\"hasSon\" />\n"563 + '\n'564 + "<owl:NegativePropertyAssertion>\n"565 + " <owl:sourceIndividual rdf:resource=\"Peter\" />\n"566 + " <owl:assertionProperty rdf:resource=\"hasSon\" />\n"567 + " <owl:targetIndividual rdf:resource=\"Meg\" /></owl:NegativePropertyAssertion>\n"568 + '\n' + "<rdf:Description rdf:about=\"Peter\">\n"569 + " <hasSon rdf:resource=\"Meg\" />\n"570 + "</rdf:Description>\n" + "</rdf:RDF>";571 String conclusion = "";572 String id = "New_Feature_NegativeObjectPropertyAssertion_001";573 TestClasses tc = TestClasses.valueOf("INCONSISTENCY");574 String d = "Demonstrates use of a negative object property assertion to create a trivial inconsistency based on an example in the Structural Specification and Functional-Style Syntax document.";575 JUnitRunner r = new JUnitRunner(premise, conclusion, id, tc, d);576 r.setReasonerFactory(factory());577 r.run();578 }579 @Test580 @Changed581 public void testNew_Feature_ObjectPropertyChain_001() {582 String premise = "<?xml version=\"1.0\"?>\n"583 + "<rdf:RDF\n"584 + " xml:base = \"http://example.org/\" xmlns = \"http://example.org/\" xmlns:owl = \"http://www.w3.org/2002/07/owl#\" xmlns:rdf = \"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n"585 + "<owl:Ontology/><owl:ObjectProperty rdf:about=\"hasMother\" />\n"586 + "<owl:ObjectProperty rdf:about=\"hasSister\" />\n"587 + "<owl:ObjectProperty rdf:about=\"hasAunt\" />\n"588 + "<rdf:Description rdf:about=\"hasAunt\">\n"589 + " <owl:propertyChainAxiom rdf:parseType=\"Collection\">\n"590 + " <rdf:Description rdf:about=\"hasMother\" />\n"591 + " <rdf:Description rdf:about=\"hasSister\" /></owl:propertyChainAxiom></rdf:Description>\n"592 + "<rdf:Description rdf:about=\"Stewie\">\n"593 + " <hasMother rdf:resource=\"Lois\" />\n"594 + "</rdf:Description>\n"595 + "<rdf:Description rdf:about=\"Lois\">\n"596 + " <hasSister rdf:resource=\"Carol\" />\n"597 + "</rdf:Description>\n" + "</rdf:RDF>";598 String conclusion = "<?xml version=\"1.0\"?>\n"599 + "<rdf:RDF\n"600 + " xml:base = \"http://example.org/\" xmlns = \"http://example.org/\" xmlns:owl = \"http://www.w3.org/2002/07/owl#\" xmlns:rdf = \"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n"601 + "<owl:Ontology/>\n"602 + "<owl:ObjectProperty rdf:about=\"hasAunt\" />\n"603 + "<rdf:Description rdf:about=\"Stewie\"><hasAunt rdf:resource=\"Carol\" /></rdf:Description></rdf:RDF>";604 String id = "New_Feature_ObjectPropertyChain_001";605 TestClasses tc = TestClasses.valueOf("POSITIVE_IMPL");606 String d = "Demonstrates an object property chain in a subproperty axiom based on the example in the Structural Specification and Functional-Style Syntax document.";607 JUnitRunner r = new JUnitRunner(premise, conclusion, id, tc, d);608 r.setReasonerFactory(factory());609 r.run();610 }611 @Test612 public void testNew_Feature_ObjectPropertyChain_BJP_004() {613 String premise = "<?xml version=\"1.0\"?>\n"614 + "<rdf:RDF\n"615 + " xml:base = \"http://example.org/\" xmlns = \"http://example.org/\" xmlns:owl = \"http://www.w3.org/2002/07/owl#\" xmlns:rdfs= \"http://www.w3.org/2000/01/rdf-schema#\" xmlns:rdf = \"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n"616 + '\n'617 + "<owl:Ontology/>\n"618 + '\n'619 + " <rdf:Description rdf:about=\"p\">\n"620 + " <owl:propertyChainAxiom rdf:parseType=\"Collection\">\n"621 + " <owl:ObjectProperty rdf:about=\"p\"/>\n"622 + " <owl:ObjectProperty rdf:about=\"q\"/></owl:propertyChainAxiom></rdf:Description>\n"623 + " \n" + " <rdf:Description rdf:about=\"a\">\n"624 + " <q rdf:resource=\"b\"/>\n"625 + " </rdf:Description>\n" + " \n"626 + " <rdf:Description rdf:about=\"b\">\n"627 + " <q rdf:resource=\"c\"/>\n"628 + " </rdf:Description>\n" + " \n" + "</rdf:RDF>";629 String conclusion = "<rdf:RDF\n"630 + " xml:base = \"http://example.org/\" xmlns = \"http://example.org/\" xmlns:owl = \"http://www.w3.org/2002/07/owl#\" xmlns:rdf = \"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n"631 + '\n' + " <owl:Ontology/>\n"632 + " <owl:ObjectProperty rdf:about=\"p\"/>\n"633 + " <owl:TransitiveProperty rdf:about=\"p\"/>\n"634 + "</rdf:RDF>";635 String id = "New_Feature_ObjectPropertyChain_BJP_004";636 TestClasses tc = TestClasses.valueOf("NEGATIVE_IMPL");637 String d = "A test of an interaction between a role chain +hierarchy and transitivity axioms.";638 JUnitRunner r = new JUnitRunner(premise, conclusion, id, tc, d);639 r.setReasonerFactory(factory());640 r.run();641 }642 @Test643 public void testNew_Feature_ObjectQCR_001() {644 String premise = "<?xml version=\"1.0\"?>\n"645 + "<rdf:RDF\n"646 + " xml:base = \"http://example.org/\" xmlns = \"http://example.org/\" xmlns:owl = \"http://www.w3.org/2002/07/owl#\" xmlns:rdf = \"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n"647 + '\n'648 + "<owl:Ontology/>\n"649 + '\n'650 + "<owl:ObjectProperty rdf:about=\"fatherOf\" />\n"651 + "<owl:Class rdf:about=\"Man\" />\n"652 + '\n'653 + "<rdf:Description rdf:about=\"Peter\">\n"654 + " <fatherOf rdf:resource=\"Stewie\" />\n"655 + " <fatherOf rdf:resource=\"Chris\" />\n"656 + "</rdf:Description>\n"657 + '\n'658 + "<Man rdf:about=\"Stewie\" />\n"659 + "<Man rdf:about=\"Chris\" />\n"660 + '\n'661 + "<rdf:Description rdf:about=\"Stewie\">\n"662 + " <owl:differentFrom rdf:resource=\"Chris\" /></rdf:Description>\n"663 + '\n' + "</rdf:RDF>";664 String conclusion = "<?xml version=\"1.0\"?>\n"665 + "<rdf:RDF\n"666 + " xml:base = \"http://example.org/\" xmlns = \"http://example.org/\" xmlns:owl = \"http://www.w3.org/2002/07/owl#\" xmlns:rdf = \"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n"667 + '\n'668 + "<owl:Ontology/>\n"669 + '\n'670 + "<owl:ObjectProperty rdf:about=\"fatherOf\" />\n"671 + "<owl:Class rdf:about=\"Man\" />\n"672 + '\n'673 + "<rdf:Description rdf:about=\"Peter\">\n"674 + " <rdf:type>\n"675 + " <owl:Restriction>\n"676 + " <owl:onProperty rdf:resource=\"fatherOf\" />\n"677 + " <owl:minQualifiedCardinality rdf:datatype=\"http://www.w3.org/2001/XMLSchema#nonNegativeInteger\">2</owl:minQualifiedCardinality>\n"678 + " <owl:onClass rdf:resource=\"Man\" /></owl:Restriction></rdf:type>\n"679 + "</rdf:Description>\n" + '\n' + "</rdf:RDF>";680 String id = "New_Feature_ObjectQCR_001";681 TestClasses tc = TestClasses.valueOf("POSITIVE_IMPL");682 String d = "Demonstrates a qualified minimum cardinality object property restriction based on example in the Structural Specification and Functional-Style Syntax document.";683 JUnitRunner r = new JUnitRunner(premise, conclusion, id, tc, d);684 r.setReasonerFactory(factory());685 r.run();686 }687 @Test688 public void testNew_Feature_ObjectQCR_002() {689 String premise = "<?xml version=\"1.0\"?>\n"690 + "<rdf:RDF\n"691 + " xml:base = \"http://example.org/\" xmlns = \"http://example.org/\" xmlns:owl = \"http://www.w3.org/2002/07/owl#\" xmlns:rdf = \"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n"692 + '\n'693 + "<owl:Ontology/>\n"694 + '\n'695 + "<owl:ObjectProperty rdf:about=\"fatherOf\" />\n"696 + "<owl:Class rdf:about=\"Woman\" />\n"697 + '\n'698 + "<rdf:Description rdf:about=\"Peter\">\n"699 + " <fatherOf rdf:resource=\"Stewie\" />\n"700 + " <fatherOf rdf:resource=\"Meg\" /></rdf:Description>\n"701 + '\n'702 + "<Woman rdf:about=\"Meg\" />\n"703 + '\n'704 + "<rdf:Description rdf:about=\"Peter\">\n"705 + " <rdf:type>\n"706 + " <owl:Restriction>\n"707 + " <owl:onProperty rdf:resource=\"fatherOf\" />\n"708 + " <owl:maxQualifiedCardinality rdf:datatype=\"http://www.w3.org/2001/XMLSchema#nonNegativeInteger\">1</owl:maxQualifiedCardinality>\n"709 + " <owl:onClass rdf:resource=\"Woman\" /></owl:Restriction></rdf:type>\n"710 + "</rdf:Description>\n"711 + '\n'712 + "<rdf:Description rdf:about=\"Stewie\">\n"713 + " <owl:differentFrom rdf:resource=\"Meg\" /></rdf:Description>\n"714 + '\n' + "</rdf:RDF>";715 String conclusion = "<?xml version=\"1.0\"?>\n"716 + "<rdf:RDF\n"717 + " xml:base = \"http://example.org/\" xmlns = \"http://example.org/\" xmlns:owl = \"http://www.w3.org/2002/07/owl#\" xmlns:rdf = \"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n"718 + '\n'719 + "<owl:Ontology/>\n"720 + '\n'721 + "<owl:Class rdf:about=\"Woman\" />\n"722 + '\n'723 + "<rdf:Description rdf:about=\"Stewie\">\n"724 + " <rdf:type>\n"725 + " <owl:Class>\n"726 + " <owl:complementOf rdf:resource=\"Woman\" /></owl:Class></rdf:type>\n"727 + "</rdf:Description>\n" + '\n' + "</rdf:RDF>";728 String id = "New_Feature_ObjectQCR_002";729 TestClasses tc = TestClasses.valueOf("POSITIVE_IMPL");730 String d = "Demonstrates a qualified maximum cardinality object property restriction adapted from example in the Structural Specification and Functional-Style Syntax document.";731 JUnitRunner r = new JUnitRunner(premise, conclusion, id, tc, d);732 r.setReasonerFactory(factory());733 r.run();734 }735 @Test736 public void testFS2RDF_different_individuals_2_ar() {737 String premise = "<rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema#\" xmlns=\"http://example.org/\" xmlns:rdfs=\"http://www.w3.org/2000/01/rdf-schema#\" xmlns:owl=\"http://www.w3.org/2002/07/owl#\">\n"738 + " <owl:Ontology/>\n"739 + " <rdf:Description rdf:about=\"http://example.org/a\">\n"740 + " <owl:differentFrom rdf:resource=\"http://example.org/b\"/></rdf:Description></rdf:RDF>";741 String conclusion = "";742 String id = "FS2RDF_different_individuals_2_ar";743 TestClasses tc = TestClasses.valueOf("CONSISTENCY");744 String d = "Functional syntax to RDFXML translation of ontology consisting of a 2 argument DifferentIndividuals";745 JUnitRunner r = new JUnitRunner(premise, conclusion, id, tc, d);746 r.setReasonerFactory(factory());747 r.run();748 }749 @Test750 public void testFS2RDF_different_individuals_3_ar() {751 String premise = "<rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema#\" xmlns=\"http://example.org/\" xmlns:rdfs=\"http://www.w3.org/2000/01/rdf-schema#\" xmlns:owl=\"http://www.w3.org/2002/07/owl#\">\n"752 + " <owl:Ontology/>\n"753 + " <owl:AllDifferent>\n"754 + " <owl:distinctMembers rdf:parseType=\"Collection\">\n"755 + " <rdf:Description rdf:about=\"http://example.org/a\"/>\n"756 + " <rdf:Description rdf:about=\"http://example.org/b\"/>\n"757 + " <rdf:Description rdf:about=\"http://example.org/c\"/></owl:distinctMembers></owl:AllDifferent>\n"758 + "</rdf:RDF>";759 String conclusion = "";760 String id = "FS2RDF_different_individuals_3_ar";761 TestClasses tc = TestClasses.valueOf("CONSISTENCY");762 String d = "Functional syntax to RDFXML translation of ontology consisting of a 3 argument DifferentIndividuals";763 JUnitRunner r = new JUnitRunner(premise, conclusion, id, tc, d);764 r.setReasonerFactory(factory());765 r.run();766 }767 @Test768 public void testFS2RDF_no_builtin_prefixes_ar() {769 String premise = "<rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema#\" xmlns=\"http://example.org/\" xmlns:rdfs=\"http://www.w3.org/2000/01/rdf-schema#\" xmlns:owl=\"http://www.w3.org/2002/07/owl#\">\n"770 + " <owl:Ontology/>\n"771 + " <rdf:Description rdf:about=\"http://example.org/d\">\n"772 + " <owl:sameAs rdf:resource=\"http://example.org/e\"/></rdf:Description>\n"773 + " <rdf:Description rdf:about=\"http://example.org/a\">\n"774 + " <owl:sameAs>\n"775 + " <rdf:Description rdf:about=\"http://example.org/b\">\n"776 + " <owl:sameAs>\n"777 + " <rdf:Description rdf:about=\"http://example.org/c\">\n"778 + " <owl:sameAs rdf:resource=\"http://example.org/d\"/></rdf:Description></owl:sameAs></rdf:Description></owl:sameAs></rdf:Description>\n"779 + "</rdf:RDF>";780 String conclusion = "";781 String id = "FS2RDF_no_builtin_prefixes_ar";782 TestClasses tc = TestClasses.valueOf("CONSISTENCY");783 String d = "Functional syntax to RDFXML checking that there aren't builtin prefixes for xsd, rdf, rdfs, owl";784 JUnitRunner r = new JUnitRunner(premise, conclusion, id, tc, d);785 r.setReasonerFactory(factory());786 r.run();787 }788 @Test789 public void testFS2RDF_same_individual_2_ar() {790 String premise = "<rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema#\" xmlns=\"http://example.org/\" xmlns:rdfs=\"http://www.w3.org/2000/01/rdf-schema#\" xmlns:owl=\"http://www.w3.org/2002/07/owl#\">\n"791 + " <owl:Ontology/>\n"792 + " <rdf:Description rdf:about=\"http://example.org/a\">\n"793 + " <owl:sameAs rdf:resource=\"http://example.org/b\"/></rdf:Description></rdf:RDF>";794 String conclusion = "";795 String id = "FS2RDF_same_individual_2_ar";796 TestClasses tc = TestClasses.valueOf("CONSISTENCY");797 String d = "Functional syntax to RDFXML translation of ontology consisting of a 2 argument SameIndividual";798 JUnitRunner r = new JUnitRunner(premise, conclusion, id, tc, d);799 r.setReasonerFactory(factory());800 r.run();801 }802 @Test803 public void testbnode2somevaluesfrom() {804 String premise = "<rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:owl=\"http://www.w3.org/2002/07/owl#\" xmlns:ex=\"http://example.org/\"\n"805 + " xml:base=\"http://example.org/\">\n"806 + " <owl:Ontology/>\n"807 + " <owl:ObjectProperty rdf:about=\"p\"/>\n"808 + " \n"809 + " <owl:Thing rdf:about=\"a\">\n"810 + " <ex:p><rdf:Description rdf:nodeID=\"x\"/></ex:p> </owl:Thing></rdf:RDF>";811 String conclusion = "<rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:ex=\"http://example.org/\" xmlns:owl=\"http://www.w3.org/2002/07/owl#\"\n"812 + " xml:base=\"http://example.org/\">\n"813 + " <owl:Ontology/>\n"814 + " <owl:ObjectProperty rdf:about=\"p\"/>\n"815 + " <owl:Thing rdf:about=\"a\">\n"816 + " <rdf:type>\n"817 + " <owl:Restriction>\n"818 + " <owl:onProperty rdf:resource=\"p\"/>\n"819 + " <owl:someValuesFrom rdf:resource=\"http://www.w3.org/2002/07/owl#Thing\"/></owl:Restriction></rdf:type></owl:Thing></rdf:RDF>";820 String id = "bnode2somevaluesfrom";821 TestClasses tc = TestClasses.valueOf("POSITIVE_IMPL");822 String d = "Shows that a BNode is an existential variable.";823 JUnitRunner r = new JUnitRunner(premise, conclusion, id, tc, d);824 r.setReasonerFactory(factory());825 r.run();826 }827 @Test828 public void testchain2trans1() {829 String premise = "<rdf:RDF \n"830 + " xml:base=\"http://example.org/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema#\" xmlns:rdfs=\"http://www.w3.org/2000/01/rdf-schema#\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:owl=\"http://www.w3.org/2002/07/owl#\">\n"831 + '\n'832 + " <owl:Ontology rdf:about=\"http://owl.semanticweb.org/page/Special:GetOntology/Chain2trans?m=p\"/>\n"833 + " <owl:ObjectProperty rdf:about=\"#p\"/>\n"834 + '\n'835 + " <rdf:Description rdf:about=\"#p\">\n"836 + " <owl:propertyChainAxiom rdf:parseType=\"Collection\">\n"837 + " <rdf:Description rdf:about=\"#p\"/>\n"838 + " <rdf:Description rdf:about=\"#p\"/></owl:propertyChainAxiom></rdf:Description>\n"839 + "</rdf:RDF>";840 String conclusion = "<?xml version=\"1.0\"?>\n"841 + "<rdf:RDF \n"842 + " xml:base=\"http://example.org/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema#\" xmlns:rdfs=\"http://www.w3.org/2000/01/rdf-schema#\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:owl=\"http://www.w3.org/2002/07/owl#\">\n"843 + " <owl:Ontology rdf:about=\"http://owl.semanticweb.org/page/Special:GetOntology/Chain2trans?m=c\"/>\n"844 + " <owl:TransitiveProperty rdf:about=\"#p\"/>\n"845 + "</rdf:RDF>";846 String id = "chain2trans1";847 TestClasses tc = TestClasses.valueOf("POSITIVE_IMPL");848 String d = "A role chain can be a synonym for transitivity.";849 JUnitRunner r = new JUnitRunner(premise, conclusion, id, tc, d);850 r.setReasonerFactory(factory());851 r.run();852 }853 @Test854 public void testConsistent_dateTime() {855 String premise = "Prefix(:=<http://example.org/>)\n"856 + "Prefix(xsd:=<http://www.w3.org/2001/XMLSchema#>)\n"857 + "Ontology(\n"858 + " Declaration(NamedIndividual(:a))\n"859 + " Declaration(DataProperty(:dp))\n"860 + " Declaration(Class(:A))\n"861 + " SubClassOf(:A \n"862 + " DataSomeValuesFrom(:dp DatatypeRestriction(\n"863 + " xsd:dateTime \n"864 + " xsd:minInclusive \"2008-10-08T20:44:11.656+01:00\"^^xsd:dateTime)\n"865 + " )\n"866 + " ) \n"867 + " SubClassOf(:A \n"868 + " DataAllValuesFrom(:dp DatatypeRestriction(\n"869 + " xsd:dateTime \n"870 + " xsd:maxInclusive \"2008-10-08T20:44:11.656+01:00\"^^xsd:dateTime)\n"871 + " )\n" + " )\n" + " ClassAssertion(:A :a)\n" + ')';872 String conclusion = "";873 String id = "Consistent_dateTime";874 TestClasses tc = TestClasses.valueOf("CONSISTENCY");875 String d = "The datatype restrictions leave exactly one dateTime value as dp filler for the individual a, so the ontology is consistent.";876 JUnitRunner r = new JUnitRunner(premise, conclusion, id, tc, d);877 r.setReasonerFactory(factory());878 r.run();879 }880 @Test881 public void testconsistent_integer_filler() {882 String premise = "Prefix(:=<http://example.org/>)\n"883 + "Prefix(xsd:=<http://www.w3.org/2001/XMLSchema#>)\n"884 + "Ontology(\n" + " Declaration(NamedIndividual(:a))\n"885 + " Declaration(DataProperty(:dp))\n"886 + " Declaration(Class(:A))\n"887 + " SubClassOf(:A DataHasValue(:dp \"18\"^^xsd:integer)) \n"888 + " ClassAssertion(:A :a) \n"889 + " ClassAssertion(DataAllValuesFrom(:dp xsd:integer) :a)\n"890 + ')';891 String conclusion = "";892 String id = "consistent_integer_filler";893 TestClasses tc = TestClasses.valueOf("CONSISTENCY");894 String d = "The individual a is in the extension of the class A, which implies that it has a hasAge filler of 18 as integer, which is consistent with the all values from integer assertion for a.";895 JUnitRunner r = new JUnitRunner(premise, conclusion, id, tc, d);896 r.setReasonerFactory(factory());897 r.run();898 }899 @Test900 public void testDatatype_DataComplementOf_001() {901 String premise = "<?xml version=\"1.0\"?>\n"902 + "<rdf:RDF\n"903 + " xml:base = \"http://example.org/\" xmlns = \"http://example.org/\" xmlns:owl = \"http://www.w3.org/2002/07/owl#\" xmlns:rdf = \"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:rdfs= \"http://www.w3.org/2000/01/rdf-schema#\" >\n"904 + '\n'905 + "<owl:Ontology/>\n"906 + '\n'907 + "<owl:DatatypeProperty rdf:about=\"p\" />\n"908 + '\n'909 + "<rdf:Description rdf:about=\"p\">\n"910 + " <rdfs:range>\n"911 + " <rdfs:Datatype>\n"912 + " <owl:datatypeComplementOf rdf:resource=\"http://www.w3.org/2001/XMLSchema#positiveInteger\" /></rdfs:Datatype></rdfs:range></rdf:Description>\n"913 + '\n'914 + "<rdf:Description rdf:about=\"i\">\n"915 + " <p rdf:datatype=\"http://www.w3.org/2001/XMLSchema#negativeInteger\">-1</p>\n"916 + " <p rdf:datatype=\"http://www.w3.org/2001/XMLSchema#string\">A string</p></rdf:Description>\n"917 + '\n' + "</rdf:RDF>";918 String conclusion = "";919 String id = "Datatype_DataComplementOf_001";920 TestClasses tc = TestClasses.valueOf("CONSISTENCY");921 String d = "Demonstrates that the complement of a datatype contains literals from other datatypes.";922 JUnitRunner r = new JUnitRunner(premise, conclusion, id, tc, d);923 r.setReasonerFactory(factory());924 r.run();925 }926 @Test927 public void testDifferent_types_in_Datatype_Restrictions_and_Complement() {928 String premise = "Prefix(:=<http://example.org/>)\n"929 + "Prefix(xsd:=<http://www.w3.org/2001/XMLSchema#>)\n"930 + "Ontology(\n" + " Declaration(NamedIndividual(:a))\n"931 + " Declaration(DataProperty(:dp))\n"932 + " Declaration(Class(:A))\n"933 + " SubClassOf(:A DataAllValuesFrom(:dp \n"934 + " DataOneOf(\"3\"^^xsd:integer \"4\"^^xsd:int))\n"935 + " ) \n" + " SubClassOf(:A DataAllValuesFrom(:dp \n"936 + " DataOneOf(\"2\"^^xsd:short \"3\"^^xsd:integer))\n"937 + " )\n" + " ClassAssertion(:A :a)\n"938 + " ClassAssertion(DataSomeValuesFrom(:dp\n"939 + " DataComplementOf(DataOneOf(\"3\"^^xsd:integer))) :a\n"940 + " )\n" + ')';941 String conclusion = "";942 String id = "Different_types_in_Datatype_Restrictions_and_Complement";943 TestClasses tc = TestClasses.valueOf("INCONSISTENCY");944 String d = "The individual a must have dp fillers that are in the sets {3, 4} and {2, 3} (different types are used, but shorts and ints are integers), but at the same time 3 is not allowed as a dp filler for a, which causes the inconsistency.";945 JUnitRunner r = new JUnitRunner(premise, conclusion, id, tc, d);946 r.setReasonerFactory(factory());947 r.run();948 }949 @Test950 public void testinconsistent_integer_filler() {951 String premise = "Prefix(:=<http://example.org/>)\n"952 + "Prefix(xsd:=<http://www.w3.org/2001/XMLSchema#>)\n"953 + "Ontology(\n"954 + " Declaration(NamedIndividual(:a))\n"955 + " Declaration(DataProperty(:hasAge))\n"956 + " Declaration(Class(:Eighteen))\n"957 + " SubClassOf(DataHasValue(:hasAge \"18\"^^xsd:integer) :Eighteen) \n"958 + " ClassAssertion(DataHasValue(:hasAge \"18\"^^xsd:integer) :a) \n"959 + " ClassAssertion(ObjectComplementOf(:Eighteen) :a)\n" + ')';960 String conclusion = "";961 String id = "inconsistent_integer_filler";962 TestClasses tc = TestClasses.valueOf("INCONSISTENCY");963 String d = "The individual has an asserted hasAge filler of 18 as integer. At the same time it is an instance of the negation of the class Eighteen, which implies that all hasAge fillers for a are not 18.";964 JUnitRunner r = new JUnitRunner(premise, conclusion, id, tc, d);965 r.setReasonerFactory(factory());966 r.run();967 }968 @Test969 public void testDisjointClasses_001() {970 String premise = "<?xml version=\"1.0\"?>\n"971 + "<rdf:RDF\n"972 + " xml:base = \"http://example.org/\" xmlns = \"http://example.org/\" xmlns:owl = \"http://www.w3.org/2002/07/owl#\" xmlns:rdf = \"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n"973 + '\n'974 + "<owl:Ontology/>\n"975 + '\n'976 + "<owl:Class rdf:about=\"Boy\" />\n"977 + "<owl:Class rdf:about=\"Girl\" />\n"978 + '\n'979 + "<rdf:Description rdf:about=\"Boy\">\n"980 + " <owl:disjointWith rdf:resource=\"Girl\" /></rdf:Description>\n"981 + '\n' + "<Boy rdf:about=\"Stewie\" />\n" + "</rdf:RDF>";982 String conclusion = "<?xml version=\"1.0\"?>\n"983 + "<rdf:RDF\n"984 + " xml:base = \"http://example.org/\" xmlns = \"http://example.org/\" xmlns:owl = \"http://www.w3.org/2002/07/owl#\" xmlns:rdf = \"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n"985 + '\n'986 + "<owl:Ontology/>\n"987 + '\n'988 + "<owl:Class rdf:about=\"Girl\" />\n"989 + '\n'990 + "<rdf:Description rdf:about=\"Stewie\">\n"991 + " <rdf:type>\n"992 + " <owl:Class>\n"993 + " <owl:complementOf rdf:resource=\"Girl\" /></owl:Class></rdf:type>\n"994 + "</rdf:Description>\n" + '\n' + "</rdf:RDF>";995 String id = "DisjointClasses_001";996 TestClasses tc = TestClasses.valueOf("POSITIVE_IMPL");997 String d = "Demonstrates a binary disjoint classes axiom based on example in the Structural Specification and Functional-Style Syntax document.";998 JUnitRunner r = new JUnitRunner(premise, conclusion, id, tc, d);999 r.setReasonerFactory(factory());1000 r.run();1001 }1002 @Test1003 public void testDisjointClasses_002() {1004 String premise = "<?xml version=\"1.0\"?>\n"1005 + "<rdf:RDF\n"1006 + " xml:base = \"http://example.org/\" xmlns = \"http://example.org/\" xmlns:owl = \"http://www.w3.org/2002/07/owl#\" xmlns:rdf = \"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n"1007 + '\n'1008 + "<owl:Ontology/>\n"1009 + '\n'1010 + "<owl:Class rdf:about=\"Boy\" />\n"1011 + "<owl:Class rdf:about=\"Girl\" />\n"1012 + '\n'1013 + "<rdf:Description rdf:about=\"Boy\">\n"1014 + " <owl:disjointWith rdf:resource=\"Girl\" /></rdf:Description>\n"1015 + '\n' + "<Boy rdf:about=\"Stewie\" />\n"1016 + "<Girl rdf:about=\"Stewie\" />\n" + '\n' + "</rdf:RDF>";1017 String conclusion = "";1018 String id = "DisjointClasses_002";1019 TestClasses tc = TestClasses.valueOf("INCONSISTENCY");1020 String d = "Demonstrates a binary disjoint classes axiom and class assertions causing an inconsistency based on example in the Structural Specification and Functional-Style Syntax document.";1021 JUnitRunner r = new JUnitRunner(premise, conclusion, id, tc, d);1022 r.setReasonerFactory(factory());1023 r.run();1024 }1025 @Test1026 public void testDisjointClasses_003() {1027 String premise = "<?xml version=\"1.0\"?>\n"1028 + "<rdf:RDF\n"1029 + " xml:base = \"http://example.org/\" xmlns = \"http://example.org/\" xmlns:owl = \"http://www.w3.org/2002/07/owl#\" xmlns:rdf = \"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n"1030 + '\n' + "<owl:Ontology/>\n" + '\n'1031 + "<owl:Class rdf:about=\"Boy\" />\n"1032 + "<owl:Class rdf:about=\"Girl\" />\n"1033 + "<owl:Class rdf:about=\"Dog\" />\n" + '\n'1034 + "<owl:AllDisjointClasses>\n"1035 + " <owl:members rdf:parseType=\"Collection\">\n"1036 + " <rdf:Description rdf:about=\"Boy\" />\n"1037 + " <rdf:Description rdf:about=\"Girl\" />\n"1038 + " <rdf:Description rdf:about=\"Dog\" />\n"1039 + " </owl:members></owl:AllDisjointClasses>\n" + '\n'1040 + "<Boy rdf:about=\"Stewie\" />\n" + '\n' + "</rdf:RDF>";1041 String conclusion = "<?xml version=\"1.0\"?>\n"1042 + "<rdf:RDF\n"1043 + " xml:base = \"http://example.org/\" xmlns = \"http://example.org/\" xmlns:owl = \"http://www.w3.org/2002/07/owl#\" xmlns:rdf = \"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n"1044 + '\n'1045 + "<owl:Ontology/>\n"1046 + '\n'1047 + "<owl:Class rdf:about=\"Girl\" />\n"1048 + "<owl:Class rdf:about=\"Dog\" />\n"1049 + '\n'1050 + "<rdf:Description rdf:about=\"Stewie\">\n"1051 + " <rdf:type>\n"1052 + " <owl:Class>\n"1053 + " <owl:complementOf rdf:resource=\"Girl\" /></owl:Class></rdf:type>\n"1054 + "</rdf:Description>\n"1055 + '\n'1056 + "<rdf:Description rdf:about=\"Stewie\">\n"1057 + " <rdf:type>\n"1058 + " <owl:Class>\n"1059 + " <owl:complementOf rdf:resource=\"Dog\" /></owl:Class></rdf:type>\n"1060 + "</rdf:Description>\n" + '\n' + "</rdf:RDF>";1061 String id = "DisjointClasses_003";1062 TestClasses tc = TestClasses.valueOf("POSITIVE_IMPL");1063 String d = "A modification of test DisjointClasses-001 to demonstrate a ternary disjoint classes axiom.";1064 JUnitRunner r = new JUnitRunner(premise, conclusion, id, tc, d);1065 r.setReasonerFactory(factory());1066 r.run();1067 }1068}...

Full Screen

Full Screen

Source:JUnitCore.java Github

copy

Full Screen

1package org.junit.runner;2import java.util.ArrayList;3import java.util.List;4import junit.runner.Version;5import org.junit.internal.JUnitSystem;6import org.junit.internal.RealSystem;7import org.junit.internal.TextListener;8import org.junit.internal.runners.JUnit38ClassRunner;9import org.junit.runner.notification.Failure;10import org.junit.runner.notification.RunListener;11import org.junit.runner.notification.RunNotifier;12/**13 * <code>JUnitCore</code> is a facade for running tests. It supports running JUnit 4 tests,14 * JUnit 3.8.x tests, and mixtures. To run tests from the command line, run15 * <code>java org.junit.runner.JUnitCore TestClass1 TestClass2 ...</code>.16 * For one-shot test runs, use the static method {@link #runClasses(Class[])}.17 * If you want to add special listeners,18 * create an instance of {@link org.junit.runner.JUnitCore} first and use it to run the tests.19 *20 * @see org.junit.runner.Result21 * @see org.junit.runner.notification.RunListener22 * @see org.junit.runner.Request23 * @since 4.024 */25public class JUnitCore {26 private final RunNotifier fNotifier = new RunNotifier();27 /**28 * Run the tests contained in the classes named in the <code>args</code>.29 * If all tests run successfully, exit with a status of 0. Otherwise exit with a status of 1.30 * Write feedback while tests are running and write31 * stack traces for all failed tests after the tests all complete.32 *33 * @param args names of classes in which to find tests to run34 */35 public static void main(String... args) {36 runMainAndExit(new RealSystem(), args);37 }38 /**39 * Runs main and exits40 */41 private static void runMainAndExit(JUnitSystem system, String... args) {42 Result result = new JUnitCore().runMain(system, args);43 System.exit(result.wasSuccessful() ? 0 : 1);44 }45 /**46 * Run the tests contained in <code>classes</code>. Write feedback while the tests47 * are running and write stack traces for all failed tests after all tests complete. This is48 * similar to {@link #main(String[])}, but intended to be used programmatically.49 *50 * @param computer Helps construct Runners from classes51 * @param classes Classes in which to find tests52 * @return a {@link Result} describing the details of the test run and the failed tests.53 */54 public static Result runClasses(Computer computer, Class<?>... classes) {55 return new JUnitCore().run(computer, classes);56 }57 /**58 * Run the tests contained in <code>classes</code>. Write feedback while the tests59 * are running and write stack traces for all failed tests after all tests complete. This is60 * similar to {@link #main(String[])}, but intended to be used programmatically.61 *62 * @param classes Classes in which to find tests63 * @return a {@link Result} describing the details of the test run and the failed tests.64 */65 public static Result runClasses(Class<?>... classes) {66 return new JUnitCore().run(defaultComputer(), classes);67 }68 /**69 * @param system70 * @args args from main()71 */72 private Result runMain(JUnitSystem system, String... args) {73 system.out().println("JUnit version " + Version.id());74 List<Class<?>> classes = new ArrayList<Class<?>>();75 List<Failure> missingClasses = new ArrayList<Failure>();76 for (String each : args) {77 try {78 classes.add(Class.forName(each));79 } catch (ClassNotFoundException e) {80 system.out().println("Could not find class: " + each);81 Description description = Description.createSuiteDescription(each);82 Failure failure = new Failure(description, e);83 missingClasses.add(failure);84 }85 }86 RunListener listener = new TextListener(system);87 addListener(listener);88 Result result = run(classes.toArray(new Class[0]));89 for (Failure each : missingClasses) {90 result.getFailures().add(each);91 }92 return result;93 }94 /**95 * @return the version number of this release96 */97 public String getVersion() {98 return Version.id();99 }100 /**101 * Run all the tests in <code>classes</code>.102 *103 * @param classes the classes containing tests104 * @return a {@link Result} describing the details of the test run and the failed tests.105 */106 public Result run(Class<?>... classes) {107 return run(Request.classes(defaultComputer(), classes));108 }109 /**110 * Run all the tests in <code>classes</code>.111 *112 * @param computer Helps construct Runners from classes...

Full Screen

Full Screen

Source:JUnit4ConfigTest.java Github

copy

Full Screen

1// Copyright 2010 The Bazel Authors. All Rights Reserved.2//3// Licensed under the Apache License, Version 2.0 (the "License");4// you may not use this file except in compliance with the License.5// You may obtain a copy of the License at6//7// http://www.apache.org/licenses/LICENSE-2.08//9// Unless required by applicable law or agreed to in writing, software10// distributed under the License is distributed on an "AS IS" BASIS,11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.12// See the License for the specific language governing permissions and13// limitations under the License.14package com.google.testing.junit.runner.junit4;15import static com.google.testing.junit.runner.junit4.JUnit4Config.JUNIT_API_VERSION_PROPERTY;16import static com.google.testing.junit.runner.junit4.JUnit4Config.SHOULD_INSTALL_SECURITY_MANAGER_PROPERTY;17import static org.junit.Assert.assertEquals;18import static org.junit.Assert.assertFalse;19import static org.junit.Assert.assertTrue;20import static org.junit.Assert.fail;21import com.google.testing.junit.runner.util.GoogleTestSecurityManager;22import java.util.Properties;23import org.junit.Test;24import org.junit.runner.RunWith;25import org.junit.runners.JUnit4;26/**27 * Tests for {@link JUnit4Config}.28 */29@RunWith(JUnit4.class)30public class JUnit4ConfigTest {31 private JUnit4Config createConfigWithApiVersion(String apiVersion) {32 Properties properties = new Properties();33 properties.put(JUNIT_API_VERSION_PROPERTY, apiVersion);34 return createConfigWithProperties(properties);35 }36 private JUnit4Config createConfigWithProperties(Properties properties) {37 return new JUnit4Config("", null, null, properties);38 }39 @Test40 public void testGetJUnitRunnerApiVersion_defaultValue() {41 JUnit4Config config = createConfigWithApiVersion("1");42 assertEquals(1, config.getJUnitRunnerApiVersion());43 }44 @Test45 public void testGetJUnitRunnerApiVersion_failsIfNotNumeric() {46 JUnit4Config config = createConfigWithApiVersion("I love pesto");47 try {48 config.getJUnitRunnerApiVersion();49 fail("exception expected");50 } catch (IllegalStateException expected) {51 assertTrue(expected.getMessage().contains("I love pesto"));52 }53 }54 @Test55 public void testGetJUnitRunnerApiVersion_failsIfNotAnInteger() {56 JUnit4Config config = createConfigWithApiVersion("3.14");57 try {58 config.getJUnitRunnerApiVersion();59 fail("exception expected");60 } catch (IllegalStateException expected) {61 assertTrue(expected.getMessage().contains("3.14"));62 }63 }64 @Test65 public void testGetJUnitRunnerApiVersion_failsIfNotOne() {66 JUnit4Config config = createConfigWithApiVersion("13");67 try {68 config.getJUnitRunnerApiVersion();69 fail("exception expected");70 } catch (IllegalStateException expected) {71 assertTrue(expected.getMessage().contains("13"));72 }73 }74 @Test75 public void testGetJUnitRunnerApiVersion_oneIsValid() {76 JUnit4Config config = createConfigWithApiVersion("1");77 assertEquals(1, config.getJUnitRunnerApiVersion());78 }79 @Test80 public void testShouldInstallSecurityManager_defaultValue() {81 GoogleTestSecurityManager.uninstallIfInstalled();82 JUnit4Config config = createConfigWithProperties(new Properties());83 assertTrue(config.shouldInstallSecurityManager());84 }85 @Test86 public void testShouldInstallSecurityManager_securityManagerPropertySet() {87 Properties properties = new Properties();88 properties.put("java.security.manager", "MySecurityManager");89 properties.put(SHOULD_INSTALL_SECURITY_MANAGER_PROPERTY, "true");90 JUnit4Config config = createConfigWithProperties(properties);91 assertFalse(config.shouldInstallSecurityManager());...

Full Screen

Full Screen

Source:VerboseMockitoJUnitRunner.java Github

copy

Full Screen

1/*2 * Copyright (c) 2007 Mockito contributors3 * This program is made available under the terms of the MIT License.4 */5package org.mockito.runners;6import org.junit.runner.Description;7import org.junit.runner.Runner;8import org.junit.runner.manipulation.Filter;9import org.junit.runner.manipulation.Filterable;10import org.junit.runner.manipulation.NoTestsRemainException;11import org.junit.runner.notification.Failure;12import org.junit.runner.notification.RunListener;13import org.junit.runner.notification.RunNotifier;14import org.mockito.internal.debugging.WarningsCollector;15import org.mockito.internal.runners.RunnerFactory;16import org.mockito.internal.runners.RunnerImpl;17import org.mockito.internal.util.junit.JUnitFailureHacker;18import java.lang.reflect.InvocationTargetException;19/**20 * Experimental implementation that suppose to improve tdd/testing experience. 21 * Don't hesitate to send feedback to mockito@googlegroups.com22 * <b>It is very likely it will change in the next version!</b>23 * <p>24 * This runner does exactly what {@link MockitoJUnitRunner} does but also 25 * adds extra Mocktio hints to the exception message. 26 * The point is that Mockito should help the tdd developer to quickly figure out if the test fails for the right reason and track the reason. 27 * <p>28 * The implementation is pretty hacky - it uses brute force of reflection to modify the exception message and add extra mockito hints.29 * You've been warned. 30 * <p>31 * Do you think it is useful or not? Drop us an email at mockito@googlegroups.com32 * <p>33 * Experimental implementation - will change in future!34 */35public class VerboseMockitoJUnitRunner extends Runner implements Filterable {36 private final RunnerImpl runner;37 public VerboseMockitoJUnitRunner(Class<?> klass) throws InvocationTargetException {38 this(new RunnerFactory().create(klass));39 }40 41 VerboseMockitoJUnitRunner(RunnerImpl runnerImpl) {42 this.runner = runnerImpl;43 }44 45 @Override46 public void run(RunNotifier notifier) { 47 //a listener that changes the failure's exception in a very hacky way...48 RunListener listener = new RunListener() {49 50 WarningsCollector warningsCollector;51 52 @Override53 public void testStarted(Description description) throws Exception {54 warningsCollector = new WarningsCollector();55 }56 57 @Override 58 public void testFailure(final Failure failure) throws Exception { 59 String warnings = warningsCollector.getWarnings();60 new JUnitFailureHacker().appendWarnings(failure, warnings); 61 }62 };63 notifier.addFirstListener(listener);64 runner.run(notifier);65 }66 @Override67 public Description getDescription() {68 return runner.getDescription();69 }70 71 public void filter(Filter filter) throws NoTestsRemainException {72 //filter is required because without it UnrootedTests show up in Eclipse73 runner.filter(filter);74 }75}...

Full Screen

Full Screen

Version

Using AI Code Generation

copy

Full Screen

1import junit.runner.Version;2import java.util.Date;3public class JunitVersion {4 public static void main(String[] args) {5 System.out.println("JUnit version: " + Version.id());6 System.out.println("Current date: " + new Date());7 }8}

Full Screen

Full Screen

Version

Using AI Code Generation

copy

Full Screen

1import junit.runner.Version;2Version v = new Version();3System.out.println(v.id());4package com.journaldev.junit;5public class Version {6 public static void main(String[] args) {7 junit.runner.Version v = new junit.runner.Version();8 System.out.println(v.id());9 }10}

Full Screen

Full Screen

Version

Using AI Code Generation

copy

Full Screen

1import org.junit.runner.Version;2Version.identify();3import org.junit.Version;4Version.id();5import org.junit.framework.Version;6Version.id();

Full Screen

Full Screen

Version

Using AI Code Generation

copy

Full Screen

1public class Main{2 public static void main(String[] args) {3 System.out.println("Hello JUnit 4.12");4 System.out.println("Hello JUnit " + Version.id());5 }6}7package com.journaldev.junit5;8import org.junit.platform.console.ConsoleLauncher;9import org.junit.platform.engine.discovery.DiscoverySelectors;10import org.junit.platform.launcher.LauncherDiscoveryRequest;11import org.junit.platform.launcher.core.LauncherDiscoveryRequestBuilder;12import org.junit.platform.launcher.core.LauncherFactory;13public class Main {14 public static void main(String[] args) {15 LauncherDiscoveryRequest request = LauncherDiscoveryRequestBuilder.request()16 .selectors(DiscoverySelectors.selectClass(TestJunit5.class))17 .build();18 ConsoleLauncher.execute(request);19 }20}21package com.journaldev.junit5;22import org.junit.jupiter.api.Test;23public class TestJunit5 {24 public void testJUnit5() {25 System.out.println("Hello JUnit 5");26 }27}

Full Screen

Full Screen

Version

Using AI Code Generation

copy

Full Screen

1import junit.runner.Version;2import org.apache.maven.artifact.versioning.ComparableVersion;3public class VersionCompare {4 public static void main(String[] args) {5 System.out.println("junit.runner.Version");6 System.out.println("1.0.0 and 1.0.0: " + Version.id("1.0.0").compareTo(Version.id("1.0.0")));7 System.out.println("1.0.0 and 1.0.1: " + Version.id("1.0.0").compareTo(Version.id("1.0.1")));8 System.out.println("1.0.1 and 1.0.0: " + Version.id("1.0.1").compareTo(Version.id("1.0.0")));9 System.out.println("1.0.0 and 1.1.0: " + Version.id("1.0.0").compareTo(Version.id("1.1.0")));10 System.out.println("1.1.0 and 1.0.0: " + Version.id("1.1.0").compareTo(Version.id("1.0.0")));11 System.out.println("1.0.0 and 2.0.0: " + Version.id("1.0.0").compareTo(Version.id("2.0.0")));12 System.out.println("2.0.0 and 1.0.0: " + Version.id("2.0.0").compareTo(Version.id("1.0.0")));13 System.out.println("1.0.0 and 10.0.0: " + Version.id("1.0.0").compareTo(Version.id("10.0.0")));14 System.out.println("10.0.0 and 1.0.0: " + Version.id("10.0.0").compareTo(Version.id("1.0.0")));15 System.out.println("1.0.0 and

Full Screen

Full Screen

Version

Using AI Code Generation

copy

Full Screen

1import static org.junit.Assert.*;2import java.util.ArrayList;3import java.util.Arrays;4import java.util.List;5import org.junit.Test;6import org.junit.runner.JUnitCore;7import org.junit.runner.Result;8import org.junit.runner.notification.Failure;9public class JunitTestRunner {10 public static void main(String[] args) {11 Result result = JUnitCore.runClasses(JunitTestRunner.class);12 for(Failure failure : result.getFailures()) {13 System.out.println(failure.toString());14 }15 System.out.println(result.wasSuccessful());16 }17 public void test() {18 List<String> actual = new ArrayList<String>();19 List<String> expected = Arrays.asList("a", "b", "c");20 actual.add("a");21 actual.add("b");22 actual.add("c");23 assertEquals(expected, actual);24 }25}

Full Screen

Full Screen
copy
1//oversimplified for demontration purposes2public class TestParameters {3 private String testName = null;4 private String testDescription = null;56 public TestParameters(String name,7 String description) {8 this.testName = name;9 this.testDescription = description;10 }1112 public String getTestName() {13 return testName;14 }15 public String getTestDescription() {16 return testDescription;17 }18}1920public class SampleTest implements ITest {21 // Has to be set to prevent NullPointerException from reporters22 protected String mTestCaseName = "";2324 @DataProvider(name="BasicDataProvider")25 public Object[][] getTestData() {26 Object[][] data = new Object[][] {27 { new TestParameters("TestCase1", "Sample test 1")},28 { new TestParameters("TestCase2", "Sample test 2")},29 { new TestParameters("TestCase3", "Sample test 3")},30 { new TestParameters("TestCase4", "Sample test 4")},31 { new TestParameters("TestCase5", "Sample test 5") }32 };33 return data;34 }3536 @BeforeMethod(alwaysRun = true)37 public void testData(Method method, Object[] testData) {38 String testCase = "";39 if (testData != null && testData.length > 0) {40 TestParameters testParams = null;41 //Check if test method has actually received required parameters42 for (Object testParameter : testData) {43 if (testParameter instanceof TestParameters) {44 testParams = (TestParameters)testParameter;45 break;46 }47 }48 if (testParams != null) {49 testCase = testParams.getTestName();50 }51 }52 this.mTestCaseName = String.format("%s(%s)", method.getName(), testCase);53 }5455 @Override56 public String getTestName() {57 return this.mTestCaseName;58 }5960 @Test(dataProvider="BasicDataProvider")61 public void testSample1(TestParameters testParams){62 //test code here63 }6465 @Test(dataProvider="BasicDataProvider")66 public void testSample2(TestParameters testParams){67 //test code here68 }6970 @Test71 public void testSample3(){72 //test code here73 }74}75
Full Screen
copy
1public String getTestName()2{3 String name = testName;4 StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();//.toString();5 if(calledFrom(stackTrace, "XMLSuiteResultWriter"))6 {7 name = testNames.size()>0?testNames.get(xmlNameIndex<testNames.size()?xmlNameIndex:0):"undefined";8 xmlNameIndex++;9 if(xmlNameIndex>=testNames.size())10 xmlNameIndex = 0;11 }12 else if(calledFrom(stackTrace, "EmailableReporter"))13 {14 name = testNames.size()>0?testNames.get(emailNameIndex<testNames.size()?emailNameIndex:0):"undefined";15 emailNameIndex++;16 if(emailNameIndex>=testNames.size())17 emailNameIndex = 0;18 }19 if(calledFrom(stackTrace, "TestHTMLReporter"))20 {21 if(testNames.size()<0)22 {23 name = "undefined";24 }25 else26 {27 if(htmlNameIndex < testNamesFailed.size())28 {29 name = testNamesFailed.get(htmlNameIndex);30 }31 else32 {33 int htmlPassedIndex = htmlNameIndex - testNamesFailed.size();34 if(htmlPassedIndex < testNamesPassed.size())35 {36 name = testNamesPassed.get(htmlPassedIndex);37 }38 else39 {40 name = "undefined";41 }42 }43 }44 htmlNameIndex++;45 if(htmlNameIndex>=testNames.size())46 htmlNameIndex = 0;47 }48 return name;49}5051private boolean calledFrom(StackTraceElement[] stackTrace, String checkForMethod)52{53 boolean calledFrom = false;54 for(StackTraceElement element : stackTrace)55 {56 String stack = element.toString();57 if(stack.contains(checkForMethod))58 calledFrom = true;59 }60 return calledFrom;61}62
Full Screen
copy
1public class NinjaTest {2...3...4@AfterMethod (alwaysRun = true)5public void afterMethod(ITestResult result, Method method) {6 try {7 //I have XML test suites organized in directories. 8 String xmlFile = result.getTestContext().getCurrentXmlTest().getSuite().getFileName();9 String suiteName = xmlFile.substring(xmlFile.lastIndexOf("\\") + 1, xmlFile.lastIndexOf(".xml"));10 String pathToFile = xmlFile.substring(0, xmlFile.lastIndexOf("\\") );11 String directory = pathToFile.substring(pathToFile.lastIndexOf("\\") + 1);12 String testMethodName = String.format("%s/%s - %s", directory, suiteName, method.getName());1314 //Total hack to change display name in HTML report \(^o^)/ 15 Field methodName = org.testng.internal.BaseTestMethod.class.getDeclaredField("m_methodName");16 methodName.setAccessible(true);17 methodName.set(result.getMethod(), testMethodName);18 } catch (Exception e) {19 // Eh.... ¯\_(ツ)_/¯20 e.printStackTrace();21 }22}23...24...25
Full Screen

JUnit Tutorial:

LambdaTest also has a detailed JUnit tutorial explaining its features, importance, advanced use cases, best practices, and more to help you get started with running your automation testing scripts.

JUnit Tutorial Chapters:

Here are the detailed JUnit testing chapters to help you get started:

  • Importance of Unit testing - Learn why Unit testing is essential during the development phase to identify bugs and errors.
  • Top Java Unit testing frameworks - Here are the upcoming JUnit automation testing frameworks that you can use in 2023 to boost your unit testing.
  • What is the JUnit framework
  • Why is JUnit testing important - Learn the importance and numerous benefits of using the JUnit testing framework.
  • Features of JUnit - Learn about the numerous features of JUnit and why developers prefer it.
  • JUnit 5 vs. JUnit 4: Differences - Here is a complete comparison between JUnit 5 and JUnit 4 testing frameworks.
  • Setting up the JUnit environment - Learn how to set up your JUnit testing environment.
  • Getting started with JUnit testing - After successfully setting up your JUnit environment, this chapter will help you get started with JUnit testing in no time.
  • Parallel testing with JUnit - Parallel Testing can be used to reduce test execution time and improve test efficiency. Learn how to perform parallel testing with JUnit.
  • Annotations in JUnit - When writing automation scripts with JUnit, we can use JUnit annotations to specify the type of methods in our test code. This helps us identify those methods when we run JUnit tests using Selenium WebDriver. Learn in detail what annotations are in JUnit.
  • Assertions in JUnit - Assertions are used to validate or test that the result of an action/functionality is the same as expected. Learn in detail what assertions are and how to use them while performing JUnit testing.
  • Parameterization in JUnit - Parameterized Test enables you to run the same automated test scripts with different variables. By collecting data on each method's test parameters, you can minimize time spent on writing tests. Learn how to use parameterization in JUnit.
  • Nested Tests In JUnit 5 - A nested class is a non-static class contained within another class in a hierarchical structure. It can share the state and setup of the outer class. Learn about nested annotations in JUnit 5 with examples.
  • Best practices for JUnit testing - Learn about the best practices, such as always testing key methods and classes, integrating JUnit tests with your build, and more to get the best possible results.
  • Advanced Use Cases for JUnit testing - Take a deep dive into the advanced use cases, such as how to run JUnit tests in Jupiter, how to use JUnit 5 Mockito for Unit testing, and more for JUnit testing.

JUnit Certification:

You can also check out our JUnit certification if you wish to take your career in Selenium automation testing with JUnit to the next level.

Run junit automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Most used methods in Version

Test Your Web Or Mobile Apps On 3000+ Browsers

Signup for free

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful