| @@ 1434-1453 (lines=20) @@ | ||
| 1431 | * @param string $lang |
|
| 1432 | * @return array array of labels (key: lang, val: label), or null if resource doesn't exist |
|
| 1433 | */ |
|
| 1434 | public function queryLabel($uri, $lang) { |
|
| 1435 | $query = $this->generateLabelQuery($uri, $lang); |
|
| 1436 | $result = $this->query($query); |
|
| 1437 | $ret = array(); |
|
| 1438 | foreach ($result as $row) { |
|
| 1439 | if (!isset($row->label)) { |
|
| 1440 | // existing concept but no labels |
|
| 1441 | return array(); |
|
| 1442 | } |
|
| 1443 | $ret[$row->label->getLang()] = $row->label; |
|
| 1444 | } |
|
| 1445 | ||
| 1446 | if (sizeof($ret) > 0) { |
|
| 1447 | // existing concept, with label(s) |
|
| 1448 | return $ret; |
|
| 1449 | } else { |
|
| 1450 | // nonexistent concept |
|
| 1451 | return null; |
|
| 1452 | } |
|
| 1453 | } |
|
| 1454 | ||
| 1455 | /** |
|
| 1456 | * Query for skos:prefLabels, skos:altLabels and skos:hiddenLabels of a resource. |
|
| @@ 1502-1520 (lines=19) @@ | ||
| 1499 | * @param string $uri URI of a propertyes |
|
| 1500 | * @return array array super properties, or null if none exist |
|
| 1501 | */ |
|
| 1502 | public function querySuperProperties($uri) { |
|
| 1503 | $query = $this->generateSubPropertyOfQuery($uri); |
|
| 1504 | $result = $this->query($query); |
|
| 1505 | $ret = array(); |
|
| 1506 | foreach ($result as $row) { |
|
| 1507 | if (isset($row->superProperty)) { |
|
| 1508 | $ret[] = $row->superProperty->getUri(); |
|
| 1509 | } |
|
| 1510 | ||
| 1511 | } |
|
| 1512 | ||
| 1513 | if (sizeof($ret) > 0) { |
|
| 1514 | // return result |
|
| 1515 | return $ret; |
|
| 1516 | } else { |
|
| 1517 | // no result, return null |
|
| 1518 | return null; |
|
| 1519 | } |
|
| 1520 | } |
|
| 1521 | ||
| 1522 | ||
| 1523 | /** |
|