Package org.semarglproject.source

Examples of org.semarglproject.source.StreamProcessor


        XdmNode doc = source.read();

        try {
            Sink sink = new Sink();
            StreamProcessor sp = new StreamProcessor(RdfaParser.connect(sink));

            // HACK!!!
            // FIXME: set serializer properties appropriately!
            Serializer serializer = makeSerializer();
            StringWriter writer = new StringWriter();
            serializer.setOutputWriter(writer);
            S9apiUtils.serialize(runtime, doc, serializer);
            writer.close();

            ByteArrayInputStream bais = new ByteArrayInputStream(writer.toString().getBytes("UTF-8"));
            sp.process(bais, doc.getBaseURI().toASCIIString());
        } catch (IOException e) {
            throw new XProcException(e);
        } catch (ParseException e) {
            throw new XProcException(e);
        }
View Full Code Here


    @BeforeMethod
    public void setUp() throws Exception {
        charOutputSink = new CharOutputSink();
        charOutputSink.connect(System.out);

        streamProcessor = new StreamProcessor(JsonLdParser.connect(NQuadsSerializer.connect(charOutputSink)));
    }
View Full Code Here

    private final StreamProcessor streamProcessor;
    private final CharOutputSink charOutputSink;

    public RdfaProcessorEndpoint() {
        charOutputSink = new CharOutputSink("UTF-8");
        streamProcessor = new StreamProcessor(RdfaParser.connect(TurtleSerializer.connect(charOutputSink)));
        streamProcessor.setProperty(RdfaParser.ENABLE_VOCAB_EXPANSION, true);
    }
View Full Code Here

     * Default constructor. Creates RDFa parser in 1.1 mode with disabled vocabulary expansion feature.
     * Properties can be changed using {@link #setProperty(String, Object)} calls with property keys
     * from {@link RdfaParser}.
     */
    public JenaRdfaReader() {
        streamProcessor = new StreamProcessor(RdfaParser.connect(JenaSink.connect(null)));
    }
View Full Code Here

    private static long benchmarkSemarglJena(File path) throws SAXException, ParseException {
        System.out.println("Semargl-Jena benchmark");
        Model model = ModelFactory.createDefaultModel();

        StreamProcessor streamProcessor = new StreamProcessor(RdfaParser.connect(JenaSink.connect(model)));

        List<File> files = listFiles(path);
        long time = System.nanoTime();
        for (File file : files) {
            streamProcessor.process(file, HTTP_EXAMPLE_COM);
        }
        System.out.println("Model size = " + model.size());
        return System.nanoTime() - time;
    }
View Full Code Here

    private static long benchmarkSemarglClerezza(File path) throws SAXException, ParseException {
        System.out.println("Semargl-Clerezza benchmark");
        MGraph model = createClerezzaModel();

        StreamProcessor streamProcessor = new StreamProcessor(RdfaParser.connect(ClerezzaSink.connect(model)));

        List<File> files = listFiles(path);
        long time = System.nanoTime();
        for (File file : files) {
            streamProcessor.process(file, HTTP_EXAMPLE_COM);
        }
        System.out.println("Model size = " + model.size());
        return System.nanoTime() - time;
    }
View Full Code Here

    }

    private static long benchmarkSemarglSesame(File path) throws SAXException, ParseException {
        System.out.println("Semargl-Sesame benchmark");
        AbstractModel model = new LinkedHashModel();
        StreamProcessor streamProcessor = new StreamProcessor(JsonLdParser.connect(SesameSink.connect(new StatementCollector(model))));

        List<File> files = listFiles(path);
        long time = System.nanoTime();
        for (File file : files) {
            streamProcessor.process(file, HTTP_EXAMPLE_COM);
        }
        System.out.println("Model size = " + model.size());
        return System.nanoTime() - time;
    }
View Full Code Here

    private static long benchmarkSemarglJena(String path) throws SAXException, ParseException {
        System.out.println("Semargl-Jena benchmark");
        Model model = ModelFactory.createDefaultModel();

        StreamProcessor streamProcessor = new StreamProcessor(RdfXmlParser.connect(JenaSink.connect(model)));

        List<File> files = listFiles(path);
        long time = System.nanoTime();
        for (File file : files) {
            streamProcessor.process(file, HTTP_EXAMPLE_COM);
        }
        System.out.println("Model size = " + model.size());
        return System.nanoTime() - time;
    }
View Full Code Here

    private static long benchmarkSemarglClerezza(String path) throws SAXException, ParseException {
        System.out.println("Semargl-Clerezza benchmark");
        MGraph model = createClerezzaModel();

        StreamProcessor streamProcessor = new StreamProcessor(RdfXmlParser.connect(ClerezzaSink.connect(model)));

        List<File> files = listFiles(path);
        long time = System.nanoTime();
        for (File file : files) {
            streamProcessor.process(file, HTTP_EXAMPLE_COM);
        }
        System.out.println("Model size = " + model.size());
        return System.nanoTime() - time;
    }
View Full Code Here

    @BeforeClass
    public void init() throws SAXException {
        model = ModelFactory.createDefaultModel();

        streamProcessor = new StreamProcessor(RdfaParser.connect(JenaSink.connect(model)));
        streamProcessor.setProperty(RdfaParser.ENABLE_VOCAB_EXPANSION, true);
    }
View Full Code Here

TOP

Related Classes of org.semarglproject.source.StreamProcessor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.