public function simpleValue($propertyName) { $query = 'PREFIX ' . $this->vocabulary->name . ': <' . $this->vocabulary->prefix . '> ' . 'SELECT ?' . $propertyName . ' ' . 'WHERE { ' . '<' . $this->url . '> ' . $this->vocabulary->name . ':' . $propertyName . ' ?' . $propertyName . ' ' . '}'; $result = $this->store->sparqlQuery($query); if (!empty($result[0][$propertyName])) { return $result[0][$propertyName]; } return NULL; }
/** * Checks a given OpenID against the store and fetches the required informations. * * @param string $openId * @return array */ protected function _checkOpenId($openId) { $retVal = array('userUri' => false, 'denyLogin' => false); // Query the store. require_once 'Erfurt/Sparql/SimpleQuery.php'; $query = new Erfurt_Sparql_SimpleQuery(); $query->setProloguePart('SELECT ?s ?p ?o'); $query->addFrom($this->_acModelUri); $where = 'WHERE { ?s ?p ?o . ?s <' . EF_RDF_TYPE . '> <' . $this->_uris['user_class'] . "> .\n FILTER (sameTerm(?s, <{$openId}>))\n }"; $query->setWherePart($where); $result = $this->_store->sparqlQuery($query, array('use_ac' => false)); foreach ((array) $result as $row) { // Set user URI if ($retVal['userUri'] === false) { $retVal['userUri'] = $row['s']; } // Check predicates, whether needed. switch ($row['p']) { case $this->_uris['action_deny']: // if login is disallowed if ($row['o'] === $this->_uris['action_login']) { $retVal['denyLogin'] = true; } break; case EF_RDFS_LABEL: $retVal['userLabel'] = $row['o']; break; case $this->_uris['user_username']: $retVal['username'] = $row['o']; break; case $this->_uris['user_mail']: $retVal['email'] = $row['o']; default: // Ignore all other statements. } } return $retVal; }