Skip to content

Commit

Permalink
add: virtuoso named graph support
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholsn committed Oct 16, 2014
1 parent 065a536 commit d81a3d5
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions niquery/app.py
Expand Up @@ -174,11 +174,19 @@ def get(self, task_id):
if async.ready():
prov = async.get(timeout=1.0)
graph = json.loads(prov['prov'])
result.update({'@graph': graph})
select = SelectQuery(config=app.config)
ctx = select.get_graph()
g = rdflib.Graph(store=ctx.store, identifier=NS.iri[async.id])
g.parse(data=result, format='json-ld')

# connect to the configured store
store = SelectQuery(config=app.config).get_graph().store
sparql_store = rdflib.ConjunctiveGraph(store=store,
identifier=NS.iri[async.id])

# handle lack of support for bnodes
g = rdflib.Graph()
g.parse(data=json.dumps(result['@graph']), format='json-ld')
g.skolemize(new_graph=sparql_store)

result.update({'graph_id': NS.iri[async.id],
'@graph': graph}) # send a json-ld graph
return result

# Endpoints
Expand All @@ -195,4 +203,4 @@ def get(self, task_id):

# TODO: 'Validate' NIDM API (Dataset Descriptor)
# TODO: Infer NIDM from XNAT + EXCEL (Experiment)
# TODO: Compute from NIDM (Workflow + Results)
# TODO: Compute from NIDM (Workflow + Results)

0 comments on commit d81a3d5

Please sign in to comment.