Skip to content
This repository has been archived by the owner on Oct 18, 2022. It is now read-only.

Convert Geofabric data to use simplified/aligned version of the ontology #26

Open
dr-shorthair opened this issue Dec 16, 2019 · 7 comments
Assignees
Labels
enhancement New feature or request Priority: Medium

Comments

@dr-shorthair
Copy link

https://github.com/CSIRO-enviro-informatics/loci.cat/wiki/Simplifying-the-initial-ontologies describes a simplification of the Geofabric datasets to match a more unified Loc-I ontology pattern. The goal is to simplify/harmonize the SPARQL queries.

The transformations required are illustrated by-example as follows.

Original format from test data

<http://linked.data.gov.au/dataset/geofabric/contractedcatchment/12101547>
  rdf:type geof:ContractedCatchment ;
  geof:perimeterLength [
      qudt:numericValue "0.839999999999691"^^xsd:float ;
      qudt:unit <http://qudt.org/vocab/unit/DEG> ;
    ] ;
  geof:shapeArea [
      qudt:numericValue "0.0179125000000005"^^xsd:float ;
      qudt:unit <http://qudt.org/vocab/unit/DEG2> ;
    ] ;
  geox:hasAreaM2 [
      data:value 173807875.618321 ;
      qb4st:crs <http://www.opengis.net/def/crs/EPSG/0/3577> ;
    ] ;
  geox:hasAreaM2 [
      data:value 173889207.14082238 ;
      qb4st:crs <http://www.opengis.net/def/crs/EPSG/0/4938> ;
    ] ;
  reg:register <http://linked.data.gov.au/dataset/geofabric/contractedcatchment/> ;
  dc:source "Bureau of Meteorology" ;
  geo:sfWithin <http://linked.data.gov.au/dataset/geofabric/drainagedivision/9400210> ;
  geo:sfWithin <http://linked.data.gov.au/dataset/geofabric/riverregion/9400345> ;
.

Minor regularization

  1. reg:registerloci:isMemberOf and inverse
  2. add explicit geo:hasGeometry link to geometry service
<http://linked.data.gov.au/dataset/geofabric/contractedcatchment/12101547>
  rdf:type geof:ContractedCatchment ;
  geof:perimeterLength [
      qudt:numericValue "0.839999999999691"^^xsd:float ;
      qudt:unit <http://qudt.org/vocab/unit/DEG> ;
    ] ;
  geof:shapeArea [
      qudt:numericValue "0.0179125000000005"^^xsd:float ;
      qudt:unit <http://qudt.org/vocab/unit/DEG2> ;
    ] ;
  geox:hasAreaM2 [
      data:value 173807875.618321 ;
      qb4st:crs <http://www.opengis.net/def/crs/EPSG/0/3577> ;
    ] ;
  geox:hasAreaM2 [
      data:value 173889207.14082238 ;
      qb4st:crs <http://www.opengis.net/def/crs/EPSG/0/4938> ;
    ] ;
  loci:isMemberOf <http://linked.data.gov.au/dataset/geofabric/contractedcatchment/> ;
  dc:source "Bureau of Meteorology" ;
  geo:hasGeometry <http://linked.data.gov.au/dataset/loci-geometry/contractedcatchment/12101547> ;
  geo:sfWithin <http://linked.data.gov.au/dataset/geofabric/drainagedivision/9400210> ;
  geo:sfWithin <http://linked.data.gov.au/dataset/geofabric/riverregion/9400345> ;
.

<http://linked.data.gov.au/dataset/geofabric/contractedcatchment/> rdfs:member <http://linked.data.gov.au/dataset/geofabric/contractedcatchment/12101547> .

@dr-shorthair
Copy link
Author

dr-shorthair commented Dec 19, 2019

Item 1.:

INSERT { 
        ?gf loci:isMemberOf ?reg . 
        ?reg a rdf:Bag , loci:Dataset ; rdfs:member ?gf . 
}
WHERE { 
	{ ?gf a geof:ContractedCatchment . } UNION { ?gf a geof:DrainageDivision . } UNION { ?gf a geof:RiverRegion . }
	BIND(  IRI ( REPLACE ( STR (?gf), "(#|/)[^#/]*$", "$1" )) AS ?reg )
}

@dr-shorthair
Copy link
Author

dr-shorthair commented Dec 19, 2019

Item 2.:

INSERT { ?gf geo:hasGeometry ?gg . }
WHERE { 
	 ?gf a geof:RiverRegion .  
     BIND( IRI( CONCAT( "http://gds.loci.cat/geometry/geofabric2_1_1_riverregion/" , REPLACE( str( ?gf), '^.*(#|/)', "" ))) AS ?gg )
}

INSERT { ?gf geo:hasGeometry ?gg . }
WHERE { 
	 ?gf a geof:DrainageDivision.  
     BIND( IRI( CONCAT( "http://gds.loci.cat/geometry/geofabric2_1_1_awradrainagedivision/" , REPLACE( str( ?gf), '^.*(#|/)', "" ))) AS ?gg )
}

INSERT { ?gf geo:hasGeometry ?gg . }
WHERE { 
	 ?gf a geof:ContractedCatchment.  
     BIND( IRI( CONCAT( "http://gds.loci.cat/geometry/geofabric2_1_1_ahgfcontractedcatchment/" , REPLACE( str( ?gf), '^.*(#|/)', "" ))) AS ?gg )
}

@dr-shorthair
Copy link
Author

Item 3.:

INSERT { ?gf dcterms:identifier ?id. }
WHERE { 
	{ ?gf a geof:ContractedCatchment . } UNION { ?gf a geof:DrainageDivision . } UNION { ?gf a geof:RiverRegion . }
        BIND( STRDT( REPLACE( str( ?gf), '^.*(#|/)', "" ), geof:geofabric-id ) AS ?id)
}

@ashleysommer
Copy link
Contributor

geofabric view adapted by commit: 26eb1f6

@ashleysommer
Copy link
Contributor

This can probably be closed now.

@jyucsiro
Copy link

jyucsiro commented Jan 6, 2020

@ashleysommer i can see you've implemented externalising the link to the geometry to gds.loci.cat so thanks for that.

The URI isn't quite right. We're using links like this.
http://gds.loci.cat/geometry/geofabric2_1_1_awradrainagedivision/9400203

In geofabricld.net drainagedivision features, eg. https://geofabricld.net/drainagedivision/9400203?_view=geofabric&_format=text/turtle

... could you change this:

    geo:hasDefaultGeometry <http://gds.loci.cat/geometry/geofabric2_1_1_drainagedivision/9400203> ;
    geo:hasGeometry <http://gds.loci.cat/geometry/geofabric2_1_1_drainagedivision/9400203> .

to

    geo:hasDefaultGeometry <http://gds.loci.cat/geometry/geofabric2_1_1_awradrainagedivision/9400203> ;
    geo:hasGeometry <http://gds.loci.cat/geometry/geofabric2_1_1_awradrainagedivision/9400203> .

(missing awra in the uri)

@ashleysommer
Copy link
Contributor

@jyucsiro
Ok, made that change.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request Priority: Medium
Projects
None yet
Development

No branches or pull requests

5 participants