|
|
@ -1028,13 +1028,14 @@ class ObjectHelper { |
|
|
|
* @param $offset int |
|
|
|
* @param $offset int |
|
|
|
* An integer, used to offset the results (results should be ordered, to |
|
|
|
* An integer, used to offset the results (results should be ordered, to |
|
|
|
* maintain consistency. |
|
|
|
* maintain consistency. |
|
|
|
|
|
|
|
* |
|
|
|
* @return array |
|
|
|
* @return array |
|
|
|
* Indexed (numerical) array, containing a number of associative arrays, |
|
|
|
* Indexed (numerical) array, containing a number of associative arrays, |
|
|
|
* with keys being the same as the variable names in the query. |
|
|
|
* with keys being the same as the variable names in the query. |
|
|
|
* URIs beginning with 'info:fedora/' will have this beginning stripped |
|
|
|
* URIs beginning with 'info:fedora/' will have this beginning stripped |
|
|
|
* off, to facilitate their use as PIDs. |
|
|
|
* off, to facilitate their use as PIDs. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
protected static function _perform_ri_query($query, $type = 'itql', $limit = -1, $offset = 0) { |
|
|
|
static function perform_ri_query($query, $type = 'itql', $limit = -1, $offset = 0) { |
|
|
|
//Setup the query options... |
|
|
|
//Setup the query options... |
|
|
|
$options = array( |
|
|
|
$options = array( |
|
|
|
'type' => 'tuples', |
|
|
|
'type' => 'tuples', |
|
|
@ -1078,7 +1079,7 @@ class ObjectHelper { |
|
|
|
|
|
|
|
|
|
|
|
$attrs = $element->attributes(); |
|
|
|
$attrs = $element->attributes(); |
|
|
|
if (!empty($attrs['uri'])) { |
|
|
|
if (!empty($attrs['uri'])) { |
|
|
|
$val = self::_pid_uri_to_bare_pid((string)$attrs['uri']); |
|
|
|
$val = self::pid_uri_to_bare_pid((string)$attrs['uri']); |
|
|
|
} |
|
|
|
} |
|
|
|
else { |
|
|
|
else { |
|
|
|
$val = (string)$element; |
|
|
|
$val = (string)$element; |
|
|
@ -1099,7 +1100,7 @@ class ObjectHelper { |
|
|
|
* @see self::_perform_ri_query() |
|
|
|
* @see self::_perform_ri_query() |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static function perform_itql_query($query, $limit = -1, $offset = 0) { |
|
|
|
public static function perform_itql_query($query, $limit = -1, $offset = 0) { |
|
|
|
return self::_perform_ri_query($query, 'itql', $limit, $offset); |
|
|
|
return self::perform_ri_query($query, 'itql', $limit, $offset); |
|
|
|
} |
|
|
|
} |
|
|
|
/** |
|
|
|
/** |
|
|
|
* Thin wrapper for self::_perform_ri_query(). |
|
|
|
* Thin wrapper for self::_perform_ri_query(). |
|
|
@ -1107,7 +1108,7 @@ class ObjectHelper { |
|
|
|
* @see self::_perform_ri_query() |
|
|
|
* @see self::_perform_ri_query() |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static function perform_sparql_query($query, $limit = -1, $offset = 0) { |
|
|
|
public static function perform_sparql_query($query, $limit = -1, $offset = 0) { |
|
|
|
return self::_perform_ri_query($query, 'sparql', $limit, $offset); |
|
|
|
return self::perform_ri_query($query, 'sparql', $limit, $offset); |
|
|
|
} |
|
|
|
} |
|
|
|
/** |
|
|
|
/** |
|
|
|
* Utility function used in self::_perform_ri_query(). |
|
|
|
* Utility function used in self::_perform_ri_query(). |
|
|
@ -1116,11 +1117,12 @@ class ObjectHelper { |
|
|
|
* |
|
|
|
* |
|
|
|
* @param $uri string |
|
|
|
* @param $uri string |
|
|
|
* A string containing a URI. |
|
|
|
* A string containing a URI. |
|
|
|
|
|
|
|
* |
|
|
|
* @return string |
|
|
|
* @return string |
|
|
|
* The input string less the 'info:fedora/' prefix (if it has it). |
|
|
|
* The input string less the 'info:fedora/' prefix (if it has it). |
|
|
|
* The original string otherwise. |
|
|
|
* The original string otherwise. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
protected static function _pid_uri_to_bare_pid($uri) { |
|
|
|
protected static function pid_uri_to_bare_pid($uri) { |
|
|
|
$chunk = 'info:fedora/'; |
|
|
|
$chunk = 'info:fedora/'; |
|
|
|
$pos = strpos($uri, $chunk); |
|
|
|
$pos = strpos($uri, $chunk); |
|
|
|
if ($pos === 0) { //Remove info:fedora/ chunk |
|
|
|
if ($pos === 0) { //Remove info:fedora/ chunk |
|
|
|