ru.avicomp.ontapi.jena.model.CreateClasses Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ontapi Show documentation
Show all versions of ontapi Show documentation
ONT-API is an OWL-API impl over Apache Jena
The newest version!
/*
* This file is part of the ONT API.
* The contents of this file are subject to the LGPL License, Version 3.0.
* Copyright (c) 2019, Avicomp Services, AO
*
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
* You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
*
* Alternatively, the contents of this file may be used under the terms of the Apache License, Version 2.0 in which case, the provisions of the Apache License Version 2.0 are applicable instead of those above.
* Licensed 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 ru.avicomp.ontapi.jena.model;
import org.apache.jena.rdf.model.Literal;
import java.util.Arrays;
import java.util.Collection;
/**
* A technical interface to generate {@link OntCE Class Expression}s.
* Created by @ssz on 13.05.2019.
*
* @since 1.4.0
*/
interface CreateClasses {
/**
* Creates an Existential Quantification Object Property Restriction.
* The RDF structure:
* {@code
* _:x rdf:type owl:Restriction .
* _:x owl:onProperty P .
* _:x owl:someValuesFrom C .
* }
*
* @param property {@link OntOPE object property expression}, not {@code null}
* @param ce {@link OntCE class expression}, not {@code null}
* @return {@link OntCE.ObjectSomeValuesFrom}
* @see 8.2.1 Existential Quantification
*/
OntCE.ObjectSomeValuesFrom createObjectSomeValuesFrom(OntOPE property, OntCE ce);
/**
* Creates an Existential Quantification Data Property Restriction.
* The RDF structure:
* {@code
* _:x rdf:type owl:Restriction .
* _:x owl:onProperty R .
* _:x owl:someValuesFrom D .
* }
*
* @param property {@link OntNDP data property}, not {@code null}
* @param dr {@link OntDR data range}, not {@code null}
* @return {@link OntCE.DataSomeValuesFrom}
* @see 8.4.1 Existential Quantification
*/
OntCE.DataSomeValuesFrom createDataSomeValuesFrom(OntNDP property, OntDR dr);
/**
* Creates an Universal Quantification Object Property Restriction.
* The RDF structure:
* {@code
* _:x rdf:type owl:Restriction .
* _:x owl:onProperty P .
* _:x owl:allValuesFrom C .
* }
*
* @param property {@link OntOPE object property expression}, not {@code null}
* @param ce {@link OntCE class expression}, not {@code null}
* @return {@link OntCE.ObjectAllValuesFrom}
* @see 8.2.2 Universal Quantification
*/
OntCE.ObjectAllValuesFrom createObjectAllValuesFrom(OntOPE property, OntCE ce);
/**
* Creates an Universal Quantification Data Property Restriction.
* The RDF structure:
* {@code
* _:x rdf:type owl:Restriction .
* _:x owl:onProperty R .
* _:x owl:allValuesFrom D .
* }
*
* @param property {@link OntNDP data property}, not {@code null}
* @param dr {@link OntDR data range}, not {@code null}
* @return {@link OntCE.DataAllValuesFrom}
* @see 8.4.2 Universal Quantification
*/
OntCE.DataAllValuesFrom createDataAllValuesFrom(OntNDP property, OntDR dr);
/**
* Creates an Individual Value Restriction.
* The RDF structure:
* {@code
* _:x rdf:type owl:Restriction .
* _:x owl:onProperty P .
* _:x owl:hasValue a .
* }
*
* @param property {@link OntOPE object property expression}, not {@code null}
* @param individual {@link OntIndividual}, not {@code null}
* @return {@link OntCE.ObjectHasValue}
* @see 8.2.3 Individual Value Restriction
*/
OntCE.ObjectHasValue createObjectHasValue(OntOPE property, OntIndividual individual);
/**
* Creates a Literal Value Restriction.
* The RDF structure:
* {@code
* _:x rdf:type owl:Restriction .
* _:x owl:onProperty R .
* _:x owl:hasValue v .
* }
*
* @param property {@link OntNDP data property}, not {@code null}
* @param literal {@link Literal}, not {@code null}
* @return {@link OntCE.DataHasValue}
* @see 8.4.3 Literal Value Restriction
*/
OntCE.DataHasValue createDataHasValue(OntNDP property, Literal literal);
/**
* Creates an Object Minimum Cardinality Restriction, possible Qualified.
* If {@code ce} is {@code null}, it is taken to be {@link ru.avicomp.ontapi.jena.vocabulary.OWL#Thing owl:Thing}.
* In that case the return restriction is unqualified.
* The RDF structure:
* {@code
* _:x rdf:type owl:Restriction .
* _:x owl:onProperty P .
* _:x owl:minCardinality n .
* } or {@code
* _:x rdf:type owl:Restriction .
* _:x owl:onProperty P .
* _:x owl:minQualifiedCardinality n .
* _:x owl:onClass C .
* }
*
* @param property {@link OntOPE object property expression}, not {@code null}
* @param cardinality int, non-negative number
* @param ce {@link OntCE class expression} or {@code null}
* @return {@link OntCE.ObjectMinCardinality}
* @see 8.3.1 Minimum Cardinality
*/
OntCE.ObjectMinCardinality createObjectMinCardinality(OntOPE property, int cardinality, OntCE ce);
/**
* Creates a Data Minimum Cardinality Restriction, possible Qualified.
* If {@code dr} is {@code null}, it is taken to be {@link org.apache.jena.vocabulary.RDFS#Literal rdfs:Literal}.
* The RDF structure:
* {@code
* _:x rdf:type owl:Restriction .
* _:x owl:onProperty R .
* _:x owl:minCardinality n .
* } or {@code
* _:x rdf:type owl:Restriction .
* _:x owl:onProperty R .
* _:x owl:minQualifiedCardinality n .
* _:x owl:onDataRange D .
* }
*
* @param property {@link OntNDP data property}, not {@code null}
* @param cardinality int, non-negative number
* @param dr {@link OntDR data range}, not {@code null}
* @return {@link OntCE.DataMinCardinality}
* @see 8.5.1 Minimum Cardinality
*/
OntCE.DataMinCardinality createDataMinCardinality(OntNDP property, int cardinality, OntDR dr);
/**
* Creates an Object Maximum Cardinality Restriction, possible Qualified.
* If {@code ce} is {@code null}, it is taken to be {@link ru.avicomp.ontapi.jena.vocabulary.OWL#Thing owl:Thing}.
* In that case the return restriction is unqualified.
* The RDF structure:
* {@code
* _:x rdf:type owl:Restriction .
* _:x owl:onProperty P .
* _:x owl:maxCardinality n .
* } or {@code
* _:x rdf:type owl:Restriction .
* _:x owl:onProperty P .
* _:x owl:maxQualifiedCardinality n .
* _:x owl:onClass C .
* }
*
* @param property {@link OntOPE object property expression}, not {@code null}
* @param cardinality, int, non-negative number
* @param ce {@link OntCE class expression} or {@code null}
* @return {@link OntCE.ObjectMaxCardinality}
* @see 8.3.2 Maximum Cardinality
*/
OntCE.ObjectMaxCardinality createObjectMaxCardinality(OntOPE property, int cardinality, OntCE ce);
/**
* Creates a Data Maximum Cardinality Restriction, possible Qualified.
* If {@code dr} is {@code null}, it is taken to be {@link org.apache.jena.vocabulary.RDFS#Literal rdfs:Literal}.
* The RDF structure:
* {@code
* _:x rdf:type owl:Restriction .
* _:x owl:onProperty R .
* _:x owl:maxCardinality n .
* } or {@code
* _:x rdf:type owl:Restriction .
* _:x owl:onProperty R .
* _:x owl:maxQualifiedCardinality n .
* _:x owl:onDataRange D .
* }
*
* @param property {@link OntNDP data property}, not {@code null}
* @param cardinality int, non-negative number
* @param dr {@link OntDR data range}, not {@code null}
* @return {@link OntCE.DataMaxCardinality}
* @see 8.5.2 Maximum Cardinality
*/
OntCE.DataMaxCardinality createDataMaxCardinality(OntNDP property, int cardinality, OntDR dr);
/**
* Creates an Object Exact Cardinality Restriction, possible Qualified.
* If {@code ce} is {@code null}, it is taken to be {@link ru.avicomp.ontapi.jena.vocabulary.OWL#Thing owl:Thing}.
* In that case the return restriction is unqualified.
* The RDF structure:
* {@code
* _:x rdf:type owl:Restriction .
* _:x owl:onProperty P .
* _:x owl:cardinality n .
* } or {@code
* _:x rdf:type owl:Restriction .
* _:x owl:onProperty P .
* _:x owl:qualifiedCardinality n .
* _:x owl:onClass C .
* }
*
* @param property {@link OntOPE object property expression}, not {@code null}
* @param cardinality, int, non-negative number
* @param ce {@link OntCE class expression} or {@code null}
* @return {@link OntCE.ObjectCardinality}
* @see 8.3.3 Exact Cardinality
*/
OntCE.ObjectCardinality createObjectCardinality(OntOPE property, int cardinality, OntCE ce);
/**
* Creates a Data Exact Cardinality Restriction, possible Qualified.
* If {@code dr} is {@code null}, it is taken to be {@link org.apache.jena.vocabulary.RDFS#Literal rdfs:Literal}.
* The RDF structure:
* {@code
* _:x rdf:type owl:Restriction .
* _:x owl:onProperty R .
* _:x owl:cardinality n .
* } or {@code
* _:x rdf:type owl:Restriction .
* _:x owl:onProperty R .
* _:x owl:qualifiedCardinality n .
* _:x owl:onDataRange D .
* }
*
* @param property {@link OntNDP data property}, not {@code null}
* @param cardinality int, non-negative number
* @param dr {@link OntDR data range}, not {@code null}
* @return {@link OntCE.DataCardinality}
* @see 8.5.3 Exact Cardinality
*/
OntCE.DataCardinality createDataCardinality(OntNDP property, int cardinality, OntDR dr);
/**
* Creates a Local Reflexivity Class Expression (Self-Restriction).
* The RDF structure:
* {@code
* _:x rdf:type owl:Restriction .
* _:x owl:onProperty P .
* _:x owl:hasSelf "true"^^xsd:boolean .
* }
*
* @param property {@link OntOPE object property expression}, not {@code null}
* @return {@link OntCE.HasSelf}
* @see 8.2.4 Self-Restriction
*/
OntCE.HasSelf createHasSelf(OntOPE property);
/**
* Creates an Union of Class Expressions.
* The RDF structure:
* {@code
* _:x rdf:type owl:Class .
* _:x owl:unionOf ( C1 ... Cn ) .
* }
*
* @param classes {@code Collection} of {@link OntCE class expression}s without {@code null}s
* @return {@link OntCE.UnionOf}
* @see 8.1.2 Union of Class Expressions
*/
OntCE.UnionOf createUnionOf(Collection classes);
/**
* Creates an Intersection of Class Expressions.
* The RDF structure:
* {@code
* _:x rdf:type owl:Class .
* _:x owl:intersectionOf ( C1 ... Cn ) .
* }
*
* @param classes {@code Collection} of {@link OntCE class expression}s without {@code null}s
* @return {@link OntCE.IntersectionOf}
* @see 8.1.1 Intersection of Class Expressions
*/
OntCE.IntersectionOf createIntersectionOf(Collection classes);
/**
* Creates an Enumeration of Individuals.
* The RDF structure:
* {@code
* _:x rdf:type owl:Class .
* _:x owl:oneOf ( a1 ... an ).
* }
*
* @param individuals {@code Collection} of {@link OntIndividual individual}s without {@code null}s
* @return {@link OntCE.OneOf}
* @see 8.1.4 Enumeration of Individuals
*/
OntCE.OneOf createOneOf(Collection individuals);
/**
* Create a Complement of Class Expressions.
* The RDF structure:
* {@code
* _:x rdf:type owl:Class .
* _:x owl:complementOf C .
* }
*
* @param ce {@link OntCE class expression} or {@code null}
* @return {@link OntCE.ComplementOf}
* @see 8.1.3 Complement of Class Expressions
*/
OntCE.ComplementOf createComplementOf(OntCE ce);
/**
* Creates a N-Ary Data Universal Quantification N-Ary Restriction.
* Note: currently an Unary Restriction is preferable since in OWL2 data-range arity is always {@code 1}.
* The RDF structure:
* {@code
* _:x rdf:type owl:Restriction .
* _:x owl:onProperties ( R1 ... Rn ) .
* _:x owl:allValuesFrom Dn .
* }
*
* @param properties {@code Collection} of {@link OntDR data range}s without {@code null}s
* @param dr {@link OntDR data range}, not {@code null}
* @return {@link OntCE.NaryDataAllValuesFrom}
* @see OntDR#arity()
* @see #createDataAllValuesFrom(OntNDP, OntDR)
* @see 8.4.2 Universal Quantification
*/
OntCE.NaryDataAllValuesFrom createDataAllValuesFrom(Collection properties, OntDR dr);
/**
* Creates a N-Ary Data Existential Quantification N-Ary Restriction.
* Note: currently an Unary Restriction is preferable since in OWL2 data-range arity is always {@code 1}.
* The RDF structure:
* {@code
* _:x rdf:type owl:Restriction .
* _:x owl:onProperties ( R1 ... Rn ) .
* _:x owl:someValuesFrom Dn .
* }
*
* @param properties {@code Collection} of {@link OntDR data range}s without {@code null}s
* @param dr {@link OntDR data range}, not {@code null}
* @return {@link OntCE.NaryDataAllValuesFrom}
* @see OntDR#arity()
* @see #createDataSomeValuesFrom(OntNDP, OntDR)
* @see 8.4.1 Existential Quantification
*/
OntCE.NaryDataSomeValuesFrom createDataSomeValuesFrom(Collection properties, OntDR dr);
/**
* Creates an Intersection of Class Expressions.
*
* @param classes Array of {@link OntCE class expression}s without {@code null}s
* @return {@link OntCE.IntersectionOf}
* @see #createIntersectionOf(Collection)
* @since 1.4.0
*/
default OntCE.IntersectionOf createIntersectionOf(OntCE... classes) {
return createIntersectionOf(Arrays.asList(classes));
}
/**
* Creates an Union of Class Expressions.
*
* @param classes Array of {@link OntCE class expression}s without {@code null}s
* @return {@link OntCE.UnionOf}
* @see #createUnionOf(Collection)
* @since 1.4.0
*/
default OntCE.UnionOf createUnionOf(OntCE... classes) {
return createUnionOf(Arrays.asList(classes));
}
/**
* Creates an Enumeration of Individuals.
*
* @param individuals Array of {@link OntIndividual individual}s without {@code null}s
* @return {@link OntCE.OneOf}
* @see #createOneOf(Collection)
* @since 1.4.0
*/
default OntCE.OneOf createOneOf(OntIndividual... individuals) {
return createOneOf(Arrays.asList(individuals));
}
}