Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,8 @@ nosetests.xml
psmv-data.duckdb
*.jar
shacl-documentaion-log.txt
rdf/data/
rdf/processed/*
!rdf/processed/graph.ttl
rdf/data/**
rdf/processed/**
!rdf/processed/shapes.ttl

# =============================================================================
Expand All @@ -100,6 +99,13 @@ rdf/processed/*
tests/*
!tests/test_connection.py

# =============================================================================
# Specific RDF files
# =============================================================================

# SHACL valication report
rdf/processed/shacl-report.ttl

# =============================================================================
# Notes
# =============================================================================
Expand Down
28 changes: 16 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,16 @@ A Python module for converting Swiss plant protection product data from CSV form
python -m service.pipeline
```

4. Upload graph
4. To upload the graph, first, place a `.env` file in the directory root:

``` bash
LINDAS_USER=lindas-foag-plant-protection
LINDAS_PASSWORD=************
ENDPOINT=https://graphdb.lindas.admin.ch/repositories/lindas/rdf-graphs/service
GRAPH=https://lindas.admin.ch/fsvo/plant-protection-products
```

Then trigger the upload to LINDAS:

``` bash
python -m service.upload_graph
Expand All @@ -46,14 +55,14 @@ A Python module for converting Swiss plant protection product data from CSV form
``` bash
psmv-rdf/
├── .github/
├── data/ # any non-RDF data files
├── README.md
├── data/ # any non-RDF data files, used as input data
│ ├── raw/ # input CSV files
│ ├── mapping/ # yaml mapping files
│ └── processed/ # intermediately generated CSV files
│ └── mapping/ # yaml mapping files
├── services/
│ └── pipeline.py
├── src/
│ ├── sparql # SPARQL inference rules
│ ├── sparql # SPARQL queries and inference rules
│ └── python/ # Python scripts for specific tasks
├── rdf/
│ ├── ontology/ # OWL ontology documentation
Expand All @@ -64,21 +73,16 @@ psmv-rdf/
├── tests/
├── docs/ # project documentation
├── .gitignore
├── README.md
└── environment.yml
```

## Ontology documentation
## Documentation

All ontology documentation files are written to `rdf/ontology`.
You may inspect a visual representation of the ontology used here: <https://service.tib.eu/webvowl/#iri=https://raw.githubusercontent.com/BLV-OSAV-USAV/PSMV-RDF/refs/heads/main/rdf/ontology/core.ttl>

## Data model
[You may inspect a visual representation of the ontology used here.](https://service.tib.eu/webvowl/#iri=https://raw.githubusercontent.com/BLV-OSAV-USAV/PSMV-RDF/refs/heads/main/rdf/ontology/core.ttl)

A more restricted data model is written in SHACL and [can be inspected here](https://blv-osav-usav.github.io/PSMV-RDF/shacl-documentation.html).

## Dependencies

Project dependencies are listed in [pyproject.toml](pyproject.toml).

## Acknowledgments
Expand Down
23 changes: 22 additions & 1 deletion data/mapping/mapping_columns.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,25 @@ ApplicationArea:
ApplicationComment:
NK_ApplicationComment: application_comment
NK_Codetable: application_comment_id
NK_Indication: indication
NK_Indication: indication

ProductCodeR:
NK_Codetable: code_id
NK_PROD_REF: product_id

ProductCodeS:
NK_codetable: code_id
NK_PROD_REF: product_id

ProductDangerSymbol:
NK_Codetable: code_id
NK_PROD_REF: product_id

ProductSignalWords:
NK_Codetable: code_id
NK_SignalWord: signal_word_id
NK_PROD_REF: product_id

ProductProductCategory:
NK_Codetable: code_id
NK_Product: product_id
26 changes: 25 additions & 1 deletion data/mapping/mapping_datasets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,28 @@ datasets:
delimiter: ","
encoding: "utf-8"
description: "PSMV Export ProductIngredient Jan 2026"

ProductCodeR:
input: "data/raw/ProductCodeR.csv"
delimiter: ","
encoding: "utf-8"
description: "PSMV Export Hazard Statements (R-Codes)"
ProductCodeS:
input: "data/raw/ProductCodeS.csv"
delimiter: ","
encoding: "utf-8"
description: "PSMV Export Precautionary Statements (S-Codes)"
ProductDangerSymbol:
input: "data/raw/ProductDangerSymbol.csv"
delimiter: ","
encoding: "utf-8"
description: "PSMV Export Hazard Pictograms"
ProductSignalWords:
input: "data/raw/ProductSignalWords.csv"
delimiter: ","
encoding: "utf-8"
description: "PSMV Export Signal Words"
ProductProductCategory:
input: "data/raw/ProductProductCategory.csv"
delimiter: ","
encoding: "utf-8"
description: "PSMV Export Product Categories"
31 changes: 30 additions & 1 deletion data/mapping/mapping_rdf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,33 @@ type_mapping:

unit_mapping:
gram_per_litre: http://qudt.org/vocab/unit/GM-PER-L
percent: http://qudt.org/vocab/unit/PERCENT
percent: http://qudt.org/vocab/unit/PERCENT

category_mapping:
"81E2110B-C061-4BA7-A863-25C06F2F5466": "PGR"
"6A901B41-29FE-4651-9DD0-239A3FA87233": "STP"
"43AA825A-6DFE-4E32-9AF2-D3A53D740E3A": "BIA"
"C9FE4A13-A36D-4464-BF1F-65DCB3462CE0": "PHE"
"C975EC0B-DD20-445A-B414-2B84BBC3C75E": "BNA"
"29B69EF4-AA1D-47E2-95F4-5B64F99A46C4": "CPP"
"7C5F5EF9-3DAE-4522-9895-B8F000F202D3": "SPP"
"5F9CE86B-112F-4B58-99E1-01545BB3D659": "INS"
"3CAD9105-7B40-43F0-8667-CF170D481F6B": "Product"
"97881D31-B47A-4148-814D-FF426F9B0E73": "BMA"
"8425418F-24DF-4E5B-AE89-C310FD7B1591": "ROD"
"E0A41A6B-AE4E-46BD-B51A-631BE77F00A9": "PDI"
"DEAB7EE2-995A-47D5-B8C0-5BA5413C7418": "NEM"
"393B3D65-22C0-4AD1-8AC1-7E9F7C81E529": "MOL"
"39F5B5A5-90D7-4D6B-A651-0A076C70A86C": "WAA"
"0D385AAD-C89F-4B13-8D9F-90E89397AA3A": "ABA"
"1416E266-2447-4520-8A91-CF77F38F924A": "IVA"
"47583D3A-E05F-4212-BE3B-C4E3788ECEE1": "CPP"
"5C94FFB7-603E-44FF-8AA9-AC0F1F7A857D": "VIR"
"0BD36B1F-4A27-4A8B-A2FF-6CC265521C15": "DIS"
"8A9EBFE1-E262-4EE9-A49F-763381986F6A": "BBA"
"F60B64E7-8599-4D47-A381-1C71751C3F60": "SPP"
"ADD523C1-A5BC-4C09-A98E-7106F0AC04F1": "BAC"
"70C26F0A-B219-4EAF-BC58-229AEFE6AC81": "HER"
"51DCB40B-FA9C-4DE5-84F1-96635758AB05": "ACA"
"056DADD1-35C6-49CA-B583-41CE5849C105": "FUN"
"CAC7C436-99CE-4214-81E4-48C227B810E8": "FBA"
4 changes: 2 additions & 2 deletions rdf/example/example.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ product:W-6761 a :Fungicide ;
:federalAdmissionNumber "W-6761" ;
:ingredient [
:substance substance:1 ;
schema:value [
:share [
schema:value 14.85 ;
schema:unitCode unit:PERCENT
], [
Expand All @@ -31,7 +31,7 @@ product:W-6761 a :Fungicide ;
] ,
[
:substance substance:2 ;
schema:value [
:share [
schema:value 7.43 ;
schema:unitCode unit:PERCENT
], [
Expand Down
148 changes: 9 additions & 139 deletions rdf/ontology/core.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -220,144 +220,6 @@ schema:PostalAddress a owl:Class ;
rdfs:domain :Product ;
rdfs:range xsd:date .

# Product taxonomy -------------------------------------------------------------

:BiologicalControlAgent a owl:Class ;
rdfs:subClassOf :Product ;
schema:name "Biological control agent"@en ;
schema:description "A living organism or a product derived from it used to combat plant pests or pathogens. These include beneficial insects, mites, nematodes, fungi, bacteria, or viruses."@en .

:ChemicalProtectionProduct a owl:Class ;
rdfs:subClassOf :Product ;
schema:name "Chemical Protection Product"@en ;
schema:description "Any crop protection product that can be reasonably well described by its chemical ingredients/synthesis rather than biological origin."@en .

# Biological Control Agents-----------------------------------------------------

:AntifungalBiologicalAgent a owl:Class ;
rdfs:subClassOf :BiologicalControlAgent ;
schema:name "Antifungal biological agent"@en ;
schema:description "Biological control agents used to protect plants from harmful fungi, based on natural organisms or their byproducts."@en .

:BacterialBiologicalAgent a owl:Class ;
rdfs:subClassOf :BiologicalControlAgent ;
schema:name "Bacterial biological agent"@en ;
schema:description "Biological control agents composed of or derived from bacteria, combating pests or diseases through mechanisms such as competition or antimicrobial production."@en .

:FungalBiologicalAgent a owl:Class ;
rdfs:subClassOf :BiologicalControlAgent ;
schema:name "Fungal Biological Agent"@en ;
schema:description "Biological control agents composed of or derived from fungi, combating pests, diseases, or weeds through mechanisms such as antagonism or parasitism."@en .

:InsectVirusAgent a owl:Class ;
rdfs:subClassOf :BiologicalControlAgent ;
schema:name "Insect Virus Agent"@en ;
schema:description "Biological control agents containing viruses that specifically target and harm insect pests."@en .

:BeneficialInsectAgent a owl:Class ;
rdfs:subClassOf :BiologicalControlAgent ;
schema:name "Beneficial Insect Agent"@en ;
schema:description "Biological control agents consisting of live or derived insect species used to combat other pests."@en .

:BeneficialMiteAgent a owl:Class ;
rdfs:subClassOf :BiologicalControlAgent ;
schema:name "Beneficial Mite Agent"@en ;
schema:description "Biological control agents containing beneficial mite species used to control harmful insects or other mites."@en .

:BeneficialNematodeAgent a owl:Class ;
rdfs:subClassOf :BiologicalControlAgent ;
schema:name "Beneficial Nematode Agent"@en ;
schema:description "Biological control agents containing live nematodes that specifically target harmful insects in soil or plants."@en .

# Chemical Products ------------------------------------------------------------

:Acaricide a owl:Class ;
rdfs:subClassOf :ChemicalProtectionProduct ;
schema:name "Acaricide"@en ;
schema:description "A chemical crop protection product used to control mites and ticks."@en .

:WettingAndAdhesionAgent a owl:Class ;
rdfs:subClassOf :ChemicalProtectionProduct ;
schema:name "Wetting and Adhesion Agent"@en ;
schema:description "Chemical products used to distribute crop protection products evenly on plant surfaces and enhance their adhesion/efficacy."@en .

:Bactericide a owl:Class ;
rdfs:subClassOf :ChemicalProtectionProduct ;
schema:name "Bactericide"@en ;
schema:description "A chemical product used to combat bacterial pathogens that harm agricultural crops, such as fire blight."@en .

:Disinfectant a owl:Class ;
rdfs:subClassOf :ChemicalProtectionProduct ;
schema:name "Disinfectant"@en ;
schema:description "Chemical agents used to destroy or inhibit the growth of harmful organisms on equipment or storage surfaces."@en .

:Fungicide a owl:Class ;
rdfs:subClassOf :ChemicalProtectionProduct ;
schema:name "Fungicide"@en ;
schema:description "A chemical product used to combat fungal diseases by killing fungi or inhibiting their spores/growth."@en .

:Herbicide a owl:Class ;
rdfs:subClassOf :ChemicalProtectionProduct ;
schema:name "Herbicide"@en ;
schema:description "A chemical product used to control or eliminate unwanted plants (weeds)."@en .

:Insecticide a owl:Class ;
rdfs:subClassOf :ChemicalProtectionProduct ;
schema:name "Insecticide"@en ;
schema:description "A chemical product specifically designed to control insect populations."@en .

:Molluscicide a owl:Class ;
rdfs:subClassOf :ChemicalProtectionProduct ;
schema:name "Molluscicide"@en ;
schema:description "A chemical product used to control mollusks, particularly slugs and snails."@en .

:PlantDefenseInducer a owl:Class ;
rdfs:subClassOf :ChemicalProtectionProduct ;
schema:name "Plant Defense Inducer"@en ;
schema:description "A chemical product that activates the natural defense mechanisms (immune system) of plants without directly targeting the pathogen."@en .

:Nematicide a owl:Class ;
rdfs:subClassOf :ChemicalProtectionProduct ;
schema:name "Nematicide"@en ;
schema:description "A chemical product used to control nematodes (roundworms) that damage root systems."@en .

:PlantGrowthRegulator a owl:Class ;
rdfs:subClassOf :ChemicalProtectionProduct ;
schema:name "Plant Growth Regulator"@en ;
schema:description "Chemical substances that influence the growth and development of plants (e.g. hormone mimics)."@en .

:Rodenticide a owl:Class ;
rdfs:subClassOf :ChemicalProtectionProduct ;
schema:name "Rodenticide"@en ;
schema:description "Chemical agents used to control rodent infestations in agricultural settings."@en .

:SeedTreatmentProduct a owl:Class ;
rdfs:subClassOf :ChemicalProtectionProduct ;
schema:name "Seed Treatment Product"@en ;
schema:description "Chemicals applied to seeds prior to planting to protect them from pathogens and pests."@en .

:StorageProtectionProduct a owl:Class ;
rdfs:subClassOf :ChemicalProtectionProduct ;
schema:name "Storage Protection Product"@en ;
schema:description "Products applied to protect harvested crops during storage."@en .

:Virucide a owl:Class ;
rdfs:subClassOf :ChemicalProtectionProduct ;
schema:name "Virucide"@en ;
schema:description "Agents capable of neutralizing or destroying viruses affecting crops."@en .

# Insecticide subclsses --------------------------------------------------------

:Pheromone a owl:Class ;
rdfs:subClassOf :Insecticide ;
schema:name "Pheromone"@en ;
schema:description "Chemical substances secreted by insects (or synthetic analogues) used as attractants to monitor or control pest populations."@en .

:SoapBasedInsecticide a owl:Class ;
rdfs:subClassOf :Insecticide ;
schema:name "Soap-based Insecticide"@en ;
schema:description "Insecticides derived from fatty acid salts (soaps) used for soft-body insect control."@en .

# ==============================================================================
# INDICATION CLASS DEFINITION AND PROPERTIES
# ==============================================================================
Expand Down Expand Up @@ -478,4 +340,12 @@ schema:QuantitativeValue a owl:Class ;
a owl:Restriction ;
owl:onProperty schema:name ;
owl:allValuesFrom xsd:string
] .
] .

# ==============================================================================
# PROPERTIES
# ==============================================================================

schema:legalName rdfs:subPropertyOf schema:name .

:productType rdfs:subPropertyOf rdf:type .
Loading
Loading