Repository navigation
isIri() and isBlank() on a node (root subject and relation value) - #418
Merged
Merged
Conversation
…I on every page A row LIMIT counted a subject twice when the data held two values of a maxCount-1 path (a label in two languages), so a page held fewer subjects than asked. Paged selects now use the sub-SELECT of subjects whenever a row carries any value besides its subject; a select of subjects only keeps its plain LIMIT. An offset without an orderBy pages in subject order.
.where((p) => p.isIri()) keeps the named subjects, .minus((p) => p.isBlank()) leaves out the blank nodes. On a paged select the filter applies inside the page of subjects, before its LIMIT.
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Depends on #417. This branch is based on
fix/page-by-subject, so that a paged select applies the filter inside the per-subject page. Merge #417 first. This PR's own change is the second commit.What changed
A query had no way to test whether the root subject is an IRI or a blank node.
isIriandisBlankexisted only on literal values (.where((p) => p.isIri())threw "is accessed in a query, but it does not have a @linkedProperty decorator"). So a read of named subjects only, e.g. classes without the anonymousowl:unionOfclass expressions, had to filter after the read, which breaks paging.QueryShape(the root subject and every relation value) now hasisIri()andisBlank(). They sit next to its existingstr()andisDefined(), are named after the README's expression table, and lower to SPARQLisIRI/isBlank:Both names are added to
RESERVED_QUERY_DSL_NAMES. The README documents them under MINUS and in the expression section. Changeset: minor (new DSL surface).Generated SPARQL for
Person.select((p) => p.name).from([g]).minus((p) => p.isBlank()).orderBy((p) => p.name).limit(7):With
.where((p) => p.isIri())the page holdsFILTER(isIRI(?a0))before itsLIMIT.Tests
src/tests/subject-term-type.test.ts. Four lowering tests cover rootwhereisIri/isBlank, the filter inside the page before LIMIT, and a relation. Five live Fuseki tests use two IRI and two blank-node subjects, withwhere,minus, pages withlimit/offset, and a relation whose value is a blank node. Written first:Tests: 9 failed, 9 total.whereRootIsIriandminusRootIsBlankinquery-fixtures, so the DSL-JSON round-trip covers them.FUSEKI_BASE_URL=http://localhost:3962 FUSEKI_ADMIN_PASSWORD=admin npm test, afternpx linked build):tsc -p tsconfig-tests.jsonpassed with exit 0.Follow-ups
isLiteral()on a node is not added: a subject or a relation's value is never a literal.