Tabnine Logo
OWLAPITranslatorOWL2QL
Code IndexAdd Tabnine to your IDE (free)

How to use
OWLAPITranslatorOWL2QL
in
it.unibz.inf.ontop.spec.ontology.owlapi

Best Java code snippets using it.unibz.inf.ontop.spec.ontology.owlapi.OWLAPITranslatorOWL2QL (Showing top 11 results out of 315)

origin: ontop/ontop

/***
 * This method loads the given ontologies in the system. This will merge
 * these new ontologies with the existing ones in a set. Then it will
 * translate the assertions in all the ontologies into a single one, in our
 * internal representation.
 * 
 * The translation is done using our OWLAPITranslator that gets the TBox
 * part of the ontologies and filters all the DL-Lite axioms (RDFS/OWL2QL
 * and DL-Lite).
 *
 */
private ClassifiedTBox loadOntologies(OWLOntology ontology) {
  /*
   * We will keep track of the loaded ontologies and translate the TBox
   * part of them into our internal representation.
   */
  log.debug("Load ontologies called. Translating ontologies.");
  Ontology mergeOntology = owlapiTranslator.translateAndClassify(ontology);
  return mergeOntology.tbox();
}
origin: ontop/ontop

public AnnotationAssertion translate(OWLAnnotationAssertionAxiom ax, OntologyVocabularyCategory<AnnotationProperty> annotationProperties) throws TranslationException, InconsistentOntologyException {
  IRIConstant c1 = getIndividual(ax.getSubject());
  Constant c2 = getValue(ax.getValue());
  AnnotationProperty ap = getPropertyExpression(ax.getProperty(), annotationProperties);
  return OntologyBuilderImpl.createAnnotationAssertion(ap, c1, c2);
}
origin: ontop/ontop

public ClassAssertion translate(OWLClassAssertionAxiom ax, OntologyVocabularyCategory<OClass> classes) throws TranslationException, InconsistentOntologyException {
  OWLClassExpression classExpression = ax.getClassExpression();
  if (!(classExpression instanceof OWLClass))
    throw new OWLAPITranslatorOWL2QL.TranslationException("complex class expressions are not supported");
  OClass concept = getOClass((OWLClass) classExpression, classes);
  IRIConstant c = getIndividual(ax.getIndividual());
  return OntologyBuilderImpl.createClassAssertion(concept, c);
}
origin: ontop/ontop

public ObjectPropertyAssertion translate(OWLObjectPropertyAssertionAxiom ax, OntologyVocabularyCategory<ObjectPropertyExpression> objectProperties) throws TranslationException, InconsistentOntologyException {
  IRIConstant c1 = getIndividual(ax.getSubject());
  IRIConstant c2 = getIndividual(ax.getObject());
  ObjectPropertyExpression ope = getPropertyExpression(ax.getProperty(), objectProperties);
  return OntologyBuilderImpl.createObjectPropertyAssertion(ope, c1, c2);
}
origin: ontop/ontop

public DataPropertyAssertion translate(OWLDataPropertyAssertionAxiom ax, OntologyVocabularyCategory<DataPropertyExpression> dataProperties) throws TranslationException, InconsistentOntologyException {
  IRIConstant c1 = getIndividual(ax.getSubject());
  ValueConstant c2 = getValueOfLiteral(ax.getObject());
  DataPropertyExpression dpe = getPropertyExpression(ax.getProperty(), dataProperties);
  return OntologyBuilderImpl.createDataPropertyAssertion(dpe, c1, c2);
}
origin: ontop/ontop

/**
 * Include all imports and load then into a single translated merge.
 *
 * @param owl
 * @return
 */
public Ontology translateAndClassify(OWLOntology owl)   {
  Set<OWLOntology> owls = owl.getOWLOntologyManager().getImportsClosure(owl);
  log.debug("Load ontologies called. Translating {} ontologies.", owls.size());
  OntologyBuilder builder = OntologyBuilderImpl.builder(rdfFactory);
  for (OWLOntology o : owls) {
    extractOntoloyVocabulary(o, builder);
  }
  for (OWLOntology o : owls) {
    OWLAxiomVisitorImpl visitor = new OWLAxiomVisitorImpl(o, builder);
    for (OWLAxiom axiom : o.getAxioms())  {
      axiom.accept(visitor);
    }
  }
  Ontology onto = builder.build();
  log.debug("Ontology loaded: {}", onto);
  return onto;
}
origin: ontop/ontop

