source: Dev/branches/jos-branch/server/rdfapi/resModel/ResModel.php @ 298

Last change on this file since 298 was 256, checked in by hendrikvanantwerpen, 13 years ago

Reworked project structure based on REST interaction and Dojo library. As
soon as this is stable, the old jQueryUI branch can be removed (it's
kept for reference).

File size: 24.3 KB
Line 
1<?php
2// ----------------------------------------------------------------------------------
3// Class: ResModel
4// ----------------------------------------------------------------------------------
5
6/**
7* A ResModel provides an resource centric view on an underlying RDF model.
8* ResModels show information not as statements but as resources with
9* properties, similar to Jena models. ResModels may create Resources [URI
10* nodes and bnodes]. Creating a Resource does not make the Resource visible to
11* the model; Resources are only "in" Models if Statements about them are added
12* to the Model. Similarly the only way to "remove" a Resource from a Model is
13* to remove all the Statements that mention it.
14*
15* When a Resource or Literal is created by a Model, the Model is free to re-use an existing
16* Resource or Literal object with the correct values, or it may create a fresh one.
17*
18* @version  $Id: ResModel.php 562 2008-02-29 15:30:18Z cax $
19* @author Daniel Westphal <mail at d-westphal dot de>
20*
21*
22* @package      resModel
23* @access       public
24**/
25 
26class ResModel
27{
28       
29        /**
30        * Holds a reference to the assoiated memmodel/dbmodel/infmodel
31        * @var          ResResource
32        * @access       private
33        */
34        var $model;
35
36       
37        /**
38    * Constructor
39        * You have to supply a memmodel/dbmodel/infmodel to save the statements.
40    *
41    * @param object model $model
42        * @access       public
43    */ 
44        function ResModel(& $model)
45        {
46                if (!is_a($model,'Model'))
47                        trigger_error(RDFAPI_ERROR . '(class: ResourceLayer; method: ResourceLayer):
48                                $model has to be object of class Model', E_USER_ERROR);
49               
50                $this->model =& $model;                 
51        }
52       
53        /**
54        * Create a new resource associated with this model.
55        * If the uri string isn't set, this creates a bnode.
56        * Otherwise it creates a URI node.
57        * A URI resource is .equals() to any other URI Resource with the same URI
58        * (even in a different model - be warned).
59        *
60        * This method may return an existing Resource with the correct URI and model,
61        * or it may construct a fresh one, as it sees fit.
62        *
63        * Operations on the result Resource may change this model.
64        *
65        * @param        string  $uri
66        * @return       object ResResource
67        * @access       public
68        */
69        function createResource($uri = null)
70        {
71                $resResource = new ResResource($uri);
72                //associate the resource with this model, and get a unique identifier
73                //if it is bnode.
74                $resResource->setAssociatedModel($this);
75               
76                return $resResource;
77        }
78       
79        /**
80        * Create a new Property associated with this model.
81        * This method may return an existing property with the correct URI and model,
82        * or it may construct a fresh one, as it sees fit.
83        *
84        * Subsequent operations on the returned property may modify this model.
85        * 
86        *
87        * @param        string  $uri
88        * @return       object ResProperty
89        * @access       public
90        */
91        function createProperty($uri = null)
92        {
93                $resProperty = new ResProperty($uri);
94                $resProperty->setAssociatedModel($this);
95                       
96                return $resProperty;
97        }
98       
99        /**
100        * Create an untyped literal from a String value with a specified language.
101        *
102        * If you want to type this literal, you have to set a datatype before
103        * adding it to the model.
104        * 
105        *
106        * @param        string  $label
107        * @param        string  $languageTag
108        * @return       object ResLiteral
109        * @access       public
110        */     
111        function createLiteral($label,$languageTag = null)
112        {
113                $resLiteral = new ResLiteral($label,$languageTag);
114                $resLiteral->setAssociatedModel($this);
115               
116                return $resLiteral;
117        }
118       
119        /**
120        * General method to search for triples.
121        * NULL input for any parameter will match anything.
122        * Example:  $result = $m->find( NULL, NULL, $node );
123        * Finds all Statements with $node as object.
124        * Returns an array of statements with ResResources.
125        *
126        * @param        object ResResource      $subject
127        * @param        object ResResource      $predicate
128        * @param        object ResResource      $object
129        * @return       array
130        * @access       public
131        * @throws       PhpError
132        */
133        function find($subject,$predicate, $object)
134        {
135                $result=array();
136                //convert ResResources to Resources and Blanknodes
137                $resmodel=$this->model->find(   $this->_resNode2Node($subject),
138                                                                                $this->_resNode2Node($predicate),
139                                                                                $this->_resNode2Node($object)
140                                                                         );
141                //convert Resources, Blanknodes to ResResources                                                 
142                foreach ($resmodel->triples as $statement)
143                {
144                        $result[]=new Statement($this->_node2ResNode($statement->getSubject()),
145                                                                        $this->_node2ResNode($statement->getPredicate(),true),
146                                                                        $this->_node2ResNode($statement->getObject())
147                                                                    );
148                };
149                return $result;
150               
151        }
152       
153        /**
154        * Searches for triples and returns the first matching statement.
155        * NULL input for any parameter will match anything.
156        * Example:  $result = $m->findFirstMatchingStatement( NULL, NULL, $node );
157        * Returns the first statement with ResResources of the Model where the object equals $node.
158        * Returns an NULL if nothing is found.
159        * You can define an offset to search.
160        *
161        * @param        object Node     $subject
162        * @param        object Node     $predicate
163        * @param        object Node     $object
164        * @param        integer $offset
165        * @return       object Statement     
166        * @access       public
167        */
168        function findFirstMatchingStatement($subject,$predicate,$object,$offset = 0)
169        {
170       
171                $statement = $this->model->findFirstMatchingStatement(  $this->_resNode2Node($subject),
172                                                                                                                                $this->_resNode2Node($predicate),
173                                                                                                                                $this->_resNode2Node($object),
174                                                                                                                                $offset
175                                                                                                                          );
176                if ($statement!==null)
177                {                                                                                       
178                        return new Statement(   $this->_node2ResNode($statement->getSubject()),
179                                                                        $this->_node2ResNode($statement->getPredicate(),true),
180                                                                        $this->_node2ResNode($statement->getObject())
181                                                            );
182                } else
183                {
184                        return null;
185                }
186        }
187       
188        /**
189        * Adds a new triple to the Model without checking if the statement is already in the Model.
190        * So if you want a duplicate free Model use the addWithoutDuplicates() function (which is slower then add())
191        * Expects a statements with ResResources(ResLiterals)
192        *
193        * @param        object Statement        $statement
194        * @access       public
195        * @throws       PhpError
196        */
197        function add($statement)
198        {
199                return $this->model->add(new Statement( $this->_resNode2Node($statement->getSubject()),
200                                                                                                $this->_resNode2Node($statement->getPredicate()),
201                                                                                                $this->_resNode2Node($statement->getObject()))
202                                                                                           );           
203        }
204        /**
205        * Checks if a new statement is already in the Model and adds the statement, if it is not in the Model.
206        * addWithoutDuplicates() is significantly slower then add().
207        * Retruns TRUE if the statement is added.
208        * FALSE otherwise.
209        * Expects a statements with ResResources(ResLiterals)
210        *
211        * @param        object Statement        $statement
212        * @return   boolean
213        * @access       public
214        * @throws       PhpError
215        */
216        function addWithoutDuplicates($statement)
217        {
218                return $this->model->addWithoutDuplicates(new Statement($this->_resNode2Node($statement->getSubject()),
219                                                                                                                                $this->_resNode2Node($statement->getPredicate()),
220                                                                                                                                $this->_resNode2Node($statement->getObject()))
221                                                                                                                            ); 
222        }
223       
224        /**
225        * Tests if the Model contains the given statement.
226        * TRUE if the statement belongs to the model;
227        * FALSE otherwise.
228        * Expects a statement of ResResources(ResLiterals)
229        *
230        * @param        object Statement        $statement
231        * @return       boolean
232        * @access       public
233        */
234        function contains(& $statement)
235        {
236               
237                return $this->model->contains(new Statement($this->_resNode2Node($statement->getSubject()),
238                                                                                                        $this->_resNode2Node($statement->getPredicate()),
239                                                                                                        $this->_resNode2Node($statement->getObject()))
240                                                                                                        );
241        }
242       
243        /**
244        * Determine if all of the statements in a model are also contained in this model.
245        * True if all of the statements in $model are also contained in this model and false otherwise.
246        *
247        * @param        object Model    &$model
248        * @return       boolean
249        * @access       public
250        */
251        function containsAll(& $model)
252        {
253                if (is_a($model,'ResModel'))
254                        return $this->model->containsAll($model->getModel());
255               
256                return $this->model->containsAll($model);
257        }
258       
259        /**
260        * Determine if any of the statements in a model are also contained in this model.
261        * True if any of the statements in $model are also contained in this model and false otherwise.
262        *
263        * @param        object Model    &$model
264        * @return       boolean
265        * @access       public
266        */     
267        function containsAny(& $model)
268        {
269                if (is_a($model,'ResModel'))
270                        return $this->model->containsAny($model->getModel());
271                return $this->model->containsAny($model);
272        }
273       
274        /**
275        * Determine if the node (ResResource / ResLiteral) $node appears in any statement of this model.
276        *
277        * @param        object Node     &$node
278        * @return       boolean
279        * @access       public
280        */     
281        function containsResource(& $node)
282        {
283                if ($this->findFirstMatchingStatement($node,null,null) === null)
284                        if ($this->findFirstMatchingStatement(null,$node,null) === null)
285                                if ($this->findFirstMatchingStatement(null,null,$node) === null)
286                                        return false;
287                                       
288                return true;
289        }
290       
291        /**
292        * Create a literal from a String value with the $dtype Datatype
293        * An existing literal of the right value may be returned, or a fresh one created.
294        *
295        * @param        string  $value
296        * @param        string  $dtype
297        * @return       object ResLiteral
298        * @access       public
299        */
300        function createTypedLiteral($value,$dtype)
301        {
302                $resLiteral = new ResLiteral($value);
303                $resLiteral->setDatatype($dtype);
304                $resLiteral->setAssociatedModel($this);
305               
306                return $resLiteral;
307        }
308       
309        /**
310        * Checks if two models are equal.
311        * Two models are equal if and only if the two RDF graphs they represent are isomorphic.
312        *
313        * Warning: This method doesn't work correct with models where the same blank node has different
314        * identifiers in the two models. We will correct this in a future version.
315        *
316        * @access       public
317        * @param        object  model &$that
318        * @throws    phpErrpr
319        * @return       boolean
320        */             
321        function equals(& $that)
322        {
323                if (is_a($that,'ResModel'))
324                        return $this->model->equals($that->getModel());
325                return $this->model->equals($that);     
326        }
327       
328        /**
329        * Returns a new model that is the subtraction of another model from this model.
330        *
331        * @param        object Model $model
332        * @return       object MemModel
333        * @access       public
334        * @throws phpErrpr
335        */
336        function subtract($model)
337        {
338                if (is_a($model,'ResModel'))
339                        return $this->model->subtract($model->getModel());
340                return $this->model->subtract($model);
341        }
342       
343        /**
344        * Answer a statement find(s, p, null) with ResResources(ResLiterals) from this model.
345        * If none exist, return null; if several exist, pick one arbitrarily.
346        *
347        * @param        object ResResource $subject
348        * @param        object ResResource $property
349        * @return       object Statement
350        * @access       public
351        * @throws phpErrpr
352        */
353        function getProperty($subject,$property)
354        {
355       
356                $statement= $this->model->findFirstMatchingStatement(   $this->_resNode2Node($subject),
357                                                                                                                                $this->_resNode2Node($property),
358                                                                                                                                null
359                                                                                                                        );
360                if ($statement === null)
361                        return null;
362                                                                                                                               
363                return new Statement($this->_node2ResNode($statement->getSubject()),
364                                                                        $this->_node2ResNode($statement->getPredicate(),true),
365                                                                        $this->_node2ResNode($statement->getObject())
366                                                        );
367                                                                                                       
368        }
369       
370        /**
371        * Checks if MemModel is empty
372        *
373        * @return       boolean
374        * @access       public
375        */
376        function isEmpty()
377        {
378                return $this->model->isEmpty();
379        }
380       
381        /**
382        * Returns a ResIterator with all objects in a model.
383        *
384        * @return       object ResIterator
385        * @access       public
386        * @throws phpErrpr
387        */
388        function listObjects()
389        {
390                return $this->listObjectsOfProperty(null);
391        }
392       
393        /**
394        * Returns a ResIterator with all objects with a given property and property value.
395        *
396        * @param        object ResResource      $property
397        * @param        object ResResource      $value
398        * @return       object ResIterator
399        * @access       public
400        */
401        function listObjectsOfProperty($property, $value = null)
402        {
403                return new ResIterator(null,$property,$value,'o',$this);
404        }
405
406       
407        /**
408        * Returns a ResIterator with all subjects in a model.
409        *
410        * @return       object ResIterator
411        * @access       public
412        * @throws phpErrpr
413        */
414        function listSubjects()
415        {
416                return $this->listSubjectsWithProperty(null);
417        }
418       
419        /**
420        * Returns a ResIterator with all subjects with a given property and property value.
421        *
422        * @param        object ResResource      $property
423        * @param        object ResResource      $value
424        * @return       object ResIterator
425        * @access       public
426        * @throws phpErrpr
427        */
428        function listSubjectsWithProperty($property,$value = null)
429        {
430                return new ResIterator(null,$property,$value,'s',$this);
431        }
432       
433        /**
434        * Removes the statement of ResResources(ResTriples) from the MemModel.
435        * TRUE if the statement is removed.
436        * FALSE otherwise.
437        *
438        * @param        object Statement        $statement
439        * @return   boolean
440        * @access       public
441        * @throws       PhpError
442        */     
443        function remove($statement)
444        {
445                return $this->model->remove(new Statement(      $this->_resNode2Node($statement->getSubject()),
446                                                                                                        $this->_resNode2Node($statement->getPredicate()),
447                                                                                                        $this->_resNode2Node($statement->getObject())
448                                                                                                  ));
449        }
450       
451        /**
452        * Number of statements in the MemModel
453        *
454        * @return       integer
455        * @access       public
456        */
457        function size()
458        {
459                return $this->model->size();
460        }
461       
462        /**
463        * Returns a new Model that is the set-union of the model with another model.
464        * Duplicate statements are removed. If you want to allow duplicates, use addModel() which is much faster.
465        *
466        * The result of taking the set-union of two or more RDF graphs (i.e. sets of triples)
467        * is another graph, which we will call the merge of the graphs.
468        * Each of the original graphs is a subgraph of the merged graph. Notice that when forming
469        * a merged graph, two occurrences of a given uriref or literal as nodes in two different
470        * graphs become a single node in the union graph (since by definition they are the same
471        * uriref or literal) but blank nodes are not 'merged' in this way; and arcs are of course
472        * never merged. In particular, this means that every blank node in a merged graph can be
473        * identified as coming from one particular graph in the original set of graphs.
474        *
475        * Notice that one does not, in general, obtain the merge of a set of graphs by concatenating
476        * their corresponding N-triples documents and constructing the graph described by the merged
477        * document, since if some of the documents use the same node identifiers, the merged document
478        * will describe a graph in which some of the blank nodes have been 'accidentally' merged.
479        * To merge Ntriples documents it is necessary to check if the same nodeID is used in two or
480        * more documents, and to replace it with a distinct nodeID in each of them, before merging the
481        * documents. (Not implemented yet !!!!!!!!!!!)
482        *
483        * @param        object Model    $model
484        * @return       object MemModel
485        * @access       public
486        * @throws phpErrpr
487        *
488        */
489        function & unite(& $model)
490        {
491                if (is_a($model,'ResModel'))
492                        return $this->model->unite($model->getModel());
493                return $this->model->unite($model);
494        }
495       
496        /**
497        * Adds another model to this MemModel.
498        * Duplicate statements are not removed.
499        * If you don't want duplicates, use unite().
500        * If any statement of the model to be added to this model contains a blankNode
501        * with an identifier already existing in this model, a new blankNode is generated.
502        *
503        * @param        object Model    $model
504        * @access       public
505        * @throws phpErrpr
506        *
507        */
508        function addModel(&$model) 
509        {
510                if (is_a($model,'ResModel'))
511                        return $this->model->addModel($model->getModel());
512                return $this->model->addModel($model);
513        }
514       
515        /**
516        * Create a new RDF Container from type rdf:Alt
517        * This method may return an existing container with the correct URI and model,
518        * or it may construct a fresh one, as it sees fit.
519        *
520        * Subsequent operations on the returned Container may modify this model.
521        * 
522        *
523        * @param        string  $uri
524        * @return       object ResProperty
525        * @access       public
526        */
527        function createAlt($uri = null)
528        {
529                $resAlt = new ResAlt($uri);
530                $resAlt->setAssociatedModel($this);
531                       
532                return $resAlt;         
533        }
534       
535        /**
536        * Create a new RDF Container from type rdf:Bag
537        * This method may return an existing container with the correct URI and model,
538        * or it may construct a fresh one, as it sees fit.
539        *
540        * Subsequent operations on the returned Container may modify this model.
541        * 
542        *
543        * @param        string  $uri
544        * @return       object ResProperty
545        * @access       public
546        */
547        function createBag($uri = null)
548        {
549                $resBag = new ResBag($uri);
550                $resBag->setAssociatedModel($this);
551                       
552                return $resBag;
553        }
554       
555        /**
556        * Create a new RDF Container from type rdf:Seq
557        * This method may return an existing container with the correct URI and model,
558        * or it may construct a fresh one, as it sees fit.
559        *
560        * Subsequent operations on the returned Container may modify this model.
561        * 
562        *
563        * @param        string  $uri
564        * @return       object ResProperty
565        * @access       public
566        */
567        function createSeq($uri = null)
568        {
569                $resSeq = new ResSeq($uri);
570                $resSeq->setAssociatedModel($this);
571                       
572                return $resSeq;
573        }       
574       
575        /**
576        * Create a new RDF Collection from type rdf:List
577        * This method may return an existing container with the correct URI and model,
578        * or it may construct a fresh one, as it sees fit.
579        *
580        * Subsequent operations on the returned Container may modify this model.
581        * 
582        *
583        * @param        string  $uri
584        * @return       object ResProperty
585        * @access       public
586        */
587        function createList($uri = null)
588        {
589                $resList = new ResList($uri);
590                $resList->setAssociatedModel($this);
591                       
592                return $resList;       
593        }
594       
595        /**
596        * Returns a reference to the underlying model (Mem/DB/InfModel) that contains the statements
597        * 
598        *
599        * @return       object Model
600        * @access       public
601        */     
602        function & getModel()
603        {
604                return  $this->model;
605        }
606       
607       
608        /**
609        * Internal method, that returns a resource URI that is unique for the Model.
610        * URIs are generated using the base_uri of the Model, the prefix and a unique number.
611        * If no prefix is defined, the bNode prefix, defined in constants.php, is used.
612        *
613        * @param        string  $prefix
614        * @return       string
615        * @access       private
616        */
617        function getUniqueResourceURI($bnodePrefix)
618        {
619                return $this->model->getUniqueResourceURI($bnodePrefix);
620        }
621       
622        /**
623        * Load a model from a file containing RDF, N3 or N-Triples.
624        * This function recognizes the suffix of the filename (.n3 or .rdf) and
625        * calls a suitable parser, if no $type is given as string ("rdf" "n3" "nt");
626        * If the model is not empty, the contents of the file is added to this DbModel.
627        *
628        * @param        string  $filename
629        * @param        string  $type
630        * @param   boolean $stream
631        * @access       public
632        */
633        function load($filename, $type = NULL, $stream=false)
634        {
635                $this->model->load($filename, $type, $stream);
636        }
637       
638        /**
639        * Return current baseURI.
640        *
641        * @return  string
642        * @access       public
643        */
644        function getBaseURI() 
645        {
646                return $this->model->getBaseURI();
647        }
648
649        /**
650        * Saves the RDF,N3 or N-Triple serialization of the MemModel to a file.
651        * You can decide to which format the model should be serialized by using a
652        * corresponding suffix-string as $type parameter. If no $type parameter
653        * is placed this method will serialize the model to XML/RDF format.
654        * Returns FALSE if the MemModel couldn't be saved to the file.
655        *
656        * @access       public
657        * @param        string  $filename
658        * @param        string  $type
659        * @throws   PhpError
660        * @return       boolean   
661        */ 
662        function saveAs($filename, $type ='rdf')
663        {
664                return $this->model->saveAs($filename, $type ='rdf');
665        }
666       
667        /**
668        * Writes the RDF serialization of the MemModel as HTML table.
669        *
670        * @access       public
671        */ 
672        function writeAsHTMLTable()
673        {
674                $this->model->writeAsHtmlTable();
675        }
676       
677        /**
678        * Returns a new model containing all the statements which are in both this model and another.
679        *
680        * @param        object Model    $model
681        * @return       object MemModel
682        * @access       public
683        * @throws phpErrpr
684        */
685        function & intersect(& $model)
686        {
687                if (is_a($model,'ResModel'))
688                        return $this->model->intersect($model->getModel());
689                return $this->model->intersect($model);
690        }
691       
692        /**
693        * converts a Resource,Blanknode,Literal into a ResResource, ResProperty, or ResLiteral
694        *
695        * @param        object Node     $node
696        * @param        boolean         $isProperty
697        * @return       object ResResource / ResProperty / ResLiteral
698        * @access       private
699        * @throws phpErrpr
700        */
701        function _node2ResNode($node, $isProperty = false)
702        {
703                if (is_a($node,'Literal'))
704                {
705                        $return= new ResLiteral($node->getLabel(),$node->getLanguage());
706                        $return->setDatatype($node->getDatatype());
707                        $return->setAssociatedModel($this);
708
709                        return $return;
710                }
711                if (is_a($node,'Resource'))
712                {
713                        if ($isProperty)
714                        {
715                                $res= new ResProperty($node->getLabel());
716                        } else
717                        {
718                                $res= new ResResource($node->getLabel());
719                        }
720                        $res->setAssociatedModel($this);
721                        if (is_a($node,'Blanknode'))
722                                $res->setIsAnon(true); 
723               
724                        return $res;
725                }
726        }
727       
728        /**
729        * converts a ResResource, ResProperty, or ResLiteral into a Resource, Blanknode, or Literal
730        *
731        * @param        object ResNode  $resNode
732        * @return       object Node
733        * @access       private
734        * @throws phpErrpr
735        */
736        function _resNode2Node($resNode)
737        {
738                if (is_a($resNode,'ResResource'))
739                {
740                        if ($resNode->getIsAnon())     
741                        {
742                                $return=new BlankNode($resNode->getURI());
743                        } else
744                        {
745                                $return=new Resource($resNode->getURI());       
746                        }       
747                return $return;
748                }
749               
750                if (is_a($resNode,'ResLiteral'))
751                {
752                        $literal=new Literal($resNode->getLabel(),$resNode->getLanguage());
753                        if ($resNode->getDatatype() != null)
754                                $literal->setDatatype($resNode->getDatatype());
755                        return $literal;
756                }
757        }
758       
759        /**
760        * Set a base URI for the MemModel.
761        * Affects creating of new resources and serialization syntax.
762        * If the URI doesn't end with # : or /, then a # is added to the URI.
763        * @param        string  $uri
764        * @access       public
765        */
766        function setBaseURI($uri)
767        {
768                $this->model->setBaseURI($uri);
769        }
770       
771        /**
772        * Writes the RDF serialization of the MemModel as HTML table.
773        *
774        * @access       public
775        * @return       string
776        */ 
777        function writeRdfToString()
778        {
779                return $this->model->writeRdfToString();       
780        }
781       
782        /**
783        * Perform an RDQL query on this MemModel.
784        * This method returns an associative array of variable bindings.
785        * The values of the query variables can either be RAP's objects (instances of Node)
786        * if $returnNodes set to TRUE, or their string serialization.
787        *
788        * @access       public
789        * @param string $queryString
790        * @param boolean $returnNodes
791        * @return  array   [][?VARNAME] = object Node  (if $returnNodes = TRUE)
792        *      OR  array   [][?VARNAME] = string
793        *
794        */
795        function & rdqlQuery($queryString, $returnNodes = TRUE)
796        {
797                $ret = $this->model->rdqlQuery($queryString, $returnNodes);
798                return $ret;
799        }
800       
801        /**
802        * Perform an RDQL query on this MemModel.
803        * This method returns an RdqlResultIterator of variable bindings.
804        * The values of the query variables can either be RAP's objects (instances of Node)
805        * if $returnNodes set to TRUE, or their string serialization.
806        *
807        * @access       public
808        * @param string $queryString
809        * @param boolean $returnNodes
810        * @return  object RdqlResultIterator = with values as object Node  (if $returnNodes = TRUE)
811        *      OR  object RdqlResultIterator = with values as strings if (if $returnNodes = FALSE)
812        *
813        */
814        function rdqlQueryAsIterator($queryString, $returnNodes = TRUE)
815        {
816                return $this->model->rdqlQueryAsIterator($queryString, $returnNodes);
817        }
818       
819       
820        /**
821        * Returns the models namespaces.
822        *
823        * @author   Tobias Gauß <tobias.gauss@web.de>
824        * @access   public
825        * @return   Array
826        */
827        function getParsedNamespaces(){
828                return $this->model->getParsedNamespaces();
829        }
830
831
832
833        /**
834        * Adds the namespaces to the model. This method is called by
835        * the parser. !!!! addParsedNamespaces() not overwrites manual
836        * added namespaces in the model !!!!
837        *
838        * @author   Tobias Gauß <tobias.gauss@web.de>
839        * @access   public
840        * @param    Array $newNs
841        */
842        function addParsedNamespaces($newNs){
843                $this->model->addParsedNamespaces($newNs);
844        }
845
846
847        /**
848        * Adds a namespace and prefix to the model.
849        *
850        * @author   Tobias Gauß <tobias.gauss@web.de>
851        * @access   public
852        * @param    String $prefix, String $nmsp
853        */
854        function addNamespace($prefix, $namespace){
855                $this->model->addNamespace($prefix, $namespace);
856        }
857       
858        /**
859        * removes a single namespace from the model
860        *
861        * @author   Tobias Gauß <tobias.gauss@web.de>
862        * @access   public
863        * @param    String $nmsp
864        */
865        function removeNamespace($nmsp){
866                return $this->model->removeNamespace($nmsp);
867        }
868
869       
870       
871       
872       
873       
874}
875
876?>
Note: See TracBrowser for help on using the repository browser.