This repository was archived by the owner on Jan 13, 2025. It is now read-only.
File tree Expand file tree Collapse file tree
src/main/java/de/linkvt/bachelor/presets Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4343import de .linkvt .bachelor .features .individuals .assertions .OwlSameAsFeature ;
4444import de .linkvt .bachelor .features .keys .OwlHasKeyFeature ;
4545
46+ import org .semanticweb .owlapi .vocab .OWL2Datatype ;
4647import org .springframework .stereotype .Component ;
4748
4849@ Component
49- public class Owl2ElPreset extends Preset {
50+ public class Owl2ElPreset extends Owl2Preset {
5051 @ Override
5152 protected void initialize () {
5253 addFeatures (OwlObjectSomeValuesFromFeature .class , OwlDataSomeValuesFromFeature .class );
@@ -81,6 +82,7 @@ protected void initialize() {
8182 addFeatures (OwlDeprecatedClassFeature .class , OwlDeprecatedPropertyFeature .class );
8283 addFeatures (OwlPropertyChainAxiomFeature .class );
8384
85+ addCompatibleOwl2DatatypeFeatures (OWL2Datatype .EL_DATATYPES );
8486 // also possible
8587// addFeatures(OwlVersionInfoFeature.class);
8688// addFeatures(RdfsLabelOnOntologyFeature.class);
Original file line number Diff line number Diff line change 1+ package de .linkvt .bachelor .presets ;
2+
3+ import de .linkvt .bachelor .features .Feature ;
4+
5+ import org .semanticweb .owlapi .vocab .OWL2Datatype ;
6+
7+ import java .util .List ;
8+ import java .util .stream .Collectors ;
9+
10+ public abstract class Owl2Preset extends Preset {
11+
12+ protected void addCompatibleOwl2DatatypeFeatures (List <OWL2Datatype > datatypes ) {
13+ List <String > datatypeIris = datatypes .stream ()
14+ .map (OWL2Datatype ::getPrefixedName )
15+ .collect (Collectors .toList ());
16+
17+ List <Class <? extends Feature >> datatypeClasses = featureMapping .getAll ().stream ()
18+ .filter (f -> datatypeIris .contains (f .getName ()))
19+ .map (Feature ::getClass )
20+ .collect (Collectors .toList ());
21+
22+ addFeatures (datatypeClasses );
23+ }
24+
25+ }
Original file line number Diff line number Diff line change 3838import de .linkvt .bachelor .features .individuals .NamedIndividualFeature ;
3939import de .linkvt .bachelor .features .individuals .assertions .OwlAllDifferentFeature ;
4040
41+ import org .semanticweb .owlapi .vocab .OWL2Datatype ;
4142import org .springframework .stereotype .Component ;
4243
4344@ Component
44- public class Owl2QlPreset extends Preset {
45+ public class Owl2QlPreset extends Owl2Preset {
4546 @ Override
4647 protected void initialize () {
4748 addFeatures (NamedIndividualFeature .class );
@@ -82,6 +83,9 @@ protected void initialize() {
8283 addFeatures (RdfsObjectSubPropertyOfFeature .class );
8384 addFeatures (RdfsSubClassOfFeature .class );
8485
86+ // the datatypes of OWL 2 EL and OWL 2 QL are equal
87+ addCompatibleOwl2DatatypeFeatures (OWL2Datatype .EL_DATATYPES );
88+
8589 // also possible
8690// addFeatures(OwlVersionInfoFeature.class);
8791// addFeatures(RdfsCommentFeature.class);
Original file line number Diff line number Diff line change 5959import de .linkvt .bachelor .features .individuals .assertions .OwlSameAsFeature ;
6060import de .linkvt .bachelor .features .keys .OwlHasKeyFeature ;
6161
62+ import org .semanticweb .owlapi .vocab .OWL2Datatype ;
6263import org .springframework .stereotype .Component ;
6364
6465@ Component
65- public class Owl2RlPreset extends Preset {
66+ public class Owl2RlPreset extends Owl2Preset {
6667 @ Override
6768 protected void initialize () {
6869 addFeatures (AnonymousIndividualFeature .class );
@@ -124,6 +125,7 @@ protected void initialize() {
124125 addFeatures (UnboundDataPropertyFeature .class );
125126 addFeatures (UnboundObjectPropertyFeature .class );
126127
128+ addCompatibleOwl2DatatypeFeatures (OWL2Datatype .RL_DATATYPES );
127129 // also possible
128130// addFeatures(OwlVersionInfoFeature.class);
129131// addFeatures(RdfsCommentFeature.class);
Original file line number Diff line number Diff line change 11package de .linkvt .bachelor .presets ;
22
33import de .linkvt .bachelor .features .Feature ;
4+ import de .linkvt .bachelor .web .converters .parameter .FeatureParameterMapping ;
45
56import org .springframework .beans .factory .annotation .Autowired ;
67import org .springframework .context .ApplicationContext ;
1617 * Base class for a preset
1718 */
1819public abstract class Preset {
19- private Set <Feature > features = new HashSet <>();
20+
21+ @ Autowired
22+ protected FeatureParameterMapping featureMapping ;
2023
2124 @ Autowired
2225 private ApplicationContext context ;
2326
27+ private Set <Feature > features = new HashSet <>();
28+
2429 public Preset () {
2530
2631 }
2732
2833 @ SafeVarargs
2934 protected final Preset addFeatures (Class <? extends Feature >... classes ) {
30- Arrays .asList (classes ).stream ().map (context ::getBean ).forEach (this .features ::add );
35+ addFeatures (Arrays .asList (classes ));
36+ return this ;
37+ }
38+
39+ protected final Preset addFeatures (Collection <Class <? extends Feature >> classes ) {
40+ classes .stream ().map (context ::getBean ).forEach (this .features ::add );
3141 return this ;
3242 }
3343
You can’t perform that action at this time.
0 commit comments