private Constant getValue(OWLAnnotationValue value)  throws TranslationException {
  try {
    if (value instanceof IRI) {
      return termFactory.getConstantIRI(rdfFactory.createIRI(value.asIRI().get().toString()));
    }
    else if (value instanceof OWLLiteral) {
      return getValueOfLiteral(value.asLiteral().get());
    }
    else
      throw new OWLAPITranslatorOWL2QL.TranslationException("Found anonymous individual, this feature is not supported:" + value);
  }
  catch (OWLRuntimeException ore) {
    throw new OWLAPITranslatorOWL2QL.TranslationException(ore.getMessage());
  }
}
origin: ontop/ontop

Optional<Ontology> loadOntology() throws OntologyException {
  OWLAPITranslatorOWL2QL translator = getInjector().getInstance(OWLAPITranslatorOWL2QL.class);
  try {
    return loadInputOntology()
        .map(o -> translator.translateAndClassify(o));
  }
  catch (OWLOntologyCreationException e) {
    throw new OntologyException(e.getMessage());
  }
}
origin: ontop/ontop

/**
 * Methods to get the empty concepts and roles in the ontology using the given mappings.
 * It generates SPARQL queries to check for entities.
 * @return QuestOWLEmptyEntitiesChecker class to get empty concepts and roles
 * @throws Exception
 */
public QuestOWLEmptyEntitiesChecker getEmptyEntitiesChecker() throws Exception {
  OWLOntology rootOntology = getRootOntology();
  Ontology mergeOntology = owlapiTranslator.translateAndClassify(rootOntology);
  ClassifiedTBox tBox = mergeOntology.tbox();
  return new QuestOWLEmptyEntitiesChecker(tBox, owlConnection);
}
origin: ontop/ontop

/**
 * High-level method
 */
public static OntopSemanticIndexLoader loadOntologyIndividuals(OWLOntology owlOntology, Properties properties)
    throws SemanticIndexException {
  OntopModelConfiguration defaultConfiguration = OntopModelConfiguration.defaultBuilder().build();
  OWLAPITranslatorOWL2QL translatorOWL2QL = defaultConfiguration.getInjector().getInstance(OWLAPITranslatorOWL2QL.class);
  Ontology ontology = translatorOWL2QL.translateAndClassify(owlOntology);
  SIRepository repo = new SIRepository(ontology.tbox(), defaultConfiguration.getTermFactory(),
      defaultConfiguration.getTypeFactory(),
      defaultConfiguration.getInjector().getInstance(TargetAtomFactory.class)
      );
  try {
    Connection connection = repo.createConnection();
    // load the data
    Set<OWLOntology> ontologyClosure = owlOntology.getOWLOntologyManager().getImportsClosure(owlOntology);
    OWLAPIABoxIterator aBoxIter = new OWLAPIABoxIterator(ontologyClosure, ontology.tbox(), translatorOWL2QL);
    int count = repo.insertData(connection, aBoxIter);
    LOG.debug("Inserted {} triples from the ontology.", count);
    return new OntopSemanticIndexLoaderImpl(repo, connection, properties,
        Optional.of(extractTBox(owlOntology)));
  }
  catch (SQLException e) {
    throw new SemanticIndexException(e.getMessage());
  }
}
origin: ontop/ontop

Ontology ontology = translatorOWL2QL.translateAndClassify(inputOntology);
SIRepository repo = new SIRepository(ontology.tbox(),
    obdaConfiguration.getTermFactory(), obdaConfiguration.getTypeFactory(),
it.unibz.inf.ontop.spec.ontology.owlapiOWLAPITranslatorOWL2QL

Most used methods

  • translateAndClassify
    Include all imports and load then into a single translated merge.
  • extractOntoloyVocabulary
  • getIndividual
  • getOClass
  • getPropertyExpression
    ObjectPropertyExpression := ObjectProperty | InverseObjectProperty InverseObjectProperty := 'ObjectI
  • getValue
  • getValueOfLiteral
  • translate

Popular in Java

  • Running tasks concurrently on multiple threads
  • runOnUiThread (Activity)
  • onCreateOptionsMenu (Activity)
  • getResourceAsStream (ClassLoader)
  • InetAddress (java.net)
    An Internet Protocol (IP) address. This can be either an IPv4 address or an IPv6 address, and in pra
  • Charset (java.nio.charset)
    A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now