Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Path matching support #8

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Path matching support #8

wants to merge 8 commits into from

Conversation

Dexagod
Copy link

@Dexagod Dexagod commented Feb 9, 2022

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:

  • Should we add the lock files to the gitignore?
  • How do we handle failure of path matching?
    • How do we handle the logging?
  • Handling of tracking multiple types of relations with different paths is currently not yet supported!

Dexagod and others added 8 commits December 16, 2021 17:37
…rash on missing tree:value property in relations.
Main branch uses package-lock
…checking for expected predicates. The expected predicate values array now is only checked AFTER checking for a tree:path value, and used as a fallback if no prior results are found by checking the tree:path of available relations
@Dexagod
Copy link
Author

Dexagod commented Mar 15, 2022

Fixed the issues I had with results not showing up in the browser while showing on the CLI.
Separated the logic for deciding which quads to test based on processing of tree relations or expected values.
There are some shenanigans in there requiring you to have to provide valid expectedDataType values when not providing expectedPredicateValue items to the scoring functions, but that is something I do not have the bandwidth to fix atm.

This should be handled with an update of all the scoring functions to be more in line with comunica v2.

I am planning to merge this tomorrow afternoon, feel free to review in mean time.
Testing is available (it's published on npm and avalailble in the TREE autocompletion demo to mess around with).
example of the code in action:

https://tree.linkeddatafragments.org/demo/autocompletion/?datasets%5B%5D=https%253A%252F%252Foliviervd.github.io%252Fsubstrings_coghent%252Fagents%252Froot.ttl&query=Al

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant