Skip to content

Commit

Permalink
BDRSPS-1109 When surveyID is missing from an occurrence, treat it as …
Browse files Browse the repository at this point in the history
…incidental

i.e. don't link it to a Survey in the RDF output.
  • Loading branch information
Lincoln-GR committed Dec 13, 2024
1 parent 456aa79 commit 358ee26
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1464,8 +1464,7 @@
<https://linked.data.gov.au/dataset/bdr/00000000-0000-0000-0000-000000000000/occurrence/12> a dwc:Occurrence,
tern:FeatureOfInterest ;
sosa:usedProcedure <https://linked.data.gov.au/def/nrm/a8db263e-7a39-5b85-a5d2-8e1af7ce1e39> ;
schema:isPartOf <https://linked.data.gov.au/dataset/bdr/00000000-0000-0000-0000-000000000000>,
<https://linked.data.gov.au/dataset/bdr/00000000-0000-0000-0000-000000000000/Survey/1> ;
schema:isPartOf <https://linked.data.gov.au/dataset/bdr/00000000-0000-0000-0000-000000000000> ;
schema:spatial _:N7bfc9936b099cf9353fc575500000021 ;
schema:temporal [ a time:TemporalEntity ;
time:hasBeginning [ a time:Instant ;
Expand All @@ -1488,8 +1487,7 @@
tern:FeatureOfInterest ;
prov:wasAssociatedWith <https://linked.data.gov.au/dataset/bdr/orgs/Stream-Environment-and-Water-Pty-Ltd> ;
sosa:usedProcedure <https://linked.data.gov.au/def/nrm/a8db263e-7a39-5b85-a5d2-8e1af7ce1e39> ;
schema:isPartOf <https://linked.data.gov.au/dataset/bdr/00000000-0000-0000-0000-000000000000>,
<https://linked.data.gov.au/dataset/bdr/00000000-0000-0000-0000-000000000000/Survey/1> ;
schema:isPartOf <https://linked.data.gov.au/dataset/bdr/00000000-0000-0000-0000-000000000000> ;
schema:spatial _:N7bfc9936b099cf9353fc575500000000 ;
schema:temporal [ a time:TemporalEntity ;
time:hasBeginning [ a time:Instant ;
Expand All @@ -1501,8 +1499,7 @@
tern:FeatureOfInterest ;
prov:wasAssociatedWith <https://linked.data.gov.au/dataset/bdr/orgs/Stream-Environment-and-Water-Pty-Ltd> ;
sosa:usedProcedure <https://linked.data.gov.au/def/nrm/a8db263e-7a39-5b85-a5d2-8e1af7ce1e39> ;
schema:isPartOf <https://linked.data.gov.au/dataset/bdr/00000000-0000-0000-0000-000000000000>,
<https://linked.data.gov.au/dataset/bdr/00000000-0000-0000-0000-000000000000/Survey/1> ;
schema:isPartOf <https://linked.data.gov.au/dataset/bdr/00000000-0000-0000-0000-000000000000> ;
schema:spatial _:N7bfc9936b099cf9353fc57550000001b ;
schema:temporal [ a time:TemporalEntity ;
time:hasBeginning [ a time:Instant ;
Expand All @@ -1514,8 +1511,7 @@
tern:FeatureOfInterest ;
prov:wasAssociatedWith <https://linked.data.gov.au/dataset/bdr/orgs/Stream-Environment-and-Water-Pty-Ltd> ;
sosa:usedProcedure <https://linked.data.gov.au/def/nrm/a8db263e-7a39-5b85-a5d2-8e1af7ce1e39> ;
schema:isPartOf <https://linked.data.gov.au/dataset/bdr/00000000-0000-0000-0000-000000000000>,
<https://linked.data.gov.au/dataset/bdr/00000000-0000-0000-0000-000000000000/Survey/1> ;
schema:isPartOf <https://linked.data.gov.au/dataset/bdr/00000000-0000-0000-0000-000000000000> ;
schema:spatial _:N7bfc9936b099cf9353fc57550000001e ;
schema:temporal [ a time:TemporalEntity ;
time:hasBeginning [ a time:Instant ;
Expand All @@ -1527,8 +1523,7 @@
tern:FeatureOfInterest ;
sosa:usedProcedure <https://linked.data.gov.au/def/nrm/a8db263e-7a39-5b85-a5d2-8e1af7ce1e39> ;
schema:identifier "PE:12:8831" ;
schema:isPartOf <https://linked.data.gov.au/dataset/bdr/00000000-0000-0000-0000-000000000000>,
<https://linked.data.gov.au/dataset/bdr/00000000-0000-0000-0000-000000000000/Survey/1> ;
schema:isPartOf <https://linked.data.gov.au/dataset/bdr/00000000-0000-0000-0000-000000000000> ;
schema:spatial _:N7bfc9936b099cf9353fc575500000003 ;
schema:temporal [ a time:TemporalEntity ;
time:hasBeginning [ a time:Instant ;
Expand All @@ -1540,8 +1535,7 @@
tern:FeatureOfInterest ;
prov:wasAssociatedWith <https://linked.data.gov.au/dataset/bdr/orgs/Test-Pty-Ltd> ;
sosa:usedProcedure <https://linked.data.gov.au/def/nrm/a8db263e-7a39-5b85-a5d2-8e1af7ce1e39> ;
schema:isPartOf <https://linked.data.gov.au/dataset/bdr/00000000-0000-0000-0000-000000000000>,
<https://linked.data.gov.au/dataset/bdr/00000000-0000-0000-0000-000000000000/Survey/1> ;
schema:isPartOf <https://linked.data.gov.au/dataset/bdr/00000000-0000-0000-0000-000000000000> ;
schema:spatial _:N7bfc9936b099cf9353fc575500000006 ;
schema:temporal [ a time:TemporalEntity ;
time:hasBeginning [ a time:Instant ;
Expand All @@ -1553,8 +1547,7 @@
tern:FeatureOfInterest ;
prov:wasAssociatedWith <https://linked.data.gov.au/dataset/bdr/orgs/Stream-Environment-and-Water-Pty-Ltd> ;
sosa:usedProcedure <https://linked.data.gov.au/def/nrm/a8db263e-7a39-5b85-a5d2-8e1af7ce1e39> ;
schema:isPartOf <https://linked.data.gov.au/dataset/bdr/00000000-0000-0000-0000-000000000000>,
<https://linked.data.gov.au/dataset/bdr/00000000-0000-0000-0000-000000000000/Survey/1> ;
schema:isPartOf <https://linked.data.gov.au/dataset/bdr/00000000-0000-0000-0000-000000000000> ;
schema:spatial _:N7bfc9936b099cf9353fc575500000009 ;
schema:temporal [ a time:TemporalEntity ;
time:hasBeginning [ a time:Instant ;
Expand All @@ -1566,8 +1559,7 @@
tern:FeatureOfInterest ;
prov:wasAssociatedWith <https://linked.data.gov.au/dataset/bdr/orgs/Stream-Environment-and-Water-Pty-Ltd> ;
sosa:usedProcedure <https://linked.data.gov.au/def/nrm/a8db263e-7a39-5b85-a5d2-8e1af7ce1e39> ;
schema:isPartOf <https://linked.data.gov.au/dataset/bdr/00000000-0000-0000-0000-000000000000>,
<https://linked.data.gov.au/dataset/bdr/00000000-0000-0000-0000-000000000000/Survey/1> ;
schema:isPartOf <https://linked.data.gov.au/dataset/bdr/00000000-0000-0000-0000-000000000000> ;
schema:spatial _:N7bfc9936b099cf9353fc57550000000c ;
schema:temporal [ a time:TemporalEntity ;
time:hasBeginning [ a time:Instant ;
Expand All @@ -1579,8 +1571,7 @@
tern:FeatureOfInterest ;
prov:wasAssociatedWith <https://linked.data.gov.au/dataset/bdr/orgs/Stream-Environment-and-Water-Pty-Ltd> ;
sosa:usedProcedure <https://linked.data.gov.au/def/nrm/a8db263e-7a39-5b85-a5d2-8e1af7ce1e39> ;
schema:isPartOf <https://linked.data.gov.au/dataset/bdr/00000000-0000-0000-0000-000000000000>,
<https://linked.data.gov.au/dataset/bdr/00000000-0000-0000-0000-000000000000/Survey/1> ;
schema:isPartOf <https://linked.data.gov.au/dataset/bdr/00000000-0000-0000-0000-000000000000> ;
schema:spatial _:N7bfc9936b099cf9353fc57550000000f ;
schema:temporal [ a time:TemporalEntity ;
time:hasBeginning [ a time:Instant ;
Expand All @@ -1592,8 +1583,7 @@
tern:FeatureOfInterest ;
prov:wasAssociatedWith <https://linked.data.gov.au/dataset/bdr/orgs/Stream-Environment-and-Water-Pty-Ltd> ;
sosa:usedProcedure <https://linked.data.gov.au/def/nrm/a8db263e-7a39-5b85-a5d2-8e1af7ce1e39> ;
schema:isPartOf <https://linked.data.gov.au/dataset/bdr/00000000-0000-0000-0000-000000000000>,
<https://linked.data.gov.au/dataset/bdr/00000000-0000-0000-0000-000000000000/Survey/1> ;
schema:isPartOf <https://linked.data.gov.au/dataset/bdr/00000000-0000-0000-0000-000000000000> ;
schema:spatial _:N7bfc9936b099cf9353fc575500000012 ;
schema:temporal [ a time:TemporalEntity ;
time:hasBeginning [ a time:Instant ;
Expand All @@ -1605,8 +1595,7 @@
tern:FeatureOfInterest ;
prov:wasAssociatedWith <https://linked.data.gov.au/dataset/bdr/orgs/Stream-Environment-and-Water-Pty-Ltd> ;
sosa:usedProcedure <https://linked.data.gov.au/def/nrm/a8db263e-7a39-5b85-a5d2-8e1af7ce1e39> ;
schema:isPartOf <https://linked.data.gov.au/dataset/bdr/00000000-0000-0000-0000-000000000000>,
<https://linked.data.gov.au/dataset/bdr/00000000-0000-0000-0000-000000000000/Survey/1> ;
schema:isPartOf <https://linked.data.gov.au/dataset/bdr/00000000-0000-0000-0000-000000000000> ;
schema:spatial _:N7bfc9936b099cf9353fc575500000015 ;
schema:temporal [ a time:TemporalEntity ;
time:hasBeginning [ a time:Instant ;
Expand All @@ -1618,8 +1607,7 @@
tern:FeatureOfInterest ;
prov:wasAssociatedWith <https://linked.data.gov.au/dataset/bdr/orgs/Stream-Environment-and-Water-Pty-Ltd> ;
sosa:usedProcedure <https://linked.data.gov.au/def/nrm/a8db263e-7a39-5b85-a5d2-8e1af7ce1e39> ;
schema:isPartOf <https://linked.data.gov.au/dataset/bdr/00000000-0000-0000-0000-000000000000>,
<https://linked.data.gov.au/dataset/bdr/00000000-0000-0000-0000-000000000000/Survey/1> ;
schema:isPartOf <https://linked.data.gov.au/dataset/bdr/00000000-0000-0000-0000-000000000000> ;
schema:spatial _:N7bfc9936b099cf9353fc575500000018 ;
schema:temporal [ a time:TemporalEntity ;
time:hasBeginning [ a time:Instant ;
Expand Down Expand Up @@ -1650,8 +1638,7 @@
dwc:collectionCode "C01" ;
prov:wasAssociatedWith <https://linked.data.gov.au/dataset/bdr/orgs/Stream-Environment-and-Water-Pty-Ltd> ;
sosa:usedProcedure <https://linked.data.gov.au/def/nrm/a8db263e-7a39-5b85-a5d2-8e1af7ce1e39> ;
schema:isPartOf <https://linked.data.gov.au/dataset/bdr/00000000-0000-0000-0000-000000000000>,
<https://linked.data.gov.au/dataset/bdr/00000000-0000-0000-0000-000000000000/Survey/1> ;
schema:isPartOf <https://linked.data.gov.au/dataset/bdr/00000000-0000-0000-0000-000000000000> ;
schema:spatial _:N7bfc9936b099cf9353fc575500000024 ;
schema:temporal [ a time:TemporalEntity ;
time:hasBeginning [ a time:Instant ;
Expand All @@ -1665,8 +1652,7 @@
dwc:collectionCode "C01" ;
prov:wasAssociatedWith <https://linked.data.gov.au/dataset/bdr/orgs/Stream-Environment-and-Water-Pty-Ltd> ;
sosa:usedProcedure <https://linked.data.gov.au/def/nrm/a8db263e-7a39-5b85-a5d2-8e1af7ce1e39> ;
schema:isPartOf <https://linked.data.gov.au/dataset/bdr/00000000-0000-0000-0000-000000000000>,
<https://linked.data.gov.au/dataset/bdr/00000000-0000-0000-0000-000000000000/Survey/1> ;
schema:isPartOf <https://linked.data.gov.au/dataset/bdr/00000000-0000-0000-0000-000000000000> ;
schema:spatial _:N7bfc9936b099cf9353fc575500000027 ;
schema:temporal [ a time:TemporalEntity ;
time:hasBeginning [ a time:Instant ;
Expand Down Expand Up @@ -1739,9 +1725,6 @@
tern:featureType <https://linked.data.gov.au/dataset/bdr/00000000-0000-0000-0000-000000000000/bdr-cv/featureType/occurrence/kingdom/new-kingdom> ;
tern:locationDescription "Cowaramup Bay Road" .

<https://linked.data.gov.au/dataset/bdr/00000000-0000-0000-0000-000000000000/Survey/1> a tern:Survey ;
schema:isPartOf <https://linked.data.gov.au/dataset/bdr/00000000-0000-0000-0000-000000000000> .

<https://linked.data.gov.au/dataset/bdr/orgs/Stream-Environment-and-Water-Pty-Ltd> a prov:Agent ;
schema:name "Stream Environment and Water Pty Ltd" .

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,6 @@
schema:isPartOf <https://linked.data.gov.au/dataset/bdr/00000000-0000-0000-0000-000000000000> ;
tern:featureType <http://linked.data.gov.au/def/tern-cv/5bf7ae21-a454-440b-bdd7-f2fe982d8de4> .

<https://linked.data.gov.au/dataset/bdr/00000000-0000-0000-0000-000000000000/Survey/1> a tern:Survey ;
schema:isPartOf <https://linked.data.gov.au/dataset/bdr/00000000-0000-0000-0000-000000000000> .

<https://linked.data.gov.au/dataset/bdr/00000000-0000-0000-0000-000000000000/attribution/Gaia-Resources/resourceProvider> a prov:Attribution ;
prov:agent <https://linked.data.gov.au/dataset/bdr/orgs/Gaia-Resources> ;
prov:hadRole <https://linked.data.gov.au/def/data-roles/resourceProvider> .
Expand All @@ -79,8 +76,7 @@
tern:FeatureOfInterest ;
sosa:isSampleOf <https://linked.data.gov.au/dataset/bdr/00000000-0000-0000-0000-000000000000/Site/P1> ;
sosa:usedProcedure <https://linked.data.gov.au/def/nrm/a8db263e-7a39-5b85-a5d2-8e1af7ce1e39> ;
schema:isPartOf <https://linked.data.gov.au/dataset/bdr/00000000-0000-0000-0000-000000000000>,
<https://linked.data.gov.au/dataset/bdr/00000000-0000-0000-0000-000000000000/Survey/1> ;
schema:isPartOf <https://linked.data.gov.au/dataset/bdr/00000000-0000-0000-0000-000000000000> ;
schema:spatial _:Nb0c3d4fa822b88b4d3f8743700000000 ;
schema:temporal [ a time:TemporalEntity ;
time:hasBeginning [ a time:Instant ;
Expand Down
19 changes: 13 additions & 6 deletions abis_mapping/templates/survey_occurrence_data_v3/mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -544,9 +544,12 @@ def apply_mapping_row(

# Create URIs for Survey-related fields (i.e. fields not on the incidental template)

# Create TERN survey IRI from surveyID field
# Create TERN survey IRI from surveyID field, only when it is provided
survey_id: str | None = row["surveyID"]
survey = utils.iri_patterns.survey_iri(base_iri, survey_id)
if survey_id:
survey = utils.iri_patterns.survey_iri(base_iri, survey_id)
else:
survey = None

# Create Tern Site IRI, depending on the siteID field
site_id: str | None = row["siteID"]
Expand Down Expand Up @@ -4244,7 +4247,7 @@ def add_sensitivity_category_collection(

def add_survey(
self,
uri: rdflib.URIRef,
uri: rdflib.URIRef | None,
dataset: rdflib.URIRef,
graph: rdflib.Graph,
) -> None:
Expand All @@ -4257,6 +4260,9 @@ def add_survey(
dataset: The dataset URI
graph: The graph to update
"""
if uri is None:
return

# Add type
graph.add((uri, a, utils.namespaces.TERN.Survey))
# Add dataset link
Expand Down Expand Up @@ -4302,7 +4308,7 @@ def add_occurrence(
other_catalog_numbers_datatype: rdflib.URIRef | None,
catalog_number_datatype: rdflib.URIRef | None,
provider_recorded_by: rdflib.URIRef | None,
survey: rdflib.URIRef,
survey: rdflib.URIRef | None,
site: rdflib.URIRef | None,
site_visit: rdflib.URIRef | None,
dataset: rdflib.URIRef,
Expand Down Expand Up @@ -4457,8 +4463,9 @@ def add_occurrence(
# Add to Graph
graph.add((uri, utils.namespaces.DWC.collectionCode, rdflib.Literal(row["collectionCode"])))

# Add survey
graph.add((uri, rdflib.SDO.isPartOf, survey))
# Add survey, if provided
if survey:
graph.add((uri, rdflib.SDO.isPartOf, survey))

# Add site if provided
if site is not None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,7 @@
{
"name": "surveyID",
"title": "Survey ID",
"description": "The identifier of the Survey that the occurrence comes from. This field should be completed if it is ambiguous as to which survey the occurrence belongs to.",
"description": "The identifier of the Survey that the Occurrence comes from. If this field is left blank, the Occurrence will be treated as incidental.",
"example": "AR220-01",
"type": "string",
"format": "default",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ Changes from Systematic Survey Occurrence Data Template v2.0.0

* When [`surveyID`](#surveyID-field) is provided, it must have a value that matches a `surveyID`
in the Systematic Survey Metadata template to indicate which Survey the Occurrence belongs to.
When [`surveyID`](#surveyID-field) is blank, the Occurrence will be treated as incidental.

## APPENDICES
### APPENDIX-I: Vocabulary List
Expand Down

0 comments on commit 358ee26

Please sign in to comment.