Hi,

I am new to this forum and run into a problem. I would like to map a rdf
schema to a view in a PostgreSQL-database.
Problem is that the query that d2rq generates is extremely slow.

This is the sparql-query:
select ?time ?value where
{
?a <uri:sensor:value>  ?value.
?a <uri:sensor:timestamp>  ?time.
FILTER (?time < '2012-01-06T08:00:00'^^xsd:dateTime && ?time >
'2012-01-06T00:00:00'^^xsd:dateTime) }

And this the generated SQL Code:
DISTINCT SELECT ...... FROM "v1" AS "T1_v1", "v1" AS "T2_v1"  WHERE (....)

FROM "v1" AS "T1_v1", "v1" AS "T2_v1" leads to a really bad performance,
because PostgreSQL joins view v1 with itself by nesting loops.
I think it happens because the view generates the measured values from a
denormalized table, where 3600 values are stored per one column using
arrays.
(for better performance and saving storage space)


That is why it would great to have a simple query in the form:
DISTINCT SELECT ...... FROM "v1" WHERE (....)

Is there a way to use just one Table after the "from" to avoid selfjoins or
must I adapt the code? I start the server (version 0.8.1) with the "fast"
option.

Many Thanks
Hendrik

That is my ttl-config:

# D2RQ Namespace
@prefix d2rq:        <http://www.wiwiss.fu-berlin.de/suhl/bizer/D2RQ/0.1#> .
# Namespace of the ontology
@prefix : <uri:sensor:measure> .
#@prefix : <:measurement> .
# 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#> .
@prefix jdbc: <http://d2rq.org/terms/jdbc/> .
@prefix sens:  <urn:measurement:> .

@prefix db: <> .
@prefix vocab: <vocab/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .

map:Configuration a d2rq:Configuration;
    d2rq:useAllOptimizations true.

map:database a d2rq:Database;
    d2rq:jdbcDSN "jdbc:postgresql://192.168.0.181/measured-data";
    d2rq:jdbcDriver "org.postgresql.Driver";
    d2rq:username "abc";
    d2rq:password "123";
    jdbc:autoReconnect "true";
    jdbc:zeroDateTimeBehavior "convertToNull";
    .

# Table measuredvalues
    map:measuredvalues a d2rq:ClassMap;
    d2rq:dataStorage map:database;
    d2rq:class :measuredvalues;
    d2rq:uriPattern "
http://example.org/lineItems/sensorid@@v1.sensorid@@-@@v1.timestamp@@";;
    .

map:measuredvaluetimestamp a d2rq:PropertyBridge;
    d2rq:belongsToClassMap map:measuredvalues;
    d2rq:column "v1.timestamp";
    d2rq:datatype xsd:dateTime;
    d2rq:property :timestamp;
    .

map:measuredvalue_2_value a d2rq:PropertyBridge;
    d2rq:belongsToClassMap map:measuredvalues;
    d2rq:column "v1.value";
    d2rq:datatype xsd:double;
    d2rq:property :value;
    .

map:measuredvaluesensorid a d2rq:PropertyBridge;
    d2rq:belongsToClassMap map:measuredvalues;
    d2rq:column "v1.sensorid";
    d2rq:datatype xsd:integer;
    d2rq:property :sensorid;
    .
------------------------------------------------------------------------------
Minimize network downtime and maximize team effectiveness.
Reduce network management and security costs.Learn how to hire 
the most talented Cisco Certified professionals. Visit the 
Employer Resources Portal
http://www.cisco.com/web/learning/employer_resources/index.html
_______________________________________________
d2rq-map-devel mailing list
d2rq-map-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/d2rq-map-devel

Reply via email to