freme-project / Broker

FREME Broker
Apache License 2.0
2 stars 0 forks source link

Pipelining - How to change the outformat to json-ld? #134

Closed x-fran closed 9 years ago

x-fran commented 9 years ago

I already tried the following but I'm getting a error.

{
  "timestamp": 1446829686371,
  "message": "Error parsing NIF input",
  "error": "Bad Request",
  "status": 400,
  "exception": "eu.freme.broker.exception.BadRequestException",
  "path": "//e-terminology/tilde"
}

This is the json I used in the body request. I just added "outformat": "json-ld" but seems to not be the right way to do it.

[
{
  "method": "POST",
  "endpoint": "http://api.freme-project.eu/current/e-entity/freme-ner/documents",
  "parameters": {
    "dataset": "dbpedia",
    "language": "en",
    "outformat": "json-ld"
  },
  "headers": {
    "content-type": "text/plain",
    "accept": "text/turtle"
  },
  "body": "Madrid is home to two world-famous football clubs, Real Madrid and Atlético de Madrid."
},
{
  "method": "POST",
  "endpoint": "http://api.freme-project.eu/current/e-terminology/tilde",
  "parameters": {
    "source-lang": "en",
    "target-lang": "es",
    "outformat": "json-ld"
  },
  "headers": {
    "content-type": "text/turtle",
    "accept": "text/turtle"
  }
}
]

I need somehow to have the response in json-ld format. Thank you in advance for your help.

andish commented 9 years ago

You have to choose one of following: 1) query parameters informat and outformat 2) headers content-type and accept. Not both to avoid misunderstandings (query parameters are stronger).

So you are doing so: 1) sent plaintext to e-entity ("content-type": "text/plain") 2) asked from e-entity and got json-ld ("outformat": "json-ld") 3) sent to e-terminology turtle ( "content-type": "text/turtle",) ,but content actualy was json-ld from e-entity <-- here is the errror 4) asked json-ld from e-terminology("outformat": "json-ld")

One variation with query parameters would be:

[
{
  "method": "POST",
  "endpoint": "http://api.freme-project.eu/current/e-entity/freme-ner/documents",
  "parameters": {
    "dataset": "dbpedia",
    "language": "en",
    "outformat": "json-ld",
    "informat": "text"
  },
  "body": "Madrid is home to two world-famous football clubs, Real Madrid and Atlético de Madrid."
},
{
  "method": "POST",
  "endpoint": "http://api.freme-project.eu/current/e-terminology/tilde",
  "parameters": {
    "source-lang": "en",
    "target-lang": "es",
    "outformat": "json-ld",
    "informat": "json-ld"
  }
}
]
x-fran commented 9 years ago

I believe I already tried that and didn't worked I'm on my phone so I cannot test it but surely I sent some wrong parameters in that case also. Anyway thank you for your help.