Share you sparql queries or best sparql resources for Fedora.

412 views
Skip to first unread message

Jennifer Eustis

unread,
Aug 3, 2016, 8:56:53 AM8/3/16
to islandora
Hi folks,

I just began learning sparql. I've found some resources on the Duraspace wiki and a couple of other places but not much to tell you the truth. I thought it would be great if people were willing to share their favorite resources for sparql recipes for Fedora or their favorite queries. This information can be added to the Islandora Metadata IG wiki or another wiki as a easy to access references. When sharing, don't forget to add what your query is supposed to do and which version of Fedora.

Best,
Jennifer
Message has been deleted

Phil R

unread,
Aug 3, 2016, 9:16:06 AM8/3/16
to islandora
Here's my list of collected sparql queries using the fedora resource index query service. Works for Fedora 3.6.2:

Get all fedora objects

SELECT ?obj 
FROM <#ri>
WHERE {
?obj <info:fedora/fedora-system:def/model#hasModel> <info:fedora/fedora-system:FedoraObject-3.0> .
}

Get all datastreams

SELECT ?obj ?ds
FROM <#ri>
WHERE {
?obj <info:fedora/fedora-system:def/view#disseminates> ?ds .
}

Get all BookCModel collection objects

SELECT ?object
WHERE {
  ?object <fedora-model:hasModel> <info:fedora/islandora:bookCModel> .
}

Get all members of a collection

SELECT *
FROM <#ri>
WHERE {
?o <fedora-rels-ext:isMemberOfCollection> <info:fedora/PID> ;
}

And using the api

Count all islandora:pageCModel objects

Jennifer Eustis

unread,
Aug 3, 2016, 11:10:29 AM8/3/16
to islandora
Thanks Phil.

Here's one of my test ones to get a particular list of pids and labels by ownerId
PREFIX fedora-model: <info:fedora/fedora-system:def/model#>
PREFIX fedora-view: <info:fedora/fedora-system:def/view#>

SELECT ?pid ?label ?ownerId
WHERE
{
?pid fedora-model:label ?label;
     fedora-model:ownerId ?ownerId .
FILTER(regex(?ownerId, "jeustis")) .
}
LIMIT 500 

Ernie Gillis

unread,
Aug 4, 2016, 8:30:17 AM8/4/16
to islandora
I have a couple of queries I can post when I'm at my desk at work.
In mean time, I'm curious which links you found useful in documentation, Jennifer. You mention the wiki, and such, but would you mind linking to them? Thank you!! :)

Jennifer Eustis

unread,
Aug 4, 2016, 3:28:57 PM8/4/16
to islandora
Great point Ernie...

Here's what I found:


There are tons of resources on sparql but my searches that pertain to Fedora and in particular version 3.7 came up rather short.

Jennifer
Reply all
Reply to author
Forward
0 new messages