zazuko / cube-creator

A tool to create RDF cubes from CSV files
GNU Affero General Public License v3.0
14 stars 2 forks source link

fix: performance of cube-projects resource #1287

Closed tpluscode closed 2 years ago

tpluscode commented 2 years ago

TL;DR; a query was generated to load projects' mapping resources in a single request. That request used many FROM claueses

CONSTRUCT { ?s ?p ?o }
FROM <A>
FROM <B>
FROM <C>
FROM <D>
# FROM ...
WHERE { ?s ?p ?o }

This proved to be slow as the number of graphs grow. On the other hand this is fast


CONSTRUCT { ?s ?p ?o }
WHERE {
  { GRAPH <A> { ?s ?p ?o } }
  UNION
  { GRAPH <B> { ?s ?p ?o } }
  UNION
  { GRAPH <C> { ?s ?p ?o } }
  UNION
  { GRAPH <D> { ?s ?p ?o } }
  # UNION ...
}
changeset-bot[bot] commented 2 years ago

🦋 Changeset detected

Latest commit: 4601dab7e2db24697205066eb644951e46b0f555

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package | Name | Type | | ---------------------- | ----- | | @cube-creator/core-api | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

codecov-commenter commented 2 years ago

Codecov Report

Merging #1287 (4601dab) into master (bb16f13) will not change coverage. The diff coverage is n/a.

@@           Coverage Diff           @@
##           master    #1287   +/-   ##
=======================================
  Coverage   81.50%   81.50%           
=======================================
  Files         192      192           
  Lines       13379    13379           
  Branches      750      750           
=======================================
  Hits        10905    10905           
  Misses       2467     2467           
  Partials        7        7           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

l00mi commented 2 years ago

Are there any Side effects to be expected with this PR?

tpluscode commented 2 years ago

Don't think so. The important change is here.

The queries should be equivalent whether using FROM or UNION GRAPH