Hello Beppe,

The query seems to be so straightforward that the only reason I can
imagine is that there are many RDF Views that deals with same
predicates, so every triple pattern become union of subqueries, one per
view, and the join of unions become a nightmare when expanded to union
of joins. Say, given two copies of one RDF View, as a result of
configuration mistake, the query first becomes join of 10 unions, 2
cases per union, and then union of 1024 joins, 10 members per join.

Altermatively, the trouble may happen if there is only one RDF View, but
its top-level quad map is not exclusive. In that case every triple
pattern is a union of data from virtual graph and data from physical
triples, the overall result is again a union of 1024 joins.

The optimizer might recognize the "exponential explosion" of number of
variants and get something reasonable like union of only 32 joins with 4
union and 6 plain subqueries per join, but there's no warranty that it's
able to find the right threshold to stop.

To provide better hints, I need to get the texts of all "create quad
storage" / "alter quad storage" / "create IRI class" etc. statements
ever used to configure the storage. If they're not preserved, I need the
exact output of sparql statement

define input:storage "" define output:format "TTL"
construct { ?s ?p ?o } from virtrdf: where { ?s ?p ?o }

The output is probably 200Kb or more so it's practical to send directly
to me, not via mail list. I'm also available at Skype as iv_an_ru.

Best Regards,

Ivan Mikhailov
OpenLink Software
http://virtuoso.openlinksw.com


On Wed, 2017-05-03 at 18:15 +0100, Beppe Mazzola wrote:
> Hi to everybody
> 
> I am trying to query the content of a virtual graph, obtained in
> Virtuoso Open Source via the R2RML mapping.
> 
> Executing (relatively) simple SPARQL statements I get run-time errors
> and I do not understand why.
> 
> 
> Example 1) 
> prefix pest:<http://example.com/dataset/pesticides/resource/>
> select ?groupCode ?groupName ?productCode ?productName
> from <http://example.com/dataset/pesticides/resource>
> where 
> {
>   ?treeNutsNameId pest:productCode       "0120000" .
>   ?treeNutsNameId pest:productCode       ?groupCode .
>   ?treeNutsNameId pest:productName       ?groupName .
>   ?treeNutsNameId pest:languageCode      "EN" .
>   ?treeNutsNameId pest:hasProduct        ?treeNutsId .
>   ?nutId          pest:hasParentProduct  ?treeNutsId .    
>   ?nutId          pest:productCode       ?productCode.  
>   ?nutNameId      pest:productCode       ?productCode.
>   ?nutNameId      pest:languageCode      "EN" .
>   ?nutNameId      pest:productName       ?productName .
> }
> 
> 
> 
> For who has the patience to read here is the description of the
> query. 
> 
> It is about a hierarchy of products in which some products can be
> child (having the attribute hasParentProduct not null) of another
> product that represents a group,. There is as well a productName class
> related to a product (referring to this with the attribute hasProduct)
> that provides the product name in many languages (attributes
> languageCode,productName).
> 
> treeNutsId is the IRI of the product group
> nutId is the IRI of a product belonging to the group
> treeNutsNameId is the IRI of the product name of the group
> nutNameId is the IRI of the product name of a group member
> 
> 
> So the meaning of the whole statement is "give me the list of the
> products belonging to the group 0120000"
> 
> 
> 
> Executing the query I get the following error.
> Virtuoso 37000 Error SP031: SPARQL compiler: Internal error: The SPARQL 
> optimizer has failed to process the query with reasonable quality. The 
> resulting SQL query is abnormally long. Please paraphrase the SPARQL query.
> I have to say that the query has worked fine for a while. Then I have
> modified the DB to host UTF-8 text and loaded UTF-8 text and the error
> has come up.
> 
> 
> 
> Example 2
> 
> 
> prefix
> pest:<http://ec.europa.eu/semantic_webgate/dataset/pesticides/resource/>
> select ?productCode ?otherProductCode ?otherProductName 
> ?otherProdScientificName 
> from
> <http://ec.europa.eu/semantic_webgate/dataset/pesticides/resource>
> where 
> {
>   ?prodSynonymId pest:scientificName ?otherProdScientificName.
>   ?prodSynonymId pest:synonymName    ?otherProductName.
>   ?prodSynonymId pest:codeNumber     ?otherProductCode .
>   ?mainProdId    pest:productCode    "120010" .
>   ?prodSynonymId pest:productCode    ?productCode .
>   ?prodSynonymId pest:hasProduct     ?mainProdId .
>   ?prodSynonymId pest:languageCode   'EN' .
> }
> 
> 
> 
> I spare you any explanation. Just a note: the attributes
> scientificName and synonymName 
> have the corresponding DB column declared as NVARCHAR(2000) and
> contain Unicode
> 
> 
> I get the following error.
> Virtuoso 37000 Error SP031: SPARQL: Internal error: The length of generated 
> SQL text has exceeded 10000 lines of code
> If I comment out the line with  scientificName the error disappears.
> 
> I am not a SPARQL expert, even less a Virtuoso expert, so I do not
> understand if and where I do something wrong. 
> 
> 
> Any chance to "squeeze" the generated SQL statement?
> 
> 
> Thanks a lot in advance for any hint or remark!
> 
> 
> Cheers
> 
> 
> Beppe




------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Virtuoso-users mailing list
Virtuoso-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/virtuoso-users

Reply via email to