On 2018/08/03 10:10:34, Andy Seaborne <a...@apache.org> wrote: 
> 
> 
> On 02/08/18 22:17, didac.montero.men...@gmail.com wrote:
> > I'm converting a JSON-LD input to RDF using Jena:
> > 
> > Model m = ModelFactory.createDefaultModel;
> > String str_reader = new StringReader(json.noSpaces)
> > RDFDataMgr.read(m, str_reader, "", RDFFormat.JSONLD.getLang)
>                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> Lang.JSONLD
> 
> > I want to be able to have a custom serializer for String Literals. My end 
> > goal is to convert a plain String literal to a xsd:date or xsd:dateTime 
> > Literal whenever a desired format is found.
> 
> Look at StreamRDF and RDFDataMgr.parse
> (or build your parser for more control with RDFParser.create())
> 
> All parsers send their output to a output to a StreamRDF.
> 
> RDFDataMgr.read uses a StreamRDF that puts triples/quads into a graph.
> 
> 
> StreamRDFs combine so you can build a pipeline
> 
> Parser -> convert strings -> store in graph.
> 
> Streams as well so works for large data if the syntax streams (JSON-LD 
> does not).
> 
> > I know this is handled by jsonld-java which in turn relies on jackson. Is 
> > there anyone who can give me a hint on how to add this type of custom 
> > serialization?
> 
> Jackson is the JSON parser.
> 
> jsonld-java is the JSON-LD algorithms.
> 
> What you seem to want is triple processing and be syntax agnostic.
> 
>      Andy
> 
Thanks for your reply. That's informative. I see that I can use 
RDFParser.create() to customize the StreamRDF (using 
RDFParser.create().parse(stream)). 

Since I want triple processing...is extending the StreamRDFBase and overriding 
the method `public void triple(Triple triple)` an option? Is it the best option?

Reply via email to