31
STANFORD UNIVERSITY LIBRARIES Annotations as Linked Data with Fedora4 and Triannon (A Real Use Case for RDF!) C ODE 4L IB 2015 P ORTLAND , OR F EBRUARY 11 Rob Sanderson / [email protected] / @azaroth42 Naomi Dushay / [email protected]

Annotations as Linked Data with Fedora4 and Triannon

Embed Size (px)

Citation preview

Page 1: Annotations as Linked Data with Fedora4 and Triannon

STANFORD UNIVERSITY LIBRARIES

Annotations as Linked Data with Fedora4 and Triannon

(A Real Use Case for RDF!)

C O D E 4 L I B 2 0 1 5 P O R T L A N D , O R F E B R U A R Y 11

Rob Sanderson / [email protected] / @azaroth42 Naomi Dushay / [email protected]

Page 2: Annotations as Linked Data with Fedora4 and Triannon

STANFORD UNIVERSITY LIBRARIES

Annotations as Linked Data with Fedora4 and Triannon

(A Real Use Case for RDF!)

C O D E 4 L I B 2 0 1 5 P O R T L A N D , O R F E B R U A R Y 11

Rob Sanderson / [email protected] / @azaroth42 Naomi Dushay / [email protected]

Page 3: Annotations as Linked Data with Fedora4 and Triannon
Page 4: Annotations as Linked Data with Fedora4 and Triannon
Page 5: Annotations as Linked Data with Fedora4 and Triannon
Page 6: Annotations as Linked Data with Fedora4 and Triannon
Page 7: Annotations as Linked Data with Fedora4 and Triannon
Page 8: Annotations as Linked Data with Fedora4 and Triannon
Page 9: Annotations as Linked Data with Fedora4 and Triannon
Page 10: Annotations as Linked Data with Fedora4 and Triannon
Page 11: Annotations as Linked Data with Fedora4 and Triannon

