Hi,

I'm implementing a Reader that extracts <script
type="application/ld+json"> from HTML and then uses JsonLDReader to
parse that data.

I've got a few questions in the process:

1. How does one obtain the default ParserProfile and ErrorHandler?
Currently I'm using

    ParserProfile profile =
RiotLib.profile(HtmlJsonLDReaderFactory.HTML, null,
ErrorHandlerFactory.getDefaultErrorHandler());

but internally the method it calls are all deprecated.

2. Can multiple StreamRDF be combined into one? There might be
multiple <script> elements and the reader should merge the data from
them. I attempted

    public void read(Reader in, String baseURI, Lang lang, StreamRDF
output, Context context)
    {
        ...
        for (Element element : jsonLdElements)
        {
            String jsonLd = element.data();
            getJsonLDReader().read(new StringReader(jsonLd), baseURI,
JSONLD.getContentType(), output, context);
        }
    }

but only the first element gets read, I guess because
getJsonLDReader().read() calls output.start()/output.finish().

Full Reader code:
https://github.com/AtomGraph/LinkedDataHub/blob/html-jsonld-reader/src/main/java/com/atomgraph/linkeddatahub/io/HtmlJsonLDReader.java#L73

Martynas

Reply via email to