Skip to content
This repository was archived by the owner on Aug 26, 2023. It is now read-only.

Commit 37b2b97

Browse files
committed
ont-map: reflect changes in ont-api jena model (see owlcs/ont-api#4, owlcs/ont-api#8)
1 parent e3cd5d3 commit 37b2b97

File tree

67 files changed

+1094
-1095
lines changed

Some content is hidden

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

67 files changed

+1094
-1095
lines changed

src/main/java/com/github/owlcs/map/ClassPropertyMap.java

+8-7
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,21 @@ public interface ClassPropertyMap {
3535
/**
3636
* Lists all properties by a class.
3737
*
38-
* @param ce {@link OntCE} with a model inside
38+
* @param ce {@link OntClass} with a model inside
3939
* @return <b>distinct</b> Stream of {@link Property properties}
4040
*/
41-
Stream<Property> properties(OntCE ce);
41+
Stream<Property> properties(OntClass ce);
4242

4343
/**
4444
* Lists all classes by a property.
45-
* A reverse operation to the {@link #properties(OntCE)}.
45+
* A reverse operation to the {@link #properties(OntClass)}.
4646
*
47-
* @param pe {@link OntPE} - an property, which in OWL2 can be either {@link OntNDP}, {@link OntNAP} or {@link OntOPE}
48-
* @return <b>distinct</b> Stream of {@link OntCE class-expressions}
47+
* @param pe {@link OntProperty} - an property, which in OWL2 can be either {@link OntDataProperty},
48+
* {@link OntAnnotationProperty} or {@link OntObjectProperty}
49+
* @return <b>distinct</b> Stream of {@link OntClass class-expressions}
4950
*/
50-
default Stream<OntCE> classes(OntPE pe) {
51-
return pe.getModel().ontObjects(OntCE.class)
51+
default Stream<OntClass> classes(OntProperty pe) {
52+
return pe.getModel().ontObjects(OntClass.class)
5253
.filter(c -> properties(c).anyMatch(p -> Objects.equals(p, pe.asProperty())))
5354
.distinct();
5455
}

src/main/java/com/github/owlcs/map/MapContext.java

+23-20
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@
1818

1919
package com.github.owlcs.map;
2020

21-
import com.github.owlcs.ontapi.jena.model.OntCE;
22-
import com.github.owlcs.ontapi.jena.model.OntOPE;
21+
import com.github.owlcs.ontapi.jena.model.OntClass;
22+
import com.github.owlcs.ontapi.jena.model.OntObjectProperty;
2323
import org.apache.jena.rdf.model.Property;
2424

2525
import java.util.stream.Stream;
2626

2727
/**
2828
* A class expressions mapping (class bridge), that is a primary component of a {@link MapModel mapping model}.
29-
* In GUI it can be represented as an arrow between source and target {@link OntCE class expression}s.
29+
* In GUI it can be represented as an arrow between source and target {@link OntClass class expression}s.
3030
* <p>
3131
* Created by @szuev on 14.04.2018.
3232
*/
@@ -35,16 +35,16 @@ public interface MapContext extends MapResource {
3535
/**
3636
* Returns a source class expression.
3737
*
38-
* @return {@link OntCE}
38+
* @return {@link OntClass}
3939
*/
40-
OntCE getSource();
40+
OntClass getSource();
4141

4242
/**
4343
* Returns a target class expression.
4444
*
45-
* @return {@link OntCE}
45+
* @return {@link OntClass}
4646
*/
47-
OntCE getTarget();
47+
OntClass getTarget();
4848

4949
/**
5050
* Answers a context' expression in the form of function-call object.
@@ -76,13 +76,15 @@ public interface MapContext extends MapResource {
7676
* Adds a properties bridge.
7777
* Source properties are specified by mapping and filter function calls, the target goes explicitly.
7878
* All input properties must be an OWL2 entities with possible to assign data on individual:
79-
* {@link com.github.owlcs.ontapi.jena.model.OntNAP named annotation property} and
80-
* {@link com.github.owlcs.ontapi.jena.model.OntNDP datatype property},
81-
* while {@link com.github.owlcs.ontapi.jena.model.OntNOP object property} is used to bind contexts together, not to inference data.
79+
* {@link com.github.owlcs.ontapi.jena.model.OntAnnotationProperty} and
80+
* {@link com.github.owlcs.ontapi.jena.model.OntDataProperty},
81+
* while {@link com.github.owlcs.ontapi.jena.model.OntObjectProperty.Named}
82+
* is used to bind contexts together, not to inference data.
8283
*
8384
* @param filterFunctionCall {@link MapFunction.Call} function-call to filter data
8485
* @param mappingFunctionCall {@link MapFunction.Call} function-call to map data
85-
* @param target property, either {@link com.github.owlcs.ontapi.jena.model.OntNAP} or {@link com.github.owlcs.ontapi.jena.model.OntNDP}
86+
* @param target property, either {@link com.github.owlcs.ontapi.jena.model.OntAnnotationProperty}
87+
* or {@link com.github.owlcs.ontapi.jena.model.OntDataProperty}
8688
* @return {@link PropertyBridge} a container with all input settings.
8789
* @throws MapJenaException if something goes wrong (e.g. incompatible function or property specified)
8890
*/
@@ -109,14 +111,14 @@ PropertyBridge addPropertyBridge(MapFunction.Call filterFunctionCall,
109111
/**
110112
* Creates a context with the same target class expression and with source linked to the source of this context.
111113
* Classes can be linked to each other through object property range and domain axioms,
112-
* see description for {@link #createRelatedContext(OntCE, OntOPE)}.
114+
* see description for {@link #createRelatedContext(OntClass, OntObjectProperty)}.
113115
* Throws an exception in the case the link (object property) does not exist or it can not be uniquely determined.
114116
*
115-
* @param source {@link OntCE} source for the new context, the target is the same as in this context.
117+
* @param source {@link OntClass} source for the new context, the target is the same as in this context.
116118
* @return <b>new</b> context
117119
* @throws MapJenaException unable to make reference context
118120
*/
119-
MapContext createRelatedContext(OntCE source) throws MapJenaException;
121+
MapContext createRelatedContext(OntClass source) throws MapJenaException;
120122

121123
/**
122124
* Creates a context associated with this one through the specified object property expression.
@@ -129,24 +131,24 @@ PropertyBridge addPropertyBridge(MapFunction.Call filterFunctionCall,
129131
* otherwise with "related object context" rule.
130132
* If {@code C1} and {@code C2} are not linked to each other, an exception are expected.
131133
*
132-
* @param source {@link OntCE} class expression, source for result context
133-
* @param link {@link OntOPE} object property expression, a link between {@code source} and {@link #getSource()}
134+
* @param source {@link OntClass} class expression, source for result context
135+
* @param link {@link OntObjectProperty} object property expression, a link between {@code source} and {@link #getSource()}
134136
* @return <b>new</b> context with specified class as source and {@link #getTarget()} as target.
135137
* @throws MapJenaException unable to make reference context
136138
*/
137-
MapContext createRelatedContext(OntCE source, OntOPE link) throws MapJenaException;
139+
MapContext createRelatedContext(OntClass source, OntObjectProperty link) throws MapJenaException;
138140

139141
/**
140142
* Binds this context and the specified with a link-property.
141143
* On inference these contexts together will produce consistent data:
142144
* the result individuals will be bound in an object property assertion.
143145
*
144146
* @param other {@link MapContext} other context
145-
* @param link {@link OntOPE}, link property
147+
* @param link {@link OntObjectProperty}, link property
146148
* @return {@link PropertyBridge} which connects this context and the specified
147149
* @throws MapJenaException if something goes wrong or input parameters are not correct
148150
*/
149-
PropertyBridge attachContext(MapContext other, OntOPE link) throws MapJenaException;
151+
PropertyBridge attachContext(MapContext other, OntObjectProperty link) throws MapJenaException;
150152

151153
/**
152154
* Lists all contexts that depend on this somehow.
@@ -204,7 +206,8 @@ default PropertyBridge addPropertyBridge(MapFunction.Builder func, Property targ
204206
* This is commonly used method, while its overloaded companion is used less frequently to build specific ontology mappings.
205207
*
206208
* @param func {@link MapFunction.Call}, expression
207-
* @param target property, either {@link com.github.owlcs.ontapi.jena.model.OntNAP} or {@link com.github.owlcs.ontapi.jena.model.OntNDP}
209+
* @param target property, either {@link com.github.owlcs.ontapi.jena.model.OntAnnotationProperty}
210+
* or {@link com.github.owlcs.ontapi.jena.model.OntDataProperty}
208211
* @return {@link PropertyBridge} a container with all input settings
209212
* @throws MapJenaException if something goes wrong (e.g. incompatible function or property specified)
210213
* @see #addPropertyBridge(MapFunction.Call, MapFunction.Call, Property)

src/main/java/com/github/owlcs/map/MapFunction.java

+10-10
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
package com.github.owlcs.map;
2020

2121
import com.github.owlcs.map.spin.vocabulary.AVC;
22-
import com.github.owlcs.ontapi.jena.model.OntCE;
23-
import com.github.owlcs.ontapi.jena.model.OntGraphModel;
24-
import com.github.owlcs.ontapi.jena.model.OntPE;
22+
import com.github.owlcs.ontapi.jena.model.OntClass;
23+
import com.github.owlcs.ontapi.jena.model.OntModel;
24+
import com.github.owlcs.ontapi.jena.model.OntNamedProperty;
2525
import com.github.owlcs.ontapi.jena.utils.BuiltIn;
2626
import org.apache.jena.rdf.model.Literal;
2727
import org.apache.jena.rdf.model.Property;
@@ -388,7 +388,7 @@ interface Builder {
388388
* e.g. if you set 'Anything' it would be actually {@code "Anything"^^<http://www.w3.org/2001/XMLSchema#string>}.
389389
* If some value is already associated with the given {@code predicate}, it will be replaced by the new value.
390390
* To list all built-in datatypes the method {@link BuiltIn.Vocabulary#datatypes()} can be used.
391-
* To list all model datatypes the expression {@link OntGraphModel#datatypes()}
391+
* To list all model datatypes the expression {@link OntModel#datatypes()}
392392
*
393393
* @param predicate iri ({@link Arg#name()}), not {@code null}
394394
* @param value String, value, not {@code null}
@@ -458,10 +458,10 @@ default Builder add(Property predicate, String value) {
458458
* This method is just for simplification code.
459459
*
460460
* @param predicate {@link Property}, that corresponds {@link Arg#name()}, not {@code null}
461-
* @param ce {@link OntCE}, not {@code null}
461+
* @param ce {@link OntClass}, not {@code null}
462462
* @return this builder
463463
*/
464-
default Builder addClass(Property predicate, OntCE ce) {
464+
default Builder addClass(Property predicate, OntClass ce) {
465465
return add(predicate, ce.asNode().toString());
466466
}
467467

@@ -470,13 +470,13 @@ default Builder addClass(Property predicate, OntCE ce) {
470470
* This method is just for simplification code.
471471
*
472472
* @param predicate {@link Property}, that corresponds {@link Arg#name()}, not {@code null}
473-
* @param property {@link com.github.owlcs.ontapi.jena.model.OntNDP},
474-
* {@link com.github.owlcs.ontapi.jena.model.OntNAP} or
475-
* {@link com.github.owlcs.ontapi.jena.model.OntNOP}, not {@code null}
473+
* @param property {@link com.github.owlcs.ontapi.jena.model.OntDataProperty},
474+
* {@link com.github.owlcs.ontapi.jena.model.OntAnnotationProperty} or
475+
* {@link com.github.owlcs.ontapi.jena.model.OntObjectProperty.Named}, not {@code null}
476476
* @param <P> a property subclass
477477
* @return this builder
478478
*/
479-
default <P extends OntPE & Property> Builder addProperty(Property predicate, P property) {
479+
default <P extends OntNamedProperty<?>> Builder addProperty(Property predicate, P property) {
480480
return add(predicate, property.getURI());
481481
}
482482

src/main/java/com/github/owlcs/map/MapManager.java

+10-10
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
package com.github.owlcs.map;
2020

21-
import com.github.owlcs.ontapi.jena.model.OntGraphModel;
21+
import com.github.owlcs.ontapi.jena.model.OntModel;
2222
import org.apache.jena.graph.Graph;
2323
import org.apache.jena.rdf.model.Model;
2424
import org.apache.jena.rdf.model.Resource;
@@ -60,13 +60,13 @@ public interface MapManager {
6060
/**
6161
* Copies all meaningful data from the given {@code Graph} into the manager's primary {@code Graph}.
6262
* The most obvious (and currently single) use of this method is registering all functions that graph may contain.
63-
* In this sense, the method behaves in the same way as method {@link #asMapModel(OntGraphModel)},
63+
* In this sense, the method behaves in the same way as method {@link #asMapModel(OntModel)},
6464
* but does not return anything.
6565
* No changes to the input graph are made.
6666
*
6767
* @param g {@link Graph}, not {@code null}
6868
* @throws MapJenaException in case the given graph contains desired data, but it is corrupted
69-
* @see #asMapModel(OntGraphModel)
69+
* @see #asMapModel(OntModel)
7070
*/
7171
void addGraph(Graph g) throws MapJenaException;
7272

@@ -81,22 +81,22 @@ public interface MapManager {
8181
* Wraps the given ontology model into the map model interface.
8282
* If the specified model contains custom functions inside, they will be registered in the manager.
8383
*
84-
* @param model {@link OntGraphModel}, not {@code null}
84+
* @param model {@link OntModel}, not {@code null}
8585
* @return {@link MapModel}
8686
* @throws MapJenaException if such wrapping is not possible or the model contains broken functions
8787
* @see #addGraph(Graph)
8888
*/
89-
MapModel asMapModel(OntGraphModel model) throws MapJenaException;
89+
MapModel asMapModel(OntModel model) throws MapJenaException;
9090

9191
/**
9292
* Answers {@code true} if the given ontology model is also a mapping model,
93-
* and therefore it can be safely wrapped as {@link MapModel} using the method {@link #asMapModel(OntGraphModel)}.
93+
* and therefore it can be safely wrapped as {@link MapModel} using the method {@link #asMapModel(OntModel)}.
9494
*
95-
* @param model {@link OntGraphModel}
95+
* @param model {@link OntModel}
9696
* @return boolean indicating whether the ontology contains mapping specific elements
9797
* and therefore is assignable to the {@link MapModel mapping} interface
9898
*/
99-
boolean isMapModel(OntGraphModel model);
99+
boolean isMapModel(OntModel model);
100100

101101
/**
102102
* Provides a class-properties mapping,
@@ -111,10 +111,10 @@ public interface MapManager {
111111
* but such kind of mappings would be almost useless, since no individual property assertions would be inferred
112112
* in a valid OWL2 model.
113113
*
114-
* @param model {@link OntGraphModel OWL model}
114+
* @param model {@link OntModel OWL model}
115115
* @return {@link ClassPropertyMap class properties mapping object}
116116
*/
117-
ClassPropertyMap getClassProperties(OntGraphModel model);
117+
ClassPropertyMap getClassProperties(OntModel model);
118118

119119
/**
120120
* Gets an engine to conduct inference on top of the specified {@link MapModel Mapping Model}.

src/main/java/com/github/owlcs/map/MapModel.java

+20-20
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@
1818

1919
package com.github.owlcs.map;
2020

21-
import com.github.owlcs.ontapi.jena.model.OntCE;
22-
import com.github.owlcs.ontapi.jena.model.OntGraphModel;
21+
import com.github.owlcs.ontapi.jena.model.OntClass;
2322
import com.github.owlcs.ontapi.jena.model.OntID;
24-
import com.github.owlcs.ontapi.jena.model.OntOPE;
23+
import com.github.owlcs.ontapi.jena.model.OntModel;
24+
import com.github.owlcs.ontapi.jena.model.OntObjectProperty;
2525
import org.apache.jena.graph.Graph;
2626

2727
import java.util.stream.Stream;
@@ -45,20 +45,20 @@ public interface MapModel {
4545
/**
4646
* Answers the OWL2 model which wraps the same mapping graph.
4747
*
48-
* @return {@link OntGraphModel OWL2 jena model}
48+
* @return {@link OntModel OWL2 jena model}
4949
*/
50-
OntGraphModel asGraphModel();
50+
OntModel asGraphModel();
5151

5252
/**
5353
* Lists all linked OWL2 ontologies,
5454
* i.e. all actual imports with exclusion of library
5555
* plus this mapping model itself if it has its own OWL-declarations.
5656
*
57-
* @return Stream of linked ontologies in form of {@link OntGraphModel OWL2 jena model}s
58-
* @see OntGraphModel#imports()
57+
* @return Stream of linked ontologies in form of {@link OntModel OWL2 jena model}s
58+
* @see OntModel#imports()
5959
* @see #asGraphModel()
6060
*/
61-
Stream<OntGraphModel> ontologies();
61+
Stream<OntModel> ontologies();
6262

6363
/**
6464
* Returns the manager with which this mapping model is associated.
@@ -79,11 +79,11 @@ public interface MapModel {
7979
* The specified class expressions can be anonymous,
8080
* since OWL2 allows individuals to be attached to any class expression.
8181
*
82-
* @param source {@link OntCE} a source class expression
83-
* @param target {@link OntCE} a target class expression
82+
* @param source {@link OntClass} a source class expression
83+
* @param target {@link OntClass} a target class expression
8484
* @return {@link MapContext} existing or fresh context
8585
*/
86-
MapContext createContext(OntCE source, OntCE target);
86+
MapContext createContext(OntClass source, OntClass target);
8787

8888
/**
8989
* Deletes the specified context and all related triples including property bindings.
@@ -107,7 +107,7 @@ public interface MapModel {
107107
* @param right {@link MapContext}
108108
* @return this model
109109
* @throws MapJenaException if something goes wrong
110-
* @see MapContext#attachContext(MapContext, OntOPE)
110+
* @see MapContext#attachContext(MapContext, OntObjectProperty)
111111
*/
112112
MapModel bindContexts(MapContext left, MapContext right) throws MapJenaException;
113113

@@ -145,14 +145,14 @@ default Stream<MapResource> rules() {
145145
/**
146146
* Creates a ready to use context.
147147
*
148-
* @param source {@link OntCE} a source class expression, not {@code null}
149-
* @param target {@link OntCE} a target class expression, not {@code null}
148+
* @param source {@link OntClass} a source class expression, not {@code null}
149+
* @param target {@link OntClass} a target class expression, not {@code null}
150150
* @param targetFunction {@link MapFunction.Builder}, not {@code null}
151151
* @return {@link MapContext} a new context instance
152152
* @throws MapJenaException if something goes wrong (e.g. not target function specified)
153153
*/
154-
default MapContext createContext(OntCE source,
155-
OntCE target,
154+
default MapContext createContext(OntClass source,
155+
OntClass target,
156156
MapFunction.Builder targetFunction) throws MapJenaException {
157157
return createContext(source, target, targetFunction.build());
158158
}
@@ -161,14 +161,14 @@ default MapContext createContext(OntCE source,
161161
/**
162162
* Creates a ready to use context, i.e. a class expression binding with an target rule expression.
163163
*
164-
* @param source {@link OntCE} a source class expression, not {@code null}
165-
* @param target {@link OntCE} a target class expression, not {@code null}
164+
* @param source {@link OntClass} a source class expression, not {@code null}
165+
* @param target {@link OntClass} a target class expression, not {@code null}
166166
* @param targetFunction {@link MapFunction.Call}, not {@code null}
167167
* @return {@link MapContext} a new context instance
168168
* @throws MapJenaException if something goes wrong (e.g. not target function specified)
169169
*/
170-
default MapContext createContext(OntCE source,
171-
OntCE target,
170+
default MapContext createContext(OntClass source,
171+
OntClass target,
172172
MapFunction.Call targetFunction) throws MapJenaException {
173173
return createContext(source, target).addClassBridge(targetFunction);
174174
}

0 commit comments

Comments
 (0)