Conversation
Resolve relative `@vocab` using expandIri with both vocab and base relative resolution. A relative `@vocab` is only invalid in 1.0.
… a term that can be used as a prefix.
|
|
||
| // already absolute IRI | ||
| return value; | ||
| if(_isAbsoluteIri(value)) { |
There was a problem hiding this comment.
Why is this extra check needed now? It still appears to be within the positive check for a colon in value.
There was a problem hiding this comment.
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.
| } | ||
| // already an absolute IRI | ||
| if(iri.indexOf(':') !== -1) { | ||
| if(api.isAbsolute(iri)) { |
There was a problem hiding this comment.
@davidlehn -- it would be good to understand the performance impact on things like this.
There was a problem hiding this comment.
We do have benchmarking code. I'm not sure what the tests would be.
There was a problem hiding this comment.
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.
Co-Authored-By: Dave Longley <dlongley@digitalbazaar.com>
dlongley
left a comment
There was a problem hiding this comment.
LGTM modulo @davidlehn's typo fix on my bad typo fix.
|
|
||
| // already absolute IRI | ||
| return value; | ||
| if(_isAbsoluteIri(value)) { |
Co-Authored-By: David I. Lehn <dil@lehn.org>
@vocabcan be relative or a Compact IRI in 1.1, resolved against either a previous@vocab,@baseor document base.@prefix: false, or expanded term definitions to construct compact IRIs.