コード例 #1
0
 public static function getInstance()
 {
     if (is_null(self::$instance)) {
         self::$instance = new self();
     }
     return self::$instance;
 }
コード例 #2
0
ファイル: SMW_WebService.php プロジェクト: seedbank/old-repo
 private function evaluateAdditionalPathAttribute($rdef, $alias, $value)
 {
     $xpath = $this->getXPathForAlias($alias, $rdef);
     $json = $this->getJSONForAlias($alias, $rdef);
     $property = $this->getPropertyForAlias($alias, $rdef);
     if ($xpath != null) {
         $newValue = array();
         foreach ($value as $v) {
             $xpathProcessor = new XPathProcessor($v);
             $newValue = array_merge($newValue, $xpathProcessor->evaluateQuery($xpath));
         }
         $value = $newValue;
     } else {
         if ($json != null) {
             $newValue = array();
             foreach ($value as $v) {
                 $jsonProcessor = new JSONProcessor();
                 $xmlString = $jsonProcessor->convertJSON2XML($v);
                 $xpathProcessor = new XPathProcessor($xmlString);
                 $newValue = array_merge($newValue, $xpathProcessor->evaluateQuery($json));
             }
             $value = $newValue;
         } else {
             if ($property != null) {
                 $value = SMWRDFProcessor::getInstance()->preprocessProperty($property);
             }
         }
     }
     return $value;
 }