Skip to content
This repository was archived by the owner on Jan 13, 2025. It is now read-only.

Commit d26eb96

Browse files
committed
Add features for OWL 2 datatypes
1 parent 7934a50 commit d26eb96

37 files changed

Lines changed: 507 additions & 0 deletions

src/main/java/de/linkvt/bachelor/features/FeatureCategory.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ public enum FeatureCategory {
1111
DATA_PROPERTIES("Data Properties and Axioms"),
1212
DATA_PROPERTY_RESTRICTIONS("Data Property Restrictions"),
1313
DATA_RANGES("Data Ranges"),
14+
DATATYPE_MAPS("Datatype Maps"),
1415
INDIVIDUALS("Individuals"),
1516
ASSERTIONS("Assertions"),
1617
KEYS("Keys"),
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
package de.linkvt.bachelor.features.datatypemaps;
2+
3+
import de.linkvt.bachelor.features.Feature;
4+
import de.linkvt.bachelor.features.FeatureCategory;
5+
6+
import org.apache.commons.lang3.text.WordUtils;
7+
import org.semanticweb.owlapi.model.OWLClass;
8+
import org.semanticweb.owlapi.model.OWLDataProperty;
9+
import org.semanticweb.owlapi.model.OWLDatatype;
10+
import org.semanticweb.owlapi.vocab.OWL2Datatype;
11+
12+
public abstract class AbstractDatatypeMapFeature extends Feature {
13+
14+
private final OWL2Datatype datatype;
15+
private final String name;
16+
private final String token;
17+
18+
public AbstractDatatypeMapFeature(OWL2Datatype datatype) {
19+
this.datatype = datatype;
20+
this.name = datatype.getPrefixedName();
21+
this.token = datatype.getPrefixedName().replaceAll(":", "").toLowerCase();
22+
}
23+
24+
@Override
25+
public void addToOntology() {
26+
OWLClass domain = featurePool.getExclusiveClass(":DatatypeMapsDomain");
27+
OWLDatatype range = factory.getOWLDatatype(datatype);
28+
29+
String namespace = datatype.getPrefixedName().split(":")[0];
30+
String name = datatype.getShortForm();
31+
String propertyIri = ":" + namespace + WordUtils.capitalize(name) + "Property";
32+
OWLDataProperty property = factory.getOWLDataProperty(propertyIri, pm);
33+
34+
addProperty(domain, property, range);
35+
}
36+
37+
@Override
38+
public String getName() {
39+
return name;
40+
}
41+
42+
@Override
43+
public String getToken() {
44+
return token;
45+
}
46+
47+
@Override
48+
public FeatureCategory getCategory() {
49+
return FeatureCategory.DATATYPE_MAPS;
50+
}
51+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package de.linkvt.bachelor.features.datatypemaps;
2+
3+
import org.semanticweb.owlapi.vocab.OWL2Datatype;
4+
import org.springframework.stereotype.Component;
5+
6+
@Component
7+
public class OwlRationalFeature extends AbstractDatatypeMapFeature {
8+
9+
public OwlRationalFeature() {
10+
super(OWL2Datatype.OWL_RATIONAL);
11+
}
12+
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package de.linkvt.bachelor.features.datatypemaps;
2+
3+
import org.semanticweb.owlapi.vocab.OWL2Datatype;
4+
import org.springframework.stereotype.Component;
5+
6+
@Component
7+
public class OwlRealFeature extends AbstractDatatypeMapFeature {
8+
9+
public OwlRealFeature() {
10+
super(OWL2Datatype.OWL_REAL);
11+
}
12+
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package de.linkvt.bachelor.features.datatypemaps;
2+
3+
import org.semanticweb.owlapi.vocab.OWL2Datatype;
4+
import org.springframework.stereotype.Component;
5+
6+
@Component
7+
public class RdfLangStringFeature extends AbstractDatatypeMapFeature {
8+
9+
public RdfLangStringFeature() {
10+
super(OWL2Datatype.RDF_LANG_STRING);
11+
}
12+
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package de.linkvt.bachelor.features.datatypemaps;
2+
3+
import org.semanticweb.owlapi.vocab.OWL2Datatype;
4+
import org.springframework.stereotype.Component;
5+
6+
@Component
7+
public class RdfPlainLiteralFeature extends AbstractDatatypeMapFeature {
8+
9+
public RdfPlainLiteralFeature() {
10+
super(OWL2Datatype.RDF_PLAIN_LITERAL);
11+
}
12+
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package de.linkvt.bachelor.features.datatypemaps;
2+
3+
import org.semanticweb.owlapi.vocab.OWL2Datatype;
4+
import org.springframework.stereotype.Component;
5+
6+
@Component
7+
public class RdfXmlLiteralFeature extends AbstractDatatypeMapFeature {
8+
9+
public RdfXmlLiteralFeature() {
10+
super(OWL2Datatype.RDF_XML_LITERAL);
11+
}
12+
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package de.linkvt.bachelor.features.datatypemaps;
2+
3+
import org.semanticweb.owlapi.vocab.OWL2Datatype;
4+
import org.springframework.stereotype.Component;
5+
6+
@Component
7+
public class RdfsLiteralFeature extends AbstractDatatypeMapFeature {
8+
9+
public RdfsLiteralFeature() {
10+
super(OWL2Datatype.RDFS_LITERAL);
11+
}
12+
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package de.linkvt.bachelor.features.datatypemaps;
2+
3+
import org.semanticweb.owlapi.vocab.OWL2Datatype;
4+
import org.springframework.stereotype.Component;
5+
6+
@Component
7+
public class XsdAnyUriFeature extends AbstractDatatypeMapFeature {
8+
9+
public XsdAnyUriFeature() {
10+
super(OWL2Datatype.XSD_ANY_URI);
11+
}
12+
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package de.linkvt.bachelor.features.datatypemaps;
2+
3+
import org.semanticweb.owlapi.vocab.OWL2Datatype;
4+
import org.springframework.stereotype.Component;
5+
6+
@Component
7+
public class XsdBase64BinaryFeature extends AbstractDatatypeMapFeature {
8+
9+
public XsdBase64BinaryFeature() {
10+
super(OWL2Datatype.XSD_BASE_64_BINARY);
11+
}
12+
13+
}

0 commit comments

Comments
 (0)