diff --git a/library/Erfurt/Ac/Default.php b/library/Erfurt/Ac/Default.php index 2ba550e8..06c432b4 100644 --- a/library/Erfurt/Ac/Default.php +++ b/library/Erfurt/Ac/Default.php @@ -373,24 +373,6 @@ public function isActionAllowed($action, $isFullUri = false) // Every Action allowed return true; } else { - // create action instance - // array for new statements (an action instance pus label) - /* - $actionStmt = array( - $actionUri => array ( - EF_RDF_TYPE => array ( - array ( 'type' => 'uri' , 'value' => $this->_uris['actionClassUri'] ) - ) , - EF_RDFS_LABEL => array ( - array ( 'type' => 'literal' , 'value' => $action ) - ) - ) - ); - - $store = Erfurt_App::getInstance()->getStore(); - $store->addMultipleStatements($this->_uris['acModelUri'], $actionStmt, false); - */ - return false; } } diff --git a/library/Erfurt/App.php b/library/Erfurt/App.php index 8c419b7f..b1f2943a 100644 --- a/library/Erfurt/App.php +++ b/library/Erfurt/App.php @@ -1160,13 +1160,6 @@ private function _getQueryCacheBackend() case 'database': $this->_queryCacheBackend = new Erfurt_Cache_Backend_QueryCache_Database(); break; -# case 'file': -# $this->_queryCacheBackend = new Erfurt_Cache_Backend_QueryCache_File(); -# break; -# -# case 'memory': -# $this->_queryCacheBackend = new Erfurt_Cache_Backend_QueryCache_Memory(); -# break; default: throw new Erfurt_Exception('Cache type is not supported.'); } diff --git a/library/Erfurt/Auth/Adapter/FoafSsl.php b/library/Erfurt/Auth/Adapter/FoafSsl.php index c3ec43a6..0d43d01b 100644 --- a/library/Erfurt/Auth/Adapter/FoafSsl.php +++ b/library/Erfurt/Auth/Adapter/FoafSsl.php @@ -634,7 +634,6 @@ public function verifyIdpResult($get) if ((null === $this->_publicKey) || !extension_loaded('openssl')) { return false; } - //$this->_publicKey = str_replace(str_split(" \t\n\r\0\x0B"), '', $this->_publicKey); $schema = (isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'])) ? 'https://' : 'http://'; $url = $schema . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; diff --git a/library/Erfurt/Auth/Adapter/OpenId.php b/library/Erfurt/Auth/Adapter/OpenId.php index 2330fdf7..098e6b7f 100644 --- a/library/Erfurt/Auth/Adapter/OpenId.php +++ b/library/Erfurt/Auth/Adapter/OpenId.php @@ -206,14 +206,6 @@ public function authenticate() if (!isset($this->_get['openid_identity'])) { $result = false; $msg = 'OpenID authentication failed.'; - - /* - $identity = array( - 'uri' => null, - 'dbuser' => false, - 'anonymous' => false - ); - */ return new Zend_Auth_Result($result, null, array($msg)); } diff --git a/library/Erfurt/Auth/Adapter/Rdf.php b/library/Erfurt/Auth/Adapter/Rdf.php index d86784d2..cd0116a9 100644 --- a/library/Erfurt/Auth/Adapter/Rdf.php +++ b/library/Erfurt/Auth/Adapter/Rdf.php @@ -88,19 +88,7 @@ public function authenticate() 'anonymous' => false ); - // have a look at the cache... - /*$cache = Erfurt_App::getInstance()->getCache(); - $id = $cache->makeId($this, '_fetchDataForUser', array($this->_username)); - OntoWiki::getInstance()->appendMessage( new OntoWiki_Message($id)); - $cachedVal = $cache->load($id); - if ($cachedVal) { - OntoWiki::getInstance()->appendMessage( new OntoWiki_Message("cached")); - $this->_users[$this->_username] = $cachedVal; - } else { - */$this->_users[$this->_username] = $this->_fetchDataForUser($this->_username); - /*$cache->save($this->_users[$this->_username], $id, array('_fetchDataForUser')); - OntoWiki::getInstance()->appendMessage( new OntoWiki_Message("uncached")); - }*/ + $this->_users[$this->_username] = $this->_fetchDataForUser($this->_username); // if login is denied return failure auth result if ($this->_users[$this->_username]['denyLogin'] === true) { diff --git a/library/Erfurt/Cache/Backend/Database.php b/library/Erfurt/Cache/Backend/Database.php index f3b35ce9..77199cf8 100644 --- a/library/Erfurt/Cache/Backend/Database.php +++ b/library/Erfurt/Cache/Backend/Database.php @@ -80,7 +80,6 @@ public function load($id, $doNotTestCacheValidity = false) { if ($result !== false) { if (isset($result[0])) { $content = $result[0]['content']; - #$content = base64_decode($content); return $content; } } @@ -123,7 +122,6 @@ public function save($data, $id, $tags = array(), $specificLifetime = false) { } $lifetime = $this->getLifetime($specificLifetime); - #$data = $this->_getConnection()->real_escape_string($data); $data = addslashes($data); $mktime = time(); if (is_null($lifetime)) { @@ -177,12 +175,6 @@ public function test($id) { * This method will build the database structure. */ private function _buildStructure() { -# $this->_query('DROP INDEX ef_cache_tag_id_index'); -# $this->_query('DROP INDEX ef_cache_tag_name_index'); -# $this->_query('DROP INDEX ef_cache_id_expire_index'); -# $this->_query('DROP TABLE ef_cache_version'); -# $this->_query('DROP TABLE ef_cache'); -# $this->_query('DROP TABLE ef_cache_tag'); $this->_query(' CREATE TABLE ef_cache_version ( num INT, diff --git a/library/Erfurt/Ping.php b/library/Erfurt/Ping.php index 3457feb5..c3b1d127 100644 --- a/library/Erfurt/Ping.php +++ b/library/Erfurt/Ping.php @@ -380,19 +380,14 @@ private function _getResourceFromWrapper ($sourceUri, $targetUri, $wrapperName = $wrapperResult = $wrapper->run($r, null, true); $newStatements = null; - if ($wrapperResult === false) { - // IMPORT_WRAPPER_NOT_AVAILABLE; - } else if (is_array($wrapperResult)) { + if (is_array($wrapperResult)) { $newStatements = $wrapperResult['add']; // TODO make sure to only import the specified resource $newModel = new Erfurt_Rdf_MemoryModel($newStatements); $newStatements = array(); $object = array('type' => 'uri', 'value' => $targetUri); $newStatements = $newModel->getP($sourceUri, $object); - } else { - // IMPORT_WRAPPER_ERR; } - return $newStatements; } diff --git a/library/Erfurt/Plugin/Manager.php b/library/Erfurt/Plugin/Manager.php index 6b92d3d4..9b46a341 100644 --- a/library/Erfurt/Plugin/Manager.php +++ b/library/Erfurt/Plugin/Manager.php @@ -138,41 +138,6 @@ private function _addPlugin($pluginName, $pluginPath) } public function addPluginExternally($pluginName, $fileName, $pluginPath, $pluginConfig){ -// for use of array based config -// if($pluginConfig instanceof Zend_Config){ -// $pluginConfig = $pluginConfig->toArray(); -// } - -// $pluginConfig['pluginPath'] = $pluginPath; -// if(!isset($pluginConfig['enabled'])){ -// $pluginConfig['enabled'] = false; -// } -// $enabled = $pluginConfig['enabled']; -// -// // keep track of loaded plug-ins -// if (!array_key_exists($pluginName, $this->_plugins)) { -// $this->_plugins[$pluginName] = $pluginConfig; -// } -// -// if ($enabled && isset($pluginConfig['events']) && is_array($pluginConfig['events'])) { -// foreach ($pluginConfig['events'] as $event) { -// if (is_array($event)) { -// // TODO: allow trigger method that differs from event name -// } else if (is_string($event)) { -// $pluginSpec = array( -// 'class_name' => ucfirst($pluginName) . self::PLUGIN_CLASS_POSTFIX, -// 'file_name' => $fileName, -// 'include_path' => $pluginPath, -// 'config' => isset($pluginPrivateConfig) ? $pluginPrivateConfig : null -// ); -// -// $priority = isset($event['priority']) ? (int) $event['priority'] : 10; -// -// // register plugin events with event dispatcher -// $this->_eventDispatcher->register($event, $pluginSpec, $priority); -// } -// } -// } $pluginConfig->pluginPath = $pluginPath; if(!isset($pluginConfig->enabled)){ $pluginConfig->enabled = false; diff --git a/library/Erfurt/Rdf/Model.php b/library/Erfurt/Rdf/Model.php index 65d03a0f..ba6f5c29 100644 --- a/library/Erfurt/Rdf/Model.php +++ b/library/Erfurt/Rdf/Model.php @@ -655,14 +655,6 @@ public function sparqlQuery($query, $options = array()) return $this->getStore()->sparqlQuery($query, $options); } - /*public function sparqlQueryWithPlainResult($query) - { - $queryObject = Erfurt_Sparql_SimpleQuery::initWithString($query); - $queryObject->addFrom($this->_graphUri); - - return $this->getStore()->sparqlQuery($queryObject); - }*/ - /** * set the model store * diff --git a/library/Erfurt/Rdf/Resource.php b/library/Erfurt/Rdf/Resource.php index 2cb37bcd..ae9a70f3 100644 --- a/library/Erfurt/Rdf/Resource.php +++ b/library/Erfurt/Rdf/Resource.php @@ -262,8 +262,6 @@ protected function _fetchDescription($maxDepth) $this->_descriptionResource($property); $currentValue = array( - // typed-literal --> literal - // 'type' => str_replace('typed-', '', $row['o']['type']), 'type' => $row['o']['type'], 'value' => $row['o']['value'] ); diff --git a/library/Erfurt/Sparql/EngineDb/Adapter/EfZendDb.php b/library/Erfurt/Sparql/EngineDb/Adapter/EfZendDb.php index 0d31776c..9b6d545a 100644 --- a/library/Erfurt/Sparql/EngineDb/Adapter/EfZendDb.php +++ b/library/Erfurt/Sparql/EngineDb/Adapter/EfZendDb.php @@ -122,97 +122,6 @@ public function getTypeSorter() return $this->ts; } - /** - * Create a prepared statement that can be executed later. - * - * @param Dataset $dataset RDF Dataset - * @param Query $query Parsed SPARQL query - * - * @return SparqlEngineDb_PreparedStatement Prepared statment that can - * be execute()d later. - */ - /*public function prepare(Dataset $dataset, Query $query) - { - //require_once RDFAPI_INCLUDE_DIR . 'sparql/SparqlEngineDb/PreparedStatement.php'; - //require_once RDFAPI_INCLUDE_DIR . 'sparql/SparqlEngineDb/Preparator.php'; - - $this->query = $query; - $this->dataset = $dataset; - $this->sg = new SparqlEngineDb_SqlGenerator ($this->query, $this->dbConn, $this->arModelIds); - $this->rc = new SparqlEngineDb_ResultConverter($this->query, $this->sg, $this); - $this->ts = new SparqlEngineDb_TypeSorter ($this->query, $this->dbConn); - $this->pr = new SparqlEngineDb_Preparator ($this->query, $this->dbConn); - - $this->arPrepared = $this->sg->createSql(); - $this->ts->setData($this->sg); - - if ($this->ts->willBeDataDependent()) { - $this->bRealPrepared = false; - } else { - $this->bRealPrepared = true; - list($strSelect, $strFrom, $strWhere) = $this->arPrepared; - $this->arPreparedQueries = $this->ts->getOrderifiedSqls( - $strSelect, - $strFrom, - $strWhere - ); - $this->arDbStatements = $this->pr->prepareInDb( - $this->arPreparedQueries, - $this->sg->getPlaceholders() - ); - } - - - return new SparqlEngineDb_PreparedStatement( - $this - ); - }*/ - - /** - * Execute a prepared statement by filling it with variables - * - * @param array $arVariables Array with (variable name => value) pairs - * @param string $resultform Which form the result should have - * - * @return mixed Result according to $resultform - */ - /*public function execute($arVariables, $resultform = false) - { - if ($this->arPrepared === null) { - throw new Exception('You need to prepare() the query first.'); - } - - if ($this->bRealPrepared) { - return - SparqlEngineDb_ResultConverter::convertFromDbResults( - $this->pr->execute( - $this->arDbStatements, - $arVariables - ), - $this, - $resultform - ); - } else { - list($strSelect, $strFrom, $strWhere) = $this->arPrepared; - - return SparqlEngineDb_ResultConverter::convertFromDbResults( - $this->_queryMultiple( - $this->ts->getOrderifiedSqls( - $strSelect, - $strFrom, - $this->pr->replacePlaceholdersWithVariables( - $strWhere, - $this->sg->getPlaceholders(), - $arVariables - ) - ) - ), - $this, - $resultform - ); - } - }*/ - /** * Query the database with the given SPARQL query. * @@ -243,9 +152,6 @@ public function queryModel(Erfurt_Sparql_Query $query, $resultform = 'plain') case 'xml': $rc = new Erfurt_Sparql_EngineDb_ResultRenderer_Xml(); break; - //throw new Erfurt_Exception('XML result format not supported yet.'); - //$this->rc = new Erfurt_Sparql_EngineDb_ResultRenderer_RapZendDb_Xml(); - //break; case 'extended': $rc = new Erfurt_Sparql_EngineDb_ResultRenderer_Extended(); break; @@ -268,10 +174,7 @@ public function queryModel(Erfurt_Sparql_Query $query, $resultform = 'plain') $this->ts = new Erfurt_Sparql_EngineDb_TypeSorter($this->query, $this); - $this->_setOptions(); - $arSqls = $this->sg->createSql(); - #var_dump($arSqls);exit; $this->ts->setData($this->sg); @@ -298,8 +201,6 @@ public function sqlQuery($sql) protected function _queryDb($arSql, $nOffset, $nLimit) { $strSql = Erfurt_Sparql_EngineDb_SqlMerger::getSelect($this->query, $arSql); -#var_dump($nLimit, $nOffset); -#echo $strSql; if ($strSql === '()') { return array(); } @@ -361,16 +262,4 @@ protected function _queryMultiple($arSqls) return $arResults; } - /** - * Set options to subobjects like SqlGenerator - */ - protected function _setOptions() - { - // allow changing the statements' table name - //if (isset($GLOBALS['RAP']['conf']['database']['tblStatements'])) { - // $this->sg->setStatementsTable( - // $GLOBALS['RAP']['conf']['database']['tblStatements'] - // ); - //} - } } diff --git a/library/Erfurt/Sparql/EngineDb/FilterGenerator.php b/library/Erfurt/Sparql/EngineDb/FilterGenerator.php index 1f8ebf49..4c5be502 100644 --- a/library/Erfurt/Sparql/EngineDb/FilterGenerator.php +++ b/library/Erfurt/Sparql/EngineDb/FilterGenerator.php @@ -98,7 +98,6 @@ public function createFilterSql($tree, $bOptional, $nUnionCount) $this->bOptional = $bOptional; $this->nUnionCount = $nUnionCount; -#return ' AND ' . $this->createTreeSql($tree, null); try { return ' AND ' . $this->createTreeSql($tree, null); } catch (Exception $e) { @@ -610,7 +609,6 @@ protected function createFunction_regex($tree) break; default: - //var_dump($strMod);exit; throw new Erfurt_Sparql_EngineDb_SqlGeneratorException( 'Unsupported regex modifier "' . $strMod diff --git a/library/Erfurt/Sparql/EngineDb/QueryOptimizer.php b/library/Erfurt/Sparql/EngineDb/QueryOptimizer.php index 3d6f84f8..8be38350 100644 --- a/library/Erfurt/Sparql/EngineDb/QueryOptimizer.php +++ b/library/Erfurt/Sparql/EngineDb/QueryOptimizer.php @@ -30,8 +30,6 @@ public function optimize(Erfurt_Sparql_Query $query) $result = $query; // TODO Not working on all queries yet. -#return $result; - if ($resultForm === 'select distinct') { $result = $this->_optimizeDistinct($query); } @@ -123,26 +121,13 @@ protected function _optimizeDistinct($query) $orderifiedSqls = $ts->getOrderifiedSqls($arSqls); $originalVars = $sg->arVarAssignments; -#var_dump($originalVars); - - - - - $usedVars = array_unique($usedVars); $newResultVars = array(); $tempQuery = clone $query; // We need to adjust the limit, offset values. -// TODO limit offset support - #$sm = $tempQuery->getSolutionModifier(); - #if (isset($sm['limit'])) { - # $tempQuery->setSolutionModifier('limit', 1000); - #} - #if (isset($sm['offset'])) { - # $tempQuery->setSolutionModifier('offset', 0); - #} + // TODO limit offset support foreach ($tempQuery->getResultVars() as $var) { if (in_array($var->getVariable(), $usedVars)) { @@ -163,7 +148,6 @@ protected function _optimizeDistinct($query) $orderifiedSqls = $ts->getOrderifiedSqls($arSqls); $mandatoryResult = $this->_queryMultiple($tempQuery, $orderifiedSqls); $mandatoryVars = $sg->arVarAssignments; -#var_dump($mandatoryResult);exit; // If the mandatory result is empty... return it. $empty = true; @@ -205,82 +189,6 @@ protected function _optimizeDistinct($query) } reset($mandatoryResult); -#var_dump($replaceArray);exit; - // Remove all old mandatory constraints from the query (already done with the first query). - // Replace them with a new sameTerm constraint - #$cArray = array(); - - #$distinctKeys = array(); -// TODO Function nesting fatal error on big result :( - /*foreach ($replaceArray as $var => $values) { - $distinctKeys[] = $var; - $c = new Erfurt_Sparql_Constraint(); - - $valueSameTermArray = array(); - foreach ($values as $key => $true) { - $valueSameTermArray[] = 'sameTerm(' . $var . ', <' . $key . '>)'; - } - - $expr = '(' . implode(' || ', $valueSameTermArray) . ')'; - $c->addExpression($expr); - $c->parse(); - $cArray[] = $c; - }*/ -#var_dump($cArray);exit; - - /*$ids = array(); - foreach ($optionals as $graphPattern) { - $newCArray = array(); - foreach ($cArray as $c) { - $add = false; - $usedVars = $c->getUsedVars(); - foreach ($graphPattern->getVariables() as $v) { - if (in_array($v, $usedVars)) { - $add = true; - break; - } - } - - if ($add) { - $newCArray[] = $c; - } - } - - #$graphPattern->setConstraints($newCArray); - foreach ($oldMandatory as $gp) { - if ($graphPattern->getOptional() === $gp->getId() && !empty($newCArray)) { - $gp->setTriplePatterns(array()); - $gp->setConstraints($newCArray); - } - - - } - - $ids[$graphPattern->getOptional()] = true; - } - - foreach ($oldMandatory as $key => $pattern) { - if (!isset($ids[$pattern->getId()])) { - $unsetIds[$pattern->getId()] = true; - unset($oldMandatory[$key]); - } - } - foreach ($oldMandatory as $pattern) { - if (isset($unsetIds[$pattern->getUnion()])) { - $pattern->setUnion(null); - } - } - */ - - - - #$pattern = new Erfurt_Sparql_GraphPattern(); - #$pattern->setId(1000); - #$pattern->setOptional(0); - #$pattern->addTriplePattern(new Erfurt_Sparql_QueryTriple('?predicate', Erfurt_Rdf_Resource::initWithUri('dummy'), Erfurt_Rdf_Resource::initWithUri('dummy'))); - - # $optionals[] = $pattern; - foreach ($oldMandatory as $gp) { $gp->setTriplePatterns(array()); $gp->setConstraints(array()); @@ -288,7 +196,6 @@ protected function _optimizeDistinct($query) // Set new result form to select (not distinct) - #$newPatterns = $optionals; $newPatterns = array_merge($oldMandatory, $optionals); $usedVars = array(); foreach ($newPatterns as $pattern) { @@ -305,7 +212,6 @@ protected function _optimizeDistinct($query) $query->setResultVars($usedVarsObjects); $query->setResultPart($newPatterns); $query->setResultForm('select'); -#var_dump($query);exit; $sg = new Erfurt_Sparql_EngineDb_SqlGenerator_Adapter_Ef($query, $this->_engine->getModelIdMapping()); $ts = new Erfurt_Sparql_EngineDb_TypeSorter($query, $this->_engine); @@ -316,9 +222,6 @@ protected function _optimizeDistinct($query) $orderifiedSqls = $ts->getOrderifiedSqls($arSqls); $optionalVars = $sg->arVarAssignments; -#var_dump($optionalVars); -#var_dump($replaceArray);exit; - $whereAddition = array(); foreach ($optionalVars as $var => $varSpec) { foreach ($replaceArray as $key => $values) { @@ -335,15 +238,9 @@ protected function _optimizeDistinct($query) if(!empty($whereAddition)) $sql['where'] .= ' AND ' . implode(' AND ', $whereAddition); } } -#var_dump($orderifiedSqls);exit; $optionalResult = $this->_queryMultiple($query, $orderifiedSqls); - -#var_dump($optionalResult);exit; - -#var_dump($originalVars, $optionalVars, $optionalResult);exit; - $newOptResult = array(); // Remove double entries $alreadyIn = array(); @@ -358,12 +255,9 @@ protected function _optimizeDistinct($query) } } $optionalResult = array($newOptResult); -#var_dump($optionalVars);exit; - - + $newResult = array(); - -#var_dump($mandatoryResult);exit; + $mResult = current($mandatoryResult); while (true) { $rowSpec = array(); @@ -549,8 +443,6 @@ protected function _optimizeDistinct($query) } } -#var_dump($newResult);exit; - $retVal = array($newResult); return array('data' => $retVal, 'vars' => $originalVars); } @@ -558,7 +450,6 @@ protected function _optimizeDistinct($query) protected function _queryDb($query, $arSql, $nOffset, $nLimit) { $strSql = Erfurt_Sparql_EngineDb_SqlMerger::getSelect($query, $arSql); -#echo $strSql; if ($strSql === '()') { return array(); } @@ -570,7 +461,6 @@ protected function _queryDb($query, $arSql, $nOffset, $nLimit) } else { $ret = $this->_engine->sqlQuery($strSql . ' LIMIT ' . $nOffset . ', ' . $nLimit); } -#var_dump($ret->fetchAll());exit; return $ret; } @@ -593,7 +483,6 @@ protected function _queryMultiple($query, $arSqls) list($nSql, $nOffset) = $offsetter->determineOffset($arSqls); $nLimit = $arSM['limit']; } -#var_dump($arSqls, $offsetter->determineOffset($arSqls)); $nCount = 0; $arResults = array(); foreach ($arSqls as $nId => $arSql) { @@ -608,7 +497,6 @@ protected function _queryMultiple($query, $arSqls) } $dbResult = $this->_queryDb($query, $arSql, $nOffset, $nCurrentLimit); -#var_dump($dbResult); $nCount += count($dbResult); $arResults[] = $dbResult; $nOffset = 0; diff --git a/library/Erfurt/Sparql/EngineDb/QuerySimplifier.php b/library/Erfurt/Sparql/EngineDb/QuerySimplifier.php index 3cb475a4..8ab2459e 100644 --- a/library/Erfurt/Sparql/EngineDb/QuerySimplifier.php +++ b/library/Erfurt/Sparql/EngineDb/QuerySimplifier.php @@ -37,7 +37,7 @@ class Erfurt_Sparql_EngineDb_QuerySimplifier * Modifies the passed query object directly. */ public function simplify(Erfurt_Sparql_Query $query) { -#return; + $arPatterns = $query->getResultPart(); self::dropEmpty($arPatterns); @@ -91,7 +91,6 @@ protected function executePlan(&$arPatterns, &$arPlan) $id = count($arPatterns)+1; foreach ($arPlan as $nParent => $arChildren) { $base = $arPatterns[$nParent]; - #$grandParent = $base->getSubpatternOf(); $nNextId = $nParent; $oldConstraints = $base->getConstraints(); @@ -99,10 +98,7 @@ protected function executePlan(&$arPatterns, &$arPlan) $optionalIds = $this->_getOptionalIds($arPatterns, $nParent); foreach ($arChildren as $nChild => $null) { - #$new = clone $base; - #$new->addTriplePatterns($arPatterns[$nChild]->getTriplePatterns()); - #$new->addConstraints($arPatterns[$nChild]->getConstraints()); - + $arPatterns[$nChild]->addTriplePatterns($base->getTriplePatterns()); // Catch all used vars from child pattern. diff --git a/library/Erfurt/Sparql/EngineDb/ResultRenderer/Extended.php b/library/Erfurt/Sparql/EngineDb/ResultRenderer/Extended.php index b2ea6c7b..9bba2273 100644 --- a/library/Erfurt/Sparql/EngineDb/ResultRenderer/Extended.php +++ b/library/Erfurt/Sparql/EngineDb/ResultRenderer/Extended.php @@ -156,8 +156,6 @@ protected function _createObjectFromDbRecordSetPart($row, $strVarBase, $strVar, break; default: if ($row[$this->_vars[$strVarName]['sql_ref']] === null) { - #$result = $this->_createLiteral( - # $row[$this->_vars[$strVarName]['sql_value']], null, null); if ($row[$this->_vars[$strVarName]['sql_dt_ref']] === null) { $result = $this->_createLiteral( @@ -173,8 +171,6 @@ protected function _createObjectFromDbRecordSetPart($row, $strVarBase, $strVar, ); } } else { - #$result = $this->_createLiteral( - #$this->literalValues[$row[$this->_vars[$strVarName]['sql_ref']]], null, null); if ($row[$this->_vars[$strVarName]['sql_dt_ref']] === null) { $result = $this->_createLiteral( diff --git a/library/Erfurt/Sparql/EngineDb/ResultRenderer/Plain.php b/library/Erfurt/Sparql/EngineDb/ResultRenderer/Plain.php index 84ccace7..f3dfb7bc 100644 --- a/library/Erfurt/Sparql/EngineDb/ResultRenderer/Plain.php +++ b/library/Erfurt/Sparql/EngineDb/ResultRenderer/Plain.php @@ -258,37 +258,11 @@ protected function _createObjectFromDbRecordSetPart($row, $strVarBase, $strVar, if ($row[$this->_vars[$strVarName]['sql_ref']] === null) { $result = $this->_createLiteral( $row[$this->_vars[$strVarName]['sql_value']], null, null); - - #if ($row[$this->_vars[$strVarName]['sql_dt_ref']] === null) { - # $result = $this->_createLiteral( - # $row[$this->_vars[$strVarName]['sql_value']], - # $row[$this->_vars[$strVarName]['sql_lang']], - # $row[$this->_vars[$strVarName]['sql_type']] - # ); - #} else { - # $result = $this->_createLiteral( - # $row[$this->_vars[$strVarName]['sql_value']], - # $row[$this->_vars[$strVarName]['sql_lang']], - # $this->uriValues[$row[$this->_vars[$strVarName]['sql_dt_ref']]] - # ); - #} + } else { $result = $this->_createLiteral( $this->literalValues[$row[$this->_vars[$strVarName]['sql_ref']]], null, null); - - #if ($row[$this->_vars[$strVarName]['sql_dt_ref']] === null) { - # $result = $this->_createLiteral( - # $this->literalValues[$row[$this->_vars[$strVarName]['sql_ref']]], - # $row[$this->_vars[$strVarName]['sql_lang']], - # $row[$this->_vars[$strVarName]['sql_type']] - # ); - #} else { - # $result = $this->_createLiteral( - # $this->literalValues[$row[$this->_vars[$strVarName]['sql_ref']]], - # $row[$this->_vars[$strVarName]['sql_lang']], - # $this->uriValues[$row[$this->_vars[$strVarName]['sql_dt_ref']]] - # ); - #} + } } diff --git a/library/Erfurt/Sparql/EngineDb/SqlGenerator/Adapter/Ef.php b/library/Erfurt/Sparql/EngineDb/SqlGenerator/Adapter/Ef.php index c1a53658..c251e9e6 100644 --- a/library/Erfurt/Sparql/EngineDb/SqlGenerator/Adapter/Ef.php +++ b/library/Erfurt/Sparql/EngineDb/SqlGenerator/Adapter/Ef.php @@ -207,10 +207,6 @@ public function createSql() foreach ($this->query->getResultPart() as $graphPattern) { - #if ($graphPattern->isEmpty()) { - # continue; - #} - if ($graphPattern->getUnion() !== null) { ++$this->nUnionCount; $this->nTableId = 0; @@ -395,14 +391,10 @@ function getTripleSql(Erfurt_Sparql_QueryTriple $triple, Erfurt_Sparql_GraphPatt $bWhereEqualitySubject = true; $this->arUsedVarTypes[$subject]['s'] = true; } else { - #if (isset($this->arVarAssignments[$subject][0])) { - # $strTablePrefix = $this->arVarAssignments[$subject][0]; - #} if (!isset($this->arVarAssignments[$subject])) { $this->arVarAssignments[$subject] = array($strTablePrefix, 's'); } - #$this->arVarAssignments[$subject] = array($strTablePrefix, 's'); $this->arVarAssignments[$subject][1] = 's'; $this->arUnionVarAssignments[$this->nUnionCount][$subject] = array($strTablePrefix, 's'); $this->arUsedVarTypes[$subject]['s'] = true; @@ -433,14 +425,10 @@ function getTripleSql(Erfurt_Sparql_QueryTriple $triple, Erfurt_Sparql_GraphPatt $bWhereEqualityPredicate = true; $this->arUsedVarTypes[$predicate]['p'] = true; } else { - #if (isset($this->arVarAssignments[$predicate][0])) { - # $strTablePrefix = $this->arVarAssignments[$predicate][0]; - #} if (!isset($this->arVarAssignments[$predicate])) { $this->arVarAssignments[$predicate] = array($strTablePrefix, 'p'); } - #$this->arVarAssignments[$predicate] = array($strTablePrefix, 'p'); $this->arVarAssignments[$predicate][1] = 'p'; $this->arUnionVarAssignments[$this->nUnionCount][$predicate] = array($strTablePrefix, 'p'); $this->arUsedVarTypes[$predicate]['p'] = true; @@ -467,9 +455,6 @@ function getTripleSql(Erfurt_Sparql_QueryTriple $triple, Erfurt_Sparql_GraphPatt $bWhereEqualityObject = true; $this->arUsedVarTypes[$object]['o'] = true; } else { - #if (isset($this->arVarAssignments[$object][0])) { - # $strTablePrefix = $this->arVarAssignments[$object][0]; - #} if (!isset($this->arVarAssignments[$object])) { $this->arVarAssignments[$object] = array($strTablePrefix, 'o'); } @@ -712,7 +697,6 @@ protected function createEqualSelects($arSelect) $ar[] = implode(',', $arVarParts); $arHasItems = true; } - // if (count($ar) > 0) { if ( true === $arHasItems ) { $arNewSelect[0][] = implode(',', $ar); } diff --git a/library/Erfurt/Sparql/EngineDb/TypeSorter.php b/library/Erfurt/Sparql/EngineDb/TypeSorter.php index 4a9232a5..d89feb69 100644 --- a/library/Erfurt/Sparql/EngineDb/TypeSorter.php +++ b/library/Erfurt/Sparql/EngineDb/TypeSorter.php @@ -285,9 +285,6 @@ protected function getTypeSets($arSpecialVars, $strFrom, $strWhere, $nUnion) $var['datatype'] = array_values(array_unique($var['datatype'])); } } - - - //$arTypes = array_unique($arTypes); return $arTypes; } @@ -409,13 +406,6 @@ function getSqlOrderBy($arTypeSet = array(), $n = 0) return ''; } - #if (count($arTypeSet) === 0) { - # return ''; - #} - -//var_dump($arTypeSet); -//var_dump($this->arUnionVarAssignments); - $sqlOrder = array(); foreach ($arSM['order by'] as $arVar) { $strSparqlVar = $arVar['val']; @@ -452,7 +442,6 @@ function getSqlOrderBy($arTypeSet = array(), $n = 0) if (count($sqlOrder) === 0) { throw new Erfurt_Exception('Something went wrong with ORDER BY.'); } -//var_dump($sqlOrder);exit; return ' ORDER BY ' . implode(', ', $sqlOrder); }//function getSqlOrderBy($arTypeSet = array()) diff --git a/library/Erfurt/Sparql/Parser.php b/library/Erfurt/Sparql/Parser.php index 21a7a975..4e26d43d 100644 --- a/library/Erfurt/Sparql/Parser.php +++ b/library/Erfurt/Sparql/Parser.php @@ -445,10 +445,7 @@ protected function _dtypeCheck(&$node) /** FastForward until next token which is not blank. */ protected function _fastForward() - { - #next($this->_tokens); - #return; - + { $tok = next($this->_tokens); while ($tok === ' ') { $tok = next($this->_tokens); @@ -683,15 +680,6 @@ protected function _parseConstraintTree($nLevel = 0, $bParameter = false) } continue 2; break; -# case '>': -# $litQuotes = null; -# $part[] = array( -# 'type' => 'value', -# 'value' => $strQuoted, -# 'quoted'=> false -# ); -# continue 2; -# break; case '(': $parens = true; $bFunc1 = isset($part[0]['type']) && $part[0]['type'] === 'value'; diff --git a/library/Erfurt/Sparql/Parser/Sparql10.php b/library/Erfurt/Sparql/Parser/Sparql10.php index 17ab331a..3f4e8838 100644 --- a/library/Erfurt/Sparql/Parser/Sparql10.php +++ b/library/Erfurt/Sparql/Parser/Sparql10.php @@ -22,7 +22,6 @@ public static function initFromString($queryString, $parsePartial = null){ $retval=null; $input = new Erfurt_Sparql_Parser_Util_CaseInsensitiveStream($queryString); $lexer = new Erfurt_Sparql_Parser_Sparql10_Sparql10Lexer($input); -// if (!count($lexer->getErrors())) { $tokens = new CommonTokenStream($lexer); $parser = new Erfurt_Sparql_Parser_Sparql10_Sparql10Parser($tokens); if($parsePartial != null && is_string($parsePartial) && method_exists($parser, $parsePartial)){ @@ -30,12 +29,8 @@ public static function initFromString($queryString, $parsePartial = null){ } else { $retval = $parser->parse(); } -// } return array('retval' =>$retval, 'errors'=> - //array_merge($lexer->getErrors(), - //$parser? $parser->getErrors() - //:array()) ); } diff --git a/library/Erfurt/Sparql/Parser/Sparql10/Sparql10/Sparql10.php b/library/Erfurt/Sparql/Parser/Sparql10/Sparql10/Sparql10.php index 6b81aad4..9f404c85 100644 --- a/library/Erfurt/Sparql/Parser/Sparql10/Sparql10/Sparql10.php +++ b/library/Erfurt/Sparql/Parser/Sparql10/Sparql10/Sparql10.php @@ -5440,8 +5440,6 @@ static function getValues(){ class Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA9 extends DFA { public function __construct($recognizer) { -// global $Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA9; -// $DFA = $Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA9; $DFA = Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA9_static::getValues(); $this->recognizer = $recognizer; $this->decisionNumber = 9; @@ -5493,8 +5491,6 @@ static function getValues(){ class Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA21 extends DFA { public function __construct($recognizer) { -// global $Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA21; -// $DFA = $Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA21; $DFA = Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA21_static::getValues(); $this->recognizer = $recognizer; $this->decisionNumber = 21; @@ -5546,8 +5542,6 @@ static function getValues(){ class Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA24 extends DFA { public function __construct($recognizer) { -// global $Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA24; -// $DFA = $Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA24; $DFA = Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA24_static::getValues(); $this->recognizer = $recognizer; $this->decisionNumber = 24; @@ -5598,8 +5592,6 @@ static function getValues(){ class Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA23 extends DFA { public function __construct($recognizer) { -// global $Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA23; -// $DFA = $Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA23; $DFA = Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA23_static::getValues(); $this->recognizer = $recognizer; $this->decisionNumber = 23; @@ -5653,8 +5645,6 @@ static function getValues(){ class Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA25 extends DFA { public function __construct($recognizer) { -// global $Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA25; -// $DFA = $Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA25; $DFA = Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA25_static::getValues(); $this->recognizer = $recognizer; $this->decisionNumber = 25; @@ -5708,9 +5698,7 @@ static function getValues(){ class Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA27 extends DFA { public function __construct($recognizer) { -// global $Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA27; -// $DFA = $Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA27; - $DFA = Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA27_static::getValues(); + $DFA = Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA27_static::getValues(); $this->recognizer = $recognizer; $this->decisionNumber = 27; $this->eot = $DFA['eot']; @@ -5763,9 +5751,7 @@ static function getValues(){ class Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA28 extends DFA { public function __construct($recognizer) { -// global $Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA28; -// $DFA = $Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA28; - $DFA = Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA28_static::getValues(); + $DFA = Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA28_static::getValues(); $this->recognizer = $recognizer; $this->decisionNumber = 28; $this->eot = $DFA['eot']; @@ -5818,9 +5804,7 @@ static function getValues(){ class Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA30 extends DFA { public function __construct($recognizer) { -// global $Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA30; -// $DFA = $Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA30; - $DFA = Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA30_static::getValues(); + $DFA = Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA30_static::getValues(); $this->recognizer = $recognizer; $this->decisionNumber = 30; $this->eot = $DFA['eot']; @@ -5873,9 +5857,7 @@ static function getValues(){ class Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA33 extends DFA { public function __construct($recognizer) { -// global $Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA33; -// $DFA = $Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA33; - $DFA = Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA33_static::getValues(); + $DFA = Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA33_static::getValues(); $this->recognizer = $recognizer; $this->decisionNumber = 33; $this->eot = $DFA['eot']; @@ -5925,9 +5907,7 @@ static function getValues(){ class Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA34 extends DFA { public function __construct($recognizer) { -// global $Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA34; -// $DFA = $Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA34; - $DFA = Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA34_static::getValues(); + $DFA = Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA34_static::getValues(); $this->recognizer = $recognizer; $this->decisionNumber = 34; $this->eot = $DFA['eot']; @@ -5981,9 +5961,7 @@ static function getValues(){ class Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA37 extends DFA { public function __construct($recognizer) { -// global $Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA37; -// $DFA = $Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA37; - $DFA = Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA37_static::getValues(); + $DFA = Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA37_static::getValues(); $this->recognizer = $recognizer; $this->decisionNumber = 37; $this->eot = $DFA['eot']; @@ -6035,9 +6013,7 @@ static function getValues(){ class Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA38 extends DFA { public function __construct($recognizer) { -// global $Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA38; -// $DFA = $Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA38; - $DFA = Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA38_static::getValues(); + $DFA = Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA38_static::getValues(); $this->recognizer = $recognizer; $this->decisionNumber = 38; $this->eot = $DFA['eot']; @@ -6089,9 +6065,7 @@ static function getValues(){ class Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA39 extends DFA { public function __construct($recognizer) { -// global $Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA39; -// $DFA = $Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA39; - $DFA = Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA39_static::getValues(); + $DFA = Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA39_static::getValues(); $this->recognizer = $recognizer; $this->decisionNumber = 39; $this->eot = $DFA['eot']; @@ -6152,9 +6126,7 @@ static function getValues(){ class Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA41 extends DFA { public function __construct($recognizer) { -// global $Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA41; -// $DFA = $Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA41; - $DFA = Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA41_static::getValues(); + $DFA = Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA41_static::getValues(); $this->recognizer = $recognizer; $this->decisionNumber = 41; $this->eot = $DFA['eot']; @@ -6205,9 +6177,7 @@ static function getValues(){ class Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA42 extends DFA { public function __construct($recognizer) { -// global $Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA42; -// $DFA = $Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA42; - $DFA = Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA42_static::getValues(); + $DFA = Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA42_static::getValues(); $this->recognizer = $recognizer; $this->decisionNumber = 42; $this->eot = $DFA['eot']; @@ -6257,9 +6227,7 @@ static function getValues(){ class Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA44 extends DFA { public function __construct($recognizer) { -// global $Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA44; -// $DFA = $Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA44; - $DFA = Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA44_static::getValues(); + $DFA = Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA44_static::getValues(); $this->recognizer = $recognizer; $this->decisionNumber = 44; $this->eot = $DFA['eot']; @@ -6309,9 +6277,7 @@ static function getValues(){ class Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA45 extends DFA { public function __construct($recognizer) { -// global $Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA45; -// $DFA = $Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA45; - $DFA = Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA45_static::getValues(); + $DFA = Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA45_static::getValues(); $this->recognizer = $recognizer; $this->decisionNumber = 45; $this->eot = $DFA['eot']; @@ -6363,9 +6329,7 @@ static function getValues(){ class Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA48 extends DFA { public function __construct($recognizer) { -// global $Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA48; -// $DFA = $Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA48; - $DFA = Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA48_static::getValues(); + $DFA = Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA48_static::getValues(); $this->recognizer = $recognizer; $this->decisionNumber = 48; $this->eot = $DFA['eot']; @@ -6426,9 +6390,7 @@ static function getValues(){ class Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA49 extends DFA { public function __construct($recognizer) { -// global $Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA49; -// $DFA = $Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA49; - $DFA = Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA49_static::getValues(); + $DFA = Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA49_static::getValues(); $this->recognizer = $recognizer; $this->decisionNumber = 49; $this->eot = $DFA['eot']; @@ -6480,9 +6442,7 @@ static function getValues(){ class Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA50 extends DFA { public function __construct($recognizer) { -// global $Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA50; -// $DFA = $Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA50; - $DFA = Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA50_static::getValues(); + $DFA = Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA50_static::getValues(); $this->recognizer = $recognizer; $this->decisionNumber = 50; $this->eot = $DFA['eot']; @@ -6535,9 +6495,7 @@ static function getValues(){ class Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA54 extends DFA { public function __construct($recognizer) { -// global $Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA54; -// $DFA = $Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA54; - $DFA = Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA54_static::getValues(); + $DFA = Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA54_static::getValues(); $this->recognizer = $recognizer; $this->decisionNumber = 54; $this->eot = $DFA['eot']; @@ -6588,9 +6546,7 @@ static function getValues(){ class Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA57 extends DFA { public function __construct($recognizer) { -// global $Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA57; -// $DFA = $Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA57; - $DFA = Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA57_static::getValues(); + $DFA = Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA57_static::getValues(); $this->recognizer = $recognizer; $this->decisionNumber = 57; $this->eot = $DFA['eot']; @@ -6641,9 +6597,7 @@ static function getValues(){ class Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA59 extends DFA { public function __construct($recognizer) { -// global $Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA59; -// $DFA = $Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA59; - $DFA = Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA59_static::getValues(); + $DFA = Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA59_static::getValues(); $this->recognizer = $recognizer; $this->decisionNumber = 59; $this->eot = $DFA['eot']; @@ -6694,9 +6648,7 @@ static function getValues(){ class Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA61 extends DFA { public function __construct($recognizer) { -// global $Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA61; -// $DFA = $Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA61; - $DFA = Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA61_static::getValues(); + $DFA = Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA61_static::getValues(); $this->recognizer = $recognizer; $this->decisionNumber = 61; $this->eot = $DFA['eot']; @@ -6750,9 +6702,7 @@ static function getValues(){ class Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA62 extends DFA { public function __construct($recognizer) { -// global $Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA62; -// $DFA = $Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA62; - $DFA = Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA62_static::getValues(); + $DFA = Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA62_static::getValues(); $this->recognizer = $recognizer; $this->decisionNumber = 62; $this->eot = $DFA['eot']; @@ -6806,9 +6756,7 @@ static function getValues(){ class Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA63 extends DFA { public function __construct($recognizer) { -// global $Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA63; -// $DFA = $Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA63; - $DFA = Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA63_static::getValues(); + $DFA = Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA63_static::getValues(); $this->recognizer = $recognizer; $this->decisionNumber = 63; $this->eot = $DFA['eot']; @@ -6858,9 +6806,7 @@ static function getValues(){ class Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA64 extends DFA { public function __construct($recognizer) { -// global $Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA64; -// $DFA = $Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA64; - $DFA = Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA64_static::getValues(); + $DFA = Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA64_static::getValues(); $this->recognizer = $recognizer; $this->decisionNumber = 64; $this->eot = $DFA['eot']; @@ -6911,9 +6857,7 @@ static function getValues(){ class Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA66 extends DFA { public function __construct($recognizer) { -// global $Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA66; -// $DFA = $Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA66; - $DFA = Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA66_static::getValues(); + $DFA = Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA66_static::getValues(); $this->recognizer = $recognizer; $this->decisionNumber = 66; $this->eot = $DFA['eot']; @@ -6968,9 +6912,7 @@ static function getValues(){ class Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA67 extends DFA { public function __construct($recognizer) { -// global $Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA67; -// $DFA = $Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA67; - $DFA = Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA67_static::getValues(); + $DFA = Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA67_static::getValues(); $this->recognizer = $recognizer; $this->decisionNumber = 67; $this->eot = $DFA['eot']; @@ -7019,9 +6961,7 @@ static function getValues(){ class Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA68 extends DFA { public function __construct($recognizer) { -// global $Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA68; -// $DFA = $Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA68; - $DFA = Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA68_static::getValues(); + $DFA = Erfurt_Sparql_Parser_Sparql10_Sparql10_Sparql10_DFA68_static::getValues(); $this->recognizer = $recognizer; $this->decisionNumber = 68; $this->eot = $DFA['eot']; diff --git a/library/Erfurt/Sparql/Parser/Sparql10/Sparql10/Tokenizer.php b/library/Erfurt/Sparql/Parser/Sparql10/Sparql10/Tokenizer.php index af55b0de..db0eab65 100644 --- a/library/Erfurt/Sparql/Parser/Sparql10/Sparql10/Tokenizer.php +++ b/library/Erfurt/Sparql/Parser/Sparql10/Sparql10/Tokenizer.php @@ -57,9 +57,7 @@ static function getValues(){ class Erfurt_Sparql_Parser_Sparql10_Sparql10_Tokenizer_DFA15 extends DFA { public function __construct($recognizer) { -// global $Erfurt_Sparql_Parser_Sparql10_Sparql10_Tokenizer_DFA15; -// $DFA = $Erfurt_Sparql_Parser_Sparql10_Sparql10_Tokenizer_DFA15; - $DFA = Erfurt_Sparql_Parser_Sparql10_Sparql10_Tokenizer_DFA15_static::getValues(); + $DFA = Erfurt_Sparql_Parser_Sparql10_Sparql10_Tokenizer_DFA15_static::getValues(); $this->recognizer = $recognizer; $this->decisionNumber = 15; $this->eot = $DFA['eot']; @@ -443,9 +441,7 @@ static function getValues(){ class Erfurt_Sparql_Parser_Sparql10_Sparql10_Tokenizer_DFA36 extends DFA { public function __construct($recognizer) { -// global $Erfurt_Sparql_Parser_Sparql10_Sparql10_Tokenizer_DFA36; -// $DFA = $Erfurt_Sparql_Parser_Sparql10_Sparql10_Tokenizer_DFA36; - $DFA = Erfurt_Sparql_Parser_Sparql10_Sparql10_Tokenizer_DFA36_static::getValues(); + $DFA = Erfurt_Sparql_Parser_Sparql10_Sparql10_Tokenizer_DFA36_static::getValues(); $this->recognizer = $recognizer; $this->decisionNumber = 36; $this->eot = $DFA['eot']; diff --git a/library/Erfurt/Sparql/Parser/Sparql11update.php b/library/Erfurt/Sparql/Parser/Sparql11update.php index 7ce6908b..92f2d55d 100644 --- a/library/Erfurt/Sparql/Parser/Sparql11update.php +++ b/library/Erfurt/Sparql/Parser/Sparql11update.php @@ -28,9 +28,6 @@ public static function initFromString($queryString, $parserOptions = array()){ $input = new Erfurt_Sparql_Parser_Util_CaseInsensitiveStream($queryString); $lexer = new Erfurt_Sparql_Parser_Sparql11_UpdateLexer($input); $tokens = new CommonTokenStream($lexer); - // foreach ($tokens->getTokens() as $t) { - // echo $t."\n"; - // } $parser = new Erfurt_Sparql_Parser_Sparql11_UpdateParser($tokens); $q = $parser->parse(); } diff --git a/library/Erfurt/Sparql/Parser/Util/CaseInsensitiveStream.php b/library/Erfurt/Sparql/Parser/Util/CaseInsensitiveStream.php index 4bb996e5..c31bb6a1 100644 --- a/library/Erfurt/Sparql/Parser/Util/CaseInsensitiveStream.php +++ b/library/Erfurt/Sparql/Parser/Util/CaseInsensitiveStream.php @@ -19,12 +19,8 @@ public function LA($i) } if ( ($this->p+$i-1) >= $this->n ) { - //System.out.println("char LA("+i+")=EOF; p="+p); return CharStreamConst::$EOF; } - // echo ord(strtolower(chr($this->data[$this->p+$i-1]))) . "\n"; - //System.out.println("char LA("+i+")="+(char)data[p+i-1]+"; p="+p); - //System.out.println("LA("+i+"); p="+p+" n="+n+" data.length="+data.length); return ord(strtolower(chr($this->data[$this->p+$i-1]))); } diff --git a/library/Erfurt/Sparql/Query2.php b/library/Erfurt/Sparql/Query2.php index 2292af14..068bfb20 100644 --- a/library/Erfurt/Sparql/Query2.php +++ b/library/Erfurt/Sparql/Query2.php @@ -84,7 +84,6 @@ static function getNextID() public function __construct($type = null) { - //parent::__construct(); $this->order = new Erfurt_Sparql_Query2_OrderClause(); $this->where = new Erfurt_Sparql_Query2_GroupGraphPattern; @@ -100,7 +99,6 @@ public function __clone() foreach ($this as $key => $val) { if (is_object($val)||(is_array($val))) { $this->{$key} = unserialize(serialize($val)); - //$this->$key= clone($this->$key); } } } @@ -229,11 +227,6 @@ public function setQueryType($type) break; case self::typeAsk: //ask has no solution modifyer - delete? - //$this->setLimit(0); - //$this->setOffset(0); - //$this->order = new Erfurt_Sparql_Query2_OrderClause(); - //$this->distinctReducedMode = 0; - //$this->projectionVars = array(); break; case self::typeDescribe: break; @@ -374,10 +367,6 @@ public function getLimit() */ public function setOffset($noffset) { - //if ($this->type == self::typeAsk) - // throw new RuntimeException("Trying to set solution modifier \"Offset\"". - // " in an ASK-Query - not possible"); - $this->offset = $noffset; return $this; //for chaining } @@ -734,12 +723,6 @@ public function addProjectionVar(Erfurt_Sparql_Query2_Var $var) } } - /*if (!in_array($var, $this->where->getVars())) { - trigger_error('Trying to add projection-var ('.$var->getSparql().') '. - * 'that is not used in pattern', E_USER_NOTICE); - return $this; //for chaining - }*/ - if (count($this->projectionVars) == 0){ //if the first var is added: deactivate the star. //maybe always? @@ -868,11 +851,6 @@ public function getVars() */ public function getOrder() { - //if ($this->type == self::typeAsk) { - // throw new RuntimeException( - // "Trying to set solution modifier \"Order\" in an ASK-Query - not possible" - // ); - //} return $this->order; } diff --git a/library/Erfurt/Sparql/Query2/Abstraction/ClassNode.php b/library/Erfurt/Sparql/Query2/Abstraction/ClassNode.php index f964c301..e30d8f2f 100644 --- a/library/Erfurt/Sparql/Query2/Abstraction/ClassNode.php +++ b/library/Erfurt/Sparql/Query2/Abstraction/ClassNode.php @@ -130,15 +130,6 @@ public static function addShownPropertyHelper(Erfurt_Sparql_Query2 $query, Erfur $optionalpart->addElement($triple); $query->getWhere()->addElement($optionalpart); - /* filtered now in php - $filter = new Erfurt_Sparql_Query2_Filter( - new Erfurt_Sparql_Query2_UnaryExpressionNot( - new Erfurt_Sparql_Query2_isBlank($var) - ) - );*/ - - //$optionalpart->addElement($filter); - $query->addProjectionVar($var); return array('optional' => $optionalpart, 'var' => $var, 'filter' => null); diff --git a/library/Erfurt/Sparql/Query2/ContainerHelper.php b/library/Erfurt/Sparql/Query2/ContainerHelper.php index 746f8444..8bd6c423 100644 --- a/library/Erfurt/Sparql/Query2/ContainerHelper.php +++ b/library/Erfurt/Sparql/Query2/ContainerHelper.php @@ -41,7 +41,6 @@ public function getParentContainer($needle){ return $parents; } - //abstract public function addElement($member); //not used because some use typehinting some do it internally for multiple types /** * getElement @@ -80,7 +79,6 @@ public function getVars() { return $ret; } - //abstract public function setElement($i, $member); //not used because some use typehinting some do it internally abstract public function setElements($elements); /** @@ -116,7 +114,6 @@ public function removeElement($toDelete, $equal = false) { } } } - //$toDelete->removeParent($this); $this->elements = $new; return $this; //for chaining diff --git a/library/Erfurt/Sparql/Query2/ElementHelper.php b/library/Erfurt/Sparql/Query2/ElementHelper.php index 1d96024a..d7ce51b3 100644 --- a/library/Erfurt/Sparql/Query2/ElementHelper.php +++ b/library/Erfurt/Sparql/Query2/ElementHelper.php @@ -23,8 +23,6 @@ public function __construct() { $this->id = Erfurt_Sparql_Query2::getNextID(); } - //abstract public function getSparql(); - /** * addParent * when a ElementHelper-object is added to a ContainerHelper-object this method is called. lets the child know of the new parent diff --git a/library/Erfurt/Sparql/SimpleQuery.php b/library/Erfurt/Sparql/SimpleQuery.php index 9a65a426..e632527e 100644 --- a/library/Erfurt/Sparql/SimpleQuery.php +++ b/library/Erfurt/Sparql/SimpleQuery.php @@ -120,7 +120,6 @@ public static function initWithString($queryString) $var = '[?$]{1}[\w\d]+'; $expr = '(\w*\(.*\))'; - // /(BASE.*?\s)?(PREFIX.*?\s)*(ASK|((COUNT(\s)*(\(.*?\))))|(SELECT(\s)+)(DISTINCT(\s)+)?(COUNT(\s)+(\(.*?\)(\s)))?(\?\w+\s+|\*)*)/si $tokens = array( 'prefix' => '/((PREFIX\s+[^:\s]+:\s+<[^\s]*>\s*)+)/si', 'base' => '/BASE\s+<(.+?)>/i', @@ -139,9 +138,6 @@ public static function initWithString($queryString) preg_match_all($pattern, $queryString, $parts[$key]); } - //echo $queryString; - //var_dump($parts); - $queryObject = new self(); if (isset($parts['prefix'][0][0]) || isset($parts['base'][0][0])) { $prologue = ''; diff --git a/library/Erfurt/Store.php b/library/Erfurt/Store.php index dc3ccb5e..26c65d27 100644 --- a/library/Erfurt/Store.php +++ b/library/Erfurt/Store.php @@ -1489,8 +1489,6 @@ protected function _prepareQuery($queryObject, &$options = array()) //the query will be altered here to implement AC and owl:imports //dont make these changes global $queryObject = clone $queryObject; - //bring triples etc. to canonical order - // $queryObject->optimize(); } $defaultOptions = array( @@ -1516,13 +1514,6 @@ protected function _prepareQuery($queryObject, &$options = array()) ); } - /* -if ($options[Erfurt_Store::USE_AC] == false) { - //we are done preparing early - return $queryObject; - } -*/ - $logger = $this->_getQueryLogger(); $noBindings = false; @@ -1716,8 +1707,6 @@ public function sparqlQuery($queryObject, $options = array()) $sparqlResult['results'] = array(); $sparqlResult['results']['bindings'] = array(); } else { - //var_dump($queryString);exit; - //exit; throw new Erfurt_Store_Exception('invalid query result.'); } } @@ -1791,9 +1780,6 @@ public function sqlQuery($sqlQuery, $limit = PHP_INT_MAX, $offset = 0) } return $result; } - - // TODO: will throw an exception - // throw new Erfurt_Store_Exception('Current backend doesn not support SQL queries.'); } /** @@ -2226,15 +2212,6 @@ private function _fetchResourceDescription( $row['p'], $row['o'] ); - - // todo: implement blank node fetching here - //if ($row['o']['type'] === 'bnode') { - //$nodeId = $row['o']['value']; - //$bNode = self::initWithBlankNode($nodeId, $this->_model); - //$nodeKey = sprintf('_:%s', $nodeId); - - //$description[$nodeKey] = $bNode->getDescription($maxDepth-1); - //} } } @@ -2410,7 +2387,6 @@ private function _getTransitiveClosure($modelIri, $property, $startResources, $i $classes = array(); foreach ($result as $row) { - // $key = $inverse ? $row['child'] : $row['parent']; $key = $inverse ? $row['child'] : $row['parent']; $closure[$key] = array( 'node' => $inverse ? $row['child'] : $row['parent'], diff --git a/library/Erfurt/Store/Adapter/EfZendDb.php b/library/Erfurt/Store/Adapter/EfZendDb.php index 9406c6bf..b65daa63 100644 --- a/library/Erfurt/Store/Adapter/EfZendDb.php +++ b/library/Erfurt/Store/Adapter/EfZendDb.php @@ -1081,7 +1081,7 @@ public function sqlQuery($sqlQuery, $limit = PHP_INT_MAX, $offset = 0) } else { try { $result = @$this->_dbConn->fetchAll($sqlQuery); - } catch (Zend_Db_Exception $e) { #return false; + } catch (Zend_Db_Exception $e) { throw new Erfurt_Store_Adapter_Exception( $e->getMessage() ); diff --git a/library/Erfurt/Store/Adapter/Mssql.php b/library/Erfurt/Store/Adapter/Mssql.php index 43223f0f..573e555d 100644 --- a/library/Erfurt/Store/Adapter/Mssql.php +++ b/library/Erfurt/Store/Adapter/Mssql.php @@ -80,9 +80,6 @@ public function __construct($adapterOptions = array()) throw new Erfurt_Exception('An error with the specified database adapter occured.', -1); } - // we want indexed results - //$this->_dbConn->setFetchMode(Zend_Db::FETCH_NUM); - // load title properties for model titles $config = Erfurt_App::getInstance()->getConfig(); if (isset($config->properties->title)) { @@ -92,16 +89,6 @@ public function __construct($adapterOptions = array()) public function __destruct() { - #$log = Erfurt_App::getInstance()->getLog(); - - #$profiles = $this->_dbConn->getProfiler()->getQueryProfiles(); - - #foreach ($profiles as $profile) { - # $debugStr = 'Query: ' . $profile->getQuery() . PHP_EOL; - # $debugStr .= 'Time: ' . $profile->getElapsedSecs() . PHP_EOL; - # - # $log->debug($debugStr); - #} } // ------------------------------------------------------------------------ @@ -209,15 +196,6 @@ public function addMultipleStatements($graphUri, array $statementsArray, array $ $sqlString .= "($graphId,'$s','$p','$oValue',"; - #$data = array( - # 'g' => $graphId, - # 's' => $subject, - # 'p' => $predicate, - # 'o' => $object['value'], - # 'st' => $subjectIs, - # 'ot' => $objectIs - #); - if ($sRef !== false) { $sqlString .= "$sRef,"; } else { @@ -236,9 +214,6 @@ public function addMultipleStatements($graphUri, array $statementsArray, array $ $sqlString .= "$subjectIs,$objectIs,'$lang',"; - #$data['ol'] = $lang; - - if (strlen((string)$dType) > $this->_getSchemaRefThreshold()) { $dTypeHash = md5((string)$dType); @@ -254,11 +229,9 @@ public function addMultipleStatements($graphUri, array $statementsArray, array $ $sqlString .= "'$dType',$dtRef)"; } else { - #$data['od'] = $dType; $sqlString .= "'$dType',NULL)"; } -// $insertArray[] = $sqlString; $counter++; $finalquery = 'IF NOT EXISTS(Select g, s, p, o, st, ot, ol, od from ef_stmt @@ -971,8 +944,6 @@ public function importRdf($modelUri, $data, $type, $locator) } else { $sql .= "NULL,NULL)"; } - - //$this->_dbConn->getConnection()->query($sql); } if ($count > 10000) { @@ -1437,8 +1408,6 @@ private function _fetchModelInfos() } else { $this->_modelInfoCache = array(); - #$rowSet = $result->fetchAll(); - #var_dump($result);exit; foreach ($result as $row) { if (!isset($this->_modelInfoCache[$row['uri']])) { $this->_modelInfoCache[$row['uri']]['modelId'] = $row['id']; @@ -1466,8 +1435,6 @@ private function _fetchModelInfos() } } - //var_dump($this->_modelInfoCache);exit; - // build the transitive closure for owl:imports // check for recursive owl:imports; also check for cylces! do { diff --git a/library/Erfurt/Store/Adapter/Virtuoso.php b/library/Erfurt/Store/Adapter/Virtuoso.php index 4eefc0ea..bac96c10 100644 --- a/library/Erfurt/Store/Adapter/Virtuoso.php +++ b/library/Erfurt/Store/Adapter/Virtuoso.php @@ -236,8 +236,6 @@ public function connection() if (!$this->_connection) { $options = $this->_adapterOptions; - // ini_set('odbc.default_cursortype', SQL_CURSOR_FORWARD_ONLY); - // determine connection function if ((isset($options['use_persistent_connection'])) && ((boolean) $options['use_persistent_connection'] === true)) { @@ -494,11 +492,6 @@ public function getSearchPatternWithNode($stringSpec, $predicateVariable, $optio new Erfurt_Sparql_Query2_Equals($strExpression, $literalExpression) ); } else { - // string >= bifLimit characters - // if (false === strpos($stringSpec, '*')) { - // $stringSpec .= '*'; - // } - $bifPrefix = new Erfurt_Sparql_Query2_Prefix( 'bif', new Erfurt_Sparql_Query2_IriRef('SparqlProcessorShouldKnow') @@ -527,7 +520,6 @@ public function getSearchPatternWithNode($stringSpec, $predicateVariable, $optio } $searchPattern[] = $filter; -#var_dump((string)$searchPattern[1]);exit; return $searchPattern; } @@ -1046,11 +1038,8 @@ private function _execSparql($sparqlQuery, $graphUri = null) $sparqlQuery = addcslashes($sparqlQuery, '\'\\'); //build Virtuoso/PL query - //$virtuosoPl = 'SPARQL ' . $sparqlQuery; $virtuosoPl = $graphSpec . 'CALL DB.DBA.SPARQL_EVAL(\'' . $sparqlQuery . '\', ' . $graphUri . ', 0)'; -# $resultId = odbc_prepare($this->connection(), $virtuosoPl); -# $resultId = odbc_exec($resultId, $virtuosoPl); $resultId = @odbc_exec($this->connection(), $virtuosoPl); if (false === $resultId) { @@ -1077,8 +1066,6 @@ private function _execSparqlUpdate($sparqlQuery, $graphUri = null) //build Virtuoso/PL query $virtuosoPl = 'SPARQL ' . $sparqlQuery; -# $resultId = odbc_prepare($this->connection(), $virtuosoPl); -# $resultId = odbc_exec($resultId, $virtuosoPl); $resultId = odbc_exec($this->connection(), $virtuosoPl); if (false === $resultId) { @@ -1098,8 +1085,6 @@ private function _execSparqlUpdate($sparqlQuery, $graphUri = null) */ protected function _execSql($sqlQuery) { -# $resultId = odbc_prepare($this->connection(), $sqlQuery); -# $resultId = odbc_exec($resultId, $sqlQuery); $resultId = @odbc_exec($this->connection(), $sqlQuery); if (false === $resultId) { $message = sprintf('SQL Error: %s in query: %s', $this->getLastError(), $sqlQuery); diff --git a/library/Erfurt/Syntax/RdfParser/Adapter/RdfXml.php b/library/Erfurt/Syntax/RdfParser/Adapter/RdfXml.php index c0db7a18..34d09836 100644 --- a/library/Erfurt/Syntax/RdfParser/Adapter/RdfXml.php +++ b/library/Erfurt/Syntax/RdfParser/Adapter/RdfXml.php @@ -280,7 +280,6 @@ protected function _characterData($parser, $data) protected function _handleCharDataStatement() { -#var_dump($this->_currentCharData);exit; if (null !== $this->_currentCharData) { if (trim($this->_currentCharData) === '') { $this->_currentCharData = null; @@ -288,9 +287,6 @@ protected function _handleCharDataStatement() } if (!$this->_topElemIsProperty()) { -#var_dump($this->_currentCharData);exit; -#var_dump($this->_statements); -#var_dump($this->_elementStack);exit; $this->_throwException('Unexpected literal.'); } @@ -313,7 +309,6 @@ protected function _handleCharDataStatement() protected function _processNode($name, &$attrs) { $nodeResource = $this->_getNodeResource($attrs); -#var_dump($nodeResource); if (null === $nodeResource) { return; } @@ -475,17 +470,8 @@ protected function _processProperty($name, &$attrs) $predicate->setDatatype($datatype); } - // Check for about attribute - #$about = $this->_removeAttribute($attrs, EF_RDF_NS.'about'); - #if (null !== $about) { - # $aboutUri = $this->_resolveUri($about); - # $this->_addStatement($aboutUri, EF_RDF_TYPE, $predicate, 'uri'); -// TODO phil # - # $this->_processSubjectAttributes($aboutUri, $attrs); - #} } } -#var_dump($this->_currentElementIsEmpty); if ($this->_currentElementIsEmpty) { array_pop($this->_elementStack); } @@ -721,18 +707,8 @@ private function _getXmlParser() // Set the handler method for namespace definitions xml_set_start_namespace_decl_handler($this->_xmlParser, array($this, '_handleNamespaceDeclaration')); - //$this->_setNamespaceDeclarationHandler('_handleNamespaceDeclaration'); - - //xml_set_end_namespace_decl_handler($xmlParser, array(&$this, '_handleNamespaceDeclaration')); - xml_set_character_data_handler($this->_xmlParser, array($this, '_characterData')); - //xml_set_external_entity_ref_handler($this->_xmlParser, array($this, '_handleExternalEntityRef')); - - //xml_set_processing_instruction_handler($this->_xmlParser, array($this, '_handleProcessingInstruction')); - - //xml_set_unparsed_entity_decl_handler($this->_xmlParser, array($this, '_handleUnparsedEntityDecl')); - xml_set_element_handler( $this->_xmlParser, array($this, '_startElement'), @@ -746,7 +722,6 @@ private function _getXmlParser() protected function _handleDefault($parser, $data) { // Handles comments - //var_dump($data); } protected function _handleNamespaceDeclaration($parser, $prefix, $uri) diff --git a/library/Erfurt/Syntax/RdfParser/Adapter/Turtle.php b/library/Erfurt/Syntax/RdfParser/Adapter/Turtle.php index 7b44bf5d..3ed589cc 100644 --- a/library/Erfurt/Syntax/RdfParser/Adapter/Turtle.php +++ b/library/Erfurt/Syntax/RdfParser/Adapter/Turtle.php @@ -15,7 +15,6 @@ class Erfurt_Syntax_RdfParser_Adapter_Turtle extends Erfurt_Syntax_RdfParser_Ada { protected $_data = ''; protected $_pos = 0; - //protected $_lastCharLength = 1; protected $_subject = null; protected $_predicate = null; @@ -300,8 +299,6 @@ protected function _parseUri() $c = $this->_read(); } - #$c = $this->_skipWS(); - $uri = $this->_resolveUri($this->_decodeString($token, true)); return Erfurt_Rdf_Resource::initWithIri($uri); } @@ -501,18 +498,6 @@ protected function _parseQuotedLiteral() } } - /* - protected function _isLanguageChar($c) - { - return ($this->_isLanguageStartChar($c) || is_numeric($c) || $c === '-'); - }*/ - - /* - protected function _isLanguageStartChar($c) - { - return ($this->_ord($c) >= 0x41 && $this->_ord($c) <= 0x7A); - }*/ - protected function _parseQuotedString() { $result = null; @@ -589,9 +574,6 @@ protected function _parseNodeId() $this->_verifyChar($this->_read(), ':'); $c = $this->_read(); - #if (!$this->_isNameStartChar($c)) { - # $this->_throwException('Illegal char.'); - #} $result = $c; @@ -606,32 +588,10 @@ protected function _parseNodeId() return $this->_createBNode($result); } - /* - protected function _isNameChar($c) - { - return ( - $this->_isNameStartChar($c) || - is_numeric($c) || - $c === '-' || - $this->_ord($c) === 0x00B7 || - ($this->_ord($c) >= 0x0300 && $this->_ord($c) < 0x036F) || - ($this->_ord($c) >= 0x203F && $this->_ord($c) < 0x2040) - ); - }*/ - - /*protected function _isNameStartChar($c) - { - return ($c === '_' || $this->_isPrefixStartChar($c)); - }*/ - protected function _parseQNameOrBoolean() { $c = $this->_read(); - #if ($c !== ':' && !$this->_isPrefixStartChar($c)) { - # $this->_throwException('Expected ":" or letter.'); - #} - $namespace = null; if ($c === ':') { // QName with default namespace @@ -679,30 +639,6 @@ protected function _parseQNameOrBoolean() return Erfurt_Rdf_Resource::initWithNamespaceAndLocalName($namespace, $localName); } - /*protected function _isPrefixChar($c) - { - return $this->_isNameChar($c); - }*/ - - /*protected function _isPrefixStartChar($c) - { - return ( - ($this->_ord($c) >= 0x41 && $this->_ord($c) <= 0x7A) || - ($this->_ord($c) >= 0x00C0 && $this->_ord($c) <= 0x00D6) || - ($this->_ord($c) >= 0x00D8 && $this->_ord($c) <= 0x00F6) || - ($this->_ord($c) >= 0x00F8 && $this->_ord($c) <= 0x02FF) || - ($this->_ord($c) >= 0x0370 && $this->_ord($c) <= 0x037D) || - ($this->_ord($c) >= 0x037F && $this->_ord($c) <= 0x1FFF) || - ($this->_ord($c) >= 0x200C && $this->_ord($c) <= 0x200D) || - ($this->_ord($c) >= 0x2070 && $this->_ord($c) <= 0x218F) || - ($this->_ord($c) >= 0x2C00 && $this->_ord($c) <= 0x2FEF) || - ($this->_ord($c) >= 0x3001 && $this->_ord($c) <= 0xD7FF) || - ($this->_ord($c) >= 0xF900 && $this->_ord($c) <= 0xFDCF) || - ($this->_ord($c) >= 0xFDF0 && $this->_ord($c) <= 0xFFFD) || - ($this->_ord($c) >= 0x10000 && $this->_ord($c) <= 0xEFFFF) - ); - }*/ - protected function _parseImplicitBlank() { $this->_verifyChar($this->_read(), '['); diff --git a/library/Erfurt/Syntax/RdfSerializer/Adapter/RdfXml/RdfWriter.php b/library/Erfurt/Syntax/RdfSerializer/Adapter/RdfXml/RdfWriter.php index 45621c02..9dc0b7c1 100644 --- a/library/Erfurt/Syntax/RdfSerializer/Adapter/RdfXml/RdfWriter.php +++ b/library/Erfurt/Syntax/RdfSerializer/Adapter/RdfXml/RdfWriter.php @@ -359,9 +359,6 @@ private function propertyNested($value) } return false; - // TODO - #$this->serializeSubject($value); - #return true; } /** @@ -414,7 +411,6 @@ private function serializeProperty($property, $value) && !$this->propertyXMLLiteral($value) && !$this->propertyLiteral($value)) { - #var_dump($value);exit; throw new Exception('Could not serialize property '.$property.' with value '.$value); } @@ -439,7 +435,6 @@ private function shouldNest($node) return true; } else if ($node['type'] === 'bnode') { return false; - #return true; } else { return false; } diff --git a/library/Erfurt/Syntax/RdfSerializer/Adapter/Turtle.php b/library/Erfurt/Syntax/RdfSerializer/Adapter/Turtle.php index ff626e6a..e09a965c 100644 --- a/library/Erfurt/Syntax/RdfSerializer/Adapter/Turtle.php +++ b/library/Erfurt/Syntax/RdfSerializer/Adapter/Turtle.php @@ -311,10 +311,6 @@ protected function _writeUri($uri) $prefix = null; $uri = substr($uri, $splitIdx); } else { - // We need to support large exports so we add namespaces once and write uris that do not match as - // full uris. - //$this->_addNamespace($ns); - //$prefix = $this->_namespaces[$ns]; } if (null !== $prefix) { diff --git a/library/Erfurt/Worker/Job/Abstract.php b/library/Erfurt/Worker/Job/Abstract.php index c90aca87..2115272f 100644 --- a/library/Erfurt/Worker/Job/Abstract.php +++ b/library/Erfurt/Worker/Job/Abstract.php @@ -250,7 +250,6 @@ private function _getCacheIdForKeyAndScope($key, $scope) } else if ($scope == self::SCOPE_GLOBAL) { $cacheId = self::CACHEID_PREFIX . $key; } - //$this->logSuccess('uses cache id '$cacheId); return $cacheId; } diff --git a/library/Erfurt/Wrapper/Manager.php b/library/Erfurt/Wrapper/Manager.php index c3e84d92..1e8ab6ed 100644 --- a/library/Erfurt/Wrapper/Manager.php +++ b/library/Erfurt/Wrapper/Manager.php @@ -137,10 +137,6 @@ protected function _addWrapper($wrapperName, $wrapperPath) public function addWrapperExternally($wrapperName, $wrapperPath, $privateConfig) { -// if($privateConfig instanceof Zend_Config){ -// $privateConfig = $privateConfig->toArray(); -// } - $wrapperSpec = array( 'class_name' => ucfirst($wrapperName) . 'Wrapper', 'include_path' => $wrapperPath,