use of fr.lirmm.graphik.util.Prefix in project graal by graphik-team.
the class OWL2ParserTest method dataRangeComplementOf.
@Test
public void dataRangeComplementOf() throws OWL2ParserException {
// D(Y) :- p(X, Y).
OWL2Parser parser = new OWL2Parser(PREFIXES + ":p rdf:type owl:DatatypeProperty . " + ":D rdf:type rdfs:Datatype ." + ":E rdf:type rdfs:Datatype." + ":p rdfs:range [owl:complementOf [owl:intersectionOf ( :D :E ) ]] .");
int nbAssertions = 0;
while (parser.hasNext()) {
Object o = parser.next();
if (!(o instanceof Prefix)) {
Assert.assertTrue(o instanceof Rule);
++nbAssertions;
}
}
parser.close();
Assert.assertEquals("Number of assertions found:", 1, nbAssertions);
}
use of fr.lirmm.graphik.util.Prefix in project graal by graphik-team.
the class OWL2ParserTest method illegalAllValuesFromMaskedInIntersection.
@Test
public void illegalAllValuesFromMaskedInIntersection() throws OWL2ParserException {
OWL2Parser parser = new OWL2Parser(PREFIXES + " :A a owl:Class. " + ":B a owl:Class. :C a owl:Class. " + ":p a owl:ObjectProperty. " + "[owl:intersectionOf ( :A [rdf:type owl:Restriction; " + " owl:onProperty :p ; " + " owl:allValuesFrom :B] ) ] rdfs:subClassOf :C .");
int nbAssertion = 0;
while (parser.hasNext()) {
Object o = parser.next();
if (!(o instanceof Prefix)) {
++nbAssertion;
}
}
parser.close();
Assert.assertEquals("Number of assertions found:", 0, nbAssertion);
}
use of fr.lirmm.graphik.util.Prefix in project graal by graphik-team.
the class OWL2ParserTest method hasKeyWithUnion.
@Test
public void hasKeyWithUnion() throws OWL2ParserException {
OWL2Parser parser = new OWL2Parser(PREFIXES + ":A a owl:Class . " + ":B a owl:Class . " + ":p a owl:ObjectProperty . " + ":q a owl:DatatypeProperty . " + "[owl:unionOf( :A :B [owl:oneOf (:i1)] ) ] owl:hasKey (:p :q) .");
int nbAssertions = 0;
while (parser.hasNext()) {
Object o = parser.next();
if (!(o instanceof Prefix)) {
Assert.assertTrue(o instanceof Rule);
++nbAssertions;
}
}
parser.close();
Assert.assertEquals("Number of assertions found:", 6, nbAssertions);
}
use of fr.lirmm.graphik.util.Prefix in project graal by graphik-team.
the class OWL2ParserTest method hasKey.
// /////////////////////////////////////////////////////////////////////////
// HAS KEY
// /////////////////////////////////////////////////////////////////////////
@Test
public void hasKey() throws OWL2ParserException {
OWL2Parser parser = new OWL2Parser(PREFIXES + ":A a owl:Class . " + ":p a owl:ObjectProperty . " + ":q a owl:ObjectProperty . " + ":A owl:hasKey (:p :q) .");
int nbAssertions = 0;
while (parser.hasNext()) {
Object o = parser.next();
if (!(o instanceof Prefix)) {
Assert.assertTrue(o instanceof Rule);
++nbAssertions;
}
}
parser.close();
Assert.assertEquals("Number of assertions found:", 1, nbAssertions);
}
use of fr.lirmm.graphik.util.Prefix in project graal by graphik-team.
the class OWL2ParserTest method objectPropertyDomain.
@Test
public void objectPropertyDomain() {
// C(Y) :- p(X, Y).
try {
OWL2Parser parser = new OWL2Parser(PREFIXES + ":p rdf:type owl:ObjectProperty . " + ":A rdf:type owl:Class . " + ":p rdfs:domain :A .");
boolean found = false;
while (parser.hasNext()) {
Object o = parser.next();
if (!(o instanceof Prefix)) {
Rule r = (Rule) o;
Atom property = (Atom) r.getBody().iterator().next();
Assert.assertEquals(P, property.getPredicate());
Atom classs = (Atom) r.getHead().iterator().next();
Assert.assertEquals(A, classs.getPredicate());
Assert.assertEquals(property.getTerm(0), classs.getTerm(0));
found = true;
}
}
parser.close();
Assert.assertTrue("Number of assertions found:", found);
} catch (Exception e) {
Assert.assertFalse(e.getMessage(), true);
}
}
Aggregations