The Knowledge Graph Conference Icon
The Knowledge Graph Conference
  • 馃彔Home
  • 馃搮Events
  • 馃懁Members
  • 馃數Announcements
  • 馃數Ask
  • 馃數Ask The Ontologists
  • 馃數Events
  • 馃數Jobs
  • 馃數Promotions
  • 馃數Share
Powered by Tightknit
Ask
Ask

DBpedia Querying: Troubleshooting Composer Data in SPARQL

Avatar of Eszter S.Eszter S.
路May 04, 2021 07:13 PM

Milan Dojchinovski Jan Forberg Hi Milan and Jan - thank you for the lovely tutorial! I am playing around with querying dbpedia and using composers as a practice example. For example, pull composer, composition and premier date of composition for e.g. classical music (1750-1820). Examining the examples under OnlineAccess, some things that are confusing me:

  1. 1.

    Filtering in the where cause with ?person dbo:birthPlace :Berlin . causes an error in https://dbpedia.org/sparql, namely, Undefined default namespace prefix at ':Berlin' before '.'. How would that clause be written correctly for the sparql endpoint?

  2. 2.

    dbo:SoccerPlayer returns results, yet dbo:MusicComposer- although defined in the ontology - does not. I am assuming that means no content was tagged with MusicComposer? How could one then find music composers?

Thank you!

馃檶1

9 comments

路 Sorted by Oldest
  • Avatar of Milan Dojchinovski
    Milan Dojchinovski
    路

    Hi Eszter S., let me try to help here

  • Avatar of Milan Dojchinovski
    Milan Dojchinovski
    路

    for 1) try following:

    SELECT ?person WHERE {
        ?person dbo:birthPlace <http://dbpedia.org/resource/Berlin> . 
    }

    or shorter version

    SELECT ?person WHERE {
        ?person dbo:birthPlace dbr:Berlin . 
    }

    dbr is prefix for http://dbpedia.org/resource/

    :thanks:1
  • Avatar of Milan Dojchinovski
    Milan Dojchinovski
    路

    as for 2) to pull composers and their compositions you can try following:

    SELECT * WHERE {
    
        ?composer a dbo:Person .
        ?composer dct:subject dbc:18th-century_classical_composers .
        ?composition dbp:composer ?composer . 
    }

  • Avatar of Milan Dojchinovski
    Milan Dojchinovski
    路

    usually, to have a better coverage one would need to craft several queries, and then merge the results

  • Avatar of Milan Dojchinovski
    Milan Dojchinovski
    路

    do you have a use case for DBpedia in the music domain? would be happy to assist further

  • Avatar of Eszter S.
    Eszter S.
    路

    Thank you, Milan! The above really helped. The use case is just a personal project a friend and I are working on. He is creating a way to show what classical pieces premiered each day (as a way of suggesting what to listen to) and I am helping as a way to learn more about querying kgs. It just seemed like a small, easy, bit-sized way to get into kgs.... One last thing - do you know of a good resource that explains how to find the right resource / prefix for things?

  • Avatar of Louis G.
    Louis G.
    路

    I know of a good one in one direction: if you come across a prefix but don't know what it is, you can enter it in prefix.cc :) found that super helpful. Would also be interested in any resource to go the other way

  • Avatar of Milan Dojchinovski
    Milan Dojchinovski
    路

    Eszter S. not sure what you mean by "find the right resource / prefix for things"... but the list of defined prefixes in the sparql endpoint can be found at https://dbpedia.org/sparql?help=nsdecl

    馃憖1
  • Avatar of Eszter S.
    Eszter S.
    路

    That is very helpful, thank you! I believe the issue I am having is figuring out all the names of things. Like, as you showed, there is a dbc:18th-century_classical_composers. Not knowing that, how would I discover it? Right now, it feels like there is no discernible pattern that can be applied to each new question. For example, I had tried to translate the SoccerPlayer example from the OpenAccess to composers. However, since dbo:MusicaComposer does not seem to be linked to much, that doesn't work.