congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
OWLDataFactory
Code IndexAdd Tabnine to your IDE (free)

How to use
OWLDataFactory
in
org.semanticweb.owlapi.model

Best Java code snippets using org.semanticweb.owlapi.model.OWLDataFactory (Showing top 20 results out of 927)

Refine searchRefine arrow

  • OWLAPIPreconditions
  • Stream
  • OWLClassExpression
  • OWLOntology
  • OWLRDFVocabulary
  • OWLOntologyManager
  • OWLReasoner
  • OWLObjectSomeValuesFrom
  • OWLOntologyLoaderConfiguration
origin: edu.stanford.protege/ontology-browser-owlmanager

public OWLEntity getOWLEntity(IRI iri, OWLDataFactory df){
  switch(this){
    case classes: return df.getOWLClass(iri);
    case objectproperties: df.getOWLObjectProperty(iri);
    case dataproperties: return df.getOWLDataProperty(iri);
    case annotationproperties: return df.getOWLAnnotationProperty(iri);
    case individuals: return df.getOWLNamedIndividual(iri);
    case datatypes: return df.getOWLDatatype(iri);
  }
  throw new RuntimeException("Unknown named object type: " + this);
}
origin: owlcs/owlapi

private void generateChanges(OWLClass cls, OWLObjectPropertyExpression property,
  Collection<OWLOntology> ontologies,
  OWLOntology targetOntology) {
  // We collect all of the fillers for existential restrictions along
  // the target property and all of the fillers for hasValue restrictions
  // as nominals
  FillerCollector collector = new FillerCollector(property);
  ontologies.forEach(o -> o.subClassAxiomsForSubClass(cls)
    .forEach(ax -> ax.getSuperClass().accept(collector)));
  if (collector.fillers.isEmpty()) {
    return;
  }
  OWLObjectUnionOf union = df.getOWLObjectUnionOf(collector.fillers);
  OWLClassExpression closureAxiomDesc = df.getOWLObjectAllValuesFrom(property, union);
  addChange(new AddAxiom(targetOntology, df.getOWLSubClassOfAxiom(cls, closureAxiomDesc)));
}
origin: owlcs/owlapi

@Override
protected void addAxioms(OWLNamedIndividual entity, OWLReasoner reasoner,
  OWLDataFactory dataFactory, Set<OWLClassAssertionAxiom> result) {
  reasoner.getTypes(entity, false).entities()
    .forEach(t -> result.add(dataFactory.getOWLClassAssertionAxiom(t, entity)));
}
origin: owlcs/owlapi

/**
 * Shorthand for
 * {@code getOWLAnnotation(getRDFSComment(), getOWLLiteral(value))}
 *
 * @param value The annotation value.
 * @return an rdfs:comment annotation with provided value
 */
default OWLAnnotation getRDFSComment(String value) {
  return getOWLAnnotation(getRDFSComment(), getOWLLiteral(value));
}
origin: owlcs/owlapi

  @Override
  public void handleTriple(IRI s, IRI p, IRI o) {
    OWLIndividual ind = df.getOWLNamedIndividual(s);
    OWLClass skosConcept = df.getOWLClass(o);
    add(df.getOWLClassAssertionAxiom(skosConcept, ind));
  }
}
origin: owlcs/owlapi

protected void expandAssertions(OWLOntology o, OWLAnnotationProperty p) {
  OWLAnnotationProperty ap425 = df.getOWLAnnotationProperty(IRI_IAO_0000425.getIRI());
  getAnnotationObjects(p, o.importsClosure(), ap425).map(a -> a.getValue().asLiteral())
    .filter(v -> v.isPresent())
    .forEach(v -> {
      String str = v.get().getLiteral();
      LOG.info("assertion mapping {} to {}", p, str);
      expandAssertionToMap.put(p.getIRI(), str);
    });
}
origin: owlcs/owlapi

