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

Expose some modified MagmaCoreDatabase methods on MagmaCoreService #67

Closed
twalmsley opened this issue Nov 2, 2022 · 1 comment · Fixed by #71
Closed

Expose some modified MagmaCoreDatabase methods on MagmaCoreService #67

twalmsley opened this issue Nov 2, 2022 · 1 comment · Fixed by #71
Assignees
Labels
enhancement New feature or request

Comments

@twalmsley
Copy link
Collaborator

A project I'm working on needs two additional methods as shown in the code below, with some slight impact on MagmaCoreDatabase and its implementers.

  1. The first method is useful for finding all items with a certain predicate, such as HQDM.ENTITY_NAME, HQDM.MEMBER_OF_KIND, or RDFS.RDF_TYPE
  2. The second method is a more specific version on the first for finding objects of a specific RDFS.RDF_TYPE or members of a specific kind etc.
    /**
     * Find objects by a predicate.
     *
     * @param <T>       HQDM entity type.
     * @param predicate the predicate {@link HqdmIri}
     * @return a List of {@link Thing} that were found.
     */
    public <T extends Thing> List<T> findByPredicateIriOnly(final IRI predicate) {
        final List<T> searchResult = (List<T>) database.findByPredicateIriOnly(predicate);
        return searchResult;
    }

    /**
     * Find objects by a predicate value.
     *
     * @param <T>       HQDM entity type.
     * @param predicate the predicate {@link IRI}
     * @param value     The value of the predicate.
     * @return a List of {@link Thing} that were found.
     */
    public <T extends Thing> List<T> findByPredicateIriAndValue(final IRI predicate, final Object value) {
        final List<T> searchResult = (List<T>) database.findByPredicateIriAndValue(predicate, value);
        return searchResult;
    }
@twalmsley twalmsley added the enhancement New feature or request label Nov 2, 2022
@twalmsley twalmsley self-assigned this Nov 2, 2022
@twalmsley
Copy link
Collaborator Author

Waiting on som PRs so I can rebase this change and create another PR.

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

Successfully merging a pull request may close this issue.

1 participant