sul-dlss-deprecated / triannon

Rails engine for working with storage of OpenAnnotations stored in Fedora4
Other
13 stars 1 forks source link

get rdf from the /annotations route (as json-ld, ttl, rdfxml, etc) #117

Closed dazza-codes closed 9 years ago

dazza-codes commented 9 years ago

Add content negotiation to get rdf from the /annotations route, i.e. https://github.com/sul-dlss/triannon/blob/master/app/controllers/triannon/annotations_controller.rb#L9-L12

The /annotations can be returned as a collection or list. An example that I'm familiar with is the list of all ontologies in bioportal, see http://data.bioontology.org/ontologies

Can we adopt the /annotation content negotiation to the /annotations collection, i.e. create a helper to do the content negotiation and use it for one annotation in /annotation and use it in an iteration for /annotations?

https://github.com/sul-dlss/triannon/blob/master/app/controllers/triannon/annotations_controller.rb#L14-L32

ndushay commented 9 years ago

When this is implemented:

ndushay commented 9 years ago

possibly superceded by #127

dazza-codes commented 9 years ago

Currently, /annotations responds with HTML, regardless of any Accept header request for RDF. (BTW, triannon has 'views' for HTML UIs, but I would never have developed it as anything more than a data API, using a simple sinatra app, and I raised this concern in the early days of developing it. Having said that, I have a lot to learn about rails engines and how triannon can be incorporated into a larger rails app.)

Perhaps I can take ownership of this issue, unless other priorities arise. At present, this is the only rspec test that fails for the triannon-client, not because the the client is doing anything wrong, per se, but it does expect to be able to negotiate for RDF media.

dazza-codes commented 9 years ago

Although triannon may not support them all, RDF::Format.content_types includes:

    # 'application/n-triples' =>  [RDF::NTriples::Format]
    # 'text/plain'            =>  [RDF::NTriples::Format]
    # 'application/n-quads'   =>  [RDF::NQuads::Format]
    # 'text/x-nquads'         =>  [RDF::NQuads::Format]
    # 'application/ld+json'   =>  [JSON::LD::Format]
    # 'application/x-ld+json' =>  [JSON::LD::Format]
    # 'application/rdf+json'  =>  [RDF::JSON::Format]
    # 'text/html'             =>  [RDF::RDFa::Format, RDF::RDFa::Lite, RDF::RDFa::HTML]
    # 'application/xhtml+xml' =>  [RDF::RDFa::XHTML]
    # 'image/svg+xml'         =>  [RDF::RDFa::SVG]
    # 'text/n3'               =>  [RDF::N3::Format, RDF::N3::Notation3]
    # 'text/rdf+n3'           =>  [RDF::N3::Format]
    # 'application/rdf+n3'    =>  [RDF::N3::Format]
    # 'application/rdf+xml'   =>  [RDF::RDFXML::Format, RDF::RDFXML::RDFFormat]
    # 'application/trig'      =>  [RDF::TriG::Format]
    # 'application/x-trig'    =>  [RDF::TriG::Format]
    # 'application/trix'      =>  [RDF::TriX::Format]
    # 'text/turtle'           =>  [RDF::Turtle::Format, RDF::Turtle::TTL]
    # 'text/rdf+turtle'       =>  [RDF::Turtle::Format]
    # 'application/turtle'    =>  [RDF::Turtle::Format]
    # 'application/x-turtle'  =>  [RDF::Turtle::Format]
ndushay commented 9 years ago

I'm well aware, Darren. When search is implemented, it will be a much better way to get a set of annos, including all the annos. Be patient. This is a known problem, in the queue and search part 1 will be done soon.

azaroth42 commented 9 years ago

Blocked by #154, and likely superseded by #127 anyway. Tagging as 1.0 but maybe close/wontfix

ndushay commented 9 years ago

This will be addressed by #154.