Page MenuHomePhabricator

Expose RDF according to Accept header
Closed, InvalidPublic


It would be quite useful for me to get the RDF representation of an entity when doing an http request with Accept: header set to an RDF serialization. For instance:

$ curl -I -H "Accept: text/turtle"

HTTP/2 303
content-type: text/html; charset=iso-8859-1


$ curl -I -H "Accept: text/turtle"

HTTP/2 301
content-type: text/html; charset=iso-8859-1

Should return RDF or a link to the .ttl URL. For comparison, DBPedia does that:

$ curl -I -H "Accept: text/turtle"

HTTP/1.1 303 See Other
Content-Type: text/turtle
Alternates: {"/data/Shantideva.atom" 0.500000 {type application/atom+xml}}, {"/data/Shantideva.jrdf" 0.600000 {type application/rdf+json}}, {"/data/Shantideva.jsod" 0.500000 {type application/odata+json}}, {"/data/Shantideva.json" 0.600000 {type application/json}}, {"/data/Shantideva.jsonld" 0.500000 {type application/ld+json}}, {"/data/Shantideva.n3" 0.800000 {type text/n3}}, {"/data/Shantideva.nt" 0.800000 {type text/rdf+n3}}, {"/data/Shantideva.ntriples" 0.500000 {type application/n-triples}}, {"/data/Shantideva.ttl" 0.700000 {type text/turtle}}, {"/data/Shantideva.xml" 0.950000 {type application/rdf+xml}}

Event Timeline

Eroux108 created this task.May 29 2018, 2:37 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMay 29 2018, 2:37 PM

I don’t understand what this task is about, sorry… if you follow the redirects, you should get TTL:

$ curl -s -L -H "Accept: text/turtle"
@prefix rdf: <> .
@prefix xsd: <> .
@prefix rdfs: <> .
@prefix owl: <> .
@prefix wikibase: <> .
wdata:Q445460 a schema:Dataset ;
        schema:about wd:Q445460 ;
        cc:license <> ;
        schema:softwareVersion "0.1.0" ;
        schema:version "685786031"^^xsd:integer ;
        schema:dateModified "2018-05-27T15:19:55Z"^^xsd:dateTime ;

The redirect target is already in the snippets you posted – /entity/Q… redirects to /wiki/Special:EntityData/Q…, which does content negotiation and redirects you (with this Accept header) to /wiki/Special:EntityData/Q….ttl. See also Wikidata:Data access#Linked Data interface.

Thanks, my mistake was to forget the www.... sorry for the annoyance, thanks for the great software!

Eroux108 closed this task as Invalid.May 29 2018, 3:37 PM
Vvjjkkii renamed this task from Expose RDF according to Accept header to y2baaaaaaa.Jul 1 2018, 1:07 AM
Vvjjkkii reopened this task as Open.
Vvjjkkii triaged this task as High priority.
Vvjjkkii updated the task description. (Show Details)
Vvjjkkii removed a subscriber: Aklapper.
CommunityTechBot renamed this task from y2baaaaaaa to Expose RDF according to Accept header.Jul 2 2018, 3:25 PM
CommunityTechBot closed this task as Invalid.
CommunityTechBot raised the priority of this task from High to Needs Triage.
CommunityTechBot updated the task description. (Show Details)
CommunityTechBot added a subscriber: Aklapper.