Reputation:
I am a beginner in ontology domain.I have a simple question which I could not find it anywhere! I have made my ontology in Protege,I have conceptualized my domain of interest(Energy consumption in a production line) and now I need to have access to the data which are stored in my database via this ontology.I do not want to store any data in my ontology but need to have access to data in database via my ontology.I am totally unaware of its possibility,if it is possible which tools I have to use for this purpose? Should I write for example a code in Java or ... Thank you so much in advance
Upvotes: 0
Views: 729
Reputation: 10659
If you have a database with data in it and an ontology that represents a conceptualization of those data, you can establish a mapping and expose those data as if they were represented according to your conceptualization by writing mappings for D2RQ.
An example taken from the documentation:
# D2RQ Namespace
@prefix d2rq: <http://www.wiwiss.fu-berlin.de/suhl/bizer/D2RQ/0.1#> .
# Namespace of the ontology
@prefix : <http://annotation.semanticweb.org/iswc/iswc.daml#> .
# Namespace of the mapping file; does not appear in mapped data
@prefix map: <file:///Users/d2r/example.ttl#> .
# Other namespaces
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
map:Database1 a d2rq:Database;
d2rq:jdbcDSN "jdbc:mysql://localhost/iswc";
d2rq:jdbcDriver "com.mysql.jdbc.Driver";
d2rq:username "user";
d2rq:password "password";
.
# -----------------------------------------------
# CREATE TABLE Conferences (ConfID int, Name text, Location text);
map:Conference a d2rq:ClassMap;
d2rq:dataStorage map:Database1;
d2rq:class :Conference;
d2rq:uriPattern "http://conferences.org/comp/confno@@Conferences.ConfID@@";
.
map:eventTitle a d2rq:PropertyBridge;
d2rq:belongsToClassMap map:Conference;
d2rq:property :eventTitle;
d2rq:column "Conferences.Name";
d2rq:datatype xsd:string;
.
map:location a d2rq:PropertyBridge;
d2rq:belongsToClassMap map:Conference;
d2rq:property :location;
d2rq:column "Conferences.Location";
d2rq:datatype xsd:string;
.
Upvotes: 1