I am just starting SPARQL recently and have got some questions.
When i am querying an endpoint (linked movie database) for actor and director of a given movie title, I will get nothing back if the querying movie has only got one of the requested property ( the movie only has actor or director property, for example this "Batman" film only has actor property http://data.linkedmdb.org/page/film/12583), so is there a way to query for multi-properties and get whatever the available result back even one the the requested property is unavailable?
How can i retrieve all the properties for a given movie title?
Thanks
Upvotes: 0
Views: 538
Reputation: 282
SELECT * WHERE { ?movie a ex:Movie . OPTIONAL { ?movie ex:prop1 ?prop1_value } OPTIONAL { ?movie ex:prop2 ?prop2_value } OPTIONAL { ?movie ex:prop3 ?prop3_value } }
SELECT ?p ?o WHERE { ex:MyMovie ?p ?o }
Of course, you'll need to replace all of the URIs above (ex:prop1, ex:MyMovie, etc.) with the actual URIs from the Linked MDB data set.
hope this helps!
Lee
Upvotes: 4