本文整理匯總了Java中org.semanticweb.owlapi.model.OWLDataFactory.getOWLNamedIndividual方法的典型用法代碼示例。如果您正苦於以下問題:Java OWLDataFactory.getOWLNamedIndividual方法的具體用法?Java OWLDataFactory.getOWLNamedIndividual怎麽用?Java OWLDataFactory.getOWLNamedIndividual使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.semanticweb.owlapi.model.OWLDataFactory
的用法示例。
在下文中一共展示了OWLDataFactory.getOWLNamedIndividual方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createIndividualInternal
import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
private static Pair<OWLNamedIndividual, Set<OWLAxiom>> createIndividualInternal(IRI iri, OWLOntology abox, OWLClassExpression ce, Set<OWLAnnotation> annotations) {
LOG.info("Generating individual for IRI: "+iri);
OWLDataFactory f = abox.getOWLOntologyManager().getOWLDataFactory();
OWLNamedIndividual i = f.getOWLNamedIndividual(iri);
// create axioms
Set<OWLAxiom> axioms = new HashSet<OWLAxiom>();
// declaration
axioms.add(f.getOWLDeclarationAxiom(i));
// annotation assertions
if(annotations != null) {
for(OWLAnnotation annotation : annotations) {
axioms.add(f.getOWLAnnotationAssertionAxiom(iri, annotation));
}
}
if (ce != null) {
OWLClassAssertionAxiom typeAxiom = createType(f, i, ce);
if (typeAxiom != null) {
axioms.add(typeAxiom);
}
}
return Pair.of(i, axioms);
}
示例2: asNamedIndividual
import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
/**
* In some OBO like ontologies
* @param entityAnnAx
* @return
*/
private String asNamedIndividual(OWLAnnotationAssertionAxiom entityAnnAx, OWLOntology onto, OWLDataFactory datafactory){
try {
//It is an individual
namedIndivIRI=(IRI)entityAnnAx.getAnnotation().getValue();
namedIndiv=datafactory.getOWLNamedIndividual(namedIndivIRI);
for (OWLAnnotationAssertionAxiom annIdiv : namedIndiv.getAnnotationAssertionAxioms(onto)){
if (annIdiv.getAnnotation().getProperty().getIRI().toString().equals(rdf_label_uri)){
return ((OWLLiteral)annIdiv.getAnnotation().getValue()).getLiteral().toLowerCase();
}
}
return "";
}
catch (Exception e){
//In case of error. Accessing an object in an expected way
return "";
}
}
開發者ID:ernestojimenezruiz,項目名稱:logmap-matcher,代碼行數:31,代碼來源:ExtractStringFromAnnotationAssertionAxiom.java
示例3: asNamedIndividualFMA
import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
/**
* FMA originalannotations annotations appear as datatype assertions
* @param entityAnnAx
* @return
*/
private String asNamedIndividualFMA(OWLAnnotationAssertionAxiom entityAnnAx, OWLOntology onto, OWLDataFactory datafactory){
try{
//It is an individual
namedIndivIRI=(IRI)entityAnnAx.getAnnotation().getValue();
namedIndiv=datafactory.getOWLNamedIndividual(namedIndivIRI);
//for (OWLAnnotation indivAnn : namedIndiv.getAnnotations(onto)){
for (OWLLiteral literal_syn : namedIndiv.getDataPropertyValues(datafactory.getOWLDataProperty(IRI.create(fma_name_uri)), onto)){
return literal_syn.getLiteral().toLowerCase();
}
return "";
}
catch (Exception e){
//In case of error. Accessing an object in an expected way
return "";
}
}
開發者ID:ernestojimenezruiz,項目名稱:logmap-matcher,代碼行數:29,代碼來源:ExtractStringFromAnnotationAssertionAxiom.java
示例4: addElementToAttributeAssociationsFromFile
import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
public static void addElementToAttributeAssociationsFromFile(OWLOntology ont, File file) throws IOException {
OWLOntologyManager m = OWLManager.createOWLOntologyManager();
OWLDataFactory df = m.getOWLDataFactory();
List<String> lines = FileUtils.readLines(file);
for (String line : lines) {
if (line.startsWith("#"))
continue;
String[] colVals = line.split("\t");
if (colVals.length != 2) {
throw new IOException("Incorrect number of value: "+line);
}
OWLNamedIndividual i = df.getOWLNamedIndividual(getIRIById(colVals[0]));
OWLClass c = df.getOWLClass(getIRIById(colVals[1]));
m.addAxiom(ont, df.getOWLClassAssertionAxiom(c, i));
}
}
示例5: parseRow
import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
private void parseRow(String[] row) {
OWLDataFactory df = graph.getDataFactory();
OWLOntologyManager mgr = graph.getManager();
String geneSetId = row[0];
IRI geneSetIRI = IRI.create(prefix + geneSetId);
String desc = row[1];
OWLClass geneSetCls = df.getOWLClass(geneSetIRI);
OWLAxiom ax = df.getOWLAnnotationAssertionAxiom(df.getRDFSLabel(),geneSetIRI, literal(desc));
mgr.addAxiom(graph.getSourceOntology(), ax);
// assume each value is an entity, e.g. gene
for (int i=2; i < row.length; i++) {
OWLNamedIndividual individual = df.getOWLNamedIndividual(IRI.create(prefix + row[i]));
mgr.addAxiom(graph.getSourceOntology(), df.getOWLClassAssertionAxiom(geneSetCls, individual));
}
}
示例6: testUnsatifiabilityDueToClashInABoxAssertions
import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
/**
* Atomic clash
*/
public void testUnsatifiabilityDueToClashInABoxAssertions() {
OWLDataFactory factory = OWLManager.getOWLDataFactory();
OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
OWLClassExpression expr1 = factory.getOWLClass(IRI.create(String.format("%s#%s", PREFIX, "A")));
OWLClassExpression expr2 = factory.getOWLObjectComplementOf(expr1);
OWLNamedIndividual indiv = factory.getOWLNamedIndividual(IRI.create(String.format("%s#%s", PREFIX, "a")));
OWLIndividualAxiom fact1 = factory.getOWLClassAssertionAxiom(expr1, indiv);
OWLIndividualAxiom fact2 = factory.getOWLClassAssertionAxiom(expr2, indiv);
try {
OWLOntology ontology = manager.createOntology();
manager.addAxiom(ontology, fact1);
manager.addAxiom(ontology, fact2);
Wolpertinger wolpertinger = new Wolpertinger(ontology);
assertFalse(wolpertinger.isConsistent());
} catch (OWLOntologyCreationException e) {
e.printStackTrace();
fail();
}
}
示例7: addPABoxConstraints
import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
protected void addPABoxConstraints(OWLOntology ontology, PABox pabox, KnowledgeBase kb,
OWLOntologyManager manager, OWLDataFactory factory) {
ConceptConverter converter = new ConceptConverter(kb, factory);
for (Map.Entry<ATermAppl, Set<ConditionalConstraint>> entry : pabox.getConstraintsMap().entrySet()) {
for (ConditionalConstraint cc : entry.getValue()) {
OWLAnnotationProperty annProp = factory.getOWLAnnotationProperty( IRI.create( Constants.CERTAINTY_ANNOTATION_URI ));
OWLAnnotationValue annValue = factory.getOWLStringLiteral( cc.getLowerBound() + ";" + cc.getUpperBound() );
OWLAnnotation annotation = factory.getOWLAnnotation( annProp, annValue );
OWLIndividual indiv = factory.getOWLNamedIndividual( IRI.create( entry.getKey().getName()) );
OWLClassExpression clsCn = (OWLClassExpression)converter.convert( cc.getConclusion() );
OWLAxiom axiom = factory.getOWLClassAssertionAxiom( clsCn, indiv, Collections.singleton( annotation ) );
try {
manager.applyChange( new AddAxiom(ontology, axiom) );
} catch( OWLOntologyChangeException e ) {
e.printStackTrace();
}
}
}
}
示例8: isRoleInstance
import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
protected boolean isRoleInstance(Role role, Individual individual1, Individual individual2) {
OWLDataFactory factory=m_reasoner.getDataFactory();
AtomicRole atomicRole;
if (role instanceof InverseRole) {
Individual tmp=individual1;
individual1=individual2;
individual2=tmp;
atomicRole=((InverseRole)role).getInverseOf();
}
else
atomicRole=(AtomicRole)role;
OWLObjectProperty property=factory.getOWLObjectProperty(IRI.create(atomicRole.getIRI()));
OWLNamedIndividual namedIndividual1=factory.getOWLNamedIndividual(IRI.create(individual1.getIRI()));
OWLNamedIndividual namedIndividual2=factory.getOWLNamedIndividual(IRI.create(individual2.getIRI()));
OWLClass pseudoNominal=factory.getOWLClass(IRI.create("internal:pseudo-nominal"));
OWLClassExpression allNotPseudoNominal=factory.getOWLObjectAllValuesFrom(property,pseudoNominal.getObjectComplementOf());
OWLAxiom allNotPseudoNominalAssertion=factory.getOWLClassAssertionAxiom(allNotPseudoNominal,namedIndividual1);
OWLAxiom pseudoNominalAssertion=factory.getOWLClassAssertionAxiom(pseudoNominal,namedIndividual2);
Tableau tableau=m_reasoner.getTableau(allNotPseudoNominalAssertion,pseudoNominalAssertion);
boolean result=!tableau.isSatisfiable(true,true,null,null,null,null,null,new ReasoningTaskDescription(true,"is {0} connected to {1} via {2}",individual1,individual2,atomicRole));
if (m_tableauMonitor!=null) {
if (result)
m_tableauMonitor.possibleInstanceIsInstance();
else
m_tableauMonitor.possibleInstanceIsNotInstance();
}
return result;
}
示例9: makeDefaultIndividuals
import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
/**
* Creates a "fake" individual for every class.
*
* ABox IRI = TBox IRI + suffix
*
* if suffix == null, then we are punning
*
* @param srcOnt
* @param iriSuffix
* @throws OWLOntologyCreationException
*/
public static void makeDefaultIndividuals(OWLOntology srcOnt, String iriSuffix) throws OWLOntologyCreationException {
OWLOntologyManager m = srcOnt.getOWLOntologyManager();
OWLDataFactory df = m.getOWLDataFactory();
for (OWLClass c : srcOnt.getClassesInSignature(Imports.INCLUDED)) {
IRI iri;
if (iriSuffix == null || iriSuffix.equals(""))
iri = c.getIRI();
else
iri = IRI.create(c.getIRI().toString()+iriSuffix);
OWLNamedIndividual ind = df.getOWLNamedIndividual(iri);
m.addAxiom(srcOnt, df.getOWLDeclarationAxiom(ind));
m.addAxiom(srcOnt, df.getOWLClassAssertionAxiom(c, ind));
}
}
示例10: testUnsatisfiabilityDuetoSimpleSubsumptionViolation
import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
public void testUnsatisfiabilityDuetoSimpleSubsumptionViolation() {
OWLDataFactory factory = OWLManager.getOWLDataFactory();
OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
OWLClassExpression classA = factory.getOWLClass(IRI.create(String.format("%s#%s", PREFIX, "A")));
OWLClassExpression classB = factory.getOWLClass(IRI.create(String.format("%s#%s", PREFIX, "B")));
OWLClassExpression complClassB = factory.getOWLObjectComplementOf(classB);
OWLNamedIndividual indiv = factory.getOWLNamedIndividual(IRI.create(String.format("%s#%s", PREFIX, "a")));
OWLIndividualAxiom fact1 = factory.getOWLClassAssertionAxiom(classA, indiv);
OWLIndividualAxiom fact2 = factory.getOWLClassAssertionAxiom(complClassB, indiv);
OWLSubClassOfAxiom subClOf = factory.getOWLSubClassOfAxiom(classA, classB);
try {
OWLOntology ontology = manager.createOntology();
manager.addAxiom(ontology, fact1);
manager.addAxiom(ontology, fact2);
manager.addAxiom(ontology, subClOf);
Wolpertinger wolpertinger = new Wolpertinger(ontology);
assertFalse(wolpertinger.isConsistent());
} catch (OWLOntologyCreationException e) {
e.printStackTrace();
fail();
}
}
示例11: testUnsatisfiabilityDueToConflictingAxioms1
import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
/**
* Smth like:
* A subClassOf B
* A subClassOf C
* C disjoint with B
* ...
*/
public void testUnsatisfiabilityDueToConflictingAxioms1() {
OWLDataFactory factory = OWLManager.getOWLDataFactory();
OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
OWLClassExpression classA = factory.getOWLClass(IRI.create(String.format("%s#%s", PREFIX, "A")));
OWLClassExpression classB = factory.getOWLClass(IRI.create(String.format("%s#%s", PREFIX, "B")));
OWLClassExpression classC = factory.getOWLClass(IRI.create(String.format("%s#%s", PREFIX, "C")));
OWLNamedIndividual indiv = factory.getOWLNamedIndividual(IRI.create(String.format("%s#%s", PREFIX, "a")));
OWLIndividualAxiom fact1 = factory.getOWLClassAssertionAxiom(classA, indiv);
OWLSubClassOfAxiom axmAsubB = factory.getOWLSubClassOfAxiom(classA, classB);
OWLSubClassOfAxiom axmAsubC = factory.getOWLSubClassOfAxiom(classA, classC);
OWLDisjointClassesAxiom axmBdisC = factory.getOWLDisjointClassesAxiom(classB, classC);
try {
OWLOntology ontology = manager.createOntology();
manager.addAxiom(ontology, fact1);
manager.addAxiom(ontology, axmAsubB);
manager.addAxiom(ontology, axmAsubC);
manager.addAxiom(ontology, axmBdisC);
Wolpertinger wolpertinger = new Wolpertinger(ontology);
assertFalse(wolpertinger.isConsistent());
} catch (OWLOntologyCreationException e) {
e.printStackTrace();
fail();
}
}
示例12: testUnsatisfiabilityDoToFixedDomain1
import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
/**
* Smth like
* A subClassOf r min 5 B
* But we have only a domain with 4 elements ...
*/
public void testUnsatisfiabilityDoToFixedDomain1() {
OWLDataFactory factory = OWLManager.getOWLDataFactory();
OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
OWLClassExpression classA = factory.getOWLClass(IRI.create(String.format("%s#%s", PREFIX, "A")));
OWLClassExpression classB = factory.getOWLClass(IRI.create(String.format("%s#%s", PREFIX, "B")));
OWLObjectPropertyExpression roleR = factory.getOWLObjectProperty(IRI.create(String.format("%s#%s", PREFIX, "r")));
OWLNamedIndividual indA = factory.getOWLNamedIndividual(IRI.create(String.format("%s#%s", PREFIX, "a")));
OWLNamedIndividual indB = factory.getOWLNamedIndividual(IRI.create(String.format("%s#%s", PREFIX, "b")));
OWLNamedIndividual indC = factory.getOWLNamedIndividual(IRI.create(String.format("%s#%s", PREFIX, "c")));
OWLNamedIndividual indD = factory.getOWLNamedIndividual(IRI.create(String.format("%s#%s", PREFIX, "d")));
OWLIndividualAxiom fact1 = factory.getOWLClassAssertionAxiom(classA, indA);
OWLIndividualAxiom fact2 = factory.getOWLClassAssertionAxiom(classA, indB);
OWLIndividualAxiom fact3 = factory.getOWLClassAssertionAxiom(classA, indC);
OWLIndividualAxiom fact4 = factory.getOWLClassAssertionAxiom(classA, indD);
OWLObjectMinCardinality exprRmin5B = factory.getOWLObjectMinCardinality(5, roleR, classB);
OWLSubClassOfAxiom axmAsubRsomeB = factory.getOWLSubClassOfAxiom(classA, exprRmin5B);
try {
OWLOntology ontology = manager.createOntology();
manager.addAxiom(ontology, fact1);
manager.addAxiom(ontology, fact2);
manager.addAxiom(ontology, fact3);
manager.addAxiom(ontology, fact4);
manager.addAxiom(ontology, axmAsubRsomeB);
Wolpertinger wolpertinger = new Wolpertinger(ontology);
assertFalse(wolpertinger.isConsistent());
} catch (OWLOntologyCreationException e) {
e.printStackTrace();
fail();
}
}
示例13: testDecorate1
import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
@Test
public void testDecorate1() throws Exception {
OWLOntologyManager m = OWLManager.createOWLOntologyManager();
OWLDataFactory f = m.getOWLDataFactory();
CurieMappings defaultMappings = DefaultCurieHandler.loadDefaultMappings();
CurieMappings localMappings = new CurieMappings.SimpleCurieMappings(Collections.singletonMap("http://testmodel.geneontology.org/","testmodel"));
CurieHandler curieHandler = new MappedCurieHandler(defaultMappings, localMappings);
OWLOntology model = m.createOntology(IRI.create("http://testmodel.geneontology.org/0001"));
// add class without a label or id
IRI cIRI = IRI.create("http://purl.obolibrary.org/obo/GO_0001");
OWLClass c = f.getOWLClass(cIRI);
m.addAxiom(model, f.getOWLDeclarationAxiom(c));
// add individual using the class as type
OWLNamedIndividual i = f.getOWLNamedIndividual(IRI.create("http://testmodel.geneontology.org/0001/0001"));
m.addAxiom(model, f.getOWLDeclarationAxiom(i));
m.addAxiom(model, f.getOWLClassAssertionAxiom(c, i));
List<LookupEntry> testEntries = new ArrayList<LookupEntry>();
testEntries.add(new LookupEntry(cIRI, "TEST CLASS 1", "Class", null));
ExternalLookupService lookup = new TableLookupService(testEntries);
int originalAxiomCount = model.getAxiomCount();
int originalAnnotationCount = model.getAnnotations().size();
ModelWriterHelper w = new ModelWriterHelper(curieHandler, lookup);
List<OWLOntologyChange> changes = w.handle(model);
// model annotations
// id, label for cls
assertEquals(6, changes.size()); // 3 + 3 declarations
assertEquals(5+originalAxiomCount, model.getAxiomCount());
final Set<OWLAnnotation> modelAnnotationsAfter = model.getAnnotations();
assertEquals(1+originalAnnotationCount, modelAnnotationsAfter.size());
//System.out.println(render(model));
ModelReaderHelper.INSTANCE.filter(model);
assertEquals(originalAxiomCount+3, model.getAxiomCount()); // declarations are fine
assertEquals(originalAnnotationCount, model.getAnnotations().size());
//System.out.println(render(model));
}
示例14: translateResultsToOWLAxioms
import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
public Set<OWLAxiom> translateResultsToOWLAxioms() {
System.out.println("TRANSLATING TO OWL AXIOM:"+this);
OWLGraphWrapper graph = simEngine.getGraph();
Set<OWLAxiom> axioms = new HashSet<OWLAxiom>();
OWLDataFactory df = graph.getDataFactory();
if (!(a instanceof OWLNamedObject)) {
System.err.println(a+ "not named - cant write OWL results");
return axioms;
}
if (!(b instanceof OWLNamedObject)) {
System.err.println(b+ "not named - cant write OWL results");
return axioms;
}
IRI ia = ((OWLNamedObject) a).getIRI();
IRI ib = ((OWLNamedObject) b).getIRI();
String[] toksA = splitIRI(ia);
String[] toksB = splitIRI(ib);
String id = toksA[0]+toksA[1]+"-vs-"+toksB[1];
persistentIRI = IRI.create(id);
// each similarity is stored as an individual of class similarity_relationship
OWLNamedIndividual result = df.getOWLNamedIndividual(persistentIRI);
OWLClass ac = df.getOWLClass(annotationIRI("similarity_relationship"));
axioms.add(df.getOWLClassAssertionAxiom(ac, result));
axioms.add(df.getOWLAnnotationAssertionAxiom(df.getOWLAnnotationProperty(OWLRDFVocabulary.RDFS_LABEL.getIRI()),
result.getIRI(),
df.getOWLLiteral("Similarity relationship between "+simEngine.label(a)+" and "+simEngine.label(b))));
// each object in the pair is connected to the similarity
OWLAnnotationProperty p = df.getOWLAnnotationProperty(annotationIRI("has_similarity_relationship"));
axioms.add(df.getOWLAnnotationAssertionAxiom(p, ((OWLNamedObject) a).getIRI(), result.getIRI()));
axioms.add(df.getOWLAnnotationAssertionAxiom(p, ((OWLNamedObject) b).getIRI(), result.getIRI()));
// every similarity has a score
OWLAnnotationProperty sp = df.getOWLAnnotationProperty(annotationIRI("has_score"));
axioms.add(df.getOWLAnnotationAssertionAxiom(sp, result.getIRI(), df.getOWLLiteral(score)));
translateResultsToOWLAxioms(id, result, axioms);
return axioms;
}
示例15: createSimpleGraphColoring
import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
private OWLOntology createSimpleGraphColoring() {
OWLOntology ontoColoring = null;
OWLDataFactory factory = OWLManager.getOWLDataFactory();
OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
OWLObjectPropertyExpression edgeProp = factory.getOWLObjectProperty(IRI.create(String.format("%s#%s", PREFIX, "edge")));
OWLClassExpression classNode = factory.getOWLClass(IRI.create(String.format("%s#%s", PREFIX, "Node")));
OWLClassExpression classBlue = factory.getOWLClass(IRI.create(String.format("%s#%s", PREFIX, "Blue")));
OWLClassExpression classRed = factory.getOWLClass(IRI.create(String.format("%s#%s", PREFIX, "Red")));
OWLClassExpression classGreen = factory.getOWLClass(IRI.create(String.format("%s#%s", PREFIX, "Green")));
OWLNamedIndividual indNode1 = factory.getOWLNamedIndividual(IRI.create(String.format("%s#%s", PREFIX, "node1")));
OWLNamedIndividual indNode2 = factory.getOWLNamedIndividual(IRI.create(String.format("%s#%s", PREFIX, "node2")));
OWLNamedIndividual indNode3 = factory.getOWLNamedIndividual(IRI.create(String.format("%s#%s", PREFIX, "node3")));
OWLNamedIndividual indNode4 = factory.getOWLNamedIndividual(IRI.create(String.format("%s#%s", PREFIX, "node4")));
// now the facts
// nodes
OWLIndividualAxiom axmNodeInst4 =factory.getOWLClassAssertionAxiom(classNode, indNode4);
OWLIndividualAxiom axmNodeInst3 =factory.getOWLClassAssertionAxiom(classNode, indNode3);
OWLIndividualAxiom axmNodeInst2 =factory.getOWLClassAssertionAxiom(classNode, indNode2);
OWLIndividualAxiom axmNodeInst1 =factory.getOWLClassAssertionAxiom(classNode, indNode1);
// 1
// | \
// | 3 - 4
// | /
// 2
//
OWLIndividualAxiom axmEdge12 = factory.getOWLObjectPropertyAssertionAxiom(edgeProp, indNode1, indNode2);
OWLIndividualAxiom axmEdge13 = factory.getOWLObjectPropertyAssertionAxiom(edgeProp, indNode1, indNode3);
OWLIndividualAxiom axmEdge23 = factory.getOWLObjectPropertyAssertionAxiom(edgeProp, indNode2, indNode3);
OWLIndividualAxiom axmEdge34 = factory.getOWLObjectPropertyAssertionAxiom(edgeProp, indNode3, indNode4);
// symmetry of edge property
OWLObjectPropertyAxiom axmEdgeSym = factory.getOWLSymmetricObjectPropertyAxiom(edgeProp);
// axioms
OWLObjectUnionOf exprColorUnion = factory.getOWLObjectUnionOf(classBlue, classRed, classGreen);
OWLSubClassOfAxiom axmNodeColorings = factory.getOWLSubClassOfAxiom(classNode, exprColorUnion);
// coloring constraints
OWLSubClassOfAxiom axmRedConstraint = factory.getOWLSubClassOfAxiom(classRed, factory.getOWLObjectAllValuesFrom(edgeProp, factory.getOWLObjectUnionOf(classGreen, classBlue)));
OWLSubClassOfAxiom axmBlueConstraint = factory.getOWLSubClassOfAxiom(classBlue, factory.getOWLObjectAllValuesFrom(edgeProp, factory.getOWLObjectUnionOf(classGreen, classRed)));
OWLSubClassOfAxiom axmGreenConstraint = factory.getOWLSubClassOfAxiom(classGreen, factory.getOWLObjectAllValuesFrom(edgeProp, factory.getOWLObjectUnionOf(classRed, classBlue)));
OWLDisjointClassesAxiom axmDisColors = factory.getOWLDisjointClassesAxiom(classRed, classBlue, classGreen);
try {
ontoColoring = manager.createOntology();
manager.addAxiom(ontoColoring, axmNodeInst1);
manager.addAxiom(ontoColoring, axmNodeInst2);
manager.addAxiom(ontoColoring, axmNodeInst3);
manager.addAxiom(ontoColoring, axmNodeInst4);
manager.addAxiom(ontoColoring, axmEdge12);
manager.addAxiom(ontoColoring, axmEdge13);
manager.addAxiom(ontoColoring, axmEdge23);
manager.addAxiom(ontoColoring, axmEdge34);
manager.addAxiom(ontoColoring, axmEdgeSym);
manager.addAxiom(ontoColoring, axmNodeColorings);
manager.addAxiom(ontoColoring, axmRedConstraint);
manager.addAxiom(ontoColoring, axmBlueConstraint);
manager.addAxiom(ontoColoring, axmGreenConstraint);
manager.addAxiom(ontoColoring, axmDisColors);
} catch (OWLOntologyCreationException e) {
e.printStackTrace();
}
return ontoColoring;
}