@@ -76,10 +76,12 @@ |
||
| 76 | 76 | */ |
| 77 | 77 | public function getUriSpace() |
| 78 | 78 | { |
| 79 | - if ($this->urispace === null) // initialize cache |
|
| 79 | + if ($this->urispace === null) { |
|
| 80 | + // initialize cache |
|
| 80 | 81 | { |
| 81 | 82 | $this->urispace = $this->resource->getLiteral('void:uriSpace')->getValue(); |
| 82 | 83 | } |
| 84 | + } |
|
| 83 | 85 | |
| 84 | 86 | return $this->urispace; |
| 85 | 87 | } |
@@ -271,6 +271,8 @@ discard block |
||
| 271 | 271 | |
| 272 | 272 | /** |
| 273 | 273 | * Counts the statistics of the vocabulary. |
| 274 | + * @param string $array |
|
| 275 | + * @param string $group |
|
| 274 | 276 | * @return array of the concept/group counts |
| 275 | 277 | */ |
| 276 | 278 | public function getStatistics($lang = '', $array=null, $group=null) |
@@ -310,6 +312,7 @@ discard block |
||
| 310 | 312 | /** |
| 311 | 313 | * Gets the child relations of a concept and whether these children have more children. |
| 312 | 314 | * @param string $uri |
| 315 | + * @param string $lang |
|
| 313 | 316 | */ |
| 314 | 317 | public function getConceptChildren($uri, $lang) |
| 315 | 318 | { |
@@ -418,6 +421,8 @@ discard block |
||
| 418 | 421 | /** |
| 419 | 422 | * Lists the concepts available in the concept group. |
| 420 | 423 | * @param $clname |
| 424 | + * @param string $glname |
|
| 425 | + * @param string $clang |
|
| 421 | 426 | * @return array |
| 422 | 427 | */ |
| 423 | 428 | public function listConceptGroupContents($glname, $clang) |
@@ -585,6 +590,7 @@ discard block |
||
| 585 | 590 | * Returns a list of recently changed or entirely new concepts. |
| 586 | 591 | * @param string $clang content language for the labels |
| 587 | 592 | * @param string $lang UI language for the dates |
| 593 | + * @param string $prop |
|
| 588 | 594 | * @return Array |
| 589 | 595 | */ |
| 590 | 596 | public function getChangeList($prop, $clang, $lang, $offset) |
@@ -598,6 +604,9 @@ discard block |
||
| 598 | 604 | return $bydate; |
| 599 | 605 | } |
| 600 | 606 | |
| 607 | + /** |
|
| 608 | + * @param string $lang |
|
| 609 | + */ |
|
| 601 | 610 | public function getTitle($lang=null) { |
| 602 | 611 | return $this->config->getTitle($lang); |
| 603 | 612 | } |
@@ -10,6 +10,9 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | class VocabularyCategory extends DataObject |
| 12 | 12 | { |
| 13 | + /** |
|
| 14 | + * @param Model $model |
|
| 15 | + */ |
|
| 13 | 16 | public function __construct($model, $resource) |
| 14 | 17 | { |
| 15 | 18 | if (!($model instanceof Model)) { |
@@ -55,6 +55,7 @@ |
||
| 55 | 55 | |
| 56 | 56 | /** |
| 57 | 57 | * Steps back, restoring the previous character or statement read() to the input buffer. |
| 58 | + * @param string $chars |
|
| 58 | 59 | */ |
| 59 | 60 | protected function unread($chars) |
| 60 | 61 | { |
@@ -79,10 +79,12 @@ |
||
| 79 | 79 | if ($sortable !== null) { |
| 80 | 80 | uksort($sortable, array($this, 'mycompare')); |
| 81 | 81 | foreach ($sortable as $prop => $vals) { |
| 82 | - if (is_array($prop)) // the ConceptProperty objects have their own sorting methods |
|
| 82 | + if (is_array($prop)) { |
|
| 83 | + // the ConceptProperty objects have their own sorting methods |
|
| 83 | 84 | { |
| 84 | 85 | ksort($sortable[$prop]); |
| 85 | 86 | } |
| 87 | + } |
|
| 86 | 88 | } |
| 87 | 89 | } |
| 88 | 90 | return $sortable; |
@@ -46,12 +46,16 @@ discard block |
||
| 46 | 46 | $this->client = new EasyRdf\Sparql\Client($endpoint); |
| 47 | 47 | |
| 48 | 48 | // set graphClause so that it can be used by all queries |
| 49 | - if ($this->isDefaultEndpoint()) // default endpoint; query any graph (and catch it in a variable) |
|
| 49 | + if ($this->isDefaultEndpoint()) { |
|
| 50 | + // default endpoint; query any graph (and catch it in a variable) |
|
| 50 | 51 | { |
| 51 | 52 | $this->graphClause = "GRAPH $graph"; |
| 52 | - } elseif ($graph) // query a specific graph |
|
| 53 | + } |
|
| 54 | + } elseif ($graph) { |
|
| 55 | + // query a specific graph |
|
| 53 | 56 | { |
| 54 | 57 | $this->graphClause = "GRAPH <$graph>"; |
| 58 | + } |
|
| 55 | 59 | } else // query the default graph |
| 56 | 60 | { |
| 57 | 61 | $this->graphClause = ""; |
@@ -100,8 +104,9 @@ discard block |
||
| 100 | 104 | } |
| 101 | 105 | } |
| 102 | 106 | foreach ($graphs as $graph) { |
| 103 | - if($graph !== NULL) |
|
| 104 | - $clause .= "FROM NAMED <$graph> "; |
|
| 107 | + if($graph !== NULL) { |
|
| 108 | + $clause .= "FROM NAMED <$graph> "; |
|
| 109 | + } |
|
| 105 | 110 | } |
| 106 | 111 | return $clause; |
| 107 | 112 | } |
@@ -1847,8 +1852,7 @@ discard block |
||
| 1847 | 1852 | if (sizeof($ret) > 0) { |
| 1848 | 1853 | // existing concept, with children |
| 1849 | 1854 | return $ret; |
| 1850 | - } |
|
| 1851 | - else { |
|
| 1855 | + } else { |
|
| 1852 | 1856 | // nonexistent concept |
| 1853 | 1857 | return null; |
| 1854 | 1858 | } |
@@ -262,8 +262,8 @@ discard block |
||
| 262 | 262 | |
| 263 | 263 | /** |
| 264 | 264 | * Used to generate the BIND + FILTER part related to the languages |
| 265 | - * @param $varnameInput the name of the variable from which to extract the language |
|
| 266 | - * @param $varnameOutput the name of the variable that will contain the language tag |
|
| 265 | + * @param string $varnameInput the name of the variable from which to extract the language |
|
| 266 | + * @param string $varnameOutput the name of the variable that will contain the language tag |
|
| 267 | 267 | * @param array $values languages to use in the FILTER |
| 268 | 268 | * @return string part of the sparql query dealing wit the languages |
| 269 | 269 | */ |
@@ -312,6 +312,7 @@ discard block |
||
| 312 | 312 | /** |
| 313 | 313 | * Counts the number of concepts in a easyRDF graph with a specific language. |
| 314 | 314 | * @param array $langs Languages to query for |
| 315 | + * @param string[] $classes |
|
| 315 | 316 | * @return Array containing count of concepts for each language and property. |
| 316 | 317 | */ |
| 317 | 318 | public function countLangConcepts($langs, $classes = null) { |
@@ -496,7 +497,7 @@ discard block |
||
| 496 | 497 | * Returns information (as a graph) for one or more concept URIs |
| 497 | 498 | * @param mixed $uris concept URI (string) or array of URIs |
| 498 | 499 | * @param string|null $arrayClass the URI for thesaurus array class, or null if not used |
| 499 | - * @param \Vocabulary[]|null $vocabs vocabularies to target |
|
| 500 | + * @param Vocabulary[] $vocabs vocabularies to target |
|
| 500 | 501 | * @return \EasyRdf\Graph |
| 501 | 502 | */ |
| 502 | 503 | public function queryConceptInfoGraph($uris, $arrayClass = null, $vocabs = array()) { |
@@ -512,7 +513,7 @@ discard block |
||
| 512 | 513 | |
| 513 | 514 | /** |
| 514 | 515 | * Returns information (as an array of Concept objects) for one or more concept URIs |
| 515 | - * @param mixed $uris concept URI (string) or array of URIs |
|
| 516 | + * @param string $uris concept URI (string) or array of URIs |
|
| 516 | 517 | * @param string|null $arrayClass the URI for thesaurus array class, or null if not used |
| 517 | 518 | * @param \Vocabulary[] $vocabs vocabularies to target |
| 518 | 519 | * @param string|null $clang content language |
@@ -727,7 +728,7 @@ discard block |
||
| 727 | 728 | |
| 728 | 729 | /** |
| 729 | 730 | * Generate a VALUES clause for limiting the targeted graphs. |
| 730 | - * @param Vocabulary[]|null $vocabs array of Vocabulary objects to target |
|
| 731 | + * @param Vocabulary[] $vocabs array of Vocabulary objects to target |
|
| 731 | 732 | * @return string VALUES clause, or "" if not necessary to limit |
| 732 | 733 | */ |
| 733 | 734 | protected function formatValuesGraph($vocabs) { |
@@ -907,6 +908,7 @@ discard block |
||
| 907 | 908 | * @param string $searchLang language code used for matching labels (null means any language) |
| 908 | 909 | * @param string[] $props properties to target e.g. array('skos:prefLabel','skos:altLabel') |
| 909 | 910 | * @param boolean $unique restrict results to unique concepts (default: false) |
| 911 | + * @param string $filterGraph |
|
| 910 | 912 | * @return string sparql query |
| 911 | 913 | */ |
| 912 | 914 | protected function generateConceptSearchQueryInner($term, $lang, $searchLang, $props, $unique, $filterGraph) |
@@ -1181,6 +1183,7 @@ discard block |
||
| 1181 | 1183 | /** |
| 1182 | 1184 | * Generates sparql query clauses used for creating the alphabetical index. |
| 1183 | 1185 | * @param string $letter the letter (or special class) to search for |
| 1186 | + * @param string $lang |
|
| 1184 | 1187 | * @return array of sparql query clause strings |
| 1185 | 1188 | */ |
| 1186 | 1189 | private function formatFilterConditions($letter, $lang) { |
@@ -1348,6 +1351,7 @@ discard block |
||
| 1348 | 1351 | /** |
| 1349 | 1352 | * Query for the first characters (letter or otherwise) of the labels in the particular language. |
| 1350 | 1353 | * @param string $lang language |
| 1354 | + * @param string[] $classes |
|
| 1351 | 1355 | * @return array array of characters |
| 1352 | 1356 | */ |
| 1353 | 1357 | public function queryFirstCharacters($lang, $classes = null) { |
@@ -1670,7 +1674,7 @@ discard block |
||
| 1670 | 1674 | /** |
| 1671 | 1675 | * Query a single transitive property of a concept. |
| 1672 | 1676 | * @param string $uri |
| 1673 | - * @param array $props the property/properties. |
|
| 1677 | + * @param string[] $props the property/properties. |
|
| 1674 | 1678 | * @param string $lang |
| 1675 | 1679 | * @param string $fallbacklang language to use if label is not available in the preferred language |
| 1676 | 1680 | * @param integer $limit |
@@ -3,6 +3,9 @@ |
||
| 3 | 3 | class LabelSkosXL extends DataObject |
| 4 | 4 | { |
| 5 | 5 | |
| 6 | + /** |
|
| 7 | + * @param Model $model |
|
| 8 | + */ |
|
| 6 | 9 | public function __construct($model, $resource) |
| 7 | 10 | { |
| 8 | 11 | parent::__construct($model, $resource); |
@@ -69,8 +69,9 @@ |
||
| 69 | 69 | public function getSearchTerm() |
| 70 | 70 | { |
| 71 | 71 | $term = $this->request->getQueryParamRaw('q') ? $this->request->getQueryParamRaw('q') : $this->request->getQueryParamRaw('query'); |
| 72 | - if (!$term && $this->rest) |
|
| 73 | - $term = $this->request->getQueryParamRaw('label'); |
|
| 72 | + if (!$term && $this->rest) { |
|
| 73 | + $term = $this->request->getQueryParamRaw('label'); |
|
| 74 | + } |
|
| 74 | 75 | $term = trim($term); // surrounding whitespace is not considered significant |
| 75 | 76 | if ($this->rest) { |
| 76 | 77 | return $term; |
@@ -400,7 +400,9 @@ discard block |
||
| 400 | 400 | $hits[] = $res; |
| 401 | 401 | } |
| 402 | 402 | } |
| 403 | - if (sizeof($hits) > 0) return $hits; |
|
| 403 | + if (sizeof($hits) > 0) { |
|
| 404 | + return $hits; |
|
| 405 | + } |
|
| 404 | 406 | |
| 405 | 407 | // case 2: case-insensitive match on preferred label |
| 406 | 408 | foreach ($results as $res) { |
@@ -408,7 +410,9 @@ discard block |
||
| 408 | 410 | $hits[] = $res; |
| 409 | 411 | } |
| 410 | 412 | } |
| 411 | - if (sizeof($hits) > 0) return $hits; |
|
| 413 | + if (sizeof($hits) > 0) { |
|
| 414 | + return $hits; |
|
| 415 | + } |
|
| 412 | 416 | |
| 413 | 417 | if ($lang === null) { |
| 414 | 418 | // case 1A: exact match on preferred label in any language |
@@ -419,7 +423,9 @@ discard block |
||
| 419 | 423 | $hits[] = $res; |
| 420 | 424 | } |
| 421 | 425 | } |
| 422 | - if (sizeof($hits) > 0) return $hits; |
|
| 426 | + if (sizeof($hits) > 0) { |
|
| 427 | + return $hits; |
|
| 428 | + } |
|
| 423 | 429 | |
| 424 | 430 | // case 2A: case-insensitive match on preferred label in any language |
| 425 | 431 | foreach ($results as $res) { |
@@ -429,7 +435,9 @@ discard block |
||
| 429 | 435 | $hits[] = $res; |
| 430 | 436 | } |
| 431 | 437 | } |
| 432 | - if (sizeof($hits) > 0) return $hits; |
|
| 438 | + if (sizeof($hits) > 0) { |
|
| 439 | + return $hits; |
|
| 440 | + } |
|
| 433 | 441 | } |
| 434 | 442 | |
| 435 | 443 | // case 3: exact match on alternate label |
@@ -438,7 +446,9 @@ discard block |
||
| 438 | 446 | $hits[] = $res; |
| 439 | 447 | } |
| 440 | 448 | } |
| 441 | - if (sizeof($hits) > 0) return $hits; |
|
| 449 | + if (sizeof($hits) > 0) { |
|
| 450 | + return $hits; |
|
| 451 | + } |
|
| 442 | 452 | |
| 443 | 453 | |
| 444 | 454 | // case 4: case-insensitive match on alternate label |
@@ -447,7 +457,9 @@ discard block |
||
| 447 | 457 | $hits[] = $res; |
| 448 | 458 | } |
| 449 | 459 | } |
| 450 | - if (sizeof($hits) > 0) return $hits; |
|
| 460 | + if (sizeof($hits) > 0) { |
|
| 461 | + return $hits; |
|
| 462 | + } |
|
| 451 | 463 | |
| 452 | 464 | return $hits; |
| 453 | 465 | } |
@@ -97,6 +97,9 @@ discard block |
||
| 97 | 97 | return $this->returnJson($ret); |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | + /** |
|
| 101 | + * @param Request $request |
|
| 102 | + */ |
|
| 100 | 103 | private function constructSearchParameters($request) |
| 101 | 104 | { |
| 102 | 105 | $parameters = new ConceptSearchParameters($request, $this->model->getConfig(), true); |
@@ -112,6 +115,10 @@ discard block |
||
| 112 | 115 | return $parameters; |
| 113 | 116 | } |
| 114 | 117 | |
| 118 | + /** |
|
| 119 | + * @param Request $request |
|
| 120 | + * @param ConceptSearchParameters $parameters |
|
| 121 | + */ |
|
| 115 | 122 | private function transformSearchResults($request, $results, $parameters) |
| 116 | 123 | { |
| 117 | 124 | // before serializing to JSON, get rid of the Vocabulary object that came with each resource |
@@ -408,6 +415,10 @@ discard block |
||
| 408 | 415 | return $this->returnJson($ret); |
| 409 | 416 | } |
| 410 | 417 | |
| 418 | + /** |
|
| 419 | + * @param string $label |
|
| 420 | + * @param string $lang |
|
| 421 | + */ |
|
| 411 | 422 | private function findLookupHits($results, $label, $lang) |
| 412 | 423 | { |
| 413 | 424 | $hits = array(); |
@@ -469,6 +480,9 @@ discard block |
||
| 469 | 480 | return $hits; |
| 470 | 481 | } |
| 471 | 482 | |
| 483 | + /** |
|
| 484 | + * @param string $lang |
|
| 485 | + */ |
|
| 472 | 486 | private function transformLookupResults($lang, $hits) |
| 473 | 487 | { |
| 474 | 488 | if (sizeof($hits) == 0) { |
@@ -540,6 +554,9 @@ discard block |
||
| 540 | 554 | return $this->returnJson($ret); |
| 541 | 555 | } |
| 542 | 556 | |
| 557 | + /** |
|
| 558 | + * @param Request $request |
|
| 559 | + */ |
|
| 543 | 560 | private function redirectToVocabData($request) { |
| 544 | 561 | $urls = $request->getVocab()->getConfig()->getDataURLs(); |
| 545 | 562 | if (sizeof($urls) == 0) { |
@@ -555,6 +572,9 @@ discard block |
||
| 555 | 572 | header("Location: " . $urls[$format]); |
| 556 | 573 | } |
| 557 | 574 | |
| 575 | + /** |
|
| 576 | + * @param string $format |
|
| 577 | + */ |
|
| 558 | 578 | private function returnDataResults($results, $format) { |
| 559 | 579 | if ($format == 'application/ld+json' || $format == 'application/json') { |
| 560 | 580 | // further compact JSON-LD document using a context |
@@ -650,6 +670,12 @@ discard block |
||
| 650 | 670 | return $this->returnJson($ret); |
| 651 | 671 | } |
| 652 | 672 | |
| 673 | + /** |
|
| 674 | + * @param string $uri |
|
| 675 | + * @param string $lang |
|
| 676 | + * @param string $propname |
|
| 677 | + * @param string $propuri |
|
| 678 | + */ |
|
| 653 | 679 | private function transformPropertyResults($uri, $lang, $objects, $propname, $propuri) |
| 654 | 680 | { |
| 655 | 681 | $results = array(); |
@@ -665,6 +691,14 @@ discard block |
||
| 665 | 691 | return $ret; |
| 666 | 692 | } |
| 667 | 693 | |
| 694 | + /** |
|
| 695 | + * @param string $uri |
|
| 696 | + * @param string $lang |
|
| 697 | + * @param string $tpropname |
|
| 698 | + * @param string $tpropuri |
|
| 699 | + * @param string $dpropname |
|
| 700 | + * @param string $dpropuri |
|
| 701 | + */ |
|
| 668 | 702 | private function transformTransitivePropertyResults($uri, $lang, $objects, $tpropname, $tpropuri, $dpropname, $dpropuri) |
| 669 | 703 | { |
| 670 | 704 | $results = array(); |
@@ -40,8 +40,7 @@ |
||
| 40 | 40 | $ret[$name] = array(); |
| 41 | 41 | if ($raw) { |
| 42 | 42 | $ret[$name] = $files[$type]; |
| 43 | - } |
|
| 44 | - else { |
|
| 43 | + } else { |
|
| 45 | 44 | foreach ($files[$type] as $file) { |
| 46 | 45 | array_push($ret[$name], 'plugins/' . $name . '/' . $file); |
| 47 | 46 | } |