英文:
Not able to get all subclasses from Protégé query
问题
I'm trying to get all classes information with a query like this: tire that HasWidth some Width125
. What I expect to have is the list of all classes that have or could have the indicated width.
This is my custom Model for a tire called AS7
<owl:Class rdf:about="#AS7">
<rdfs:label xml:lang="en">Avon AS7</rdfs:label>
<rdfs:subClassOf rdf:resource="https://spec.edmcouncil.org/auto/ontology/VC/VehicleParts/PneumaticTire"/>
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="#HasWidth"/>
<owl:someValuesFrom rdf:resource="#Width"/>
</owl:Restriction>
</rdfs:subClassOf>
<rdfs:subClassOf>
</owl:Class>
That is my Width class
<owl:Class rdf:about="#Width">
<rdfs:label xml:lang="en">Width</rdfs:label>
<rdfs:subClassOf rdf:resource="https://spec.edmcouncil.org/auto/ontology/VC/VehicleParts/Tire"/>
</owl:Class>
And here an example of subclass
<owl:Class rdf:about="#Width125">
<rdfs:subClassOf rdf:resource="#Width"/>
<rdfs:comment>Width 125.</rdfs:comment>
<rdfs:isDefinedBy rdf:resource=""/>
<rdfs:label>Width 125</rdfs:label>
</owl:Class>
Is my restriction/DL query incorrect or may I miss something?
英文:
I'm trying to get all classes information with a query like this: tire that HasWidth some Width125
. What I expect to have is the list of all classes that have or could have the indicated width.
This is my custom Model for a tire called AS7
<owl:Class rdf:about="#AS7">
<rdfs:label xml:lang="en">Avon AS7</rdfs:label>
<rdfs:subClassOf rdf:resource="https://spec.edmcouncil.org/auto/ontology/VC/VehicleParts/PneumaticTire"/>
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="#HasWidth"/>
<owl:someValuesFrom rdf:resource="#Width"/>
</owl:Restriction>
</rdfs:subClassOf>
<rdfs:subClassOf>
</owl:Class>
That is my Width class
<owl:Class rdf:about="#Width">
<rdfs:label xml:lang="en">Width</rdfs:label>
<rdfs:subClassOf rdf:resource="https://spec.edmcouncil.org/auto/ontology/VC/VehicleParts/Tire"/>
</owl:Class>
And here an example of subclass
<owl:Class rdf:about="#Width125">
<rdfs:subClassOf rdf:resource="#Width"/>
<rdfs:comment>Width 125.</rdfs:comment>
<rdfs:isDefinedBy rdf:resource=""/>
<rdfs:label>Width 125</rdfs:label>
</owl:Class>
Is my restriction/DL quey incorrect or may I miss something?
答案1
得分: 0
解决它。问题出在我需要一个具有属性 intersectionOf 的集合上。
代码看起来像这样:
<owl:Class rdf:about="#AllWidth">
<rdfs:subClassOf rdf:resource="#Width"/>
<owl:equivalentClass>
<owl:Class>
<owl:intersectionOf rdf:parseType="Collection">
<owl:Restriction>
<owl:onProperty rdf:resource="#HasWidth"/>
<owl:someValuesFrom rdf:resource="#Width125"/>
</owl:Restriction>
...
</owl:intersectionOf>
</owl:Class>
</owl:equivalentClass>
</owl:Class>
而在属性中
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="#HasWidth"/>
<owl:allValuesFrom rdf:resource="#AllWidth"/>
</owl:Restriction>
</rdfs:subClassOf>
英文:
Solve it. The issue was on my restriction that needs to be a collections with the property intersectionOf.
The code looks like this:
<owl:Class rdf:about="#AllWidth">
<rdfs:subClassOf rdf:resource="#Width"/>
<owl:equivalentClass>
<owl:Class>
<owl:intersectionOf rdf:parseType="Collection">
<owl:Restriction>
<owl:onProperty rdf:resource="#HasWidth"/>
<owl:someValuesFrom rdf:resource="#Width125"/>
</owl:Restriction>
...
</owl:intersectionOf>
</owl:Class>
</owl:equivalentClass>
</owl:Class>
And in the property
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="#HasWidth"/>
<owl:allValuesFrom rdf:resource="#AllWidth"/>
</owl:Restriction>
</rdfs:subClassOf>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论