Arc2JsonLdConverter.php
public static function indexToQuads(array $index) {
    $quads = array();
    foreach ($index as $subject => $predicates) {
      foreach ($predicates as $predicate => $objects) {
        foreach ($objects as $object) {
          $quads[] = new Quad(new IRI($subject),
            new IRI($predicate),
            ($object['type']!='literal')
              ? new IRI($object['value']) : new TypedValue($object['value'],
            (isset($object['datatype']) && $object['datatype']!='')
              ? $object['datatype'] : RdfConstants::XSD_STRING));
        }
      }
    }
    return $quads;
  }
public static function indexToQuads(array $index) {
    $quads = array();
    foreach ($index as $subject => $predicates) {
      foreach ($predicates as $predicate => $objects) {
        foreach ($objects as $object) {
          $quads[] = new Quad(new IRI($subject),
            new IRI($predicate),
            ($object['type']!='literal')
              ? new IRI($object['value']) : new TypedValue($object['value'],
            (isset($object['datatype']) && $object['datatype']!='')
              ? $object['datatype'] : RdfConstants::XSD_STRING));
        }
      }
    }
    return $quads;
  }
public static function indexToQuads ( array $ index ) { $ quads = array ( ) ; foreach ( $ index as $ subject => $ predicates ) { foreach ( $ predicates as $ predicate => $ objects ) { foreach ( $ objects as $ object ) { $ quads [ ] = new Quad ( new IRI ( $ subject ) , new IRI ( $ predicate ) , ( $ object [ 'type' ] != 'literal' ) ? new IRI ( $ object [ 'value' ] ) : new TypedValue ( $ object [ 'value' ] , ( isset ( $ object [ 'datatype' ] ) && $ object [ 'datatype' ] != '' ) ? $ object [ 'datatype' ] : RdfConstants :: XSD_STRING ) ) ; } } } return $ quads ; }
Converts an ARC2 index into an array of RDF quads in JsonLD
library format.
@param array $index ARC2 index
Converts an ARC2 index into an array of RDF quads in JsonLD library format .