题
我有一些自定义类型:
[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作为单个项目导出和NOT项目阵列。
是否有一些其它的方式来定义阵列没有他们限制在一定范围内的元素
解决方案
ROWLEX OntologyExtractor正确行为(OwlGrinder读取本体和生产组件。OntologyExtractor读取组件和吐出本体)。按照 OWL规范的,如果有相关的无基数限制OWL属性,那么它的基数假定“零个或多个”。如果你想有一个属性是不是“阵列属性”,那么你需要申请基数限制。一种用于该速记正在使OWL性的功能性质,其中基数是0或1
因此,所有你需要做的就是删除[CardinalityRestiction(1100)]装修,你有你想要的东西。
[编辑:响应在注释] 我你的再现的情况下,除去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>
这本体允许你创建RDF文件在您的容器对象具有零个或多个项目通过MYARRAY OWL财产相连的。
不隶属于 StackOverflow