[英]Writing OWLObjectPropertyExpression on OWL Ontology using OWL API
I'm trying to write an OWLObjectPropertyExpression on OWL Ontology object. 我正在尝试在OWL本体对象上编写OWLObjectPropertyExpression。 If I had an OWL Class I use something like the following:
如果我有OWL类,则使用类似以下的内容:
OWLOntologyManager managerWriter = OWLManager.createOWLOntologyManager();
OWLOntology ontoWrite=managerWriter.createOntology();
OWLDataFactory factory = manager.getOWLDataFactory();
managerWriter.addAxiom(ontoWrite,factory.getOWLDeclarationAxiom(factory.getOWLClass((cl.getIRI()))));
But what should I write if I want to write an OWLObjectPropertyExpression ? 但是,如果我想编写OWLObjectPropertyExpression,应该怎么写? Thanks in advance !.
提前致谢 !。
The following code snippet illustrate an example of usage and creation of an OWL expression using the OWL API (taken and adapted from there ): 以下代码段说明了使用OWL API(从此处获取和改编)来使用和创建OWL表达式的示例:
//OWL Expression we would like to create:
//in OWL Functional syntax: ObjectIntersectionOf(A ObjectSomeValuesFrom(R B))
//in Manchester syntax: A and R some B
PrefixManager pm = new DefaultPrefixManager("http://example.org/");
OWLClass A = factory.getOWLClass(":A", pm);
OWLObjectProperty R = factory.getOWLObjectProperty(":R", pm);
OWLClass B = factory.getOWLClass(":B", pm);
//The expression
OWLClassExpression expression =
factory.getOWLObjectIntersectionOf(A, factory.getOWLObjectSomeValuesFrom(R, B));
//Create a class in order to use the expression
OWLClass C = factory.getOWLClass(":C", pm);
// Declare an equivalentClass axiom
//Just there to show how an example on how to use the expression
OWLAxiom definition = factory.getOWLEquivalentClassesAxiom(C, expression);
manager.addAxiom(ontology, definition);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.