问题描述
我正在使用Protege在OWL中添加一些新的数据类型.
I am adding few new DataType in the OWL using Protege.
DataType类似于百分比,我想用0到100范围内的double值来指定它的范围.
The DataType is like percentage and I want to specify it's range with the double value ranging from 0 to 100.
类似地,一个名为Quality的数据类型,我想用从0到1的double值来指定它的范围.
Similarly a DataType named Quality and I want to specify it's range with the double value ranging from 0 to 1.
我们如何在数据范围表达式中指定这些内容?
How can we specify these things in the Data range Expression ?
我试图找出答案,但是我发现了两个链接,但在我的上下文中没有用.
I tried to find out but I found two links but not useful in my context.
-
如何为OWL定义自己的范围DataProperties 如果我们手动创建OWL文件而不使用Protege,则很有用.
How to Define My Own Ranges for OWL DataProperties This is useful if we are manually creating the OWL file and not using Protege.
http://answers.semanticweb.com/questions/16541/datatype-property-protege 这与上下文有关,因为我们不能选择添加新的数据类型.
http://answers.semanticweb.com/questions/16541/datatype-property-protege This is related to the context when we don't have the option of adding the new data type.
请帮助如何在Protege中为这些情况编写数据范围表达式
Please help how to write the Data range expression for these scenario in 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 .
这篇关于为数据类型属性定义Protege中的DataRange表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!