grapholscape
Version:
ontology visualization
1,411 lines (1,380 loc) • 817 kB
JavaScript
/**
* MIT License
*
* Copyright (c) 2018-2024 OBDA Systems
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
import cytoscape from 'cytoscape';
import cola from 'cytoscape-cola';
import popper from 'cytoscape-popper';
import chroma from 'chroma-js';
import cy_svg from 'cytoscape-svg';
import automove from 'cytoscape-automove';
import tippy from 'tippy.js';
import '@lit-labs/virtualizer';
import autopan from 'cytoscape-autopan-on-drag';
/******************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
function __awaiter(thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
}
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
var e = new Error(message);
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
};
var WidgetEnum;
(function (WidgetEnum) {
WidgetEnum["DIAGRAM_SELECTOR"] = "diagram-selector";
WidgetEnum["ENTITY_DETAILS"] = "details";
WidgetEnum["ENTITY_SELECTOR"] = "entity-selector";
WidgetEnum["FILTERS"] = "filters";
WidgetEnum["FIT_BUTTON"] = "fit-button";
WidgetEnum["FULLSCREEN_BUTTON"] = "fullscreen-button";
WidgetEnum["ONTOLOGY_EXPLORER"] = "ontology-explorer";
WidgetEnum["ONTOLOGY_INFO"] = "ontology-info";
WidgetEnum["OWL_VISUALIZER"] = "owl-visualizer";
WidgetEnum["RENDERER_SELECTOR"] = "renderer-selector";
WidgetEnum["LAYOUT_SETTINGS"] = "layout-settings";
WidgetEnum["SETTINGS"] = "settings";
WidgetEnum["ZOOM_TOOLS"] = "zoom-tools";
WidgetEnum["INITIAL_RENDERER_SELECTOR"] = "initial-renderer-selector";
WidgetEnum["ENTITY_COLOR_LEGEND"] = "entity-color-legend";
WidgetEnum["COLOR_BUTTON"] = "color-button";
WidgetEnum["INCREMENTAL_FILTERS"] = "incremental-filters";
WidgetEnum["INCREMENTAL_ENTITY_DETAILS"] = "class-instance-details";
/** @internal */
WidgetEnum["INSTANCES_EXPLORER"] = "instances-explorer";
/** @internal */
WidgetEnum["NAVIGATION_MENU"] = "naviagtion-menu";
/** @internal */
WidgetEnum["VKG_PREFERENCES"] = "vkg-preferences";
WidgetEnum["INCREMENTAL_INITIAL_MENU"] = "incremental-initial-menu";
WidgetEnum["DESIGNER_TOOLBOX"] = "designer-toolbox";
})(WidgetEnum || (WidgetEnum = {}));
const NAMESPACE = 'obda-systems.grapholscape';
const getNamespacedKey = (key) => `${NAMESPACE}-${key}`;
const getKeyWithoutNamespace = (key) => key.substring(NAMESPACE.length + 1);
const valueToStore = (v) => JSON.stringify(v);
const valueFromStorage = (v) => JSON.parse(v);
/**
* Load config from local storage
*/
function loadConfig() {
const config = {};
if (storageAvailable() && isAnySettingSaved()) {
Object.keys(window.localStorage)
.filter(k => k.startsWith(NAMESPACE)) // take only local storage items written by grapholscape
.forEach(k => {
const configKey = getKeyWithoutNamespace(k);
const value = valueFromStorage(window.localStorage.getItem(k));
if (Object.values(WidgetEnum).includes(configKey)) {
if (!config.widgets)
config.widgets = {};
config.widgets[configKey] = value;
}
else {
config[configKey] = value;
}
});
}
return config;
}
/**
* Store a single setting in local storage
* @param {string} k the key of the setting to store
* @param {any} value the value of the setting to store
*/
function storeConfigEntry(k, value) {
if (storageAvailable())
window.localStorage.setItem(getNamespacedKey(k), valueToStore(value));
}
function storageAvailable() {
let storage = window.localStorage;
try {
var x = '__storage_test__';
storage.setItem(x, x);
storage.removeItem(x);
return true;
}
catch (e) {
return e instanceof DOMException && (
// everything except Firefox
e.code === 22 ||
// Firefox
e.code === 1014 ||
// test name field too, because code might not be present
// everything except Firefox
e.name === 'QuotaExceededError' ||
// Firefox
e.name === 'NS_ERROR_DOM_QUOTA_REACHED') &&
// acknowledge QuotaExceededError only if there's something already stored
(storage && storage.length !== 0);
}
}
/**
* @returns Whether there is any local storage in setting belonging to grapholscape
*/
function isAnySettingSaved() {
if (storageAvailable()) {
return Object.keys(window.localStorage).some(k => k.startsWith(NAMESPACE));
}
return false;
}
function clearLocalStorage() {
Object.keys(window.localStorage)
.filter(k => k.startsWith(NAMESPACE))
.forEach(k => window.localStorage.removeItem(k));
}
var cytoscapeDefaultConfig = {
layout: { name: 'preset' },
autoungrabify: true,
maxZoom: 2.5,
minZoom: 0.02,
wheelSensitivity: 0.2,
};
const liteOptions = {
layout: { name: 'preset' },
autoungrabify: false,
maxZoom: 2.5,
minZoom: 0.02,
wheelSensitivity: 0.2,
};
const floatyOptions = {
layout: { name: 'preset' },
autoungrabify: false,
maxZoom: 2.5,
minZoom: 0.02,
wheelSensitivity: 0.2,
};
var Language;
(function (Language) {
Language["DE"] = "de";
Language["EN"] = "en";
Language["ES"] = "es";
Language["FR"] = "fr";
Language["IT"] = "it";
})(Language || (Language = {}));
/**
* Class representing a namespace
* @property {string[]} prefixes - array of prefixes
* @property {string} value - namespace lexical form
* @property {boolean} standard - bool saying if the namespace is standard or user defined
*/
class Namespace {
constructor(prefixes, value, standard = false) {
this.prefixes = prefixes;
this.value = value;
this.standard = standard;
}
get prefixes() {
return Array.from(this._prefixes);
}
set prefixes(value) {
this._prefixes = value;
}
set value(val) {
this._value = val;
}
get value() {
return this._value;
}
toString() {
return this._value;
}
set standard(value) {
this._standard = value;
}
/**
* Wether the namespace is standard (`true`) or user defined (`false`)
*/
isStandard() {
return this._standard ? true : false;
}
/**
* Check if the passed prefix is assigned to this namespace
* @param prefix the prefix to check
*/
hasPrefix(prefix) {
return this.prefixes.includes(prefix);
}
addPrefix(newPrefix) {
this._prefixes.push(newPrefix);
}
}
const DefaultNamespaces = {
RDFS: new Namespace(['rdfs'], 'http://www.w3.org/2000/01/rdf-schema#'),
OWL: new Namespace(['owl'], 'http://www.w3.org/2002/07/owl#'),
};
class Iri {
constructor(iri, namespaces, remainder) {
let isPrefixed = false;
this.fullIri = iri;
this.namespace = namespaces.find(n => {
if (iri.includes(n.toString()))
return true;
for (let prefix of n.prefixes) {
if (iri === `${prefix}:${iri.split(':')[1]}` && !iri.startsWith('http://')) {
isPrefixed = true;
return true;
}
}
});
if (remainder) {
this.remainder = remainder;
}
else {
if (!this.namespace) {
console.warn(`Namespace not found for [${iri}]. The prefix undefined has been assigned`);
// try {
// const uri = new URL(iri)
// this.remainder = uri.hash || uri.pathname.slice(uri.pathname.lastIndexOf('/') + 1)
// this.namespace = new Namespace([], uri.toString().slice(0, uri.toString().length - this.remainder.length))
// } catch (e) {
// this.remainder = iri
// }
this.remainder = iri;
}
else {
this.remainder = isPrefixed ? iri.split(':')[1] : iri.slice(this.namespace.toString().length);
}
}
}
set remainder(value) {
this._remainder = value;
}
get remainder() {
return this._remainder;
}
set namespace(value) {
this._namespace = value;
}
get namespace() {
return this._namespace;
}
get prefix() {
var _a;
return (_a = this.namespace) === null || _a === void 0 ? void 0 : _a.prefixes[0];
}
// public get fullIri() {
// return this.namespace?.toString() ? `${this.namespace.toString()}${this.remainder}` : this.remainder
// }
get prefixed() {
return this.prefix || this.prefix === '' ? `${this.prefix}:${this.remainder}` : `${this.remainder}`;
}
equals(iriToCheck) {
if (typeof iriToCheck !== 'string') {
iriToCheck = iriToCheck.fullIri;
}
if (this.fullIri === iriToCheck || this.prefixed === iriToCheck)
return true;
if (!this.namespace)
return false;
for (let prefix of this.namespace.prefixes) {
if (`${prefix}:${this.remainder}` === iriToCheck) {
return true;
}
}
return false;
}
hasPrefix(prefixToCheck) {
var _a;
return ((_a = this.namespace) === null || _a === void 0 ? void 0 : _a.hasPrefix(prefixToCheck)) || false;
}
toString() {
return this.fullIri;
}
}
const DefaultAnnotationProperties = {
label: new Iri(`${DefaultNamespaces.RDFS.value}label`, [DefaultNamespaces.RDFS]),
comment: new Iri(`${DefaultNamespaces.RDFS.value}comment`, [DefaultNamespaces.RDFS]),
author: new Iri(`${DefaultNamespaces.RDFS.value}author`, [DefaultNamespaces.RDFS]),
seeAlso: new Iri(`${DefaultNamespaces.RDFS.value}seeAlso`, [DefaultNamespaces.RDFS]),
isDefinedBy: new Iri(`${DefaultNamespaces.RDFS.value}isDefinedBy`, [DefaultNamespaces.RDFS]),
deprecated: new Iri(`${DefaultNamespaces.OWL.value}deprecated`, [DefaultNamespaces.OWL]),
versionInfo: new Iri(`${DefaultNamespaces.OWL.value}versionInfo`, [DefaultNamespaces.OWL]),
priorVersion: new Iri(`${DefaultNamespaces.OWL.value}priorVersion`, [DefaultNamespaces.OWL]),
backCompatibleWith: new Iri(`${DefaultNamespaces.OWL.value}backCompatibleWith`, [DefaultNamespaces.OWL]),
incompatibleWith: new Iri(`${DefaultNamespaces.OWL.value}incompatibleWith`, [DefaultNamespaces.OWL]),
};
class AnnotationProperty extends Iri {
}
class AnnotatedElement {
constructor() {
this._annotations = [];
}
set annotations(annotations) {
this._annotations = annotations;
}
addAnnotation(newAnnotation) {
for (let annotation of this._annotations) {
if (annotation.equals(newAnnotation)) {
return;
}
}
this._annotations.push(newAnnotation);
}
removeAnnotation(annotation) {
this._annotations = this._annotations.filter(a => !a.equals(annotation));
}
getAnnotations(language, annotationProperty) {
return this._annotations.filter(ann => {
let shouldAdd = true;
if (language && ann.language !== language) {
shouldAdd = false;
}
if (annotationProperty && !annotationProperty.equals(ann.property)) {
shouldAdd = false;
}
return shouldAdd;
});
}
getLabels(language) {
return this.getAnnotations(language, DefaultAnnotationProperties.label);
}
getComments(language) {
return this.getAnnotations(language, DefaultAnnotationProperties.comment);
}
}
var RendererStatesEnum;
(function (RendererStatesEnum) {
RendererStatesEnum["GRAPHOL"] = "graphol";
RendererStatesEnum["GRAPHOL_LITE"] = "lite";
RendererStatesEnum["FLOATY"] = "floaty";
RendererStatesEnum["INCREMENTAL"] = "incremental";
})(RendererStatesEnum || (RendererStatesEnum = {}));
/* tslint:disable */
/* eslint-disable */
/**
* Grapholscape API model
* This is the API for retaining a Grapholscape\'s loaded ontology (or graph) in order to restart navigation from a previous state.
*
* The version of the OpenAPI document: 1.0.0
* Contact: obdasystems@info.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
const BASE_PATH = "https://virtserver.swaggerhub.com/PEPE_2/Grapholscape_Model/1.0.0".replace(/\/+$/, "");
class Configuration {
constructor(configuration = {}) {
this.configuration = configuration;
}
set config(configuration) {
this.configuration = configuration;
}
get basePath() {
return this.configuration.basePath != null ? this.configuration.basePath : BASE_PATH;
}
get fetchApi() {
return this.configuration.fetchApi;
}
get middleware() {
return this.configuration.middleware || [];
}
get queryParamsStringify() {
return this.configuration.queryParamsStringify || querystring;
}
get username() {
return this.configuration.username;
}
get password() {
return this.configuration.password;
}
get apiKey() {
const apiKey = this.configuration.apiKey;
if (apiKey) {
return typeof apiKey === 'function' ? apiKey : () => apiKey;
}
return undefined;
}
get accessToken() {
const accessToken = this.configuration.accessToken;
if (accessToken) {
return typeof accessToken === 'function' ? accessToken : () => __awaiter(this, void 0, void 0, function* () { return accessToken; });
}
return undefined;
}
get headers() {
return this.configuration.headers;
}
get credentials() {
return this.configuration.credentials;
}
}
const DefaultConfig = new Configuration();
/**
* This is the base class for all generated API classes.
*/
class BaseAPI {
constructor(configuration = DefaultConfig) {
this.configuration = configuration;
this.fetchApi = (url, init) => __awaiter(this, void 0, void 0, function* () {
let fetchParams = { url, init };
for (const middleware of this.middleware) {
if (middleware.pre) {
fetchParams = (yield middleware.pre(Object.assign({ fetch: this.fetchApi }, fetchParams))) || fetchParams;
}
}
let response = undefined;
try {
response = yield (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init);
}
catch (e) {
for (const middleware of this.middleware) {
if (middleware.onError) {
response = (yield middleware.onError({
fetch: this.fetchApi,
url: fetchParams.url,
init: fetchParams.init,
error: e,
response: response ? response.clone() : undefined,
})) || response;
}
}
if (response === undefined) {
if (e instanceof Error) {
throw new FetchError(e, 'The request failed and the interceptors did not return an alternative response');
}
else {
throw e;
}
}
}
for (const middleware of this.middleware) {
if (middleware.post) {
response = (yield middleware.post({
fetch: this.fetchApi,
url: fetchParams.url,
init: fetchParams.init,
response: response.clone(),
})) || response;
}
}
return response;
});
this.middleware = configuration.middleware;
}
withMiddleware(...middlewares) {
const next = this.clone();
next.middleware = next.middleware.concat(...middlewares);
return next;
}
withPreMiddleware(...preMiddlewares) {
const middlewares = preMiddlewares.map((pre) => ({ pre }));
return this.withMiddleware(...middlewares);
}
withPostMiddleware(...postMiddlewares) {
const middlewares = postMiddlewares.map((post) => ({ post }));
return this.withMiddleware(...middlewares);
}
/**
* Check if the given MIME is a JSON MIME.
* JSON MIME examples:
* application/json
* application/json; charset=UTF8
* APPLICATION/JSON
* application/vnd.company+json
* @param mime - MIME (Multipurpose Internet Mail Extensions)
* @return True if the given MIME is JSON, false otherwise.
*/
isJsonMime(mime) {
if (!mime) {
return false;
}
return BaseAPI.jsonRegex.test(mime);
}
request(context, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
const { url, init } = yield this.createFetchParams(context, initOverrides);
const response = yield this.fetchApi(url, init);
if (response && (response.status >= 200 && response.status < 300)) {
return response;
}
throw new ResponseError(response, 'Response returned an error code');
});
}
createFetchParams(context, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
let url = this.configuration.basePath + context.path;
if (context.query !== undefined && Object.keys(context.query).length !== 0) {
// only add the querystring to the URL if there are query parameters.
// this is done to avoid urls ending with a "?" character which buggy webservers
// do not handle correctly sometimes.
url += '?' + this.configuration.queryParamsStringify(context.query);
}
const headers = Object.assign({}, this.configuration.headers, context.headers);
Object.keys(headers).forEach(key => headers[key] === undefined ? delete headers[key] : {});
const initOverrideFn = typeof initOverrides === "function"
? initOverrides
: () => __awaiter(this, void 0, void 0, function* () { return initOverrides; });
const initParams = {
method: context.method,
headers,
body: context.body,
credentials: this.configuration.credentials,
};
const overriddenInit = Object.assign(Object.assign({}, initParams), (yield initOverrideFn({
init: initParams,
context,
})));
const init = Object.assign(Object.assign({}, overriddenInit), { body: isFormData(overriddenInit.body) ||
overriddenInit.body instanceof URLSearchParams ||
isBlob(overriddenInit.body)
? overriddenInit.body
: JSON.stringify(overriddenInit.body) });
return { url, init };
});
}
/**
* Create a shallow clone of `this` by constructing a new instance
* and then shallow cloning data members.
*/
clone() {
const constructor = this.constructor;
const next = new constructor(this.configuration);
next.middleware = this.middleware.slice();
return next;
}
}
BaseAPI.jsonRegex = new RegExp('^(:?application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$', 'i');
function isBlob(value) {
return typeof Blob !== 'undefined' && value instanceof Blob;
}
function isFormData(value) {
return typeof FormData !== "undefined" && value instanceof FormData;
}
class ResponseError extends Error {
constructor(response, msg) {
super(msg);
this.response = response;
this.name = "ResponseError";
}
}
class FetchError extends Error {
constructor(cause, msg) {
super(msg);
this.cause = cause;
this.name = "FetchError";
}
}
class RequiredError extends Error {
constructor(field, msg) {
super(msg);
this.field = field;
this.name = "RequiredError";
}
}
const COLLECTION_FORMATS = {
csv: ",",
ssv: " ",
tsv: "\t",
pipes: "|",
};
function exists(json, key) {
const value = json[key];
return value !== null && value !== undefined;
}
function querystring(params, prefix = '') {
return Object.keys(params)
.map(key => querystringSingleKey(key, params[key], prefix))
.filter(part => part.length > 0)
.join('&');
}
function querystringSingleKey(key, value, keyPrefix = '') {
const fullKey = keyPrefix + (keyPrefix.length ? `[${key}]` : key);
if (value instanceof Array) {
const multiValue = value.map(singleValue => encodeURIComponent(String(singleValue)))
.join(`&${encodeURIComponent(fullKey)}=`);
return `${encodeURIComponent(fullKey)}=${multiValue}`;
}
if (value instanceof Set) {
const valueAsArray = Array.from(value);
return querystringSingleKey(key, valueAsArray, keyPrefix);
}
if (value instanceof Date) {
return `${encodeURIComponent(fullKey)}=${encodeURIComponent(value.toISOString())}`;
}
if (value instanceof Object) {
return querystring(value, fullKey);
}
return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`;
}
function mapValues(data, fn) {
return Object.keys(data).reduce((acc, key) => (Object.assign(Object.assign({}, acc), { [key]: fn(data[key]) })), {});
}
function canConsumeForm(consumes) {
for (const consume of consumes) {
if ('multipart/form-data' === consume.contentType) {
return true;
}
}
return false;
}
class JSONApiResponse {
constructor(raw, transformer = (jsonValue) => jsonValue) {
this.raw = raw;
this.transformer = transformer;
}
value() {
return __awaiter(this, void 0, void 0, function* () {
return this.transformer(yield this.raw.json());
});
}
}
class VoidApiResponse {
constructor(raw) {
this.raw = raw;
}
value() {
return __awaiter(this, void 0, void 0, function* () {
return undefined;
});
}
}
class BlobApiResponse {
constructor(raw) {
this.raw = raw;
}
value() {
return __awaiter(this, void 0, void 0, function* () {
return yield this.raw.blob();
});
}
;
}
class TextApiResponse {
constructor(raw) {
this.raw = raw;
}
value() {
return __awaiter(this, void 0, void 0, function* () {
return yield this.raw.text();
});
}
;
}
/* tslint:disable */
/* eslint-disable */
/**
* Grapholscape API model
* This is the API for retaining a Grapholscape\'s loaded ontology (or graph) in order to restart navigation from a previous state.
*
* The version of the OpenAPI document: 1.0.0
* Contact: obdasystems@info.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/**
* Check if a given object implements the Position interface.
*/
function instanceOfPosition(value) {
let isInstance = true;
isInstance = isInstance && "x" in value;
isInstance = isInstance && "y" in value;
return isInstance;
}
function PositionFromJSON(json) {
return PositionFromJSONTyped(json);
}
function PositionFromJSONTyped(json, ignoreDiscriminator) {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'x': json['x'],
'y': json['y'],
};
}
function PositionToJSON(value) {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'x': value.x,
'y': value.y,
};
}
/* tslint:disable */
/* eslint-disable */
/**
* Grapholscape API model
* This is the API for retaining a Grapholscape\'s loaded ontology (or graph) in order to restart navigation from a previous state.
*
* The version of the OpenAPI document: 1.0.0
* Contact: obdasystems@info.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/**
* Contiene tutti i tipi di nodi/archi orginirari dal Graphol per evitare di duplicare gli enumeratori. Nella rappresentazione Floaty/vkg vengono usati questi valori.
* NODI class data-property class-instance (vkg) individual (floaty) union disjoint-union iri (floaty iri range di annotazioni che non sono entità)
* ARCHI object-property annotation-property instance-of input inclusion equivalence attribute-edge union disjoint-union complete-union complete-disjoint-union
* @export
* @enum {string}
*/
var TypesEnum;
(function (TypesEnum) {
TypesEnum["CLASS"] = "class";
TypesEnum["OBJECT_PROPERTY"] = "object-property";
TypesEnum["DATA_PROPERTY"] = "data-property";
TypesEnum["ANNOTATION_PROPERTY"] = "annotation-property";
TypesEnum["INDIVIDUAL"] = "individual";
TypesEnum["CLASS_INSTANCE"] = "class-instance";
TypesEnum["DOMAIN_RESTRICTION"] = "domain-restriction";
TypesEnum["RANGE_RESTRICTION"] = "range-restriction";
TypesEnum["UNION"] = "union";
TypesEnum["COMPLETE_UNION"] = "complete-union";
TypesEnum["DISJOINT_UNION"] = "disjoint-union";
TypesEnum["COMPLETE_DISJOINT_UNION"] = "complete-disjoint-union";
TypesEnum["COMPLEMENT"] = "complement";
TypesEnum["INTERSECTION"] = "intersection";
TypesEnum["ENUMERATION"] = "enumeration";
TypesEnum["HAS_KEY"] = "has-key";
TypesEnum["ROLE_INVERSE"] = "role-inverse";
TypesEnum["ROLE_CHAIN"] = "role-chain";
TypesEnum["DATATYPE_RESTRICTION"] = "datatype-restriction";
TypesEnum["VALUE_DOMAIN"] = "value-domain";
TypesEnum["PROPERTY_ASSERTION"] = "property-assertion";
TypesEnum["LITERAL"] = "literal";
TypesEnum["FACET"] = "facet";
TypesEnum["NEUTRAL"] = "neutral";
TypesEnum["VALUE"] = "value";
TypesEnum["INCLUSION"] = "inclusion";
TypesEnum["EQUIVALENCE"] = "equivalence";
TypesEnum["INSTANCE_OF"] = "instance-of";
TypesEnum["INPUT"] = "input";
TypesEnum["SAME"] = "same";
TypesEnum["DIFFERENT"] = "different";
TypesEnum["MEMBERSHIP"] = "membership";
TypesEnum["ATTRIBUTE_EDGE"] = "attribute-edge";
TypesEnum["IRI"] = "iri";
})(TypesEnum || (TypesEnum = {}));
function TypesEnumFromJSON(json) {
return TypesEnumFromJSONTyped(json);
}
function TypesEnumFromJSONTyped(json, ignoreDiscriminator) {
return json;
}
function TypesEnumToJSON(value) {
return value;
}
/* tslint:disable */
/* eslint-disable */
/**
* Grapholscape API model
* This is the API for retaining a Grapholscape\'s loaded ontology (or graph) in order to restart navigation from a previous state.
*
* The version of the OpenAPI document: 1.0.0
* Contact: obdasystems@info.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/**
* Check if a given object implements the Edge interface.
*/
function instanceOfEdge(value) {
let isInstance = true;
isInstance = isInstance && "id" in value;
isInstance = isInstance && "type" in value;
isInstance = isInstance && "sourceId" in value;
isInstance = isInstance && "targetId" in value;
return isInstance;
}
function EdgeFromJSON(json) {
return EdgeFromJSONTyped(json);
}
function EdgeFromJSONTyped(json, ignoreDiscriminator) {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'id': json['id'],
'originalId': !exists(json, 'originalId') ? undefined : json['originalId'],
'diagramId': !exists(json, 'diagramId') ? undefined : json['diagramId'],
'displayedName': !exists(json, 'displayedName') ? undefined : json['displayedName'],
'iri': !exists(json, 'iri') ? undefined : json['iri'],
'type': TypesEnumFromJSON(json['type']),
'sourceId': json['sourceId'],
'targetId': json['targetId'],
'breakpoints': !exists(json, 'breakpoints') ? undefined : (json['breakpoints'].map(PositionFromJSON)),
'domainTyped': !exists(json, 'domainTyped') ? undefined : json['domainTyped'],
'rangeTyped': !exists(json, 'rangeTyped') ? undefined : json['rangeTyped'],
'domainMandatory': !exists(json, 'domainMandatory') ? undefined : json['domainMandatory'],
'rangeMandatory': !exists(json, 'rangeMandatory') ? undefined : json['rangeMandatory'],
};
}
function EdgeToJSON(value) {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'id': value.id,
'originalId': value.originalId,
'diagramId': value.diagramId,
'displayedName': value.displayedName,
'iri': value.iri,
'type': TypesEnumToJSON(value.type),
'sourceId': value.sourceId,
'targetId': value.targetId,
'breakpoints': value.breakpoints === undefined ? undefined : (value.breakpoints.map(PositionToJSON)),
'domainTyped': value.domainTyped,
'rangeTyped': value.rangeTyped,
'domainMandatory': value.domainMandatory,
'rangeMandatory': value.rangeMandatory,
};
}
/* tslint:disable */
/* eslint-disable */
/**
* Grapholscape API model
* This is the API for retaining a Grapholscape\'s loaded ontology (or graph) in order to restart navigation from a previous state.
*
* The version of the OpenAPI document: 1.0.0
* Contact: obdasystems@info.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/**
* Check if a given object implements the Annotation interface.
*/
function instanceOfAnnotation(value) {
let isInstance = true;
isInstance = isInstance && "value" in value;
isInstance = isInstance && "property" in value;
return isInstance;
}
function AnnotationFromJSON(json) {
return AnnotationFromJSONTyped(json);
}
function AnnotationFromJSONTyped(json, ignoreDiscriminator) {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'value': json['value'],
'hasIriValue': !exists(json, 'hasIriValue') ? undefined : json['hasIriValue'],
'property': json['property'],
'language': !exists(json, 'language') ? undefined : json['language'],
'datatype': !exists(json, 'datatype') ? undefined : json['datatype'],
};
}
function AnnotationToJSON(value) {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'value': value.value,
'hasIriValue': value.hasIriValue,
'property': value.property,
'language': value.language,
'datatype': value.datatype,
};
}
/* tslint:disable */
/* eslint-disable */
/**
* Grapholscape API model
* This is the API for retaining a Grapholscape\'s loaded ontology (or graph) in order to restart navigation from a previous state.
*
* The version of the OpenAPI document: 1.0.0
* Contact: obdasystems@info.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/**
*
* @export
* @enum {string}
*/
var FunctionPropertiesEnum;
(function (FunctionPropertiesEnum) {
FunctionPropertiesEnum["FUNCTIONAL"] = "functional";
FunctionPropertiesEnum["INVERSE_FUNCTIONAL"] = "inverseFunctional";
FunctionPropertiesEnum["TRANSITIVE"] = "transitive";
FunctionPropertiesEnum["SYMMETRIC"] = "symmetric";
FunctionPropertiesEnum["ASYMMETRIC"] = "asymmetric";
FunctionPropertiesEnum["REFLEXIVE"] = "reflexive";
FunctionPropertiesEnum["IRREFLEXIVE"] = "irreflexive";
})(FunctionPropertiesEnum || (FunctionPropertiesEnum = {}));
function FunctionPropertiesEnumFromJSON(json) {
return FunctionPropertiesEnumFromJSONTyped(json);
}
function FunctionPropertiesEnumFromJSONTyped(json, ignoreDiscriminator) {
return json;
}
function FunctionPropertiesEnumToJSON(value) {
return value;
}
/* tslint:disable */
/* eslint-disable */
/**
* Grapholscape API model
* This is the API for retaining a Grapholscape\'s loaded ontology (or graph) in order to restart navigation from a previous state.
*
* The version of the OpenAPI document: 1.0.0
* Contact: obdasystems@info.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/**
* Check if a given object implements the Entity interface.
*/
function instanceOfEntity(value) {
let isInstance = true;
isInstance = isInstance && "fullIri" in value;
return isInstance;
}
function EntityFromJSON(json) {
return EntityFromJSONTyped(json);
}
function EntityFromJSONTyped(json, ignoreDiscriminator) {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'fullIri': json['fullIri'],
'annotations': !exists(json, 'annotations') ? undefined : (json['annotations'].map(AnnotationFromJSON)),
'datatype': !exists(json, 'datatype') ? undefined : json['datatype'],
'isDataPropertyFunctional': !exists(json, 'isDataPropertyFunctional') ? undefined : json['isDataPropertyFunctional'],
'functionProperties': !exists(json, 'functionProperties') ? undefined : (json['functionProperties'].map(FunctionPropertiesEnumFromJSON)),
};
}
function EntityToJSON(value) {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'fullIri': value.fullIri,
'annotations': value.annotations === undefined ? undefined : (value.annotations.map(AnnotationToJSON)),
'datatype': value.datatype,
'isDataPropertyFunctional': value.isDataPropertyFunctional,
'functionProperties': value.functionProperties === undefined ? undefined : (value.functionProperties.map(FunctionPropertiesEnumToJSON)),
};
}
/* tslint:disable */
/* eslint-disable */
/**
* Grapholscape API model
* This is the API for retaining a Grapholscape\'s loaded ontology (or graph) in order to restart navigation from a previous state.
*
* The version of the OpenAPI document: 1.0.0
* Contact: obdasystems@info.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/**
* Check if a given object implements the HierarchySuperclassesInner interface.
*/
function instanceOfHierarchySuperclassesInner(value) {
let isInstance = true;
isInstance = isInstance && "classEntity" in value;
isInstance = isInstance && "complete" in value;
return isInstance;
}
function HierarchySuperclassesInnerFromJSON(json) {
return HierarchySuperclassesInnerFromJSONTyped(json);
}
function HierarchySuperclassesInnerFromJSONTyped(json, ignoreDiscriminator) {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'classEntity': EntityFromJSON(json['classEntity']),
'complete': json['complete'],
};
}
function HierarchySuperclassesInnerToJSON(value) {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'classEntity': EntityToJSON(value.classEntity),
'complete': value.complete,
};
}
/* tslint:disable */
/* eslint-disable */
/**
* Grapholscape API model
* This is the API for retaining a Grapholscape\'s loaded ontology (or graph) in order to restart navigation from a previous state.
*
* The version of the OpenAPI document: 1.0.0
* Contact: obdasystems@info.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/**
* Check if a given object implements the Hierarchy interface.
*/
function instanceOfHierarchy(value) {
let isInstance = true;
isInstance = isInstance && "id" in value;
isInstance = isInstance && "type" in value;
isInstance = isInstance && "inputs" in value;
isInstance = isInstance && "superclasses" in value;
return isInstance;
}
function HierarchyFromJSON(json) {
return HierarchyFromJSONTyped(json);
}
function HierarchyFromJSONTyped(json, ignoreDiscriminator) {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'id': json['id'],
'type': TypesEnumFromJSON(json['type']),
'inputs': (json['inputs'].map(EntityFromJSON)),
'superclasses': (json['superclasses'].map(HierarchySuperclassesInnerFromJSON)),
};
}
function HierarchyToJSON(value) {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'id': value.id,
'type': TypesEnumToJSON(value.type),
'inputs': (value.inputs.map(EntityToJSON)),
'superclasses': (value.superclasses.map(HierarchySuperclassesInnerToJSON)),
};
}
/* tslint:disable */
/* eslint-disable */
/**
* Grapholscape API model
* This is the API for retaining a Grapholscape\'s loaded ontology (or graph) in order to restart navigation from a previous state.
*
* The version of the OpenAPI document: 1.0.0
* Contact: obdasystems@info.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/**
* Check if a given object implements the Node interface.
*/
function instanceOfNode(value) {
let isInstance = true;
isInstance = isInstance && "id" in value;
isInstance = isInstance && "type" in value;
return isInstance;
}
function NodeFromJSON(json) {
return NodeFromJSONTyped(json);
}
function NodeFromJSONTyped(json, ignoreDiscriminator) {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'id': json['id'],
'originalId': !exists(json, 'originalId') ? undefined : json['originalId'],
'diagramId': !exists(json, 'diagramId') ? undefined : json['diagramId'],
'displayedName': !exists(json, 'displayedName') ? undefined : json['displayedName'],
'iri': !exists(json, 'iri') ? undefined : json['iri'],
'type': TypesEnumFromJSON(json['type']),
'position': !exists(json, 'position') ? undefined : PositionFromJSON(json['position']),
'labelPosition': !exists(json, 'labelPosition') ? undefined : PositionFromJSON(json['labelPosition']),
'geoPosition': !exists(json, 'geoPosition') ? undefined : PositionFromJSON(json['geoPosition']),
};
}
function NodeToJSON(value) {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'id': value.id,
'originalId': value.originalId,
'diagramId': value.diagramId,
'displayedName': value.displayedName,
'iri': value.iri,
'type': TypesEnumToJSON(value.type),
'position': PositionToJSON(value.position),
'labelPosition': PositionToJSON(value.labelPosition),
'geoPosition': PositionToJSON(value.geoPosition),
};
}
/* tslint:disable */
/* eslint-disable */
/**
* Grapholscape API model
* This is the API for retaining a Grapholscape\'s loaded ontology (or graph) in order to restart navigation from a previous state.
*
* The version of the OpenAPI document: 1.0.0
* Contact: obdasystems@info.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/**
* Check if a given object implements the ActionInvolvedElements interface.
*/
function instanceOfActionInvolvedElements(value) {
let isInstance = true;
return isInstance;
}
function ActionInvolvedElementsFromJSON(json) {
return ActionInvolvedElementsFromJSONTyped(json);
}
function ActionInvolvedElementsFromJSONTyped(json, ignoreDiscriminator) {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'nodes': !exists(json, 'nodes') ? undefined : (json['nodes'].map(NodeFromJSON)),
'edges': !exists(json, 'edges') ? undefined : (json['edges'].map(EdgeFromJSON)),
'hierarchies': !exists(json, 'Hierarchies') ? undefined : (json['Hierarchies'].map(HierarchyFromJSON)),
};
}
function ActionInvolvedElementsToJSON(value) {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'nodes': value.nodes === undefined ? undefined : (value.nodes.map(NodeToJSON)),
'edges': value.edges === undefined ? undefined : (value.edges.map(EdgeToJSON)),
'Hierarchies': value.hierarchies === undefined ? undefined : (value.hierarchies.map(HierarchyToJSON)),
};
}
/* tslint:disable */
/* eslint-disable */
/**
* Grapholscape API model
* This is the API for retaining a Grapholscape\'s loaded ontology (or graph) in order to restart navigation from a previous state.
*
* The version of the OpenAPI document: 1.0.0
* Contact: obdasystems@info.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/**
* Check if a given object implements the ActionUser interface.
*/
function instanceOfActionUser(value) {
let isInstance = true;
isInstance = isInstance && "name" in value;
return isInstance;
}
function ActionUserFromJSON(json) {
return ActionUserFromJSONTyped(json);
}
function ActionUserFromJSONTyped(json, ignoreDiscriminator) {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'name': json['name'],
'firstName': !exists(json, 'firstName') ? undefined : json['firstName'],
'lastName': !exists(json, 'lastName') ? undefined : json['lastName'],
'email': !exists(json, 'email') ? undefined : json['email'],
};
}
function ActionUserToJSON(value) {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'name': value.name,
'firstName': value.firstName,
'lastName': value.lastName,
'email': value.email,
};
}
/* tslint:disable */
/* eslint-disable */
/**
* Grapholscape API model
* This is the API for retaining a Grapholscape\'s loaded ontology (or graph) in order to restart navigation from a previous state.
*
* The version of the OpenAPI document: 1.0.0
* Contact: obdasystems@info.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/**
* @export
* @enum {string}
*/
var ActionOperationTypeEnum;
(function (ActionOperationTypeEnum) {
ActionOperationTypeEnum["ADD"] = "add";
ActionOperationTypeEnum["EDIT"] = "edit";
ActionOperationTypeEnum["REMOVE"] = "remove";
})(ActionOperationTypeEnum || (ActionOperationTypeEnum = {}));
/**
* Check if a given object implements the Action interface.
*/
function instanceOfAction(value) {
let isInstance = true;
isInstance = isInstance && "operationType" in value;
isInstance = isInstance && "subject" in value;
isInstance = isInstance && "user" in value;
isInstance = isInstance && "timestamp" in value;
return isInstance;
}
function ActionFromJSON(json) {
return ActionFromJSONTyped(json);
}
function ActionFromJSONTyped(json, ignoreDiscriminator) {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'operationType': json['operationType'],
'subject': json['subject'],
'previousState': !exists(json, 'previousState') ? undefined : json['previousState'],
'involvedElements': !exists(json, 'involvedElements') ? undefined : ActionInvolvedElementsFromJSON(json['involvedElements']),
'subactions': !exists(json, 'subactions') ? undefined : (json['subactions'].map(ActionFromJSON)),
'user': ActionUserFromJSON(json['user']),
'timestamp': json['timestamp'],
};
}
function ActionToJSON(value) {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'operationType': value.operationType,
'subject': value.subject,
'previousState': value.previousState,
'involvedElements': ActionInvolvedElementsToJSON(value.involvedElements),
'subactions': value.subactions === undefined ? undefined : (value.subactions.map(ActionToJSON)),
'user': ActionUserToJSON(value.user),
'timestamp': value.timestamp,
};
}
/* tslint:disable */
/* eslint-disable */
/**
* Grapholscape API model
* This is the API for retaining a Grapholscape\'s loaded ontology (or graph) in order to restart navigation from a previous state.
*
* The version of the OpenAPI document: 1.0.0
* Contact: obdasystems@info.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/**
* @export
* @enum {string}
*/
var AnnotationActionOperationTypeEnum;
(function (AnnotationActionOperationTypeEnum) {
AnnotationActionOperationTypeEnum["ADD"] = "add";
AnnotationActionOperationTypeEnum["EDIT"] = "edit";
AnnotationActionOperationTypeEnum["REMOVE"] = "remove";
})(AnnotationActionOperationTypeEnum || (AnnotationActionOperationTypeEnum = {}));
/**
* Check if a given object implements the AnnotationAction interface.
*/
function instanceOfAnnotationAction(value) {
let isInstance = true;
isInstance = isInstance && "operationType" in value;
isInstance = isInstance && "user" in value;
isInstance = isInstance && "timestamp" in value;
return isInstance;
}
function AnnotationActionFromJSON(json) {
return AnnotationActionFromJSONTyped(json);
}
function AnnotationActionFromJSONTyped(json, ignoreDiscriminator) {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'subject': !exists(json, 'subject') ? undefined : AnnotationFromJSON(json['subject']),
'previousState': !exists(json, 'previousState') ? undefined : AnnotationFromJSON(json['previousState']),
'entity': !exists(json, 'entity') ? undefined : EntityFromJSON(json['entity']),
'onOntology': !exists(json, 'onOntology') ? undefined : json['onOntology'],
'operationType': json['operationType'],
'involvedElements': !exists(json, 'involvedElements') ? undefined : ActionInvolvedElementsFromJSON(json['involvedElements']),