Skip to content

Commit 6149be2

Browse files
committed
ont-api: major renaming com.github.owlcs.ontapi.OntologyModel -> com.github.owlcs.ontapi.Ontology (issue #4)
1 parent fe232be commit 6149be2

File tree

63 files changed

+682
-677
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+682
-677
lines changed

src/main/java/com/github/owlcs/ontapi/OWLAdapter.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,10 @@ public OntologyManagerImpl asIMPL(OWLOntologyManager manager) {
160160
* Performs mapping {@code OWLOntology -> OntologyModel}.
161161
*
162162
* @param ont {@link OWLOntology}, not {@code null}
163-
* @return {@link OntologyModel}
163+
* @return {@link Ontology}
164164
*/
165-
public OntologyModel asONT(OWLOntology ont) {
166-
return (OntologyModel) ont;
165+
public Ontology asONT(OWLOntology ont) {
166+
return (Ontology) ont;
167167
}
168168

169169
/**
@@ -193,10 +193,10 @@ public OntologyFactory asONT(OWLOntologyFactory factory) {
193193
/**
194194
* Performs mapping {@code OntologyModel -> InternalModelHolder}.
195195
*
196-
* @param ont {@link OntologyModel}, not {@code null}
196+
* @param ont {@link Ontology}, not {@code null}
197197
* @return {@link BaseModel}
198198
*/
199-
public BaseModel asBaseModel(OntologyModel ont) {
199+
public BaseModel asBaseModel(Ontology ont) {
200200
return (BaseModel) ont;
201201
}
202202

src/main/java/com/github/owlcs/ontapi/OWLFactoryWrapper.java

+10-8
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,11 @@
3232

3333
/**
3434
* An implementation of {@link OntologyLoader} which is actually {@link OWLOntologyFactory} decorator.
35-
* Used to load {@link OntologyModel ontology} through pure OWL-API mechanisms (i.e. owl-api parsers).
35+
* Used to load {@link Ontology ontology} through pure OWL-API mechanisms (i.e. owl-api parsers).
3636
* Some formats (such as {@link org.semanticweb.owlapi.formats.ManchesterSyntaxDocumentFormat} or
3737
* {@link org.semanticweb.owlapi.formats.FunctionalSyntaxDocumentFormat}) are not supported by Jena,
3838
* so this is the only way to handle them by ONT-API.
39+
*
3940
* @see OntologyLoaderImpl
4041
* @see com.github.owlcs.ontapi.config.LoadSettings#isUseOWLParsersToLoad()
4142
*/
@@ -108,7 +109,7 @@ public OntLoaderConfiguration optimize(OntLoaderConfiguration config) {
108109
/**
109110
* {@inheritDoc}
110111
*
111-
* @param builder {@link OntologyCreator} to construct a fresh {@link OntologyModel} instance
112+
* @param builder {@link OntologyCreator} to construct a fresh {@link Ontology} instance
112113
* @param manager {@link OntologyManager}
113114
* @param source {@link OWLOntologyDocumentSource}
114115
* @param conf {@link OntLoaderConfiguration}
@@ -119,10 +120,10 @@ public OntLoaderConfiguration optimize(OntLoaderConfiguration config) {
119120
* @throws OWLOntologyCreationException if any other problem occurs
120121
*/
121122
@Override
122-
public OntologyModel loadOntology(OntologyCreator builder,
123-
OntologyManager manager,
124-
OWLOntologyDocumentSource source,
125-
OntLoaderConfiguration conf) throws OWLOntologyCreationException {
123+
public Ontology loadOntology(OntologyCreator builder,
124+
OntologyManager manager,
125+
OWLOntologyDocumentSource source,
126+
OntLoaderConfiguration conf) throws OWLOntologyCreationException {
126127
OWLAdapter adapter = getAdapter();
127128
OWLOntologyFactory factory = new FactoryImpl(builder);
128129
try {
@@ -131,7 +132,7 @@ public OntologyModel loadOntology(OntologyCreator builder,
131132
throw new OntologyFactoryImpl.BadRecursionException("Cycle loading for source " + doc);
132133
}
133134
sources.add(doc);
134-
OntologyModel res = getAdapter().asONT(factory.loadOWLOntology(manager, source, adapter.asHandler(manager), conf));
135+
Ontology res = getAdapter().asONT(factory.loadOWLOntology(manager, source, adapter.asHandler(manager), conf));
135136
if (LOGGER.isDebugEnabled()) {
136137
OntFormat format = OntFormat.get(manager.getOntologyFormat(res));
137138
LOGGER.debug("The ontology <{}> is loaded. Format: {}[{}]", res.getOntologyID(), format, source.getClass().getSimpleName());
@@ -230,7 +231,8 @@ public static class FactoryImpl implements OWLOntologyFactory, HasAdapter {
230231

231232
/**
232233
* Creates an OWL-API compatible factory.
233-
* This version cannot be used with ONT-API if the builder does not produce {@link OntologyModel}.
234+
* This version cannot be used with ONT-API if the builder does not produce {@link Ontology}.
235+
*
234236
* @param builder {@link OWLOntologyBuilder}, not {@code null}
235237
*/
236238
public FactoryImpl(OWLOntologyBuilder builder) {

src/main/java/com/github/owlcs/ontapi/OWLOntologyWrapper.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434
/**
3535
* A decorator for any {@link OWLOntology} instance.
36-
* Notices that it does not implement {@link OntologyModel} and therefore cannot be used in ONT-API directly.
36+
* Notices that it does not implement {@link Ontology} and therefore cannot be used in ONT-API directly.
3737
* <p>
3838
* Matthew Horridge Stanford Center for Biomedical Informatics Research 03/04/15
3939
*

src/main/java/com/github/owlcs/ontapi/OntBaseModelImpl.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1104,10 +1104,10 @@ public boolean equals(@Nullable Object obj) {
11041104
if (obj == this) {
11051105
return true;
11061106
}
1107-
if (!(obj instanceof OntologyModel)) {
1107+
if (!(obj instanceof Ontology)) {
11081108
return false;
11091109
}
1110-
OntGraphModel right = ((OntologyModel) obj).asGraphModel();
1110+
OntGraphModel right = ((Ontology) obj).asGraphModel();
11111111
OntGraphModel left = getBase();
11121112
return left.getID().sameAs(right.getID());
11131113
}

src/main/java/com/github/owlcs/ontapi/OntManagers.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414

1515
package com.github.owlcs.ontapi;
1616

17+
import com.github.owlcs.ontapi.jena.OntModelFactory;
1718
import com.google.common.collect.LinkedListMultimap;
1819
import org.semanticweb.owlapi.io.OWLParserFactory;
1920
import org.semanticweb.owlapi.model.*;
20-
import com.github.owlcs.ontapi.jena.OntModelFactory;
2121

2222
import java.lang.reflect.Constructor;
2323
import java.lang.reflect.InvocationTargetException;
@@ -66,7 +66,7 @@ public class OntManagers implements OWLOntologyManagerFactory {
6666
* <p>
6767
* Alternative way to assembly ontology is direct working with the {@link org.apache.jena.graph.Graph Graph}
6868
* through the {@link com.github.owlcs.ontapi.jena.model.OntGraphModel} view of the ontology,
69-
* that can be obtained using the method {@link OntologyModel#asGraphModel()}.
69+
* that can be obtained using the method {@link Ontology#asGraphModel()}.
7070
* The first way of ontology editing is native for OWL-API,
7171
* the second way is native for Apache Jena and provided by ONT-API as a feature,
7272
* that actually underlies any interaction with ontologies in ONT-API.

src/main/java/com/github/owlcs/ontapi/OntologyModel.java renamed to src/main/java/com/github/owlcs/ontapi/Ontology.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,21 @@
1414

1515
package com.github.owlcs.ontapi;
1616

17-
import org.semanticweb.owlapi.model.OWLOntology;
1817
import com.github.owlcs.ontapi.config.AxiomsSettings;
1918
import com.github.owlcs.ontapi.jena.model.OntGraphModel;
19+
import org.semanticweb.owlapi.model.OWLOntology;
2020

2121
/**
22-
* A Structural Ontological Model, that is an extended {@link OWLOntology OWL-API Ontology}, and
23-
* represents an <a href="http://www.w3.org/TR/owl2-syntax/#Ontologies">Ontology</a> in the OWL2 specification.
22+
* A Structural Ontological Model, that is an extended {@link OWLOntology OWL-API Ontology}.
23+
* It represents an <a href="http://www.w3.org/TR/owl2-syntax/#Ontologies">Ontology</a> in the OWL2 specification.
2424
* This interface provides a wide range of methods inherited from OWL-API
2525
* for working with structural (OWL Axioms and Annotations) representation of data
2626
* stored in the form of {@link org.apache.jena.graph.Graph RDF Graph}.
2727
* In addition to this range, there are also two new methods: {@link #asGraphModel()} and {@link #clearCache()}.
2828
* <p>
2929
* Created by szuev on 24.10.2016.
3030
*/
31-
public interface OntologyModel extends OWLOntology {
31+
public interface Ontology extends OWLOntology {
3232

3333
/**
3434
* Returns the jena model shadow,

src/main/java/com/github/owlcs/ontapi/OntologyBuilderImpl.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
/**
2626
* An implementation of {@link OntologyFactory.Builder} - a technical factory to create standalone ontology instances.
27-
* This should be the only way to create {@link OntologyModel} instances.
27+
* This should be the only way to create {@link Ontology} instances.
2828
*/
2929
@SuppressWarnings("WeakerAccess")
3030
@ParametersAreNonnullByDefault
@@ -36,15 +36,15 @@ public OWLAdapter getAdapter() {
3636
}
3737

3838
@Override
39-
public OntologyModel createOntology(ID id, OntologyManager manager, OntLoaderConfiguration config) {
39+
public Ontology createOntology(ID id, OntologyManager manager, OntLoaderConfiguration config) {
4040
OntologyManagerImpl m = getAdapter().asIMPL(manager);
4141
OntologyModelImpl res = createOntologyImpl(createGraph(), m, config);
4242
res.setOntologyID(id);
4343
return withLock(res, m.getLock());
4444
}
4545

4646
@Override
47-
public OntologyModel createOntology(Graph graph, OntologyManager manager, OntLoaderConfiguration config) {
47+
public Ontology createOntology(Graph graph, OntologyManager manager, OntLoaderConfiguration config) {
4848
OntologyManagerImpl m = getAdapter().asIMPL(manager);
4949
return withLock(createOntologyImpl(graph, m, config), m.getLock());
5050
}
@@ -79,11 +79,11 @@ protected ModelConfig createModelConfig(OntologyManagerImpl manager, OntLoaderCo
7979
/**
8080
* Wraps the given {@code ont} as a concurrent R/W locked view impl, if it is needed.
8181
*
82-
* @param ont {@link OntologyModelImpl}, not {@code null}
82+
* @param ont {@link OntologyModelImpl}, not {@code null}
8383
* @param lock {@link ReadWriteLock}, possible {@code null}
84-
* @return {@link OntologyModel} instance
84+
* @return {@link Ontology} instance
8585
*/
86-
protected OntologyModel withLock(OntologyModelImpl ont, ReadWriteLock lock) {
86+
protected Ontology withLock(OntologyModelImpl ont, ReadWriteLock lock) {
8787
if (!NoOpReadWriteLock.isConcurrent(lock)) return ont;
8888
return new OntologyModelImpl.Concurrent(ont, lock);
8989
}

src/main/java/com/github/owlcs/ontapi/OntologyCreator.java

+7-6
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@
2222
import java.util.Objects;
2323

2424
/**
25-
* An interface to create {@link OntologyModel} instances.
25+
* An interface to create {@link Ontology} instances.
2626
* Created by @ssz on 03.06.2019.
27+
*
2728
* @since 1.4.1
2829
*/
2930
public interface OntologyCreator {
@@ -33,14 +34,14 @@ public interface OntologyCreator {
3334
* which is associated to the specified manager.
3435
* Does not change the manager state,
3536
* although the returned ontology must have a reference to the given manager,
36-
* i.e. the method {@link OntologyModel#getOWLOntologyManager()} must return the passed manager instance.
37+
* i.e. the method {@link Ontology#getOWLOntologyManager()} must return the passed manager instance.
3738
*
3839
* @param id {@link ID}, not {@code null}
3940
* @param manager {@link OntologyManager}, not {@code null}
4041
* @param config {@link OntLoaderConfiguration} the config, not {@code null}
41-
* @return {@link OntologyModel} new instance reflecting manager settings
42+
* @return {@link Ontology} new instance reflecting manager settings
4243
*/
43-
OntologyModel createOntology(ID id, OntologyManager manager, OntLoaderConfiguration config);
44+
Ontology createOntology(ID id, OntologyManager manager, OntLoaderConfiguration config);
4445

4546
/**
4647
* Creates a new detached ontology model which wraps the specified {@link Graph graph}.
@@ -50,10 +51,10 @@ public interface OntologyCreator {
5051
* @param graph {@link Graph} the graph, not {@code null}
5152
* @param manager {@link OntologyManager} manager, not {@code null}
5253
* @param config {@link OntLoaderConfiguration} the config, not {@code null}
53-
* @return {@link OntologyModel} new instance reflecting manager settings
54+
* @return {@link Ontology} new instance reflecting manager settings
5455
* @since 1.3.0
5556
*/
56-
OntologyModel createOntology(Graph graph, OntologyManager manager, OntLoaderConfiguration config);
57+
Ontology createOntology(Graph graph, OntologyManager manager, OntLoaderConfiguration config);
5758

5859
/**
5960
* Creates a fresh empty {@link Graph RDF Graph} instance.

src/main/java/com/github/owlcs/ontapi/OntologyFactory.java

+23-22
Original file line numberDiff line numberDiff line change
@@ -52,46 +52,47 @@ public interface OntologyFactory extends OWLOntologyFactory, HasAdapter {
5252

5353
/**
5454
* Adds the specified ontology into the manager and performs some final tuning actions.
55+
*
5556
* @param manager {@link OntologyManager} the ontology manager, which will hold the {@code model}, not {@code null}
56-
* @param model {@link OntologyModel} that has been created by the {@link #getBuilder() Builder}, not {@code null}
57+
* @param model {@link Ontology} that has been created by the {@link #getBuilder() Builder}, not {@code null}
5758
* @since 1.4.2
5859
*/
59-
void includeOntology(OntologyManager manager, OntologyModel model);
60+
void includeOntology(OntologyManager manager, Ontology model);
6061

6162
/**
62-
* Creates a fresh {@link OntologyModel Ontology Model} inside the manager
63+
* Creates a fresh {@link Ontology Ontology Model} inside the manager
6364
* with the given ID and default configuration.
6465
*
6566
* @param manager {@link OntologyManager} the ontology manager to set, not {@code null}
6667
* @param id {@link ID} the ID of the ontology to create, not {@code null}
67-
* @return {@link OntologyModel}
68+
* @return {@link Ontology}
6869
* @throws OntApiException if something goes wrong
6970
* @since 1.3.0
7071
*/
71-
default OntologyModel createOntology(OntologyManager manager, ID id) throws OntApiException {
72-
OntologyModel res = getBuilder().createOntology(id, manager, manager.getOntologyLoaderConfiguration());
72+
default Ontology createOntology(OntologyManager manager, ID id) throws OntApiException {
73+
Ontology res = getBuilder().createOntology(id, manager, manager.getOntologyLoaderConfiguration());
7374
includeOntology(manager, res);
7475
return res;
7576
}
7677

7778
/**
7879
* Reads a graph from the given document source and stores
79-
* it as a ready to use {@link OntologyModel Ontology Model} in the specified manager.
80+
* it as a ready to use {@link Ontology Ontology Model} in the specified manager.
8081
* {@inheritDoc}
8182
*
8283
* @param manager {@link OntologyManager} manager the ontology manager to set, not {@code null}
8384
* @param source {@link OWLOntologyDocumentSource} the document source that provides the means
8485
* of getting a representation of a document, not {@code null}
8586
* @param config {@link OntLoaderConfiguration} settings to manage loading process, not {@code null}
86-
* @return {@link OntologyModel}
87+
* @return {@link Ontology}
8788
* @throws OWLOntologyCreationException if the ontology could not be created due to some I/O problem,
8889
* broken source or incompatible state of manager
8990
* @throws OntApiException if something else goes wrong
9091
* @since 1.3.0
9192
*/
92-
default OntologyModel loadOntology(OntologyManager manager,
93-
OWLOntologyDocumentSource source,
94-
OntLoaderConfiguration config) throws OWLOntologyCreationException, OntApiException {
93+
default Ontology loadOntology(OntologyManager manager,
94+
OWLOntologyDocumentSource source,
95+
OntLoaderConfiguration config) throws OWLOntologyCreationException, OntApiException {
9596
return getLoader().loadOntology(getBuilder(), manager, source, config);
9697
}
9798

@@ -131,14 +132,14 @@ default boolean canAttemptLoading(OWLOntologyDocumentSource source) {
131132
* @param id {@link OWLOntologyID} the ID of the ontology to create, not {@code null}
132133
* @param documentIRI unused parameter
133134
* @param handler unused parameter
134-
* @return {@link OntologyModel} the newly created ontology
135+
* @return {@link Ontology} the newly created ontology
135136
* @throws OntApiException if something goes wrong
136137
*/
137138
@Override
138-
default OntologyModel createOWLOntology(OWLOntologyManager manager,
139-
OWLOntologyID id,
140-
IRI documentIRI,
141-
OWLOntologyCreationHandler handler) {
139+
default Ontology createOWLOntology(OWLOntologyManager manager,
140+
OWLOntologyID id,
141+
IRI documentIRI,
142+
OWLOntologyCreationHandler handler) {
142143
Adapter adapter = getAdapter();
143144
return createOntology(adapter.asONT(manager), adapter.asONT(id));
144145
}
@@ -152,16 +153,16 @@ default OntologyModel createOWLOntology(OWLOntologyManager manager,
152153
* @param handler unused parameter
153154
* @param config {@link OWLOntologyLoaderConfiguration} a configuration object which can be used
154155
* to pass various options to th loader, not {@code null}
155-
* @return {@link OntologyModel} the newly created and loaded ontology
156+
* @return {@link Ontology} the newly created and loaded ontology
156157
* @throws OWLOntologyCreationException if the ontology could not be created due to some I/O problem,
157158
* broken source or incompatible state of manager
158159
* @throws OntApiException if something else goes wrong
159160
*/
160161
@Override
161-
default OntologyModel loadOWLOntology(OWLOntologyManager manager,
162-
OWLOntologyDocumentSource source,
163-
OWLOntologyCreationHandler handler,
164-
OWLOntologyLoaderConfiguration config) throws OWLOntologyCreationException {
162+
default Ontology loadOWLOntology(OWLOntologyManager manager,
163+
OWLOntologyDocumentSource source,
164+
OWLOntologyCreationHandler handler,
165+
OWLOntologyLoaderConfiguration config) throws OWLOntologyCreationException {
165166
Adapter adapter = getAdapter();
166167
return loadOntology(adapter.asONT(manager), source, adapter.asONT(config));
167168
}
@@ -174,7 +175,7 @@ default OntologyModel loadOWLOntology(OWLOntologyManager manager,
174175
interface Builder extends OntologyCreator, HasAdapter, OWLOntologyBuilder {
175176

176177
@Override
177-
default OntologyModel createOWLOntology(OWLOntologyManager manager, OWLOntologyID id) {
178+
default Ontology createOWLOntology(OWLOntologyManager manager, OWLOntologyID id) {
178179
Adapter adapter = getAdapter();
179180
return createOntology(adapter.asONT(id), adapter.asONT(manager),
180181
adapter.asONT(manager.getOntologyLoaderConfiguration()));

src/main/java/com/github/owlcs/ontapi/OntologyFactoryImpl.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414

1515
package com.github.owlcs.ontapi;
1616

17+
import com.github.owlcs.ontapi.jena.utils.Models;
18+
import com.github.owlcs.ontapi.transforms.TransformException;
1719
import org.apache.commons.lang3.StringUtils;
1820
import org.apache.jena.riot.system.ErrorHandlerFactory;
1921
import org.semanticweb.owlapi.model.IRI;
2022
import org.semanticweb.owlapi.model.OWLDocumentFormat;
2123
import org.semanticweb.owlapi.model.OWLOntologyCreationException;
2224
import org.semanticweb.owlapi.model.OWLOntologyFactory;
23-
import com.github.owlcs.ontapi.jena.utils.Models;
24-
import com.github.owlcs.ontapi.transforms.TransformException;
2525

2626
import javax.annotation.ParametersAreNonnullByDefault;
2727
import java.util.Objects;
@@ -76,7 +76,7 @@ public Loader getLoader() {
7676
* since it is more readable and more widely used in Jena-world.
7777
*/
7878
@Override
79-
public void includeOntology(OntologyManager manager, OntologyModel model) {
79+
public void includeOntology(OntologyManager manager, Ontology model) {
8080
if (model.getOWLOntologyManager() != manager) {
8181
throw new OntApiException.IllegalState("The specified ontology is attached to another manager: " + model);
8282
}

0 commit comments

Comments
 (0)