2017-04-25 7 views
1

は、私はそのようなOWLフォーマットを達成する必要があります。イエナOWL/RDF FunctionalPropertyの

<owl:DatatypeProperty rdf:ID="Role-description"> <rdfs:range 
rdf:resource="http://www.w3.org/2001/XMLSchema#string"/> 
<rdfs:domain rdf:resource="#Role"/> 
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#FunctionalProperty"/> 

私は次に何をしようとしたとき、私はイエナを使用しています:

DatatypeProperty datatypeProperty = ontModel.createDatatypeProperty(OWL.NS + "Role-description"); 
datatypeProperty.addRDFType(OWL.FunctionalProperty); 
datatypeProperty.asDatatypeProperty(); 

すべての万力にその逆を取得します。

<rdf:RDF 
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
    xmlns:owl="http://www.w3.org/2002/07/owl#" 
    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" 
    xmlns:xsd="http://www.w3.org/2001/XMLSchema#"> 
    <owl:Class rdf:about="http://www.w3.org/2002/07/owl#Task"/> 
    <owl:Class rdf:about="http://www.w3.org/2002/07/owl#Actor"/> 
    <owl:ObjectProperty rdf:about="http://www.w3.org/2002/07/owl#Task-performedBy-Actor"/> 
    <owl:ObjectProperty rdf:about="http://www.w3.org/2002/07/owl#Actor-performs-Task"/> 
    <owl:FunctionalProperty rdf:about="http://www.w3.org/2002/07/owl#Role-description"> 
    <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#DatatypeProperty"/> 
    </owl:FunctionalProperty> 
</rdf:RDF> 

はどんなアドバイス

+0

を私はWH YITの重要なデータがシリアル化されるかを理解していません。セマンティクスは同じものとみなされ、適切なパーサーは、同じ完全で正確な情報を取得します。 OWLのオントロジーはOWLの公理の集合で構成されているため、OWLのシリアライズには順序がありません。 – AKSW

+0

@AKSW頻繁に過度に指定されたリクエストや割り当ての結果として、同様のニーズが頻繁に見られました。多くの場合、RDF以外のツールチェーンや非OWLツールチェーンとのやりとりの結果。 – Ignazio

答えて

2

あなたが取得している出力がその逆ではないことを理解するであろう。基本的には、複数の型を持つRDFリソースです。 Jenaには、それらをシリアル化する方法(つまり、「プライマリ」を考慮する方法)があります。説明するために、私はカメ(少しカスタム名前空間を使用するように変更)にあなたの例を連載します:

public static final String ROLES_NS = "http://example.com/ns/roles#"; 

public static void main(String[] args) { 
    OntModel ontModel = ModelFactory.createOntologyModel(OntModelSpec.OWL_DL_MEM); 
    ontModel.setNsPrefix("roles", ROLES_NS); 

    DatatypeProperty prop = ontModel.createDatatypeProperty(
      ROLES_NS + "Role-description"); 
    prop.setRDFType(OWL.FunctionalProperty); 
    prop.addRDFType(OWL.DatatypeProperty); 

    RDFDataMgr.write(System.out, ontModel, RDFFormat.RDFXML_PRETTY); 
} 
:今

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . 
@prefix owl: <http://www.w3.org/2002/07/owl#> . 
@prefix roles: <http://example.com/ns/roles#> . 
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . 
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . 

roles:Role-description 
     a  owl:DatatypeProperty , owl:FunctionalProperty . 

、ここにあなたがに便利なシリアル化タイプの順序を操作する方法であります

それは次のような出力生成:

<rdf:RDF 
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
    xmlns:owl="http://www.w3.org/2002/07/owl#" 
    xmlns:roles="http://example.com/ns/roles#" 
    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" 
    xmlns:xsd="http://www.w3.org/2001/XMLSchema#"> 
    <owl:DatatypeProperty rdf:about="http://example.com/ns/roles#Role-description"> 
    <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#FunctionalProperty"/> 
    </owl:DatatypeProperty> 
</rdf:RDF> 
+0

Utが動作します、ありがとう、ありがとう! – Svitlana

関連する問題