-
Notifications
You must be signed in to change notification settings - Fork 21
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
Feature/sparql func #778
Feature/sparql func #778
Conversation
8e3b6fc
to
17afff8
Compare
64942a8
to
7977d64
Compare
3689f24
to
76d9d7c
Compare
Rebased on #769 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall. I have some test organization and description suggestions.
"person:birthday" | ||
{"@value" "2011-01-10T14:45:13.815-05:00", "@type" "xsd:dateTime"}}] | ||
where) | ||
"datatype literal"))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be good to move these into their own descriptive testing
form. They're moving away from "simple triple" :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "simple triple" refers more to the grammar classification of this type of expression. These test cases just confirm that all the different types of RDF literal terms are translated correctly.
@@ -333,6 +457,14 @@ | |||
{:keys [groupBy]} (sparql/->fql query)] | |||
(is (= ["?person" "?handle"] | |||
groupBy)))) | |||
(testing "mutiple HAVING constraints" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing the first "l" in "multiple"
@@ -254,11 +268,109 @@ | |||
[:bind "?num1" "(* (/ (* (* ?age 4) 3) -2) (/ -4 2))"] | |||
{"@id" "?person", "person:handle" "?handle"} | |||
{"@id" "?person", "person:age" "?age"}] | |||
where))) | |||
(let [query "SELECT ?person ?abs ?bnode ?bound ?ceil ?coalesce ?concat ?contains ?datatype ?day ?encodeForUri ?floor ?hours ?if ?iri ?lang ?langMatches ?lcase ?md5 ?minutes ?month ?now ?rand ?round ?seconds ?sha1 ?sha256 ?sha512 ?str ?strAfter ?strBefore ?strDt ?strEnds ?strLang ?strLen ?strStarts ?struuid ?timezone ?tz ?ucase ?uri ?uuid ?year ?isBlank ?isIri ?isLiteral ?isNumeric ?isUri ?sameTerm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this benefit from a testing
form w/ a description? Or is it just "test lots of binds"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is testing that the grammar and translation for all the different SPARQL functions works correctly. I'll add a testing expression for it : )
7977d64
to
41fb5e9
Compare
The tricky part is deciding when to `literal-quote` one or more of the args. Since that information does not exist in the parse tree at the point where :Func needs parsing, we need to figure out whether to quote based on the signature of the function, according to the SPARQL spec: https://www.w3.org/TR/sparql11-query/#SparqlOps and the SPARQL grammar. This way is more repetitive but more robust. Once we've got all the functions covered we can search for abstractions to reduce verbosity.
I'm not sure where the LANGTAG regex came from, but it didn't match the one in the spec - it required the hyphen (-) between two-part lang tags of the style `@en-us`, but disallowed the simple verson `@en`. Now it correctly accepts both.
63090d7
to
968aedd
Compare
The grammar wasn't expecting whitespace between the 'a' and the prev/next term.
Semantics and syntax from SPARQL IN expression.
It's not sparql-specific, so no need to qualify it.
The :Expression parser was turning everything into a string, which works in some cases but introduces unwanted quoting in others. By deferring stringification until values need to be incorporated into an actual string expression we avoid the unwanted quoting. Do note that all the numeric functions now correctly expect numeric values instead of strings.
abs expects only a single expression as an argument, and that argument does not need to be quoted.
translate SPARQL IN/NOT IN expresssions into FQL
translate SPARQL EXISTS/NOT EXISTS filters into FQL
add support for `in` expression
Feature/fql exists not exists
Feature/sparql from named
No description provided.