File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ export function inDefaultGraph(quad) {
3434
3535// Creates a function that prepends the given IRI to a local name
3636export function prefix ( iri , factory ) {
37- return prefixes ( { '' : iri } , factory ) ( '' ) ;
37+ return prefixes ( { '' : iri . value || iri } , factory ) ( '' ) ;
3838}
3939
4040// Creates a function that allows registering and expanding prefixes
Original file line number Diff line number Diff line change @@ -190,6 +190,16 @@ describe('Util', () => {
190190 expect ( rdfs ( 'label' ) ) . to . deep . equal ( namedNode ( 'http://www.w3.org/2000/01/rdf-schema#label' ) ) ;
191191 } ) ;
192192
193+ it ( 'should expand a NamedNode prefix' , ( ) => {
194+ const rdfs = Util . prefix ( namedNode ( 'http://www.w3.org/2000/01/rdf-schema#' ) ) ;
195+ expect ( rdfs ( 'label' ) ) . to . deep . equal ( namedNode ( 'http://www.w3.org/2000/01/rdf-schema#label' ) ) ;
196+ } ) ;
197+
198+ it ( 'should expand a Literal prefix' , ( ) => {
199+ const rdfs = Util . prefix ( literal ( 'http://www.w3.org/2000/01/rdf-schema#' ) ) ;
200+ expect ( rdfs ( 'label' ) ) . to . deep . equal ( namedNode ( 'http://www.w3.org/2000/01/rdf-schema#label' ) ) ;
201+ } ) ;
202+
193203 it ( 'should use a custom factory when specified' , ( ) => {
194204 const factory = { namedNode : function ( s ) { return `n-${ s } ` ; } } ;
195205 const rdfs = Util . prefix ( 'http://www.w3.org/2000/01/rdf-schema#' , factory ) ;
You can’t perform that action at this time.
0 commit comments