Where are the Dragons? :(

Page 12: Annotations as Linked Data with Fedora4 and Triannon

Triannon: Putting the Dragons Back in Portland

since sometime last week Requirements: •  Create and manage tags/annotations in any client or environment •  Retrieve tags/annotations to display in any client •  With the identifiers of Works, not of catalog views Need: •  A model for annotations •  A format to serialize them into •  A protocol to transfer the serializations between systems •  Implementations!

Page 13: Annotations as Linked Data with Fedora4 and Triannon

JSON Annotation Format {! "@context": "http://www.w3.org/ns/oa-context-20130208.json",! "@id": "http://www.example.org/annotations/1",! "@type": "oa:Annotation”,! "motivatedBy":"oa:commenting",! "hasBody": {! "@type": "cnt:ContentAsText",! "chars": "Portland is somewhere here. Also Dragons",! "format": "text/plain"! },! "hasTarget": "http://purl.stanford.edu/bd136jk4522#xywh=..."!} !

Page 14: Annotations as Linked Data with Fedora4 and Triannon

JSON-LD Annotation Format {! "@context": "http://www.w3.org/ns/oa-context-20130208.json",! "@id": "http://www.example.org/annotations/1",! "@type": "oa:Annotation”,! "motivatedBy":"oa:commenting",! "hasBody": {! "@type": "cnt:ContentAsText",! "chars": "Portland is somewhere here. Also Dragons",! "format": "text/plain"! },! "hasTarget": "http://purl.stanford.edu/bd136jk4522#xywh=..."!} !

Page 15: Annotations as Linked Data with Fedora4 and Triannon

JSON-LD Annotation Format {! "@context": "http://www.w3.org/ns/oa-context-20130208.json",! "@id": "http://www.example.org/annotations/1",! "@type": "oa:Annotation”,! "motivatedBy":"oa:commenting",! "hasBody": {! "@type": "cnt:ContentAsText",! "chars": "Portland is somewhere here. Also Dragons",! "format": "text/plain"! },! "hasTarget": "http://purl.stanford.edu/bd136jk4522#xywh=..."!} !

Dirty not-so-secret time...

Page 16: Annotations as Linked Data with Fedora4 and Triannon

RDF Annotation Format {! "@context": "http://www.w3.org/ns/oa-context-20130208.json",! "@id": "http://www.example.org/annotations/1",! "@type": "oa:Annotation”,! "motivatedBy":"oa:commenting",! "hasBody": {! "@type": "cnt:ContentAsText",! "chars": "Portland is somewhere here. Also Dragons",! "format": "text/plain"! },! "hasTarget": "http://purl.stanford.edu/bd136jk4522#xywh=..."!} !

It's actually RDF, following the Open Annotation model

Page 17: Annotations as Linked Data with Fedora4 and Triannon

Open Annotation

http://www.openannotation.org/spec/core/

http://www.w3.org/TR/annotation-model/ (beta)

Page 18: Annotations as Linked Data with Fedora4 and Triannon

Annotation Management: LDP

Page 19: Annotations as Linked Data with Fedora4 and Triannon

Reality is More Complex

Page 20: Annotations as Linked Data with Fedora4 and Triannon

In Reality ...

•  Multiple resources to manage, each requires a POST •  Binary or external resources with descriptions tricky •  Multiple JSON-LD contexts complex (IIIF, OA, ...) Want: •  Ease of use/implementation for annotation client •  Ability to swap back-end to other LDP system •  Integration with Rails environment •  Search with Solr (easy) not SPARQL (less easy)

Page 21: Annotations as Linked Data with Fedora4 and Triannon

Triannon

Page 22: Annotations as Linked Data with Fedora4 and Triannon

Triannon plus Solr

Page 23: Annotations as Linked Data with Fedora4 and Triannon

Triannon: Implementation Goals

•  Rapid Development •  Modular •  Re-Usable •  Deployable •  Maintainable

Page 24: Annotations as Linked Data with Fedora4 and Triannon

Triannon: Rails Engine Gem

REST over HTTP Create POST jsonld, turtle, rdfxml Read GET " Update PUT/PATCH " Delete DELETE (id)

Model ActiveRecord ActiveModel LDP View (for apps and developers) jsonld, turtle, rdfxml Controller

http://github.com/sul-dlss/triannon

Page 25: Annotations as Linked Data with Fedora4 and Triannon
Page 26: Annotations as Linked Data with Fedora4 and Triannon

It’s the Graph, Baby!

Page 27: Annotations as Linked Data with Fedora4 and Triannon

Rails App (SearchWorks)

ActiveTriples

ld4l-open_annotation_rdf

triple store (in memory)

RDF

SearchWorks: Create, Update, Delete

Triannon

id

html form

jsonld from RDF::Graph

Page 28: Annotations as Linked Data with Fedora4 and Triannon

Client App: Search and Display

Triannon Solr Client App

http://triannon-solr/by_target?url=purl.stanford.edu\/bd136jk4522

'response'=>{'numFound'=>3,'start'=>0,'maxScore'=>1.0,'docs'=>[ { 'id'=>'98206ec8-4def-44b8-b190-648d8224ce1c’, 'anno_jsonld'=>'{"@context":"http://www.w3.org/ns/oa.jsonld","@graph":[{"@id":"_:g70038924372700","@type":["dctypes:Text","cnt:ContentAsText"], "format":"text/plain”,

"chars":"Portland is somewhere here. Also Dragons”},{"@id":"https://triannon-dev.stanford.edu/annotations/98206ec8-4def-44b8-b190-648d8224ce1c","@type":"oa:Annotation","hasBody":"_:g70038924372700","hasTarget":"http://purl.stanford.edu/bd136jk4522","motivatedBy":"oa:commenting"}]}',

...}, { 'id'=>'f691b921-6f54-415b-9dfb-0d017f0d8ada',

...

Page 29: Annotations as Linked Data with Fedora4 and Triannon

Rails App (SearchWorks)

ActiveTriples

ld4l-open_annotation_rdf

triple store (in memory)

RDF

SearchWorks: Read and Display •  Easy Access to Relevant Info from jsonld •  Rapid Development •  Modular •  Maintainable

Triannon Solr

jsonld as RDF::Graph

Search for annos

Page 30: Annotations as Linked Data with Fedora4 and Triannon

LDP API

Fedora 4Solr

CRUD

Search / Read CRUDCUD

Client Application

Client Application

Client Application

Triannon

Page 31: Annotations as Linked Data with Fedora4 and Triannon

STANFORD UNIVERSITY LIBRARIES

Thank You!

February 11th, 2015

[email protected] [email protected]