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

SPARQL VALUES patterns #769

Merged
merged 87 commits into from
Jun 17, 2024
Merged

SPARQL VALUES patterns #769

merged 87 commits into from
Jun 17, 2024

Commits on Jun 12, 2024

  1. support VALUES patterns in where clause

    This is a basic implementation of the SPARQL VALUES pattern type.
    dpetran committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    e43302f View commit details
    Browse the repository at this point in the history
  2. support VALUES patterns in an order-agnostic way

    Three approaches considered:
    
    1) just document that :values needs to appear first
    2) discard solutions that don't match the given solution
    3) during the parse step, sort the patterns so :values is first
    
    I don't like #1, though that's the most expedient. #2 is a bit wasteful as it forces us
    to generate useless solutions. #3 is doable, and may be a minimal requirement in basic
    query planning.
    
    This implements solution #2.
    dpetran committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    91ae277 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    3336a27 View commit details
    Browse the repository at this point in the history
  4. correctly filter solutions across ledgers and with meta

    Change 1: handle multiple inline values correctly.
    
    Instead of checking that _every_ inline solution equal the solution matches, we needed
    to _filter_ the inline solutions by whether they match the solution. If any matches, the
    values can contribute their solutions to the solution chan.
    
    This case allows multiple values to be handled correctly, as seen in the "pattern"
    "single var" test.
    
    Change 2: do not consider ::sids while checking match equality
    
    When dealing with federated queries the ::sids map may be different for the same
    value. We now dissoc the ::sids key from the solution matches before checking equality.
    
    This is verified by the "federated" test case
    
    Change 3: only consider :lang ::meta while checking equality
    
    Two identical strings with different language tags are different values. However the :i
    order or whether it comes from a reasoned flake do not matter for equality checks. We
    now select only the :lang ::meta key, if ::meta exists in the solution match.
    
    Language tags were not parsed, so I've added parsing support for that.
    dpetran committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    703f3ff View commit details
    Browse the repository at this point in the history
  5. use public match api instead of removing unwanted match elements

    In the future the contents of a match may change, so instead of removing specific
    unwanted elements we now extract only those elements of a match that establish its
    identity for equality checking.
    dpetran committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    0dd8a2e View commit details
    Browse the repository at this point in the history
  6. correctly assign langString datatype to language tagged strings

    We were not parsing language tagged strings to langString datatypes correctly in where
    patterns or in values patterns, nor inferring a langString datatype in the presence of a
    language tag.
    
    I had to update the test expectation because now the language tagged string no longer
    conforms to the `sh:maxCount 1` _and_ the `sh:datatype xsd:string` constraints, instead of
    just the `sh:maxCount` constraint.
    dpetran committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    2a6b1fb View commit details
    Browse the repository at this point in the history
  7. add support for multiple values per var in VALUES pattern

    In SPARQL, a VALUES pattern can appear inside a WHERE clause alongside other
    patterns. In FQL :values is its own clause. This mismatch makes translating directly
    awkward, since we need to insert our translated pattern at a different point in the
    parse tree than where we are at translation time.
    
    We got around it by translating it into a :bind pattern. However, a :bind pattern can
    only bind a single value to a variable, so we limited the scope of a VALUES pattern to
    only a single value.
    
    This gets around it by "tagging" the translated value pattern and then after the whole
    parsing is done, moving it to the correct place in the tree: see `format-values`. It's
    awkward, but it gives much more flexibility to the user.
    dpetran committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    4790fc5 View commit details
    Browse the repository at this point in the history
  8. add support for VALUES patterns and VALUES clauses

    FQL now supports :values patterns so we can use that directly instead of translating to
    a :values clause.
    dpetran committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    e5e3e86 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    6e33a13 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    b116e6a View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    41fb5e9 View commit details
    Browse the repository at this point in the history
  12. remove useless thread macro

    dpetran committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    95914df View commit details
    Browse the repository at this point in the history
  13. handle Func translation on a case-by-case basis

    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.
    dpetran committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    6147559 View commit details
    Browse the repository at this point in the history
  14. add support for BOUND

    dpetran committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    37fd89f View commit details
    Browse the repository at this point in the history
  15. Add separate test for funcs

    JaceRockman authored and dpetran committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    7e27b8f View commit details
    Browse the repository at this point in the history
  16. Alphabetize the lists of funcs

    JaceRockman authored and dpetran committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    13fe3b7 View commit details
    Browse the repository at this point in the history
  17. add support for BNODE

    JaceRockman authored and dpetran committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    74900be View commit details
    Browse the repository at this point in the history
  18. add support for COALESCE

    JaceRockman authored and dpetran committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    acec6f6 View commit details
    Browse the repository at this point in the history
  19. fix implementation of BNODE

    JaceRockman authored and dpetran committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    4801e21 View commit details
    Browse the repository at this point in the history
  20. add support for CONTAINS

    JaceRockman authored and dpetran committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    9286d4c View commit details
    Browse the repository at this point in the history
  21. add support for DATATYPE

    JaceRockman authored and dpetran committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    e28e4a6 View commit details
    Browse the repository at this point in the history
  22. add support for DAY

    JaceRockman authored and dpetran committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    ecada24 View commit details
    Browse the repository at this point in the history
  23. add support for ENCODE_FOR_URI

    JaceRockman authored and dpetran committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    3219cbb View commit details
    Browse the repository at this point in the history
  24. add support for FLOOR

    JaceRockman authored and dpetran committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    276245e View commit details
    Browse the repository at this point in the history
  25. add support for HOURS

    JaceRockman authored and dpetran committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    c4cb06f View commit details
    Browse the repository at this point in the history
  26. add support for IF

    JaceRockman authored and dpetran committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    1c3bc19 View commit details
    Browse the repository at this point in the history
  27. add support for IRI

    JaceRockman authored and dpetran committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    a9db1e0 View commit details
    Browse the repository at this point in the history
  28. add support for LANG

    JaceRockman authored and dpetran committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    27d92e6 View commit details
    Browse the repository at this point in the history
  29. add support for LANGMATCHES

    JaceRockman authored and dpetran committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    0d33ea4 View commit details
    Browse the repository at this point in the history
  30. add support for LCASE

    JaceRockman authored and dpetran committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    96f02e7 View commit details
    Browse the repository at this point in the history
  31. add support for MD5

    JaceRockman authored and dpetran committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    3cee558 View commit details
    Browse the repository at this point in the history
  32. add support for MINUTES

    JaceRockman authored and dpetran committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    3035d03 View commit details
    Browse the repository at this point in the history
  33. add support for MONTH

    JaceRockman authored and dpetran committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    b35b1c2 View commit details
    Browse the repository at this point in the history
  34. add support for NOW

    JaceRockman authored and dpetran committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    c70a168 View commit details
    Browse the repository at this point in the history
  35. add support for RAND

    JaceRockman authored and dpetran committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    22ce5a1 View commit details
    Browse the repository at this point in the history
  36. add support for ROUND

    JaceRockman authored and dpetran committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    f44006c View commit details
    Browse the repository at this point in the history
  37. add support for SECONDS

    JaceRockman authored and dpetran committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    819545c View commit details
    Browse the repository at this point in the history
  38. add support for SHA1

    JaceRockman authored and dpetran committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    55820d0 View commit details
    Browse the repository at this point in the history
  39. add support for SHA256

    JaceRockman authored and dpetran committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    fe09d62 View commit details
    Browse the repository at this point in the history
  40. add tests for SHA512

    JaceRockman authored and dpetran committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    e7d9cb9 View commit details
    Browse the repository at this point in the history
  41. add support for STR

    JaceRockman authored and dpetran committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    3e55016 View commit details
    Browse the repository at this point in the history
  42. Configuration menu
    Copy the full SHA
    e38a748 View commit details
    Browse the repository at this point in the history
  43. add support for STRDT

    JaceRockman authored and dpetran committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    1a0e2f7 View commit details
    Browse the repository at this point in the history
  44. add support for STRENDS

    JaceRockman authored and dpetran committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    9fdaeb0 View commit details
    Browse the repository at this point in the history
  45. add support for STRLANG

    JaceRockman authored and dpetran committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    f594eff View commit details
    Browse the repository at this point in the history
  46. add support for STRLEN and STRENDS

    JaceRockman authored and dpetran committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    9851f94 View commit details
    Browse the repository at this point in the history
  47. add support for STRUUID

    JaceRockman authored and dpetran committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    b901f9e View commit details
    Browse the repository at this point in the history
  48. add support for TIMEZONE

    JaceRockman authored and dpetran committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    62b0825 View commit details
    Browse the repository at this point in the history
  49. add support for TZ

    JaceRockman authored and dpetran committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    05f97a0 View commit details
    Browse the repository at this point in the history
  50. add support for UCASE

    JaceRockman authored and dpetran committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    d0a2298 View commit details
    Browse the repository at this point in the history
  51. add support for URI

    JaceRockman authored and dpetran committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    0dac86c View commit details
    Browse the repository at this point in the history
  52. add support for UUID

    JaceRockman authored and dpetran committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    e167b66 View commit details
    Browse the repository at this point in the history
  53. add support for YEAR

    JaceRockman authored and dpetran committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    9d219e5 View commit details
    Browse the repository at this point in the history
  54. add support for isBLANK

    JaceRockman authored and dpetran committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    3b54bd6 View commit details
    Browse the repository at this point in the history
  55. add support for isIRI

    JaceRockman authored and dpetran committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    99f7880 View commit details
    Browse the repository at this point in the history
  56. add support for isLITERAL

    JaceRockman authored and dpetran committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    5a64bd7 View commit details
    Browse the repository at this point in the history
  57. add support for isNUMERIC

    JaceRockman authored and dpetran committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    6a084ba View commit details
    Browse the repository at this point in the history
  58. add support for isURI

    JaceRockman authored and dpetran committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    15ce3e7 View commit details
    Browse the repository at this point in the history
  59. add support for sameTerm

    JaceRockman authored and dpetran committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    e45471a View commit details
    Browse the repository at this point in the history
  60. support SPARQL literal datatype and language tags

    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.
    dpetran committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    595bcdf View commit details
    Browse the repository at this point in the history
  61. Configuration menu
    Copy the full SHA
    e6e1481 View commit details
    Browse the repository at this point in the history
  62. Configuration menu
    Copy the full SHA
    c842db3 View commit details
    Browse the repository at this point in the history
  63. Configuration menu
    Copy the full SHA
    f617b71 View commit details
    Browse the repository at this point in the history
  64. fix typo

    dpetran committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    26c7ac6 View commit details
    Browse the repository at this point in the history
  65. Configuration menu
    Copy the full SHA
    968aedd View commit details
    Browse the repository at this point in the history
  66. add support for FROM NAMED

    JaceRockman authored and dpetran committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    c47cd57 View commit details
    Browse the repository at this point in the history
  67. Configuration menu
    Copy the full SHA
    a521573 View commit details
    Browse the repository at this point in the history
  68. add support for GRAPH

    JaceRockman authored and dpetran committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    25c82b9 View commit details
    Browse the repository at this point in the history
  69. Configuration menu
    Copy the full SHA
    e38600a View commit details
    Browse the repository at this point in the history
  70. Configuration menu
    Copy the full SHA
    2a93cb7 View commit details
    Browse the repository at this point in the history
  71. Configuration menu
    Copy the full SHA
    fe03c44 View commit details
    Browse the repository at this point in the history
  72. Configuration menu
    Copy the full SHA
    8890937 View commit details
    Browse the repository at this point in the history
  73. allow SPARQL to use a as an alias for @type

    The grammar wasn't expecting whitespace between the 'a' and the prev/next term.
    dpetran committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    521d4c3 View commit details
    Browse the repository at this point in the history
  74. add support for in expression

    Semantics and syntax from SPARQL IN expression.
    dpetran committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    a00ebba View commit details
    Browse the repository at this point in the history
  75. rename sparql-in to in

    It's not sparql-specific, so no need to qualify it.
    dpetran committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    3311ab7 View commit details
    Browse the repository at this point in the history
  76. Configuration menu
    Copy the full SHA
    7844077 View commit details
    Browse the repository at this point in the history
  77. SPARQL IN support

    dpetran committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    662ff42 View commit details
    Browse the repository at this point in the history
  78. fix expression quoting

    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.
    dpetran committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    ec0915d View commit details
    Browse the repository at this point in the history
  79. SPARQL NOT IN support

    dpetran committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    d671a27 View commit details
    Browse the repository at this point in the history
  80. fix abs expression parsing

    abs expects only a single expression as an argument, and that argument does not need to
    be quoted.
    dpetran committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    0b715bf View commit details
    Browse the repository at this point in the history
  81. Configuration menu
    Copy the full SHA
    1a13d9c View commit details
    Browse the repository at this point in the history