@Override
public void visit(OWLOntology ontology) {
  checkNotNull(ontology, "ontology cannot be null");
  ontology.importsDeclarations().sorted().forEach(decl -> {
    writer.writeStartElement(IMPORT);
    writer.writeTextContent(decl.getIRI().toString());
    writer.writeEndElement();
  });
  render(ontology.annotations());
  Set<OWLEntity> declared = asUnorderedSet(ontology.unsortedSignature());
  ontology.axioms(AxiomType.DECLARATION).sorted().forEach(ax -> {
    ax.accept(this);
    declared.remove(ax.getEntity());
        if (!e.isBuiltIn() && !illegalPunnings.contains(e.getIRI())
          && !ontology.isDeclared(e, Imports.INCLUDED)) {
          ontology.getOWLOntologyManager().getOWLDataFactory()
            .getOWLDeclarationAxiom(e).accept(this);
origin: protegeproject/webprotege

  for(OWLOntology ontology : rootOntology.getImportsClosure()) {
    for(OWLClassAssertionAxiom ax : rootOntology.getClassAssertionAxioms(individual)) {
      if (!ax.getClassExpression().isAnonymous()) {
        OWLClass typeCls = ax.getClassExpression().asOWLClass();
        if(ax.getClassExpression().equals(thePreferredType)) {
actualType = EntitySearcher.getTypes(individual, rootOntology.getImportsClosure())
    .stream()
    .filter(ClassExpression::isOWLClass)
    .map(ClassExpression::asOWLClass)
    .findFirst()
    .orElse(dataFactory.getOWLThing());
origin: owlcs/owlapi

private void writeDeclarations(OWLEntity entity, Set<OWLAxiom> alreadyWrittenAxioms,
  Collection<IRI> illegals) {
  Collection<OWLDeclarationAxiom> axioms = asList(ont.declarationAxioms(entity).sorted());
  axioms.stream().filter(alreadyWrittenAxioms::add).forEach(this::acceptAndReturn);
  // if multiple illegal declarations already exist, they have already
  // been outputted the renderer cannot take responsibility for removing
  // them. It should not add declarations for illegally punned entities
  // here, though
  if (addMissingDeclarations && axioms.isEmpty() && !entity.isBuiltIn()
    && !illegals.contains(entity.getIRI()) && !ont.isDeclared(entity, Imports.INCLUDED)) {
    OWLDeclarationAxiom declaration =
      ont.getOWLOntologyManager().getOWLDataFactory().getOWLDeclarationAxiom(entity);
    acceptAndReturn(declaration);
  }
}
origin: owlcs/owlapi

/**
 * Tr term frame.
 *
 * @param termFrame the term frame
 * @return the oWL class expression
 */
public OWLClassExpression trTermFrame(Frame termFrame) {
  OWLClass cls = trClass(checkNotNull(termFrame.getId()));
  add(fac.getOWLDeclarationAxiom(cls));
  termFrame.getTags().stream().filter(OboFormatTag.TAG_ALT_ID.getTag()::equals).forEach(t ->
  // Generate deprecated and replaced_by details for alternate
  // identifier
  add(translateAltIds(termFrame.getClauses(t), cls.getIRI(), true)));
  termFrame.getTags().forEach(t -> add(trTermFrameClauses(cls, termFrame.getClauses(t), t)));
  return cls;
}
origin: SmartDataAnalytics/DL-Learner

tree.getEdges().stream().filter(edge -> !edge.equals(RDF.type.asNode())).forEach(edge -> {
  List<RDFResourceTree> children = tree.getChildren(edge);
types.remove(df.getOWLThing());
  if(!type.isAnonymous()) {
    addTypeChild.accept(type.asOWLClass());
  } else {
    if(type.getClassExpressionType() == ClassExpressionType.OBJECT_INTERSECTION_OF) {
      type.getNestedClassExpressions().stream()
          .filter(ce -> !ce.isAnonymous())
          .map(OWLClassExpression::asOWLClass)
          .forEach(addTypeChild);
origin: flaxsearch/BioSolr

if (reasoner.getSubClasses(getFactory().getOWLThing(), true).getFlattened().contains(owlClass)) {
  addRootsTerms(owlClass.getIRI());
if (reasoner.getSubClasses(getFactory().getOWLClass(Namespaces.OBOINOWL.createIRI("ObsoleteClass")), false).getFlattened().contains(owlClass)) {
  addObsoleteTerms(owlClass.getIRI());
    reasoner.getSubClasses(owlClass, true).getFlattened().stream()
        .map(OWLNamedObject::getIRI)
        .collect(Collectors.toSet()),
        owlVocabulary);
if (ct.size() >0) addDirectChildren(owlClass.getIRI(), ct) ;
    reasoner.getSubClasses(owlClass, false).getFlattened().stream()
        .map(OWLNamedObject::getIRI)
        .collect(Collectors.toSet()),
    owlVocabulary);
for (OWLClassExpression expression : owlClass.getSuperClasses(getManager().getOntologies())) {
  if (expression.isAnonymous()) {
      if (!someValuesFrom.getFiller().isAnonymous()) {
        IRI propertyIRI = someValuesFrom.getProperty().asOWLObjectProperty().getIRI();
        IRI relatedTerm = someValuesFrom.getFiller().asOWLClass().getIRI();
        if (!relatedTerms.containsKey(propertyIRI)) {
          relatedTerms.put(propertyIRI, new HashSet<>());
origin: owlcs/owlapi

/**
 * @param dataFactory data factory to use
 * @return set of SKOS data properties
 */
public static Set<OWLDataProperty> getDataProperties(OWLDataFactory dataFactory) {
  return asSet(stream().filter(v -> v.entityType.equals(DATA_PROPERTY))
    .map(v -> dataFactory.getOWLDataProperty(
      v.iri)));
}
origin: net.sourceforge.owlapi/owlexplanation

OWLOntology ont = man.createOntology(axioms);
toSave = ont;
OWLDataFactory df=man.getOWLDataFactory();
unsatDesc.signature()
  .filter(ent->!ent.isBuiltIn() && !ont.containsEntityInSignature(ent))
  .forEach(ent -> ont.add(df.getOWLDeclarationAxiom(ent)));
OWLClass namingCls = man.getOWLDataFactory().getOWLClass(IRI.create(clsName));
OWLAxiom namingAxiom = man.getOWLDataFactory().getOWLSubClassOfAxiom(namingCls, unsatDesc);
man.addAxiom(ont, namingAxiom);
for (OWLEntity freshEntity : freshEntities) {
  man.addAxiom(ont, man.getOWLDataFactory().getOWLDeclarationAxiom(freshEntity));
entailmentCheckTimer.start();
OWLReasoner reasoner = reasonerFactory.createReasoner(ont, new SimpleConfiguration(new NullReasonerProgressMonitor(), FreshEntityPolicy.ALLOW, timeOutMS, IndividualNodeSetPolicy.BY_SAME_AS));
entailed = !reasoner.isSatisfiable(unsatDesc);
entailmentCheckTimer.stop();
reasoner.dispose();
man.removeOntology(ont);
if (entailed) {
  lastEntailingAxioms.remove(namingAxiom);
  add(lastEntailingAxioms, ont.logicalAxioms());
origin: owlcs/owlapi

  protected void amalgamate(OWLOntology ont, OWLClass cls) {
    List<OWLSubClassOfAxiom> axioms = asList(ont.subClassAxiomsForSubClass(cls));
    if (axioms.size() < 2) {
      return;
    }
    axioms.forEach(ax -> addChange(new RemoveAxiom(ont, ax)));
    Stream<OWLClassExpression> superclasses = axioms.stream()
      .map(OWLSubClassOfAxiom::getSuperClass);
    OWLObjectIntersectionOf intersection = df.getOWLObjectIntersectionOf(superclasses);
    addChange(new AddAxiom(ont, df.getOWLSubClassOfAxiom(cls, intersection)));
  }
}
origin: owlcs/owlapi

@SuppressWarnings("null")
protected AbstractMacroExpansionVisitor(OWLOntology o) {
  df = o.getOWLOntologyManager().getOWLDataFactory();
  expandExpressionMap = new HashMap<>();
  expandAssertionToMap = new HashMap<>();
  OWLAnnotationProperty ap424 = df.getOWLAnnotationProperty(IRI_IAO_0000424.getIRI());
  o.objectPropertiesInSignature()
    .forEach(p -> getAnnotationObjects(p, o.importsClosure(), ap424).forEach(
      a -> mapToExpand(p, a)));
  o.annotationPropertiesInSignature().forEach(p -> expandAssertions(o, p));
  OIO_ISEXPANSION = df.getOWLAnnotationProperty(
    IRI.create(Obo2OWLConstants.OIOVOCAB_IRI_PREFIX, "is_expansion"));
  expansionMarkerAnnotation = df.getOWLAnnotation(OIO_ISEXPANSION, df.getOWLLiteral(true));
}
origin: owlcs/owlapi

/**
 * Retrieve the {@link OWLNamedIndividual} for a given {@link IRI}, if
 * it has at least one corresponding {@link OWLDeclarationAxiom}.
 *
 * @param iri iri
 * @return {@link OWLNamedIndividual} or null
 */
@Nullable
protected OWLNamedIndividual getOWLIndividual(IRI iri) {
  for (OWLOntology o : ontologies) {
    OWLNamedIndividual c = o.getOWLOntologyManager().getOWLDataFactory()
      .getOWLNamedIndividual(iri);
    Optional<OWLDeclarationAxiom> found = o.declarationAxioms(c)
      .filter(da -> da.getEntity()
        .isOWLNamedIndividual()).findAny();
    if (found.isPresent()) {
      return found.get().getEntity().asOWLNamedIndividual();
    }
  }
  return null;
}
origin: net.sourceforge.owlapi/owlapi-distribution

@Override
protected void addAxioms(OWLClass entity, OWLReasoner reasoner, OWLDataFactory dataFactory,
  Set<OWLSubClassOfAxiom> result) {
  checkNotNull(dataFactory, "dataFactory cannot be null");
  checkNotNull(reasoner, "reasoner cannot be null");
  checkNotNull(result, "result cannot be null");
  checkNotNull(entity, "entity cannot be null");
  if (reasoner.isSatisfiable(entity)) {
    reasoner.getSuperClasses(entity, true).entities()
      .forEach(sup -> result.add(dataFactory.getOWLSubClassOfAxiom(entity, sup)));
  } else {
    result.add(dataFactory.getOWLSubClassOfAxiom(entity, dataFactory.getOWLNothing()));
  }
}
origin: owlcs/owlapi

private void generateChanges() {
  Set<OWLClassExpression> supers = new HashSet<>();
  for (OWLOntology o : ontologies) {
    o.equivalentClassesAxioms(cls).forEach(ax -> {
      addChange(new RemoveAxiom(o, ax));
      ax.classExpressions().forEach(c -> collectClassExpressions(c, supers));
    });
  }
  supers.remove(cls);
  supers.forEach(
    sup -> addChange(new AddAxiom(targetOntology, df.getOWLSubClassOfAxiom(cls, sup))));
}
origin: owlcs/owlapi

@Override
public void visit(OWLOntology ontology) {
  List<OWLClass> classes1 = asList(ontology.classesInSignature());
  classes1.remove(ontology.getOWLOntologyManager().getOWLDataFactory().getOWLThing());
  classes1.remove(ontology.getOWLOntologyManager().getOWLDataFactory().getOWLNothing());
  classes1.sort(null);
  for (OWLClass eachClass : classes1) {
        write(EQUIVALENT);
        writeSpace();
        classExpression.accept(this);
        writeCloseBracket();
        writeln();
          write(eachClass);
          writeSpace();
          iter.next().accept(this);
          writeCloseBracket();
          writeln();
  ontology.generalClassAxioms().forEach(a -> a.accept(this));
  for (OWLObjectProperty property : asList(ontology.objectPropertiesInSignature())) {
    writeOpenBracket();
      sup(ontology.axioms(Filters.subObjectPropertyWithSub, property, INCLUDED),
        OWLObjectPropertyExpression.class);
    Iterator<OWLObjectPropertyExpression> it = superProperties.iterator();
    if (it.hasNext()) {
      writeAttribute(PARENTS_ATTR);
org.semanticweb.owlapi.modelOWLDataFactory

Javadoc

An interface for creating entities, class expressions and axioms.

Most used methods

  • getOWLClass
    Gets an OWL class that has the specified IRI
  • getOWLNamedIndividual
    Gets an OWL individual that has the specified IRI
  • getOWLObjectProperty
    Gets an OWL object property that has the specified IRI
  • getOWLSubClassOfAxiom
  • getOWLClassAssertionAxiom
  • getOWLDataProperty
    Gets an OWL data property that has the specified IRI
  • getOWLThing
    Gets the built in owl:Thing class, which has a URI of
  • getOWLAnnotationProperty
    Gets an OWLAnnotationProperty that has the specified IRI
  • getOWLLiteral
    Convenience method that obtains a literal typed as a boolean.
  • getOWLDeclarationAxiom
    Gets a declaration with zero or more annotations for an entity
  • getOWLObjectIntersectionOf
  • getOWLEquivalentClassesAxiom
  • getOWLObjectIntersectionOf,
  • getOWLEquivalentClassesAxiom,
  • getOWLObjectSomeValuesFrom,
  • getOWLNothing,
  • getOWLObjectComplementOf,
  • getOWLObjectPropertyAssertionAxiom,
  • getOWLAnnotationAssertionAxiom,
  • getOWLDataPropertyAssertionAxiom,
  • getOWLDatatype,
  • getOWLAnnotation

Popular in Java

  • Start an intent from android
  • startActivity (Activity)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • File (java.io)
    An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • Dictionary (java.util)
    Note: Do not use this class since it is obsolete. Please use the Map interface for new implementatio
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • Collectors (java.util.stream)
  • DateTimeFormat (org.joda.time.format)
    Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
  • 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