Dreams:report: Difference between revisions

From DREAMS
Jump to navigation Jump to search
(→‎Patterns: Changed significance display)
(→‎Patterns: Include link)
Line 111: Line 111:
   ?project_type ?project_typeLabel
   ?project_type ?project_typeLabel
   (CONCAT("#projecttype/", SUBSTR(STR(?project_type), 38)) AS ?project_typeUrl)   
   (CONCAT("#projecttype/", SUBSTR(STR(?project_type), 38)) AS ?project_typeUrl)   
  ?link


WHERE {
WHERE {
Line 124: Line 126:
   OPTIONAL { ?pattern dreamst:P21 / dreamst:P44 ?symbol . }
   OPTIONAL { ?pattern dreamst:P21 / dreamst:P44 ?symbol . }
   BIND(IF(BOUND(?symbol), ?symbol, "❓") AS ?significance)
   BIND(IF(BOUND(?symbol), ?symbol, "❓") AS ?significance)
  OPTIONAL {
    ?pattern dreamst:P20 ?report .
    ?report dreamst:P40 ?miljøportal .
    OPTIONAL { ?pattern dreamst:P46 ?page }
    BIND(CONCAT(STR(?miljøportal), IF(BOUND(?page), CONCAT(?page, " ↗"), " ↗")) AS ?value)
    BIND(CONCAT("https://daieproddreamspdfsto.blob.core.windows.net/files/", STR(?miljøportal),
                IF(BOUND(?page), CONCAT("#page=", ?page), "")) AS ?link)
  }


   SERVICE wikibase:label { bd:serviceParam wikibase:language "da,en". }
   SERVICE wikibase:label { bd:serviceParam wikibase:language "da,en". }

Revision as of 09:00, 16 September 2022

Report data

PREFIX target: <https://dreams.wikibase.cloud/entity/Q158>
PREFIX dreams: <https://dreams.wikibase.cloud/entity/>
PREFIX dreamst: <https://dreams.wikibase.cloud/prop/direct/>
PREFIX dreamsp: <https://dreams.wikibase.cloud/prop/>
PREFIX dreamspsv: <https://dreams.wikibase.cloud/prop/statement/value/> 

SELECT DISTINCT ?description
  ?value ?valueLabel ?valueUrl
WHERE {
  BIND(target: AS ?work)
  {
    BIND(1 AS ?order)
    BIND("Title" AS ?description)
    ?work dreamst:P1 ?value .
  }
  UNION
  {
    BIND(2 AS ?order)
    BIND("Author" AS ?description)
    target: dreamst:P24 ?iri .
    BIND(SUBSTR(STR(?iri), 38) AS ?q) 
    ?iri rdfs:label ?value . 
    FILTER (LANG(?value) = 'da')
    BIND(CONCAT("#author/", ?q) AS ?valueUrl)
  }
  UNION
  {
    BIND(2.5 AS ?order)
    BIND("Language" AS ?description)
    ?work dreamst:P11 ?iri .
    ?iri rdfs:label ?value_string .
    FILTER (LANG(?value_string) = 'da')
    BIND(STR(?value_string) AS ?value)
  }
  UNION
  {
    BIND(6 AS ?order)
    BIND("Publication date" AS ?description)
    ?work dreamsp:P6 / dreamspsv:P6 ?publication_date_value .
    ?publication_date_value wikibase:timePrecision ?time_precision ;
                            wikibase:timeValue ?publication_date .
    BIND(IF(?time_precision = 9, YEAR(?publication_date), xsd:date(?publication_date)) AS ?value)
  }
  UNION
  {
    BIND(7 AS ?order)
    BIND("Publisher" AS ?description)
    ?work dreamst:P26 ?iri .
    BIND(SUBSTR(STR(?iri), 38) AS ?q) 
    ?iri rdfs:label ?value_string . 
    FILTER (LANG(?value_string) = 'da')
    BIND(COALESCE(?value_string, ?q) AS ?value)
    BIND(CONCAT("#publisher/", ?q) AS ?valueUrl)
  }
  UNION
  {
    BIND(10 AS ?order)
    BIND("Project type" AS ?description)
    ?work dreamst:P16 ?value .
    BIND(CONCAT("#projecttype/", SUBSTR(STR(?value), 38)) AS ?valueUrl)
  }
  UNION
  {
    BIND(21 AS ?order)
    BIND("Scholia" AS ?description)
    ?work dreamst:P3 ?value_ .
    BIND(CONCAT(STR(?value_), " ↗") AS ?value)
    BIND(CONCAT("https://scholia.toolforge.org/work/", STR(?value_)) AS ?valueUrl)
  }
  UNION
  {
    BIND(22 AS ?order)
    BIND("Miljøportal" AS ?description)
    ?work dreamst:P40 ?value_ .
    BIND(CONCAT(STR(?value_), " ↗") AS ?value)
    BIND(CONCAT("https://daieproddreamspdfsto.blob.core.windows.net/files/", STR(?value_)) AS ?valueUrl)
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],da,en". }
} 
ORDER BY ?order


Patterns

PREFIX target: <https://dreams.wikibase.cloud/entity/Q153>
PREFIX dreams: <https://dreams.wikibase.cloud/entity/>
PREFIX dreamst: <https://dreams.wikibase.cloud/prop/direct/>
PREFIX dreamsp: <https://dreams.wikibase.cloud/prop/>
PREFIX dreamspsv: <https://dreams.wikibase.cloud/prop/statement/value/> 

SELECT
  ?pattern ?patternLabel
  (CONCAT("#pattern/", SUBSTR(STR(?pattern), 38)) AS ?patternUrl)  

  ?subject ?subjectLabel
  (CONCAT("#effect/", SUBSTR(STR(?subject), 38)) AS ?subjectUrl)  

  ?object ?objectLabel
  (CONCAT("#effect/", SUBSTR(STR(?object), 38)) AS ?objectUrl)  

  ?significance

  ?quote 

  ?project_phase ?project_phaseLabel
  (CONCAT("#projectphase/", SUBSTR(STR(?project_phase), 38)) AS ?project_phaseUrl)  

  ?project_type ?project_typeLabel
  (CONCAT("#projecttype/", SUBSTR(STR(?project_type), 38)) AS ?project_typeUrl)  

  ?link

WHERE {
  ?pattern dreamst:P2 dreams:Q263 ;
           dreamst:P20 target: .

  OPTIONAL { ?pattern dreamst:P33 ?subject . }
  OPTIONAL { ?pattern dreamst:P34 ?object . }
  OPTIONAL { ?pattern dreamst:P18 ?quote . }
  OPTIONAL { ?pattern dreamst:P19 ?project_phase . }
  OPTIONAL { ?pattern dreamst:P16 ?project_type . }

  OPTIONAL { ?pattern dreamst:P21 / dreamst:P44 ?symbol . }
  BIND(IF(BOUND(?symbol), ?symbol, "❓") AS ?significance)

  OPTIONAL {
    ?pattern dreamst:P20 ?report .
    ?report dreamst:P40 ?miljøportal .
    OPTIONAL { ?pattern dreamst:P46 ?page }
    BIND(CONCAT(STR(?miljøportal), IF(BOUND(?page), CONCAT(?page, " ↗"), " ↗")) AS ?value)
    BIND(CONCAT("https://daieproddreamspdfsto.blob.core.windows.net/files/", STR(?miljøportal), 
                IF(BOUND(?page), CONCAT("#page=", ?page), "")) AS ?link)
  }

  SERVICE wikibase:label { bd:serviceParam wikibase:language "da,en". }
}


Locations

PREFIX target: <https://dreams.wikibase.cloud/entity/Q158>
PREFIX dreams: <https://dreams.wikibase.cloud/entity/>
PREFIX dreamst: <https://dreams.wikibase.cloud/prop/direct/>
PREFIX dreamsp: <https://dreams.wikibase.cloud/prop/>
PREFIX dreamspr: <https://dreams.wikibase.cloud/prop/reference/>
PREFIX dreamsps: <https://dreams.wikibase.cloud/prop/statement/> 
PREFIX prov: <http://www.w3.org/ns/prov#>

SELECT 
  ?location ?locationLabel
  (CONCAT("#location/", SUBSTR(STR(?location), 38)) AS ?locationUrl)
  ?locationDescription

  ?quote
WHERE {
  target: dreamsp:P12 ?location_statement .
  ?location_statement dreamsps:P12 ?location .
  OPTIONAL {
    ?location_statement prov:wasDerivedFrom / dreamspr:P18 ?quote .
  }
  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "da,en". }
}


Citations

PREFIX target: <https://dreams.wikibase.cloud/entity/Q100>
PREFIX dreams: <https://dreams.wikibase.cloud/entity/>
PREFIX dreamst: <https://dreams.wikibase.cloud/prop/direct/>
PREFIX dreamsp: <https://dreams.wikibase.cloud/prop/>
PREFIX dreamspsv: <https://dreams.wikibase.cloud/prop/statement/value/> 

SELECT 
  ?title

  ("Scholia ↗" AS ?scholia) 
  ?scholiaUrl
WHERE {
  target: dreamst:P3 ?wikidata_q .
  BIND(IRI(CONCAT("http://www.wikidata.org/entity/", ?wikidata_q)) AS ?wikidata)
  
  SERVICE <https://query.wikidata.org/sparql> {
    ?wikidata wdt:P2860 ?cited .
    OPTIONAL {
      ?cited wdt:P1476 ?title .
    }
    BIND(CONCAT("https://scholia.toolforge.org/work/", SUBSTR(STR(?cited), 32)) AS ?scholiaUrl)
  }
}


Related works from co-citations

PREFIX target: <https://dreams.wikibase.cloud/entity/Q100>
PREFIX dreams: <https://dreams.wikibase.cloud/entity/>
PREFIX dreamst: <https://dreams.wikibase.cloud/prop/direct/>

SELECT 
  ?score
  ?title ?titleUrl
  ("Scholia ↗" AS ?scholia) ?scholiaUrl
  
WHERE {
  { 
    SELECT 
      (COUNT(*) AS ?score)
      ?work ?title
    WHERE {
      target: dreamst:P3 ?wikidata_q .
      BIND(IRI(CONCAT("http://www.wikidata.org/entity/", ?wikidata_q)) AS ?wikidata)
  
      SERVICE <https://query.wikidata.org/sparql> {
        ?wikidata (^wdt:P2860