这是用于a的类表达式的示例 演示应用程序:
Lecturer
and (hasResearch some (relatedTo some Semantic_Web))
and (teaches at-least 3 Course)
and (hasTitle value "Assist.Prof.")
我通过这些方法创建OWLAPI对象(从String创建OWL对象)。
OWLClass lecturer = m.createOWLClassFromString("Lecturer");
OWLObjectProperty hasResearch = m.createOWLObjectPropertyFromString("hasResearch");
OWLObjectProperty teaches = m.createOWLObjectPropertyFromString("teaches");
OWLNamedIndividual sWeb = m.createOWLNamedIndividualFromString("Semantic_Web");
OWLClass course = m.createOWLClassFromString("Course");
OWLDataProperty hasTitle = m.createOWLDataPropertyFromString("hasTitle");
如何在Java上实现该类表达式?
[编辑#1] 我得到了实施:
OWLClass lecturer = m.createOWLClassFromString("Lecturer");
OWLObjectProperty hasResearch = m.createOWLObjectPropertyFromString("hasResearch");
OWLObjectProperty isRelatedToResearch = m.createOWLObjectPropertyFromString("isRelatedToResearch");
OWLObjectProperty teaches = m.createOWLObjectPropertyFromString("teaches");
OWLNamedIndividual sWeb = m.createOWLIndividualFromString("Semantic_Web");
OWLClass course = m.createOWLClassFromString("Course");
OWLClass researchArea = m.createOWLClassFromString("ResearchArea");
OWLDataProperty hasTitle = m.createOWLDataPropertyFromString("hasTitle");
OWLDatatype dt = m.getDataFactory().getRDFPlainLiteral();
OWLLiteral asstprof = m.getDataFactory().getOWLLiteral("Asst. Prof. Dr.",dt);
OWLClassExpression relateToSomeResearchArea = df.getOWLObjectSomeValuesFrom(isRelatedToResearch, researchArea);
OWLClassExpression hasResearchRelateToSomeResearchArea = df.getOWLObjectSomeValuesFrom(hasResearch,relateToSomeResearchArea);
OWLClassExpression teachesAtLeastThreeCourse = df.getOWLObjectMinCardinality(3, teaches, course);
OWLClassExpression hasTitleAsstProf = df.getOWLDataHasValue(hasTitle, asstprof);
Set s1 = new HashSet();
s1.add(lecturer);
s1.add(hasResearchRelateToSomeResearchArea);
s1.add(teachesAtLeastThreeCourse);
s1.add(hasTitleAsstProf);
OWLObjectIntersectionOf iof = df.getOWLObjectIntersectionOf(s1);
System.out.println(iof.getNestedClassExpressions());