I did create the following simple ontology as seen in the picture and code below. My ontology But I am not able to query this ontology.
I would like to make an AKS query, if this one is true than an SELECT query, if false a CONSTRUCT query. I would like to see if a class machine (later a subclass) is connected by a data property with part (later a subclass) and then pull the comment of the part. I tried to combine those answers: Answer1 and Answer2. My question is probably extremely basic but it seems that I can't get my head around this problem. Thank you for your help and patience
My queries look at the moment like this (I put the prefix here only once):
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
ASK { ?machine base:partOf ?part .
?part rdfs:comment ?comment}
SELECT ?machine ?part ?comment
WHERE {
?machine base:partOf ?part .
?part rdfs:comment ?comment.
}
CONSTRUCT {?part rdfs:comment ?comment}
WHERE { ?machine base:partOf ?part .
?part rdfs:comment ?comment}
Onology
<!-- http://www.semanticweb.org/linus/ontologies/2019/5/untitled-ontology-11#partOf -->
<owl:ObjectProperty rdf:about="http://www.semanticweb.org/linus/ontologies/2019/5/untitled-ontology-11#partOf">
<rdfs:domain rdf:resource="http://www.semanticweb.org/linus/ontologies/2019/5/untitled-ontology-11#part"/>
<rdfs:range rdf:resource="http://www.semanticweb.org/linus/ontologies/2019/5/untitled-ontology-11#machine"/>
</owl:ObjectProperty>
<!-- http://www.semanticweb.org/linus/ontologies/2019/5/untitled-ontology-11#machine -->
<owl:Class rdf:about="http://www.semanticweb.org/linus/ontologies/2019/5/untitled-ontology-11#machine"/>
<!-- http://www.semanticweb.org/linus/ontologies/2019/5/untitled-ontology-11#part -->
<owl:Class rdf:about="http://www.semanticweb.org/linus/ontologies/2019/5/untitled-ontology-11#part"/>
Thank you for your help and patience!