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

JCL-431: Improve containment validation #653

Merged
merged 2 commits into from
Aug 17, 2023
Merged

Conversation

acoburn
Copy link
Collaborator

@acoburn acoburn commented Aug 14, 2023

Resolves #634

This improves containment validation by considering more cases to be handled, specifically those containment triples that include fragment and query components.

The test cases have been expanded to include the additional cases.

The implementation makes more extensive use of normalized Java URI objects to achieve the improved validation.

@acoburn acoburn requested a review from a team as a code owner August 14, 2023 23:04
Comment on lines 86 to 87
if (getIdentifier().getPath().endsWith("/")) {
final String container = normalize(getIdentifier());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Newly, the condition is not normalized. This seems intentional.

But what happens with URIs of the form x/. and x/y/..?
Maybe we should normalize before checking whether it ends in a slash.

Example

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getIdentifier from RDFSource via SolidRDFSource is a URI and getPath is not normalized.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've updated this to normalize the URI path

Comment on lines 105 to 110
if (!getIdentifier().getPath().endsWith("/")) {
messages.add("Container URI does not end in a slash");
}

// Get the normalized container URI
final String container = normalize(getIdentifier());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above.

Maybe worth extracting something like isContainer for readability and consistency.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done in 2b4b916

if (!object.getIRIString().startsWith(container)) {
// Out-of-domain containment triple object

// 1 URI Structure Tests
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do these numbers refer to? I looked in several place I imagined would be relevant, but haven't found anything like this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was more for my own organization. I've backed that out

@acoburn acoburn merged commit 286dfe4 into main Aug 17, 2023
5 checks passed
@acoburn acoburn deleted the JCL-431-containment-validation branch August 17, 2023 13:19
acoburn added a commit that referenced this pull request Aug 18, 2023
This pull request was closed.
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.

getResources can include non-child resources
3 participants