Skip to content

Fedora4 Structure and Sparql Examples

thomas edited this page Nov 18, 2016 · 11 revisions

#Install Blazegraph

  1. Blazegraph : https://superb-dca2.dl.sourceforge.net/project/bigdata/bigdata/2.1.1/blazegraph.jar
  2. java -server -Xmx4g -jar blazegraph.jar

#Document Objectives

  1. Explore core and external features
  2. Explore Fedora HTML UI
  3. Gain insight into content modeling (PCDM)
  4. Gain insight into interaction models (LDP)

#Fedora Vagrant Components

  1. Solr
  2. Triplestore
  • (Fuseki, Sesame)
    • Audit Service
    • SPARQL-Query
  1. F4
  2. LDP / WebAC?? / Memento??
  3. Apache Camel

Fedora 4 PCDM Modeling

Final result (structure)

  • ● cover/
    • ○ files/
      • ■ cover.jpg
      • ■ cover.tiff
  • ● book/
    • ○ members/
      • ■ coverProxy
        • ● favorites/
          • ○ members/
            • ■ bookProxy

Final result (relationships)

  • ● cover/
    • ○ pcdm:hasFile
      • ■ cover.jpg
      • ■ cover.tiff
  • ● book/
    • ○ pcdm:hasMember
      • ■ cover/
  • ● favorites/
    • ○ pcdm:hasMember
      • ■ book/

Final result (relationships)

  • pcdm:hasFile <cover.jpg>
  • pcdm:hasFile <cover.tiff>
  • pcdm:hasMember
  • pcdm:hasMember

SPARQL Create Queries

Create a “cover” Container

Make “cover” a pcdm:Object

PREFIX pcdm: <http://pcdm.org/models#>
INSERT {
    <http://localhost:8080/fcrepo/rest/cover>
    rdf:type
    pcdm:Object
}
WHERE { }

Make “cover” a pcdm:Object

PREFIX pcdm: <http://pcdm.org/models#>
INSERT { <> a pcdm:Object }
WHERE { }

Create “files” Container ...contained inside “cover”

Make “files” an ldp:DirectContainer

PREFIX ldp: <http://www.w3.org/ns/ldp#>
PREFIX pcdm: <http://pcdm.org/models#>
INSERT {
    </fcrepo/rest/cover/files/> rdf:type ldp:DirectContainer .
    <> rdf:type pcdm:Object .
    <> ldp:membershipResource </fcrepo/rest/cover/> .
    <> ldp:hasMemberRelation pcdm:hasFile .
}
WHERE { }

Make “files” an ldp:DirectContainer

PREFIX ldp: <http://www.w3.org/ns/ldp#>
PREFIX pcdm: <http://pcdm.org/models#>
INSERT {
   <> a ldp:DirectContainer, pcdm:Object ;
   ldp:membershipResource </fcrepo/rest/cover/> ;
   ldp:hasMemberRelation pcdm:hasFile .
}
WHERE { }

Create some cover binaries... contained inside “files”

  • cover.jpg
  • cover.tif
  • See auto-generated relationship on “cover”
  • Fixity

Create a “book” Container

Make “book” a pcdm:Object

PREFIX pcdm: <http://pcdm.org/models#>
INSERT { <> a pcdm:Object }
WHERE { }

Create a “members” Container...contained inside “book”

Make “members” an ldp:IndirectContainer

PREFIX ldp: <http://www.w3.org/ns/ldp#>
PREFIX pcdm: <http://pcdm.org/models#>
PREFIX ore: <http://www.openarchives.org/ore/terms/>
INSERT {
    <> a ldp:IndirectContainer, pcdm:Object ;
    ldp:membershipResource </fcrepo/rest/book/> ;
    ldp:hasMemberRelation pcdm:hasMember ;
    ldp:insertedContentRelation ore:proxyFor .
}
WHERE { }

Create a “coverProxy” Container...contained inside “members”

Make “coverProxy” proxy for...

PREFIX pcdm: <http://pcdm.org/models#>
PREFIX ore: <http://www.openarchives.org/ore/terms/>
INSERT {
   <> a pcdm:Object ;
   ore:proxyFor </fcrepo/rest/cover/> ;
   ore:proxyIn </fcrepo/rest/book/> .
}
WHERE { }

Create a “favorites” Container...Just like “book”, except a pcdm:Collection

Make “favorites” a pcdm:Collection

PREFIX pcdm: <http://pcdm.org/models#>
INSERT { <> a pcdm:Collection }
WHERE { }

Create a “members” Container...contained inside “favorites”

Make “members” an ldp:IndirectContainer

PREFIX ldp: <http://www.w3.org/ns/ldp#>
PREFIX pcdm: <http://pcdm.org/models#>
PREFIX ore: <http://www.openarchives.org/ore/terms/>
INSERT {
   <> a ldp:IndirectContainer, pcdm:Object ;
   ldp:membershipResource </fcrepo/rest/favorites/> ;
   ldp:hasMemberRelation pcdm:hasMember ;
   ldp:insertedContentRelation ore:proxyFor .
}
WHERE { }

Create a “bookProxy” Container...contained inside “members”

Make “bookProxy” proxy for...

PREFIX pcdm: <http://pcdm.org/models#>
PREFIX ore: <http://www.openarchives.org/ore/terms/>
INSERT {
   <> a pcdm:Object ;
   ore:proxyFor </fcrepo/rest/book/> ;
   ore:proxyIn </fcrepo/rest/favorites/> .
}
WHERE { }

Other Features

  • Versioning
  • Transactions
  • Transform
  • Authorization

SPARQL SEARCH Queries

Find Collections

prefix pcdm: <http://pcdm.org/models#>
select ?r where {
    ?r a pcdm:Collection
}

Find Resources with Members

prefix pcdm: <http://pcdm.org/models#>
select ?r ?m where {
   ?r pcdm:hasMember ?m
}

Find Resources with TIF files

prefix pcdm: <http://pcdm.org/models#>
prefix fedora: <http://fedora.info/definitions/v4/repository#>
prefix xsd: <http://www.w3.org/2001/XMLSchema#>
select ?r ?m ?f where {
    ?r pcdm:hasMember ?m .
    ?m pcdm:hasFile ?f .
    ?f fedora:mimeType "image/tiff"^^xsd:string
}

Find Resources with nested TIF files

prefix pcdm: <http://pcdm.org/models#>
prefix fedora: <http://fedora.info/definitions/v4/repository#>
prefix xsd: <http://www.w3.org/2001/XMLSchema#>
select ?r ?m ?f where {
    ?r pcdm:hasMember+ ?m .
    ?m pcdm:hasFile ?f .
    ?f fedora:mimeType "image/tiff"^^xsd:string
}

Find Binary larger than 1-MB

prefix premis: <http://www.loc.gov/premis/rdf/v1#>
prefix fedora: <http://fedora.info/definitions/v4/repository#>
select ?r ?s where {
   ?r a fedora:Binary .
   ?r premis:hasSize ?s .
FILTER (?s > 100000)
}
Clone this wiki locally