My goal: Have a list of the Smartphones from DBpedia associated with manufacturers.
Example:
Iphone 6 | Apple
Samsung Galaxy S6 | Samsung
Iphone 5 | Apple
Sony xperia Z5 | Sony
What I did:
I think that it would be a union query. So as a first step I tried to get all the smartphone list and I succeeded using this query:
SELECT ?phone
where {?phone <http://dbpedia.org/property/type> <http://dbpedia.org/resource/Smartphone>}
However I didn't succeed to get the manufactures list. I tried this query in order to get the manufacturer of the Iphone 6. But it didn't work.
SELECT ?Manufacturer
where {?Manufacturer <http://dbpedia.org/property/manufacturer> <http://dbpedia.org/resource/Smartphone>}
?phone dbp:type dbr:Smartphone
This triple roughly means: "the type
of ?phone
is Smartphone
". That makes sense, so you get what you want.
?manufacturer dbp:manufacturer dbr:Smartphone
This triple means: "the manufacturer
of ?manufacturer
is Smartphone
". That doesn't make any sense, Smartphone
is not something that can be a manufacturer. This is why you get no results.
What you want is:
type
of ?phone
is Smartphone
manufacturer
of ?phone
is ?manufacturer
In SPARQL:
SELECT *
WHERE {
?phone dbp:type dbr:Smartphone.
?phone dbp:manufacturer ?manufacturer.
}