本文整理了Java中openllet.owlapi.OWL.ObjectProperty()
方法的一些代码示例,展示了OWL.ObjectProperty()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。OWL.ObjectProperty()
方法的具体详情如下:
包路径:openllet.owlapi.OWL
类名称:OWL
方法名:ObjectProperty
暂无
代码示例来源:origin: Galigator/openllet
private static OWLEntity createEntity(final String type, final String entityIRI)
{
if (CLASS_KEYWORD.equals(type))
return OWL.Class(entityIRI);
else
if (DATA_TYPE_KEYWORD.equals(type))
return OWL.Datatype(entityIRI);
else
if (INDIVIDUAL_KEYWORD.equals(type))
return OWL.Individual(entityIRI);
else
if (DATA_PROPERTY_KEYWORD.equals(type))
return OWL.DataProperty(entityIRI);
else
if (OBJECT_PROPERTY_KEYWORD.equals(type))
return OWL.ObjectProperty(entityIRI);
throw new IllegalArgumentException("Unrecognized type of OWLEntity in module " + type);
}
代码示例来源:origin: Galigator/openllet
private static OWLEntity createEntity(final String type, final String entityIRI)
{
if (CLASS_KEYWORD.equals(type))
return OWL.Class(entityIRI);
else
if (DATA_TYPE_KEYWORD.equals(type))
return OWL.Datatype(entityIRI);
else
if (INDIVIDUAL_KEYWORD.equals(type))
return OWL.Individual(entityIRI);
else
if (DATA_PROPERTY_KEYWORD.equals(type))
return OWL.DataProperty(entityIRI);
else
if (OBJECT_PROPERTY_KEYWORD.equals(type))
return OWL.ObjectProperty(entityIRI);
throw new IllegalArgumentException("Unrecognized type of OWLEntity in module " + type);
}
代码示例来源:origin: Galigator/openllet
/**
* Test that object property domain axioms are handled correctly
*/
@Test
public void objectDomain()
{
assertLocal(domain(ObjectProperty("p"), Class("D")));
assertLocal(domain(ObjectProperty("p"), Class("D")), Class("D"));
assertNonLocal(domain(ObjectProperty("p"), Class("D")), ObjectProperty("p"));
assertLocal(domain(ObjectProperty("p"), Thing), ObjectProperty("p"));
assertNonLocal(domain(ObjectProperty("p"), Class("D")), ObjectProperty("p"), Class("D"));
}
代码示例来源:origin: Galigator/openllet
/**
* Test that object property domain axioms are handled correctly
*/
@Test
public void objectDomain()
{
assertLocal(domain(ObjectProperty("p"), Class("D")));
assertNonLocal(domain(ObjectProperty("p"), Class("D")), Class("D"));
assertLocal(domain(ObjectProperty("p"), Class("D")), ObjectProperty("p"));
assertLocal(domain(ObjectProperty("p"), Thing), ObjectProperty("p"));
assertNonLocal(domain(ObjectProperty("p"), Class("D")), ObjectProperty("p"), Class("D"));
}
}
代码示例来源:origin: Galigator/openllet
@Test
public void objectMaxSubCls()
{
assertNonLocal(subClassOf(max(ObjectProperty("p"), 2, Thing), Class("A")), Class("A"));
assertNonLocal(subClassOf(max(ObjectProperty("p"), 2, Thing), Class("A")), Class("A"), ObjectProperty("p"));
assertNonLocal(subClassOf(max(ObjectProperty("p"), 2, Nothing), Class("A")), Class("A"));
assertNonLocal(subClassOf(max(ObjectProperty("p"), 2, Nothing), Class("A")), Class("A"), ObjectProperty("p"));
assertNonLocal(subClassOf(max(ObjectProperty("p"), 2, Class("B")), Class("A")), Class("A"));
assertNonLocal(subClassOf(max(ObjectProperty("p"), 2, Class("B")), Class("A")), Class("A"), ObjectProperty("p"));
assertNonLocal(subClassOf(max(ObjectProperty("p"), 2, Class("B")), Class("A")), Class("A"), ObjectProperty("p"), Class("B"));
}
代码示例来源:origin: Galigator/openllet
@Test
public void objectMaxSubCls()
{
assertNonLocal(subClassOf(max(ObjectProperty("p"), 2, Thing), Class("A")), Class("A"));
assertNonLocal(subClassOf(max(ObjectProperty("p"), 2, Thing), Class("A")), Class("A"), ObjectProperty("p"));
assertNonLocal(subClassOf(max(ObjectProperty("p"), 2, Nothing), Class("A")), Class("A"));
assertNonLocal(subClassOf(max(ObjectProperty("p"), 2, Nothing), Class("A")), Class("A"), ObjectProperty("p"));
assertNonLocal(subClassOf(max(ObjectProperty("p"), 2, Class("B")), Class("A")), Class("A"));
assertNonLocal(subClassOf(max(ObjectProperty("p"), 2, Class("B")), Class("A")), Class("A"), ObjectProperty("p"));
assertNonLocal(subClassOf(max(ObjectProperty("p"), 2, Class("B")), Class("A")), Class("A"), ObjectProperty("p"), Class("B"));
}
代码示例来源:origin: Galigator/openllet
@SuppressWarnings("unused")
@Test
public void testPunning2() throws Exception
{
final OWLObjectProperty P = OWL.ObjectProperty("P");
final OWLObjectProperty S = OWL.ObjectProperty("S");
final OWLIndividual i = OWL.Individual("P");
final Set<OWLAxiom> axioms = new HashSet<>();
axioms.add(OWL.disjointProperties(P, S));
axioms.add(OWL.propertyAssertion(i, P, i));
axioms.add(OWL.propertyAssertion(i, S, i));
final OWLOntology ontology = OWL.Ontology(axioms);
final OpenlletReasoner reasoner = OpenlletReasonerFactory.getInstance().createReasoner(ontology);
final PelletExplanation explain = new PelletExplanation(reasoner);
assertFalse(explain.getInconsistencyExplanations().isEmpty());
}
代码示例来源:origin: Galigator/openllet
@Test
public void testReflexive2()
{
final String ns = "http://www.example.org/test#";
final String foaf = "http://xmlns.com/foaf/0.1/";
final OWLOntology ont = loadOntology(OWLManager.createOWLOntologyManager(), _base + "reflexive.owl");
final OpenlletReasoner reasoner = OpenlletReasonerFactory.getInstance().createReasoner(ont);
final OWLObjectProperty[] knows = { ObjectProperty(foaf + "knows"), ObjectProperty(ns + "knows2"), ObjectProperty(ns + "knows3") };
final OWLNamedIndividual[] people = new OWLNamedIndividual[5];
for (int i = 0; i < people.length; i++)
{
people[i] = Individual(ns + "P" + (i + 1));
for (final OWLObjectProperty know : knows)
{
assertTrue(people[i] + " " + know, reasoner.isEntailed(propertyAssertion(people[i], know, people[i])));
assertPropertyValues(reasoner, people[i], know, people[i]);
}
}
}
代码示例来源:origin: Galigator/openllet
/**
* Test that filler classes used in existentials as superclass are handled correctly.
*/
@Test
public void objectExistentialFillerSuperCls()
{
assertNonLocal(subClassOf(Class("A"), some(ObjectProperty("p"), Class("B"))), Class("A"));
assertNonLocal(subClassOf(Class("A"), some(ObjectProperty("p"), Class("B"))), Class("A"), ObjectProperty("p"));
}
代码示例来源:origin: Galigator/openllet
/**
* Test that universal object restriction subclasses are handled correctly
*/
@Test
public void objectUniversalSubCls()
{
assertNonLocal(subClassOf(all(ObjectProperty("p"), Class("B")), Class("A")), Class("A"));
assertNonLocal(subClassOf(all(ObjectProperty("p"), Class("B")), Class("A")), Class("A"), Class("B"));
assertNonLocal(subClassOf(all(ObjectProperty("p"), Class("B")), Class("A")), Class("A"), ObjectProperty("p"));
}
}
代码示例来源:origin: Galigator/openllet
/**
* Test that universal object restriction subclasses are handled correctly
*/
@Test
public void objectUniversalSubCls()
{
assertNonLocal(subClassOf(all(ObjectProperty("p"), Class("B")), Class("A")), Class("A"));
assertNonLocal(subClassOf(all(ObjectProperty("p"), Class("B")), Class("A")), Class("A"), Class("B"));
assertNonLocal(subClassOf(all(ObjectProperty("p"), Class("B")), Class("A")), Class("A"), ObjectProperty("p"));
}
}
代码示例来源:origin: Galigator/openllet
@Test
public void testSibling()
{
final String ns = "http://www.example.org/test#";
final OWLOntology ont = loadOntology(OWLManager.createOWLOntologyManager(), _base + "sibling.owl");
final OpenlletReasoner reasoner = OpenlletReasonerFactory.getInstance().createReasoner(ont);
final OWLNamedIndividual Bob = Individual(ns + "Bob");
final OWLNamedIndividual John = Individual(ns + "John");
final OWLNamedIndividual Jane = Individual(ns + "Jane");
final OWLObjectProperty hasBrother = ObjectProperty(ns + "hasBrother");
final OWLObjectProperty hasSister = ObjectProperty(ns + "hasSister");
assertPropertyValues(reasoner, Bob, hasBrother, John);
assertPropertyValues(reasoner, Bob, hasSister, Jane);
}
代码示例来源:origin: Galigator/openllet
/**
* Test that in all circumstances where the role of an object existential is not in a signature, the axiom is non-local (Known to fail prior to r99)
*/
@Test
public void objectExistentialSuperClsProp()
{
assertNonLocal(subClassOf(Class("A"), some(ObjectProperty("p"), Thing)), Class("A"));
assertNonLocal(subClassOf(Class("A"), some(ObjectProperty("p"), Nothing)), Class("A"));
assertNonLocal(subClassOf(Class("A"), some(ObjectProperty("p"), Class("B"))), Class("A"));
assertNonLocal(subClassOf(Class("A"), some(ObjectProperty("p"), Class("A"))), Class("A"));
}
代码示例来源:origin: Galigator/openllet
@Test
public void testSameAs1()
{
final String ns = "urn:test:";
final IRI ontIRI = IRI.create(_base + "invalidTransitivity.owl");
final OWLNamedIndividual a = Individual(ns + "a");
final OWLNamedIndividual b = Individual(ns + "b");
final OWLNamedIndividual c = Individual(ns + "c");
final OWLObjectProperty p = ObjectProperty(ns + "p");
final OWLObjectProperty q = ObjectProperty(ns + "q");
final Set<OWLAxiom> axioms = new HashSet<>();
axioms.add(propertyAssertion(a, p, c));
axioms.add(propertyAssertion(b, p, b));
axioms.add(propertyAssertion(c, q, a));
axioms.add(sameAs(b, c));
axioms.add(propertyAssertion(a, q, c));
final OWLOntology ont = OWL.Ontology(axioms, ontIRI);
final OpenlletReasoner reasoner = OpenlletReasonerFactory.getInstance().createReasoner(ont);
assertStreamAsSetEquals(Stream.of(a), reasoner.getSameIndividuals(a).entities());
assertStreamAsSetEquals(Stream.of(b, c), reasoner.getSameIndividuals(b).entities());
assertStreamAsSetEquals(Stream.of(b, c), reasoner.getSameIndividuals(c).entities());
assertPropertyValues(reasoner, a, p, b, c);
assertPropertyValues(reasoner, a, q, b, c);
assertPropertyValues(reasoner, b, p, b, c);
assertPropertyValues(reasoner, b, q, a);
assertPropertyValues(reasoner, c, p, b, c);
assertPropertyValues(reasoner, c, q, a);
}
代码示例来源:origin: Galigator/openllet
@Test
public void testUncle()
{
final String ns = "http://www.example.org/test#";
final OWLOntology ont = loadOntology(OWLManager.createOWLOntologyManager(), _base + "uncle.owl");
final OpenlletReasoner reasoner = OpenlletReasonerFactory.getInstance().createReasoner(ont);
final OWLNamedIndividual Bob = Individual(ns + "Bob");
final OWLNamedIndividual Sam = Individual(ns + "Sam");
final OWLObjectProperty uncleOf = ObjectProperty(ns + "uncleOf");
assertPropertyValues(reasoner, Bob, uncleOf, Sam);
}
代码示例来源:origin: Galigator/openllet
@Test
public void testAxiomConverterRules3()
{
final KnowledgeBase kb = new KnowledgeBaseImpl();
final OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
final OWLDataFactory df = manager.getOWLDataFactory();
final AxiomConverter converter = new AxiomConverter(kb, df);
final ATermAppl p = ATermUtils.makeTermAppl("p");
final ATermAppl q = ATermUtils.makeTermAppl("q");
final ATermAppl x = ATermUtils.makeVar("x");
final ATermAppl y = ATermUtils.makeVar("y");
kb.addObjectProperty(p);
kb.addObjectProperty(q);
final ATermAppl[] head = new ATermAppl[] { ATermUtils.makePropAtom(q, x, y) };
final ATermAppl[] body = new ATermAppl[] { ATermUtils.makePropAtom(p, x, y) };
final ATermAppl rule = ATermUtils.makeRule(head, body);
final OWLAxiom actual = converter.convert(rule);
final Set<SWRLAtom> antecedent = new HashSet<>();
final Set<SWRLAtom> consequent = new HashSet<>();
antecedent.add(propertyAtom(ObjectProperty("p"), variable("x"), variable("y")));
consequent.add(propertyAtom(ObjectProperty("q"), variable("x"), variable("y")));
final OWLAxiom expected = rule(antecedent, consequent);
assertEquals(expected, actual);
}
代码示例来源:origin: Galigator/openllet
@Before
public void createEntities()
{
_A = OWL.Class(ontologyURI + "A");
_B = OWL.Class(ontologyURI + "B");
_C = OWL.Class(ontologyURI + "C");
_D = OWL.Class(ontologyURI + "D");
_E = OWL.Class(ontologyURI + "E");
_F = OWL.Class(ontologyURI + "F");
_p = OWL.ObjectProperty(ontologyURI + "p");
_q = OWL.ObjectProperty(ontologyURI + "q");
_r = OWL.ObjectProperty(ontologyURI + "r");
dp = OWL.DataProperty(ontologyURI + "dp");
dq = OWL.DataProperty(ontologyURI + "dq");
dr = OWL.DataProperty(ontologyURI + "dr");
_a = OWL.Individual(ontologyURI + "a");
_b = OWL.Individual(ontologyURI + "b");
_c = OWL.Individual(ontologyURI + "c");
_d = OWL.Individual(ontologyURI + "d");
_dt = OWL.Datatype(ontologyURI + "dt");
_anon1 = OWL.AnonymousIndividual("anon1");
_x = SWRL.variable(ontologyURI + "x");
_y = SWRL.variable(ontologyURI + "y");
_dx = SWRL.variable(ontologyURI + "dx");
}
代码示例来源:origin: Galigator/openllet
@Before
public void setUp() throws OWLOntologyCreationException
{
_manager = OWLManager.createOWLOntologyManager();
final IRI ontologyURI = IRI.create("tag:clarkparsia.com,2008:pellint:test");
_ontology = _manager.createOntology(ontologyURI);
_cls = new OWLClass[5];
for (int i = 0; i < _cls.length; i++)
_cls[i] = OWL.Class(ontologyURI + "#C" + i);
_pro = new OWLObjectProperty[5];
for (int i = 0; i < _pro.length; i++)
_pro[i] = OWL.ObjectProperty(ontologyURI + "#R" + i);
_ind = new OWLIndividual[5];
for (int i = 0; i < _ind.length; i++)
_ind[i] = OWL.Individual(ontologyURI + "#I" + i);
_P0AllC0 = OWL.all(_pro[0], _cls[0]);
_P0SomeC1 = OWL.some(_pro[0], _cls[1]);
}
代码示例来源:origin: Galigator/openllet
public void testLuigiFamilyOWLApi() throws Exception
{
final OWLOntologyManager manager = OWL._manager;
final OWLOntology familyRef = manager.loadOntology(IRI.create(_base + "basicFamilyReference.owl"));
final OWLOntology familyRules = manager.loadOntology(IRI.create(_base + "basicFamilyRules.owl"));
final OWLOntology mergedOntology = OWL.Ontology(Stream.concat(familyRef.axioms(), familyRules.axioms()));
final OpenlletReasoner reasoner = openllet.owlapi.OpenlletReasonerFactory.getInstance().createReasoner(mergedOntology);
final OWLIndividual nella = OWL.Individual(_luigiFamily.resolve("#Nella"));
final OWLObjectProperty hasUncle = OWL.ObjectProperty(_luigiFamily.resolve("#hasUncle"));
final OWLIndividual dino = OWL.Individual(_luigiFamily.resolve("#Dino"));
assertFalse(reasoner.isEntailed(OWL.propertyAssertion(nella, hasUncle, dino)));
}
代码示例来源:origin: Galigator/openllet
@Test
public void testInvalidTransitivity()
{
final String ns = "http://www.example.org/test#";
final OWLClass C = Class(ns + "C");
final OWLObjectProperty p1 = ObjectProperty(ns + "p1");
final OWLObjectProperty p2 = ObjectProperty(ns + "p2");
final OWLIndividual x = Individual(ns + "x");
final OWLIndividual y = Individual(ns + "y");
final OWLIndividual z = Individual(ns + "z");
final OWLOntology ont = OWL.Ontology(transitive(p1), classAssertion(x, all(p1, C)), propertyAssertion(x, p1, y), propertyAssertion(y, p1, z));
OpenlletReasoner reasoner = OpenlletReasonerFactory.getInstance().createReasoner(ont);
assertTrue(reasoner.isEntailed(classAssertion(y, C)));
assertTrue(reasoner.isEntailed(classAssertion(z, C)));
final OWLAxiom[] axioms = new OWLAxiom[] { functional(p1), inverseFunctional(p1), irreflexive(p1), asymmetric(p1), disjointProperties(p1, p2), subClassOf(C, min(p1, 2)), classAssertion(x, max(p1, 3)), disjointClasses(C, min(p1, 2)) };
for (final OWLAxiom axiom : axioms)
{
ont.add(axiom);
reasoner = OpenlletReasonerFactory.getInstance().createReasoner(ont);
assertTrue(axiom.toString(), reasoner.isEntailed(classAssertion(y, C)));
assertFalse(axiom.toString(), reasoner.isEntailed(classAssertion(z, C)));
ont.remove(axiom);
}
}
内容来源于网络,如有侵权,请联系作者删除!