Skip to content
Snippets Groups Projects
Commit 4957359c authored by Eliott Sammier's avatar Eliott Sammier
Browse files

Rename file constants for clarity

parent 709bcc58
No related branches found
No related tags found
No related merge requests found
...@@ -27,10 +27,14 @@ SOURCE_DIR = env_path_or_rel_default( ...@@ -27,10 +27,14 @@ SOURCE_DIR = env_path_or_rel_default(
"""Path to the Macao source directory (i.e. the one with the manifest)""" """Path to the Macao source directory (i.e. the one with the manifest)"""
RESULT_DIR = env_path_or_rel_default("RESULTS_DIR", "../../result") RESULT_DIR = env_path_or_rel_default("RESULTS_DIR", "../../result")
"""Path to the output directory""" """Path to the output directory"""
RESULT_FILE = env_path_or_rel_default("RESULT_FILE", RESULT_DIR + "/macao_content.ttl") RDF_CONTENT_FILE = env_path_or_rel_default(
"""Path to the Turtle output file""" "RDF_CONTENT_FILE", RESULT_DIR + "/macao_content.ttl"
SCHEMA_FILE = env_path_or_rel_default("SCHEMA_FILE", "../../macao_schema.ttl") )
"""Path to the file containing the extracted content"""
RDF_SCHEMA_FILE = env_path_or_rel_default("RDF_SCHEMA_FILE", "../../macao_schema.ttl")
"""Path to the schema file""" """Path to the schema file"""
RDF_FULL_FILE = env_path_or_rel_default("RDF_FULL_FILE", RESULT_DIR + "/macao_full.ttl")
"""Path to the full RDF file, including schema, extracted content and inferences"""
NS = Namespace("http://www.semanticweb.org/eliott/ontologies/2024/4/macao/") NS = Namespace("http://www.semanticweb.org/eliott/ontologies/2024/4/macao/")
"""The rdflib base Namespace for our ontology""" """The rdflib base Namespace for our ontology"""
......
...@@ -40,8 +40,8 @@ def main(): ...@@ -40,8 +40,8 @@ def main():
graph = Graph() graph = Graph()
ld = Load.create(graph) ld = Load.create(graph)
Property.set(Property.Value.DISABLE_OWL_AUTO_IMPORT, True) Property.set(Property.Value.DISABLE_OWL_AUTO_IMPORT, True)
ld.parse(SCHEMA_FILE) ld.parse(RDF_SCHEMA_FILE)
ld.parse(RESULT_FILE) ld.parse(RDF_CONTENT_FILE)
# Run STTL transformation # Run STTL transformation
tr = Transformer.create(graph, MODULE_DIR + "/../templates/") tr = Transformer.create(graph, MODULE_DIR + "/../templates/")
......
...@@ -38,8 +38,8 @@ def export_graph(g: Graph): ...@@ -38,8 +38,8 @@ def export_graph(g: Graph):
g.add((this_onto, RDF.type, OWL.Ontology)) g.add((this_onto, RDF.type, OWL.Ontology))
g.add((this_onto, RDFS.label, Literal("macao-content"))) g.add((this_onto, RDFS.label, Literal("macao-content")))
g.add((this_onto, OWL.imports, schema_ontology_uri)) g.add((this_onto, OWL.imports, schema_ontology_uri))
g.serialize(RESULT_FILE, "turtle", base=NS) g.serialize(RDF_CONTENT_FILE, "turtle", base=NS)
log.info(f"Exported {len(g)} triples to {RESULT_FILE}.") log.info(f"Exported {len(g)} triples to {RDF_CONTENT_FILE}.")
def ns_find(elem: etree._Element, query: str): def ns_find(elem: etree._Element, query: str):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment