Exemplo n.º 1
0
 /**
  * Convert a JSON-LD document to RDF quads
  *
  * The document can be supplied directly as string, by passing a file
  * path, or by passing a URL.
  *
  * Usage:
  *
  *     $quads = JsonLD::toRdf('document.jsonld');
  *     print_r($quads);
  *
  * It is possible to configure the extraction process 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>
  * </dl>
  *
  * The options parameter might be passed as associative array or as
  * object.
  *
  * @param string|object|array $input   The JSON-LD document to expand.
  * @param null|array|object   $options Options to configure the expansion
  *                                    process.
  *
  * @return Quad[] The extracted quads.
  *
  * @throws JsonLdException
  *
  * @api
  */
 public static function toRdf($input, $options = null)
 {
     $options = self::mergeOptions($options);
     $expanded = self::expand($input, $options);
     $processor = new Processor($options);
     return $processor->toRdf($expanded);
 }