-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improve metadata to comply with FOOPS recommendations
- Loading branch information
1 parent
5aee817
commit f1075b9
Showing
5 changed files
with
306 additions
and
198 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
34 changes: 34 additions & 0 deletions
34
docs/assets/img/fig/src/domain-electrochemistry-logo.drawio
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,34 @@ | ||
<mxfile host="65bd71144e"> | ||
<diagram id="NrZ29duDLyXxqPhjrZT9" name="Page-1"> | ||
<mxGraphModel dx="799" dy="469" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0"> | ||
<root> | ||
<mxCell id="0"/> | ||
<mxCell id="1" parent="0"/> | ||
<mxCell id="2" value="<font style="font-size: 104px;">ECHO</font>" style="text;strokeColor=none;fillColor=none;html=1;fontSize=24;fontStyle=1;verticalAlign=middle;align=center;" vertex="1" parent="1"> | ||
<mxGeometry x="335" y="40" width="350" height="120" as="geometry"/> | ||
</mxCell> | ||
<mxCell id="3" value="<span style="font-weight: normal;">Electrochemistry Domain Ontology</span>" style="text;strokeColor=none;fillColor=none;html=1;fontSize=24;fontStyle=1;verticalAlign=middle;align=center;" vertex="1" parent="1"> | ||
<mxGeometry x="320" y="160" width="380" height="40" as="geometry"/> | ||
</mxCell> | ||
<mxCell id="12" value="" style="group" vertex="1" connectable="0" parent="1"> | ||
<mxGeometry x="140" y="40" width="181.1" height="161.88" as="geometry"/> | ||
</mxCell> | ||
<mxCell id="8" value="" style="ellipse;whiteSpace=wrap;html=1;fontSize=104;fillColor=none;rotation=30;shadow=1;strokeWidth=4;strokeColor=#028cae;" vertex="1" parent="12"> | ||
<mxGeometry x="9.616304589462196" y="36.42974499999999" width="161.86739082107562" height="81.84383" as="geometry"/> | ||
</mxCell> | ||
<mxCell id="10" value="" style="ellipse;whiteSpace=wrap;html=1;fontSize=104;fillColor=none;rotation=-210;shadow=1;strokeWidth=4;strokeColor=#028cae;" vertex="1" parent="12"> | ||
<mxGeometry x="9.616304589462196" y="36.42974499999999" width="161.86739082107562" height="81.84383" as="geometry"/> | ||
</mxCell> | ||
<mxCell id="11" value="" style="ellipse;whiteSpace=wrap;html=1;fontSize=104;fillColor=none;rotation=90;shadow=1;strokeWidth=4;strokeColor=#028cae;" vertex="1" parent="12"> | ||
<mxGeometry x="9.616304589462196" y="40.018084999999985" width="161.86739082107562" height="81.84383" as="geometry"/> | ||
</mxCell> | ||
<mxCell id="5" value="" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;fontSize=104;fillColor=#005CA2;strokeWidth=4;strokeColor=#e4c89e;" vertex="1" parent="12"> | ||
<mxGeometry x="50.0831522947311" y="36.42974499999999" width="80.93369541053781" height="80.93369541053781" as="geometry"/> | ||
</mxCell> | ||
<mxCell id="6" value="" style="verticalLabelPosition=bottom;verticalAlign=top;html=1;shape=mxgraph.basic.polygon;polyCoords=[[0.62,0.32],[0.57,0.43],[0.62,0.43],[0.46,0.65],[0.46,0.65],[0.51,0.48],[0.46,0.48],[0.51,0.32]];polyline=0;fontSize=104;fillColor=#E4C89E;" vertex="1" parent="12"> | ||
<mxGeometry x="7.59296220419875" y="3.3792449999999934" width="155.1229162035308" height="155.135" as="geometry"/> | ||
</mxCell> | ||
</root> | ||
</mxGraphModel> | ||
</diagram> | ||
</mxfile> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,64 @@ | ||
from rdflib import Graph, Namespace, Literal | ||
from rdflib.namespace import RDF, RDFS, SKOS | ||
import sys | ||
|
||
def add_foops_recommendations(input_file, output_file): | ||
""" | ||
Reads an ontology from a TTL file, adds extra relationships to comply with FOOPS recommendations, | ||
and writes the updated ontology to a new TTL file. | ||
Args: | ||
input_file (str): Path to the input TTL file. | ||
output_file (str): Path to the output TTL file where updated ontology will be saved. | ||
""" | ||
# Define the EMMO namespace | ||
EMMO = Namespace("https://w3id.org/emmo#") | ||
|
||
# Read the original TTL file content with UTF-8 encoding | ||
with open(input_file, 'r', encoding='utf-8') as file: | ||
ttl_content = file.read() | ||
|
||
# Load the TTL content into an RDFLib graph | ||
graph = Graph() | ||
graph.parse(data=ttl_content, format='turtle') | ||
|
||
# Prepare to collect new triples as a list | ||
new_triples = [] | ||
|
||
# Duplicate skos:prefLabel triples as rdfs:label triples | ||
for subj, pred, obj in graph.triples((None, SKOS.prefLabel, None)): | ||
if isinstance(obj, Literal): | ||
new_triples.append((subj, RDFS.label, obj)) | ||
|
||
# Duplicate EMMO-specific annotation triples as rdfs:comment triples | ||
for subj, pred, obj in graph.triples((None, EMMO.EMMO_967080e5_2f42_4eb2_a3a9_c58143e835f9, None)): | ||
if isinstance(obj, Literal): | ||
new_triples.append((subj, RDFS.comment, obj)) | ||
|
||
# Add new triples to the graph | ||
for triple in new_triples: | ||
graph.add(triple) | ||
|
||
# Serialize the graph to the output file with UTF-8 encoding | ||
graph.serialize(destination=output_file, format='turtle') | ||
|
||
def main(): | ||
""" | ||
Main function to handle command-line arguments and invoke the FOOPS compliance update. | ||
""" | ||
# Check for command-line arguments | ||
if len(sys.argv) != 3: | ||
print("Usage: python convert_ttl.py <input_file> <output_file>") | ||
sys.exit(1) | ||
|
||
# Input and output file paths from command-line arguments | ||
input_file = sys.argv[1] | ||
output_file = sys.argv[2] | ||
|
||
# Update the TTL file with FOOPS recommendations | ||
add_foops_recommendations(input_file, output_file) | ||
|
||
print(f"Updated TTL file saved as {output_file}") | ||
|
||
if __name__ == "__main__": | ||
main() |
Oops, something went wrong.