Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 Priority: Medium
Projects

Comments

@dr-shorthair
Copy link
Contributor

dr-shorthair commented Dec 16, 2019

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 dr-shorthair added the enhancement label Dec 16, 2019
@dr-shorthair dr-shorthair added this to To do in loci-kanban via automation Dec 16, 2019
@dr-shorthair
Copy link
Contributor 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
Contributor 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
Contributor Author

dr-shorthair commented Dec 19, 2019

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

ashleysommer commented Jan 6, 2020

geofabric view adapted by commit: 26eb1f6

@ashleysommer
Copy link
Contributor

ashleysommer commented Jan 6, 2020

This can probably be closed now.

@ashleysommer ashleysommer moved this from To do to In progress in loci-kanban Jan 6, 2020
@ashleysommer ashleysommer moved this from In progress to Discussion needed in loci-kanban Jan 6, 2020
@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

ashleysommer commented Jan 7, 2020

@jyucsiro
Ok, made that change.

@ashleysommer ashleysommer moved this from Discussion needed to Closed in loci-kanban Feb 20, 2020
@jyucsiro jyucsiro moved this from Closed to Done in loci-kanban Mar 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Priority: Medium
Projects
loci-kanban
  
Done
Development

No branches or pull requests

5 participants