我有这个猫头鹰文件。 #indelivers是#ipInDelivers的子类。我想知道的是如何找到这个类的#isPartOfMibDef资源,在这种情况下是#IP-MIB。
<owl:ObjectProperty rdf:about="#isPartOfMibDef"/>
<owl:ObjectProperty rdf:about="#hasSyntax"/>
<owl:Class rdf:about="#Counter32">
<rdfs:subClassOf rdf:resource="#SYNTAX"/>
</owl:Class>
<owl:Class rdf:about="&owl;Thing"/>
<owl:Class rdf:about="#mibObjects">
<rdfs:subClassOf rdf:resource="&owl;Thing"/>
</owl:Class>
<owl:Class rdf:about="#IP-MIB">
<rdfs:subClassOf rdf:resource="#mibDefs"/>
</owl:Class>
<owl:Class rdf:about="#ipInDelivers">
<owl:equivalentClass>
<owl:Class>
<owl:intersectionOf rdf:parseType="Collection">
<owl:Restriction>
<owl:onProperty rdf:resource="#hasSyntax"/>
<owl:allValuesFrom rdf:resource="#Counter32"/>
</owl:Restriction>
<owl:Restriction>
<owl:onProperty rdf:resource="#isPartOfMibDef"/>
<owl:allValuesFrom rdf:resource="#IP-MIB"/>
</owl:Restriction>
</owl:intersectionOf>
</owl:Class>
</owl:equivalentClass>
<rdfs:subClassOf rdf:resource="#mibObjects"/>
</owl:Class>
<owl:Class rdf:about="#aliases">
<rdfs:subClassOf rdf:resource="&owl;Thing"/>
</owl:Class>
<owl:Class rdf:about="#indelivers">
<rdfs:subClassOf rdf:resource="#aliases"/>
<rdfs:subClassOf rdf:resource="#ipInDelivers"/>
</owl:Class>
到目前为止我的代码是:
String NS = "http://namespace.com/owl#";
InputStream is = FileManager.get().open(this.owlPath);
OntModel ontology = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM_MICRO_RULE_INF,null);
ontology.read(is,"");
Reasoner reason = ReasonerRegistry.getOWLMicroReasoner();
InfModel info = ModelFactory.createInfModel(reason,ontology);
OntClass alias = this.ontology.getOntClass(NS+"indelivers");
OntClass superClass = alias.getSuperClass();
我尝试访问superClass中的大多数get-和list函数,但我似乎无法在任何地方找到#isPartOfMibDef
答案 0 :(得分:0)
您的命名空间应为:
String NS = "http://namespace.com/owl#";
答案 1 :(得分:0)
这对我有用。我的猫头鹰类“会话”虽然没有交集。
OntClass cl1 = model.getOntClass(nsPrefix + "session");
OntClass cl = cl1.getSuperClass();
for (StmtIterator i = model.listStatements(cl, null, (RDFNode) null); i.hasNext(); ) {
Statement stmt = i.nextStatement();
logger.info(" - " + PrintUtil.print(stmt));
}