Database Reference
In-Depth Information
and the relational data model. Let us look at the Merea Maps example expressed
in the D2RQ Mapping language. As you can see, it is in Turtle format, using some
specific d2rq vocabulary items. Lines 1 and 2 specify the namespaces for RDF and
RDFS ontology, with which we are familiar, while line 3 specifies the location of this
D2RQ vocabulary. Line 4 gives a prefix for the mapping file's namespace, although
this does not much matter as it will not appear in the final RDF. The prefix in line 5
is for the jdbc namespace, which the D2R Server code uses to link to the database,
and line 6 denotes Merea Maps' administrative regions' RDFS namespace. Lines 8
to 12 specify an instance of the D2RQ “Database” class and includes the instruc-
tions for how to connect to the database. In this case, Merea Maps has an Oracle
database, but D2RQ works with MySQL, PostgreSQL, and Microsoft SQL Server as
well. The strings in jdbcDriver and jdbcDNS (the JDBC URL connection for the data-
base) will depend on which type of database you use. An instance of d2rq:ClassMap
is created in lines 14-18 and includes information about where the data is stored
(line 15) and the structure of the resources' URIs (line 16). In this case, it will be of
the form http://data.mereamaps.gov.me/administrativeRegions/” concatenated with
the contents of the Regions table “F_ID” column. Line 17 makes the RDF resource
an instance of the RDFS class admin:Parish, and line 18 indicates that only those
Regions table rows that meet the condition where the DESC column contains the
string “Parish” should be returned. (This corresponds to an SQL FILTER statement.)
1. @prefix rdf: < http://www.w3.org/1999/02/22-rdf-syntax-ns# >.
2. @prefix rdfs: < http://www.w3.org/2000/01/rdf-schema# >.
3. @prefix d2rq: < http://www.wiwiss.fu-berlin.de/suhl/bizer/D2RQ/0.1# > .
4. @prefix map: <file:/MereaMaps/adminRegions-mapping.n3#>.
5. prefix jdbc: < http://d2rq.org/terms/jdbc/ > .
6. @prefix admin: < http://data.mereamaps.gov.me/administrativeRegions/ > .
7.
8. map:database a d2rq:Database;
9. d2rq:jdbcDriver “oracle.jdbc.driver.OracleDriver”;
10. d2rq:jdbcDSN “jdbc:oracle:thin:@merea-server:1521:merea-db”;
11. d2rq:username “root” ;
12. d2rq:password “password”.
13.
14.map:parishMap a d2rq:ClassMap;
15. d2rq:dataStorage map:database;
16. d2rq:uriPattern
http://data.mereamaps.gov.me/administrativeRegions/@@Regions.F_ID@@” ;
17. d2rq:class admin:Parish ;
18. d2rq:condition “Regions.DESC = 'Parish'”.
19.
20.map:parishMap_hasPlaceName a d2rq:PropertyBridge;
21. d2rq:belongsToClassMap map:parishMap;
22. d2rq:property admin:hasPlaceName;
23. d2rq:column “Regions.DEF_NAME”.
24.
25.map:parishMap containedIn a d2rq:PropertyBridge;
26. d2rq:belongsToClassMap map:parishMap;
Search WWH ::




Custom Search