質問

私はいくつかのカスタムタイプがあります:

[RdfSerializable]
public class Item
{
    [RdfProperty(true)]
    public string Name { get; set; }
}

とアイテムの配列を有しているいくつかの他のタイプ:

[RdfSerializable]
public class Container
{
      // ... some code

      // if this attribute is missing, then this property will not be exported as array
      [CardinalityRestriction(1, 100)]     
      [RdfProperty(false)]
      public Item[] MyArray { get { return mMyArray; } }
}

そして、私がMyArrayというのCardinalityRestriction属性を削除した場合、それは単一の項目として、およびいない項目の配列としてOwlGrinder.exeによってエクスポートされることが起こっている。

要素のいくつかの範囲にそれらを制約せずに配列を定義するためにいくつかの他の方法はありますか?

役に立ちましたか?

解決

ROWLEX のOntologyExtractor OwlGrinderはオントロジーを読み取り、アセンブリを生成し(正しく動作します。OntologyExtractor読み込みアセンブリとオントロジーを出してくれる)。 に関連付けられ基数制限がない場合OWL仕様は、をによりますOWLプロパティは、そのカーディナリティは「ゼロ以上」と想定されます。あなたは、プロパティは「配列プロパティ」ではないことが、あなたはカーディナリティの制限を適用する必要がしたいはずです。そのための速記は、OWLプロパティA 機能特性を作っていますカーディナリティは0または1である

だから、すべてを行う必要がある[CardinalityRestiction(1100)]装飾を削除して、あなたが望むものを持っています。

[EDIT:コメントに応答] 私は、あなたのケースを再現しCardinalityRestrictionを除去し、OntologyExtractorは、以下のオントロジーを生成します:

<?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:owl="http://www.w3.org/2002/07/owl#" xmlns:rdfschema="http://www.w3.org/2000/01/rdf-schema#">
    <owl:Ontology rdf:about="http://www.test.com/MyOntology" />
    <owl:Class rdf:about="http://www.test.com/MyOntology#Item" />
    <owl:DatatypeProperty rdf:about="http://www.test.com/MyOntology#Name">
        <rdfschema:domain rdf:resource="http://www.test.com/MyOntology#Item" />
        <rdfschema:range rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
        <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#FunctionalProperty" />
    </owl:DatatypeProperty>
    <owl:ObjectProperty rdf:about="http://www.test.com/MyOntology#MyArray">
        <rdfschema:domain>
            <owl:Class rdf:about="http://www.test.com/MyOntology#Container" />
        </rdfschema:domain>
        <rdfschema:range rdf:resource="http://www.test.com/MyOntology#Item" />
    </owl:ObjectProperty>
</rdf:RDF>

このオントロジーは、あなたのコンテナオブジェクトは、MyArrayというOWLのプロパティを介して連結された0個以上の項目を持っているRDFファイルを作成することができます。

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top