You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Expand the API from the previous exercise by adding documentation and making sure your query can only be run on DBpedia SPARQL endpoint. Solution: SPARQL
Tip: Use the summary, description, endpoint and endpoint_in_url decorators.
#+ summary: Bands by city and genre#+ description:#+ This API endpoint lists bands from DBPedia that play either#+ Rock or Jazz, and that have either Liverpool or Los Angeles as hometown.#+ endpoint: http://dbpedia.org/sparql#+ endpoint_in_url: false#+ tags:#+ - dbpedia#+ method: GET#+ enumerate:#+ - genre:#+ - http://dbpedia.org/resource/Rock_music#+ - http://dbpedia.org/resource/Jazz#+ - hometown:#+ - http://dbpedia.org/resource/Liverpool#+ - http://dbpedia.org/resource/Los_AngelesPREFIX dbo: <http://dbpedia.org/ontology/>SELECTDISTINCT?sWHERE {
?sa dbo:Band;
dbo:genre ?_genre_iri;
dbo:hometown ?_hometown_iri
}
Create an API that lists the name, genre and hometown of bands whose name matches a given string. Solution: SPARQL
Tip 1: Use the DBpedia property type dbp:name.
Tip 2: Because DBpedia uses Virtuoso, you can use the built in function bif:contains.
#+ summary: Bands by city and genre#+ description:#+ This API endpoint lists bands from DBPedia that play either#+ Rock or Jazz, and that have either Liverpool or Los Angeles as hometown.#+ endpoint: http://dbpedia.org/sparql#+ endpoint_in_url: false#+ tags:#+ - dbpedia#+ method: GETPREFIX dbo: <http://dbpedia.org/ontology/>PREFIX dbp: <http://dbpedia.org/property/>PREFIX bif: <bif:>SELECTDISTINCT?name?genre?hometownWHERE {
?s a dbo:Band;
dbp:name ?name;
dbo:genre ?genre;
dbo:hometown ?hometown .
?name bif:contains ?_bandname
} LIMIT100