o-ref: Omeka S portable references
Two terms that identify and link Omeka S resources by a property value instead of by internal id.
| Namespace | https://omeka-s-contrib.github.io/omeka-s-ref/ns# |
|---|---|
| Prefix | o-ref |
| Version | 0.1.0 |
| Formats | Turtle, JSON-LD, RDF/XML |
Why
Omeka S links one resource to another by internal id: an item lists its item sets as
{"o:id": 42}, and a value that points to another item does the same. That id only means
something on the installation that assigned it. A record exported from one installation and imported
into another needs a link that survives the move. These terms name the linked resource by one of its
property values instead, and the importing side looks it up.
Terms
o-ref:id- At the top level of a record. The record's own identity, used to find an existing copy of it before creating it, so the same record is not imported twice.
o-ref:ref- Where Omeka S writes
{"o:id": …}: an entry ofo:item_set, or a value that links to another resource. A link to another record, resolved to that record's id on import.
Both take an object with exactly one property and one value:
{"<term>": "<value>"}
The property is a term of a vocabulary the installation knows, such as
dcterms:identifier. o-ref:id says “this record is the resource that has this
value”; o-ref:ref says “link to the one resource that has this value”.
Example
An item set and an item in it, adapted from Omeka-S-Cli's documentation examples. The item set
identifies itself by its dcterms:identifier:
{
"@context": {
"dcterms": "http://purl.org/dc/terms/",
"o": "http://omeka.org/s/vocabs/o#",
"o-ref": "https://omeka-s-contrib.github.io/omeka-s-ref/ns#"
},
"@type": "o:ItemSet",
"o-ref:id": {"dcterms:identifier": "set-paintings"},
"o:title": "Paintings",
"dcterms:title": [{"type": "literal", "@value": "Paintings"}],
"dcterms:identifier": [{"type": "literal", "@value": "set-paintings"}]
}
The item names that item set by the same value, where Omeka S would write its id:
{
"@context": {
"dcterms": "http://purl.org/dc/terms/",
"o": "http://omeka.org/s/vocabs/o#",
"o-ref": "https://omeka-s-contrib.github.io/omeka-s-ref/ns#"
},
"@type": "o:Item",
"o-ref:id": {"dcterms:identifier": "obj-1"},
"o:title": "Mona Lisa",
"o:item_set": [{"o-ref:ref": {"dcterms:identifier": "set-paintings"}}],
"dcterms:title": [{"type": "literal", "@value": "Mona Lisa"}],
"dcterms:identifier": [{"type": "literal", "@value": "obj-1"}]
}
On import, the item set is created first (or found, by its o-ref:id); the item's
o-ref:ref then resolves to that item set's id on the new installation.
Matching
- By namespace, not by prefix. A key is an
o-refterm when it expands to this namespace through the document's@context. The prefixo-refis only the usual local alias; a document may map another prefix to the same namespace. - The named property. The property inside an
o-refobject is read like any other key of the document: it expands to a property IRI through the document's@context, and the consumer looks for the property with that IRI on its installation, whatever prefix the installation gives that vocabulary. - How the value compares. The value is compared as a string with a value of the
named property on the record. That value may be a literal (its
@value) or a URI (its@id). Whether case is ignored is left to the consumer. - A reference needs exactly one match. An
o-ref:refthat matches no resource, or more than one, leaves the link unresolved, and the consumer warns about it. - An identity matches one copy or none. An
o-ref:idthat matches no resource means the record is new. One that matches more than one resource is ambiguous: the consumer does not pick one of them, creates nothing, and warns about it. - Without
o-ref:id. A record without ano-ref:idmay be matched by its title instead, as the consumer chooses.
Consumers
- Omeka-S-Cli:
item:exportwrites these terms,item:importresolves them.
Stability
- The namespace URI never changes. Terms are only added, never removed or redefined.
- Each change bumps the version (
owl:versionInfo) and gets a git tag.
Source
omeka-s-contrib/omeka-s-ref, under the
MIT license. ns.ttl is the source of truth; the JSON-LD and RDF/XML are generated from
it.