Skip to content

Manually removing published cube

Michael Luggen edited this page Nov 16, 2022 · 6 revisions

The query below can be used to remove a cube, its metadata and observations.

  1. Replace the WITH line with the organization's proper graph name
  2. Replace the URI in the BIND line with the correct cube identifier to remove
PREFIX cube: <https://cube.link/>
prefix sh: <http://www.w3.org/ns/shacl#>
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>

WITH <https://lindas.admin.ch/foen/cube>
delete {
  ?cube a cube:Cube ;
        cube:observationConstraint ?shape ;
        cube:observationSet ?set ;
        ?p1 ?metaLevel1 .

  ?metaLevel1 ?p2 ?metaLevel2 .
  
  ?shape ?shapeP ?shapeO .
  ?propertyS ?propertyP ?propertyO .
  
  ?set cube:observation ?observationS .
  ?observationS ?observationP ?observationO .
}
WHERE  
{ 
    BIND(<https://environment.ld.admin.ch/foen/ubd000501/10> AS ?cube)
    ?cube  rdf:type  cube:Cube

      { ?cube  ?p1  ?metaLevel1
        OPTIONAL
          { ?metaLevel1  ?p2  ?metaLevel2
            FILTER isBlank(?metaLevel1)
          }
      }
    UNION
      { ?cube   cube:observationConstraint  ?shape .
        ?shape  ?shapeP               ?shapeO
      }
    UNION
      { ?cube cube:observationConstraint/sh:property ?property .
        ?property (<>|!<>)* ?propertyS .
        ?propertyS  ?propertyP  ?propertyO
      }
    UNION
      { ?cube     cube:observationSet  ?set .
        ?set      cube:observation     ?observationS .
        ?observationS
                  ?observationP        ?observationO
      }
}
Clone this wiki locally