Documentation: Question about SPARQL queries with CLAW media as subjects....

Created on 29 Oct 2018  路  7Comments  路  Source: Islandora/documentation

When I run curl -v "http://localhost:8000/media/403?_format=jsonld" I get back a JSON-LD graph containing all the properties Fedora knows about "http://localhost:8000/media/403". When I query Blazegraph for all properties of that subject:

SELECT ?s ?p ?o
WHERE 
{
   <http://localhost:8000/media/403> ?p ?o .
}

I get nothing back. Is my SPARQL wrong?

What I am specifically interested in is getting the Fedora URI of the file associated with http://localhost:8000/media/403. In other words, I know the media URI in Drupal, but I want to query the binary resource in Fedora. In this case, to do a fixity check on it. The JSON-LD graph retured by Drupal contains "http:\/\/schema.org\/sameAs":[{"@value":"http:\/\/localhost:8000\/_flysystem\/fedora\/masters\/testing_7_OBJ.jpg"}]}, which provides me with what I want in Drupal, but I want the value from Fedora (which I am hoping to get from Blazegraph).

question

Most helpful comment

Closing this for now, but it would be good to have an overview of how to query the triplestore. Maybe an idea for a sprint or a hackdoc topic?

All 7 comments

Not sure if directly related but @mjordan since Blazegraph has named graphs, and i'm guessing some work has happened on that front, maybe you need to point to the correct namespace where Drupal URIs are being indexed as subjects/objects of triples. See https://github.com/Islandora-CLAW/CLAW/issues/805

Thanks @DiegoPino. I retried my query using FROM both graphs and it still returns 0 results.

So first, I don't know if there is a direct linkage between URIs in Fedora and URIs in Drupal in the triplestore. You might want to use Gemini to covert URIs.

As for the query if there is for sure data in the system I would guess that the problem is ?s is not defined in your query, I think something using VALUES might work

SELECT ?s ?p ?o
WHERE 
{
   VALUES ?s { <http://localhost:8000/media/403> }
   ?s ?p ?o .
}

@whikloj Gemini does exactly what I am looking for. I'll leave the SPARQL for another day. (BTW thanks for the suggestion about VALUES but I'm still getting 0 results; I assume that the subject exists but that's just an assumption.)

Using examples at https://github.com/Islandora-CLAW/Crayfish/tree/master/Gemini, I'm not getting very far though. curl http://localhost:8282/drupal/media/403 gets me a Connection reset by peer error. Is there some authentication header I need to be passing? 8282 being the port assigned to Islandora Microservices in the active Vagrantfile. May be a question for @dannylamb since he's listed as maintainer.... I'll ping him in IRC.

Sorry about the outdated documentation @mjordan. For posterity outside of IRC, Gemini urls are at localhost:8000/gemini/{uuid}

Also, how you put the Drupal URL in RDF is configurable. It defaults to schema:sameAs. See admin/structure/context/repository_content. There's a context reaction called "Map Uri To Predicate" that lets you put in your own predicate if you want.

But in the long run we gotta figure out how we're gonna use named graphs, because I think that's the best solution (and opens up other possibilities).

@dannylamb no sweat, I'm reverse engineering the Gemini code so I can update the README :smile:.

Closing this for now, but it would be good to have an overview of how to query the triplestore. Maybe an idea for a sprint or a hackdoc topic?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

acoburn picture acoburn  路  4Comments

dannylamb picture dannylamb  路  5Comments

jonathangreen picture jonathangreen  路  3Comments

dannylamb picture dannylamb  路  4Comments

ruebot picture ruebot  路  4Comments