Skip to content
Snippets Groups Projects
Commit feba1b8e authored by Tarje.Lavik's avatar Tarje.Lavik
Browse files

Add @id mapping to classes

parent a42dd4c4
No related branches found
No related tags found
No related merge requests found
......@@ -10,7 +10,7 @@ const Context = ({ types }) => {
orderedClasses
.forEach((type) => {
context['@context'][type.name] = {
'@id': `${base}${type.name}`,
'@id': type.options?.jsonld?.context?.['@id'] ? type.options.jsonld.context?.['@id'] : `${base}${type.name}`,
'@context': getFields(type.fields, base),
};
});
......
......@@ -5,8 +5,8 @@ import config from 'config:jsonld-context';
* Order the schemas for simpler diffs
*/
export const orderSchemas = (schema) => {
const orderedClasses = _.orderBy(schema, ['name'], ['asc']).filter(_class => _class.options?.jsonld?.exclude != true)
return orderedClasses
const result = _.orderBy(schema, ['name'], ['asc']).filter(_class => _class.options?.jsonld?.exclude != true)
return result
}
/**
......@@ -26,13 +26,15 @@ export const getContext = () => {
'@context': {
'@version': 1.1,
_id: '@id',
id: '@id',
_ref: '@id',
id: '@id',
_type: '@type',
type: '@type',
'@base': config.base ? config.base : undefined,
[vocab]: vocabUri,
"crm": "http://www.cidoc-crm.org/cidoc-crm/",
"xsd": "http://www.w3.org/2001/XMLSchema#",
'@base': config.base ? config.base : undefined
"rdfs": "http://www.w3.org/2000/01/rdf-schema#",
},
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment