Examples of StringDocumentSource


Examples of org.apache.any23.source.StringDocumentSource

        @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

Examples of org.apache.any23.source.StringDocumentSource

            if (req.getParameter("type") != null && !"".equals(req.getParameter("type"))) {
                type = req.getParameter("type");
            }
            log("Attempting conversion to '" + format + "' from body parameter");
            responder.runExtraction(
                    new StringDocumentSource(req.getParameter("body"), Servlet.DEFAULT_BASE_URI, type),
                    eps,
                    format,
                    report, annotate
            );
            return;
View Full Code Here

Examples of org.apache.any23.source.StringDocumentSource

            String documentURI,
            String contentType,
            String encoding,
            TripleHandler outputHandler
    ) throws IOException, ExtractionException {
        return extract(new StringDocumentSource(in, documentURI, contentType, encoding), outputHandler);
    }
View Full Code Here

Examples of org.apache.any23.source.StringDocumentSource

     * @throws IOException
     * @throws ExtractionException
     */
    public ExtractionReport extract(String in, String documentURI, TripleHandler outputHandler)
    throws IOException, ExtractionException {
        return extract(new StringDocumentSource(in, documentURI), outputHandler);
    }
View Full Code Here

Examples of org.apache.any23.source.StringDocumentSource

        /*2*/ final String content = "@prefix foo: <http://example.org/ns#> .   " +
                                     "@prefix : <http://other.example.org/ns#> ." +
                                     "foo:bar foo: : .                          " +
                                     ":bar : foo:bar .                           ";
        //    The second argument of StringDocumentSource() must be a valid URI.
        /*3*/ DocumentSource source = new StringDocumentSource(content, "http://host.com/service");
        /*4*/ ByteArrayOutputStream out = new ByteArrayOutputStream();
        /*5*/ TripleHandler handler = new NTriplesWriter(out);
              try {
        /*6*/     runner.extract(source, handler);
              } finally {
View Full Code Here

Examples of org.apache.any23.source.StringDocumentSource

    @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

Examples of org.semanticweb.owlapi.io.StringDocumentSource

        if (axioms == null || axioms.isEmpty()) {
            return null;
        }
        try {
            OWLFunctionalSyntaxOWLParser p = new OWLFunctionalSyntaxOWLParser();
            OWLOntologyDocumentSource documentSource = new StringDocumentSource(
                    axioms);
            OWLOntology ontology = translationManager.createOntology();
            p.parse(documentSource, ontology,
                    translationManager.getOntologyLoaderConfiguration());
            return ontology.getAxioms();
View Full Code Here

Examples of org.semanticweb.owlapi.io.StringDocumentSource

        OWLOntologyManager manager = owlOntology.getOWLOntologyManager();
        StringDocumentTarget documentTarget = new StringDocumentTarget();
        manager.saveOntology(owlOntology, new OWLXMLDocumentFormat(),
                documentTarget);
        String owlString = documentTarget.toString();
        OWLOntologyDocumentSource documentSource = new StringDocumentSource(
                owlString);
        OWLOntology reloadedOwl = OWLManager.createOWLOntologyManager()
                .loadOntologyFromOntologyDocument(documentSource);
        assertEquals(owlOntology.getAxiomCount(), reloadedOwl.getAxiomCount());
    }
View Full Code Here

Examples of org.semanticweb.owlapi.io.StringDocumentSource

    @Test
    public void testConvert() throws Exception {
        OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
        String input = "Prefix(:=<http://www.example.org/#>)\nOntology(<http://example.org/>\nSubClassOf(:a :b) )";
        StringDocumentSource source = new StringDocumentSource(input);
        OWLOntology origOnt = manager.loadOntologyFromOntologyDocument(source);
        assertNotNull(origOnt);
        assertEquals(1, manager.getOntologies().size());
        assertFalse(origOnt.getOntologyID().getVersionIRI().isPresent());
        assertTrue(origOnt.getAxiomCount() > 0);
View Full Code Here

Examples of org.semanticweb.owlapi.io.StringDocumentSource

    private final IRI s = IRI.create("urn:test#s");

    @Test
    public void shouldParseFixedQuotesLiterals1()
            throws OWLOntologyCreationException {
        OWLOntology o = loadOntologyFromString(new StringDocumentSource(
                "<urn:test#s> <urn:test#p> ''' ''\\' ''' .", iri, tf, null));
        for (OWLAnnotationAssertionAxiom ax : o.getAnnotationAssertionAxioms(s)) {
            assertEquals(" ''' ", ((OWLLiteral) ax.getValue()).getLiteral());
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.