17
SPARQLing with GraphDB John P. McCrae, Thierry Declerck

SPARQLing with GraphDB - European Summer School in Logic ...esslli2018.folli.info/wp-content/uploads/SPARQLing-with-GraphDB.pdf · Step 1: Install GraphDB Go to your email and “download

  • Upload
    others

  • View
    13

  • Download
    0

Embed Size (px)

Citation preview

Page 1: SPARQLing with GraphDB - European Summer School in Logic ...esslli2018.folli.info/wp-content/uploads/SPARQLing-with-GraphDB.pdf · Step 1: Install GraphDB Go to your email and “download

SPARQLing with GraphDBJohn P. McCrae, Thierry Declerck

Page 2: SPARQLing with GraphDB - European Summer School in Logic ...esslli2018.folli.info/wp-content/uploads/SPARQLing-with-GraphDB.pdf · Step 1: Install GraphDB Go to your email and “download

Step 1: Install GraphDB

Go to http://graphdb.ontotext.com/ and download the free version of GraphDB

Page 3: SPARQLing with GraphDB - European Summer School in Logic ...esslli2018.folli.info/wp-content/uploads/SPARQLing-with-GraphDB.pdf · Step 1: Install GraphDB Go to your email and “download

Step 1: Install GraphDB

Go to your email and “download as stand-alone server”.

(Linux) Unzip this and run the command at bin/graphdb

(Windows) Should start after installPoint your browser to

http://localhost:7200/

Page 4: SPARQLing with GraphDB - European Summer School in Logic ...esslli2018.folli.info/wp-content/uploads/SPARQLing-with-GraphDB.pdf · Step 1: Install GraphDB Go to your email and “download

Step 1: Success?

Page 5: SPARQLing with GraphDB - European Summer School in Logic ...esslli2018.folli.info/wp-content/uploads/SPARQLing-with-GraphDB.pdf · Step 1: Install GraphDB Go to your email and “download

Step 2: Load some data

Page 6: SPARQLing with GraphDB - European Summer School in Logic ...esslli2018.folli.info/wp-content/uploads/SPARQLing-with-GraphDB.pdf · Step 1: Install GraphDB Go to your email and “download

Step 2: Add some data

Page 7: SPARQLing with GraphDB - European Summer School in Logic ...esslli2018.folli.info/wp-content/uploads/SPARQLing-with-GraphDB.pdf · Step 1: Install GraphDB Go to your email and “download

Step 2: Add some data

Page 8: SPARQLing with GraphDB - European Summer School in Logic ...esslli2018.folli.info/wp-content/uploads/SPARQLing-with-GraphDB.pdf · Step 1: Install GraphDB Go to your email and “download

Step 2: Add some data

Page 9: SPARQLing with GraphDB - European Summer School in Logic ...esslli2018.folli.info/wp-content/uploads/SPARQLing-with-GraphDB.pdf · Step 1: Install GraphDB Go to your email and “download

Step 3: Do some SPARQLing

Page 10: SPARQLing with GraphDB - European Summer School in Logic ...esslli2018.folli.info/wp-content/uploads/SPARQLing-with-GraphDB.pdf · Step 1: Install GraphDB Go to your email and “download

Task

● Look at the example entry here:http://wordnet-rdf.princeton.edu/ttl/lemma/cat

● Task: Rewrite the query to return only nouns● Task: List the definition of each sense● Task: Find the lemmas of all hypernyms

Page 11: SPARQLing with GraphDB - European Summer School in Logic ...esslli2018.folli.info/wp-content/uploads/SPARQLing-with-GraphDB.pdf · Step 1: Install GraphDB Go to your email and “download

Step 4: Interoperability

Add two datasets:https://github.com/jmccrae/wn-wiki-instances/raw/master/ili-map-dbpedia.ttlhttp://downloads.dbpedia.org/2016-10/core-i18n/en/genders_en.ttl.bz2

(You will need to download and unzip this one)

