| @@ 1451-1470 (lines=20) @@ | ||
| 1448 | * @param string $lang |
|
| 1449 | * @return array array of labels (key: lang, val: label), or null if resource doesn't exist |
|
| 1450 | */ |
|
| 1451 | public function queryLabel($uri, $lang) { |
|
| 1452 | $query = $this->generateLabelQuery($uri, $lang); |
|
| 1453 | $result = $this->query($query); |
|
| 1454 | $ret = array(); |
|
| 1455 | foreach ($result as $row) { |
|
| 1456 | if (!isset($row->label)) { |
|
| 1457 | // existing concept but no labels |
|
| 1458 | return array(); |
|
| 1459 | } |
|
| 1460 | $ret[$row->label->getLang()] = $row->label; |
|
| 1461 | } |
|
| 1462 | ||
| 1463 | if (sizeof($ret) > 0) { |
|
| 1464 | // existing concept, with label(s) |
|
| 1465 | return $ret; |
|
| 1466 | } else { |
|
| 1467 | // nonexistent concept |
|
| 1468 | return null; |
|
| 1469 | } |
|
| 1470 | } |
|
| 1471 | ||
| 1472 | /** |
|
| 1473 | * Query for skos:prefLabels, skos:altLabels and skos:hiddenLabels of a resource. |
|
| @@ 1519-1537 (lines=19) @@ | ||
| 1516 | * @param string $uri URI of a propertyes |
|
| 1517 | * @return array array super properties, or null if none exist |
|
| 1518 | */ |
|
| 1519 | public function querySuperProperties($uri) { |
|
| 1520 | $query = $this->generateSubPropertyOfQuery($uri); |
|
| 1521 | $result = $this->query($query); |
|
| 1522 | $ret = array(); |
|
| 1523 | foreach ($result as $row) { |
|
| 1524 | if (isset($row->superProperty)) { |
|
| 1525 | $ret[] = $row->superProperty->getUri(); |
|
| 1526 | } |
|
| 1527 | ||
| 1528 | } |
|
| 1529 | ||
| 1530 | if (sizeof($ret) > 0) { |
|
| 1531 | // return result |
|
| 1532 | return $ret; |
|
| 1533 | } else { |
|
| 1534 | // no result, return null |
|
| 1535 | return null; |
|
| 1536 | } |
|
| 1537 | } |
|
| 1538 | ||
| 1539 | ||
| 1540 | /** |
|