@@ -575,9 +575,9 @@ discard block |
||
| 575 | 575 | $vocid = $request->getVocab()->getId(); |
| 576 | 576 | return $this->returnError('404', 'Not Found', "No download source URL known for vocabulary $vocid in language $dataLang"); |
| 577 | 577 | } |
| 578 | - } else { |
|
| 578 | + } else { |
|
| 579 | 579 | header("Location: " . $urls[$format]); |
| 580 | - } |
|
| 580 | + } |
|
| 581 | 581 | } |
| 582 | 582 | |
| 583 | 583 | private function returnDataResults($results, $format) { |
@@ -1100,15 +1100,15 @@ discard block |
||
| 1100 | 1100 | foreach($changeList as $conceptInfo) { |
| 1101 | 1101 | if (array_key_exists('date', $conceptInfo)) { |
| 1102 | 1102 | $simpleChangeList[] = array( 'uri' => $conceptInfo['uri'], |
| 1103 | - 'prefLabel' => $conceptInfo['prefLabel'], |
|
| 1104 | - 'date' => $conceptInfo['date']->format("Y-m-d\TH:i:sO") ); |
|
| 1103 | + 'prefLabel' => $conceptInfo['prefLabel'], |
|
| 1104 | + 'date' => $conceptInfo['date']->format("Y-m-d\TH:i:sO") ); |
|
| 1105 | 1105 | } |
| 1106 | 1106 | } |
| 1107 | 1107 | return $this->returnJson(array_merge_recursive($this->context, |
| 1108 | 1108 | array('@context' => array( '@language' => $request->getLang(), |
| 1109 | - 'prefLabel' => 'skos:prefLabel', |
|
| 1110 | - 'xsd' => 'http://www.w3.org/2001/XMLSchema#', |
|
| 1111 | - 'date' => array( '@id' => 'http://purl.org/dc/terms/date', '@type' => 'http://www.w3.org/2001/XMLSchema#dateTime') ) |
|
| 1109 | + 'prefLabel' => 'skos:prefLabel', |
|
| 1110 | + 'xsd' => 'http://www.w3.org/2001/XMLSchema#', |
|
| 1111 | + 'date' => array( '@id' => 'http://purl.org/dc/terms/date', '@type' => 'http://www.w3.org/2001/XMLSchema#dateTime') ) |
|
| 1112 | 1112 | ), |
| 1113 | 1113 | array('changeList' => $simpleChangeList))); |
| 1114 | 1114 | |
@@ -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 |
@@ -420,6 +427,10 @@ discard block |
||
| 420 | 427 | return $this->returnJson($ret); |
| 421 | 428 | } |
| 422 | 429 | |
| 430 | + /** |
|
| 431 | + * @param string $label |
|
| 432 | + * @param string $lang |
|
| 433 | + */ |
|
| 423 | 434 | private function findLookupHits($results, $label, $lang) |
| 424 | 435 | { |
| 425 | 436 | $hits = array(); |
@@ -481,6 +492,9 @@ discard block |
||
| 481 | 492 | return $hits; |
| 482 | 493 | } |
| 483 | 494 | |
| 495 | + /** |
|
| 496 | + * @param string $lang |
|
| 497 | + */ |
|
| 484 | 498 | private function transformLookupResults($lang, $hits) |
| 485 | 499 | { |
| 486 | 500 | if (sizeof($hits) == 0) { |
@@ -555,6 +569,9 @@ discard block |
||
| 555 | 569 | return $this->returnJson($ret); |
| 556 | 570 | } |
| 557 | 571 | |
| 572 | + /** |
|
| 573 | + * @param Request $request |
|
| 574 | + */ |
|
| 558 | 575 | private function redirectToVocabData($request) { |
| 559 | 576 | $urls = $request->getVocab()->getConfig()->getDataURLs(); |
| 560 | 577 | if (sizeof($urls) == 0) { |
@@ -580,6 +597,10 @@ discard block |
||
| 580 | 597 | } |
| 581 | 598 | } |
| 582 | 599 | |
| 600 | + /** |
|
| 601 | + * @param string $results |
|
| 602 | + * @param string $format |
|
| 603 | + */ |
|
| 583 | 604 | private function returnDataResults($results, $format) { |
| 584 | 605 | if ($format == 'application/ld+json' || $format == 'application/json') { |
| 585 | 606 | // further compact JSON-LD document using a context |
@@ -791,6 +812,12 @@ discard block |
||
| 791 | 812 | return $this->returnJson($ret); |
| 792 | 813 | } |
| 793 | 814 | |
| 815 | + /** |
|
| 816 | + * @param string $uri |
|
| 817 | + * @param string $lang |
|
| 818 | + * @param string $propname |
|
| 819 | + * @param string $propuri |
|
| 820 | + */ |
|
| 794 | 821 | private function transformPropertyResults($uri, $lang, $objects, $propname, $propuri) |
| 795 | 822 | { |
| 796 | 823 | $results = array(); |
@@ -805,6 +832,14 @@ discard block |
||
| 805 | 832 | ); |
| 806 | 833 | } |
| 807 | 834 | |
| 835 | + /** |
|
| 836 | + * @param string $uri |
|
| 837 | + * @param string $lang |
|
| 838 | + * @param string $tpropname |
|
| 839 | + * @param string $tpropuri |
|
| 840 | + * @param string $dpropname |
|
| 841 | + * @param string $dpropuri |
|
| 842 | + */ |
|
| 808 | 843 | private function transformTransitivePropertyResults($uri, $lang, $objects, $tpropname, $tpropuri, $dpropname, $dpropuri) |
| 809 | 844 | { |
| 810 | 845 | $results = array(); |
@@ -1095,6 +1130,7 @@ discard block |
||
| 1095 | 1130 | * @param Request $request |
| 1096 | 1131 | * @param int $offset starting index offset |
| 1097 | 1132 | * @param int $limit maximum number of concepts to return |
| 1133 | + * @param string $prop |
|
| 1098 | 1134 | * @return object json-ld wrapped list of changed concepts |
| 1099 | 1135 | */ |
| 1100 | 1136 | private function changedConcepts($request, $prop, $offset, $limit) |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | |
| 152 | 152 | /** |
| 153 | 153 | * Returns the graph instance |
| 154 | - * @return object EasyRDF graph instance. |
|
| 154 | + * @return string|null EasyRDF graph instance. |
|
| 155 | 155 | */ |
| 156 | 156 | public function getGraph() { |
| 157 | 157 | return $this->graph; |
@@ -286,6 +286,7 @@ discard block |
||
| 286 | 286 | /** |
| 287 | 287 | * Counts the number of concepts in a easyRDF graph with a specific language. |
| 288 | 288 | * @param array $langs Languages to query for |
| 289 | + * @param string[] $classes |
|
| 289 | 290 | * @return Array containing count of concepts for each language and property. |
| 290 | 291 | */ |
| 291 | 292 | public function countLangConcepts($langs, $classes = null) { |
@@ -470,7 +471,7 @@ discard block |
||
| 470 | 471 | * Returns information (as a graph) for one or more concept URIs |
| 471 | 472 | * @param mixed $uris concept URI (string) or array of URIs |
| 472 | 473 | * @param string|null $arrayClass the URI for thesaurus array class, or null if not used |
| 473 | - * @param \Vocabulary[]|null $vocabs vocabularies to target |
|
| 474 | + * @param Vocabulary[] $vocabs vocabularies to target |
|
| 474 | 475 | * @return \EasyRdf\Graph |
| 475 | 476 | */ |
| 476 | 477 | public function queryConceptInfoGraph($uris, $arrayClass = null, $vocabs = array()) { |
@@ -486,7 +487,7 @@ discard block |
||
| 486 | 487 | |
| 487 | 488 | /** |
| 488 | 489 | * Returns information (as an array of Concept objects) for one or more concept URIs |
| 489 | - * @param mixed $uris concept URI (string) or array of URIs |
|
| 490 | + * @param string $uris concept URI (string) or array of URIs |
|
| 490 | 491 | * @param string|null $arrayClass the URI for thesaurus array class, or null if not used |
| 491 | 492 | * @param \Vocabulary[] $vocabs vocabularies to target |
| 492 | 493 | * @param string|null $clang content language |
@@ -704,7 +705,7 @@ discard block |
||
| 704 | 705 | |
| 705 | 706 | /** |
| 706 | 707 | * Generate a VALUES clause for limiting the targeted graphs. |
| 707 | - * @param Vocabulary[]|null $vocabs array of Vocabulary objects to target |
|
| 708 | + * @param Vocabulary[] $vocabs array of Vocabulary objects to target |
|
| 708 | 709 | * @return string VALUES clause, or "" if not necessary to limit |
| 709 | 710 | */ |
| 710 | 711 | protected function formatValuesGraph($vocabs) { |
@@ -886,6 +887,7 @@ discard block |
||
| 886 | 887 | * @param string $searchLang language code used for matching labels (null means any language) |
| 887 | 888 | * @param string[] $props properties to target e.g. array('skos:prefLabel','skos:altLabel') |
| 888 | 889 | * @param boolean $unique restrict results to unique concepts (default: false) |
| 890 | + * @param string $filterGraph |
|
| 889 | 891 | * @return string sparql query |
| 890 | 892 | */ |
| 891 | 893 | 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) { |
@@ -1361,6 +1364,7 @@ discard block |
||
| 1361 | 1364 | /** |
| 1362 | 1365 | * Query for the first characters (letter or otherwise) of the labels in the particular language. |
| 1363 | 1366 | * @param string $lang language |
| 1367 | + * @param string[] $classes |
|
| 1364 | 1368 | * @return array array of characters |
| 1365 | 1369 | */ |
| 1366 | 1370 | public function queryFirstCharacters($lang, $classes = null) { |
@@ -1731,7 +1735,7 @@ discard block |
||
| 1731 | 1735 | /** |
| 1732 | 1736 | * Query a single transitive property of a concept. |
| 1733 | 1737 | * @param string $uri |
| 1734 | - * @param array $props the property/properties. |
|
| 1738 | + * @param string[] $props the property/properties. |
|
| 1735 | 1739 | * @param string $lang |
| 1736 | 1740 | * @param string $fallbacklang language to use if label is not available in the preferred language |
| 1737 | 1741 | * @param integer $limit |
@@ -2207,7 +2211,6 @@ discard block |
||
| 2207 | 2211 | |
| 2208 | 2212 | /** |
| 2209 | 2213 | * Generates the sparql query for queryChangeList. |
| 2210 | - * @param string $property the property uri pointing to timestamps, eg. 'dc:modified' |
|
| 2211 | 2214 | * @param string $lang language of labels to return |
| 2212 | 2215 | * @param int $offset offset of results to retrieve; 0 for beginning of list |
| 2213 | 2216 | * @param int $limit maximum number of results to return |
@@ -2260,10 +2263,10 @@ discard block |
||
| 2260 | 2263 | |
| 2261 | 2264 | /** |
| 2262 | 2265 | * return a list of recently changed or entirely new concepts |
| 2263 | - * @param string $property the property uri pointing to timestamps, eg. 'dc:modified' |
|
| 2264 | 2266 | * @param string $lang language of labels to return |
| 2265 | 2267 | * @param int $offset offset of results to retrieve; 0 for beginning of list |
| 2266 | 2268 | * @param int $limit maximum number of results to return |
| 2269 | + * @param string $prop |
|
| 2267 | 2270 | * @return array Result array |
| 2268 | 2271 | */ |
| 2269 | 2272 | public function queryChangeList($prop, $lang, $offset, $limit) { |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | * Get the localname of a concept in the vocabulary. If the URI is not |
| 132 | 132 | * in the URI space of this vocabulary, return the full URI. |
| 133 | 133 | * |
| 134 | - * @param $uri string full URI of concept |
|
| 134 | + * @param string $uri string full URI of concept |
|
| 135 | 135 | * @return string local name of concept, or original full URI if the local name cannot be determined |
| 136 | 136 | */ |
| 137 | 137 | public function getLocalName($uri) |
@@ -303,6 +303,8 @@ discard block |
||
| 303 | 303 | |
| 304 | 304 | /** |
| 305 | 305 | * Counts the statistics of the vocabulary. |
| 306 | + * @param string $array |
|
| 307 | + * @param string $group |
|
| 306 | 308 | * @return array of the concept/group counts |
| 307 | 309 | */ |
| 308 | 310 | public function getStatistics($lang = '', $array=null, $group=null) |
@@ -342,6 +344,7 @@ discard block |
||
| 342 | 344 | /** |
| 343 | 345 | * Gets the child relations of a concept and whether these children have more children. |
| 344 | 346 | * @param string $uri |
| 347 | + * @param string $lang |
|
| 345 | 348 | */ |
| 346 | 349 | public function getConceptChildren($uri, $lang) |
| 347 | 350 | { |
@@ -450,6 +453,8 @@ discard block |
||
| 450 | 453 | /** |
| 451 | 454 | * Lists the concepts available in the concept group. |
| 452 | 455 | * @param $clname |
| 456 | + * @param string $glname |
|
| 457 | + * @param string $clang |
|
| 453 | 458 | * @return array |
| 454 | 459 | */ |
| 455 | 460 | public function listConceptGroupContents($glname, $clang) |
@@ -476,7 +481,7 @@ discard block |
||
| 476 | 481 | /** |
| 477 | 482 | * Returns the letters of the alphabet which have been used in this vocabulary. |
| 478 | 483 | * The returned letters may also include specials such as '0-9' (digits) and '!*' (special characters). |
| 479 | - * @param $clang content language |
|
| 484 | + * @param string $clang content language |
|
| 480 | 485 | * @return array array of letters |
| 481 | 486 | */ |
| 482 | 487 | public function getAlphabet($clang) |
@@ -511,6 +516,7 @@ discard block |
||
| 511 | 516 | * Also the special tokens '0-9' (digits), '!*' (special characters) and '*' |
| 512 | 517 | * (everything) are supported. |
| 513 | 518 | * @param $letter letter (or special token) to search for |
| 519 | + * @param string $clang |
|
| 514 | 520 | */ |
| 515 | 521 | public function searchConceptsAlphabetical($letter, $limit = null, $offset = null, $clang = null) |
| 516 | 522 | { |
@@ -626,6 +632,9 @@ discard block |
||
| 626 | 632 | return $this->getSparql()->queryChangeList($prop, $clang, $offset, $limit); |
| 627 | 633 | } |
| 628 | 634 | |
| 635 | + /** |
|
| 636 | + * @param string $lang |
|
| 637 | + */ |
|
| 629 | 638 | public function getTitle($lang=null) { |
| 630 | 639 | return $this->config->getTitle($lang); |
| 631 | 640 | } |
@@ -594,10 +594,10 @@ |
||
| 594 | 594 | } |
| 595 | 595 | |
| 596 | 596 | /** |
| 597 | - * Formats the list of concepts as labels arranged by modification month |
|
| 598 | - * @param Array $changeList |
|
| 599 | - * @param string $lang the language for displaying dates in the change list |
|
| 600 | - */ |
|
| 597 | + * Formats the list of concepts as labels arranged by modification month |
|
| 598 | + * @param Array $changeList |
|
| 599 | + * @param string $lang the language for displaying dates in the change list |
|
| 600 | + */ |
|
| 601 | 601 | public function formatChangeList($changeList, $lang) |
| 602 | 602 | { |
| 603 | 603 | $formatByDate = array(); |