Page 12: SPARQLing with GraphDB - European Summer School in Logic ...esslli2018.folli.info/wp-content/uploads/SPARQLing-with-GraphDB.pdf · Step 1: Install GraphDB Go to your email and “download

Task

Use this to find a male philosopher

Hints A philosopher is an wn:instance_hypernym of

http://wordnet-rdf.princeton.edu/id/10443334-n

Synsets are connected to the ILI with http://www.w3.org/2002/07/owl#sameAs

The ILI is connected to DBpedia with http://www.w3.org/2004/02/skos/core#exactMatch

The gender is given in DBpedia with http://xmlns.com/foaf/0.1/gender

Page 13: SPARQLing with GraphDB - European Summer School in Logic ...esslli2018.folli.info/wp-content/uploads/SPARQLing-with-GraphDB.pdf · Step 1: Install GraphDB Go to your email and “download

Solutions

PREFIX ontolex: <http://www.w3.org/ns/lemon/ontolex#>

PREFIX wn: <http://wordnet-rdf.princeton.edu/ontology#>

select distinct * where {

?s ontolex:canonicalForm [ ontolex:writtenRep "cat"@en ] ;

wn:partOfSpeech wn:noun .

} limit 100

Page 14: SPARQLing with GraphDB - European Summer School in Logic ...esslli2018.folli.info/wp-content/uploads/SPARQLing-with-GraphDB.pdf · Step 1: Install GraphDB Go to your email and “download

Solutions

PREFIX ontolex: <http://www.w3.org/ns/lemon/ontolex#>

PREFIX wn: <http://wordnet-rdf.princeton.edu/ontology#>

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>

select distinct ?value where {

?s ontolex:canonicalForm [ ontolex:writtenRep "cat"@en ] ;

ontolex:sense ?sense .

?sense ontolex:isLexicalizedSenseOf ?synset .

?synset wn:definition ?defn .

?defn rdf:value ?value .

} limit 100

Page 15: SPARQLing with GraphDB - European Summer School in Logic ...esslli2018.folli.info/wp-content/uploads/SPARQLing-with-GraphDB.pdf · Step 1: Install GraphDB Go to your email and “download

Solutions

PREFIX ontolex: <http://www.w3.org/ns/lemon/ontolex#> PREFIX wn: <http://wordnet-rdf.princeton.edu/ontology#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>select distinct ?lemma2 where { ?entry1 ontolex:canonicalForm [ ontolex:writtenRep "cat"@en ] ; ontolex:sense ?sense1 . ?sense1 ontolex:isLexicalizedSenseOf ?synset1 . ?entry2 ontolex:canonicalForm [ ontolex:writtenRep ?lemma2 ] ; ontolex:sense ?sense2 . ?sense2 ontolex:isLexicalizedSenseOf ?synset2 . ?synset1 wn:hypernym ?synset2 . } limit 100

Page 16: SPARQLing with GraphDB - European Summer School in Logic ...esslli2018.folli.info/wp-content/uploads/SPARQLing-with-GraphDB.pdf · Step 1: Install GraphDB Go to your email and “download

Solutions

PREFIX ontolex: <http://www.w3.org/ns/lemon/ontolex#>

PREFIX wn: <http://wordnet-rdf.princeton.edu/ontology#>

PREFIX owl: <http://www.w3.org/2002/07/owl#>

PREFIX skos: <http://www.w3.org/2004/02/skos/core#>

PREFIX wnid: <http://wordnet-rdf.princeton.edu/id/>

select distinct * where {

?s wn:instance_hypernym wnid:10443334-n.

?s owl:sameAs ?ili .

?ili skos:exactMatch ?dbp .

?dbp <http://xmlns.com/foaf/0.1/gender> ?gender

} limit 100

Page 17: SPARQLing with GraphDB - European Summer School in Logic ...esslli2018.folli.info/wp-content/uploads/SPARQLing-with-GraphDB.pdf · Step 1: Install GraphDB Go to your email and “download

Thanks.

This publication has emanated from research supported in part by a research grant from Science Foundation Ireland (SFI) under Grant Number SFI/12/RC/2289, co-funded by the European Regional Development Fund