Page MenuHomePhabricator

Expose RDF according to Accept header
Closed, InvalidPublic

Description

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 https://www.wikidata.org/entity/Q445460 -H "Accept: text/turtle"

HTTP/2 303
content-type: text/html; charset=iso-8859-1
location: https://www.wikidata.org/wiki/Special:EntityData/Q445460
...

and/or

$ curl -I https://wikidata.org/wiki/Special:EntityData/Q445460 -H "Accept: text/turtle"

HTTP/2 301
content-type: text/html; charset=iso-8859-1
location: https://www.wikidata.org/wiki/Special:EntityData/Q445460
...

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

$ curl -I http://dbpedia.org/resource/Shantideva -H "Accept: text/turtle"

HTTP/1.1 303 See Other
Content-Type: text/turtle
...
Location: http://dbpedia.org/data/Shantideva.ttl
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

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

$ curl -s -L https://www.wikidata.org/entity/Q445460 -H "Accept: text/turtle"
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix wikibase: <http://wikiba.se/ontology-beta#> .
...
wdata:Q445460 a schema:Dataset ;
        schema:about wd:Q445460 ;
        cc:license <http://creativecommons.org/publicdomain/zero/1.0/> ;
        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!

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.