Examples of RDFXMLOntologyFormat


Examples of org.semanticweb.owl.io.RDFXMLOntologyFormat

    OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
    /* Set up a mapping, which maps the ontology URI to the physical URI */
    SimpleURIMapper mapper = new SimpleURIMapper(ontology.getURI(), tboxPhysicalURI);
    manager.addURIMapper(mapper);
    try {
      manager.saveOntology(ontology, new RDFXMLOntologyFormat(), tboxPhysicalURI);
    } catch (UnknownOWLOntologyException e) {
      logger.equals("Couldn't save approximated Tbox to file ("+tboxPhysicalURI+")");
      logger.equals(e);
    } catch (OWLOntologyStorageException e) {
      logger.equals("Couldn't save approximated Tbox to file ("+tboxPhysicalURI+")");
View Full Code Here

Examples of org.semanticweb.owl.io.RDFXMLOntologyFormat

        physicalURI);
    manager.addURIMapper(mapper);

    try
    {
      manager.saveOntology(ontology, new RDFXMLOntologyFormat(),
          physicalURI);
    } catch (UnknownOWLOntologyException e)
    {
    } catch (OWLOntologyStorageException e)
    {
View Full Code Here

Examples of org.semanticweb.owl.io.RDFXMLOntologyFormat

            entity = getDataFactory().getOWLDataProperty(subject);
        }
        else if (getConsumer().isAnnotationProperty(subject)) {
            // An annotation on an annotation property - what the hell do we do here?
            // 18th Dec 2006: I can't find anyway of dealing with this!
            RDFXMLOntologyFormat format = getConsumer().getOntologyFormat();
            format.addAnnotationURIAnnotation(subject, annotation);
            consumeTriple(subject, predicate, object);
        }
        else {
            // The annotation will either be on an individual or on an
            // axiom
View Full Code Here

Examples of org.semanticweb.owl.io.RDFXMLOntologyFormat

                    return annotationPropertyURIs.contains(uri);
                }
                else {
                    OWLOntologyFormat format = owlOntologyManager.getOntologyFormat(ont);
                    if (format instanceof RDFXMLOntologyFormat) {
                        RDFXMLOntologyFormat rdfFormat = (RDFXMLOntologyFormat) format;
                        annotationPropertyURIs.addAll(rdfFormat.getAnnotationURIs());
                        return annotationPropertyURIs.contains(uri);
                    }
                }
            }
        }
View Full Code Here

Examples of org.semanticweb.owl.io.RDFXMLOntologyFormat

    public void endModel() throws SAXException {
        try {
            uriMap.clear();

            tripleProcessor.fine("Total number of triples: " + count);
            RDFXMLOntologyFormat format = getOntologyFormat();
            if (format != null) {
                format.setNumberOfTriplesProcessedDuringLoading(count);
            }

            // Do we need to change the ontology URI?
            if (!ontologyURIs.contains(ontology.getURI())) {
                if (ontologyURIs.size() == 1) {
View Full Code Here

Examples of org.semanticweb.owl.io.RDFXMLOntologyFormat

    protected Set<URI> getAnnotationURIsThatRequireNamespaces() {
        Set<URI> results = new HashSet<URI>();
        OWLOntologyFormat format = man.getOntologyFormat(ontology);
        // Nasty hack until OWL 1.1 spec is fixed
        if (format instanceof RDFXMLOntologyFormat) {
            RDFXMLOntologyFormat rdfXmlFormat = (RDFXMLOntologyFormat) format;
            results.addAll(rdfXmlFormat.getAnnotationURIs());
        }
        results.addAll(ontology.getAnnotationURIs());
        return results;
    }
View Full Code Here

Examples of org.semanticweb.owl.io.RDFXMLOntologyFormat

        annotationURIs.removeAll(OWLRDFVocabulary.BUILT_IN_ANNOTATION_PROPERTIES);
        Map<URI, Set<OWLAnnotation>> annoURIAnnotations = Collections.emptyMap();
        OWLOntologyFormat format = getOntologyFormat();

        if (format instanceof RDFXMLOntologyFormat) {
            RDFXMLOntologyFormat rdfXMLFormat = (RDFXMLOntologyFormat) format;
            annotationURIs.addAll(rdfXMLFormat.getAnnotationURIs());
            annoURIAnnotations = rdfXMLFormat.getAnnotationURIAnnotations();
        }
        if (!annotationURIs.isEmpty()) {
            writeBanner("Annotation properties");
            graph = new RDFGraph();
            for (URI uri : annotationURIs) {
View Full Code Here

Examples of org.semanticweb.owlapi.io.RDFXMLOntologyFormat

        try {
//        try {
            IRIMap.clear();

            tripleProcessor.fine("Total number of triples: " + count);
            RDFXMLOntologyFormat format = getOntologyFormat();

            // First mop up any rules triples
            SWRLRuleTranslator translator = new SWRLRuleTranslator(this);
            for (IRI ruleIRI : swrlRules) {
                translator.translateRule(ruleIRI);
            }


            // We need to mop up all remaining triples.  These triples will be in the
            // triples by subject map.  Other triples which reside in the triples by
            // predicate (single valued) triple aren't "root" triples for axioms.  First
            // we translate all system triples and then go for triples whose predicates
            // are not system/reserved vocabulary IRIs to translate these into ABox assertions
            // or annotationIRIs
            for (IRI subject : new ArrayList<IRI>(resTriplesBySubject.keySet())) {
                Map<IRI, Set<IRI>> map = resTriplesBySubject.get(subject);
                if (map == null) {
                    continue;
                }
                for (IRI predicate : new ArrayList<IRI>(map.keySet())) {
                    Set<IRI> objects = map.get(predicate);
                    if (objects == null) {
                        continue;
                    }
                    for (IRI object : new ArrayList<IRI>(objects)) {
                        // We don't handle x rdf:type owl:Axiom because these must be handled after everything else
                        // so that the "base triples" that represent the axiom with out the annotations get mopped up first
                        if (!(predicate.equals(OWLRDFVocabulary.RDF_TYPE.getIRI()) && (object.equals(OWLRDFVocabulary.OWL_AXIOM.getIRI()) || object.equals(OWLRDFVocabulary.OWL_ALL_DISJOINT_CLASSES.getIRI())))) {
                            handle(subject, predicate, object);
                        }
                    }
                }
            }

            // Now handle axiom annotations
            // TODO: TIDY UP THIS COPY AND PASTE HACK!
            for (IRI subject : new ArrayList<IRI>(resTriplesBySubject.keySet())) {
                Map<IRI, Set<IRI>> map = resTriplesBySubject.get(subject);
                if (map == null) {
                    continue;
                }
                for (IRI predicate : new ArrayList<IRI>(map.keySet())) {
                    Set<IRI> objects = map.get(predicate);
                    if (objects == null) {
                        continue;
                    }
                    for (IRI object : new ArrayList<IRI>(objects)) {
                        if ((predicate.equals(OWLRDFVocabulary.RDF_TYPE.getIRI()) && (object.equals(OWLRDFVocabulary.OWL_AXIOM.getIRI()) || object.equals(OWLRDFVocabulary.OWL_ALL_DISJOINT_CLASSES.getIRI())))) {
                            handle(subject, predicate, object);
                        }
                    }
                }
            }

            // TODO: TIDY UP!  This is a copy and paste hack!!
            // Now for the ABox assertions and annotationIRIs
            for (IRI subject : new ArrayList<IRI>(resTriplesBySubject.keySet())) {
                Map<IRI, Set<IRI>> map = resTriplesBySubject.get(subject);
                if (map == null) {
                    continue;
                }
                for (IRI predicate : new ArrayList<IRI>(map.keySet())) {
                    Set<IRI> objects = map.get(predicate);
                    if (objects == null) {
                        continue;
                    }
                    for (IRI object : new ArrayList<IRI>(objects)) {
                        for (AbstractResourceTripleHandler resTripHandler : resourceTripleHandlers) {
                            if (resTripHandler.canHandle(subject, predicate, object)) {
                                resTripHandler.handleTriple(subject, predicate, object);
                                break;
                            }
                        }
                    }
                }
            }


            for (IRI subject : new ArrayList<IRI>(litTriplesBySubject.keySet())) {
                Map<IRI, Set<OWLLiteral>> map = litTriplesBySubject.get(subject);
                if (map == null) {
                    continue;
                }
                for (IRI predicate : new ArrayList<IRI>(map.keySet())) {
                    Set<OWLLiteral> objects = map.get(predicate);
                    for (OWLLiteral object : new ArrayList<OWLLiteral>(objects)) {
                        handle(subject, predicate, object);
                    }
                }
            }

//        translateDanglingEntities();

            if (format != null) {
                RDFOntologyFormat.ParserMetaData metaData = new RDFOntologyFormat.ParserMetaData(count, RDFOntologyFormat.OntologyHeaderStatus.PARSED_ONE_HEADER);
                format.setParserMetaData(metaData);
            }


            // Do we need to change the ontology IRI?
            IRI ontologyIRIToSet = chooseOntologyIRI();
View Full Code Here

Examples of org.semanticweb.owlapi.io.RDFXMLOntologyFormat

    OWLOntologyFormat ontologyFormat = manager.getOntologyFormat(ontology);
    switch(format){
    case OWL_FORMAT:
      ontologyFormat = new OWLXMLOntologyFormat();break;
    case RDF_FORMAT:
      ontologyFormat = new RDFXMLOntologyFormat();break;
    case NTRIPLE_FORMAT:
      throw new IOntologyException("Unsupported export format");
    case OBO_FORMAT:
      ontologyFormat = new OBOOntologyFormat();break;
    case TURTLE_FORMAT:
View Full Code Here

Examples of org.semanticweb.owlapi.io.RDFXMLOntologyFormat

    OWLOntologyFormat ontologyFormat = manager.getOntologyFormat(ontology);
    switch(format){
    case OWL_FORMAT:
      ontologyFormat = new OWLXMLOntologyFormat();break;
    case RDF_FORMAT:
      ontologyFormat = new RDFXMLOntologyFormat();break;
    case NTRIPLE_FORMAT:
      throw new IOntologyException("Unsupported export format");
    case OBO_FORMAT:
      ontologyFormat = new OBOOntologyFormat();break;
    case TURTLE_FORMAT:
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.