Wikidata:Synia:danskvirksomhed

From Wikidata
Jump to navigation Jump to search

Synia: Dansk virksomhed

[edit]
PREFIX target: <http://www.wikidata.org/entity/Q3949497>

SELECT DISTINCT
  ?beskrivelse ?værdi ?værdiUrl
WHERE {
  {
    BIND(1 AS ?order)
    BIND("Virksomhed" AS ?beskrivelse)
    BIND(target: AS ?iri)
    BIND(SUBSTR(STR(?iri), 32) AS ?q) 
    ?iri rdfs:label ?value_string . 
    FILTER (LANG(?value_string) = 'da')
    BIND(COALESCE(?value_string, ?q) AS ?værdi)
  }
  UNION
  {
    BIND(2 AS ?order)
    BIND("CVR" AS ?beskrivelse)
    target: wdt:P1059 ?værdi_streng .
    BIND(CONCAT(?værdi_streng, " ↗") AS ?værdi)
    BIND(CONCAT("https://datacvr.virk.dk/enhed/virksomhed/", ?værdi_streng) AS ?værdiUrl)
  }
  UNION
  {
    BIND(100 AS ?order)
    BIND("" AS ?beskrivelse)
    BIND(SUBSTR(STR(target:), 32) AS ?q) 
    BIND("Scholia ↗" AS ?værdi)
    BIND(CONCAT("https://scholia.toolforge.org/organization/", ?q) AS ?værdiUrl)
  }
} 
ORDER BY ?order
Try it!


Kontrolgraf

[edit]
#defaultView:Graph
#defaultView:Graph
PREFIX target: <http://www.wikidata.org/entity/Q818846>

SELECT DISTINCT
  ?from ?from_image ?fromLabel
  ?to ?to_image ?toLabel
WITH {
  SELECT DISTINCT
    ?from
  WHERE {
    { BIND(target: AS ?from) }
    UNION
    { target: (wdt:P169| wdt:P488 | wdt:P1037 | wdt:P3320)? ?from }
    UNION
    { target: ( (wdt:P127 | ^wdt:P1830 | wdt:P749 | ^wdt:P355)+ | 
                (^wdt:P127 | wdt:P1830 | ^wdt:P749 | wdt:P355)+)
        / (wdt:P169 | wdt:P488 | wdt:P1037 | wdt:P3320)?
                                                       ?from . }        
  }
} AS %froms
WITH {
  SELECT DISTINCT
    ?to
  WHERE {
    { BIND(target: AS ?to) }
    UNION
    { target: ( (wdt:P127 | ^wdt:P1830 | wdt:P749 | ^wdt:P355)+ | 
                (^wdt:P127 | wdt:P1830 | ^wdt:P749 | wdt:P355)+) ?to }
  }
} AS %tos
WHERE {
  INCLUDE %froms
  INCLUDE %tos
  { ?from wdt:P1830 | wdt:P355 ?to . }
  UNION
  { ?to wdt:P127 ?from }
  UNION 
  { ?to wdt:P169 | wdt:P488 | wdt:P1037 | wdt:P3320 ?from }

  OPTIONAL { ?from wdt:P18 ?from_image . }
  OPTIONAL { ?to wdt:P18 ?to_image . }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "da,en" .  } 
}
Try it!