Commit 466a8450 authored by rwm's avatar rwm
Browse files

RDF/Turtle file extensions changed from .n3 to .ttl, examples modified

parent 0a4e02e7
Processing ontologies with Jena
-------------------------------
* Parse enumerated data types: http://stackoverflow.com/questions/15018784/use-jena-to-parse-enumerated-datatype-generated-by-protege
# For the turtle syntax, see http://www.w3.org/TR/turtle/
@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#> .
@prefix snomed: <http://purl.bioontology.org/ontology/SNOMEDCT/>
:FF.2235.qspab_60 a dwh:Concept ;
skos:notation "FF.2235.qspab_60" .
dwh:mapTo [
dwh:ifValueEquals 1 ;
dwh:target snomed:11399002 ; # pulmonary arterial hypertension
dwh:replaceValue :noValue
] .
# TODO use anonymous nodes
# TODO how to map negations (eg NO hypertension)
:FF.XXXX.example a dwh:Concept ;
dwh:valueType :YesNoEnum .
:YesNoEnum owl:oneOf ("Y"^^xsd:string "N"^^xsd:string) .
@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#> .
@prefix snomed: <http://purl.bioontology.org/ontology/SNOMEDCT/>
@prefix : <http://aktin.org/skos-cda#> .
:AKTIN a skos:ConceptScheme ;
skos:hasTopConcept :EmergencyNote .
:EmergencyNote a skos:Concept ;
skos:narrower :Basismodul ;
skos:narrower :Traumamodul .
:Basismodul a skos:Concept ;
skos:narrower :GCS .
:GCS a skos:Concept .
:Pupillenweitenuntersuchung a skos:Concept ;
# wert ist weite
owl:hasPart xxxx ; # subclass of 164020000
# z.B. snomed:37125009 # wide pupil
owl:hasPart eyeStructure; # one of 18944008, 8966001 (left eye, right eye)
# z.B. snomed:8966001 # left eye (structure)
# modifier ist seite
# siehe auch http://www.w3.org/2001/sw/BestPractices/OEP/SimplePartWhole/
# und http://www.w3.org/TR/owl2-new-features/
\ No newline at end of file
......@@ -4,30 +4,15 @@
@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 nom: <http://sekmi.de/histream/nomenclature#> .
@prefix : <http://sekmi.de/histream/concepts#> .
: dc:title "HIStream meta ontology".
#
# define concept value types
#
:empty a rdfs:Datatype .
:enum a rdfs:Datatype .
# predicate for concepts
:valueType a rdf:Property ;
owl:oneOf ( xsd:decimal xsd:string xsd:integer :enum :empty ) .
:ConceptModifier a rdfs:Class .
# Todo: add required predicates :valueType, ...
:hasModifier a rdf:Property ;
rdfs:range :ConceptModifier .
nom:id a rdf:Property;
rdfs:range xsd:string .
@prefix i2b2: <http://sekmi.de/skos-i2b2#> .
skos:Concept a i2b2:OntologyNode .
# multiple types allowed?
i2b2:hasModifier a rdf:Property ;
rdfs:range skos:Concept .
i2b2:valueMap a rdf:Property ;
rdfs:domain skos:Concept ;
\ No newline at end of file
......@@ -50,7 +50,7 @@ public class Store implements Ontology, Plugin {
int i=1;
List<File> files = new ArrayList<>();
List<String> baseURIs = new ArrayList<>();
// TODO: allow specification of directory
while( conf.containsKey("rdf.file."+i) ){
File file = new File(conf.get("rdf.file."+i));
if( !file.exists() )throw new FileNotFoundException("rdf.file."+i+" not found: "+file.getAbsolutePath());
......@@ -113,6 +113,7 @@ public class Store implements Ontology, Plugin {
else return concepts.toArray(new Concept[concepts.size()]);
}
public Concept[] getTopConcepts()throws OntologyException{
// TODO use ConceptSchema specified in configuration
return getRelatedConcepts(null, SKOS.HAS_TOP_CONCEPT);
}
private Concept[] getRelatedConcepts(Resource subject, URI predicate)throws OntologyException{
......
......@@ -18,7 +18,7 @@ public class OntologyTest {
@Before
public void setupOntology()throws Exception{
store = new Store(new File("src/main/examples/test-ontology.n3"));
store = new Store(new File("src/main/examples/test-ontology.ttl"));
}
@Test
......
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