
org.protege.owl.rdf.impl.RDFTranslator Maven / Gradle / Ivy
package org.protege.owl.rdf.impl;
import java.util.ArrayList;
import java.util.IdentityHashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import org.semanticweb.owlapi.rdf.model.AbstractTranslator;
import org.openrdf.model.BNode;
import org.openrdf.model.Resource;
import org.openrdf.model.Value;
import org.openrdf.model.ValueFactory;
import org.openrdf.repository.Repository;
import org.openrdf.repository.RepositoryConnection;
import org.openrdf.repository.RepositoryException;
import org.semanticweb.owlapi.apibinding.OWLManager;
import org.semanticweb.owlapi.model.AddAxiom;
import org.semanticweb.owlapi.model.IRI;
import org.semanticweb.owlapi.model.OWLAxiom;
import org.semanticweb.owlapi.model.OWLEntity;
import org.semanticweb.owlapi.model.OWLLiteral;
import org.semanticweb.owlapi.model.OWLOntology;
import org.semanticweb.owlapi.model.OWLOntologyChange;
import org.semanticweb.owlapi.model.OWLOntologyCreationException;
import org.semanticweb.owlapi.model.OWLOntologyManager;
import org.semanticweb.owlapi.util.AlwaysOutputId;
import org.semanticweb.owlapi.vocab.OWLRDFVocabulary;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class RDFTranslator extends AbstractTranslator {
public static final Logger LOGGER = LoggerFactory.getLogger(RDFTranslator.class);
private org.openrdf.model.URI axiomResource;
/**
* There is a dangerous bend coming up! If you don't use the identity hash map then this
* code doesn't work. The identity hashmap is used to ensure that lists are not reused in
* non-standard ways by different axioms. (I think that this might actually lead to an OWL full by
* the specification because of how triples are "consumed" by the translator). But there is
* an additional problem (not quite a bug because it works) in the AbstractTranslator.translateList
* method in an off by one error when it generates the key for getAnonymousNode. So using a
* HashMap here leads to unexpectedly bad results even when you would not expect that lists
* would be shared.
*/
private Map
© 2015 - 2025 Weber Informatics LLC | Privacy Policy