LinkedDataFragments / Client.js

[DEPRECATED] A JavaScript client for Triple Pattern Fragments interfaces.

Home Page:http://linkeddatafragments.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Parsing GRAPH

ariutta opened this issue · comments

I'm assuming the GRAPH keyword is not yet supported because it doesn't appear in the regex here, and I'm getting Error: Could not parse query when I try running a query using GRAPH on this turtle datasource.

Would this file be the place to start for adding support for the GRAPH keyword?

Hi @ariutta,

The current implementation is a proof-of-concept demonstrated at LDOW2014.

In the new version of the client that will be released within a few days, we use this parser, which supports much more SPARQL features than the current ad-hoc regex.

The entire client has been rewritten with iterators, so adding support for graphs can be done in one of the iterator modules. That said, I think that you would need server support as well; basic Linked Data Fragments only offer triple patterns, not graph patterns. (Unless you see the graph as the origin of the data, which is interesting.)

Do not hesitate to tell us more about your plans, maybe we have planned features in mind that can be relevant. (We will communicate a roadmap at some point.)

Ruben

Hi @RubenVerborgh,

The new version is looking good.

I've got a sample use case to share with you. You can see the data to query for this sample at the JSON-LD playground.

I would like to be able to find all entities of @type protein http://www.biopax.org/release/biopax-level3.owl#Protein that interact with each other, where that interaction is of @type inhibition http://identifiers.org/biomodels.sbo/SBO:0000169.

An example from the sample data: the entity with an @id of cee06 inhibits the entity with an @id of caa4a. Both entities are proteins and should be included in the results of the desired query. You can see the interaction described in the entity with an @id of idb8a520d6. The interactionGraph is a @graph that links cee06 and caa4a.

I could find this by just filtering the entities something like this:

return entity['@type'].indexOf('http://identifiers.org/biomodels.sbo/SBO:0000169') > 0 && !!entity.interactionGraph && entity.interactionGraph.filter(function(graphMember) {return graphMember['@type'].indexOf('http://www.biopax.org/release/biopax-level3.owl#Protein').length === 2;}).length > 0

But it seems like it should be possible to do this with a SPARQL query using the LDF client.

Eventually this should be possible, yes. But then we would need a different contract, as basic LDF servers only offer triple pattern (and not graph pattern) access. You could, however, put each of the different graphs in a different place (i.e., different basic LDF interface). Then you have graphs and triple patterns per graph.

This project has now been deprecated in favor of Comunica, where the requested feature is supported.