Example #1
0
 /**
  * Load and parse a JSON-LD document
  *
  * The document can be supplied directly as string, by passing a file
  * path, or by passing a URL.
  *
  * Usage:
  *
  *     $document = JsonLD::getDocument('document.jsonld');
  *     print_r($document->getGraphNames());
  *
  * It is possible to configure the processing by setting the options
  * parameter accordingly. Available options are:
  *
  * <dl>
  *   <dt>base</dt>
  *   <dd>The base IRI of the input document.</dd>
  *
  *   <dt>expandContext</dt>
  *   <dd>An optional context to use additionally to the context embedded
  *     in input when expanding the input.</dd>
  *
  *   <dt>documentFactory</dt>
  *   <dd>The document factory.</dd>
  * </dl>
  *
  * The options parameter might be passed as associative array or as
  * object.
  *
  * @param string|object|array $input   The JSON-LD document to process.
  * @param null|array|object   $options Options to configure the processing.
  *
  * @return Document The parsed JSON-LD document.
  *
  * @throws JsonLdException
  *
  * @api
  */
 public static function getDocument($input, $options = null)
 {
     $input = self::expand($input, $options);
     $processor = new Processor(self::mergeOptions($options));
     return $processor->getDocument($input);
 }