File tree Expand file tree Collapse file tree 4 files changed +6
-6
lines changed
Expand file tree Collapse file tree 4 files changed +6
-6
lines changed Original file line number Diff line number Diff line change 33### Fixed
44- Use rdf-canonize to compare n-quads test results.
55- Multiple graph tests.
6+ - Sort ` @type ` when looking for scoped contexts.
67
78### Changed
89- Use JSON-LD WG tests.
Original file line number Diff line number Diff line change @@ -145,7 +145,10 @@ api.compact = ({
145145 // apply any context defined on an alias of @type
146146 // if key is @type and any compacted value is a term having a local
147147 // context, overlay that context
148- const types = element [ '@type' ] || [ ] ;
148+ let types = element [ '@type' ] || [ ] ;
149+ if ( types . length > 1 ) {
150+ types = Array . from ( types ) . sort ( ) ;
151+ }
149152 for ( const type of types ) {
150153 const compactedType = api . compactIri (
151154 { activeCtx, iri : type , relativeTo : { vocab : true } } ) ;
Original file line number Diff line number Diff line change @@ -157,7 +157,7 @@ api.expand = ({
157157 const expandedProperty = _expandIri ( activeCtx , key , { vocab : true } ) ;
158158 if ( expandedProperty === '@type' ) {
159159 // set scopped contexts from @type
160- const types = [ ] . concat ( element [ key ] ) ;
160+ const types = [ ] . concat ( element [ key ] ) . sort ( ) ;
161161 for ( const type of types ) {
162162 const ctx = _getContextValue ( activeCtx , type , '@context' ) ;
163163 if ( ctx ) {
Original file line number Diff line number Diff line change @@ -44,8 +44,6 @@ const TEST_TYPES = {
4444 / ^ # t l i 0 5 / ,
4545 // terms
4646 / ^ # t p 0 0 1 / ,
47- // scoped context on type
48- / ^ # t c 0 1 2 / ,
4947 // rel iri
5048 / ^ # t 0 0 9 5 /
5149 ]
@@ -76,8 +74,6 @@ const TEST_TYPES = {
7674 // mode
7775 / ^ # t p 0 0 1 / ,
7876 / ^ # t p 0 0 2 / ,
79- // scoped context on type
80- / ^ # t c 0 1 1 / ,
8177 // rel iri
8278 / ^ # t 0 0 9 2 / ,
8379 // remote
You can’t perform that action at this time.
0 commit comments