Code Duplication    Length = 19-20 lines in 2 locations

model/sparql/GenericSparql.php 2 locations

@@ 1411-1430 (lines=20) @@
1408
     * @param string $lang
1409
     * @return array array of labels (key: lang, val: label), or null if resource doesn't exist
1410
     */
1411
    public function queryLabel($uri, $lang) {
1412
        $query = $this->generateLabelQuery($uri, $lang);
1413
        $result = $this->query($query);
1414
        $ret = array();
1415
        foreach ($result as $row) {
1416
            if (!isset($row->label)) {
1417
                // existing concept but no labels
1418
                return array();
1419
            }
1420
            $ret[$row->label->getLang()] = $row->label;
1421
        }
1422
1423
        if (sizeof($ret) > 0) {
1424
            // existing concept, with label(s)
1425
            return $ret;
1426
        } else {
1427
            // nonexistent concept
1428
            return null;
1429
        }
1430
    }
1431
1432
    /**
1433
     * Generates a SPARQL query to retrieve the super properties of a given property URI.
@@ 1454-1472 (lines=19) @@
1451
     * @param string $uri URI of a propertyes
1452
     * @return array array super properties, or null if none exist
1453
     */
1454
    public function querySuperProperties($uri) {
1455
        $query = $this->generateSubPropertyOfQuery($uri);
1456
        $result = $this->query($query);
1457
        $ret = array();
1458
        foreach ($result as $row) {
1459
            if (isset($row->superProperty)) {
1460
                $ret[] = $row->superProperty->getUri();
1461
            }
1462
1463
        }
1464
1465
        if (sizeof($ret) > 0) {
1466
            // return result
1467
            return $ret;
1468
        } else {
1469
            // no result, return null
1470
            return null;
1471
        }
1472
    }
1473
1474
1475
    /**