Hi Håvard,

That's not what should happen!

Could you turn that into a complete, minimal example and create a JIRA please?

        Andy

On 07/01/16 09:09, Håvard Mikkelsen Ottestad wrote:
Hi Andy,

I tried the QueryBuilder, but it doesn’t work for update queries.

The UpdateTransformOps looks good, however it seems to be removing a filter 
from my query. The filter is used to stop stop duplicate usernames.

##############
### BEFORE ###
##############


PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX : <http://example.com/metadata/>

INSERT {
        GRAPH <http://example.com/usersGraph/> {
                <http://example.com/user_930cd3ca-aae0-4201-8af4-c7af00b1e2cd> 
foaf:accountName ?username .
                <http://example.com/user_930cd3ca-aae0-4201-8af4-c7af00b1e2cd> 
:role ?role .
                <http://example.com/user_930cd3ca-aae0-4201-8af4-c7af00b1e2cd> 
:password ?password .
                <http://example.com/user_930cd3ca-aae0-4201-8af4-c7af00b1e2cd> 
<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> :User .
        }
}
WHERE{
        FILTER ( ! EXISTS { ?a foaf:accountName ?username } ) #### THIS FILTER 
GETS REMOVED WHEN I TRANSFORM
}




#############
### AFTER ###
#############

PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX : <http://example.com/metadata/>

INSERT {
        GRAPH <http://example.com/usersGraph/> {
                <http://example.com/user_930cd3ca-aae0-4201-8af4-c7af00b1e2cd> 
foaf:accountName "testUserName" .
                <http://example.com/user_930cd3ca-aae0-4201-8af4-c7af00b1e2cd> :role 
"" .
                <http://example.com/user_930cd3ca-aae0-4201-8af4-c7af00b1e2cd> :password 
"" .
                <http://example.com/user_930cd3ca-aae0-4201-8af4-c7af00b1e2cd> 
<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> :User .
        }
}
WHERE
{} #### THE FILTER HERE IS MISSING !!!




Håvard




On 06/01/16 20:18, "Andy Seaborne" <a...@apache.org> wrote:

Is it possible to do something similar when running these queries against 
Fuseki over HTTP?

Håvard,

What is the starting point? A string as the template or an
already-parsed query or update? Or building the  structure each time?

1:: If it is a string,  parameterized sparql strings are the way to go
and it protects against injected strings for

2:: There is also the QueryBuilder
https://jena.apache.org/documentation/extras/querybuilder/
that Claude can talk about.

Last time we had a discussion about this
http://mail-archives.apache.org/mod_mbox/jena-dev/201506.mbox/%3C558FC784.9060407%40apache.org%3E

3:: I put in the machinery for syntax rewriting: it does not have a
QuerySolution based interface:

UpdateTransformOps / QueryTransformOps

It would be good to know the details here of your use case: do you only
want to inject values for specific parameters, not partial patterns?

It would help use further understand the different alternatives and
workflows.

        Andy


Reply via email to