| 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 Analytify_Google_Service_Freebase extends Analytify_Google_Service |
| 33 |
{ |
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
private $base_methods; |
| 38 |
|
| 39 |
/** |
| 40 |
* Constructs the internal representation of the Freebase service. |
| 41 |
* |
| 42 |
* @param Analytify_Google_Client $client |
| 43 |
*/ |
| 44 |
public function __construct(Analytify_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 Analytify_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 Analytify_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), "Analytify_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 Analytify_Google_Service_Freebase_ReconcileCandidate extends Analytify_Google_Model |
| 289 |
{ |
| 290 |
public $confidence; |
| 291 |
public $lang; |
| 292 |
public $mid; |
| 293 |
public $name; |
| 294 |
protected $notableType = 'Analytify_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(Analytify_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 Analytify_Google_Service_Freebase_ReconcileCandidateNotable extends Analytify_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 Analytify_Google_Service_Freebase_ReconcileGet extends Analytify_Google_Collection |
| 375 |
{ |
| 376 |
protected $candidateType = 'Analytify_Google_Service_Freebase_ReconcileCandidate'; |
| 377 |
protected $candidateDataType = 'array'; |
| 378 |
protected $costsType = 'Analytify_Google_Service_Freebase_ReconcileGetCosts'; |
| 379 |
protected $costsDataType = ''; |
| 380 |
protected $matchType = 'Analytify_Google_Service_Freebase_ReconcileCandidate'; |
| 381 |
protected $matchDataType = ''; |
| 382 |
protected $warningType = 'Analytify_Google_Service_Freebase_ReconcileGetWarning'; |
| 383 |
protected $warningDataType = 'array'; |
| 384 |
|
| 385 |
public function setCandidate($candidate) |
| 386 |
{ |
| 387 |
$this->candidate = $candidate; |
| 388 |
} |
| 389 |
|
| 390 |
public function getCandidate() |
| 391 |
{ |
| 392 |
return $this->candidate; |
| 393 |
} |
| 394 |
|
| 395 |
public function setCosts(Analytify_Google_Service_Freebase_ReconcileGetCosts $costs) |
| 396 |
{ |
| 397 |
$this->costs = $costs; |
| 398 |
} |
| 399 |
|
| 400 |
public function getCosts() |
| 401 |
{ |
| 402 |
return $this->costs; |
| 403 |
} |
| 404 |
|
| 405 |
public function setMatch(Analytify_Google_Service_Freebase_ReconcileCandidate $match) |
| 406 |
{ |
| 407 |
$this->match = $match; |
| 408 |
} |
| 409 |
|
| 410 |
public function getMatch() |
| 411 |
{ |
| 412 |
return $this->match; |
| 413 |
} |
| 414 |
|
| 415 |
public function setWarning($warning) |
| 416 |
{ |
| 417 |
$this->warning = $warning; |
| 418 |
} |
| 419 |
|
| 420 |
public function getWarning() |
| 421 |
{ |
| 422 |
return $this->warning; |
| 423 |
} |
| 424 |
} |
| 425 |
|
| 426 |
class Analytify_Google_Service_Freebase_ReconcileGetCosts extends Analytify_Google_Model |
| 427 |
{ |
| 428 |
public $hits; |
| 429 |
public $ms; |
| 430 |
|
| 431 |
public function setHits($hits) |
| 432 |
{ |
| 433 |
$this->hits = $hits; |
| 434 |
} |
| 435 |
|
| 436 |
public function getHits() |
| 437 |
{ |
| 438 |
return $this->hits; |
| 439 |
} |
| 440 |
|
| 441 |
public function setMs($ms) |
| 442 |
{ |
| 443 |
$this->ms = $ms; |
| 444 |
} |
| 445 |
|
| 446 |
public function getMs() |
| 447 |
{ |
| 448 |
return $this->ms; |
| 449 |
} |
| 450 |
} |
| 451 |
|
| 452 |
class Analytify_Google_Service_Freebase_ReconcileGetWarning extends Analytify_Google_Model |
| 453 |
{ |
| 454 |
public $location; |
| 455 |
public $message; |
| 456 |
public $reason; |
| 457 |
|
| 458 |
public function setLocation($location) |
| 459 |
{ |
| 460 |
$this->location = $location; |
| 461 |
} |
| 462 |
|
| 463 |
public function getLocation() |
| 464 |
{ |
| 465 |
return $this->location; |
| 466 |
} |
| 467 |
|
| 468 |
public function setMessage($message) |
| 469 |
{ |
| 470 |
$this->message = $message; |
| 471 |
} |
| 472 |
|
| 473 |
public function getMessage() |
| 474 |
{ |
| 475 |
return $this->message; |
| 476 |
} |
| 477 |
|
| 478 |
public function setReason($reason) |
| 479 |
{ |
| 480 |
$this->reason = $reason; |
| 481 |
} |
| 482 |
|
| 483 |
public function getReason() |
| 484 |
{ |
| 485 |
return $this->reason; |
| 486 |
} |
| 487 |
} |
| 488 |
|