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.
This PR is to add path-matching support to the treemunica repo.
Per evaluated page, the available tree:paths are extracted, and are evaluated over the tree:member entities in the page to score their values.
Changes:
/lib/PathMatcher.ts - exports the function to evaluate a path over a graph. This path and the graph are automatically constructed from the passed quad arrays. The path SHOULD be the tree:relation path found in a relation, and looks for a tree:path or shacl:path triple as the root of its path evaluation. The passed graph SHOULD be the tree:member entity and its connected predicates. If these are not the case, performance is slower. An entry point for the member MUST be given (the member uri), an entrypoint for the path MAY be given, if not will auto-find the tree:path and shacl:path entities in the passed quads.
lib/ResultsIterator - Adapted the resultsiterator to make use of path matching functionality. This iterator keeps track of the currently used relationPath (This does not yet have support for multiple different relation types and paths). It handles the extraction of the available path metadata (tree and shacl), and will currently always choose the first relation found for the whole page being processed, or the last used path if no relations are found in this page!
This has as a consequence that multiple relation types with different paths are not supported, and one will be picked at random from each page. This could be solved in future work, but then you would need a mechanism to filter out identical relation paths to not do double work.
lib/functions/extractTreeNodes.ts - Fixed an error in this helper function that would crash if the tree:value of a relation was undefined or null.
Some questions: