Skip to content

Commit ef1296a

Browse files
fix relative path name now subdirectory per processed ontology generated
1 parent 05ae5eb commit ef1296a

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

profilewiz/profilewiz.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -608,6 +608,7 @@ def process(name, args):
608608
#check a subdir called outbase exists - create if missing
609609
if not os.path.exists(os.path.join( outdir,outbase) ):
610610
os.makedirs(os.path.join( outdir,outbase))
611+
rel_file_base = outbase
611612
output_file_base = os.path.join( outdir, outbase,outbase)
612613
# Process known resources and intentions from the profile catalog list, before
613614
owl = output_file_base + ".ttl"
@@ -656,14 +657,14 @@ def process(name, args):
656657
for fmt, mime in formats.items():
657658
dedupgraph.serialize(destination=output_file_base + "." + fmt,
658659
format='json-ld' if fmt == 'jsonld' else fmt)
659-
curprofile.addResource(ontid, output_file_base + "." + fmt, "Normalised OWL with imports",
660+
curprofile.addResource(ontid, rel_file_base + "." + fmt, "Normalised OWL with imports",
660661
desc="This is an OWL file with imports for ontologies containing all object definitions, but with only statements not present in imports",
661662
role=PROFROLE.vocabulary,
662663
conformsTo=OWL,
663664
fmt=mime)
664665
if args.all or args.flat:
665666
maximal_ont.serialize(destination=output_file_base + "_flat." + fmt, format='json-ld' if fmt == 'jsonld' else fmt)
666-
curprofile.addResource(ontid, output_file_base + "_flat." + fmt,
667+
curprofile.addResource(ontid, rel_file_base + "_flat." + fmt,
667668
"OWL with definition details from imports",
668669
role=PROFROLE.vocabulary,
669670
conformsTo=OWL,
@@ -675,7 +676,7 @@ def process(name, args):
675676
if args.all or args.json:
676677
with open(output_file_base + "_context_flat.jsonld", "w") as outfile:
677678
json.dump(make_context(ontid, maximal_ont, fullclosure, used_namespaces, args.q, profiles=profiles, flat=True), outfile, indent=4)
678-
curprofile.addResource(ontid, output_file_base + "_context_flat.jsonld",
679+
curprofile.addResource(ontid, rel_file_base + "_context_flat.jsonld",
679680
"Flattened JSON-LD context",
680681
role=PROFROLE.contextflat,
681682
conformsTo=JSONLD_URI, fmt='application/ld+json')
@@ -684,7 +685,7 @@ def process(name, args):
684685
json.dump(make_context(ontid, dedupgraph, fullclosure, used_namespaces, args.q, profiles=profiles, flat=False),
685686
outfile,
686687
indent=4)
687-
curprofile.addResource(ontid, output_file_base + "_context.jsonld", "JSON-LD Context - local file link",
688+
curprofile.addResource(ontid, rel_file_base + "_context.jsonld", "JSON-LD Context - local file link",
688689
role=PROFROLE.contextlocal,
689690
conformsTo=JSONLD_URI,
690691
fmt='application/ld+json')
@@ -695,7 +696,7 @@ def process(name, args):
695696
if args.all or args.json:
696697
with open(output_file_base + ".json", "w") as outfile:
697698
json.dump(make_schema(ontid, dedupgraph, args.q, frames), outfile, indent=4)
698-
curprofile.addResource(ontid, output_file_base + ".json", "JSON Schema", role=PROFROLE.schema,
699+
curprofile.addResource(ontid, rel_file_base + ".json", "JSON Schema", role=PROFROLE.schema,
699700
conformsTo=JSONSCHEMA_URI,
700701
fmt='application/json')
701702

@@ -704,7 +705,7 @@ def process(name, args):
704705
html = pylode.MakeDocco(
705706
input_graph=ont, outputformat="html", profile="ontdoc", exclude_css=css_found).document()
706707
htmlfile.write(html)
707-
curprofile.addResource(ontid, output_file_base + "_source.html",
708+
curprofile.addResource(ontid, rel_file_base + "_source.html",
708709
"Profile description as HTML", role=PROFROLE.profile,
709710
conformsTo=PROF,
710711
desc="Original source OWL file as HTML - for comparison and review purposes",
@@ -731,7 +732,7 @@ def process(name, args):
731732
subs={'https://astrea.linkeddata.es/shapes': ontid + "_shapes",
732733
'http://schema.org/': 'https://schema.org/'})
733734
file.write(shacl)
734-
curprofile.addResource(ontid, output_file_base + "_flat_shacl.ttl",
735+
curprofile.addResource(ontid, rel_file_base + "_flat_shacl.ttl",
735736
"SHACL constraints for profile",
736737
desc="SHACL validation constraints for all declarations relevant to profile including imports",
737738
role=PROFROLE.validation,
@@ -742,7 +743,7 @@ def process(name, args):
742743
subs={'https://astrea.linkeddata.es/shapes': ontid + "_shapes",
743744
'http://schema.org/': 'https://schema.org/'})
744745
file.write(shacl)
745-
curprofile.addResource(ontid, output_file_base + "_shacl.ttl",
746+
curprofile.addResource(ontid, rel_file_base + "_shacl.ttl",
746747
"SHACL for minimal profile",
747748
desc="SHACL validation constraints for profile specific declarations",
748749
role=PROFROLE.validation,
@@ -751,7 +752,7 @@ def process(name, args):
751752

752753
if args.all or args.html_owl:
753754
docgraph = maximal_ont
754-
curprofile.addResource(ontid, output_file_base + ".html",
755+
curprofile.addResource(ontid, rel_file_base + ".html",
755756
"OWL documentation as HTML",
756757
desc="Based on the OWL flat view of the profile, a HTML rendering of key elements of the model.",
757758
role=PROFROLE.profile,
@@ -764,7 +765,7 @@ def process(name, args):
764765

765766
# serialise current profile last - so it captures all formats generated
766767
if args.all or args.html_prof:
767-
curprofile.addResource(ontid, output_file_base + "_prof.html",
768+
curprofile.addResource(ontid, rel_file_base + "_prof.html",
768769
"Profile description as HTML", role=PROFROLE.profile,
769770
conformsTo=PROF,
770771
desc="Overview of profile and available descriptive and implementation support resources",

0 commit comments

Comments
 (0)