query-39f368b0cdab47ba59b45ff81041ca8a

rq turtle/ttl

Spørring for å finne båtomtaler på Skipsrevyen eller Maritimt Magasin. SELECT ?item ?itemLabel (YEAR(?sentry_) AS ?sEntry) ?srid (COALESCE(IF(!BOUND(?srid), URI(CONCAT(?srsfu, ?itemLabel3)), "")) AS ?srSearch) #(COALESCE(IF(!BOUND(?srid), URI(CONCAT(?srsfu, ?itemLabel4)), "")) AS ?altsrSearch) ?mmid (COALESCE(IF(!BOUND(?mmid), URI(CONCAT(?mmsfu, ?itemLabel3)), "")) AS ?mmSearch) #(COALESCE(IF(!BOUND(?mmid), URI(CONCAT(?mmsfu, ?itemLabel4)), "")) AS ?altmmSearch) WHERE { { SELECT DISTINCT ?item WHERE { ?item wdt:P31/wdt:P279* wd:Q11446; wdt:P8047 wd:Q20. hint:SubQuery hint:runOnce true . } } OPTIONAL { ?item wdt:P9659 ?srid . } OPTIONAL { ?item wdt:P10355 ?mmid . } OPTIONAL { ?item wdt:P729 ?sentry_ . } FILTER (?sentry_ >= "1990-00-00"^^xsd:dateTime)

wd:P9659 wdt:P4354 ?srsfu_ . BIND(STRBEFORE(?srsfu_, "$1") AS ?srsfu) wd:P10355 wdt:P4354 ?mmsfu_ . BIND(STRBEFORE(?mmsfu_, "$1") AS ?mmsfu) BIND(REPLACE(?itemLabel, "«", "") AS ?itemLabel1) BIND(REPLACE(?itemLabel1, "»", "") AS ?itemLabel2) BIND(ENCODE_FOR_URI(?itemLabel2) AS ?itemLabel3) BIND(ENCODE_FOR_URI(STRAFTER(?itemLabel2, " ")) AS ?itemLabel4)

SERVICE wikibase:label { bd:serviceParam wikibase:language "nb,en" . ?item rdfs:label ?itemLabel . } }

Use at

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
# Spørring for å finne båtomtaler på Skipsrevyen eller Maritimt Magasin.
SELECT
  ?item ?itemLabel 
  (YEAR(?sentry_) AS ?sEntry)
  ?srid
  (COALESCE(IF(!BOUND(?srid), URI(CONCAT(?srsfu, ?itemLabel3)), "")) AS ?srSearch)
  #(COALESCE(IF(!BOUND(?srid), URI(CONCAT(?srsfu, ?itemLabel4)), "")) AS ?altsrSearch)
  ?mmid
  (COALESCE(IF(!BOUND(?mmid), URI(CONCAT(?mmsfu, ?itemLabel3)), "")) AS ?mmSearch)
  #(COALESCE(IF(!BOUND(?mmid), URI(CONCAT(?mmsfu, ?itemLabel4)), "")) AS ?altmmSearch)
WHERE {
  { SELECT DISTINCT ?item WHERE {
    ?item wdt:P31/wdt:P279* wd:Q11446;
      wdt:P8047 wd:Q20.

  } }
  OPTIONAL { ?item wdt:P9659 ?srid . }
  OPTIONAL { ?item wdt:P10355 ?mmid . }
  OPTIONAL { ?item wdt:P729 ?sentry_ . }
  FILTER (?sentry_ >= "1990-00-00"^^xsd:dat)

  wd:P9659 wdt:P4354 ?srsfu_ . BIND(STRBEFORE(?srsfu_, "$1") AS ?srsfu)
  wd:P10355 wdt:P4354 ?mmsfu_ . BIND(STRBEFORE(?mmsfu_, "$1") AS ?mmsfu)
  BIND(REPLACE(?itemLabel, "«", "") AS ?itemLabel1)
  BIND(REPLACE(?itemLabel1, "»", "") AS ?itemLabel2)
  BIND(ENCODE_FOR_URI(?itemLabel2) AS ?itemLabel3)
  BIND(ENCODE_FOR_URI(STRAFTER(?itemLabel2, " ")) AS ?itemLabel4)

  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "nb,en" . 
    ?item rdfs:label ?itemLabel .
  }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?item"):::projected v13("?itemLabel"):::projected v9("?itemLabel1") v10("?itemLabel2") v11("?itemLabel3"):::projected v12("?itemLabel4") v16("?mmSearch") v4("?mmid"):::projected v8("?mmsfu"):::projected v7("?mmsfu_") v14("?sEntry") v1("?sentry_"):::projected v15("?srSearch") v3("?srid"):::projected v6("?srsfu"):::projected v5("?srsfu_") a1((" ")) c6(["wd:Q20"]):::iri c12(["wd:P10355"]):::iri c10(["wd:P9659"]):::iri c14(["bd:serviceParam"]):::iri c16(["nb,en"]):::literal c4(["wd:Q11446"]):::iri f0[["?sentry_ >= s1990-00-00^^<http://www.w3.org/2001/XMLSchema#dat>'"]] f0 --> v1 v2 --"wdt:P31"--> a1 a1 --"wdt:P279"--> c4 v2 --"wdt:P8047"--> c6 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v2 -."wdt:P9659".-> v3 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v2 -."wdt:P10355".-> v4 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v2 -."wdt:P729".-> v1 end c10 --"wdt:P4354"--> v5 bind1[/"substring-before(?srsfu_,'$1')"/] v5 --o bind1 bind1 --as--o v6 c12 --"wdt:P4354"--> v7 bind2[/"substring-before(?mmsfu_,'$1')"/] v7 --o bind2 bind2 --as--o v8 bind3[/"replace(?itemLabel,'«','')"/] v13 --o bind3 bind3 --as--o v9 bind4[/"replace(?itemLabel1,'»','')"/] v9 --o bind4 bind4 --as--o v10 bind5[/"encode-for-uri(?itemLabel2)"/] v10 --o bind5 bind5 --as--o v11 bind6[/"encode-for-uri(substring-after(?itemLabel2,' '))"/] v10 --o bind6 bind6 --as--o v12 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c14 --"wikibase:language"--> c16 v2 --"rdfs:label"--> v13 end bind7[/"year-from-dateTime(?sentry_)"/] v1 --o bind7 bind7 --as--o v14 bind8[/"if(not bound(?srid),concat(?srsfu,?itemLabel3),'')"/] v3 --o bind8 v6 --o bind8 v11 --o bind8 bind8 --as--o v15 bind9[/"if(not bound(?mmid),concat(?mmsfu,?itemLabel3),'')"/] v4 --o bind9 v8 --o bind9 v11 --o bind9 bind9 --as--o v16