Skip to content

Instantly share code, notes, and snippets.

@naturzukunft
Last active May 22, 2021 17:20
Show Gist options
  • Save naturzukunft/ff1c7fd746904da3649d147dccdd6c7b to your computer and use it in GitHub Desktop.
Save naturzukunft/ff1c7fd746904da3649d147dccdd6c7b to your computer and use it in GitHub Desktop.
package org.linkedopenactors.code.transiscopeadapter;
import java.io.IOException;
import java.io.StringReader;
import java.io.StringWriter;
import org.eclipse.rdf4j.model.Model;
import org.eclipse.rdf4j.rio.RDFFormat;
import org.eclipse.rdf4j.rio.RDFParseException;
import org.eclipse.rdf4j.rio.Rio;
import org.eclipse.rdf4j.rio.UnsupportedRDFormatException;
import org.springframework.web.reactive.function.client.WebClient;
public class JsonLdParserBug {
public static void main(String[] args) throws RDFParseException, UnsupportedRDFormatException, IOException {
WebClient webClient = WebClient.builder().build();
String body = webClient.get().uri("https://presdecheznous.gogocarto.fr/api/elements.jsonld?limit=1")
.retrieve().bodyToMono(String.class).block();
StringReader sr = new StringReader(body);
Model model = Rio.parse(sr, RDFFormat.JSONLD);
// Model model = Rio.parse(sr, "http://example.org/base/uri/", RDFFormat.JSONLD);
StringWriter sw = new StringWriter();
Rio.write(model, sw, RDFFormat.TURTLE );
System.out.println("TURTLE: " + sw.toString());
}
}
{
"@context": "https://rawgit.com/jmvanel/rdf-convert/master/context-gogo.jsonld",
"@graph": [
{
"id": "AEP",
"name": "Ecole Montessori de Beaus\u00e9jour",
"geo": {
"latitude": -20.89299,
"longitude": 55.52815
},
"sourceKey": "Colibris",
"address": {
"streetAddress": "461, rue Pointe Allisard",
"addressLocality": "Sainte-marie",
"postalCode": "97438",
"addressCountry": "FR"
},
"createdAt": "2017-08-01T14:15:08+02:00",
"updatedAt": "2017-12-29T18:36:51+01:00",
"status": 1,
"categories": [
"\u00c9ducation et Formation",
"\u00c9cole",
"Maternelle",
"\u00c9l\u00e9mentaire"
],
"categoriesFull": [
{
"id": 578,
"name": "\u00c9ducation et Formation",
"description": null,
"index": 0
},
{
"id": 579,
"name": "\u00c9cole",
"description": null,
"index": 0
},
{
"id": 580,
"name": "Maternelle",
"description": null,
"index": 0
},
{
"id": 581,
"name": "\u00c9l\u00e9mentaire",
"description": null,
"index": 0
}
],
"website": "http:\/\/www.montesourire.com",
"commitment": "",
"description": "Fond\u00e9e par des enseignants et des parents, l'association Montesourire g\u00e8re l'\u00e9cole Montessori de Beaus\u00e9jour. Deux ambiances (3-6 \/ 6-11) permettent la formation et l'\u00e9ducation des jeunes bas\u00e9s sur la p\u00e9dagogie Montessori.",
"openhours_more_infos": "Lundi, Mardi, Jeudi et Vendredi : 8h30 - 16h30",
"email": "private"
}
]
}
@naturzukunft
Copy link
Author

This is the detail of that description: eclipse-rdf4j/rdf4j#3064

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment