如何用owl阅读本体文件:JENA中的导入?

时间:2015-04-24 14:51:06

标签: jena owl ontology

我有一个猫头鹰文件,可以从其他猫头鹰文件中导入其他一些本体。我试图遵循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);

0 个答案:

没有答案