A Walkthrough Example

In the following a step-by-step explanation for the following swget command (and NautiLOD expression) is provided.

Natural language description:

Find information about cities with less than 15000 persons in which musicians, currently living in Italy, were born.

We’ll use the following abbreviations:

Short namespace

Full namespace

dbpedia-owl: http://dbpedia.org/ontology/
rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns#
owl: http://www.w3.org/2002/07/owl#

Set by step construction of the swget command:

  • We suppose to start from dbpedia.org, which is one of the most important information sources in the Web of Data. Here, we identify the resource http://dbpedia.org/resource/Italy as the starting point for our information request. Our swget command will start with:

swget http://dbpedia.org/resource/Italy

  • To identify people currently living in Italy we leverage the property dbpedia-owl:hometown  defined in the DBPedia ontology . In terms of our request, this means that we can follow links for which this property holds. Therefore, we add to the previous swget command the option -p predicate stating the predicate that we want to expand. Our swget command becomes:

swget http://dbpedia.org/resource/Italy -p dbpedia-owl:hometown

  • With the previous command we are able to get information about all the resources related to Italy by the dbpedia-owl:hometown property. This means that we can have different kinds of resources such as Musicians, Painters, Football Players and so forth. However, we are interested just in Musicians. Therefore, at the next step we have to continue to gather information only about Musicians. swget enables to control the navigation process by inserting triggers on the form of SPARQL queries into regular expressions, which are exploited to define predicate expansion and then recursive navigation.
  • The control the further expansion of resource that are Persons and then Musicians we can exploit the following SPARQL query: [ASK {?ctx rdf:type dbpedia-owl:Person. ?ctx rdf:type dbpedia:MusicalArtist.}]. The initial swget command then becomes:

swget http://dbpedia.org/resource/Italy -p dbpedia-owl:hometown[ASK {?ctx rdf:type dbpedia-owl:Person. ?ctx rdf:type dbpedia:MusicalArtist.}]

  • At this point swget can discern links to be followed to identify the place were MusicalArtist(s) were born by exploiting again regular expressions. In particular, the property dbpedia-owl:birthPlace is exploited. Note that with this regular expression we will be able to dereference URIs of resources representing cities. The swget commad updated is:

swget http://dbpedia.org/resource/Italy -p dbpedia-owl:hometown[ASK {?ctx rdf:type dbpediaowl:Person. ?ctx rdf:type dbpedia:MusicalArtist.}]/dbpedia-owl:birthPlace

  • With the previous command, swget obtains information about all cities were MusicialArtist(s) were born. However, we are interested only in places with less than 15000 people. Again, swget can exploit SPARQL queries to select among all the possible cities those to be expanded. In particular, the following SPARQL query is exploited: [ASK {?ctx dbpedia-owl:populationTotal ?pop. FILTER (?pop <15000).}]. According to this new piece of information the swget command will be updated as follows:

swget http://dbpedia.org/resource/Italy -p dbpedia-owl:hometown[ASK {?ctx rdf:type dbpedia-owl:Person. ?ctx rdf:type dbpedia:MusicalArtist.}]/dbpedia-owl:birthPlace[ASK {?ctx dbpedia-owl:populationTotal ?pop. FILTER (?pop <15000).}]

  • With the previous command we are able to obtain the information we wanted. However, one may be interested in collecting different representations for the same real world entity from different information providers (e.g., dbpedia.org, freebase.com). In the Semantic Web the predicate owl:sameAs is used to link different representations for the same real world entity. swget can recursively expand owl:sameAs predicates via regular expressions. Since we are dealing with predicate expansions, we use owl:sameAs* . Note that the symbol * instructs swget to recursively expand a chain of owl:sameAs of whatever length. The final swget command will be:

swget http://dbpedia.org/resource/Italy -p dbpedia-owl:hometown[ASK {?ctx rdf:type dbpedia-owl:Person. ?ctx rdf:type dbpedia:MusicalArtist.}]/dbpedia-owl:birthPlace[ASK {?ctx dbpedia-owl:populationTotal ?pop. FILTER (?pop <15000).}]/owl:sameAs*

To summarize, the previous command has the following form: swget -p <p1>[Q1]/<p2>[Q2]/<p3> where <p1>, <p2>,<p3> are regular expressions over predicates and [Q1] and [Q2] are SPARQL queries to control the navigation.

Advertisements