Both sides previous revision
Poprzednia wersja
Nowa wersja
|
Poprzednia wersja
|
pl:miw:2009:miw09_semweb_rdfstore [2009/07/07 12:08] jsi08 |
pl:miw:2009:miw09_semweb_rdfstore [2019/06/27 15:50] (aktualna) |
| |
===== Przykłady użycia ===== | ===== Przykłady użycia ===== |
| Przykłady opierają się na dbpedii. |
| |
| * Obiekty połorzone w pobliżu Krakowa: |
| <code> |
| SELECT ?subject ?label ?lat ?long WHERE { |
| <http://dbpedia.org/resource/Krak%C3%B3w> geo:lat ?myLat . |
| <http://dbpedia.org/resource/Krak%C3%B3w> geo:long ?myLong . |
| ?subject geo:lat ?lat. |
| ?subject geo:long ?long. |
| ?subject rdfs:label ?label. |
| FILTER(xsd:float(?lat) - xsd:float(?myLat) <= 0.05 && |
| xsd:float(?myLat) - xsd:float(?lat) <= 0.05 && |
| xsd:float(?long) - xsd:float(?myLong) <= 0.05 && |
| xsd:float(?myLong) - xsd:float(?long) <= 0.05 && |
| (lang(?label) = "en" || lang(?label) = "pl")). |
| } |
| </code> |
| [[http://dbpedia.org/snorql/?query=SELECT+%3Fsubject+%3Flabel+%3Flat+%3Flong+WHERE+{%0D%0A%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FKrak%25C3%25B3w%3E+geo%3Alat+%3FmyLat+.%0D%0A%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FKrak%25C3%25B3w%3E+geo%3Along+%3FmyLong+.%0D%0A%3Fsubject+geo%3Alat+%3Flat.%0D%0A%3Fsubject+geo%3Along+%3Flong.%0D%0A%3Fsubject+rdfs%3Alabel+%3Flabel.%0D%0AFILTER(xsd%3Afloat(%3Flat)+-+xsd%3Afloat(%3FmyLat)+%3C%3D+0.05+%26%26%0D%0Axsd%3Afloat(%3FmyLat)+-+xsd%3Afloat(%3Flat)+%3C%3D+0.05+%26%26%0D%0Axsd%3Afloat(%3Flong)+-+xsd%3Afloat(%3FmyLong)+%3C%3D+0.05+%26%26%0D%0Axsd%3Afloat(%3FmyLong)+-+xsd%3Afloat(%3Flong)+%3C%3D+0.05+%26%26%0D%0A(lang(%3Flabel)+%3D+%22en%22+||+lang(%3Flabel)+%3D+%22pl%22)).%0D%0A}%0D%0A|wynik]] |
| |
| * Uniwersytety w Krakowie: |
| <code> |
| SELECT ?subject ?label ?lat ?long |
| WHERE { |
| ?subject rdfs:label ?label. |
| ?subject dbpprop:city <http://dbpedia.org/resource/Krak%C3%B3w>. |
| ?subject rdf:type <http://dbpedia.org/ontology/University>. |
| FILTER ( |
| (lang(?label) = "en" || lang(?label) = "pl") |
| ). |
| OPTIONAL { |
| ?subject geo:lat ?lat. |
| ?subject geo:long ?long. |
| } |
| } |
| </code> |
| [[http://dbpedia.org/snorql/?query=SELECT+%3Fsubject+%3Flabel+%3Flat+%3Flong+%0D%0AWHERE+{%0D%0A+++++%3Fsubject+rdfs%3Alabel+%3Flabel.%0D%0A+++++%3Fsubject+dbpprop%3Acity+%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FKrak%25C3%25B3w%3E.%0D%0A%09%3Fsubject+rdf%3Atype+%3Chttp%3A%2F%2Fdbpedia.org%2Fontology%2FUniversity%3E.%0D%0A%09+FILTER+(%0D%0A%09(lang(%3Flabel)+%3D+%22en%22+||+lang(%3Flabel)+%3D+%22pl%22)%0D%0A%09).%0D%0A%09OPTIONAL+{%0D%0A++++%3Fsubject+geo%3Alat+%3Flat.%0D%0A%09%3Fsubject+geo%3Along+%3Flong.%0D%0A%09}%0D%0A}%0D%0A|wynik]] |
| |
| * Obiekty powiązane z Krakowem: |
| <code> |
| SELECT ?subject ?label ?lat ?long ?type |
| WHERE { |
| ?subject rdfs:label ?label. |
| ?subject dbpprop:city <http://dbpedia.org/resource/Krak%C3%B3w>. |
| ?subject rdf:type ?type. |
| FILTER ( |
| (lang(?label) = "en" || lang(?label) = "pl") |
| ). |
| OPTIONAL { |
| ?subject geo:lat ?lat. |
| ?subject geo:long ?long. |
| } |
| } |
| </code> |
| [[http://dbpedia.org/snorql/?query=SELECT+%3Fsubject+%3Flabel+%3Flat+%3Flong+%3Ftype%0D%0AWHERE+{%0D%0A+++++%3Fsubject+rdfs%3Alabel+%3Flabel.%0D%0A+++++%3Fsubject+dbpprop%3Acity+%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FKrak%25C3%25B3w%3E.%0D%0A%09%3Fsubject+rdf%3Atype+%3Ftype.%0D%0A%09+FILTER+(%0D%0A%09(lang(%3Flabel)+%3D+%22en%22+||+lang(%3Flabel)+%3D+%22pl%22)%0D%0A%09).%0D%0A%09OPTIONAL+{%0D%0A++++%3Fsubject+geo%3Alat+%3Flat.%0D%0A%09%3Fsubject+geo%3Along+%3Flong.%0D%0A%09}%0D%0A}%0D%0A|wynik]] |
| |
| * Polscy piłkarze: |
| <code> |
| SELECT DISTINCT ?name ?type |
| WHERE { |
| ?subject ?func <http://dbpedia.org/resource/Poland>. |
| ?func rdfs:label ?type. |
| ?subject foaf:name ?name . |
| ?subject rdf:type <http://dbpedia.org/ontology/FootballPlayer>. |
| } |
| </code> |
| [[http://dbpedia.org/snorql/?query=SELECT+DISTINCT+%3Fname+%3Ftype%0D%0AWHERE+{%0D%0A++++%3Fsubject+%3Ffunc+%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FPoland%3E.%0D%0A%09%3Ffunc+rdfs%3Alabel+%3Ftype.%0D%0A++++%3Fsubject+foaf%3Aname+%3Fname+.%0D%0A++++%3Fsubject+rdf%3Atype+%3Chttp%3A%2F%2Fdbpedia.org%2Fontology%2FFootballPlayer%3E.%0D%0A}%0D%0A|wynik]] |
| |
| * Osoby powiązane z Berlinem: |
| <code> |
| SELECT ?name ?type ?ffa ?fff |
| WHERE { |
| ?subject ?func <http://dbpedia.org/resource/Berlin>. |
| ?func rdfs:label ?type. |
| ?subject foaf:name ?name . |
| ?subject rdf:type <http://dbpedia.org/ontology/Person>. |
| ?subject rdf:type ?ffa. |
| ?ffa rdfs:label ?fff. |
| } |
| </code> |
| [[http://dbpedia.org/snorql/?query=SELECT+%3Fname+%3Ftype+%3Fffa+%3Ffff%0D%0AWHERE+{%0D%0A++++%3Fsubject+%3Ffunc+%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FBerlin%3E.%0D%0A%09%3Ffunc+rdfs%3Alabel+%3Ftype.%0D%0A++++%3Fsubject+foaf%3Aname+%3Fname+.%0D%0A++++%3Fsubject+rdf%3Atype+%3Chttp%3A%2F%2Fdbpedia.org%2Fontology%2FPerson%3E.%0D%0A%09%3Fsubject+rdf%3Atype+%3Fffa.%0D%0A%09%3Fffa+rdfs%3Alabel+%3Ffff.%0D%0A}%0D%0A|wynik]] |
| |
| |