Re: [Virtuoso-users] Find out which SQL query is generated from my SPARQL

2015-12-14 Thread Kingsley Idehen
On 12/14/15 11:34 AM, Efimov, Alexander wrote:
>
> Hi Kingsley,
>
>  
>
> The idea is that our concept model I map to with R2RML is not the same
> as source tables.
>
> So just  using output from Generate RDF Views would not work.
>
> I write custom R2RML code which maps from flat DB model to graph
> concept model
>
>  
>
> For example:
>
>  
>
> Let it be the following tables:
>
>  
>
> 1.   Goods
>
> a.   ID Integer
>
> b.  Name String
>
> c.   Category String
>
> d.  SubCategory String
>
>  
>
> 2.   Customer
>
> a.   ID Integer
>
> b.  Name String
>
>  
>
> 3.   Order
>
> a.   ID Integer
>
> b.  Goods ID Integer
>
> c.   Customer ID Integer
>
>  
>
> These three tables map to our Concept model which is a bit different
> from table structure and I’m executing SPARQL Query like this:
>
>  
>
> PREFIX:  sq:
>
>  
>
> SELECT *
>
> FROM  >
>
> WHERE
>
> {
>
> ?customer sq:hasOrder ?order .
>
> ?order sq:hasGoods ?goods .
>
> ?goods sq:Name ?goodsName . FILTER (?goodsName in (‘Name1’,
> ‘Name2’)) .
>
> ?goods sq:hasSubCategory ?subCategory . #note that subcategory is IRI
>
> ?subCategory a sq:SubCategory .
>
> ?subCategory sq:hasParentCategory ?category #note that category is IRI
>
> ?subCategory a sq:Category .
>
> };
>
>  
>
> In my particular case I map data from ~10 views to ~13 classes in our
> concept model and WHERE statement is a bit longer.
>
>  
>


You have a number of rdf:type relations in your query which pose
problems unless you leverage the use of physical triples sync'd with
transient triples (the product of loading your r2rml mappings).

Command:

RDF_VIEW_SYNC_TO_PHYSICAL ('{virtual-triples-named-graph-iri}', 1,
'{physical-triples-named-graph-iri}');

Example:

Given a named-graph containing virtual triples (result of loading your
r2rml declarations) identified by the IRI
, you could make the physical
sync replica using a named-graph that holds physical triples identified
by the IRI:  using the command:

RDF_VIEW_SYNC_TO_PHYSICAL ('http://demo.openlinksw.com/SQLServer#', 1,
'urn:demo.openlinksw.com:SQLServer');

Virtuoso will keep  in sync with
 and that named graph should be
the target of queries that are scoped to rdf:type relations.

Links:

[1]
http://kidehen.blogspot.com/2015/07/conceptual-data-virtualization-across.html

[2]
http://docs.openlinksw.com/virtuoso/fn_rdf_view_sync_to_physical.html  .


-- 
Regards,

Kingsley Idehen   
Founder & CEO 
OpenLink Software 
Company Web: http://www.openlinksw.com
Personal Weblog 1: http://kidehen.blogspot.com
Personal Weblog 2: http://www.openlinksw.com/blog/~kidehen
Twitter Profile: https://twitter.com/kidehen
Google+ Profile: https://plus.google.com/+KingsleyIdehen/about
LinkedIn Profile: http://www.linkedin.com/in/kidehen
Personal WebID: http://kingsley.idehen.net/dataspace/person/kidehen#this



smime.p7s
Description: S/MIME Cryptographic Signature
--
___
Virtuoso-users mailing list
Virtuoso-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/virtuoso-users


Re: [Virtuoso-users] Find out which SQL query is generated from my SPARQL

2015-12-14 Thread Efimov, Alexander
Hi Kingsley,

The idea is that our concept model I map to with R2RML is not the same as 
source tables.
So just  using output from Generate RDF Views would not work.
I write custom R2RML code which maps from flat DB model to graph concept model

For example:

Let it be the following tables:


1.   Goods

a.   ID Integer

b.  Name String

c.   Category String

d.  SubCategory String



2.   Customer

a.   ID Integer

b.  Name String



3.   Order

a.   ID Integer

b.  Goods ID Integer

c.   Customer ID Integer

These three tables map to our Concept model which is a bit different from table 
structure and I'm executing SPARQL Query like this:

PREFIX:  sq:

SELECT *
FROM   >
WHERE
{
?customer sq:hasOrder ?order .
?order sq:hasGoods ?goods .
?goods sq:Name ?goodsName . FILTER (?goodsName in ('Name1', 'Name2')) .
?goods sq:hasSubCategory ?subCategory . #note that subcategory is IRI
?subCategory a sq:SubCategory .
?subCategory sq:hasParentCategory ?category #note that category is IRI
?subCategory a sq:Category .
};

