All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.jena.ontapi.model.OntEntity Maven / Gradle / Ivy

/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.apache.jena.ontapi.model;

import org.apache.jena.ontapi.common.OntPersonality;
import org.apache.jena.ontapi.utils.Iterators;
import org.apache.jena.util.iterator.ExtendedIterator;
import org.apache.jena.vocabulary.OWL2;

import java.util.Set;

/**
 * The base interface for OWL entities, which are always URI-{@link org.apache.jena.rdf.model.Resource}.
 * In OWL2 there are 6 types of entities, see below.
 *
 * @see OntClass.Named
 * @see OntDataRange.Named
 * @see OntIndividual.Named
 * @see OntAnnotationProperty
 * @see OntObjectProperty.Named
 * @see OntDataProperty
 */
public interface OntEntity extends OntObject {

    Set> TYPES = Set.of(
            OntClass.Named.class,
            OntDataRange.Named.class,
            OntIndividual.Named.class,
            OntObjectProperty.Named.class,
            OntAnnotationProperty.class,
            OntDataProperty.class
    );

    /**
     * Lists all OWL entity types.
     *
     * @return an {@link ExtendedIterator} of OWL entity {@code Class}-types
     */
    static ExtendedIterator> listEntityTypes() {
        return Iterators.of(
                OntClass.Named.class,
                OntDataRange.Named.class,
                OntIndividual.Named.class,
                OntObjectProperty.Named.class,
                OntAnnotationProperty.class,
                OntDataProperty.class
        );
    }

    /**
     * Determines if this is a builtin entity.
     * In a standard (default) OWL2 vocabulary an entity is builtin if it is:
     * 
    *
  • a {@link OntClass.Named class} and its IRI is either {@code owl:Thing} or {@code owl:Nothing}
  • *
  • an {@link OntObjectProperty.Named object property} and its IRI is either {@code owl:topObjectProperty} * or {@code owl:bottomObjectProperty}
  • *
  • a {@link OntDataProperty data property} and its IRI is either {@code owl:topDataProperty} * or {@code owl:bottomDataProperty}
  • *
  • a {@link OntDataRange.Named datatype} and its IRI is either {@code rdfs:Literal}, * or {@code rdf:PlainLiteral}, * or it is from the OWL 2 datatype map
  • *
  • an {@link OntAnnotationProperty annotation property} and its IRI is one of the following: *
      *
    • {@code rdfs:label}
    • *
    • {@code rdfs:comment}
    • *
    • {@code rdfs:seeAlso}
    • *
    • {@code rdfs:isDefinedBy}
    • *
    • {@code owl:deprecated}
    • *
    • {@code owl:versionInfo}
    • *
    • {@code owl:priorVersion}
    • *
    • {@code owl:backwardCompatibleWith}
    • *
    • {@code owl:incompatibleWith}
    • *
    *
  • *
* Note: all the listed above IRIs refer * to the default {@link OntPersonality.Builtins Builtins Vocabulary}. * A model with different {@code Builtins} vocabulary will naturally have a different {@code Set} of builtin IRIs, * and this method will return a different result. * * @return {@code true} if it is a built-in entity * @see OWL2 * @see OntPersonality.Builtins */ @SuppressWarnings("javadoc") boolean isBuiltIn(); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy