[ Index ]

PHP Cross Reference of moodle-2.8

title

Body

[close]

/lib/google/Google/Service/ -> Freebase.php (source)

   1  <?php
   2  /*
   3   * Copyright 2010 Google Inc.
   4   *
   5   * Licensed under the Apache License, Version 2.0 (the "License"); you may not
   6   * use this file except in compliance with the License. You may obtain a copy of
   7   * the License at
   8   *
   9   * http://www.apache.org/licenses/LICENSE-2.0
  10   *
  11   * Unless required by applicable law or agreed to in writing, software
  12   * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  13   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  14   * License for the specific language governing permissions and limitations under
  15   * the License.
  16   */
  17  
  18  /**
  19   * Service definition for Freebase (v1).
  20   *
  21   * <p>
  22   * Find Freebase entities using textual queries and other constraints.
  23   * </p>
  24   *
  25   * <p>
  26   * For more information about this service, see the API
  27   * <a href="https://developers.google.com/freebase/" target="_blank">Documentation</a>
  28   * </p>
  29   *
  30   * @author Google, Inc.
  31   */
  32  class Google_Service_Freebase extends Google_Service
  33  {
  34  
  35  
  36  
  37    private $base_methods;
  38  
  39    /**
  40     * Constructs the internal representation of the Freebase service.
  41     *
  42     * @param Google_Client $client
  43     */
  44    public function __construct(Google_Client $client)
  45    {
  46      parent::__construct($client);
  47      $this->servicePath = 'freebase/v1/';
  48      $this->version = 'v1';
  49      $this->serviceName = 'freebase';
  50  
  51      $this->base_methods = new Google_Service_Resource(
  52          $this,
  53          $this->serviceName,
  54          '',
  55          array(
  56            'methods' => array(
  57              'reconcile' => array(
  58                'path' => 'reconcile',
  59                'httpMethod' => 'GET',
  60                'parameters' => array(
  61                  'lang' => array(
  62                    'location' => 'query',
  63                    'type' => 'string',
  64                    'repeated' => true,
  65                  ),
  66                  'confidence' => array(
  67                    'location' => 'query',
  68                    'type' => 'number',
  69                  ),
  70                  'name' => array(
  71                    'location' => 'query',
  72                    'type' => 'string',
  73                  ),
  74                  'kind' => array(
  75                    'location' => 'query',
  76                    'type' => 'string',
  77                    'repeated' => true,
  78                  ),
  79                  'prop' => array(
  80                    'location' => 'query',
  81                    'type' => 'string',
  82                    'repeated' => true,
  83                  ),
  84                  'limit' => array(
  85                    'location' => 'query',
  86                    'type' => 'integer',
  87                  ),
  88                ),
  89              ),'search' => array(
  90                'path' => 'search',
  91                'httpMethod' => 'GET',
  92                'parameters' => array(
  93                  'domain' => array(
  94                    'location' => 'query',
  95                    'type' => 'string',
  96                    'repeated' => true,
  97                  ),
  98                  'help' => array(
  99                    'location' => 'query',
 100                    'type' => 'string',
 101                  ),
 102                  'query' => array(
 103                    'location' => 'query',
 104                    'type' => 'string',
 105                  ),
 106                  'scoring' => array(
 107                    'location' => 'query',
 108                    'type' => 'string',
 109                  ),
 110                  'cursor' => array(
 111                    'location' => 'query',
 112                    'type' => 'integer',
 113                  ),
 114                  'prefixed' => array(
 115                    'location' => 'query',
 116                    'type' => 'boolean',
 117                  ),
 118                  'exact' => array(
 119                    'location' => 'query',
 120                    'type' => 'boolean',
 121                  ),
 122                  'mid' => array(
 123                    'location' => 'query',
 124                    'type' => 'string',
 125                    'repeated' => true,
 126                  ),
 127                  'encode' => array(
 128                    'location' => 'query',
 129                    'type' => 'string',
 130                  ),
 131                  'type' => array(
 132                    'location' => 'query',
 133                    'type' => 'string',
 134                    'repeated' => true,
 135                  ),
 136                  'as_of_time' => array(
 137                    'location' => 'query',
 138                    'type' => 'string',
 139                  ),
 140                  'stemmed' => array(
 141                    'location' => 'query',
 142                    'type' => 'boolean',
 143                  ),
 144                  'format' => array(
 145                    'location' => 'query',
 146                    'type' => 'string',
 147                  ),
 148                  'spell' => array(
 149                    'location' => 'query',
 150                    'type' => 'string',
 151                  ),
 152                  'with' => array(
 153                    'location' => 'query',
 154                    'type' => 'string',
 155                    'repeated' => true,
 156                  ),
 157                  'lang' => array(
 158                    'location' => 'query',
 159                    'type' => 'string',
 160                    'repeated' => true,
 161                  ),
 162                  'indent' => array(
 163                    'location' => 'query',
 164                    'type' => 'boolean',
 165                  ),
 166                  'filter' => array(
 167                    'location' => 'query',
 168                    'type' => 'string',
 169                    'repeated' => true,
 170                  ),
 171                  'callback' => array(
 172                    'location' => 'query',
 173                    'type' => 'string',
 174                  ),
 175                  'without' => array(
 176                    'location' => 'query',
 177                    'type' => 'string',
 178                    'repeated' => true,
 179                  ),
 180                  'limit' => array(
 181                    'location' => 'query',
 182                    'type' => 'integer',
 183                  ),
 184                  'output' => array(
 185                    'location' => 'query',
 186                    'type' => 'string',
 187                  ),
 188                  'mql_output' => array(
 189                    'location' => 'query',
 190                    'type' => 'string',
 191                  ),
 192                ),
 193              ),
 194            )
 195          )
 196      );
 197    }
 198    /**
 199     * Reconcile entities to Freebase open data. (reconcile)
 200     *
 201     * @param array $optParams Optional parameters.
 202     *
 203     * @opt_param string lang
 204     * Languages for names and values. First language is used for display. Default is 'en'.
 205     * @opt_param float confidence
 206     * Required confidence for a candidate to match. Must be between .5 and 1.0
 207     * @opt_param string name
 208     * Name of entity.
 209     * @opt_param string kind
 210     * Classifications of entity e.g. type, category, title.
 211     * @opt_param string prop
 212     * Property values for entity formatted as
 213    :
 214     * @opt_param int limit
 215     * Maximum number of candidates to return.
 216     * @return Google_Service_Freebase_ReconcileGet
 217     */
 218    public function reconcile($optParams = array())
 219    {
 220      $params = array();
 221      $params = array_merge($params, $optParams);
 222      return $this->base_methods->call('reconcile', array($params), "Google_Service_Freebase_ReconcileGet");
 223    }
 224    /**
 225     * Search Freebase open data. (search)
 226     *
 227     * @param array $optParams Optional parameters.
 228     *
 229     * @opt_param string domain
 230     * Restrict to topics with this Freebase domain id.
 231     * @opt_param string help
 232     * The keyword to request help on.
 233     * @opt_param string query
 234     * Query term to search for.
 235     * @opt_param string scoring
 236     * Relevance scoring algorithm to use.
 237     * @opt_param int cursor
 238     * The cursor value to use for the next page of results.
 239     * @opt_param bool prefixed
 240     * Prefix match against names and aliases.
 241     * @opt_param bool exact
 242     * Query on exact name and keys only.
 243     * @opt_param string mid
 244     * A mid to use instead of a query.
 245     * @opt_param string encode
 246     * The encoding of the response. You can use this parameter to enable html encoding.
 247     * @opt_param string type
 248     * Restrict to topics with this Freebase type id.
 249     * @opt_param string as_of_time
 250     * A mql as_of_time value to use with mql_output queries.
 251     * @opt_param bool stemmed
 252     * Query on stemmed names and aliases. May not be used with prefixed.
 253     * @opt_param string format
 254     * Structural format of the json response.
 255     * @opt_param string spell
 256     * Request 'did you mean' suggestions
 257     * @opt_param string with
 258     * A rule to match against.
 259     * @opt_param string lang
 260     * The code of the language to run the query with. Default is 'en'.
 261     * @opt_param bool indent
 262     * Whether to indent the json results or not.
 263     * @opt_param string filter
 264     * A filter to apply to the query.
 265     * @opt_param string callback
 266     * JS method name for JSONP callbacks.
 267     * @opt_param string without
 268     * A rule to not match against.
 269     * @opt_param int limit
 270     * Maximum number of results to return.
 271     * @opt_param string output
 272     * An output expression to request data from matches.
 273     * @opt_param string mql_output
 274     * The MQL query to run againist the results to extract more data.
 275     */
 276    public function search($optParams = array())
 277    {
 278      $params = array();
 279      $params = array_merge($params, $optParams);
 280      return $this->call('search', array($params));
 281    }
 282  }
 283  
 284  
 285  
 286  
 287  
 288  class Google_Service_Freebase_ReconcileCandidate extends Google_Model
 289  {
 290    public $confidence;
 291    public $lang;
 292    public $mid;
 293    public $name;
 294    protected $notableType = 'Google_Service_Freebase_ReconcileCandidateNotable';
 295    protected $notableDataType = '';
 296  
 297    public function setConfidence($confidence)
 298    {
 299      $this->confidence = $confidence;
 300    }
 301  
 302    public function getConfidence()
 303    {
 304      return $this->confidence;
 305    }
 306  
 307    public function setLang($lang)
 308    {
 309      $this->lang = $lang;
 310    }
 311  
 312    public function getLang()
 313    {
 314      return $this->lang;
 315    }
 316  
 317    public function setMid($mid)
 318    {
 319      $this->mid = $mid;
 320    }
 321  
 322    public function getMid()
 323    {
 324      return $this->mid;
 325    }
 326  
 327    public function setName($name)
 328    {
 329      $this->name = $name;
 330    }
 331  
 332    public function getName()
 333    {
 334      return $this->name;
 335    }
 336  
 337    public function setNotable(Google_Service_Freebase_ReconcileCandidateNotable $notable)
 338    {
 339      $this->notable = $notable;
 340    }
 341  
 342    public function getNotable()
 343    {
 344      return $this->notable;
 345    }
 346  }
 347  
 348  class Google_Service_Freebase_ReconcileCandidateNotable extends Google_Model
 349  {
 350    public $id;
 351    public $name;
 352  
 353    public function setId($id)
 354    {
 355      $this->id = $id;
 356    }
 357  
 358    public function getId()
 359    {
 360      return $this->id;
 361    }
 362  
 363    public function setName($name)
 364    {
 365      $this->name = $name;
 366    }
 367  
 368    public function getName()
 369    {
 370      return $this->name;
 371    }
 372  }
 373  
 374  class Google_Service_Freebase_ReconcileGet extends Google_Collection
 375  {
 376    protected $collection_key = 'warning';
 377    protected $candidateType = 'Google_Service_Freebase_ReconcileCandidate';
 378    protected $candidateDataType = 'array';
 379    protected $costsType = 'Google_Service_Freebase_ReconcileGetCosts';
 380    protected $costsDataType = '';
 381    protected $matchType = 'Google_Service_Freebase_ReconcileCandidate';
 382    protected $matchDataType = '';
 383    protected $warningType = 'Google_Service_Freebase_ReconcileGetWarning';
 384    protected $warningDataType = 'array';
 385  
 386    public function setCandidate($candidate)
 387    {
 388      $this->candidate = $candidate;
 389    }
 390  
 391    public function getCandidate()
 392    {
 393      return $this->candidate;
 394    }
 395  
 396    public function setCosts(Google_Service_Freebase_ReconcileGetCosts $costs)
 397    {
 398      $this->costs = $costs;
 399    }
 400  
 401    public function getCosts()
 402    {
 403      return $this->costs;
 404    }
 405  
 406    public function setMatch(Google_Service_Freebase_ReconcileCandidate $match)
 407    {
 408      $this->match = $match;
 409    }
 410  
 411    public function getMatch()
 412    {
 413      return $this->match;
 414    }
 415  
 416    public function setWarning($warning)
 417    {
 418      $this->warning = $warning;
 419    }
 420  
 421    public function getWarning()
 422    {
 423      return $this->warning;
 424    }
 425  }
 426  
 427  class Google_Service_Freebase_ReconcileGetCosts extends Google_Model
 428  {
 429    public $hits;
 430    public $ms;
 431  
 432    public function setHits($hits)
 433    {
 434      $this->hits = $hits;
 435    }
 436  
 437    public function getHits()
 438    {
 439      return $this->hits;
 440    }
 441  
 442    public function setMs($ms)
 443    {
 444      $this->ms = $ms;
 445    }
 446  
 447    public function getMs()
 448    {
 449      return $this->ms;
 450    }
 451  }
 452  
 453  class Google_Service_Freebase_ReconcileGetWarning extends Google_Model
 454  {
 455    public $location;
 456    public $message;
 457    public $reason;
 458  
 459    public function setLocation($location)
 460    {
 461      $this->location = $location;
 462    }
 463  
 464    public function getLocation()
 465    {
 466      return $this->location;
 467    }
 468  
 469    public function setMessage($message)
 470    {
 471      $this->message = $message;
 472    }
 473  
 474    public function getMessage()
 475    {
 476      return $this->message;
 477    }
 478  
 479    public function setReason($reason)
 480    {
 481      $this->reason = $reason;
 482    }
 483  
 484    public function getReason()
 485    {
 486      return $this->reason;
 487    }
 488  }


Generated: Fri Nov 28 20:29:05 2014 Cross-referenced by PHPXref 0.7.1