source: Dev/trunk/rdfapi/sparql/SparqlVariable.php @ 12

Last change on this file since 12 was 12, checked in by basvannuland, 14 years ago

Added RAP RDF API
Added RDF reader writer for save and load survey

File size: 785 bytes
Line 
1<?php
2require_once RDFAPI_INCLUDE_DIR . '/model/Node.php';
3require_once RDFAPI_INCLUDE_DIR . '/util/Object.php';
4
5/**
6*   Object representation of a SPARQL variable.
7*   @license http://www.gnu.org/licenses/lgpl.html LGPL
8*/
9class SparqlVariable extends Object
10{
11    public $name;
12
13    public function __construct($name)
14    {
15        $this->name = $name;
16    }
17
18
19
20    public function __toString()
21    {
22        return $this->name;
23    }
24
25
26
27    /**
28    *   Checks if the given subject/predicate/object
29    *   is a variable name.
30    *
31    *   @return boolean
32    */
33    public static function isVariable($bject)
34    {
35        return is_string($bject) && strlen($bject) >= 2
36             && ($bject[0] == '?' || $bject[0] == '$');
37    }//public static function isVariable($bject)
38
39}
40?>
Note: See TracBrowser for help on using the repository browser.