List children based on all targetclasses in schema #224
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.
Basically this is a refactored version of the solution suggested by @qplevier.
Whereas the current implementation picks the first item from the list of
targetClassUris, we now check all specified target classes, i.e. bothdcat:Resourceand its subclasses. As a result, the list of matched subjects is likely to contain duplicates, e.g. one fordcat:Resourceand one fordcat:Catalog, but these are removed with the help ofSet.Also added some type specifications, for clarity, and changed the arrow function argument.
fixes #210
Rationale
As far as I can see, the goal in
EntityConfig.createChildrenList()is to create a list summarizing all the child resources.For this reason it needs to obtain all subjects matching the type
dcat:Resourceor one of its subclasses.Because the data graph only contains triples describing the child resources, it should be sufficient to grab unique subjects matching any of the target classes defined in the active resource definition.
Notes:
<subject> a dcat:Resource, dcat:Catalog. This seems redundant, knowning thatdcat:Catalogis a subclass ofdcat:Resource. However, the client is not aware of the DCAT class hierarchy, because there are no explicitrdfs:subClassOfstatements in the data graph, and it has not loaded the dcat spec.