Commits on Jun 17, 2024

  1. Merge pull request #797 from fluree/feature/sparql-in-not-in

    translate SPARQL IN/NOT IN expresssions into FQL
    dpetran authored Jun 17, 2024
    Configuration menu
    Copy the full SHA
    faf021f View commit details
    Browse the repository at this point in the history
  2. Merge pull request #796 from fluree/feature/sparql-exists-not-exists

    translate SPARQL EXISTS/NOT EXISTS filters into FQL
    dpetran authored Jun 17, 2024
    Configuration menu
    Copy the full SHA
    79565b8 View commit details
    Browse the repository at this point in the history
  3. Merge pull request #795 from fluree/feature/fql-in-not-in

    add support for `in` expression
    dpetran authored Jun 17, 2024
    Configuration menu
    Copy the full SHA
    4c13b1b View commit details
    Browse the repository at this point in the history
  4. Merge pull request #784 from fluree/feature/fql-exists-not-exists

    Feature/fql exists not exists
    dpetran authored Jun 17, 2024
    Configuration menu
    Copy the full SHA
    1f62042 View commit details
    Browse the repository at this point in the history
  5. Merge pull request #780 from fluree/feature/sparql-from-named

    Feature/sparql from named
    dpetran authored Jun 17, 2024
    Configuration menu
    Copy the full SHA
    2973fc1 View commit details
    Browse the repository at this point in the history
  6. Merge pull request #778 from fluree/feature/sparql-func

    Feature/sparql func
    dpetran authored Jun 17, 2024
    Configuration menu
    Copy the full SHA
    dee6c88 View commit details
    Browse the repository at this point in the history