Package org.apache.stanbol.ontologymanager.servicesapi.ontology

Examples of org.apache.stanbol.ontologymanager.servicesapi.ontology.OntologyLoadingException


            graph = new IndexedMGraph();
            bindPhysicalOrigin(null);
        }

        Iterator<String> itf = formats.iterator();
        if (!itf.hasNext()) throw new OntologyLoadingException("No suitable format found or defined.");
        do {
            String f = itf.next();
            log.debug("Parsing with format {}", f);
            try {
                parser.parse((MGraph) graph, content, f);
                loaded = true;
                log.info("Graph parsed, has {} triples", graph.size());
            } catch (UnsupportedFormatException e) {
                log.debug("Parsing format {} failed.", f);
            } catch (Exception e) {
                log.debug("Error parsing format " + f, e);
            } finally {
                if (!loaded && content.markSupported()) try {
                    content.reset();
                } catch (IOException e) {
                    log.debug("Failed to reset data stream while parsing format {}.", f);
                    // No way to retry if the stream cannot be reset. Must recreate it.
                    break;
                }
            }
        } while (!loaded && itf.hasNext());

        if (loaded) {
            bindRootOntology(graph);
            log.debug("Root ontology is a {}.", getRootOntology().getClass().getCanonicalName());
        } else {
            // Rollback graph creation, if any
            if (tcProvider != null && tcProvider != null) {
                tcProvider.deleteTripleCollection(name);
                log.error("Parsing failed. Deleting triple collection {}", name);
            }
            throw new OntologyLoadingException("Parsing failed. Giving up.");
        }

        log.debug("Input source initialization completed in {} ms.", (System.currentTimeMillis() - before));
    }
View Full Code Here


                else // The RESTful API has its own list of preferred formats
                formats = Arrays.asList(new String[] {RDF_XML, TURTLE, X_TURTLE, N3, N_TRIPLE, OWL_XML,
                                                      FUNCTIONAL_OWL, MANCHESTER_OWL, RDF_JSON});
                int unsupported = 0, failed = 0;
                Iterator<String> itf = formats.iterator();
                if (!itf.hasNext()) throw new OntologyLoadingException("No suitable format found or defined.");
                do {
                    String f = itf.next();
                    try {
                        // Re-instantiate the stream on every attempt
                        InputStream content = new FileInputStream(file);
View Full Code Here

                    FUNCTIONAL_OWL, MANCHESTER_OWL, RDF_JSON});
            }
            int unsupported = 0, failed = 0;
            Iterator<String> itf = formats.iterator();
            if (!itf.hasNext()) {
                throw new OntologyLoadingException("No suitable format found or defined.");
            }
            do {
                String f = itf.next();
                try {
                    // Re-instantiate the stream on every attempt
View Full Code Here

TOP

Related Classes of org.apache.stanbol.ontologymanager.servicesapi.ontology.OntologyLoadingException

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.