我有一个从其他猫头鹰文件导入其他一些本体的OWL文件。 我试图按照JENA API文档来对付它,但无法成功。 我在想什么?
我使用的代码是以上:
E-GovSecAOnto.owl进口:
<owl:Ontology rdf:about="">
<owl:imports rdf:resource="http://www.ida.liu.se/~iislab/projects/secont/Security.owl"/>
<owl:imports rdf:resource="http://www.unifiedcloud.org/2009/2/26/uci.owl"/>
<owl:imports rdf:resource="http://wwwsemanticweb.org/ontologies/Portaria141.owl"/>
</owl:Ontology>
ONT-policy.rdf:
<?xml version='1.0'?>
<!DOCTYPE rdf:RDF [
<!ENTITY jena 'http://jena.hpl.hp.com/schemas/'>
<!ENTITY rdf 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
<!ENTITY rdfs 'http://www.w3.org/2000/01/rdf-schema#'>
<!ENTITY xsd 'http://www.w3.org/2001/XMLSchema#'>
<!ENTITY base '&jena;2003/03/ont-manager'>
<!ENTITY ont '&base;#'>
]>
<rdf:RDF
xmlns:rdf ="&rdf;"
xmlns:rdfs="&rdfs;"
xmlns ="&ont;"
xml:base ="&base;"
>
<DocumentManagerPolicy>
<processImports rdf:datatype="&xsd;boolean">true</processImports>
<cacheModels rdf:datatype="&xsd;boolean">true</cacheModels>
</DocumentManagerPolicy>
<OntologySpec>
<altURL rdf:resource="file:///C:/Users/usuario/Documents/Visual Studio 2013/WebSites/FrameworkBeta/Repository/Ontologies/Portaria141/Portaria141_V1.owl"/>
<language rdf:resource="http://www.w3.org/2002/07/owl"/>
<publicURI rdf:resource="http://wwwsemanticweb.org/ontologies/Portaria141.owl"/>
</OntologySpec>
<OntologySpec>
<altURL rdf:resource="file:///C:/Users/usuario/Documents/Visual Studio 2013/WebSites/FrameworkBeta/Repository/Ontologies/CloudComputing/uci.owl"/>
<language rdf:resource="http://www.w3.org/2002/07/owl"/>
<publicURI rdf:resource="http://www.unifiedcloud.org/2009/2/26/uci.owl"/>
</OntologySpec>
</rdf:RDF>
ReadOntology():
OntDocumentManager dm = new OntDocumentManager(dmFileName);
OntModelSpec modelSpec = new OntModelSpec( OntModelSpec.RDFS_MEM );
modelSpec.setDocumentManager(dm);
OntModel m = ModelFactory.createOntologyModel(modelSpec);
m.read(FileManager.get().open(@"C:\Users\usuario\Documents\Visual Studio 2013\WebSites\FrameworkBeta\Repository\Ontologies\e-GovSecAOnto\e-GovSecAOnto.owl"), NS);