BritishGeologicalSurvey / stratigraph

Network stratigraphy through text mining
GNU Lesser General Public License v3.0
4 stars 0 forks source link

generalise units up to a parent higher ranking unit #24

Open rachelheaven opened 3 years ago

rachelheaven commented 3 years ago

The graph visualisation might only make sense if it is drawn for a single unit rank type at a time (mostly Member or Formation, but we could let any rank type be selected). The current query to generate the graph optionally applies this filter , returning triples only where the subject unit and the upper and lower units are all of rank Formation.

Some upper and lower units may be of a different rank though, so we can walk up the skos:broader path of units to generalise a lower ranking unit until we get to the rank that we want the graph to show.

The query below using the property path query syntax to traverse any number of paths until a parent unit of rank Formation (F) is reached. This will need to be applied to the unit that is the subject of the triple, and the units that are the objects of the upperand lower relationships.


PREFIX lex: <http://data.bgs.ac.uk/ref/Lexicon/>
PREFIX geochron: <http://data.bgs.ac.uk/ref/Geochronology/>
PREFIX rock: <http://data.bgs.ac.uk/id/Lexicon/RockUnitRank/>
PREFIX ext: <http://data.bgs.ac.uk/ref/Lexicon/Extended/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

 SELECT ?lex ?rank ?parent ?parentrank
 {
   ?lex  lex:hasRockUnitRank ?rank .  
   ?lex skos:broader+ ?parent .
   ?parent lex:hasRockUnitRank ?parentrank .
   FILTER (?parentrank=rock:F)
 }