문제

맞춤형 유형이 있습니다.

[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는 온톨로지를 읽고 어셈블리를 생성합니다. Ontology -Extractor는 어셈블리와 끈적 끈적한 온톨로지를 읽습니다). 에 따르면 올빼미 사양, 올빼미 속성과 관련된 카디널리티 제한이 없으면 카디널리티는 "0 이상"으로 가정됩니다. 속성이 "배열 속성"이 아닌 경우 카디널리티 제한을 적용해야합니다. 그것의 속기는 올빼미 속성을 만드는 것입니다. 기능적 속성, 여기서 카디널리티는 0 또는 1입니다.

따라서 [CardinalityRestiction (1,100)] 장식을 제거하면 원하는 것을 제거하기 만하면됩니다.

편집 : 의견에 대한 응답] 나는 당신의 사례를 재현하고, 카디널리티 레스틱을 제거했으며, Ontology -Extractor는 다음과 같은 온톨로지를 생성합니다.

<?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 올빼미 속성을 통해 링크 된 0 이상의 항목이있는 RDF 파일을 만들 수 있습니다.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top