I third it. We've found that D2R grinds to a halt due to seemingly
unnecessary joins. It's a shame, because D2R could be a really useful
piece of technology.
dlb
On Thu, Apr 4, 2013 at 11:25 AM, Diogo FC Patrao <djogopat...@gmail.com>wrote:
> Hi Hendrik
>
> I second that; And I also add that sometimes stuff should not be joined at
> all, but resolved in two different queries. I know, D2R isn't suited for
> connecting at two databases at once, but if it could tell when to JOIN,
> when to use the same FROM and when to join things from memory, it would be
> great.
>
> Cheers,
>
>
> --
> diogo patrĂ£o
>
>
>
>
> On Wed, Apr 3, 2013 at 10:17 PM, Hendrik Adler <hen.ad...@gmail.com>wrote:
>
>> 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
>>
>>
>
>
> ------------------------------------------------------------------------------
> 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
>
>
--
'Take it easy, you little fool,' the werewolf growled. 'When your turn
comes to jump into the Nothing, you too will be a nameless servant of
power, with no will of your own. Who knows what use they will make of you?
Maybe you'll help them persuade people to buy things they don't need, or
hate things they know nothing about, or hold beliefs that make them easy to
handle, or doubt the truths that might save them. Yes, you little
Fantastican, big things will be done in the human world with your help,
wars started, empires founded...'
------------------------------------------------------------------------------
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