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 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 assertionDataProperty.
@Test
public void assertionDataProperty() throws OWL2ParserException, IteratorException {
OWL2Parser parser = new OWL2Parser(PREFIXES + ":p rdf:type owl:DatatypeProperty . " + ":i1 :p 7 ." + "");
boolean found = false;
while (parser.hasNext()) {
Object o = parser.next();
if (!(o instanceof Prefix)) {
AtomSet atomset = (AtomSet) o;
Atom a = atomset.iterator().next();
Assert.assertEquals(P, a.getPredicate());
Iterator<Term> it = a.iterator();
Assert.assertEquals(I1, it.next());
Assert.assertEquals(L1, it.next());
found = true;
}
}
parser.close();
Assert.assertTrue("Number of assertions found:", found);
}
use of fr.lirmm.graphik.util.Prefix in project graal by graphik-team.
the class OWL2ParserTest method objectPropertyRange.
// /////////////////////////////////////////////////////////////////////////
//
// /////////////////////////////////////////////////////////////////////////
@Test
public void objectPropertyRange() {
// C(Y) :- p(X, Y).
try {
OWL2Parser parser = new OWL2Parser(PREFIXES + ":p rdf:type owl:ObjectProperty . " + ":A rdf:type owl:Class . " + ":p rdfs:range :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(1), classs.getTerm(0));
found = true;
}
}
parser.close();
Assert.assertTrue("Number of assertions found:", found);
} catch (Exception e) {
Assert.assertFalse(e.getMessage(), true);
}
}
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);
}
Aggregations