In my particular case I map data from ~10 views to ~13 classes in our concept 
model and WHERE statement is a bit longer.

Best regards,
Alexander Efimov.

From: Kingsley Idehen [mailto:kide...@openlinksw.com]
Sent: Monday, December 14, 2015 6:46 PM
To: Efimov, Alexander ; 
virtuoso-users@lists.sourceforge.net
Cc: Gedich, Andrey ; wced...@its.jnj.com
Subject: Re: [Virtuoso-users] Find out which SQL query is generated from my 
SPARQL

On 12/14/15 9:21 AM, Efimov, Alexander wrote:
Hi,

I've built R2RML mappings, but my SPARQL Query (I expect that to be joining 
across about 10 views in DB) runs for hours.
Is there a way to get a SQL query which Virtuoso generates and runs over the 
database views?
I have tried to use trace_on(); command but have nothing human readable in 
terms of SQL queries executed.

Thanks.

Efimov,

I don't quite understand what you are doing, but I would suggest you tried the 
following:

1) Make a SQL view from you 10 table query -- have a sense of the performance 
of this view
2) Use the Virtuoso RDF Views Wizard to generate RDF Views script (this 
includes R2RML generation)
3) Choose the option to make materialized RDF Views (i.e., to actually generate 
physical rather than virtual triples in the quad store that are syn'cd with 
source)
4) Re-test outcome and provide feedback about performance .


Kingsley







--




___

Virtuoso-users mailing list

Virtuoso-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/virtuoso-users




--

Regards,



Kingsley Idehen

Founder & CEO

OpenLink Software

Company Web: http://www.openlinksw.com

Personal Weblog 1: http://kidehen.blogspot.com

Personal Weblog 2: http://www.openlinksw.com/blog/~kidehen

Twitter Profile: https://twitter.com/kidehen

Google+ Profile: https://plus.google.com/+KingsleyIdehen/about

LinkedIn Profile: http://www.linkedin.com/in/kidehen

Personal WebID: http://kingsley.idehen.net/dataspace/person/kidehen#this
--
___
Virtuoso-users mailing list
Virtuoso-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/virtuoso-users


Re: [Virtuoso-users] Find out which SQL query is generated from my SPARQL

2015-12-14 Thread Kingsley Idehen
On 12/14/15 9:21 AM, Efimov, Alexander wrote:
>
> Hi,
>
>  
>
> I’ve built R2RML mappings, but my SPARQL Query (I expect that to be
> joining across about 10 views in DB) runs for hours.
>
> Is there a way to get a SQL query which Virtuoso generates and runs
> over the database views?
>
> I have tried to use trace_on(); command but have nothing human
> readable in terms of SQL queries executed.
>
>  
>
> Thanks.
>

Efimov,

I don't quite understand what you are doing, but I would suggest you
tried the following:

1) Make a SQL view from you 10 table query -- have a sense of the
performance of this view
2) Use the Virtuoso RDF Views Wizard to generate RDF Views script (this
includes R2RML generation)
3) Choose the option to make materialized RDF Views (i.e., to actually
generate physical rather than virtual triples in the quad store that are
syn'cd with source)
4) Re-test outcome and provide feedback about performance .


Kingsley


>
>
> --
>
>
> ___
> Virtuoso-users mailing list
> Virtuoso-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/virtuoso-users


-- 
Regards,

Kingsley Idehen   
Founder & CEO 
OpenLink Software 
Company Web: http://www.openlinksw.com
Personal Weblog 1: http://kidehen.blogspot.com
Personal Weblog 2: http://www.openlinksw.com/blog/~kidehen
Twitter Profile: https://twitter.com/kidehen
Google+ Profile: https://plus.google.com/+KingsleyIdehen/about
LinkedIn Profile: http://www.linkedin.com/in/kidehen
Personal WebID: http://kingsley.idehen.net/dataspace/person/kidehen#this



smime.p7s
Description: S/MIME Cryptographic Signature
--
___
Virtuoso-users mailing list
Virtuoso-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/virtuoso-users


[Virtuoso-users] Find out which SQL query is generated from my SPARQL

2015-12-14 Thread Efimov, Alexander
Hi,

I've built R2RML mappings, but my SPARQL Query (I expect that to be joining 
across about 10 views in DB) runs for hours.
Is there a way to get a SQL query which Virtuoso generates and runs over the 
database views?
I have tried to use trace_on(); command but have nothing human readable in 
terms of SQL queries executed.

Thanks.
--
___
Virtuoso-users mailing list
Virtuoso-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/virtuoso-users