query-1fc4632edef5a01497d283bec2ecf7f6

rq turtle/ttl

Synia: topic

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
PREFIX target: <http://www.wikidata.org/entity/Q54871>

SELECT DISTINCT
  ?description
  ?value ?valueUrl 

  ?wikidata ?wikidataUrl

  ?scholia ?scholiaUrl

  # ?wikidata_topic_curator1 ?wikidata_topic_curator1Url

  # ?wikidata_topic_curator2 ?wikidata_topic_curator2Url
WHERE {
  {
    BIND(1 AS ?order)
    BIND("Topic" AS ?description)
    BIND(target: AS ?iri)
    BIND(SUBSTR(STR(?iri), 32) AS ?q) 
    ?iri rdfs:label ?value_string . 
    FILTER (LANG(?value_string) = 'en')
    BIND(COALESCE(?value_string, ?q) AS ?value)

    BIND(CONCAT(?q, "&nbsp;↗") AS ?wikidata)
    BIND(CONCAT("https://www.wikidata.org/wiki/", ?q) AS ?wikidataUrl)

    BIND("Scholia ↗" AS ?scholia)
    BIND(CONCAT("https://scholia.toolforge.org/topic/", ?q) AS ?scholiaUrl)

    # BIND("Wikidata Topic Curator (Scientific documents) ↗" AS ?wikidata_topic_curator1)
    # BIND(CONCAT("http://162.19.226.24:8080/term?lang=en&subgraph=&qid=", ?q) AS ?wikidata_topic_curator1Url)

    # BIND("Wikidata Topic Curator (Riksdagen documents) ↗" AS ?wikidata_topic_curator2)
    # BIND(CONCAT("http://162.19.226.24:8080/term?lang=sv&subgraph=riksdagen_documents&qid=", ?q) AS ?wikidata_topic_curator2Url)
  }
  UNION
  {
    BIND(2 AS ?order)
    BIND("Class" AS ?description)
    target: wdt:P31 ?iri .
    BIND(SUBSTR(STR(?iri), 32) AS ?q) 
    ?iri rdfs:label ?value_string . 
    FILTER (LANG(?value_string) = 'en')
    BIND(COALESCE(?value_string, ?q) AS ?value)
    BIND(CONCAT("#topic/", ?q) AS ?valueUrl)
  }
  UNION
  {
    BIND(3 AS ?order)
    BIND("Superclass" AS ?description)
    target: wdt:P279 ?iri .
    BIND(SUBSTR(STR(?iri), 32) AS ?q) 
    ?iri rdfs:label ?value_string . 
    FILTER (LANG(?value_string) = 'en')
    BIND(COALESCE(?value_string, ?q) AS ?value)
    BIND(CONCAT("#topic/", ?q) AS ?valueUrl)
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} 
ORDER BY ?order

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v12("?description"):::projected v4("?iri") v12("?order") v12("?q") v9("?scholia"):::projected v10("?scholiaUrl"):::projected v12("?value"):::projected v12("?valueUrl"):::projected v2("?value_string") v7("?wikidata"):::projected v8("?wikidataUrl"):::projected c7(["bd:serviceParam"]):::iri c3([http://www.wikidata.org/entity/Q54871]):::iri c9(["#91;AUTO_LANGUAGE#93;,en"]):::literal subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; subgraph union1[" Union "] subgraph union1l[" "] style union1l fill:#abf,stroke-dasharray: 3 3; f0[["?value_string = 'en'"]] f0 --> v2 bind1[/"'3^^xsd:integer'"/] bind1 --as--o v12 bind2[/"'Superclass'"/] bind2 --as--o v12 c3 --"wdt:P279"--> v4 bind3[/"substring(str(?iri),'32^^xsd:integer')"/] v4 --o bind3 bind3 --as--o v12 v4 --"rdfs:label"--> v2 bind4[/"?value_string?q"/] v2 --o bind4 v12 --o bind4 bind4 --as--o v12 bind5[/"concat('#topic/',?q)"/] v12 --o bind5 bind5 --as--o v12 end subgraph union1r[" "] style union1r fill:#abf,stroke-dasharray: 3 3; f6[["?value_string = 'en'"]] f6 --> v2 bind7[/"'2^^xsd:integer'"/] bind7 --as--o v12 bind8[/"'Class'"/] bind8 --as--o v12 c3 --"wdt:P31"--> v4 bind9[/"substring(str(?iri),'32^^xsd:integer')"/] v4 --o bind9 bind9 --as--o v12 v4 --"rdfs:label"--> v2 bind10[/"?value_string?q"/] v2 --o bind10 v12 --o bind10 bind10 --as--o v12 bind11[/"concat('#topic/',?q)"/] v12 --o bind11 bind11 --as--o v12 end union1r <== or ==> union1l end end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; f12[["?value_string = 'en'"]] f12 --> v2 bind13[/"'1^^xsd:integer'"/] bind13 --as--o v12 bind14[/"'Topic'"/] bind14 --as--o v12 bind15[/"http://www.wikidata.org/entity/Q54871"/] bind15 --as--o v4 bind16[/"substring(str(?iri),'32^^xsd:integer')"/] v4 --o bind16 bind16 --as--o v12 v4 --"rdfs:label"--> v2 bind17[/"?value_string?q"/] v2 --o bind17 v12 --o bind17 bind17 --as--o v12 bind18[/"concat(?q,'&nbsp;↗')"/] v12 --o bind18 bind18 --as--o v7 bind19[/"concat('https://www.wikidata.org/wiki/',?q)"/] v12 --o bind19 bind19 --as--o v8 bind20[/"'Scholia ↗'"/] bind20 --as--o v9 bind21[/"concat('https://scholia.toolforge.org/topic/',?q)"/] v12 --o bind21 bind21 --as--o v10 end union0r <== or ==> union0l end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c7 --"wikibase:language"--> c9 end