File tree Expand file tree Collapse file tree 2 files changed +22
-5
lines changed Expand file tree Collapse file tree 2 files changed +22
-5
lines changed Original file line number Diff line number Diff line change @@ -373,11 +373,11 @@ export interface StoreOptions {
373373}
374374
375375export namespace Util {
376- function isNamedNode ( value : RDF . Term | null ) : boolean ;
377- function isBlankNode ( value : RDF . Term | null ) : boolean ;
378- function isLiteral ( value : RDF . Term | null ) : boolean ;
379- function isVariable ( value : RDF . Term | null ) : boolean ;
380- function isDefaultGraph ( value : RDF . Term | null ) : boolean ;
376+ function isNamedNode ( value : RDF . Term | null ) : value is RDF . NamedNode ;
377+ function isBlankNode ( value : RDF . Term | null ) : value is RDF . BlankNode ;
378+ function isLiteral ( value : RDF . Term | null ) : value is RDF . Literal ;
379+ function isVariable ( value : RDF . Term | null ) : value is RDF . Variable ;
380+ function isDefaultGraph ( value : RDF . Term | null ) : value is RDF . DefaultGraph ;
381381 function inDefaultGraph ( value : RDF . Quad ) : boolean ;
382382 function prefix ( iri : RDF . NamedNode | string , factory ?: RDF . DataFactory ) : PrefixedToIri ;
383383 function prefixes (
Original file line number Diff line number Diff line change @@ -434,6 +434,23 @@ function test_doc_utility() {
434434 const namedNode1 : RDF . NamedNode = N3Util . prefix ( "http://www.w3.org/2000/01/rdf-schema#" ) ( "label" ) ;
435435 const namedNode2 : RDF . NamedNode = N3Util . prefixes ( prefixes ) ( "rdfs" ) ( "label" ) ;
436436 const namedNode3 : N3 . NamedNode = N3Util . prefixes ( prefixes ) ( "rdfs" ) ( "label" ) ;
437+
438+ const term = N3 . DataFactory . literal ( "Mickey Mouse" ) as RDF . Term ;
439+ if ( N3Util . isNamedNode ( term ) ) {
440+ const namedNodeTerm : RDF . NamedNode = term ;
441+ }
442+ if ( N3Util . isBlankNode ( term ) ) {
443+ const blankNodeTerm : RDF . BlankNode = term ;
444+ }
445+ if ( N3Util . isLiteral ( term ) ) {
446+ const literalTerm : RDF . Literal = term ;
447+ }
448+ if ( N3Util . isVariable ( term ) ) {
449+ const variableTerm : RDF . Variable = term ;
450+ }
451+ if ( N3Util . isDefaultGraph ( term ) ) {
452+ const defaultGraphTerm : RDF . DefaultGraph = term ;
453+ }
437454}
438455
439456function test_parser_options ( ) {
You can’t perform that action at this time.
0 commit comments