Arc2JsonLdConverter.php
public static function quadsToTriples(array $quads) {
    $arcTriples = array();
    foreach ($quads as $q) {
      $arcTriples[] = array(
        's' => (string)$q->getSubject(),
        'p' => (string)$q->getProperty(),
        'o' => (is_a($q->getObject(), 'ML\JsonLD\TypedValue'))
          ? $q->getObject()->getValue()
          : (string)$q->getObject(),
        'o_type' => (is_a($q->getObject(), 'ML\JsonLD\TypedValue'))
          ? 'literal'
          : (($q->getObject()->getScheme() == '_')
            ? 'bnode'
            : 'uri')
      );
    }
    return $arcTriples;
  }
public static function quadsToTriples(array $quads) {
    $arcTriples = array();
    foreach ($quads as $q) {
      $arcTriples[] = array(
        's' => (string)$q->getSubject(),
        'p' => (string)$q->getProperty(),
        'o' => (is_a($q->getObject(), 'ML\JsonLD\TypedValue'))
          ? $q->getObject()->getValue()
          : (string)$q->getObject(),
        'o_type' => (is_a($q->getObject(), 'ML\JsonLD\TypedValue'))
          ? 'literal'
          : (($q->getObject()->getScheme() == '_')
            ? 'bnode'
            : 'uri')
      );
    }
    return $arcTriples;
  }
public static function quadsToTriples ( array $ quads ) { $ arcTriples = array ( ) ; foreach ( $ quads as $ q ) { $ arcTriples [ ] = array ( 's' => ( string ) $ q -> getSubject ( ) , 'p' => ( string ) $ q -> getProperty ( ) , 'o' => ( is_a ( $ q -> getObject ( ) , 'ML\JsonLD\TypedValue' ) ) ? $ q -> getObject ( ) -> getValue ( ) : ( string ) $ q -> getObject ( ) , 'o_type' => ( is_a ( $ q -> getObject ( ) , 'ML\JsonLD\TypedValue' ) ) ? 'literal' : ( ( $ q -> getObject ( ) -> getScheme ( ) == '_' ) ? 'bnode' : 'uri' ) ) ; } return $ arcTriples ; }
Converts an array of RDF quads in JsonLD library format into
an array of ARC2 triples.
@param array $quads JsonLD quads
Converts an array of RDF quads in JsonLD library format into an array of ARC2 triples .