anvc / scalar

Born-digital, open source, media-rich scholarly publishing that’s as easy as blogging.
Other
231 stars 73 forks source link

How to add a new ontology? #109

Closed brimwats1 closed 5 years ago

brimwats1 commented 5 years ago

Hello!

Craig pointed me in this direction!

I'm doing some experimentation with semantic linked data vocabularies and online publishing platforms. I was wondering how I might go about using Homosaurus.org in Scalar? Omeka S had an easy way to add new vocabularies and ontologies, but I don't see that in scalar. I have my own scalar instance spun up on my website.

Thank you! Brian

craigdietrich commented 5 years ago

Hi!

It turns out it's pretty easy! There are two steps, both described at the top of this file which is also the file you'll need to edit: https://github.com/anvc/scalar/blob/master/system/application/config/rdf.php

You'll need to first define the prefix to uri link in the $config['namespaces'] array, e.g.,

'brimwats' => 'http://example.com/brimwats/'

Them, add the fields of the ontology to the $config['ontologies'] array, e.g.,

$config['ontologies']['brimwats'] = array(
  'date', 'time', 'location', 'etc', 'etc'
);

The next time you open up the 'Add additional metadata' panel (e.g., on the edit page) you should see 'brimwats' as one of the selectable ontologies, with those fields as items to choose from.

Finally, fields will be output as "brimwats:location" for HTML and XML and "http://example.com/brimwats/location" for JSON.

Hopefully helpful!

brimwats1 commented 5 years ago

It works very well, thank you!