Skip to content

Commit

Permalink
debug in case if unit has no en-annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
MBueschelberger committed Dec 11, 2024
1 parent 3ff4c18 commit 002a856
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 14 deletions.
11 changes: 9 additions & 2 deletions data2rdf/qudt/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,16 @@ def _get_qudt_label_and_symbol(
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT DISTINCT ?label ?symbol
WHERE {{
<{iri}> rdfs:label ?label .
<{iri}> qudt:symbol ?symbol .
FILTER (LANG(?label) = "{language}")
OPTIONAL {{
<{iri}> rdfs:label ?label .
FILTER (LANG(?label) = "{language}")
}}
OPTIONAL {{
<{iri}> rdfs:label ?label_no_lang .
FILTER (LANG(?label_no_lang) = "")
}}
BIND(COALESCE(?label, ?label_no_lang) AS ?label)
}}"""
match = [
{"label": str(row["label"]), "symbol": str(row["symbol"])}
Expand Down
8 changes: 4 additions & 4 deletions tests/abox/csv_empty_rows/input/mapping/mapping.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
"iri": "https://w3id.org/steel/ProcessOntology/ThermalExpansionCoefficient",
"key": "Coefficient of thermal exapansion[1/K]",
"unit": "https://qudt.org/vocab/unit/PERCENT-PER-K"
"unit": "http://qudt.org/vocab/unit/PERCENT-PER-K"
},
{
"iri": "https://w3id.org/steel/ProcessOntology/MassDensity",
Expand All @@ -12,7 +12,7 @@
{
"iri": "https://w3id.org/steel/ProcessOntology/PoissonRatio",
"key": "Poison's ratio[-]",
"unit": "https://qudt.org/vocab/unit/NUM"
"unit": "http://qudt.org/vocab/unit/NUM"
},
{
"iri": "https://w3id.org/steel/ProcessOntology/SpecificHeatCapacity",
Expand All @@ -22,7 +22,7 @@
{
"iri": "https://w3id.org/steel/ProcessOntology/Temperature",
"key": "Temperature[\u00b0C]",
"unit": "https://qudt.org/vocab/unit/DEG_C"
"unit": "http://qudt.org/vocab/unit/DEG_C"
},
{
"iri": "https://w3id.org/steel/ProcessOntology/ThermalConductivity",
Expand All @@ -32,6 +32,6 @@
{
"iri": "https://w3id.org/steel/ProcessOntology/ModulusOfElasticity",
"key": "Young's modulus[Pa]",
"unit": "https://qudt.org/vocab/unit/PA"
"unit": "http://qudt.org/vocab/unit/PA"
}
]
8 changes: 4 additions & 4 deletions tests/abox/csv_empty_rows/output/output_csv_parser.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -64,19 +64,19 @@ fileid:MassDensity a <https://w3id.org/steel/ProcessOntology/MassDensity> ;
qudt:hasUnit "http://qudt.org/vocab/unit/KiloGM-PER-M3"^^xsd:anyURI .

fileid:ModulusOfElasticity a <https://w3id.org/steel/ProcessOntology/ModulusOfElasticity> ;
qudt:hasUnit "https://qudt.org/vocab/unit/PA"^^xsd:anyURI .
qudt:hasUnit "http://qudt.org/vocab/unit/PA"^^xsd:anyURI .

fileid:PoissonRatio a <https://w3id.org/steel/ProcessOntology/PoissonRatio> ;
qudt:hasUnit "https://qudt.org/vocab/unit/NUM"^^xsd:anyURI .
qudt:hasUnit "http://qudt.org/vocab/unit/NUM"^^xsd:anyURI .

fileid:SpecificHeatCapacity a <https://w3id.org/steel/ProcessOntology/SpecificHeatCapacity> ;
qudt:hasUnit "http://qudt.org/vocab/unit/J-PER-KiloGM-K"^^xsd:anyURI .

fileid:Temperature a <https://w3id.org/steel/ProcessOntology/Temperature> ;
qudt:hasUnit "https://qudt.org/vocab/unit/DEG_C"^^xsd:anyURI .
qudt:hasUnit "http://qudt.org/vocab/unit/DEG_C"^^xsd:anyURI .

fileid:ThermalConductivity a <https://w3id.org/steel/ProcessOntology/ThermalConductivity> ;
qudt:hasUnit "http://qudt.org/vocab/unit/KiloW-PER-M-K"^^xsd:anyURI .

fileid:ThermalExpansionCoefficient a <https://w3id.org/steel/ProcessOntology/ThermalExpansionCoefficient> ;
qudt:hasUnit "https://qudt.org/vocab/unit/PERCENT-PER-K"^^xsd:anyURI .
qudt:hasUnit "http://qudt.org/vocab/unit/PERCENT-PER-K"^^xsd:anyURI .
8 changes: 4 additions & 4 deletions tests/abox/csv_empty_rows/output/output_csv_pipeline.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,22 @@ fileid:MassDensity a <https://w3id.org/steel/ProcessOntology/MassDensity> ;
qudt:hasUnit "http://qudt.org/vocab/unit/KiloGM-PER-M3"^^xsd:anyURI .

fileid:ModulusOfElasticity a <https://w3id.org/steel/ProcessOntology/ModulusOfElasticity> ;
qudt:hasUnit "https://qudt.org/vocab/unit/PA"^^xsd:anyURI .
qudt:hasUnit "http://qudt.org/vocab/unit/PA"^^xsd:anyURI .

fileid:PoissonRatio a <https://w3id.org/steel/ProcessOntology/PoissonRatio> ;
qudt:hasUnit "https://qudt.org/vocab/unit/NUM"^^xsd:anyURI .
qudt:hasUnit "http://qudt.org/vocab/unit/NUM"^^xsd:anyURI .

fileid:SpecificHeatCapacity a <https://w3id.org/steel/ProcessOntology/SpecificHeatCapacity> ;
qudt:hasUnit "http://qudt.org/vocab/unit/J-PER-KiloGM-K"^^xsd:anyURI .

fileid:Temperature a <https://w3id.org/steel/ProcessOntology/Temperature> ;
qudt:hasUnit "https://qudt.org/vocab/unit/DEG_C"^^xsd:anyURI .
qudt:hasUnit "http://qudt.org/vocab/unit/DEG_C"^^xsd:anyURI .

fileid:ThermalConductivity a <https://w3id.org/steel/ProcessOntology/ThermalConductivity> ;
qudt:hasUnit "http://qudt.org/vocab/unit/KiloW-PER-M-K"^^xsd:anyURI .

fileid:ThermalExpansionCoefficient a <https://w3id.org/steel/ProcessOntology/ThermalExpansionCoefficient> ;
qudt:hasUnit "https://qudt.org/vocab/unit/PERCENT-PER-K"^^xsd:anyURI .
qudt:hasUnit "http://qudt.org/vocab/unit/PERCENT-PER-K"^^xsd:anyURI .

fileid:tableGroup a csvw:TableGroup ;
csvw:table [ a csvw:Table ;
Expand Down

0 comments on commit 002a856

Please sign in to comment.