packages/extension-map/doc/webpacks/shexmap-webapp.js
// ### Constructs a term from the given internal string ID
Constructs a term from the given internal string ID
Constructs a term from the given internal string ID
function termFromId(id, factory) {
  factory = factory || DataFactory; 
  if (!id) return factory.defaultGraph(); 
  switch (id[0]) {
    case '?':
      return factory.variable(id.substr(1));
    case '_':
      return factory.blankNode(id.substr(2));
    case '"':
      if (factory === DataFactory) return new Literal(id); 
      if (id[id.length - 1] === '"') return factory.literal(id.substr(1, id.length - 2)); 
      const endPos = id.lastIndexOf('"', id.length - 1);
      return factory.literal(id.substr(1, endPos - 1), id[endPos + 1] === '@' ? id.substr(endPos + 2) : factory.namedNode(id.substr(endPos + 3)));
    case '<':
      const components = quadId.exec(id);
      return factory.quad(termFromId(unescapeQuotes(components[1]), factory), termFromId(unescapeQuotes(components[2]), factory), termFromId(unescapeQuotes(components[3]), factory), components[4] && termFromId(unescapeQuotes(components[4]), factory));
    default:
      return factory.namedNode(id);
  }
} 
function termFromId ( id , factory ) { factory = factory || DataFactory ; if ( ! id ) return factory . defaultGraph ( ) ; switch ( id [ 0 ] ) { case '?' : return factory . variable ( id . substr ( 1 ) ) ; case '_' : return factory . blankNode ( id . substr ( 2 ) ) ; case '"' : if ( factory === DataFactory ) return new Literal ( id ) ; if ( id [ id . length - 1 ] === '"' ) return factory . literal ( id . substr ( 1 , id . length - 2 ) ) ; const endPos = id . lastIndexOf ( '"' , id . length - 1 ) ; return factory . literal ( id . substr ( 1 , endPos - 1 ) , id [ endPos + 1 ] === '@' ? id . substr ( endPos + 2 ) : factory . namedNode ( id . substr ( endPos + 3 ) ) ) ; case '<' : const components = quadId . exec ( id ) ; return factory . quad ( termFromId ( unescapeQuotes ( components [ 1 ] ) , factory ) , termFromId ( unescapeQuotes ( components [ 2 ] ) , factory ) , termFromId ( unescapeQuotes ( components [ 3 ] ) , factory ) , components [ 4 ] && termFromId ( unescapeQuotes ( components [ 4 ] ) , factory ) ) ; default : return factory . namedNode ( id ) ; } }
Constructs a term from the given internal string ID
Constructs a term from the given internal string ID
// Falsy value or empty string indicate the default graph // Identify the term type based on the first character // Shortcut for internal literals // Literal without datatype or language // Literal with datatype or language // ### Constructs an internal string ID from the given term or ID string