graph-environment.js
/**
   Given an IRI, return the property name associated with it in the environment.
   If none is present in the context, add a definition which specifies the IRI leaf as the name.
   The first probe searches the context for a property definition which specifies the iri as its @id.
   That result is then cached for future references.
   @oaram {(string|URL)} uri
   */
Given an IRI, return the property name associated with it in the environment.
If none is present in the context, add a definition which specifies the IRI leaf as the name.
The first probe searches the context for a property definition which specifies the iri as its @id.
That result is then cached for future references.
Given an IRI return the property name associated with it in the environment . If none is present in the context add a definition which specifies the IRI leaf as the name . The first probe searches the context for a property definition which specifies the iri as its @id . That result is then cached for future references .
findIdentifierName(uri) {
    var uriNamestring = null;
    switch (typeof(uri)) {
    case 'string': 
      uriNamestring = uri;
      break;
    case 'object': 
      uriNamestring = uri.lexicalForm;
      break;
    default:
      return (null);
    }
    var fieldName = this.context[uriNamestring];
    if (! fieldName) {
      for (var name in this.context) {
        var def = this.context[name];
        var id = def['@id'];
        if (id == uriNamestring) {
          fieldName = name;
          this.context[uriNamestring] = name;
          break;
        }
      }
    }
    if (! fieldName) {
      fieldName = this.context[uriNamestring] = predicateLeaf(uri);
    }
    return ( fieldName );
  }
findIdentifierName ( uri ) { var uriNamestring = null ; switch ( typeof ( uri ) ) { case 'string' : uriNamestring = uri ; break ; case 'object' : uriNamestring = uri . lexicalForm ; break ; default : return ( null ) ; } var fieldName = this . context [ uriNamestring ] ; if ( ! fieldName ) { for ( var name in this . context ) { var def = this . context [ name ] ; var id = def [ '@id' ] ; if ( id == uriNamestring ) { fieldName = name ; this . context [ uriNamestring ] = name ; break ; } } } if ( ! fieldName ) { fieldName = this . context [ uriNamestring ] = predicateLeaf ( uri ) ; } return ( fieldName ) ; }
Given an IRI, return the property name associated with it in the environment.
Given an IRI return the property name associated with it in the environment .
// console.log("fin", uri); // iri as string // url // console.log("fin=", fieldName);