From e0c841ab3126ab4e7620bc9a4fdf1326931d55d7 Mon Sep 17 00:00:00 2001 From: Alejandro Villar Date: Wed, 28 Aug 2024 12:59:41 +0200 Subject: [PATCH] Implement green-public-spaces-present and fix uplift --- data/cityjson-uplift.yml | 8 +++-- data/shapes/ascoli-piceno.shacl | 2 +- data/shapes/green-public-spaces-present.shacl | 29 +++++++++++-------- data/shapes/roads-present.shacl | 5 +++- 4 files changed, 27 insertions(+), 17 deletions(-) diff --git a/data/cityjson-uplift.yml b/data/cityjson-uplift.yml index ce6913a..2b47cd5 100644 --- a/data/cityjson-uplift.yml +++ b/data/cityjson-uplift.yml @@ -56,6 +56,8 @@ context: id: dct:identifier version: city:version + attributes: '@nest' + CityObjects: '@id': city:hasObject '@context': @@ -97,6 +99,9 @@ context: _AbstractCityObject: city:_AbstractCityObject _AbstractTransportationComplex: city:_AbstractTransportationComplex '+GenericCityObject': https://www.cityjson.org/extensions/download/generic.ext.json#GenericCityObject + + function: city:hasFunction + usage: city:hasUsage geometry: '@id': city:hasGeometry @@ -147,9 +152,6 @@ context: '@id': city:boundaries '@container': '@list' '@type': '@id' - function: city:hasFunction - usage: city:hasUsage - attributes: '@nest' parents: '@id': city:hasParent '@type': '@id' diff --git a/data/shapes/ascoli-piceno.shacl b/data/shapes/ascoli-piceno.shacl index aa4ef29..6e03bcb 100644 --- a/data/shapes/ascoli-piceno.shacl +++ b/data/shapes/ascoli-piceno.shacl @@ -33,7 +33,7 @@ ex: ], [ sh:prefix "attr" ; sh:namespace "http://example.com/vocab/city/attr#"^^xsd:anyURI ; - ]; + ] ; . :BuildingOfInterestPresent diff --git a/data/shapes/green-public-spaces-present.shacl b/data/shapes/green-public-spaces-present.shacl index 902b0d4..216e559 100644 --- a/data/shapes/green-public-spaces-present.shacl +++ b/data/shapes/green-public-spaces-present.shacl @@ -29,22 +29,27 @@ ex: ], [ sh:prefix "sd" ; sh:namespace "https://w3id.org/okn/o/sd#"^^xsd:anyURI ; - ]; + ], [ + sh:prefix "attr" ; + sh:namespace "http://example.com/vocab/city/attr#"^^xsd:anyURI ; + ] ; . :GreenPublicSpaces a sh:NodeShape ; sh:targetNode chek:document ; - sh:not [ - sh:sparql [ - sh:prefixes ex: ; - sh:select """ - SELECT $this (rdf:type as ?path) (city:Road as ?value) WHERE { - ?s a city:Road - } LIMIT 1 - """ ; - ] ; - ] ; - sh:message "Dataset contains no Road objects" ; + sh:sparql [ + sh:prefixes ex: ; + sh:select """ + SELECT $this (rdf:type as ?path) ("LandUse objects with function 1110, 3010 or 3030" as ?value) WHERE { + FILTER NOT EXISTS { + ?s a city:LandUse ; + city:hasFunction ?function . + FILTER(?function IN ("1110", "3010", "3030")) + } + } LIMIT 1 + """ ; + ] ; + sh:message "Dataset contains no green public spaces" ; sh:severity sh:Violation ; . \ No newline at end of file diff --git a/data/shapes/roads-present.shacl b/data/shapes/roads-present.shacl index 9ba7279..f9046c4 100644 --- a/data/shapes/roads-present.shacl +++ b/data/shapes/roads-present.shacl @@ -29,7 +29,10 @@ ex: ], [ sh:prefix "sd" ; sh:namespace "https://w3id.org/okn/o/sd#"^^xsd:anyURI ; - ]; + ], [ + sh:prefix "attr" ; + sh:namespace "http://example.com/vocab/city/attr#"^^xsd:anyURI ; + ] ; . :RoadsPresent