Rome Kres Hackathon
From STLab
(Difference between revisions)
Current revision (07:05, 15 April 2011) (view source) m (Text replace - '150.146.88.63' to 'wit.istc.cnr.it') |
|||
(20 intermediate revisions not shown.) | |||
Line 1: | Line 1: | ||
Link to the work flow: http://stlab.istc.cnr.it/documents/events/kres-hackathon/rome-kres-hackaton-2.png | Link to the work flow: http://stlab.istc.cnr.it/documents/events/kres-hackathon/rome-kres-hackaton-2.png | ||
- | |||
- | |||
- | ===Load enahcnements :: /store=== | + | Link to the photogallery: [[KReSHackathonRomeGallery]] |
+ | <center>[[Image:Board.jpg|240px]]</center> | ||
+ | |||
+ | LOD resources endpoint is : http://wit.istc.cnr.it:8893/sparql | ||
+ | |||
+ | Stanbol instance at : http://wit.istc.cnr.it:9292/ | ||
+ | |||
+ | == Detect dbpedia entities == | ||
+ | |||
+ | ===Load enahcnements :: <stanbol>/store=== | ||
# Create a file with my example text: | # Create a file with my example text: | ||
#* movie.txt | #* movie.txt | ||
#* "Una nuova missione per l'agente Ethan Hunt ( Tom Cruise ) che, questa volta, dovrà cercare di fermare la diffusione di Chimera, un virus geneticamente modificato che produce effetti letali sul sistema nervoso dell'essere umano, capace di mettere in ginocchio il mondo. Al fianco di Ethan il genio dell'informatica Luther Stickell ( Ving Rhames ) e l'affascinante ladra internazionale Nyah Nordoff-Hall (Thandie Newton). Il nemico da combattere, invece, è il perfido Sean Ambrose ( Dougray Scott ) il cui piano è di vendere su scala mondiale al miglior offerente l'antidoto al virus." | #* "Una nuova missione per l'agente Ethan Hunt ( Tom Cruise ) che, questa volta, dovrà cercare di fermare la diffusione di Chimera, un virus geneticamente modificato che produce effetti letali sul sistema nervoso dell'essere umano, capace di mettere in ginocchio il mondo. Al fianco di Ethan il genio dell'informatica Luther Stickell ( Ving Rhames ) e l'affascinante ladra internazionale Nyah Nordoff-Hall (Thandie Newton). Il nemico da combattere, invece, è il perfido Sean Ambrose ( Dougray Scott ) il cui piano è di vendere su scala mondiale al miglior offerente l'antidoto al virus." | ||
- | # curl -i -X PUT -H "Content-Type:text/plain" -T movie1.txt http:// | + | # curl -i -X PUT -H "Content-Type:text/plain" -T movie1.txt http://wit.istc.cnr.it:9292/store/content/movie1.txt |
- | # Result: http:// | + | # Result: http://wit.istc.cnr.it:9292/store/page/movie1.txt |
- | ===Select entity references :: /sparql=== | + | ===Select entity references :: <lod-resource>/sparql=== |
- | + | prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> | |
+ | prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> | ||
+ | prefix owl: <http://www.w3.org/2002/07/owl#> | ||
+ | prefix xsd: <http://www.w3.org/2001/XMLSchema#> | ||
- | ?x <http://fise.iks-project.eu/ontology/ | + | select distinct |
+ | ?z | ||
+ | WHERE | ||
+ | { | ||
+ | ?x <http://fise.iks-project.eu/ontology/extracted-from> <http://wit.istc.cnr.it:9292/store/content/movie1.txt> . | ||
+ | ?x <http://fise.iks-project.eu/ontology/entity-reference> ?z | ||
+ | } | ||
- | + | OR | |
- | + | prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> | |
+ | prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> | ||
+ | prefix owl: <http://www.w3.org/2002/07/owl#> | ||
+ | prefix xsd: <http://www.w3.org/2001/XMLSchema#> | ||
+ | construct { | ||
+ | ?z rdf:type owl:Thing | ||
+ | } | ||
+ | WHERE | ||
+ | { | ||
+ | ?x <http://fise.iks-project.eu/ontology/extracted-from> <http://wit.istc.cnr.it:9292/store/content/movie1.txt> . | ||
+ | ?x <http://fise.iks-project.eu/ontology/entity-reference> ?z | ||
+ | } | ||
- | + | ===Select owl:sameAs from each LOD source=== | |
- | + | ====Linked MDB==== | |
+ | PREFIX oddlinker: <http://data.linkedmdb.org/resource/oddlinker/> | ||
+ | CONSTRUCT { | ||
+ | ?Subject ?type ?source | ||
+ | } | ||
+ | FROM <lmdb_dataset> | ||
+ | |||
+ | WHERE | ||
+ | { | ||
+ | ?x oddlinker:link_source ?source . | ||
+ | ?x oddlinker:link_type ?type . | ||
+ | ?x oddlinker:link_target ?Subject . | ||
+ | FILTER ( ?type = "owl:sameAs" || ?type = "rdfs:SeeAlso") . | ||
+ | FILTER ( | ||
+ | ?Subject = <http://sws.geonames.org/2118968/> || | ||
+ | ?Subject = <http://dbpedia.org/resource/Tom_Cruise> || | ||
+ | ?Subject = <http://sws.geonames.org/556951/> || | ||
+ | ?Subject = <http://dbpedia.org/resource/Al_Pacino> || | ||
+ | ?Subject = <http://sws.geonames.org/106281/> || | ||
+ | ?Subject = <http://dbpedia.org/resource/Al_Gore> | ||
+ | ) | ||
+ | } | ||
+ | LIMIT 10000 | ||
- | + | And the result is: | |
- | + | ||
- | + | ||
- | + | {| class=smwtable | |
+ | ! Subject | ||
+ | ! type | ||
+ | ! source | ||
+ | |- | ||
+ | | http://dbpedia.org/resource/Al_Gore | ||
+ | | owl:sameAs | ||
+ | | http://data.linkedmdb.org/resource/actor/12737 | ||
+ | |- | ||
+ | | http://dbpedia.org/resource/Al_Pacino | ||
+ | | owl:sameAs | ||
+ | | http://data.linkedmdb.org/resource/actor/12748 | ||
+ | |- | ||
+ | | http://dbpedia.org/resource/Tom_Cruise | ||
+ | | owl:sameAs | ||
+ | | http://data.linkedmdb.org/resource/actor/28241 | ||
+ | |} | ||
- | + | ===Compute owl:sameAs with the reasoner :: /enrich=== | |
- | + | ==Fetch the information from LOD sources== | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | SELECT * | |
- | + | FROM <lmdb_dataset> | |
+ | WHERE{ | ||
+ | {<http://dbpedia.org/resource/Al_Gore> ?p ?o} | ||
+ | UNION | ||
+ | {?s ?pp <http://dbpedia.org/resource/Al_Gore>} | ||
+ | UNION | ||
+ | {<http://dbpedia.org/resource/Al_Pacino> ?p ?o} | ||
+ | UNION | ||
+ | {?s ?pp <http://dbpedia.org/resource/Al_Pacino>} | ||
+ | UNION | ||
+ | {<http://dbpedia.org/resource/Tom_Cruise> ?p ?o} | ||
+ | UNION | ||
+ | {?s ?pp <http://dbpedia.org/resource/Tom_Cruise>} | ||
+ | UNION | ||
+ | {<http://data.linkedmdb.org/resource/actor/12737> ?p ?o} | ||
+ | UNION | ||
+ | {?s ?pp <http://data.linkedmdb.org/resource/actor/12748>} | ||
+ | UNION | ||
+ | {<http://data.linkedmdb.org/resource/actor/12737> ?p ?o} | ||
+ | UNION | ||
+ | {?s ?pp <http://data.linkedmdb.org/resource/actor/12748>} | ||
+ | UNION | ||
+ | {?s ?pp <http://data.linkedmdb.org/resource/actor/28241>} | ||
+ | UNION | ||
+ | {<http://data.linkedmdb.org/resource/actor/28241> ?p ?o} | ||
+ | } | ||
- | + | == Select the Recipe and do /refactor == | |
- | + | ||
- | + | <source lang="xml"> | |
- | http://data.linkedmdb.org/resource/ | + | google = <http://rdf.data-vocabulary.org/#> . |
- | <http:// | + | mdb = <http://data.linkedmdb.org/resource/movie/> . |
+ | dcterms = <http://purl.org/dc/terms/> . | ||
+ | foaf = <http://xmlns.com/foaf/0.1/> . | ||
- | + | !film2product[ | |
+ | is(mdb:Film, ?film) | ||
+ | -> | ||
+ | is(google:Product, ?film) | ||
+ | ] . | ||
- | + | !actor2person[ | |
+ | is(mdb:Actor, ?actor) | ||
+ | -> | ||
+ | is(google:Person, ?actor) . | ||
+ | values(google:title, ?actor, "Actor") | ||
+ | ] . | ||
- | + | actorname[ | |
+ | is(google:Person, ?p) . | ||
+ | values(mdb:actor_name, ?p, ?name) . | ||
+ | -> | ||
+ | values(google:name, ?p, ?name) | ||
+ | ] . | ||
- | + | actorCharacter[ | |
+ | is(google:Person, ?p) . | ||
+ | has(mdb:performance, ?p, ?performance) . | ||
+ | has(mdb:performance_character, ?performance, ?character) . | ||
+ | values(performance_film, ?performance, ?film) . | ||
+ | -> | ||
+ | values(google:role, ?character) . | ||
+ | values(google:affiliation, ?film) | ||
+ | ] . | ||
- | + | actorPage[ | |
- | + | is(google:Person, ?p) . | |
+ | has(foaf:page, ?p, ?page) . | ||
+ | let(?pageString, str(?page)) | ||
+ | -> | ||
+ | values(google:role, ?pageString) | ||
+ | ] | ||
+ | </source> |
Current revision
Link to the work flow: http://stlab.istc.cnr.it/documents/events/kres-hackathon/rome-kres-hackaton-2.png
Link to the photogallery: KReSHackathonRomeGallery
LOD resources endpoint is : http://wit.istc.cnr.it:8893/sparql
Stanbol instance at : http://wit.istc.cnr.it:9292/
Contents |
Detect dbpedia entities
Load enahcnements :: <stanbol>/store
- Create a file with my example text:
- movie.txt
- "Una nuova missione per l'agente Ethan Hunt ( Tom Cruise ) che, questa volta, dovrà cercare di fermare la diffusione di Chimera, un virus geneticamente modificato che produce effetti letali sul sistema nervoso dell'essere umano, capace di mettere in ginocchio il mondo. Al fianco di Ethan il genio dell'informatica Luther Stickell ( Ving Rhames ) e l'affascinante ladra internazionale Nyah Nordoff-Hall (Thandie Newton). Il nemico da combattere, invece, è il perfido Sean Ambrose ( Dougray Scott ) il cui piano è di vendere su scala mondiale al miglior offerente l'antidoto al virus."
- curl -i -X PUT -H "Content-Type:text/plain" -T movie1.txt http://wit.istc.cnr.it:9292/store/content/movie1.txt
- Result: http://wit.istc.cnr.it:9292/store/page/movie1.txt
Select entity references :: <lod-resource>/sparql
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> prefix owl: <http://www.w3.org/2002/07/owl#> prefix xsd: <http://www.w3.org/2001/XMLSchema#> select distinct ?z WHERE { ?x <http://fise.iks-project.eu/ontology/extracted-from> <http://wit.istc.cnr.it:9292/store/content/movie1.txt> . ?x <http://fise.iks-project.eu/ontology/entity-reference> ?z }
OR
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> prefix owl: <http://www.w3.org/2002/07/owl#> prefix xsd: <http://www.w3.org/2001/XMLSchema#> construct { ?z rdf:type owl:Thing } WHERE { ?x <http://fise.iks-project.eu/ontology/extracted-from> <http://wit.istc.cnr.it:9292/store/content/movie1.txt> . ?x <http://fise.iks-project.eu/ontology/entity-reference> ?z }
Select owl:sameAs from each LOD source
Linked MDB
PREFIX oddlinker: <http://data.linkedmdb.org/resource/oddlinker/> CONSTRUCT { ?Subject ?type ?source } FROM <lmdb_dataset> WHERE { ?x oddlinker:link_source ?source . ?x oddlinker:link_type ?type . ?x oddlinker:link_target ?Subject . FILTER ( ?type = "owl:sameAs" || ?type = "rdfs:SeeAlso") . FILTER ( ?Subject = <http://sws.geonames.org/2118968/> || ?Subject = <http://dbpedia.org/resource/Tom_Cruise> || ?Subject = <http://sws.geonames.org/556951/> || ?Subject = <http://dbpedia.org/resource/Al_Pacino> || ?Subject = <http://sws.geonames.org/106281/> || ?Subject = <http://dbpedia.org/resource/Al_Gore> ) } LIMIT 10000
And the result is:
Compute owl:sameAs with the reasoner :: /enrich
Fetch the information from LOD sources
SELECT * FROM <lmdb_dataset> WHERE{ {<http://dbpedia.org/resource/Al_Gore> ?p ?o} UNION {?s ?pp <http://dbpedia.org/resource/Al_Gore>} UNION {<http://dbpedia.org/resource/Al_Pacino> ?p ?o} UNION {?s ?pp <http://dbpedia.org/resource/Al_Pacino>} UNION {<http://dbpedia.org/resource/Tom_Cruise> ?p ?o} UNION {?s ?pp <http://dbpedia.org/resource/Tom_Cruise>} UNION {<http://data.linkedmdb.org/resource/actor/12737> ?p ?o} UNION {?s ?pp <http://data.linkedmdb.org/resource/actor/12748>} UNION {<http://data.linkedmdb.org/resource/actor/12737> ?p ?o} UNION {?s ?pp <http://data.linkedmdb.org/resource/actor/12748>} UNION {?s ?pp <http://data.linkedmdb.org/resource/actor/28241>} UNION {<http://data.linkedmdb.org/resource/actor/28241> ?p ?o} }
Select the Recipe and do /refactor
google = <http://rdf.data-vocabulary.org/#> . mdb = <http://data.linkedmdb.org/resource/movie/> . dcterms = <http://purl.org/dc/terms/> . foaf = <http://xmlns.com/foaf/0.1/> . !film2product[ is(mdb:Film, ?film) -> is(google:Product, ?film) ] . !actor2person[ is(mdb:Actor, ?actor) -> is(google:Person, ?actor) . values(google:title, ?actor, "Actor") ] . actorname[ is(google:Person, ?p) . values(mdb:actor_name, ?p, ?name) . -> values(google:name, ?p, ?name) ] . actorCharacter[ is(google:Person, ?p) . has(mdb:performance, ?p, ?performance) . has(mdb:performance_character, ?performance, ?character) . values(performance_film, ?performance, ?film) . -> values(google:role, ?character) . values(google:affiliation, ?film) ] . actorPage[ is(google:Person, ?p) . has(foaf:page, ?p, ?page) . let(?pageString, str(?page)) -> values(google:role, ?pageString) ]