本文整理汇总了Java中org.openrdf.model.vocabulary.OWL.THING属性的典型用法代码示例。如果您正苦于以下问题:Java OWL.THING属性的具体用法?Java OWL.THING怎么用?Java OWL.THING使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.openrdf.model.vocabulary.OWL
的用法示例。
在下文中一共展示了OWL.THING属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testGeneralConsequent
@Test
public void testGeneralConsequent() throws Exception {
String text = "CONSTRUCT {\n"
+ " ?x ?p2 ?y"
+ "} WHERE {\n"
+ " ?x ?p1 ?y .\n"
+ " ?p1 rdfs:subPropertyOf ?p2 .\n"
+ "}";
ParsedGraphQuery query = (ParsedGraphQuery) PARSER.parseQuery(text, null);
SpinConstructRule rule = new SpinConstructRule(OWL.THING, RL_PRP_SPO1, query);
Multiset<StatementPattern> expectedAntecedents = HashMultiset.create(Arrays.asList(
new StatementPattern(new Var("p1"), ac(RDFS.SUBPROPERTYOF), new Var("p2")),
new StatementPattern(new Var("x"), new Var("p1"), new Var("y"))));
Multiset<StatementPattern> expectedConsequents = HashMultiset.create(Arrays.asList(
new StatementPattern(new Var("subject"), new Var("predicate"), new Var("object"))));
Assert.assertEquals(expectedAntecedents, HashMultiset.create(rule.getAntecedentPatterns()));
Assert.assertEquals(expectedConsequents, HashMultiset.create(rule.getConsequentPatterns()));
Assert.assertFalse(rule.hasAnonymousConsequent());
// Basic pattern matches
Assert.assertTrue(rule.canConclude(new StatementPattern(new Var("a"), new Var("b"), new Var("c"))));
// Narrower patterns match (constants in place of variables)
Assert.assertTrue(rule.canConclude(new StatementPattern(new Var("x"), c(RDFS.SUBPROPERTYOF), c(OWL.THING))));
Assert.assertTrue(rule.canConclude(new StatementPattern(c(OWL.NOTHING), new Var("prop"), c(OWL.THING))));
Assert.assertTrue(rule.canConclude(new StatementPattern(c(FOAF.PERSON), c(RDFS.SUBCLASSOF), new Var("x"))));
Assert.assertTrue(rule.canConclude(new StatementPattern(c(OWL.NOTHING), c(RDFS.SUBCLASSOF), c(FOAF.PERSON))));
}
示例2: testThisUnbound
@Test
public void testThisUnbound() throws Exception {
String text = "CONSTRUCT {\n"
+ " ?ind a ?superclass .\n"
+ "} WHERE {\n"
+ " ?ind a ?subclass .\n"
+ " ?subclass rdfs:subClassOf ?superclass .\n"
+ "}";
ParsedGraphQuery query = (ParsedGraphQuery) PARSER.parseQuery(text, null);
SpinConstructRule rule = new SpinConstructRule(OWL.THING, RL_CAX_SCO, query);
Multiset<StatementPattern> expectedAntecedents = HashMultiset.create(Arrays.asList(
new StatementPattern(new Var("subclass"), ac(RDFS.SUBCLASSOF), new Var("superclass")),
new StatementPattern(new Var("ind"), ac(RDF.TYPE), new Var("subclass"))));
Multiset<StatementPattern> expectedConsequents = HashMultiset.create(Arrays.asList(
new StatementPattern(new Var("subject"), new Var("predicate", RDF.TYPE), new Var("object"))));
Assert.assertEquals(expectedAntecedents, HashMultiset.create(rule.getAntecedentPatterns()));
Assert.assertEquals(expectedConsequents, HashMultiset.create(rule.getConsequentPatterns()));
Assert.assertFalse(rule.hasAnonymousConsequent());
// Basic pattern matches
Assert.assertTrue(rule.canConclude(new StatementPattern(new Var("x"), c(RDF.TYPE), new Var("y"))));
// Broader patterns match (variables in place of constants)
Assert.assertTrue(rule.canConclude(new StatementPattern(new Var("a"), new Var("b"), new Var("c"))));
// Narrower patterns match (constants in place of variables)
Assert.assertTrue(rule.canConclude(new StatementPattern(c(RDF.TYPE), c(RDF.TYPE), c(RDF.TYPE))));
// Incompatible patterns don't match (different constants)
Assert.assertFalse(rule.canConclude(new StatementPattern(new Var("x"), c(RDFS.SUBCLASSOF), new Var("y"))));
}
示例3: testAnonymousConsequent
@Test
public void testAnonymousConsequent() throws Exception {
String text = "CONSTRUCT {\n"
+ " ?x ?p2 _:something"
+ "} WHERE {\n"
+ " ?x ?p1 ?y .\n"
+ " ?p1 rdfs:subPropertyOf ?p2 .\n"
+ "}";
ParsedGraphQuery query = (ParsedGraphQuery) PARSER.parseQuery(text, null);
SpinConstructRule rule = new SpinConstructRule(OWL.THING, RL_PRP_SPO1, query);
Multiset<StatementPattern> expectedAntecedents = HashMultiset.create(Arrays.asList(
new StatementPattern(new Var("p1"), ac(RDFS.SUBPROPERTYOF), new Var("p2")),
new StatementPattern(new Var("x"), new Var("p1"), new Var("y"))));
Assert.assertEquals(expectedAntecedents, HashMultiset.create(rule.getAntecedentPatterns()));
// should have detected anonymous node
Assert.assertTrue(rule.hasAnonymousConsequent());
Var anonymousObject = new Var("object");
anonymousObject.setAnonymous(true);
Multiset<StatementPattern> expectedConsequents = HashMultiset.create(Arrays.asList(
new StatementPattern(new Var("subject"), new Var("predicate"), anonymousObject)));
Assert.assertEquals(expectedConsequents, HashMultiset.create(rule.getConsequentPatterns()));
// Pattern matches should be unaffected by anonymous node status
Assert.assertTrue(rule.canConclude(new StatementPattern(new Var("a"), new Var("b"), new Var("c"))));
Assert.assertTrue(rule.canConclude(new StatementPattern(new Var("x"), c(RDFS.SUBPROPERTYOF), c(OWL.THING))));
Assert.assertTrue(rule.canConclude(new StatementPattern(c(OWL.NOTHING), new Var("prop"), c(OWL.THING))));
Assert.assertTrue(rule.canConclude(new StatementPattern(c(FOAF.PERSON), c(RDFS.SUBCLASSOF), new Var("x"))));
Assert.assertTrue(rule.canConclude(new StatementPattern(c(OWL.NOTHING), c(RDFS.SUBCLASSOF), c(FOAF.PERSON))));
}