Skip to content

Commit

Permalink
start of reasoning rules
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholascar committed Sep 26, 2024
1 parent b1d7448 commit 8fac6a0
Show file tree
Hide file tree
Showing 3 changed files with 158 additions and 3 deletions.
2 changes: 1 addition & 1 deletion spec/01-metadata.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
|*https://schema.org/name[Name]* | Australian Biodiversity Information Standard
|*https://www.w3.org/TR/skos-reference/#definition[Definition]* | This document is the normative specification of the Australian Biodiversity Information Standard (ABIS) and includes its authoritative statements on parts, requirements and patterns.
|*https://schema.org/dateCreated[Created Date]* | 2021-10-24
|*https://schema.org/dateModified[Modified Date]* | 2024-08-12
|*https://schema.org/dateModified[Modified Date]* | 2024-09-26
|*https://schema.org/dateIssued[Issued Date]* | 2023-12-04
|*https://schema.org/version[Version]* | 2.4
|*https://www.w3.org/TR/2012/REC-owl2-syntax-20121211/#Ontology_IRI_and_Version_IRI[Version IRI]* | https://linked.data.gov.au/def/abis/2.3[abis:2.4]
Expand Down
2 changes: 1 addition & 1 deletion spec/10-mappings.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ ex:obs-1

maps to the following Darwin Core Terms data:

[turtle]
[source, turtle]
----
ex:sample-1
a dwc:LivingSpecimen ;
Expand Down
157 changes: 156 additions & 1 deletion spec/11-reasoning-rules.adoc
Original file line number Diff line number Diff line change
@@ -1,12 +1,167 @@
== Reasoning Rules

This section contains rules that ABIS-compliant systems must implement. The rules are machine executable rules that create new information from ABIS data based on logical, ontological, spatial and other reasoning.
This section contains rules that MUST be able to be executed on ABIS data. The rules are machine executable and create new information from ABIS data based on logical, ontological, spatial and other reasoning.

The purpose of these rules are to create convenient forms of base ABIS data, such as bounding boxes for datasets when only Occurrence locations are initially provided. This enables efficient use of ABIS data - dataset discovery can search spatially across the fewer datasets, not just across the more numerous occurrences - and also fleshes out certain data patterns where base ABIS data might have provided multiple forms of content which do not meet the pattern directly but can be used to calculate it.

=== How Rules Work

On receipt of ABIS data, ABIS-compliant systems MAY make available data that has been expended, based on the rules in the Rule List below. How a system does this is a matter for the system but the general approaches are:

1. forward chaining
2. backwards chaining

Forwards chaining involves expanding received data in accordance with the rules and materialising all the extension elements. Backwards chaining involves applying the reasoning rules to queries of the data such that the query can be answered as if the data had been expanded.

The rules are identified below, described in English and then defined in <<SPARQL, SPARQL>> queries. Implementing systems do not have to expand the data using SPARQL queries - they may use any system they like, such as application code - but the SPARQL queries serve as the canonical definition of the rule.

=== Rule List

[cols="1,4,1,8"]
|===
| ID | Description | Dependencies | Definition

| R01 | Calculate `abis:Occurrence` instances from Observations with XXX properties | - a|
[sources,sparql]
----
PREFIX abis: <https://linked.data.gov.au/def/abis/>
PREFIX tern <https://w3id.org/tern/ontologies/tern/>
PREFIX void: <http://rdfs.org/ns/void#>
CONSTRUCT {
?occ a abis:Occurrence .
}
WHERE {
# ...
}
----
| R02 | Calculate `abis:BiodiversityOccurrenceRecord` instances from ... | - a|
[sources,sparql]
----
PREFIX abis: <https://linked.data.gov.au/def/abis/>
PREFIX tern <https://w3id.org/tern/ontologies/tern/>
PREFIX void: <http://rdfs.org/ns/void#>
CONSTRUCT {
?boc a abis:BiodiversityOccurrenceRecord .
}
WHERE {
# ...
}
----
| R03 | Centroids must be calculated for polygons | - a|
[sources,sparql]
----
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
CONSTRUCT {
?feature geo:hasCentroid ?centroid
}
WHERE {
?feature geo:hasGeometry/geo:asWKT ?wkt .
BIND geof:centroid(?wkt) AS ?centroid .
FILTER REGEX(?wkt, "POLYGON")
}
----
| R04 | If a Dataset does not have a geometry supplied, it must have it calculated as the convex hull of its spatial object members | R01 a|
[sources,sparql]
----
PREFIX abis: <https://linked.data.gov.au/def/abis/>
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX tern <https://w3id.org/tern/ontologies/tern/>
PREFIX void: <http://rdfs.org/ns/void#>
CONSTRUCT {
?dataset geo:hasGeometry ?geom .
?geom geo:asWKT ?wkt .
}
WHERE {
{
VALUES ?spatialFeature {
abis:Ocurrence
tern:Site
tern:Survey
tern:SiteVisit
}
SELECT ?wkt
WHERE {
?feature
void:inDataset ?dataset ;
a ?spatialFeature ;
.
}
}
BIND BNODE() AS ?geom .
BIND geof:aggBoundingBox(?wkt) AS ?boundingbox .
MINUS {
?dataset geo:hasGeometry ?geom .
}
}
----
| R05 | Bounding Boxes must be calculated for Datasets | R04 a|
[sources,sparql]
----
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
CONSTRUCT {
?dataset geo:hasBoundingBox ?boundingbox
}
WHERE {
?dataset geo:hasGeometry/geo:asWKT ?wkt .
BIND geof:aggBoundingBox(?wkt) AS ?boundingbox .
}
----
| R06 | If a Dataset does not have a temporal range supplied, it must have it calculated as the containing interval containing all of its temporal object members | R01 a|
[sources,sparql]
----
PREFIX abis: <https://linked.data.gov.au/def/abis/>
PREFIX schema: <https://schema.org/>
PREFIX tern <https://w3id.org/tern/ontologies/tern/>
PREFIX time: <http://www.w3.org/2006/time#>
CONSTRUCT {
?dataset schema:temporality ?boundingbox
}
WHERE {
{
VALUES ?temporalFeature {
abis:Ocurrence
}
SELECT ?wkt
WHERE {
?feature
void:inDataset ?dataset ;
a ?temporalFeature
.
?feature time:hasTime ?time .
}
}
?dataset geo:hasGeometry/geo:asWKT ?wkt .
BIND geof:aggBoundingBox(?wkt) AS ?boundingbox .
MINUS {
?dataset schema:temporality ?temporal .
}
}
----

|===


[discrete]
==== Record Rule

Expand Down

0 comments on commit 8fac6a0

Please sign in to comment.