Passed
Branch master (4b538d)
by Osma
10:57
created

Vocabulary::listConceptGroupContents()   A

Complexity

Conditions 4
Paths 6

Size

Total Lines 19
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 4
eloc 11
nc 6
nop 2
dl 0
loc 19
rs 9.9
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * Vocabulary dataobjects provide access to the vocabularies on the SPARQL endpoint.
5
 */
6
class Vocabulary extends DataObject implements Modifiable
7
{
8
    /** cached value of URI space */
9
    private $urispace = null;
10
    private $config;
11
12
    public function __construct($model, $resource)
13
    {
14
        parent::__construct($model, $resource);
15
        $this->config = new VocabularyConfig($resource, $model->getConfig()->getGlobalPlugins());
16
    }
17
18
    /**
19
     * Returns the VocabularyConfig object
20
     * @return VocabularyConfig
21
     */
22
    public function getConfig()
23
    {
24
      return $this->config;
25
    }
26
27
    /**
28
     * Get the SPARQL endpoint URL for this vocabulary
29
     *
30
     * @return string endpoint URL
31
     */
32
    public function getEndpoint()
33
    {
34
        return $this->resource->get('void:sparqlEndpoint')->getUri();
35
    }
36
37
    /**
38
     * Get the SPARQL graph URI for this vocabulary
39
     *
40
     * @return string|null graph URI
41
     */
42
    public function getGraph()
43
    {
44
        $graph = $this->resource->get('skosmos:sparqlGraph');
45
        if ($graph) {
46
            $graph = $graph->getUri();
47
        }
48
49
        return $graph;
50
    }
51
52
    /**
53
     * Get the SPARQL implementation for this vocabulary
54
     *
55
     * @return GenericSparql SPARQL object
56
     */
57
    public function getSparql()
58
    {
59
        $endpoint = $this->getEndpoint();
60
        $graph = $this->getGraph();
61
        $dialect = $this->resource->get('skosmos:sparqlDialect');
62
        $dialect = $dialect ? $dialect->getValue() : $this->model->getConfig()->getDefaultSparqlDialect();
63
64
        return $this->model->getSparqlImplementation($dialect, $endpoint, $graph);
65
    }
66
67
    /**
68
     * Get the URI space of concepts in this vocabulary.
69
     *
70
     * @return string full URI of concept
71
     */
72
    public function getUriSpace()
73
    {
74
        if ($this->urispace === null) // initialize cache
75
        {
76
            $this->urispace = $this->resource->getLiteral('void:uriSpace')->getValue();
77
        }
78
79
        return $this->urispace;
80
    }
81
82
    /**
83
     * Return true if the URI is within the URI space of this vocabulary.
84
     *
85
     * @param string full URI of concept
0 ignored issues
show
Bug introduced by
The type full was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
86
     * @return bool true if URI is within URI namespace, false otherwise
87
     */
88
89
    public function containsURI($uri)
90
    {
91
        return (strpos($uri, $this->getUriSpace()) === 0);
92
    }
93
94
    /**
95
     * Get the full URI of a concept in a vocabulary. If the passed local
96
     * name is already a full URI, return it unchanged.
97
     *
98
     * @param $lname string local name of concept
99
     * @return string full URI of concept
100
     */
101
    public function getConceptURI($lname)
102
    {
103
        if (strpos($lname, 'http') === 0) {
104
            return $lname;
105
        }
106
        // already a full URI
107
        return $this->getUriSpace() . $lname;
108
    }
109
110
    /**
111
     * Asks the sparql implementation to make a label query for a uri.
112
     * @param string $uri
113
     * @param string $lang
114
     */
115
    public function getConceptLabel($uri, $lang)
116
    {
117
        return $this->getSparql()->queryLabel($uri, $lang);
118
    }
119
120
    /**
121
     * Asks the sparql implementation to make a label query for a uri.
122
     * @param string $uri
123
     * @param string $lang
124
     * @return array array of altLabels
125
     */
126
    public function getAllConceptLabels($uri, $lang)
127
    {
128
        return $this->getSparql()->queryAllConceptLabels($uri, $lang);
129
    }
130
    /**
131
     * Get the localname of a concept in the vocabulary. If the URI is not
132
     * in the URI space of this vocabulary, return the full URI.
133
     *
134
     * @param $uri string full URI of concept
135
     * @return string local name of concept, or original full URI if the local name cannot be determined
136
     */
137
    public function getLocalName($uri)
138
    {
139
        return str_replace($this->getUriSpace(), "", $uri);
140
    }
141
142
    /**
143
     * Retrieves all the information about the Vocabulary
144
     * from the SPARQL-endpoint.
145
     */
146
    public function getInfo($lang = null)
147
    {
148
        $ret = array();
149
        if (!$lang) {
150
            $lang = $this->getEnvLang();
151
        }
152
153
        // get metadata (literals only e.g. name) from vocabulary configuration file
154
        foreach ($this->resource->properties() as $prop) {
155
            foreach ($this->resource->allLiterals($prop, $lang) as $val) {
156
                $ret[$prop][] = $val->getValue();
157
            }
158
        }
159
160
        // also include ConceptScheme metadata from SPARQL endpoint
161
        $defaultcs = $this->getDefaultConceptScheme();
162
163
        // query everything the endpoint knows about the ConceptScheme
164
        $sparql = $this->getSparql();
165
        $result = $sparql->queryConceptScheme($defaultcs);
166
        $conceptscheme = $result->resource($defaultcs);
167
        $this->order = array("dc:title", "dc11:title", "skos:prefLabel", "rdfs:label", "dc:subject", "dc11:subject", "dc:description", "dc11:description", "dc:publisher", "dc11:publisher", "dc:creator", "dc11:creator", "dc:contributor", "dc:language", "dc11:language", "owl:versionInfo", "dc:source", "dc11:source");
168
169
        foreach ($conceptscheme->properties() as $prop) {
170
            foreach ($conceptscheme->allLiterals($prop, $lang) as $val) {
171
                $prop = (substr($prop, 0, 5) == 'dc11:') ? str_replace('dc11:', 'dc:', $prop) : $prop;
172
                $ret[$prop][$val->getValue()] = $val;
173
            }
174
            if (!isset($ret[$prop]) || sizeof($ret[$prop]) == 0) { // not found with language tag
175
                foreach ($conceptscheme->allLiterals($prop, null) as $val) {
176
                    $prop = (substr($prop, 0, 5) == 'dc11:') ? str_replace('dc11:', 'dc:', $prop) : $prop;
177
                    if ($val->getValue() instanceof DateTime) {
178
                        $val = Punic\Calendar::formatDate($val->getValue(), 'full', $lang) . ' ' . Punic\Calendar::format($val->getValue(), 'HH:mm:ss', $lang);
179
                    }
180
                    $ret[$prop][] = $val;
181
                }
182
            }
183
            foreach ($conceptscheme->allResources($prop) as $val) {
184
                $prop = (substr($prop, 0, 5) == 'dc11:') ? str_replace('dc11:', 'dc:', $prop) : $prop;
185
                $exvocab = $this->model->guessVocabularyFromURI($val->getURI());
186
                $exlabel = $this->getExternalLabel($exvocab, $val->getURI(), $lang);
187
                if (isset($exlabel)) {
188
                    $val->add('skosmos:vocab', $exvocab->getId());
189
                    $val->add('skosmos:label', $exlabel);
190
                }
191
                $label = $val->label($lang) ? $val->label($lang)->getValue() : $val->getUri();
192
                $ret[$prop][$exlabel ? $exlabel->getValue() : $label] = $val;
193
            }
194
            if (isset($ret[$prop])) {
195
                ksort($ret[$prop]);
196
            }
197
        }
198
        if (isset($ret['owl:versionInfo'])) { // if version info available for vocabulary convert it to a more readable format
199
            $ret['owl:versionInfo'][0] = $this->parseVersionInfo($ret['owl:versionInfo'][0]);
200
        }
201
        // remove duplicate values
202
        foreach (array_keys($ret) as $prop) {
203
            $ret[$prop] = array_unique($ret[$prop]);
204
        }
205
206
        $ret = $this->arbitrarySort($ret);
207
208
        // filtering multiple labels
209
        if (isset($ret['dc:title'])) {
210
            unset($ret['dc11:title'], $ret['skos:prefLabel'], $ret['rdfs:label']);
211
        } else if (isset($ret['dc11:title'])) {
212
            unset($ret['skos:prefLabel'], $ret['rdfs:label']);
213
        } else if (isset($ret['skos:prefLabel'])) {
214
            unset($ret['rdfs:label']);
215
        }
216
217
        return $ret;
218
    }
219
220
    /**
221
     * Return all concept schemes in the vocabulary.
222
     * @return array Array with concept scheme URIs (string) as keys and labels (string) as values
223
     */
224
225
    public function getConceptSchemes($lang = '')
226
    {
227
        if ($lang === '') {
228
            $lang = $this->getEnvLang();
229
        }
230
231
        return $this->getSparql()->queryConceptSchemes($lang);
232
    }
233
234
    /**
235
     * Return the URI of the default concept scheme of this vocabulary. If the skosmos:mainConceptScheme property is set in the
236
     * vocabulary configuration, that will be returned. Otherwise an arbitrary concept scheme will be returned.
237
     * @return string concept scheme URI
238
     */
239
240
    public function getDefaultConceptScheme()
241
    {
242
        $conceptScheme = $this->config->getMainConceptSchemeURI();
243
        if ($conceptScheme) {
244
            return $conceptScheme;
245
        }
246
247
        // mainConceptScheme not explicitly set, guess it
248
        $conceptSchemes = $this->getConceptSchemes();
249
        $conceptSchemeURIs = array_keys($conceptSchemes);
250
        // return the URI of the last concept scheme
251
        return array_pop($conceptSchemeURIs);
252
    }
253
254
    /**
255
     * Returns the main Concept Scheme of that Vocabulary, or null if not set.
256
     * @param string $defaultConceptSchemeURI default concept scheme URI
257
     * @return \EasyRdf\Graph|mixed
258
     */
259
    public function getConceptScheme(string $defaultConceptSchemeURI)
260
    {
261
        return $this->getSparql()->queryConceptScheme($defaultConceptSchemeURI);
262
    }
263
264
    /**
265
     * Return the top concepts of a concept scheme in the vocabulary.
266
     * @param string $conceptScheme URI of concept scheme whose top concepts to return. If not set,
267
     *                              the default concept scheme of the vocabulary will be used.
268
     * @param string $lang preferred language for the concept labels,
269
     * @return array Array with concept URIs (string) as keys and labels (string) as values
270
     */
271
272
    public function getTopConcepts($conceptScheme = null, $lang = '')
273
    {
274
        if ($lang === '') {
275
            $lang = $this->getEnvLang();
276
        }
277
        $fallback = $this->config->getDefaultLanguage();
278
279
        if ($conceptScheme === null || $conceptScheme == '') {
280
            $conceptScheme = $this->getDefaultConceptScheme();
281
        }
282
283
        return $this->getSparql()->queryTopConcepts($conceptScheme, $lang, $fallback);
284
    }
285
286
    /**
287
     * Tries to parse version, date and time from sparql version information into a readable format.
288
     * @param string $version
289
     * @return string
290
     */
291
    private function parseVersionInfo($version)
292
    {
293
        $parts = explode(' ', $version);
294
        if ($parts[0] != '$Id:') {
295
            return $version;
296
        }
297
        // don't know how to parse
298
        $rev = $parts[2];
299
        $datestr = $parts[3] . ' ' . $parts[4];
300
301
        return "$datestr (r$rev)";
302
    }
303
304
    /**
305
     * Counts the statistics of the vocabulary.
306
     * @return Array containing the label counts
307
     */
308
    public function getStatistics($lang = '', $array=null, $group=null)
309
    {
310
        $sparql = $this->getSparql();
311
        // find the number of concepts
312
        return $sparql->countConcepts($lang, $array, $group);
313
    }
314
315
    /**
316
     * Counts the statistics of the vocabulary.
317
     * @return array of the concept counts in different languages
318
     */
319
    public function getLabelStatistics()
320
    {
321
        $sparql = $this->getSparql();
322
        $ret = array();
323
        // count the number of different types of concepts in all languages
324
        $ret['terms'] = $sparql->countLangConcepts($this->config->getLanguages(), $this->config->getIndexClasses());
325
326
        return $ret;
327
    }
328
329
    /**
330
     * Gets the parent concepts of a concept and child concepts for all of those.
331
     * @param string $uri
332
     * @param string $lang language identifier.
333
     */
334
    public function getConceptHierarchy($uri, $lang)
335
    {
336
        $lang = $lang ? $lang : $this->getEnvLang();
337
        $fallback = count($this->config->getLanguageOrder($lang)) > 1 ? $this->config->getLanguageOrder($lang)[1] : $this->config->getDefaultLanguage();
338
        $props = $this->config->getHierarchyProperty();
339
        return $this->getSparql()->queryParentList($uri, $lang, $fallback, $props);
340
    }
341
342
    /**
343
     * Gets the child relations of a concept and whether these children have more children.
344
     * @param string $uri
345
     */
346
    public function getConceptChildren($uri, $lang)
347
    {
348
        $lang = $lang ? $lang : $this->getEnvLang();
349
        $fallback = count($this->config->getLanguageOrder($lang)) > 1 ? $this->config->getLanguageOrder($lang)[1] : $this->config->getDefaultLanguage();
350
        $props = $this->config->getHierarchyProperty();
351
        return $this->getSparql()->queryChildren($uri, $lang, $fallback, $props);
352
    }
353
354
    /**
355
     * Gets the skos:narrower relations of a concept.
356
     * @param string $uri
357
     * @param string $lang language identifier.
358
     */
359
    public function getConceptNarrowers($uri, $lang)
360
    {
361
        $lang = $lang ? $lang : $this->getEnvLang();
362
        return $this->getSparql()->queryProperty($uri, 'skos:narrower', $lang);
363
    }
364
365
    /**
366
     * Gets the skos:narrowerTransitive relations of a concept.
367
     * @param string $uri
368
     * @param integer $limit
369
     * @param string $lang language identifier.
370
     */
371
    public function getConceptTransitiveNarrowers($uri, $limit, $lang)
372
    {
373
        $lang = $lang ? $lang : $this->getEnvLang();
374
        return $this->getSparql()->queryTransitiveProperty($uri, array('skos:narrower'), $lang, $limit);
375
    }
376
377
    /**
378
     * Gets the skos:broader relations of a concept.
379
     * @param string $uri
380
     * @param string $lang language identifier.
381
     */
382
    public function getConceptBroaders($uri, $lang)
383
    {
384
        $lang = $lang ? $lang : $this->getEnvLang();
385
        return $this->getSparql()->queryProperty($uri, 'skos:broader', $lang);
386
    }
387
388
    /**
389
     * Gets the skos:broaderTransitive relations of a concept.
390
     * @param string $uri
391
     * @param integer $limit
392
     * @param boolean $any set to true if you want to have a label even in case of a correct language one missing.
393
     * @param string $lang language identifier.
394
     */
395
    public function getConceptTransitiveBroaders($uri, $limit, $any = false, $lang)
396
    {
397
        $lang = $lang ? $lang : $this->getEnvLang();
398
        $fallback = $this->config->getDefaultLanguage();
399
        return $this->getSparql()->queryTransitiveProperty($uri, array('skos:broader'), $lang, $limit, $any, $fallback);
400
    }
401
402
    /**
403
     * Gets all the skos:related concepts of a concept.
404
     * @param string $uri
405
     * @param string $lang language identifier.
406
     */
407
    public function getConceptRelateds($uri, $lang)
408
    {
409
        $lang = $lang ? $lang : $this->getEnvLang();
410
        return $this->getSparql()->queryProperty($uri, 'skos:related', $lang);
411
    }
412
413
    /**
414
     * Makes a query into the sparql endpoint for a concept.
415
     * @param string $uri the full URI of the concept
416
     * @return Concept[]
417
     */
418
    public function getConceptInfo($uri, $clang)
419
    {
420
        $sparql = $this->getSparql();
421
422
        return $sparql->queryConceptInfo($uri, $this->config->getArrayClassURI(), array($this), $clang);
423
    }
424
425
    /**
426
     * Lists the different concept groups available in the vocabulary.
427
     * @param string $clang content language parameter
428
     * @return array
429
     */
430
    public function listConceptGroups($clang = null)
431
    {
432
        if ($clang === null || $clang == '') {
433
            $clang = $this->getEnvLang();
434
        }
435
436
        $ret = array();
437
        $gclass = $this->config->getGroupClassURI();
438
        if ($gclass === null) {
0 ignored issues
show
introduced by
The condition $gclass === null is always false.
Loading history...
439
            return $ret;
440
        }
441
        // no group class defined, so empty result
442
        $groups = $this->getSparql()->listConceptGroups($gclass, $clang);
443
        foreach ($groups as $uri => $label) {
444
            $ret[$uri] = $label;
445
        }
446
447
        return $ret;
448
    }
449
450
    /**
451
     * Lists the concepts available in the concept group.
452
     * @param $clname
453
     * @return array
454
     */
455
    public function listConceptGroupContents($glname, $clang)
456
    {
457
        if (!$clang) {
458
            $clang = $this->config->getEnvLang();
459
        }
460
461
        $ret = array();
462
        $gclass = $this->config->getGroupClassURI();
463
        if ($gclass === null) {
0 ignored issues
show
introduced by
The condition $gclass === null is always false.
Loading history...
464
            return $ret;
465
        }
466
        // no group class defined, so empty result
467
        $group = $this->getConceptURI($glname);
468
        $contents = $this->getSparql()->listConceptGroupContents($gclass, $group, $clang, $this->config->getShowDeprecated());
469
        foreach ($contents as $uri => $label) {
470
            $ret[$uri] = $label;
471
        }
472
473
        return $ret;
474
    }
475
476
    /**
477
     * Returns the letters of the alphabet which have been used in this vocabulary.
478
     * The returned letters may also include specials such as '0-9' (digits) and '!*' (special characters).
479
     * @param $clang content language
0 ignored issues
show
Bug introduced by
The type content was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
480
     * @return array array of letters
481
     */
482
    public function getAlphabet($clang)
483
    {
484
        $chars = $this->getSparql()->queryFirstCharacters($clang, $this->config->getIndexClasses());
485
        $letters = array();
486
        $digits = false;
487
        $specials = false;
488
        foreach ($chars as $char) {
489
            if (preg_match('/\p{L}/u', $char)) {
490
                $letters[] = $char;
491
            } elseif (preg_match('/\d/u', $char)) {
492
                $digits = true;
493
            } else {
494
                $specials = true;
495
            }
496
        }
497
        usort($letters, 'strcoll');
498
        if ($specials) {
499
            $letters[] = '!*';
500
        }
501
502
        if ($digits) {
503
            $letters[] = '0-9';
504
        }
505
506
        return $letters;
507
    }
508
509
    /**
510
     * Searches for concepts with a label starting with the specified letter.
511
     * Also the special tokens '0-9' (digits), '!*' (special characters) and '*'
512
     * (everything) are supported.
513
     * @param $letter letter (or special token) to search for
0 ignored issues
show
Bug introduced by
The type letter was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
514
     */
515
    public function searchConceptsAlphabetical($letter, $limit = null, $offset = null, $clang = null)
516
    {
517
        return $this->getSparql()->queryConceptsAlphabetical($letter, $clang, $limit, $offset, $this->config->getIndexClasses(), $this->config->getShowDeprecated(), $this->config->getAlphabeticalListQualifier());
518
    }
519
520
    /**
521
     * Makes a query for the transitive broaders of a concept and returns the concepts hierarchy processed for the view.
522
     * @param string $lang
523
     * @param string $uri
524
     */
525
    public function getBreadCrumbs($lang, $uri)
526
    {
527
        $broaders = $this->getConceptTransitiveBroaders($uri, 1000, true, $lang);
528
        $origCrumbs = $this->getCrumbs($broaders, $uri);
529
        return $this->combineCrumbs($origCrumbs);
530
    }
531
532
    /**
533
     * Takes the crumbs as a parameter and combines the crumbs if the path they form is too long.
534
     * @return array
535
     */
536
    private function combineCrumbs($origCrumbs)
537
    {
538
        $combined = array();
539
        foreach ($origCrumbs as $pathKey => $path) {
540
            $firstToCombine = true;
541
            $combinedPath = array();
542
            foreach ($path as $crumbKey => $crumb) {
543
                if ($crumb->getPrefLabel() === '...') {
544
                    array_push($combinedPath, $crumb);
545
                    if ($firstToCombine) {
546
                        $firstToCombine = false;
547
                    } else {
548
                        unset($origCrumbs[$pathKey][$crumbKey]);
549
                    }
550
                }
551
            }
552
            $combined[] = $combinedPath;
553
        }
554
555
        return array('combined' => $combined, 'breadcrumbs' => $origCrumbs);
556
    }
557
558
    /**
559
     * Recursive function for building the breadcrumb paths for the view.
560
     * @param array $bTresult contains the results of the broaderTransitive query.
561
     * @param string $uri
562
     * @param array $path
563
     */
564
    private function getCrumbs($bTresult, $uri, $path = null)
565
    {
566
        $crumbs = array();
567
        if (!isset($path)) {
568
            $path = array();
569
        }
570
571
        // check that there is no cycle (issue #220)
572
        foreach ($path as $childcrumb) {
573
            if ($childcrumb->getUri() == $uri) {
574
                // found a cycle - short-circuit and stop
575
                return $crumbs;
576
            }
577
        }
578
        if (isset($bTresult[$uri]['direct'])) {
579
            foreach ($bTresult[$uri]['direct'] as $broaderUri) {
580
                $newpath = array_merge($path, array(new Breadcrumb($uri, $bTresult[$uri]['label'])));
581
                if ($uri !== $broaderUri) {
582
                    $crumbs = array_merge($crumbs, $this->getCrumbs($bTresult, $broaderUri, $newpath));
583
                }
584
            }
585
        } else { // we have reached the end of a path and we need to start a new row in the 'stack'
586
            if (isset($bTresult[$uri])) {
587
                $path = array_merge($path, array(new Breadcrumb($uri, $bTresult[$uri]['label'])));
588
            }
589
590
            $index = 1;
591
            $length = sizeof($path);
592
            $limit = $length - 5;
593
            foreach ($path as $crumb) {
594
                if ($length > 5 && $index > $length - $limit) { // displays 5 concepts closest to the concept.
595
                    $crumb->hideLabel();
596
                }
597
                $index++;
598
            }
599
            $crumbs[] = array_reverse($path);
600
        }
601
        return $crumbs;
602
    }
603
604
    /**
605
     * Verify that the requested language is supported by the vocabulary. If not, returns
606
     * the default language of the vocabulary.
607
     * @param string $lang language to check
608
     * @return string language tag that is supported by the vocabulary
609
     */
610
611
    public function verifyVocabularyLanguage($lang)
612
    {
613
        return (in_array($lang, $this->config->getLanguages())) ? $lang : $this->config->getDefaultLanguage();
614
    }
615
616
    /**
617
     * Returns a list of recently changed or entirely new concepts.
618
     * @param string $prop the property uri pointing to timestamps, eg. 'dc:modified'
619
     * @param string $clang content language for the labels
620
     * @param int $offset starting index offset
621
     * @param int $limit maximum number of concepts to return
622
     * @return Array
623
     */
624
    public function getChangeList($prop, $clang, $offset, $limit)
625
    {
626
      return $this->getSparql()->queryChangeList($prop, $clang, $offset, $limit);
627
    }
628
629
    public function getTitle($lang=null) {
630
      return $this->config->getTitle($lang);
631
    }
632
633
    public function getShortName() {
634
      return $this->config->getShortName();
635
    }
636
637
    public function getId() {
638
      return $this->config->getId();
639
    }
640
641
    public function getModifiedDate()
642
    {
643
        $modifiedDate = null;
644
645
        $conceptSchemeURI = $this->getDefaultConceptScheme();
646
        if ($conceptSchemeURI) {
647
            $conceptSchemeGraph = $this->getConceptScheme($conceptSchemeURI);
648
            if (!$conceptSchemeGraph->isEmpty()) {
649
                $literal = $conceptSchemeGraph->getLiteral($conceptSchemeURI, "dc:modified");
650
                if ($literal) {
0 ignored issues
show
introduced by
$literal is of type EasyRdf\Literal, thus it always evaluated to true.
Loading history...
651
                    $modifiedDate = $literal->getValue();
652
                }
653
            }
654
        }
655
656
        return $modifiedDate;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $modifiedDate also could return the type string which is incompatible with the return type mandated by Modifiable::getModifiedDate() of DateTime|null.
Loading history...
657
    }
658
659
    public function isUseModifiedDate()
660
    {
661
        return $this->getConfig()->isUseModifiedDate();
662
    }
663
}
664