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

apf: functions not working in SERVICE blocks (Testing 0.9-DEV.2) #421

Closed
EmidioStani opened this issue Nov 8, 2023 · 10 comments
Closed
Labels
Bug Something isn't working
Milestone

Comments

@EmidioStani
Copy link
Contributor

EmidioStani commented Nov 8, 2023

Hello,

I have been using Sparql Anything Server 0.8.2 successfully for some data integration/transformation with: https://github.com/SEMICeu/Taxonomy/blob/master/Entity_Legal_Form/SPARQL-query-for-ELF-v1.5.rq

Now I wanted to test version 0.9-DEV.2 as I have seen string distances have been implemented.
However, when I run the same query I have 0 result (expected many ) and on the command line I see the below log messages:

[qtp1632789609-19] ERROR io.github.sparqlanything.engine.PropertyExtractor - Neither location nor content provided
[qtp1632789609-19] WARN io.github.sparqlanything.engine.FXWorkerOpService - No triplifier found
[qtp1632789609-19] ERROR io.github.sparqlanything.engine.PropertyExtractor - Neither location nor content provided
[qtp1632789609-19] WARN io.github.sparqlanything.engine.FXWorkerOpService - No triplifier found
[qtp1632789609-19] WARN org.apache.jena.sparql.engine.iterator.QueryIteratorCheck - Open iterator: QueryIterRoot/0
[qtp1632789609-19] WARN org.apache.jena.sparql.engine.iterator.QueryIteratorCheck - Open iterator: QueryIterFilterExpr/16
[qtp1632789609-19] WARN org.apache.jena.sparql.engine.iterator.QueryIteratorCheck - Open iterator: QueryIterFilterExpr/22
[qtp1632789609-19] WARN org.apache.jena.sparql.engine.iterator.QueryIteratorCheck - Open iterator: QueryIterNullIterator/23
[qtp1632789609-19] WARN org.apache.jena.sparql.engine.iterator.QueryIteratorCheck - Open iterator: QueryIterAssign/24
[qtp1632789609-19] INFO org.apache.jena.fuseki.Fuseki - [1] 200 OK (2.579 s)
[qtp1632789609-19] INFO org.apache.jena.fuseki.Request - [0:0:0:0:0:0:0:1] - - [08/Nov/2023:18:00:28 +0000] "GET /sparql.anything" 200 - "http://localhost:3000/sparql" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36"

By the way, both show this error:
ERROR org.apache.jena.util.JenaXMLInput - Problem setting StAX property - name: "http://javax.xml.XMLConstants/property/accessExternalDTD" - value: "" - error: Unrecognized property 'http://javax.xml.XMLConstants/property/accessExternalDTD'

Is there something I should do ?

Thanks,

Emidio

@EmidioStani
Copy link
Contributor Author

EmidioStani commented Nov 9, 2023

I have investigated a bit, it seems related to the jena strSplit function I have used in my query:

# split abbreviations delimited via ; character
?abbrs apf:strSplit(?abbrList ";") .
BIND (IF(STRLEN(?abbrs) > 0, ?abbrs, 1/0) AS ?abbr) .
?abbrsTrans apf:strSplit(?abbrListTrans ";") .
BIND (IF(STRLEN(?abbrsTrans) > 0, ?abbrsTrans, 1/0) AS ?abbrTrans) .

If I remove this part of query, it works. Are apf functions still supported via Sparql Anything ? If not, what alternative exist to split a string ?

@justin2004
Copy link
Contributor

justin2004 commented Nov 9, 2023

@EmidioStani i believe you need to reference apf:strSplit outside of the sparql anything service clause. e.g.

select * where {
{service <x-sparql-anything:> { ... }}
{ ?abbrsTrans apf:strSplit(?abbrListTrans ";") }
...

@EmidioStani
Copy link
Contributor Author

Hello @justin2004 , as you can see:

https://github.com/SEMICeu/Taxonomy/blob/master/Entity_Legal_Form/SPARQL-query-for-ELF-v1.5.rq#L102

it is outside, it is on the WHERE block, and it works on 0.8.2 but it doesn't work on 0.9-DEV.2

@enridaga
Copy link
Member

Thanks for testing the current build, we knew there was an issue with apf functions inside the service block (#330) but now, apparently, this has scaled up. There have been quite a few changes in the way the system handles the execution; we need to figure this out before the next release.

@luigi-asprino
Copy link
Member

Hi,

The problem is here

if (this.execCxt.getClass() == FacadeXExecutionContext.class) {

The apf:strSplit is outside the service clause and is not encapsulated in FacadeXExecutionContext and will not be executed!
My fault.. will fix it in a moment.

@enridaga
Copy link
Member

Do you think the fix will also address #330?

@enridaga enridaga added this to the v0.9.0 milestone Nov 13, 2023
@luigi-asprino luigi-asprino reopened this Nov 13, 2023
@luigi-asprino
Copy link
Member

luigi-asprino commented Nov 13, 2023

I re-open the issue because I didn't know that the Fix #<number of issue> in the commit message closes the issue automatically.
@EmidioStani, I think that you should be able to use apf functions outside the service clauses.
I reproduced the issue with this query

PREFIX fx: <http://sparql.xyz/facade-x/ns/>
PREFIX xyz: <http://sparql.xyz/facade-x/data/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX apf: <http://jena.apache.org/ARQ/property#>
SELECT ?a WHERE {
    SERVICE <x-sparql-anything:> {
            fx:properties fx:content "abc;cde" .
            ?s rdf:_1 ?o
    }
    ?a apf:strSplit(?o ";") .
}

Let us know if it works.

Do you think the fix will also address #330?

@enridaga, let me investigate a little bit more.

@enridaga
Copy link
Member

@EmidioStani
Copy link
Contributor Author

Hello @luigi-asprino and @enridaga ,

I tested the same query with version 0.9-DEV.3 and it works, thanks for your work

@luigi-asprino
Copy link
Member

Great! I think we can close this now.

@enridaga enridaga changed the title Testing 0.9-DEV.2 apf: functions not working in SERVICE blocks (Testing 0.9-DEV.2) Dec 6, 2023
@enridaga enridaga added the Bug Something isn't working label Dec 6, 2023
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

4 participants