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

PATCH requests with absolute in-domain URIs are not correctly mapped to resource graphs #386

Closed
acoburn opened this issue Apr 4, 2019 · 3 comments
Labels
area/http HTTP module bug
Milestone

Comments

@acoburn
Copy link
Member

acoburn commented Apr 4, 2019

Given a resource:

<> a ex:Foo ;
    dc:title "A title" .

The SPARQL-Update request to delete these triples only works with relative URIs:

DELETE DATA {
  <> dc:title "A title" .
}

With absolute URIs, the delete statement does not match the resource triples (and the triples are not removed). This is due to the fact that when the resource triples are loaded into a Graph in preparation for running the IOService::update operation, the triples are not first converted from their internal representation to an external representation and the context of the update query uses the internal IRI value (rather than the external resource URL).

@acoburn acoburn added bug area/http HTTP module labels Apr 4, 2019
@acoburn acoburn added this to the 0.9.0 Release milestone Apr 4, 2019
acoburn added a commit that referenced this issue Apr 4, 2019
Resolves #386

This also adds an integration test to check this behavior
acoburn added a commit that referenced this issue Apr 4, 2019
Resolves #386

This also adds an integration test to check this behavior
acoburn added a commit that referenced this issue Apr 5, 2019
@mjgiarlo
Copy link

@acoburn Related to this issue, if the root ACL resource looks like:

<http://platform:8080/#auth>
        acl:mode        acl:Read ;
        acl:mode        acl:Write ;
        acl:mode        acl:Control ;
        acl:agentClass  <http://xmlns.com/foaf/0.1/Agent> ;
        acl:accessTo    <http://platform:8080/> .

And I want to replace it with my own ACLs, I would think I could issue a PATCH request to http://myhost:myport/?ext=acl with the following SPARQL Update:

DELETE DATA {
     </#auth>
        acl:accessTo    </> ;
        acl:agentClass  <http://xmlns.com/foaf/0.1/Agent> ;
        acl:mode        acl:Control ;
        acl:mode        acl:Write ;
        acl:mode        acl:Read .
}

The response seems to succeed (returns a 204), but the graph is unaltered. Am I doing something obviously wrong or is this a bug? (I am rusty with SPARQL, fair warning.)

@acoburn
Copy link
Member Author

acoburn commented Apr 11, 2019

The SPARQL request that I'd use is this:

PREFIX acl: <http://www.w3.org/ns/auth/acl#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>

DELETE WHERE { ?s ?p ?o };
INSERT {
  </#my_auth>
        acl:accessTo    </> ;
        acl:agentClass  foaf:Agent ;
        acl:mode        acl:Control , acl:Write, acl:Read .
} WHERE {}

@mjgiarlo
Copy link

@acoburn That worked like a charm once I reworked the triples in the INSERT block to be ntriples rather than turtle. thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/http HTTP module bug
Projects
None yet
Development

No branches or pull requests

2 participants