Code Duplication    Length = 19-20 lines in 2 locations

model/sparql/GenericSparql.php 2 locations

@@ 1355-1374 (lines=20) @@
1352
     * @param string $lang
1353
     * @return array array of labels (key: lang, val: label), or null if resource doesn't exist
1354
     */
1355
    public function queryLabel($uri, $lang) {
1356
        $query = $this->generateLabelQuery($uri, $lang);
1357
        $result = $this->query($query);
1358
        $ret = array();
1359
        foreach ($result as $row) {
1360
            if (!isset($row->label)) {
1361
                // existing concept but no labels
1362
                return array();
1363
            }
1364
            $ret[$row->label->getLang()] = $row->label;
1365
        }
1366
1367
        if (sizeof($ret) > 0) {
1368
            // existing concept, with label(s)
1369
            return $ret;
1370
        } else {
1371
            // nonexistent concept
1372
            return null;
1373
        }
1374
    }
1375
    
1376
    /**
1377
     * Generates a SPARQL query to retrieve the super properties of a given property URI.
@@ 1398-1416 (lines=19) @@
1395
     * @param string $uri URI of a propertyes
1396
     * @return array array super properties, or null if none exist
1397
     */
1398
    public function querySuperProperties($uri) {
1399
        $query = $this->generateSubPropertyOfQuery($uri);
1400
        $result = $this->query($query);
1401
        $ret = array();
1402
        foreach ($result as $row) {
1403
            if (isset($row->superProperty)) {
1404
                $ret[] = $row->superProperty->getUri();
1405
            }
1406
            
1407
        }
1408
        
1409
        if (sizeof($ret) > 0) {
1410
            // return result
1411
            return $ret;
1412
        } else {
1413
            // no result, return null
1414
            return null;
1415
        }
1416
    }
1417
1418
1419
    /**