-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from mfastudillo/main
add terms for material recover facility
- Loading branch information
Showing
3 changed files
with
178 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
from pathlib import Path | ||
|
||
import pandas as pd | ||
from rdflib import Graph, Literal, Namespace, URIRef | ||
from rdflib.namespace import RDF, SKOS | ||
|
||
from sentier_vocab.ordered_serialization import OrderedTurtleSerializer | ||
|
||
|
||
def generate_mrf_turtles(param_data_path, output_file_path): | ||
preferred_labels = { | ||
"NIR HDPE": "near infrared sorting machine of HDPE plastics", | ||
"NIR PET": "near infrared sorting machine of PET plastics", | ||
"glass breaker": "glass breaker sorting machine", | ||
"disc screen 1": "disc screen sorting machine", | ||
"disc screen 2": "disc screen sorting machine", | ||
"disc screen 3": "disc screen sorting machine", | ||
"eddy": "eddy current separator", | ||
"magnet": "magnet sorting machine for ferrous metals", | ||
"vacuum": "vacuum sorting machine for film plastic", | ||
"optical glass": "optical sorting machine for glass", | ||
} | ||
|
||
disc_descr = ( | ||
"An inclined plane filled with a series of parallel rods " | ||
+ "with discs spread along each rod such that large materials travel " | ||
+ "over the top while smaller materials fall between the discs" | ||
) | ||
|
||
opticalglass_decr = " ".join( | ||
[ | ||
"Identifies pre-determined material(s) using optical", | ||
"technology (e.g., cameras, lasers, sensors) and removes the identified material" | ||
"from the stream using bursts of compressed air", | ||
] | ||
) | ||
|
||
description = { | ||
"eddy": "Uses magnetic fields to remove aluminum and other non-ferrous metals", | ||
"magnet": "Uses magnetic fields to remove ferrous metals", | ||
"disc screen 1": disc_descr, | ||
"disc screen 2": disc_descr, | ||
"disc screen 3": disc_descr, | ||
"optical glass": opticalglass_decr, | ||
} | ||
|
||
# New graph | ||
g = Graph() | ||
|
||
# Set up namespaces | ||
qudt = Namespace("http://qudt.org/schema/qudt/") | ||
iri_base = "https://vocab.sentier.dev/products/material-recovery-facility/" | ||
|
||
g.bind("qudt", qudt) | ||
g.bind("skos", SKOS) | ||
|
||
# the existing Efficiency concept in dds vocabulary | ||
efficiency_qk = URIRef("https://vocab.sentier.dev/units/quantity-kind/Efficiency") | ||
sorting_machine = URIRef("https://publications.europa.eu/resource/authority/cpv/cpv/43411000") | ||
|
||
# sequence | ||
GENERIC = Namespace("https://vocab.sentier.dev/model-terms/generic/") | ||
g.add((URIRef(GENERIC + "sequence"), RDF.type, SKOS.Concept)) | ||
g.add( | ||
( | ||
URIRef(GENERIC + "sequence"), | ||
SKOS.exactMatch, | ||
URIRef("http://semanticscience.org/resource/SIO_001118"), | ||
) | ||
) | ||
|
||
# sorting machines | ||
path_to_file = Path(__file__).parent / param_data_path | ||
df = pd.read_csv(path_to_file, sep=";") | ||
|
||
for _equipment in df.equipment.unique(): | ||
uri = URIRef(f"{iri_base}{_equipment.replace(' ', '_')}") | ||
g.add((uri, RDF.type, SKOS.Concept)) | ||
g.add( | ||
(uri, SKOS.prefLabel, Literal(preferred_labels.get(_equipment, _equipment), lang="en")) | ||
) | ||
g.add((uri, qudt.hasQuantityKind, efficiency_qk)) | ||
g.add((uri, SKOS.broader, sorting_machine)) | ||
|
||
if _equipment in description: | ||
g.add((uri, SKOS.definition, Literal(description.get(_equipment), lang="en"))) | ||
|
||
output_path = output_file_path.with_suffix(".ttl") | ||
serializer = OrderedTurtleSerializer(g) | ||
with open(output_path, "wb") as fp: | ||
serializer.serialize(fp) | ||
|
||
|
||
if __name__ == "__main__": | ||
output_file = Path(__file__).parent / "output" / "material_recover_facility.ttl" | ||
input_file = Path(__file__).parent / "input" / "corrected_mrf_equipment_efficiency.csv" | ||
generate_mrf_turtles(input_file, output_file) |
19 changes: 19 additions & 0 deletions
19
sentier_vocab/input/corrected_mrf_equipment_efficiency.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
plant model;equipment;sequence;film;cardboard;glass;paper;PET;HDPE;iron;aluminium;other | ||
4P;vacuum;1;0.98;0.02;0;0.02;0;0;0;0;0 | ||
4P;disc screen 1;2;0;0.75;0;0.02;0;0;0;0;0 | ||
4P;glass breaker;3;0;0;0.97;0;0;0;0;0;0 | ||
4P;disc screen 2;4;0.02;0.02;0;0.94;0;0;0;0;0 | ||
4P;NIR PET;5;0.2;0.05;0.08;0.05;0.91;0.1;0;0.03;0.05 | ||
4P;NIR HDPE;6;0.2;0.05;0.08;0.05;0.01;0.7;0;0.03;0.05 | ||
4P;magnet;7;0.01;0;0;0;0;0;0.92;0;0.02 | ||
4P;eddy;8;0;0;0.5;0;0;0;0;0.8;0 | ||
Pressley et al. 2015;vacuum;1;0.90;0;0;0;0;0;0;0;0 | ||
Pressley et al. 2015;disc screen 1;2;0;0.7;0;0;0;0;0;0;0 | ||
Pressley et al. 2015;disc screen 2;3;0;0.85;0;0.85;0;0;0;0;0 | ||
Pressley et al. 2015;disc screen 3;4;0;0.91;0;0.91;0;0;0;0;0 | ||
Pressley et al. 2015;glass breaker;5;0;0;0.97;0;0;0;0;0;0 | ||
Pressley et al. 2015;optical glass;6;0;0;0.98;0;0;0;0;0;0 | ||
Pressley et al. 2015;NIR PET;7;0;0;0;0;0.98;0;0;0;0 | ||
Pressley et al. 2015;NIR HDPE;8;0;0;0;0;0;0.98;0;0;0 | ||
Pressley et al. 2015;magnet;9;0;0;0;0;0;0;0.98;0;0 | ||
Pressley et al. 2015;eddy;10;0;0;0;0;0;0;0;0.97;0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
@prefix qudt: <http://qudt.org/schema/qudt/> . | ||
@prefix skos: <http://www.w3.org/2004/02/skos/core#> . | ||
|
||
<https://vocab.sentier.dev/model-terms/generic/sequence> a skos:Concept ; | ||
skos:exactMatch <http://semanticscience.org/resource/SIO_001118> . | ||
|
||
<https://vocab.sentier.dev/products/material-recovery-facility/NIR_HDPE> a skos:Concept ; | ||
qudt:hasQuantityKind <https://vocab.sentier.dev/units/quantity-kind/Efficiency> ; | ||
skos:broader <https://publications.europa.eu/resource/authority/cpv/cpv/43411000> ; | ||
skos:prefLabel "near infrared sorting machine of HDPE plastics"@en . | ||
|
||
<https://vocab.sentier.dev/products/material-recovery-facility/NIR_PET> a skos:Concept ; | ||
qudt:hasQuantityKind <https://vocab.sentier.dev/units/quantity-kind/Efficiency> ; | ||
skos:broader <https://publications.europa.eu/resource/authority/cpv/cpv/43411000> ; | ||
skos:prefLabel "near infrared sorting machine of PET plastics"@en . | ||
|
||
<https://vocab.sentier.dev/products/material-recovery-facility/disc_screen_1> a skos:Concept ; | ||
qudt:hasQuantityKind <https://vocab.sentier.dev/units/quantity-kind/Efficiency> ; | ||
skos:broader <https://publications.europa.eu/resource/authority/cpv/cpv/43411000> ; | ||
skos:definition "An inclined plane filled with a series of parallel rods with discs spread along each rod such that large materials travel over the top while smaller materials fall between the discs"@en ; | ||
skos:prefLabel "disc screen sorting machine"@en . | ||
|
||
<https://vocab.sentier.dev/products/material-recovery-facility/disc_screen_2> a skos:Concept ; | ||
qudt:hasQuantityKind <https://vocab.sentier.dev/units/quantity-kind/Efficiency> ; | ||
skos:broader <https://publications.europa.eu/resource/authority/cpv/cpv/43411000> ; | ||
skos:definition "An inclined plane filled with a series of parallel rods with discs spread along each rod such that large materials travel over the top while smaller materials fall between the discs"@en ; | ||
skos:prefLabel "disc screen sorting machine"@en . | ||
|
||
<https://vocab.sentier.dev/products/material-recovery-facility/disc_screen_3> a skos:Concept ; | ||
qudt:hasQuantityKind <https://vocab.sentier.dev/units/quantity-kind/Efficiency> ; | ||
skos:broader <https://publications.europa.eu/resource/authority/cpv/cpv/43411000> ; | ||
skos:definition "An inclined plane filled with a series of parallel rods with discs spread along each rod such that large materials travel over the top while smaller materials fall between the discs"@en ; | ||
skos:prefLabel "disc screen sorting machine"@en . | ||
|
||
<https://vocab.sentier.dev/products/material-recovery-facility/eddy> a skos:Concept ; | ||
qudt:hasQuantityKind <https://vocab.sentier.dev/units/quantity-kind/Efficiency> ; | ||
skos:broader <https://publications.europa.eu/resource/authority/cpv/cpv/43411000> ; | ||
skos:definition "Uses magnetic fields to remove aluminum and other non-ferrous metals"@en ; | ||
skos:prefLabel "eddy current separator"@en . | ||
|
||
<https://vocab.sentier.dev/products/material-recovery-facility/glass_breaker> a skos:Concept ; | ||
qudt:hasQuantityKind <https://vocab.sentier.dev/units/quantity-kind/Efficiency> ; | ||
skos:broader <https://publications.europa.eu/resource/authority/cpv/cpv/43411000> ; | ||
skos:prefLabel "glass breaker sorting machine"@en . | ||
|
||
<https://vocab.sentier.dev/products/material-recovery-facility/magnet> a skos:Concept ; | ||
qudt:hasQuantityKind <https://vocab.sentier.dev/units/quantity-kind/Efficiency> ; | ||
skos:broader <https://publications.europa.eu/resource/authority/cpv/cpv/43411000> ; | ||
skos:definition "Uses magnetic fields to remove ferrous metals"@en ; | ||
skos:prefLabel "magnet sorting machine for ferrous metals"@en . | ||
|
||
<https://vocab.sentier.dev/products/material-recovery-facility/optical_glass> a skos:Concept ; | ||
qudt:hasQuantityKind <https://vocab.sentier.dev/units/quantity-kind/Efficiency> ; | ||
skos:broader <https://publications.europa.eu/resource/authority/cpv/cpv/43411000> ; | ||
skos:definition "Identifies pre-determined material(s) using optical technology (e.g., cameras, lasers, sensors) and removes the identified materialfrom the stream using bursts of compressed air"@en ; | ||
skos:prefLabel "optical sorting machine for glass"@en . | ||
|
||
<https://vocab.sentier.dev/products/material-recovery-facility/vacuum> a skos:Concept ; | ||
qudt:hasQuantityKind <https://vocab.sentier.dev/units/quantity-kind/Efficiency> ; | ||
skos:broader <https://publications.europa.eu/resource/authority/cpv/cpv/43411000> ; | ||
skos:prefLabel "vacuum sorting machine for film plastic"@en . | ||
|