Suppose I give a word "Product" the results should be
A product ... can be ... new ... NPD
A product ... can be ... existing ... Re-design
A Product ... has ... structure, ... has ... function, ... has ... behavior
where "can be" and "has" are object properties and structure, function , behavior etc are the instances linked to Product
I also want it to show the object properties of the output. Like here, I want it to show the object properties of Function, Behavior etc with terms other than product
Given the SPARQL query
PREFIX uni: <http://www.semanticweb.org/admin/ontologies/2017/4/untitled-ontology-19#>
SELECT ?has ?isa ?satisfies WHERE {
uni:Product uni:IsA ?isa .
uni:Product uni:Has ?has .
uni:Product uni:Satisfies ?satisfies
}
you can get additional information for each individual by appending another triple pattern with the variable being the subject of the triple pattern:
PREFIX uni: <http://www.semanticweb.org/admin/ontologies/2017/4/untitled-ontology-19#>
SELECT ?has ?p_has ?o_has ?isa ?p_isa ?o_isa ?satisfies ?p_satisfies ?o_satisfies
WHERE {
uni:Product uni:IsA ?isa .
?isa ?p_isa ?o_isa .
uni:Product uni:Has ?has .
?has ?p_has ?o_has .
uni:Product uni:Satisfies ?satisfies .
?satisfies ?p_satisfies ?o_satisfies
}
You might have to put it into OPTIONAL
clauses because it wouldn't return something if there is no such information:
PREFIX uni: <http://www.semanticweb.org/admin/ontologies/2017/4/untitled-ontology-19#>
SELECT ?has ?p_has ?o_has ?isa ?p_isa ?o_isa ?satisfies ?p_satisfies ?o_satisfies
WHERE {
uni:Product uni:IsA ?isa .
OPTIONAL {?isa ?p_isa ?o_isa }
uni:Product uni:Has ?has .
OPTIONAL {?has ?p_has ?o_has }
uni:Product uni:Satisfies ?satisfies .
OPTIONAL {?satisfies ?p_satisfies ?o_satisfies }
}