Commit f903724f authored by R.W.Majeed's avatar R.W.Majeed
Browse files

Added getParts and getValueRestriction for ontology concepts

parent 0f5461cf
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix dc: <http://purl.org/dc/elements/1.1/> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix i2b2: <http://sekmi.de/skos-i2b2#> .
skos:Concept a i2b2:OntologyNode .
# multiple types allowed?
i2b2:hasModifier a rdf:Property ;
rdfs:range skos:Concept .
dwh:hasValueSet a rdf:Property ;
rdfs:domain skos:Concept .
dwh:
......@@ -23,14 +23,14 @@
:TestEnumConcept a skos:Concept;
skos:inScheme :TestData;
dwh:valueType :testEnum;
dwh:valueRestriction [ a owl:Restriction ;
owl:oneOf ([rdf:value "1"^^xsd:string; skos:prefLabel "1_de"@de; skos:prefLabel "1_en"@en ]
[rdf:value "2"^^xsd:string; skos:prefLabel "2_de"@de; skos:prefLabel "2_en"@en ])
] ;
skos:prefLabel "Enum_label_de"@de;
skos:prefLabel "Enum_label_en"@en;
skos:notation "Enum"^^:TestCS .
:testEnum owl:oneOf ([rdf:value "1"^^xsd:string; skos:prefLabel "1_de"@de; skos:prefLabel "1_en"@en ]
[rdf:value "2"^^xsd:string; skos:prefLabel "2_de"@de; skos:prefLabel "2_en"@en ]) .
:TestIntegerConcept a skos:Concept;
skos:inScheme :TestData ;
dwh:valueType xsd:integer ;
......@@ -48,6 +48,15 @@
:TestDecimalConcept a skos:Concept;
skos:inScheme :TestData ;
dwh:valueType xsd:decimal ;
dwh:valueRestriction [ a owl:Restriction ;
owl:allValuesFrom [a rdfs:Datatype;
owl:onDatatype xsd:decimal;
owl:withRestrictions( [ xsd:minInclusive 200 ]
[ xsd:maxInclusive 400 ] )
]
] ;
# oder via rdfs:range? http://stackoverflow.com/questions/24531940/defining-datarange-expression-in-protege-for-a-data-type-property
# oder via owl:DataRange
# oder restriction owl:onProperty rdf:value
skos:prefLabel "Decimal_label_en"@en ;
skos:notation "T:type:dec" .
......@@ -13,6 +13,7 @@ import org.openrdf.repository.RepositoryResult;
import de.sekmi.histream.ontology.Concept;
import de.sekmi.histream.ontology.OntologyException;
import de.sekmi.histream.ontology.ValueRestriction;
public class ConceptImpl implements Concept {
......@@ -72,6 +73,18 @@ public class ConceptImpl implements Concept {
String lang = (locale==null)?null:locale.toString();
return store.getLocalString(getResource(), DC.DESCRIPTION, lang);
}
@Override
public Concept[] getParts() {
// TODO implement
return null;
}
@Override
public ValueRestriction getValueRestriction() {
// TODO implement
return null;
}
......
......@@ -62,4 +62,21 @@ public interface Concept {
* @throws OntologyException for ontology errors
*/
String getDescription(Locale locale) throws OntologyException;
/**
* Get concepts which are part of this concepts.
* <p>
* The part relationship is different from the narrower relationship
* in the sense that {@link #getNarrower()} will point to more specific concepts while
* {@link #getParts()} will divide the concept in the sense of a whole/part relationship.
*
* @return concepts which are part of this concept, or {@code null} if this concept cannot be divided.
*/
Concept[] getParts();
/**
* Get restrictions for the values of this concept.
* @return value restrictions or {@code null} if no restrictions are provided
*/
ValueRestriction getValueRestriction();
}
package de.sekmi.histream.ontology;
import java.util.Locale;
public interface EnumValue {
String getPrefLabel(Locale locale);
Object getValue();
}
package de.sekmi.histream.ontology;
import java.util.regex.Pattern;
public interface ValueRestriction {
Class<?> getType();
EnumValue[] getEnumeration();
Number minInclusive();
Number maxInclusive();
Integer minLength();
Integer maxLength();
Pattern getPattern();
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment