rdf-environment.js
/**
   Create a statement with provisions from translation from curie terms and
   completion of relative iri.
   @param {Node} subject
   @param {NamedNode} predicate
   @param {Term} object
   @param {Node} [graph]
   */
Create a statement with provisions from translation from curie terms and
completion of relative iri.
Create a statement with provisions from translation from curie terms and completion of relative iri .
createStatement(subject, predicate, object, graph = null) {
    if (typeof(subject) == 'string' || subject instanceof String) {
      subject = this.createNamedNode(subject);
    }
    if (typeof(predicate) == 'string' || predicate instanceof String) {
      predicate = this.createNamedNode(predicate);
    }
    if (typeof(object) == 'string' || object instanceof String) {
      try {
        var asURL = new URL(object);
        object = this.createNamedNode(asURL.href);
      } catch (_) {
        object = this.toLiteral(object);
      }
    } else if (typeof(object) != 'object') {
      object = this.toLiteral(object);
    }
    if (typeof(graph) == 'string' || graph instanceof String) {
      graph = this.createNamedNode(graph);
    }
    return (createStatement(subject, predicate, object, graph));
  }
createStatement ( subject , predicate , object , graph = null ) { if ( typeof ( subject ) == 'string' || subject instanceof String ) { subject = this . createNamedNode ( subject ) ; } if ( typeof ( predicate ) == 'string' || predicate instanceof String ) { predicate = this . createNamedNode ( predicate ) ; } if ( typeof ( object ) == 'string' || object instanceof String ) { try { var asURL = new URL ( object ) ; object = this . createNamedNode ( asURL . href ) ; } catch ( _ ) { object = this . toLiteral ( object ) ; } } else if ( typeof ( object ) != 'object' ) { object = this . toLiteral ( object ) ; } if ( typeof ( graph ) == 'string' || graph instanceof String ) { graph = this . createNamedNode ( graph ) ; } return ( createStatement ( subject , predicate , object , graph ) ) ; }
Create a statement with provisions from translation from curie terms and
completion of relative iri.
Create a statement with provisions from translation from curie terms and completion of relative iri .
// console.log({op: 'createStatement', subject: subject, predicate: predicate, object: object, graph: graph});