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