buda-base / lds-pdi

http://purl.bdrc.io BDRC Linked Data Server
Apache License 2.0
2 stars 0 forks source link

support more rdf serializations on /graph requests #42

Closed eroux closed 6 years ago

eroux commented 6 years ago

Now when I run:

$ curl -v -XPOST -d '{"R_RES": "bdr:W22084"}' -H "Accept: text/turtle" -H "Content-Type: application/json" http://purl.bdrc.io/graph/IIIFPres_workGraph

I'm getting a strange result: the header of the response says it's ttl:

* upload completely sent off: 23 out of 23 bytes
< HTTP/1.1 200 OK
< Server: nginx/1.10.3
< Date: Thu, 15 Mar 2018 16:33:39 GMT
< Content-Type: text/turtle;charset=utf-8

while the content is clearly jsonld:

{
  "@id" : "bdr:W22084",
  "type" : "Work",
  "adm:access" : "bdr:AccessOpen",
  "adm:gitRevision" : "18844847bb96e7925ae4c9b19da924cf55386dc9",
  "adm:license" : "bdr:LicensePublicDomain",
  "adm:status" : "bdr:StatusReleased",
  "creatorEditor" : "bdr:P956",
  "itemBDRCHoldingStatement" : "1",
  "workCatalogInfo" : {
    "@language" : "en",
    "@value" : "Dege Kangyur. Facsimile of the parpud or 'first fruit' printing of the 1733 blocks, meaning it was pressed before later changes were made to the blocks. Produced under the patronage of the Dege King Tenpa Tsering. Chief editor was Palpung Tai Situ Chokyi Jungne in 1733. One of the first editions of the Tibetan canon to be widely distributed, and is almost universally praised for its clarity. Editors in India made numerous changes in preparation for this edition, printed 1976-1979."
  },
  "workCreator" : "bdr:P956",
  "workExtentStatement" : "103v.",
  "workHasItem" : [ "bdr:I22084", "bdr:I22084_P001" ],
  "workHasItemImageAsset" : "bdr:I22084"
MarcAgate commented 6 years ago

Fixed in commit e25ae2e - Supported Accept header values :

text/turtle application/n-triples application/n-quads text/trig=trig application/rdf+xml application/owl+xml application/ld+json application/rdf+thrift application/rdf+thrift application/json application/trix+xml

eroux commented 6 years ago

Reopening due to the wrong result of:

curl -XPOST -v -sSL 'http://purl.bdrc.io/graph/IIIFPres_itemGraph' -H 'Accept: text/turtle' -d '{"R_RES":"bdr:I22084"}'

which returns an error instead of ttl, and

curl -v -sSL 'http://purl.bdrc.io/graph/IIIFPres_itemGraph?R_RES=bdr:I22084' -H 'Accept: text/turtle'

which returns jsonld instead of ttl

eroux commented 6 years ago

(also, I won't close the issue unless some unit tests appear)

MarcAgate commented 6 years ago

There were two issues: 1) The conversion from mime types to jena MediaType was wrong and default was set to jsonld (error 2) 2) The graph service only accepts application/json contentType and it looks like curl has its default post contentType set to application/x-www-form-urlencoded. Therefore, the contentType must be set in the command line when it is different from the default.(error 1)

curl -v -sSL "http://purl.bdrc.io/graph/IIIFPres_itemGraph" -H "Accept: text/turtle" -H "Content-Type: application/json" -d '{"R_RES":"bdr:I22084"}'

Fixed as of commit ed49c34. Unit tests will soon follow.

eroux commented 6 years ago

Thanks! Can you update the version on ec2?