Skip to content

Commit

Permalink
Add namespace configuration and moved bibliographic info as literals --
Browse files Browse the repository at this point in the history
  • Loading branch information
enridaga committed Oct 4, 2023
1 parent 011dea9 commit 906e420
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 18 deletions.
3 changes: 3 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ url: https://reeco-framework.github.io
baseurl: "reeco-jekyll"
#baseurl: ""

rdf:
namespace: "https://reeco-framework.github.io/ecosystem/entity/"

# just-the-docs
#theme: "just-the-docs"
logo: "/assets/images/polifonia-black.png"
Expand Down
7 changes: 5 additions & 2 deletions build_rdf_data_files.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import pysparql_anything as pysa
import os
import yaml

config = yaml.load(open('_config.yml','r'), Loader=yaml.Loader)
namespace = config['rdf']['namespace']
print(namespace)
engine = pysa.SparqlAnything()
directory = './content/'
includes = './_includes/rdf/'
Expand All @@ -11,7 +15,6 @@
location = os.path.join(root, filename)
if "/.github/" in location:
continue
print(location)
pre, ext = os.path.splitext(location)
output_includes = pre.replace("./content/", "./_includes/rdf/")
output = pre + ".schema.json"
Expand All @@ -22,7 +25,7 @@
os.makedirs(pth)
if not os.path.exists(pth_includes):
os.makedirs(pth_includes)
g = engine.construct(q='./components-to-rdf.sparql', v={'componentFile': location}) #
g = engine.construct(q='./components-to-rdf.sparql', v={'componentFile': location, 'namespace': namespace}) #
f = open(output, 'w')
f.write(g.serialize(format='json-ld'))
f1 = open(output_includes, 'w')
Expand Down
33 changes: 17 additions & 16 deletions components-to-rdf.sparql
Original file line number Diff line number Diff line change
Expand Up @@ -231,23 +231,24 @@ WHERE {
}

#--> Step 5. Build entities (when entity IRIs design change, modify this!)
BIND ( ?_namespace AS ?ns ) .
# Entities:
BIND ( fx:entity ( xyz:, ?container_id ) AS ?container )
BIND ( fx:entity ( xyz:, ?id ) AS ?component )
BIND ( fx:entity ( xyz:, ?funder_grant ) AS ?grant )
BIND ( fx:entity ( xyz:, replace(?type, " ", "") ) AS ?Type )
BIND ( fx:entity ( xyz:, ?wp ) AS ?w_package )
BIND ( fx:entity ( xyz:, ?id ) AS ?r_event )
BIND ( fx:entity ( xyz:, ?pilot) AS ?pilot_ )
BIND ( fx:entity ( xyz:, ?project) AS ?project_ )
BIND ( fx:entity ( xyz:, ?main_pub) AS ?main_pub_ )
BIND ( fx:entity ( xyz:, ?publication) AS ?publication_ )
BIND ( fx:entity ( xyz:, ?report) AS ?report_)
BIND ( fx:entity ( xyz:, ?main_report) AS ?main_report_)
BIND ( fx:entity ( xyz:, ?deliverable_doc) AS ?deliverable_doc_ )
BIND ( fx:entity ( xyz:, ?persona) AS ?persona_ )
BIND ( fx:entity ( xyz:, ?documentation) AS ?documentation_ )
BIND ( fx:entity ( xyz:, ?evaluated_in) AS ?evaluated_in_ )
BIND ( fx:entity ( ?ns, ?container_id ) AS ?container )
BIND ( fx:entity ( ?ns, ?id ) AS ?component )
BIND ( fx:entity ( ?ns, ?funder_grant ) AS ?grant )
BIND ( fx:entity ( ?ns, replace(?type, " ", "") ) AS ?Type )
BIND ( fx:entity ( ?ns, ?wp ) AS ?w_package )
BIND ( fx:entity ( ?ns, ?id ) AS ?r_event )
BIND ( fx:entity ( ?ns, ?pilot) AS ?pilot_ )
BIND ( fx:entity ( ?ns, ?project) AS ?project_ )
BIND ( ?main_pub AS ?main_pub_ )
BIND ( ?publication AS ?publication_ )
BIND ( ?report AS ?report_)
BIND ( ?main_report AS ?main_report_)
BIND ( ?deliverable_doc AS ?deliverable_doc_ )
BIND ( fx:entity ( ?ns, ?persona) AS ?persona_ )
BIND ( fx:entity ( ?ns, ?documentation) AS ?documentation_ )
BIND ( fx:entity ( ?ns, ?evaluated_in) AS ?evaluated_in_ )
# Blank Nodes
BIND ( fx:bnode ( ?link ) AS ?bnode0 )
BIND ( fx:bnode ( ?funder_grant ) AS ?bnode1 )
Expand Down

0 comments on commit 906e420

Please sign in to comment.