diff --git a/abis_mapping/templates/incidental_occurrence_data_v3/examples/margaret_river_flora/margaret_river_flora.csv b/abis_mapping/templates/incidental_occurrence_data_v3/examples/margaret_river_flora/margaret_river_flora.csv index 21e9f171..dc3a10ac 100644 --- a/abis_mapping/templates/incidental_occurrence_data_v3/examples/margaret_river_flora/margaret_river_flora.csv +++ b/abis_mapping/templates/incidental_occurrence_data_v3/examples/margaret_river_flora/margaret_river_flora.csv @@ -11,7 +11,7 @@ providerRecordID,providerRecordIDSource,locality,decimalLatitude,decimalLongitud 10,WAM,Cowaramup Bay Road,-33.86,115.02,WGS84,,,26/09/2019,,,,Stream Environment and Water Pty Ltd,,,,,,,,,,,,,,,,,,,,,,,Caladenia excelsa,,Stream Environment and Water Pty Ltd,,Caladenia excelsa,,,,Plantae,,,,,,,, 11,WAM,Cowaramup Bay Road,-33.86,115.02,WGS84,,,26/09/2019,,,,Stream Environment and Water Pty Ltd,,,,,,,,,,,,,,,,,,,,,,,Caladenia ?excelsa,,Stream Environment and Water Pty Ltd,,Caladenia excelsa,?,One unopened flower when recorded and one leaf only. ID not confirmed,,Plantae,,,,,,,, 12,WAM,,-33.8,115.21,WGS84,,,26/09/2019,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,Caladenia excelsa,,,,Plantae,,,,,,,, -13,WAM,Cowaramup Bay Road,-33.86,115.02,WGS84,,,26/09/2019,,,PreservedSpecimen,Stream Environment and Water Pty Ltd,,,,,,,,,,,,,,,CC123,WAM,,,,,,,,,Stream Environment and Water Pty Ltd,,Caladenia excelsa,,,,Plantae,,,,,,,, -14,WAM,Cowaramup Bay Road,-33.86,115.02,WGS84,20,Coordinates rounded to the nearest 10 km for conservation concern,26/09/2019,,,HumanObservation,Stream Environment and Water Pty Ltd,,,,,,,5,individuals,,,,,,,CC456,WAM,,,,,,,Caladenia ?excelsa,,Stream Environment and Water Pty Ltd,,Caladenia excelsa,?,Could not confirm the ID due to damaged flower,,Plantae,,,,,,,, +13,WAM,Cowaramup Bay Road,-33.86,115.02,WGS84,,,26/09/2019,,,PreservedSpecimen,Stream Environment and Water Pty Ltd,,,,,,,,,,,,,,C01,CC123,WAM,,,,,,,,,Stream Environment and Water Pty Ltd,,Caladenia excelsa,,,,Plantae,,,,,,,, +14,WAM,Cowaramup Bay Road,-33.86,115.02,WGS84,20,Coordinates rounded to the nearest 10 km for conservation concern,26/09/2019,,,HumanObservation,Stream Environment and Water Pty Ltd,,,,,,,5,individuals,,,,,,C01,CC456,WAM,,,,,,,Caladenia ?excelsa,,Stream Environment and Water Pty Ltd,,Caladenia excelsa,?,Could not confirm the ID due to damaged flower,,Plantae,,,,,,,, 8022FSJMJ079c5cf,WAM,Cowaramup Bay Road,-33.8,115.21,WGS84,50,Coordinates rounded to the nearest 10 km for conservation concern,26/09/2019,,human observation,PreservedSpecimen,Stream Environment and Water Pty Ltd,PE:12:8832,present,"Closed forest of Melaleuca lanceolata. White, grey or brown sand, sandy loam.",native,Dried out leaf tips,2,,,adult,male,No breeding evident,MR-456,Stream Environment and Water Pty Ltd,32237,ARACH,WAM,BHP2012-7521 | M12378,BHP,Wet (in ethanol or some other preservative),26/09/2019,https://www.ncbi.nlm.nih.gov/nuccore/MH040669.1 | https://www.ncbi.nlm.nih.gov/nuccore/MH040616.1,Sanger dideoxy sequencing,Caladenia ?excelsa,2019-09-27T12:34+08:00,Stream Environment and Water Pty Ltd,Visually identified in the field (sighting),Caladenia excelsa,species incerta,no flowers present,Caladenia excelsa Hopper & A.P.Br.,Plantae,species,VU,WA,Check against Threatened and Priority Fauna List WA available from https://www.dpaw.wa.gov.au/plants-and-animals/threatened-species-and-communities/threatened-animals. Last updated 13 June 2022,,WA-BIO,, ABC123,WAM,Cowaramup Bay Road,-33.8,115.21,WGS84,30,Coordinates generalised,26/09/2019,,new sampling protocol,new basis of record,Stream Environment and Water Pty Ltd,PE:12:8833,new occurrence status,new habitat,new establishment means,Leaves brown,6,,,new life stage,new sex,new reproductiveCondition,MR-457,Stream Environment and Water Pty Ltd,32238,ARACH,WAM,BHP2012-7522 | M12379,BHP,new preparations,27/09/2019,https://www.ncbi.nlm.nih.gov/nuccore/MH040669.1 | https://www.ncbi.nlm.nih.gov/nuccore/MH040616.1,new sequencing method,Caladenia ?excelsa,2019-09-27T12:34+08:00,Stream Environment and Water Pty Ltd,new identification method,Caladenia excelsa,new identification qualifier,new remarks,Caladenia excelsa Hopper & A.P.Br.,new kingdom,new taxon rank,new threat status,WA,a random selection,,,Category 1,The Department of Biodiversity and Conservation diff --git a/abis_mapping/templates/incidental_occurrence_data_v3/examples/margaret_river_flora/margaret_river_flora.ttl b/abis_mapping/templates/incidental_occurrence_data_v3/examples/margaret_river_flora/margaret_river_flora.ttl index e9c6a9fb..817c5b25 100644 --- a/abis_mapping/templates/incidental_occurrence_data_v3/examples/margaret_river_flora/margaret_river_flora.ttl +++ b/abis_mapping/templates/incidental_occurrence_data_v3/examples/margaret_river_flora/margaret_river_flora.ttl @@ -15,7 +15,7 @@ a schema:Collection ; void:inDataset ; schema:identifier "Occurrence Collection - Basis Of Record - HumanObservation" ; - schema:member ; + schema:member ; tern:hasAttribute . a schema:Collection ; @@ -573,19 +573,6 @@ sosa:observedProperty ; sosa:usedProcedure . - a tern:Observation ; - void:inDataset ; - rdfs:comment "verbatimID-observation" ; - time:hasTime [ a time:Instant ; - rdfs:comment "Date unknown, template eventDateStart used as proxy" ; - time:inXSDDate "2019-09-26"^^xsd:date ] ; - prov:wasAssociatedWith ; - sosa:hasFeatureOfInterest ; - sosa:hasResult ; - sosa:hasSimpleResult "Caladenia ?excelsa" ; - sosa:observedProperty ; - sosa:usedProcedure . - a tern:Observation ; void:inDataset ; rdfs:comment "verbatimID-observation" ; @@ -649,6 +636,19 @@ sosa:observedProperty ; sosa:usedProcedure . + a tern:Observation ; + void:inDataset ; + rdfs:comment "verbatimID-observation" ; + time:hasTime [ a time:Instant ; + rdfs:comment "Date unknown, template eventDateStart used as proxy" ; + time:inXSDDate "2019-09-26"^^xsd:date ] ; + prov:wasAssociatedWith ; + sosa:hasFeatureOfInterest ; + sosa:hasResult ; + sosa:hasSimpleResult "Caladenia ?excelsa" ; + sosa:observedProperty ; + sosa:usedProcedure . + a tern:Observation ; void:inDataset ; rdfs:comment "verbatimID-observation" ; @@ -1359,10 +1359,13 @@ rdf:value "Caladenia excelsa Hopper & A.P.Br." ; tern:featureType . + a tern:Text, + tern:Value ; + rdf:value "Caladenia ?excelsa" . + a tern:FeatureOfInterest, tern:Sample ; void:inDataset ; - dwc:catalogNumber "CC123"^^ ; rdfs:comment "specimen-sample" ; sosa:isResultOf ; sosa:isSampleOf ; @@ -1403,21 +1406,9 @@ sosa:hasResult ; sosa:usedProcedure . - a tern:Sampling ; - void:inDataset ; - geo:hasGeometry _:Nfc9ba55a50d500211c02e20000000003 ; - geo:hasMetricSpatialAccuracy 2e+01 ; - rdfs:comment "specimen-sampling" ; - time:hasTime [ a time:Instant ; - rdfs:comment "Date unknown, template eventDateStart used as proxy" ; - time:inXSDDate "2019-09-26"^^xsd:date ] ; - sosa:hasFeatureOfInterest ; - sosa:hasResult ; - sosa:usedProcedure . - a tern:Sampling ; void:inDataset ; - geo:hasGeometry _:Nfc9ba55a50d500211c02e20000000005 ; + geo:hasGeometry _:Nfc9ba55a50d500211c02e20000000003 ; geo:hasMetricSpatialAccuracy 5e+01 ; rdfs:comment "specimen-sampling" ; time:hasTime [ a time:Instant ; @@ -1428,7 +1419,7 @@ a tern:Sampling ; void:inDataset ; - geo:hasGeometry _:Nfc9ba55a50d500211c02e20000000007 ; + geo:hasGeometry _:Nfc9ba55a50d500211c02e20000000005 ; geo:hasMetricSpatialAccuracy 3e+01 ; rdfs:comment "specimen-sampling" ; time:hasTime [ a time:Instant ; @@ -1482,28 +1473,10 @@ rdf:value "Boronia anceps" ; tern:featureType . - a tern:Text, - tern:Value ; - rdf:value "Caladenia ?excelsa" . - a tern:Text, tern:Value ; rdf:value "Boronia anceps" . - a tern:Text, - tern:Value ; - rdf:value "Caladenia ?excelsa", - "Caladenia excelsa" . - - a tern:FeatureOfInterest, - tern:Sample ; - void:inDataset ; - dwc:catalogNumber "CC456"^^ ; - rdfs:comment "specimen-sample" ; - sosa:isResultOf ; - sosa:isSampleOf ; - tern:featureType . - a dwc:Occurrence, tern:FeatureOfInterest ; void:inDataset ; @@ -1648,9 +1621,16 @@ tern:Value ; rdf:value "Banksia sessilis var. cordata" . + a tern:Text, + tern:Value ; + rdf:value "Caladenia ?excelsa", + "Caladenia excelsa" . + a dwc:Occurrence, tern:FeatureOfInterest ; void:inDataset ; + dwc:catalogNumber "CC123"^^ ; + dwc:collectionCode "C01" ; prov:wasAssociatedWith ; sosa:usedProcedure ; schema:spatial _:N489292b7f1191795326ddd2200000024 ; @@ -1663,6 +1643,8 @@ a dwc:Occurrence, tern:FeatureOfInterest ; void:inDataset ; + dwc:catalogNumber "CC456"^^ ; + dwc:collectionCode "C01" ; prov:wasAssociatedWith ; sosa:usedProcedure ; schema:spatial _:N489292b7f1191795326ddd2200000027 ; @@ -1675,8 +1657,6 @@ a tern:FeatureOfInterest, tern:Sample ; void:inDataset ; - dwc:catalogNumber "ARACH"^^ ; - dwc:collectionCode "32237" ; rdfs:comment "specimen-sample" ; sosa:isResultOf ; sosa:isSampleOf ; @@ -1685,8 +1665,6 @@ a tern:FeatureOfInterest, tern:Sample ; void:inDataset ; - dwc:catalogNumber "ARACH"^^ ; - dwc:collectionCode "32238" ; rdfs:comment "specimen-sample" ; sosa:isResultOf ; sosa:isSampleOf ; @@ -1703,6 +1681,8 @@ a dwc:Occurrence, tern:FeatureOfInterest ; void:inDataset ; + dwc:catalogNumber "ARACH"^^ ; + dwc:collectionCode "32237" ; prov:wasAssociatedWith ; sosa:usedProcedure ; schema:identifier "BHP2012-7521"^^, @@ -1719,6 +1699,8 @@ a dwc:Occurrence, tern:FeatureOfInterest ; void:inDataset ; + dwc:catalogNumber "ARACH"^^ ; + dwc:collectionCode "32238" ; prov:wasAssociatedWith ; sosa:usedProcedure ; schema:identifier "BHP2012-7522"^^, @@ -1896,18 +1878,10 @@ rdf:subject ; rdfs:comment "supplied as" . -[] a rdf:Statement ; - geo:hasGeometry [ a geo:Geometry ; - geo:asWKT " POINT (-33.86 115.02)"^^geo:wktLiteral ] ; - rdf:object _:Nfc9ba55a50d500211c02e20000000003 ; - rdf:predicate geo:hasGeometry ; - rdf:subject ; - rdfs:comment "supplied as" . - [] a rdf:Statement ; geo:hasGeometry [ a geo:Geometry ; geo:asWKT " POINT (-33.8 115.21)"^^geo:wktLiteral ] ; - rdf:object _:Nfc9ba55a50d500211c02e20000000005 ; + rdf:object _:Nfc9ba55a50d500211c02e20000000003 ; rdf:predicate geo:hasGeometry ; rdf:subject ; rdfs:comment "supplied as" . @@ -1915,7 +1889,7 @@ [] a rdf:Statement ; geo:hasGeometry [ a geo:Geometry ; geo:asWKT " POINT (-33.8 115.21)"^^geo:wktLiteral ] ; - rdf:object _:Nfc9ba55a50d500211c02e20000000007 ; + rdf:object _:Nfc9ba55a50d500211c02e20000000005 ; rdf:predicate geo:hasGeometry ; rdf:subject ; rdfs:comment "supplied as" . @@ -1984,14 +1958,10 @@ _:Nfc9ba55a50d500211c02e20000000001 a geo:Geometry ; rdfs:comment "Location unknown, location of field sampling used as proxy" . _:Nfc9ba55a50d500211c02e20000000003 a geo:Geometry ; - geo:asWKT " POINT (-33.86 115.02)"^^geo:wktLiteral ; - rdfs:comment "Location unknown, location of field sampling used as proxy" . - -_:Nfc9ba55a50d500211c02e20000000005 a geo:Geometry ; geo:asWKT " POINT (-33.8 115.21)"^^geo:wktLiteral ; rdfs:comment "Location unknown, location of field sampling used as proxy" . -_:Nfc9ba55a50d500211c02e20000000007 a geo:Geometry ; +_:Nfc9ba55a50d500211c02e20000000005 a geo:Geometry ; geo:asWKT " POINT (-33.8 115.21)"^^geo:wktLiteral ; rdfs:comment "Location unknown, location of field sampling used as proxy" . diff --git a/abis_mapping/templates/incidental_occurrence_data_v3/mapping.py b/abis_mapping/templates/incidental_occurrence_data_v3/mapping.py index a7a8fdf1..c09227e1 100644 --- a/abis_mapping/templates/incidental_occurrence_data_v3/mapping.py +++ b/abis_mapping/templates/incidental_occurrence_data_v3/mapping.py @@ -575,7 +575,6 @@ def apply_mapping_row( dataset=dataset, sampling_specimen=sampling_specimen, provider_record_id_occurrence=provider_record_id_occurrence, - catalog_number_datatype=catalog_number_datatype, graph=graph, base_iri=base_iri, ) @@ -1149,6 +1148,7 @@ def apply_mapping_row( record_number_datatype=record_number_datatype, owner_record_id_datatype=owner_record_id_datatype, other_catalog_numbers_datatype=other_catalog_numbers_datatype, + catalog_number_datatype=catalog_number_datatype, provider_recorded_by=provider_recorded_by, dataset=dataset, row=row, @@ -1895,7 +1895,6 @@ def add_sample_specimen( dataset: rdflib.URIRef, sampling_specimen: rdflib.URIRef, provider_record_id_occurrence: rdflib.URIRef, - catalog_number_datatype: rdflib.URIRef | None, graph: rdflib.Graph, base_iri: rdflib.Namespace | None, ) -> None: @@ -1909,8 +1908,6 @@ def add_sample_specimen( with this node provider_record_id_occurrence (rdflib.URIRef): Occurrence associated with this node - catalog_number_datatype (rdflib.URIRef): Catalog number source - datatype. graph (rdflib.Graph): Graph to add to base_iri (rdflib.Namespace | None): Namespace used to construct IRIs) """ @@ -1933,22 +1930,6 @@ def add_sample_specimen( graph.add((uri, rdflib.SOSA.isSampleOf, provider_record_id_occurrence)) graph.add((uri, utils.namespaces.TERN.featureType, term)) - # Check for catalogNumber - if row["catalogNumber"]: - # Add to Graph - graph.add( - ( - uri, - utils.namespaces.DWC.catalogNumber, - rdflib.Literal(row["catalogNumber"], datatype=catalog_number_datatype), - ) - ) - - # Check for collectionCode - if row["collectionCode"]: - # Add to Graph - graph.add((uri, utils.namespaces.DWC.collectionCode, rdflib.Literal(row["collectionCode"]))) - def add_data_generalizations_attribute( self, uri: rdflib.URIRef | None, @@ -3795,6 +3776,7 @@ def add_occurrence( record_number_datatype: rdflib.URIRef | None, owner_record_id_datatype: rdflib.URIRef | None, other_catalog_numbers_datatype: rdflib.URIRef | None, + catalog_number_datatype: rdflib.URIRef | None, provider_recorded_by: rdflib.URIRef | None, dataset: rdflib.URIRef, row: frictionless.Row, @@ -3808,6 +3790,7 @@ def add_occurrence( record_number_datatype: Datatype associated with the recordNumber. owner_record_id_datatype: Datatype associated with the owner recordID. other_catalog_numbers_datatype: Datatype associated with other catalog numbers. + catalog_number_datatype: Catalog number source datatype. provider_recorded_by: Agent derived from the recordedBy field. dataset: The uri for the dateset node. row: Raw data from the row. @@ -3897,6 +3880,22 @@ def add_occurrence( if provider_recorded_by is not None: graph.add((uri, rdflib.PROV.wasAssociatedWith, provider_recorded_by)) + # Check for catalogNumber + if row["catalogNumber"]: + # Add to Graph + graph.add( + ( + uri, + utils.namespaces.DWC.catalogNumber, + rdflib.Literal(row["catalogNumber"], datatype=catalog_number_datatype), + ) + ) + + # Check for collectionCode + if row["collectionCode"]: + # Add to Graph + graph.add((uri, utils.namespaces.DWC.collectionCode, rdflib.Literal(row["collectionCode"]))) + # Helper Functions # These utility helper functions are specific to this template, and as such are @@ -3914,8 +3913,8 @@ def has_specimen(row: frictionless.Row) -> bool: bool: Whether this row has a specimen associated with it. """ # Check Specimen Rules - if row["preparations"] or row["catalogNumber"] or row["associatedSequences"]: - # If any of `preparations`, `catalogNumber` or `associatedSequences` + if row["preparations"] or row["associatedSequences"]: + # If either of `preparations` or `associatedSequences` # are provided, regardless of the value of `basisOfRecord` we can infer # that there is a specimen associated with the row. specimen = True @@ -3925,14 +3924,14 @@ def has_specimen(row: frictionless.Row) -> bool: or vocabs.basis_of_record.HUMAN_OBSERVATION.match(row["basisOfRecord"]) # HumanObservation or vocabs.basis_of_record.OCCURRENCE.match(row["basisOfRecord"]) # Occurrence ): - # Otherwise, if none of `preparations`, `catalogNumber` or + # Otherwise, if neither of `preparations` or # `associatedSequences` were provided, and the `basisOfRecord` is # either blank or one of "HumanObservation" or "Occurrence", then we # cannot infer that there is a specimen associated with the row. specimen = False else: - # Finally, none of `preparations`, `catalogNumber` or + # Finally, neither of `preparations` or # `associatedSequences` were provided, but the `basisOfRecord` is a # value that implies that there is a specimen associated with the row. specimen = True diff --git a/abis_mapping/templates/survey_occurrence_data_v2/examples/margaret_river_flora/margaret_river_flora.csv b/abis_mapping/templates/survey_occurrence_data_v2/examples/margaret_river_flora/margaret_river_flora.csv index fcabeeb4..ea565c76 100644 --- a/abis_mapping/templates/survey_occurrence_data_v2/examples/margaret_river_flora/margaret_river_flora.csv +++ b/abis_mapping/templates/survey_occurrence_data_v2/examples/margaret_river_flora/margaret_river_flora.csv @@ -11,7 +11,7 @@ providerRecordID,providerRecordIDSource,locality,decimalLatitude,decimalLongitud 10,WAM,Cowaramup Bay Road,-33.86,115.02,WGS84,,,26/09/2019,,,,Stream Environment and Water Pty Ltd,,,,,,,,,,,,,,,,,,,,,,,Caladenia excelsa,,Stream Environment and Water Pty Ltd,,Caladenia excelsa,,,,Plantae,,,,,,,,,,, 11,WAM,Cowaramup Bay Road,-33.86,115.02,WGS84,,,26/09/2019,,,,Stream Environment and Water Pty Ltd,,,,,,,,,,,,,,,,,,,,,,,Caladenia ?excelsa,,Stream Environment and Water Pty Ltd,,Caladenia excelsa,?,One unopened flower when recorded and one leaf only. ID not confirmed,,Plantae,,,,,,,,,,, 12,WAM,,-33.8,115.21,WGS84,,,26/09/2019,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,Caladenia excelsa,,,,Plantae,,,,,,,,,,, -13,WAM,Cowaramup Bay Road,-33.86,115.02,WGS84,,,26/09/2019,,,PreservedSpecimen,Stream Environment and Water Pty Ltd,,,,,,,,,,,,,,,CC123,WAM,,,,,,,,,Stream Environment and Water Pty Ltd,,Caladenia excelsa,,,,Plantae,,,,,,,,,,, -14,WAM,Cowaramup Bay Road,-33.86,115.02,WGS84,20,Coordinates rounded to the nearest 10 km for conservation concern,26/09/2019,,,HumanObservation,Stream Environment and Water Pty Ltd,,,,,,,,,,,,,,,CC456,WAM,,,,,,,Caladenia ?excelsa,,Stream Environment and Water Pty Ltd,,Caladenia excelsa,?,Could not confirm the ID due to damaged flower,,Plantae,,,,,,,,,,, +13,WAM,Cowaramup Bay Road,-33.86,115.02,WGS84,,,26/09/2019,,,PreservedSpecimen,Stream Environment and Water Pty Ltd,,,,,,,,,,,,,,C01,CC123,WAM,,,,,,,,,Stream Environment and Water Pty Ltd,,Caladenia excelsa,,,,Plantae,,,,,,,,,,, +14,WAM,Cowaramup Bay Road,-33.86,115.02,WGS84,20,Coordinates rounded to the nearest 10 km for conservation concern,26/09/2019,,,HumanObservation,Stream Environment and Water Pty Ltd,,,,,,,,,,,,,,C01,CC456,WAM,,,,,,,Caladenia ?excelsa,,Stream Environment and Water Pty Ltd,,Caladenia excelsa,?,Could not confirm the ID due to damaged flower,,Plantae,,,,,,,,,,, 8022FSJMJ079c5cf,WAM,Cowaramup Bay Road,-33.8,115.21,WGS84,50,Coordinates rounded to the nearest 10 km for conservation concern,26/09/2019,,human observation,PreservedSpecimen,Stream Environment and Water Pty Ltd,PE:12:8832,present,"Closed forest of Melaleuca lanceolata. White, grey or brown sand, sandy loam.",native,Dried out leaf tips,2,,,adult,male,No breeding evident,MR-456,Stream Environment and Water Pty Ltd,32237,ARACH,WAM,BHP2012-7521 | M12378,BHP,Wet (in ethanol or some other preservative),26/09/2019,https://www.ncbi.nlm.nih.gov/nuccore/MH040669.1 | https://www.ncbi.nlm.nih.gov/nuccore/MH040616.1,Sanger dideoxy sequencing,Caladenia ?excelsa,2019-09-27T12:34+08:00,Stream Environment and Water Pty Ltd,Visually identified in the field (sighting),Caladenia excelsa,species incerta,no flowers present,Caladenia excelsa Hopper & A.P.Br.,Plantae,species,VU,WA,Check against Threatened and Priority Fauna List WA available from https://www.dpaw.wa.gov.au/plants-and-animals/threatened-species-and-communities/threatened-animals. Last updated 13 June 2022,,WA-BIO,Category 1,Department of Biodiversity and Conservation,MR-R1,MR-S1,MR-R1-V1 ABC123,WAM,Cowaramup Bay Road,-33.8,115.21,WGS84,30,Coordinates generalised,26/09/2019,,new sampling protocol,new basis of record,Stream Environment and Water Pty Ltd,PE:12:8833,new occurrence status,new habitat,new establishment means,Leaves brown,6,,,new life stage,new sex,new reproductiveCondition,MR-457,Stream Environment and Water Pty Ltd,32238,ARACH,WAM,BHP2012-7522 | M12379,BHP,new preparations,27/09/2019,https://www.ncbi.nlm.nih.gov/nuccore/MH040669.1 | https://www.ncbi.nlm.nih.gov/nuccore/MH040616.1,new sequencing method,Caladenia ?excelsa,2019-09-27T12:34+08:00,Stream Environment and Water Pty Ltd,new identification method,Caladenia excelsa,new identification qualifier,new remarks,Caladenia excelsa Hopper & A.P.Br.,new kingdom,new taxon rank,new threat status,WA,a random selection,,,Category 1,Department of Biodiversity and Conservation,MR-R1,MR-S1, diff --git a/abis_mapping/templates/survey_occurrence_data_v2/examples/margaret_river_flora/margaret_river_flora.ttl b/abis_mapping/templates/survey_occurrence_data_v2/examples/margaret_river_flora/margaret_river_flora.ttl index 02e2a7e2..31e5103e 100644 --- a/abis_mapping/templates/survey_occurrence_data_v2/examples/margaret_river_flora/margaret_river_flora.ttl +++ b/abis_mapping/templates/survey_occurrence_data_v2/examples/margaret_river_flora/margaret_river_flora.ttl @@ -15,7 +15,7 @@ a schema:Collection ; void:inDataset ; schema:identifier "Occurrence Collection - Basis Of Record - HumanObservation" ; - schema:member ; + schema:member ; tern:hasAttribute . a schema:Collection ; @@ -557,19 +557,6 @@ sosa:observedProperty ; sosa:usedProcedure . - a tern:Observation ; - void:inDataset ; - rdfs:comment "verbatimID-observation" ; - time:hasTime [ a time:Instant ; - rdfs:comment "Date unknown, template eventDateStart used as proxy" ; - time:inXSDDate "2019-09-26"^^xsd:date ] ; - prov:wasAssociatedWith ; - sosa:hasFeatureOfInterest ; - sosa:hasResult ; - sosa:hasSimpleResult "Caladenia ?excelsa" ; - sosa:observedProperty ; - sosa:usedProcedure . - a tern:Observation ; void:inDataset ; rdfs:comment "verbatimID-observation" ; @@ -633,6 +620,19 @@ sosa:observedProperty ; sosa:usedProcedure . + a tern:Observation ; + void:inDataset ; + rdfs:comment "verbatimID-observation" ; + time:hasTime [ a time:Instant ; + rdfs:comment "Date unknown, template eventDateStart used as proxy" ; + time:inXSDDate "2019-09-26"^^xsd:date ] ; + prov:wasAssociatedWith ; + sosa:hasFeatureOfInterest ; + sosa:hasResult ; + sosa:hasSimpleResult "Caladenia ?excelsa" ; + sosa:observedProperty ; + sosa:usedProcedure . + a tern:Observation ; void:inDataset ; rdfs:comment "verbatimID-observation" ; @@ -1352,10 +1352,13 @@ rdf:value "Caladenia excelsa Hopper & A.P.Br." ; tern:featureType . + a tern:Text, + tern:Value ; + rdf:value "Caladenia ?excelsa" . + a tern:FeatureOfInterest, tern:Sample ; void:inDataset ; - dwc:catalogNumber "CC123"^^ ; rdfs:comment "specimen-sample" ; sosa:isResultOf ; sosa:isSampleOf ; @@ -1396,21 +1399,9 @@ sosa:hasResult ; sosa:usedProcedure . - a tern:Sampling ; - void:inDataset ; - geo:hasGeometry _:N2021abae78e1a33ea09b88e700000003 ; - geo:hasMetricSpatialAccuracy 2e+01 ; - rdfs:comment "specimen-sampling" ; - time:hasTime [ a time:Instant ; - rdfs:comment "Date unknown, template eventDateStart used as proxy" ; - time:inXSDDate "2019-09-26"^^xsd:date ] ; - sosa:hasFeatureOfInterest ; - sosa:hasResult ; - sosa:usedProcedure . - a tern:Sampling ; void:inDataset ; - geo:hasGeometry _:N2021abae78e1a33ea09b88e700000005 ; + geo:hasGeometry _:N2021abae78e1a33ea09b88e700000003 ; geo:hasMetricSpatialAccuracy 5e+01 ; rdfs:comment "specimen-sampling" ; time:hasTime [ a time:Instant ; @@ -1421,7 +1412,7 @@ a tern:Sampling ; void:inDataset ; - geo:hasGeometry _:N2021abae78e1a33ea09b88e700000007 ; + geo:hasGeometry _:N2021abae78e1a33ea09b88e700000005 ; geo:hasMetricSpatialAccuracy 3e+01 ; rdfs:comment "specimen-sampling" ; time:hasTime [ a time:Instant ; @@ -1476,28 +1467,10 @@ rdf:value "Boronia anceps" ; tern:featureType . - a tern:Text, - tern:Value ; - rdf:value "Caladenia ?excelsa" . - a tern:Text, tern:Value ; rdf:value "Boronia anceps" . - a tern:Text, - tern:Value ; - rdf:value "Caladenia ?excelsa", - "Caladenia excelsa" . - - a tern:FeatureOfInterest, - tern:Sample ; - void:inDataset ; - dwc:catalogNumber "CC456"^^ ; - rdfs:comment "specimen-sample" ; - sosa:isResultOf ; - sosa:isSampleOf ; - tern:featureType . - a dwc:Occurrence, tern:FeatureOfInterest ; void:inDataset ; @@ -1653,9 +1626,16 @@ tern:Value ; rdf:value "Banksia sessilis var. cordata" . + a tern:Text, + tern:Value ; + rdf:value "Caladenia ?excelsa", + "Caladenia excelsa" . + a dwc:Occurrence, tern:FeatureOfInterest ; void:inDataset ; + dwc:catalogNumber "CC123"^^ ; + dwc:collectionCode "C01" ; prov:wasAssociatedWith ; sosa:usedProcedure ; schema:isPartOf ; @@ -1669,6 +1649,8 @@ a dwc:Occurrence, tern:FeatureOfInterest ; void:inDataset ; + dwc:catalogNumber "CC456"^^ ; + dwc:collectionCode "C01" ; prov:wasAssociatedWith ; sosa:usedProcedure ; schema:isPartOf ; @@ -1682,8 +1664,6 @@ a tern:FeatureOfInterest, tern:Sample ; void:inDataset ; - dwc:catalogNumber "ARACH"^^ ; - dwc:collectionCode "32237" ; rdfs:comment "specimen-sample" ; sosa:isResultOf ; sosa:isSampleOf ; @@ -1692,8 +1672,6 @@ a tern:FeatureOfInterest, tern:Sample ; void:inDataset ; - dwc:catalogNumber "ARACH"^^ ; - dwc:collectionCode "32238" ; rdfs:comment "specimen-sample" ; sosa:isResultOf ; sosa:isSampleOf ; @@ -1710,6 +1688,8 @@ a dwc:Occurrence, tern:FeatureOfInterest ; void:inDataset ; + dwc:catalogNumber "ARACH"^^ ; + dwc:collectionCode "32237" ; prov:wasAssociatedWith ; sosa:isSampleOf ; sosa:usedProcedure ; @@ -1729,6 +1709,8 @@ a dwc:Occurrence, tern:FeatureOfInterest ; void:inDataset ; + dwc:catalogNumber "ARACH"^^ ; + dwc:collectionCode "32238" ; prov:wasAssociatedWith ; sosa:isSampleOf ; sosa:usedProcedure ; @@ -1895,18 +1877,10 @@ rdf:subject ; rdfs:comment "supplied as" . -[] a rdf:Statement ; - geo:hasGeometry [ a geo:Geometry ; - geo:asWKT " POINT (-33.86 115.02)"^^geo:wktLiteral ] ; - rdf:object _:N2021abae78e1a33ea09b88e700000003 ; - rdf:predicate geo:hasGeometry ; - rdf:subject ; - rdfs:comment "supplied as" . - [] a rdf:Statement ; geo:hasGeometry [ a geo:Geometry ; geo:asWKT " POINT (-33.8 115.21)"^^geo:wktLiteral ] ; - rdf:object _:N2021abae78e1a33ea09b88e700000005 ; + rdf:object _:N2021abae78e1a33ea09b88e700000003 ; rdf:predicate geo:hasGeometry ; rdf:subject ; rdfs:comment "supplied as" . @@ -1914,7 +1888,7 @@ [] a rdf:Statement ; geo:hasGeometry [ a geo:Geometry ; geo:asWKT " POINT (-33.8 115.21)"^^geo:wktLiteral ] ; - rdf:object _:N2021abae78e1a33ea09b88e700000007 ; + rdf:object _:N2021abae78e1a33ea09b88e700000005 ; rdf:predicate geo:hasGeometry ; rdf:subject ; rdfs:comment "supplied as" . @@ -1991,14 +1965,10 @@ _:N2021abae78e1a33ea09b88e700000001 a geo:Geometry ; rdfs:comment "Location unknown, location of field sampling used as proxy" . _:N2021abae78e1a33ea09b88e700000003 a geo:Geometry ; - geo:asWKT " POINT (-33.86 115.02)"^^geo:wktLiteral ; - rdfs:comment "Location unknown, location of field sampling used as proxy" . - -_:N2021abae78e1a33ea09b88e700000005 a geo:Geometry ; geo:asWKT " POINT (-33.8 115.21)"^^geo:wktLiteral ; rdfs:comment "Location unknown, location of field sampling used as proxy" . -_:N2021abae78e1a33ea09b88e700000007 a geo:Geometry ; +_:N2021abae78e1a33ea09b88e700000005 a geo:Geometry ; geo:asWKT " POINT (-33.8 115.21)"^^geo:wktLiteral ; rdfs:comment "Location unknown, location of field sampling used as proxy" . diff --git a/abis_mapping/templates/survey_occurrence_data_v2/mapping.py b/abis_mapping/templates/survey_occurrence_data_v2/mapping.py index d49e76cb..db98ac02 100644 --- a/abis_mapping/templates/survey_occurrence_data_v2/mapping.py +++ b/abis_mapping/templates/survey_occurrence_data_v2/mapping.py @@ -735,7 +735,6 @@ def apply_mapping_row( dataset=dataset, sampling_specimen=sampling_specimen, provider_record_id_occurrence=provider_record_id_occurrence, - catalog_number_datatype=catalog_number_datatype, graph=graph, base_iri=base_iri, ) @@ -1339,6 +1338,7 @@ def apply_mapping_row( record_number_datatype=record_number_datatype, owner_record_id_datatype=owner_record_id_datatype, other_catalog_numbers_datatype=other_catalog_numbers_datatype, + catalog_number_datatype=catalog_number_datatype, provider_recorded_by=provider_recorded_by, survey=survey, site=site, @@ -2256,7 +2256,6 @@ def add_sample_specimen( dataset: rdflib.URIRef, sampling_specimen: rdflib.URIRef, provider_record_id_occurrence: rdflib.URIRef, - catalog_number_datatype: rdflib.URIRef | None, graph: rdflib.Graph, base_iri: rdflib.Namespace | None, ) -> None: @@ -2270,8 +2269,6 @@ def add_sample_specimen( with this node provider_record_id_occurrence (rdflib.URIRef): Occurrence associated with this node - catalog_number_datatype (rdflib.URIRef | None): Catalog number source - datatype. graph (rdflib.Graph): Graph to add to base_iri (rdflib.Namespace | None): Namespace used to construct IRIs """ @@ -2294,22 +2291,6 @@ def add_sample_specimen( graph.add((uri, rdflib.SOSA.isSampleOf, provider_record_id_occurrence)) graph.add((uri, utils.namespaces.TERN.featureType, term)) - # Check for catalogNumber - if row["catalogNumber"]: - # Add to Graph - graph.add( - ( - uri, - utils.namespaces.DWC.catalogNumber, - rdflib.Literal(row["catalogNumber"], datatype=catalog_number_datatype), - ) - ) - - # Check for collectionCode - if row["collectionCode"]: - # Add to Graph - graph.add((uri, utils.namespaces.DWC.collectionCode, rdflib.Literal(row["collectionCode"]))) - def add_data_generalizations_attribute( self, uri: rdflib.URIRef | None, @@ -4428,6 +4409,7 @@ def add_occurrence( record_number_datatype: rdflib.URIRef | None, owner_record_id_datatype: rdflib.URIRef | None, other_catalog_numbers_datatype: rdflib.URIRef | None, + catalog_number_datatype: rdflib.URIRef | None, provider_recorded_by: rdflib.URIRef | None, survey: rdflib.URIRef, site: rdflib.URIRef | None, @@ -4445,6 +4427,7 @@ def add_occurrence( record_number_datatype: Datatype associated with the recordNumber. owner_record_id_datatype: Datatype associated with the owner recordID. other_catalog_numbers_datatype: Datatype associated with other catalog numbers. + catalog_number_datatype: Catalog number source datatype. provider_recorded_by: Agent derived from the recordedBy field. survey: Survey that the occurrence took place. site: Designated site that occurrence happened. @@ -4567,6 +4550,22 @@ def add_occurrence( if provider_recorded_by is not None: graph.add((uri, rdflib.PROV.wasAssociatedWith, provider_recorded_by)) + # Check for catalogNumber + if row["catalogNumber"]: + # Add to Graph + graph.add( + ( + uri, + utils.namespaces.DWC.catalogNumber, + rdflib.Literal(row["catalogNumber"], datatype=catalog_number_datatype), + ) + ) + + # Check for collectionCode + if row["collectionCode"]: + # Add to Graph + graph.add((uri, utils.namespaces.DWC.collectionCode, rdflib.Literal(row["collectionCode"]))) + # Add survey graph.add((uri, rdflib.SDO.isPartOf, survey)) @@ -4620,8 +4619,8 @@ def has_specimen(row: frictionless.Row) -> bool: bool: Whether this row has a specimen associated with it. """ # Check Specimen Rules - if row["preparations"] or row["catalogNumber"] or row["associatedSequences"]: - # If any of `preparations`, `catalogNumber` or `associatedSequences` + if row["preparations"] or row["associatedSequences"]: + # If either of `preparations` or `associatedSequences` # are provided, regardless of the value of `basisOfRecord` we can infer # that there is a specimen associated with the row. specimen = True @@ -4631,14 +4630,14 @@ def has_specimen(row: frictionless.Row) -> bool: or vocabs.basis_of_record.HUMAN_OBSERVATION.match(row["basisOfRecord"]) # HumanObservation or vocabs.basis_of_record.OCCURRENCE.match(row["basisOfRecord"]) # Occurrence ): - # Otherwise, if none of `preparations`, `catalogNumber` or + # Otherwise, if neither of `preparations` or # `associatedSequences` were provided, and the `basisOfRecord` is # either blank or one of "HumanObservation" or "Occurrence", then we # cannot infer that there is a specimen associated with the row. specimen = False else: - # Finally, none of `preparations`, `catalogNumber` or + # Finally, neither of `preparations` or # `associatedSequences` were provided, but the `basisOfRecord` is a # value that implies that there is a specimen associated with the row. specimen = True