Template:NOSAD-POC Federation Quick: Difference between revisions

From oswald
Jump to navigation Jump to search
No edit summary
No edit summary
 
Line 26: Line 26:
</sparql>
</sparql>
* [https://www.wikidata.org/wiki/Help:QuickStatements Quickstatements]
* [https://www.wikidata.org/wiki/Help:QuickStatements Quickstatements]
[[category:SPARQL]]

Latest revision as of 23:40, 4 November 2022

Hämta alla organisationer i Oswald som har koppling WD och hämta från WD med SPARQL federation deras Organisationsnummer, visa det på Quickstatement format

#title:  org hos NOSAD där WD har Organisationsnr P6460 info som saknas lokalt P37 som QuickStatement - SPARQL Federation
PREFIX od: <https://oswald.wikibase.cloud/entity/>
PREFIX odt: <https://oswald.wikibase.cloud/prop/direct/>

SELECT DISTINCT ?Oswald ("P37" AS ?P) ?orgnr WHERE {

  VALUES ?Orgobj {
    od:Q76
  }
  ?org odt:P12 ?Orgobj.
  ?org odt:P2 ?WDs.
  BIND(URI(REPLACE(STR(?WDs), "https://www.wikidata.org/wiki/", "http://www.wikidata.org/entity/")) AS ?WD)
  SERVICE <https://query.wikidata.org/sparql> {
    ?WD wdt:P6460 ?wdorg.
    BIND(CONCAT("\"", str(?wdorg), "\"") AS ?orgnr)
  }
  BIND(REPLACE(STR(?org), "https://oswald.wikibase.cloud/entity/", "") AS ?Oswald)
  SERVICE wikibase:label { bd:serviceParam wikibase:language "sv,en". }
}
ORDER BY (?spkrOswaldLabel)

Try it!