Skip to content

Commit

Permalink
Renamed Methods as per PR
Browse files Browse the repository at this point in the history
  • Loading branch information
lordtatty committed Jul 23, 2015
1 parent a895200 commit c8ef3f6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
12 changes: 6 additions & 6 deletions src/classes/ExtendedGraph.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public function make_resource_array($resource) {
* @return boolean true if the triple was new, false if it already existed in the graph
*/
public function add_resource_triple($s, $p, $o) {
if($this->isValidResourceValue($o)) {
if($this->isValidResource($o)) {
return $this->_add_triple($s, $p, array('type' => strpos($o, '_:') === 0 ? 'bnode' : 'uri', 'value' => $o));
}
return false;
Expand All @@ -157,7 +157,7 @@ public function add_resource_triple($s, $p, $o) {
* @return boolean true if the triple was new, false if it already existed in the graph
*/
public function add_literal_triple($s, $p, $o, $lang = null, $dt = null) {
if($this->isValidLiteralValue($o)) {
if($this->isValidLiteral($o)) {
$o_info = array('type' => 'literal', 'value' => $o);
if ($lang != null) {
$o_info['lang'] = $lang;
Expand All @@ -181,10 +181,10 @@ private function _add_triple($s, $p, Array $o_info) {
// The value $o should already have been validated by this point
// It's validation differs depending on whether it is a literal or resource
// So just check the subject and predicate here...
if(!$this->isValidResourceValue($s)){
if(!$this->isValidResource($s)){
throw new \Tripod\Exceptions\Exception("The subject is invalid");
}
if(!$this->isValidResourceValue($p)){
if(!$this->isValidResource($p)){
throw new \Tripod\Exceptions\Exception("The predicate is invalid");
}
if (!isset($this->_index[$s])) {
Expand Down Expand Up @@ -214,7 +214,7 @@ private function _add_triple($s, $p, Array $o_info) {
* @param string $value
* @return bool
*/
protected function isValidLiteralValue($value){
protected function isValidLiteral($value){
if(!is_scalar($value)){
return false;
}
Expand All @@ -227,7 +227,7 @@ protected function isValidLiteralValue($value){
* @param string $value
* @return bool
*/
protected function isValidResourceValue($value){
protected function isValidResource($value){
if(!is_string($value) || empty($value)){
return false;
}
Expand Down
10 changes: 5 additions & 5 deletions src/mongo/MongoGraph.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ private function add_tarray_to_index($tarray)
}
else if($key == "_id"){
// If the subject is invalid then throw an exception
if(!isset($value['r']) || !$this->isValidResourceValue($value['r'])){
if(!isset($value['r']) || !$this->isValidResource($value['r'])){
throw new \Tripod\Exceptions\Exception("The subject cannot be an empty string");
}
}
Expand All @@ -160,7 +160,7 @@ private function toGraphValueObject($mongoValueObject)
if (array_key_exists(VALUE_LITERAL,$mongoValueObject))
{
// only allow valid values
if($this->isValidLiteralValue($mongoValueObject[VALUE_LITERAL])){
if($this->isValidLiteral($mongoValueObject[VALUE_LITERAL])){
// single value literal
$simpleGraphValueObject[] = array(
'type'=>'literal',
Expand All @@ -170,7 +170,7 @@ private function toGraphValueObject($mongoValueObject)
else if (array_key_exists(VALUE_URI,$mongoValueObject))
{
// only allow valid values
if($this->isValidResourceValue($mongoValueObject[VALUE_URI])) {
if($this->isValidResource($mongoValueObject[VALUE_URI])) {
// single value uri
$simpleGraphValueObject[] = array(
'type' => 'uri',
Expand All @@ -186,13 +186,13 @@ private function toGraphValueObject($mongoValueObject)
{
// Make sure the value is valid
if($type==VALUE_LITERAL){
if(!$this->isValidLiteralValue($value)){
if(!$this->isValidLiteral($value)){
continue;
}
$valueTypeLabel = 'literal';
}
else{
if(!$this->isValidResourceValue($value)){
if(!$this->isValidResource($value)){
continue;
}
$valueTypeLabel = 'uri';
Expand Down

0 comments on commit c8ef3f6

Please sign in to comment.