source:
Dev/branches/rest-dojo-ui/server/rdfapi/sparql/SparqlVariable.php
@
274
Last change on this file since 274 was 256, checked in by hendrikvanantwerpen, 13 years ago | |
---|---|
File size: 785 bytes |
Line | |
---|---|
1 | <?php |
2 | require_once RDFAPI_INCLUDE_DIR . '/model/Node.php'; |
3 | require_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 | */ |
9 | class 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.