Package org.apache.any23.writer

Examples of org.apache.any23.writer.CompositeTripleHandler


    @Test
    public void testExtractionParameters() throws IOException, ExtractionException, TripleHandlerException {
        final int EXPECTED_TRIPLES  = 6;
        Any23 runner = new Any23();
        DocumentSource source = getDocumentSourceFromResource(
                "/org/apache/any23/validator/missing-og-namespace.html",
                "http://www.test.com"
        );

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
View Full Code Here


    @Test
    public void testExtractionParametersWithNestingDisabled()
    throws IOException, ExtractionException, TripleHandlerException {
        final int EXPECTED_TRIPLES = 19;
        Any23 runner = new Any23();
        DocumentSource source = getDocumentSourceFromResource(
                "/microformats/nested-microformats-a1.html",
                "http://www.test.com"
        );

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
View Full Code Here

    }

    @Test
    public void testExceptionPropagation() throws IOException {
        Any23 any23 = new Any23();
        DocumentSource source = getDocumentSourceFromResource(
                "/application/turtle/geolinkeddata.ttl",
                "http://www.test.com"
        );
        CountingTripleHandler cth1 = new CountingTripleHandler();
        try {
View Full Code Here

    @Test
    public void testXMLMimeTypeManagement() throws IOException, ExtractionException {
        final String documentURI = "http://www.test.com/resource.xml";
        final String contentType = "application/xml";
        final String in = StreamUtils.asString( this.getClass().getResourceAsStream("any23-xml-mimetype.xml") );
        final DocumentSource doc = new StringDocumentSource(in, documentURI, contentType);
        final Any23 any23 = new Any23();
        final CountingTripleHandler cth = new CountingTripleHandler(false);
        final ReportingTripleHandler rth = new ReportingTripleHandler(cth);
        final ExtractionReport report = any23.extract(doc, rth);
        Assert.assertFalse(report.hasMatchingExtractors());
View Full Code Here

    private File getFile() {
        return file;
    }

    public DocumentSource getOpener(String baseURI) {
        return new FileDocumentSource(getFile(), baseURI);
    }
View Full Code Here

        assertContains("<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>", response.getContent());
    }

    @Test
    public void testResponseWithReport() throws Exception {
        content = new FileDocumentSource(
                new File("src/test/resources/org/apache/any23/servlet/missing-og-namespace.html")
        ).readStream();
        acceptHeader = "text/plain";
        HttpTester response = doGetRequest("/best/http://foo.com?validation-mode=validate-fix&report=on");
        Assert.assertEquals(200, response.getStatus());
View Full Code Here

        tempDirectory = testFolder.newFolder();
    }

    protected DocumentSource getDocumentSourceFromResource(
            String resourceLocation) throws IOException {
        return new FileDocumentSource(copyResourceToTempFile(resourceLocation));
    }
View Full Code Here

        return new FileDocumentSource(copyResourceToTempFile(resourceLocation));
    }

    protected DocumentSource getDocumentSourceFromResource(
            String resourceLocation, String baseUri) throws IOException {
        return new FileDocumentSource(copyResourceToTempFile(resourceLocation),
                baseUri);
    }
View Full Code Here

        }
    }

    protected DocumentSource createHTTPDocumentSource(HTTPClient httpClient, String uri)
            throws IOException, URISyntaxException {
        return new HTTPDocumentSource(httpClient, uri);
    }
View Full Code Here

        @Override
        protected DocumentSource createHTTPDocumentSource(HTTPClient httpClient, String uri)
                throws IOException, URISyntaxException {
            requestedURI = uri;
            if(content != null) {
                return new StringDocumentSource(content, uri);
            } else {
                return super.createHTTPDocumentSource(httpClient, uri);
            }
        }
View Full Code Here

TOP

Related Classes of org.apache.any23.writer.CompositeTripleHandler

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.