我使用Protege在OWL中添加了一些新的DataType。
DataType就像百分比,我想指定它的范围,双精度值范围从0到100。
类似地,一个名为Quality的DataType,我想指定它的范围,其double值范围从0到1。
我们如何在数据范围表达式中指定这些内容?
我试图找出,但我找到了两个链接但在我的上下文中没用。
请帮助如何在Protege中为这些场景编写数据范围表达式
场景:
这只是xsd:double[ >= 0, <= 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="http://stackoverflow.com/q/24531940/1281433/percentages#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#">
<owl:Ontology rdf:about="http://stackoverflow.com/q/24531940/1281433/percentages"/>
<owl:DatatypeProperty rdf:about="http://stackoverflow.com/q/24531940/1281433/percentages#hasPercentage">
<rdfs:range>
<rdfs:Datatype>
<owl:onDatatype rdf:resource="http://www.w3.org/2001/XMLSchema#double"/>
<owl:withRestrictions rdf:parseType="Collection">
<rdf:Description>
<xsd:minInclusive rdf:datatype="http://www.w3.org/2001/XMLSchema#integer"
>0</xsd:minInclusive>
</rdf:Description>
<rdf:Description>
<xsd:maxInclusive rdf:datatype="http://www.w3.org/2001/XMLSchema#integer"
>100</xsd:maxInclusive>
</rdf:Description>
</owl:withRestrictions>
</rdfs:Datatype>
</rdfs:range>
</owl:DatatypeProperty>
</rdf:RDF>
@prefix : <http://stackoverflow.com/q/24531940/1281433/percentages#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
:hasPercentage a owl:DatatypeProperty ;
rdfs:range [ a rdfs:Datatype ;
owl:onDatatype xsd:double ;
owl:withRestrictions ( [ xsd:minInclusive
0 ] [ xsd:maxInclusive 100 ] )
] .
<http://stackoverflow.com/q/24531940/1281433/percentages>
a owl:Ontology .
这篇文章可能对那些想要将离散整数(或任何数据类型)值指定为数据类型属性范围的人有所帮助。在数据范围表达式编辑器中键入以下代码:
{"0"^^xsd:int , "1"^^xsd:int , "10"^^xsd:int , "18"^^xsd:int , "2"^^xsd:int , "3"^^xsd:int , "4"^^xsd:int , "5"^^xsd:int , "6"^^xsd:int , "8"^^xsd:int}