Hi Murick, it seems it doesn't recognize the file mimetype (it tries to parse it as RDF-NT instead than JSONLD). Try to rename the file using jsonld extension:
File myFile = new File(“input/file.jsonld."); Best Michele On 3 April 2015 at 03:09, Murick <mur...@gmail.com> wrote: > Hi Michele, > Thank you for recommendations. It helped a lot! Instead of manually > attaching .jar libraries, I started a Java maven project from the scratch. > I apologize for slow response. Everything was working fine until I tried to > convert JSONLD to N-Triples. I got the following error: > > > ExtractionContext(urn:x-any23:rdf-nt:root-extraction-result-id:file:/Users/murick/Development/Eclipse/RDF%20Converter/input/file_jsonld.txt) > Errors { > FATAL: 'Expected '<' or '_', found: {' (1,-1) > } > ------------ END Exception context ------------ > > *code* > > File myFile = new File(“input/file_jsonld.txt"); > Any23 runner = new Any23(); > > DocumentSource source = new FileDocumentSource(myFile); > ByteArrayOutputStream out = new ByteArrayOutputStream(); > TripleHandler writer = new NTriplesWriter(out); > try > { > runner.extract(source, writer); //HERE OCCURS ERROR > } > finally > { > writer.close(); > } > System.out.println(out.toString("UTF-8")); > > > *input file contents* > > { > "@context": { > "name": "http://xmlns.com/foaf/0.1/name", > "homepage": { > "@id": "http://xmlns.com/foaf/0.1/workplaceHomepage", > "@type": "@id" > }, > "Person": "http://xmlns.com/foaf/0.1/Person" > }, > "@id": "http://me.markus-lanthaler.com", > "@type": "Person", > "name": "Markus Lanthaler", > "homepage": "http://www.tugraz.at/" > } > > > *desired output* > > <http://me.markus-lanthaler.com> < > http://www.w3.org/1999/02/22-rdf-syntax-ns#type> < > http://xmlns.com/foaf/0.1/Person> . > <http://me.markus-lanthaler.com> <http://xmlns.com/foaf/0.1/name> "Markus > Lanthaler"^^<http://www.w3.org/2001/XMLSchema#string> . > <http://me.markus-lanthaler.com> < > http://xmlns.com/foaf/0.1/workplaceHomepage> <http://www.tugraz.at/> . > > > > However, the reverse process (N-Triples —> JSONLD) is working fine. Thank > you for your help! > > -- Michele Mostarda Senior Software Engineer skype: michele.mostarda twitter: micmos mail: m...@michelemostarda.com site: http://michelemostarda.it