acdh-oeaw / arche-lib-schema
An API providing commonly used views on the ARCHE ontology
Installs: 2 688
Dependents: 2
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 1
Requires
- php: >= 8
- acdh-oeaw/easyrdf: *
- zozlak/rdf-constants: ^1
Requires (Dev)
README
An API for the ACDH ontology stored in an ARCHE repository.
Installation
composer require acdh-oeaw/arche-lib-schema
API Documentation
https://acdh-oeaw.github.io/arche-docs/devdocs/namespaces/acdhoeaw-arche-lib-schema.html
Usage
$conn = new PDO('pgsql: repo db connection details'); $cfg = (object) [ 'ontologyNamespace' => 'https://vocabs.acdh.oeaw.ac.at/schema#', 'parent' => 'https://vocabs.acdh.oeaw.ac.at/schema#isPartOf', 'label' => 'https://vocabs.acdh.oeaw.ac.at/schema#hasTitle', ]; $ontology = new \acdhOeaw\arche\lib\schema\Ontology($conn, $cfg); $class = $ontology->getClass('https://vocabs.acdh.oeaw.ac.at/schema#Person'); print_r($class); $property = $ontology->getProperty('https://vocabs.acdh.oeaw.ac.at/schema#RepoObject', 'https://vocabs.acdh.oeaw.ac.at/schema#hasContact'); print_r($property); $property = $ontology->getProperty(null, 'https://vocabs.acdh.oeaw.ac.at/schema#hasContact'); print_r($property); // controlled vocabulary on a property $property = $ontology->getProperty(null, 'https://vocabs.acdh.oeaw.ac.at/schema#hasLicense'); echo $property->checkVocabularyValue('cc-by-4-0', \acdhOeaw\arche\lib\schema\Ontology::VOCABSVALUE_ALL); // doesn't fetch all vocabulary values print_r($property->getVocabularyValue('https://vocabs.acdh.oeaw.ac.at/archelicenses/cc-by-4-0')); // doesn't fetch all vocabulary values print_r($property->vocabularyValues); // fetches all values echo $property->vocabularyValues['https://vocabs.acdh.oeaw.ac.at/archelicenses/cc-by-4-0']->getLabel('de'); // fetches all values first if they aren't loaded yet
// store cache in ontology.cache and refresh it every 600s $ontology = new \acdhOeaw\arche\lib\schema\Ontology($conn, $cfg, 'ontology.cache', 600);