Skip to content

Commit

Permalink
Generated distribution and documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
iherman committed Mar 18, 2024
1 parent 42ccb3e commit 9dc254a
Show file tree
Hide file tree
Showing 40 changed files with 152 additions and 109 deletions.
33 changes: 29 additions & 4 deletions dist/lib/convert.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ function finalizeRawEntry(raw) {
value: raw.value,
label: label,
upper_value: toArray(raw.upper_value),
type: toArray(raw.type),
domain: toArray(raw.domain),
range: toArray(raw.range),
deprecated: deprecated,
Expand Down Expand Up @@ -415,7 +416,11 @@ function getData(vocab_source) {
// the extra owl types added depending on the range
const properties = (vocab.property !== undefined) ?
vocab.property.map((raw) => {
const types = (raw.status === common_1.Status.deprecated) ? ["rdf:Property", "owl:DeprecatedProperty"] : ["rdf:Property"];
const user_type = (raw.type === undefined) ? [] : raw.type;
const types = [
...(raw.status === common_1.Status.deprecated) ? ["rdf:Property", "owl:DeprecatedProperty"] : ["rdf:Property"],
...user_type
];
// Calculate the number of entries in various categories
// The conditional assignment is actually unnecessary per the earlier processing,
// but the deno typescript checker complains...
Expand All @@ -441,6 +446,7 @@ function getData(vocab_source) {
return {
id: raw.id,
type: types,
user_type: user_type,
label: raw.label,
comment: raw.comment,
deprecated: raw.deprecated,
Expand All @@ -458,7 +464,11 @@ function getData(vocab_source) {
// Get the classes. Note the special treatment for deprecated classes and the location of relevant domains and ranges
const classes = (vocab.class !== undefined) ?
vocab.class.map((raw) => {
const types = (raw.status === common_1.Status.deprecated) ? ["rdfs:Class", "owl:DeprecatedClass"] : ["rdfs:Class"];
const user_type = (raw.type === undefined) ? [] : raw.type;
const types = [
...(raw.status === common_1.Status.deprecated) ? ["rdfs:Class", "owl:DeprecatedClass"] : ["rdfs:Class"],
...user_type
];
const range_of = [];
const domain_of = [];
const included_in_domain_of = [];
Expand All @@ -475,6 +485,7 @@ function getData(vocab_source) {
return {
id: raw.id,
type: types,
user_type: user_type,
label: raw.label,
comment: raw.comment,
deprecated: raw.deprecated,
Expand All @@ -490,14 +501,21 @@ function getData(vocab_source) {
// Get the individuals. Note that, in this case, the 'type' value may be a full array of types provided in the YAML file
const individuals = (vocab.individual !== undefined) ?
vocab.individual.map((raw) => {
// In the former version the user's type was done via the upper_value property, which was not clean
// the current version has a separate type attribute, but the upper_value should also be used for backward compatibility
// To be sure, an extra action below is necessary to make sure there are no repeated entries.
const type = [
...(raw.type !== undefined) ? raw.type : [],
...(raw.upper_value !== undefined) ? raw.upper_value : []
];
return {
id: raw.id,
label: raw.label,
comment: raw.comment,
deprecated: raw.deprecated,
defined_by: raw.defined_by,
status: raw.status,
type: (raw.upper_value !== undefined) ? raw.upper_value : [],
type: [...new Set(type)],
see_also: raw.see_also,
example: raw.example,
context: final_contexts(raw),
Expand All @@ -506,6 +524,13 @@ function getData(vocab_source) {
// Get the datatypes.
const datatypes = (vocab.datatype !== undefined) ?
vocab.datatype.map((raw) => {
// In the former version the user's type was done via the upper_value property, which was not clean
// the current version has a separate type attribute, but the upper_value should also be used for backward compatibility
// To be sure, an extra action below is necessary to make sure there are no repeated entries.
const type = [
...(raw.type !== undefined) ? raw.type : [],
...(raw.upper_value !== undefined) ? raw.upper_value : []
];
const range_of = [];
const includes_range_of = [];
// Get the range cross-references
Expand All @@ -524,7 +549,7 @@ function getData(vocab_source) {
deprecated: raw.deprecated,
defined_by: raw.defined_by,
status: raw.status,
type: (raw.upper_value !== undefined) ? raw.upper_value : [],
type: [...new Set(type)],
see_also: raw.see_also,
example: raw.example,
context: final_contexts(raw),
Expand Down
11 changes: 11 additions & 0 deletions dist/lib/html.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,17 @@ function toHTML(vocab, template_text) {
document.addChild(dd, 'br');
}
}
if (item.user_type && item.user_type.length > 0) {
const dl = document.addChild(section, 'dl');
dl.className = 'terms';
document.addChild(dl, 'dt', 'Type');
const dd = document.addChild(dl, 'dd');
for (const itype of item.user_type) {
document.addChild(dd, 'span', resolveCurie(itype));
document.addChild(dd, 'br');
}
}
// This does not display, it is only here for RDFa's sake!
const span = document.addChild(section, 'span');
span.setAttribute('property', 'rdfs:isDefinedBy');
span.setAttribute('resource', `${vocab_prefix}:`);
Expand Down
2 changes: 1 addition & 1 deletion docs/assets/search.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 9dc254a

Please sign in to comment.