Exemplo n.º 1
0
 /**
  * @param Erfurt_Sparql_Query2_VarOrTerm $s
  * @param Erfurt_Sparql_Query2_Verb $p
  * @param Erfurt_Sparql_Query2_IF_ObjectList $o
  */
 public function __construct(Erfurt_Sparql_Query2_VarOrTerm $s, Erfurt_Sparql_Query2_Verb $p, Erfurt_Sparql_Query2_IF_ObjectList $o)
 {
     $this->s = $s;
     $this->p = $p;
     $this->o = $o;
     parent::__construct();
 }
Exemplo n.º 2
0
 /**
  * @param Erfurt_Sparql_Query2_VarOrTerm $subject
  * @param array $propList array of (Erfurt_Sparql_Query2_Verb, Erfurt_Sparql_Query2_IF_ObjectList)-pairs
  */
 public function __construct($subject, Erfurt_Sparql_Query2_PropertyList $propList)
 {
     if (!$subject instanceof Erfurt_Sparql_Query2_VarOrTerm && !$subject instanceof Erfurt_Sparql_Query2_TriplesNode) {
         throw new RuntimeException('Argument 1 passed to Erfurt_Sparql_Query2_TriplesSameSubject::__construct must be instance of Erfurt_Sparql_Query2_VarOrTerm or Erfurt_Sparql_Query2_TriplesNode', E_USER_ERROR);
     }
     $this->subject = $subject;
     $this->propertyList = $propList;
     parent::__construct();
 }
Exemplo n.º 3
0
 /**
  * @param Erfurt_Sparql_Query2_Constraint $element
  */
 public function __construct($element)
 {
     if (!($element instanceof Erfurt_Sparql_Query2_Constraint || is_bool($element))) {
         throw new Exception('Argument 1 passed to Erfurt_Sparql_Query2_Filter::__construct must be Instance of Erfurt_Sparql_Query2_Constraint', 1);
     }
     if (is_bool($element)) {
         $element = new Erfurt_Sparql_Query2_BooleanLiteral($element);
     }
     $this->element = $element;
     parent::__construct();
 }
Exemplo n.º 4
0
 /**
  * @param string $nname
  */
 public function __construct($nname)
 {
     if (is_string($nname) && $nname != '') {
         $this->name = preg_replace('/[^\\w]/', '', $nname);
     } else {
         if ($nname instanceof Erfurt_Sparql_Query2_IriRef) {
             $this->name = self::extractName($nname->getIri());
         } else {
             throw new RuntimeException('Argument 1 passed to Erfurt_Sparql_Query2_Var : string (not empty) or Erfurt_Sparql_Query2_IriRef expected. ' . typeHelper($nname) . ' found.');
         }
     }
     parent::__construct();
 }
Exemplo n.º 5
0
 /**
  * @param Erfurt_Sparql_Query2_IriRef $iri
  */
 public function __construct($iri, $named = false)
 {
     if (is_string($iri)) {
         $iri = new Erfurt_Sparql_Query2_IriRef($iri);
     }
     if (!$iri instanceof Erfurt_Sparql_Query2_IriRef) {
         throw new RuntimeException("Argument 1 passed to Erfurt_Sparql_Query2_GraphClause::__construct must be instance of Erfurt_Sparql_Query2_IriRef or string", E_USER_ERROR);
     }
     $this->graphIri = $iri;
     if (is_bool($named)) {
         $this->named = $named;
     }
     parent::__construct();
 }
Exemplo n.º 6
0
 /**
  * @param string $nresource
  * @param Erfurt_Sparql_Query2_Prefix $prefix
  * @param string $unexpandablePrefix
  */
 public function __construct($nresource, Erfurt_Sparql_Query2_Prefix $prefix = null, $unexpandablePrefix = null)
 {
     if (!is_string($nresource)) {
         throw new RuntimeException('wrong argument 1 passed to Erfurt_Sparql_Query2_IriRef::__construct. string expected. ' . typeHelper($nresource) . ' found.');
     }
     $this->iri = $nresource;
     if ($prefix != null) {
         $this->prefix = $prefix;
     }
     if ($unexpandablePrefix !== null && is_string($unexpandablePrefix)) {
         $this->unexpandablePrefix = $unexpandablePrefix;
     }
     parent::__construct();
 }
Exemplo n.º 7
0
 /**
  * @param string $nname
  * @param Erfurt_Sparql_Query2_IriRef $iri
  */
 public function __construct($nname, $iri)
 {
     if (!is_string($nname)) {
         throw new RuntimeException('Argument 1 passed to Erfurt_Sparql_Query2_Prefix::__construct must be an instance of string, instance of ' . typeHelper($iri) . ' given');
     }
     $this->name = $nname;
     if (is_string($iri)) {
         $iri = new Erfurt_Sparql_Query2_IriRef($iri);
     }
     if (!$iri instanceof Erfurt_Sparql_Query2_IriRef) {
         throw new RuntimeException("Argument 2 passed to Erfurt_Sparql_Query2_Prefix::__construct must be instance of Erfurt_Sparql_Query2_IriRef or string", E_USER_ERROR);
     }
     $this->iri = $iri;
     parent::__construct();
 }
Exemplo n.º 8
0
 /**
  *
  * @param Erfurt_Sparql_Query2_Expression $element1
  * @param Erfurt_Sparql_Query2_Expression $element2
  * @param <type> $element3
  */
 public function __construct(Erfurt_Sparql_Query2_Expression $element1, Erfurt_Sparql_Query2_Expression $element2, $element3 = null)
 {
     $this->element1 = $element1;
     $this->element2 = $element2;
     if ($element3 != null) {
         if ($element3 instanceof Erfurt_Sparql_Query2_Expression) {
             $this->element3 = $element3;
         } else {
             throw new RuntimeException('Argument 3 passed to Erfurt_Sparql_Query2_Regex::__construct must be an instance of Erfurt_Sparql_Query2_Expression or null, instance of ' . typeHelper($element3) . ' given');
         }
     }
     parent::__construct();
 }
Exemplo n.º 9
0
 /**
  * removeElement
  * @param Erfurt_Sparql_Query2_ElementHelper $toDelete
  * @param boolean $equal
  * @return Erfurt_Sparql_Query2_ContainerHelper $this
  */
 public function removeElement($toDelete, $equal = false)
 {
     $new = array();
     foreach ($this->elements as $element) {
         $inExp = false;
         if (!$element instanceof Erfurt_Sparql_Query2_ElementHelper) {
             if (isset($element['exp']) && $element['exp'] instanceof Erfurt_Sparql_Query2_ElementHelper) {
                 //this is used in Erfurt_Sparql_Query2_AdditiveExpression
                 $inExp = true;
             } else {
                 throw new RuntimeException("Element of a Erfurt_Sparql_Query2_ContainerHelper must be of type Erfurt_Sparql_Query2_ElementHelper", E_USER_ERROR);
             }
         }
         if ($toDelete->getID() == ($inExp ? $element["exp"]->getID() : $element->getID()) || $equal && $toDelete->equals($inExp ? $element["exp"] : $element)) {
             //matched - dont keep
         } else {
             //not matched - keep
             $new[] = $element;
             //recursive
             if (($inExp ? $element["exp"] : $element) instanceof Erfurt_Sparql_Query2_ContainerHelper) {
                 if ($inExp) {
                     $element["exp"]->removeElement($toDelete, $equal);
                 } else {
                     $element->removeElement($toDelete, $equal);
                 }
             }
         }
     }
     //$toDelete->removeParent($this);
     $this->elements = $new;
     return $this;
     //for chaining
 }