本文整理了Java中openllet.owlapi.OWL.Individual()
方法的一些代码示例,展示了OWL.Individual()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。OWL.Individual()
方法的具体详情如下:
包路径:openllet.owlapi.OWL
类名称:OWL
方法名:Individual
暂无
代码示例来源:origin: com.github.galigator.openllet/openllet-owlapi
public static SWRLIndividualArgument individual(final String individual)
{
return OWL._factory.getSWRLIndividualArgument(OWL.Individual(individual));
}
代码示例来源:origin: Galigator/openllet
public static SWRLIndividualArgument individual(final String individual)
{
return OWL._factory.getSWRLIndividualArgument(OWL.Individual(individual));
}
代码示例来源:origin: Galigator/openllet
public static SWRLIndividualArgument individual(final String individual)
{
return OWL._factory.getSWRLIndividualArgument(OWL.Individual(individual));
}
代码示例来源: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
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
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
@SuppressWarnings("unused")
@Test
public void testPunning3() throws Exception
{
final OWLClass A = OWL.Class("A");
final OWLIndividual i = OWL.Individual("A");
final OWLClass B = OWL.Class("B");
final OWLIndividual j = OWL.Individual("B");
final Set<OWLAxiom> axioms = new HashSet<>();
axioms.add(OWL.disjointClasses(A, B));
axioms.add(OWL.classAssertion(i, A));
axioms.add(OWL.classAssertion(j, B));
axioms.add(OWL.sameAs(i, j));
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 testPunningOneOf()
{
final OWLClass A = OWL.Class("A");
final OWLIndividual a = OWL.Individual("A");
final OWLIndividual b = OWL.Individual("b");
final Set<OWLAxiom> axioms = new HashSet<>();
axioms.add(OWL.equivalentClasses(A, OWL.oneOf(a, b)));
final OWLOntology ontology = OWL.Ontology(axioms);
final OpenlletReasoner reasoner = OpenlletReasonerFactory.getInstance().createReasoner(ontology);
final PelletExplanation explain = new PelletExplanation(reasoner);
assertEquals(axioms, explain.getEntailmentExplanation(OWL.classAssertion(a, A)));
}
代码示例来源:origin: Galigator/openllet
@SuppressWarnings("unused")
@Test
public void testPunning1() throws Exception
{
final OWLClass A = OWL.Class("A");
final OWLClass B = OWL.Class("B");
final OWLIndividual i = OWL.Individual("A");
final Set<OWLAxiom> axioms = new HashSet<>();
axioms.add(OWL.disjointClasses(A, B));
axioms.add(OWL.classAssertion(i, A));
axioms.add(OWL.classAssertion(i, B));
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
@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 testDLSafeConstants()
{
final String ns = "http://owldl.com/ontologies/dl-safe-constants.owl#";
final OWLOntology ont = loadOntology(OWLManager.createOWLOntologyManager(), _base + "dl-safe-constants.owl");
final OpenlletReasoner reasoner = OpenlletReasonerFactory.getInstance().createReasoner(ont);
final OWLClass DreamTeamMember = Class(ns + "DreamTeamMember");
final OWLClass DreamTeamMember1 = Class(ns + "DreamTeamMember1");
final OWLClass DreamTeamMember2 = Class(ns + "DreamTeamMember2");
final OWLIndividual Alice = Individual(ns + "Alice");
final OWLIndividual Bob = Individual(ns + "Bob");
final OWLIndividual Charlie = Individual(ns + "Charlie");
for (int test = 0; test < 1; test++)
{
if (test != 0)
reasoner.prepareReasoner();
assertIteratorValues(reasoner.getInstances(DreamTeamMember, false).entities().iterator(), new Object[] { Alice, Bob, Charlie });
assertIteratorValues(reasoner.getInstances(DreamTeamMember1, false).entities().iterator(), new Object[] { Alice, Bob, Charlie });
assertIteratorValues(reasoner.getInstances(DreamTeamMember2, false).entities().iterator(), new Object[] { Alice, Bob, Charlie });
}
}
代码示例来源:origin: Galigator/openllet
@Test
public void testPunningSingletonOneOf()
{
final OWLClass A = OWL.Class("A");
final OWLIndividual a = OWL.Individual("A");
final Set<OWLAxiom> axioms = new HashSet<>();
axioms.add(OWL.equivalentClasses(A, OWL.oneOf(a)));
final OWLOntology ontology = OWL.Ontology(axioms);
final OpenlletReasoner reasoner = OpenlletReasonerFactory.getInstance().createReasoner(ontology);
final PelletExplanation explain = new PelletExplanation(reasoner);
assertEquals(axioms, explain.getEntailmentExplanation(OWL.classAssertion(a, A)));
}
代码示例来源: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
@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
@Test
public void testOWL2Incremental()
{
final String ns = "http://www.example.org/test#";
final OWLOntology ont = loadOntology(OWLManager.createOWLOntologyManager(), _base + "owl2.owl");
final IncrementalClassifier classifier = new IncrementalClassifier(ont);
try
{
classifier.classify(); // force classification
final OWLNamedIndividual ind1 = Individual(ns + "ind1");
classifier.getTypes(ind1, true);// force realization
testOWL2Reasoner(ns, classifier);
}
finally
{
classifier.dispose();
}
}
代码示例来源:origin: Galigator/openllet
@Test
public void testFamilyIncremental()
{
final String ns = "http://www.example.org/family#";
final OWLOntology ont = loadOntology(OWLManager.createOWLOntologyManager(), _base + "family.owl");
final IncrementalClassifier classifier = new IncrementalClassifier(ont);
try
{
// force classification
classifier.classify();
testFamily(ns, classifier);
// force realization
final OWLNamedIndividual ind1 = Individual(ns + "ind1");
classifier.getTypes(ind1, true);
testFamily(ns, classifier);
}
finally
{
classifier.dispose();
}
}
代码示例来源: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: com.github.galigator.openllet/openllet-owlapi
@Test
public void testAddAndRemove() throws OWLOntologyCreationException
{
try (final OWLManagerGroup group = new OWLManagerGroup())
{
final OWLOntologyID ontId = OWLHelper.getVersion(IRI.create(NS + "owlapi.add.remove"), 1.0);
final OWLHelper owl = new OWLGenericTools(group, ontId, true);
owl.addAxiom(OWL.declaration(OWL.DataProperty(NS + "propA")));
owl.addAxiom(OWL.declaration(OWL.Class(NS + "clsA")));
owl.addAxiom(OWL.equivalentClasses(OWL.Class(NS + "clsA"), //
OWL.value(OWL.DataProperty(NS + "propA"), OWL.constant(12))//
));
assertTrue(owl.getReasoner().instances(OWL.Class(NS + "clsA")).count() == 0);
final OWLNamedIndividual x1 = OWL.Individual(NS + "I1");
owl.addAxiom(OWL.classAssertion(x1, OWL.Class(NS + "clsA")));
assertTrue(owl.getReasoner().instances(OWL.Class(NS + "clsA")).count() == 1);
owl.removeAxiom(OWL.classAssertion(x1, OWL.Class(NS + "clsA")));
assertTrue(owl.getReasoner().instances(OWL.Class(NS + "clsA")).count() == 0);
} // The test is just about not crash.
}
代码示例来源:origin: Galigator/openllet
@Test
public void testAddAndRemove() throws OWLOntologyCreationException
{
try (final OWLManagerGroup group = new OWLManagerGroup())
{
final OWLOntologyID ontId = OWLHelper.getVersion(IRI.create(NS + "owlapi.add.remove"), 1.0);
final OWLHelper owl = new OWLGenericTools(group, ontId, true);
owl.addAxiom(OWL.declaration(OWL.DataProperty(NS + "propA")));
owl.addAxiom(OWL.declaration(OWL.Class(NS + "clsA")));
owl.addAxiom(OWL.equivalentClasses(OWL.Class(NS + "clsA"), //
OWL.value(OWL.DataProperty(NS + "propA"), OWL.constant(12))//
));
assertTrue(owl.getReasoner().instances(OWL.Class(NS + "clsA")).count() == 0);
final OWLNamedIndividual x1 = OWL.Individual(NS + "I1");
owl.addAxiom(OWL.classAssertion(x1, OWL.Class(NS + "clsA")));
assertTrue(owl.getReasoner().instances(OWL.Class(NS + "clsA")).count() == 1);
owl.removeAxiom(OWL.classAssertion(x1, OWL.Class(NS + "clsA")));
assertTrue(owl.getReasoner().instances(OWL.Class(NS + "clsA")).count() == 0);
} // The test is just about not crash.
}
内容来源于网络,如有侵权,请联系作者删除!