Skip to content

Commit

Permalink
ont-api: remove 'since' tag from Jena API subsystem + remove unused m…
Browse files Browse the repository at this point in the history
…ethods + cleanup javadocs
  • Loading branch information
sszuev committed Jan 2, 2020
1 parent 93518ef commit c4976e2
Show file tree
Hide file tree
Showing 58 changed files with 178 additions and 541 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* 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, The University of Manchester, owl.cs group.
* Copyright (c) 2020, The University of Manchester, owl.cs group.
*
* 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.
Expand All @@ -15,7 +15,6 @@
package com.github.owlcs.ontapi;

import com.github.owlcs.ontapi.jena.utils.Graphs;
import com.github.owlcs.ontapi.transforms.TransformationModel;
import org.apache.jena.atlas.web.ContentType;
import org.apache.jena.graph.Graph;
import org.apache.jena.riot.Lang;
Expand Down Expand Up @@ -65,10 +64,10 @@ public abstract class OntGraphDocumentSource implements OWLOntologyDocumentSourc
public abstract Graph getGraph();

/**
* Answers if the graph must be put in order by the transformations mechanism.
* Answers {@code true} iff the graph must be put in order by the transformations mechanism.
*
* @return {@code true} if graph transformations is allowed
* @see TransformationModel
* @return boolean, {@code true} if the graph transformations for this source are allowed
* @see com.github.owlcs.ontapi.config.LoadSettings#isPerformTransformation()
* @since 1.3.2
*/
public boolean withTransforms() {
Expand Down
13 changes: 7 additions & 6 deletions src/main/java/com/github/owlcs/ontapi/jena/OntVocabulary.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* 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, The University of Manchester, owl.cs group.
* Copyright (c) 2020, The University of Manchester, owl.cs group.
*
* 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.
Expand All @@ -16,7 +16,6 @@

import com.github.owlcs.ontapi.jena.utils.Iter;
import com.github.owlcs.ontapi.jena.vocabulary.*;
import com.github.owlcs.ontapi.transforms.GraphTransformers;
import org.apache.jena.datatypes.BaseDatatype;
import org.apache.jena.datatypes.RDFDatatype;
import org.apache.jena.datatypes.TypeMapper;
Expand Down Expand Up @@ -192,10 +191,12 @@ default Set<Resource> getBuiltinOWLEntities() {

/**
* A factory-helper to work with {@link OntVocabulary} instances, that wrap constant-holders
* from the packages {@link com.github.owlcs.ontapi.jena.vocabulary} and {@link org.apache.jena.vocabulary}
* (such as {@link OWL}).
* In ONT-API, a {@link OntVocabulary} is used to build {@link com.github.owlcs.ontapi.jena.impl.conf.OntPersonality}
* and in {@link GraphTransformers} subsystem.
* from the packages {@link com.github.owlcs.ontapi.jena.vocabulary}
* and {@link org.apache.jena.vocabulary} (such as {@link OWL}).
* <p>
* In ONT-API, a {@link OntVocabulary} singleton is used
* to build {@link com.github.owlcs.ontapi.jena.impl.conf.OntPersonality}
* and, also, in {@link com.github.owlcs.ontapi.transforms} subsystem.
* <p>
* Created by @szuev on 21.12.2016.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* 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, The University of Manchester, owl.cs group.
* Copyright (c) 2020, The University of Manchester, owl.cs group.
*
* 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.
Expand Down Expand Up @@ -438,7 +438,6 @@ protected void removeIterator(WIT<?> it) {
* A {@code WrappedIterator} with timestamp and possibility to change the base iterator.
*
* @param <X> anything
* @since 1.4.0
*/
public class WIT<X> extends WrappedIterator<X> {
protected final Thread thread;
Expand Down Expand Up @@ -594,8 +593,6 @@ public void forEachRemaining(Consumer<? super X> action) {

/**
* A wrapper for {@link PrefixMapping}.
*
* @since 1.4.0
*/
protected class WPM implements PrefixMapping {
private final PrefixMapping pm;
Expand Down
12 changes: 5 additions & 7 deletions src/main/java/com/github/owlcs/ontapi/jena/impl/Factories.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* 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, The University of Manchester, owl.cs group.
* Copyright (c) 2020, The University of Manchester, owl.cs group.
*
* 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.
Expand All @@ -14,16 +14,16 @@

package com.github.owlcs.ontapi.jena.impl;

import com.github.owlcs.ontapi.jena.impl.conf.*;
import com.github.owlcs.ontapi.jena.model.OntObject;
import com.github.owlcs.ontapi.jena.utils.Iter;
import com.github.owlcs.ontapi.jena.vocabulary.RDF;
import org.apache.jena.graph.FrontsNode;
import org.apache.jena.graph.Graph;
import org.apache.jena.graph.Node;
import org.apache.jena.graph.Triple;
import org.apache.jena.rdf.model.Resource;
import org.apache.jena.util.iterator.ExtendedIterator;
import com.github.owlcs.ontapi.jena.impl.conf.*;
import com.github.owlcs.ontapi.jena.model.OntObject;
import com.github.owlcs.ontapi.jena.utils.Iter;
import com.github.owlcs.ontapi.jena.vocabulary.RDF;

import java.util.Arrays;
import java.util.Objects;
Expand All @@ -34,8 +34,6 @@
* A helper(factory) to produce {@link ObjectFactory object factory} instances or its components.
* <p>
* Created by @ssz on 19.01.2019.
*
* @since 1.4.0
*/
class Factories {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* 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, The University of Manchester, owl.cs group.
* Copyright (c) 2020, The University of Manchester, owl.cs group.
*
* 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.
Expand Down Expand Up @@ -222,7 +222,6 @@ private static <S> S removeMin(Set<S> notEmptySet,
*
* @param annotation {@link OntAnnotation}
* @return {@link ExtendedIterator} of {@link OntStatement}s
* @since 1.3.0
*/
public static ExtendedIterator<OntStatement> listRelatedStatements(OntAnnotation annotation) {
OntAnnotationImpl a = (OntAnnotationImpl) annotation;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* 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, The University of Manchester, owl.cs group.
* Copyright (c) 2020, The University of Manchester, owl.cs group.
*
* 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.
Expand Down Expand Up @@ -33,7 +33,6 @@
import org.apache.jena.reasoner.Reasoner;
import org.apache.jena.shared.PrefixMapping;
import org.apache.jena.util.iterator.ExtendedIterator;
import org.apache.jena.util.iterator.NullIterator;
import org.apache.jena.vocabulary.RDFS;

import java.io.OutputStream;
Expand Down Expand Up @@ -131,7 +130,6 @@ public static <M extends EnhGraph & PersonalityModel, O extends OntObject> Exten
* with the {@link RDF#type rdf:type} as predicate, not {@code null}
* @param <M> a subtype of {@link OntModel} and {@link PersonalityModel}
* @return {@link ExtendedIterator} of {@link OntIndividual}s that are attached to the {@code model}
* @since 1.4.2
*/
public static <M extends OntModel & PersonalityModel> ExtendedIterator<OntIndividual> listIndividuals(M model,
Set<Node> system,
Expand Down Expand Up @@ -187,7 +185,6 @@ public static <M extends OntModel & PersonalityModel> ExtendedIterator<OntIndivi
* @param withSize if {@code true} attempts to include graph size as a estimated size of a future {@code Stream}
* @param <X> type of iterator's items
* @return {@code Stream} of {@link X}s
* @since 1.4.2
*/
private static <X> Stream<X> asStream(Graph graph,
ExtendedIterator<X> it,
Expand All @@ -206,7 +203,6 @@ private static <X> Stream<X> asStream(Graph graph,
*
* @param graph {@link Graph}
* @return int
* @since 1.4.2
*/
protected static int getSpliteratorCharacteristics(Graph graph) {
// a graph cannot return iterator with null-elements
Expand All @@ -224,7 +220,6 @@ protected static int getSpliteratorCharacteristics(Graph graph) {
* @param p {@link Property}, the predicate
* @param o {@link RDFNode}, the object
* @return boolean
* @since 1.4.2
*/
private static boolean isANY(Resource s, Property p, RDFNode o) {
if (s != null) return false;
Expand Down Expand Up @@ -344,7 +339,6 @@ protected void removeImportModel(Graph g, String u) {
*
* @param personality {@link OntPersonality}, not {@code null}
* @return <b>distinct</b> {@code ExtendedIterator} of {@link OntGraphModelImpl}s
* @since 1.4.2
*/
@SuppressWarnings("unused")
protected final ExtendedIterator<OntGraphModelImpl> listAllModels(OntPersonality personality) {
Expand All @@ -357,7 +351,6 @@ protected final ExtendedIterator<OntGraphModelImpl> listAllModels(OntPersonality
*
* @param personality {@link OntPersonality}, not {@code null}
* @return <b>non-distinct</b> {@code ExtendedIterator} of {@link OntGraphModelImpl}s
* @since 1.4.2
*/
protected final ExtendedIterator<OntGraphModelImpl> listImportModels(OntPersonality personality) {
return listImportGraphs().mapWith(u -> new OntGraphModelImpl(u, personality));
Expand All @@ -368,7 +361,6 @@ protected final ExtendedIterator<OntGraphModelImpl> listImportModels(OntPersonal
* This model graph is not included.
*
* @return <b>non-distinct</b> {@code ExtendedIterator} of {@link UnionGraph}
* @since 1.4.2
*/
protected final ExtendedIterator<UnionGraph> listImportGraphs() {
return getGraph().getUnderlying().listGraphs()
Expand All @@ -383,7 +375,6 @@ protected final ExtendedIterator<UnionGraph> listImportGraphs() {
*
* @return {@link OntGraphModelImpl}
* @see #getBaseModel()
* @since 1.3.0
*/
public OntGraphModelImpl getTopModel() {
if (independent()) {
Expand Down Expand Up @@ -617,7 +608,6 @@ public StmtIterator listStatements(Resource s, Property p, RDFNode o) {
* @param o {@link RDFNode} the object sought, can be {@code null}
* @return {@link ExtendedIterator} of {@link OntStatement}s
* @see #listStatements(Resource, Property, RDFNode)
* @since 1.3.0
*/
public ExtendedIterator<OntStatement> listOntStatements(Resource s, Property p, RDFNode o) {
return Iter.create(getGraph().find(asNode(s), asNode(p), asNode(o)).mapWith(this::asStatement));
Expand All @@ -634,7 +624,6 @@ public ExtendedIterator<OntStatement> listOntStatements(Resource s, Property p,
* @param o {@link RDFNode} the object sought, can be {@code null}
* @return {@link ExtendedIterator} of {@link OntStatement}s, which are local to the base graph
* @see #listStatements(Resource, Property, RDFNode)
* @since 1.3.0
*/
public ExtendedIterator<OntStatement> listLocalStatements(Resource s, Property p, RDFNode o) {
return Iter.create(getBaseGraph().find(asNode(s), asNode(p), asNode(o)).mapWith(this::asStatement));
Expand Down Expand Up @@ -689,71 +678,6 @@ public OntGraphModelImpl deleteOntList(OntObject subject, Property predicate, On
return this;
}

/**
* Extracts all members from []-list, that is an object in a <b>local</b> SPO with the specified predicate.
* The returned iterator includes the subject of the []-list root statement, if it is specified.
*
* @param subject {@code Class}-type of subject
* @param predicate {@link Property}
* @param object {@code Class}-type of object
* @param includeSubject if {@code true} then the subject of []-list root statement is also included
* @param <O> subtype of {@link OntObject}, the []-list members type
* @param <S> subtype of {@link OntObject} in the subject position of the SPO, where O is a []-list
* @return {@link ExtendedIterator} of {@link O}s
*/
protected <O extends OntObject, S extends O> ExtendedIterator<O> fromLocalList(Class<S> subject,
Property predicate,
Class<O> object,
boolean includeSubject) {
return Iter.flatMap(listLocalStatements(null, predicate, null), s -> {
S a = findNodeAs(s.getSubject().asNode(), subject);
if (a == null) return NullIterator.instance();
if (!s.getObject().canAs(RDFList.class)) return NullIterator.instance();
OntListImpl<O> list = OntListImpl.asOntList(s.getObject().as(RDFList.class),
this, s.getSubject(), predicate, null, object);
if (!includeSubject) return list.listMembers();
return Iter.concat(Iter.of(a), list.listMembers());
});
}

/**
* Lists all <b>local</b> objects for the given predicate and types of subject and object.
*
* @param subject {@code Class}-type of subject
* @param predicate {@link Property}
* @param object {@code Class}-type of object
* @param <O> subtype of {@link OntObject} in the object position of the found SPO
* @param <S> subtype of {@link OntObject} in the subject position of the found SPO
* @return {@link ExtendedIterator} of {@link O}s
*/
protected <O extends OntObject, S extends OntObject> ExtendedIterator<O> listLocalObjects(Class<S> subject,
Property predicate,
Class<O> object) {
return listLocalStatements(null, predicate, null).mapWith(s -> {
S left = findNodeAs(s.getSubject().asNode(), subject);
return left == null ? null : findNodeAs(s.getObject().asNode(), object);
}).filterDrop(Objects::isNull);
}

/**
* Lists <b>local</b> subjects and objects for the given predicate and the type of subject and object.
*
* @param predicate {@link Property}
* @param type {@code Class}-type of subject and object
* @param <R> subtype of {@link OntObject}, S and P from SPO must be of this type
* @return {@link ExtendedIterator} of {@link R}s
*/
protected <R extends OntObject> ExtendedIterator<R> listLocalSubjectAndObjects(Property predicate,
Class<R> type) {
return Iter.flatMap(listLocalStatements(null, predicate, null), s -> {
R a = findNodeAs(s.getSubject().asNode(), type);
if (a == null) return NullIterator.instance();
R b = findNodeAs(s.getObject().asNode(), type);
if (b == null) return NullIterator.instance();
return Iter.of(a, b);
});
}

@Override
public OntDisjoint.Classes createDisjointClasses(Collection<OntClass> classes) {
return OntDisjointImpl.createDisjointClasses(this, classes.stream());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* 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, The University of Manchester, owl.cs group.
* Copyright (c) 2020, The University of Manchester, owl.cs group.
*
* 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.
Expand Down Expand Up @@ -97,7 +97,6 @@ public ExtendedIterator<OntClass> listClasses() {
* @param direct if {@code true} returns only direct types, just like {@link #listClasses()}
* @return {@link ExtendedIterator} over all {@link OntClass class}-types
* @see #listClasses()
* @since 1.4.2
*/
@SuppressWarnings("unused")
public ExtendedIterator<OntClass> listClasses(boolean direct) {
Expand All @@ -110,7 +109,6 @@ public ExtendedIterator<OntClass> listClasses(boolean direct) {
*
* @param direct if {@code true} returns only direct types, just like {@code #listClasses().toSet()}
* @return a {@code Set} of all {@link OntClass class}-types
* @since 1.4.2
*/
public Set<OntClass> getClasses(boolean direct) {
if (direct) {
Expand Down
Loading

0 comments on commit c4976e2

Please sign in to comment.