selecting limited subquery data with SPARQL 1.1

你离开我真会死。 提交于 2020-01-06 09:41:51

问题


I'm trying to get something done, but I got performance issues.

I got stores, and products. The products are linked to the stores via :inStore predicate. The main purpose here is to get 5 products from each matched store with total limit of 75 products. The order should be the closest ?distance and the highest ?price. Here's my query:

SELECT ?store ?productID ?distance ?price {
    {
        SELECT ?store ?distance {
            ?store omgeo:nearby(51.5125591000 -0.1248754000 '100km') .
            ?store geo-pos:lat ?latBase .
            ?store geo-pos:long ?longBase .
            BIND (omgeo:distance(51.5125591000, -0.1248754000, ?latBase, ?longBase) AS ?distance)
        } ORDER BY (?distance)
    }
    OPTIONAL {
        {
            SELECT ?productID ?price {
                {
                    SELECT ?productID {
                        ?productID :inStore ?store . 
                    }
                }
                ?productID :price ?price .
            } ORDER BY DESC(?price) LIMIT 5
        }
    }
    FILTER (BOUND(?productID))
} LIMIT 75

The problem here is that this is extremly slow on a very powerful server. Any suggestions?

来源:https://stackoverflow.com/questions/29469353/selecting-limited-subquery-data-with-sparql-1-1

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!