This content has been marked as final. Show 10 replies
This feature (where the table function interface for RDF querying generates SQL) is expected to be available in the upcoming database release. The implementation which retrieves an array of values is available from 10gR2 onwards.
Semantic Technologies development team
Is the TableRewriteSQL feature available in version 11g that is just released?
Yes. 11g has been launched, and will be released shortly.
Note that the user visible query interface remains the same. The use of the TableRewrite functionality is during execution of the query in 11g.
We are developing solutions (using RDF) for other companies. Some of them will use Oracle 10g and some Oracle 11g.
Will there be any way to solve this speed issue in Oracle 10g? E.g. will Oracle release any Stored Procedures that will help on speed issues for 10g?
Can you be more specific about the query performance issues encountered?
In our test-case (which mimics a real case), we have inserted 100 000 Triples which are something like this: (aPerson, hasAmount, amount). To get the Sum of all the amounts, I do the following:
SELECT SUM(Y) FROM TABLE (SDO_RDF_MATCH('(?X :hasAmount ?Y)', SDO_RDF_Models('testmodel'), null SDO_RDF_Alias('', 'http://www.example.org/Account/')), null));
This query will take approx. 40 seconds. If I rewrite this specific query using the TableRewriteSQL approach, the resulting query takes less than a second.
My problem is that I don't know the queries I will use in advance, so in order to use this technique, I need a dynamic way of "translating" the first kind of query into the second kind of query.
So my question is if there is some kind of "translation" procedure already in 10g; or if there are other ways of solving this kind of problem?
Your query is indeed simple, but not very selective. Using table function rewrite (only in 11g) will certainly improve the performance, as verified by yourself.
Tuning SGA/PGA, etc. may reduce that 40 seconds query time. But it is unlikely that
it can reduce the query time to a sub second level, assuming that single graph query
pattern has a match of 100K rows.
Please show me how you did the translation yourself.
Reading from the internet from different places (e.g. here: http://www.cs.wayne.edu/~artem/main/research/TR-DB-052006-CLJF.pdf), I found out that (using a general algorithm) my query could be translated to the following query:
SELECT sum(y) FROM
(Select UriMap.Value_Name.url y, UriMap.Value_Type y$type from mdsys.rdfm_newrdftest triple_table, mdsys.rdf_value$ UriMap WHERe triple_table.P_VALUE_ID = 47 AND triple_table.MODEL_ID = 16 AND UriMap.Value_Id = triple_table.END_NODE_ID);
Here the predicate Amount has ID 47, and our model has ID 16.
This way I could deal with at least some of my problems. However; I did the translation 'manually', and now need a Stored Procedure to do the job. It would be much easier for me (and with less errors) if these kind of Stored Procedures already existed (e.g. the TableRewriteSQL must have already been made?).
So; Is the TableRewriteSQL source code available somewhere? Are there other kinds of Translation algorithms that has been implemented using PL/SQL?
Thank you for the detailed post.
Based on your feedback, we are planning to look into providing a table function rewrite interface (perhaps a stored procedure) for 10gR2. We will keep you updated on how our plans develop.
Meanwhile your 11g users should be able to take advantage of the table function rewrite interface that is part of 11g. Note that the table function rewrite happens transparently to the user/application developer (in other words there are no additional stored procedures to call).
-- Irrelevant contents removed --
Edited by: alwu on Jan 6, 2011 1:32 PM