SWE574-Groupago / heritago

A platform where anyone can share and learn about cultural heritages.
MIT License
9 stars 8 forks source link

endpoint /api/v1/heritages/{heritage_id}/annotations POST method supports certain formats #182

Closed fkucuk closed 7 years ago

fkucuk commented 7 years ago

While testing I've realized that annotation POST only works with the following format:


{  
   "context":"http://www.w3.org/ns/anno.jsonld",
   "annotation_id":"http://574heritago.com/annotations/null/",
   "type":"Annotation",
   "creator":"me",
   "body":[  
      {  
         "type":"video",
         "format":"text/plain",
         "value":"loved it"
      }
   ],
   "target":[  
      {  
         "type":"text",
         "format":"text/plain",
         "selector":[  
            {  
               "type":"FragmentSelector",
               "conformsTo":"http://tools.ietf.org/rfc/rfc5147",
               "value":"char=2,4"
            }
         ]
      }
   ]
}

for instance it does not support the following selector:

{
  "@context": "http://www.w3.org/ns/anno.jsonld",
  "id": "http://example.org/anno22",
  "type": "Annotation",
  "body": "http://example.org/note1",
  "target": {
    "source": "http://example.org/page1.html",
    "selector": {
      "type": "XPathSelector",
      "value": "/html/body/p[2]/table/tr[2]/td[3]/span"
    }
  }
}

To support defined formats the serializer has to be polymorphic.

fkucuk commented 7 years ago

we can (should) define body and target models as text.

fkucuk commented 7 years ago

talked to @TalatCikikci, it is okay with the first format.