Skip to content

owl:versionInfo with a language code causes PHP warnings #2051

Description

@akeldamas

URL address of the page where you encountered the problem

No public URL is available. I identified the problem on a fresh local Skosmos v3.4 container instance.

Description of the problem

While creating a fresh thesaurus using OWL, I noticed that adding a language code to owl:versionInfo causes PHP warnings.

Steps to reproduce

  1. Load a vocabulary containing:
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .

<https://example.org/thesaurus> a owl:Ontology, skos:ConceptScheme;
    skos:prefLabel "Test thesaurus"@en;
    owl:versionInfo "5"@en .
  1. Open the vocabulary page.

The page displays:

Warning: Undefined array key 0 in /var/www/html/src/model/Vocabulary.php on line 225

Deprecated: explode(): Passing null to parameter #2 ($string) of type string is deprecated in /var/www/html/src/model/Vocabulary.php on line 326

Expected outcome

The version information displays without PHP warnings.

Additional information (e.g. screenshots) about the problem

Tested with Skosmos container using v3.4 and PHP 8.3.

Image

Tracing the issue shows that Skosmos stores the literal value as its array key:

$ret[$prop][$val->getValue()] = $val;

In the example I showed it would create [5 => $val], but the code later assumes that it is stored as key 0:

if (isset($ret['owl:versionInfo'])) { // if version info available for vocabulary convert it to a more readable format
$ret['owl:versionInfo'][0] = $this->parseVersionInfo($ret['owl:versionInfo'][0]);
}

OWL supports literal values on annotation properties. So while little value might be gained from a language code it still is valid OWL.

The browser you used when the problem appeared

Not browser-specific. The same warnings are reproducible using curl.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions