-
Notifications
You must be signed in to change notification settings - Fork 34
#455: Integrate SPARQL Functions #511
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
base: gh-pages
Are you sure you want to change the base?
Conversation
Do we want to have the SPARQL function sections being populated dynamically (from https://github.com/w3c/sparql-query/blob/main/sparql-ns.ttl ) or just updated on demand? |
I am afraid the proper process would be:
This is of course a lot of work but will be paying off on the long term because the info will be machine readable, e.g. for syntax-directed editors. BTW the diff is huge - what happened? |
I messed up the formatting.. will fix that next |
If contributed back to RDF & SPARQL WG, I'm sure that could get incorporated into sparql-ns. |
…ptions, categories, spec links.
- Introduced examples for various SPARQL functions to enhance documentation and usability. - Added a new prefix for shnex-sparql to categorize examples. - Updated existing functions with example usage, including arithmetic, logical, string, numeric, and date functions. - Ensured all aggregate functions also include example usage for clarity.
rdfs:label "W3C SHACL SPARQL Functions Vocabulary"@en ; | ||
rdfs:comment "This vocabulary defines SPARQL functions for use with SHACL."@en ; | ||
sh:declare [ | ||
sh:prefix "shnex" ; |
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.
Should declare sparql instead
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.
addressed in 530b33d
…ttl; fix isdefinedby URIs
…nd infix operator symbols. Add infix operators to selected functions
SPARQL functions work on arguments that are single RDF terms. In SPARQL Aggregates tied into the way shnex has it's own aggregates and that's probably the way to go - I think that defining an adaption layer to get SPARQL aggregates to work is not that different from shnex's aggregates so there is no advantage to SPARQL aggregates. shnex aggregates working on lists which integrates with the way shnex is e.g.
I don't see that node expressions can have variables other than the environment : #498 (comment) |
shnex-sparql:infixOperator | ||
a rdf:Property ; | ||
rdfs:label "infix operator"@en ; | ||
rdfs:comment "Indicates the infix operator symbol used in SPARQL syntax for this function, enabling conversion from functional form to infix notation."@en ; |
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.
Where is infix used in node expressions?
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.
It is not but the information is useful to capture IMHO, to produce human-readable syntax.
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.
That would also need infix precedence.
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.
That would also need infix precedence.
which means? 🤔
shnex-sparql:example """[ sparql:plus ( 38 4 ) ]""" ; | ||
. | ||
|
||
sparql:subtract |
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 has the same URI as the entry in /ns/sparql.ttl
.
But both graphs have triples with subject sparql:subtract
and properties rdfs:comment
and rdfs:isDefinedBy
with different object.
It would be better to only include the SHACL Node Expression additions.
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.
Yes, if necessary create a fresh property to avoid clashes.
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 has the same URI as the entry in /ns/sparql.ttl.
what has the same URI? shnex-sparql:example
?
rdfs:comment "This function tests whether a string matches a regular expression pattern, optionally with a specified flag (e.g., i for case-insensitive)."@en ; | ||
shnex-sparql:category "string" ; | ||
rdfs:isDefinedBy <http://www.w3.org/TR/sparql12-query/#func-regex> ; | ||
shnex-sparql:example """[ sparql:regex ( "hello123" "[0-9]+" ) ]""" ; |
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.
Where does the "specified flag" go? It seems this should have either multiple examples, or one that includes the optional "specified flag".
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.
shnex-sparql:example """[ sparql:regex ( "hello123" "[0-9]+" ) ]""" ; | |
shnex-sparql:example """[ sparql:regex ( "HeLLo123" "^hello" "i" ) ]""" ; |
sparql:day | ||
a sparql:Function ; | ||
rdfs:label "day"@en ; | ||
rdfs:comment "This function returns the day component of an xsd:dateTime or xsd:date."@en ; |
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.
rdfs:comment "This function returns the day component of an xsd:dateTime or xsd:date."@en ; | |
rdfs:comment "This function returns the day (0–31) component of an xsd:dateTime or xsd:date."@en ; |
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.
rdfs:comment "This function returns the day component of an xsd:dateTime or xsd:date."@en ; | |
rdfs:comment "This function returns the day (1-31) component of an xsd:dateTime or xsd:date."@en ; |
shouldn't it be 1-31 then?
sparql:month | ||
a sparql:Function ; | ||
rdfs:label "month"@en ; | ||
rdfs:comment "This function returns the month component of an xsd:dateTime or xsd:date."@en ; |
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.
rdfs:comment "This function returns the month component of an xsd:dateTime or xsd:date."@en ; | |
rdfs:comment "This function returns the month component (0–12) of an xsd:dateTime or xsd:date."@en ; |
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.
rdfs:comment "This function returns the month component of an xsd:dateTime or xsd:date."@en ; | |
rdfs:comment "This function returns the month component (1-12) of an xsd:dateTime or xsd:date."@en ; |
shouldn't it be 1-12 then?
sparql:seconds | ||
a sparql:Function ; | ||
rdfs:label "seconds"@en ; | ||
rdfs:comment "This function returns the second component (0–60, including leap seconds) of an xsd:dateTime value."@en ; |
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.
If this is "including leap seconds", the range must reach 61 (possibly higher; I do not know the maximum number of leap seconds that might be applied in any given year).
rdfs:comment "This function returns the second component (0–60, including leap seconds) of an xsd:dateTime value."@en ; | |
rdfs:comment "This function returns the second component (0–61, including leap seconds) of an xsd:dateTime value."@en ; |
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 counting from zero.
60
would be the leap second.
But xsd:dateTime
does not support leap seconds.
"a decimal number greater than or equal to 0 and less than 60."
Discussion: https://www.w3.org/TR/xmlschema11-2/#d-t-values
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.
in which case it should actually be:
rdfs:comment "This function returns the second component (0–60, including leap seconds) of an xsd:dateTime value."@en ; | |
rdfs:comment "This function returns the second (0–59) component of an xsd:dateTime value."@en ; |
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.
59.5
is legal.
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.
so [0,60)
then?
what about removing the value range altogether?
rdfs:comment "This function returns the second component (0–60, including leap seconds) of an xsd:dateTime value."@en ; | |
rdfs:comment "This function returns the seconds component of an xsd:dateTime value."@en ; |
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.
what about removing the value range altogether?
+1
s/second/seconds/ to reduce the ambiguity of "the second component of". |
Closes #455