Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for triple pattern abbreviations in WHERE clause #1

Open
martinleopold opened this issue Dec 11, 2015 · 1 comment
Open

Support for triple pattern abbreviations in WHERE clause #1

martinleopold opened this issue Dec 11, 2015 · 1 comment

Comments

@martinleopold
Copy link

The predicate-object list (http://www.w3.org/TR/rdf-sparql-query/#predObjLists)

 ?x  foaf:name  ?name ;
        foaf:mbox  ?mbox .

might be written as

  .where('?x', ['foaf:name  ?name', 'foaf:mbox  ?mbox'])

The object list (http://www.w3.org/TR/rdf-sparql-query/#objLists)

?x foaf:nick  "Alice" , "Alice_" .

might be written as

  .where('?x foaf:nick', ['"Alice"', '"Alice_"'])

So basically the syntax for the two cases is the same:

  .where(string, array)

To separate the two cases one might test the first argument (the string) for whitespace.

@dasantonym
Copy link
Member

this is now implemented in a basic way as:

.where(new SPH.Triple('?x', ['foaf:name  ?name', 'foaf:mbox  ?mbox']));

and

.where(new SPH.Triple('?x foaf:nick', ['"Alice"', '"Alice_"']));

still need to think about the whole string parsing. for now i am inclined to only use the classes in the constructors:

var pattern = new SPH.GraphPattern([
    new SPH.Triple('?x foo:bar ?name'),
    new SPH.Triple('?x foaf:nick', ['"Alice"', '"Alice_"']),
    new SPH.Filter('... some filter clause ...')
]);
query.where(pattern);

the whole string-parsing alternative stuff is nice, but i think an oo-structure that provides basic validation and then converts into a sparql query string is more important. a proper string parser could follow and then be used in the class constructor methods.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants