Package edu.unika.aifb.rdf.api.syntax

Examples of edu.unika.aifb.rdf.api.syntax.RDFParser


        try {
            final RDFXMLOntologyFormat format = new RDFXMLOntologyFormat();
            if (owlOntologyManager == null) {
                throw new OWLRuntimeException("Cannot parse because OWLOntologyManager is null!");
            }
            final RDFParser parser = new RDFParser() {
                public void startPrefixMapping(String prefix, String uri) throws SAXException {
                    super.startPrefixMapping(prefix, uri);
                    format.addPrefixNamespaceMapping(prefix, uri);
                }


                public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws
                                                                                                               SAXException {
                    super.startElement(namespaceURI, localName, qName, atts);
                    String value = atts.getValue(XMLNS, "base");
                    if (value != null) {
                        consumer.setXMLBase(value);
                    }
                }
            };
            consumer = new OWLRDFConsumer(owlOntologyManager, ontology, new AnonymousNodeChecker() {
                public boolean isAnonymousNode(URI uri) {
                    return parser.isAnonymousNodeURI(uri.toString());
                }


                public boolean isAnonymousNode(String uri) {
                    return parser.isAnonymousNodeURI(uri);
                }
            });
            consumer.setOntologyFormat(format);
            InputSource is = getInputSource(inputSource);
            parser.parse(is, consumer);
            return format;
        }
        catch (SAXException e) {
            throw new OWLRDFXMLParserSAXException(e);
        }
View Full Code Here


    private Map<String, URI> uriCache;

    public static void main(String[] args) {
        try {
            RDFAPITest con = new RDFAPITest();
            RDFParser parser = new RDFParser();


            URI uri = URI.create("http://www.co-ode.org/ontologies/pizza/2006/07/18/pizza.owl");
            File file = new File("/Users/matthewhorridge/Desktop/Thesaurus.owl");
            uri = file.toURI();
            BufferedInputStream inputStream = new BufferedInputStream(uri.toURL().openStream());


            long t0 = System.currentTimeMillis();
            InputSource is = new InputSource(inputStream);
            is.setSystemId(uri.toString());
            parser.parse(is, con);
            long t1 = System.currentTimeMillis();
            System.gc();
                        System.gc();
                        System.gc();
                        System.gc();
View Full Code Here

TOP

Related Classes of edu.unika.aifb.rdf.api.syntax.RDFParser

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.