Skip to content

Conversation

gkellogg
Copy link
Collaborator

  • @vocab can be relative or a Compact IRI in 1.1, resolved against either a previous @vocab,
    @base or document base.
  • Better checking of absolute IRIs.
  • Terms that beging with a ':' are not considered absolute or compact IRIs.
  • Don't use terms with @prefix: false, or expanded term definitions to construct compact IRIs.

return mapping['@id'] + suffix;
}

// already absolute IRI
return value;
if(_isAbsoluteIri(value)) {
Copy link
Member

Choose a reason for hiding this comment

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

Why is this extra check needed now? It still appears to be within the positive check for a colon in value.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Having a colon isn’t sufficient to make it an absolute (or compact) IRI. This final test ensure that only an absolute IRI will be returned, otherwise, if falls through.

Copy link
Member

Choose a reason for hiding this comment

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

Ok.

@@ -66,7 +66,7 @@ api.prependBase = (base, iri) => {
return iri;
}
// already an absolute IRI
if(iri.indexOf(':') !== -1) {
if(api.isAbsolute(iri)) {
Copy link
Member

Choose a reason for hiding this comment

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

@davidlehn -- it would be good to understand the performance impact on things like this.

Copy link
Member

Choose a reason for hiding this comment

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

We do have benchmarking code. I'm not sure what the tests would be.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

While a regex comparison is more compute intensive than an indexOf, they should be pretty similar. In any case, it's incorrect to just look for a ':' as a test for if an IRI is absolute.

Copy link
Member

@dlongley dlongley left a comment

Choose a reason for hiding this comment

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

LGTM modulo @davidlehn's typo fix on my bad typo fix.

return mapping['@id'] + suffix;
}

// already absolute IRI
return value;
if(_isAbsoluteIri(value)) {
Copy link
Member

Choose a reason for hiding this comment

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

Ok.

@gkellogg gkellogg requested a review from davidlehn November 14, 2019 21:11
@davidlehn davidlehn added this to the JSON-LD 1.1 milestone Nov 19, 2019
@davidlehn davidlehn merged commit b3da66a into master Nov 19, 2019
@davidlehn davidlehn deleted the rel-iri branch November 19, 2019 01:08
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.

3 participants