I want to extract RDF from an API and I use jsonld with javascript to do it. The json from the API look like this :
"datasetid": "etat-des-stations-le-velo-star-en-temps-reel",
"recordid": "88a8871cd455b991aae541e2d60ebdab34840e3e",
"fields": {
"etat": "En fonctionnement",
"lastupdate": "2021-03-19T17:33:18+00:00",
"nombrevelosdisponibles": 6,
"nombreemplacementsactuels": 16,
"nom": "Musée Beaux-Arts",
"nombreemplacementsdisponibles": 10,
"idstation": "5510",
"coordonnees": [
48.109601,
-1.67408
]
},
"geometry": {
"type": "Point",
"coordinates": [
-1.67408,
48.109601
]
},
"record_timestamp": "2021-03-19T17:33:00+00:00"
}
and I have defined this context:
const context_bike = {
"@vocab": "http://schema.org/",
"@base": "http://data.org/",
"geometry":null,
"datasetid":null,
"recordid":null,
"record_timestamp":null,
"field": "@nest",
"idstation": "@id",
"coordonnees":"???",
"nombreemplacementsdisponibles":{"@id":"AvailableSpaceNumber", "@type":"xsd:integer"},
"nom": {"@id":"name", "@type":"xsd:string"},
"nombrevelosdisponibles": {"@id":"AvailableBikeNumber", "@type":"xsd:integer"},
"lastupdate":{"@id":"lastupdate", "@type":"xsd:dateTime"},
"state":{"@id":"etat", "@type":"xsd:string"}
}
I just have a problem to extract data from "coordonnees". I would like to have a property lat and another long which correspond to the first and second element of the "coordonnees" array.
How can I do this ? And I also see in other example the definition of the word "@context", do i have to add it ? I juste added "@vocab" and when i add "@context" it create weird n triple and even the null properties are defined.
Thanks!
You probably want to have a look at Geo JSON-LD (http://geojson.org/geojson-ld/) for describing coordinates using lists. You could then use SPARQL (or GeoSPARQL) to get lat/long into properties.