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

Apache Jena function apf:strSplit not working within the service clause #330

Closed
enridaga opened this issue Jan 20, 2023 · 4 comments
Closed
Assignees
Labels
Bug Something isn't working
Milestone

Comments

@enridaga
Copy link
Member

This issue emerged while tackling #329 -- it appears that moving the call outside the SERVICE clause fixed the problem.

See #329 (comment)

@enridaga enridaga added the Bug Something isn't working label Jan 20, 2023
@enridaga enridaga changed the title Apache Jena function apf:strSplit not working within SPARQL Anythig service clause Apache Jena function apf:strSplit not working within the service clause Jan 20, 2023
@enridaga
Copy link
Member Author

Does the FX executor register APF functions?

@luigi-asprino
Copy link
Member

My understanding of the thing is the following.
First of all, let me say that I don't fully understand what Jena does.
However, I was able to track the execution and I have a general idea of the workflow.
Suppose having this query

PREFIX  rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX  apf:  <http://jena.apache.org/ARQ/property#>

SELECT  ?a
WHERE
  { ?s    rdf:_1        ?o .
    ?a    apf:strSplit  ( ?o ";" )
  }

This translates in Algebra as

(project (?a)
  (bgp
    (triple ?s <http://www.w3.org/1999/02/22-rdf-syntax-ns#_1> ?o)
    (triple ?a <http://jena.apache.org/ARQ/property#strSplit> ??0)
    (triple ??0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> ?o)
    (triple ??0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> ??1)
    (triple ??1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> ";")
    (triple ??1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil>)
  ))

The Jena optimiser transforms the OpBGP into

(propfunc <http://jena.apache.org/ARQ/property#strSplit>
  ?a (?o ";")
  (bgp (triple ?s <http://www.w3.org/1999/02/22-rdf-syntax-ns#_1> ?o)))

via the TransformPropertyFunction.transform() method.
This does not seem to happen for the BGPs inside the SERVICE clause (perhaps because the optimisation of the operations is supposed to be the responsibility of the remote endpoint (?)).

As a result, to make the Apache Jena functions work inside the service clause we just need to transform the OpBGP at some point. This would turn the OpBGP into a OpPropFunc and will be evaluated as exepected.

@luigi-asprino
Copy link
Member

By the way, if the operations within the service are not optimised maybe the execution is not optimal.. maybe we could consider invoking the optimiser in FXOpExecutor.execute(OpService).

@enridaga
Copy link
Member Author

By the way, if the operations within the service are not optimised maybe the execution is not optimal.. maybe we could consider invoking the optimiser in FXOpExecutor.execute(OpService).

Excellent point; I am opening an issue for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants