-2

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>}
svick
  • 236,525
  • 50
  • 385
  • 514
  • This should have been an edit to one of your earlier questions under your other account, e.g., http://stackoverflow.com/questions/38171909/a-simlpe-sparql-query-over-dbpedia-and-using-python . – Joshua Taylor Jul 11 '16 at 19:55
  • Right, I was thinking the same when I saw this here, but somehow my comment got lost. @Amir Ladhar: Can you give us the reason for creating a new account and post a - to some extend related question to your previous one? And wouldn't it make sense to reply to peoples comments and/or questions? – UninformedUser Jul 11 '16 at 20:04
  • BY the way, what you "tried" is something that I showed to you, so it would be nice to refer to it... – UninformedUser Jul 11 '16 at 20:05

1 Answers1

1
?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:

  • the type of ?phone is Smartphone
  • the manufacturer of ?phone is ?manufacturer

In SPARQL:

SELECT *
WHERE {
  ?phone dbp:type dbr:Smartphone.
  ?phone dbp:manufacturer ?manufacturer.
}
scotthenninger
  • 3,921
  • 1
  • 15
  • 24
svick
  • 236,525
  • 50
  • 385
  • 514