1

I am working in a Android App and I have to connect with a API which return a JSON-LD, but I have not idea how I can parse the response. Which libraries I have to use for this? I have been reading about RDF, but it is not clear to me. Could somebody help me, please?

I enclose the API response.

{
  "@context": {
    "c": "http://www.w3.org/2002/12/cal#",
    "dcterms": "http://purl.org/dc/terms/",
    "geo": "http://www.w3.org/2003/01/geo/wgs84_pos#",
    "loc": "http://purl.org/ctic/infraestructuras/localizacion#",
    "org": "http://purl.org/ctic/infraestructuras/organizacion#",
    "vcard": "http://www.w3.org/2006/vcard/ns#",
    "title": "vcard:fn",
    "id": "dcterms:identifier",
    "relation": "dcterms:relation",
    "references": "dcterms:references",
    "address": "vcard:adr",
    "area": "loc:barrio",
    "district": "loc:distrito",
    "locality": "vcard:locality",
    "postal-code": "vcard:postal-code",
    "street": "vcard:street-address",
    "location": "vcard:geo",
    "latitude": "geo:lat",
    "longitude": "geo:long",
    "organization": "vcard:org",
    "organization-desc": "dcterms:description",
    "accesibility": "org:accesibilidad",
    "services": "org:servicios",
    "schedule": "org:horario",
    "organization-name": "vcard:organization-name",
    "description": "c:summary",
    "link": "c:url",
    "uid": "c:uid",
    "dtstart": "c:dtstart",
    "dtend": "c:dtend",
    "excluded-days": "c:exdate",
    "event-location": "c:location",
    "price": "c:resource",
    "recurrence": "c:rrule",
    "days": "c:byday",
    "frequency": "c:freq",
    "interval": "c:interval",
    "audience": "dc:audience"
  },
  "@graph": [
    {
      "@id": "https://datos.madrid.es/egob/catalogo/tipo/evento/11019983-33-certamen-coreografico-madrid.json",
      "title": "33º Certamen Coreográfico de Madrid",
      "location": {
        "latitude": 40.42802889001877,
        "longitude": -3.710182353581842
      }
    },
    {
      "@id": "https://datos.madrid.es/egob/catalogo/tipo/evento/11034478-70-aniversario-radio-inter-pensando-siempre-ti.json",
      "title": "70 Aniversario Radio Inter. Pensando siempre en ti",
      "location": {
        "latitude": 40.43371190964793,
        "longitude": -3.7104543597957758
      }
    }
Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
  • did you check this library: https://github.com/jsonld-java/jsonld-java ? – dardan.g Oct 29 '19 at 13:22
  • Yes, but how Can I add the dependency in the build gradle in Android ? @dardan.gjinovci – Carlos García Gaitán Oct 29 '19 at 13:24
  • Clone it: `git clone ...`, then Import as Project in Android Studio or: https://stackoverflow.com/questions/22791150/how-do-you-import-an-eclipse-project-into-android-studio-now Good luck – dardan.g Oct 29 '19 at 13:37
  • But, this project is not an Android project, it is a Java Maven project. I want to know if it is possible to use JSON-LD in Android project. And what I have to include in the build gradle. Thank @dardan.gjinovci – Carlos García Gaitán Oct 29 '19 at 14:01
  • You were right, here is a forked version: https://github.com/dgjinovci/jsonld-java You can build in AndroidStudio and copy `core/build/outputs/aar/core.aar` to your libs project – dardan.g Oct 29 '19 at 14:59

0 Answers0