Skip to content

Commit

Permalink
fix: added 'authoritative file' to the download links and fixed json-…
Browse files Browse the repository at this point in the history
…ld namespaces (#66)

fix(github): fix github actions workflow
  • Loading branch information
jgeluk authored Sep 5, 2024
1 parent 5865d47 commit 94c9714
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 60 deletions.
93 changes: 46 additions & 47 deletions respec/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
key: "Download as RDF:",
data: [
{
value: "DPROD Ontology --- RDF Turtle",
value: "DPROD Ontology --- RDF Turtle --- (authoritative file)",
href: "dprod.ttl",
},
{
Expand All @@ -107,12 +107,12 @@
href: "dprod-all.rdf",
},
{
value: "DPROD Shapes --- JSON-LD",
href: "dprod-shapes.jsonld",
value: "DPROD Shapes --- RDF Turtle --- (authoritative file)",
href: "dprod-shapes.ttl",
},
{
value: "DPROD Shapes --- RDF Turtle",
href: "dprod-shapes.ttl",
value: "DPROD Shapes --- JSON-LD",
href: "dprod-shapes.jsonld",
},
{
value: "DPROD Shapes --- RDF/XML",
Expand Down Expand Up @@ -479,7 +479,6 @@ <h2>Scope</h2>
To share common semantics across different Data Products and promote harmonization
</li>
</ul>

</section>

<section id='conformance' class="override">
Expand All @@ -502,47 +501,47 @@ <h2>Terms and Definitions</h2>
<h2>Symbols</h2>
<p>
The following acronyms are used in this specification.
<ul class="no-bullets">
<li>
<strong>DCAT</strong> - Data Catalog Vocabulary [[vocab-dcat-3]]
</li>
<li>
<strong>DPROD</strong> - Data Product Ontology
</li>
<li>
<strong>JSON-LD</strong> - JavaScript Object Notation for Linked Data [[json-ld11]]
</li>
<li>
<strong>IRI</strong> - Internationalized Resource Identifier [[IRI]]
</li>
<li>
<strong>ODRL</strong> - Open Digital Rights Language [[odrl-model]]
</li>
<li>
<strong>OWL</strong> - Web Ontology Language [[owl2-quick-reference]]
</li>
<li>
<strong>PROV</strong> - Provenance Ontology [[prov-overview]]
</li>
<li>
<strong>RDF</strong> - Resource Description Format [[rdf11-concepts]]
</li>
<li>
<strong>RDFS</strong> - RDF Schema [[rdf-schema]], [[swbp-xsch-datatypes]]
</li>
<li>
<strong>SHACL</strong> - Shapes Constraint Language ([[shacl]])
</li>
<li>
<strong>TTL</strong> - Turtle (commonly used serialization for RDF) [[turtle]] [[rdf12-turtle]]
</li>
<li>
<strong>URI</strong> - Uniform Resource Identifier [[URI]]
</li>
<li>
<strong>W3C</strong> - World Wide Web Consortium
</li>
</ul>
<ul class="no-bullets">
<li>
<strong>DPROD</strong> - Data Product Ontology
</li>
<li>
<strong>DCAT</strong> - Data Catalog Vocabulary [[vocab-dcat-3]]
</li>
<li>
<strong>JSON-LD</strong> - JavaScript Object Notation for Linked Data [[json-ld11]]
</li>
<li>
<strong>IRI</strong> - Internationalized Resource Identifier [[IRI]]
</li>
<li>
<strong>ODRL</strong> - Open Digital Rights Language [[odrl-model]]
</li>
<li>
<strong>OWL</strong> - Web Ontology Language [[owl2-quick-reference]]
</li>
<li>
<strong>PROV</strong> - Provenance Ontology [[prov-overview]]
</li>
<li>
<strong>RDF</strong> - Resource Description Format [[rdf11-concepts]]
</li>
<li>
<strong>RDFS</strong> - RDF Schema [[rdf-schema]], [[swbp-xsch-datatypes]]
</li>
<li>
<strong>SHACL</strong> - Shapes Constraint Language ([[shacl]])
</li>
<li>
<strong>TTL</strong> - Turtle (commonly used serialization for RDF) [[turtle]] [[rdf12-turtle]]
</li>
<li>
<strong>URI</strong> - Uniform Resource Identifier [[URI]]
</li>
<li>
<strong>W3C</strong> - World Wide Web Consortium
</li>
</ul>
</p>
</section>

Expand Down
39 changes: 26 additions & 13 deletions spec-generator/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,23 @@ def main():
g_ontology = load_dprod_ontology()
g_shapes = load_dprod_shapes()

jsonld_context = {
jsonld_context_ontology = {
"@context": {
"@version": 1.1,
"dprod": ontology_namespace_iri,
"xsd": XSD._NS,
"owl": OWL._NS,
"dcat": DCAT._NS,
"dct": DCTERMS._NS,
"prov": PROV._NS,
"rdfs": RDFS._NS,
"rdf": RDF._NS,
"sh": SH._NS,
"linkedin": LINKEDIN._NS,
}
}

jsonld_context_shapes = {
"@context": {
"@version": 1.1,
"dprod": ontology_namespace_iri,
Expand All @@ -80,28 +96,23 @@ def main():
"linkedin": LINKEDIN._NS,
}
}


with open('dist/dprod.jsonld', mode='x', encoding='utf-8') as f:
print(f"Generating RDF JSON-LD - on its own: ./{f.name}")
f.write(g_ontology.serialize(format='json-ld', base=ontology_namespace_iri, indent=4, context=jsonld_context))
f.write(g_ontology.serialize(format='json-ld', base=ontology_namespace_iri, indent=4, context=jsonld_context_ontology))

with open('dist/dprod-all.jsonld', mode='x', encoding='utf-8') as f:
print(f"Generating RDF JSON-LD - all: ./{f.name}")
f.write(g.serialize(format='json-ld', base=ontology_namespace_iri, indent=4, context=jsonld_context))
f.write(g.serialize(format='json-ld', base=ontology_namespace_iri, indent=4, context=jsonld_context_shapes))

with open('dist/dprod.ttl', mode='x', encoding='utf-8') as f:
print(f"Generating RDF Turtle - on its own: ./{f.name}")
f.write(g_ontology.serialize(format='turtle', base=ontology_namespace_iri))
# with open('dist/dprod.ttl', mode='x', encoding='utf-8') as f:
# print(f"Generating RDF Turtle - on its own: ./{f.name}")
# f.write(g_ontology.serialize(format='turtle', base=ontology_namespace_iri))

with open('dist/dprod-all.ttl', mode='x', encoding='utf-8') as f:
print(f"Generating RDF Turtle - all: ./{f.name}")
f.write(g.serialize(format='turtle', base=ontology_namespace_iri))

# with open('dist/dprod.rdf', mode='x', encoding='utf-8') as f:
# print(f"Generating RDF/XML - on its own: ./{f.name}")
# f.write(g_ontology.serialize(format='xml', base=ontology_namespace_iri))

with open('dist/dprod.rdf', mode='x', encoding='utf-8') as f:
print(f"Generating RDF/XML - on its own: ./{f.name}")
f.write(g_ontology.serialize(format='pretty-xml', base=ontology_namespace_iri))
Expand All @@ -116,7 +127,7 @@ def main():

with open('dist/dprod-shapes.jsonld', mode='x', encoding='utf-8') as f:
print(f"Generating SHACL Ontology JSON-LD - on its own: ./{f.name}")
f.write(g_shapes.serialize(format='json-ld', base=shapes_graph_ns_iri, indent=4, context=jsonld_context))
f.write(g_shapes.serialize(format='json-ld', base=shapes_graph_ns_iri, indent=4, context=jsonld_context_shapes))

with open('dist/dprod-shapes.rdf', mode='x', encoding='utf-8') as f:
print(f"Generating SHACL Ontology RDF/XML - on its own: ./{f.name}")
Expand All @@ -126,8 +137,10 @@ def main():
print(f"Copying asset: {asset}")
shutil.copy2(f'assets/{asset}', 'dist/assets')

print("Copying dprod.ttl")
shutil.copy2('ontology/dprod/dprod-ontology.ttl', 'dist/dprod.ttl')
print("Copying dprod-shapes.ttl")
shutil.copy2('ontology/dprod/dprod-shapes.ttl', 'dist/dprod-shapes-original.ttl')
shutil.copy2('ontology/dprod/dprod-shapes.ttl', 'dist/dprod-shapes.ttl')

print("Specification generated successfully!")

Expand Down

0 comments on commit 94c9714

Please sign in to comment.