I'm trying to define class of intervals. Each interval object may have (optionally) at most two boundary points. One of them - lower boundary, and another - upper boundary. How can I restrict my class of intervals, so that lower and upper individual boundary points must be different (if provided)?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
You can declare that the hasLowerBound and hasUpperBound properties are disjoint. This means that an individual with values for both cannot have the same value for both. Here's an example. I've used an object property here, but you can use disjoint property axioms with datatype properties, too.
@prefix : <http://stackoverflow.com/q/36043590/1281433/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
<http://stackoverflow.com/q/36043590/1281433/#hasLowerBound>
a owl:ObjectProperty ;
owl:propertyDisjointWith <http://stackoverflow.com/q/36043590/1281433/#hasUpperBound> .
<http://stackoverflow.com/q/36043590/1281433/#hasUpperBound>
a owl:ObjectProperty .
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://stackoverflow.com/q/36043590/1281433/"
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#">
<owl:ObjectProperty rdf:about="http://stackoverflow.com/q/36043590/1281433/#hasUpperBound"/>
<owl:ObjectProperty rdf:about="http://stackoverflow.com/q/36043590/1281433/#hasLowerBound">
<owl:propertyDisjointWith rdf:resource="http://stackoverflow.com/q/36043590/1281433/#hasUpperBound"/>
</owl:ObjectProperty>
</rdf:RDF>