Uploaded image for project: 'Blazegraph (by SYSTAP)'
  1. Blazegraph (by SYSTAP)
  2. BLZG-8990

SERVICE clause is reordered wrongly

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Medium
    • Resolution: Unresolved
    • Affects Version/s: BLAZEGRAPH_2_1_4
    • Fix Version/s: None
    • Component/s: Wikidata Query Service
    • Labels:
      None

      Description

      When using custom SERVICE in Wikidata query service, I try to implement this pattern:
      data -> SERVICE -> data, i.e. some triple matches done resulting in certain result set, this result set is fed to SERVICE, which produces more bindings, and these bindings are used for further processing. Example:

      SELECT * WHERE {
      # Part 1
        wd:Q27119725 wdt:P910 ?category .
        ?link schema:about ?category; schema:isPartOf
      <https://en.wikipedia.org/>; schema:name ?title .
      # Part 2
        SERVICE wikibase:mwapi {
           bd:serviceParam wikibase:api "Generator" .
           bd:serviceParam wikibase:endpoint "en.wikipedia.org" .
           bd:serviceParam mwapi:gcmtitle ?title .
           bd:serviceParam mwapi:generator "categorymembers" .
           bd:serviceParam mwapi:gcmprop "ids|title|type" .
           bd:serviceParam mwapi:gcmlimit "max" .
           # out
           ?subcat wikibase:apiOutput mwapi:title  .
           ?ns wikibase:apiOutput "@ns" .
           ?item wikibase:apiOutputItem mwapi:item .
        }
      # Part 3
        ?item rdfs:label ?itemLabel
        FILTER(lang(?itemLabel) = "en")
      }
      

      Part 1 is producing a single row of bindings, with ?category bound to wd:Q7361750.
      Part 2 generates a number of bindinds for ?item, ?ns and ?subcat based on data in Wikipedia. This also works and results in 16 rows of bindings.

      However, Part 3, that is supposed to add labels to bindings named ?item, does not work. What seems to be happening is that instead of this part being run after SERVICE with ?item already bound, it is reordered to be run before SERVICE, which ?item unbound, which results in considering all labels in the database (millions of them) as valid bindings. This of course does not work and leads to either wrong results on small test databases, or to timeout on complete production database.

      Is there a way to force execution of the patterns in exactly the order they are listed in the query - Part 1 first, then SERVICE, then Part 3?

        Attachments

          Activity

            People

            Assignee:
            bryanthompson bryanthompson
            Reporter:
            stasmalyshev stasmalyshev
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: