diff --git a/DKBFrontEnd/deployment/README b/DKBFrontEnd/deployment/README deleted file mode 100644 index 4d6a33d0c..000000000 --- a/DKBFrontEnd/deployment/README +++ /dev/null @@ -1,90 +0,0 @@ -What's this? -============ - -This is an automated script to deploy the latest (more-or-less) node.js -for DKB project. We run on various OS, mainly CentOS, so have outdated -compilers, node.js itself, etc. Thus, we're taking recent software and -compiling it on our own: it is sufficient to deploy node.js, since -it is a platform, and after this experiment, install, modify software -inside the platform itself. - -This is OK for development, don't know how it will fly for production. -Will see once DKB itself will be close to it. - - -How to use? -=========== - -Look inside the top of install.sh, customize to the taste. -Run install.sh, fix problems it reports about, rinse and repeat. -With certain non-zero amount of luck it will be successfully -deployed after ~30 minutes. - - -What will be installed? -======================= - - - Node.js itself (to BASE/node). - - Ontodia -- GUI for working with ontology graphs (to BASE/ontodia/git). - - -DKB frontend deployment -======================= - - - Go to the frontend sources (../src): this is the standard Node.js - application, so NPM will work there. - - - Run -{{{ -npm install -npm build -WEB_PREFIX=/ SPARQL_ENDPOINT=http://nosql.tpu.ru:8890/sparql npm run demo -}}} - to install dependencies, build the stuff and run the application. - This should be enough to run/test frontend locally (head to - http://localhost:10444/ with anything which speaks HTTP - and is JavaScript-capable: browser, telnet/brain, whatever). - - - To proxy node.js from Apache, you'll probably need to align - WEB_PREFIX with the URL root where application will be deployed. - Then use mod_proxy: -{{{ -LoadModule proxy_module modules/mod_proxy.so - -# Ontodia demo instance - - ProxyPass "http://localhost:10444/dkb/onto-demo" - ProxyPassReverse "http://localhost:10444/dkb/onto-demo" - -}}} - For such a setup, application must be invoked as -{{{ -WEB_PREFIX=/dkb/onto-demo SPARQL_ENDPOINT=http://nosql.tpu.ru:8890/sparql npm run demo -}}} - Not doing this will bring chaos into existence and doomed will be your - frontend; thy should try to avoid it. - - - For now, npm is to be spawned manually. The corresponding automation is on the go, - but not yet landed into our realms. - - - Port and other parameters can be customized via ../src/package.json: look for - "scripts" key and if you will need to run node.js in some customized way, - don't hesitate to add sanely-named target there instead of typing the command - each time and making others to think "How the hell $IT makes it to run?". - - - We have 'npm run dkb-prod' and 'npm run dkb-dev' to spawn production - and development instances; the corresponding Apache configuration can be taken - from ./apache-dkb.conf. - - - We have RESTRICT_GRAPH environment variable to present objects only from given - graphs. dkb-prod/dkb-dev uses it with the current graph URL, - http://nosql.tpu.ru:8890/DAV/ATLAS/new. One can use dkb-prod-whole/dkb-dev-whole - to be able to select all existing objects. - - -Whom to blame? -============== - -Me, Eygene Ryabinkin . - -$Id: README 345 2017-04-27 18:17:11Z rea $ diff --git a/DKBFrontEnd/deployment/apache-dkb.conf b/DKBFrontEnd/deployment/apache-dkb.conf deleted file mode 100644 index 47960d9c3..000000000 --- a/DKBFrontEnd/deployment/apache-dkb.conf +++ /dev/null @@ -1,14 +0,0 @@ -## NB: keep this in sync with package.json in ../src. - -# Main DKB instance - - ProxyPass "http://localhost:3000/dkb/app" - ProxyPassReverse "http://localhost:3000/dkb/app" - - - -# Development DKB instance - - ProxyPass "http://localhost:3001/dkb/dev" - ProxyPassReverse "http://localhost:3001/dkb/dev" - diff --git a/DKBFrontEnd/deployment/install.sh b/DKBFrontEnd/deployment/install.sh deleted file mode 100755 index dba623761..000000000 --- a/DKBFrontEnd/deployment/install.sh +++ /dev/null @@ -1,111 +0,0 @@ -#!/bin/sh -e -# $Id: install.sh 310 2017-04-14 15:07:26Z rea $ - -# Tunables -VERSION="6.10.2" -BASE=/opt/node.js -PREFIX="$BASE"/node -ONTODIA="$BASE"/ontodia -# 3 zero-padded digits for major, minor and patchlevel. -GCC_MIN="004006000" - - -# Nuts'n'bolts, edit with care -SRC="https://nodejs.org/dist/v${VERSION}/node-v${VERSION}.tar.xz" -ONTODIA_SRC="https://github.com/ontodia-org/ontodia.git" -DIR="node-v${VERSION}" -TARFLAGS="-J" - - -modern_gcc_instructions () { - if [ -f /etc/issue ] && grep -q '^CentOS[[:space:]]' /etc/issue; then - cat << EOF - -Looks like we are running on CentOS. Here is how to get recent GCC: - - yum install -y centos-release-scl - - yum install -y devtoolset-6-gcc-c++ - - scl enable devtoolset-6 bash -and rerun me from the activated shell. -EOF - return - fi -} - - -# Determine if we have proper GCC -GCC_VERSION="$( gcc --version 2>/dev/null | head -1 | sed -Ee's/^gcc\s+\([^\)]+\)\s+([0-9]+).([0-9]+).([0-9]+).*$/\1 \2 \3/' )" -if [ "$?" != 0 -o -z "$GCC_VERSION" -o \ - -n "$(echo "$GCC_VERSION" | tr -d '[ 0-9]')" ]; then - cat >&2 << EOF -Was not able to extract GCC version from -{{{ -$(gcc --version 2>&1) -}}} -EOF - exit 1 -fi -GCC_VERSION="$( echo "$GCC_VERSION" | (read maj min patch; printf "%03d%03d%03d" "$maj" "$min" "$patch") )" -if [ "$GCC_VERSION" -lt "$GCC_MIN" ]; then - echo "Too old GCC, need at least ${GCC_MIN}." >&2 - modern_gcc_instructions - exit 1 -fi - - -# Some acrobatics with temporary directory. -TMPDIR= -trap '[ -n "$TMPDIR" ] && rm -rf "$TMPDIR"; trap "" 0; exit;' 0 1 2 3 15 -TMPDIR="$(mktemp -d)" -if [ -z "$TMPDIR" ]; then - echo "Can't create temporary directory, exiting." >&2 - exit 1 -fi -t="$(readlink -f "$TMPDIR")" -if [ "$?" != 0 ]; then - echo "Can't get full path of created temporary directory '$TMPDIR'." >&2 - exit 1 -fi -TMPDIR="$t" -cd "$TMPDIR" || exit 1 - - -## Node.js itself -curl -o src "$SRC" -tar -xvf src "$TARFLAGS" -cd "$DIR" -./configure --prefix="$PREFIX" -make -mkdir -p "$PREFIX" -make install -export PATH="$PREFIX"/bin:"$PATH" - - -## Ontodia -mkdir -p "$ONTODIA" -cd "$ONTODIA" -git clone "$ONTODIA_SRC" git -cd git -# Install all dependencies locally ... -npm install -# ... and build. -npm run build - - -# That's all, folks! -cat << EOF - -======================================================================== -Installed node.js and Ontodia. Don't forget to prepend - ${PREFIX}/bin -to our PATH to use NPM and stuff. - -You can run -SPARQL_ENDPOINT=https://library-ontodia-org.herokuapp.com/sparql npm run demo -from Ontodia directory (${ONTODIA}/git) to invoke demo. - -To deploy applications just use npm from this node.js installation -in a usual fashion. - -Good luck! -======================================================================== -EOF diff --git a/DKBFrontEnd/src/.editorconfig b/DKBFrontEnd/src/.editorconfig deleted file mode 100644 index 2aadc959b..000000000 --- a/DKBFrontEnd/src/.editorconfig +++ /dev/null @@ -1,20 +0,0 @@ -# http://editorconfig.org - -# top-most EditorConfig file -root = true - -[*] -charset = utf-8 -insert_final_newline = true - -[*.{ts,tsx}] -indent_style = space -indent_size = 4 - -[*.css] -indent_style = space -indent_size = 4 - -[*.scss] -indent_style = space -indent_size = 2 diff --git a/DKBFrontEnd/src/.gitignore b/DKBFrontEnd/src/.gitignore deleted file mode 100644 index db88f2b40..000000000 --- a/DKBFrontEnd/src/.gitignore +++ /dev/null @@ -1,10 +0,0 @@ -/node_modules -/dist -/*.sh -/*.bat - -.idea/ -.vscode/ - -*.iml -*.log diff --git a/DKBFrontEnd/src/.npmignore b/DKBFrontEnd/src/.npmignore deleted file mode 100644 index ac07a964d..000000000 --- a/DKBFrontEnd/src/.npmignore +++ /dev/null @@ -1,10 +0,0 @@ -/node_modules -/dist/dts -/*.sh -/*.bat - -.idea/ -.vscode/ - -*.iml -*.log diff --git a/DKBFrontEnd/src/.travis.yml b/DKBFrontEnd/src/.travis.yml deleted file mode 100644 index 52ad81f2f..000000000 --- a/DKBFrontEnd/src/.travis.yml +++ /dev/null @@ -1,4 +0,0 @@ -language: node_js -node_js: - - "6" - - "4" diff --git a/DKBFrontEnd/src/CHANGELOG.md b/DKBFrontEnd/src/CHANGELOG.md deleted file mode 100644 index b0d80f5fd..000000000 --- a/DKBFrontEnd/src/CHANGELOG.md +++ /dev/null @@ -1,186 +0,0 @@ -# Change Log -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](http://keepachangelog.com/) -and this project adheres to [Semantic Versioning](http://semver.org/). - -## [Latest] -### Added -- Support for IE11 (without exporting to SVG/PNG). -- Workspace API for external toolbar. - -### Changed -- Replaced `foreignObject`-based element rendering with overlayed -HTML elements. -- Filter non-left mouse button clicks on paper. -- Automatically set link type visible when adding elements through -Connections menu. -- Tutorial don't automatically show up on a first visit by default. - -### Fixed -- Inconsistent elements and links rendering between editor and exported SVG. -- Paper always including initial canvas area when adjusting size to content. -- Rendering `Halo` in a wrong place when paper origin changes. -- Non-scrollable Connections panel in Firefox and IE11. -- Lost scroll position in Instances panel on 'Show more' button press -(introduced in [0.3.8]). -- Missing localized labels with different languages for classes. - -### Breaking changes -- `DiagramModel.requestElementData()` don't requests for links. -- Connected links data cleared from model on element remove. - -## [0.3.8] - 2017-01-24 -### Added -- Saving to/loading from LocalStorage examples. - -### Changed -- Diagram content now centered at paper after performing force layout. -- Updated to recent react typings and fixed relevant errors - -### Fixed -- Sorting elements properties by label. -- Placement of newly added from Connections popup elements. -- Lost links geometry when importing a layout. - -### Breaking changes -- Replaced DiagramModel.importLayout()'s `preloadedLinks` parameter with -`validateLinks`: when specified, marks all links from layout as `layoutOnly` -and requests diagram links at the end of importing process. -- Removed non-expiring "cache" `DiagramModel.elements`, replaced by -`cells`/`elements`/`links`/`getElement` accessors. -- Removed `presentOnDiagram` property from Element: now element is present -if it's in a graph, otherwise it's considered to be absent. - -## [0.3.7] - 2017-01-12 -### Added -- Select/deselect all elements checkbox in Connections popup. - -### Fixed -- Too close zoom to fit on diagrams with small number of elements, -making elements unnessesary big. - -## [0.3.6] - 2017-01-11 -### Fixed -- Broken attachment of links to nodes when loading a diagram. - -## [0.3.5] - 2016-12-29 -### Added -- Ability display labels for element properties by implementing -`DataProvider.propertyInfo()`. - -### Changed -- Replaced `d3` dependency with `d3-color`. - -### Fixed -- Exported missing `LayoutData` types. -- Error when `WikidataProvider.filter()` query execution encounters literals -or non-entity IRIs. -- Diagram area scroll jump on element click when workspace area size changed. -- Filter trash nodes (hyperlinks to resources expressed as IRIs) -in `WikidataProvider`. -- Made diagram area scroll smoother in Webkit browsers. -- Preserve full URI when drag'n'drop links with absolute URI with hashpart -onto the diagram area. -- Printing person template with expanded properties. - -## [0.3.3] - 2016-12-15 -### Added -- "Search for connected elements" button to Halo. - -### Changed -- Disabled "click on element to search". -- Hide Connections popup when click on empty paper space. - -### Fixed -- Display error in Connections popup on failed request. -- Inconsistent thumbnail width in default element thumbnail. -- Made paper adjust its size when element is expanded or collapsed. -- `WikidataProvider`: - * made search ordering consistent; - * prevent label and property duplication; - * replaced full images with thumbnails when using `imageClassUris`; - * query elementInfo using single SPARQL query for all elements; - * corrected `linkTypesOf` query to return actual connected elements count. - -## [0.3.2] - 2016-12-14 -### Added -- Fetching for link between elements on a diagram at the end of import. - -### Changed -- Significant performance improvments when importing diagram. -- Increased preferred link length in force layout. - -### Fixed -- Unable to export as PNG/SVG diagram that contains element with SVG thumbnail. -- Unable to export as PNG/SVG in Firefox >= 50. -- Connections popup height overflow in Firefox. - -### Breaking changes -- Link arrowheads implementation replaced by native -SVG markers, changed link style customization interface. -- Rewritten scrollable diagram component `PaperArea` -in React way, moved `zoomToFit()` and other related members. -This change fixes many issues with scrolling and resizing diagram area. -- Fixed typo in `GraphBuilder.getGraphFromConstruct()` method name. - -## [0.3.1] - 2016-11-22 -### Added -- Warning if browser is IE. - -### Fixed -- Collapsing/expanding widgets on resizable panels. -- Text wrapping in `big-icon-template`. -- Ignore literals when creating diagram from SparQL construct query. - -## [0.3.0] - 2016-10-03 -### Added -- Construct diagram from RDF graph using `GraphBuilder`. -- Ability to customize style of links on diagram. -- Ability to specify custom element image using user-provided function. -- Extension points for undo/redo support and element selection/halo. -- Default halo to operate on selected element. -- Wikidata data provider to browse wikidata SparQL endpoints. -- Ability to filter link types in Connections panel by name. - -### Changed -- Custom SVG layout of elements replaced with HTML-based one with React and -Handlebars as template engines with ability to register custom templates. -- Faster exporting diagram as SVG/PNG. -- Replaced bundled typings for backbone and react with @types/* -- Make Connections panel intially hidden. -- Replaced icons from Glyphicons with FontAwesome. -- Replaced force layout implementation from Springy to WebCola. - -### Fixed -- `SparqlEndpoint` error when `imageClassUris` left unspecifed. -- Compile errors when importing library to webpack-based TypeScript projects. -- Hide "Share" button from workspace when corresponding callback -is not specified. -- Diagram canvas scrolling in Safari. - -### Removed -- "All connections" group from Connections panel to support lazy loading of -link types. - -## [0.2.1] - 2016-09-14 -### Added -- Ability to customize colors of elements on diagram by providing option to -`Workspace` props. -- Displaying custom images on elements by specifying image URL when element -info loaded from `DataProvider`. - -## 0.2.0 - 2016-09-12 -### Added -- Ontodia published on GitHub as OSS project. - -[Latest]: https://github.com/ontodia-org/ontodia/compare/v0.3.8...HEAD -[0.3.8]: https://github.com/ontodia-org/ontodia/compare/v0.3.7...v0.3.8 -[0.3.7]: https://github.com/ontodia-org/ontodia/compare/v0.3.6...v0.3.7 -[0.3.6]: https://github.com/ontodia-org/ontodia/compare/v0.3.5...v0.3.6 -[0.3.5]: https://github.com/ontodia-org/ontodia/compare/v0.3.3...v0.3.5 -[0.3.3]: https://github.com/ontodia-org/ontodia/compare/v0.3.2...v0.3.3 -[0.3.2]: https://github.com/ontodia-org/ontodia/compare/v0.3.1...v0.3.2 -[0.3.1]: https://github.com/ontodia-org/ontodia/compare/v0.3.0...v0.3.1 -[0.3.0]: https://github.com/ontodia-org/ontodia/compare/v0.2.1...v0.3.0 -[0.2.1]: https://github.com/ontodia-org/ontodia/compare/v0.2.0...v0.2.1 diff --git a/DKBFrontEnd/src/LICENSE b/DKBFrontEnd/src/LICENSE deleted file mode 100644 index 48a1cd55d..000000000 --- a/DKBFrontEnd/src/LICENSE +++ /dev/null @@ -1,16 +0,0 @@ -Ontodia data diagramming library -Copyright (C) 2016 Vismart, Ltd. - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, you can receive a copy -of the GNU Lesser General Public License from http://www.gnu.org/ diff --git a/DKBFrontEnd/src/README.md b/DKBFrontEnd/src/README.md deleted file mode 100644 index 97d0774d8..000000000 --- a/DKBFrontEnd/src/README.md +++ /dev/null @@ -1,46 +0,0 @@ -# Ontodia [![npm](https://img.shields.io/npm/v/ontodia.svg)](https://www.npmjs.com/package/ontodia) [![Travis CI](https://img.shields.io/travis/ontodia-org/ontodia.svg)](https://travis-ci.org/ontodia-org/ontodia) # - -Ontodia is a JavaScript library that allows to visualize, navigate and explore the data in the form of an interactive graph based on underlying data sources. The library is a major front-end component in ontodia.org web application that provides semantic data visualization services. - -## What is Ontodia for? - -Ontodia allows you to create and persist diagrams made from connected data - relational, object, semantic. - -It was designed to visualize RDF data sets in particular, but could be tailored to almost any data sourece by implementing data provider interface. - -## Core features - -- Visual navigation and diagramming over large graph data sets -- Rich graph visualization and context-aware navigation features -- Ability to store and retrieve diagrams -- User friendly - no graph query language or prior knowledge of the schema required -- Customizable user interface (by modifying templates for nodes and links) and data storage back-end - -## How to try it? - -You can: -- Open ontodia.org [demo diagram](http://app.ontodia.org/diagram?sharedDiagram=49689f29-82bc-405d-b5f6-33507f1c1444) and navigate through demo data set -- Create an account at [ontodia.org](http://app.ontodia.org/register), browser through sample diagrams, download your rdf file or point to your sparql endpoint to build diagrams over your data -- Follow developer tutorials at [developer documentation page](https://github.com/ontodia-org/ontodia/wiki) -- Run via 'WEB_PREFIX=/dkb/onto-demo SPARQL_ENDPOINT=http://nosql.tpu.ru:8890/sparql npm run demo' customizing SPARQL endpoint and Web prefix as suitable (if you are proxying Webpack server via some upstream like Apache/NginX, use Web prefix which is consistent with your public URL, otherwise you will get numerous URL inconsistencies and non-functional demo) -- Environment variable RESTRICT_GRAPH will allow to restrict element selection only from a given graph. - -## How to use it - -- Use it as service at [ontodia.org](http://ontodia.org). Connect to your data, creata and share diagrams -- Customize it and embed into your web application as a JavaScript library - -## Licence - -Ontodia library is distributed under LGPL-2.1. Commercial license with additional features, support and custom development is available, please contact us at [ontodia-people@vismart.biz](ontodia-people@vismart.biz). - - -## Developer documentation and contributing - -Developer documentation is available at [wiki page](https://github.com/ontodia-org/ontodia/wiki). - -## Whom do I talk to? ### - -Feel free to write to [ontodia-people@vismart.biz](mailto:ontodia-people@vismart.biz). - -In order to simplify for you the access to our development team and to our growing community, we'd like to invite you to join our Slack channel. Here's the [form](https://goo.gl/forms/mfKFRRNU9ToHxGGM2) to fill out, so we can add you to the list of members. On our slack channel you can get answers to your questions regarding the library and ontodia.org service directly from developers and other users. diff --git a/DKBFrontEnd/src/STYLEGUIDE.md b/DKBFrontEnd/src/STYLEGUIDE.md deleted file mode 100644 index f9e5e92dd..000000000 --- a/DKBFrontEnd/src/STYLEGUIDE.md +++ /dev/null @@ -1,64 +0,0 @@ -* Pay attention to TSLint warnings. - -* Module files and directories should be named in camelCase; if module has single important entity like -class or function then this file should be named after it: - -``` - // DO - (src/foo/bar/bazBazBaz.ts) - export class BazBazBaz { ... } - export function barBaz(baz: BazBazBaz) { ... } - export default BazBazBaz; - - // DON'T - (src/foo/bar/BazBazBaz.ts) - (src/foo/bar/baz-baz-baz.ts) -``` - -* Inline interface declarations and module imports block should have spaces inside braces, -object literals should not: - -``` - // DO - import { barBaz, BazBazBaz } from '../bar/bazBazBaz'; - const point: { x: number; y: number; } = {x: 42, y: 10}; - export { point }; - - // DON'T - import {barBaz, BazBazBaz} from '../bar/bazBazBaz'; - const point: {x: number; y: number;} = { x: 42, y: 10; }; - export {point}; -``` - -* Don't use parenthesis around lambda function with single type inferenced argument: - -``` - // DO - items.map(item => ...) - - // DON'T - items.map((item) => ...) -``` - -* Use const keyword to declare variables by default instead of let if you are not intended to modify it. - -* Declare imports from libraries first, then imports from project other than current module directory, -then modules from current directory: - -``` - // DO - import * as $ from 'jquery'; - import { keyBy } from 'lodash'; - - import { BazBazBaz } from '../bar/bazBazBaz'; - - import { Foo } from './foo'; - import { frob } from './frob'; - - // DON'T - import { Foo } from './foo'; - import * as $ from 'jquery'; - import { BazBazBaz } from '../bar/bazBazBaz'; - import { keyBy } from 'lodash'; - import { Foo } from './frob'; -``` diff --git a/DKBFrontEnd/src/images/add-to-filter.png b/DKBFrontEnd/src/images/add-to-filter.png deleted file mode 100644 index feeedcd45..000000000 Binary files a/DKBFrontEnd/src/images/add-to-filter.png and /dev/null differ diff --git a/DKBFrontEnd/src/images/arrow-left.png b/DKBFrontEnd/src/images/arrow-left.png deleted file mode 100644 index b7bbb2270..000000000 Binary files a/DKBFrontEnd/src/images/arrow-left.png and /dev/null differ diff --git a/DKBFrontEnd/src/images/arrow-left1.png b/DKBFrontEnd/src/images/arrow-left1.png deleted file mode 100644 index 0513e37ff..000000000 Binary files a/DKBFrontEnd/src/images/arrow-left1.png and /dev/null differ diff --git a/DKBFrontEnd/src/images/arrow-right.png b/DKBFrontEnd/src/images/arrow-right.png deleted file mode 100644 index d58f95362..000000000 Binary files a/DKBFrontEnd/src/images/arrow-right.png and /dev/null differ diff --git a/DKBFrontEnd/src/images/arrow-right1.png b/DKBFrontEnd/src/images/arrow-right1.png deleted file mode 100644 index 4925f6824..000000000 Binary files a/DKBFrontEnd/src/images/arrow-right1.png and /dev/null differ diff --git a/DKBFrontEnd/src/images/close-connections.png b/DKBFrontEnd/src/images/close-connections.png deleted file mode 100644 index d89ed4caa..000000000 Binary files a/DKBFrontEnd/src/images/close-connections.png and /dev/null differ diff --git a/DKBFrontEnd/src/images/collapse-properties.png b/DKBFrontEnd/src/images/collapse-properties.png deleted file mode 100644 index a21357478..000000000 Binary files a/DKBFrontEnd/src/images/collapse-properties.png and /dev/null differ diff --git a/DKBFrontEnd/src/images/connections.png b/DKBFrontEnd/src/images/connections.png deleted file mode 100644 index 61550334a..000000000 Binary files a/DKBFrontEnd/src/images/connections.png and /dev/null differ diff --git a/DKBFrontEnd/src/images/delete.png b/DKBFrontEnd/src/images/delete.png deleted file mode 100644 index 25ce6a673..000000000 Binary files a/DKBFrontEnd/src/images/delete.png and /dev/null differ diff --git a/DKBFrontEnd/src/images/expand-link.png b/DKBFrontEnd/src/images/expand-link.png deleted file mode 100644 index 9002a420e..000000000 Binary files a/DKBFrontEnd/src/images/expand-link.png and /dev/null differ diff --git a/DKBFrontEnd/src/images/expand-properties.png b/DKBFrontEnd/src/images/expand-properties.png deleted file mode 100644 index 2ebad8c5c..000000000 Binary files a/DKBFrontEnd/src/images/expand-properties.png and /dev/null differ diff --git a/DKBFrontEnd/src/images/expand-properties_100x100.png b/DKBFrontEnd/src/images/expand-properties_100x100.png deleted file mode 100644 index e5a571e46..000000000 Binary files a/DKBFrontEnd/src/images/expand-properties_100x100.png and /dev/null differ diff --git a/DKBFrontEnd/src/images/resizable-column-handle.png b/DKBFrontEnd/src/images/resizable-column-handle.png deleted file mode 100644 index 9b23af024..000000000 Binary files a/DKBFrontEnd/src/images/resizable-column-handle.png and /dev/null differ diff --git a/DKBFrontEnd/src/images/transparent-background.png b/DKBFrontEnd/src/images/transparent-background.png deleted file mode 100644 index 06ee8e08e..000000000 Binary files a/DKBFrontEnd/src/images/transparent-background.png and /dev/null differ diff --git a/DKBFrontEnd/src/images/tree-leaf-folder.png b/DKBFrontEnd/src/images/tree-leaf-folder.png deleted file mode 100644 index 5101846a3..000000000 Binary files a/DKBFrontEnd/src/images/tree-leaf-folder.png and /dev/null differ diff --git a/DKBFrontEnd/src/images/tree-leaf.png b/DKBFrontEnd/src/images/tree-leaf.png deleted file mode 100644 index 4e8089154..000000000 Binary files a/DKBFrontEnd/src/images/tree-leaf.png and /dev/null differ diff --git a/DKBFrontEnd/src/images/tree-node-class.png b/DKBFrontEnd/src/images/tree-node-class.png deleted file mode 100644 index eb9573493..000000000 Binary files a/DKBFrontEnd/src/images/tree-node-class.png and /dev/null differ diff --git a/DKBFrontEnd/src/package.json b/DKBFrontEnd/src/package.json deleted file mode 100644 index 032079a3d..000000000 --- a/DKBFrontEnd/src/package.json +++ /dev/null @@ -1,85 +0,0 @@ -{ - "name": "ontodia", - "version": "0.4.0-dev.20170307", - "description": "Ontodia Library", - "repository": { - "type": "git", - "url": "git+ssh://git@github.com/ontodia-org/ontodia.git" - }, - "keywords": [ - "owl", - "graph", - "rdf", - "diagram", - "sparql" - ], - "author": { - "name": "ontodia.org", - "url": "ontodia.org" - }, - "license": "LGPL-2.1", - "bugs": { - "url": "https://github.com/ontodia-org/ontodia/issues" - }, - "homepage": "https://github.com/ontodia-org/ontodia#readme", - "scripts": { - "build": "npm run _webpack && npm run _typings", - "demo": "node ./node_modules/webpack-dev-server/bin/webpack-dev-server.js --port 10444 --config webpack.demo.config.js --content-base dist/", - "dkb-prod": "env WEB_PREFIX=/dkb/app/ SPARQL_ENDPOINT=http://nosql.tpu.ru:8890/sparql RESTRICT_GRAPH=http://nosql.tpu.ru:8890/DAV/ATLAS/new node ./node_modules/webpack-dev-server/bin/webpack-dev-server.js --port 3000 --config webpack.demo.config.js --content-base dist/", - "dkb-dev": "env WEB_PREFIX=/dkb/dev/ SPARQL_ENDPOINT=http://nosql.tpu.ru:8890/sparql RESTRICT_GRAPH=http://nosql.tpu.ru:8890/DAV/ATLAS/new node ./node_modules/webpack-dev-server/bin/webpack-dev-server.js --port 3001 --config webpack.demo.config.js --content-base dist/", - "dkb-prod-whole": "env WEB_PREFIX=/dkb/app/ SPARQL_ENDPOINT=http://nosql.tpu.ru:8890/sparql node ./node_modules/webpack-dev-server/bin/webpack-dev-server.js --port 3000 --config webpack.demo.config.js --content-base dist/", - "dkb-dev-whole": "env WEB_PREFIX=/dkb/dev/ SPARQL_ENDPOINT=http://nosql.tpu.ru:8890/sparql node ./node_modules/webpack-dev-server/bin/webpack-dev-server.js --port 3001 --config webpack.demo.config.js --content-base dist/", - "_typings-tsc": "node ./node_modules/typescript/bin/tsc --declaration --outDir dist/dts", - "_typings-dts-bundle": "node ./node_modules/dts-bundle/lib/dts-bundle.js --main dist/dts/index.d.ts --name ontodia --out ../ontodia.d.ts", - "_typings": "npm run _typings-tsc && npm run _typings-dts-bundle", - "test": "npm run build", - "_webpack": "node ./node_modules/webpack/bin/webpack.js", - "start" : "node ./node_modules/webpack-dev-server/bin/webpack-dev-server.js --port 5000 --host 0.0.0.0 --config webpack.demo.config.js --content-base dist/" - }, - "dependencies": { - "d3-color": "1.0.2", - "handlebars": "4.0.5", - "intro.js": "1.1.1", - "jointjs": "0.9.10", - "jquery": "2.2.1", - "lodash": "4.15.0", - "n3": "0.6.1", - "webcola": "3.1.3", - "whatwg-fetch": "2.0.2" - }, - "peerDependencies": { - "@types/backbone": "*", - "@types/react": "*", - "react": "^15.0.0", - "react-dom": "^15.0.0" - }, - "devDependencies": { - "@types/whatwg-fetch": "0.0.33", - "@types/backbone": "1.3.33", - "@types/d3-color": "1.0.4", - "@types/lodash": "4.14.37", - "@types/react": "0.14.55", - "@types/react-dom": "0.14.19", - "css-loader": "0.23.1", - "dts-bundle": "0.5.0", - "exports-loader": "0.6.3", - "expose-loader": "0.7.1", - "file-loader": "0.8.5", - "html-webpack-plugin": "2.22.0", - "json-loader": "0.5.4", - "jstree": "3.2.1", - "node-sass": "3.10.1", - "react": "15.3.2", - "react-dom": "15.3.2", - "sass-loader": "4.0.2", - "string-replace-loader": "*", - "style-loader": "0.13.1", - "ts-loader": "0.8.2", - "typescript": "2.1.4", - "url-loader": "0.5.7", - "webpack": "1.13.2", - "webpack-dev-server": "1.16.2" - }, - "main": "dist/ontodia.js", - "typings": "dist/ontodia.d.ts" -} diff --git a/DKBFrontEnd/src/src/examples/common.ts b/DKBFrontEnd/src/src/examples/common.ts deleted file mode 100644 index 7b97b3f43..000000000 --- a/DKBFrontEnd/src/src/examples/common.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { LayoutData } from '../index'; - -export function onPageLoad(callback: (container: HTMLDivElement) => void) { - document.addEventListener('DOMContentLoaded', () => { - const container = document.createElement('div'); - container.id = 'root'; - document.body.appendChild(container); - callback(container); - }); -} - -export function tryLoadLayoutFromLocalStorage(): LayoutData | undefined { - if (window.location.hash.length > 1) { - try { - const key = window.location.hash.substring(1); - const unparsedLayout = localStorage.getItem(key); - return unparsedLayout && JSON.parse(unparsedLayout); - } catch (e) { /* ignore */ } - } - return undefined; -} - -export function saveLayoutToLocalStorage(layout: LayoutData): string { - const randomKey = Math.floor((1 + Math.random()) * 0x10000000000) - .toString(16).substring(1); - localStorage.setItem(randomKey, JSON.stringify(layout)); - return randomKey; -} diff --git a/DKBFrontEnd/src/src/examples/sparql.ts b/DKBFrontEnd/src/src/examples/sparql.ts deleted file mode 100644 index 08d54c044..000000000 --- a/DKBFrontEnd/src/src/examples/sparql.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { createElement, ClassAttributes } from 'react'; -import * as ReactDOM from 'react-dom'; - -import { Workspace, WorkspaceProps, SparqlDataProvider, OWLStatsSettings, SparqlQueryMethod } from '../index'; - -import { onPageLoad, tryLoadLayoutFromLocalStorage, saveLayoutToLocalStorage } from './common'; - -require('jointjs/css/layout.css'); -require('jointjs/css/themes/default.css'); - -function onWorkspaceMounted(workspace: Workspace) { - if (!workspace) { return; } - - const model = workspace.getModel(); - model.graph.on('action:iriClick', (iri: string) => { - window.open(iri); - console.log(iri); - }); - - const layoutData = tryLoadLayoutFromLocalStorage(); - model.importLayout({ - layoutData, - validateLinks: true, - dataProvider: new SparqlDataProvider({ - endpointUrl: __SPARQL_ENDPOINT__, - imagePropertyUris: [ - 'http://collection.britishmuseum.org/id/ontology/PX_has_main_representation', - 'http://xmlns.com/foaf/0.1/img', - ], - queryMethod: SparqlQueryMethod.GET - }, OWLStatsSettings), - }); -} - -const props: WorkspaceProps & ClassAttributes = { - ref: onWorkspaceMounted, - onSaveDiagram: workspace => { - const {layoutData} = workspace.getModel().exportLayout(); - window.location.hash = saveLayoutToLocalStorage(layoutData); - window.location.reload(); - }, -}; - -onPageLoad(container => ReactDOM.render(createElement(Workspace, props), container)); diff --git a/DKBFrontEnd/src/src/examples/sparqlConstruct.ts b/DKBFrontEnd/src/src/examples/sparqlConstruct.ts deleted file mode 100644 index 19a43510e..000000000 --- a/DKBFrontEnd/src/src/examples/sparqlConstruct.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { createElement, ClassAttributes } from 'react'; -import * as ReactDOM from 'react-dom'; - -import { Workspace, WorkspaceProps, SparqlDataProvider, GraphBuilder, OWLStatsSettings, SparqlQueryMethod } from '../index'; - -import { onPageLoad } from './common'; - -require('jointjs/css/layout.css'); -require('jointjs/css/themes/default.css'); - -function onWorkspaceMounted(workspace: Workspace) { - if (!workspace) { return; } - - const model = workspace.getModel(); - const endpointUrl = __SPARQL_ENDPOINT__; - const sparqlDataProvider = new SparqlDataProvider({endpointUrl: endpointUrl, queryMethod: SparqlQueryMethod.GET}, OWLStatsSettings); - const graphBuilder = new GraphBuilder(sparqlDataProvider); - - const loadingGraph = graphBuilder.getGraphFromConstruct( - `CONSTRUCT { - ?inst rdf:type ?class. - ?inst ?propType1 ?propValue1. - ?inst rdfs:label ?label . - ?propValue2 ?propType2 ?inst . - } WHERE { - BIND ( as ?inst) - ?inst rdf:type ?class. - OPTIONAL {?inst rdfs:label ?label} - OPTIONAL {?inst ?propType1 ?propValue1. FILTER(isURI(?propValue1)). } - OPTIONAL {?propValue2 ?propType2 ?inst. FILTER(isURI(?propValue2)). } - } LIMIT 100`, - ); - workspace.showWaitIndicatorWhile(loadingGraph); - - loadingGraph.then(({layoutData, preloadedElements}) => model.importLayout({ - layoutData, - preloadedElements, - dataProvider: sparqlDataProvider, - })).then(() => { - workspace.forceLayout(); - workspace.zoomToFit(); - }); -} - -const props: WorkspaceProps & ClassAttributes = { - ref: onWorkspaceMounted, - onSaveDiagram: workspace => { - const layout = workspace.getModel().exportLayout(); - console.log(layout); - }, -}; - -onPageLoad(container => ReactDOM.render(createElement(Workspace, props), container)); diff --git a/DKBFrontEnd/src/src/examples/sparqlNoStats.ts b/DKBFrontEnd/src/src/examples/sparqlNoStats.ts deleted file mode 100644 index 0e24f6756..000000000 --- a/DKBFrontEnd/src/src/examples/sparqlNoStats.ts +++ /dev/null @@ -1,71 +0,0 @@ -import { createElement, ClassAttributes } from 'react'; -import * as ReactDOM from 'react-dom'; - -import { Workspace, WorkspaceProps, SparqlDataProvider, OWLRDFSSettings } from '../index'; - -import { onPageLoad, tryLoadLayoutFromLocalStorage, saveLayoutToLocalStorage } from './common'; - -require('jointjs/css/layout.css'); -require('jointjs/css/themes/default.css'); - -function onWorkspaceMounted(workspace: Workspace) { - if (!workspace) { return; } - - const model = workspace.getModel(); - model.graph.on('action:iriClick', (iri: string) => { - window.open(iri); - console.log(iri); - }); - - const layoutData = tryLoadLayoutFromLocalStorage(); - model.importLayout({ - layoutData, - validateLinks: true, - dataProvider: new SparqlDataProvider({ - endpointUrl: __SPARQL_ENDPOINT__, - imagePropertyUris: [ - 'http://www.researchspace.org/ontology/PX_has_main_representation', - 'http://xmlns.com/foaf/0.1/img', - ], - }, {...OWLRDFSSettings, ...{ - defaultPrefix: OWLRDFSSettings.defaultPrefix + ` -PREFIX rso: `, - dataLabelProperty: "rso:displayLabel", - ftsSettings: { - ftsPrefix: 'PREFIX bds: ' + '\n', - ftsQueryPattern: ` - ?inst rso:displayLabel ?searchLabel. - SERVICE bds:search { - ?searchLabel bds:search "\${text}*" ; - bds:minRelevance '0.5' ; - - bds:matchAllTerms 'true'; - bds:relevance ?score. - } - ` - }, - elementInfoQuery: ` - SELECT ?inst ?class ?label ?propType ?propValue - WHERE { - OPTIONAL {?inst rdf:type ?class . } - OPTIONAL {?inst \${dataLabelProperty} ?label} - OPTIONAL {?inst ?propType ?propValue. - FILTER (isLiteral(?propValue)) } - VALUES (?labelProp) { (rso:displayLabel) (rdfs:label) } - } VALUES (?inst) {\${ids}} - `, - } - }), - }); -} - -const props: WorkspaceProps & ClassAttributes = { - ref: onWorkspaceMounted, - onSaveDiagram: workspace => { - const {layoutData} = workspace.getModel().exportLayout(); - window.location.hash = saveLayoutToLocalStorage(layoutData); - window.location.reload(); - }, -}; - -onPageLoad(container => ReactDOM.render(createElement(Workspace, props), container)); diff --git a/DKBFrontEnd/src/src/examples/sparqlRDFGraph.ts b/DKBFrontEnd/src/src/examples/sparqlRDFGraph.ts deleted file mode 100644 index e4cfcc1d6..000000000 --- a/DKBFrontEnd/src/src/examples/sparqlRDFGraph.ts +++ /dev/null @@ -1,102 +0,0 @@ -import { createElement, ClassAttributes } from 'react'; -import * as ReactDOM from 'react-dom'; - -import { Workspace, WorkspaceProps, SparqlDataProvider, OWLStatsSettings, GraphBuilder, Triple } from '../index'; - -import { onPageLoad } from './common'; - -require('jointjs/css/layout.css'); -require('jointjs/css/themes/default.css'); - -const GRAPH: Triple[] = [ - { - subject: { - 'type': 'uri', - 'value': 'http://collection.britishmuseum.org/id/object/JCF8939', - }, - predicate: { - 'type': 'uri', - 'value': 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', - }, - object: { - 'type': 'uri', - 'value': 'http://www.cidoc-crm.org/cidoc-crm/E22_Man-Made_Object', - }, - }, - { - subject: { - 'type': 'uri', - 'value': 'http://collection.britishmuseum.org/id/object/JCF8939', - }, - predicate: { - 'type': 'uri', - 'value': 'http://www.cidoc-crm.org/cidoc-crm/P43_has_dimension', - }, - object: { - 'type': 'uri', - 'value': 'http://collection.britishmuseum.org/id/object/JCF8939/height/1', - }, - }, - { - subject: { - 'type': 'uri', - 'value': 'http://www.britishmuseum.org/collectionimages/AN00230/AN00230739_001_l.jpg/digiprocess', - }, - predicate: { - 'type': 'uri', - 'value': 'http://www.ics.forth.gr/isl/CRMdig/L1_digitized', - }, - object: { - 'type': 'uri', - 'value': 'http://collection.britishmuseum.org/id/object/JCF8939', - }, - }, - { - subject: { - 'type': 'uri', - 'value': 'http://collection.britishmuseum.org/id/object/JCF8939', - }, - predicate: { - 'type': 'uri', - 'value': 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', - }, - object: { - 'type': 'uri', - 'value': 'http://www.researchspace.org/ontology/Thing', - }, - }, -]; - -function onWorkspaceMounted(workspace: Workspace) { - if (!workspace) { return; } - - const model = workspace.getModel(); - const endpointUrl = __SPARQL_ENDPOINT__; - const sparqlDataProvider = new SparqlDataProvider({ - endpointUrl: endpointUrl, - imagePropertyUris: ['http://collection.britishmuseum.org/id/ontology/PX_has_main_representation'], - }, OWLStatsSettings); - const graphBuilder = new GraphBuilder(sparqlDataProvider); - - const loadingGraph = graphBuilder.getGraphFromRDFGraph(GRAPH); - workspace.showWaitIndicatorWhile(loadingGraph); - - loadingGraph.then(({layoutData, preloadedElements}) => model.importLayout({ - layoutData, - preloadedElements, - dataProvider: sparqlDataProvider, - })).then(() => { - workspace.forceLayout(); - workspace.zoomToFit(); - }); -} - -const props: WorkspaceProps & ClassAttributes = { - ref: onWorkspaceMounted, - onSaveDiagram: workspace => { - const layout = workspace.getModel().exportLayout(); - console.log(layout); - }, -}; - -onPageLoad(container => ReactDOM.render(createElement(Workspace, props), container)); diff --git a/DKBFrontEnd/src/src/examples/styleCustomization.ts b/DKBFrontEnd/src/src/examples/styleCustomization.ts deleted file mode 100644 index 61cda57a9..000000000 --- a/DKBFrontEnd/src/src/examples/styleCustomization.ts +++ /dev/null @@ -1,91 +0,0 @@ -import { createElement, ClassAttributes } from 'react'; -import * as ReactDOM from 'react-dom'; - -import { Workspace, WorkspaceProps, SparqlDataProvider, LinkStyle } from '../index'; - -import { onPageLoad, tryLoadLayoutFromLocalStorage, saveLayoutToLocalStorage } from './common'; - -require('jointjs/css/layout.css'); -require('jointjs/css/themes/default.css'); - -const CUSTOM_LINK_STYLE: LinkStyle = { - connection: { - stroke: '#3c4260', - 'stroke-width': 2, - }, - markerSource: { - fill: '#4b4a67', - stroke: '#4b4a67', - d: 'M0,3a3,3 0 1,0 6,0a3,3 0 1,0 -6,0', - width: 6, - height: 6, - }, - markerTarget: { - fill: '#4b4a67', - stroke: '#4b4a67', - d: 'm 20,5.88 -10.3,-5.95 0,5.6 -9.7,-5.6 0,11.82 9.7,-5.53 0,5.6 z', - width: 20, - height: 12, - }, - labels: [{ - attrs: { - text: {fill: '#3c4260'}, - }, - }], - connector: {name: 'rounded'}, - router: {name: 'orthogonal'}, -}; - -function onWorkspaceMounted(workspace: Workspace) { - if (!workspace) { return; } - - const model = workspace.getModel(); - model.graph.on('action:iriClick', (iri: string) => { - console.log(iri); - }); - - const layoutData = tryLoadLayoutFromLocalStorage(); - model.importLayout({ - layoutData, - dataProvider: new SparqlDataProvider({ - endpointUrl: __SPARQL_ENDPOINT__, - imagePropertyUris: [ - 'http://collection.britishmuseum.org/id/ontology/PX_has_main_representation', - 'http://xmlns.com/foaf/0.1/img', - ], - }), - }); -} - -const props: WorkspaceProps & ClassAttributes = { - ref: onWorkspaceMounted, - onSaveDiagram: workspace => { - const {layoutData} = workspace.getModel().exportLayout(); - window.location.hash = saveLayoutToLocalStorage(layoutData); - window.location.reload(); - }, - viewOptions: { - typeStyleResolvers: [ - types => { - if (types.indexOf('http://www.w3.org/2000/01/rdf-schema#Class') !== -1) { - return {icon: 'glyphicon glyphicon-certificate'}; - } else if (types.indexOf('http://www.w3.org/2002/07/owl#Class') !== -1) { - return {icon: 'glyphicon glyphicon-certificate'}; - } else if (types.indexOf('http://www.w3.org/2002/07/owl#ObjectProperty') !== -1) { - return {icon: 'glyphicon glyphicon-cog'}; - } else if (types.indexOf('http://www.w3.org/2002/07/owl#DatatypeProperty') !== -1) { - return {color: '#046380'}; - } else { - return undefined; - } - }, - ], - linkStyleResolvers: [ - type => { - return CUSTOM_LINK_STYLE; - }, - ], - }, -}; - -onPageLoad(container => ReactDOM.render(createElement(Workspace, props), container)); diff --git a/DKBFrontEnd/src/src/examples/template.ejs b/DKBFrontEnd/src/src/examples/template.ejs deleted file mode 100644 index cb9e017e8..000000000 --- a/DKBFrontEnd/src/src/examples/template.ejs +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - <%= htmlWebpackPlugin.options.title %> - - - - - - - - - - - - - - - - diff --git a/DKBFrontEnd/src/src/index.ts b/DKBFrontEnd/src/src/index.ts deleted file mode 100644 index 98f8ec567..000000000 --- a/DKBFrontEnd/src/src/index.ts +++ /dev/null @@ -1,19 +0,0 @@ -require('intro.js/introjs.css'); - -require('../styles/main.scss'); - -export * from './ontodia/customization/props'; -export * from './ontodia/customization/defaultTemplate'; -export * from './ontodia/customization/templates/stringTemplates'; -export * from './ontodia/data/model'; -export * from './ontodia/data/provider'; -export * from './ontodia/data/demo/provider'; -export { RdfNode, RdfIri, RdfLiteral, Triple } from './ontodia/data/sparql/sparqlModels'; -export * from './ontodia/data/sparql/sparqlDataProvider'; -export * from './ontodia/data/sparql/sparqlDataProviderSettings'; -export * from './ontodia/data/sparql/graphBuilder'; -export { Element, Link } from './ontodia/diagram/elements'; -export { LayoutData, LayoutCell, LayoutElement, LayoutLink } from './ontodia/diagram/layoutData'; -export * from './ontodia/diagram/model'; -export * from './ontodia/diagram/view'; -export { Workspace, Props as WorkspaceProps } from './ontodia/workspace/workspace'; diff --git a/DKBFrontEnd/src/src/ontodia/customization/defaultLinkStyles.ts b/DKBFrontEnd/src/src/ontodia/customization/defaultLinkStyles.ts deleted file mode 100644 index 03f0391e2..000000000 --- a/DKBFrontEnd/src/src/ontodia/customization/defaultLinkStyles.ts +++ /dev/null @@ -1,61 +0,0 @@ -import { LinkStyle, LinkStyleResolver } from './props'; - -const LINK_SUB_CLASS_OF: LinkStyle = { - connection: { - stroke: '#f8a485', - 'stroke-width': 2, - }, - markerTarget: { - fill: '#f8a485', - stroke: '#cf8e76', - }, -}; - -const LINK_DOMAIN: LinkStyle = { - connection: { - stroke: '#34c7f3', - 'stroke-width': 2, - }, - markerTarget: { - fill: '#34c7f3', - stroke: '#38b5db', - }, -}; - -const LINK_RANGE: LinkStyle = { - connection: { - stroke: '#34c7f3', - 'stroke-width': 2, - }, - markerTarget: { - fill: '#34c7f3', - stroke: '#38b5db', - }, -}; - -const LINK_TYPE_OF: LinkStyle = { - connection: { - stroke: '#8cd965', - 'stroke-width': 2, - }, - markerTarget: { - fill: '#8cd965', - stroke: '#5b9a3b', - }, -}; - -export const DefaultLinkStyleBundle: LinkStyleResolver[] = [ - type => { - if (type === 'http://www.w3.org/2000/01/rdf-schema#subClassOf') { - return LINK_SUB_CLASS_OF; - } else if (type === 'http://www.w3.org/2000/01/rdf-schema#domain') { - return LINK_DOMAIN; - } else if (type === 'http://www.w3.org/2000/01/rdf-schema#range') { - return LINK_RANGE; - } else if (type === 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type') { - return LINK_TYPE_OF; - } else { - return undefined; - } - }, -]; diff --git a/DKBFrontEnd/src/src/ontodia/customization/defaultTemplate.tsx b/DKBFrontEnd/src/src/ontodia/customization/defaultTemplate.tsx deleted file mode 100644 index 801253aab..000000000 --- a/DKBFrontEnd/src/src/ontodia/customization/defaultTemplate.tsx +++ /dev/null @@ -1,86 +0,0 @@ -import * as React from 'react'; - -import { TemplateProps } from './props'; - -const CLASS_NAME = 'ontodia-default-template'; - -export class DefaultTemplate extends React.Component { - render() { - const props = this.props; - - const imageStyle: React.CSSProperties = {borderBottomColor: props.color}; - const image = props.imgUrl ? ( -
- -
- ) : undefined; - - let propertyTable: React.ReactElement; - if (props.propsAsList && props.propsAsList.length > 0) { - propertyTable =
- {props.propsAsList.map(prop => { - const values = prop.property.values.map(({text}, index) => -
- {text} -
- ); - return ( -
-
- {prop.name} -
-
- {values} -
-
- ); - })} -
; - } else { - propertyTable =
no properties
; - } - - const expander = props.isExpanded ? ( -
-
-
- IRI: -
- -
-
- {propertyTable} -
- ) : undefined; - - return ( -
-
- -
-
- {props.types} -
-
-
- {image} -
- - {expander} -
-
- ); - } -} diff --git a/DKBFrontEnd/src/src/ontodia/customization/defaultTypeStyles.ts b/DKBFrontEnd/src/src/ontodia/customization/defaultTypeStyles.ts deleted file mode 100644 index c09bca13a..000000000 --- a/DKBFrontEnd/src/src/ontodia/customization/defaultTypeStyles.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { TypeStyleResolver } from './props'; - -export const DefaultTypeStyleBundle: TypeStyleResolver[] = [ - types => { - if (types.indexOf('http://www.w3.org/2002/07/owl#Class') !== -1 || - types.indexOf('http://www.w3.org/2000/01/rdf-schema#Class') !== -1 - ) { - return {color: '#eaac77', icon: 'ontodia-class-icon'}; - } else if (types.indexOf('http://www.w3.org/2002/07/owl#ObjectProperty') !== -1) { - return {color: '#34c7f3', icon: 'ontodia-object-property-icon'}; - } else if (types.indexOf('http://www.w3.org/2002/07/owl#DatatypeProperty') !== -1) { - return {color: '#34c7f3', icon: 'ontodia-datatype-property-icon'}; - } else if (types.indexOf('http://xmlns.com/foaf/0.1/Person') !== -1) { - return {color: '#eb7777', icon: 'ontodia-person-icon'}; - } else if ( - types.indexOf('http://schema.org/Organization') !== -1 || - types.indexOf('http://dbpedia.org/ontology/Organisation') !== -1 || - types.indexOf('http://xmlns.com/foaf/0.1/Organization') !== -1 - ) { - return {color: '#77ca98', icon: 'ontodia-organization-icon'}; - } else { - return undefined; - } - }, -]; diff --git a/DKBFrontEnd/src/src/ontodia/customization/handlebarsTemplate.tsx b/DKBFrontEnd/src/src/ontodia/customization/handlebarsTemplate.tsx deleted file mode 100644 index bcf79435d..000000000 --- a/DKBFrontEnd/src/src/ontodia/customization/handlebarsTemplate.tsx +++ /dev/null @@ -1,101 +0,0 @@ -import * as React from 'react'; -import { findDOMNode } from 'react-dom'; -import { compile as compileTemplate, HandlebarsTemplateDelegate } from 'handlebars'; - -import { Dictionary, Property } from '../data/model'; - -import { TemplateProps } from './props'; - -export interface HandlebarsTemplateProps { - template: string; - templateProps: TemplateProps; - onLoad?: () => void; -} - -const HANDLEBARS_HELPERS = { - getProperty: (props: Dictionary, id: string) => { - if (props && props[id]) { - return props[id].values.map(v => v.text).join(', '); - } else { - return undefined; - } - }, -}; - -export class HandlebarsTemplate extends React.Component { - private compiledTemplate: HandlebarsTemplateDelegate; - - private cancelLoad = () => { /* nothing */ }; - - constructor(props: HandlebarsTemplateProps) { - super(props); - this.compiledTemplate = compileTemplate(this.props.template); - } - - render() { - return
; - } - - renderTemplate() { - const {templateProps} = this.props; - const html = this.compiledTemplate(templateProps, {helpers: HANDLEBARS_HELPERS}); - return {__html: html}; - } - - componentDidMount() { - this.subscribeOnLoad(); - } - - componentDidUpdate() { - this.subscribeOnLoad(); - } - - componentWillUnmount() { - this.cancelLoad(); - } - - private subscribeOnLoad() { - this.cancelLoad(); - const {onLoad} = this.props; - const node = findDOMNode(this) as HTMLElement; - if (onLoad) { - let cancelled = false; - this.cancelLoad = () => cancelled = true; - this.subscribeOnImagesLoad(node).then(() => { - if (!cancelled) { onLoad(); } - }); - } - } - - private subscribeOnImagesLoad(node: HTMLElement) { - const loadingImages: Promise[] = []; - const images = node.querySelectorAll('img'); - for (let i = 0; i < images.length; i++) { - const image = images[i]; - const loadPromise = whenImageLoad(image); - if (loadPromise) { loadingImages.push(loadPromise); } - } - return Promise.all(loadingImages).then(() => { /* nothing*/ }); - } -} - -function whenImageLoad(image: HTMLImageElement): Promise | undefined { - if (image.complete) { return undefined; } - return new Promise(resolve => { - let removeListeners: () => void; - const loadListener = () => { - removeListeners(); - resolve(); - }; - const errorListener = () => { - removeListeners(); - resolve(); - }; - removeListeners = () => { - image.removeEventListener('load', loadListener, true); - image.removeEventListener('error', loadListener, true); - }; - image.addEventListener('load', loadListener, true); - image.addEventListener('error', errorListener, true); - }); -} diff --git a/DKBFrontEnd/src/src/ontodia/customization/props.ts b/DKBFrontEnd/src/src/ontodia/customization/props.ts deleted file mode 100644 index 006073e0b..000000000 --- a/DKBFrontEnd/src/src/ontodia/customization/props.ts +++ /dev/null @@ -1,83 +0,0 @@ -import { ComponentClass } from 'react'; - -import { Dictionary, Property } from '../data/model'; - -export type TypeStyleResolver = (types: string[]) => CustomTypeStyle | undefined; -export type LinkStyleResolver = (type: string) => LinkStyle | undefined; -export type TemplateResolver = (types: string[]) => ElementTemplate | undefined; - -export interface CustomTypeStyle { - color?: string; - icon?: string; -} - -export type ElementTemplate = ComponentClass | string; - -export interface TemplateProps { - types: string; - label: string; - color: any; - icon: string; - iri: string; - imgUrl?: string; - isExpanded?: boolean; - propsAsList?: PropArray; - props?: Dictionary; -} - -export type PropArray = Array<{ - id: string; - name: string; - property: Property; -}>; - -export interface LinkStyle { - connection?: { - fill?: string; - stroke?: string; - 'stroke-width'?: number; - 'stroke-dasharray'?: string; - }; - markerSource?: LinkMarkerStyle; - markerTarget?: LinkMarkerStyle; - labels?: LinkLabelStyle[]; - connector?: { - name?: string; - args?: { - radius?: number; - }; - }; - router?: { - name?: string; - args?: { - startDirections?: string[]; - endDirections?: string[]; - excludeTypes?: string[]; - }; - }; -} - -export interface LinkMarkerStyle { - fill?: string; - stroke?: string; - strokeWidth?: string; - d?: string; - width?: number; - height?: number; -} - -export interface LinkLabelStyle { - position?: number; - attrs?: { - rect?: { - fill?: string; - 'stroke'?: string; - 'stroke-width'?: number; - }; - text?: { - fill?: string; - 'stroke'?: string; - 'stroke-width'?: number; - }; - }; -} diff --git a/DKBFrontEnd/src/src/ontodia/customization/templates/defaultTemplates.ts b/DKBFrontEnd/src/src/ontodia/customization/templates/defaultTemplates.ts deleted file mode 100644 index 8fe673c9d..000000000 --- a/DKBFrontEnd/src/src/ontodia/customization/templates/defaultTemplates.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { TemplateResolver } from '../props'; - -import { LeftBarTemplate, BigIconTemplate, PersonTemplate, OrganizationTemplate } from './stringTemplates'; - -export const DefaultTemplateBundle: TemplateResolver[] = [ - types => { - if (types.indexOf('http://www.w3.org/2000/01/rdf-schema#Class') !== -1) { - return BigIconTemplate; - } else { - return undefined; - } - }, - types => { - if (types.indexOf('http://www.w3.org/2002/07/owl#Class') !== -1) { - return BigIconTemplate; - } else { - return undefined; - } - }, - types => { - if (types.indexOf('http://www.w3.org/2002/07/owl#ObjectProperty') !== -1) { - return LeftBarTemplate; - } else { - return undefined; - } - }, - types => { - if (types.indexOf('http://www.w3.org/2002/07/owl#DatatypeProperty') !== -1) { - return LeftBarTemplate; - } else { - return undefined; - } - }, - types => { - if (types.indexOf('http://xmlns.com/foaf/0.1/Person') !== -1 || - types.indexOf('http://www.wikidata.org/entity/Q5') !== -1 ) { - return PersonTemplate; - } else { - return undefined; - } - }, - types => { - if ( - types.indexOf('http://schema.org/Organization') !== -1 || - types.indexOf('http://dbpedia.org/ontology/Organisation') !== -1 || - types.indexOf('http://xmlns.com/foaf/0.1/Organization') !== -1 - ) { - return OrganizationTemplate; - } else { - return undefined; - } - }, -]; diff --git a/DKBFrontEnd/src/src/ontodia/customization/templates/stringTemplates.ts b/DKBFrontEnd/src/src/ontodia/customization/templates/stringTemplates.ts deleted file mode 100644 index e6c661189..000000000 --- a/DKBFrontEnd/src/src/ontodia/customization/templates/stringTemplates.ts +++ /dev/null @@ -1,337 +0,0 @@ -export const DefaultElementTemplate = ` -
-
- -
-
{{types}}
-
-
- {{#if imgUrl}} - - {{/if}} -
- - {{#if isExpanded}} -
-
- IRI: -
- -
- -
- {{#if propsAsList.length}} -
- {{#each propsAsList}} -
-
- {{name}} -
-
- {{#each property.values}} -
- {{text}} -
- {{/each}} -
-
- {{/each}} -
- {{else}} - no properties - {{/if}} - {{/if}} -
-
-`; - -export const LeftBarTemplate = ` -
-
- {{#if imgUrl}} - - {{/if}} -
- -
- {{types}} -
-
- - {{label}} - - {{#if isExpanded}} -
-
- IRI: -
- -
- -
- {{#if propsAsList.length}} -
- {{#each propsAsList}} -
-
- {{name}} -
-
- {{#each property.values}} -
- {{text}} -
- {{/each}} -
-
- {{/each}} -
- {{else}} - no properties - {{/if}} - {{/if}} -
-
-`; - -export const BigIconTemplate = ` -
-
-
-
- - {{label}} - -
-
{{types}}
-
-
- -
-
- {{#if isExpanded}} -
- {{#if imgUrl}} - - {{/if}} -
-
-
- IRI: -
-
- {{iri}} -
-
- -
- {{#if propsAsList.length}} -
- {{#each propsAsList}} -
-
- {{name}} -
-
- {{#each property.values}} -
- {{text}} -
- {{/each}} -
-
- {{/each}} -
- {{else}} - no properties - {{/if}} -
-
- {{/if}} -
-`; - -export const PersonTemplate = ` -
-
-
- {{#if imgUrl}} - - {{else}} - - {{/if}} -
-
-
Person
-
-
-
-
- {{#if isExpanded}} -
- {{#if imgUrl}} - - {{/if}} -
-
-
- IRI: -
-
- {{iri}} -
-
- -
- {{#if propsAsList.length}} -
- {{#each propsAsList}} -
-
- {{name}} -
-
- {{#each property.values}} -
- {{text}} -
- {{/each}} -
-
- {{/each}} -
- {{else}} - no properties - {{/if}} -
-
- {{/if}} -
-`; - -export const OrganizationTemplate = ` -
-
- -
-
- Organization -
- {{#if (getProperty props "http://xmlns.com/foaf/0.1/name") }} - - {{else}} - - {{/if}} -
-
- {{#if isExpanded}} -
-
- IRI: -
- -
- -
- {{#if propsAsList.length}} -
- {{#each propsAsList}} -
-
- {{name}} -
-
- {{#each property.values}} -
- {{text}} -
- {{/each}} -
-
- {{/each}} -
- {{else}} - no properties - {{/if}} - {{/if}} -
-
-
-`; diff --git a/DKBFrontEnd/src/src/ontodia/data/demo/data/classes.json b/DKBFrontEnd/src/src/ontodia/data/demo/data/classes.json deleted file mode 100644 index 4499ea4fd..000000000 --- a/DKBFrontEnd/src/src/ontodia/data/demo/data/classes.json +++ /dev/null @@ -1,697 +0,0 @@ -[ - { - "id": "http://www.w3.org/2002/07/owl#Thing", - "label": { - "values": [ - { - "text": "Thing", - "lang": "en" - }, - { - "text": "Вещь", - "lang": "ru" - } - ] - }, - "count": 8, - "children": [ - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#ServiceProvider", - "label": { - "values": [ - { - "text": "ServiceProvider", - "lang": "" - } - ] - }, - "count": 2, - "children": [] - }, - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#SimpleProperty", - "label": { - "values": [ - { - "text": "SimpleProperty", - "lang": "" - } - ] - }, - "count": 0, - "children": [ - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Image", - "label": { - "values": [ - { - "text": "Image", - "lang": "" - } - ] - }, - "count": 0, - "children": [] - }, - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Speed", - "label": { - "values": [ - { - "text": "Speed", - "lang": "" - } - ] - }, - "count": 0, - "children": [] - } - ] - }, - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#RTService", - "label": { - "values": [ - { - "text": "RTService", - "lang": "" - } - ] - }, - "count": 0, - "children": [] - }, - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Operation", - "label": { - "values": [ - { - "text": "Operation", - "lang": "" - } - ] - }, - "count": 0, - "children": [ - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Subscription", - "label": { - "values": [ - { - "text": "Subscription", - "lang": "" - } - ] - }, - "count": 0, - "children": [ - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Unsubscribe", - "label": { - "values": [ - { - "text": "Unsubscribe", - "lang": "" - } - ] - }, - "count": 0, - "children": [] - }, - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Subscribe", - "label": { - "values": [ - { - "text": "Subscribe", - "lang": "" - } - ] - }, - "count": 0, - "children": [] - } - ] - }, - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Contact", - "label": { - "values": [ - { - "text": "Contact", - "lang": "" - } - ] - }, - "count": 0, - "children": [ - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#TurnOff", - "label": { - "values": [ - { - "text": "TurnOff", - "lang": "" - } - ] - }, - "count": 0, - "children": [] - }, - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Connect", - "label": { - "values": [ - { - "text": "Соединение", - "lang": "" - } - ] - }, - "count": 0, - "children": [] - }, - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Disconnect", - "label": { - "values": [ - { - "text": "Disconnect", - "lang": "" - } - ] - }, - "count": 0, - "children": [] - }, - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#TurnOn", - "label": { - "values": [ - { - "text": "TurnOn", - "lang": "" - } - ] - }, - "count": 0, - "children": [] - } - ] - }, - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Observe", - "label": { - "values": [ - { - "text": "Observe", - "lang": "" - } - ] - }, - "count": 0, - "children": [ - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Disappear", - "label": { - "values": [ - { - "text": "Disappear", - "lang": "" - } - ] - }, - "count": 0, - "children": [] - }, - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Appear", - "label": { - "values": [ - { - "text": "Appear", - "lang": "" - } - ] - }, - "count": 0, - "children": [] - } - ] - } - ] - }, - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Service", - "label": { - "values": [ - { - "text": "Service", - "lang": "" - } - ] - }, - "count": 6, - "children": [ - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#TVChannel", - "label": { - "values": [ - { - "text": "TVChannel", - "lang": "" - } - ] - }, - "count": 1, - "children": [ - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#DigitalTVChannel", - "label": { - "values": [ - { - "text": "DigitalTVChannel", - "lang": "" - } - ] - }, - "count": 0, - "children": [] - }, - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#AnalogueTVChannel", - "label": { - "values": [ - { - "text": "AnalogueTVChannel", - "lang": "" - } - ] - }, - "count": 0, - "children": [] - } - ] - }, - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#ServiceDevice", - "label": { - "values": [ - { - "text": "ServiceDevice", - "lang": "" - } - ] - }, - "count": 0, - "children": [ - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Battery", - "label": { - "values": [ - { - "text": "Battery", - "lang": "" - } - ] - }, - "count": 0, - "children": [] - }, - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Router", - "label": { - "values": [ - { - "text": "Router", - "lang": "" - } - ] - }, - "count": 0, - "children": [ - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#WiFiRouter", - "label": { - "values": [ - { - "text": "WiFiRouter", - "lang": "" - } - ] - }, - "count": 0, - "children": [] - } - ] - }, - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#CamModule", - "label": { - "values": [ - { - "text": "CamModule", - "lang": "" - } - ] - }, - "count": 0, - "children": [] - }, - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#TVSet", - "label": { - "values": [ - { - "text": "TVSet", - "lang": "" - } - ] - }, - "count": 0, - "children": [] - }, - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#ControlPanel", - "label": { - "values": [ - { - "text": "ControlPanel", - "lang": "" - } - ] - }, - "count": 0, - "children": [] - }, - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Cable", - "label": { - "values": [ - { - "text": "Cable", - "lang": "" - } - ] - }, - "count": 0, - "children": [] - }, - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#SetTopBox", - "label": { - "values": [ - { - "text": "SetTopBox", - "lang": "" - } - ] - }, - "count": 0, - "children": [] - } - ] - }, - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#All", - "label": { - "values": [ - { - "text": "All", - "lang": "" - } - ] - }, - "count": 0, - "children": [] - }, - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#SubscribableService", - "label": { - "values": [ - { - "text": "SubscribableService", - "lang": "" - } - ] - }, - "count": 5, - "children": [ - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#TVService", - "label": { - "values": [ - { - "text": "TVService", - "lang": "" - } - ] - }, - "count": 0, - "children": [ - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#DigitalTVService", - "label": { - "values": [ - { - "text": "DigitalTVService", - "lang": "" - } - ] - }, - "count": 0, - "children": [] - } - ] - }, - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Internet", - "label": { - "values": [ - { - "text": "Internet", - "lang": "" - } - ] - }, - "count": 0, - "children": [] - }, - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#ChannelPack", - "label": { - "values": [ - { - "text": "ChannelPack", - "lang": "" - } - ] - }, - "count": 5, - "children": [] - } - ] - } - ] - }, - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#ServiceDesk", - "label": { - "values": [ - { - "text": "ServiceDesk", - "lang": "" - } - ] - }, - "count": 0, - "children": [] - }, - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#PropertyAsGoods", - "label": { - "values": [ - { - "text": "PropertyAsGoods", - "lang": "" - } - ] - }, - "count": 0, - "children": [ - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Home", - "label": { - "values": [ - { - "text": "Home", - "lang": "" - } - ] - }, - "count": 0, - "children": [ - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Flat", - "label": { - "values": [ - { - "text": "Flat", - "lang": "" - } - ] - }, - "count": 0, - "children": [] - } - ] - }, - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Phone", - "label": { - "values": [ - { - "text": "Phone", - "lang": "" - } - ] - }, - "count": 0, - "children": [ - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#HomePhone", - "label": { - "values": [ - { - "text": "HomePhone", - "lang": "" - } - ] - }, - "count": 0, - "children": [] - } - ] - } - ] - }, - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#User", - "label": { - "values": [ - { - "text": "User", - "lang": "" - } - ] - }, - "count": 0, - "children": [] - }, - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#ServiceMan", - "label": { - "values": [ - { - "text": "ServiceMan", - "lang": "" - } - ] - }, - "count": 0, - "children": [] - } - ] - }, - { - "id": "http://www.w3.org/1999/02/22-rdf-syntax-ns#Property", - "label": { - "values": [ - { - "text": "Property", - "lang": "" - } - ] - }, - "count": 3, - "children": [] - }, - { - "id": "http://www.w3.org/2000/01/rdf-schema#Datatype", - "label": { - "values": [ - { - "text": "Datatype", - "lang": "" - } - ] - }, - "count": 3, - "children": [] - }, - { - "id": "http://www.w3.org/2002/07/owl#Class", - "label": { - "values": [ - { - "text": "Class", - "lang": "" - } - ] - }, - "count": 44, - "children": [] - }, - { - "id": "http://www.w3.org/2002/07/owl#Ontology", - "label": { - "values": [ - { - "text": "Ontology", - "lang": "" - } - ] - }, - "count": 1, - "children": [] - }, - { - "id": "http://www.w3.org/2002/07/owl#AnnotationProperty", - "label": { - "values": [ - { - "text": "AnnotationProperty", - "lang": "" - } - ] - }, - "count": 1, - "children": [] - }, - { - "id": "http://www.w3.org/2002/07/owl#ObjectProperty", - "label": { - "values": [ - { - "text": "ObjectProperty", - "lang": "" - } - ] - }, - "count": 3, - "children": [] - }, - { - "id": "http://www.w3.org/2002/07/owl#DatatypeProperty", - "label": { - "values": [ - { - "text": "DatatypeProperty", - "lang": "" - } - ] - }, - "count": 30, - "children": [] - } -] diff --git a/DKBFrontEnd/src/src/ontodia/data/demo/data/elements.json b/DKBFrontEnd/src/src/ontodia/data/demo/data/elements.json deleted file mode 100644 index 4103f5ba7..000000000 --- a/DKBFrontEnd/src/src/ontodia/data/demo/data/elements.json +++ /dev/null @@ -1,2641 +0,0 @@ -{ - "http://ailab.ifmo.ru/dialog/tv/schema": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema", - "types": [ - "http://www.w3.org/2002/07/owl#Ontology" - ], - "label": { - "values": [ - { - "text": "schema", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2002/07/owl#versionInfo": { - "type": "string", - "values": [ - { - "text": "Created with TopBraid Composer", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#ortChannel": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#ortChannel", - "types": [ - "http://ailab.ifmo.ru/dialog/tv/schema#TVChannel" - ], - "label": { - "values": [ - { - "text": "ortChannel", - "lang": "" - } - ] - }, - "properties": { - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "орт", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#Battery": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Battery", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "Battery", - "lang": "" - } - ] - }, - "properties": { - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "батарейка", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#rostelekom": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#rostelekom", - "types": [ - "http://ailab.ifmo.ru/dialog/tv/schema#ServiceProvider" - ], - "label": { - "values": [ - { - "text": "rostelekom", - "lang": "" - } - ] - }, - "properties": { - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "ростелеком", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#problemStated": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#problemStated", - "types": [ - "http://www.w3.org/2002/07/owl#DatatypeProperty" - ], - "label": { - "values": [ - { - "text": "problemStated", - "lang": "" - } - ] - }, - "properties": {} - }, - "http://ailab.ifmo.ru/dialog/tv/schema#hdPremiumChannelPack": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#hdPremiumChannelPack", - "types": [ - "http://ailab.ifmo.ru/dialog/tv/schema#ChannelPack" - ], - "label": { - "values": [ - { - "text": "hdPremiumChannelPack", - "lang": "" - } - ] - }, - "properties": { - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "эйчди-премиум", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#subscriberName": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#subscriberName", - "types": [ - "http://www.w3.org/2002/07/owl#DatatypeProperty" - ], - "label": { - "values": [ - { - "text": "subscriberName", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Имя человека, на которого оформлен договор.", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "оформлять", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#encryptedSignal": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#encryptedSignal", - "types": [ - "http://www.w3.org/2002/07/owl#DatatypeProperty" - ], - "label": { - "values": [ - { - "text": "encryptedSignal", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "На экаране показывается, что сигнал зашифрован ил нет доступа", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#forwardedToAccounts": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#forwardedToAccounts", - "types": [ - "http://www.w3.org/2002/07/owl#DatatypeProperty" - ], - "label": { - "values": [ - { - "text": "forwardedToAccounts", - "lang": "" - } - ] - }, - "properties": {} - }, - "http://ailab.ifmo.ru/dialog/tv/schema#TVService": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#TVService", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "TVService", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Услуга телевидения. Пока нахождение на этом уровне определяется только необходимостью преобразования в онто-факты.", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "телевидение", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#Address": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Address", - "types": [ - "http://www.w3.org/2000/01/rdf-schema#Datatype" - ], - "label": { - "values": [ - { - "text": "Address", - "lang": "" - } - ] - }, - "properties": {} - }, - "http://ailab.ifmo.ru/dialog/tv/schema#TurnOff": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#TurnOff", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "TurnOff", - "lang": "" - } - ] - }, - "properties": { - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "выключать", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#TVChannel": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#TVChannel", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "TVChannel", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Телевизионный канал.", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "канал", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#ServiceDevice": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#ServiceDevice", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "ServiceDevice", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Устройство у пользователя, отвечающее за предоставление услуг", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#Connect": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Connect", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "Соединение", - "lang": "" - } - ] - }, - "properties": { - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "втыкать", - "lang": "" - }, - { - "text": "вставлять", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#falseExpressedBy": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#falseExpressedBy", - "types": [ - "http://www.w3.org/1999/02/22-rdf-syntax-ns#Property" - ], - "label": { - "values": [ - { - "text": "falseExpressedBy", - "lang": "" - } - ] - }, - "properties": {} - }, - "http://ailab.ifmo.ru/dialog/tv/schema#changedSpeed": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#changedSpeed", - "types": [ - "http://www.w3.org/2002/07/owl#DatatypeProperty" - ], - "label": { - "values": [ - { - "text": "changedSpeed", - "lang": "" - } - ] - }, - "properties": { - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "уменьшать", - "lang": "" - }, - { - "text": "увеличивать", - "lang": "" - }, - { - "text": "снижать", - "lang": "" - }, - { - "text": "поднимать", - "lang": "" - }, - { - "text": "изменять", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#kinoChannelPack": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#kinoChannelPack", - "types": [ - "http://ailab.ifmo.ru/dialog/tv/schema#ChannelPack" - ], - "label": { - "values": [ - { - "text": "kinoChannelPack", - "lang": "" - } - ] - }, - "properties": { - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "кино", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#Subscription": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Subscription", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "Subscription", - "lang": "" - } - ] - }, - "properties": {} - }, - "http://ailab.ifmo.ru/dialog/tv/schema#switchedOn": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#switchedOn", - "types": [ - "http://www.w3.org/2002/07/owl#DatatypeProperty" - ], - "label": { - "values": [ - { - "text": "switchedOn", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Включено ли устройство.", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#falseExpressedBy": { - "type": "string", - "values": [ - { - "text": "tv:TurnOff", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#trueExpressedBy": { - "type": "string", - "values": [ - { - "text": "tv:TurnOn", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#Contact": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Contact", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "Contact", - "lang": "" - } - ] - }, - "properties": {} - }, - "http://ailab.ifmo.ru/dialog/tv/schema#canHelp": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#canHelp", - "types": [ - "http://www.w3.org/2002/07/owl#DatatypeProperty" - ], - "label": { - "values": [ - { - "text": "canHelp", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Система спрашивает 'Я могу еще чем-либо помочь?'", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#trueExpressedBy": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#trueExpressedBy", - "types": [ - "http://www.w3.org/1999/02/22-rdf-syntax-ns#Property" - ], - "label": { - "values": [ - { - "text": "trueExpressedBy", - "lang": "" - } - ] - }, - "properties": {} - }, - "http://ailab.ifmo.ru/dialog/tv/schema#inserted": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#inserted", - "types": [ - "http://www.w3.org/2002/07/owl#DatatypeProperty" - ], - "label": { - "values": [ - { - "text": "inserted", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Вставлен ли Cam-модуль в ТВ или приставку", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#falseExpressedBy": { - "type": "string", - "values": [ - { - "text": "tv:Disconnect", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#trueExpressedBy": { - "type": "string", - "values": [ - { - "text": "tv:Connect", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#operational": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#operational", - "types": [ - "http://www.w3.org/2002/07/owl#DatatypeProperty" - ], - "label": { - "values": [ - { - "text": "operational", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Работает в смысле 'Не сломано и может выполняет основные фунции'", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#falseExpressedBy": { - "type": "string", - "values": [ - { - "text": "tv:Disappear", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "работать", - "lang": "" - }, - { - "text": "показывать", - "lang": "" - }, - { - "text": "включаться", - "lang": "" - }, - { - "text": "включать", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#Name": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Name", - "types": [ - "http://www.w3.org/2000/01/rdf-schema#Datatype" - ], - "label": { - "values": [ - { - "text": "Name", - "lang": "" - } - ] - }, - "properties": {} - }, - "http://ailab.ifmo.ru/dialog/tv/schema#Router": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Router", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "Router", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Роутер - устройство маршрутизации между сетями, компонент услуги предоставление доступа в интернет или интерактивного телевидения.", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "роутер", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#Disconnect": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Disconnect", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "Disconnect", - "lang": "" - } - ] - }, - "properties": { - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "извлекать", - "lang": "" - }, - { - "text": "вытаскивать", - "lang": "" - }, - { - "text": "вынимать", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#Unsubscribe": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Unsubscribe", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "Unsubscribe", - "lang": "" - } - ] - }, - "properties": { - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "отписываться", - "lang": "" - }, - { - "text": "отключать", - "lang": "" - }, - { - "text": "отказываться", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#CamModule": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#CamModule", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "CamModule", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Cam-модуль, отвечает за декодирование платных каналов DVB. Может вставляться в телевизор или в теле-приставку.", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "к-модуль", - "lang": "" - }, - { - "text": "cam-модуль", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#Subscribe": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Subscribe", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "Subscribe", - "lang": "" - } - ] - }, - "properties": { - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "устанавливать", - "lang": "" - }, - { - "text": "подключать", - "lang": "" - }, - { - "text": "переходить", - "lang": "" - }, - { - "text": "настраивать", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#Internet": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Internet", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "Internet", - "lang": "" - } - ] - }, - "properties": { - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "интернет", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#sufficientFunds": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#sufficientFunds", - "types": [ - "http://www.w3.org/2002/07/owl#DatatypeProperty" - ], - "label": { - "values": [ - { - "text": "sufficientFunds", - "lang": "" - } - ] - }, - "properties": {} - }, - "http://ailab.ifmo.ru/dialog/tv/schema#ServiceProvider": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#ServiceProvider", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "ServiceProvider", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Поставщик услуг.", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#suspended": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#suspended", - "types": [ - "http://www.w3.org/2002/07/owl#DatatypeProperty" - ], - "label": { - "values": [ - { - "text": "suspended", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Приостановлено ли предоставление услуги из-за отсутствия оплаты или еще каких причин.", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "отключать", - "lang": "" - }, - { - "text": "заблокировать", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#SimpleProperty": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#SimpleProperty", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "SimpleProperty", - "lang": "" - } - ] - }, - "properties": {} - }, - "http://ailab.ifmo.ru/dialog/tv/schema#RTService": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#RTService", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "RTService", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Услуга ростелекома как элемент оплаты, биллинга, части договора.", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "услуга", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#serviceNumber": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#serviceNumber", - "types": [ - "http://www.w3.org/2002/07/owl#DatatypeProperty" - ], - "label": { - "values": [ - { - "text": "serviceNumber", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Номер услуги клиента. Используется для идентификации клиента.", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "номер", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#Disappear": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Disappear", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "Disappear", - "lang": "" - } - ] - }, - "properties": { - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "отключаться", - "lang": "" - }, - { - "text": "пропадать", - "lang": "" - }, - { - "text": "исчезать", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#Operation": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Operation", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "Operation", - "lang": "" - } - ] - }, - "properties": {} - }, - "http://ailab.ifmo.ru/dialog/tv/schema#WiFiRouter": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#WiFiRouter", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "WiFiRouter", - "lang": "" - } - ] - }, - "properties": { - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "WiFi", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#Service": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Service", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "Service", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Сервис, класс всех сущностей, ответственных за предоставление услуг клиентам.", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#DigitalTVChannel": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#DigitalTVChannel", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "DigitalTVChannel", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Цифровой телевизионный канал.", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "цифровой", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#rent": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#rent", - "types": [ - "http://www.w3.org/2002/07/owl#ObjectProperty" - ], - "label": { - "values": [ - { - "text": "rent", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Арендовать указанное имущество", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "арендовать", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#ServiceDesk": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#ServiceDesk", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "ServiceDesk", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Служба поддержки.", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#filedRequest": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#filedRequest", - "types": [ - "http://www.w3.org/2002/07/owl#DatatypeProperty" - ], - "label": { - "values": [ - { - "text": "filedRequest", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Пользователь оставил заявку", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#isClientOf": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#isClientOf", - "types": [ - "http://www.w3.org/2002/07/owl#ObjectProperty" - ], - "label": { - "values": [ - { - "text": "isClientOf", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Являться клиентом указанного оператора", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "клиент", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#came": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#came", - "types": [ - "http://www.w3.org/2002/07/owl#DatatypeProperty" - ], - "label": { - "values": [ - { - "text": "came", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Был ли мастер у клиента.", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "приходить", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#Observe": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Observe", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "Observe", - "lang": "" - } - ] - }, - "properties": {} - }, - "http://ailab.ifmo.ru/dialog/tv/schema#PropertyAsGoods": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#PropertyAsGoods", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "PropertyAsGoods", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Собственность пользователя в виде материальных или нематериальных объектов.", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#expressedBy": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#expressedBy", - "types": [ - "http://www.w3.org/1999/02/22-rdf-syntax-ns#Property" - ], - "label": { - "values": [ - { - "text": "expressedBy", - "lang": "" - } - ] - }, - "properties": {} - }, - "http://ailab.ifmo.ru/dialog/tv/schema#modified": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#modified", - "types": [ - "http://www.w3.org/2002/07/owl#DatatypeProperty" - ], - "label": { - "values": [ - { - "text": "modified", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Перенастроено ли устройство, были ли изменены настройки.", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "настраивать", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#ChannelPack": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#ChannelPack", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "ChannelPack", - "lang": "" - } - ] - }, - "properties": { - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "тариф", - "lang": "" - }, - { - "text": "план", - "lang": "" - }, - { - "text": "пакет", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#deviceModel": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#deviceModel", - "types": [ - "http://www.w3.org/2002/07/owl#DatatypeProperty" - ], - "label": { - "values": [ - { - "text": "deviceModel", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Название модели устройства.", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "модель", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#popularChannelPack": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#popularChannelPack", - "types": [ - "http://ailab.ifmo.ru/dialog/tv/schema#ChannelPack" - ], - "label": { - "values": [ - { - "text": "popularChannelPack", - "lang": "" - } - ] - }, - "properties": { - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "популярный", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#canHangUp": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#canHangUp", - "types": [ - "http://www.w3.org/2002/07/owl#DatatypeProperty" - ], - "label": { - "values": [ - { - "text": "canHangUp", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Можно ли клиенту повесить трубку и продложить решать проблему автономно.", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#canSolve": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#canSolve", - "types": [ - "http://www.w3.org/2002/07/owl#DatatypeProperty" - ], - "label": { - "values": [ - { - "text": "canSolve", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Может ли служба поддержки решить проблему пользователя. Нет - в случае неработающего телевизора, например.", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#userCanSwitchChannel": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#userCanSwitchChannel", - "types": [ - "http://www.w3.org/2002/07/owl#DatatypeProperty" - ], - "label": { - "values": [ - { - "text": "userCanSwitchChannel", - "lang": "" - } - ] - }, - "properties": { - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "переключаться", - "lang": "" - }, - { - "text": "переключать", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#rebooted": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#rebooted", - "types": [ - "http://www.w3.org/2002/07/owl#DatatypeProperty" - ], - "label": { - "values": [ - { - "text": "rebooted", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Перезагружено ли устройство", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "перезагружать", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#own": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#own", - "types": [ - "http://www.w3.org/2002/07/owl#ObjectProperty" - ], - "label": { - "values": [ - { - "text": "own", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Владеть указанным имуществом", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "есть", - "lang": "" - }, - { - "text": "иметь", - "lang": "" - }, - { - "text": "владеть", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#DigitalTVService": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#DigitalTVService", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "DigitalTVService", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Услуга цифрового телевидения.", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "цифровой", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#PhoneNumber": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#PhoneNumber", - "types": [ - "http://www.w3.org/2000/01/rdf-schema#Datatype" - ], - "label": { - "values": [ - { - "text": "PhoneNumber", - "lang": "" - } - ] - }, - "properties": {} - }, - "http://ailab.ifmo.ru/dialog/tv/schema#User": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#User", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "User", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Пользователь. Пока и клиент Ростелекома и позвонивший человек в одном лице.", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "мы", - "lang": "" - }, - { - "text": "я", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#subscribed": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#subscribed", - "types": [ - "http://www.w3.org/2002/07/owl#DatatypeProperty" - ], - "label": { - "values": [ - { - "text": "subscribed", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Подписан ли пользователь на эту услугу.", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#falseExpressedBy": { - "type": "string", - "values": [ - { - "text": "tv:Unsubscribe", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#trueExpressedBy": { - "type": "string", - "values": [ - { - "text": "tv:Subscribe", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#baseChannelPack": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#baseChannelPack", - "types": [ - "http://ailab.ifmo.ru/dialog/tv/schema#ChannelPack" - ], - "label": { - "values": [ - { - "text": "baseChannelPack", - "lang": "" - } - ] - }, - "properties": { - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "стартовый", - "lang": "" - }, - { - "text": "начальный", - "lang": "" - }, - { - "text": "базовый", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#TVSet": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#TVSet", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "TVSet", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Телевизор. Может иметь возможность декодирования платных каналов услуги цифрового телевидения с использованием CAM-модуля.", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "телевизор", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#forwardedToInfoSupport": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#forwardedToInfoSupport", - "types": [ - "http://www.w3.org/2002/07/owl#DatatypeProperty" - ], - "label": { - "values": [ - { - "text": "forwardedToInfoSupport", - "lang": "" - } - ] - }, - "properties": {} - }, - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#lemma", - "types": [ - "http://www.w3.org/2002/07/owl#AnnotationProperty" - ], - "label": { - "values": [ - { - "text": "lemma", - "lang": "" - } - ] - }, - "properties": {} - }, - "http://ailab.ifmo.ru/dialog/tv/schema#identified": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#identified", - "types": [ - "http://www.w3.org/2002/07/owl#DatatypeProperty" - ], - "label": { - "values": [ - { - "text": "identified", - "lang": "" - } - ] - }, - "properties": {} - }, - "http://ailab.ifmo.ru/dialog/tv/schema#forwardedToSecondSupport": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#forwardedToSecondSupport", - "types": [ - "http://www.w3.org/2002/07/owl#DatatypeProperty" - ], - "label": { - "values": [ - { - "text": "forwardedToSecondSupport", - "lang": "" - } - ] - }, - "properties": {} - }, - "http://ailab.ifmo.ru/dialog/tv/schema#callsAgain": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#callsAgain", - "types": [ - "http://www.w3.org/2002/07/owl#DatatypeProperty" - ], - "label": { - "values": [ - { - "text": "callsAgain", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Пользователь обращается повторно", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#ControlPanel": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#ControlPanel", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "ControlPanel", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Пульт от телевизора", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "пульт", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#hasNetworkConnection": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#hasNetworkConnection", - "types": [ - "http://www.w3.org/2002/07/owl#DatatypeProperty" - ], - "label": { - "values": [ - { - "text": "hasNetworkConnection", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Есть ли подключение к роутеру со стороны провайдера услуг.", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#Image": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Image", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "Image", - "lang": "" - } - ] - }, - "properties": { - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "сигнал", - "lang": "" - }, - { - "text": "картинка", - "lang": "" - }, - { - "text": "изображение", - "lang": "" - }, - { - "text": "видео", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#phoneNumber": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#phoneNumber", - "types": [ - "http://www.w3.org/2002/07/owl#DatatypeProperty" - ], - "label": { - "values": [ - { - "text": "phoneNumber", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Номер телефона", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "номер", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#deviceAppearance": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#deviceAppearance", - "types": [ - "http://www.w3.org/2002/07/owl#DatatypeProperty" - ], - "label": { - "values": [ - { - "text": "deviceAppearance", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Описание внешнего вида устройства.", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "внешний вид", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#TurnOn": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#TurnOn", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "TurnOn", - "lang": "" - } - ] - }, - "properties": { - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "включать", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#tvoeTV": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#tvoeTV", - "types": [ - "http://ailab.ifmo.ru/dialog/tv/schema#ServiceProvider" - ], - "label": { - "values": [ - { - "text": "tvoeTV", - "lang": "" - } - ] - }, - "properties": { - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "твой интернет", - "lang": "" - }, - { - "text": "твое тв", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#HomePhone": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#HomePhone", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "HomePhone", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Домашний телефон. Один из способов идентифицировать клиента. Другой - по номеру услуги.", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "домашний", - "lang": "" - }, - { - "text": "городской", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#All": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#All", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "All", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Концепт для обработки 'а потом все отвалилось'", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "всё", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#Home": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Home", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "Home", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Дом клиента в смысле места, где установлено такое оборудование, как роутер.", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "дом", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#Appear": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Appear", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "Appear", - "lang": "" - } - ] - }, - "properties": { - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "появляться", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#Cable": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Cable", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "Cable", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Кабель - нужен для подключения кабельного телевидения.", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#homeAddress": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#homeAddress", - "types": [ - "http://www.w3.org/2002/07/owl#DatatypeProperty" - ], - "label": { - "values": [ - { - "text": "homeAddress", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Домашний адрес", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "адрес", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#Flat": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Flat", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "Flat", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Квартира (уточнение дома).", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "квартира", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#operationalBad": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#operationalBad", - "types": [ - "http://www.w3.org/2002/07/owl#DatatypeProperty" - ], - "label": { - "values": [ - { - "text": "operationalBad", - "lang": "" - } - ] - }, - "properties": { - "http://ailab.ifmo.ru/dialog/tv/schema#falseExpressedBy": { - "type": "string", - "values": [ - { - "text": "tv:Disappear", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "тормозить", - "lang": "" - }, - { - "text": "расползаться", - "lang": "" - }, - { - "text": "портиться", - "lang": "" - }, - { - "text": "барахлить", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#AnalogueTVChannel": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#AnalogueTVChannel", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "AnalogueTVChannel", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Аналоговый телевизионный канал.", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "аналоговый", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#ServiceMan": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#ServiceMan", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "ServiceMan", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Квалифицированный работник", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "мастер", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#Phone": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Phone", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "Phone", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Телефон. Здесь пока только для образование сущности 'домашний телефон'", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "телефон", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#Speed": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Speed", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "Speed", - "lang": "" - } - ] - }, - "properties": { - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "скорость", - "lang": "" - }, - { - "text": "производительность", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#SubscribableService": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#SubscribableService", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "SubscribableService", - "lang": "" - } - ] - }, - "properties": {} - }, - "http://ailab.ifmo.ru/dialog/tv/schema#hdChannelPack": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#hdChannelPack", - "types": [ - "http://ailab.ifmo.ru/dialog/tv/schema#ChannelPack" - ], - "label": { - "values": [ - { - "text": "hdChannelPack", - "lang": "" - } - ] - }, - "properties": { - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "эйчди", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#SetTopBox": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#SetTopBox", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "SetTopBox", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Телеприставка, осуществляющая декодирование цифрового сигнала и подключаемая к телевизору.", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "приставка", - "lang": "" - } - ] - } - } - } -} diff --git a/DKBFrontEnd/src/src/ontodia/data/demo/data/linkTypes.json b/DKBFrontEnd/src/src/ontodia/data/demo/data/linkTypes.json deleted file mode 100644 index 857a236b1..000000000 --- a/DKBFrontEnd/src/src/ontodia/data/demo/data/linkTypes.json +++ /dev/null @@ -1,110 +0,0 @@ -[ - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#own", - "label": { - "values": [ - { - "text": "own", - "lang": "" - } - ] - }, - "count": 0 - }, - { - "id": "http://www.w3.org/2002/07/owl#disjointWith", - "label": { - "values": [ - { - "text": "disjointWith", - "lang": "" - } - ] - }, - "count": 8 - }, - { - "id": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", - "label": { - "values": [ - { - "text": "type", - "lang": "" - } - ] - }, - "count": 93 - }, - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#isClientOf", - "label": { - "values": [ - { - "text": "isClientOf", - "lang": "" - } - ] - }, - "count": 0 - }, - { - "id": "http://www.w3.org/2000/01/rdf-schema#domain", - "label": { - "values": [ - { - "text": "domain", - "lang": "" - } - ] - }, - "count": 33 - }, - { - "id": "http://www.w3.org/2000/01/rdf-schema#subPropertyOf", - "label": { - "values": [ - { - "text": "subPropertyOf", - "lang": "" - } - ] - }, - "count": 2 - }, - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#rent", - "label": { - "values": [ - { - "text": "rent", - "lang": "" - } - ] - }, - "count": 0 - }, - { - "id": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "label": { - "values": [ - { - "text": "subClassOf", - "lang": "" - } - ] - }, - "count": 45 - }, - { - "id": "http://www.w3.org/2000/01/rdf-schema#range", - "label": { - "values": [ - { - "text": "range", - "lang": "" - } - ] - }, - "count": 33 - } -] diff --git a/DKBFrontEnd/src/src/ontodia/data/demo/data/links.json b/DKBFrontEnd/src/src/ontodia/data/demo/data/links.json deleted file mode 100644 index f727f1c8a..000000000 --- a/DKBFrontEnd/src/src/ontodia/data/demo/data/links.json +++ /dev/null @@ -1,467 +0,0 @@ -[ - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#ortChannel", - "linkTypeId": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#TVChannel" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#Battery", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#ServiceDevice" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#rostelekom", - "linkTypeId": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#ServiceProvider" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#problemStated", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#domain", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#User" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#hdPremiumChannelPack", - "linkTypeId": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#ChannelPack" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#subscriberName", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#domain", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#RTService" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#subscriberName", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#range", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#Name" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#encryptedSignal", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#domain", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#ChannelPack" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#forwardedToAccounts", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#domain", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#User" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#TVService", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#SubscribableService" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#TurnOff", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#Contact" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#TurnOff", - "linkTypeId": "http://www.w3.org/2002/07/owl#disjointWith", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#TurnOn" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#TVChannel", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#Service" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#ServiceDevice", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#PropertyAsGoods" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#ServiceDevice", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#Service" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#Connect", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#Contact" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#Connect", - "linkTypeId": "http://www.w3.org/2002/07/owl#disjointWith", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#Disconnect" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#falseExpressedBy", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subPropertyOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#expressedBy" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#changedSpeed", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#domain", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#Speed" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#kinoChannelPack", - "linkTypeId": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#ChannelPack" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#Subscription", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#Operation" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#switchedOn", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#domain", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#ServiceDevice" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#Contact", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#Operation" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#canHelp", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#domain", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#ServiceDesk" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#trueExpressedBy", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subPropertyOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#expressedBy" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#inserted", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#domain", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#CamModule" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#operational", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#domain", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#Service" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#Router", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#ServiceDevice" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#Disconnect", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#Contact" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#Disconnect", - "linkTypeId": "http://www.w3.org/2002/07/owl#disjointWith", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#Connect" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#Unsubscribe", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#Subscription" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#Unsubscribe", - "linkTypeId": "http://www.w3.org/2002/07/owl#disjointWith", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#Subscribe" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#CamModule", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#ServiceDevice" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#Subscribe", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#Subscription" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#Subscribe", - "linkTypeId": "http://www.w3.org/2002/07/owl#disjointWith", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#Unsubscribe" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#Internet", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#SubscribableService" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#sufficientFunds", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#domain", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#User" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#suspended", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#domain", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#DigitalTVService" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#serviceNumber", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#domain", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#RTService" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#Disappear", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#Observe" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#Disappear", - "linkTypeId": "http://www.w3.org/2002/07/owl#disjointWith", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#Appear" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#WiFiRouter", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#Router" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#DigitalTVChannel", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#TVChannel" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#rent", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#domain", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#User" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#rent", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#range", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#PropertyAsGoods" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#filedRequest", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#domain", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#User" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#isClientOf", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#domain", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#User" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#isClientOf", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#range", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#ServiceProvider" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#came", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#domain", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#ServiceMan" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#Observe", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#Operation" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#modified", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#domain", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#Router" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#ChannelPack", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#SubscribableService" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#deviceModel", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#domain", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#ServiceDevice" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#popularChannelPack", - "linkTypeId": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#ChannelPack" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#canHangUp", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#domain", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#User" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#canSolve", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#domain", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#ServiceDesk" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#userCanSwitchChannel", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#domain", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#TVChannel" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#rebooted", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#domain", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#ServiceDevice" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#own", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#domain", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#User" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#own", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#range", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#PropertyAsGoods" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#DigitalTVService", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#TVService" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#subscribed", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#domain", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#SubscribableService" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#baseChannelPack", - "linkTypeId": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#ChannelPack" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#TVSet", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#ServiceDevice" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#forwardedToInfoSupport", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#domain", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#User" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#identified", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#domain", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#User" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#forwardedToSecondSupport", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#domain", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#User" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#callsAgain", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#domain", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#User" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#ControlPanel", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#ServiceDevice" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#hasNetworkConnection", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#domain", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#Router" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#Image", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#SimpleProperty" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#phoneNumber", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#domain", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#Phone" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#phoneNumber", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#range", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#PhoneNumber" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#deviceAppearance", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#domain", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#ServiceDevice" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#TurnOn", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#Contact" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#TurnOn", - "linkTypeId": "http://www.w3.org/2002/07/owl#disjointWith", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#TurnOff" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#tvoeTV", - "linkTypeId": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#ServiceProvider" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#HomePhone", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#Phone" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#All", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#Service" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#Home", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#PropertyAsGoods" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#Appear", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#Observe" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#Appear", - "linkTypeId": "http://www.w3.org/2002/07/owl#disjointWith", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#Disappear" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#Cable", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#ServiceDevice" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#homeAddress", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#domain", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#Home" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#homeAddress", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#range", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#Address" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#Flat", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#Home" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#operationalBad", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#domain", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#Service" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#AnalogueTVChannel", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#TVChannel" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#Phone", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#PropertyAsGoods" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#Speed", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#SimpleProperty" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#SubscribableService", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#Service" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#hdChannelPack", - "linkTypeId": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#ChannelPack" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#SetTopBox", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#ServiceDevice" - } -] diff --git a/DKBFrontEnd/src/src/ontodia/data/demo/provider.ts b/DKBFrontEnd/src/src/ontodia/data/demo/provider.ts deleted file mode 100644 index 8505678c1..000000000 --- a/DKBFrontEnd/src/src/ontodia/data/demo/provider.ts +++ /dev/null @@ -1,141 +0,0 @@ -import { cloneDeep, keyBy, map, each } from 'lodash'; -import { DataProvider, FilterParams } from '../provider'; -import { Dictionary, ClassModel, LinkType, ElementModel, LinkModel, LinkCount } from '../model'; - -const CLASSES = require('json!./data/classes.json'); -const LINK_TYPES = require('json!./data/linkTypes.json'); -const ELEMENTS = require>('json!./data/elements.json'); -const LINKS = require('json!./data/links.json'); - -export class DemoDataProvider implements DataProvider { - private simulateNetwork(result: T) { - const MEAN_DELAY = 200; - const cloned = cloneDeep(result); - // simulate exponential distribution - const delay = -Math.log(Math.random()) * MEAN_DELAY; - return new Promise(resolve => { - setTimeout(() => resolve(cloned), delay); - }); - } - - classTree() { - return this.simulateNetwork(CLASSES); - } - - classInfo(params: { classIds: string[] }) { - let classIds = params.classIds || []; - return this.simulateNetwork(CLASSES.filter(cl => classIds.indexOf(cl.id))); - } - - linkTypes() { - return this.simulateNetwork(LINK_TYPES); - } - - linkTypesInfo(params: { linkTypeIds: string[] }): Promise { - const types = keyBy(params.linkTypeIds); - const linkTypes = LINK_TYPES.filter(type => types[type.id]); - return this.simulateNetwork(linkTypes); - } - - elementInfo(params: { elementIds: string[]; }): Promise> { - const elements = params.elementIds - .map(elementId => ELEMENTS[elementId]) - .filter(element => element !== undefined); - return this.simulateNetwork( - keyBy(elements, element => element.id)); - } - - linksInfo(params: { - elementIds: string[]; - linkTypeIds: string[]; - }) { - const nodes = keyBy(params.elementIds); - const types = keyBy(params.linkTypeIds); - const links = LINKS.filter(link => - types[link.linkTypeId] && nodes[link.sourceId] && nodes[link.targetId]); - return this.simulateNetwork(links); - } - - linkTypesOf(params: { elementId: string; }) { - const counts: Dictionary = {}; - for (const link of LINKS) { - if (link.sourceId === params.elementId || - link.targetId === params.elementId - ) { - const linkCount = counts[link.linkTypeId]; - if (linkCount) { - linkCount.count++; - } else { - counts[link.linkTypeId] = {id: link.linkTypeId, count: 1}; - } - } - } - return this.simulateNetwork(map(counts)); - } - - linkElements(params: { elementId: string; linkId: string; limit: number; offset: number }): Promise> { - //for sparql we have rich filtering features and we just reuse filter. - return this.filter({ - refElementId: params.elementId, - refElementLinkId: params.linkId, - limit: params.limit, - offset: params.offset, - languageCode: ""}); - } - - filter(params: FilterParams): Promise> { - if (params.offset > 0) { return Promise.resolve({}); } - - let filtered: Dictionary = {}; - if (params.elementTypeId) { - each(ELEMENTS, element => { - if (element.types.indexOf(params.elementTypeId) >= 0) { - filtered[element.id] = element; - } - }); - } else if (params.refElementId) { - const filteredLinks = params.refElementLinkId - ? LINKS.filter(link => link.linkTypeId === params.refElementLinkId) - : LINKS; - const nodeId = params.refElementId; - for (const link of filteredLinks) { - let linkedElementId: string = undefined; - if (link.sourceId === nodeId) { - linkedElementId = link.targetId; - } else if (link.targetId === nodeId) { - linkedElementId = link.sourceId; - } - if (linkedElementId !== undefined) { - const linkedElement = ELEMENTS[linkedElementId]; - if (linkedElement) { - filtered[linkedElement.id] = linkedElement; - } - } - } - } else if (params.text) { - filtered = ELEMENTS; // filtering by text is done below - } else { - return Promise.reject(new Error('This type of filter is not implemented')); - } - - if (params.text) { - const filteredByText: Dictionary = {}; - const text = params.text.toLowerCase(); - each(filtered, element => { - let found = false; - if (element.id.toLowerCase().indexOf(text) >= 0) { - found = true; - } else { - found = element.label.values.some( - label => label.text.toLowerCase().indexOf(text) >= 0); - } - if (found) { - filteredByText[element.id] = element; - } - }); - return this.simulateNetwork(filteredByText); - } else { - return this.simulateNetwork(filtered); - } - } -} diff --git a/DKBFrontEnd/src/src/ontodia/data/model.ts b/DKBFrontEnd/src/src/ontodia/data/model.ts deleted file mode 100644 index 2624af5a4..000000000 --- a/DKBFrontEnd/src/src/ontodia/data/model.ts +++ /dev/null @@ -1,43 +0,0 @@ -export type Dictionary = { [key: string]: T; }; - -export interface LocalizedString { - text: string; - lang: string; -} - -export type Property = { type: 'string'; values: LocalizedString[]; }; - -export interface ElementModel { - id: string; - types: string[]; - label: { values: LocalizedString[] }; - image?: string; - properties: { [id: string]: Property }; -} - -export interface LinkModel { - linkTypeId: string; - sourceId: string; - targetId: string; -} - -export interface ClassModel { - id: string; - label: { values: LocalizedString[] }; - count: number; - children: ClassModel[]; -} - -export interface LinkCount { - id: string; - count: number; -} - -export interface LinkType extends LinkCount { - label: { values: LocalizedString[] }; -} - -export interface PropertyModel { - id: string; - label: { values: LocalizedString[] }; -} diff --git a/DKBFrontEnd/src/src/ontodia/data/provider.ts b/DKBFrontEnd/src/src/ontodia/data/provider.ts deleted file mode 100644 index fa8caa5a4..000000000 --- a/DKBFrontEnd/src/src/ontodia/data/provider.ts +++ /dev/null @@ -1,133 +0,0 @@ -import { - Dictionary, ClassModel, LinkType, ElementModel, LinkModel, LinkCount, PropertyModel, -} from './model'; - -/** - * DataProvider is responsible for getting data into Ontodia - * - * It has three parts: - * - Schema extraction - classTree(), linkTypes() - * - On-demand schema extraction - classInfo(), propertyInfo(), linkTypeInfo() - * - elements and links extraction - elementsInfo() and linksInfo() - * - navigation - linkTypesOf(), linkElements() - * - filtering - filter - * - * Schema extraction is executed on initialization and used to display class tree. - * - * On-demand schema extraction occurs when element with yet unknown type or link type appears any part of Ontodia. - * - * Elements and links extraction is executed when new element is placed on the diagram or diagram is restored from - * saved state to get all the data for it - * - * Navigation functions are called when user brings up navigation menu to display available links - * and places chosen elements on the diagram. - * - * When possible, Ontodia will group requests into batches to reduce round-trips and this will reduce calls to - * data provider. - * - */ -export interface DataProvider { - // schema extraction - - /** should return start-up class tree. In case of huge class tree some limits should be imposed. - * It can contain count of instances for each class if it's possible to get it from source. - */ - classTree(): Promise; - /* - initial fetching of link types along with statistics. - Since this list is not much use in UI, this method is subject to be removed. - */ - linkTypes(): Promise; - - /** - * Class information - */ - classInfo(params: { - classIds: string[]; - }): Promise; - - /** - * Data properties information - */ - propertyInfo?(params: { propertyIds: string[] }): Promise>; - - /** - * Link type information. - */ - linkTypesInfo(params: { - linkTypeIds: string[]; - }): Promise; - - /** - * Getting the elements from the data source on diagram initialization and on navigation events - */ - elementInfo(params: { elementIds: string[]; }): Promise>; - - /** - * Should return all links between elements. - * linkTypeIds is ignored in current sparql providers and is subject to be removed - */ - linksInfo(params: { - elementIds: string[]; - linkTypeIds: string[]; - }): Promise; - - /** - * Get link types of element to build navigation menu - */ - linkTypesOf(params: { elementId: string; }): Promise; - - /** - * returns elements following link for specified element. - * Has overlapping functionality with filter, but easier less powerful and easier to implement - * linkId could be null, if it's the case method should return all elements from all links from current element. - */ - linkElements(params: { elementId: string, linkId: string, limit: number, offset: number }) : Promise>; - - /** - * Supports filter functionality with different filters - by type, by element and it's connection, by full-text search - * Implementation should implement all possible combinations - */ - filter(params: FilterParams): Promise>; -} - -export default DataProvider; - -export interface FilterParams { - /** - * element type filter - */ - elementTypeId?: string; - /** - * text search - */ - text?: string; - - /** - * Reference element id to limit elements accessible through links from this elements only. - * Could be used with refElementLinkId to limit link types which to follow. - */ - refElementId?: string; - - /** - * Reference element link type id. Is used only when refElementId is set. - */ - refElementLinkId?: string; - - /* - * Limit number of elements returned. Defaults depend on data provider implementation - */ - limit: number; - - /** - * Offset within matched data set to use - */ - offset: number; - - /** - * Right now this is unused in sparql data provider. - * It was introduced to order results by particular language when doing substring match with regexps. - * It's subject to be removed. - */ - languageCode: string; -} diff --git a/DKBFrontEnd/src/src/ontodia/data/sparql/graphBuilder.ts b/DKBFrontEnd/src/src/ontodia/data/sparql/graphBuilder.ts deleted file mode 100644 index 5213894c6..000000000 --- a/DKBFrontEnd/src/src/ontodia/data/sparql/graphBuilder.ts +++ /dev/null @@ -1,88 +0,0 @@ -import * as N3 from 'n3'; - -import { LayoutData, LayoutCell, LayoutElement, LayoutLink } from '../../diagram/layoutData'; -import { uniformGrid } from '../../viewUtils/layout'; -import { Dictionary, ElementModel, LinkModel } from '../model'; - -import { SparqlDataProvider } from './sparqlDataProvider'; -import { SparqlResponse, Triple } from './sparqlModels'; - -const DEFAULT_PREFIX = -`PREFIX rdfs: - PREFIX rdf: - PREFIX owl: ` + '\n\n'; - -const GREED_STEP = 150; - -export class GraphBuilder { - constructor(public dataProvider: SparqlDataProvider) {} - - getGraphFromConstruct(constructQuery: string): Promise<{ - preloadedElements: Dictionary, - layoutData: LayoutData, - }> { - const query = DEFAULT_PREFIX + constructQuery; - return this.dataProvider.executeSparqlConstruct(query) - .then(graph => this.getGraphFromRDFGraph(graph)); - }; - - getGraphFromRDFGraph(graph: Triple[]): Promise<{ - preloadedElements: Dictionary, - layoutData: LayoutData, - }> { - let {elementIds, links} = this.getConstructElements(graph); - return this.dataProvider.elementInfo({elementIds}).then(elementsInfo => ({ - preloadedElements: elementsInfo, - layoutData: this.getLayout(elementsInfo, links), - })); - }; - - private getConstructElements(response: Triple[]): { - elementIds: string[], links: LinkModel[] - } { - const elements: Dictionary = {}; - const links: LinkModel[] = []; - - for (const {subject, predicate, object} of response) { - if (subject.type === 'uri' && object.type === 'uri') { - if (!elements[subject.value]) { elements[subject.value] = true; } - if (!elements[object.value]) { elements[object.value] = true; } - links.push({ - linkTypeId: predicate.value, - sourceId: subject.value, - targetId: object.value, - }); - } - } - return { elementIds: Object.keys(elements), links: links }; - } - - private getLayout(elementsInfo: Dictionary, linksInfo: LinkModel[]): LayoutData { - const keys = Object.keys(elementsInfo); - - const rows = Math.ceil(Math.sqrt(keys.length)); - const grid = uniformGrid({rows, cellSize: {x: GREED_STEP, y: GREED_STEP}}); - - const layoutElements: LayoutCell[] = keys.map((key, index) => { - const element = elementsInfo[key]; - const {x, y} = grid(index); - return { - id: element.id, - type: 'element', - position: {x, y}, - }; - }); - const layoutLinks = linksInfo.map((link, index) => { - return { - id: 'link_' + index, - typeId: link.linkTypeId, - type: 'link', - source: {id: link.sourceId}, - target: {id: link.targetId}, - }; - }); - return {cells: layoutElements.concat(layoutLinks)}; - } -} - -export default GraphBuilder; diff --git a/DKBFrontEnd/src/src/ontodia/data/sparql/responseHandler.ts b/DKBFrontEnd/src/src/ontodia/data/sparql/responseHandler.ts deleted file mode 100644 index 4edd0b922..000000000 --- a/DKBFrontEnd/src/src/ontodia/data/sparql/responseHandler.ts +++ /dev/null @@ -1,372 +0,0 @@ -import { - RdfLiteral, SparqlResponse, ClassBinding, ElementBinding, LinkBinding, - ElementImageBinding, LinkTypeBinding, LinkTypeInfoBinding, PropertyBinding, -} from './sparqlModels'; -import { - Dictionary, LocalizedString, LinkType, ClassModel, ElementModel, LinkModel, Property, PropertyModel, -} from '../model'; - -const THING_URI = 'http://www.w3.org/2002/07/owl#Thing'; -const LABEL_URI = 'http://www.w3.org/2000/01/rdf-schema#label'; - -export function getClassTree(response: SparqlResponse): ClassModel[] { - const tree: ClassModel[] = []; - const treeNodes = createClassMap(response.results.bindings); - // createClassMap ensures we get both elements and parents and we can use treeNodes[treeNode.parent] safely - for (const nodeId in treeNodes) { - const treeNode = treeNodes[nodeId]; - if (treeNode.parent) { - const parent = treeNodes[treeNode.parent]; - parent.children.push(treeNode); - parent.count += treeNode.count; - } else { - tree.push(treeNode); - } - } - - calcCounts(tree); - - return tree; -} - -function createClassMap(sNodes: ClassBinding[]) : Dictionary { - let treeNodes: Dictionary = {}; - for (const sNode of sNodes) { - const sNodeId: string = sNode.class.value; - var node = treeNodes[sNodeId]; - if (node) { - if (sNode.label) { - const label = node.label; - if (label.values.length === 1 && !label.values[0].lang) { - label.values = []; - } - label.values.push(getLocalizedString(sNode.label)); - } - if (!node.parent && sNode.parent) { - node.parent = sNode.parent.value - } - } else { - node = getClassModel(sNode); - treeNodes[sNodeId] = node; - } - //ensuring parent will always be there - if (node.parent && !treeNodes[node.parent]) { - treeNodes[node.parent] = getClassModel({class: {value: node.parent, type: 'uri'}}); - } - } - return treeNodes; -} - -function calcCounts(children: ClassModel[]) { - for (let node of children) { - // no more to count - if (!node.children) return; - // ensure all children have their counts completed; - calcCounts(node.children); - // we have to preserve no data here. If nor element nor childs have no count information, - // we just pass NaN upwards. - const childCount = node.children.reduce((acc, val) => - // if val.count is not NaN, turn result into number - !isNaN(val.count) ? (!isNaN(acc) ? acc + val.count : val.count) : acc - , NaN); - node.count = !isNaN(childCount) ? (!isNaN(node.count) ? node.count + childCount : childCount) : node.count; - } -} - -export function getClassInfo(response: SparqlResponse): ClassModel[] { - const classes: { [id: string]: ClassModel } = {}; - for (const binding of response.results.bindings) { - if (!binding.class) { continue; } - const id = binding.class.value; - const model = classes[id]; - if (model) { - const newLabel = getLocalizedString(binding.label); - if (!model.label.values.some(label => isLocalizedEqual(label, newLabel))) { - model.label.values.push(newLabel); - } - const instanceCount = getInstCount(binding.instcount); - if (!isNaN(instanceCount)) { - model.count = Math.max(model.count, instanceCount); - } - } else { - const label = getLocalizedString(binding.label); - classes[id] = { - id, - children: [], - label: {values: label ? [label] : []}, - count: getInstCount(binding.instcount), - }; - } - } - - const classesList: ClassModel[] = []; - for (const id in classes) { - if (!classes.hasOwnProperty(id)) { continue; } - const model = classes[id]; - if (model.label.values.length === 0) { - model.label.values.push(getLocalizedString(undefined, id)); - } - classesList.push(model); - } - - return classesList; -} - -export function getPropertyInfo(response: SparqlResponse): Dictionary { - const models: Dictionary = {}; - for (const sProp of response.results.bindings) { - const model = getPropertyModel(sProp); - models[model.id] = model; - } - return models; -} - -export function getLinkTypes(response: SparqlResponse): LinkType[] { - const sInst = response.results.bindings; - const linkTypes: LinkType[] = []; - const instancesMap: Dictionary = {}; - - for (const sLink of sInst) { - let sInstTypeId: string = sLink.link.value; - - if (instancesMap[sInstTypeId]) { - if (sLink.label) { - const label = instancesMap[sInstTypeId].label; - if (label.values.length === 1 && !label.values[0].lang) { - label.values = []; - } - label.values.push(getLocalizedString(sLink.label)); - } - if (sLink.instcount) { - instancesMap[sInstTypeId].count = getInstCount(sLink.instcount); - } - } else { - instancesMap[sInstTypeId] = getLinkType(sLink); - linkTypes.push(instancesMap[sInstTypeId]); - } - - }; - - return linkTypes; -} - -export function getElementsInfo(response: SparqlResponse, ids: string[]): Dictionary { - const sInstances = response.results.bindings; - const instancesMap: Dictionary = {}; - - for (const sInst of sInstances) { - if (!sInst.hasOwnProperty('inst')) - continue; - - let sInstTypeId: string = sInst.inst.value; - - if (instancesMap[sInstTypeId]) { - enrichElement(instancesMap[sInst.inst.value], sInst); - } else { - instancesMap[sInstTypeId] = getElementInfo(sInst); - } - }; - - const proccesedIds = Object.keys(instancesMap); - for (const id of ids) { - if (proccesedIds.indexOf(id) === -1) { - instancesMap[id] = { - id: id, - label: { values: [getLocalizedString(undefined, id)] }, - types: [THING_URI], - properties: {}, - }; - } - }; - - return instancesMap; -} - -export function getEnrichedElementsInfo( - response: SparqlResponse, - elementsInfo: Dictionary -): Dictionary { - const respElements = response.results.bindings; - for (const respEl of respElements) { - const elementInfo = elementsInfo[respEl.inst.value]; - if (elementInfo) { - elementInfo.image = respEl.image.value; - } - } - return elementsInfo; -} - -export function getLinkTypesInfo(response: SparqlResponse): LinkType[] { - const sparqlLinkTypes = response.results.bindings; - return sparqlLinkTypes.map((sLinkType: LinkTypeInfoBinding) => getLinkTypeInfo(sLinkType)); -} - -export function getLinksInfo(response: SparqlResponse): LinkModel[] { - const sparqlLinks = response.results.bindings; - return sparqlLinks.map((sLink: LinkBinding) => getLinkInfo(sLink)); -} - -export function getLinksTypesOf(response: SparqlResponse): LinkType[] { - const sparqlLinkTypes = response.results.bindings; - return sparqlLinkTypes.map((sLink: LinkTypeBinding) => getLinkType(sLink)); -} - -export function getFilteredData(response: SparqlResponse): Dictionary { - const sInstances = response.results.bindings; - const instancesMap: Dictionary = {}; - - for (const sInst of sInstances) { - if (!sInst.hasOwnProperty('inst') || sInst.inst.type === 'literal') { - continue; - } - if (!instancesMap[sInst.inst.value]) { - instancesMap[sInst.inst.value] = getElementInfo(sInst); - } else { - enrichElement(instancesMap[sInst.inst.value], sInst); - } - }; - return instancesMap; -} - -export function enrichElement(element: ElementModel, sInst: ElementBinding) { - if (!element) { return; } - if (sInst.label) { - const localized = getLocalizedString(sInst.label); - - const currentLabels = element.label.values; - const isAutogeneratedLabel = currentLabels.length === 1 && - !currentLabels[0].lang && currentLabels[0].text === getNameFromId(element.id); - - if (isAutogeneratedLabel) { - element.label.values = [localized]; - } else if (element.label.values.every(value => !isLocalizedEqual(value, localized))) { - element.label.values.push(localized); - } - } - if (sInst.class && element.types.indexOf(sInst.class.value) < 0) { - element.types.push(sInst.class.value); - } - if (sInst.propType && sInst.propType.value !== LABEL_URI) { - let property: Property = element.properties[sInst.propType.value]; - if (!property) { - property = element.properties[sInst.propType.value] = { - type: 'string', // sInst.propType.value, - values: [], - }; - } - const propertyValue = getPropertyValue(sInst.propValue); - if (property.values.every(value => !isLocalizedEqual(value, propertyValue))) { - property.values.push(propertyValue); - } - } -} - -function isLocalizedEqual(left: LocalizedString, right: LocalizedString) { - return left.lang === right.lang && left.text === right.text; -} - -export function getNameFromId(id: string): string { - const sharpIndex = id.indexOf('#'); - if (sharpIndex !== -1) { - return id.substring(sharpIndex + 1, id.length); - } else { - const tokens = id.split('/'); - return tokens[tokens.length - 1]; - } -} - -export function getLocalizedString(label?: RdfLiteral, id?: string): LocalizedString { - if (label) { - return { - text: label.value, - lang: label['xml:lang'], - }; - } else if (id) { - return { - text: getNameFromId(id), - lang: '', - }; - } else { - return undefined; - } -} - -export function getInstCount(instcount: RdfLiteral): number { - return (instcount ? +instcount.value : NaN); -} - -/** - * This extension of ClassModel is used only in processing, parent links are not needed in UI (yet?) - */ -export interface HierarchicalClassModel extends ClassModel { - parent: string -} - -export function getClassModel(node: ClassBinding): HierarchicalClassModel { - return { - id: node.class.value, - children: [], - label: { values: [getLocalizedString(node.label, node.class.value)] }, - count: getInstCount(node.instcount), - parent: node.parent ? node.parent.value : undefined - }; -} - -export function getPropertyModel(node: PropertyBinding): PropertyModel { - return { - id: node.prop.value, - label: { values: [getLocalizedString(node.label, node.prop.value)] }, - }; -} - -export function getLinkType(sLinkType: LinkTypeBinding): LinkType { - return { - id: sLinkType.link.value, - label: { values: [getLocalizedString(sLinkType.label, sLinkType.link.value)] }, - count: getInstCount(sLinkType.instcount), - }; -} - -export function getPropertyValue(propValue?: RdfLiteral): LocalizedString { - if (!propValue) { return undefined; } - return { - lang: propValue['xml:lang'], - text: propValue.value, - }; -} - -export function getElementInfo(sInfo: ElementBinding): ElementModel { - const elementInfo: ElementModel = { - id: sInfo.inst.value, - label: { values: [getLocalizedString(sInfo.label, sInfo.inst.value)] }, - types: (sInfo.class ? [ sInfo.class.value ] : []), - properties: {}, - }; - - if (sInfo.propType && sInfo.propType.value !== LABEL_URI) { - elementInfo.properties[sInfo.propType.value] = { - type: 'string', // sInst.propType.value, - values: [getPropertyValue(sInfo.propValue)], - }; - } - - return elementInfo; -} - -export function getLinkInfo(sLinkInfo: LinkBinding): LinkModel { - if (!sLinkInfo) { return undefined; } - return { - linkTypeId: sLinkInfo.type.value, - sourceId: sLinkInfo.source.value, - targetId: sLinkInfo.target.value, - }; -} - -export function getLinkTypeInfo(sLinkInfo: LinkTypeInfoBinding): LinkType { - if (!sLinkInfo) { return undefined; } - return { - id: sLinkInfo.typeId.value, - label: { values: [getLocalizedString(sLinkInfo.label, sLinkInfo.typeId.value)] }, - count: getInstCount(sLinkInfo.instcount), - }; -} diff --git a/DKBFrontEnd/src/src/ontodia/data/sparql/sparqlDataProvider.ts b/DKBFrontEnd/src/src/ontodia/data/sparql/sparqlDataProvider.ts deleted file mode 100644 index 816b4fde4..000000000 --- a/DKBFrontEnd/src/src/ontodia/data/sparql/sparqlDataProvider.ts +++ /dev/null @@ -1,430 +0,0 @@ -import 'whatwg-fetch'; -import * as N3 from 'n3'; -import { DataProvider, FilterParams } from '../provider'; -import { Dictionary, ClassModel, LinkType, ElementModel, LinkModel, LinkCount, PropertyModel } from '../model'; -import { - getClassTree, - getClassInfo, - getPropertyInfo, - getLinkTypes, - getElementsInfo, - getLinksInfo, - getLinksTypesOf, - getFilteredData, - getEnrichedElementsInfo, - getLinkTypesInfo, -} from './responseHandler'; -import { - ClassBinding, ElementBinding, LinkBinding, PropertyBinding, - LinkTypeBinding, LinkTypeInfoBinding, ElementImageBinding, SparqlResponse, Triple, RdfNode, -} from './sparqlModels'; -import { SparqlDataProviderSettings, OWLStatsSettings } from './sparqlDataProviderSettings'; - -export enum SparqlQueryMethod { GET = 1, POST } - -/** - * Runtime settings of SPARQL data provider - */ -export interface SparqlDataProviderOptions { - - /** - * sparql endpoint URL to use - */ - endpointUrl: string; - - // there are two options for fetching images: specify imagePropertyUris - // to use as image properties or specify a function to fetch image URLs - - /** - * properties to use as image URLs - */ - imagePropertyUris?: string[]; - - /** - * you can specify prepareImages function to extract image URL from element model - */ - prepareImages?: (elementInfo: Dictionary) => Promise>; - - /** - * wether to use GET (more compatible (Virtuozo), more error-prone due to large request URLs) - * or POST(less compatible, better on large data sets) - */ - queryMethod?: SparqlQueryMethod; - - /* - * what property to use as instance labels. This will override dataLabelProperty from settings - */ - labelProperty?: string; -} - -export class SparqlDataProvider implements DataProvider { - dataLabelProperty: string; - constructor( - private options: SparqlDataProviderOptions, - private settings: SparqlDataProviderSettings = OWLStatsSettings - ) { - this.dataLabelProperty = options.labelProperty ? options.labelProperty : settings.dataLabelProperty; - } - - classTree(): Promise { - const query = this.settings.defaultPrefix + this.settings.classTreeQuery; - return this.executeSparqlQuery(query).then(getClassTree); - } - - propertyInfo(params: { propertyIds: string[] }): Promise> { - const ids = params.propertyIds.map(escapeIri).map(id => ` ( ${id} )`).join(' '); - const query = this.settings.defaultPrefix + ` - SELECT ?prop ?label - WHERE { __GRAPH_LIMIT_BEGIN__ - ?prop ${this.settings.schemaLabelProperty} ?label. - VALUES (?prop) {${ids}}. - __GRAPH_LIMIT_END__ } - `; - return this.executeSparqlQuery(query).then(getPropertyInfo); - } - - classInfo(params: { classIds: string[] }): Promise { - const ids = params.classIds.map(escapeIri).map(id => ` ( ${id} )`).join(' '); - const query = this.settings.defaultPrefix + ` - SELECT ?class ?label ?instcount - WHERE { __GRAPH_LIMIT_BEGIN__ - ?class ${this.settings.schemaLabelProperty} ?label. - VALUES (?class) {${ids}}. - BIND("" as ?instcount) - __GRAPH_LIMIT_END__ } - `; - return this.executeSparqlQuery(query).then(getClassInfo); - } - - linkTypesInfo(params: {linkTypeIds: string[]}): Promise { - const ids = params.linkTypeIds.map(escapeIri).map(id => ` ( ${id} )`).join(' '); - const query = this.settings.defaultPrefix + ` - SELECT ?typeId ?label ?instcount - WHERE { __GRAPH_LIMIT_BEGIN__ - ?typeId ${this.settings.schemaLabelProperty} ?label. - VALUES (?typeId) {${ids}}. - BIND("" as ?instcount) - __GRAPH_LIMIT_END__ } - `; - return this.executeSparqlQuery(query).then(getLinkTypesInfo); - } - - linkTypes(): Promise { - const query = this.settings.defaultPrefix + ` - SELECT ?link ?instcount ?label - WHERE { __GRAPH_LIMIT_BEGIN__ - ${this.settings.linkTypesPattern} - OPTIONAL {?link ${this.settings.schemaLabelProperty} ?label.} - __GRAPH_LIMIT_END__ } - `; - return this.executeSparqlQuery(query).then(getLinkTypes); - } - - elementInfo(params: { elementIds: string[]; }): Promise> { - const ids = params.elementIds.map(escapeIri).map(id => ` (${id})`).join(' '); - const query = this.settings.defaultPrefix - + resolveTemplate(this.settings.elementInfoQuery, {ids: ids, dataLabelProperty: this.dataLabelProperty}); - return this.executeSparqlQuery(query) - .then(elementsInfo => getElementsInfo(elementsInfo, params.elementIds)) - .then(elementModels => { - if (this.options.prepareImages) { - return this.prepareElementsImage(elementModels); - } else if (this.options.imagePropertyUris && this.options.imagePropertyUris.length) { - return this.enrichedElementsInfo(elementModels, this.options.imagePropertyUris); - } else { - return elementModels; - } - }); - } - - private enrichedElementsInfo( - elementsInfo: Dictionary, - types: string[] - ): Promise> { - const ids = Object.keys(elementsInfo).map(escapeIri).map(id => ` ( ${id} )`).join(' '); - const typesString = types.map(escapeIri).map(id => ` ( ${id} )`).join(' '); - - const query = this.settings.defaultPrefix + ` - SELECT ?inst ?linkType ?image - WHERE {__GRAPH_LIMIT_BEGIN__{ - VALUES (?inst) {${ids}} - VALUES (?linkType) {${typesString}} - ${this.settings.imageQueryPattern} - }__GRAPH_LIMIT_END__} - `; - return this.executeSparqlQuery(query) - .then(imageResponse => getEnrichedElementsInfo(imageResponse, elementsInfo)).catch((err) => { - console.log(err); - return elementsInfo; - }); - } - - private prepareElementsImage( - elementsInfo: Dictionary - ): Promise> { - return this.options.prepareImages(elementsInfo).then(images => { - for (const key in images) { - if (images.hasOwnProperty(key) && elementsInfo[key]) { - elementsInfo[key].image = images[key]; - } - } - return elementsInfo; - }); - } - - linksInfo(params: { - elementIds: string[]; - linkTypeIds: string[]; - }): Promise { - const ids = params.elementIds.map(escapeIri).map(id => ` ( ${id} )`).join(' '); - const query = this.settings.defaultPrefix + ` - SELECT ?source ?type ?target - WHERE { __GRAPH_LIMIT_BEGIN__ - ?source ?type ?target. - VALUES (?source) {${ids}} - VALUES (?target) {${ids}} - __GRAPH_LIMIT_END__ } - `; - return this.executeSparqlQuery(query).then(getLinksInfo); - } - - linkTypesOf(params: { elementId: string; }): Promise { - const elementIri = escapeIri(params.elementId); - const query = this.settings.defaultPrefix - + resolveTemplate(this.settings.linkTypesOfQuery, {elementIri: elementIri}); - return this.executeSparqlQuery(query).then(getLinksTypesOf); - }; - - - linkElements(params: { - elementId: string; - linkId: string; - limit: number; - offset: number - }): Promise> { - // for sparql we have rich filtering features and we just reuse filter. - return this.filter({ - refElementId: params.elementId, - refElementLinkId: params.linkId, - limit: params.limit, - offset: params.offset, - languageCode: ''}); - } - - filter(params: FilterParams): Promise> { - if (params.limit === 0) { params.limit = 100; } - - let refQueryPart = ''; - // link to element with specified link type - if (params.refElementId && params.refElementLinkId) { - const refElementIRI = escapeIri(params.refElementId); - const refElementLinkIRI = escapeIri(params.refElementLinkId); - refQueryPart = `{ - ${refElementIRI} ${refElementLinkIRI} ?inst . - } UNION { - ?inst ${refElementLinkIRI} ${refElementIRI} . - }`; - } - - // all links to current element - if (params.refElementId && !params.refElementLinkId) { - const refElementIRI = escapeIri(params.refElementId); - refQueryPart = `{ - ${refElementIRI} ?link ?inst . - } UNION { - ?inst ?link ${refElementIRI} . - } - ${this.settings.filterRefElementLinkPattern} - `; - } - - if (!params.refElementId && params.refElementLinkId) { - throw new Error(`Can't execute refElementLink filter without refElement`); - } - - let elementTypePart: string; - if (params.elementTypeId) { - const elementTypeIri = escapeIri(params.elementTypeId); - elementTypePart = resolveTemplate(this.settings.filterTypePattern, {elementTypeIri: elementTypeIri}); - } else { - elementTypePart = ''; - } - - let textSearchPart: string; - if (params.text) { - const text = params.text; - textSearchPart = resolveTemplate( - this.settings.fullTextSearch.queryPattern, - {text: text, dataLabelProperty: this.dataLabelProperty} - ); - } else { - textSearchPart = ''; - } - - let query = `${this.settings.defaultPrefix} - ${this.settings.fullTextSearch.prefix} - - SELECT ?inst ?class ?label - WHERE { __GRAPH_LIMIT_BEGIN__ - { - SELECT DISTINCT ?inst ?score WHERE { __GRAPH_LIMIT_BEGIN__ - ${elementTypePart} - ${refQueryPart} - ${textSearchPart} - ${this.settings.filterAdditionalRestriction} - ${this.settings.fullTextSearch.extractLabel ? sparqlExtractLabel('?inst', '?extractedLabel') : ''} - __GRAPH_LIMIT_END__ } ORDER BY DESC(?score) LIMIT ${params.limit} OFFSET ${params.offset} - } - ${resolveTemplate(this.settings.filterElementInfoPattern, {dataLabelProperty: this.dataLabelProperty})} - __GRAPH_LIMIT_END__ } ORDER BY DESC(?score) - `; - - // TODO: we don't always have 'inst' property in results. Why? - return this.executeSparqlQuery(query).then(getFilteredData); - }; - - executeSparqlQuery(query: string) { - const method = this.options.queryMethod ? this.options.queryMethod : SparqlQueryMethod.GET; - return executeSparqlQuery(this.options.endpointUrl, query, method); - } - - executeSparqlConstruct(query: string) : Promise { - const method = this.options.queryMethod ? this.options.queryMethod : SparqlQueryMethod.GET; - return executeSparqlConstruct(this.options.endpointUrl, query, method); - } -} - -function resolveTemplate(template: string, values: Dictionary) { - let result = template; - for (const replaceKey in values) { - const replaceValue = values[replaceKey]; - result = result.replace(new RegExp('\\${' + replaceKey + '}', 'g'), replaceValue); - } - return result; -} - -export function executeSparqlQuery(endpoint: string, query: string, method: SparqlQueryMethod): Promise> { - let internalQuery: Promise; - if (method == SparqlQueryMethod.GET) { - internalQuery = queryInternal({ - url: `${endpoint}?query=` + encodeURIComponent(query), - body: null, - headers: { - 'Accept': 'application/sparql-results+json', - }, - method: 'GET', - }); - } else { - internalQuery = queryInternal({ - url: endpoint, - body: query, - headers: { - 'Accept': 'application/sparql-results+json', - 'Content-Type': 'application/sparql-query', - }, - method: 'POST', - }); - } - return internalQuery.then((response): Promise> => { - if (response.ok) { - return response.json(); - } else { - const error = new Error(`${response.statusText}: ${query}`); - (error).response = response; - throw error; - } - }); -}; - -export function executeSparqlConstruct(endpoint: string, query: string, method: SparqlQueryMethod): Promise { - let internalQuery: Promise; - if (method == SparqlQueryMethod.GET) { - internalQuery = queryInternal({ - url: `${endpoint}?query=` + encodeURIComponent(query), - body: null, - headers: { - 'Accept': 'text/turtle', - }, - method: 'GET', - }); - } else { - internalQuery = queryInternal({ - url: endpoint, - body: query, - headers: { - 'Accept': 'text/turtle', - 'Content-Type': 'application/sparql-query', - }, - method: 'POST', - }); - } - return new Promise((resolve, reject) => { - internalQuery.then(response => { - if (response.ok) { - return response.text(); - } else { - const error = new Error(`${response.statusText}: ${query}`); - (error).response = response; - throw error; - } - }).then(turtleText => { - let triples: Triple[] = []; - N3.Parser().parse(turtleText, (error, triple, hash) => { - if (triple) { - triples.push({ - subject: toRdfNode(triple.subject), - predicate: toRdfNode(triple.predicate), - object: toRdfNode(triple.object), - }); - } else { - resolve(triples); - } - }); - }); - }); -} - - - -function toRdfNode(entity: string): RdfNode { - if (entity.length >= 2 && entity[0] === '"' && entity[entity.length - 1] === '"') { - return {type: 'literal', value: entity.substring(1, entity.length - 1), 'xml:lang': ''}; - } else { - return {type: 'uri', value: entity}; - } -} - -function queryInternal(params: { - url: string, - body: string, - headers: any, - method: string, -}) { - return fetch(params.url, { - method: params.method, - body: params.body, - credentials: 'same-origin', - mode: 'cors', - cache: 'default', - headers: params.headers, - }); -} - -function sparqlExtractLabel(subject: string, label: string): string { - return ` - BIND ( str( ${subject} ) as ?uriStr) - BIND ( strafter(?uriStr, "#") as ?label3) - BIND ( strafter(strafter(?uriStr, "//"), "/") as ?label6) - BIND ( strafter(?label6, "/") as ?label5) - BIND ( strafter(?label5, "/") as ?label4) - BIND (if (?label3 != "", ?label3, - if (?label4 != "", ?label4, - if (?label5 != "", ?label5, ?label6))) as ${label}) - `; -}; - -function escapeIri(iri: string) { - return `<${iri}>`; -} - -export default SparqlDataProvider; diff --git a/DKBFrontEnd/src/src/ontodia/data/sparql/sparqlDataProviderSettings.ts b/DKBFrontEnd/src/src/ontodia/data/sparql/sparqlDataProviderSettings.ts deleted file mode 100644 index f418d6ed8..000000000 --- a/DKBFrontEnd/src/src/ontodia/data/sparql/sparqlDataProviderSettings.ts +++ /dev/null @@ -1,306 +0,0 @@ -/** - * this is dataset-schema specific settings - */ -export interface SparqlDataProviderSettings { - /** - * default prefix to be used in every query - */ - defaultPrefix: string; - /** - * property to use as label in schema (classes, properties) - */ - schemaLabelProperty: string; - - /** - * property to use as instance label - * todo: make it an array - */ - dataLabelProperty: string; - - /** - * full-text search settings - */ - fullTextSearch: FullTextSearchSettings; - - /** - * query to retreive class tree. Should return class, label, parent, instcount (optional) - */ - classTreeQuery: string; - - /** - * link types pattern - what to consider a link on initial fetch - */ - linkTypesPattern: string; - - /** - * query for fetching all information on element: labels, classes, properties - */ - elementInfoQuery: string; - - /** - * this should return image URL for ?inst as instance and ?linkType for image property IRI - * todo: move to runtime settings instead? proxying is runtime thing - */ - imageQueryPattern: string; - - /** - * link types of returns possible link types from specified instance with statistics - */ - linkTypesOfQuery: string; - - /** - * when fetching all links from element, we could specify additional filter - */ - filterRefElementLinkPattern: string; - - /** - * filter by type pattern. One could use transitive type resolution here. - */ - filterTypePattern: string; - - /** - * how to fetch elements info when fetching data. - */ - filterElementInfoPattern: string; - - /** - * imposes additional filtering on elements within filter - */ - filterAdditionalRestriction: string; -} - -/** - * Full text search settings, - * developer could use anything from search extensions of triplestore to regular expressions match - * See wikidata and dbpedia examples for reusing full text search capabilities of Blazegraph and Virtuozo - */ -export interface FullTextSearchSettings { - /** - * prefix to use in FTS queries - */ - prefix: string; - - /** - * query pattern should return ?inst and ?score for given ${text}. - */ - queryPattern: string; - - /** - * try to extract label from IRI for usage in search purposes. - * If you have no labels in the dataset and want to search, you - * can use ?extractedLabel as something to search for. - */ - extractLabel?: boolean; -} - -export const WikidataSettings: SparqlDataProviderSettings = { - defaultPrefix: - `PREFIX rdfs: - PREFIX rdf: - PREFIX wdt: - PREFIX wd: - PREFIX owl: - -`, - - schemaLabelProperty: 'rdfs:label', - dataLabelProperty: 'rdfs:label', - - fullTextSearch: { - prefix: 'PREFIX bds: ' + '\n', - queryPattern: ` - ?inst rdfs:label ?searchLabel. - SERVICE bds:search { - ?searchLabel bds:search "\${text}*" ; - bds:minRelevance '0.5' ; - bds:matchAllTerms 'true' . - } - BIND(IF(STRLEN(?strInst) > 33, - 0-(SUBSTR(?strInst, 33)), - -10000) as ?score) - `, - }, - - classTreeQuery: ` - SELECT distinct ?class ?label ?parent WHERE { __GRAPH_LIMIT_BEGIN__ - ?class rdfs:label ?label. - { ?class wdt:P279 wd:Q35120. } - UNION - { ?parent wdt:P279 wd:Q35120. - ?class wdt:P279 ?parent. } - UNION - { ?parent wdt:P279/wdt:P279 wd:Q35120. - ?class wdt:P279 ?parent. } - __GRAPH_LIMIT_END__ } - `, - - // todo: think more, maybe add a limit here? - linkTypesPattern: `?link wdt:P279* wd:Q18616576. - BIND(0 as ?instcount) -`, - - elementInfoQuery: ` - SELECT ?inst ?class ?label ?propType ?propValue - WHERE { __GRAPH_LIMIT_BEGIN__ - OPTIONAL { - { ?inst wdt:P31 ?class } UNION - { ?inst wdt:P31 ?realClass . - ?realClass wdt:P279 | wdt:P279/wdt:P279 ?class } - } - OPTIONAL {?inst rdfs:label ?label} - OPTIONAL { - ?inst ?propType ?propValue . - FILTER (isLiteral(?propValue)) - } - __GRAPH_LIMIT_END__ } VALUES (?inst) {\${ids}} - `, - imageQueryPattern: ` { ?inst ?linkType ?fullImage } union { ?inst wdt:P163/wdt:P18 ?fullImage } - BIND(CONCAT("https://commons.wikimedia.org/w/thumb.php?f=", - STRAFTER(STR(?fullImage), "Special:FilePath/"), "&w=200") AS ?image)`, - - linkTypesOfQuery: ` - SELECT ?link (count(distinct ?object) as ?instcount) - WHERE { __GRAPH_LIMIT_BEGIN__ - { \${elementIri} ?link ?object } - UNION { ?object ?link \${elementIri} } - #this is to prevent some junk appear on diagram, but can really slow down execution on complex objects - FILTER ISIRI(?object) - FILTER exists {?object ?someprop ?someobj} - FILTER regex(STR(?link), "direct") - __GRAPH_LIMIT_END__ } GROUP BY ?link - `, - filterRefElementLinkPattern: 'FILTER regex(STR(?link), "direct")', - filterTypePattern: `?inst wdt:P31 ?instType. ?instType wdt:P279* \${elementTypeIri} . ${'\n'}`, - filterAdditionalRestriction: `FILTER ISIRI(?inst) - BIND(STR(?inst) as ?strInst) - FILTER exists {?inst ?someprop ?someobj} -`, - filterElementInfoPattern: `OPTIONAL {?inst wdt:P31 ?foundClass} - BIND (coalesce(?foundClass, owl:Thing) as ?class) - OPTIONAL {?inst rdfs:label ?label} -`, -}; - -export const OWLRDFSSettings: SparqlDataProviderSettings = { - defaultPrefix: - `PREFIX rdfs: - PREFIX rdf: - PREFIX owl: - -`, - schemaLabelProperty: 'rdfs:label', - dataLabelProperty: 'rdfs:label', - fullTextSearch: { - prefix: '', - queryPattern: - ` OPTIONAL {?inst \${dataLabelProperty} ?search1} - FILTER regex(COALESCE(str(?search1), str(?extractedLabel)), "\${text}", "i") - BIND(0 as ?score) -`, - extractLabel: true, - }, - classTreeQuery: ` - SELECT ?class ?label ?parent - WHERE { __GRAPH_LIMIT_BEGIN__ - { - ?class a rdfs:Class - } UNION { - ?class a owl:Class - } - OPTIONAL { ?class rdfs:label ?label.} - OPTIONAL {?class rdfs:subClassOf ?parent} - __GRAPH_LIMIT_END__ } - `, - - // todo: think more, maybe add a limit here? - linkTypesPattern: `{ ?link a rdf:Property - } UNION { - ?link a owl:ObjectProperty - } - BIND('' as ?instcount) -`, - elementInfoQuery: ` - SELECT ?inst ?class ?label ?propType ?propValue - WHERE { __GRAPH_LIMIT_BEGIN__ - OPTIONAL {?inst rdf:type ?class . } - OPTIONAL {?inst \${dataLabelProperty} ?label} - OPTIONAL {?inst ?propType ?propValue. - FILTER (isLiteral(?propValue)) } - __GRAPH_LIMIT_END__ } VALUES (?inst) {\${ids}} - `, - imageQueryPattern: `{ ?inst ?linkType ?image } UNION { [] ?linkType ?inst. BIND(?inst as ?image) }`, - linkTypesOfQuery: ` - SELECT ?link (count(distinct ?object) as ?instcount) - WHERE { __GRAPH_LIMIT_BEGIN__ - { \${elementIri} ?link ?object FILTER ISIRI(?object)} - UNION { ?object ?link \${elementIri} } - __GRAPH_LIMIT_END__ } GROUP BY ?link - `, - filterRefElementLinkPattern: '', - filterTypePattern: `?inst rdf:type \${elementTypeIri} . ${'\n'}`, - filterElementInfoPattern: `OPTIONAL {?inst rdf:type ?foundClass} - BIND (coalesce(?foundClass, owl:Thing) as ?class) - OPTIONAL {?inst \${dataLabelProperty} ?label}`, - filterAdditionalRestriction: '', -}; - -export const OWLStatsSettings: SparqlDataProviderSettings = {...OWLRDFSSettings, - classTreeQuery: ` - SELECT ?class ?instcount ?label ?parent - WHERE { __GRAPH_LIMIT_BEGIN__ - {SELECT ?class (count(?inst) as ?instcount) - WHERE { __GRAPH_LIMIT_BEGIN__ - ?inst rdf:type ?class. - __GRAPH_LIMIT_END__ } GROUP BY ?class } UNION - { - ?class rdf:type rdfs:Class - } UNION { - ?class rdf:type owl:Class - } - OPTIONAL { ?class rdfs:label ?label.} - OPTIONAL {?class rdfs:subClassOf ?parent} - __GRAPH_LIMIT_END__ } - `, -}; - -export const DBPediaSettings: SparqlDataProviderSettings = {...OWLRDFSSettings, - fullTextSearch: { - prefix: 'PREFIX dbo: \n', - queryPattern: ` - ?inst rdfs:label ?searchLabel. - ?searchLabel bif:contains "\${text}". - ?inst dbo:wikiPageID ?origScore . - BIND(0-?origScore as ?score) - `, - }, - - classTreeQuery: ` - SELECT distinct ?class ?label ?parent WHERE { - ?class rdfs:label ?label. - OPTIONAL {?class rdfs:subClassOf ?parent} - ?root rdfs:subClassOf owl:Thing. - ?class rdfs:subClassOf? | rdfs:subClassOf/rdfs:subClassOf ?root - } - `, - - elementInfoQuery: ` - SELECT ?inst ?class ?label ?propType ?propValue - WHERE { - ?inst rdf:type ?class . - ?inst rdfs:label ?label . - FILTER (!contains(str(?class), 'http://dbpedia.org/class/yago')) - OPTIONAL {?inst ?propType ?propValue. - FILTER (isLiteral(?propValue)) } - } VALUES (?inst) {\${ids}} - `, - filterElementInfoPattern: ` - OPTIONAL {?inst rdf:type ?foundClass. FILTER (!contains(str(?foundClass), 'http://dbpedia.org/class/yago'))} - BIND (coalesce(?foundClass, owl:Thing) as ?class) - OPTIONAL {?inst \${dataLabelProperty} ?label}`, - imageQueryPattern: ` { ?inst ?linkType ?fullImage } UNION { [] ?linkType ?inst. BIND(?inst as ?fullImage) } - BIND(CONCAT("https://commons.wikimedia.org/w/thumb.php?f=", - STRAFTER(STR(?fullImage), "Special:FilePath/"), "&w=200") AS ?image) -`, - -}; - diff --git a/DKBFrontEnd/src/src/ontodia/data/sparql/sparqlModels.ts b/DKBFrontEnd/src/src/ontodia/data/sparql/sparqlModels.ts deleted file mode 100644 index dd7cda57b..000000000 --- a/DKBFrontEnd/src/src/ontodia/data/sparql/sparqlModels.ts +++ /dev/null @@ -1,68 +0,0 @@ -export type RdfNode = RdfIri | RdfLiteral; - -export interface RdfIri { - type: 'uri'; - value: string; -} - -export interface RdfLiteral { - type: 'literal'; - value: string; - datatype?: string; - 'xml:lang': string; -} - -export interface Triple { - subject: RdfNode; - predicate: RdfNode; - object: RdfNode; -} - -export interface ElementBinding { - inst: RdfLiteral; - class?: RdfLiteral; - label?: RdfLiteral; - propType?: RdfLiteral; - propValue?: RdfLiteral; -} - -export interface ClassBinding { - class: RdfIri; - instcount?: RdfLiteral; - label?: RdfLiteral; - parent?: RdfIri; -} - -export interface PropertyBinding { - prop: RdfIri; - label?: RdfLiteral; -} - -export interface LinkBinding { - source: RdfIri; - type: RdfIri; - target: RdfIri; -} - -export interface LinkTypeBinding { - link: RdfIri; - instcount?: RdfLiteral; - label?: RdfLiteral; -} - -export interface LinkTypeInfoBinding { - typeId: RdfIri; - label?: RdfLiteral; - instcount?: RdfLiteral; -} - -export interface ElementImageBinding { - inst: RdfIri; - linkType: RdfIri; - image: RdfIri; -} - -export interface SparqlResponse { - head: { vars: string[] }; - results: { bindings: Binding[] }; -} diff --git a/DKBFrontEnd/src/src/ontodia/diagram/dataFetchingThread.ts b/DKBFrontEnd/src/src/ontodia/diagram/dataFetchingThread.ts deleted file mode 100644 index 717615835..000000000 --- a/DKBFrontEnd/src/src/ontodia/diagram/dataFetchingThread.ts +++ /dev/null @@ -1,29 +0,0 @@ -const DEFAULT_WAITING_TIME = 200; - -export class DataFetchingThread { - private fetchingPromise: Promise = null; - private fetchingQueue: string[] = []; - private waitingTime: number; - - constructor(waitingTime?: number) { - this.waitingTime = waitingTime || DEFAULT_WAITING_TIME; - } - - public startFetchingThread(typeId: string): Promise { - this.fetchingQueue.push(typeId); - if (this.fetchingPromise) { - return Promise.resolve([]); - } else { - this.fetchingPromise = new Promise((resolve) => { - setTimeout(() => { - this.fetchingPromise = null; - const queue = this.fetchingQueue; - this.fetchingQueue = []; - resolve(queue); - }, 200); - }); - return this.fetchingPromise; - } - } - -} diff --git a/DKBFrontEnd/src/src/ontodia/diagram/elementLayer.tsx b/DKBFrontEnd/src/src/ontodia/diagram/elementLayer.tsx deleted file mode 100644 index 1d9b1a2ef..000000000 --- a/DKBFrontEnd/src/src/ontodia/diagram/elementLayer.tsx +++ /dev/null @@ -1,292 +0,0 @@ -import * as React from 'react'; -import { findDOMNode } from 'react-dom'; -import * as joint from 'jointjs'; -import * as Backbone from 'backbone'; -import { hcl } from 'd3-color'; - -import { Property } from '../data/model'; - -import { TemplateProps } from '../customization/props'; -import { HandlebarsTemplate } from '../customization/handlebarsTemplate'; - -import { Element } from './elements'; -import { uri2name } from './model'; -import { DiagramView } from './view'; - -export interface Props { - paper: joint.dia.Paper; - view: DiagramView; -} - -export class ElementLayer extends React.Component { - private readonly listener = new Backbone.Model(); - - private layer: HTMLDivElement; - - render() { - const models = this.props.view.model.elements; - - const ctm = this.props.paper.viewport.getCTM(); - const scale = {x: ctm.a, y: ctm.d}; - const translate = {x: ctm.e, y: ctm.f}; - - return
this.layer = layer} - style={{ - position: 'absolute', left: 0, top: 0, - transform: `translate(${translate.x}px,${translate.y}px) scale(${scale.x},${scale.y})`, - }}> - {models.map(model => )} -
; - } - - componentDidMount() { - const {paper} = this.props; - const graph = paper.model; - this.listener.listenTo(graph, 'add remove reset', this.updateAll); - this.listener.listenTo(paper, 'scale', this.updateAll); - this.listener.listenTo(paper, 'translate resize', this.updateAll); - } - - private updateAll = () => this.forceUpdate(); - - componentWillUnmount() { - this.listener.stopListening(); - } - - private updateElementSize = (element: Element, node: HTMLDivElement) => { - const {clientWidth, clientHeight} = node; - element.set('size', {width: clientWidth, height: clientHeight}); - } -} - -interface OverlayedElementProps { - model: Element; - view: DiagramView; - onResize: (model: Element, node: HTMLDivElement) => void; - onRender: (model: Element, node: HTMLDivElement) => void; -} - -interface OverlayedElementState { - readonly templateProps?: TemplateProps; -} - -class OverlayedElement extends React.Component { - private readonly listener = new Backbone.Model(); - - private typesObserver = new KeyedObserver({ - subscribe: key => { - const type = this.props.view.model.getClassesById(key); - if (type) { this.listener.listenTo(type, 'change:label', this.rerenderTemplate); } - }, - unsubscribe: key => { - const type = this.props.view.model.getClassesById(key); - if (type) { this.listener.stopListening(type); } - }, - }); - - private propertyObserver = new KeyedObserver({ - subscribe: key => { - const property = this.props.view.model.getPropertyById(key); - if (property) { this.listener.listenTo(property, 'change:label', this.rerenderTemplate); } - }, - unsubscribe: key => { - const property = this.props.view.model.getPropertyById(key); - if (property) { this.listener.stopListening(property); } - }, - }); - - constructor(props: OverlayedElementProps) { - super(props); - this.state = { - templateProps: this.templateProps(), - }; - } - - private rerenderTemplate = () => this.setState({templateProps: this.templateProps()}); - - render(): React.ReactElement { - const {model, view, onResize, onRender} = this.props; - - this.typesObserver.observe(model.template.types); - this.propertyObserver.observe(Object.keys(model.template.properties)); - - const template = view.getElementTemplate(model.template.types); - - const {x = 0, y = 0} = model.get('position') || {}; - let transform = `translate(${x}px,${y}px)`; - - const angle = model.get('angle') || 0; - if (angle) { transform += `rotate(${angle}deg)`; } - - return
onResize(model, findDOMNode(this) as HTMLDivElement)} - onError={() => onResize(model, findDOMNode(this) as HTMLDivElement)} - onClick={e => { - if (e.target instanceof HTMLElement && e.target.localName === 'a') { - const anchor = e.target as HTMLAnchorElement; - model.iriClick(anchor.href); - e.preventDefault(); - } - }} - onDoubleClick={() => { - model.isExpanded = !model.isExpanded; - }} - ref={node => { - if (!node) { return; } - // set `model-id` to translate mouse events to paper - node.setAttribute('model-id', model.id); - onRender(model, node); - }}> - {typeof template === 'string' - ? onResize(model, findDOMNode(this) as HTMLDivElement)} /> - : React.createElement(template, this.state.templateProps)} -
; - } - - componentDidMount() { - const {model, view} = this.props; - this.listener.listenTo(view, 'change:language', this.rerenderTemplate); - this.listener.listenTo(model, 'state:loaded', this.rerenderTemplate); - this.listener.listenTo(model, 'focus-on-me', () => { - const element = findDOMNode(this) as HTMLElement; - if (element) { element.focus(); } - }); - this.listener.listenTo(model, 'change', () => { - let invalidateRendering = false, - invalidateAll = false; - - for (const changedKey in model.changed) { - if (!model.changed.hasOwnProperty(changedKey)) { continue; } - if (changedKey === 'size') { - /* ignore size changes */ - } else if (changedKey === 'position' || changedKey === 'angle') { - invalidateRendering = true; - } else { - invalidateAll = true; - } - } - - if (invalidateAll) { - this.rerenderTemplate(); - } else if (invalidateRendering) { - this.forceUpdate(); - } - }); - } - - componentWillUnmount() { - this.listener.stopListening(); - } - - shouldComponentUpdate(nextProps: OverlayedElementProps, nextState: OverlayedElementState) { - return nextState !== this.state; - } - - componentDidUpdate() { - this.props.onResize(this.props.model, findDOMNode(this) as HTMLDivElement); - } - - private templateProps(): TemplateProps { - const {model, view} = this.props; - - const types = model.template.types.length > 0 - ? view.getElementTypeString(model.template) : 'Thing'; - const label = view.getLocalizedText(model.template.label.values).text; - const {color, icon} = this.styleFor(model); - const propsAsList = this.getPropertyTable(); - - return { - types, - label, - color, - icon, - iri: model.template.id, - imgUrl: model.template.image, - isExpanded: model.isExpanded, - props: model.template.properties, - propsAsList, - }; - } - - private getPropertyTable(): Array<{ id: string; name: string; property: Property; }> { - const {model, view} = this.props; - - if (!model.template.properties) { return []; } - - const propTable = Object.keys(model.template.properties).map(key => { - const property = view ? view.model.getPropertyById(key) : undefined; - const name = view ? view.getLocalizedText(property.label.values).text : uri2name(key); - return { - id: key, - name: name, - property: model.template.properties[key], - }; - }); - - propTable.sort((a, b) => { - const aLabel = (a.name || a.id).toLowerCase(); - const bLabel = (b.name || b.id).toLowerCase(); - return aLabel.localeCompare(bLabel); - }); - return propTable; - } - - private styleFor(model: Element) { - const {color: {h, c, l}, icon} = this.props.view.getTypeStyle(model.template.types); - return { - icon: icon ? icon : 'ontodia-default-icon', - color: hcl(h, c, l).toString(), - }; - } -} - -class KeyedObserver { - private observedKeys = this.createMap(); - - private subscribe: (key: string) => void; - private unsubscribe: (key: string) => void; - - constructor(params: { - subscribe: (key: string) => void; - unsubscribe: (key: string) => void; - }) { - this.subscribe = params.subscribe; - this.unsubscribe = params.unsubscribe; - } - - private createMap(): { [key: string]: V; } { - const map = Object.create(null); - delete map['hint']; - return map; - } - - observe(keys: string[]) { - const newObservedKeys = this.createMap(); - - for (const key of keys) { - if (newObservedKeys[key]) { continue; } - newObservedKeys[key] = true; - if (!this.observedKeys[key]) { - this.subscribe(key); - } - } - - for (const key in this.observedKeys) { - if (!newObservedKeys[key]) { - this.unsubscribe(key); - } - } - - this.observedKeys = newObservedKeys; - } -} diff --git a/DKBFrontEnd/src/src/ontodia/diagram/elements.ts b/DKBFrontEnd/src/src/ontodia/diagram/elements.ts deleted file mode 100644 index 853f156c7..000000000 --- a/DKBFrontEnd/src/src/ontodia/diagram/elements.ts +++ /dev/null @@ -1,194 +0,0 @@ -import * as Backbone from 'backbone'; -import * as joint from 'jointjs'; - -import { ClassModel, ElementModel, LocalizedString } from '../data/model'; -import { DiagramModel, PreventLinksLoading } from './model'; - -export class UIElement extends joint.shapes.basic.Generic { - markup: string; - defaults() { - return joint.util.deepSupplement({ - type: 'element', - size: { width: 250, height: 50 }, - }, joint.shapes.basic.Generic.prototype.defaults); - } -} -UIElement.prototype.markup = ''; - -/** - * Properties: - * isExpanded: boolean - * position: { x: number, y: number } - * size: { width: number, height: number } - * angle: number - degrees - * - * Events: - * state:loaded - * add-to-filter - * focus-on-me - * action:iriClick - */ -export class Element extends UIElement { - template: ElementModel; - /** All in and out links of the element */ - links: Link[] = []; - - get isExpanded(): boolean { return this.get('isExpanded'); } - set isExpanded(value: boolean) { this.set('isExpanded', value); } - - initialize() { - joint.shapes.basic.Generic.prototype.initialize.apply(this, arguments); - this.set('z', 1); - // element is collapsed by default - if (!this.has('isExpanded')) { this.set('isExpanded', false); } - } - - addToFilter(linkType?: FatLinkType) { - this.trigger('add-to-filter', this, linkType); - } - - focus() { - this.trigger('focus-on-me', this); - } - - iriClick(iri: string) { - this.trigger('action:iriClick', iri); - } -} - -/** - * Properties: - * id: string - * label: { values: LocalizedString[] } - * count: number - */ -export class FatClassModel extends Backbone.Model { - model: ClassModel; - - get label(): { values: LocalizedString[] } { return this.get('label'); } - - constructor(classModel: ClassModel) { - super({id: classModel.id}); - this.model = classModel; - this.set('label', classModel.label); - this.set('count', classModel.count); - } -} - -/** - * Properties: - * id: string - * label: { values: LocalizedString[] } - */ -export class RichProperty extends Backbone.Model { - get label(): { values: LocalizedString[] } { return this.get('label'); } - - constructor(model: { - id: string; - label: { values: LocalizedString[] }; - }) { - super({id: model.id}); - this.set('label', model.label); - } -} - -/** - * Properties: - * typeId: string - * typeIndex: number - * source: { id: string } - * target: { id: string } - * layoutOnly: boolean -- link exists only in layout (instead of underlying data) - * - * Events: - * state:loaded - */ -export class Link extends joint.dia.Link { - arrowheadMarkup: string; - get markup() { - if (typeof this.typeIndex !== 'number') { - throw new Error('Missing typeIndex when intializing link\'s markup'); - } - return `` - + `` - + `` - + `` - + ``; - } - - get typeIndex(): number { return this.get('typeIndex'); } - set typeIndex(value: number) { this.set('typeIndex', value); } - - get typeId(): string { return this.get('typeId'); } - - get sourceId(): string { return this.get('source').id; } - get targetId(): string { return this.get('target').id; } - - get layoutOnly(): boolean { return this.get('layoutOnly'); } - set layoutOnly(value: boolean) { this.set('layoutOnly', value); } - - initialize(attributes?: {id: string}) { - this.set('labels', [{position: 0.5}]); - } -} -Link.prototype.arrowheadMarkup = null; - -export function linkMarkerKey(linkTypeIndex: number, startMarker: boolean) { - return `ontodia-${startMarker ? 'mstart' : 'mend'}-${linkTypeIndex}`; -} - -/** - * Properties: - * visible: boolean - * showLabel: boolean - * isNew?: boolean - * label?: { values: LocalizedString[] } - */ -export class FatLinkType extends Backbone.Model { - private diagram: DiagramModel; - - readonly index: number; - - get label(): { values: LocalizedString[] } { return this.get('label'); } - set label(value: { values: LocalizedString[] }) { this.set('label', value); } - - get visible(): boolean { return this.get('visible'); } - setVisibility( - params: { visible: boolean; showLabel: boolean; }, - options?: PreventLinksLoading, - ) { - this.set(params, options); - } - - constructor(params: { - id: string; - index: number; - label: { values: LocalizedString[] }; - diagram: DiagramModel; - }) { - super({ - id: params.id, - label: params.label, - visible: true, - showLabel: true, - }); - this.index = params.index; - this.diagram = params.diagram; - this.listenTo(this, 'change:visible', this.onVisibilityChanged); - } - - private onVisibilityChanged(self: this, visible: boolean, options: PreventLinksLoading) { - if (visible) { - if (!options.preventLoading) { - this.diagram.requestLinksOfType([this.id]); - } - } else { - const links = [...this.diagram.linksOfType(this.id)]; - for (const link of links) { - link.remove(); - } - } - } -} diff --git a/DKBFrontEnd/src/src/ontodia/diagram/layoutData.ts b/DKBFrontEnd/src/src/ontodia/diagram/layoutData.ts deleted file mode 100644 index a3278a2ca..000000000 --- a/DKBFrontEnd/src/src/ontodia/diagram/layoutData.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { pick } from 'lodash'; - -export interface LayoutData { - readonly cells: LayoutCell[]; -} - -export type LayoutCell = LayoutElement | LayoutLink; - -export interface LayoutElement { - type: 'element'; - id: string; - position: { x: number; y: number; }; - size?: any; - angle?: number; - isExpanded?: boolean; -} - -export interface LayoutLink { - type: 'link'; - id: string; - typeId: string; - source: { id: string }; - target: { id: string }; - vertices?: Array<{ x: number; y: number; }>; -} - -const serializedCellProperties = [ - 'id', 'type', // common properties - 'size', 'angle', 'isExpanded', 'position', // element properties - 'typeId', 'source', 'target', 'vertices', // link properties -]; - -export function normalizeImportedCell(cell: Cell): Cell { - let newCell: any = pick(cell, serializedCellProperties); - if (newCell.type === 'Ontodia.Element') { - newCell.type = 'element'; - } - return newCell; -} - -export function cleanExportedLayout(layout: LayoutData): LayoutData { - const cells = layout.cells.map(cell => pick(cell, serializedCellProperties) as LayoutCell); - return {cells}; -} diff --git a/DKBFrontEnd/src/src/ontodia/diagram/linkView.ts b/DKBFrontEnd/src/src/ontodia/diagram/linkView.ts deleted file mode 100644 index 952e89162..000000000 --- a/DKBFrontEnd/src/src/ontodia/diagram/linkView.ts +++ /dev/null @@ -1,89 +0,0 @@ -import * as joint from 'jointjs'; -import { merge } from 'lodash'; - -import { isIE11 } from '../viewUtils/detectBrowser'; - -import { Link, FatLinkType } from './elements'; -import { DiagramView } from './view'; - -export class LinkView extends joint.dia.LinkView { - model: Link; - - paper?: { diagramView?: DiagramView }; - - private view: DiagramView; - - initialize() { - joint.dia.LinkView.prototype.initialize.apply(this, arguments); - this.listenTo(this.model, 'change:layoutOnly', this.updateLabel); - } - render(): LinkView { - if (!this.view && this.paper && this.paper.diagramView) { - this.setView(this.paper.diagramView); - } - const result: any = super.render(); - return result; - } - getTypeModel(): FatLinkType { - return this.view.model.getLinkType(this.model.get('typeId')); - } - private setView(view: DiagramView) { - this.view = view; - this.listenTo(this.view, 'change:language', this.updateLabel); - - const typeModel = this.getTypeModel(); - this.listenTo(typeModel, 'change:showLabel', this.updateLabel); - this.listenTo(typeModel, 'change:label', this.updateLabel); - - this.updateLabelWithOptions({silent: true}); - } - - private updateLabel() { - this.updateLabelWithOptions(); - } - - private updateLabelWithOptions(options?: { silent?: boolean }) { - const linkTypeId: string = this.model.get('typeId'); - const typeModel = this.view.model.getLinkType(linkTypeId); - - const style = this.view.getLinkStyle(this.model.get('typeId')); - merge(style, {connection: {'stroke-dasharray': this.model.layoutOnly ? '5,5' : null}}); - - let linkAttributes: joint.dia.LinkAttributes = { - labels: style.labels, - connector: style.connector, - router: style.router, - z: 0, - }; - if (style.connection) { - merge(linkAttributes, {attrs: {'.connection': style.connection}}); - } - - const showLabels = typeModel && typeModel.get('showLabel'); - const labelAttributes = showLabels ? [{ - position: 0.5, - attrs: {text: { - text: this.view.getLinkLabel(linkTypeId).text, - }}, - }] : []; - - merge(linkAttributes, {labels: labelAttributes}); - this.model.set(linkAttributes, options); - } -} - -if (isIE11()) { - // workaround for "Dynamically updated SVG path with a marker-end does not update" issue - // https://connect.microsoft.com/IE/feedback/details/801938/ - (LinkView.prototype as any).update = function (this: LinkView) { - (joint.dia.LinkView.prototype as any).update.apply(this, arguments); - const path = (this.el as HTMLElement).querySelector('.connection') as SVGPathElement; - if (path) { - const pathParent = path.parentNode; - if (pathParent) { - pathParent.removeChild(path); - pathParent.insertBefore(path, pathParent.firstChild); - } - } - }; -} diff --git a/DKBFrontEnd/src/src/ontodia/diagram/model.ts b/DKBFrontEnd/src/src/ontodia/diagram/model.ts deleted file mode 100644 index a855fc317..000000000 --- a/DKBFrontEnd/src/src/ontodia/diagram/model.ts +++ /dev/null @@ -1,586 +0,0 @@ -import * as Backbone from 'backbone'; -import { each, size, values, keyBy, defaults, uniqueId } from 'lodash'; -import * as joint from 'jointjs'; - -import { - Dictionary, LocalizedString, LinkType, ClassModel, ElementModel, LinkModel, -} from '../data/model'; -import { DataProvider } from '../data/provider'; - -import { LayoutData, LayoutElement, normalizeImportedCell, cleanExportedLayout } from './layoutData'; -import { Element, Link, FatLinkType, FatClassModel, RichProperty } from './elements'; -import { DataFetchingThread } from './dataFetchingThread'; - -export type IgnoreCommandHistory = { ignoreCommandManager?: boolean }; -export type PreventLinksLoading = { preventLoading?: boolean; }; - -type ChangeVisibilityOptions = { isFromHandler?: boolean }; - -/** - * Model of diagram. - * - * Properties: - * isViewOnly: boolean - * - * Events: - * state:beginLoad - * state:endLoad (diagramElementCount?: number) - * state:loadError (error: any) - * state:renderStart - * state:renderDone - * state:dataLoaded - * - * history:undo - * history:redo - * history:reset - * history:initBatchCommand - * history:storeBatchCommand - */ -export class DiagramModel extends Backbone.Model { - graph = new joint.dia.Graph(); - - dataProvider: DataProvider; - - classTree: ClassTreeElement[]; - private classesById: Dictionary = {}; - private propertyLabelById: Dictionary = {}; - - private nextLinkTypeIndex = 0; - private linkTypes: Dictionary; - - private linksByType: Dictionary = {}; - - private classFetchingThread: DataFetchingThread; - private linkFetchingThread: DataFetchingThread; - private propertyLabelFetchingThread: DataFetchingThread; - - constructor(isViewOnly = false) { - super(); - this.set('isViewOnly', isViewOnly); - this.initializeExternalAddRemoveSupport(); - this.classFetchingThread = new DataFetchingThread(); - this.linkFetchingThread = new DataFetchingThread(); - this.propertyLabelFetchingThread = new DataFetchingThread(); - } - - isViewOnly(): boolean { return this.get('isViewOnly'); } - - get cells(): Backbone.Collection { return this.graph.get('cells'); } - get elements() { return this.graph.getElements() as Element[]; } - get links() { return this.graph.getLinks() as Link[]; } - - getElement(elementId: string): Element | undefined { - const cell = this.cells.get(elementId); - return cell instanceof Element ? cell : undefined; - } - - getLinkType(linkTypeId: string): FatLinkType | undefined { - return this.linkTypes[linkTypeId]; - } - - linksOfType(linkTypeId: string): ReadonlyArray { return this.linksByType[linkTypeId] || []; } - - sourceOf(link: Link) { return this.getElement(link.get('source').id); } - targetOf(link: Link) { return this.getElement(link.get('target').id); } - isSourceAndTargetVisible(link: Link): boolean { - return Boolean(this.sourceOf(link) && this.targetOf(link)); - } - - undo() { this.trigger('history:undo'); } - redo() { this.trigger('history:redo'); } - resetHistory() { this.trigger('history:reset'); } - initBatchCommand() { this.trigger('history:initBatchCommand'); } - storeBatchCommand() { this.trigger('history:storeBatchCommand'); } - - private initializeExternalAddRemoveSupport() { - // override graph.addCell to support CommandManager's undo/redo - const superAddCell = this.graph.addCell; - this.graph['addCell'] = (cell: any, options: any) => { - if (cell instanceof Element || cell instanceof Link) { - superAddCell.call(this.graph, cell, options); - } else if (cell.type === 'link') { - this.createLink({ - sourceId: cell.source.id, - targetId: cell.target.id, - linkTypeId: cell.typeId, - suggestedId: cell.id, - vertices: cell.vertices, - }); - } else if (cell.type === 'element') { - const {id, position, angle, isExpanded} = cell as LayoutElement; - const element = new Element({id, position, angle, isExpanded}); - element.template = placeholderTemplateFromIri(cell.id); - superAddCell.call(this.graph, element, options); - this.requestElementData([element]); - this.requestLinksOfType(); - } else { - superAddCell.call(this.graph, cell, options); - } - }; - // listen to external add/remove calls to graph (Halo's remove for example) - this.listenTo(this.graph, 'add', (cell: joint.dia.Cell) => { - if (cell instanceof Link) { - const linkType = this.getLinkType(cell.get('typeId')); - linkType.set('visible', true); - } - }); - this.listenTo(this.graph, 'remove', (cell: joint.dia.Cell) => { - if (cell instanceof Link) { - const {typeId, sourceId, targetId} = cell; - this.removeLinkReferences({linkTypeId: typeId, sourceId, targetId}); - } - }); - } - - createNewDiagram(dataProvider: DataProvider): Promise { - this.dataProvider = dataProvider; - this.trigger('state:beginLoad'); - - return Promise.all([ - this.dataProvider.classTree(), - this.dataProvider.linkTypes(), - ]).then(([classTree, linkTypes]: [ClassModel[], LinkType[]]) => { - this.setClassTree(classTree); - this.initLinkTypes(linkTypes); - this.trigger('state:endLoad', 0); - this.initLinkSettings(); - return this.initDiagram({preloadedElements: {}, markLinksAsLayoutOnly: false}); - }).catch(err => { - console.error(err); - this.trigger('state:endLoad', null, err.errorKind, err.message); - }); - } - - private initLinkTypes(linkTypes: LinkType[]) { - this.linkTypes = {}; - each(linkTypes, ({id, label}: LinkType) => { - const linkType = new FatLinkType({id, label, diagram: this, index: this.nextLinkTypeIndex++}); - this.linkTypes[linkType.id] = linkType; - }); - } - - importLayout(params: { - dataProvider: DataProvider; - preloadedElements?: Dictionary; - layoutData?: LayoutData; - validateLinks?: boolean; - linkSettings?: LinkTypeOptions[]; - hideUnusedLinkTypes?: boolean; - }): Promise { - this.dataProvider = params.dataProvider; - this.trigger('state:beginLoad'); - - return Promise.all([ - this.dataProvider.classTree(), - this.dataProvider.linkTypes(), - ]).then(([classTree, linkTypes]) => { - this.setClassTree(classTree); - this.initLinkTypes(linkTypes); - this.trigger('state:endLoad', size(params.preloadedElements)); - this.initLinkSettings(params.linkSettings); - return this.initDiagram({ - layoutData: params.layoutData, - preloadedElements: params.preloadedElements || {}, - markLinksAsLayoutOnly: params.validateLinks || false, - hideUnusedLinkTypes: params.hideUnusedLinkTypes, - }).then(() => { - if (params.validateLinks) { this.requestLinksOfType(); } - }); - }).catch(err => { - console.error(err); - this.trigger('state:endLoad', null, err.errorKind, err.message); - }); - } - - exportLayout(): { - layoutData: LayoutData; - linkSettings: LinkTypeOptions[]; - } { - const layoutData = cleanExportedLayout(this.graph.toJSON()); - const linkSettings = values(this.linkTypes).map((type: FatLinkType) => ({ - id: type.id, - visible: type.get('visible'), - showLabel: type.get('showLabel'), - })); - return {layoutData, linkSettings}; - } - - private setClassTree(rootClasses: ClassModel[]) { - this.classTree = rootClasses; - const addClass = (cl: ClassTreeElement) => { - this.classesById[cl.id] = new FatClassModel(cl); - each(cl.children, addClass); - }; - each(rootClasses, addClass); - } - - private initDiagram(params: { - layoutData?: LayoutData; - preloadedElements: Dictionary; - markLinksAsLayoutOnly: boolean; - hideUnusedLinkTypes?: boolean; - }): Promise { - const {layoutData, preloadedElements, markLinksAsLayoutOnly, hideUnusedLinkTypes} = params; - return new Promise((resolve, reject) => { - this.graph.trigger('batch:start', {batchName: 'to-back'}); - - this.listenToOnce(this, 'state:renderDone', () => { - if (hideUnusedLinkTypes) { - this.hideUnusedLinkTypes(); - } - this.graph.trigger('batch:stop', {batchName: 'to-back'}); - - resolve(); - // notify when graph model is fully initialized - this.trigger('state:dataLoaded'); - }); - - this.initLayout(layoutData || {cells: []}, preloadedElements, markLinksAsLayoutOnly); - }); - } - - private initLinkSettings(linkSettings?: LinkTypeOptions[]) { - if (linkSettings) { - const existingDefaults = { visible: false, showLabel: true }; - const indexedSettings = keyBy(linkSettings, 'id'); - each(this.linkTypes, (type, typeId) => { - const settings = indexedSettings[typeId] || {isNew: true}; - const options: PreventLinksLoading = {preventLoading: true}; - type.set(defaults(settings, existingDefaults), options); - }); - } else { - const newDefaults = { visible: true, showLabel: true }; - const options: PreventLinksLoading = {preventLoading: true}; - each(this.linkTypes, type => type.set(newDefaults, options)); - } - } - - private initLayout( - layoutData: LayoutData, - preloadedElements: Dictionary, - markLinksAsLayoutOnly: boolean, - ) { - this.linksByType = {}; - - const cellModels: joint.dia.Cell[] = []; - const elementToRequestData: Element[] = []; - - for (const layoutCell of layoutData.cells) { - let cell = normalizeImportedCell(layoutCell); - if (cell.type === 'element') { - // set size to zero to always recompute it on the first render - const element = new Element({...cell, size: {width: 0, height: 0}}); - const template = preloadedElements[cell.id]; - if (!template) { - elementToRequestData.push(element); - } - element.template = template || placeholderTemplateFromIri(cell.id); - cellModels.push(element); - } else if (cell.type === 'link') { - const link = new Link(cell); - link.layoutOnly = markLinksAsLayoutOnly; - link.typeIndex = this.createLinkType(link.typeId).index; - cellModels.push(link); - } - } - - this.requestElementData(elementToRequestData); - this.trigger('state:renderStart'); - this.graph.resetCells(cellModels); - - for (const link of this.links) { - this.registerLink(link); - } - } - - private hideUnusedLinkTypes() { - const unusedLinkTypes = {...this.linkTypes}; - for (const link of this.links) { - delete unusedLinkTypes[link.typeId]; - } - for (const typeId in unusedLinkTypes) { - if (!unusedLinkTypes.hasOwnProperty(typeId)) { continue; } - const unusedLinkType = unusedLinkTypes[typeId]; - unusedLinkType.set('visible', false); - } - } - - createElement(idOrModel: string | ElementModel): Element { - const id = typeof idOrModel === 'string' ? idOrModel : idOrModel.id; - const existing = this.getElement(id); - if (existing) { return existing; } - - const model = typeof idOrModel === 'string' - ? placeholderTemplateFromIri(idOrModel) : idOrModel; - - const element = new Element({id: model.id}); - element.template = model; - - this.graph.addCell(element); - return element; - } - - requestElementData(elements: Element[]) { - if (elements.length == 0) return Promise.resolve([]); - return this.dataProvider.elementInfo({elementIds: elements.map(e => e.id)}) - .then(models => this.onElementInfoLoaded(models)) - .catch(err => { - console.error(err); - return Promise.reject(err); - }); - } - - requestLinksOfType(linkTypeIds?: string[]) { - let linkTypes = linkTypeIds; - if (!linkTypes) { - linkTypeIds = values(this.linkTypes).map(type => type.id); - } - return this.dataProvider.linksInfo({ - elementIds: this.graph.getElements().map(element => element.id), - linkTypeIds: linkTypeIds, - }).then(links => this.onLinkInfoLoaded(links)) - .catch(err => { - console.error(err); - return Promise.reject(err); - }); - } - - getPropertyById(labelId: string): RichProperty { - if (!this.propertyLabelById[labelId]) { - this.propertyLabelById[labelId] = new RichProperty({ - id: labelId, - label: {values: [{lang: '', text: uri2name(labelId)}]}, - }); - this.propertyLabelFetchingThread.startFetchingThread(labelId).then(propertyIds => { - if (!this.dataProvider.propertyInfo) { return; } - if (propertyIds.length === 0) { return; } - this.dataProvider.propertyInfo({propertyIds}).then(propertyModels => { - for (const propertyId in propertyModels) { - if (!Object.hasOwnProperty.call(propertyModels, propertyId)) { continue; } - const propertyModel = propertyModels[propertyId]; - if (!this.propertyLabelById[propertyModel.id]) { continue; } - this.propertyLabelById[propertyModel.id].set('label', propertyModel.label); - } - }); - }); - } - return this.propertyLabelById[labelId]; - } - - getClassesById(typeId: string): FatClassModel { - if (!this.classesById[typeId]) { - this.classesById[typeId] = new FatClassModel({ - id: typeId, - label: { values: [{lang: '', text: uri2name(typeId)}] }, - count: 0, - children: [], - }); - this.classFetchingThread.startFetchingThread(typeId).then(typeIds => { - if (typeIds.length > 0) { - this.dataProvider.classInfo({classIds: typeIds}).then(classes => { - for (const cl of classes) { - if (!this.classesById[cl.id]) { continue; } - this.classesById[cl.id].set('label', cl.label); - this.classesById[cl.id].set('count', cl.count); - } - }); - } - }); - } - return this.classesById[typeId]; - } - - createLinkType(linkTypeId: string): FatLinkType { - if (this.linkTypes.hasOwnProperty(linkTypeId)) { - return this.linkTypes[linkTypeId]; - } - - const defaultLabel = {values: [{text: uri2name(linkTypeId), lang: ''}]}; - const fatLinkType = new FatLinkType({ - id: linkTypeId, - index: this.nextLinkTypeIndex++, - label: defaultLabel, - diagram: this, - }); - - this.linkFetchingThread.startFetchingThread(linkTypeId).then(linkTypeIds => { - if (linkTypeIds.length > 0) { - this.dataProvider.linkTypesInfo({linkTypeIds}).then(linkTypesInfo => { - for (const lt of linkTypesInfo) { - if (!this.linkTypes[lt.id]) { continue; } - this.linkTypes[lt.id].label = lt.label; - } - }); - } - }); - - this.linkTypes[linkTypeId] = fatLinkType; - return fatLinkType; - } - - private onElementInfoLoaded(elements: Dictionary) { - for (const id of Object.keys(elements)) { - const element = this.getElement(id); - if (element) { - element.template = elements[id]; - element.trigger('state:loaded'); - } - } - } - - private onLinkInfoLoaded(links: LinkModel[]) { - this.initBatchCommand(); - for (const linkModel of links) { - this.createLink(linkModel); - } - this.storeBatchCommand(); - } - - createLink(linkModel: LinkModel & { - suggestedId?: string; - vertices?: Array<{ x: number; y: number; }>; - }, options?: IgnoreCommandHistory): Link | undefined { - const existingLink = this.getLink(linkModel); - if (existingLink) { - if (existingLink.layoutOnly) { - existingLink.set('layoutOnly', false, {ignoreCommandManager: true} as IgnoreCommandHistory); - } - return existingLink; - } - - const {linkTypeId, sourceId, targetId, suggestedId, vertices} = linkModel; - const suggestedIdAvailable = Boolean(suggestedId && !this.cells.get(suggestedId)); - - const link = new Link({ - id: suggestedIdAvailable ? suggestedId : `link_${generateRandomID()}`, - typeId: linkTypeId, - source: {id: sourceId}, - target: {id: targetId}, - vertices, - }); - - if (this.isSourceAndTargetVisible(link) && this.createLinkType(link.typeId).visible) { - this.registerLink(link); - this.graph.addCell(link, options); - return link; - } - return undefined; - } - - private registerLink(link: Link) { - const typeId = link.typeId; - if (!this.linksByType.hasOwnProperty(typeId)) { - this.linksByType[typeId] = []; - } - this.linksByType[typeId].push(link); - - if (link.typeIndex === undefined) { - link.typeIndex = this.createLinkType(typeId).index; - } - - this.sourceOf(link).links.push(link); - this.targetOf(link).links.push(link); - } - - getLink(linkModel: LinkModel): Link | undefined { - const source = this.getElement(linkModel.sourceId); - if (!source) { return undefined; } - const index = findLinkIndex(source.links, linkModel); - return index >= 0 && source.links[index]; - } - - private removeLinkReferences(linkModel: LinkModel) { - const source = this.getElement(linkModel.sourceId); - removeLinkFrom(source && source.links, linkModel); - - const target = this.getElement(linkModel.targetId); - removeLinkFrom(target && target.links, linkModel); - - const linksOfType = this.linksByType[linkModel.linkTypeId]; - removeLinkFrom(linksOfType, linkModel); - } -} - -export default DiagramModel; - -export interface ClassTreeElement { - id: string; - label: { values: LocalizedString[] }; - count: number; - children: ClassTreeElement[]; - a_attr?: { - href: string; - draggable: boolean; - }; -} - -export interface LinkTypeOptions { - id: string; - visible: boolean; - showLabel?: boolean; -} - -function placeholderTemplateFromIri(iri: string): ElementModel { - return { - id: iri, - types: [], - label: {values: [{lang: '', text: uri2name(iri)}]}, - properties: {}, - }; -} - -function removeLinkFrom(links: Link[], model: LinkModel) { - if (!links) { return; } - const index = findLinkIndex(links, model); - links.splice(index, 1); -} - -function findLinkIndex(haystack: Link[], needle: LinkModel) { - const {sourceId, targetId, linkTypeId} = needle; - for (let i = 0; i < haystack.length; i++) { - const link = haystack[i]; - if (link.sourceId === sourceId && - link.targetId === targetId && - link.typeId === linkTypeId - ) { - return i; - } - } - return -1; -} - -/** Generates random 16-digit hexadecimal string. */ -function generateRandomID() { - function randomHalfDigits() { - return Math.floor((1 + Math.random()) * 0x100000000) - .toString(16).substring(1); - } - // generate by half because of restricted numerical precision - return randomHalfDigits() + randomHalfDigits(); -} - -export function uri2name(uri: string): string { - const hashIndex = uri.lastIndexOf('#'); - if (hashIndex !== -1 && hashIndex !== uri.length - 1) { - return uri.substring(hashIndex + 1); - } - const lastPartStart = uri.lastIndexOf('/'); - if (lastPartStart !== -1 && lastPartStart !== uri.length - 1) { - return uri.substring(lastPartStart + 1); - } - return uri; -} - -export function chooseLocalizedText(texts: LocalizedString[], language: string): LocalizedString { - if (texts.length === 0) { return null; } - // undefined if default language string isn't present - let defaultLanguageValue: LocalizedString; - for (const text of texts) { - if (text.lang === language) { - return text; - } else if (text.lang === '') { - defaultLanguageValue = text; - } - } - return typeof defaultLanguageValue === 'undefined' ? texts[0] : defaultLanguageValue; -} diff --git a/DKBFrontEnd/src/src/ontodia/diagram/paperArea.tsx b/DKBFrontEnd/src/src/ontodia/diagram/paperArea.tsx deleted file mode 100644 index 6684b5364..000000000 --- a/DKBFrontEnd/src/src/ontodia/diagram/paperArea.tsx +++ /dev/null @@ -1,442 +0,0 @@ -import * as Backbone from 'backbone'; -import * as joint from 'jointjs'; -import * as React from 'react'; -import { render as reactDOMRender, unmountComponentAtNode } from 'react-dom'; -import { debounce } from 'lodash'; - -import { Spinner, Props as SpinnerProps } from '../viewUtils/spinner'; - -import { DiagramModel } from './model'; - -export interface Props { - model: DiagramModel; - paper: joint.dia.Paper; - preventTextSelection: () => void; - zoomOptions?: { - min?: number; - max?: number; - /** Used when zooming to fit to limit zoom of small diagrams */ - maxFit?: number; - fitPadding?: number; - }; - panningAlwaysActive?: boolean; - onDragDrop?: (e: DragEvent, paperPosition: { x: number; y: number; }) => void; -} - -export interface ZoomOptions { - pivot?: { x: number; y: number; }; -} - -export class PaperArea extends React.Component { - private readonly listener = new Backbone.Model(); - - private area: HTMLDivElement; - private paper: joint.dia.Paper; - - private spinnerElement: SVGGElement; - - private pageSize: { x: number; y: number; }; - - private padding = {x: 0, y: 0}; - private center: { x: number; y: number; }; - private previousOrigin: { x: number; y: number; }; - - private isPanning = false; - private panningOrigin: { pageX: number; pageY: number; }; - private panningScrollOrigin: { scrollLeft: number; scrollTop: number; }; - - render() { - return
this.area = area} - onMouseDown={this.onAreaPointerDown} - onWheel={this.onWheel}> -
; - } - - componentDidMount() { - this.paper = this.props.paper; - - this.pageSize = { - x: this.paper.options.width, - y: this.paper.options.height, - }; - (this.paper.svg as any as HTMLElement).style.overflow = 'visible'; - this.area.appendChild(this.paper.el); - this.updatePaperMargins(); - this.centerTo(); - - this.spinnerElement = document.createElementNS('http://www.w3.org/2000/svg', 'g'); - this.paper.svg.appendChild(this.spinnerElement); - - this.listener.listenTo(this.paper, 'scale', this.onPaperScale); - this.listener.listenTo(this.paper, 'resize', this.onPaperResize); - this.listener.listenTo(this.paper, 'translate', this.onPaperTranslate); - this.listener.listenTo(this.paper, 'blank:pointerdown', (e: MouseEvent) => { - if (this.shouldStartPanning(e)) { - e.preventDefault(); - this.startPanning(e); - } - }); - this.listener.listenTo(this.paper, 'render:done', () => { - this.adjustPaper(); - this.centerTo(); - }); - this.listener.listenTo(this.paper, 'cell:pointerdown', () => { - this.props.preventTextSelection(); - }); - // automatic paper adjust on element dragged - this.listener.listenTo(this.paper, 'cell:pointerup', this.adjustPaper); - this.listener.listenTo(this.paper.options.model, - 'add remove change:position', debounce(this.adjustPaper, 50)); - this.listener.listenTo(this.paper.options.model, 'change:size', this.adjustPaper); - this.listener.listenTo(this.paper, 'ontodia:adjustSize', this.adjustPaper); - - this.area.addEventListener('dragover', this.onDragOver); - this.area.addEventListener('drop', this.onDragDrop); - - const model = this.props.model; - this.listener.listenTo(model, 'state:beginLoad', () => this.showIndicator()); - this.listener.listenTo(model, 'state:endLoad', - (elementCount: number) => this.renderLoadingIndicator(elementCount)); - this.listener.listenTo(model, 'state:loadError', - (error: any) => this.renderLoadingIndicator(undefined, error)); - this.listener.listenTo(model, 'state:renderStart', () => { - unmountComponentAtNode(this.spinnerElement); - }); - this.listener.listenTo(model, 'state:dataLoaded', () => { - this.zoomToFit(); - }); - } - - shouldComponentUpdate() { - return false; - } - - componentWillUnmount() { - this.stopPanning(); - this.listener.stopListening(); - this.area.removeEventListener('dragover', this.onDragOver); - this.area.removeEventListener('drop', this.onDragDrop); - unmountComponentAtNode(this.spinnerElement); - } - - clientToPaperCoords(areaClientX: number, areaClientY: number) { - const ctm = this.paper.viewport.getCTM(); - let x = areaClientX + this.area.scrollLeft - this.padding.x - ctm.e; - x /= ctm.a; - let y = areaClientY + this.area.scrollTop - this.padding.y - ctm.f; - y /= ctm.d; - return {x, y}; - } - - /** Returns bounding box of paper content in paper coordinates. */ - getContentFittingBox() { - return joint.V(this.paper.viewport).bbox(true, this.paper.svg); - } - - /** Returns paper size in paper coordinates. */ - getPaperSize(): { width: number; height: number; } { - const scale = this.getScale(); - const {width, height} = this.paper.options; - return {width: width / scale, height: height / scale}; - } - - adjustPaper = () => { - this.center = this.clientToPaperCoords( - this.area.clientWidth / 2, this.area.clientHeight / 2); - - const scale = this.getScale(); - // bbox in paper coordinates - const bboxPaper = this.getContentFittingBox(); - // bbox in area client coordinates - const bboxArea = { - left: bboxPaper.x * scale, - right: (bboxPaper.x + bboxPaper.width) * scale, - top: bboxPaper.y * scale, - bottom: (bboxPaper.y + bboxPaper.height) * scale, - }; - - const gridWidth = this.pageSize.x * scale; - const gridHeight = this.pageSize.y * scale; - - // bbox in integer grid coordinates (open-closed intervals) - const bboxGrid = { - left: Math.floor(bboxArea.left / gridWidth), - right: Math.ceil(bboxArea.right / gridWidth), - top: Math.floor(bboxArea.top / gridHeight), - bottom: Math.ceil(bboxArea.bottom / gridHeight), - }; - - const oldOrigin = this.paper.options.origin; - const newOrigin = { - x: (-bboxGrid.left) * gridWidth, - y: (-bboxGrid.top) * gridHeight, - }; - if (newOrigin.x !== oldOrigin.x || newOrigin.y !== oldOrigin.y) { - this.paper.setOrigin(newOrigin.x, newOrigin.y); - } - - const oldWidth = this.paper.options.width; - const oldHeight = this.paper.options.height; - const newWidth = Math.max(bboxGrid.right - bboxGrid.left, 1) * gridWidth; - const newHeight = Math.max(bboxGrid.bottom - bboxGrid.top, 1) * gridHeight; - if (newWidth !== oldWidth || newHeight !== oldHeight) { - this.paper.setDimensions(newWidth, newHeight); - } - - this.updatePaperMargins(); - } - - private updatePaperMargins() { - const previousPadding = this.padding; - this.padding = { - x: Math.ceil(this.area.clientWidth * 0.75), - y: Math.ceil(this.area.clientHeight * 0.75), - }; - - const paddingUnchanged = - this.padding.x === previousPadding.x && - this.padding.y === previousPadding.y; - if (paddingUnchanged) { return; } - - const paperElement: HTMLElement = this.paper.el; - paperElement.style.marginLeft = `${this.padding.x}px`; - paperElement.style.marginRight = `${this.padding.x}px`; - paperElement.style.marginTop = `${this.padding.y}px`; - paperElement.style.marginBottom = `${this.padding.y}px`; - - if (previousPadding) { - this.area.scrollLeft += this.padding.x - previousPadding.x; - this.area.scrollTop += this.padding.y - previousPadding.y; - } - } - - private onPaperScale = (scaleX: number, scaleY: number, originX: number, originY: number) => { - this.adjustPaper(); - if (originX !== undefined || originY !== undefined) { - this.centerTo({x: originX, y: originY}); - } - }; - - private onPaperResize = () => { - if (this.center) { - this.centerTo(this.center); - } - }; - - private onPaperTranslate = (originX: number, originY: number) => { - if (this.previousOrigin) { - const {x, y} = this.previousOrigin; - const translatedX = originX - x; - const translatedY = originY - y; - // update visible area when paper change origin without resizing - // e.g. paper shinks from left side and grows from right - this.area.scrollLeft += translatedX; - this.area.scrollTop += translatedY; - } - this.previousOrigin = {x: originX, y: originY}; - } - - private shouldStartPanning(e: MouseEvent | React.MouseEvent) { - return e.ctrlKey || e.shiftKey || this.props.panningAlwaysActive; - } - - private onAreaPointerDown = (e: React.MouseEvent) => { - if (e.target === this.area) { - if (this.shouldStartPanning(e)) { - e.preventDefault(); - this.startPanning(e); - } - } - }; - - private startPanning(event: { pageX: number; pageY: number; }) { - this.props.preventTextSelection(); - - const {pageX, pageY} = event; - this.panningOrigin = {pageX, pageY}; - const {scrollLeft, scrollTop} = this.area; - this.panningScrollOrigin = {scrollLeft, scrollTop}; - - this.isPanning = true; - document.addEventListener('mousemove', this.onPointerMove); - document.addEventListener('mouseup', this.stopPanning); - } - - private onPointerMove = (e: MouseEvent) => { - if (this.isPanning) { - const offsetX = e.pageX - this.panningOrigin.pageX; - const offsetY = e.pageY - this.panningOrigin.pageY; - this.area.scrollLeft = this.panningScrollOrigin.scrollLeft - offsetX; - this.area.scrollTop = this.panningScrollOrigin.scrollTop - offsetY; - } - }; - - private stopPanning = () => { - if (this.isPanning) { - this.isPanning = false; - document.removeEventListener('mousemove', this.onPointerMove); - document.removeEventListener('mouseup', this.stopPanning); - } - }; - - private onWheel = (e: React.WheelEvent) => { - if (e.ctrlKey) { - e.preventDefault(); - const delta = Math.max(-1, Math.min(1, e.deltaY)); - const {offsetLeft, offsetTop} = this.area; - const pivot = this.clientToPaperCoords( - e.pageX - offsetLeft, - e.pageY - offsetTop); - this.zoomBy(-delta * 0.1, {pivot}); - } - }; - - centerTo(paperPosition?: { x: number; y: number; }) { - const ctm = this.paper.viewport.getCTM(); - let clientX: number; - let clientY: number; - - if (paperPosition) { - const scale = ctm.a; - clientX = paperPosition.x * scale; - clientY = paperPosition.y * scale; - } else { - const x1 = -ctm.e; - const y1 = -ctm.f; - const x2 = x1 + this.paper.options.width; - const y2 = y1 + this.paper.options.height; - clientX = (x1 + x2) / 2; - clientY = (y1 + y2) / 2; - } - - const {clientWidth, clientHeight} = this.area; - this.updatePaperMargins(); - this.area.scrollLeft = clientX - clientWidth / 2 + ctm.e + this.padding.x; - this.area.scrollTop = clientY - clientHeight / 2 + ctm.f + this.padding.y; - } - - centerContent() { - const {x, y, width, height} = this.paper.viewport.getBBox(); - const viewportCenter = { - x: x + width / 2, - y: y + height / 2, - }; - this.centerTo(viewportCenter); - } - - getScale() { - const ctm = this.paper.viewport.getCTM(); - // scale should be uniform (scaleX == scaleY) - // and no rotation present, so - // ctm.a == ctm.d and ctm.b == ctm.c == 0 - return ctm.a; - } - - setScale(value: number, options: ZoomOptions = {}) { - let scale = value; - - const {zoomOptions = {}} = this.props; - const {min, max} = zoomOptions; - if (min !== undefined) { scale = Math.max(scale, min); } - if (max !== undefined) { scale = Math.min(scale, max); } - - const center = this.clientToPaperCoords( - this.area.clientWidth / 2, this.area.clientHeight / 2); - let pivot: { x: number; y: number; }; - if (options.pivot) { - const {x, y} = options.pivot; - const previousScale = this.getScale(); - const scaledBy = scale / previousScale; - pivot = { - x: x - (x - center.x) / scaledBy, - y: y - (y - center.y) / scaledBy, - }; - } else { - pivot = center; - } - - this.paper.scale(scale, scale); - this.centerTo(pivot); - } - - zoomBy(value: number, options: ZoomOptions = {}) { - this.setScale(this.getScale() + value, options); - } - - zoomToFit() { - if (this.paper.options.model.get('cells').length === 0) { - this.centerTo(); - return; - } - - const {x: originX, y: originY} = this.paper.options.origin; - const fittingBBox = { - x: originX, - y: originY, - width: this.area.clientWidth, - height: this.area.clientHeight, - }; - const {zoomOptions = {}} = this.props; - this.paper.scaleContentToFit({ - fittingBBox, - padding: (this.props.zoomOptions || {}).fitPadding, - minScale: zoomOptions.min, - maxScale: zoomOptions.maxFit || zoomOptions.max, - }); - this.paper.setOrigin(originX, originY); - - this.adjustPaper(); - this.centerContent(); - } - - private onDragOver = (e: DragEvent) => { - // Necessary. Allows us to drop. - if (e.preventDefault) { e.preventDefault(); } - e.dataTransfer.dropEffect = 'move'; - return false; - }; - - private onDragDrop = (e: DragEvent) => { - if (this.props.onDragDrop) { - const {offsetLeft, offsetTop} = this.area; - const paperPosition = this.clientToPaperCoords( - e.pageX - offsetLeft, e.pageY - offsetTop); - this.props.onDragDrop(e, paperPosition); - } - }; - - private renderSpinner(props: SpinnerProps = {}) { - const paperRect = this.paper.svg.getBoundingClientRect(); - const x = props.statusText ? paperRect.width / 3 : paperRect.width / 2; - const position = {x, y: paperRect.height / 2}; - reactDOMRender(, this.spinnerElement); - } - - showIndicator(operation?: Promise) { - this.centerTo(); - this.renderSpinner(); - - if (operation) { - operation.then(() => { - unmountComponentAtNode(this.spinnerElement); - }).catch(error => { - console.error(error); - this.renderSpinner({statusText: 'Unknown error occured', errorOccured: true}); - }); - } - } - - private renderLoadingIndicator(elementCount: number | undefined, error?: any) { - const WARN_ELEMENT_COUNT = 70; - if (error) { - this.renderSpinner({statusText: error.statusText || error.message, errorOccured: true}); - } else if (elementCount > WARN_ELEMENT_COUNT) { - this.renderSpinner({statusText: - `The diagram contains more than ${WARN_ELEMENT_COUNT} ` + - `elements. Please wait until it is fully loaded.`}); - } else { - this.renderSpinner(); - } - }; -} diff --git a/DKBFrontEnd/src/src/ontodia/diagram/separatedElementView.ts b/DKBFrontEnd/src/src/ontodia/diagram/separatedElementView.ts deleted file mode 100644 index 907e684d5..000000000 --- a/DKBFrontEnd/src/src/ontodia/diagram/separatedElementView.ts +++ /dev/null @@ -1,44 +0,0 @@ -import * as joint from 'jointjs'; - -import { Element } from './elements'; -import { DiagramView } from './view'; - -const DEBUG_BOUNDS = false; - -export class SeparatedElementView extends joint.dia.ElementView { - model: Element; - - paper?: { diagramView?: DiagramView }; - private view: DiagramView; - - private rect: SVGRectElement; - - render() { - const result = super.render(); - if (!this.view && this.paper && this.paper.diagramView) { - this.setView(this.paper.diagramView); - } - - this.rect = (this.el as SVGElement).querySelector('.rootOfUI') as SVGRectElement; - this.rect.setAttribute('cursor', 'pointer'); - if (DEBUG_BOUNDS) { - this.rect.style.fill = 'green'; - this.rect.style.stroke = 'red'; - this.rect.style.strokeWidth = '3'; - } - - this.updateSize(); - return result; - } - - private setView(view: DiagramView) { - this.view = view; - this.listenTo(this.model, 'change:size', this.updateSize); - } - - private updateSize = () => { - const size = this.model.get('size') || {width: 0, height: 0}; - this.rect.setAttribute('width', size.width || 0); - this.rect.setAttribute('height', size.height || 0); - } -} diff --git a/DKBFrontEnd/src/src/ontodia/diagram/view.ts b/DKBFrontEnd/src/src/ontodia/diagram/view.ts deleted file mode 100644 index b2968579a..000000000 --- a/DKBFrontEnd/src/src/ontodia/diagram/view.ts +++ /dev/null @@ -1,535 +0,0 @@ -import { hcl } from 'd3-color'; -import * as Backbone from 'backbone'; -import * as joint from 'jointjs'; -import { merge, cloneDeep } from 'lodash'; -import { createElement } from 'react'; -import { render as reactDOMRender, unmountComponentAtNode } from 'react-dom'; - -import { - TypeStyleResolver, - LinkStyleResolver, - TemplateResolver, - CustomTypeStyle, - ElementTemplate, - LinkStyle, LinkMarkerStyle, -} from '../customization/props'; -import { DefaultTypeStyleBundle } from '../customization/defaultTypeStyles'; -import { DefaultLinkStyleBundle } from '../customization/defaultLinkStyles'; -import { DefaultTemplate } from '../customization/defaultTemplate'; -import { DefaultTemplateBundle } from '../customization/templates/defaultTemplates'; - -import { Halo } from '../viewUtils/halo'; -import { ConnectionsMenu } from '../viewUtils/connectionsMenu'; -import { - toSVG, ToSVGOptions, toDataURL, ToDataURLOptions, -} from '../viewUtils/toSvg'; - -import { Dictionary, ElementModel, LocalizedString } from '../data/model'; - -import { DiagramModel, chooseLocalizedText, uri2name } from './model'; -import { Element, FatClassModel, linkMarkerKey } from './elements'; - -import { LinkView } from './linkView'; -import { SeparatedElementView } from './separatedElementView'; -import { ElementLayer } from './elementLayer'; - -export interface DiagramViewOptions { - typeStyleResolvers?: TypeStyleResolver[]; - linkStyleResolvers?: LinkStyleResolver[]; - templatesResolvers?: TemplateResolver[]; - disableDefaultHalo?: boolean; -} - -export interface TypeStyle { - color: { h: number; c: number; l: number; }; - icon?: string; -} - -const DefaultToSVGOptions: ToSVGOptions = { - elementsToRemoveSelector: '.link-tools, .marker-vertices', - convertImagesToDataUris: true, -}; - -/** - * Properties: - * language: string - * - * Events: - * (private) dispose - fires on view dispose - */ -export class DiagramView extends Backbone.Model { - private typeStyleResolvers: TypeStyleResolver[]; - private linkStyleResolvers: LinkStyleResolver[]; - private templatesResolvers: TemplateResolver[]; - - paper: joint.dia.Paper; - halo: Halo; - connectionsMenu: ConnectionsMenu; - - readonly selection = new Backbone.Collection(); - - private colorSeed = 0x0BADBEEF; - - private linkMarkers: Dictionary<{ - start: SVGMarkerElement; - end: SVGMarkerElement; - }> = {}; - - constructor( - public readonly model: DiagramModel, - public readonly options: DiagramViewOptions = {} - ) { - super(); - this.setLanguage('en'); - this.paper = new joint.dia.Paper({ - model: this.model.graph, - gridSize: 1, - elementView: SeparatedElementView, - linkView: LinkView, - width: 1500, - height: 800, - async: true, - preventContextMenu: false, - guard: (evt, view) => { - // filter right mouse button clicks - if (evt.type === 'mousedown' && evt.button !== 0) { return true; } - return false; - }, - }); - (this.paper as any).diagramView = this; - - this.typeStyleResolvers = options.typeStyleResolvers - ? options.typeStyleResolvers : DefaultTypeStyleBundle; - - this.linkStyleResolvers = options.linkStyleResolvers - ? this.options.linkStyleResolvers : DefaultLinkStyleBundle; - - this.templatesResolvers = options.templatesResolvers - ? options.templatesResolvers : DefaultTemplateBundle; - - this.listenTo(this.paper, 'render:done', () => { - this.model.trigger('state:renderDone'); - }); - this.listenTo(model, 'state:dataLoaded', () => { - this.model.resetHistory(); - }); - } - - getLanguage(): string { return this.get('language'); } - setLanguage(value: string) { this.set('language', value); } - - cancelSelection() { this.selection.reset([]); } - - print() { - toSVG(this.paper, DefaultToSVGOptions).then(svg => { - const printWindow = window.open('', undefined, 'width=1280,height=720'); - printWindow.document.write(svg); - printWindow.print(); - }); - } - - exportSVG(): Promise { - return toSVG(this.paper, {...DefaultToSVGOptions, preserveDimensions: true}); - } - - exportPNG(options: ToDataURLOptions = {}): Promise { - return toDataURL(this.paper, { - ...options, - svgOptions: {...DefaultToSVGOptions, ...options.svgOptions}, - }); - } - - adjustPaper() { - this.paper.trigger('ontodia:adjustSize'); - } - - initializePaperComponents() { - this.configureElementLayer(); - if (!this.model.isViewOnly()) { - this.configureSelection(); - this.configureDefaultHalo(); - document.addEventListener('keyup', this.onKeyUp); - this.onDispose(() => document.removeEventListener('keyup', this.onKeyUp)); - } - } - - private configureElementLayer() { - const container = document.createElement('div'); - this.paper.el.appendChild(container); - reactDOMRender(createElement(ElementLayer, {paper: this.paper, view: this}), container); - this.onDispose(() => { - unmountComponentAtNode(container); - this.paper.el.removeChild(container); - }); - } - - private onKeyUp = (e: KeyboardEvent) => { - const DELETE_KEY_CODE = 46; - if (e.keyCode === DELETE_KEY_CODE && - document.activeElement.localName !== 'input' - ) { - this.removeSelectedElements(); - } - }; - - private removeSelectedElements() { - const elementsToRemove = this.selection.toArray(); - if (elementsToRemove.length === 0) { return; } - - this.cancelSelection(); - this.model.graph.trigger('batch:start'); - for (const element of elementsToRemove) { - element.remove(); - } - this.model.graph.trigger('batch:stop'); - }; - - private configureSelection() { - if (this.model.isViewOnly()) { return; } - - this.listenTo(this.paper, 'cell:pointerup', (cellView: joint.dia.CellView, evt: MouseEvent) => { - // We don't want a Halo for links. - if (cellView.model instanceof joint.dia.Link) { return; } - if (evt.ctrlKey || evt.shiftKey || evt.metaKey) { return; } - const element = cellView.model as Element; - this.selection.reset([element]); - element.focus(); - }); - - let pointerScreenCoords = {x: NaN, y: NaN}; - this.listenTo(this.paper, 'blank:pointerdown', (evt: MouseEvent) => { - pointerScreenCoords = {x: evt.screenX, y: evt.screenY}; - }); - - this.listenTo(this.paper, 'blank:pointerup', (evt: MouseEvent) => { - if (evt.screenX !== pointerScreenCoords.x || evt.screenY !== pointerScreenCoords.y) { return; } - this.selection.reset(); - this.hideNavigationMenu(); - if (document.activeElement) { - (document.activeElement as HTMLElement).blur(); - } - }); - } - - private configureDefaultHalo() { - if (this.options.disableDefaultHalo) { return; } - - const container = document.createElement('div'); - this.paper.el.appendChild(container); - - const renderDefaultHalo = (selectedElement?: Element) => { - let cellView: joint.dia.CellView = undefined; - if (selectedElement) { - cellView = this.paper.findViewByModel(selectedElement); - } - reactDOMRender(createElement(Halo, { - paper: this.paper, - diagramView: this, - cellView: cellView, - onDelete: () => this.removeSelectedElements(), - onExpand: () => { - cellView.model.set('isExpanded', !cellView.model.get('isExpanded')); - }, - navigationMenuOpened: Boolean(this.connectionsMenu), - onToggleNavigationMenu: () => { - if (this.connectionsMenu) { - this.hideNavigationMenu(); - } else { - this.showNavigationMenu(selectedElement); - } - renderDefaultHalo(selectedElement); - }, - onAddToFilter: () => selectedElement.addToFilter(), - }), container); - }; - - this.listenTo(this.selection, 'add remove reset', () => { - const selected = this.selection.length === 1 ? this.selection.first() : undefined; - if (this.connectionsMenu && selected !== this.connectionsMenu.cellView.model) { - this.hideNavigationMenu(); - } - renderDefaultHalo(selected); - }); - - renderDefaultHalo(); - this.onDispose(() => { - unmountComponentAtNode(container); - this.paper.el.removeChild(container); - }); - } - - showNavigationMenu(element: Element) { - const cellView = this.paper.findViewByModel(element); - this.connectionsMenu = new ConnectionsMenu({ - paper: this.paper, - view: this, - cellView, - onClose: () => { - this.connectionsMenu.remove(); - this.connectionsMenu = undefined; - }, - }); - } - - hideNavigationMenu() { - if (this.connectionsMenu) { - this.connectionsMenu.remove(); - this.connectionsMenu = undefined; - } - } - - onDragDrop(e: DragEvent, paperPosition: { x: number; y: number; }) { - e.preventDefault(); - let elementIds: string[]; - try { - elementIds = JSON.parse(e.dataTransfer.getData('application/x-ontodia-elements')); - } catch (ex) { - try { - elementIds = JSON.parse(e.dataTransfer.getData('text')); // IE fix - } catch (ex) { - const draggedUri = e.dataTransfer.getData('text/uri-list'); - // element dragged from the class tree has URI of the form: - // # - const uriFromTreePrefix = window.location.href.split('#')[0] + '#'; - const uri = draggedUri.indexOf(uriFromTreePrefix) === 0 - ? draggedUri.substring(uriFromTreePrefix.length) : draggedUri; - elementIds = [uri]; - } - } - if (!elementIds || elementIds.length === 0) { return; } - - this.model.initBatchCommand(); - - let elementsToSelect: Element[] = []; - - let totalXOffset = 0; - let {x, y} = paperPosition; - for (const elementId of elementIds) { - const center = elementIds.length === 1; - const element = this.createElementAt(elementId, {x: x + totalXOffset, y, center}); - totalXOffset += element.get('size').width + 20; - - elementsToSelect.push(element); - element.focus(); - } - - this.model.requestElementData(elementsToSelect); - this.model.requestLinksOfType(); - this.selection.reset(elementsToSelect); - - this.model.storeBatchCommand(); - } - - private createElementAt(elementId: string, position: { x: number; y: number; center?: boolean; }) { - const element = this.model.createElement(elementId); - - let {x, y} = position; - const size: { width: number; height: number; } = element.get('size'); - if (position.center) { - x -= size.width / 2; - y -= size.height / 2; - } - element.set('position', {x, y}); - - return element; - } - - public getLocalizedText(texts: LocalizedString[]): LocalizedString { - return chooseLocalizedText(texts, this.getLanguage()); - } - - public getElementTypeString(elementModel: ElementModel): string { - return elementModel.types.map((typeId: string) => { - const type = this.model.getClassesById(typeId); - return this.getElementTypeLabel(type).text; - }).sort().join(', '); - } - - public getElementTypeLabel(type: FatClassModel): LocalizedString { - const label = this.getLocalizedText(type.get('label').values); - return label ? label : { text: uri2name(type.id), lang: '' }; - } - - public getLinkLabel(linkTypeId: string): LocalizedString { - const type = this.model.getLinkType(linkTypeId); - const label = type ? this.getLocalizedText(type.get('label').values) : null; - return label ? label : { text: uri2name(linkTypeId), lang: '' }; - } - - public getTypeStyle(types: string[]): TypeStyle { - types.sort(); - - let customStyle: CustomTypeStyle; - for (const resolver of this.typeStyleResolvers) { - const result = resolver(types); - if (result) { - customStyle = result; - break; - } - } - - const icon = customStyle ? customStyle.icon : undefined; - let color: { h: number; c: number; l: number; }; - if (customStyle && customStyle.color) { - color = hcl(customStyle.color); - } else { - const hue = getHueFromClasses(types, this.colorSeed); - color = {h: hue, c: 40, l: 75}; - } - return {icon, color}; - } - - public registerElementStyleResolver(resolver: TypeStyleResolver): TypeStyleResolver { - this.typeStyleResolvers.unshift(resolver); - return resolver; - } - - public unregisterElementStyleResolver(resolver: TypeStyleResolver): TypeStyleResolver { - const index = this.typeStyleResolvers.indexOf(resolver); - if (index !== -1) { - return this.typeStyleResolvers.splice(index, 1)[0]; - } else { - return undefined; - } - } - - public getElementTemplate(types: string[]): ElementTemplate { - for (const resolver of this.templatesResolvers) { - const result = resolver(types); - if (result) { - return result; - } - } - return DefaultTemplate; - } - - public registerTemplateResolver(resolver: TemplateResolver): TemplateResolver { - this.templatesResolvers.unshift(resolver); - return resolver; - } - - public unregisterTemplateResolver(resolver: TemplateResolver): TemplateResolver { - const index = this.templatesResolvers.indexOf(resolver); - if (index !== -1) { - return this.templatesResolvers.splice(index, 1)[0]; - } else { - return undefined; - } - } - - getLinkStyle(linkTypeId: string): LinkStyle { - let style = getDefaultLinkStyle(); - for (const resolver of this.linkStyleResolvers) { - const result = resolver(linkTypeId); - if (result) { - merge(style, cloneDeep(result)); - break; - } - } - if (!this.linkMarkers[linkTypeId]) { - this.linkMarkers[linkTypeId] = { - start: this.createLinkMarker(linkTypeId, true, style.markerSource), - end: this.createLinkMarker(linkTypeId, false, style.markerTarget), - }; - } - return style; - } - - private createLinkMarker(linkTypeId: string, startMarker: boolean, style: LinkMarkerStyle) { - if (!style) { return undefined; } - - const SVG_NAMESPACE: 'http://www.w3.org/2000/svg' = 'http://www.w3.org/2000/svg'; - const defs = this.paper.svg.getElementsByTagNameNS(SVG_NAMESPACE, 'defs')[0]; - const marker = document.createElementNS(SVG_NAMESPACE, 'marker'); - const linkTypeIndex = this.model.getLinkType(linkTypeId).index; - marker.setAttribute('id', linkMarkerKey(linkTypeIndex, startMarker)); - marker.setAttribute('markerWidth', style.width.toString()); - marker.setAttribute('markerHeight', style.height.toString()); - marker.setAttribute('orient', 'auto'); - - let xOffset = startMarker ? 0 : (style.width - 1); - marker.setAttribute('refX', xOffset.toString()); - marker.setAttribute('refY', (style.height / 2).toString()); - marker.setAttribute('markerUnits', 'userSpaceOnUse'); - - const path = document.createElementNS(SVG_NAMESPACE, 'path'); - path.setAttribute('d', style.d); - if (style.fill !== undefined) { path.setAttribute('fill', style.fill); } - if (style.stroke !== undefined) { path.setAttribute('stroke', style.stroke); } - if (style.strokeWidth !== undefined) { path.setAttribute('stroke-width', style.strokeWidth); } - - marker.appendChild(path); - defs.appendChild(marker); - return marker; - } - - public registerLinkStyleResolver(resolver: LinkStyleResolver): LinkStyleResolver { - this.linkStyleResolvers.unshift(resolver); - return resolver; - } - - public unregisterLinkStyleResolver(resolver: LinkStyleResolver): LinkStyleResolver { - const index = this.linkStyleResolvers.indexOf(resolver); - if (index !== -1) { - return this.linkStyleResolvers.splice(index, 1)[0]; - } else { - return undefined; - } - } - - public getOptions(): DiagramViewOptions { - return this.options; - } - - private onDispose(handler: () => void) { - this.listenTo(this, 'dispose', handler); - } - - dispose() { - if (!this.paper) { return; } - this.trigger('dispose'); - this.stopListening(); - this.paper.remove(); - this.paper = undefined; - } -} - -function getHueFromClasses(classes: string[], seed?: number): number { - let hash = seed; - for (const name of classes) { - hash = hashFnv32a(name, hash); - } - const MAX_INT32 = 0x7fffffff; - return 360 * ((hash === undefined ? 0 : hash) / MAX_INT32); -} - -function getDefaultLinkStyle(): LinkStyle { - return { - markerTarget: {d: 'M0,0 L0,8 L9,4 z', width: 9, height: 8, fill: 'black'}, - }; -} - -/** - * Calculate a 32 bit FNV-1a hash - * Found here: https://gist.github.com/vaiorabbit/5657561 - * Ref.: http://isthe.com/chongo/tech/comp/fnv/ - * - * @param {string} str the input value - * @param {boolean} [asString=false] set to true to return the hash value as - * 8-digit hex string instead of an integer - * @param {integer} [seed] optionally pass the hash of the previous chunk - * @returns {integer | string} - */ -function hashFnv32a(str: string, seed = 0x811c9dc5): number { - /* tslint:disable:no-bitwise */ - let i: number, l: number, hval = seed & 0x7fffffff; - - for (i = 0, l = str.length; i < l; i++) { - hval ^= str.charCodeAt(i); - hval += (hval << 1) + (hval << 4) + (hval << 7) + (hval << 8) + (hval << 24); - } - return hval >>> 0; - /* tslint:enable:no-bitwise */ -} - -export default DiagramView; diff --git a/DKBFrontEnd/src/src/ontodia/tutorial/tutorial.ts b/DKBFrontEnd/src/src/ontodia/tutorial/tutorial.ts deleted file mode 100644 index d308eca31..000000000 --- a/DKBFrontEnd/src/src/ontodia/tutorial/tutorial.ts +++ /dev/null @@ -1,27 +0,0 @@ -import * as $ from 'jquery'; -import { introJs } from 'intro.js'; - -export interface TutorialProps { - 'data-position': string; - 'data-step': string; - 'data-intro-id': string; - 'data-intro': string; -} - -const helpAlreadySeenKey = 'helpPopupDisable'; - -export function showTutorial() { - introJs() - .setOption('showStepNumbers', false) - .onexit(() => { - localStorage.setItem(helpAlreadySeenKey, 'true'); - }).oncomplete(() => { - localStorage.setItem(helpAlreadySeenKey, 'true'); - }).start(); -} - -export function showTutorialIfNotSeen() { - if (!localStorage.getItem(helpAlreadySeenKey)) { - showTutorial(); - } -} diff --git a/DKBFrontEnd/src/src/ontodia/viewUtils/collectionView.ts b/DKBFrontEnd/src/src/ontodia/viewUtils/collectionView.ts deleted file mode 100644 index eb16c5011..000000000 --- a/DKBFrontEnd/src/src/ontodia/viewUtils/collectionView.ts +++ /dev/null @@ -1,74 +0,0 @@ -import * as Backbone from 'backbone'; -import * as _ from 'lodash'; -import * as $ from 'jquery'; - -export interface CollectionViewOptions extends Backbone.ViewOptions { - childView: any; /* typeof Backbone.View */ - childOptions: Backbone.ViewOptions; -} - -export class CollectionView extends Backbone.View { - private childView: any; /* typeof Backbone.View */ - private childOptions: Backbone.ViewOptions; - private childViews: Backbone.View[]; - private isRendered = false; - - constructor(options: CollectionViewOptions) { - super(options); - this.onAdd = this.onAdd.bind(this); - this.onRemove = this.onRemove.bind(this); - this.onReset = this.onReset.bind(this); - - if (!options.childView) { throw new Error('No child view constructor provided'); } - if (!options.childOptions) { throw new Error('No child view options provided'); } - - this.childView = options.childView; - this.childOptions = options.childOptions; - this.childViews = []; - - this.collection.each(this.onAdd); - this.collection.bind('add', this.onAdd); - this.collection.bind('remove', this.onRemove); - this.collection.bind('reset', this.onReset); - } - - private onAdd(model: TModel) { - const childView: Backbone.View = new this.childView( - _.extend({ model: model }, this.childOptions)); - - this.childViews.push(childView); - - if (this.isRendered) { - $(this.el).append(childView.render().el); - } - } - - private onRemove(model: TModel) { - const viewToRemove = _.filter(this.childViews, cv => cv.model === model)[0]; - if (viewToRemove) { - this.childViews = _.without(this.childViews, viewToRemove); - viewToRemove.remove(); - } - } - - private onReset() { - // 'reset' event on collection do not trigger - // 'add' and 'remove' events on models - removeAllViews(this.childViews); - this.collection.each(this.onAdd); - } - - public render(): CollectionView { - this.isRendered = true; - $(this.el).empty(); - _.each(this.childViews, cv => $(this.el).append(cv.render().el)); - return this; - } -} - -export default CollectionView; - -export function removeAllViews(views: Backbone.View[]) { - _.each(views, view => { view.remove(); }); - views.length = 0; -} diff --git a/DKBFrontEnd/src/src/ontodia/viewUtils/connectionsMenu.tsx b/DKBFrontEnd/src/src/ontodia/viewUtils/connectionsMenu.tsx deleted file mode 100644 index 379e33fbf..000000000 --- a/DKBFrontEnd/src/src/ontodia/viewUtils/connectionsMenu.tsx +++ /dev/null @@ -1,744 +0,0 @@ -import * as Backbone from 'backbone'; -import * as joint from 'jointjs'; -import * as React from 'react'; -import * as ReactDOM from 'react-dom'; - -import { FatLinkType, Element } from '../diagram/elements'; -import DiagramView from '../diagram/view'; -import { chooseLocalizedText } from '../diagram/model'; - -import { Dictionary, LocalizedString, ElementModel } from '../data/model'; - -type Label = { values: LocalizedString[] }; -export interface ReactElementModel { - model: ElementModel; - presentOnDiagram: boolean; -} - -const MENU_OFFSET = 40; -const ALL_RELATED_ELEMENTS_LINK: FatLinkType = new FatLinkType({ - id: 'allRelatedElements', - index: -1, - label: { values: [{lang: '', text: 'All'}] }, - diagram: null, -}); - -export interface ConnectionsMenuOptions { - paper: joint.dia.Paper; - view: DiagramView; - cellView: joint.dia.CellView; - onClose: () => void; -} - -export class ConnectionsMenu { - private container: HTMLElement; - private handler: Backbone.Model; - private view: DiagramView; - private state: 'loading' | 'error' | 'completed'; - - private links: FatLinkType[]; - private countMap: { [linkTypeId: string]: number }; - - private selectedLink: FatLinkType; - private objects: ReactElementModel[]; - - public cellView: joint.dia.CellView; - - constructor(private options: ConnectionsMenuOptions) { - this.container = document.createElement('div'); - this.options.paper.el.appendChild(this.container); - - this.cellView = this.options.cellView; - this.view = this.options.view; - - this.handler = new Backbone.Model(); - this.handler.listenTo(this.options.cellView.model, - 'change:isExpanded change:position change:size', this.render); - this.handler.listenTo(this.options.paper, 'scale', this.render); - this.handler.listenTo(this.view, 'change:language', this.render); - - this.loadLinks(); - this.render(); - } - - private subscribeOnLinksEevents(linksOfElement: FatLinkType[]) { - for (const link of linksOfElement) { - this.handler.listenTo(link, 'change:label', this.render); - this.handler.listenTo(link, 'change:visible', this.render); - this.handler.listenTo(link, 'change:showLabel', this.render); - }; - } - - private unsubscribeOnLinksEevents(linksOfElement: FatLinkType[]) { - for (const link of linksOfElement) { - this.handler.stopListening(link); - }; - } - - private loadLinks() { - this.state = 'loading'; - this.links = []; - this.countMap = {}; - this.view.model.dataProvider.linkTypesOf({elementId: this.cellView.model.id}) - .then(linkTypes => { - this.state = 'completed'; - - const countMap: Dictionary = {}; - const links: FatLinkType[] = []; - for (const linkCount of linkTypes) { - countMap[linkCount.id] = linkCount.count; - links.push(this.view.model.getLinkType(linkCount.id)); - } - - let totalCount = 0; - Object.keys(countMap).forEach(key => totalCount += countMap[key]); - countMap['allRelatedElements'] = totalCount; - - this.countMap = countMap; - - this.unsubscribeOnLinksEevents(this.links); - this.links = links; - this.subscribeOnLinksEevents(this.links); - - this.render(); - }) - .catch(err => { - console.error(err); - this.state = 'error'; - this.render(); - }); - } - - private loadObjects(link: FatLinkType) { - this.state = 'loading'; - this.selectedLink = link; - this.objects = []; - const requestsCount = Math.ceil(this.countMap[link.id] / 100); - - const requests: Promise>[] = []; - for (let i = 0; i < requestsCount; i++) { - requests.push( - this.view.model.dataProvider.linkElements({ - elementId: this.cellView.model.id, - linkId: (link === ALL_RELATED_ELEMENTS_LINK ? undefined : this.selectedLink.id), - limit: 100, - offset: i * 100 - }) - ); - } - - Promise.all(requests).then(results => { - this.state = 'completed'; - this.objects = []; - results.forEach(elements => { - Object.keys(elements).forEach(key => this.objects.push({ - model: elements[key], - presentOnDiagram: Boolean(this.view.model.getElement(key)), - })); - }); - this.render(); - }).catch(err => { - console.error(err); - this.state = 'error'; - this.render(); - }); - } - - private addSelectedElements = (selectedObjects: ReactElementModel[]) => { - const positionBoxSide = Math.round(Math.sqrt(selectedObjects.length)) + 1; - const GRID_STEP = 100; - let pos; - if (this.cellView.model instanceof joint.dia.Element) { - pos = this.cellView.model.position(); // the position() is more stable than getBBox - } else { - pos = this.cellView.getBBox(); - } - const startX = pos.x - positionBoxSide * GRID_STEP / 2; - const startY = pos.y - positionBoxSide * GRID_STEP / 2; - let xi = 0; - let yi = 0; - - const addedElements: Element[] = []; - selectedObjects.forEach(el => { - let element = this.view.model.getElement(el.model.id); - if (!element) { element = this.view.model.createElement(el.model); } - addedElements.push(element); - - if (xi > positionBoxSide) { - xi = 0; - yi++; - } - if (xi === Math.round(positionBoxSide / 2)) { - xi++; - } - if (yi === Math.round(positionBoxSide / 2)) { - yi++; - } - element.position(startX + (xi++) * GRID_STEP, startY + (yi) * GRID_STEP); - }); - - const hasChosenLinkType = this.selectedLink && this.selectedLink !== ALL_RELATED_ELEMENTS_LINK; - if (hasChosenLinkType && !this.selectedLink.visible) { - // prevent loading here because of .requestLinksOfType() call - this.selectedLink.setVisibility({visible: true, showLabel: true}, {preventLoading: true}); - } - - this.view.model.requestElementData(addedElements); - this.view.model.requestLinksOfType(); - - this.options.view.adjustPaper(); - this.options.onClose(); - }; - - private onExpandLink = (link: FatLinkType) => { - if (this.selectedLink !== link || !this.objects) { - this.loadObjects(link); - } - this.render(); - }; - - private onMoveToFilter = (link: FatLinkType) => { - if (link === ALL_RELATED_ELEMENTS_LINK) { - const element = this.cellView.model as Element; - element.addToFilter(); - // this.options.onClose(); - } else { - const selectedElement = this.view.model.getElement(this.cellView.model.id); - selectedElement.addToFilter(link); - // this.options.onClose(); - } - }; - - private render = () => { - const connectionsData = { - links: this.links || [], - countMap: this.countMap || {}, - }; - - let objectsData: { - selectedLink: FatLinkType; - objects: ReactElementModel[]; - } = null; - - if (this.selectedLink && this.objects) { - objectsData = { - selectedLink: this.selectedLink, - objects: this.objects, - }; - } - - ReactDOM.render(React.createElement(ConnectionsMenuMarkup, { - cellView: this.options.cellView, - connectionsData: connectionsData, - objectsData: objectsData, - state: this.state, - lang: this.view.getLanguage(), - onExpandLink: this.onExpandLink, - onPressAddSelected: this.addSelectedElements, - onMoveToFilter: this.onMoveToFilter, - }), this.container); - }; - - remove() { - this.handler.stopListening(); - ReactDOM.unmountComponentAtNode(this.container); - this.options.paper.el.removeChild(this.container); - } -} - -export interface ConnectionsMenuMarkupProps { - cellView: joint.dia.CellView; - - connectionsData: { - links: FatLinkType[]; - countMap: { [linkTypeId: string]: number }; - }; - - objectsData?: { - selectedLink?: FatLinkType; - objects: ReactElementModel[]; - }; - - lang: string; - state: 'loading' | 'error' | 'completed'; - - onExpandLink?: (link: FatLinkType) => void; - onPressAddSelected?: (selectedObjects: ReactElementModel[]) => void; - onMoveToFilter?: (link: FatLinkType) => void; -} - -export class ConnectionsMenuMarkup - extends React.Component { - - constructor (props: ConnectionsMenuMarkupProps) { - super(props); - this.state = { filterKey: '', panel: 'connections' }; - } - - private onChangeFilter = (e: React.FormEvent) => { - this.state.filterKey = e.currentTarget.value; - this.setState(this.state); - }; - - private getTitle = () => { - if (this.props.objectsData && this.state.panel === 'objects') { - return 'Objects'; - } else if (this.props.connectionsData && this.state.panel === 'connections') { - return 'Connections'; - } - return 'Error'; - }; - - private onExpandLink = (link: FatLinkType) => { - this.setState({ filterKey: '', panel: 'objects' }); - this.props.onExpandLink(link); - }; - - private onCollapseLink = () => { - this.setState({ filterKey: '', panel: 'connections' }); - }; - - private getBreadCrumbs = () => { - return (this.props.objectsData && this.state.panel === 'objects' ? - - Connections{'\u00A0' + '/' + '\u00A0'} - { - chooseLocalizedText( - this.props.objectsData.selectedLink.get('label').values, - this.props.lang - ).text.toLowerCase() - } - - : '' - ); - }; - - private getBody = () => { - if (this.props.state === 'error') { - return ; - } else if (this.props.objectsData && this.state.panel === 'objects') { - return ; - } else if (this.props.connectionsData && this.state.panel === 'connections') { - if (this.props.state === 'loading') { - return ; - } - return ; - } else { - return
; - } - }; - - render() { - const bBox = this.props.cellView.getBBox(); - const style = { - top: (bBox.y + bBox.height / 2 - 150), - left: (bBox.x + bBox.width + MENU_OFFSET), - backgroundColor: 'white', - border: '1px solid black', - }; - - return ( -
- - {this.getBreadCrumbs()} -
- -
-
-
-
-
- {this.getBody()} -
- ); - } -} - -export interface ConnectionsListProps { - data: { - links: FatLinkType[]; - countMap: { [linkTypeId: string]: number }; - }; - lang: string; - filterKey: string; - - onExpandLink?: (link: FatLinkType) => void; - onMoveToFilter?: (link: FatLinkType) => void; -} - -export class ConnectionsList extends React.Component { - - constructor (props: ConnectionsListProps) { - super(props); - } - - private compareLinks = (a: FatLinkType, b: FatLinkType) => { - const aLabel: Label = a.get('label'); - const bLabel: Label = b.get('label'); - const aText = (aLabel ? chooseLocalizedText(aLabel.values, this.props.lang).text.toLowerCase() : null); - const bText = (bLabel ? chooseLocalizedText(bLabel.values, this.props.lang).text.toLowerCase() : null); - - if (aText < bText) { - return -1; - } - - if (aText > bText) { - return 1; - } - - return 0; - }; - - private getLinks = () => { - return (this.props.data.links || []).filter(link => { - const label: Label = link.get('label'); - const text = (label ? chooseLocalizedText(label.values, this.props.lang).text.toLowerCase() : null); - return (!this.props.filterKey) || (text && text.indexOf(this.props.filterKey.toLowerCase()) !== -1); - }) - .sort(this.compareLinks); - }; - - private getViews = (links: FatLinkType[]) => { - const countMap = this.props.data.countMap || {}; - const views: React.ReactElement[] = []; - for (const link of links) { - views.push( - - ); - } - return views; - }; - - render() { - const links = this.getLinks(); - const views = this.getViews(links); - - let viewList: React.ReactElement | React.ReactElement[]; - if (views.length === 0) { - viewList = ; - } else { - viewList = views; - if (links.length > 1) { - const countMap = this.props.data.countMap || {}; - viewList = [ - , -
, - ].concat(viewList); - } - } - - return
    {viewList}
; - } -} - -export interface LinkInPopupMenuProps { - link: FatLinkType; - count: number; - lang?: string; - filterKey?: string; - onExpandLink?: (link: FatLinkType) => void; - onMoveToFilter?: (link: FatLinkType) => void; -} - -export class LinkInPopupMenu extends React.Component { - constructor(props: LinkInPopupMenuProps) { - super(props); - } - - private onExpandLink = () => { - this.props.onExpandLink(this.props.link); - }; - - private onMoveToFilter = (evt: React.MouseEvent) => { - evt.stopPropagation(); - this.props.onMoveToFilter(this.props.link); - }; - - render() { - const countIcon = (this.props.count > 0 ? - {this.props.count} : ''); - - const fullText = chooseLocalizedText(this.props.link.get('label').values, this.props.lang).text; - const textLine = getColoredText(fullText, this.props.filterKey); - - return ( -
  • -
    - {textLine} -
    - {countIcon} - -
    -
  • - ); - } -} - -export interface ObjectsPanelProps { - data: { - selectedLink?: FatLinkType; - objects: ReactElementModel[] - }; - loading?: boolean; - lang?: string; - filterKey?: string; - onPressAddSelected?: (selectedObjects: ReactElementModel[]) => void; -} - -export class ObjectsPanel extends React.Component { - - constructor(props: ObjectsPanelProps) { - super(props); - this.state = { checkMap: {}, selectAll: 'checked' }; - this.updateCheckMap(); - } - - private updateCheckMap = () => { - this.props.data.objects.forEach(element => { - if (this.state.checkMap[element.model.id] === undefined) { - this.state.checkMap[element.model.id] = true; - } - }); - }; - - private onCheckboxChanged = (object: ReactElementModel, value: boolean) => { - if (this.state.checkMap[object.model.id] === value) { - return; - } - this.state.checkMap[object.model.id] = value; - - const filtered = this.getFilteredObjects().map(o => o.model.id); - const keys = Object.keys(this.state.checkMap).filter(key => filtered.indexOf(key) !== -1); - - const unchekedListElementLength = keys.filter(key => !this.state.checkMap[key]).length; - if (!value && unchekedListElementLength === keys.length) { - this.state.selectAll = 'unchecked'; - } else if (unchekedListElementLength === 0) { - this.state.selectAll = 'checked'; - } else { - this.state.selectAll = 'undefined'; - } - this.setState(this.state); - }; - - private onSelectAll = () => { - let checked = !this.selectAllValue(); - if (checked) { - this.state.selectAll = 'checked'; - } else { - this.state.selectAll = 'unchecked'; - } - const filtered = this.getFilteredObjects().filter(o => !o.presentOnDiagram).map(o => o.model.id); - const keys = Object.keys(this.state.checkMap).filter(key => filtered.indexOf(key) !== -1); - keys.forEach(key => { - this.state.checkMap[key] = checked; - }); - this.setState(this.state); - }; - - private selectAllValue = () => { - if (this.state.selectAll === 'undefined' || this.state.selectAll === 'checked') { - return true; - } else { - return false; - } - }; - - private getFilteredObjects = (): ReactElementModel[] => { - return this.props.data.objects - .filter(element => { - const label: Label = element.model.label; - const text = (label ? chooseLocalizedText(label.values, this.props.lang).text.toLowerCase() : null); - return (!this.props.filterKey) || (text && text.indexOf(this.props.filterKey.toLowerCase()) !== -1); - }); - }; - - private getObjects = (list: ReactElementModel[]) => { - const keyMap: Dictionary = {}; - return list.filter(obj => { - if (keyMap[obj.model.id]) { - return false; - } else { - keyMap[obj.model.id] = true; - return true; - } - }).map(obj => { - return ; - }); - }; - - private addSelected = () => { - this.props.onPressAddSelected( - this.getFilteredObjects().filter(el => this.state.checkMap[el.model.id] && !el.presentOnDiagram) - ); - }; - - render() { - this.updateCheckMap(); - const objects = this.getFilteredObjects(); - const objectViews = this.getObjects(objects); - const activeObjCount = objects.filter(el => this.state.checkMap[el.model.id] && !el.presentOnDiagram).length; - const countString = activeObjCount.toString() + '\u00A0of\u00A0' + this.props.data.objects.length; - return
    -
    - {/*nothing*/}} - disabled={this.props.data.objects.length === 0}/> - Select All -
    - {( - this.props.loading ? - - :
    - {objectViews} -
    - )} -
    - - -
    -
    ; - } -} - -export interface ElementInPopupMenuProps { - element: ReactElementModel; - onCheckboxChanged?: (object: ReactElementModel, value: boolean) => void; - lang?: string; - checked?: boolean; - filterKey?: string; -} - -export class ElementInPopupMenu extends React.Component { - constructor(props: ElementInPopupMenuProps) { - super(props); - this.state = { checked: this.props.checked }; - } - - private onCheckboxChange = () => { - if (this.props.element.presentOnDiagram) { - return; - } - this.state.checked = !this.state.checked; - this.setState(this.state); - this.props.onCheckboxChanged(this.props.element, this.state.checked); - }; - - componentWillReceiveProps(props: ElementInPopupMenuProps) { - this.setState({ checked: props.checked }); - } - - render() { - const fullText = chooseLocalizedText(this.props.element.model.label.values, this.props.lang).text; - const textLine = getColoredText(fullText, this.props.filterKey); - return ( -
  • - {/*nothing*/}} - className='element-in-popup-menu__checkbox' - disabled={this.props.element.presentOnDiagram}/> -
    - {textLine} -
    -
  • - ); - } -} - -function getColoredText(fullText: string, filterKey: string) { - if (filterKey) { - filterKey = filterKey.toLowerCase(); - const leftIndex = fullText.toLowerCase().indexOf(filterKey); - const rightIndex = leftIndex + filterKey.length; - let firstPart = ''; - let selectedPart = ''; - let lastPart = ''; - - if (leftIndex === 0) { - selectedPart = fullText.substring(0, rightIndex); - } else { - firstPart = fullText.substring(0, leftIndex); - selectedPart = fullText.substring(leftIndex, rightIndex); - } - if (rightIndex <= fullText.length) { - lastPart = fullText.substring(rightIndex, fullText.length); - } - return - {firstPart}{selectedPart}{lastPart} - ; - } else { - return {fullText}; - } -} diff --git a/DKBFrontEnd/src/src/ontodia/viewUtils/detectBrowser.ts b/DKBFrontEnd/src/src/ontodia/viewUtils/detectBrowser.ts deleted file mode 100644 index 860b935af..000000000 --- a/DKBFrontEnd/src/src/ontodia/viewUtils/detectBrowser.ts +++ /dev/null @@ -1,4 +0,0 @@ - -export function isIE11() { - return !((window as any).ActiveXObject) && 'ActiveXObject' in window; -} diff --git a/DKBFrontEnd/src/src/ontodia/viewUtils/halo.tsx b/DKBFrontEnd/src/src/ontodia/viewUtils/halo.tsx deleted file mode 100644 index a2b33348e..000000000 --- a/DKBFrontEnd/src/src/ontodia/viewUtils/halo.tsx +++ /dev/null @@ -1,85 +0,0 @@ -import * as Backbone from 'backbone'; -import * as joint from 'jointjs'; -import * as React from 'react'; - -import { DiagramView } from '../diagram/view'; - -export interface Props { - paper: joint.dia.Paper; - cellView: joint.dia.CellView; - diagramView: DiagramView; - onDelete?: () => void; - onExpand?: () => void; - navigationMenuOpened?: boolean; - onToggleNavigationMenu?: () => void; - onAddToFilter?: () => void; -} - -const CLASS_NAME = 'ontodia-halo'; - -export class Halo extends React.Component { - private handler = new Backbone.Model(); - - componentWillMount() { - this.handler.listenTo(this.props.paper, 'translate resize scale', () => this.forceUpdate()); - this.listenToCell(this.props.cellView); - } - - componentWillReceiveProps(nextProps: Props) { - if (nextProps.cellView !== this.props.cellView) { - if (this.props.cellView) { this.handler.stopListening(this.props.cellView.model); } - this.listenToCell(nextProps.cellView); - } - } - - listenToCell(cellView: joint.dia.CellView) { - if (cellView) { - this.handler.listenTo(cellView.model, - 'change:isExpanded change:position change:size', () => this.forceUpdate()); - } - } - - componentWillUnmount() { - this.props.diagramView.hideNavigationMenu(); - this.handler.stopListening(); - } - - render() { - if (!this.props.cellView) { - return
    ; - } - - const {cellView, navigationMenuOpened} = this.props; - const cellExpanded = cellView.model.get('isExpanded'); - - const bbox = this.props.cellView.getBBox(); - const style = { - top: bbox.y, - left: bbox.x, - height: bbox.height, - width: bbox.width, - }; - - return ( -
    -
    - -
    - -
    - -
    -
    - ); - } -} diff --git a/DKBFrontEnd/src/src/ontodia/viewUtils/layout.ts b/DKBFrontEnd/src/src/ontodia/viewUtils/layout.ts deleted file mode 100644 index f64984f3d..000000000 --- a/DKBFrontEnd/src/src/ontodia/viewUtils/layout.ts +++ /dev/null @@ -1,148 +0,0 @@ -import * as cola from 'webcola'; - -export interface LayoutNode { - id?: string; - x: number; - y: number; - width: number; - height: number; - bounds?: any; - innerBounds?: any; -} - -export interface LayoutLink { - source: LayoutNode; - target: LayoutNode; -} - -export function forceLayout(params: { - nodes: LayoutNode[]; - links: LayoutLink[]; - preferredLinkLength: number; -}) { - const layout = new cola.Layout() - .nodes(params.nodes) - .links(params.links) - .convergenceThreshold(1e-9) - .jaccardLinkLengths(params.preferredLinkLength) - .handleDisconnected(true); - layout.start(30, 0, 10, undefined, false); -} - -export function removeOverlaps(nodes: LayoutNode[]) { - const nodeRectangles: cola.vpsc.Rectangle[] = []; - for (const node of nodes) { - nodeRectangles.push(new cola.vpsc.Rectangle( - node.x, node.x + node.width, - node.y, node.y + node.height)); - } - - cola.vpsc.removeOverlaps(nodeRectangles); - - for (let i = 0; i < nodeRectangles.length; i++) { - const node = nodes[i]; - const rectangle = nodeRectangles[i]; - node.x = rectangle.x; - node.y = rectangle.y; - } -} - -export function translateToPositiveQuadrant(params: { - nodes: LayoutNode[]; - padding?: { x: number; y: number; }; -}) { - let minX = Infinity, minY = Infinity; - for (const node of params.nodes) { - minX = Math.min(minX, node.x); - minY = Math.min(minY, node.y); - } - - const {padding = {x: 0, y: 0}} = params; - for (const node of params.nodes) { - node.x = node.x - minX + padding.x; - node.y = node.y - minY + padding.y; - } -} - -export function translateToCenter(params: { - nodes: LayoutNode[]; - paperSize: { width: number; height: number; }; - contentBBox: { x: number, y: number, width: number; height: number; }; -}) { - const {paperSize, contentBBox} = params; - const graphPos = { - x: (paperSize.width - contentBBox.width) / 2 - contentBBox.x, - y: (paperSize.height - contentBBox.height) / 2 - contentBBox.y, - }; - - for (const node of params.nodes) { - node.x = graphPos.x + node.x; - node.y = graphPos.y + node.y; - } -} - -export function uniformGrid(params: { - rows: number; - cellSize: { x: number; y: number; }; -}): (cellIndex: number) => LayoutNode { - return cellIndex => { - const row = Math.floor(cellIndex / params.rows); - const column = cellIndex - row * params.rows; - return { - x: column * params.cellSize.x, - y: row * params.cellSize.y, - width: params.cellSize.x, - height: params.cellSize.y, - }; - }; -} - -export function padded( - nodes: LayoutNode[], - padding: { x: number; y: number; } | undefined, - transform: () => void, -) { - if (padding) { - for (const node of nodes) { - node.x -= padding.x; - node.y -= padding.y; - node.width += 2 * padding.x; - node.height += 2 * padding.y; - } - } - - transform(); - - if (padding) { - for (const node of nodes) { - node.x += padding.x; - node.y += padding.y; - node.width -= 2 * padding.x; - node.height -= 2 * padding.y; - } - } -} - -export function flowLayout(params: { - nodes: LayoutNode[]; - links: Link[]; - preferredLinkLength: number; - route: (link: Link, path: any[]) => void -}) { - const layout = new cola.Layout() - .nodes(params.nodes) - .links(params.links) - .avoidOverlaps(true) - .flowLayout('x', params.preferredLinkLength) - .jaccardLinkLengths(params.preferredLinkLength); - layout.start(30, 0, 10, undefined, false); - - for (const node of params.nodes) { - node.innerBounds = node.bounds.inflate(-50); - } - - layout.prepareEdgeRouting(50 / 3); - for (const link of params.links) { - params.route(link, layout.routeEdge(link, undefined)); - } -} diff --git a/DKBFrontEnd/src/src/ontodia/viewUtils/spinner.tsx b/DKBFrontEnd/src/src/ontodia/viewUtils/spinner.tsx deleted file mode 100644 index fd470047d..000000000 --- a/DKBFrontEnd/src/src/ontodia/viewUtils/spinner.tsx +++ /dev/null @@ -1,31 +0,0 @@ -import * as React from 'react'; - -export interface Props { - size?: number; - position?: { x: number; y: number; }; - maxWidth?: number; - statusText?: string; - errorOccured?: boolean; -} - -const CLASS_NAME = 'ontodia-spinner'; - -export class Spinner extends React.Component { - render() { - let {position = {x: 0, y: 0}, size = 50, statusText, errorOccured} = this.props; - - const textLeftMargin = 5; - const pathGeometry = 'm3.47,-19.7 a20,20 0 1,1 -6.95,0 m0,0 l-6,5 m6,-5 l-8,-0' + - (errorOccured ? 'M-8,-8L8,8M-8,8L8,-8' : ''); - - return - - - - {statusText} - ; - } -} diff --git a/DKBFrontEnd/src/src/ontodia/viewUtils/toSvg.ts b/DKBFrontEnd/src/src/ontodia/viewUtils/toSvg.ts deleted file mode 100644 index e2088a903..000000000 --- a/DKBFrontEnd/src/src/ontodia/viewUtils/toSvg.ts +++ /dev/null @@ -1,346 +0,0 @@ -import * as _ from 'lodash'; -import * as joint from 'jointjs'; - -import { isIE11 } from './detectBrowser'; - -export interface ToSVGOptions { - preserveDimensions?: boolean; - convertImagesToDataUris?: boolean; - blacklistedCssAttributes?: string[]; - elementsToRemoveSelector?: string; -} - -type Bounds = { width: number; height: number; }; - -/** - * Padding (in px) for elements of exported SVG to - * mitigate issues with elements body overflow caused by missing styles - * in exported image. - */ -const ForeignObjectSizePadding = 2; - -export function toSVG(paper: joint.dia.Paper, opt: ToSVGOptions = {}): Promise { - if (isIE11()) { - return Promise.reject(new Error( - 'Export to SVG is not supported in the Internet Explorer')); - } - - const viewportTransform = paper.viewport.getAttribute('transform'); - paper.viewport.setAttribute('transform', ''); - - const bbox = paper.getContentBBox(); - const {svgClone, imageBounds} = clonePaperSvg(paper, ForeignObjectSizePadding); - - paper.viewport.setAttribute('transform', viewportTransform || ''); - - svgClone.removeAttribute('style'); - if (opt.preserveDimensions) { - svgClone.setAttribute('width', bbox.width.toString()); - svgClone.setAttribute('height', bbox.height.toString()); - } else { - svgClone.setAttribute('width', '100%'); - svgClone.setAttribute('height', '100%'); - } - svgClone.setAttribute('viewBox', `${bbox.x} ${bbox.y} ${bbox.width} ${bbox.height}`); - - const nodes = svgClone.querySelectorAll('img'); - const convertImagesStartingAt = (index: number, done: () => void) => { - if (index >= nodes.length) { - done(); - return; - } - const img = nodes[index]; - const {width, height} = imageBounds[nodeRelativePath(svgClone, img)]; - img.setAttribute('width', width.toString()); - img.setAttribute('height', height.toString()); - if (opt.convertImagesToDataUris) { - joint.util.imageToDataUri(img.src, (err, dataUri) => { - // check for empty svg data URI which happens when mockJointXHR catches an exception - if (dataUri && dataUri !== 'data:image/svg+xml,') { img.src = dataUri; } - convertImagesStartingAt(index + 1, done); - }); - } else { - convertImagesStartingAt(index + 1, done); - } - }; - - return new Promise(resolve => { - const mock = mockJointXHR(); - convertImagesStartingAt(0, () => { - mock.dispose(); - resolve(); - }); - }).then(() => { - // workaround to include only ontodia-related stylesheets - const cssTexts = extractCSSFromDocument(text => text.indexOf('.ontodia') >= 0); - - const defs = document.createElementNS('http://www.w3.org/2000/svg', 'defs'); - defs.innerHTML = ``; - svgClone.insertBefore(defs, svgClone.firstChild); - - if (opt.elementsToRemoveSelector) { - foreachNode(svgClone.querySelectorAll(opt.elementsToRemoveSelector), - node => node.remove()); - } - - return new XMLSerializer().serializeToString(svgClone); - }); -} - -function extractCSSFromDocument(shouldInclude: (cssText: string) => boolean): string[] { - const cssTexts: string[] = []; - for (let i = 0; i < document.styleSheets.length; i++) { - let rules: CSSRuleList; - try { - const cssSheet = document.styleSheets[i] as CSSStyleSheet; - rules = cssSheet.cssRules || cssSheet.rules; - if (!rules) { continue; } - } catch (e) { continue; } - - const ruleTexts: string[] = []; - let allowToInclude = false; - - for (let j = 0; j < rules.length; j++) { - const rule = rules[j]; - if (rule instanceof CSSStyleRule) { - const text = rule.cssText; - ruleTexts.push(rule.cssText); - if (shouldInclude(text)) { - allowToInclude = true; - } - } - } - - if (allowToInclude) { - cssTexts.push(ruleTexts.join('\n')); - } - } - return cssTexts; -} - -function clonePaperSvg(paper: joint.dia.Paper, elementSizePadding: number): { - svgClone: SVGElement; - imageBounds: { [path: string]: Bounds }; -} { - const svgClone = paper.svg.cloneNode(true) as SVGElement; - const imageBounds: { [path: string]: Bounds } = {}; - - const cells: Backbone.Collection = paper.model.get('cells'); - foreachNode(svgClone.querySelectorAll('g.element'), separatedView => { - const modelId = separatedView.getAttribute('model-id'); - const overlayedView = (paper.el as HTMLElement).querySelector( - `.ontodia-overlayed-element[model-id='${modelId}']`); - if (!overlayedView) { return; } - - const newRoot = document.createElementNS('http://www.w3.org/2000/svg', 'foreignObject'); - const model = cells.get(modelId); - const modelSize = model.get('size'); - newRoot.setAttribute('width', modelSize.width + elementSizePadding); - newRoot.setAttribute('height', modelSize.height + elementSizePadding); - const overlayedViewContent = overlayedView.firstChild as HTMLElement; - newRoot.appendChild(overlayedViewContent.cloneNode(true)); - - separatedView.setAttribute('class', - `${separatedView.getAttribute('class')} ontodia-exported-element`); - const oldRoot = separatedView.querySelector('.rootOfUI'); - const rootParent = oldRoot.parentElement; - rootParent.removeChild(oldRoot); - rootParent.appendChild(newRoot); - - foreachNode(overlayedViewContent.querySelectorAll('img'), img => { - const rootPath = nodeRelativePath(svgClone, rootParent); - const imgPath = nodeRelativePath(overlayedViewContent, img); - // combine path "from SVG to root" and "from root to image" - // with additional separator to consider newly added nodes - imageBounds[rootPath + ':0:0:' + imgPath] = { - width: img.clientWidth, - height: img.clientHeight, - }; - }); - }); - - return {svgClone, imageBounds}; -} - -/** - * Mock XMLHttpRequest for joint.util.imageToDataUri as workaround to uncatchable - * DOMException in synchronous xhr.send() call when Joint trying to load SVG image. - * - * @param onSyncSendError callback called on error - */ -function mockJointXHR(onSyncSendError?: (e: any) => void): { dispose: () => void } { - try { - const oldXHR = XMLHttpRequest; - XMLHttpRequest = class { - xhr = new oldXHR(); - responseText = ''; - open(...args: any[]) { this.xhr.open.apply(this.xhr, args); } - send(...args: any[]) { - try { - this.xhr.send.apply(this.xhr, args); - } catch (e) { - if (onSyncSendError) { onSyncSendError(e); } - } - } - } as any; - let disposed = false; - const dispose = () => { - if (disposed) { return; } - disposed = true; - XMLHttpRequest = oldXHR; - }; - return {dispose}; - } catch (e) { - // do nothing if failed to mock XHR - return {dispose: () => { /* nothing */ }}; - } -} - -function foreachNode(nodeList: NodeListOf, callback: (node: T) => void) { - for (let i = 0; i < nodeList.length; i++) { - callback(nodeList[i]); - } -} - -/** - * Returns colon-separeted path from `parent` to `child` where each part - * corresponds to child index at each tree level. - * - * @example - *
    - * - *
      - *
    • - *
    • - *
    - *
    - * - * nodeRelativePath(root, target) === '1:0' - */ -function nodeRelativePath(parent: Node, child: Node) { - const path: number[] = []; - let current = child; - while (current && current !== parent) { - let sibling = current; - let indexAtLevel = 0; - while (sibling = sibling.previousSibling) { - indexAtLevel++; - } - path.unshift(indexAtLevel); - current = current.parentNode; - } - return path.join(':'); -} - -export interface ToDataURLOptions { - /** 'image/png' | 'image/jpeg' | ... */ - type?: string; - width?: number; - height?: number; - padding?: number; - backgroundColor?: string; - quality?: number; - svgOptions?: ToSVGOptions; -} - -export function toDataURL(paper: joint.dia.Paper, options?: ToDataURLOptions): Promise { - return new Promise((resolve, reject) => { - options = options || {}; - options.type = options.type || 'image/png'; - - let imageRect: Bounds; - let contentHeight: number; - let contentWidth: number; - let padding = options.padding || 0; - - const clientRect = paper.viewport.getBoundingClientRect(); - imageRect = fitRectKeepingAspectRatio( - clientRect.width || 1, clientRect.height || 1, - options.width, options.height); - - padding = Math.min(padding, imageRect.width / 2 - 1, imageRect.height / 2 - 1); - contentWidth = imageRect.width - 2 * padding; - contentHeight = imageRect.height - 2 * padding; - - const img = new Image(); - img.onload = function () { - let dataURL: string; - let context: CanvasRenderingContext2D; - let canvas: HTMLCanvasElement; - - function createCanvas() { - canvas = document.createElement('canvas'); - canvas.width = imageRect.width; - canvas.height = imageRect.height; - context = canvas.getContext('2d'); - context.fillStyle = options.backgroundColor || 'white'; - context.fillRect(0, 0, imageRect.width, imageRect.height); - } - - createCanvas(); - try { - context.drawImage(img, padding, padding, contentWidth, contentHeight); - dataURL = canvas.toDataURL(options.type, options.quality); - resolve(dataURL); - } catch (e) { - reject(e); - return; - } - }; - const svgOptions = _.clone(options.svgOptions || {convertImagesToDataUris: true}); - svgOptions.convertImagesToDataUris = true; - toSVG(paper, svgOptions).then(svgString => { - svgString = svgString - .replace('width="100%"', 'width="' + contentWidth + '"') - .replace('height="100%"', 'height="' + contentHeight + '"'); - img.src = 'data:image/svg+xml,' + encodeURIComponent(svgString); - }); - }); -} - -export function fitRectKeepingAspectRatio( - sourceWidth: number, sourceHeight: number, - targetWidth: number, targetHeight: number, -): { width: number; height: number; } { - if (!targetWidth && !targetHeight) { - return {width: sourceWidth, height: sourceHeight}; - } - const sourceAspectRatio = sourceWidth / sourceHeight; - targetWidth = targetWidth || targetHeight * sourceAspectRatio; - targetHeight = targetHeight || targetWidth / sourceAspectRatio; - if (targetHeight * sourceAspectRatio <= targetWidth) { - return {width: targetHeight * sourceAspectRatio, height: targetHeight}; - } else { - return {width: targetWidth, height: targetWidth / sourceAspectRatio}; - } -} - -/** - * Creates and returns a blob from a data URL (either base64 encoded or not). - * - * @param {string} dataURL The data URL to convert. - * @return {Blob} A blob representing the array buffer data. - */ -export function dataURLToBlob(dataURL: string): Blob { - const BASE64_MARKER = ';base64,'; - if (dataURL.indexOf(BASE64_MARKER) === -1) { - const parts = dataURL.split(','); - const contentType = parts[0].split(':')[1]; - const raw = decodeURIComponent(parts[1]); - - return new Blob([raw], {type: contentType}); - } - - const parts = dataURL.split(BASE64_MARKER); - const contentType = parts[0].split(':')[1]; - const raw = window.atob(parts[1]); - const rawLength = raw.length; - - const uInt8Array = new Uint8Array(rawLength); - - for (let i = 0; i < rawLength; ++i) { - uInt8Array[i] = raw.charCodeAt(i); - } - - return new Blob([uInt8Array], {type: contentType}); -} diff --git a/DKBFrontEnd/src/src/ontodia/widgets/classTree.ts b/DKBFrontEnd/src/src/ontodia/widgets/classTree.ts deleted file mode 100644 index 4da397e1d..000000000 --- a/DKBFrontEnd/src/src/ontodia/widgets/classTree.ts +++ /dev/null @@ -1,152 +0,0 @@ -import * as Backbone from 'backbone'; -import * as _ from 'lodash'; -import * as $ from 'jquery'; - -import { Dictionary } from '../data/model'; - -import { ClassTreeElement } from '../diagram/model'; -import DiagramView from '../diagram/view'; - -// bundling jstree to solve issues with multiple jquery packages, -// when jstree sets itself as plugin to wrong version of jquery -const jstreeJQuery = require('exports?require("jquery")!jstree'); -require('jstree/dist/themes/default/style.css'); - -interface TreeClassModel extends ClassTreeElement { - text?: string; - type?: string; -} - -export interface ClassTreeOptions extends Backbone.ViewOptions { - view: DiagramView; -} - -const CLASS_NAME = 'ontodia-class-tree'; - -/** - * Events: - * action:classSelected(classId: string) - */ -export class ClassTree extends Backbone.View { - private filter: JQuery = null; - private tree: JQuery = null; - private rest: JQuery = null; - private view: DiagramView; - - constructor(options: ClassTreeOptions) { - super(_.extend({className: CLASS_NAME}, options)); - let selfLink = this; - this.$el.addClass(_.result(this, 'className') as string); - this.view = options.view; - this.model.set('language', this.view.getLanguage(), {silent: true}); - this.listenTo(this.view, 'change:language', this.onLanguageChanged); - - this.rest = $(`
    `); - this.tree = $(`
    `).appendTo(this.rest); - - // Input for search in classTree - this.filter = $(`
    `); - - let innerDiv = $(`
    `).appendTo(this.filter); - let searchInput = - $('') - .appendTo(innerDiv); - - this.listenTo(this.view.model, 'state:dataLoaded', () => { - let model = this.view.model; - let tree = model.classTree; - const iconMap = this.updateClassLabels(tree); - this.setUrls(tree); - this.getJSTree().jstree({ - 'plugins': ['types', 'sort', 'search'], - 'core': {'data': tree}, - 'types': iconMap, - 'sort': (firstClassId: string, secondClassId: string) => { - return (model.getClassesById(firstClassId).model as TreeClassModel).text.localeCompare( - (model.getClassesById(secondClassId).model as TreeClassModel).text); - }, - 'search': { - 'case_insensitive': true, - 'show_only_matches': true, - }, - }); - - this.getJSTree().on('select_node.jstree', (e, data) => { - this.trigger('action:classSelected', data.selected[0]); - }); - - searchInput.keyup(function (this: HTMLInputElement) { - let searchString = $(this).val(); - selfLink.getJSTree().jstree('search', searchString); - }); - }); - } - - private updateClassLabels(roots: ClassTreeElement[]): Dictionary<{icon: string}> { - const iconMap: Dictionary<{ icon: string }> = { - 'default': {icon: 'default-tree-icon'}, - 'has-not-children': {icon: 'default-tree-icon'}, - 'has-children': {icon: 'parent-tree-icon'}, - }; - - if (roots) { - for (let i = 0; i < roots.length; i++) { - let element = roots[i] as TreeClassModel; - const icon = this.view.getTypeStyle([element.id]).icon; - let iconId: string; - if (icon) { - iconId = _.uniqueId('iconId'); - iconMap[iconId] = {icon: icon + ' ontodia-tree-icon'}; - } - - if ('children' in element) { - const innerMap = this.updateClassLabels(element.children); - Object.keys(innerMap).forEach(key => { - iconMap[key] = innerMap[key]; - }); - - if (element.children.length !== 0) { - element.type = (iconId ? iconId : 'has-children'); - } else { - element.type = (iconId ? iconId : 'has-not-children'); - } - } else { - element.type = (iconId ? iconId : 'has-not-children'); - } - - element.text = this.view.getLocalizedText(element.label.values).text + (!isNaN(element.count) ? ' (' + element.count + ')' : ''); - } - } - - return iconMap; - } - - private getJSTree() { - return jstreeJQuery(this.tree.get(0)); - } - - private onLanguageChanged() { - // this.updateClassLabels(this.view.model.classTree); - let jsTree = this.getJSTree().jstree(true); - (jsTree as any).settings.core.data = this.view.model.classTree; - jsTree.refresh(/* do not show loading indicator */ true, undefined); - } - - private setUrls(tree: ClassTreeElement[]) { - tree.forEach(el => { - this.setUrlsRec(el); - }); - } - private setUrlsRec(root: ClassTreeElement) { - root.a_attr = { href: '#' + root.id, draggable: true }; - root.children.forEach(el => this.setUrlsRec(el)); - } - - render(): ClassTree { - this.filter.appendTo(this.$el); - this.rest.appendTo(this.$el); - return this; - } -} - -export default ClassTree; diff --git a/DKBFrontEnd/src/src/ontodia/widgets/instancesSearch.tsx b/DKBFrontEnd/src/src/ontodia/widgets/instancesSearch.tsx deleted file mode 100644 index 9926453cf..000000000 --- a/DKBFrontEnd/src/src/ontodia/widgets/instancesSearch.tsx +++ /dev/null @@ -1,297 +0,0 @@ -import * as React from 'react'; -import * as Backbone from 'backbone'; - -import { Dictionary, ElementModel, LocalizedString } from '../data/model'; -import { FilterParams } from '../data/provider'; - -import { uri2name } from '../diagram/model'; -import { DiagramView } from '../diagram/view'; - -import { ListElementView } from './listElementView'; - -export interface InstancesSearchProps { - className?: string; - view: DiagramView; - criteria: SearchCriteria; - onCriteriaChanged: (criteria: SearchCriteria) => void; -} - -export interface SearchCriteria { - readonly text?: string; - readonly elementTypeId?: string; - readonly refElementId?: string; - readonly refElementLinkId?: string; -} - -export interface State { - readonly inputText?: string; - readonly quering?: boolean; - readonly resultId?: number; - readonly error?: any; - readonly items?: ReadonlyArray; - readonly moreItemsAvailable?: boolean; - readonly selectedItems?: Readonly>; -} - -const CLASS_NAME = 'ontodia-instances-search'; - -export class InstancesSearch extends React.Component { - private readonly listener = new Backbone.Model(); - - private currentRequest: FilterParams; - - constructor(props: InstancesSearchProps) { - super(props); - this.state = { - selectedItems: {}, - resultId: 0, - }; - } - - render() { - const ENTER_KEY_CODE = 13; - - const className = `${CLASS_NAME} stateBasedProgress ${this.props.className || ''}`; - const progressState = - this.state.quering ? 'querying' : - this.state.error ? 'error' : - this.state.items ? 'finished' : undefined; - - const searchTerm = this.state.inputText === undefined - ? this.props.criteria.text : this.state.inputText; - - return
    -
    -
    -
    -
    -
    - {this.renderCriteria()} -
    - this.setState({inputText: e.currentTarget.value})} - onKeyUp={e => { - if (e.keyCode === ENTER_KEY_CODE) { - this.submitCriteriaUpdate(); - } - }} /> - - - -
    -
    - {/* specify resultId as key to reset scroll position when loaded new search results */} -
    - {this.renderSearchResults()} -
    - -
    -
    -
    ; - } - - private renderCriteria(): React.ReactElement { - const {criteria = {}, view} = this.props; - const criterions: React.ReactElement[] = []; - - if (criteria.elementTypeId) { - const classInfo = view.model.getClassesById(criteria.elementTypeId); - const classLabel = view.getLocalizedText(classInfo.label.values).text; - criterions.push(
    - {this.renderRemoveCriterionButtons(() => this.props.onCriteriaChanged( - {...this.props.criteria, elementTypeId: undefined}))} - Has type {classLabel} -
    ); - } else if (criteria.refElementId) { - const element = view.model.getElement(criteria.refElementId); - const template = element && element.template; - const elementLabel = formatLabel( - view, criteria.refElementId, template && template.label); - - const linkType = criteria.refElementLinkId && view.model.getLinkType(criteria.refElementLinkId); - const linkTypeLabel = linkType && formatLabel(view, linkType.id, linkType.label); - - criterions.push(
    - {this.renderRemoveCriterionButtons(() => this.props.onCriteriaChanged( - {...this.props.criteria, refElementId: undefined, refElementLinkId: undefined}))} - Connected to {elementLabel} - {criteria.refElementLinkId ? [ - ' through ', - {linkTypeLabel}, - ] : []} -
    ); - } - - return
    {criterions}
    ; - } - - private renderRemoveCriterionButtons(onClick: () => void) { - return
    - -
    ; - } - - private renderSearchResults(): React.ReactElement { - const items = this.state.items || []; - return
      - {items.map((model, index) => this.setState({ - selectedItems: { - ...this.state.selectedItems, - [model.id]: !this.state.selectedItems[model.id], - }, - })} - onDragStart={e => { - const elementIds = Object.keys({...this.state.selectedItems, [model.id]: true}); - try { - e.dataTransfer.setData('application/x-ontodia-elements', JSON.stringify(elementIds)); - } catch (ex) { // IE fix - e.dataTransfer.setData('text', JSON.stringify(elementIds)); - } - return false; - }} />, - )} -
    ; - } - - private submitCriteriaUpdate() { - let text = this.state.inputText === undefined ? this.props.criteria.text : this.state.inputText; - text = text === '' ? undefined : text; - this.props.onCriteriaChanged({...this.props.criteria, text}); - } - - componentDidMount() { - this.listener.listenTo(this.props.view, 'change:language', () => this.forceUpdate()); - this.listener.listenTo(this.props.view.model.cells, 'add remove reset', () => { - const selectedItems: Dictionary = {...this.state.selectedItems}; - for (const id of Object.keys(selectedItems)) { - if (selectedItems[id] && this.props.view.model.getElement(id)) { - delete selectedItems[id]; - } - } - this.setState({selectedItems}); - }); - this.queryItems(false); - } - - componentWillReceiveProps(nextProps: InstancesSearchProps) { - const languageChanged = this.currentRequest - ? this.currentRequest.languageCode !== nextProps.view.getLanguage() : false; - - if (this.props.criteria !== nextProps.criteria || languageChanged) { - this.setState({inputText: undefined}, () => this.queryItems(false)); - } - } - - componentWillUnmount() { - this.listener.stopListening(); - this.currentRequest = undefined; - } - - private queryItems(loadMoreItems: boolean) { - let request: FilterParams; - if (loadMoreItems) { - if (!this.currentRequest) { - throw new Error('Cannot request more items without initial request.'); - } - const {offset, limit} = this.currentRequest; - request = {...this.currentRequest, offset: offset + limit}; - } else { - request = createRequest(this.props.criteria, this.props.view.getLanguage()); - } - - if (!(request.text || request.elementTypeId || request.refElementId || request.refElementLinkId)) { - this.setState({ - quering: false, - error: undefined, - items: undefined, - moreItemsAvailable: false, - selectedItems: {}, - }); - return; - } - - this.currentRequest = request; - this.setState({ - quering: true, - error: undefined, - moreItemsAvailable: false, - }); - - this.props.view.model.dataProvider.filter(request).then(elements => { - if (this.currentRequest !== request) { return; } - this.processFilterData(elements); - }).catch(error => { - if (this.currentRequest !== request) { return; } - console.error(error); - this.setState({error}); - }); - } - - private processFilterData(elements: Dictionary) { - const selectedItems: Dictionary = {...this.state.selectedItems}; - - const newItems: ElementModel[] = []; - for (const elementId in elements) { - if (!elements.hasOwnProperty(elementId)) { continue; } - - let element = elements[elementId]; - newItems.push(element); - - delete selectedItems[element.id]; - } - - const requestedAdditionalItems = this.currentRequest.offset > 0; - const items = requestedAdditionalItems - ? this.state.items.concat(newItems) : newItems; - - let resultId = this.state.resultId; - if (!requestedAdditionalItems) { resultId += 1; } - - this.setState({ - quering: false, - resultId, - items, - error: undefined, - moreItemsAvailable: newItems.length >= this.currentRequest.limit, - selectedItems, - }); - } -} - -function createRequest(criteria: SearchCriteria, language: string): FilterParams { - return { - text: criteria.text, - elementTypeId: criteria.elementTypeId, - refElementId: criteria.refElementId, - refElementLinkId: criteria.refElementLinkId, - offset: 0, - limit: 100, - languageCode: language ? language : 'en', - }; -} - -function formatLabel(view: DiagramView, uri: string, label?: { values: LocalizedString[] }) { - return label ? view.getLocalizedText(label.values).text : uri2name(uri); -} diff --git a/DKBFrontEnd/src/src/ontodia/widgets/linksToolbox.tsx b/DKBFrontEnd/src/src/ontodia/widgets/linksToolbox.tsx deleted file mode 100644 index b20e84759..000000000 --- a/DKBFrontEnd/src/src/ontodia/widgets/linksToolbox.tsx +++ /dev/null @@ -1,384 +0,0 @@ -import * as _ from 'lodash'; -import * as React from 'react'; -import * as ReactDOM from 'react-dom'; -import * as Backbone from 'backbone'; - -import LinkTypesToolboxModel from './linksToolboxModel'; -import { Element, FatLinkType } from '../diagram/elements'; -import DiagramView from '../diagram/view'; -import { chooseLocalizedText } from '../diagram/model'; - -export { LinkTypesToolboxModel }; -export interface LinkInToolBoxProps { - link: FatLinkType; - count: number; - language?: string; - onPressFilter?: (type: FatLinkType) => void; - filterKey?: string; -} - -import { LocalizedString } from '../data/model'; -type Label = { values: LocalizedString[] }; - -type LinkTypeVisibility = 'invisible' | 'withoutLabels' | 'allVisible'; - -/** - * Events: - * filter-click(link: FatLinkType) - when filter button clicked - */ -export class LinkInToolBox extends React.Component { - constructor(props: LinkInToolBoxProps) { - super(props); - } - - private onPressFilter = () => { - if (this.props.onPressFilter) { - this.props.onPressFilter(this.props.link); - } - }; - - private changeState = (state: LinkTypeVisibility) => { - if (state === 'invisible') { - this.props.link.setVisibility({visible: false, showLabel: false}); - } else if (state === 'withoutLabels') { - this.props.link.setVisibility({visible: true, showLabel: false}); - } else if (state === 'allVisible') { - this.props.link.setVisibility({visible: true, showLabel: true}); - } - }; - - private isChecked = (stateName: LinkTypeVisibility): boolean => { - let curState: LinkTypeVisibility; - if (!this.props.link.get('visible')) { - curState = 'invisible'; - } else if (!this.props.link.get('showLabel')) { - curState = 'withoutLabels'; - } else { - curState = 'allVisible'; - } - return stateName === curState; - }; - - private getText = () => { - const label: Label = this.props.link.get('label'); - const fullText = chooseLocalizedText(label.values, this.props.language).text.toLowerCase(); - if (this.props.filterKey) { - const filterKey = this.props.filterKey.toLowerCase(); - const leftIndex = fullText.toLowerCase().indexOf(filterKey); - const rightIndex = leftIndex + filterKey.length; - let firstPart = ''; - let selectedPart = ''; - let lastPart = ''; - - if (leftIndex === 0) { - selectedPart = fullText.substring(0, rightIndex); - } else { - firstPart = fullText.substring(0, leftIndex); - selectedPart = fullText.substring(leftIndex, rightIndex); - } - if (rightIndex <= fullText.length) { - lastPart = fullText.substring(rightIndex, fullText.length); - } - return - {firstPart}{selectedPart}{lastPart} - ; - } else { - return {fullText}; - } - } - - render() { - const newIcon = (this.props.link.get('isNew') ? new : ''); - const countIcon = (this.props.count > 0 ? {this.props.count} : ''); - const badgeContainer = (newIcon || countIcon ?
    {newIcon}{countIcon}
    : ''); - - return ( -
  • - - - - - -
    {this.getText()}
    - {badgeContainer} - -
  • - ); - } -} - -export interface LinkTypesToolboxProps extends Backbone.ViewOptions { - links: FatLinkType[]; - countMap?: { [linkTypeId: string]: number }; - label?: { values: LocalizedString[] }; - language?: string; - dataState?: string; - filterCallback?: (type: FatLinkType) => void; -} - -export class LinkTypesToolbox extends React.Component { - constructor(props: LinkTypesToolboxProps) { - super(props); - this.state = {filterKey: ''}; - } - - private compareLinks = (a: FatLinkType, b: FatLinkType) => { - const aLabel: Label = a.get('label'); - const bLabel: Label = b.get('label'); - const aText = (aLabel ? chooseLocalizedText(aLabel.values, this.props.language).text.toLowerCase() : null); - const bText = (bLabel ? chooseLocalizedText(bLabel.values, this.props.language).text.toLowerCase() : null); - - if (aText < bText) { - return -1; - } - - if (aText > bText) { - return 1; - } - - return 0; - } - - private onChangeInput = (e: React.SyntheticEvent) => { - this.setState({filterKey: e.currentTarget.value}); - } - - private onDropFilter = () => { - this.setState({filterKey: ''}); - } - - private changeState = (state: LinkTypeVisibility, links: FatLinkType[]) => { - if (state === 'invisible') { - for (const link of links) { - link.setVisibility({visible: false, showLabel: false}); - } - } else if (state === 'withoutLabels') { - for (const link of links) { - link.setVisibility({visible: true, showLabel: false}); - } - } else if (state === 'allVisible') { - for (const link of links) { - link.setVisibility({visible: true, showLabel: true}); - } - } - }; - - private getLinks = () => { - return (this.props.links || []).filter(link => { - const label: Label = link.get('label'); - const text = (label ? chooseLocalizedText(label.values, this.props.language).text.toLowerCase() : null); - return (!this.state.filterKey) || (text && text.indexOf(this.state.filterKey.toLowerCase()) !== -1); - }) - .sort(this.compareLinks); - } - - private getViews = (links: FatLinkType[]) => { - const countMap = this.props.countMap || {}; - const views: React.ReactElement[] = []; - for (const link of links) { - views.push( - - ); - } - return views; - } - - render() { - const className = 'link-types-toolbox'; - - const dataState = this.props.dataState || null; - const links = this.getLinks(); - const views = this.getViews(links); - - let connectedTo: React.ReactElement = null; - if (this.props.label) { - const selectedElementLabel = chooseLocalizedText( - this.props.label.values, this.props.language).text.toLowerCase(); - connectedTo = ( -

    - Connected to{'\u00A0'} - {selectedElementLabel} -

    - ); - } - - let dropButton: React.ReactElement = null; - if (this.state.filterKey) { - dropButton = ; - } - - return ( -
    -
    -
    - - {dropButton} -
    -
    -
    - - - -
    -  Switch all -
    -
    -
    -
    -
    -
    -
    - {connectedTo} -
    -
      {views}
    -
    -
    -
    - ); - } -} - -export interface LinkTypesToolboxShellProps extends Backbone.ViewOptions { - view: DiagramView; -} - -export class LinkTypesToolboxShell extends Backbone.View { - private view: DiagramView; - private dataState: string; - private filterCallback: (type: FatLinkType) => void; - private linksOfElement: FatLinkType[] = []; - private countMap: { [linkTypeId: string]: number }; - - constructor(public props: LinkTypesToolboxShellProps) { - super(_.extend({ tagName: 'div' }, props)); - - this.view = props.view; - - this.listenTo(this.view, 'change:language', this.render); - this.listenTo(this.view.model, 'state:dataLoaded', this.render); - this.listenTo(this.view, 'change:language', this.updateLinks); - - this.listenTo(this.view.selection, 'add remove reset', _.debounce(() => { - const single = this.view.selection.length === 1 - ? this.view.selection.first() : null; - if (single !== this.model.get('selectedElement')) { - this.model.set('selectedElement', single); - } - this.updateLinks(); - }, 50)); - - this.listenTo(this.model, 'state:beginQuery', () => { this.setDataState('querying'); }); - this.listenTo(this.model, 'state:queryError', () => this.setDataState('error')); - this.listenTo(this.model, 'state:endQuery', () => { - this.setDataState(this.model.connectionsOfSelectedElement ? 'finished' : null); - this.updateLinks(); - }); - - this.filterCallback = (linkType: FatLinkType) => { - let selectedElement: Element = this.model.get('selectedElement'); - selectedElement.addToFilter(linkType); - }; - } - - private setDataState(dataState: string) { - this.dataState = dataState; - this.render(); - } - - private updateLinks() { - this.unsubscribeOnLinksEevents(); - - if (this.model.connectionsOfSelectedElement) { - this.countMap = this.model.connectionsOfSelectedElement; - const linkTypeIds = _.keys(this.model.connectionsOfSelectedElement); - this.linksOfElement = linkTypeIds.map(id => { - return this.view.model.createLinkType(id); - }); - this.subscribeOnLinksEevents(this.linksOfElement); - } else { - this.linksOfElement = null; - this.countMap = {}; - } - this.render(); - } - - private subscribeOnLinksEevents(linksOfElement: FatLinkType[]) { - for (const link of linksOfElement) { - this.listenTo(link, 'change:label', this.render); - this.listenTo(link, 'change:visible', this.render); - this.listenTo(link, 'change:showLabel', this.render); - }; - } - - private unsubscribeOnLinksEevents() { - if (!this.linksOfElement) { return; } - for (const link of this.linksOfElement) { - this.stopListening(link); - } - } - - public getReactComponent() { - let selectedElement: Element = this.model.get('selectedElement'); - - return (); - } - - render(): LinkTypesToolboxShell { - ReactDOM.render(this.getReactComponent(), this.el); - return this; - } - - remove() { - this.unsubscribeOnLinksEevents(); - return this; - } -} - -export default LinkTypesToolboxShell; diff --git a/DKBFrontEnd/src/src/ontodia/widgets/linksToolboxModel.ts b/DKBFrontEnd/src/src/ontodia/widgets/linksToolboxModel.ts deleted file mode 100644 index eb94fabb5..000000000 --- a/DKBFrontEnd/src/src/ontodia/widgets/linksToolboxModel.ts +++ /dev/null @@ -1,52 +0,0 @@ -import * as Backbone from 'backbone'; - -import { Element } from '../diagram/elements'; -import DiagramModel from '../diagram/model'; - -/** - * Model of 'connections' component. - * - * Properties: - * selectedElement: Element - * - * Events: - * state:beginQuery - * state:endQuery - * state:queryError - */ -export class LinkTypesToolboxModel extends Backbone.Model { - connectionsOfSelectedElement: { [linkTypeId: string]: number }; - - private currentRequest: { elementId: string; }; - - constructor(public diagram: DiagramModel) { - super(); - this.listenTo(this, 'change:selectedElement', this.onSelectedElementChanged); - } - - private onSelectedElementChanged(self: LinkTypesToolboxModel, element: Element) { - this.trigger('state:beginQuery'); - if (element) { - const request = {elementId: element.id}; - this.currentRequest = request; - this.diagram.dataProvider.linkTypesOf(request).then(linkTypes => { - if (this.currentRequest !== request) { return; } - this.connectionsOfSelectedElement = {}; - for (const linkType of linkTypes) { - this.connectionsOfSelectedElement[linkType.id] = linkType.count; - } - this.trigger('state:endQuery'); - }).catch(error => { - if (this.currentRequest !== request) { return; } - console.error(error); - this.trigger('state:queryError'); - }); - } else { - this.currentRequest = null; - this.connectionsOfSelectedElement = null; - this.trigger('state:endQuery'); - } - } -} - -export default LinkTypesToolboxModel; diff --git a/DKBFrontEnd/src/src/ontodia/widgets/listElementView.tsx b/DKBFrontEnd/src/src/ontodia/widgets/listElementView.tsx deleted file mode 100644 index 049de7a62..000000000 --- a/DKBFrontEnd/src/src/ontodia/widgets/listElementView.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import * as React from 'react'; -import { hcl } from 'd3-color'; - -import { ElementModel } from '../data/model'; -import { DiagramView } from '../diagram/view'; - -export interface ListElementViewProps extends React.HTMLProps { - view: DiagramView; - model: Readonly; - disabled?: boolean; - selected?: boolean; -} - -const CLASS_NAME = 'ontodia-list-element-view'; - -export class ListElementView extends React.Component { - render() { - const {view, model, selected, disabled, ...otherProps} = this.props; - - const {h, c, l} = view.getTypeStyle(model.types).color; - const frontColor = (selected && !disabled) ? hcl(h, c, l * 1.2) : hcl('white'); - - const disabledClass = disabled ? `${CLASS_NAME}--disabled` : ''; - const className = `${CLASS_NAME} ${disabledClass} ${otherProps.className || ''}`; - - return
  • -
    - {view.getLocalizedText(model.label.values).text} -
    -
  • ; - } -} diff --git a/DKBFrontEnd/src/src/ontodia/widgets/toolbar.tsx b/DKBFrontEnd/src/src/ontodia/widgets/toolbar.tsx deleted file mode 100644 index ccb84c3e4..000000000 --- a/DKBFrontEnd/src/src/ontodia/widgets/toolbar.tsx +++ /dev/null @@ -1,159 +0,0 @@ -import * as React from 'react'; - -export interface Props { - onSaveDiagram?: () => void; - onSaveToSelf?: () => void; - onEditAtMainSite?: () => void; - onResetDiagram?: () => void; - onForceLayout: () => void; - onZoomIn: () => void; - onZoomOut: () => void; - onZoomToFit: () => void; - onUndo: () => void; - onRedo: () => void; - onExportSVG: (link: HTMLAnchorElement) => void; - onExportPNG: (link: HTMLAnchorElement) => void; - onPrint: () => void; - onShare?: () => void; - onChangeLanguage: (language: string) => void; - onShowTutorial: () => void; - isEmbeddedMode?: boolean; - isDiagramSaved?: boolean; -} - -export interface State { - showModal: boolean; -} - -const CLASS_NAME = 'ontodia-toolbar'; - -export class EditorToolbar extends React.Component { - private downloadImageLink: HTMLAnchorElement; - - constructor(props: Props) { - super(props); - this.state = {showModal: false}; - } - - private onChangeLanguage = (event: React.SyntheticEvent) => { - const value = event.currentTarget.value; - this.props.onChangeLanguage(value); - }; - - private onExportSVG = () => { - this.props.onExportSVG(this.downloadImageLink); - }; - - private onExportPNG = () => { - this.props.onExportPNG(this.downloadImageLink); - }; - - render() { - const intro = '

    Toolbox

    ' + - '

    You can use additional tools for working with your diagram, such as choosing between automatic ' + - 'layouts or fit diagram to screen, etc.

    ' + - '

    Don’t forget to save diagrams, it always comes handy after all.

    '; - - let btnSaveDiagram = ( - - ); - - let btnEditAtMainSite = ( - - ); - - let btnShare = ( - - ); - - let btnHelp = ( - - ); - - const nonEmbedded = !this.props.isEmbeddedMode; - return ( -
    -
    - {nonEmbedded - ? (this.props.onSaveDiagram ? btnSaveDiagram : undefined) - : (this.props.onEditAtMainSite ? btnEditAtMainSite : undefined)} - {this.props.onSaveToSelf ? ( - - ) : undefined} - {(this.props.isDiagramSaved && this.props.onResetDiagram) ? ( - - ) : undefined} - - - - - {(nonEmbedded && this.props.onUndo) ? ( - - ) : undefined} - {(nonEmbedded && this.props.onRedo) ? ( - - ) : undefined} - - - - {(nonEmbedded && this.props.onShare) ? btnShare : undefined} - - {nonEmbedded ? : undefined} - - - {nonEmbedded ? btnHelp : undefined} -
    - { this.downloadImageLink = link; }} - style={{display: 'none', visibility: 'collapse'}}/> -
    - ); - } -} - -export default EditorToolbar; diff --git a/DKBFrontEnd/src/src/ontodia/workspace/accordion.tsx b/DKBFrontEnd/src/src/ontodia/workspace/accordion.tsx deleted file mode 100644 index 9b37f2bdb..000000000 --- a/DKBFrontEnd/src/src/ontodia/workspace/accordion.tsx +++ /dev/null @@ -1,205 +0,0 @@ -import * as React from 'react'; - -import { AccordionItem, Props as ItemProps } from './accordionItem'; - -export interface Props { - onStartResize?: () => void; - /** AccordionItem[] */ - children?: React.ReactElement[]; -} - -export interface State { - /** - * Items' sizes in pixels. - * Undefined until first resize or toggle initiated by user. - **/ - readonly sizes?: number[]; - /** - * Per-item collapsed state: true if corresponding item is collapsed; - * otherwise false. - */ - readonly collapsed?: boolean[]; - readonly resizing?: boolean; -} - -const CLASS_NAME = 'ontodia-accordion'; - -export class Accordion extends React.Component { - private element: HTMLDivElement; - - private items: AccordionItem[] = []; - private originSizes: ReadonlyArray; - private originCollapsed: ReadonlyArray; - private originTotalHeight: number; - - constructor(props: Props) { - super(props); - this.state = { - collapsed: React.Children.map(this.props.children, () => false), - resizing: false, - }; - } - - render() { - const {resizing} = this.state; - return ( -
    this.element = element}> - {this.renderItems()} -
    - ); - } - - private renderItems() { - const {sizes, collapsed} = this.state; - const {children} = this.props; - const childCount = React.Children.count(children); - const totalHeight = this.element ? this.element.clientHeight : undefined; - - return React.Children.map(children, (child: React.ReactElement, index: number) => { - const lastChild = index === children.length - 1; - const height = sizes - ? (collapsed[index] ? sizes[index] : `${100 * sizes[index] / totalHeight}%`) - : `${100 / childCount}%`; - - const additionalProps: Partial & React.Props = { - ref: element => this.items[index] = element, - collapsed: collapsed[index], - height, - onChangeCollapsed: newState => this.onItemChangeCollapsed(index, newState), - onBeginDragHandle: lastChild ? undefined : () => this.onBeginDragHandle(index), - onDragHandle: lastChild ? undefined : (dx, dy) => this.onDragHandle(index, dx, dy), - onEndDragHandle: this.onEndDragHandle, - }; - return React.cloneElement(child, additionalProps); - }); - } - - private onBeginDragHandle = (itemIndex: number) => { - this.originTotalHeight = this.element.clientHeight; - this.originSizes = this.computeEffectiveItemHeights(); - this.originCollapsed = [...this.state.collapsed]; - this.setState({resizing: true}, () => { - if (this.props.onStartResize) { - this.props.onStartResize(); - } - }); - } - - private onEndDragHandle = () => { - this.setState({resizing: false}); - } - - private computeEffectiveItemHeights(): number[] { - return this.items.map((item, index) => { - if (this.state.collapsed[index]) { - return item.header.clientHeight; - } else { - return item.element.offsetHeight; - } - }); - } - - private sizeWhenCollapsed = (index: number) => { - const item = this.items[index]; - return item.header.clientHeight + (item.element.offsetHeight - item.element.clientHeight); - } - - private onDragHandle = (itemIndex: number, dx: number, dy: number) => { - const sizes = [...this.originSizes]; - const collapsed = [...this.originCollapsed]; - - new SizeDistributor( - sizes, collapsed, this.originTotalHeight, this.sizeWhenCollapsed, - ).distribute(itemIndex + 1, dy); - - this.setState({sizes, collapsed}); - } - - private onItemChangeCollapsed(itemIndex: number, itemCollapsed: boolean) { - const totalHeight = this.element.clientHeight; - const sizes = this.computeEffectiveItemHeights(); - const collapsed = [...this.state.collapsed]; - - const effectiveSize = sizes[itemIndex]; - - const collapsedSize = this.sizeWhenCollapsed(itemIndex); - const distributor = new SizeDistributor( - sizes, collapsed, totalHeight, this.sizeWhenCollapsed); - - if (itemCollapsed) { - const splitShift = Math.max(effectiveSize - collapsedSize, 0); - sizes[itemIndex] = collapsedSize; - if (itemIndex === sizes.length - 1) { - distributor.expand(splitShift, 0, itemIndex); - } else { - distributor.expand(splitShift, itemIndex + 1, sizes.length); - } - } else { - const shift = (totalHeight / sizes.length) - collapsedSize; - let freeSize = distributor.collapse(shift, itemIndex + 1, sizes.length); - freeSize = Math.max(freeSize, distributor.leftoverSize()); - if (freeSize < shift) { - freeSize += distributor.collapse(shift - freeSize, 0, itemIndex); - } - const newSize = Math.round(collapsedSize + freeSize); - sizes[itemIndex] = newSize; - } - - collapsed[itemIndex] = itemCollapsed; - - this.setState({sizes, collapsed}); - } -} - -class SizeDistributor { - constructor( - readonly sizes: number[], - readonly collapsed: boolean[], - readonly totalSize: number, - readonly sizeWhenCollapsed: (index: number) => number, - ) {} - - distribute(splitIndex: number, splitShift: number) { - if (splitShift > 0) { - let freeSize = this.collapse(splitShift, splitIndex, this.sizes.length); - freeSize = Math.max(freeSize, this.leftoverSize()); - this.expand(freeSize, 0, splitIndex); - } else { - let freeSize = this.collapse(-splitShift, 0, splitIndex); - freeSize = Math.max(freeSize, this.leftoverSize()); - this.expand(freeSize, splitIndex, this.sizes.length); - } - } - - collapse(shift: number, from: number, to: number) { - if (shift <= 0) { return 0; } - let shiftLeft = shift; - for (let i = to - 1; i >= from; i--) { - if (this.collapsed[i]) { continue; } - const size = this.sizes[i]; - const collapsedSize = this.sizeWhenCollapsed(i); - const newSize = Math.round(Math.max(size - shiftLeft, collapsedSize)); - shiftLeft = shiftLeft - (size - newSize); - this.sizes[i] = newSize; - this.collapsed[i] = newSize <= collapsedSize; - } - return shift - shiftLeft; - } - - expand(shift: number, from: number, to: number) { - if (shift <= 0) { return 0; } - const firstOpenFromEnd = this.collapsed.lastIndexOf(false, to - 1); - const index = (firstOpenFromEnd >= from) ? firstOpenFromEnd : (to - 1); - const oldSize = this.sizes[index]; - const newSize = Math.round(oldSize + shift); - this.sizes[index] = newSize; - this.collapsed[index] = newSize <= this.sizeWhenCollapsed(index); - return newSize - oldSize; - } - - leftoverSize() { - const sizeSum = this.sizes.reduce((sum, size) => sum + size, 0); - return Math.max(this.totalSize - sizeSum, 0); - } -} diff --git a/DKBFrontEnd/src/src/ontodia/workspace/accordionItem.tsx b/DKBFrontEnd/src/src/ontodia/workspace/accordionItem.tsx deleted file mode 100644 index 200628d02..000000000 --- a/DKBFrontEnd/src/src/ontodia/workspace/accordionItem.tsx +++ /dev/null @@ -1,58 +0,0 @@ -import * as React from 'react'; - -import { TutorialProps } from '../tutorial/tutorial'; - -import { DraggableHandle } from './draggableHandle'; - -export interface Props { - heading: string; - bodyClassName?: string; - bodyRef?: (body: HTMLDivElement) => void; - tutorialProps?: TutorialProps; - children?: React.ReactNode; - - // props provided by Accordion - collapsed?: boolean; - height?: number | string; - onChangeCollapsed?: (collapsed: boolean) => void; - onBeginDragHandle?: () => void; - onDragHandle?: (dx: number, dy: number) => void; - onEndDragHandle?: () => void; -} - -const CLASS_NAME = 'ontodia-accordion-item'; - -export class AccordionItem extends React.Component { - private _element: HTMLDivElement; - private _header: HTMLDivElement; - - get element() { return this._element; } - get header() { return this._header; } - - render() { - const { - heading, bodyClassName, children, tutorialProps, bodyRef, - collapsed, height, onBeginDragHandle, onDragHandle, onEndDragHandle, - } = this.props; - const shouldRenderHandle = onBeginDragHandle && onDragHandle && onEndDragHandle; - - return
    this._element = element} - style={{height}} - {...tutorialProps}> -
    -
    this._header = header} - onClick={() => this.props.onChangeCollapsed(!collapsed)}>{heading}
    -
    - {children ? children : -
    } -
    -
    - {shouldRenderHandle ? onBeginDragHandle()} - onDragHandle={(e, x, y) => onDragHandle(x, y)} - onEndDragHandle={e => onEndDragHandle()} /> : null} -
    ; - } -} diff --git a/DKBFrontEnd/src/src/ontodia/workspace/draggableHandle.tsx b/DKBFrontEnd/src/src/ontodia/workspace/draggableHandle.tsx deleted file mode 100644 index 3c448eea3..000000000 --- a/DKBFrontEnd/src/src/ontodia/workspace/draggableHandle.tsx +++ /dev/null @@ -1,62 +0,0 @@ -import * as React from 'react'; - -export interface Props extends React.HTMLAttributes { - onBeginDragHandle: (e: React.MouseEvent) => void; - onDragHandle: (e: MouseEvent, dx: number, dy: number) => void; - onEndDragHandle?: (e: MouseEvent) => void; -} - -export class DraggableHandle extends React.Component { - private isHoldingMouse = false; - private originPageX: number; - private originPageY: number; - - render() { - // remove custom handlers from `div` props - // tslint:disable-next-line:no-unused-variable - const {onBeginDragHandle, onDragHandle, onEndDragHandle, ...props} = this.props; - return
    - {this.props.children} -
    ; - } - - componentWillUnmount() { - this.removeListeners(); - } - - private onHandleMouseDown = (e: React.MouseEvent) => { - if (e.target !== e.currentTarget) { return; } - if (this.isHoldingMouse) { return; } - - const LEFT_BUTTON = 0; - if (e.button !== LEFT_BUTTON) { return; } - - this.isHoldingMouse = true; - this.originPageX = e.pageX; - this.originPageY = e.pageY; - document.addEventListener('mousemove', this.onMouseMove); - document.addEventListener('mouseup', this.onMouseUp); - this.props.onBeginDragHandle(e); - } - - private onMouseMove = (e: MouseEvent) => { - if (!this.isHoldingMouse) { return; } - e.preventDefault(); - this.props.onDragHandle(e, e.pageX - this.originPageX, e.pageY - this.originPageY); - } - - private onMouseUp = (e: MouseEvent) => { - this.removeListeners(); - if (this.props.onEndDragHandle) { - this.props.onEndDragHandle(e); - } - } - - private removeListeners() { - if (this.isHoldingMouse) { - this.isHoldingMouse = false; - document.removeEventListener('mousemove', this.onMouseMove); - document.removeEventListener('mouseup', this.onMouseUp); - } - } -} diff --git a/DKBFrontEnd/src/src/ontodia/workspace/resizableSidebar.tsx b/DKBFrontEnd/src/src/ontodia/workspace/resizableSidebar.tsx deleted file mode 100644 index b08d68fb2..000000000 --- a/DKBFrontEnd/src/src/ontodia/workspace/resizableSidebar.tsx +++ /dev/null @@ -1,114 +0,0 @@ -import * as React from 'react'; - -import { TutorialProps } from '../tutorial/tutorial'; - -import { DraggableHandle } from './draggableHandle'; - -export interface Props { - className?: string; - dockSide?: DockSide; - defaultWidth?: number; - minWidth?: number; - maxWidth?: number; - initiallyOpen?: boolean; - onOpenOrClose?: (open: boolean) => void; - onStartResize: () => void; - tutorialProps?: TutorialProps; - children?: React.ReactNode; -} - -export enum DockSide { - Left = 1, - Right, -} - -export interface State { - readonly open?: boolean; - readonly width?: number; -} - -const CLASS_NAME = 'ontodia-drag-resizable-column'; - -export class ResizableSidebar extends React.Component { - static readonly defaultProps: Partial = { - dockSide: DockSide.Left, - minWidth: 0, - maxWidth: 500, - defaultWidth: 275, - initiallyOpen: true, - }; - - private originWidth: number; - - constructor(props: Props) { - super(props); - const {initiallyOpen} = this.props; - this.state = { - open: initiallyOpen, - width: this.defaultWidth(), - }; - } - - private defaultWidth() { - const {defaultWidth, maxWidth} = this.props; - return Math.min(defaultWidth, maxWidth); - } - - render() { - const isDockedLeft = this.props.dockSide === DockSide.Left; - const {open, width} = this.state; - - const className = `${CLASS_NAME} ` + - `${CLASS_NAME}--${isDockedLeft ? 'docked-left' : 'docked-right'} ` + - `${CLASS_NAME}--${open ? 'opened' : 'closed'} ` + - `${this.props.className || ''}`; - - return
    - {this.props.children} - -
    this.toggle({open: !this.state.open})}> -
    -
    -
    ; - } - - private onBeginDragHandle = () => { - this.originWidth = this.state.open ? this.state.width : 0; - this.props.onStartResize(); - } - - private onDragHandle = (e: MouseEvent, dx: number, dy: number) => { - let xDifference = dx; - if (this.props.dockSide === DockSide.Right) { - xDifference = -xDifference; - } - const newWidth = this.originWidth + xDifference; - const clampedWidth = Math.max(Math.min(newWidth, this.props.maxWidth), this.props.minWidth); - this.toggle({open: clampedWidth > this.props.minWidth, newWidth: clampedWidth}); - } - - private toggle(params: { - open: boolean; - newWidth?: number; - }) { - const {open, newWidth} = params; - const openChanged = open !== this.state.open; - const onStateChanged = () => { - if (openChanged && this.props.onOpenOrClose) { - this.props.onOpenOrClose(open); - } - }; - - const useDefaultWidth = open && this.state.width === 0 && newWidth === undefined; - if (useDefaultWidth) { - this.setState({open, width: this.defaultWidth()}, onStateChanged); - } else { - this.setState(newWidth === undefined ? {open} : {open, width: newWidth}, onStateChanged); - } - } -} diff --git a/DKBFrontEnd/src/src/ontodia/workspace/workspace.ts b/DKBFrontEnd/src/src/ontodia/workspace/workspace.ts deleted file mode 100644 index a54b09070..000000000 --- a/DKBFrontEnd/src/src/ontodia/workspace/workspace.ts +++ /dev/null @@ -1,230 +0,0 @@ -import { Component, createElement, ReactElement } from 'react'; -import * as Backbone from 'backbone'; - -import { DiagramModel } from '../diagram/model'; -import { Link, FatLinkType } from '../diagram/elements'; -import { DiagramView, DiagramViewOptions } from '../diagram/view'; -import { - forceLayout, removeOverlaps, padded, translateToPositiveQuadrant, - LayoutNode, LayoutLink, translateToCenter, -} from '../viewUtils/layout'; -import { ClassTree } from '../widgets/classTree'; -import { LinkTypesToolboxShell, LinkTypesToolboxModel } from '../widgets/linksToolbox'; -import { dataURLToBlob } from '../viewUtils/toSvg'; - -import { EditorToolbar, Props as EditorToolbarProps } from '../widgets/toolbar'; -import { SearchCriteria } from '../widgets/instancesSearch'; -import { showTutorial, showTutorialIfNotSeen } from '../tutorial/tutorial'; - -import { WorkspaceMarkup, Props as MarkupProps } from './workspaceMarkup'; - -export interface Props { - onSaveDiagram?: (workspace: Workspace) => void; - onShareDiagram?: (workspace: Workspace) => void; - onEditAtMainSite?: (workspace: Workspace) => void; - isViewOnly?: boolean; - isDiagramSaved?: boolean; - hideTutorial?: boolean; - viewOptions?: DiagramViewOptions; -} - -export interface State { - readonly criteria?: SearchCriteria; -} - -export class Workspace extends Component { - static readonly defaultProps: { [K in keyof Props]?: any } = { - hideTutorial: true, - }; - - private markup: WorkspaceMarkup; - - private readonly model: DiagramModel; - private readonly diagram: DiagramView; - private tree: ClassTree; - private linksToolbox: LinkTypesToolboxShell; - - constructor(props: Props) { - super(props); - this.model = new DiagramModel(this.props.isViewOnly); - this.diagram = new DiagramView(this.model, this.props.viewOptions); - this.state = {}; - } - - render(): ReactElement { - return createElement(WorkspaceMarkup, { - ref: markup => { this.markup = markup; }, - isViewOnly: this.props.isViewOnly, - view: this.diagram, - searchCriteria: this.state.criteria, - onSearchCriteriaChanged: criteria => this.setState({criteria}), - toolbar: createElement(EditorToolbar, { - onUndo: this.undo, - onRedo: this.redo, - onZoomIn: this.zoomIn, - onZoomOut: this.zoomOut, - onZoomToFit: this.zoomToFit, - onPrint: this.print, - onExportSVG: this.exportSvg, - onExportPNG: this.exportPng, - onShare: this.props.onShareDiagram ? () => this.props.onShareDiagram(this) : undefined, - onSaveDiagram: () => this.props.onSaveDiagram(this), - onForceLayout: () => { - this.forceLayout(); - this.zoomToFit(); - }, - onChangeLanguage: this.changeLanguage, - onShowTutorial: showTutorial, - onEditAtMainSite: () => this.props.onEditAtMainSite(this), - isEmbeddedMode: this.props.isViewOnly, - isDiagramSaved: this.props.isDiagramSaved, - }), - } as MarkupProps & React.ClassAttributes); - } - - componentDidMount() { - this.diagram.initializePaperComponents(); - - if (this.props.isViewOnly) { return; } - - this.tree = new ClassTree({ - model: new Backbone.Model(this.diagram.model), - view: this.diagram, - el: this.markup.classTreePanel, - }).render(); - - this.tree.on('action:classSelected', (classId: string) => { - this.setState({criteria: {elementTypeId: classId}}); - }); - this.model.graph.on('add-to-filter', (element: Element, linkType?: FatLinkType) => { - this.setState({criteria: {refElementId: element.id, refElementLinkId: linkType && linkType.id}}); - }); - - this.linksToolbox = new LinkTypesToolboxShell({ - model: new LinkTypesToolboxModel(this.model), - view: this.diagram, - el: this.markup.linkTypesPanel, - }); - - if (!this.props.hideTutorial) { - showTutorialIfNotSeen(); - } - } - - componentWillUnmount() { - if (this.tree) { - this.tree.remove(); - } - - this.diagram.dispose(); - } - - getModel() { return this.model; } - getDiagram() { return this.diagram; } - - preventTextSelectionUntilMouseUp() { this.markup.preventTextSelection(); } - - zoomToFit = () => { - this.markup.paperArea.zoomToFit(); - } - - showWaitIndicatorWhile(promise: Promise) { - this.markup.paperArea.showIndicator(promise); - } - - forceLayout = () => { - const nodes: LayoutNode[] = []; - const nodeById: { [id: string]: LayoutNode } = {}; - for (const element of this.model.elements) { - const size = element.get('size'); - const position = element.get('position'); - const node: LayoutNode = { - id: element.id, - x: position.x, - y: position.y, - width: size.width, - height: size.height, - }; - nodeById[element.id] = node; - nodes.push(node); - } - - type LinkWithReference = LayoutLink & { link: Link }; - const links: LinkWithReference[] = []; - for (const link of this.model.links) { - if (!this.model.isSourceAndTargetVisible(link)) { continue; } - const source = this.model.sourceOf(link); - const target = this.model.targetOf(link); - links.push({ - link, - source: nodeById[source.id], - target: nodeById[target.id], - }); - } - - forceLayout({nodes, links, preferredLinkLength: 200}); - padded(nodes, {x: 10, y: 10}, () => removeOverlaps(nodes)); - translateToPositiveQuadrant({nodes, padding: {x: 150, y: 150}}); - for (const node of nodes) { - this.model.getElement(node.id).position(node.x, node.y); - } - this.markup.paperArea.adjustPaper(); - translateToCenter({ - nodes, - paperSize: this.markup.paperArea.getPaperSize(), - contentBBox: this.markup.paperArea.getContentFittingBox(), - }); - - for (const node of nodes) { - this.model.getElement(node.id).position(node.x, node.y); - } - - for (const {link} of links) { - link.set('vertices', []); - } - } - - exportSvg = (link: HTMLAnchorElement) => { - this.diagram.exportSVG().then(svg => { - link.download = 'diagram.svg'; - const xmlEncodingHeader = ''; - link.href = window.URL.createObjectURL( - new Blob([xmlEncodingHeader + svg], {type: 'image/svg+xml'})); - link.click(); - }); - } - - exportPng = (link: HTMLAnchorElement) => { - this.diagram.exportPNG({backgroundColor: 'white'}).then(dataUri => { - link.download = 'diagram.png'; - link.href = window.URL.createObjectURL(dataURLToBlob(dataUri)); - link.click(); - }); - } - - undo = () => { - this.model.undo(); - } - - redo = () => { - this.model.redo(); - } - - zoomIn = () => { - this.markup.paperArea.zoomBy(0.2); - } - - zoomOut = () => { - this.markup.paperArea.zoomBy(-0.2); - } - - print = () => { - this.diagram.print(); - } - - changeLanguage = (language: string) => { - this.diagram.setLanguage(language); - } -} - -export default Workspace; diff --git a/DKBFrontEnd/src/src/ontodia/workspace/workspaceMarkup.tsx b/DKBFrontEnd/src/src/ontodia/workspace/workspaceMarkup.tsx deleted file mode 100644 index d0bc7ea1a..000000000 --- a/DKBFrontEnd/src/src/ontodia/workspace/workspaceMarkup.tsx +++ /dev/null @@ -1,176 +0,0 @@ -import * as React from 'react'; - -import { DiagramView } from '../diagram/view'; -import { PaperArea } from '../diagram/paperArea'; - -import { InstancesSearch, SearchCriteria } from '../widgets/instancesSearch'; - -import { ResizableSidebar, DockSide } from './resizableSidebar'; -import { Accordion } from './accordion'; -import { AccordionItem } from './accordionItem'; - -export interface Props { - toolbar: React.ReactElement; - view: DiagramView; - isViewOnly?: boolean; - - searchCriteria?: SearchCriteria; - onSearchCriteriaChanged: (criteria: SearchCriteria) => void; -} - -const INTRO_CLASSES = `

    Navigate through class tree and click a class to select it.

    -

    When the class is selected, its instances are shown in Instances panel

    -

    Double-click the class expands it and displays its subclasses.

    `; - -const INTRO_INSTANCES = `

    Instances of the selected class are displayed here.

    -

    You can select one or several instances and drag-and-drop them directly on canvas to - start your diagram.

    `; - -const INTRO_DIAGRAM = `

    Main working area

    Zooming: Ctrl-mousewheel or pinch-zoom on touchpad

    -

    Pan: Ctrl-mouse drag or mouse wheel

    Filtering related instances
    -

    When you select an element on the diagram the Ontodia shows a funnel icon underneath the - element. By clicking the funnel icon, you can filter the related elements into the Instances panel.

    -

    Then related elements can be drag-and-dropped into the diagram.

    -

    By repeating it you can navigate from one element to another as far as you like and your way - will be shown on the diagram.

    `; - -const INTRO_CONNECTIONS = `

    Connections panel lists all the connection present in the data source.

    -

    You can define which connections Ontodia should display and which should stay hidden.

    -

    You can also change the way they are shown on the diagram: it’s either with the name above - them or without it.

    `; - -const INTRO_RESIZE = `

    Panels can be resized and collapsed.

    `; - -export class WorkspaceMarkup extends React.Component { - element: HTMLElement; - classTreePanel: HTMLElement; - linkTypesPanel: HTMLElement; - paperArea: PaperArea; - - private untilMouseUpClasses: string[] = []; - - render() { - let leftPanel = ( - this.untilMouseUp({ - preventTextSelection: true, - horizontalResizing: true, - })} - tutorialProps={{ - 'data-position': 'right', - 'data-step': '7', - 'data-intro-id': 'resize', - 'data-intro': INTRO_RESIZE, - }}> - this.untilMouseUp({ - preventTextSelection: true, - verticalResizing: true, - })}> - this.classTreePanel = e} - tutorialProps={{ - 'data-position': 'right', - 'data-step': '1', - 'data-intro-id': 'tree-view', - 'data-intro': INTRO_CLASSES, - }}> - - - - - - - ); - - let rightPanel = ( - this.untilMouseUp({ - preventTextSelection: true, - horizontalResizing: true, - })}> - this.untilMouseUp({ - preventTextSelection: true, - verticalResizing: true, - })}> - this.linkTypesPanel = e} - tutorialProps={{ - 'data-position': 'left', - 'data-step': '4', - 'data-intro-id': 'link-types-toolbox', - 'data-intro': INTRO_CONNECTIONS, - }}> - - - - ); - - return ( -
    this.element = e} className='ontodia'> -
    {this.props.toolbar}
    -
    - {!this.props.isViewOnly ? leftPanel : null} -
    - this.paperArea = el} - model={this.props.view.model} - paper={this.props.view.paper} - zoomOptions={{min: 0.2, max: 2, maxFit: 1, fitPadding: 20}} - preventTextSelection={() => this.preventTextSelection()} - onDragDrop={(e, position) => this.props.view.onDragDrop(e, position)} /> -
    - {!this.props.isViewOnly ? rightPanel : null} -
    -
    - ); - } - - componentDidMount() { - document.addEventListener('mouseup', this.onDocumentMouseUp); - } - - componentWillUnmount() { - document.removeEventListener('mouseup', this.onDocumentMouseUp); - } - - preventTextSelection() { - this.untilMouseUp({preventTextSelection: true}); - } - - private untilMouseUp(params: { - preventTextSelection?: boolean; - horizontalResizing?: boolean; - verticalResizing?: boolean; - }) { - this.untilMouseUpClasses = []; - if (params.preventTextSelection) { - this.untilMouseUpClasses.push('ontodia--unselectable'); - } - if (params.horizontalResizing) { - this.untilMouseUpClasses.push('ontodia--horizontal-resizing'); - } - if (params.verticalResizing) { - this.untilMouseUpClasses.push('ontodia--vertical-resizing'); - } - - for (const className of this.untilMouseUpClasses) { - this.element.classList.add(className); - } - } - - private onDocumentMouseUp = () => { - for (const className of this.untilMouseUpClasses) { - this.element.classList.remove(className); - } - this.untilMouseUpClasses = []; - } -} - -export default WorkspaceMarkup; diff --git a/DKBFrontEnd/src/styles/_misc.scss b/DKBFrontEnd/src/styles/_misc.scss deleted file mode 100644 index cedd487db..000000000 --- a/DKBFrontEnd/src/styles/_misc.scss +++ /dev/null @@ -1,5 +0,0 @@ -/* JointJS */ -.link-tools .tool-remove { display: none } -.link-tools .tool-options { display: none } -.marker-arrowheads { display: none } -.selection .handle.rotate { display: none; } /* disables the rotate tool */ diff --git a/DKBFrontEnd/src/styles/diagram/_connectionsMenu.scss b/DKBFrontEnd/src/styles/diagram/_connectionsMenu.scss deleted file mode 100644 index debc963fe..000000000 --- a/DKBFrontEnd/src/styles/diagram/_connectionsMenu.scss +++ /dev/null @@ -1,244 +0,0 @@ -.ontodia-connections-menu { - position: absolute; - width: 300px; - height: 300px; - border-radius: 3px; - display: flex; - flex-direction: column; - box-shadow: 0px 4px 15px 0px rgba(0, 0, 0, 0.38); -} - -.ontodia-connections-menu_bread-crumbs { - padding: 10px; - padding-bottom: 0px; - overflow: hidden; - text-overflow: ellipsis; - height: 27px; - min-height: 27px; - flex-grow: 0; -} - -.ontodia-connections-menu__title-label { - position: absolute; - top: -11px; - left: 10px; - background: white; - padding-left: 3px; - padding-right: 3px; - border-radius: 6px; -} - -.ontodia-connections-menu_search-line { - padding: 10px; -} - -.ontodia-connections-menu_links-list { - padding: 5px; - overflow-x: hidden; - overflow-y: auto; - border-top: 1px solid #dbdbdb; - flex-grow: 1; - margin-bottom: 0px; -} - -.ocm_links-list-empty { - display: flex; - align-items: center; -} - -.ontodia-connections-menu_links-list__empty { - width: 100%; - position: relative; - font-size: x-large; - color: #cbcbcb; - text-align: center; -} - -.ontodia-connections-menu__loading, -.ontodia-connections-menu__error { - width: 100%; - height: 100%; - position: relative; - font-size: x-large; - display: flex; - color: #cbcbcb; - align-items: center; - justify-content: center; -} -.ontodia-connections-menu__loading-objects { - border: 1px solid gray; - flex-grow: 1; - box-shadow: inset 0px 0px 23px -8px gray; - background-color: whitesmoke; - position: relative; - font-size: x-large; - display: flex; - color: #cbcbcb; - align-items: center; - justify-content: center; - margin-bottom: 5px; -} - -.ontodia-connections-menu__progress-bar { - opacity: 0; - height: 0px; - -webkit-transition: 0.3s; - -moz-transition: 0.3s; - transition: 0.3s; - - &--loading { - height: 10px; - opacity: 1; - } - - &--error { - height: 10px; - opacity: 1; - > .progress-bar { background-color: #E72F2F; } - } -} - -.element-in-popup-menu { - display: flex; - padding: 5px 10px; - margin: 5px 10px; - border-radius: 5px; -} -.element-in-popup-menu:hover { - background-color: #e6e6e6; -} - -.element-in-popup-menu.unchecked { - background-color: rgba(255, 255, 255, 0.79); -} -.element-in-popup-menu_disabled-line { - pointer-events: none; - cursor: not-allowed; -} - -.element-in-popup-menu__checkbox { - min-width: 13px; -} - -.element-in-popup-menu__link-label { - flex-grow: 1; - margin-left: 5px; - overflow: hidden; - text-overflow: ellipsis; -} - -.link-in-popup-menu { - display: flex; - padding: 5px 5px 5px 10px; - border-radius: 5px; - align-items: center; - margin-bottom: 4px; - box-shadow: 0px 0px 23px -5px #dbdbdb inset; -} - -.link-in-popup-menu:hover { - background-color: whitesmoke; -} - -.link-in-popup-menu__link-title { - flex-grow: 1; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; -} - -.link-in-popup-menu__count { - float: right; - margin-left: 10px; -} -.link-in-popup-menu__count.badge { - min-width: 21px; -} - -.link-in-popup-menu__navigate-button { - float: right; - background-image: url("../images/expand-link.png"); - width: 16px; - height: 16px; - opacity: 0.5; - margin-left: 10px; - min-width: 16px; - background-size: cover; -} - -.link-in-popup-menu__navigate-button:hover { - opacity: 1; -} - -.ontodia-connections-menu_links-list__loading { - text-align: center; - width: 100%; - position: relative; - font-size: x-large; - color: #cbcbcb; -} - -.ontodia-connections-menu_links-list__hr { - margin-top: 10px; - margin-bottom: 10px; -} - -.ontodia-connections-menu_objects-panel { - flex-grow: 1; - padding: 10px; - position: relative; - display: flex; - flex-direction: column; - padding-top: 0px; -} - -.ontodia-connections-menu_objects-panel__select-all { - white-space: nowrap; - margin-bottom: 5px; - display: flex; - - input { - display: inline-block; - } - - .undefined { - opacity: 0.3; - } - - span { - margin-left: 5px; - } -} - - -.ontodia-connections-menu_objects-panel_bottom-panel { - height: 25px; - white-space: nowrap; -} - -.ontodia-connections-menu_objects-panel_bottom-panel__count-label { - height: 25px; - float: left; - padding: 0px 5px; - font-size: larger; - display: flex; - align-items: center; - max-width: 60%; -} - -.btn.ontodia-connections-menu_objects-panel_bottom-panel__add-button { - height: 25px; - padding-top: 1px; - padding-bottom: 2px; -} - -.ontodia-connections-menu_objects-panel_objects-list { - border: 1px solid gray; - height: 0; - flex-grow: 1; - box-shadow: inset 0px 0px 23px -8px gray; - background-color: whitesmoke; - overflow-x: hidden; - overflow-y: scroll; - margin-bottom: 5px; -} diff --git a/DKBFrontEnd/src/styles/diagram/_elementLayer.scss b/DKBFrontEnd/src/styles/diagram/_elementLayer.scss deleted file mode 100644 index 15044ad44..000000000 --- a/DKBFrontEnd/src/styles/diagram/_elementLayer.scss +++ /dev/null @@ -1,24 +0,0 @@ -.ontodia-overlayed-element { - cursor: move; - outline: none; -} - -.ontodia-overlayed-element, -.ontodia-exported-element { - // set defaults for all inherited properties - box-sizing: border-box; - color: black; - font-family: "Helvetica Neue",Helvetica,Arial,sans-serif; - font-size: 14px; - line-height: 1.42857143; - - // http://stackoverflow.com/questions/6664460/line-height-affects-images - img { vertical-align: middle; } -} - -// remove link fill on exported SVG -.link .connection { fill: none; } -.link .connection-wrap { - fill: none; - opacity: 0; -} diff --git a/DKBFrontEnd/src/styles/diagram/_halo.scss b/DKBFrontEnd/src/styles/diagram/_halo.scss deleted file mode 100644 index 3259e9b79..000000000 --- a/DKBFrontEnd/src/styles/diagram/_halo.scss +++ /dev/null @@ -1,75 +0,0 @@ -.ontodia-halo { - position: absolute; - pointer-events: none; - - @mixin halo-button { - position: absolute; - background-size: cover; - cursor: pointer; - pointer-events: auto; - opacity: 0.5; - transition: opacity 0.3s; - width: 16px; - height: 16px; - } - - &__navigate { - @include halo-button; - bottom: calc(50% - 10px); - right: -17px; - margin-left: -8px; - - &:hover { - opacity: 1; - } - - &--open { - background-image: url("../images/connections.png"); - } - - &--closed { - background-image: url("../images/close-connections.png"); - } - } - - &__delete { - @include halo-button; - background-image: url("../images/delete.png"); - top: -16px; - right: -16px; - - &:hover { - opacity: 1; - } - } - - &__expand { - @include halo-button; - bottom: -17px; - left: 50%; - margin-left: -8px; - - &:hover { - opacity: 1; - } - - &--open { - background-image: url("../images/expand-properties.png"); - } - - &--closed { - background-image: url("../images/collapse-properties.png"); - } - } - - &__add-to-filter { - @include halo-button; - background-image: url("../images/add-to-filter.png"); - bottom: -17px; - right: -17px; - - &:hover { - opacity: 1; - } - } -} diff --git a/DKBFrontEnd/src/styles/diagram/_paperArea.scss b/DKBFrontEnd/src/styles/diagram/_paperArea.scss deleted file mode 100644 index 8037d27f5..000000000 --- a/DKBFrontEnd/src/styles/diagram/_paperArea.scss +++ /dev/null @@ -1,24 +0,0 @@ -.paper-area { - flex: auto; - cursor: default; - overflow: scroll; - - // create new layer to to fix “repaints on scroll” bottleneck - -webkit-transform: translateZ(0); - -moz-transform: translateZ(0); - transform: translateZ(0); - - background-image: url('../images/transparent-background.png'); - .paper { - margin: 0; - position: relative; - display: inline-block; - border: 1px solid black; - background-color: white; - } -} - -.uiElementView__iri { - fill: #969696; - font-size: smaller; -} diff --git a/DKBFrontEnd/src/styles/main.scss b/DKBFrontEnd/src/styles/main.scss deleted file mode 100644 index 0c46c20ba..000000000 --- a/DKBFrontEnd/src/styles/main.scss +++ /dev/null @@ -1,26 +0,0 @@ -@import "misc"; - -@import "diagram/connectionsMenu"; -@import "diagram/elementLayer"; -@import "diagram/halo"; -@import "diagram/paperArea"; - -@import "viewUtils/spinner"; - -@import "widgets/classTree"; -@import "widgets/instancesSearch"; -@import "widgets/linksToolbox"; -@import "widgets/listElementView"; -@import "widgets/progress"; -@import "widgets/toolbar"; - -@import "workspace/accordion"; -@import "workspace/resizableSidebar"; -@import "workspace/workspace"; - -@import "templates/icons"; -@import "templates/bigIcon"; -@import "templates/defaultElement"; -@import "templates/leftBar"; -@import "templates/organization"; -@import "templates/person"; diff --git a/DKBFrontEnd/src/styles/templates/_bigIcon.scss b/DKBFrontEnd/src/styles/templates/_bigIcon.scss deleted file mode 100644 index 99b06b2ba..000000000 --- a/DKBFrontEnd/src/styles/templates/_bigIcon.scss +++ /dev/null @@ -1,153 +0,0 @@ -.ontodia-big-icon-container { - max-width: 400px; - float: left; -} - -.ontodia-big-icon-template { - border-radius: 10px; - border-style: solid; - border-width: 1px; -} - -.ontodia-big-icon-template_body { - margin-left: 13px; - height: 100%; - border-radius: 3px; - border-top-right-radius: 10px; - border-bottom-right-radius: 10px; - border-left-style: solid; - border-left-width: 1px; - padding: 3px 6px 3px 6px; - background: white; - display: flex; - align-items: center; - justify-content: space-between; - overflow: hidden; -} - -.ontodia-big-icon-template_body__label { - font-size: 19px; - white-space: nowrap; - font-weight: 100; - margin-bottom: -7px; - width: 100%; - overflow: hidden; - text-overflow: ellipsis; -} - -.ontodia-big-icon-template_body_type-container { - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - font-size: 11px; - font-style: italic; - color: #afafaf; - font-weight: 100; - display: flex; -} - -.ontodia-big-icon-template_body_type-container__type { - width: 0; - flex-grow: 1; - overflow: hidden; - text-overflow: ellipsis; -} - -.ontodia-big-icon-template_body__icon { - position: inherit !important; - font-size: x-large; - margin: 5px 6px 5px 15px; - display: flex; -} - -.ontodia-big-icon-template_property { - border-radius: 10px; - background-color: white; - margin-top: 5px; - border: 1px solid; -} - -.ontodia-big-icon-template_property__image { - width: 100%; - border-top-left-radius: 10px; - border-top-right-radius: 10px; - border-bottom: 1px solid; -} - -.ontodia-big-icon-template_property_content { - width: 100%; - height: 100%; - padding: 9px; -} - -.ontodia-big-icon-template_property_content_iri-line { - width: 100%; - overflow: hidden; - display: flex; -} - -.ontodia-big-icon-template_property_content_iri-line__label { - font-size: 12px; - font-weight: 100; - margin-right: 4px; - color: #b6b6b6; -} - -.ontodia-big-icon-template_property_content_iri-line__iri { - font-size: 12px; - width: 100%; - overflow: hidden; - white-space: nowrap; - text-overflow: ellipsis; -} - -.ontodia-big-icon-template_property_content_iri-line__iri a { - color: #b6b6b6; -} - -.ontodia-big-icon-template_property_content__hr { - margin: 5px 0px 5px 0px; -} - -.ontodia-big-icon-template_property_content_property-table { - font-size: 15px; - font-weight: 100; - max-height: 200px; - overflow-y: scroll; - overflow-x: hidden; -} - -.ontodia-big-icon-template_property_content_property-table_row { - white-space: nowrap; -} - -.ontodia-big-icon-template_property_content_property-table_row__key { - display: inline-block; - width: 50%; - text-overflow: ellipsis; - overflow: hidden; - vertical-align: top; -} - -.ontodia-big-icon-template_property_content_property-table_row_key { - display: inline-block; - width: 50%; - text-overflow: ellipsis; - overflow: hidden; - vertical-align: top; -} - -.ontodia-big-icon-template_property_content_property-table_row_key_values { - display: inline-block; - width: 50%; - text-overflow: ellipsis; - overflow: hidden; -} - -.ontodia-big-icon-template_property_content_property-table_row_key_values__value { - width: 100%; - overflow: hidden; - text-overflow: ellipsis; - white-space: initial; - padding-right: 10px; -} diff --git a/DKBFrontEnd/src/styles/templates/_defaultElement.scss b/DKBFrontEnd/src/styles/templates/_defaultElement.scss deleted file mode 100644 index ba200f8ef..000000000 --- a/DKBFrontEnd/src/styles/templates/_defaultElement.scss +++ /dev/null @@ -1,142 +0,0 @@ -.ontodia-default-template { - max-width: 450px; - float: left; - border-radius: 12px; - border-style: solid; - border-width: 1px; - - &__thumbnail { - text-align: center; - > img { - max-width: 200px; - border-bottom: 1px solid; - } - } - - &[data-expanded='true'] &__thumbnail > img { - max-width: 350px; - } -} - -.ontodia-default-template_type-line { - padding: 0px 7px; - color: white; - height: 18px; - margin-bottom: 2px; - overflow: hidden; - display: flex; - align-items: baseline; - margin-top: -3px; -} - -div.ontodia-default-template_type-line__icon { - position: inherit !important; - margin-right: 4px; -} - -.ontodia-default-template_type-line_text-container { - flex-grow: 1; - overflow: hidden; - text-overflow: ellipsis; - width: 0; -} -.ontodia-default-template_type-line_text-container__text { - display: inline; - white-space: nowrap; - font-size: 12px; -} - -.ontodia-default-template_body { - border-bottom-left-radius: 12px; - border-bottom-right-radius: 12px; - border-top-style: solid; - border-top-width: 1px; - background: white; - padding: 7px 10px 8px 10px; - overflow: hidden; - display: flex; - flex-direction: column; -} - -.ontodia-default-template_body__label { - font-size: 19px; - font-weight: 100; - overflow: hidden; - text-overflow: ellipsis; - margin-bottom: 0; - white-space: nowrap; - word-wrap: break-word; -} - -.ontodia-default-template_body_expander { - width: 100%; - overflow: hidden; - display: flex; -} - -.ontodia-default-template_body_expander__iri_label { - font-size: 12px; - font-weight: 100; - margin-right: 15px; - color: #b6b6b6; -} - -.ontodia-default-template_body_expander_iri { - font-size: 12px; - width: 100%; - overflow: hidden; - white-space: nowrap; - text-overflow: ellipsis; -} - -.ontodia-default-template_body_expander_iri__link { - color: #b6b6b6; -} - -.ontodia-default-template_body_expander__hr { - margin: 5px 0px 5px 0px; -} - -.ontodia-default-template_body_expander_property-table { - font-size: 15px; - font-weight: 100; - margin-bottom: 5px; - max-height: 200px; - overflow-y: scroll; - overflow-x: hidden; -} - -.ontodia-default-template_body_expander_property-table_row { - white-space: nowrap; -} - -.ontodia-default-template_body_expander_property-table_row__key { - display: inline-block; - width: 50%; - text-overflow: ellipsis; - overflow: hidden; - vertical-align: top; -} - -.ontodia-default-template_body_expander_property-table_row_key { - display: inline-block; - width: 50%; - text-overflow: ellipsis; - overflow: hidden; - vertical-align: top; -} - -.ontodia-default-template_body_expander_property-table_row_key_values { - display: inline-block; - width: 50%; - text-overflow: ellipsis; - overflow: hidden; -} - -.ontodia-default-template_body_expander_property-table_row_key_values__value { - width: 100%; - overflow: hidden; - text-overflow: ellipsis; - white-space: initial; - padding-right: 10px; -} diff --git a/DKBFrontEnd/src/styles/templates/_icons.scss b/DKBFrontEnd/src/styles/templates/_icons.scss deleted file mode 100644 index 8382b682a..000000000 --- a/DKBFrontEnd/src/styles/templates/_icons.scss +++ /dev/null @@ -1,104 +0,0 @@ -.ontodia-default-icon::after { - content: "\25EF"; - min-width: 10px; - min-height: 10px; - border-radius: 100px; - overflow: hidden; - font-style: normal; - font-size: 12px; -} - -.ontodia-class-icon::after { - content: "C"; - font-weight: bold; - min-width: 10px; - min-height: 10px; - border-radius: 100px; - overflow: hidden; - font-style: normal; -} -.jstree-icon.jstree-themeicon-custom.ontodia-tree-icon.ontodia-class-icon { - color: #eaac77; - background-color: #fff6f0; - border: 1px solid #d99292; -} - -.ontodia-object-property-icon::after { - content: "OP"; - font-weight: bold; - min-width: 10px; - min-height: 10px; - border-radius: 100px; - overflow: hidden; - font-style: normal; -} - -.jstree-icon.jstree-themeicon-custom.ontodia-tree-icon.ontodia-object-property-icon { - font-size: 11px; - color: #34c7f3; - border: 1px solid #2dd6e6; -} - -.ontodia-datatype-property-icon::after { - content: "DP"; - font-weight: bold; - min-width: 10px; - min-height: 10px; - border-radius: 100px; - overflow: hidden; - font-style: normal; -} -.jstree-icon.jstree-themeicon-custom.ontodia-tree-icon.ontodia-datatype-property-icon { - font-size: 11px; - color: #34c7f3; -} - -.ontodia-person-icon::after { - content: "\1F464"; - min-width: 10px; - min-height: 10px; - border-radius: 100px; - overflow: hidden; - font-style: normal; -} - -.ontodia-country-icon::after { - content: "\2690"; //U+2690 - min-width: 10px; - min-height: 10px; - border-radius: 100px; - overflow: hidden; - font-style: normal; -} - -.jstree-icon.jstree-themeicon-custom.ontodia-tree-icon.ontodia-person-icon { - color: #eb7777; -} - -.ontodia-organization-icon::after { - content: "Org"; - font-weight: bold; - min-width: 10px; - min-height: 10px; - overflow: hidden; - font-style: normal; -} -.jstree-icon.jstree-themeicon-custom.ontodia-tree-icon.ontodia-organization-icon { - font-size: 9px; - color: #4c9d6c; - background-color: #dcffe2; - border: 1px solid #69b286; -} -.jstree-default .jstree-icon.jstree-themeicon-custom.ontodia-tree-icon { - height: 20px; - width: 20px; - line-height: 20px; -} -.jstree-icon.jstree-themeicon-custom.ontodia-tree-icon { - color: #1573b0; - background-color: aliceblue; - border-radius: 15px; - border: 1px solid #92bdd9; - overflow: hidden; - font-size: 15px; -} diff --git a/DKBFrontEnd/src/styles/templates/_leftBar.scss b/DKBFrontEnd/src/styles/templates/_leftBar.scss deleted file mode 100644 index 26f4fd929..000000000 --- a/DKBFrontEnd/src/styles/templates/_leftBar.scss +++ /dev/null @@ -1,132 +0,0 @@ -.ontodia-left-bar-template { - max-width: 400px; - float: left; - border-radius: 10px; - border-style: solid; - border-width: 1px; -} - -.ontodia-left-bar-template_body { - height: 100%; - border-radius: 2px; - border-top-right-radius: 10px; - border-bottom-right-radius: 10px; - border-left-style: solid; - border-left-width: 1px; - padding: 2px 10px 0px 6px; - margin-left: 13px; - background: white; - overflow: hidden; -} - -.ontodia-left-bar-template_body__image { - width: 100%; - margin: 5px 0px; - border: 1px solid #bdbdbd; -} - -.ontodia-left-bar-template_body_type-line { - display: flex; - overflow: hidden; - margin-top: 0px; - margin-bottom: -3px; - align-items: baseline; -} - -.ontodia-left-bar-template_body_type-line__icon { - position: inherit !important; - margin-right: 4px; -} - -.ontodia-left-bar-template_body_type-line__type { - white-space: nowrap; - font-size: 12px; - font-weight: 100; - width: 0; - flex-grow: 1; - overflow: hidden; - text-overflow: ellipsis; -} - -.ontodia-left-bar-template_body__label { - font-size: 19px; - white-space: nowrap; - font-weight: 100; - margin-bottom: -3px; - width: 100%; - overflow: hidden; - text-overflow: ellipsis; -} - -.ontodia-left-bar-template_body_expander { - width: 100%; - overflow: hidden; - display: flex; -} - -.ontodia-left-bar-template_body_expander__iri_label { - font-size: 12px; - font-weight: 100; - margin-right: 4px; - color: #b6b6b6; -} - -.ontodia-left-bar-template_body_expander_iri { - font-size: 12px; - width: 100%; - overflow: hidden; - white-space: nowrap; - text-overflow: ellipsis; -} - -.ontodia-left-bar-template_body_expander_iri__link { - color: #b6b6b6; -} - -.ontodia-left-bar-template_body_expander__hr { - margin: 5px 0px 5px 0px; -} - -.ontodia-left-bar-template_body_expander_property-table { - font-size: 15px; - font-weight: 100; - margin-bottom: 5px; - max-height: 200px; - overflow-y: scroll; - overflow-x: hidden; -} - -.ontodia-left-bar-template_body_expander_property-table_row { - white-space: nowrap; -} - -.ontodia-left-bar-template_body_expander_property-table_row__key { - display: inline-block; - width: 50%; - text-overflow: ellipsis; - overflow: hidden; - vertical-align: top; -} - -.ontodia-left-bar-template_body_expander_property-table_row_key { - display: inline-block; - width: 50%; - text-overflow: ellipsis; - overflow: hidden; - vertical-align: top; -} - -.ontodia-left-bar-template_body_expander_property-table_row_key_values { - display: inline-block; - width: 50%; - text-overflow: ellipsis; - overflow: hidden; -} - -.ontodia-left-bar-template_body_expander_property-table_row_key_values__value { - width: 100%; - overflow: hidden; - text-overflow: ellipsis; - white-space: initial; - padding-right: 10px; -} diff --git a/DKBFrontEnd/src/styles/templates/_organization.scss b/DKBFrontEnd/src/styles/templates/_organization.scss deleted file mode 100644 index 01707a34f..000000000 --- a/DKBFrontEnd/src/styles/templates/_organization.scss +++ /dev/null @@ -1,52 +0,0 @@ -.ontodia-organization-template { - border: 2px solid; - max-width: 400px; - border-radius: 2px; - - &__properties { - width: 100%; - } -} - -.ontodia-organization-template_body { - height: 100%; - border-radius: 2px; - padding: 3px 12px 3px 12px; - background: white; - display: flex; - align-items: stretch; - justify-content: space-between; - overflow: hidden; - flex-direction: column; -} - -.ontodia-organization-template_body__logo { - position: inherit !important; - font-size: x-large; - margin: 5px 0px; - border: 1px solid; - padding: 5px 6px; - flex-grow: 1; - display: flex; - justify-content: center; - align-items: center; -} - -.ontodia-organization-template_body_data { - flex-grow: 1; -} - -.ontodia-organization-template_body_data__types { - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - font-size: 12px; - font-weight: 100; -} - -.ontodia-organization-template_body_data__label { - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - margin-bottom: 0px; -} diff --git a/DKBFrontEnd/src/styles/templates/_person.scss b/DKBFrontEnd/src/styles/templates/_person.scss deleted file mode 100644 index 2defcebcf..000000000 --- a/DKBFrontEnd/src/styles/templates/_person.scss +++ /dev/null @@ -1,170 +0,0 @@ -.ontodia-person-container { - max-width: 400px; - float: left; -} - -.ontodia-person-template { - border-radius: 10px; - border-style: solid; - border-width: 1px; -} - -.ontodia-person-template_body { - margin-left: 13px; - border-radius: 3px; - border-top-right-radius: 10px; - border-bottom-right-radius: 10px; - border-left-style: solid; - border-left-width: 1px; - padding: 3px 12px 3px 0px; - background: white; - display: flex; - align-items: center; - justify-content: space-between; - overflow: hidden; -} - -.ontodia-person-template_body_main-part__label { - font-size: 19px; - white-space: nowrap; - font-weight: 100; - margin-bottom: -7px; - width: 100%; - overflow: hidden; - text-overflow: ellipsis; -} - -.ontodia-person-template_body_main-part_type-container { - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - font-size: 11px; - font-style: italic; - color: #afafaf; - font-weight: 100; - display: flex; -} - -.ontodia-person-template_body_main-part_type-container__type { - width: 0; - flex-grow: 1; - overflow: hidden; - text-overflow: ellipsis; -} - -.ontodia-person-template_body__icon { - position: inherit !important; - font-size: 30px; - margin: 5px 10px 5px 10px; - border: 1px solid; - /*padding: 5px 6px;*/ - flex-grow: 0; -} - -.ontodia-person-template_body_photo { - position: inherit !important; - font-size: x-large; - margin: 5px 8px 5px 8px; - border: 1px solid; - flex-grow: 0; - height: 40px; -} - -.ontodia-person-template_body_photo__image { - height: 100%; -} - -.ontodia-person-template_body_main-part { - flex-grow: 1; -} - -.ontodia-person-template_property { - border-radius: 10px; - background-color: white; - margin-top: 5px; - border: 1px solid; -} - -.ontodia-person-template_property_content { - width: 100%; - padding: 9px; -} - -.ontodia-person-template_property_content_iri-line { - width: 100%; - overflow: hidden; - display: flex; -} - -.ontodia-person-template_property_content_iri-line__label { - font-size: 12px; - font-weight: 100; - margin-right: 4px; - color: #b6b6b6; -} - -.ontodia-person-template_property_content_iri-line__iri { - font-size: 12px; - width: 100%; - overflow: hidden; - white-space: nowrap; - text-overflow: ellipsis; -} - -.ontodia-person-template_property_content_iri-line__iri a { - color: #b6b6b6; -} - -.ontodia-person-template_property__image { - width: 100%; - border-top-left-radius: 10px; - border-top-right-radius: 10px; - border-bottom: 1px solid; -} - -.ontodia-person-template_property_content__hr { - margin: 5px 0px 5px 0px; -} - -.ontodia-person-template_property_content_property-table { - font-size: 15px; - font-weight: 100; - max-height: 200px; - overflow-y: scroll; - overflow-x: hidden; -} - -.ontodia-person-template_property_content_property-table_row { - white-space: nowrap; -} - -.ontodia-person-template_property_content_property-table_row__key { - display: inline-block; - width: 50%; - text-overflow: ellipsis; - overflow: hidden; - vertical-align: top; -} - -.ontodia-person-template_property_content_property-table_row_key { - display: inline-block; - width: 50%; - text-overflow: ellipsis; - overflow: hidden; - vertical-align: top; -} - -.ontodia-person-template_property_content_property-table_row_key_values { - display: inline-block; - width: 50%; - text-overflow: ellipsis; - overflow: hidden; -} - -.ontodia-person-template_property_content_property-table_row_key_values__value { - width: 100%; - overflow: hidden; - text-overflow: ellipsis; - white-space: initial; - padding-right: 10px; -} diff --git a/DKBFrontEnd/src/styles/viewUtils/_spinner.scss b/DKBFrontEnd/src/styles/viewUtils/_spinner.scss deleted file mode 100644 index 99f5d8232..000000000 --- a/DKBFrontEnd/src/styles/viewUtils/_spinner.scss +++ /dev/null @@ -1,17 +0,0 @@ -.ontodia-spinner { - &__arrow { - animation-name: ontodia-spinner-rotation; - animation-duration: 1.5s; - animation-timing-function: cubic-bezier(0.645, 0.045, 0.355, 1); - animation-iteration-count: infinite; - } - - &[data-error='true'] &__arrow { - animation-iteration-count: 1; - } -} - -@keyframes ontodia-spinner-rotation { - 0% { transform: rotate(0deg); } - 100% { transform: rotate(360deg); } -} diff --git a/DKBFrontEnd/src/styles/widgets/_classTree.scss b/DKBFrontEnd/src/styles/widgets/_classTree.scss deleted file mode 100644 index 5fee685b5..000000000 --- a/DKBFrontEnd/src/styles/widgets/_classTree.scss +++ /dev/null @@ -1,44 +0,0 @@ -.ontodia-class-tree { - flex: auto; - display: flex; - flex-direction: column; - - &__filter { - flex-shrink: 0; - margin: 10px 0 10px 0; - } - - &__filter-group { - margin-left: 10px; - margin-right: 10px; - } - - &__rest { - height: 0; - flex-grow: 1; - overflow-y: scroll; - border-top: 1px solid rgb(221, 221, 221); - } - - .jstree-icon.default-tree-icon::after { - content: url("../images/tree-leaf.png"); - max-width: 19px; - max-height: 19px; - margin: 2px; - } - - .ontodia-icon { - display: inline-block; - width: 1em; - height: 1em; - background-size: auto 100%; - vertical-align: middle; - } - - .jstree-icon.parent-tree-icon::after { - content: url("../images/tree-leaf-folder.png"); - max-width: 19px; - max-height: 19px; - margin: 2px; - } -} diff --git a/DKBFrontEnd/src/styles/widgets/_instancesSearch.scss b/DKBFrontEnd/src/styles/widgets/_instancesSearch.scss deleted file mode 100644 index c7ecff205..000000000 --- a/DKBFrontEnd/src/styles/widgets/_instancesSearch.scss +++ /dev/null @@ -1,73 +0,0 @@ -.ontodia-instances-search { - flex: auto; - display: flex; - flex-direction: column; - - &__criteria { - flex-shrink: 0; - margin: 10px 0 10px 0; - } - - &__criterions { - padding-left: 15px; - margin-bottom: 10px; - &:empty { margin-bottom: 0; } - } - - &__criterion { - display: block; - position: relative; - width: 100%; - } - - &__criterion-class { - border: black 1px dashed; - background: rgb(255, 210, 33); - padding: 0 .5em 0 .5em; - word-wrap: break-word; - } - - &__criterion-element { - border: black 1px dashed; - background: rgb(255, 131, 92); - padding: 0 .5em 0 .5em; - word-wrap: break-word; - } - - &__criterion-link-type { - border: black 1px dashed; - background: rgb(202, 255, 206); - padding: 0 .5em 0 .5em; - word-wrap: break-word; - } - - &__criterion-remove { - float: right; - margin: 0 10px 4px 4px; - } - - &__text-criteria { margin: 0 10px; } - - &__rest { - height: 0; - flex-grow: 1; - overflow-y: scroll; - border-top: 1px solid rgb(221, 221, 221); - } - - &__results { - padding-left: 0; - padding-top: 10px; - margin: 0 10px 0 10px; - } - - &[data-state='finished'] &__results:empty:before { - content: 'No items correspond to the specified criteria.'; - font-style: italic; - } - - &__rest-end { margin: 5px 10px 15px 10px; } - &__load-more { - width: 100%; - } -} diff --git a/DKBFrontEnd/src/styles/widgets/_linksToolbox.scss b/DKBFrontEnd/src/styles/widgets/_linksToolbox.scss deleted file mode 100644 index 09a553df7..000000000 --- a/DKBFrontEnd/src/styles/widgets/_linksToolbox.scss +++ /dev/null @@ -1,136 +0,0 @@ -.link-types-toolbox { - flex: auto; - display: flex; - flex-direction: column; - margin-bottom: 0; - - &__heading { - padding: 10px; - } - - &__searching-box { - display: flex; - align-items: center; - } - - &__clearSearch { - margin-left: -25px; - -webkit-appearance: none; - padding: 0; - cursor: pointer; - background: 0 0; - border: 0; - } - - &__switch-all { - margin-top: 5px; - } - - &__rest { - border-top: 1px solid #dddddd; - flex: auto; - display: flex; - flex-direction: column; - } -} - -.link-types-toolbox .panel-heading { - flex-shrink: 0; - -webkit-flex-shrink: 0; /* safari 8 */ -} -.link-types-toolbox .link-lists { - flex: auto; - height: 0; - overflow-y: scroll; -} -.link-types-toolbox ul { - margin-bottom: 0; -} -.link-types-toolbox .links-heading { - margin-left: .4em; -} -.link-types-toolbox .links-heading span { - border: black 1px dashed; - background: rgb(255, 131, 92); - padding: 0 .5em 0 .5em; - word-wrap: break-word; - line-height: 1.3; -} - -.link-types-toolbox__heading .link-types-toolbox-controls { - padding: 5px 15px; - font-size: 14px; - font-style: italic; -} -.link-types-toolbox__heading .link-types-toolbox-controls > span { - padding-left: .3em; -} - -.list-group .linkInToolBox { - padding: 0 0 0 5px; - word-break: break-word; -} -.linkInToolBox > div { - display: inline; -} -.linkInToolBox .label { - margin-left: .5em; - white-space: normal; - word-wrap: normal; -} - -.linkInToolBox .badge { - display: none; - margin-left: .5em; - white-space: normal; - word-wrap: normal; -} -.connected-links .linkInToolBox .badge { - /* show connection count badge only in "Connected to Element" list */ - display: inline; -} -.linkInToolBox .link-title { - font-size: 16px; - color: black; - display: inline; -} -.linkInToolBox .btn-group { - float: left; - margin-top: 2px; - margin-right: 6px; - margin-bottom: 2px; -} -.linkInToolBox .btn.btn-default { - border-color: rgb(195, 195, 195); -} -.linkInToolBox .filter-button { - display: none; - float: right; - margin: 3px; - cursor: pointer; - opacity: 0.4; - transition: opacity 200ms 0ms; -} -.linkInToolBox:hover .filter-button { - opacity: 1.0; - transition: opacity 200ms 0ms; -} -.connected-links .linkInToolBox .filter-button { - /* show filter button only in "Connected to Element" list */ - display: inline; -} -.linkInToolBox .filter-button img { - content: url("../images/add-to-filter.png"); - width: 20px; - height: 20px; -} -.link-in-popup-menu .filter-button img { - opacity: 0.4; - margin-left: 10px; - content: url("../images/add-to-filter.png"); - width: 20px; - height: 20px; -} -.link-in-popup-menu .filter-button img:hover { - opacity: 1; -} diff --git a/DKBFrontEnd/src/styles/widgets/_listElementView.scss b/DKBFrontEnd/src/styles/widgets/_listElementView.scss deleted file mode 100644 index b1397c596..000000000 --- a/DKBFrontEnd/src/styles/widgets/_listElementView.scss +++ /dev/null @@ -1,25 +0,0 @@ -.ontodia-list-element-view { - display: block; - background: #808080; - padding: 1px 1px 1px 20px; - border-radius: 10px; - margin: 0 0 2px 0; - opacity: 1.0; - cursor: move; - - &--disabled { - opacity: 0.4; - cursor: default; - } - - &__label { - background: white; - border-radius: 10px; - font-family: "Andale Mono", sans-serif; - font-size: 15px; - min-height: 1.3em; - padding-left: 7px; - padding-right: 5px; - overflow-wrap: break-word; - } -} diff --git a/DKBFrontEnd/src/styles/widgets/_progress.scss b/DKBFrontEnd/src/styles/widgets/_progress.scss deleted file mode 100644 index cf9a87973..000000000 --- a/DKBFrontEnd/src/styles/widgets/_progress.scss +++ /dev/null @@ -1,27 +0,0 @@ -.stateBasedProgress .progress { - flex-shrink: 0; - -webkit-flex-shrink: 0; /* safari 8 */ - width: 100%; - border-radius: 0; - margin-bottom: 0; -} - -.stateBasedProgress:not([data-state]) .progress { - height: 0; -} - -.stateBasedProgress[data-state='querying'] .progress, -.stateBasedProgress[data-state='error'] .progress { - /* property name | duration | delay */ - transition: height 300ms 300ms; -} - -.stateBasedProgress[data-state='error'] .progress-bar { - background-color: #E72F2F; -} - -.stateBasedProgress[data-state='finished'] .progress { - height: 0; - /* property name | duration | delay */ - transition: height 200ms 0ms; -} diff --git a/DKBFrontEnd/src/styles/widgets/_toolbar.scss b/DKBFrontEnd/src/styles/widgets/_toolbar.scss deleted file mode 100644 index 310da42fb..000000000 --- a/DKBFrontEnd/src/styles/widgets/_toolbar.scss +++ /dev/null @@ -1,23 +0,0 @@ -.ontodia-toolbar { - &__language-selector { - padding: 5px; - margin-top: 4px; - - > label > span { vertical-align: middle; } - } -} - -.ontodia-toolbar { - background: rgba(0, 0, 0, 0.15); -} -.ontodia-toolbar > .btn-group { - margin-left: 10px; -} -.ontodia-toolbar > .btn-group > button { - margin-top: 5px; - margin-bottom: 5px; -} -.ontodia-toolbar .ontodia-toolbar__undo, -.ontodia-toolbar .ontodia-toolbar__redo { - display: none; -} diff --git a/DKBFrontEnd/src/styles/workspace/_accordion.scss b/DKBFrontEnd/src/styles/workspace/_accordion.scss deleted file mode 100644 index 63b769599..000000000 --- a/DKBFrontEnd/src/styles/workspace/_accordion.scss +++ /dev/null @@ -1,81 +0,0 @@ -.ontodia-accordion { - flex: auto; - flex-direction: column; - height: 100%; - - &:not(&--resizing) .ontodia-accordion-item { - transition: height 0.3s ease-in-out; - } -} - -.ontodia-accordion-item { - display: flex; - flex-direction: column; - position: relative; - border-top: 1px solid lightgray; - - &__handle { - position: absolute; - height: 5px; - bottom: -2.5px; - left: 0; - width: 100%; - z-index: 2; - cursor: ns-resize; - } - - &__inner { - flex: auto; - display: flex; - flex-direction: column; - overflow: hidden; - } - - &__body { - flex: auto; - display: flex; - flex-direction: column; - } - - &__header { - padding-left: 20px; - position: relative; - - flex-shrink: 0; - font-size: 16px; - background: #E4E4E4; - cursor: default; - /* unselectable */ - -webkit-touch-callout: none; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - - &:before { - border-top: 6px solid #555555; - border-left: 3.5px solid transparent; - border-right: 3.5px solid transparent; - content: ""; - position: absolute; - top: 50%; - left: 7px; - margin-top: -3px; - - -webkit-transition: 0.1s; - -moz-transition: 0.1s; - transition: 0.1s; - } - } - - &--collapsed &__header:before { - -webkit-transform: rotate(-90deg); - -moz-transform: rotate(-90deg); - -ms-transform: rotate(-90deg); - transform: rotate(-90deg); - } - - &--collapsed &__body { - display: none; - } -} diff --git a/DKBFrontEnd/src/styles/workspace/_resizableSidebar.scss b/DKBFrontEnd/src/styles/workspace/_resizableSidebar.scss deleted file mode 100644 index d88b3df36..000000000 --- a/DKBFrontEnd/src/styles/workspace/_resizableSidebar.scss +++ /dev/null @@ -1,73 +0,0 @@ -.ontodia-drag-resizable-column { - display: flex; - flex-direction: column; - position: relative; - - &__handle { - background: #fff url("../images/resizable-column-handle.png") repeat; - height: 100%; - position: absolute; - top: 0; - width: 8px; - z-index: 2; - -webkit-transition: 0.3s; - -moz-transition: 0.3s; - transition: 0.3s; - cursor: ew-resize; - } - - &__handle-btn { - background: #eee; - cursor: pointer; - height: 40px; - position: absolute; - top: 50%; - left: 0; - margin-top: -20px; - width: 100%; - z-index: 1; - -webkit-transition: 0.3s; - -moz-transition: 0.3s; - transition: 0.3s; - - &::before { - background-position: 0 0 ; - background-repeat: no-repeat; - background-size: cover; - content: ""; - height: 6px; - position: absolute; - top: 50%; - left: 50%; - margin-top: -3px; - margin-left: -3px; - width: 6px; - -webkit-transition: 0.3s; - -moz-transition: 0.3s; - transition: 0.3s; - } - - &:hover { - background: #b3b3b3; - transform: scale(1.2); - } - } - - &--closed &__handle-btn { - &::before { transform: rotate(180deg); } - } - - &--docked-left { margin-right: 8px; } - &--docked-left &__handle { right: -8px; } - &--docked-left &__handle-btn { - &::before { background-image: url("../images/arrow-left.png"); } - &:hover::before { background-image: url("../images/arrow-left1.png"); } - } - - &--docked-right { margin-left: 8px; } - &--docked-right &__handle { left: -8px; } - &--docked-right &__handle-btn { - &::before { background-image: url("../images/arrow-right.png"); } - &:hover::before { background-image: url("../images/arrow-right1.png"); } - } -} diff --git a/DKBFrontEnd/src/styles/workspace/_workspace.scss b/DKBFrontEnd/src/styles/workspace/_workspace.scss deleted file mode 100644 index e4fde793f..000000000 --- a/DKBFrontEnd/src/styles/workspace/_workspace.scss +++ /dev/null @@ -1,36 +0,0 @@ -.ontodia { - display: flex; - flex-direction: column; - height: 100%; - box-sizing: border-box; - - &__header { - display: flex; - flex-direction: column; - flex: 0 0 auto; - } - - &__workspace { - display: flex; - flex: auto; - overflow: hidden; - } - - &__main-panel { - display: flex; - flex: auto; - overflow: hidden; - width: 0; - } - - &--unselectable { - -webkit-touch-callout: none; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - } - - &--horizontal-resizing * { cursor: ew-resize !important; } - &--vertical-resizing * { cursor: ns-resize !important; } -} diff --git a/DKBFrontEnd/src/tsconfig.json b/DKBFrontEnd/src/tsconfig.json deleted file mode 100644 index 8f76ebd97..000000000 --- a/DKBFrontEnd/src/tsconfig.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "compilerOptions": { - "target": "es5", - "module": "commonjs", - "jsx": "react", - "lib": [ - "dom", - "es2015" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "noImplicitReturns": true - }, - "include": [ - "./index.ts", - "./src/**/*.ts", - "./src/**/*.tsx", - "./typings/index.d.ts", - "./typings/local.d.ts" - ], - "compileOnSave": false -} diff --git a/DKBFrontEnd/src/tslint.json b/DKBFrontEnd/src/tslint.json deleted file mode 100644 index 601f87a24..000000000 --- a/DKBFrontEnd/src/tslint.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "rules": { - "class-name": true, - "comment-format": [true, "check-space"], - "curly": true, - "eofline": true, - "forin": true, - "indent": [true, "spaces"], - "label-position": true, - "label-undefined": true, - "max-line-length": [true, 120], - "member-access": false, - "member-ordering": [false, "public-before-private", "static-before-instance", "variables-before-functions"], - "no-arg": true, - "no-bitwise": true, - "no-console": [true, "debug", "info", "time", "timeEnd", "trace"], - "no-construct": true, - "no-debugger": true, - "no-duplicate-key": true, - "no-duplicate-variable": true, - "no-empty": true, - "no-eval": true, - "no-inferrable-types": true, - "no-shadowed-variable": true, - "no-string-literal": false, - "no-switch-case-fall-through": true, - "no-trailing-whitespace": true, - "no-unused-expression": true, - "no-unused-variable": true, - "no-unreachable": true, - "no-use-before-declare": true, - "no-var-keyword": true, - "object-literal-sort-keys": false, - "one-line": [true, - "check-open-brace", - "check-catch", - "check-else", - "check-finally", - "check-whitespace" - ], - "quotemark": [true, "single", "avoid-escape"], - "radix": true, - "semicolon": [true, "always"], - "trailing-comma": [true, - { - "singleline": "never", - "multiline": "always" - }], - "triple-equals": [true, "allow-null-check"], - "typedef-whitespace": [true, - { - "call-signature": "nospace", - "index-signature": "nospace", - "parameter": "nospace", - "property-declaration": "nospace", - "variable-declaration": "nospace" - }, { - "call-signature": "onespace", - "index-signature": "onespace", - "parameter": "onespace", - "property-declaration": "onespace", - "variable-declaration": "onespace" - }], - "variable-name": false, - "whitespace": [true, "check-branch", "check-decl", "check-operator", "check-separator", "check-type"] - } -} diff --git a/DKBFrontEnd/src/typings/README b/DKBFrontEnd/src/typings/README deleted file mode 100644 index 4396d8333..000000000 --- a/DKBFrontEnd/src/typings/README +++ /dev/null @@ -1,9 +0,0 @@ -See https://github.com/Microsoft/TypeScript-Handbook/blob/master/pages/declaration%20files/Library%20Structures.md -for declaration files authoring. - -/globals - global libraries installed from Typings -/modules - modular libraries installed from Typings -/local - global libraries authored by us -/local-modules - modular libraries authored by us - -Important: modular libraries should follow pattern {library-name}/index.d.ts diff --git a/DKBFrontEnd/src/typings/globals/jstree/index.d.ts b/DKBFrontEnd/src/typings/globals/jstree/index.d.ts deleted file mode 100644 index a691ccb4c..000000000 --- a/DKBFrontEnd/src/typings/globals/jstree/index.d.ts +++ /dev/null @@ -1,1909 +0,0 @@ -// Generated by typings -// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/00dd9a1cf6c5b748d51e6d470ce6117bb383ea6c/jstree/jstree.d.ts -interface JQueryStatic { - /** - * holds all jstree related functions and variables, - * including the actual class and methods to create, - * access and manipulate instances. - * @property jstree - * @type {JSTreeStatic} - */ - jstree?: JSTreeStatic; -} - -interface JQuery { - /** - * Create an instance, get an instance or invoke a command on a instance. - * - * If there is no instance associated with the current node a new one is created - * and `arg` is used to extend `$.jstree.defaults` for this new instance. There would be no return value (chaining is not broken). - * - * If there is an existing instance and `arg` is a string the command specified by `arg` is executed on the instance, - * with any additional arguments passed to the function. If the function returns a value it will be returned (chaining could break depending on function). - * - * If there is an existing instance and `arg` is not a string the instance itself is returned (similar to `$.jstree.reference`). - * - * In any other case - nothing is returned and chaining is not broken. - * - * __Examples__ - * - * $('#tree1').jstree(); // creates an instance - * $('#tree2').jstree({ plugins : [] }); // create an instance with some options - * $('#tree1').jstree('open_node', '#branch_1'); // call a method on an existing instance, passing additional arguments - * $('#tree2').jstree(); // get an existing instance (or create an instance) - * $('#tree2').jstree(true); // get an existing instance (will not create new instance) - * $('#branch_1').jstree().select_node('#branch_1'); // get an instance (using a nested element and call a method) - * - * @name $().jstree([arg]) - * @param {String|Object} arg - * @return {Mixed} - */ - jstree(): JSTree; - jstree(options: JSTreeStaticDefaults): JSTree; - jstree(arg: boolean): JSTree; - jstree(...args: any[]): any; -} - -interface JSTreeStatic { - /** - * specifies the jstree version in use - * @name $.jstree.version - */ - version: string; - - /** - * holds all the default options used when creating new instances - * @name $.jstree.defaults - */ - defaults: JSTreeStaticDefaults; - - /** - * stores all loaded jstree plugins (used internally) - * @name $.jstree.plugins - */ - plugins: any[]; - path: string; - idregex: any; - root: string; - - /** - * creates a jstree instance - * @name $.jstree.create(el [, options]) - * @param {DOMElement|jQuery|String} el the element to create the instance on, can be jQuery extended or a selector - * @param {Object} options options for this instance (extends `$.jstree.defaults`) - * @return {jsTree} the new instance - */ - create(el: HTMLElement|JQuery|string, options?: JSTreeStaticDefaults): JSTree; - - /** - * remove all traces of jstree from the DOM and destroy all instances - * @name $.jstree.destroy() - */ - destroy(): void; - - /** - * the jstree class constructor, used only internally - * @private - * @name $.jstree.core(id) - * @param {Number} id this instance's index - */ - core(id: number): void; - - /** - * get a reference to an existing instance - * - * __Examples__ - * - * // provided a container with an ID of "tree", and a nested node with an ID of "branch" - * // all of there will return the same instance - * $.jstree.reference('tree'); - * $.jstree.reference('#tree'); - * $.jstree.reference($('#tree')); - * $.jstree.reference(document.getElementByID('tree')); - * $.jstree.reference('branch'); - * $.jstree.reference('#branch'); - * $.jstree.reference($('#branch')); - * $.jstree.reference(document.getElementByID('branch')); - * - * @name $.jstree.reference(needle) - * @param {DOMElement|jQuery|String} needle - * @return {jsTree|null} the instance or `null` if not found - */ - reference(needle: HTMLElement|JQuery|string): JSTree; -} - -interface JSTreeStaticDefaults { - /** - * configure which plugins will be active on an instance. - * Should be an array of strings, where each element is a plugin name. - * The default is `[]` - * @name $.jstree.defaults.plugins - */ - plugins: string[]; - - /** - * stores all defaults for the core - * @name $.jstree.defaults.core - */ - core: JSTreeStaticDefaultsCore; - - /** - * stores all defaults for the checkbox plugin - */ - checkbox?: JSTreeStaticDefaultsCheckbox; - - /** - * stores all defaults for the contextmenu plugin - */ - contextmenu?: JSTreeStaticDefaultsContextMenu; - - /** - * stores all defaults for the drag'n'drop plugin - */ - dnd?: JSTreeStaticDefaultsDragNDrop; - - /** - * Adds massload functionality to jsTree, so that multiple nodes can be loaded in a single request (only useful with lazy loading). - */ - massload?: JSTreeStaticDefaultsMassload; - - /** - * stores all defaults for the search plugin - */ - search?: JSTreeStaticDefaultsSearch; - - /** - * the settings function used to sort the nodes. - * It is executed in the tree's context, accepts two nodes as arguments and should return `1` or `-1`. - * @name $.jstree.defaults.sort - * @plugin sort - */ - sort?: (x: any, y: any) => number; - - /** - * stores all defaults for the state plugin - */ - state?: JSTreeStaticDefaultsState; - - /** - * An object storing all types as key value pairs, - * where the key is the type name and the value is an object - * that could contain following keys (all optional). - * max_children the maximum number of immediate children this node type can have. - * Do not specify or set to -1 for unlimited. - * max_depth the maximum number of nesting this node type can have. - * A value of 1 would mean that the node can have children, but no grandchildren. - * Do not specify or set to -1 for unlimited. - * valid_children an array of node type strings, that nodes of this type can have as children. - * Do not specify or set to -1 for no limits. - * icon a string - can be a path to an icon or a className, if using an image - * that is in the current directory use a ./ prefix, otherwise it will be detected as a class. - * Omit to use the default icon from your theme. - * There are two predefined types: - * # represents the root of the tree, for example max_children would control the maximum number of root nodes. - * default represents the default node - any settings here will be applied to all nodes that do not have a type specified. - */ - types?: any; - - /** - * stores all defaults for the unique plugin - * @name $.jstree.defaults.unique - * @plugin unique - */ - unique?: JSTreeStaticDefaultsUnique; -} - -interface JSTreeStaticDefaultsCore { - /** - * data configuration - * - * If left as `false` the HTML inside the jstree container element is used to populate the tree (that should be an unordered list with list items). - * - * You can also pass in a HTML string or a JSON array here. - * - * It is possible to pass in a standard jQuery-like AJAX config and jstree will automatically determine if the response is JSON or HTML and use that to populate the tree. - * In addition to the standard jQuery ajax options here you can suppy functions for `data` and `url`, the functions will be run in the current instance's scope and a param will be passed indicating which node is being loaded, the return value of those functions will be used. - * - * The last option is to specify a function, that function will receive the node being loaded as argument and a second param which is a function which should be called with the result. - * - * __Examples__ - * - * // AJAX - * $('#tree').jstree({ - * 'core' : { - * 'data' : { - * 'url' : '/get/children/', - * 'data' : function (node) { - * return { 'id' : node.id }; - * } - * } - * }); - * - * // direct data - * $('#tree').jstree({ - * 'core' : { - * 'data' : [ - * 'Simple root node', - * { - * 'id' : 'node_2', - * 'text' : 'Root node with options', - * 'state' : { 'opened' : true, 'selected' : true }, - * 'children' : [ { 'text' : 'Child 1' }, 'Child 2'] - * } - * ] - * }); - * - * // function - * $('#tree').jstree({ - * 'core' : { - * 'data' : function (obj, callback) { - * callback.call(this, ['Root 1', 'Root 2']); - * } - * }); - * - * @name $.jstree.defaults.core.data - */ - data?: any; - - /** - * configure the various strings used throughout the tree - * - * You can use an object where the key is the string you need to replace and the value is your replacement. - * Another option is to specify a function which will be called with an argument of the needed string and should return the replacement. - * If left as `false` no replacement is made. - * - * __Examples__ - * - * $('#tree').jstree({ - * 'core' : { - * 'strings' : { - * 'Loading ...' : 'Please wait ...' - * } - * } - * }); - * - * @name $.jstree.defaults.core.strings - */ - strings?: any; - - /** - * determines what happens when a user tries to modify the structure of the tree - * If left as `false` all operations like create, rename, delete, move or copy are prevented. - * You can set this to `true` to allow all interactions or use a function to have better control. - * - * __Examples__ - * - * $('#tree').jstree({ - * 'core' : { - * 'check_callback' : function (operation, node, node_parent, node_position, more) { - * // operation can be 'create_node', 'rename_node', 'delete_node', 'move_node' or 'copy_node' - * // in case of 'rename_node' node_position is filled with the new node name - * return operation === 'rename_node' ? true : false; - * } - * } - * }); - * - * @name $.jstree.defaults.core.check_callback - */ - check_callback?: any; - - /** - * a callback called with a single object parameter in the instance's scope when something goes wrong (operation prevented, ajax failed, etc) - * @name $.jstree.defaults.core.error - */ - error: () => any; - - /** - * the open / close animation duration in milliseconds - set this to `false` to disable the animation (default is `200`) - * @name $.jstree.defaults.core.animation - */ - animation?: any; - - /** - * a boolean indicating if multiple nodes can be selected - * @name $.jstree.defaults.core.multiple - */ - multiple?: boolean; - - /** - * theme configuration object - * @name $.jstree.defaults.core.themes - */ - themes?: JSTreeStaticDefaultsCoreThemes; - - /** - * if left as `true` all parents of all selected nodes will be opened once the tree loads (so that all selected nodes are visible to the user) - * @name $.jstree.defaults.core.expand_selected_onload - */ - expand_selected_onload?: boolean; - - /** - * if left as `true` web workers will be used to parse incoming JSON data where possible, so that the UI will not be blocked by large requests. - * Workers are however about 30% slower. Defaults to `true` - * @name $.jstree.defaults.core.worker - */ - worker?: boolean; - - /** - * Force node text to plain text (and escape HTML). Defaults to `false` - * @name $.jstree.defaults.core.force_text - */ - force_text?: boolean; - - /** - * Should the node should be toggled if the text is double clicked . Defaults to `true` - * @name $.jstree.defaults.core.dblclick_toggle - */ - dblclick_toggle?: boolean; -} - -interface JSTreeStaticDefaultsCoreThemes { - /** - * the name of the theme to use (if left as `false` the default theme is used) - * @name $.jstree.defaults.core.themes.name - */ - name?: string; - - /** - * the URL of the theme's CSS file, leave this as `false` if you have manually included the theme CSS (recommended). You can set this to `true` too which will try to autoload the theme. - * @name $.jstree.defaults.core.themes.url - */ - url?: string; - - /** - * the location of all jstree themes - only used if `url` is set to `true` - * @name $.jstree.defaults.core.themes.dir - */ - dir?: string; - - /** - * a boolean indicating if connecting dots are shown - * @name $.jstree.defaults.core.themes.dots - */ - dots?: boolean; - - /** - * a boolean indicating if node icons are shown - * @name $.jstree.defaults.core.themes.icons - */ - icons?: boolean; - - /** - * a boolean indicating if the tree background is striped - * @name $.jstree.defaults.core.themes.stripes - */ - stripes?: boolean; - - /** - * a string (or boolean `false`) specifying the theme variant to use (if the theme supports variants) - * @name $.jstree.defaults.core.themes.variant - */ - variant?: any; - - /** - * a boolean specifying if a reponsive version of the theme should kick in on smaller screens (if the theme supports it). Defaults to `false`. - * @name $.jstree.defaults.core.themes.responsive - */ - responsive?: boolean; -} - -interface JSTreeStaticDefaultsCheckbox { - /** - * a boolean indicating if checkboxes should be visible (can be changed at a later time using `show_checkboxes()` and `hide_checkboxes`). Defaults to `true`. - * @name $.jstree.defaults.checkbox.visible - * @plugin checkbox - */ - visible: boolean; - - /** - * a boolean indicating if checkboxes should cascade down and have an undetermined state. Defaults to `true`. - * @name $.jstree.defaults.checkbox.three_state - * @plugin checkbox - */ - three_state: boolean; - - /** - * a boolean indicating if clicking anywhere on the node should act as clicking on the checkbox. Defaults to `true`. - * @name $.jstree.defaults.checkbox.whole_node - * @plugin checkbox - */ - whole_node: boolean; - - /** - * a boolean indicating if the selected style of a node should be kept, or removed. Defaults to `true`. - * @name $.jstree.defaults.checkbox.keep_selected_style - * @plugin checkbox - */ - keep_selected_style: boolean; - - /** - * This setting controls how cascading and undetermined nodes are applied. - * If 'up' is in the string - cascading up is enabled, if 'down' is in the string - cascading down is enabled, if 'undetermined' is in the string - undetermined nodes will be used. - * If `three_state` is set to `true` this setting is automatically set to 'up+down+undetermined'. Defaults to ''. - * @name $.jstree.defaults.checkbox.cascade - * @plugin checkbox - */ - cascade: boolean; - - /** - * This setting controls if checkbox are bound to the general tree selection - * or to an internal array maintained by the checkbox plugin. - * Defaults to `true`, only set to `false` if you know exactly what you are doing. - * @name $.jstree.defaults.checkbox.tie_selection - * @plugin checkbox - */ - tie_selection: boolean; -} - -interface JSTreeStaticDefaultsContextMenu { - /** - * a boolean indicating if the node should be selected when the context menu is invoked on it. Defaults to `true`. - * @name $.jstree.defaults.contextmenu.select_node - * @plugin contextmenu - */ - select_node: boolean; - - /** - * a boolean indicating if the menu should be shown aligned with the node. Defaults to `true`, otherwise the mouse coordinates are used. - * @name $.jstree.defaults.contextmenu.show_at_node - * @plugin contextmenu - */ - show_at_node: boolean; - - /** - * an object of actions, or a function that accepts a node and a callback function and calls the callback function with an object of actions available for that node (you can also return the items too). - * - * Each action consists of a key (a unique name) and a value which is an object with the following properties (only label and action are required). Once a menu item is activated the `action` function will be invoked with an object containing the following keys: item - the contextmenu item definition as seen below, reference - the DOM node that was used (the tree node), element - the contextmenu DOM element, position - an object with x/y properties indicating the position of the menu. - * - * * `separator_before` - a boolean indicating if there should be a separator before this item - * * `separator_after` - a boolean indicating if there should be a separator after this item - * * `_disabled` - a boolean indicating if this action should be disabled - * * `label` - a string - the name of the action (could be a function returning a string) - * * `title` - a string - an optional tooltip for the item - * * `action` - a function to be executed if this item is chosen, the function will receive - * * `icon` - a string, can be a path to an icon or a className, if using an image that is in the current directory use a `./` prefix, otherwise it will be detected as a class - * * `shortcut` - keyCode which will trigger the action if the menu is open (for example `113` for rename, which equals F2) - * * `shortcut_label` - shortcut label (like for example `F2` for rename) - * * `submenu` - an object with the same structure as $.jstree.defaults.contextmenu.items which can be used to create a submenu - each key will be rendered as a separate option in a submenu that will appear once the current item is hovered - * - * @name $.jstree.defaults.contextmenu.items - * @plugin contextmenu - */ - items: any; -} - -interface JSTreeStaticDefaultsDragNDrop { - /** - * a boolean indicating if a copy should be possible while dragging (by pressint the meta key or Ctrl). Defaults to `true`. - * @name $.jstree.defaults.dnd.copy - * @plugin dnd - */ - copy: boolean; - - /** - * a number indicating how long a node should remain hovered while dragging to be opened. Defaults to `500`. - * @name $.jstree.defaults.dnd.open_timeout - * @plugin dnd - */ - open_timeout: number; - - /** - * a function invoked each time a node is about to be dragged, invoked in the tree's scope and receives the nodes about to be dragged as an argument (array) - return `false` to prevent dragging - * @name $.jstree.defaults.dnd.is_draggable - * @plugin dnd - */ - is_draggable: boolean; - - /** - * a boolean indicating if checks should constantly be made while the user is dragging the node (as opposed to checking only on drop), default is `true` - * @name $.jstree.defaults.dnd.check_while_dragging - * @plugin dnd - */ - check_while_dragging: boolean; - - /** - * a boolean indicating if nodes from this tree should only be copied with dnd (as opposed to moved), default is `false` - * @name $.jstree.defaults.dnd.always_copy - * @plugin dnd - */ - always_copy: boolean; - - /** - * when dropping a node "inside", this setting indicates the position the node should go to - it can be an integer or a string: "first" (same as 0) or "last", default is `0` - * @name $.jstree.defaults.dnd.inside_pos - * @plugin dnd - */ - inside_pos: any; - - /** - * when starting the drag on a node that is selected this setting controls if all selected nodes are dragged or only the single node, default is `true`, which means all selected nodes are dragged when the drag is started on a selected node - * @name $.jstree.defaults.dnd.drag_selection - * @plugin dnd - */ - drag_selection: boolean; - - /** - * controls whether dnd works on touch devices. If left as boolean true dnd will work the same as in desktop browsers, which in some cases may impair scrolling. If set to boolean false dnd will not work on touch devices. There is a special third option - string "selected" which means only selected nodes can be dragged on touch devices. - * @name $.jstree.defaults.dnd.touch - * @plugin dnd - */ - touch: boolean; - - /** - * controls whether items can be dropped anywhere on the node, not just on the anchor, by default only the node anchor is a valid drop target. Works best with the wholerow plugin. If enabled on mobile depending on the interface it might be hard for the user to cancel the drop, since the whole tree container will be a valid drop target. - * @name $.jstree.defaults.dnd.large_drop_target - * @plugin dnd - */ - large_drop_target: boolean; - - /** - * controls whether a drag can be initiated from any part of the node and not just the text/icon part, works best with the wholerow plugin. Keep in mind it can cause problems with tree scrolling on mobile depending on the interface - in that case set the touch option to "selected". - * @name $.jstree.defaults.dnd.large_drag_target - * @plugin dnd - */ - large_drag_target: boolean; - - /** - * controls whether use HTML5 dnd api instead of classical. That will allow better integration of dnd events with other HTML5 controls. - * @reference http://caniuse.com/#feat=dragndrop - * @name $.jstree.defaults.dnd.use_html5 - * @plugin dnd - */ - use_html5: boolean; -} - -interface JSTreeStaticDefaultsMassload { - /** - * massload configuration - * - * It is possible to set this to a standard jQuery-like AJAX config. - * In addition to the standard jQuery ajax options here you can supply functions for `data` and `url`, the functions will be run in the current instance's scope and a param will be passed indicating which node IDs need to be loaded, the return value of those functions will be used. - * - * You can also set this to a function, that function will receive the node IDs being loaded as argument and a second param which is a function (callback) which should be called with the result. - * - * Both the AJAX and the function approach rely on the same return value - an object where the keys are the node IDs, and the value is the children of that node as an array. - * - * { - * "id1" : [{ "text" : "Child of ID1", "id" : "c1" }, { "text" : "Another child of ID1", "id" : "c2" }], - * "id2" : [{ "text" : "Child of ID2", "id" : "c3" }] - * } - * - * @name $.jstree.defaults.massload - * @plugin massload - */ - - url: any; - - data: any; -} - -interface JSTreeStaticDefaultsSearch { - /** - * a jQuery-like AJAX config, which jstree uses if a server should be queried for results. - * - * A `str` (which is the search string) parameter will be added with the request, - * an optional `inside` parameter will be added if the search is limited to a node id. - * The expected result is a JSON array with nodes that need to be opened so that matching nodes will be revealed. - * Leave this setting as `false` to not query the server. You can also set this to a function, - * which will be invoked in the instance's scope and receive 3 parameters - the search string, - * the callback to call with the array of nodes to load, and the optional node ID to limit the search to - * @name $.jstree.defaults.search.ajax - * @plugin search - */ - ajax: any; - - /** - * Indicates if the search should be fuzzy or not (should `chnd3` match `child node 3`). Default is `true`. - * @name $.jstree.defaults.search.fuzzy - * @plugin search - */ - fuzzy: boolean; - - /** - * Indicates if the search should be case sensitive. Default is `false`. - * @name $.jstree.defaults.search.case_sensitive - * @plugin search - */ - case_sensitive: boolean; - - /** - * Indicates if the tree should be filtered (by default) to show only matching nodes - * (keep in mind this can be a heavy on large trees in old browsers). - * This setting can be changed at runtime when calling the search method. Default is `false`. - * @name $.jstree.defaults.search.show_only_matches - * @plugin search - */ - show_only_matches: boolean; - - /** - * Indicates if the children of matched element are shown (when show_only_matches is true) - * This setting can be changed at runtime when calling the search method. Default is `false`. - * @name $.jstree.defaults.search.show_only_matches_children - * @plugin search - */ - show_only_matches_children: boolean; - - /** - * Indicates if all nodes opened to reveal the search result, - * should be closed when the search is cleared or a new search is performed. Default is `true`. - * @name $.jstree.defaults.search.close_opened_onclear - * @plugin search - */ - close_opened_onclear: boolean; - - /** - * Indicates if only leaf nodes should be included in search results. Default is `false`. - * @name $.jstree.defaults.search.search_leaves_only - * @plugin search - */ - search_leaves_only: boolean; - - /** - * If set to a function it wil be called in the instance's scope with two arguments - - * search string and node (where node will be every node in the structure, so use with caution). - * If the function returns a truthy value the node will be considered a match - * (it might not be displayed if search_only_leaves is set to true and the node is not a leaf). Default is `false`. - * @name $.jstree.defaults.search.search_callback - * @plugin search - */ - search_callback: any; -} - -interface JSTreeStaticDefaultsState { - /** - * A string for the key to use when saving the current tree (change if using multiple trees in your project). Defaults to `jstree`. - * @name $.jstree.defaults.state.key - * @plugin state - */ - key: string; - - /** - * A space separated list of events that trigger a state save. Defaults to `changed.jstree open_node.jstree close_node.jstree`. - * @name $.jstree.defaults.state.events - * @plugin state - */ - events: string; - - /** - * Time in milliseconds after which the state will expire. Defaults to 'false' meaning - no expire. - * @name $.jstree.defaults.state.ttl - * @plugin state - */ - ttl: any; - - /** - * A function that will be executed prior to restoring state with one argument - the state object. Can be used to clear unwanted parts of the state. - * @name $.jstree.defaults.state.filter - * @plugin state - */ - filter: any; -} - -interface JSTreeStaticDefaultsUnique { - /** - * Indicates if the comparison should be case sensitive. Default is `false`. - * @name $.jstree.defaults.unique.case_sensitive - * @plugin unique - */ - case_sensitive: boolean; - /** - * A callback executed in the instance's scope when a new node is created - * and the name is already taken, the two arguments are the conflicting name and the counter. - * The default will produce results like `New node (2)`. - * @name $.jstree.defaults.unique.duplicate - * @plugin unique - */ - duplicate: (name: string, counter: number) => string; -} - -interface JSTree extends JQuery { - /** - * used to decorate an instance with a plugin. Used internally. - * @private - * @name plugin(deco [, opts]) - * @param {String} deco the plugin to decorate with - * @param {Object} opts options for the plugin - * @return {jsTree} - */ - plugin: (deco: string, opts?: any) => JSTree; - - /** - * used to decorate an instance with a plugin. Used internally. - * @private - * @name init(el, options) - * @param {DOMElement|jQuery|String} el the element we are transforming - * @param {Object} options options for this instance - * @trigger init.jstree, loading.jstree, loaded.jstree, ready.jstree, changed.jstree - */ - init: (el: HTMLElement|JQuery|string, options:any) => void; - - /** - * destroy an instance - * @name destroy() - * @param {Boolean} keep_html if not set to `true` the container will be emptied, otherwise the current DOM elements will be kept intact - */ - destroy: (keep_html?: boolean) => void; - - /** - * part of the destroying of an instance. Used internally. - * @private - * @name teardown() - */ - teardown: () => void; - - /** - * bind all events. Used internally. - * @private - * @name bind() - */ - bind: () => any; - - /** - * part of the destroying of an instance. Used internally. - * @private - * @name unbind() - */ - unbind: () => any; - - /** - * trigger an event. Used internally. - * @private - * @name trigger(ev [, data]) - * @param {String} ev the name of the event to trigger - * @param {Object} data additional data to pass with the event - */ - /* - * defined in JQuery - */ - // trigger: (ev: string, data?: Object) => any; - - /** - * returns the jQuery extended instance container - * @name get_container() - * @return {jQuery} - */ - get_container: () => JQuery; - - /** - * returns the jQuery extended main UL node inside the instance container. Used internally. - * @private - * @name get_container_ul() - * @return {jQuery} - */ - get_container_ul: () => JQuery; - - /** - * gets string replacements (localization). Used internally. - * @private - * @name get_string(key) - * @param {String} key - * @return {String} - */ - get_string: (key: string) => string; - - /** - * gets the first child of a DOM node. Used internally. - * @private - * @name _firstChild(dom) - * @param {DOMElement} dom - * @return {DOMElement} - */ - _firstChild: (dom: HTMLElement) => HTMLElement; - - /** - * gets the next sibling of a DOM node. Used internally. - * @private - * @name _nextSibling(dom) - * @param {DOMElement} dom - * @return {DOMElement} - */ - _nextSibling: (dom: HTMLElement) => HTMLElement; - - /** - * gets the previous sibling of a DOM node. Used internally. - * @private - * @name _previousSibling(dom) - * @param {DOMElement} dom - * @return {DOMElement} - */ - _previousSibling: (dom: HTMLElement) => HTMLElement; - - /** - * get the JSON representation of a node (or the actual jQuery extended DOM node) by using any input (child DOM element, ID string, selector, etc) - * @name get_node(obj [, as_dom]) - * @param {mixed} obj - * @param {Boolean} as_dom - * @return {Object|jQuery} - */ - get_node: (obj: any, as_dom?: boolean) => any; - - /** - * get the path to a node, either consisting of node texts, or of node IDs, optionally glued together (otherwise an array) - * @name get_path(obj [, glue, ids]) - * @param {mixed} obj the node - * @param {String} glue if you want the path as a string - pass the glue here (for example '/'), if a falsy value is supplied here, an array is returned - * @param {Boolean} ids if set to true build the path using ID, otherwise node text is used - * @return {mixed} - */ - get_path: (obj: any, glue?: string, ids?: boolean) => any; - - /** - * get the next visible node that is below the `obj` node. If `strict` is set to `true` only sibling nodes are returned. - * @name get_next_dom(obj [, strict]) - * @param {mixed} obj - * @param {Boolean} strict - * @return {jQuery} - */ - get_next_dom: (obj: any, strict?: boolean) => JQuery; - - /** - * get the previous visible node that is above the `obj` node. If `strict` is set to `true` only sibling nodes are returned. - * @name get_prev_dom(obj [, strict]) - * @param {mixed} obj - * @param {Boolean} strict - * @return {jQuery} - */ - get_prev_dom: (obj: any, strict?: boolean) => JQuery; - - /** - * get the parent ID of a node - * @name get_parent(obj) - * @param {mixed} obj - * @return {String} - */ - get_parent: (obj: any) => string; - - /** - * get a jQuery collection of all the children of a node (node must be rendered) - * @name get_children_dom(obj) - * @param {mixed} obj - * @return {jQuery} - */ - get_children_dom: (obj: any) => JQuery; - - /** - * checks if a node has children - * @name is_parent(obj) - * @param {mixed} obj - * @return {Boolean} - */ - is_parent: (obj: any) => boolean; - - /** - * checks if a node is loaded (its children are available) - * @name is_loaded(obj) - * @param {mixed} obj - * @return {Boolean} - */ - is_loaded: (obj: any) => boolean; - - /** - * check if a node is currently loading (fetching children) - * @name is_loading(obj) - * @param {mixed} obj - * @return {Boolean} - */ - is_loading: (obj: any) => boolean; - - /** - * check if a node is opened - * @name is_open(obj) - * @param {mixed} obj - * @return {Boolean} - */ - is_open: (obj: any) => boolean; - - /** - * check if a node is in a closed state - * @name is_closed(obj) - * @param {mixed} obj - * @return {Boolean} - */ - is_closed: (obj: any) => boolean; - - /** - * check if a node has no children - * @name is_leaf(obj) - * @param {mixed} obj - * @return {Boolean} - */ - is_leaf: (obj: any) => boolean; - - /** - * loads a node (fetches its children using the `core.data` setting). Multiple nodes can be passed to by using an array. - * @name load_node(obj [, callback]) - * @param {mixed} obj - * @param {function} callback a function to be executed once loading is conplete, the function is executed in the instance's scope - * and receives two arguments - the node and a boolean status - * @return {Boolean} - * @trigger load_node.jstree - */ - load_node: (obj: any, callback: (node: any, status: boolean) => void) => boolean; - - /** - * load an array of nodes (will also load unavailable nodes as soon as the appear in the structure). Used internally. - * @private - * @name _load_nodes(nodes [, callback]) - * @param {array} nodes - * @param {function} callback a function to be executed once loading is complete, the function is executed in the instance's scope and receives one argument - the array passed to _load_nodes - * @param {Boolean} is_callback - if false reloads node (AP - original comment missing in source code) - * @param {Boolean} force_reload - if true force reloads node (AP - original comment missing in source code) - */ - _load_nodes: (nodes: any[], callback?: (nodes: any[]) => void, is_callback?: boolean, force_reload?: boolean) => void; - - /** - * loads all unloaded nodes - * @name load_all([obj, callback]) - * @param {mixed} obj the node to load recursively, omit to load all nodes in the tree - * @param {function} callback a function to be executed once loading all the nodes is complete, - * @trigger load_all.jstree - */ - load_all: (obj: any, callback: () => void) => void; - - /** - * handles the actual loading of a node. Used only internally. - * @private - * @name _load_node(obj [, callback]) - * @param {mixed} obj - * @param {function} callback a function to be executed once loading is complete, the function is executed in the instance's scope and receives one argument - a boolean status - * @return {Boolean} - */ - _load_node: (obj: any, callback?: (status: boolean) => void) => boolean; - - /** - * adds a node to the list of nodes to redraw. Used only internally. - * @private - * @name _node_changed(obj) - * @param {mixed} obj - */ - _node_changed: (obj: any) => void; - - /** - * appends HTML content to the tree. Used internally. - * @private - * @name _append_html_data(obj, data) - * @param {mixed} obj the node to append to - * @param {String} data the HTML string to parse and append - * @param {function} callback function which takes boolean flag executes after append (AP: originally lack of comment) - * @trigger model.jstree, changed.jstree - */ - _append_html_data: (dom: any, data: string, cb: (flag: boolean) => void) => void; - - /** - * appends JSON content to the tree. Used internally. - * @private - * @name _append_json_data(obj, data) - * @param {mixed} dom the node to append to - * @param {String} data the JSON object to parse and append - * @param {function} cb function which takes boolean flag executes after append (AP: originally lack of comment) - * @param {Boolean} force_processing internal param - do not set - * @trigger model.jstree, changed.jstree - */ - _append_json_data: (dom: any, data: string, cb: (flag: boolean) => void, force_processing: boolean) => void; - - /** - * parses a node from a jQuery object and appends them to the in memory tree model. Used internally. - * @private - * @name _parse_model_from_html(d [, p, ps]) - * @param {jQuery} d the jQuery object to parse - * @param {String} p the parent ID - * @param {Array} ps list of all parents - * @return {String} the ID of the object added to the model - */ - _parse_model_from_html: (d: JQuery, p?: string, ps?: any[]) => string; - - /** - * parses a node from a JSON object (used when dealing with flat data, which has no nesting of children, but has id and parent properties) and appends it to the in memory tree model. Used internally. - * @private - * @name _parse_model_from_flat_json(d [, p, ps]) - * @param {Object} d the JSON object to parse - * @param {String} p the parent ID - * @param {Array} ps list of all parents - * @return {String} the ID of the object added to the model - */ - _parse_model_from_flat_json: (d: any, p?: string, ps?: any[]) => string; - - /** - * parses a node from a JSON object and appends it to the in memory tree model. Used internally. - * @private - * @name _parse_model_from_json(d [, p, ps]) - * @param {Object} d the JSON object to parse - * @param {String} p the parent ID - * @param {Array} ps list of all parents - * @return {String} the ID of the object added to the model - */ - _parse_model_from_json: (d: any, p?: string, ps?: any[]) => string; - - /** - * redraws all nodes that need to be redrawn. Used internally. - * @private - * @name _redraw() - * @trigger redraw.jstree - */ - _redraw: () => void ; - - /** - * redraws all nodes that need to be redrawn or optionally - the whole tree - * @name redraw([full]) - * @param {Boolean} full if set to `true` all nodes are redrawn. - */ - redraw: (full?: boolean) => void; - - /** - * redraws a single node's children. Used internally. - * @private - * @name draw_children(node) - * @param {mixed} node the node whose children will be redrawn - */ - draw_children: (node: any) => void; - - /** - * redraws a single node. Used internally. - * @private - * @name redraw_node(node, deep, is_callback, force_render) - * @param {mixed} node the node to redraw - * @param {Boolean} deep should child nodes be redrawn too - * @param {Boolean} is_callback is this a recursion call - * @param {Boolean} force_render should children of closed parents be drawn anyway - */ - redraw_node: (node: any, deep: boolean, is_callback: boolean, force_render: boolean) => void; - - /** - * opens a node, revaling its children. If the node is not loaded it will be loaded and opened once ready. - * @name open_node(obj [, callback, animation]) - * @param {mixed} obj the node to open - * @param {Function} callback a function to execute once the node is opened - * @param {Number} animation the animation duration in milliseconds - * when opening the node (overrides the `core.animation` setting). Use `false` for no animation. - * @trigger open_node.jstree, after_open.jstree, before_open.jstree - */ - open_node: (obj: any, callback?: any, animation?: any) => void; - - /** - * opens every parent of a node (node should be loaded) - * @name _open_to(obj) - * @param {mixed} obj the node to reveal - * @private - */ - _open_to: (obj:any) => void; - - /** - * closes a node, hiding its children - * @name close_node(obj [, animation]) - * @param {mixed} obj the node to close - * @param {Number} animation the animation duration in milliseconds - * when closing the node (overrides the `core.animation` setting). Use `false` for no animation. - * @trigger close_node.jstree, after_close.jstree - */ - close_node: (obj: any, animation?: any) => void; - - /** - * toggles a node - closing it if it is open, opening it if it is closed - * @name toggle_node(obj) - * @param {mixed} obj the node to toggle - */ - toggle_node: (obj: any) => void; - - /** - * opens all nodes within a node (or the tree), revaling their children. If the node is not loaded it will be loaded and opened once ready. - * @name open_all([obj, animation, original_obj]) - * @param {mixed} obj the node to open recursively, omit to open all nodes in the tree - * @param {Number} animation the animation duration in milliseconds when opening the nodes, the default is no animation - * @param {jQuery} reference to the node that started the process (internal use) - * @trigger open_all.jstree - */ - open_all: (obj?: any, animation?: number, original_obj?: any) => void; - - /** - * closes all nodes within a node (or the tree), revaling their children - * @name close_all([obj, animation]) - * @param {mixed} obj the node to close recursively, omit to close all nodes in the tree - * @param {Number} animation the animation duration in milliseconds when closing the nodes, the default is no animation - * @trigger close_all.jstree - */ - close_all: (obj?: any, animation?: number) => void; - - /** - * checks if a node is disabled (not selectable) - * @name is_disabled(obj) - * @param {mixed} obj - * @return {Boolean} - */ - is_disabled: (obj: any) => boolean; - - /** - * enables a node - so that it can be selected - * @name enable_node(obj) - * @param {mixed} obj the node to enable - * @trigger enable_node.jstree - */ - enable_node: (obj: any) => boolean; - - /** - * disables a node - so that it can not be selected - * @name disable_node(obj) - * @param {mixed} obj the node to disable - * @trigger disable_node.jstree - */ - disable_node: (obj: any) => boolean; - - /** - * determines if a node is hidden - * @name is_hidden(obj) - * @param {mixed} obj the node - */ - is_hidden: (obj: any) => boolean; - - /** - * hides a node - it is still in the structure but will not be visible - * @name hide_node(obj) - * @param {mixed} obj the node to hide - * @param {Boolean} skip_redraw internal parameter controlling if redraw is called - * @trigger hide_node.jstree - */ - hide_node: (obj: any, skip_redraw: boolean) => boolean; - - /** - * shows a node - * @name show_node(obj) - * @param {mixed} obj the node to show - * @param {Boolean} skip_redraw internal parameter controlling if redraw is called - * @trigger show_node.jstree - */ - show_node: (obj: any, skip_redraw: boolean) => boolean; - - /** - * hides all nodes - * @name hide_all() - * @trigger hide_all.jstree - */ - hide_all: (skip_redraw: boolean) => boolean; - - /** - * shows all nodes - * @name show_all() - * @trigger show_all.jstree - */ - show_all: (skip_redraw: boolean) => boolean; - - /** - * called when a node is selected by the user. Used internally. - * @private - * @name activate_node(obj, e) - * @param {mixed} obj the node - * @param {Object} e the related event - * @trigger activate_node.jstree, changed.jstree - */ - activate_node: (obj: any, e: any) => void; - - /** - * applies the hover state on a node, called when a node is hovered by the user. Used internally. - * @private - * @name hover_node(obj) - * @param {mixed} obj - * @trigger hover_node.jstree - */ - hover_node: (obj: any) => void; - - /** - * removes the hover state from a nodecalled when a node is no longer hovered by the user. Used internally. - * @private - * @name dehover_node(obj) - * @param {mixed} obj - * @trigger dehover_node.jstree - */ - dehover_node: (obj: any) => void; - - /** - * select a node - * @name select_node(obj [, supress_event, prevent_open]) - * @param {mixed} obj an array can be used to select multiple nodes - * @param {Boolean} supress_event if set to `true` the `changed.jstree` event won't be triggered - * @param {Boolean} prevent_open if set to `true` parents of the selected node won't be opened - * @trigger select_node.jstree, changed.jstree - */ - select_node: (obj: any, supress_event?: boolean, prevent_open?: boolean, e?: any) => any; - - /** - * deselect a node - * @name deselect_node(obj [, supress_event]) - * @param {mixed} obj an array can be used to deselect multiple nodes - * @param {Boolean} supress_event if set to `true` the `changed.jstree` event won't be triggered - * @trigger deselect_node.jstree, changed.jstree - */ - deselect_node: (obj: any, supress_event?: boolean, e?: any) => void; - - /** - * select all nodes in the tree - * @name select_all([supress_event]) - * @param {Boolean} supress_event if set to `true` the `changed.jstree` event won't be triggered - * @trigger select_all.jstree, changed.jstree - */ - select_all: (supress_event?: boolean) => void; - - /** - * deselect all selected nodes - * @name deselect_all([supress_event]) - * @param {Boolean} supress_event if set to `true` the `changed.jstree` event won't be triggered - * @trigger deselect_all.jstree, changed.jstree - */ - deselect_all: (supress_event?: boolean) => void; - - /** - * checks if a node is selected - * @name is_selected(obj) - * @param {mixed} obj - * @return {Boolean} - */ - is_selected: (obj: any) => boolean; - - /** - * get an array of all selected nodes - * @name get_selected([full]) - * @param {mixed} full if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned - * @return {Array} - */ - get_selected: (full?: any) => any[]; - - /** - * get an array of all top level selected nodes (ignoring children of selected nodes) - * @name get_top_selected([full]) - * @param {mixed} full if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned - * @return {Array} - */ - get_top_selected: (full?: any) => any[]; - - /** - * get an array of all bottom level selected nodes (ignoring selected parents) - * @name get_top_selected([full]) - * @param {mixed} full if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned - * @return {Array} - */ - get_bottom_selected: (full?: any) => any[]; - - /** - * gets the current state of the tree so that it can be restored later with `set_state(state)`. Used internally. - * @name get_state() - * @private - * @return {Object} - */ - get_state: () => any; - - /** - * sets the state of the tree. Used internally. - * @name set_state(state [, callback]) - * @private - * @param {Object} state the state to restore - * @param {Function} callback an optional function to execute once the state is restored. - * @trigger set_state.jstree - */ - set_state: (state: any, callback: () => void) => void; - - /** - * refreshes the tree - all nodes are reloaded with calls to `load_node`. - * @name refresh() - * @param {Boolean} skip_loading an option to skip showing the loading indicator - * @param {Mixed} forget_state if set to `true` state will not be reapplied, - * if set to a function (receiving the current state as argument) the result of that function will be used as state - * @trigger refresh.jstree - */ - refresh: (skip_loading: boolean, forget_state: any) => void; - - /** - * refreshes a node in the tree (reload its children) all opened nodes inside that node are reloaded with calls to `load_node`. - * @name refresh_node(obj) - * @param {mixed} obj the node - * @trigger refresh_node.jstree - */ - refresh_node: (obj: any) => void; - - /** - * set (change) the ID of a node - * @name set_id(obj, id) - * @param {mixed} obj the node - * @param {String} id the new ID - * @return {Boolean} - */ - set_id: (obj: any, id: string) => boolean; - - /** - * get the text value of a node - * @name get_text(obj) - * @param {mixed} obj the node - * @return {String} - */ - get_text: (obj: any) => string; - - /** - * set the text value of a node. Used internally, please use `rename_node(obj, val)`. - * @private - * @name set_text(obj, val) - * @param {mixed} obj the node, you can pass an array to set the text on multiple nodes - * @param {String} val the new text value - * @return {Boolean} - * @trigger set_text.jstree - */ - set_text: (obj:any, val:string) => boolean; - - /** - * gets a JSON representation of a node (or the whole tree) - * @name get_json([obj, options]) - * @param {mixed} obj - * @param {Object} options - * @param {Boolean} options.no_state do not return state information - * @param {Boolean} options.no_id do not return ID - * @param {Boolean} options.no_children do not include children - * @param {Boolean} options.no_data do not include node data - * @param {Boolean} options.no_li_attr do not include LI attributes - * @param {Boolean} options.no_a_attr do not include A attributes - * @param {Boolean} options.flat return flat JSON instead of nested - * @return {Object} - */ - get_json: (obj?: any, options?: JSTreeGetJsonOptions, flat?: boolean) => any; - - /** - * create a new node (do not confuse with load_node) - * @name create_node([obj, node, pos, callback, is_loaded]) - * @param {mixed} par the parent node (to create a root node use either "#" (string) or `null`) - * @param {mixed} node the data for the new node (a valid JSON object, or a simple string with the name) - * @param {mixed} pos the index at which to insert the node, "first" and "last" are also supported, default is "last" - * @param {Function} callback a function to be called once the node is created - * @param {Boolean} is_loaded internal argument indicating if the parent node was succesfully loaded - * @return {String} the ID of the newly create node - * @trigger model.jstree, create_node.jstree - */ - create_node: (par?: any, node?: any, pos?: any, callback?: any, is_loaded?: boolean) => string; - - /** - * set the text value of a node - * @name rename_node(obj, val) - * @param {mixed} obj the node, you can pass an array to rename multiple nodes to the same name - * @param {String} val the new text value - * @return {Boolean} - * @trigger rename_node.jstree - */ - rename_node: (obj: any, val: string) => boolean; - - /** - * remove a node - * @name delete_node(obj) - * @param {mixed} obj the node, you can pass an array to delete multiple nodes - * @return {Boolean} - * @trigger delete_node.jstree, changed.jstree - */ - delete_node: (obj: any) => boolean; - - /** - * check if an operation is premitted on the tree. Used internally. - * @private - * @name check(chk, obj, par, pos) - * @param {String} chk the operation to check, can be "create_node", "rename_node", "delete_node", "copy_node" or "move_node" - * @param {mixed} obj the node - * @param {mixed} par the parent - * @param {mixed} pos the position to insert at, or if "rename_node" - the new name - * @param {mixed} more some various additional information, for example if a "move_node" operations is triggered by DND this will be the hovered node - * @return {Boolean} - */ - check: (chk: string, obj: any, par: any, pos: any, more: any) => boolean; - - /** - * get the last error - * @name last_error() - * @return {Object} - */ - last_error: () => any; - - /** - * move a node to a new parent - * @name move_node(obj, par [, pos, callback, is_loaded]) - * @param {mixed} obj the node to move, pass an array to move multiple nodes - * @param {mixed} par the new parent - * @param {mixed} pos the position to insert at (besides integer values, "first" and "last" are supported, as well as "before" and "after"), defaults to integer `0` - * @param {function} callback a function to call once the move is completed, receives 3 arguments - the node, the new parent and the position - * @param {Boolean} is_loaded internal parameter indicating if the parent node has been loaded - * @param {Boolean} skip_redraw internal parameter indicating if the tree should be redrawn - * @param {Boolean} instance internal parameter indicating if the node comes from another instance - * @trigger move_node.jstree - */ - move_node: (obj: any, par: any, pos?: any, callback?: (node: any, new_par: any, pos: any) => void, is_loaded?: boolean, skip_redraw?: boolean, origin?: boolean) => void; - - /** - * copy a node to a new parent - * @name copy_node(obj, par [, pos, callback, is_loaded]) - * @param {mixed} obj the node to copy, pass an array to copy multiple nodes - * @param {mixed} par the new parent - * @param {mixed} pos the position to insert at (besides integer values, "first" and "last" are supported, as well as "before" and "after"), defaults to integer `0` - * @param {function} callback a function to call once the move is completed, receives 3 arguments - the node, the new parent and the position - * @param {Boolean} is_loaded internal parameter indicating if the parent node has been loaded - * @param {Boolean} skip_redraw internal parameter indicating if the tree should be redrawn - * @param {Boolean} instance internal parameter indicating if the node comes from another instance - * @trigger model.jstree copy_node.jstree - */ - copy_node: (obj: any, par: any, pos?: any, callback?: (node: any, new_par: any, pos: any) => void, is_loaded?: boolean, skip_redraw?: boolean, origin?: boolean) => void; - - /** - * cut a node (a later call to `paste(obj)` would move the node) - * @name cut(obj) - * @param {mixed} obj multiple objects can be passed using an array - * @trigger cut.jstree - */ - cut: (obj: any) => void; - - /** - * copy a node (a later call to `paste(obj)` would copy the node) - * @name copy(obj) - * @param {mixed} obj multiple objects can be passed using an array - * @trigger copy.jstre - */ - copy: (obj: any) => void; - - /** - * get the current buffer (any nodes that are waiting for a paste operation) - * @name get_buffer() - * @return {Object} an object consisting of `mode` ("copy_node" or "move_node"), `node` (an array of objects) and `inst` (the instance) - */ - get_buffer: () => Buffer; - - /** - * check if there is something in the buffer to paste - * @name can_paste() - * @return {Boolean} - */ - can_paste: () => boolean; - - /** - * copy or move the previously cut or copied nodes to a new parent - * @name paste(obj [, pos]) - * @param {mixed} obj the new parent - * @param {mixed} pos the position to insert at (besides integer, "first" and "last" are supported), defaults to integer `0` - * @trigger paste.jstree - */ - paste: (obj: any, pos: any) => void; - - /** - * clear the buffer of previously copied or cut nodes - * @name clear_buffer() - * @trigger clear_buffer.jstree - */ - clear_buffer: () => void; - - /** - * put a node in edit mode (input field to rename the node) - * @name edit(obj [, default_text, callback]) - * @param {mixed} obj - * @param {String} default_text the text to populate the input with (if omitted or set to a non-string value the node's text value is used) - * @param {Function} callback a function to be called once the text box is blurred, it is called in the instance's scope and receives the node, a status parameter (true if the rename is successful, false otherwise) and a boolean indicating if the user cancelled the edit. You can access the node's title using .text - */ - edit: (obj: any, default_text?: string, callback?: (node: any, status: boolean, canceled: boolean) => void) => void; - - /** - * changes the theme - * @name set_theme(theme_name [, theme_url]) - * @param {String} theme_name the name of the new theme to apply - * @param {mixed} theme_url the location of the CSS file for this theme. Omit or set to `false` - * if you manually included the file. Set to `true` to autoload from the `core.themes.dir` directory. - * @trigger set_theme.jstree - */ - set_theme: (theme_name: string, theme_url?: any) => void; - - /** - * gets the name of the currently applied theme name - * @name get_theme() - * @return {String} - */ - get_theme: () => string; - - /** - * changes the theme variant (if the theme has variants) - * @name set_theme_variant(variant_name) - * @param {String|Boolean} variant_name the variant to apply (if `false` is used the current variant is removed) - */ - set_theme_variant: (variant_name: any) => void; - - /** - * gets the name of the currently applied theme variant - * @name get_theme() - * @return {String} - */ - get_theme_variant: () => string; - - /** - * shows a striped background on the container (if the theme supports it) - * @name show_stripes() - */ - show_stripes: () => void; - - /** - * hides the striped background on the container - * @name hide_stripes() - */ - hide_stripes: () => void; - - /** - * toggles the striped background on the container - * @name toggle_stripes() - */ - toggle_stripes: () => void; - - /** - * shows the connecting dots (if the theme supports it) - * @name show_dots() - */ - show_dots: () => void; - - /** - * hides the connecting dots - * @name hide_dots() - */ - hide_dots: () => void; - - /** - * toggles the connecting dots - * @name toggle_dots() - */ - toggle_dots: () => void; - - /** - * show the node icons - * @name show_icons() - */ - show_icons: () => void; - - /** - * hide the node icons - * @name hide_icons() - */ - hide_icons: () => void; - - /** - * toggle the node icons - * @name toggle_icons() - */ - toggle_icons: () => void; - - /** - * set the node icon for a node - * @name set_icon(obj, icon) - * @param {mixed} obj - * @param {String} icon the new icon - can be a path to an icon or a className, - * if using an image that is in the current directory use a `./` prefix, otherwise it will be detected as a class - */ - set_icon: (obj: any, icon: string) => void; - - /** - * get the node icon for a node - * @name get_icon(obj) - * @param {mixed} obj - * @return {String} - */ - get_icon: (obj: any) => string; - - /** - * hide the icon on an individual node - * @name hide_icon(obj) - * @param {mixed} obj - */ - hide_icon: (obj: any) => void; - - /** - * show the icon on an individual node - * @name show_icon(obj) - * @param {mixed} obj - */ - show_icon: (obj: any) => void; - - /** - * checkbox plugin - */ - - /** - * set the undetermined state where and if necessary. Used internally. - * @private - * @name _undetermined() - * @plugin checkbox - */ - _undetermined: () => void; - - /** - * show the node checkbox icons - * @name show_checkboxes() - * @plugin checkbox - */ - show_checkboxes: () => void; - - /** - * hide the node checkbox icons - * @name hide_checkboxes() - * @plugin checkbox - */ - hide_checkboxes: () => void; - - /** - * toggle the node icons - * @name toggle_checkboxes() - * @plugin checkbox - */ - toggle_checkboxes: () => void; - - /** - * checks if a node is in an undetermined state - * @name is_undetermined(obj) - * @param {mixed} obj - * @return {Boolean} - */ - is_undetermined: (obj: any) => boolean; - - /** - * disable a node's checkbox - * @name disable_checkbox(obj) - * @param {mixed} obj an array can be used too - * @trigger disable_checkbox.jstree - * @plugin checkbox - */ - disable_checkbox: (obj: any) => boolean; - - /** - * enable a node's checkbox - * @name disable_checkbox(obj) - * @param {mixed} obj an array can be used too - * @trigger enable_checkbox.jstree - * @plugin checkbox - */ - enable_checkbox: (obj: any) => boolean; - - /** - * check a node (only if tie_selection in checkbox settings is false, otherwise select_node will be called internally) - * @name check_node(obj) - * @param {mixed} obj an array can be used to check multiple nodes - * @trigger check_node.jstree - * @plugin checkbox - */ - check_node: (obj: any, e: any) => any; - - /** - * uncheck a node (only if tie_selection in checkbox settings is false, otherwise deselect_node will be called internally) - * @name deselect_node(obj) - * @param {mixed} obj an array can be used to deselect multiple nodes - * @trigger uncheck_node.jstree - * @plugin checkbox - */ - uncheck_node: (obj: any, e: any) => any; - - /** - * checks all nodes in the tree (only if tie_selection in checkbox settings is false, otherwise select_all will be called internally) - * @name check_all() - * @trigger check_all.jstree, changed.jstree - * @plugin checkbox - */ - check_all: () => any; - - /** - * uncheck all checked nodes (only if tie_selection in checkbox settings is false, otherwise deselect_all will be called internally) - * @name uncheck_all() - * @trigger uncheck_all.jstree - * @plugin checkbox - */ - uncheck_all: () => any; - - /** - * checks if a node is checked (if tie_selection is on in the settings this function will return the same as is_selected) - * @name is_checked(obj) - * @param {mixed} obj - * @return {Boolean} - * @plugin checkbox - */ - is_checked: (obj: any) => boolean; - - /** - * get an array of all checked nodes (if tie_selection is on in the settings this function will return the same as get_selected) - * @name get_checked([full]) - * @param {mixed} full if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned - * @return {Array} - * @plugin checkbox - */ - get_checked: (full: any) => any[]; - - /** - * get an array of all top level checked nodes (ignoring children of checked nodes) (if tie_selection is on in the settings this function will return the same as get_top_selected) - * @name get_top_checked([full]) - * @param {mixed} full if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned - * @return {Array} - * @plugin checkbox - */ - get_top_checked: (full: any) => any[]; - - /** - * get an array of all bottom level checked nodes (ignoring selected parents) (if tie_selection is on in the settings this function will return the same as get_bottom_selected) - * @name get_bottom_checked([full]) - * @param {mixed} full if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned - * @return {Array} - * @plugin checkbox - */ - get_bottom_checked: (full: any) => any[]; - - /** - * context menu plugin - */ - - /** - * prepare and show the context menu for a node - * @name show_contextmenu(obj [, x, y]) - * @param {mixed} obj the node - * @param {Number} x the x-coordinate relative to the document to show the menu at - * @param {Number} y the y-coordinate relative to the document to show the menu at - * @param {Object} e the event if available that triggered the contextmenu - * @plugin contextmenu - * @trigger show_contextmenu.jstree - */ - show_contextmenu: (obj: any, x?: number, y?: number, e?: any) => void; - - /** - * show the prepared context menu for a node - * @name _show_contextmenu(obj, x, y, i) - * @param {mixed} obj the node - * @param {Number} x the x-coordinate relative to the document to show the menu at - * @param {Number} y the y-coordinate relative to the document to show the menu at - * @param {Number} i the object of items to show - * @plugin contextmenu - * @trigger show_contextmenu.jstree - * @private - */ - _show_contextmenu: (obj: any, x: number, y: number, i: number) => void; - - /** - * search plugin - */ - - /** - * used to search the tree nodes for a given string - * @name search(str [, skip_async]) - * @param {String} str the search string - * @param {Boolean} skip_async if set to true server will not be queried even if configured - * @param {Boolean} show_only_matches if set to true only matching nodes will be shown (keep in mind this can be very slow on large trees or old browsers) - * @param {mixed} inside an optional node to whose children to limit the search - * @param {Boolean} append if set to true the results of this search are appended to the previous search - * @param {Boolean} show_only_matches_children show only matched children - * @plugin search - * @trigger search.jstree - */ - search: (str: string, skip_async?: boolean, show_only_matches?: boolean, inside?: any, append?: boolean, show_only_matches_children?: boolean) => void; - - /** - * used to clear the last search (removes classes and shows all nodes if filtering is on) - * @name clear_search() - * @plugin search - * @trigger clear_search.jstree - */ - clear_search: () => void; - - /** - * opens nodes that need to be opened to reveal the search results. Used only internally. - * @private - * @name _search_open(d) - * @param {Array} d an array of node IDs - * @plugin search - */ - _search_open: (d: string[]) => void; - - /** - * sort plugin - */ - - /** - * used to sort a node's children - * @private - * @name sort(obj [, deep]) - * @param {mixed} obj the node - * @param {Boolean} deep if set to `true` nodes are sorted recursively. - * @plugin sort - * @trigger search.jstree - */ - sort: (obj: any, deep?: boolean) => void; - - /** - * state plugin - */ - - /** - * save the state - * @name save_state() - * @plugin state - */ - save_state: () => void; - - /** - * restore the state from the user's computer - * @name restore_state() - * @plugin state - */ - restore_state: () => void; - - /** - * clear the state on the user's computer - * @name clear_state() - * @plugin state - */ - clear_state: () => void; - - /** - * types plugin - */ - - /** - * used to retrieve the type settings object for a node - * @name get_rules(obj) - * @param {mixed} obj the node to find the rules for - * @return {Object} - * @plugin types - */ - get_rules: (obj: any) => any; - - /** - * used to retrieve the type string or settings object for a node - * @name get_type(obj [, rules]) - * @param {mixed} obj the node to find the rules for - * @param {Boolean} rules if set to `true` instead of a string the settings object will be returned - * @return {String|Object} - * @plugin types - */ - get_type: (obj: any, rules?: any) => any; - - /** - * used to change a node's type - * @name set_type(obj, type) - * @param {mixed} obj the node to change - * @param {String} type the new type - * @plugin types - */ - set_type: (obj: any, type: string) => any; -} - -interface JSTreeGetJsonOptions { - /** - * do not return state information - */ - no_state: boolean; - - /** - * do not return ID - */ - no_id: boolean; - - /** - * do not include children - */ - no_children: boolean; - - /** - * do not include node data - */ - no_data: boolean; - - /** - * do not include LI attributes - */ - no_li_attr: boolean; - - /** - * do not include A attributes - */ - no_a_attr: boolean; - - /** - * return flat JSON instead of nested - */ - flat: boolean; -} - -interface JSTreeBindOptions { - inst?: any; - args?: any; - rslt?: any; - rlbk?: any; -} - -interface Buffer { - mode: string; - node: any[]; - inst: any; -} diff --git a/DKBFrontEnd/src/typings/globals/jstree/typings.json b/DKBFrontEnd/src/typings/globals/jstree/typings.json deleted file mode 100644 index 83064e642..000000000 --- a/DKBFrontEnd/src/typings/globals/jstree/typings.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "resolution": "main", - "tree": { - "src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/00dd9a1cf6c5b748d51e6d470ce6117bb383ea6c/jstree/jstree.d.ts", - "raw": "registry:dt/jstree#0.0.0+20160815165627", - "typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/00dd9a1cf6c5b748d51e6d470ce6117bb383ea6c/jstree/jstree.d.ts" - } -} diff --git a/DKBFrontEnd/src/typings/index.d.ts b/DKBFrontEnd/src/typings/index.d.ts deleted file mode 100644 index 224e9fc89..000000000 --- a/DKBFrontEnd/src/typings/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/DKBFrontEnd/src/typings/local-modules/d3/index.d.ts b/DKBFrontEnd/src/typings/local-modules/d3/index.d.ts deleted file mode 100644 index 4fd941379..000000000 --- a/DKBFrontEnd/src/typings/local-modules/d3/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -declare module 'd3' { - export type Dispatch = any; -} diff --git a/DKBFrontEnd/src/typings/local-modules/detect-browser/index.d.ts b/DKBFrontEnd/src/typings/local-modules/detect-browser/index.d.ts deleted file mode 100644 index 14d21e7db..000000000 --- a/DKBFrontEnd/src/typings/local-modules/detect-browser/index.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -declare module DetectBrowser { - const name: string; - const version: string; -} - -declare module 'detect-browser' { - export = DetectBrowser; -} diff --git a/DKBFrontEnd/src/typings/local-modules/handlebars/index.d.ts b/DKBFrontEnd/src/typings/local-modules/handlebars/index.d.ts deleted file mode 100644 index ea85fb98f..000000000 --- a/DKBFrontEnd/src/typings/local-modules/handlebars/index.d.ts +++ /dev/null @@ -1,290 +0,0 @@ -// Generated by typings -// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/6c95a70c7498a144915c36660c6698ddaeb431b4/handlebars/handlebars.d.ts -declare module "handlebars" { -namespace Handlebars { - export function registerHelper(name: string, fn: Function, inverse?: boolean): void; - export function registerHelper(name: Object): void; - export function registerPartial(name: string, str: any): void; - export function unregisterHelper(name: string): void; - export function unregisterPartial(name: string): void; - export function K(): void; - export function createFrame(object: any): any; - export function Exception(message: string): void; - export function log(level: number, obj: any): void; - export function parse(input: string): hbs.AST.Program; - export function compile(input: any, options?: CompileOptions): HandlebarsTemplateDelegate; - export function precompile(input: any, options?: PrecompileOptions): TemplateSpecification; - export function template(precompilation: TemplateSpecification): HandlebarsTemplateDelegate; - - export function create(): typeof Handlebars; - - export var SafeString: typeof hbs.SafeString; - export var escapeExpression: typeof hbs.Utils.escapeExpression; - export var Utils: typeof hbs.Utils; - export var logger: Logger; - export var templates: HandlebarsTemplates; - export var helpers: any; - - export function registerDecorator(name: string, fn: Function): void; - export function registerDecorator(obj: {[name: string] : Function}): void; - export function unregisterDecorator(name: string): void; - - export function noConflict(): typeof Handlebars; - - export module AST { - export var helpers: hbs.AST.helpers; - } - - interface ICompiler { - accept(node: hbs.AST.Node): void; - Program(program: hbs.AST.Program): void; - BlockStatement(block: hbs.AST.BlockStatement): void; - PartialStatement(partial: hbs.AST.PartialStatement): void; - PartialBlockStatement(partial: hbs.AST.PartialBlockStatement): void; - DecoratorBlock(decorator: hbs.AST.DecoratorBlock): void; - Decorator(decorator: hbs.AST.Decorator): void; - MustacheStatement(mustache: hbs.AST.MustacheStatement): void; - ContentStatement(content: hbs.AST.ContentStatement): void; - CommentStatement(comment?: hbs.AST.CommentStatement): void; - SubExpression(sexpr: hbs.AST.SubExpression): void; - PathExpression(path: hbs.AST.PathExpression): void; - StringLiteral(str: hbs.AST.StringLiteral): void; - NumberLiteral(num: hbs.AST.NumberLiteral): void; - BooleanLiteral(bool: hbs.AST.BooleanLiteral): void; - UndefinedLiteral(): void; - NullLiteral(): void; - Hash(hash: hbs.AST.Hash): void; - } - - export class Visitor implements ICompiler { - accept(node: hbs.AST.Node): void; - acceptKey(node: hbs.AST.Node, name: string): void; - acceptArray(arr: hbs.AST.Expression[]): void; - Program(program: hbs.AST.Program): void; - BlockStatement(block: hbs.AST.BlockStatement): void; - PartialStatement(partial: hbs.AST.PartialStatement): void; - PartialBlockStatement(partial: hbs.AST.PartialBlockStatement): void; - DecoratorBlock(decorator: hbs.AST.DecoratorBlock): void; - Decorator(decorator: hbs.AST.Decorator): void; - MustacheStatement(mustache: hbs.AST.MustacheStatement): void; - ContentStatement(content: hbs.AST.ContentStatement): void; - CommentStatement(comment?: hbs.AST.CommentStatement): void; - SubExpression(sexpr: hbs.AST.SubExpression): void; - PathExpression(path: hbs.AST.PathExpression): void; - StringLiteral(str: hbs.AST.StringLiteral): void; - NumberLiteral(num: hbs.AST.NumberLiteral): void; - BooleanLiteral(bool: hbs.AST.BooleanLiteral): void; - UndefinedLiteral(): void; - NullLiteral(): void; - Hash(hash: hbs.AST.Hash): void; - } - - /** - * Implement this interface on your MVW/MVVM/MVC views such as Backbone.View - **/ - interface HandlebarsTemplatable { - template: HandlebarsTemplateDelegate; - } - - interface HandlebarsTemplateDelegate { - (context: any, options?: any): string; - } - - interface HandlebarsTemplates { - [index: string]: HandlebarsTemplateDelegate; - } - - interface TemplateSpecification { - - } - - interface CompileOptions { - data?: boolean; - compat?: boolean; - knownHelpers?: { - helperMissing?: boolean; - blockHelperMissing?: boolean; - each?: boolean; - if?: boolean; - unless?: boolean; - with?: boolean; - log?: boolean; - lookup?: boolean; - } - knownHelpersOnly?: boolean; - noEscape?: boolean; - strict?: boolean; - assumeObjects?: boolean; - preventIndent?: boolean; - ignoreStandalone?: boolean; - explicitPartialContext?: boolean; - } - - interface PrecompileOptions extends CompileOptions { - srcName?: string; - destName?: string; - } - - namespace hbs { - class SafeString { - constructor(str: string); - static toString(): string; - } - - namespace Utils { - function escapeExpression(str: string): string; - function createFrame(obj: Object): Object; - function isEmpty(obj: any) : boolean; - function extend(obj: any, ...source: any[]): any; - function toString(obj: any): string; - function isArray(obj: any): boolean; - function isFunction(obj: any): boolean; - } - } - - interface Logger { - DEBUG: number; - INFO: number; - WARN: number; - ERROR: number; - level: number; - - methodMap: { [level: number]: string }; - - log(level: number, obj: string): void; - } - - namespace hbs { - namespace AST { - interface Node { - type: string; - loc: SourceLocation; - } - - interface SourceLocation { - source: string; - start: Position; - end: Position; - } - - interface Position { - line: number; - column: number; - } - - interface Program extends Node { - body: Statement[]; - blockParams: string[]; - } - - interface Statement extends Node {} - - interface MustacheStatement extends Statement { - path: PathExpression | Literal; - params: Expression[]; - hash: Hash; - escaped: boolean; - strip: StripFlags; - } - - interface Decorator extends MustacheStatement { } - - interface BlockStatement extends Statement { - path: PathExpression; - params: Expression[]; - hash: Hash; - program: Program; - inverse: Program; - openStrip: StripFlags; - inverseStrip: StripFlags; - closeStrip: StripFlags; - } - - interface DecoratorBlock extends BlockStatement { } - - interface PartialStatement extends Statement { - name: PathExpression | SubExpression; - params: Expression[]; - hash: Hash; - indent: string; - strip: StripFlags; - } - - interface PartialBlockStatement extends Statement { - name: PathExpression | SubExpression; - params: Expression[], - hash: Hash, - program: Program, - openStrip: StripFlags, - closeStrip: StripFlags - } - - interface ContentStatement extends Statement { - value: string; - original: StripFlags; - } - - interface CommentStatement extends Statement { - value: string; - strip: StripFlags; - } - - interface Expression extends Node {} - - interface SubExpression extends Expression { - path: PathExpression; - params: Expression[]; - hash: Hash; - } - - interface PathExpression extends Expression { - data: boolean; - depth: number; - parts: string[]; - original: string; - } - - interface Literal extends Expression {} - interface StringLiteral extends Literal { - value: string; - original: string; - } - - interface BooleanLiteral extends Literal { - value: boolean; - original: boolean; - } - - interface NumberLiteral extends Literal { - value: number; - original: number; - } - - interface UndefinedLiteral extends Literal {} - - interface NullLiteral extends Literal {} - - interface Hash extends Node { - pairs: HashPair[]; - } - - interface HashPair extends Node { - key: string; - value: Expression; - } - - interface StripFlags { - open: boolean; - close: boolean; - } - - interface helpers { - helperExpression(node: Node): boolean; - scopeId(path: PathExpression): boolean; - simpleId(path: PathExpression): boolean; - } - } - } -} - export = Handlebars; -} diff --git a/DKBFrontEnd/src/typings/local-modules/handlebars/typings.json b/DKBFrontEnd/src/typings/local-modules/handlebars/typings.json deleted file mode 100644 index afe2b904e..000000000 --- a/DKBFrontEnd/src/typings/local-modules/handlebars/typings.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "resolution": "main", - "tree": { - "src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/6c95a70c7498a144915c36660c6698ddaeb431b4/handlebars/handlebars.d.ts", - "raw": "registry:dt/handlebars#4.0.5+20160804082238", - "typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/6c95a70c7498a144915c36660c6698ddaeb431b4/handlebars/handlebars.d.ts" - } -} diff --git a/DKBFrontEnd/src/typings/local-modules/intro.js/index.d.ts b/DKBFrontEnd/src/typings/local-modules/intro.js/index.d.ts deleted file mode 100644 index 564e09981..000000000 --- a/DKBFrontEnd/src/typings/local-modules/intro.js/index.d.ts +++ /dev/null @@ -1,24 +0,0 @@ - -declare module "intro.js" { - interface IntroJs { - start(): IntroJs; - goToStep(step: number): IntroJs; - nextStep(): IntroJs; - previousStep(): IntroJs; - exit(): IntroJs; - setOption(option: string, value: string|number|boolean): IntroJs; - setOptions(options: { [option: string]: string|number|boolean }): IntroJs; - refresh(): IntroJs; - addHints(): IntroJs; - onhintclick(providedCallback: () => void): IntroJs; - onhintsadded(providedCallback: () => void): IntroJs; - onhintclose(providedCallback: () => void): IntroJs; - oncomplete(providedCallback: () => void): IntroJs; - onexit(providedCallback: () => void): IntroJs; - onchange(providedCallback: () => void): IntroJs; - onbeforechange(providedCallback: () => void): IntroJs; - onafterchange(providedCallback: (element: HTMLElement) => void): IntroJs; - } - - export function introJs(targetElm?: HTMLElement): IntroJs; -} diff --git a/DKBFrontEnd/src/typings/local-modules/jointjs/index.d.ts b/DKBFrontEnd/src/typings/local-modules/jointjs/index.d.ts deleted file mode 100644 index 2369447ef..000000000 --- a/DKBFrontEnd/src/typings/local-modules/jointjs/index.d.ts +++ /dev/null @@ -1,373 +0,0 @@ -// Type definitions for Joint JS 0.6 -// Project: http://www.jointjs.com/ -// Definitions by: Aidan Reel , David Durman -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -declare module 'jointjs' { - import * as Backbone from 'backbone'; - -namespace joint { - - namespace dia { - - interface IElementSize { - width: number; - height: number; - } - - /** - * The model holding all the cells (elements and links) of the diagram. - * The collection of all the cells is stored in the property cells. - */ - class Graph extends Backbone.Model { - initialize(): void; - fromJSON(json: any): void; - clear(): void; - /** - * Add a new cell to the graph. If cell is an array, all the cells in the array will be added to the graph. - */ - addCell(cell: Cell, options?: any): void; - /** - * Add new cells to the graph. This is just a syntactic sugar to the addCell method. - * Calling addCell with an array of cells is an equivalent to calling addCells. - */ - addCells(cells: Cell[], options?: any): void; - getConnectedLinks(cell: Cell, options?: any): Link[]; - disconnectLinks(cell: Cell): void; - removeLinks(cell: Cell[]): void; - getElements(): Element[]; - getLinks(): Link[]; - /** - * Reset cells in the graph. Update all the cells in the graph in one bulk. - * This is a more efficient method of adding cells to the graph if you you want to - * replace all the cells in one go. - * @param cells - * @param options optionally contain additional data that is passed over to - * the event listeners of the graph reset event - */ - resetCells(cells: Cell[], options?: any): void; - hasActiveBatch(name: string): void; - } - - class Cell extends Backbone.Model { - toJSON(): void; - remove(options?: any): void; - toFront(): void; - toBack(): void; - getBBox(): void; - embed(cell: Cell): void; - unembed(cell: Cell): void; - getEmbeddedCells(): Cell[]; - clone(opt?: any): Backbone.Model; // @todo: return can either be Cell or Cell[]. - attr(attrs: any): Cell; - attr(path: string, value: any): Cell; - } - - class Element extends Cell { - position(x?: number, y?: number): {x: number; y: number}; - translate(tx: number, ty?: number): Element; - resize(width: number, height: number, opt?: any): Element; - rotate(angle: number, absolute?: boolean): Element; - } - - class Link extends Cell { - defaults(): any; - disconnect(): Link; - label(idx?: number, value?: LinkLabelAttributes): any; // @todo: returns either a label under idx or Link if both idx and value were passed - } - - export interface LinkLabelAttributes { - position?: number; - attrs?: { - rect?: { - fill?: string; - 'stroke'?: string; - 'stroke-width'?: number; - }; - text?: { - fill?: string; - 'stroke'?: string; - 'stroke-width'?: number; - }; - }; - } - - export interface LinkAttributes { - attrs?: { - '.connection'?: { - fill?: string; - stroke?: string; - 'stroke-width'?: number; - 'stroke-dasharray'?: string; - }, - '.marker-source'?: { - fill?: string; - stroke?: string; - 'stroke-width'?: number; - d?: string; - }, - '.marker-target'?: { - fill?: string; - stroke?: string; - 'stroke-width'?: number; - d?: string; - } - }; - labels?: LinkLabelAttributes[]; - connector?: { - name?: string; - args?: { - radius?: number; - }; - }; - router?: { - name?: string; - args?: { - startDirections?: string[]; - endDirections?: string[]; - excludeTypes?: string[]; - }; - }; - z?: number; - } - - interface PaperFitToContentOptions { - gridWidth?: number; - gridHeight?: number; - padding?: number | {top: number; right: number; bottom: number; left: number;} - allowNewOrigin?: string; // one of ['negative'|'positive'|'any'] - minWidth?: number; - minHeight?: number; - maxWidth?: number; - maxHeight?: number; - } - interface PaperScaleToFitOptions { - padding?: number; - preserveAspectRatio?: boolean; - minScale?: number; - maxScale?: number; - minScaleX?: number; - minScaleY?: number; - maxScaleX?: number; - maxScaleY?: number; - scaleGrid?: number; - fittingBBox?: {x?: number; y?: number; width?: number; height?: number;} - } - interface PaperOptions extends Backbone.ViewOptions { - gridSize?: number; - elementView?: typeof ElementView; - linkView?: typeof LinkView; - width?: number; - height?: number; - origin?: { x: number; y: number; }; - async?: boolean; - preventContextMenu?: boolean; - guard?: (evt: any, view: joint.dia.CellView) => boolean; - } - class Paper extends Backbone.View { - constructor(options?: PaperOptions); - options: PaperOptions; - svg: SVGElement; - viewport: SVGGElement; - setDimensions(width: number, height: number): void; - scale(sx: number, sy?: number, ox?: number, oy?: number): Paper; - rotate(deg: number, ox?: number, oy?: number): Paper; // @todo not released yet though it's in the source code already - findView(el: any): CellView; - findViewByModel(modelOrId: any): CellView; - findViewsFromPoint(p: { x: number; y: number; }): CellView[]; - findViewsInArea(r: { x: number; y: number; width: number; height: number; }): CellView[]; - fitToContent(opt?: PaperFitToContentOptions): void; - snapToGrid(p: { x: number; y: number; }): { x: number; y: number; }; - scaleContentToFit(opt?: PaperScaleToFitOptions): void; - toPNG(callback: (png: string) => void): void; - toSVG(callback: (svg: string) => void): void; - openAsSVG(): void; - print(): void; - getContentBBox(): g.rect; - setOrigin(x: number, y: number): void; - } - - class ElementView extends CellView { - scale(sx: number, sy: number): void; - resize(): void; - update(cell?: any, renderingOnlyAttrs?: any): void; - } - - class CellView extends Backbone.View { - getBBox(): { x: number; y: number; width: number; height: number; }; - highlight(el?: any): void; - unhighlight(el?: any): void; - findMagnet(el: any): void; - getSelector(el: any): void; - } - - class LinkView extends CellView { - getConnectionLength(): number; - getPointAtLength(length: number): { x: number; y: number; }; - } - - /** Rappid only */ - class CommandManager extends Backbone.Model { - constructor(options?: CommandManagerOptions); - initialize(): void; - undo(): void; - initBatchCommand(): void; - storeBatchCommand(): void; - redo(): void; - reset(): void; - } - - /** Rappid only */ - interface CommandManagerOptions { - graph: Graph; - cmdBeforeAdd?: (cmdName: string, cell: Cell, graph: Graph, options: any) => boolean; - } - } - - namespace ui { - /** Rappid only */ - class PaperScroller extends Backbone.View { - startPanning(evt: MouseEvent): void; - zoom(size: any, opts: any): void; - zoomToFit(params: any): void; - toLocalPoint(x: number, y: number): {x: number; y: number}; - center(): void; - adjustPaper(): void; - } - - /** Rappid only */ - interface SnaplinesOptions extends Backbone.ViewOptions { - paper: joint.dia.Paper; - } - - /** Rappid only */ - class Snaplines extends Backbone.View { - constructor(options: SnaplinesOptions); - startListening(): void; - } - - /** Rappid only */ - interface SelectionViewOptions extends Backbone.ViewOptions { - paper: joint.dia.Paper; - graph: joint.dia.Graph; - } - - /** Rappid only */ - class SelectionView extends Backbone.View { - constructor(options: SelectionViewOptions); - startSelecting(evt: MouseEvent): void; - cancelSelection(): void; - createSelectionBox(view: joint.dia.CellView): void; - destroySelectionBox(view: joint.dia.CellView): void; - } - - /** Rappid only */ - class Halo extends Backbone.View { - constructor(options: HaloOptions); - options: HaloOptions; - addHandle(options: { name:string; position: string; icon: string; }): void; - removeHandle(name: string): void; - changeHandle(name: string, options: { position: string; icon: string; }): void; - } - - /** Rappid only */ - interface HaloOptions { - graph: joint.dia.Graph; - paper: joint.dia.Paper; - cellView: joint.dia.CellView; - /** - * The preferred side for a self-loop link created from Halo ("top"|"bottom"|"left"|"right"), default is "top" - */ - linkLoopPreferredSide?: string; - /** - * The self-loop link width in pixels, default is 40 - */ - linkLoopWidth?: number; - /** - * The angle increments the rotate action snaps to, default is 15 - */ - rotateAngleGrid?: number; - /** - * A function that returns an HTML string with the content that will be used in the information box below the element. - * Default is x,y,width,height coordinates and dimensions of the element. - */ - boxContent?: boolean | ((cellView: joint.dia.CellView, boxDOMElement: HTMLElement) => string); - /** - * If set to true, the model position and dimensions will be used as a basis for the Halo tools position. - * By default, this is set to false which causes the Halo tools position be based on the bounding box of - * the element view. Sometimes though, your shapes can have certain SVG sub elements that stick out - * of the view and you don't want these sub elements to affect the Halo tools position. - * In this case, set the useModelGeometry to true. - */ - useModelGeometry?: boolean; - } - } - - namespace shapes { - module basic { - class Generic extends joint.dia.Element { } - class Rect extends Generic { } - class Text extends Generic { } - class Circle extends Generic { } - class Image extends Generic { } - } - } - - namespace util { - function uuid(): string; - function guid(obj: any): string; - function mixin(objects: any[]): any; - function supplement(objects: any[]): any; - function deepMixin(objects: any[]): any; - function deepSupplement(objects: any, defaultIndicator?: any): any; - function imageToDataUri(url: string, callback: (error: Error, dataUri: string) => void): void; - function normalizeEvent(params: any): any; - } - - function V(element: SVGElement): V; - - interface V { - node: SVGAElement; - attr(name: string): string; - attr(name: string, value: string): void; - attr(attrs: {}): void; - scale(): {sx: number; sy: number;} - bbox(withoutTransformations?: boolean, target?: Element): g.rect; - } - - export namespace g { - function point(x: number, y: number): point; - function point(p: {x: number; y: number;}): point; - interface point { - x: number; - y: number; - } - - function rect(x: number, y: number, w: number, h: number): rect; - interface rect { - x: number; - y: number; - width: number; - height: number; - toString(): string; - origin(): point; - corner(): point; - topRight(): point; - bottomLeft(): point; - center(): point; - intersect(r: rect): boolean; - /// @return 'left' | 'right' | 'top' | 'bottom' - sideNearestToPoint(p: point): string; - containsPoint(p: point): boolean; - containsRect(r: rect): boolean; - pointNearestToPoint(p: point): point; - intersectionWithLineFromCenterToPoint(p: point, angle: number): point; - moveAndExpand(r: rect): rect; - round(decimals: number): rect; - normalize(): rect; - bbox(angle: number): rect; - } - } -} - export = joint; -} diff --git a/DKBFrontEnd/src/typings/local-modules/n3/index.d.ts b/DKBFrontEnd/src/typings/local-modules/n3/index.d.ts deleted file mode 100644 index afaaacdb0..000000000 --- a/DKBFrontEnd/src/typings/local-modules/n3/index.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -declare module "n3" { - class N3Parser { - parse( - string: string, - callback: (error: any, triple: Triple | undefined, prefix: any) => any - ): void; - } - - function Parser(): N3Parser; - - interface Triple { - subject: string; - predicate: string; - object: string; - } -} diff --git a/DKBFrontEnd/src/typings/local-modules/webcola/index.d.ts b/DKBFrontEnd/src/typings/local-modules/webcola/index.d.ts deleted file mode 100644 index 9b5a12dab..000000000 --- a/DKBFrontEnd/src/typings/local-modules/webcola/index.d.ts +++ /dev/null @@ -1,978 +0,0 @@ -declare module 'webcola' { - import * as D3 from 'd3'; - function applyPacking(graphs: Array, w: any, h: any, node_size: any, desired_ratio?: number): void; - function separateGraphs(nodes: any, links: any): any[]; - export module vpsc { - - class PositionStats { - scale: number; - AB: number; - AD: number; - A2: number; - constructor(scale: number); - addVariable(v: Variable): void; - getPosn(): number; - } - class Constraint { - left: Variable; - right: Variable; - gap: number; - equality: boolean; - lm: number; - active: boolean; - unsatisfiable: boolean; - constructor(left: Variable, right: Variable, gap: number, equality?: boolean); - slack(): number; - } - class Variable { - desiredPosition: number; - weight: number; - scale: number; - offset: number; - block: Block; - cIn: Constraint[]; - cOut: Constraint[]; - constructor(desiredPosition: number, weight?: number, scale?: number); - dfdv(): number; - position(): number; - visitNeighbours(prev: Variable, f: (c: Constraint, next: Variable) => void): void; - } - class Block { - vars: Variable[]; - posn: number; - ps: PositionStats; - blockInd: number; - constructor(v: Variable); - private addVariable(v); - updateWeightedPosition(): void; - private compute_lm(v, u, postAction); - private populateSplitBlock(v, prev); - traverse(visit: (c: Constraint) => any, acc: any[], v?: Variable, prev?: Variable): void; - findMinLM(): Constraint; - private findMinLMBetween(lv, rv); - private findPath(v, prev, to, visit); - isActiveDirectedPathBetween(u: Variable, v: Variable): boolean; - static split(c: Constraint): Block[]; - private static createSplitBlock(startVar); - splitBetween(vl: Variable, vr: Variable): { - constraint: Constraint; - lb: Block; - rb: Block; - }; - mergeAcross(b: Block, c: Constraint, dist: number): void; - cost(): number; - } - class Blocks { - vs: Variable[]; - private list; - constructor(vs: Variable[]); - cost(): number; - insert(b: Block): void; - remove(b: Block): void; - merge(c: Constraint): void; - forEach(f: (b: Block, i: number) => void): void; - updateBlockPositions(): void; - split(inactive: Constraint[]): void; - } - class Solver { - vs: Variable[]; - cs: Constraint[]; - bs: Blocks; - inactive: Constraint[]; - static LAGRANGIAN_TOLERANCE: number; - static ZERO_UPPERBOUND: number; - constructor(vs: Variable[], cs: Constraint[]); - cost(): number; - setStartingPositions(ps: number[]): void; - setDesiredPositions(ps: number[]): void; - private mostViolated(); - satisfy(): void; - solve(): number; - } - } - export module vpsc { - - interface Leaf { - bounds: Rectangle; - variable: Variable; - } - interface Group { - bounds: Rectangle; - padding: number; - stiffness: number; - leaves: Leaf[]; - groups: Group[]; - minVar: Variable; - maxVar: Variable; - } - function computeGroupBounds(g: Group): Rectangle; - class Rectangle { - x: number; - X: number; - y: number; - Y: number; - constructor(x: number, X: number, y: number, Y: number); - static empty(): Rectangle; - cx(): number; - cy(): number; - overlapX(r: Rectangle): number; - overlapY(r: Rectangle): number; - setXCentre(cx: number): void; - setYCentre(cy: number): void; - width(): number; - height(): number; - union(r: Rectangle): Rectangle; - /** - * return any intersection points between the given line and the sides of this rectangle - * @method lineIntersection - * @param x1 number first x coord of line - * @param y1 number first y coord of line - * @param x2 number second x coord of line - * @param y2 number second y coord of line - * @return any intersection points found - */ - lineIntersections(x1: number, y1: number, x2: number, y2: number): Array<{ - x: number; - y: number; - }>; - /** - * return any intersection points between a line extending from the centre of this rectangle to the given point, - * and the sides of this rectangle - * @method lineIntersection - * @param x2 number second x coord of line - * @param y2 number second y coord of line - * @return any intersection points found - */ - rayIntersection(x2: number, y2: number): { - x: number; - y: number; - }; - vertices(): { - x: number; - y: number; - }[]; - static lineIntersection(x1: number, y1: number, x2: number, y2: number, x3: number, y3: number, x4: number, y4: number): { - x: number; - y: number; - }; - inflate(pad: number): Rectangle; - } - function makeEdgeBetween(link: any, source: Rectangle, target: Rectangle, ah: number): void; - function makeEdgeTo(s: { - x: number; - y: number; - }, target: Rectangle, ah: number): { - x: number; - y: number; - }; - function generateXConstraints(rs: Rectangle[], vars: Variable[]): Constraint[]; - function generateYConstraints(rs: Rectangle[], vars: Variable[]): Constraint[]; - function generateXGroupConstraints(root: Group): Constraint[]; - function generateYGroupConstraints(root: Group): Constraint[]; - function removeOverlaps(rs: Rectangle[]): void; - interface GraphNode extends Leaf { - fixed: boolean; - width: number; - height: number; - x: number; - y: number; - px: number; - py: number; - } - class IndexedVariable extends Variable { - index: number; - constructor(index: number, w: number); - } - class Projection { - private nodes; - private groups; - private rootGroup; - private avoidOverlaps; - private xConstraints; - private yConstraints; - private variables; - constructor(nodes: GraphNode[], groups: Group[], rootGroup?: Group, constraints?: any[], avoidOverlaps?: boolean); - private createSeparation(c); - private makeFeasible(c); - private createAlignment(c); - private createConstraints(constraints); - private setupVariablesAndBounds(x0, y0, desired, getDesired); - xProject(x0: number[], y0: number[], x: number[]): void; - yProject(x0: number[], y0: number[], y: number[]): void; - projectFunctions(): { - (x0: number[], y0: number[], r: number[]): void; - }[]; - private project(x0, y0, start, desired, getDesired, cs, generateConstraints, updateNodeBounds, updateGroupBounds); - private solve(vs, cs, starting, desired); - } - } - export module geom { - - class Point { - x: number; - y: number; - } - class LineSegment { - x1: number; - y1: number; - x2: number; - y2: number; - constructor(x1: number, y1: number, x2: number, y2: number); - } - class PolyPoint extends Point { - polyIndex: number; - } - /** tests if a point is Left|On|Right of an infinite line. - * @param points P0, P1, and P2 - * @return >0 for P2 left of the line through P0 and P1 - * =0 for P2 on the line - * <0 for P2 right of the line - */ - function isLeft(P0: Point, P1: Point, P2: Point): number; - /** - * returns the convex hull of a set of points using Andrew's monotone chain algorithm - * see: http://geomalgorithms.com/a10-_hull-1.html#Monotone%20Chain - * @param S array of points - * @return the convex hull as an array of points - */ - function ConvexHull(S: Point[]): Point[]; - function clockwiseRadialSweep(p: Point, P: Point[], f: (point: Point) => void): void; - function tangent_PolyPolyC(V: Point[], W: Point[], t1: (a: Point, b: Point[]) => number, t2: (a: Point, b: Point[]) => number, cmp1: (a: Point, b: Point, c: Point) => boolean, cmp2: (a: Point, b: Point, c: Point) => boolean): { - t1: number; - t2: number; - }; - function LRtangent_PolyPolyC(V: Point[], W: Point[]): { - t1: number; - t2: number; - }; - function RLtangent_PolyPolyC(V: Point[], W: Point[]): { - t1: number; - t2: number; - }; - function LLtangent_PolyPolyC(V: Point[], W: Point[]): { - t1: number; - t2: number; - }; - function RRtangent_PolyPolyC(V: Point[], W: Point[]): { - t1: number; - t2: number; - }; - class BiTangent { - t1: number; - t2: number; - constructor(t1: number, t2: number); - } - class BiTangents { - rl: BiTangent; - lr: BiTangent; - ll: BiTangent; - rr: BiTangent; - } - class TVGPoint extends Point { - vv: VisibilityVertex; - } - class VisibilityVertex { - id: number; - polyid: number; - polyvertid: number; - p: TVGPoint; - constructor(id: number, polyid: number, polyvertid: number, p: TVGPoint); - } - class VisibilityEdge { - source: VisibilityVertex; - target: VisibilityVertex; - constructor(source: VisibilityVertex, target: VisibilityVertex); - length(): number; - } - class TangentVisibilityGraph { - P: TVGPoint[][]; - V: VisibilityVertex[]; - E: VisibilityEdge[]; - constructor(P: TVGPoint[][], g0?: { - V: VisibilityVertex[]; - E: VisibilityEdge[]; - }); - addEdgeIfVisible(u: TVGPoint, v: TVGPoint, i1: number, i2: number): void; - addPoint(p: TVGPoint, i1: number): VisibilityVertex; - private intersectsPolys(l, i1, i2); - } - function tangents(V: Point[], W: Point[]): BiTangents; - function polysOverlap(p: Point[], q: Point[]): boolean; - } - /** - * @module cola - */ - - /** - * Descent respects a collection of locks over nodes that should not move - * @class Locks - */ - class Locks { - locks: any; - /** - * add a lock on the node at index id - * @method add - * @param id index of node to be locked - * @param x required position for node - */ - add(id: number, x: number[]): void; - /** - * @method clear clear all locks - */ - clear(): void; - /** - * @isEmpty - * @returns false if no locks exist - */ - isEmpty(): boolean; - /** - * perform an operation on each lock - * @apply - */ - apply(f: (id: number, x: number[]) => void): void; - } - /** - * Uses a gradient descent approach to reduce a stress or p-stress goal function over a graph with specified ideal edge lengths or a square matrix of dissimilarities. - * The standard stress function over a graph nodes with position vectors x,y,z is (mathematica input): - * stress[x_,y_,z_,D_,w_]:=Sum[w[[i,j]] (length[x[[i]],y[[i]],z[[i]],x[[j]],y[[j]],z[[j]]]-d[[i,j]])^2,{i,Length[x]-1},{j,i+1,Length[x]}] - * where: D is a square matrix of ideal separations between nodes, w is matrix of weights for those separations - * length[x1_, y1_, z1_, x2_, y2_, z2_] = Sqrt[(x1 - x2)^2 + (y1 - y2)^2 + (z1 - z2)^2] - * below, we use wij = 1/(Dij^2) - * - * @class Descent - */ - class Descent { - D: number[][]; - G: number[][]; - threshold: number; - /** Hessian Matrix - * @property H {number[][][]} - */ - H: number[][][]; - /** gradient vector - * @property G {number[][]} - */ - g: number[][]; - /** positions vector - * @property x {number[][]} - */ - x: number[][]; - /** - * @property k {number} dimensionality - */ - k: number; - /** - * number of data-points / nodes / size of vectors/matrices - * @property n {number} - */ - n: number; - locks: Locks; - private static zeroDistance; - private minD; - private Hd; - private a; - private b; - private c; - private d; - private e; - private ia; - private ib; - private xtmp; - numGridSnapNodes: number; - snapGridSize: number; - snapStrength: number; - scaleSnapByMaxH: boolean; - private random; - project: { - (x0: number[], y0: number[], r: number[]): void; - }[]; - /** - * @method constructor - * @param x {number[][]} initial coordinates for nodes - * @param D {number[][]} matrix of desired distances between pairs of nodes - * @param G {number[][]} [default=null] if specified, G is a matrix of weights for goal terms between pairs of nodes. - * If G[i][j] > 1 and the separation between nodes i and j is greater than their ideal distance, then there is no contribution for this pair to the goal - * If G[i][j] <= 1 then it is used as a weighting on the contribution of the variance between ideal and actual separation between i and j to the goal function - */ - constructor(x: number[][], D: number[][], G?: number[][]); - static createSquareMatrix(n: number, f: (i: number, j: number) => number): number[][]; - private offsetDir(); - computeDerivatives(x: number[][]): void; - private static dotProd(a, b); - private static rightMultiply(m, v, r); - computeStepSize(d: number[][]): number; - reduceStress(): number; - private static copy(a, b); - private stepAndProject(x0, r, d, stepSize); - private static mApply(m, n, f); - private matrixApply(f); - private computeNextPosition(x0, r); - run(iterations: number): number; - rungeKutta(): number; - private static mid(a, b, m); - takeDescentStep(x: number[], d: number[], stepSize: number): void; - computeStress(): number; - } - class PseudoRandom { - seed: number; - private a; - private c; - private m; - private range; - constructor(seed?: number); - getNext(): number; - getNextBetween(min: number, max: number): number; - } - export module powergraph { - - interface LinkAccessor { - getSourceIndex(l: Link): number; - getTargetIndex(l: Link): number; - getType(l: Link): number; - } - class PowerEdge { - source: any; - target: any; - type: number; - constructor(source: any, target: any, type: number); - } - class Configuration { - private linkAccessor; - modules: Module[]; - roots: ModuleSet[]; - R: number; - constructor(n: number, edges: Link[], linkAccessor: LinkAccessor, rootGroup?: any[]); - private initModulesFromGroup(group); - merge(a: Module, b: Module, k?: number): Module; - private rootMerges(k?); - greedyMerge(): boolean; - private nEdges(a, b); - getGroupHierarchy(retargetedEdges: PowerEdge[]): any[]; - allEdges(): PowerEdge[]; - static getEdges(modules: ModuleSet, es: PowerEdge[]): void; - } - class Module { - id: number; - outgoing: LinkSets; - incoming: LinkSets; - children: ModuleSet; - definition: any; - gid: number; - constructor(id: number, outgoing?: LinkSets, incoming?: LinkSets, children?: ModuleSet, definition?: any); - getEdges(es: PowerEdge[]): void; - isLeaf(): boolean; - isIsland(): boolean; - isPredefined(): boolean; - } - class ModuleSet { - table: any; - count(): number; - intersection(other: ModuleSet): ModuleSet; - intersectionCount(other: ModuleSet): number; - contains(id: number): boolean; - add(m: Module): void; - remove(m: Module): void; - forAll(f: (m: Module) => void): void; - modules(): Module[]; - } - class LinkSets { - sets: any; - n: number; - count(): number; - contains(id: number): boolean; - add(linktype: number, m: Module): void; - remove(linktype: number, m: Module): void; - forAll(f: (ms: ModuleSet, linktype: number) => void): void; - forAllModules(f: (m: Module) => void): void; - intersection(other: LinkSets): LinkSets; - } - function getGroups(nodes: any[], links: Link[], la: LinkAccessor, rootGroup?: any[]): { - groups: any[]; - powerEdges: PowerEdge[]; - }; - } - /** - * @module cola - */ - - interface LinkAccessor { - getSourceIndex(l: Link): number; - getTargetIndex(l: Link): number; - } - interface LinkLengthAccessor extends LinkAccessor { - setLength(l: Link, value: number): void; - } - /** modify the specified link lengths based on the symmetric difference of their neighbours - * @class symmetricDiffLinkLengths - */ - function symmetricDiffLinkLengths(links: Link[], la: LinkLengthAccessor, w?: number): void; - /** modify the specified links lengths based on the jaccard difference between their neighbours - * @class jaccardLinkLengths - */ - function jaccardLinkLengths(links: Link[], la: LinkLengthAccessor, w?: number): void; - interface IConstraint { - left: number; - right: number; - gap: number; - } - interface DirectedEdgeConstraints { - axis: string; - gap: number; - } - interface LinkSepAccessor extends LinkAccessor { - getMinSeparation(l: Link): number; - } - /** generate separation constraints for all edges unless both their source and sink are in the same strongly connected component - * @class generateDirectedEdgeConstraints - */ - function generateDirectedEdgeConstraints(n: number, links: Link[], axis: string, la: LinkSepAccessor): IConstraint[]; - export class PairingHeap { - elem: T; - private subheaps; - constructor(elem: T); - toString(selector: any): string; - forEach(f: any): void; - count(): number; - min(): T; - empty(): boolean; - contains(h: PairingHeap): boolean; - isHeap(lessThan: (a: T, b: T) => boolean): boolean; - insert(obj: T, lessThan: any): PairingHeap; - merge(heap2: PairingHeap, lessThan: any): PairingHeap; - removeMin(lessThan: (a: T, b: T) => boolean): PairingHeap; - mergePairs(lessThan: (a: T, b: T) => boolean): PairingHeap; - decreaseKey(subheap: PairingHeap, newValue: T, setHeapNode: (e: T, h: PairingHeap) => void, lessThan: (a: T, b: T) => boolean): PairingHeap; - } - /** - * @class PriorityQueue a min priority queue backed by a pairing heap - */ - export class PriorityQueue { - private lessThan; - private root; - constructor(lessThan: (a: T, b: T) => boolean); - /** - * @method top - * @return the top element (the min element as defined by lessThan) - */ - top(): T; - /** - * @method push - * put things on the heap - */ - push(...args: T[]): PairingHeap; - /** - * @method empty - * @return true if no more elements in queue - */ - empty(): boolean; - /** - * @method isHeap check heap condition (for testing) - * @return true if queue is in valid state - */ - isHeap(): boolean; - /** - * @method forEach apply f to each element of the queue - * @param f function to apply - */ - forEach(f: any): void; - /** - * @method pop remove and return the min element from the queue - */ - pop(): T; - /** - * @method reduceKey reduce the key value of the specified heap node - */ - reduceKey(heapNode: PairingHeap, newKey: T, setHeapNode?: (e: T, h: PairingHeap) => void): void; - toString(selector: any): string; - /** - * @method count - * @return number of elements in queue - */ - count(): number; - } - /** - * @module shortestpaths - */ - export module shortestpaths { - - /** - * calculates all-pairs shortest paths or shortest paths from a single node - * @class Calculator - * @constructor - * @param n {number} number of nodes - * @param es {Edge[]} array of edges - */ - class Calculator { - n: number; - es: Link[]; - private neighbours; - constructor(n: number, es: Link[], getSourceIndex: (link: Link) => number, getTargetIndex: (link: Link) => number, getLength: (link: Link) => number); - /** - * compute shortest paths for graph over n nodes with edges an array of source/target pairs - * edges may optionally have a length attribute. 1 is the default. - * Uses Johnson's algorithm. - * - * @method DistanceMatrix - * @return the distance matrix - */ - DistanceMatrix(): number[][]; - /** - * get shortest paths from a specified start node - * @method DistancesFromNode - * @param start node index - * @return array of path lengths - */ - DistancesFromNode(start: number): number[]; - PathFromNodeToNode(start: number, end: number): number[]; - PathFromNodeToNodeWithPrevCost(start: number, end: number, prevCost: (u: number, v: number, w: number) => number): number[]; - private dijkstraNeighbours(start, dest?); - } - } - /** - * @module cola - */ - - /** - * The layout process fires three events: - * - start: layout iterations started - * - tick: fired once per iteration, listen to this to animate - * - end: layout converged, you might like to zoom-to-fit or something at notification of this event - */ - enum EventType { - start = 0, - tick = 1, - end = 2, - } - interface Event { - type: EventType; - alpha: number; - stress?: number; - listener?: () => void; - } - interface Node { - x: number; - y: number; - } - interface Link { - source: NodeType; - target: NodeType; - length?: number; - } - /** - * Main interface to cola layout. - * @class Layout - */ - class Layout { - private _canvasSize; - private _linkDistance; - private _defaultNodeSize; - private _linkLengthCalculator; - private _linkType; - private _avoidOverlaps; - private _handleDisconnected; - private _alpha; - private _lastStress; - private _running; - private _nodes; - private _groups; - private _variables; - private _rootGroup; - private _links; - private _constraints; - private _distanceMatrix; - private _descent; - private _directedLinkConstraints; - private _threshold; - private _visibilityGraph; - private _groupCompactness; - protected event: any; - on(e: EventType | string, listener: (event: Event) => void): Layout; - protected trigger(e: Event): void; - protected kick(): void; - /** - * iterate the layout. Returns true when layout converged. - */ - protected tick(): boolean; - /** - * the list of nodes. - * If nodes has not been set, but links has, then we instantiate a nodes list here, of the correct size, - * before returning it. - * @property nodes {Array} - * @default empty list - */ - nodes(): Array; - nodes(v: Array): Layout; - /** - * a list of hierarchical groups defined over nodes - * @property groups {Array} - * @default empty list - */ - groups(): Array; - groups(x: Array): Layout; - powerGraphGroups(f: Function): Layout; - /** - * if true, the layout will not permit overlaps of the node bounding boxes (defined by the width and height properties on nodes) - * @property avoidOverlaps - * @type bool - * @default false - */ - avoidOverlaps(): boolean; - avoidOverlaps(v: boolean): Layout; - /** - * if true, the layout will not permit overlaps of the node bounding boxes (defined by the width and height properties on nodes) - * @property avoidOverlaps - * @type bool - * @default false - */ - handleDisconnected(): boolean; - handleDisconnected(v: boolean): Layout; - /** - * causes constraints to be generated such that directed graphs are laid out either from left-to-right or top-to-bottom. - * a separation constraint is generated in the selected axis for each edge that is not involved in a cycle (part of a strongly connected component) - * @param axis {string} 'x' for left-to-right, 'y' for top-to-bottom - * @param minSeparation {number|link=>number} either a number specifying a minimum spacing required across all links or a function to return the minimum spacing for each link - */ - flowLayout(axis: string, minSeparation: number | ((t: any) => number)): Layout; - /** - * links defined as source, target pairs over nodes - * @property links {array} - * @default empty list - */ - links(): Array>; - links(x: Array>): Layout; - /** - * list of constraints of various types - * @property constraints - * @type {array} - * @default empty list - */ - constraints(): Array; - constraints(c: Array): Layout; - /** - * Matrix of ideal distances between all pairs of nodes. - * If unspecified, the ideal distances for pairs of nodes will be based on the shortest path distance between them. - * @property distanceMatrix - * @type {Array of Array of Number} - * @default null - */ - distanceMatrix(): Array>; - distanceMatrix(d: Array>): Layout; - /** - * Size of the layout canvas dimensions [x,y]. Currently only used to determine the midpoint which is taken as the starting position - * for nodes with no preassigned x and y. - * @property size - * @type {Array of Number} - */ - size(): Array; - size(x: Array): Layout; - /** - * Default size (assume nodes are square so both width and height) to use in packing if node width/height are not specified. - * @property defaultNodeSize - * @type {Number} - */ - defaultNodeSize(): number; - defaultNodeSize(x: number): Layout; - /** - * The strength of attraction between the group boundaries to each other. - * @property defaultNodeSize - * @type {Number} - */ - groupCompactness(): number; - groupCompactness(x: number): Layout; - /** - * links have an ideal distance, The automatic layout will compute layout that tries to keep links (AKA edges) as close as possible to this length. - */ - linkDistance(): number; - linkDistance(): (t: any) => number; - linkDistance(x: number): Layout; - linkDistance(x: (t: any) => number): Layout; - linkType(f: Function | number): Layout; - convergenceThreshold(): number; - convergenceThreshold(x: number): Layout; - alpha(): number; - alpha(x: number): Layout; - getLinkLength(link: any): number; - static setLinkLength(link: any, length: number): void; - getLinkType(link: any): number; - linkAccessor: { - getSourceIndex: (e: any) => any; - getTargetIndex: (e: any) => any; - setLength: (link: any, length: number) => void; - getType: (l: any) => any; - }; - /** - * compute an ideal length for each link based on the graph structure around that link. - * you can use this (for example) to create extra space around hub-nodes in dense graphs. - * In particular this calculation is based on the "symmetric difference" in the neighbour sets of the source and target: - * i.e. if neighbours of source is a and neighbours of target are b then calculation is: sqrt(|a union b| - |a intersection b|) - * Actual computation based on inspection of link structure occurs in start(), so links themselves - * don't have to have been assigned before invoking this function. - * @param {number} [idealLength] the base length for an edge when its source and start have no other common neighbours (e.g. 40) - * @param {number} [w] a multiplier for the effect of the length adjustment (e.g. 0.7) - */ - symmetricDiffLinkLengths(idealLength: number, w?: number): Layout; - /** - * compute an ideal length for each link based on the graph structure around that link. - * you can use this (for example) to create extra space around hub-nodes in dense graphs. - * In particular this calculation is based on the "symmetric difference" in the neighbour sets of the source and target: - * i.e. if neighbours of source is a and neighbours of target are b then calculation is: |a intersection b|/|a union b| - * Actual computation based on inspection of link structure occurs in start(), so links themselves - * don't have to have been assigned before invoking this function. - * @param {number} [idealLength] the base length for an edge when its source and start have no other common neighbours (e.g. 40) - * @param {number} [w] a multiplier for the effect of the length adjustment (e.g. 0.7) - */ - jaccardLinkLengths(idealLength: number, w?: number): Layout; - /** - * start the layout process - * @method start - * @param {number} [initialUnconstrainedIterations=0] unconstrained initial layout iterations - * @param {number} [initialUserConstraintIterations=0] initial layout iterations with user-specified constraints - * @param {number} [initialAllConstraintsIterations=0] initial layout iterations with all constraints including non-overlap - * @param {number} [gridSnapIterations=0] iterations of "grid snap", which pulls nodes towards grid cell centers - grid of size node[0].width - only really makes sense if all nodes have the same width and height - * @param [keepRunning=true] keep iterating asynchronously via the tick method - */ - start( - initialUnconstrainedIterations?: number, - initialUserConstraintIterations?: number, - initialAllConstraintsIterations?: number, - gridSnapIterations?: number, - keepRunning?: boolean - ): Layout; - resume(): Layout; - stop(): Layout; - prepareEdgeRouting(nodeMargin?: number): void; - routeEdge(d: any, draw: any): any[]; - static getSourceIndex(e: any): any; - static getTargetIndex(e: any): any; - static linkId(e: any): string; - static dragStart(d: any): void; - static dragEnd(d: any): void; - static mouseOver(d: any): void; - static mouseOut(d: any): void; - } - - class D3StyleLayoutAdaptor extends Layout { - event: D3.Dispatch; - trigger(e: Event): void; - kick(): void; - drag: () => any; - constructor(); - on(eventType: EventType | string, listener: () => void): D3StyleLayoutAdaptor; - } - /** - * provides an interface for use with d3: - * - uses the d3 event system to dispatch layout events such as: - * o "start" (start layout process) - * o "tick" (after each layout iteration) - * o "end" (layout converged and complete). - * - uses the d3 timer to queue layout iterations. - * - sets up d3.behavior.drag to drag nodes - * o use `node.call(.drag)` to make nodes draggable - * returns an instance of the Layout itself with which the user - * can interact directly. - */ - function d3adaptor(): D3StyleLayoutAdaptor; - - interface NodeAccessor { - getChildren(v: Node): number[]; - getBounds(v: Node): vpsc.Rectangle; - } - class NodeWrapper { - id: number; - rect: vpsc.Rectangle; - children: number[]; - leaf: boolean; - parent: NodeWrapper; - ports: Vert[]; - constructor(id: number, rect: vpsc.Rectangle, children: number[]); - } - class Vert { - id: number; - x: number; - y: number; - node: NodeWrapper; - line: any; - constructor(id: number, x: number, y: number, node?: NodeWrapper, line?: any); - } - class LongestCommonSubsequence { - s: T[]; - t: T[]; - length: number; - si: number; - ti: number; - reversed: boolean; - constructor(s: T[], t: T[]); - private static findMatch(s, t); - getSequence(): T[]; - } - class GridRouter { - originalnodes: Node[]; - groupPadding: number; - leaves: any[]; - groups: NodeWrapper[]; - nodes: NodeWrapper[]; - cols: any; - rows: any; - root: any; - verts: Vert[]; - edges: any; - backToFront: any; - obstacles: any; - passableEdges: any; - private avg(a); - private getGridDim(axis); - private getDepth(v); - private midPoints(a); - constructor(originalnodes: Node[], accessor: NodeAccessor, groupPadding?: number); - private findLineage(v); - private findAncestorPathBetween(a, b); - siblingObstacles(a: any, b: any): any; - static getSegmentSets(routes: any, x: any, y: any): any[]; - static nudgeSegs(x: string, y: string, routes: any, segments: any, leftOf: any, gap: number): void; - static nudgeSegments(routes: any, x: string, y: string, leftOf: (e1: number, e2: number) => boolean, gap: number): void; - routeEdges(edges: Edge[], gap: number, source: (e: Edge) => number, target: (e: Edge) => number): geom.Point[][][]; - static unreverseEdges(routes: any, routePaths: any): void; - static angleBetween2Lines(line1: geom.Point[], line2: geom.Point[]): number; - private static isLeft(a, b, c); - private static getOrder(pairs); - static orderEdges(edges: any): (l: number, r: number) => boolean; - static makeSegments(path: geom.Point[]): geom.Point[][]; - route(s: number, t: number): geom.Point[]; - static getRoutePath(route: geom.Point[][], cornerradius: number, arrowwidth: number, arrowheight: number): { - routepath: string; - arrowpath: string; - }; - } - /** - * Use cola to do a layout in 3D!! Yay. - * Pretty simple for the moment. - */ - - class Link3D { - source: number; - target: number; - length: number; - constructor(source: number, target: number); - actualLength(x: number[][]): number; - } - class Node3D { - x: number; - y: number; - z: number; - fixed: boolean; - constructor(x?: number, y?: number, z?: number); - } - class Layout3D { - nodes: Node3D[]; - links: Link3D[]; - idealLinkLength: number; - static dims: string[]; - static k: number; - result: number[][]; - constructor(nodes: Node3D[], links: Link3D[], idealLinkLength: number); - linkLength(l: Link3D): number; - descent: Descent; - start(iterations?: number): Layout3D; - tick(): number; - } -} diff --git a/DKBFrontEnd/src/typings/local.d.ts b/DKBFrontEnd/src/typings/local.d.ts deleted file mode 100644 index 8498b9786..000000000 --- a/DKBFrontEnd/src/typings/local.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -/// -/// -/// -/// -/// -/// -/// -/// -/// diff --git a/DKBFrontEnd/src/typings/local/bootstrap.jquery/bootstrap.jquery.d.ts b/DKBFrontEnd/src/typings/local/bootstrap.jquery/bootstrap.jquery.d.ts deleted file mode 100644 index 1fcecdc0f..000000000 --- a/DKBFrontEnd/src/typings/local/bootstrap.jquery/bootstrap.jquery.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -interface JQuery { - /** - * Shows or hides a modal dialog - **/ - modal(showOrHide: string): void; - modal(options: { - backdrop: string; - keyboard: boolean; - show: boolean; - }): void; - - serializeObject(): any; - deserialize(data: any): void; - - fileupload(options: { - url: string; - dataType: string; - done: (e: any, data: any) => void; - progressall: (e: any, data: any) => void; - start: (e: any, data: any) => void; - onRemove: (id: string) => void; - }): JQuery; -} - -interface JQuerySupport { - fileInput?: boolean; -} diff --git a/DKBFrontEnd/src/typings/local/require/require.d.ts b/DKBFrontEnd/src/typings/local/require/require.d.ts deleted file mode 100644 index 3325410cd..000000000 --- a/DKBFrontEnd/src/typings/local/require/require.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -declare var require: { - (path: string): T; - (paths: string[], callback: (...modules: any[]) => void): void; - ensure: (paths: string[], callback: (require: (path: string) => T) => void) => void; -}; \ No newline at end of file diff --git a/DKBFrontEnd/src/webpack.config.js b/DKBFrontEnd/src/webpack.config.js deleted file mode 100644 index bf0daca2a..000000000 --- a/DKBFrontEnd/src/webpack.config.js +++ /dev/null @@ -1,56 +0,0 @@ -var webpack = require('webpack'); -var path = require('path'); - -var npmDir = path.join(__dirname, 'node_modules'); - -// if BUNDLE_PEERS is set, we'll produce bundle with all dependencies -var bundlePeers = Boolean(process.env.BUNDLE_PEERS); - -module.exports = { - entry: { - ontodia: path.join(__dirname, 'src', 'index.ts'), - }, - resolve: { - extensions: ['', '.ts', '.tsx', '.webpack.js', '.web.js', '.js'], - alias: { - // Backbone provided by joint.js, to prevent module duplication which - // causes errors when Ontodia uses Backbone models from joint.js - 'backbone': path.join(npmDir, 'backbone', 'backbone.js'), - // awful and temporary workaround to reference browser bundle instead of node's, see: - // https://github.com/wycats/handlebars.js/issues/1102 - 'handlebars': path.join(npmDir, 'handlebars', 'dist', 'handlebars.min.js'), - }, - }, - module: { - loaders: [ - {test: /\.ts$|\.tsx$/, loader: 'ts-loader'}, - {test: /\.css$/, loader: 'style-loader!css-loader'}, - {test: /\.scss$/, loader: 'style-loader!css-loader!sass-loader'}, - {test: /\.jpe?g$/, loader: 'url-loader?mimetype=image/jpeg'}, - {test: /\.gif$/, loader: 'url-loader?mimetype=image/gif'}, - {test: /\.png$/, loader: 'url-loader?mimetype=image/png'}, - ], - }, - plugins: [], - output: { - path: path.join(__dirname, 'dist'), - filename: 'ontodia.js', - library: 'Ontodia', - libraryTarget: 'umd', - }, - externals: !bundlePeers ? { - 'd3-color': true, - 'intro.js': true, - 'jointjs': true, - 'jquery': true, - 'handlebars': true, - 'lodash': true, - 'n3': true, - 'react': true, - 'react-dom': true, - 'backbone': true, - 'webcola': true, - 'whatwg-fetch': true, - } : {}, - devtool: '#source-map', -}; diff --git a/DKBFrontEnd/src/webpack.demo.config.js b/DKBFrontEnd/src/webpack.demo.config.js deleted file mode 100644 index ad0c4dbc9..000000000 --- a/DKBFrontEnd/src/webpack.demo.config.js +++ /dev/null @@ -1,135 +0,0 @@ -var webpack = require('webpack'); -var path = require('path'); - -var CommonsChunkPlugin = require("webpack/lib/optimize/CommonsChunkPlugin"); -var HtmlWebpackPlugin = require('html-webpack-plugin'); - -var npmDir = path.join(__dirname, 'node_modules'); - -var webPrefix = process.env.WEB_PREFIX; -if (!Boolean(webPrefix)) { - webPrefix = ''; -} - -if (webPrefix.length == 0) { - webPrefix= '/'; -} else if(webPrefix.charAt(webPrefix.length - 1) != '/') { - webPrefix+= '/'; -} - - -var graphLimit = process.env.RESTRICT_GRAPH; -var graphLimitEnd = ''; -if (!Boolean(graphLimit)) { - graphLimit = graphLimitEnd = ''; -} else { - graphLimit = `GRAPH <${graphLimit}> {`; - graphLimitEnd = '}'; -} - -module.exports = { - entry: { - sparql: path.join(__dirname, 'src', 'examples', 'sparql.ts'), - sparqlNoStats: path.join(__dirname, 'src', 'examples', 'sparqlNoStats.ts'), - sparqlConstruct: path.join(__dirname, 'src', 'examples', 'sparqlConstruct.ts'), - sparqlRDFGraph: path.join(__dirname, 'src', 'examples', 'sparqlRDFGraph.ts'), - styleCustomization: path.join(__dirname, 'src', 'examples', 'styleCustomization.ts'), - }, - resolve: { - extensions: ['', '.ts', '.tsx', '.webpack.js', '.web.js', '.js'], - alias: { - // Backbone provided by joint.js, to prevent module duplication which - // causes errors when Ontodia uses Backbone models from joint.js - 'backbone': path.join(npmDir, 'backbone', 'backbone.js'), - // awful and temporary workaround to reference browser bundle instead of node's, see: - // https://github.com/wycats/handlebars.js/issues/1102 - 'handlebars': path.join(npmDir, 'handlebars', 'dist', 'handlebars.min.js'), - }, - }, - module: { - preLoaders: [ - { - test: /\.ts$/, - loader: 'string-replace', - query: { - multiple: [ - { search: '__SPARQL_ENDPOINT__', - replace: "'" + webPrefix + 'sparql-endpoint' + "'", - flags: 'g' }, - { search: '__GRAPH_LIMIT_BEGIN__', - replace: graphLimit, - flags: 'g' }, - { search: '__GRAPH_LIMIT_END__', - replace: graphLimitEnd, - flags: 'g' }, - ] - } - }, - ], - loaders: [ - {test: /\.ts$|\.tsx$/, loader: 'ts-loader'}, - {test: /\.css$/, loader: 'style-loader!css-loader'}, - {test: /\.scss$/, loader: 'style-loader!css-loader!sass-loader'}, - {test: /\.jpe?g$/, loader: 'url-loader?mimetype=image/jpeg'}, - {test: /\.gif$/, loader: 'url-loader?mimetype=image/gif'}, - {test: /\.png$/, loader: 'url-loader?mimetype=image/png'}, - ], - }, - plugins: [ - new HtmlWebpackPlugin({ - title: 'Ontodia SparQL Demo', - chunks: ['commons', 'sparql'], - template: path.join(__dirname, 'src', 'examples', 'template.ejs'), - publicPath: webPrefix, - }), - new HtmlWebpackPlugin({ - filename: 'sparqlNoStats.html', - title: 'Ontodia SparQL Demo', - chunks: ['commons', 'sparqlNoStats'], - template: path.join(__dirname, 'src', 'examples', 'template.ejs'), - publicPath: webPrefix, - }), - new HtmlWebpackPlugin({ - filename: 'sparqlConstruct.html', - title: 'Ontodia SparQL Construct Demo', - chunks: ['commons', 'sparqlConstruct'], - template: path.join(__dirname, 'src', 'examples', 'template.ejs'), - publicPath: webPrefix, - }), - new HtmlWebpackPlugin({ - filename: 'sparqlRDFGraph.html', - title: 'Ontodia SparQL RDF Graph Demo', - chunks: ['commons', 'sparqlRDFGraph'], - template: path.join(__dirname, 'src', 'examples', 'template.ejs'), - publicPath: webPrefix, - }), - new HtmlWebpackPlugin({ - filename: 'styleCustomization.html', - title: 'Ontodia Style Customization Demo', - chunks: ['commons', 'styleCustomization', ], - template: path.join(__dirname, 'src', 'examples', 'template.ejs'), - publicPath: webPrefix, - }), - new CommonsChunkPlugin('commons', 'commons.chunk.js'), - ], - output: { - path: path.join(__dirname, 'dist', 'examples'), - filename: '[name].bundle.js', - chunkFilename: '[id].chunk.js', - publicPath: webPrefix, - }, - devtool: '#source-map', - devServer: { - historyApiFallback: { - index: webPrefix, - }, - proxy: { - [webPrefix + 'sparql-endpoint**']: { - target: process.env.SPARQL_ENDPOINT, - pathRewrite: {[webPrefix + 'sparql-endpoint'] : ''}, - changeOrigin: true, - secure: false, - }, - }, - }, -}; diff --git a/DKBFrontEnd/vendor/.editorconfig b/DKBFrontEnd/vendor/.editorconfig deleted file mode 100644 index 2aadc959b..000000000 --- a/DKBFrontEnd/vendor/.editorconfig +++ /dev/null @@ -1,20 +0,0 @@ -# http://editorconfig.org - -# top-most EditorConfig file -root = true - -[*] -charset = utf-8 -insert_final_newline = true - -[*.{ts,tsx}] -indent_style = space -indent_size = 4 - -[*.css] -indent_style = space -indent_size = 4 - -[*.scss] -indent_style = space -indent_size = 2 diff --git a/DKBFrontEnd/vendor/.gitignore b/DKBFrontEnd/vendor/.gitignore deleted file mode 100644 index db88f2b40..000000000 --- a/DKBFrontEnd/vendor/.gitignore +++ /dev/null @@ -1,10 +0,0 @@ -/node_modules -/dist -/*.sh -/*.bat - -.idea/ -.vscode/ - -*.iml -*.log diff --git a/DKBFrontEnd/vendor/.npmignore b/DKBFrontEnd/vendor/.npmignore deleted file mode 100644 index ac07a964d..000000000 --- a/DKBFrontEnd/vendor/.npmignore +++ /dev/null @@ -1,10 +0,0 @@ -/node_modules -/dist/dts -/*.sh -/*.bat - -.idea/ -.vscode/ - -*.iml -*.log diff --git a/DKBFrontEnd/vendor/.travis.yml b/DKBFrontEnd/vendor/.travis.yml deleted file mode 100644 index 52ad81f2f..000000000 --- a/DKBFrontEnd/vendor/.travis.yml +++ /dev/null @@ -1,4 +0,0 @@ -language: node_js -node_js: - - "6" - - "4" diff --git a/DKBFrontEnd/vendor/CHANGELOG.md b/DKBFrontEnd/vendor/CHANGELOG.md deleted file mode 100644 index b0d80f5fd..000000000 --- a/DKBFrontEnd/vendor/CHANGELOG.md +++ /dev/null @@ -1,186 +0,0 @@ -# Change Log -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](http://keepachangelog.com/) -and this project adheres to [Semantic Versioning](http://semver.org/). - -## [Latest] -### Added -- Support for IE11 (without exporting to SVG/PNG). -- Workspace API for external toolbar. - -### Changed -- Replaced `foreignObject`-based element rendering with overlayed -HTML elements. -- Filter non-left mouse button clicks on paper. -- Automatically set link type visible when adding elements through -Connections menu. -- Tutorial don't automatically show up on a first visit by default. - -### Fixed -- Inconsistent elements and links rendering between editor and exported SVG. -- Paper always including initial canvas area when adjusting size to content. -- Rendering `Halo` in a wrong place when paper origin changes. -- Non-scrollable Connections panel in Firefox and IE11. -- Lost scroll position in Instances panel on 'Show more' button press -(introduced in [0.3.8]). -- Missing localized labels with different languages for classes. - -### Breaking changes -- `DiagramModel.requestElementData()` don't requests for links. -- Connected links data cleared from model on element remove. - -## [0.3.8] - 2017-01-24 -### Added -- Saving to/loading from LocalStorage examples. - -### Changed -- Diagram content now centered at paper after performing force layout. -- Updated to recent react typings and fixed relevant errors - -### Fixed -- Sorting elements properties by label. -- Placement of newly added from Connections popup elements. -- Lost links geometry when importing a layout. - -### Breaking changes -- Replaced DiagramModel.importLayout()'s `preloadedLinks` parameter with -`validateLinks`: when specified, marks all links from layout as `layoutOnly` -and requests diagram links at the end of importing process. -- Removed non-expiring "cache" `DiagramModel.elements`, replaced by -`cells`/`elements`/`links`/`getElement` accessors. -- Removed `presentOnDiagram` property from Element: now element is present -if it's in a graph, otherwise it's considered to be absent. - -## [0.3.7] - 2017-01-12 -### Added -- Select/deselect all elements checkbox in Connections popup. - -### Fixed -- Too close zoom to fit on diagrams with small number of elements, -making elements unnessesary big. - -## [0.3.6] - 2017-01-11 -### Fixed -- Broken attachment of links to nodes when loading a diagram. - -## [0.3.5] - 2016-12-29 -### Added -- Ability display labels for element properties by implementing -`DataProvider.propertyInfo()`. - -### Changed -- Replaced `d3` dependency with `d3-color`. - -### Fixed -- Exported missing `LayoutData` types. -- Error when `WikidataProvider.filter()` query execution encounters literals -or non-entity IRIs. -- Diagram area scroll jump on element click when workspace area size changed. -- Filter trash nodes (hyperlinks to resources expressed as IRIs) -in `WikidataProvider`. -- Made diagram area scroll smoother in Webkit browsers. -- Preserve full URI when drag'n'drop links with absolute URI with hashpart -onto the diagram area. -- Printing person template with expanded properties. - -## [0.3.3] - 2016-12-15 -### Added -- "Search for connected elements" button to Halo. - -### Changed -- Disabled "click on element to search". -- Hide Connections popup when click on empty paper space. - -### Fixed -- Display error in Connections popup on failed request. -- Inconsistent thumbnail width in default element thumbnail. -- Made paper adjust its size when element is expanded or collapsed. -- `WikidataProvider`: - * made search ordering consistent; - * prevent label and property duplication; - * replaced full images with thumbnails when using `imageClassUris`; - * query elementInfo using single SPARQL query for all elements; - * corrected `linkTypesOf` query to return actual connected elements count. - -## [0.3.2] - 2016-12-14 -### Added -- Fetching for link between elements on a diagram at the end of import. - -### Changed -- Significant performance improvments when importing diagram. -- Increased preferred link length in force layout. - -### Fixed -- Unable to export as PNG/SVG diagram that contains element with SVG thumbnail. -- Unable to export as PNG/SVG in Firefox >= 50. -- Connections popup height overflow in Firefox. - -### Breaking changes -- Link arrowheads implementation replaced by native -SVG markers, changed link style customization interface. -- Rewritten scrollable diagram component `PaperArea` -in React way, moved `zoomToFit()` and other related members. -This change fixes many issues with scrolling and resizing diagram area. -- Fixed typo in `GraphBuilder.getGraphFromConstruct()` method name. - -## [0.3.1] - 2016-11-22 -### Added -- Warning if browser is IE. - -### Fixed -- Collapsing/expanding widgets on resizable panels. -- Text wrapping in `big-icon-template`. -- Ignore literals when creating diagram from SparQL construct query. - -## [0.3.0] - 2016-10-03 -### Added -- Construct diagram from RDF graph using `GraphBuilder`. -- Ability to customize style of links on diagram. -- Ability to specify custom element image using user-provided function. -- Extension points for undo/redo support and element selection/halo. -- Default halo to operate on selected element. -- Wikidata data provider to browse wikidata SparQL endpoints. -- Ability to filter link types in Connections panel by name. - -### Changed -- Custom SVG layout of elements replaced with HTML-based one with React and -Handlebars as template engines with ability to register custom templates. -- Faster exporting diagram as SVG/PNG. -- Replaced bundled typings for backbone and react with @types/* -- Make Connections panel intially hidden. -- Replaced icons from Glyphicons with FontAwesome. -- Replaced force layout implementation from Springy to WebCola. - -### Fixed -- `SparqlEndpoint` error when `imageClassUris` left unspecifed. -- Compile errors when importing library to webpack-based TypeScript projects. -- Hide "Share" button from workspace when corresponding callback -is not specified. -- Diagram canvas scrolling in Safari. - -### Removed -- "All connections" group from Connections panel to support lazy loading of -link types. - -## [0.2.1] - 2016-09-14 -### Added -- Ability to customize colors of elements on diagram by providing option to -`Workspace` props. -- Displaying custom images on elements by specifying image URL when element -info loaded from `DataProvider`. - -## 0.2.0 - 2016-09-12 -### Added -- Ontodia published on GitHub as OSS project. - -[Latest]: https://github.com/ontodia-org/ontodia/compare/v0.3.8...HEAD -[0.3.8]: https://github.com/ontodia-org/ontodia/compare/v0.3.7...v0.3.8 -[0.3.7]: https://github.com/ontodia-org/ontodia/compare/v0.3.6...v0.3.7 -[0.3.6]: https://github.com/ontodia-org/ontodia/compare/v0.3.5...v0.3.6 -[0.3.5]: https://github.com/ontodia-org/ontodia/compare/v0.3.3...v0.3.5 -[0.3.3]: https://github.com/ontodia-org/ontodia/compare/v0.3.2...v0.3.3 -[0.3.2]: https://github.com/ontodia-org/ontodia/compare/v0.3.1...v0.3.2 -[0.3.1]: https://github.com/ontodia-org/ontodia/compare/v0.3.0...v0.3.1 -[0.3.0]: https://github.com/ontodia-org/ontodia/compare/v0.2.1...v0.3.0 -[0.2.1]: https://github.com/ontodia-org/ontodia/compare/v0.2.0...v0.2.1 diff --git a/DKBFrontEnd/vendor/LICENSE b/DKBFrontEnd/vendor/LICENSE deleted file mode 100644 index 48a1cd55d..000000000 --- a/DKBFrontEnd/vendor/LICENSE +++ /dev/null @@ -1,16 +0,0 @@ -Ontodia data diagramming library -Copyright (C) 2016 Vismart, Ltd. - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, you can receive a copy -of the GNU Lesser General Public License from http://www.gnu.org/ diff --git a/DKBFrontEnd/vendor/README.md b/DKBFrontEnd/vendor/README.md deleted file mode 100644 index 4a1fda8a8..000000000 --- a/DKBFrontEnd/vendor/README.md +++ /dev/null @@ -1,44 +0,0 @@ -# Ontodia [![npm](https://img.shields.io/npm/v/ontodia.svg)](https://www.npmjs.com/package/ontodia) [![Travis CI](https://img.shields.io/travis/ontodia-org/ontodia.svg)](https://travis-ci.org/ontodia-org/ontodia) # - -Ontodia is a JavaScript library that allows to visualize, navigate and explore the data in the form of an interactive graph based on underlying data sources. The library is a major front-end component in
    ontodia.org web application that provides semantic data visualization services. - -## What is Ontodia for? - -Ontodia allows you to create and persist diagrams made from connected data - relational, object, semantic. - -It was designed to visualize RDF data sets in particular, but could be tailored to almost any data sourece by implementing data provider interface. - -## Core features - -- Visual navigation and diagramming over large graph data sets -- Rich graph visualization and context-aware navigation features -- Ability to store and retrieve diagrams -- User friendly - no graph query language or prior knowledge of the schema required -- Customizable user interface (by modifying templates for nodes and links) and data storage back-end - -## How to try it? - -You can: -- Open ontodia.org [demo diagram](http://app.ontodia.org/diagram?sharedDiagram=49689f29-82bc-405d-b5f6-33507f1c1444) and navigate through demo data set -- Create an account at [ontodia.org](http://app.ontodia.org/register), browser through sample diagrams, download your rdf file or point to your sparql endpoint to build diagrams over your data -- Follow developer tutorials at [developer documentation page](https://github.com/ontodia-org/ontodia/wiki) - -## How to use it - -- Use it as service at [ontodia.org](http://ontodia.org). Connect to your data, creata and share diagrams -- Customize it and embed into your web application as a JavaScript library - -## Licence - -Ontodia library is distributed under LGPL-2.1. Commercial license with additional features, support and custom development is available, please contact us at [ontodia-people@vismart.biz](ontodia-people@vismart.biz). - - -## Developer documentation and contributing - -Developer documentation is available at [wiki page](https://github.com/ontodia-org/ontodia/wiki). - -## Whom do I talk to? ### - -Feel free to write to [ontodia-people@vismart.biz](mailto:ontodia-people@vismart.biz). - -In order to simplify for you the access to our development team and to our growing community, we'd like to invite you to join our Slack channel. Here's the [form](https://goo.gl/forms/mfKFRRNU9ToHxGGM2) to fill out, so we can add you to the list of members. On our slack channel you can get answers to your questions regarding the library and ontodia.org service directly from developers and other users. diff --git a/DKBFrontEnd/vendor/STYLEGUIDE.md b/DKBFrontEnd/vendor/STYLEGUIDE.md deleted file mode 100644 index f9e5e92dd..000000000 --- a/DKBFrontEnd/vendor/STYLEGUIDE.md +++ /dev/null @@ -1,64 +0,0 @@ -* Pay attention to TSLint warnings. - -* Module files and directories should be named in camelCase; if module has single important entity like -class or function then this file should be named after it: - -``` - // DO - (src/foo/bar/bazBazBaz.ts) - export class BazBazBaz { ... } - export function barBaz(baz: BazBazBaz) { ... } - export default BazBazBaz; - - // DON'T - (src/foo/bar/BazBazBaz.ts) - (src/foo/bar/baz-baz-baz.ts) -``` - -* Inline interface declarations and module imports block should have spaces inside braces, -object literals should not: - -``` - // DO - import { barBaz, BazBazBaz } from '../bar/bazBazBaz'; - const point: { x: number; y: number; } = {x: 42, y: 10}; - export { point }; - - // DON'T - import {barBaz, BazBazBaz} from '../bar/bazBazBaz'; - const point: {x: number; y: number;} = { x: 42, y: 10; }; - export {point}; -``` - -* Don't use parenthesis around lambda function with single type inferenced argument: - -``` - // DO - items.map(item => ...) - - // DON'T - items.map((item) => ...) -``` - -* Use const keyword to declare variables by default instead of let if you are not intended to modify it. - -* Declare imports from libraries first, then imports from project other than current module directory, -then modules from current directory: - -``` - // DO - import * as $ from 'jquery'; - import { keyBy } from 'lodash'; - - import { BazBazBaz } from '../bar/bazBazBaz'; - - import { Foo } from './foo'; - import { frob } from './frob'; - - // DON'T - import { Foo } from './foo'; - import * as $ from 'jquery'; - import { BazBazBaz } from '../bar/bazBazBaz'; - import { keyBy } from 'lodash'; - import { Foo } from './frob'; -``` diff --git a/DKBFrontEnd/vendor/images/add-to-filter.png b/DKBFrontEnd/vendor/images/add-to-filter.png deleted file mode 100644 index feeedcd45..000000000 Binary files a/DKBFrontEnd/vendor/images/add-to-filter.png and /dev/null differ diff --git a/DKBFrontEnd/vendor/images/arrow-left.png b/DKBFrontEnd/vendor/images/arrow-left.png deleted file mode 100644 index b7bbb2270..000000000 Binary files a/DKBFrontEnd/vendor/images/arrow-left.png and /dev/null differ diff --git a/DKBFrontEnd/vendor/images/arrow-left1.png b/DKBFrontEnd/vendor/images/arrow-left1.png deleted file mode 100644 index 0513e37ff..000000000 Binary files a/DKBFrontEnd/vendor/images/arrow-left1.png and /dev/null differ diff --git a/DKBFrontEnd/vendor/images/arrow-right.png b/DKBFrontEnd/vendor/images/arrow-right.png deleted file mode 100644 index d58f95362..000000000 Binary files a/DKBFrontEnd/vendor/images/arrow-right.png and /dev/null differ diff --git a/DKBFrontEnd/vendor/images/arrow-right1.png b/DKBFrontEnd/vendor/images/arrow-right1.png deleted file mode 100644 index 4925f6824..000000000 Binary files a/DKBFrontEnd/vendor/images/arrow-right1.png and /dev/null differ diff --git a/DKBFrontEnd/vendor/images/close-connections.png b/DKBFrontEnd/vendor/images/close-connections.png deleted file mode 100644 index d89ed4caa..000000000 Binary files a/DKBFrontEnd/vendor/images/close-connections.png and /dev/null differ diff --git a/DKBFrontEnd/vendor/images/collapse-properties.png b/DKBFrontEnd/vendor/images/collapse-properties.png deleted file mode 100644 index a21357478..000000000 Binary files a/DKBFrontEnd/vendor/images/collapse-properties.png and /dev/null differ diff --git a/DKBFrontEnd/vendor/images/connections.png b/DKBFrontEnd/vendor/images/connections.png deleted file mode 100644 index 61550334a..000000000 Binary files a/DKBFrontEnd/vendor/images/connections.png and /dev/null differ diff --git a/DKBFrontEnd/vendor/images/delete.png b/DKBFrontEnd/vendor/images/delete.png deleted file mode 100644 index 25ce6a673..000000000 Binary files a/DKBFrontEnd/vendor/images/delete.png and /dev/null differ diff --git a/DKBFrontEnd/vendor/images/expand-link.png b/DKBFrontEnd/vendor/images/expand-link.png deleted file mode 100644 index 9002a420e..000000000 Binary files a/DKBFrontEnd/vendor/images/expand-link.png and /dev/null differ diff --git a/DKBFrontEnd/vendor/images/expand-properties.png b/DKBFrontEnd/vendor/images/expand-properties.png deleted file mode 100644 index 2ebad8c5c..000000000 Binary files a/DKBFrontEnd/vendor/images/expand-properties.png and /dev/null differ diff --git a/DKBFrontEnd/vendor/images/expand-properties_100x100.png b/DKBFrontEnd/vendor/images/expand-properties_100x100.png deleted file mode 100644 index e5a571e46..000000000 Binary files a/DKBFrontEnd/vendor/images/expand-properties_100x100.png and /dev/null differ diff --git a/DKBFrontEnd/vendor/images/resizable-column-handle.png b/DKBFrontEnd/vendor/images/resizable-column-handle.png deleted file mode 100644 index 9b23af024..000000000 Binary files a/DKBFrontEnd/vendor/images/resizable-column-handle.png and /dev/null differ diff --git a/DKBFrontEnd/vendor/images/transparent-background.png b/DKBFrontEnd/vendor/images/transparent-background.png deleted file mode 100644 index 06ee8e08e..000000000 Binary files a/DKBFrontEnd/vendor/images/transparent-background.png and /dev/null differ diff --git a/DKBFrontEnd/vendor/images/tree-leaf-folder.png b/DKBFrontEnd/vendor/images/tree-leaf-folder.png deleted file mode 100644 index 5101846a3..000000000 Binary files a/DKBFrontEnd/vendor/images/tree-leaf-folder.png and /dev/null differ diff --git a/DKBFrontEnd/vendor/images/tree-leaf.png b/DKBFrontEnd/vendor/images/tree-leaf.png deleted file mode 100644 index 4e8089154..000000000 Binary files a/DKBFrontEnd/vendor/images/tree-leaf.png and /dev/null differ diff --git a/DKBFrontEnd/vendor/images/tree-node-class.png b/DKBFrontEnd/vendor/images/tree-node-class.png deleted file mode 100644 index eb9573493..000000000 Binary files a/DKBFrontEnd/vendor/images/tree-node-class.png and /dev/null differ diff --git a/DKBFrontEnd/vendor/package.json b/DKBFrontEnd/vendor/package.json deleted file mode 100644 index 0a1fd7c51..000000000 --- a/DKBFrontEnd/vendor/package.json +++ /dev/null @@ -1,80 +0,0 @@ -{ - "name": "ontodia", - "version": "0.4.0-dev.20170307", - "description": "Ontodia Library", - "repository": { - "type": "git", - "url": "git+ssh://git@github.com/ontodia-org/ontodia.git" - }, - "keywords": [ - "owl", - "graph", - "rdf", - "diagram", - "sparql" - ], - "author": { - "name": "ontodia.org", - "url": "ontodia.org" - }, - "license": "LGPL-2.1", - "bugs": { - "url": "https://github.com/ontodia-org/ontodia/issues" - }, - "homepage": "https://github.com/ontodia-org/ontodia#readme", - "scripts": { - "build": "npm run _webpack && npm run _typings", - "demo": "node ./node_modules/webpack-dev-server/bin/webpack-dev-server.js --port 10444 --config webpack.demo.config.js --content-base dist/", - "_typings-tsc": "node ./node_modules/typescript/bin/tsc --declaration --outDir dist/dts", - "_typings-dts-bundle": "node ./node_modules/dts-bundle/lib/dts-bundle.js --main dist/dts/index.d.ts --name ontodia --out ../ontodia.d.ts", - "_typings": "npm run _typings-tsc && npm run _typings-dts-bundle", - "test": "npm run build", - "_webpack": "node ./node_modules/webpack/bin/webpack.js", - "start" : "node ./node_modules/webpack-dev-server/bin/webpack-dev-server.js --port 5000 --host 0.0.0.0 --config webpack.demo.config.js --content-base dist/" - }, - "dependencies": { - "d3-color": "1.0.2", - "handlebars": "4.0.5", - "intro.js": "1.1.1", - "jointjs": "0.9.10", - "jquery": "2.2.1", - "lodash": "4.15.0", - "n3": "0.6.1", - "webcola": "3.1.3", - "whatwg-fetch": "2.0.2" - }, - "peerDependencies": { - "@types/backbone": "*", - "@types/react": "*", - "react": "^15.0.0", - "react-dom": "^15.0.0" - }, - "devDependencies": { - "@types/whatwg-fetch": "0.0.33", - "@types/backbone": "1.3.33", - "@types/d3-color": "1.0.4", - "@types/lodash": "4.14.37", - "@types/react": "0.14.55", - "@types/react-dom": "0.14.19", - "css-loader": "0.23.1", - "dts-bundle": "0.5.0", - "exports-loader": "0.6.3", - "expose-loader": "0.7.1", - "file-loader": "0.8.5", - "html-webpack-plugin": "2.22.0", - "json-loader": "0.5.4", - "jstree": "3.2.1", - "node-sass": "3.10.1", - "react": "15.3.2", - "react-dom": "15.3.2", - "sass-loader": "4.0.2", - "style-loader": "0.13.1", - "ts-loader": "0.8.2", - "typescript": "2.1.4", - "url-loader": "0.5.7", - "webpack": "1.13.2", - "webpack-dev-server": "1.16.2" - }, - "main": "dist/ontodia.js", - "typings": "dist/ontodia.d.ts" -} diff --git a/DKBFrontEnd/vendor/src/examples/common.ts b/DKBFrontEnd/vendor/src/examples/common.ts deleted file mode 100644 index 7b97b3f43..000000000 --- a/DKBFrontEnd/vendor/src/examples/common.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { LayoutData } from '../index'; - -export function onPageLoad(callback: (container: HTMLDivElement) => void) { - document.addEventListener('DOMContentLoaded', () => { - const container = document.createElement('div'); - container.id = 'root'; - document.body.appendChild(container); - callback(container); - }); -} - -export function tryLoadLayoutFromLocalStorage(): LayoutData | undefined { - if (window.location.hash.length > 1) { - try { - const key = window.location.hash.substring(1); - const unparsedLayout = localStorage.getItem(key); - return unparsedLayout && JSON.parse(unparsedLayout); - } catch (e) { /* ignore */ } - } - return undefined; -} - -export function saveLayoutToLocalStorage(layout: LayoutData): string { - const randomKey = Math.floor((1 + Math.random()) * 0x10000000000) - .toString(16).substring(1); - localStorage.setItem(randomKey, JSON.stringify(layout)); - return randomKey; -} diff --git a/DKBFrontEnd/vendor/src/examples/dbpedia.ts b/DKBFrontEnd/vendor/src/examples/dbpedia.ts deleted file mode 100644 index 453a3f001..000000000 --- a/DKBFrontEnd/vendor/src/examples/dbpedia.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { createElement, ClassAttributes } from 'react'; -import * as ReactDOM from 'react-dom'; - -import { Workspace, WorkspaceProps, SparqlDataProvider } from '../index'; - -import { onPageLoad, tryLoadLayoutFromLocalStorage, saveLayoutToLocalStorage } from './common'; -import { SparqlQueryMethod } from "../ontodia/data/sparql/sparqlDataProvider"; -import { DBPediaSettings } from "../ontodia/data/sparql/sparqlDataProviderSettings"; - -require('jointjs/css/layout.css'); -require('jointjs/css/themes/default.css'); - -function onWorkspaceMounted(workspace: Workspace) { - if (!workspace) { return; } - - const model = workspace.getModel(); - model.graph.on('action:iriClick', (iri: string) => { - window.open(iri); - console.log(iri); - }); - - const layoutData = tryLoadLayoutFromLocalStorage(); - model.importLayout({ - layoutData, - validateLinks: true, - dataProvider: new SparqlDataProvider({ - endpointUrl: 'http://dbpedia.org/sparql', - imagePropertyUris: [ - 'http://xmlns.com/foaf/0.1/depiction', - 'http://xmlns.com/foaf/0.1/img', - ], - queryMethod: SparqlQueryMethod.GET, - }, DBPediaSettings), - }); -} - -const props: WorkspaceProps & ClassAttributes = { - ref: onWorkspaceMounted, - onSaveDiagram: workspace => { - const {layoutData} = workspace.getModel().exportLayout(); - window.location.hash = saveLayoutToLocalStorage(layoutData); - window.location.reload(); - }, -}; - -onPageLoad(container => ReactDOM.render(createElement(Workspace, props), container)); diff --git a/DKBFrontEnd/vendor/src/examples/demo.ts b/DKBFrontEnd/vendor/src/examples/demo.ts deleted file mode 100644 index 21ed2ee9d..000000000 --- a/DKBFrontEnd/vendor/src/examples/demo.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { createElement, ClassAttributes } from 'react'; -import * as ReactDOM from 'react-dom'; - -import { Workspace, WorkspaceProps, DemoDataProvider } from '../index'; - -import { onPageLoad, tryLoadLayoutFromLocalStorage, saveLayoutToLocalStorage } from './common'; - -require('jointjs/css/layout.css'); -require('jointjs/css/themes/default.css'); - -function onWorkspaceMounted(workspace: Workspace) { - if (!workspace) { return; } - - const model = workspace.getModel(); - model.graph.on('action:iriClick', (iri: string) => console.log(iri)); - - const layoutData = tryLoadLayoutFromLocalStorage(); - model.importLayout({layoutData, dataProvider: new DemoDataProvider(), validateLinks: true}); -} - -const props: WorkspaceProps & ClassAttributes = { - ref: onWorkspaceMounted, - onSaveDiagram: workspace => { - const {layoutData} = workspace.getModel().exportLayout(); - window.location.hash = saveLayoutToLocalStorage(layoutData); - window.location.reload(); - }, -}; - -onPageLoad(container => ReactDOM.render(createElement(Workspace, props), container)); diff --git a/DKBFrontEnd/vendor/src/examples/sparql.ts b/DKBFrontEnd/vendor/src/examples/sparql.ts deleted file mode 100644 index 0e50f9116..000000000 --- a/DKBFrontEnd/vendor/src/examples/sparql.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { createElement, ClassAttributes } from 'react'; -import * as ReactDOM from 'react-dom'; - -import { Workspace, WorkspaceProps, SparqlDataProvider, OWLStatsSettings, SparqlQueryMethod } from '../index'; - -import { onPageLoad, tryLoadLayoutFromLocalStorage, saveLayoutToLocalStorage } from './common'; - -require('jointjs/css/layout.css'); -require('jointjs/css/themes/default.css'); - -function onWorkspaceMounted(workspace: Workspace) { - if (!workspace) { return; } - - const model = workspace.getModel(); - model.graph.on('action:iriClick', (iri: string) => { - window.open(iri); - console.log(iri); - }); - - const layoutData = tryLoadLayoutFromLocalStorage(); - model.importLayout({ - layoutData, - validateLinks: true, - dataProvider: new SparqlDataProvider({ - endpointUrl: '/sparql-endpoint', - imagePropertyUris: [ - 'http://collection.britishmuseum.org/id/ontology/PX_has_main_representation', - 'http://xmlns.com/foaf/0.1/img', - ], - queryMethod: SparqlQueryMethod.GET - }, OWLStatsSettings), - }); -} - -const props: WorkspaceProps & ClassAttributes = { - ref: onWorkspaceMounted, - onSaveDiagram: workspace => { - const {layoutData} = workspace.getModel().exportLayout(); - window.location.hash = saveLayoutToLocalStorage(layoutData); - window.location.reload(); - }, -}; - -onPageLoad(container => ReactDOM.render(createElement(Workspace, props), container)); diff --git a/DKBFrontEnd/vendor/src/examples/sparqlConstruct.ts b/DKBFrontEnd/vendor/src/examples/sparqlConstruct.ts deleted file mode 100644 index bb95a7692..000000000 --- a/DKBFrontEnd/vendor/src/examples/sparqlConstruct.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { createElement, ClassAttributes } from 'react'; -import * as ReactDOM from 'react-dom'; - -import { Workspace, WorkspaceProps, SparqlDataProvider, GraphBuilder, OWLStatsSettings, SparqlQueryMethod } from '../index'; - -import { onPageLoad } from './common'; - -require('jointjs/css/layout.css'); -require('jointjs/css/themes/default.css'); - -function onWorkspaceMounted(workspace: Workspace) { - if (!workspace) { return; } - - const model = workspace.getModel(); - const endpointUrl = '/sparql-endpoint'; - const sparqlDataProvider = new SparqlDataProvider({endpointUrl: endpointUrl, queryMethod: SparqlQueryMethod.GET}, OWLStatsSettings); - const graphBuilder = new GraphBuilder(sparqlDataProvider); - - const loadingGraph = graphBuilder.getGraphFromConstruct( - `CONSTRUCT { - ?inst rdf:type ?class. - ?inst ?propType1 ?propValue1. - ?inst rdfs:label ?label . - ?propValue2 ?propType2 ?inst . - } WHERE { - BIND ( as ?inst) - ?inst rdf:type ?class. - OPTIONAL {?inst rdfs:label ?label} - OPTIONAL {?inst ?propType1 ?propValue1. FILTER(isURI(?propValue1)). } - OPTIONAL {?propValue2 ?propType2 ?inst. FILTER(isURI(?propValue2)). } - } LIMIT 100`, - ); - workspace.showWaitIndicatorWhile(loadingGraph); - - loadingGraph.then(({layoutData, preloadedElements}) => model.importLayout({ - layoutData, - preloadedElements, - dataProvider: sparqlDataProvider, - })).then(() => { - workspace.forceLayout(); - workspace.zoomToFit(); - }); -} - -const props: WorkspaceProps & ClassAttributes = { - ref: onWorkspaceMounted, - onSaveDiagram: workspace => { - const layout = workspace.getModel().exportLayout(); - console.log(layout); - }, -}; - -onPageLoad(container => ReactDOM.render(createElement(Workspace, props), container)); diff --git a/DKBFrontEnd/vendor/src/examples/sparqlNoStats.ts b/DKBFrontEnd/vendor/src/examples/sparqlNoStats.ts deleted file mode 100644 index 4af2f4554..000000000 --- a/DKBFrontEnd/vendor/src/examples/sparqlNoStats.ts +++ /dev/null @@ -1,71 +0,0 @@ -import { createElement, ClassAttributes } from 'react'; -import * as ReactDOM from 'react-dom'; - -import { Workspace, WorkspaceProps, SparqlDataProvider, OWLRDFSSettings } from '../index'; - -import { onPageLoad, tryLoadLayoutFromLocalStorage, saveLayoutToLocalStorage } from './common'; - -require('jointjs/css/layout.css'); -require('jointjs/css/themes/default.css'); - -function onWorkspaceMounted(workspace: Workspace) { - if (!workspace) { return; } - - const model = workspace.getModel(); - model.graph.on('action:iriClick', (iri: string) => { - window.open(iri); - console.log(iri); - }); - - const layoutData = tryLoadLayoutFromLocalStorage(); - model.importLayout({ - layoutData, - validateLinks: true, - dataProvider: new SparqlDataProvider({ - endpointUrl: '/sparql-endpoint', - imagePropertyUris: [ - 'http://www.researchspace.org/ontology/PX_has_main_representation', - 'http://xmlns.com/foaf/0.1/img', - ], - }, {...OWLRDFSSettings, ...{ - defaultPrefix: OWLRDFSSettings.defaultPrefix + ` -PREFIX rso: `, - dataLabelProperty: "rso:displayLabel", - ftsSettings: { - ftsPrefix: 'PREFIX bds: ' + '\n', - ftsQueryPattern: ` - ?inst rso:displayLabel ?searchLabel. - SERVICE bds:search { - ?searchLabel bds:search "\${text}*" ; - bds:minRelevance '0.5' ; - - bds:matchAllTerms 'true'; - bds:relevance ?score. - } - ` - }, - elementInfoQuery: ` - SELECT ?inst ?class ?label ?propType ?propValue - WHERE { - OPTIONAL {?inst rdf:type ?class . } - OPTIONAL {?inst \${dataLabelProperty} ?label} - OPTIONAL {?inst ?propType ?propValue. - FILTER (isLiteral(?propValue)) } - VALUES (?labelProp) { (rso:displayLabel) (rdfs:label) } - } VALUES (?inst) {\${ids}} - `, - } - }), - }); -} - -const props: WorkspaceProps & ClassAttributes = { - ref: onWorkspaceMounted, - onSaveDiagram: workspace => { - const {layoutData} = workspace.getModel().exportLayout(); - window.location.hash = saveLayoutToLocalStorage(layoutData); - window.location.reload(); - }, -}; - -onPageLoad(container => ReactDOM.render(createElement(Workspace, props), container)); diff --git a/DKBFrontEnd/vendor/src/examples/sparqlRDFGraph.ts b/DKBFrontEnd/vendor/src/examples/sparqlRDFGraph.ts deleted file mode 100644 index 100fd6c99..000000000 --- a/DKBFrontEnd/vendor/src/examples/sparqlRDFGraph.ts +++ /dev/null @@ -1,102 +0,0 @@ -import { createElement, ClassAttributes } from 'react'; -import * as ReactDOM from 'react-dom'; - -import { Workspace, WorkspaceProps, SparqlDataProvider, OWLStatsSettings, GraphBuilder, Triple } from '../index'; - -import { onPageLoad } from './common'; - -require('jointjs/css/layout.css'); -require('jointjs/css/themes/default.css'); - -const GRAPH: Triple[] = [ - { - subject: { - 'type': 'uri', - 'value': 'http://collection.britishmuseum.org/id/object/JCF8939', - }, - predicate: { - 'type': 'uri', - 'value': 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', - }, - object: { - 'type': 'uri', - 'value': 'http://www.cidoc-crm.org/cidoc-crm/E22_Man-Made_Object', - }, - }, - { - subject: { - 'type': 'uri', - 'value': 'http://collection.britishmuseum.org/id/object/JCF8939', - }, - predicate: { - 'type': 'uri', - 'value': 'http://www.cidoc-crm.org/cidoc-crm/P43_has_dimension', - }, - object: { - 'type': 'uri', - 'value': 'http://collection.britishmuseum.org/id/object/JCF8939/height/1', - }, - }, - { - subject: { - 'type': 'uri', - 'value': 'http://www.britishmuseum.org/collectionimages/AN00230/AN00230739_001_l.jpg/digiprocess', - }, - predicate: { - 'type': 'uri', - 'value': 'http://www.ics.forth.gr/isl/CRMdig/L1_digitized', - }, - object: { - 'type': 'uri', - 'value': 'http://collection.britishmuseum.org/id/object/JCF8939', - }, - }, - { - subject: { - 'type': 'uri', - 'value': 'http://collection.britishmuseum.org/id/object/JCF8939', - }, - predicate: { - 'type': 'uri', - 'value': 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', - }, - object: { - 'type': 'uri', - 'value': 'http://www.researchspace.org/ontology/Thing', - }, - }, -]; - -function onWorkspaceMounted(workspace: Workspace) { - if (!workspace) { return; } - - const model = workspace.getModel(); - const endpointUrl = '/sparql-endpoint'; - const sparqlDataProvider = new SparqlDataProvider({ - endpointUrl: endpointUrl, - imagePropertyUris: ['http://collection.britishmuseum.org/id/ontology/PX_has_main_representation'], - }, OWLStatsSettings); - const graphBuilder = new GraphBuilder(sparqlDataProvider); - - const loadingGraph = graphBuilder.getGraphFromRDFGraph(GRAPH); - workspace.showWaitIndicatorWhile(loadingGraph); - - loadingGraph.then(({layoutData, preloadedElements}) => model.importLayout({ - layoutData, - preloadedElements, - dataProvider: sparqlDataProvider, - })).then(() => { - workspace.forceLayout(); - workspace.zoomToFit(); - }); -} - -const props: WorkspaceProps & ClassAttributes = { - ref: onWorkspaceMounted, - onSaveDiagram: workspace => { - const layout = workspace.getModel().exportLayout(); - console.log(layout); - }, -}; - -onPageLoad(container => ReactDOM.render(createElement(Workspace, props), container)); diff --git a/DKBFrontEnd/vendor/src/examples/styleCustomization.ts b/DKBFrontEnd/vendor/src/examples/styleCustomization.ts deleted file mode 100644 index bca36fae8..000000000 --- a/DKBFrontEnd/vendor/src/examples/styleCustomization.ts +++ /dev/null @@ -1,91 +0,0 @@ -import { createElement, ClassAttributes } from 'react'; -import * as ReactDOM from 'react-dom'; - -import { Workspace, WorkspaceProps, SparqlDataProvider, LinkStyle } from '../index'; - -import { onPageLoad, tryLoadLayoutFromLocalStorage, saveLayoutToLocalStorage } from './common'; - -require('jointjs/css/layout.css'); -require('jointjs/css/themes/default.css'); - -const CUSTOM_LINK_STYLE: LinkStyle = { - connection: { - stroke: '#3c4260', - 'stroke-width': 2, - }, - markerSource: { - fill: '#4b4a67', - stroke: '#4b4a67', - d: 'M0,3a3,3 0 1,0 6,0a3,3 0 1,0 -6,0', - width: 6, - height: 6, - }, - markerTarget: { - fill: '#4b4a67', - stroke: '#4b4a67', - d: 'm 20,5.88 -10.3,-5.95 0,5.6 -9.7,-5.6 0,11.82 9.7,-5.53 0,5.6 z', - width: 20, - height: 12, - }, - labels: [{ - attrs: { - text: {fill: '#3c4260'}, - }, - }], - connector: {name: 'rounded'}, - router: {name: 'orthogonal'}, -}; - -function onWorkspaceMounted(workspace: Workspace) { - if (!workspace) { return; } - - const model = workspace.getModel(); - model.graph.on('action:iriClick', (iri: string) => { - console.log(iri); - }); - - const layoutData = tryLoadLayoutFromLocalStorage(); - model.importLayout({ - layoutData, - dataProvider: new SparqlDataProvider({ - endpointUrl: '/sparql-endpoint', - imagePropertyUris: [ - 'http://collection.britishmuseum.org/id/ontology/PX_has_main_representation', - 'http://xmlns.com/foaf/0.1/img', - ], - }), - }); -} - -const props: WorkspaceProps & ClassAttributes = { - ref: onWorkspaceMounted, - onSaveDiagram: workspace => { - const {layoutData} = workspace.getModel().exportLayout(); - window.location.hash = saveLayoutToLocalStorage(layoutData); - window.location.reload(); - }, - viewOptions: { - typeStyleResolvers: [ - types => { - if (types.indexOf('http://www.w3.org/2000/01/rdf-schema#Class') !== -1) { - return {icon: 'glyphicon glyphicon-certificate'}; - } else if (types.indexOf('http://www.w3.org/2002/07/owl#Class') !== -1) { - return {icon: 'glyphicon glyphicon-certificate'}; - } else if (types.indexOf('http://www.w3.org/2002/07/owl#ObjectProperty') !== -1) { - return {icon: 'glyphicon glyphicon-cog'}; - } else if (types.indexOf('http://www.w3.org/2002/07/owl#DatatypeProperty') !== -1) { - return {color: '#046380'}; - } else { - return undefined; - } - }, - ], - linkStyleResolvers: [ - type => { - return CUSTOM_LINK_STYLE; - }, - ], - }, -}; - -onPageLoad(container => ReactDOM.render(createElement(Workspace, props), container)); diff --git a/DKBFrontEnd/vendor/src/examples/template.ejs b/DKBFrontEnd/vendor/src/examples/template.ejs deleted file mode 100644 index 5b8c20a3f..000000000 --- a/DKBFrontEnd/vendor/src/examples/template.ejs +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - <%= htmlWebpackPlugin.options.title %> - - - - - - - - - - - - - - - - diff --git a/DKBFrontEnd/vendor/src/examples/wikidata.ts b/DKBFrontEnd/vendor/src/examples/wikidata.ts deleted file mode 100644 index a4343a45f..000000000 --- a/DKBFrontEnd/vendor/src/examples/wikidata.ts +++ /dev/null @@ -1,70 +0,0 @@ -import { createElement, ClassAttributes } from 'react'; -import * as ReactDOM from 'react-dom'; - -import { - Workspace, WorkspaceProps, SparqlDataProvider, OrganizationTemplate, DefaultElementTemplate, PersonTemplate, - WikidataSettings, SparqlQueryMethod -} from '../index'; - -import { onPageLoad, tryLoadLayoutFromLocalStorage, saveLayoutToLocalStorage } from './common'; - -require('jointjs/css/layout.css'); -require('jointjs/css/themes/default.css'); - -function onWorkspaceMounted(workspace: Workspace) { - if (!workspace) { return; } - - const diagram = workspace.getDiagram(); - diagram.registerTemplateResolver(types => { - //using default template for country as a temporary solution - if (types.indexOf('http://www.wikidata.org/entity/Q6256') !== -1) { - return DefaultElementTemplate; - } else if (types.indexOf('http://www.wikidata.org/entity/Q43229') !== -1) { - return OrganizationTemplate; - } else if (types.indexOf('http://www.wikidata.org/entity/Q5') !== -1) { - return PersonTemplate; - } else { - return undefined; - } - }); - diagram.registerElementStyleResolver(types => { - if (types.indexOf('http://www.wikidata.org/entity/Q6256') !== -1) { - return {color: '#77ca98', icon: 'ontodia-country-icon'}; - } else if (types.indexOf('http://www.wikidata.org/entity/Q43229') !== -1) { - return {color: '#77ca98', icon: 'ontodia-organization-icon'}; - } else if (types.indexOf('http://www.wikidata.org/entity/Q5') !== -1) { - return {color: '#eb7777', icon: 'ontodia-person-icon'}; - } else { - return undefined; - } - }); - - const model = workspace.getModel(); - model.graph.on('action:iriClick', (iri: string) => { - window.open(iri); - console.log(iri); - }); - - const layoutData = tryLoadLayoutFromLocalStorage(); - const dataProvider = new SparqlDataProvider({ - endpointUrl: '/sparql-endpoint', - imagePropertyUris: [ - 'http://www.wikidata.org/prop/direct/P18', - 'http://www.wikidata.org/prop/direct/P154', - ], - queryMethod: SparqlQueryMethod.POST, - }, WikidataSettings); - - model.importLayout({layoutData, dataProvider, validateLinks: true}); -} - -const props: WorkspaceProps & ClassAttributes = { - ref: onWorkspaceMounted, - onSaveDiagram: workspace => { - const {layoutData} = workspace.getModel().exportLayout(); - window.location.hash = saveLayoutToLocalStorage(layoutData); - window.location.reload(); - }, -}; - -onPageLoad(container => ReactDOM.render(createElement(Workspace, props), container)); diff --git a/DKBFrontEnd/vendor/src/examples/wikidataGraph.ts b/DKBFrontEnd/vendor/src/examples/wikidataGraph.ts deleted file mode 100644 index 8c4d0275d..000000000 --- a/DKBFrontEnd/vendor/src/examples/wikidataGraph.ts +++ /dev/null @@ -1,85 +0,0 @@ -import { createElement, ClassAttributes } from 'react'; -import * as ReactDOM from 'react-dom'; - -import { - Workspace, WorkspaceProps, SparqlDataProvider, OrganizationTemplate, PersonTemplate, - GraphBuilder, WikidataSettings, -} from '../index'; - -import { onPageLoad } from './common'; - -require('jointjs/css/layout.css'); -require('jointjs/css/themes/default.css'); - -function onWorkspaceMounted(workspace: Workspace) { - if (!workspace) { return; } - - const diagram = workspace.getDiagram(); - diagram.registerTemplateResolver(types => { - if (types.indexOf('http://www.wikidata.org/entity/Q43229') !== -1) { - return OrganizationTemplate; - } else if (types.indexOf('http://www.wikidata.org/entity/Q5') !== -1) { - return PersonTemplate; - } else { - return undefined; - } - }); - diagram.registerElementStyleResolver(types => { - if (types.indexOf('http://www.wikidata.org/entity/Q43229') !== -1) { - return {color: '#77ca98', icon: 'ontodia-organization-icon'}; - } else if (types.indexOf('http://www.wikidata.org/entity/Q5') !== -1) { - return {color: '#eb7777', icon: 'ontodia-person-icon'}; - } else { - return undefined; - } - }); - - const model = workspace.getModel(); - model.graph.on('action:iriClick', (iri: string) => { - window.open(iri); - console.log(iri); - }); - - const dataProvider = new SparqlDataProvider({ - endpointUrl: '/sparql-endpoint', - imagePropertyUris: [ - 'http://www.wikidata.org/prop/direct/P18', - 'http://www.wikidata.org/prop/direct/P154', - ], - }, WikidataSettings); - const graphBuilder = new GraphBuilder(dataProvider); - - const loadingGraph = graphBuilder.getGraphFromConstruct(` - CONSTRUCT { ?current ?p ?o. } - WHERE { - { - ?current ?p ?o. - ?p ?label. - FILTER(ISIRI(?o)) - FILTER exists{?o ?p1 ?o2} - } - } - LIMIT 20 - VALUES (?current) { - () - }`, - ); - workspace.showWaitIndicatorWhile(loadingGraph); - - loadingGraph.then(({layoutData, preloadedElements}) => - model.importLayout({layoutData, preloadedElements, dataProvider}), - ).then(() => { - workspace.forceLayout(); - workspace.zoomToFit(); - }); -} - -const props: WorkspaceProps & ClassAttributes = { - ref: onWorkspaceMounted, - onSaveDiagram: workspace => { - const layout = workspace.getModel().exportLayout(); - console.log(layout); - }, -}; - -onPageLoad(container => ReactDOM.render(createElement(Workspace, props), container)); diff --git a/DKBFrontEnd/vendor/src/index.ts b/DKBFrontEnd/vendor/src/index.ts deleted file mode 100644 index 98f8ec567..000000000 --- a/DKBFrontEnd/vendor/src/index.ts +++ /dev/null @@ -1,19 +0,0 @@ -require('intro.js/introjs.css'); - -require('../styles/main.scss'); - -export * from './ontodia/customization/props'; -export * from './ontodia/customization/defaultTemplate'; -export * from './ontodia/customization/templates/stringTemplates'; -export * from './ontodia/data/model'; -export * from './ontodia/data/provider'; -export * from './ontodia/data/demo/provider'; -export { RdfNode, RdfIri, RdfLiteral, Triple } from './ontodia/data/sparql/sparqlModels'; -export * from './ontodia/data/sparql/sparqlDataProvider'; -export * from './ontodia/data/sparql/sparqlDataProviderSettings'; -export * from './ontodia/data/sparql/graphBuilder'; -export { Element, Link } from './ontodia/diagram/elements'; -export { LayoutData, LayoutCell, LayoutElement, LayoutLink } from './ontodia/diagram/layoutData'; -export * from './ontodia/diagram/model'; -export * from './ontodia/diagram/view'; -export { Workspace, Props as WorkspaceProps } from './ontodia/workspace/workspace'; diff --git a/DKBFrontEnd/vendor/src/ontodia/customization/defaultLinkStyles.ts b/DKBFrontEnd/vendor/src/ontodia/customization/defaultLinkStyles.ts deleted file mode 100644 index 03f0391e2..000000000 --- a/DKBFrontEnd/vendor/src/ontodia/customization/defaultLinkStyles.ts +++ /dev/null @@ -1,61 +0,0 @@ -import { LinkStyle, LinkStyleResolver } from './props'; - -const LINK_SUB_CLASS_OF: LinkStyle = { - connection: { - stroke: '#f8a485', - 'stroke-width': 2, - }, - markerTarget: { - fill: '#f8a485', - stroke: '#cf8e76', - }, -}; - -const LINK_DOMAIN: LinkStyle = { - connection: { - stroke: '#34c7f3', - 'stroke-width': 2, - }, - markerTarget: { - fill: '#34c7f3', - stroke: '#38b5db', - }, -}; - -const LINK_RANGE: LinkStyle = { - connection: { - stroke: '#34c7f3', - 'stroke-width': 2, - }, - markerTarget: { - fill: '#34c7f3', - stroke: '#38b5db', - }, -}; - -const LINK_TYPE_OF: LinkStyle = { - connection: { - stroke: '#8cd965', - 'stroke-width': 2, - }, - markerTarget: { - fill: '#8cd965', - stroke: '#5b9a3b', - }, -}; - -export const DefaultLinkStyleBundle: LinkStyleResolver[] = [ - type => { - if (type === 'http://www.w3.org/2000/01/rdf-schema#subClassOf') { - return LINK_SUB_CLASS_OF; - } else if (type === 'http://www.w3.org/2000/01/rdf-schema#domain') { - return LINK_DOMAIN; - } else if (type === 'http://www.w3.org/2000/01/rdf-schema#range') { - return LINK_RANGE; - } else if (type === 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type') { - return LINK_TYPE_OF; - } else { - return undefined; - } - }, -]; diff --git a/DKBFrontEnd/vendor/src/ontodia/customization/defaultTemplate.tsx b/DKBFrontEnd/vendor/src/ontodia/customization/defaultTemplate.tsx deleted file mode 100644 index 801253aab..000000000 --- a/DKBFrontEnd/vendor/src/ontodia/customization/defaultTemplate.tsx +++ /dev/null @@ -1,86 +0,0 @@ -import * as React from 'react'; - -import { TemplateProps } from './props'; - -const CLASS_NAME = 'ontodia-default-template'; - -export class DefaultTemplate extends React.Component { - render() { - const props = this.props; - - const imageStyle: React.CSSProperties = {borderBottomColor: props.color}; - const image = props.imgUrl ? ( -
    - -
    - ) : undefined; - - let propertyTable: React.ReactElement; - if (props.propsAsList && props.propsAsList.length > 0) { - propertyTable =
    - {props.propsAsList.map(prop => { - const values = prop.property.values.map(({text}, index) => -
    - {text} -
    - ); - return ( -
    -
    - {prop.name} -
    -
    - {values} -
    -
    - ); - })} -
    ; - } else { - propertyTable =
    no properties
    ; - } - - const expander = props.isExpanded ? ( -
    -
    -
    - IRI: -
    - -
    -
    - {propertyTable} -
    - ) : undefined; - - return ( -
    -
    - -
    -
    - {props.types} -
    -
    -
    - {image} -
    - - {expander} -
    -
    - ); - } -} diff --git a/DKBFrontEnd/vendor/src/ontodia/customization/defaultTypeStyles.ts b/DKBFrontEnd/vendor/src/ontodia/customization/defaultTypeStyles.ts deleted file mode 100644 index c09bca13a..000000000 --- a/DKBFrontEnd/vendor/src/ontodia/customization/defaultTypeStyles.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { TypeStyleResolver } from './props'; - -export const DefaultTypeStyleBundle: TypeStyleResolver[] = [ - types => { - if (types.indexOf('http://www.w3.org/2002/07/owl#Class') !== -1 || - types.indexOf('http://www.w3.org/2000/01/rdf-schema#Class') !== -1 - ) { - return {color: '#eaac77', icon: 'ontodia-class-icon'}; - } else if (types.indexOf('http://www.w3.org/2002/07/owl#ObjectProperty') !== -1) { - return {color: '#34c7f3', icon: 'ontodia-object-property-icon'}; - } else if (types.indexOf('http://www.w3.org/2002/07/owl#DatatypeProperty') !== -1) { - return {color: '#34c7f3', icon: 'ontodia-datatype-property-icon'}; - } else if (types.indexOf('http://xmlns.com/foaf/0.1/Person') !== -1) { - return {color: '#eb7777', icon: 'ontodia-person-icon'}; - } else if ( - types.indexOf('http://schema.org/Organization') !== -1 || - types.indexOf('http://dbpedia.org/ontology/Organisation') !== -1 || - types.indexOf('http://xmlns.com/foaf/0.1/Organization') !== -1 - ) { - return {color: '#77ca98', icon: 'ontodia-organization-icon'}; - } else { - return undefined; - } - }, -]; diff --git a/DKBFrontEnd/vendor/src/ontodia/customization/handlebarsTemplate.tsx b/DKBFrontEnd/vendor/src/ontodia/customization/handlebarsTemplate.tsx deleted file mode 100644 index bcf79435d..000000000 --- a/DKBFrontEnd/vendor/src/ontodia/customization/handlebarsTemplate.tsx +++ /dev/null @@ -1,101 +0,0 @@ -import * as React from 'react'; -import { findDOMNode } from 'react-dom'; -import { compile as compileTemplate, HandlebarsTemplateDelegate } from 'handlebars'; - -import { Dictionary, Property } from '../data/model'; - -import { TemplateProps } from './props'; - -export interface HandlebarsTemplateProps { - template: string; - templateProps: TemplateProps; - onLoad?: () => void; -} - -const HANDLEBARS_HELPERS = { - getProperty: (props: Dictionary, id: string) => { - if (props && props[id]) { - return props[id].values.map(v => v.text).join(', '); - } else { - return undefined; - } - }, -}; - -export class HandlebarsTemplate extends React.Component { - private compiledTemplate: HandlebarsTemplateDelegate; - - private cancelLoad = () => { /* nothing */ }; - - constructor(props: HandlebarsTemplateProps) { - super(props); - this.compiledTemplate = compileTemplate(this.props.template); - } - - render() { - return
    ; - } - - renderTemplate() { - const {templateProps} = this.props; - const html = this.compiledTemplate(templateProps, {helpers: HANDLEBARS_HELPERS}); - return {__html: html}; - } - - componentDidMount() { - this.subscribeOnLoad(); - } - - componentDidUpdate() { - this.subscribeOnLoad(); - } - - componentWillUnmount() { - this.cancelLoad(); - } - - private subscribeOnLoad() { - this.cancelLoad(); - const {onLoad} = this.props; - const node = findDOMNode(this) as HTMLElement; - if (onLoad) { - let cancelled = false; - this.cancelLoad = () => cancelled = true; - this.subscribeOnImagesLoad(node).then(() => { - if (!cancelled) { onLoad(); } - }); - } - } - - private subscribeOnImagesLoad(node: HTMLElement) { - const loadingImages: Promise[] = []; - const images = node.querySelectorAll('img'); - for (let i = 0; i < images.length; i++) { - const image = images[i]; - const loadPromise = whenImageLoad(image); - if (loadPromise) { loadingImages.push(loadPromise); } - } - return Promise.all(loadingImages).then(() => { /* nothing*/ }); - } -} - -function whenImageLoad(image: HTMLImageElement): Promise | undefined { - if (image.complete) { return undefined; } - return new Promise(resolve => { - let removeListeners: () => void; - const loadListener = () => { - removeListeners(); - resolve(); - }; - const errorListener = () => { - removeListeners(); - resolve(); - }; - removeListeners = () => { - image.removeEventListener('load', loadListener, true); - image.removeEventListener('error', loadListener, true); - }; - image.addEventListener('load', loadListener, true); - image.addEventListener('error', errorListener, true); - }); -} diff --git a/DKBFrontEnd/vendor/src/ontodia/customization/props.ts b/DKBFrontEnd/vendor/src/ontodia/customization/props.ts deleted file mode 100644 index 006073e0b..000000000 --- a/DKBFrontEnd/vendor/src/ontodia/customization/props.ts +++ /dev/null @@ -1,83 +0,0 @@ -import { ComponentClass } from 'react'; - -import { Dictionary, Property } from '../data/model'; - -export type TypeStyleResolver = (types: string[]) => CustomTypeStyle | undefined; -export type LinkStyleResolver = (type: string) => LinkStyle | undefined; -export type TemplateResolver = (types: string[]) => ElementTemplate | undefined; - -export interface CustomTypeStyle { - color?: string; - icon?: string; -} - -export type ElementTemplate = ComponentClass | string; - -export interface TemplateProps { - types: string; - label: string; - color: any; - icon: string; - iri: string; - imgUrl?: string; - isExpanded?: boolean; - propsAsList?: PropArray; - props?: Dictionary; -} - -export type PropArray = Array<{ - id: string; - name: string; - property: Property; -}>; - -export interface LinkStyle { - connection?: { - fill?: string; - stroke?: string; - 'stroke-width'?: number; - 'stroke-dasharray'?: string; - }; - markerSource?: LinkMarkerStyle; - markerTarget?: LinkMarkerStyle; - labels?: LinkLabelStyle[]; - connector?: { - name?: string; - args?: { - radius?: number; - }; - }; - router?: { - name?: string; - args?: { - startDirections?: string[]; - endDirections?: string[]; - excludeTypes?: string[]; - }; - }; -} - -export interface LinkMarkerStyle { - fill?: string; - stroke?: string; - strokeWidth?: string; - d?: string; - width?: number; - height?: number; -} - -export interface LinkLabelStyle { - position?: number; - attrs?: { - rect?: { - fill?: string; - 'stroke'?: string; - 'stroke-width'?: number; - }; - text?: { - fill?: string; - 'stroke'?: string; - 'stroke-width'?: number; - }; - }; -} diff --git a/DKBFrontEnd/vendor/src/ontodia/customization/templates/defaultTemplates.ts b/DKBFrontEnd/vendor/src/ontodia/customization/templates/defaultTemplates.ts deleted file mode 100644 index 8fe673c9d..000000000 --- a/DKBFrontEnd/vendor/src/ontodia/customization/templates/defaultTemplates.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { TemplateResolver } from '../props'; - -import { LeftBarTemplate, BigIconTemplate, PersonTemplate, OrganizationTemplate } from './stringTemplates'; - -export const DefaultTemplateBundle: TemplateResolver[] = [ - types => { - if (types.indexOf('http://www.w3.org/2000/01/rdf-schema#Class') !== -1) { - return BigIconTemplate; - } else { - return undefined; - } - }, - types => { - if (types.indexOf('http://www.w3.org/2002/07/owl#Class') !== -1) { - return BigIconTemplate; - } else { - return undefined; - } - }, - types => { - if (types.indexOf('http://www.w3.org/2002/07/owl#ObjectProperty') !== -1) { - return LeftBarTemplate; - } else { - return undefined; - } - }, - types => { - if (types.indexOf('http://www.w3.org/2002/07/owl#DatatypeProperty') !== -1) { - return LeftBarTemplate; - } else { - return undefined; - } - }, - types => { - if (types.indexOf('http://xmlns.com/foaf/0.1/Person') !== -1 || - types.indexOf('http://www.wikidata.org/entity/Q5') !== -1 ) { - return PersonTemplate; - } else { - return undefined; - } - }, - types => { - if ( - types.indexOf('http://schema.org/Organization') !== -1 || - types.indexOf('http://dbpedia.org/ontology/Organisation') !== -1 || - types.indexOf('http://xmlns.com/foaf/0.1/Organization') !== -1 - ) { - return OrganizationTemplate; - } else { - return undefined; - } - }, -]; diff --git a/DKBFrontEnd/vendor/src/ontodia/customization/templates/stringTemplates.ts b/DKBFrontEnd/vendor/src/ontodia/customization/templates/stringTemplates.ts deleted file mode 100644 index e6c661189..000000000 --- a/DKBFrontEnd/vendor/src/ontodia/customization/templates/stringTemplates.ts +++ /dev/null @@ -1,337 +0,0 @@ -export const DefaultElementTemplate = ` -
    -
    - -
    -
    {{types}}
    -
    -
    - {{#if imgUrl}} - - {{/if}} -
    - - {{#if isExpanded}} -
    -
    - IRI: -
    - -
    - -
    - {{#if propsAsList.length}} -
    - {{#each propsAsList}} -
    -
    - {{name}} -
    -
    - {{#each property.values}} -
    - {{text}} -
    - {{/each}} -
    -
    - {{/each}} -
    - {{else}} - no properties - {{/if}} - {{/if}} -
    -
    -`; - -export const LeftBarTemplate = ` -
    -
    - {{#if imgUrl}} - - {{/if}} -
    - -
    - {{types}} -
    -
    - - {{label}} - - {{#if isExpanded}} -
    -
    - IRI: -
    - -
    - -
    - {{#if propsAsList.length}} -
    - {{#each propsAsList}} -
    -
    - {{name}} -
    -
    - {{#each property.values}} -
    - {{text}} -
    - {{/each}} -
    -
    - {{/each}} -
    - {{else}} - no properties - {{/if}} - {{/if}} -
    -
    -`; - -export const BigIconTemplate = ` -
    -
    -
    -
    - - {{label}} - -
    -
    {{types}}
    -
    -
    - -
    -
    - {{#if isExpanded}} -
    - {{#if imgUrl}} - - {{/if}} -
    -
    -
    - IRI: -
    -
    - {{iri}} -
    -
    - -
    - {{#if propsAsList.length}} -
    - {{#each propsAsList}} -
    -
    - {{name}} -
    -
    - {{#each property.values}} -
    - {{text}} -
    - {{/each}} -
    -
    - {{/each}} -
    - {{else}} - no properties - {{/if}} -
    -
    - {{/if}} -
    -`; - -export const PersonTemplate = ` -
    -
    -
    - {{#if imgUrl}} - - {{else}} - - {{/if}} -
    -
    -
    Person
    -
    -
    -
    -
    - {{#if isExpanded}} -
    - {{#if imgUrl}} - - {{/if}} -
    -
    -
    - IRI: -
    -
    - {{iri}} -
    -
    - -
    - {{#if propsAsList.length}} -
    - {{#each propsAsList}} -
    -
    - {{name}} -
    -
    - {{#each property.values}} -
    - {{text}} -
    - {{/each}} -
    -
    - {{/each}} -
    - {{else}} - no properties - {{/if}} -
    -
    - {{/if}} -
    -`; - -export const OrganizationTemplate = ` -
    -
    - -
    -
    - Organization -
    - {{#if (getProperty props "http://xmlns.com/foaf/0.1/name") }} - - {{else}} - - {{/if}} -
    -
    - {{#if isExpanded}} -
    -
    - IRI: -
    - -
    - -
    - {{#if propsAsList.length}} -
    - {{#each propsAsList}} -
    -
    - {{name}} -
    -
    - {{#each property.values}} -
    - {{text}} -
    - {{/each}} -
    -
    - {{/each}} -
    - {{else}} - no properties - {{/if}} - {{/if}} -
    -
    -
    -`; diff --git a/DKBFrontEnd/vendor/src/ontodia/data/demo/data/classes.json b/DKBFrontEnd/vendor/src/ontodia/data/demo/data/classes.json deleted file mode 100644 index 4499ea4fd..000000000 --- a/DKBFrontEnd/vendor/src/ontodia/data/demo/data/classes.json +++ /dev/null @@ -1,697 +0,0 @@ -[ - { - "id": "http://www.w3.org/2002/07/owl#Thing", - "label": { - "values": [ - { - "text": "Thing", - "lang": "en" - }, - { - "text": "Вещь", - "lang": "ru" - } - ] - }, - "count": 8, - "children": [ - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#ServiceProvider", - "label": { - "values": [ - { - "text": "ServiceProvider", - "lang": "" - } - ] - }, - "count": 2, - "children": [] - }, - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#SimpleProperty", - "label": { - "values": [ - { - "text": "SimpleProperty", - "lang": "" - } - ] - }, - "count": 0, - "children": [ - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Image", - "label": { - "values": [ - { - "text": "Image", - "lang": "" - } - ] - }, - "count": 0, - "children": [] - }, - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Speed", - "label": { - "values": [ - { - "text": "Speed", - "lang": "" - } - ] - }, - "count": 0, - "children": [] - } - ] - }, - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#RTService", - "label": { - "values": [ - { - "text": "RTService", - "lang": "" - } - ] - }, - "count": 0, - "children": [] - }, - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Operation", - "label": { - "values": [ - { - "text": "Operation", - "lang": "" - } - ] - }, - "count": 0, - "children": [ - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Subscription", - "label": { - "values": [ - { - "text": "Subscription", - "lang": "" - } - ] - }, - "count": 0, - "children": [ - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Unsubscribe", - "label": { - "values": [ - { - "text": "Unsubscribe", - "lang": "" - } - ] - }, - "count": 0, - "children": [] - }, - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Subscribe", - "label": { - "values": [ - { - "text": "Subscribe", - "lang": "" - } - ] - }, - "count": 0, - "children": [] - } - ] - }, - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Contact", - "label": { - "values": [ - { - "text": "Contact", - "lang": "" - } - ] - }, - "count": 0, - "children": [ - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#TurnOff", - "label": { - "values": [ - { - "text": "TurnOff", - "lang": "" - } - ] - }, - "count": 0, - "children": [] - }, - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Connect", - "label": { - "values": [ - { - "text": "Соединение", - "lang": "" - } - ] - }, - "count": 0, - "children": [] - }, - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Disconnect", - "label": { - "values": [ - { - "text": "Disconnect", - "lang": "" - } - ] - }, - "count": 0, - "children": [] - }, - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#TurnOn", - "label": { - "values": [ - { - "text": "TurnOn", - "lang": "" - } - ] - }, - "count": 0, - "children": [] - } - ] - }, - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Observe", - "label": { - "values": [ - { - "text": "Observe", - "lang": "" - } - ] - }, - "count": 0, - "children": [ - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Disappear", - "label": { - "values": [ - { - "text": "Disappear", - "lang": "" - } - ] - }, - "count": 0, - "children": [] - }, - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Appear", - "label": { - "values": [ - { - "text": "Appear", - "lang": "" - } - ] - }, - "count": 0, - "children": [] - } - ] - } - ] - }, - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Service", - "label": { - "values": [ - { - "text": "Service", - "lang": "" - } - ] - }, - "count": 6, - "children": [ - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#TVChannel", - "label": { - "values": [ - { - "text": "TVChannel", - "lang": "" - } - ] - }, - "count": 1, - "children": [ - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#DigitalTVChannel", - "label": { - "values": [ - { - "text": "DigitalTVChannel", - "lang": "" - } - ] - }, - "count": 0, - "children": [] - }, - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#AnalogueTVChannel", - "label": { - "values": [ - { - "text": "AnalogueTVChannel", - "lang": "" - } - ] - }, - "count": 0, - "children": [] - } - ] - }, - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#ServiceDevice", - "label": { - "values": [ - { - "text": "ServiceDevice", - "lang": "" - } - ] - }, - "count": 0, - "children": [ - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Battery", - "label": { - "values": [ - { - "text": "Battery", - "lang": "" - } - ] - }, - "count": 0, - "children": [] - }, - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Router", - "label": { - "values": [ - { - "text": "Router", - "lang": "" - } - ] - }, - "count": 0, - "children": [ - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#WiFiRouter", - "label": { - "values": [ - { - "text": "WiFiRouter", - "lang": "" - } - ] - }, - "count": 0, - "children": [] - } - ] - }, - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#CamModule", - "label": { - "values": [ - { - "text": "CamModule", - "lang": "" - } - ] - }, - "count": 0, - "children": [] - }, - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#TVSet", - "label": { - "values": [ - { - "text": "TVSet", - "lang": "" - } - ] - }, - "count": 0, - "children": [] - }, - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#ControlPanel", - "label": { - "values": [ - { - "text": "ControlPanel", - "lang": "" - } - ] - }, - "count": 0, - "children": [] - }, - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Cable", - "label": { - "values": [ - { - "text": "Cable", - "lang": "" - } - ] - }, - "count": 0, - "children": [] - }, - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#SetTopBox", - "label": { - "values": [ - { - "text": "SetTopBox", - "lang": "" - } - ] - }, - "count": 0, - "children": [] - } - ] - }, - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#All", - "label": { - "values": [ - { - "text": "All", - "lang": "" - } - ] - }, - "count": 0, - "children": [] - }, - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#SubscribableService", - "label": { - "values": [ - { - "text": "SubscribableService", - "lang": "" - } - ] - }, - "count": 5, - "children": [ - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#TVService", - "label": { - "values": [ - { - "text": "TVService", - "lang": "" - } - ] - }, - "count": 0, - "children": [ - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#DigitalTVService", - "label": { - "values": [ - { - "text": "DigitalTVService", - "lang": "" - } - ] - }, - "count": 0, - "children": [] - } - ] - }, - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Internet", - "label": { - "values": [ - { - "text": "Internet", - "lang": "" - } - ] - }, - "count": 0, - "children": [] - }, - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#ChannelPack", - "label": { - "values": [ - { - "text": "ChannelPack", - "lang": "" - } - ] - }, - "count": 5, - "children": [] - } - ] - } - ] - }, - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#ServiceDesk", - "label": { - "values": [ - { - "text": "ServiceDesk", - "lang": "" - } - ] - }, - "count": 0, - "children": [] - }, - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#PropertyAsGoods", - "label": { - "values": [ - { - "text": "PropertyAsGoods", - "lang": "" - } - ] - }, - "count": 0, - "children": [ - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Home", - "label": { - "values": [ - { - "text": "Home", - "lang": "" - } - ] - }, - "count": 0, - "children": [ - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Flat", - "label": { - "values": [ - { - "text": "Flat", - "lang": "" - } - ] - }, - "count": 0, - "children": [] - } - ] - }, - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Phone", - "label": { - "values": [ - { - "text": "Phone", - "lang": "" - } - ] - }, - "count": 0, - "children": [ - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#HomePhone", - "label": { - "values": [ - { - "text": "HomePhone", - "lang": "" - } - ] - }, - "count": 0, - "children": [] - } - ] - } - ] - }, - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#User", - "label": { - "values": [ - { - "text": "User", - "lang": "" - } - ] - }, - "count": 0, - "children": [] - }, - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#ServiceMan", - "label": { - "values": [ - { - "text": "ServiceMan", - "lang": "" - } - ] - }, - "count": 0, - "children": [] - } - ] - }, - { - "id": "http://www.w3.org/1999/02/22-rdf-syntax-ns#Property", - "label": { - "values": [ - { - "text": "Property", - "lang": "" - } - ] - }, - "count": 3, - "children": [] - }, - { - "id": "http://www.w3.org/2000/01/rdf-schema#Datatype", - "label": { - "values": [ - { - "text": "Datatype", - "lang": "" - } - ] - }, - "count": 3, - "children": [] - }, - { - "id": "http://www.w3.org/2002/07/owl#Class", - "label": { - "values": [ - { - "text": "Class", - "lang": "" - } - ] - }, - "count": 44, - "children": [] - }, - { - "id": "http://www.w3.org/2002/07/owl#Ontology", - "label": { - "values": [ - { - "text": "Ontology", - "lang": "" - } - ] - }, - "count": 1, - "children": [] - }, - { - "id": "http://www.w3.org/2002/07/owl#AnnotationProperty", - "label": { - "values": [ - { - "text": "AnnotationProperty", - "lang": "" - } - ] - }, - "count": 1, - "children": [] - }, - { - "id": "http://www.w3.org/2002/07/owl#ObjectProperty", - "label": { - "values": [ - { - "text": "ObjectProperty", - "lang": "" - } - ] - }, - "count": 3, - "children": [] - }, - { - "id": "http://www.w3.org/2002/07/owl#DatatypeProperty", - "label": { - "values": [ - { - "text": "DatatypeProperty", - "lang": "" - } - ] - }, - "count": 30, - "children": [] - } -] diff --git a/DKBFrontEnd/vendor/src/ontodia/data/demo/data/elements.json b/DKBFrontEnd/vendor/src/ontodia/data/demo/data/elements.json deleted file mode 100644 index 4103f5ba7..000000000 --- a/DKBFrontEnd/vendor/src/ontodia/data/demo/data/elements.json +++ /dev/null @@ -1,2641 +0,0 @@ -{ - "http://ailab.ifmo.ru/dialog/tv/schema": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema", - "types": [ - "http://www.w3.org/2002/07/owl#Ontology" - ], - "label": { - "values": [ - { - "text": "schema", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2002/07/owl#versionInfo": { - "type": "string", - "values": [ - { - "text": "Created with TopBraid Composer", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#ortChannel": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#ortChannel", - "types": [ - "http://ailab.ifmo.ru/dialog/tv/schema#TVChannel" - ], - "label": { - "values": [ - { - "text": "ortChannel", - "lang": "" - } - ] - }, - "properties": { - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "орт", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#Battery": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Battery", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "Battery", - "lang": "" - } - ] - }, - "properties": { - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "батарейка", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#rostelekom": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#rostelekom", - "types": [ - "http://ailab.ifmo.ru/dialog/tv/schema#ServiceProvider" - ], - "label": { - "values": [ - { - "text": "rostelekom", - "lang": "" - } - ] - }, - "properties": { - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "ростелеком", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#problemStated": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#problemStated", - "types": [ - "http://www.w3.org/2002/07/owl#DatatypeProperty" - ], - "label": { - "values": [ - { - "text": "problemStated", - "lang": "" - } - ] - }, - "properties": {} - }, - "http://ailab.ifmo.ru/dialog/tv/schema#hdPremiumChannelPack": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#hdPremiumChannelPack", - "types": [ - "http://ailab.ifmo.ru/dialog/tv/schema#ChannelPack" - ], - "label": { - "values": [ - { - "text": "hdPremiumChannelPack", - "lang": "" - } - ] - }, - "properties": { - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "эйчди-премиум", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#subscriberName": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#subscriberName", - "types": [ - "http://www.w3.org/2002/07/owl#DatatypeProperty" - ], - "label": { - "values": [ - { - "text": "subscriberName", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Имя человека, на которого оформлен договор.", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "оформлять", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#encryptedSignal": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#encryptedSignal", - "types": [ - "http://www.w3.org/2002/07/owl#DatatypeProperty" - ], - "label": { - "values": [ - { - "text": "encryptedSignal", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "На экаране показывается, что сигнал зашифрован ил нет доступа", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#forwardedToAccounts": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#forwardedToAccounts", - "types": [ - "http://www.w3.org/2002/07/owl#DatatypeProperty" - ], - "label": { - "values": [ - { - "text": "forwardedToAccounts", - "lang": "" - } - ] - }, - "properties": {} - }, - "http://ailab.ifmo.ru/dialog/tv/schema#TVService": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#TVService", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "TVService", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Услуга телевидения. Пока нахождение на этом уровне определяется только необходимостью преобразования в онто-факты.", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "телевидение", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#Address": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Address", - "types": [ - "http://www.w3.org/2000/01/rdf-schema#Datatype" - ], - "label": { - "values": [ - { - "text": "Address", - "lang": "" - } - ] - }, - "properties": {} - }, - "http://ailab.ifmo.ru/dialog/tv/schema#TurnOff": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#TurnOff", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "TurnOff", - "lang": "" - } - ] - }, - "properties": { - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "выключать", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#TVChannel": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#TVChannel", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "TVChannel", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Телевизионный канал.", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "канал", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#ServiceDevice": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#ServiceDevice", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "ServiceDevice", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Устройство у пользователя, отвечающее за предоставление услуг", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#Connect": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Connect", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "Соединение", - "lang": "" - } - ] - }, - "properties": { - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "втыкать", - "lang": "" - }, - { - "text": "вставлять", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#falseExpressedBy": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#falseExpressedBy", - "types": [ - "http://www.w3.org/1999/02/22-rdf-syntax-ns#Property" - ], - "label": { - "values": [ - { - "text": "falseExpressedBy", - "lang": "" - } - ] - }, - "properties": {} - }, - "http://ailab.ifmo.ru/dialog/tv/schema#changedSpeed": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#changedSpeed", - "types": [ - "http://www.w3.org/2002/07/owl#DatatypeProperty" - ], - "label": { - "values": [ - { - "text": "changedSpeed", - "lang": "" - } - ] - }, - "properties": { - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "уменьшать", - "lang": "" - }, - { - "text": "увеличивать", - "lang": "" - }, - { - "text": "снижать", - "lang": "" - }, - { - "text": "поднимать", - "lang": "" - }, - { - "text": "изменять", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#kinoChannelPack": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#kinoChannelPack", - "types": [ - "http://ailab.ifmo.ru/dialog/tv/schema#ChannelPack" - ], - "label": { - "values": [ - { - "text": "kinoChannelPack", - "lang": "" - } - ] - }, - "properties": { - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "кино", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#Subscription": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Subscription", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "Subscription", - "lang": "" - } - ] - }, - "properties": {} - }, - "http://ailab.ifmo.ru/dialog/tv/schema#switchedOn": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#switchedOn", - "types": [ - "http://www.w3.org/2002/07/owl#DatatypeProperty" - ], - "label": { - "values": [ - { - "text": "switchedOn", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Включено ли устройство.", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#falseExpressedBy": { - "type": "string", - "values": [ - { - "text": "tv:TurnOff", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#trueExpressedBy": { - "type": "string", - "values": [ - { - "text": "tv:TurnOn", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#Contact": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Contact", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "Contact", - "lang": "" - } - ] - }, - "properties": {} - }, - "http://ailab.ifmo.ru/dialog/tv/schema#canHelp": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#canHelp", - "types": [ - "http://www.w3.org/2002/07/owl#DatatypeProperty" - ], - "label": { - "values": [ - { - "text": "canHelp", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Система спрашивает 'Я могу еще чем-либо помочь?'", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#trueExpressedBy": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#trueExpressedBy", - "types": [ - "http://www.w3.org/1999/02/22-rdf-syntax-ns#Property" - ], - "label": { - "values": [ - { - "text": "trueExpressedBy", - "lang": "" - } - ] - }, - "properties": {} - }, - "http://ailab.ifmo.ru/dialog/tv/schema#inserted": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#inserted", - "types": [ - "http://www.w3.org/2002/07/owl#DatatypeProperty" - ], - "label": { - "values": [ - { - "text": "inserted", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Вставлен ли Cam-модуль в ТВ или приставку", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#falseExpressedBy": { - "type": "string", - "values": [ - { - "text": "tv:Disconnect", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#trueExpressedBy": { - "type": "string", - "values": [ - { - "text": "tv:Connect", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#operational": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#operational", - "types": [ - "http://www.w3.org/2002/07/owl#DatatypeProperty" - ], - "label": { - "values": [ - { - "text": "operational", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Работает в смысле 'Не сломано и может выполняет основные фунции'", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#falseExpressedBy": { - "type": "string", - "values": [ - { - "text": "tv:Disappear", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "работать", - "lang": "" - }, - { - "text": "показывать", - "lang": "" - }, - { - "text": "включаться", - "lang": "" - }, - { - "text": "включать", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#Name": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Name", - "types": [ - "http://www.w3.org/2000/01/rdf-schema#Datatype" - ], - "label": { - "values": [ - { - "text": "Name", - "lang": "" - } - ] - }, - "properties": {} - }, - "http://ailab.ifmo.ru/dialog/tv/schema#Router": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Router", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "Router", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Роутер - устройство маршрутизации между сетями, компонент услуги предоставление доступа в интернет или интерактивного телевидения.", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "роутер", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#Disconnect": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Disconnect", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "Disconnect", - "lang": "" - } - ] - }, - "properties": { - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "извлекать", - "lang": "" - }, - { - "text": "вытаскивать", - "lang": "" - }, - { - "text": "вынимать", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#Unsubscribe": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Unsubscribe", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "Unsubscribe", - "lang": "" - } - ] - }, - "properties": { - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "отписываться", - "lang": "" - }, - { - "text": "отключать", - "lang": "" - }, - { - "text": "отказываться", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#CamModule": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#CamModule", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "CamModule", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Cam-модуль, отвечает за декодирование платных каналов DVB. Может вставляться в телевизор или в теле-приставку.", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "к-модуль", - "lang": "" - }, - { - "text": "cam-модуль", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#Subscribe": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Subscribe", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "Subscribe", - "lang": "" - } - ] - }, - "properties": { - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "устанавливать", - "lang": "" - }, - { - "text": "подключать", - "lang": "" - }, - { - "text": "переходить", - "lang": "" - }, - { - "text": "настраивать", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#Internet": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Internet", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "Internet", - "lang": "" - } - ] - }, - "properties": { - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "интернет", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#sufficientFunds": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#sufficientFunds", - "types": [ - "http://www.w3.org/2002/07/owl#DatatypeProperty" - ], - "label": { - "values": [ - { - "text": "sufficientFunds", - "lang": "" - } - ] - }, - "properties": {} - }, - "http://ailab.ifmo.ru/dialog/tv/schema#ServiceProvider": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#ServiceProvider", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "ServiceProvider", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Поставщик услуг.", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#suspended": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#suspended", - "types": [ - "http://www.w3.org/2002/07/owl#DatatypeProperty" - ], - "label": { - "values": [ - { - "text": "suspended", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Приостановлено ли предоставление услуги из-за отсутствия оплаты или еще каких причин.", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "отключать", - "lang": "" - }, - { - "text": "заблокировать", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#SimpleProperty": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#SimpleProperty", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "SimpleProperty", - "lang": "" - } - ] - }, - "properties": {} - }, - "http://ailab.ifmo.ru/dialog/tv/schema#RTService": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#RTService", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "RTService", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Услуга ростелекома как элемент оплаты, биллинга, части договора.", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "услуга", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#serviceNumber": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#serviceNumber", - "types": [ - "http://www.w3.org/2002/07/owl#DatatypeProperty" - ], - "label": { - "values": [ - { - "text": "serviceNumber", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Номер услуги клиента. Используется для идентификации клиента.", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "номер", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#Disappear": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Disappear", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "Disappear", - "lang": "" - } - ] - }, - "properties": { - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "отключаться", - "lang": "" - }, - { - "text": "пропадать", - "lang": "" - }, - { - "text": "исчезать", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#Operation": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Operation", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "Operation", - "lang": "" - } - ] - }, - "properties": {} - }, - "http://ailab.ifmo.ru/dialog/tv/schema#WiFiRouter": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#WiFiRouter", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "WiFiRouter", - "lang": "" - } - ] - }, - "properties": { - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "WiFi", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#Service": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Service", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "Service", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Сервис, класс всех сущностей, ответственных за предоставление услуг клиентам.", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#DigitalTVChannel": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#DigitalTVChannel", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "DigitalTVChannel", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Цифровой телевизионный канал.", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "цифровой", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#rent": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#rent", - "types": [ - "http://www.w3.org/2002/07/owl#ObjectProperty" - ], - "label": { - "values": [ - { - "text": "rent", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Арендовать указанное имущество", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "арендовать", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#ServiceDesk": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#ServiceDesk", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "ServiceDesk", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Служба поддержки.", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#filedRequest": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#filedRequest", - "types": [ - "http://www.w3.org/2002/07/owl#DatatypeProperty" - ], - "label": { - "values": [ - { - "text": "filedRequest", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Пользователь оставил заявку", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#isClientOf": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#isClientOf", - "types": [ - "http://www.w3.org/2002/07/owl#ObjectProperty" - ], - "label": { - "values": [ - { - "text": "isClientOf", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Являться клиентом указанного оператора", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "клиент", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#came": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#came", - "types": [ - "http://www.w3.org/2002/07/owl#DatatypeProperty" - ], - "label": { - "values": [ - { - "text": "came", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Был ли мастер у клиента.", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "приходить", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#Observe": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Observe", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "Observe", - "lang": "" - } - ] - }, - "properties": {} - }, - "http://ailab.ifmo.ru/dialog/tv/schema#PropertyAsGoods": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#PropertyAsGoods", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "PropertyAsGoods", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Собственность пользователя в виде материальных или нематериальных объектов.", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#expressedBy": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#expressedBy", - "types": [ - "http://www.w3.org/1999/02/22-rdf-syntax-ns#Property" - ], - "label": { - "values": [ - { - "text": "expressedBy", - "lang": "" - } - ] - }, - "properties": {} - }, - "http://ailab.ifmo.ru/dialog/tv/schema#modified": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#modified", - "types": [ - "http://www.w3.org/2002/07/owl#DatatypeProperty" - ], - "label": { - "values": [ - { - "text": "modified", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Перенастроено ли устройство, были ли изменены настройки.", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "настраивать", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#ChannelPack": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#ChannelPack", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "ChannelPack", - "lang": "" - } - ] - }, - "properties": { - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "тариф", - "lang": "" - }, - { - "text": "план", - "lang": "" - }, - { - "text": "пакет", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#deviceModel": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#deviceModel", - "types": [ - "http://www.w3.org/2002/07/owl#DatatypeProperty" - ], - "label": { - "values": [ - { - "text": "deviceModel", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Название модели устройства.", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "модель", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#popularChannelPack": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#popularChannelPack", - "types": [ - "http://ailab.ifmo.ru/dialog/tv/schema#ChannelPack" - ], - "label": { - "values": [ - { - "text": "popularChannelPack", - "lang": "" - } - ] - }, - "properties": { - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "популярный", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#canHangUp": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#canHangUp", - "types": [ - "http://www.w3.org/2002/07/owl#DatatypeProperty" - ], - "label": { - "values": [ - { - "text": "canHangUp", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Можно ли клиенту повесить трубку и продложить решать проблему автономно.", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#canSolve": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#canSolve", - "types": [ - "http://www.w3.org/2002/07/owl#DatatypeProperty" - ], - "label": { - "values": [ - { - "text": "canSolve", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Может ли служба поддержки решить проблему пользователя. Нет - в случае неработающего телевизора, например.", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#userCanSwitchChannel": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#userCanSwitchChannel", - "types": [ - "http://www.w3.org/2002/07/owl#DatatypeProperty" - ], - "label": { - "values": [ - { - "text": "userCanSwitchChannel", - "lang": "" - } - ] - }, - "properties": { - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "переключаться", - "lang": "" - }, - { - "text": "переключать", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#rebooted": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#rebooted", - "types": [ - "http://www.w3.org/2002/07/owl#DatatypeProperty" - ], - "label": { - "values": [ - { - "text": "rebooted", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Перезагружено ли устройство", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "перезагружать", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#own": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#own", - "types": [ - "http://www.w3.org/2002/07/owl#ObjectProperty" - ], - "label": { - "values": [ - { - "text": "own", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Владеть указанным имуществом", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "есть", - "lang": "" - }, - { - "text": "иметь", - "lang": "" - }, - { - "text": "владеть", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#DigitalTVService": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#DigitalTVService", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "DigitalTVService", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Услуга цифрового телевидения.", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "цифровой", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#PhoneNumber": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#PhoneNumber", - "types": [ - "http://www.w3.org/2000/01/rdf-schema#Datatype" - ], - "label": { - "values": [ - { - "text": "PhoneNumber", - "lang": "" - } - ] - }, - "properties": {} - }, - "http://ailab.ifmo.ru/dialog/tv/schema#User": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#User", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "User", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Пользователь. Пока и клиент Ростелекома и позвонивший человек в одном лице.", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "мы", - "lang": "" - }, - { - "text": "я", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#subscribed": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#subscribed", - "types": [ - "http://www.w3.org/2002/07/owl#DatatypeProperty" - ], - "label": { - "values": [ - { - "text": "subscribed", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Подписан ли пользователь на эту услугу.", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#falseExpressedBy": { - "type": "string", - "values": [ - { - "text": "tv:Unsubscribe", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#trueExpressedBy": { - "type": "string", - "values": [ - { - "text": "tv:Subscribe", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#baseChannelPack": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#baseChannelPack", - "types": [ - "http://ailab.ifmo.ru/dialog/tv/schema#ChannelPack" - ], - "label": { - "values": [ - { - "text": "baseChannelPack", - "lang": "" - } - ] - }, - "properties": { - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "стартовый", - "lang": "" - }, - { - "text": "начальный", - "lang": "" - }, - { - "text": "базовый", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#TVSet": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#TVSet", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "TVSet", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Телевизор. Может иметь возможность декодирования платных каналов услуги цифрового телевидения с использованием CAM-модуля.", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "телевизор", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#forwardedToInfoSupport": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#forwardedToInfoSupport", - "types": [ - "http://www.w3.org/2002/07/owl#DatatypeProperty" - ], - "label": { - "values": [ - { - "text": "forwardedToInfoSupport", - "lang": "" - } - ] - }, - "properties": {} - }, - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#lemma", - "types": [ - "http://www.w3.org/2002/07/owl#AnnotationProperty" - ], - "label": { - "values": [ - { - "text": "lemma", - "lang": "" - } - ] - }, - "properties": {} - }, - "http://ailab.ifmo.ru/dialog/tv/schema#identified": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#identified", - "types": [ - "http://www.w3.org/2002/07/owl#DatatypeProperty" - ], - "label": { - "values": [ - { - "text": "identified", - "lang": "" - } - ] - }, - "properties": {} - }, - "http://ailab.ifmo.ru/dialog/tv/schema#forwardedToSecondSupport": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#forwardedToSecondSupport", - "types": [ - "http://www.w3.org/2002/07/owl#DatatypeProperty" - ], - "label": { - "values": [ - { - "text": "forwardedToSecondSupport", - "lang": "" - } - ] - }, - "properties": {} - }, - "http://ailab.ifmo.ru/dialog/tv/schema#callsAgain": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#callsAgain", - "types": [ - "http://www.w3.org/2002/07/owl#DatatypeProperty" - ], - "label": { - "values": [ - { - "text": "callsAgain", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Пользователь обращается повторно", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#ControlPanel": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#ControlPanel", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "ControlPanel", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Пульт от телевизора", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "пульт", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#hasNetworkConnection": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#hasNetworkConnection", - "types": [ - "http://www.w3.org/2002/07/owl#DatatypeProperty" - ], - "label": { - "values": [ - { - "text": "hasNetworkConnection", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Есть ли подключение к роутеру со стороны провайдера услуг.", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#Image": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Image", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "Image", - "lang": "" - } - ] - }, - "properties": { - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "сигнал", - "lang": "" - }, - { - "text": "картинка", - "lang": "" - }, - { - "text": "изображение", - "lang": "" - }, - { - "text": "видео", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#phoneNumber": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#phoneNumber", - "types": [ - "http://www.w3.org/2002/07/owl#DatatypeProperty" - ], - "label": { - "values": [ - { - "text": "phoneNumber", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Номер телефона", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "номер", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#deviceAppearance": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#deviceAppearance", - "types": [ - "http://www.w3.org/2002/07/owl#DatatypeProperty" - ], - "label": { - "values": [ - { - "text": "deviceAppearance", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Описание внешнего вида устройства.", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "внешний вид", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#TurnOn": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#TurnOn", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "TurnOn", - "lang": "" - } - ] - }, - "properties": { - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "включать", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#tvoeTV": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#tvoeTV", - "types": [ - "http://ailab.ifmo.ru/dialog/tv/schema#ServiceProvider" - ], - "label": { - "values": [ - { - "text": "tvoeTV", - "lang": "" - } - ] - }, - "properties": { - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "твой интернет", - "lang": "" - }, - { - "text": "твое тв", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#HomePhone": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#HomePhone", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "HomePhone", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Домашний телефон. Один из способов идентифицировать клиента. Другой - по номеру услуги.", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "домашний", - "lang": "" - }, - { - "text": "городской", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#All": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#All", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "All", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Концепт для обработки 'а потом все отвалилось'", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "всё", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#Home": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Home", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "Home", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Дом клиента в смысле места, где установлено такое оборудование, как роутер.", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "дом", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#Appear": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Appear", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "Appear", - "lang": "" - } - ] - }, - "properties": { - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "появляться", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#Cable": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Cable", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "Cable", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Кабель - нужен для подключения кабельного телевидения.", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#homeAddress": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#homeAddress", - "types": [ - "http://www.w3.org/2002/07/owl#DatatypeProperty" - ], - "label": { - "values": [ - { - "text": "homeAddress", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Домашний адрес", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "адрес", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#Flat": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Flat", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "Flat", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Квартира (уточнение дома).", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "квартира", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#operationalBad": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#operationalBad", - "types": [ - "http://www.w3.org/2002/07/owl#DatatypeProperty" - ], - "label": { - "values": [ - { - "text": "operationalBad", - "lang": "" - } - ] - }, - "properties": { - "http://ailab.ifmo.ru/dialog/tv/schema#falseExpressedBy": { - "type": "string", - "values": [ - { - "text": "tv:Disappear", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "тормозить", - "lang": "" - }, - { - "text": "расползаться", - "lang": "" - }, - { - "text": "портиться", - "lang": "" - }, - { - "text": "барахлить", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#AnalogueTVChannel": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#AnalogueTVChannel", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "AnalogueTVChannel", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Аналоговый телевизионный канал.", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "аналоговый", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#ServiceMan": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#ServiceMan", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "ServiceMan", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Квалифицированный работник", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "мастер", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#Phone": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Phone", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "Phone", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Телефон. Здесь пока только для образование сущности 'домашний телефон'", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "телефон", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#Speed": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#Speed", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "Speed", - "lang": "" - } - ] - }, - "properties": { - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "скорость", - "lang": "" - }, - { - "text": "производительность", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#SubscribableService": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#SubscribableService", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "SubscribableService", - "lang": "" - } - ] - }, - "properties": {} - }, - "http://ailab.ifmo.ru/dialog/tv/schema#hdChannelPack": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#hdChannelPack", - "types": [ - "http://ailab.ifmo.ru/dialog/tv/schema#ChannelPack" - ], - "label": { - "values": [ - { - "text": "hdChannelPack", - "lang": "" - } - ] - }, - "properties": { - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "эйчди", - "lang": "" - } - ] - } - } - }, - "http://ailab.ifmo.ru/dialog/tv/schema#SetTopBox": { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#SetTopBox", - "types": [ - "http://www.w3.org/2002/07/owl#Class" - ], - "label": { - "values": [ - { - "text": "SetTopBox", - "lang": "" - } - ] - }, - "properties": { - "http://www.w3.org/2000/01/rdf-schema#comment": { - "type": "string", - "values": [ - { - "text": "Телеприставка, осуществляющая декодирование цифрового сигнала и подключаемая к телевизору.", - "lang": "" - } - ] - }, - "http://ailab.ifmo.ru/dialog/tv/schema#lemma": { - "type": "string", - "values": [ - { - "text": "приставка", - "lang": "" - } - ] - } - } - } -} diff --git a/DKBFrontEnd/vendor/src/ontodia/data/demo/data/linkTypes.json b/DKBFrontEnd/vendor/src/ontodia/data/demo/data/linkTypes.json deleted file mode 100644 index 857a236b1..000000000 --- a/DKBFrontEnd/vendor/src/ontodia/data/demo/data/linkTypes.json +++ /dev/null @@ -1,110 +0,0 @@ -[ - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#own", - "label": { - "values": [ - { - "text": "own", - "lang": "" - } - ] - }, - "count": 0 - }, - { - "id": "http://www.w3.org/2002/07/owl#disjointWith", - "label": { - "values": [ - { - "text": "disjointWith", - "lang": "" - } - ] - }, - "count": 8 - }, - { - "id": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", - "label": { - "values": [ - { - "text": "type", - "lang": "" - } - ] - }, - "count": 93 - }, - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#isClientOf", - "label": { - "values": [ - { - "text": "isClientOf", - "lang": "" - } - ] - }, - "count": 0 - }, - { - "id": "http://www.w3.org/2000/01/rdf-schema#domain", - "label": { - "values": [ - { - "text": "domain", - "lang": "" - } - ] - }, - "count": 33 - }, - { - "id": "http://www.w3.org/2000/01/rdf-schema#subPropertyOf", - "label": { - "values": [ - { - "text": "subPropertyOf", - "lang": "" - } - ] - }, - "count": 2 - }, - { - "id": "http://ailab.ifmo.ru/dialog/tv/schema#rent", - "label": { - "values": [ - { - "text": "rent", - "lang": "" - } - ] - }, - "count": 0 - }, - { - "id": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "label": { - "values": [ - { - "text": "subClassOf", - "lang": "" - } - ] - }, - "count": 45 - }, - { - "id": "http://www.w3.org/2000/01/rdf-schema#range", - "label": { - "values": [ - { - "text": "range", - "lang": "" - } - ] - }, - "count": 33 - } -] diff --git a/DKBFrontEnd/vendor/src/ontodia/data/demo/data/links.json b/DKBFrontEnd/vendor/src/ontodia/data/demo/data/links.json deleted file mode 100644 index f727f1c8a..000000000 --- a/DKBFrontEnd/vendor/src/ontodia/data/demo/data/links.json +++ /dev/null @@ -1,467 +0,0 @@ -[ - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#ortChannel", - "linkTypeId": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#TVChannel" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#Battery", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#ServiceDevice" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#rostelekom", - "linkTypeId": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#ServiceProvider" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#problemStated", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#domain", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#User" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#hdPremiumChannelPack", - "linkTypeId": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#ChannelPack" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#subscriberName", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#domain", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#RTService" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#subscriberName", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#range", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#Name" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#encryptedSignal", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#domain", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#ChannelPack" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#forwardedToAccounts", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#domain", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#User" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#TVService", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#SubscribableService" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#TurnOff", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#Contact" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#TurnOff", - "linkTypeId": "http://www.w3.org/2002/07/owl#disjointWith", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#TurnOn" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#TVChannel", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#Service" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#ServiceDevice", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#PropertyAsGoods" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#ServiceDevice", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#Service" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#Connect", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#Contact" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#Connect", - "linkTypeId": "http://www.w3.org/2002/07/owl#disjointWith", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#Disconnect" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#falseExpressedBy", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subPropertyOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#expressedBy" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#changedSpeed", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#domain", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#Speed" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#kinoChannelPack", - "linkTypeId": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#ChannelPack" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#Subscription", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#Operation" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#switchedOn", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#domain", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#ServiceDevice" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#Contact", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#Operation" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#canHelp", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#domain", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#ServiceDesk" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#trueExpressedBy", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subPropertyOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#expressedBy" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#inserted", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#domain", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#CamModule" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#operational", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#domain", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#Service" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#Router", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#ServiceDevice" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#Disconnect", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#Contact" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#Disconnect", - "linkTypeId": "http://www.w3.org/2002/07/owl#disjointWith", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#Connect" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#Unsubscribe", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#Subscription" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#Unsubscribe", - "linkTypeId": "http://www.w3.org/2002/07/owl#disjointWith", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#Subscribe" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#CamModule", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#ServiceDevice" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#Subscribe", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#Subscription" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#Subscribe", - "linkTypeId": "http://www.w3.org/2002/07/owl#disjointWith", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#Unsubscribe" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#Internet", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#SubscribableService" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#sufficientFunds", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#domain", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#User" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#suspended", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#domain", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#DigitalTVService" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#serviceNumber", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#domain", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#RTService" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#Disappear", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#Observe" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#Disappear", - "linkTypeId": "http://www.w3.org/2002/07/owl#disjointWith", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#Appear" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#WiFiRouter", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#Router" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#DigitalTVChannel", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#TVChannel" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#rent", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#domain", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#User" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#rent", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#range", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#PropertyAsGoods" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#filedRequest", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#domain", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#User" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#isClientOf", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#domain", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#User" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#isClientOf", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#range", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#ServiceProvider" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#came", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#domain", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#ServiceMan" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#Observe", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#Operation" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#modified", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#domain", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#Router" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#ChannelPack", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#SubscribableService" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#deviceModel", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#domain", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#ServiceDevice" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#popularChannelPack", - "linkTypeId": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#ChannelPack" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#canHangUp", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#domain", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#User" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#canSolve", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#domain", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#ServiceDesk" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#userCanSwitchChannel", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#domain", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#TVChannel" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#rebooted", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#domain", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#ServiceDevice" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#own", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#domain", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#User" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#own", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#range", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#PropertyAsGoods" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#DigitalTVService", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#TVService" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#subscribed", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#domain", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#SubscribableService" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#baseChannelPack", - "linkTypeId": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#ChannelPack" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#TVSet", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#ServiceDevice" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#forwardedToInfoSupport", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#domain", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#User" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#identified", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#domain", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#User" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#forwardedToSecondSupport", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#domain", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#User" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#callsAgain", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#domain", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#User" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#ControlPanel", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#ServiceDevice" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#hasNetworkConnection", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#domain", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#Router" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#Image", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#SimpleProperty" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#phoneNumber", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#domain", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#Phone" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#phoneNumber", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#range", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#PhoneNumber" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#deviceAppearance", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#domain", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#ServiceDevice" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#TurnOn", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#Contact" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#TurnOn", - "linkTypeId": "http://www.w3.org/2002/07/owl#disjointWith", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#TurnOff" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#tvoeTV", - "linkTypeId": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#ServiceProvider" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#HomePhone", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#Phone" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#All", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#Service" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#Home", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#PropertyAsGoods" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#Appear", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#Observe" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#Appear", - "linkTypeId": "http://www.w3.org/2002/07/owl#disjointWith", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#Disappear" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#Cable", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#ServiceDevice" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#homeAddress", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#domain", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#Home" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#homeAddress", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#range", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#Address" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#Flat", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#Home" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#operationalBad", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#domain", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#Service" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#AnalogueTVChannel", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#TVChannel" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#Phone", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#PropertyAsGoods" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#Speed", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#SimpleProperty" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#SubscribableService", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#Service" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#hdChannelPack", - "linkTypeId": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#ChannelPack" - }, - { - "sourceId": "http://ailab.ifmo.ru/dialog/tv/schema#SetTopBox", - "linkTypeId": "http://www.w3.org/2000/01/rdf-schema#subClassOf", - "targetId": "http://ailab.ifmo.ru/dialog/tv/schema#ServiceDevice" - } -] diff --git a/DKBFrontEnd/vendor/src/ontodia/data/demo/provider.ts b/DKBFrontEnd/vendor/src/ontodia/data/demo/provider.ts deleted file mode 100644 index 8505678c1..000000000 --- a/DKBFrontEnd/vendor/src/ontodia/data/demo/provider.ts +++ /dev/null @@ -1,141 +0,0 @@ -import { cloneDeep, keyBy, map, each } from 'lodash'; -import { DataProvider, FilterParams } from '../provider'; -import { Dictionary, ClassModel, LinkType, ElementModel, LinkModel, LinkCount } from '../model'; - -const CLASSES = require('json!./data/classes.json'); -const LINK_TYPES = require('json!./data/linkTypes.json'); -const ELEMENTS = require>('json!./data/elements.json'); -const LINKS = require('json!./data/links.json'); - -export class DemoDataProvider implements DataProvider { - private simulateNetwork(result: T) { - const MEAN_DELAY = 200; - const cloned = cloneDeep(result); - // simulate exponential distribution - const delay = -Math.log(Math.random()) * MEAN_DELAY; - return new Promise(resolve => { - setTimeout(() => resolve(cloned), delay); - }); - } - - classTree() { - return this.simulateNetwork(CLASSES); - } - - classInfo(params: { classIds: string[] }) { - let classIds = params.classIds || []; - return this.simulateNetwork(CLASSES.filter(cl => classIds.indexOf(cl.id))); - } - - linkTypes() { - return this.simulateNetwork(LINK_TYPES); - } - - linkTypesInfo(params: { linkTypeIds: string[] }): Promise { - const types = keyBy(params.linkTypeIds); - const linkTypes = LINK_TYPES.filter(type => types[type.id]); - return this.simulateNetwork(linkTypes); - } - - elementInfo(params: { elementIds: string[]; }): Promise> { - const elements = params.elementIds - .map(elementId => ELEMENTS[elementId]) - .filter(element => element !== undefined); - return this.simulateNetwork( - keyBy(elements, element => element.id)); - } - - linksInfo(params: { - elementIds: string[]; - linkTypeIds: string[]; - }) { - const nodes = keyBy(params.elementIds); - const types = keyBy(params.linkTypeIds); - const links = LINKS.filter(link => - types[link.linkTypeId] && nodes[link.sourceId] && nodes[link.targetId]); - return this.simulateNetwork(links); - } - - linkTypesOf(params: { elementId: string; }) { - const counts: Dictionary = {}; - for (const link of LINKS) { - if (link.sourceId === params.elementId || - link.targetId === params.elementId - ) { - const linkCount = counts[link.linkTypeId]; - if (linkCount) { - linkCount.count++; - } else { - counts[link.linkTypeId] = {id: link.linkTypeId, count: 1}; - } - } - } - return this.simulateNetwork(map(counts)); - } - - linkElements(params: { elementId: string; linkId: string; limit: number; offset: number }): Promise> { - //for sparql we have rich filtering features and we just reuse filter. - return this.filter({ - refElementId: params.elementId, - refElementLinkId: params.linkId, - limit: params.limit, - offset: params.offset, - languageCode: ""}); - } - - filter(params: FilterParams): Promise> { - if (params.offset > 0) { return Promise.resolve({}); } - - let filtered: Dictionary = {}; - if (params.elementTypeId) { - each(ELEMENTS, element => { - if (element.types.indexOf(params.elementTypeId) >= 0) { - filtered[element.id] = element; - } - }); - } else if (params.refElementId) { - const filteredLinks = params.refElementLinkId - ? LINKS.filter(link => link.linkTypeId === params.refElementLinkId) - : LINKS; - const nodeId = params.refElementId; - for (const link of filteredLinks) { - let linkedElementId: string = undefined; - if (link.sourceId === nodeId) { - linkedElementId = link.targetId; - } else if (link.targetId === nodeId) { - linkedElementId = link.sourceId; - } - if (linkedElementId !== undefined) { - const linkedElement = ELEMENTS[linkedElementId]; - if (linkedElement) { - filtered[linkedElement.id] = linkedElement; - } - } - } - } else if (params.text) { - filtered = ELEMENTS; // filtering by text is done below - } else { - return Promise.reject(new Error('This type of filter is not implemented')); - } - - if (params.text) { - const filteredByText: Dictionary = {}; - const text = params.text.toLowerCase(); - each(filtered, element => { - let found = false; - if (element.id.toLowerCase().indexOf(text) >= 0) { - found = true; - } else { - found = element.label.values.some( - label => label.text.toLowerCase().indexOf(text) >= 0); - } - if (found) { - filteredByText[element.id] = element; - } - }); - return this.simulateNetwork(filteredByText); - } else { - return this.simulateNetwork(filtered); - } - } -} diff --git a/DKBFrontEnd/vendor/src/ontodia/data/model.ts b/DKBFrontEnd/vendor/src/ontodia/data/model.ts deleted file mode 100644 index 2624af5a4..000000000 --- a/DKBFrontEnd/vendor/src/ontodia/data/model.ts +++ /dev/null @@ -1,43 +0,0 @@ -export type Dictionary = { [key: string]: T; }; - -export interface LocalizedString { - text: string; - lang: string; -} - -export type Property = { type: 'string'; values: LocalizedString[]; }; - -export interface ElementModel { - id: string; - types: string[]; - label: { values: LocalizedString[] }; - image?: string; - properties: { [id: string]: Property }; -} - -export interface LinkModel { - linkTypeId: string; - sourceId: string; - targetId: string; -} - -export interface ClassModel { - id: string; - label: { values: LocalizedString[] }; - count: number; - children: ClassModel[]; -} - -export interface LinkCount { - id: string; - count: number; -} - -export interface LinkType extends LinkCount { - label: { values: LocalizedString[] }; -} - -export interface PropertyModel { - id: string; - label: { values: LocalizedString[] }; -} diff --git a/DKBFrontEnd/vendor/src/ontodia/data/provider.ts b/DKBFrontEnd/vendor/src/ontodia/data/provider.ts deleted file mode 100644 index fa8caa5a4..000000000 --- a/DKBFrontEnd/vendor/src/ontodia/data/provider.ts +++ /dev/null @@ -1,133 +0,0 @@ -import { - Dictionary, ClassModel, LinkType, ElementModel, LinkModel, LinkCount, PropertyModel, -} from './model'; - -/** - * DataProvider is responsible for getting data into Ontodia - * - * It has three parts: - * - Schema extraction - classTree(), linkTypes() - * - On-demand schema extraction - classInfo(), propertyInfo(), linkTypeInfo() - * - elements and links extraction - elementsInfo() and linksInfo() - * - navigation - linkTypesOf(), linkElements() - * - filtering - filter - * - * Schema extraction is executed on initialization and used to display class tree. - * - * On-demand schema extraction occurs when element with yet unknown type or link type appears any part of Ontodia. - * - * Elements and links extraction is executed when new element is placed on the diagram or diagram is restored from - * saved state to get all the data for it - * - * Navigation functions are called when user brings up navigation menu to display available links - * and places chosen elements on the diagram. - * - * When possible, Ontodia will group requests into batches to reduce round-trips and this will reduce calls to - * data provider. - * - */ -export interface DataProvider { - // schema extraction - - /** should return start-up class tree. In case of huge class tree some limits should be imposed. - * It can contain count of instances for each class if it's possible to get it from source. - */ - classTree(): Promise; - /* - initial fetching of link types along with statistics. - Since this list is not much use in UI, this method is subject to be removed. - */ - linkTypes(): Promise; - - /** - * Class information - */ - classInfo(params: { - classIds: string[]; - }): Promise; - - /** - * Data properties information - */ - propertyInfo?(params: { propertyIds: string[] }): Promise>; - - /** - * Link type information. - */ - linkTypesInfo(params: { - linkTypeIds: string[]; - }): Promise; - - /** - * Getting the elements from the data source on diagram initialization and on navigation events - */ - elementInfo(params: { elementIds: string[]; }): Promise>; - - /** - * Should return all links between elements. - * linkTypeIds is ignored in current sparql providers and is subject to be removed - */ - linksInfo(params: { - elementIds: string[]; - linkTypeIds: string[]; - }): Promise; - - /** - * Get link types of element to build navigation menu - */ - linkTypesOf(params: { elementId: string; }): Promise; - - /** - * returns elements following link for specified element. - * Has overlapping functionality with filter, but easier less powerful and easier to implement - * linkId could be null, if it's the case method should return all elements from all links from current element. - */ - linkElements(params: { elementId: string, linkId: string, limit: number, offset: number }) : Promise>; - - /** - * Supports filter functionality with different filters - by type, by element and it's connection, by full-text search - * Implementation should implement all possible combinations - */ - filter(params: FilterParams): Promise>; -} - -export default DataProvider; - -export interface FilterParams { - /** - * element type filter - */ - elementTypeId?: string; - /** - * text search - */ - text?: string; - - /** - * Reference element id to limit elements accessible through links from this elements only. - * Could be used with refElementLinkId to limit link types which to follow. - */ - refElementId?: string; - - /** - * Reference element link type id. Is used only when refElementId is set. - */ - refElementLinkId?: string; - - /* - * Limit number of elements returned. Defaults depend on data provider implementation - */ - limit: number; - - /** - * Offset within matched data set to use - */ - offset: number; - - /** - * Right now this is unused in sparql data provider. - * It was introduced to order results by particular language when doing substring match with regexps. - * It's subject to be removed. - */ - languageCode: string; -} diff --git a/DKBFrontEnd/vendor/src/ontodia/data/sparql/graphBuilder.ts b/DKBFrontEnd/vendor/src/ontodia/data/sparql/graphBuilder.ts deleted file mode 100644 index 5213894c6..000000000 --- a/DKBFrontEnd/vendor/src/ontodia/data/sparql/graphBuilder.ts +++ /dev/null @@ -1,88 +0,0 @@ -import * as N3 from 'n3'; - -import { LayoutData, LayoutCell, LayoutElement, LayoutLink } from '../../diagram/layoutData'; -import { uniformGrid } from '../../viewUtils/layout'; -import { Dictionary, ElementModel, LinkModel } from '../model'; - -import { SparqlDataProvider } from './sparqlDataProvider'; -import { SparqlResponse, Triple } from './sparqlModels'; - -const DEFAULT_PREFIX = -`PREFIX rdfs: - PREFIX rdf: - PREFIX owl: ` + '\n\n'; - -const GREED_STEP = 150; - -export class GraphBuilder { - constructor(public dataProvider: SparqlDataProvider) {} - - getGraphFromConstruct(constructQuery: string): Promise<{ - preloadedElements: Dictionary, - layoutData: LayoutData, - }> { - const query = DEFAULT_PREFIX + constructQuery; - return this.dataProvider.executeSparqlConstruct(query) - .then(graph => this.getGraphFromRDFGraph(graph)); - }; - - getGraphFromRDFGraph(graph: Triple[]): Promise<{ - preloadedElements: Dictionary, - layoutData: LayoutData, - }> { - let {elementIds, links} = this.getConstructElements(graph); - return this.dataProvider.elementInfo({elementIds}).then(elementsInfo => ({ - preloadedElements: elementsInfo, - layoutData: this.getLayout(elementsInfo, links), - })); - }; - - private getConstructElements(response: Triple[]): { - elementIds: string[], links: LinkModel[] - } { - const elements: Dictionary = {}; - const links: LinkModel[] = []; - - for (const {subject, predicate, object} of response) { - if (subject.type === 'uri' && object.type === 'uri') { - if (!elements[subject.value]) { elements[subject.value] = true; } - if (!elements[object.value]) { elements[object.value] = true; } - links.push({ - linkTypeId: predicate.value, - sourceId: subject.value, - targetId: object.value, - }); - } - } - return { elementIds: Object.keys(elements), links: links }; - } - - private getLayout(elementsInfo: Dictionary, linksInfo: LinkModel[]): LayoutData { - const keys = Object.keys(elementsInfo); - - const rows = Math.ceil(Math.sqrt(keys.length)); - const grid = uniformGrid({rows, cellSize: {x: GREED_STEP, y: GREED_STEP}}); - - const layoutElements: LayoutCell[] = keys.map((key, index) => { - const element = elementsInfo[key]; - const {x, y} = grid(index); - return { - id: element.id, - type: 'element', - position: {x, y}, - }; - }); - const layoutLinks = linksInfo.map((link, index) => { - return { - id: 'link_' + index, - typeId: link.linkTypeId, - type: 'link', - source: {id: link.sourceId}, - target: {id: link.targetId}, - }; - }); - return {cells: layoutElements.concat(layoutLinks)}; - } -} - -export default GraphBuilder; diff --git a/DKBFrontEnd/vendor/src/ontodia/data/sparql/responseHandler.ts b/DKBFrontEnd/vendor/src/ontodia/data/sparql/responseHandler.ts deleted file mode 100644 index fbf19b572..000000000 --- a/DKBFrontEnd/vendor/src/ontodia/data/sparql/responseHandler.ts +++ /dev/null @@ -1,369 +0,0 @@ -import { - RdfLiteral, SparqlResponse, ClassBinding, ElementBinding, LinkBinding, - ElementImageBinding, LinkTypeBinding, LinkTypeInfoBinding, PropertyBinding, -} from './sparqlModels'; -import { - Dictionary, LocalizedString, LinkType, ClassModel, ElementModel, LinkModel, Property, PropertyModel, -} from '../model'; - -const THING_URI = 'http://www.w3.org/2002/07/owl#Thing'; -const LABEL_URI = 'http://www.w3.org/2000/01/rdf-schema#label'; - -export function getClassTree(response: SparqlResponse): ClassModel[] { - const tree: ClassModel[] = []; - const treeNodes = createClassMap(response.results.bindings); - // createClassMap ensures we get both elements and parents and we can use treeNodes[treeNode.parent] safely - for (const nodeId in treeNodes) { - const treeNode = treeNodes[nodeId]; - if (treeNode.parent) { - const parent = treeNodes[treeNode.parent]; - parent.children.push(treeNode); - parent.count += treeNode.count; - } else { - tree.push(treeNode); - } - } - - calcCounts(tree); - - return tree; -} - -function createClassMap(sNodes: ClassBinding[]) : Dictionary { - let treeNodes: Dictionary = {}; - for (const sNode of sNodes) { - const sNodeId: string = sNode.class.value; - var node = treeNodes[sNodeId]; - if (node) { - if (sNode.label) { - const label = node.label; - if (label.values.length === 1 && !label.values[0].lang) { - label.values = []; - } - label.values.push(getLocalizedString(sNode.label)); - } - if (!node.parent && sNode.parent) { - node.parent = sNode.parent.value - } - } else { - node = getClassModel(sNode); - treeNodes[sNodeId] = node; - } - //ensuring parent will always be there - if (node.parent && !treeNodes[node.parent]) { - treeNodes[node.parent] = getClassModel({class: {value: node.parent, type: 'uri'}}); - } - } - return treeNodes; -} - -function calcCounts(children: ClassModel[]) { - for (let node of children) { - // no more to count - if (!node.children) return; - // ensure all children have their counts completed; - calcCounts(node.children); - // we have to preserve no data here. If nor element nor childs have no count information, - // we just pass NaN upwards. - const childCount = node.children.reduce((acc, val) => - // if val.count is not NaN, turn result into number - !isNaN(val.count) ? (!isNaN(acc) ? acc + val.count : val.count) : acc - , NaN); - node.count = !isNaN(childCount) ? (!isNaN(node.count) ? node.count + childCount : childCount) : node.count; - } -} - -export function getClassInfo(response: SparqlResponse): ClassModel[] { - const classes: { [id: string]: ClassModel } = {}; - for (const binding of response.results.bindings) { - if (!binding.class) { continue; } - const id = binding.class.value; - const model = classes[id]; - if (model) { - const newLabel = getLocalizedString(binding.label); - if (!model.label.values.some(label => isLocalizedEqual(label, newLabel))) { - model.label.values.push(newLabel); - } - const instanceCount = getInstCount(binding.instcount); - if (!isNaN(instanceCount)) { - model.count = Math.max(model.count, instanceCount); - } - } else { - const label = getLocalizedString(binding.label); - classes[id] = { - id, - children: [], - label: {values: label ? [label] : []}, - count: getInstCount(binding.instcount), - }; - } - } - - const classesList: ClassModel[] = []; - for (const id in classes) { - if (!classes.hasOwnProperty(id)) { continue; } - const model = classes[id]; - if (model.label.values.length === 0) { - model.label.values.push(getLocalizedString(undefined, id)); - } - classesList.push(model); - } - - return classesList; -} - -export function getPropertyInfo(response: SparqlResponse): Dictionary { - const models: Dictionary = {}; - for (const sProp of response.results.bindings) { - const model = getPropertyModel(sProp); - models[model.id] = model; - } - return models; -} - -export function getLinkTypes(response: SparqlResponse): LinkType[] { - const sInst = response.results.bindings; - const linkTypes: LinkType[] = []; - const instancesMap: Dictionary = {}; - - for (const sLink of sInst) { - let sInstTypeId: string = sLink.link.value; - - if (instancesMap[sInstTypeId]) { - if (sLink.label) { - const label = instancesMap[sInstTypeId].label; - if (label.values.length === 1 && !label.values[0].lang) { - label.values = []; - } - label.values.push(getLocalizedString(sLink.label)); - } - if (sLink.instcount) { - instancesMap[sInstTypeId].count = getInstCount(sLink.instcount); - } - } else { - instancesMap[sInstTypeId] = getLinkType(sLink); - linkTypes.push(instancesMap[sInstTypeId]); - } - - }; - - return linkTypes; -} - -export function getElementsInfo(response: SparqlResponse, ids: string[]): Dictionary { - const sInstances = response.results.bindings; - const instancesMap: Dictionary = {}; - - for (const sInst of sInstances) { - let sInstTypeId: string = sInst.inst.value; - - if (instancesMap[sInstTypeId]) { - enrichElement(instancesMap[sInst.inst.value], sInst); - } else { - instancesMap[sInstTypeId] = getElementInfo(sInst); - } - }; - - const proccesedIds = Object.keys(instancesMap); - for (const id of ids) { - if (proccesedIds.indexOf(id) === -1) { - instancesMap[id] = { - id: id, - label: { values: [getLocalizedString(undefined, id)] }, - types: [THING_URI], - properties: {}, - }; - } - }; - - return instancesMap; -} - -export function getEnrichedElementsInfo( - response: SparqlResponse, - elementsInfo: Dictionary -): Dictionary { - const respElements = response.results.bindings; - for (const respEl of respElements) { - const elementInfo = elementsInfo[respEl.inst.value]; - if (elementInfo) { - elementInfo.image = respEl.image.value; - } - } - return elementsInfo; -} - -export function getLinkTypesInfo(response: SparqlResponse): LinkType[] { - const sparqlLinkTypes = response.results.bindings; - return sparqlLinkTypes.map((sLinkType: LinkTypeInfoBinding) => getLinkTypeInfo(sLinkType)); -} - -export function getLinksInfo(response: SparqlResponse): LinkModel[] { - const sparqlLinks = response.results.bindings; - return sparqlLinks.map((sLink: LinkBinding) => getLinkInfo(sLink)); -} - -export function getLinksTypesOf(response: SparqlResponse): LinkType[] { - const sparqlLinkTypes = response.results.bindings; - return sparqlLinkTypes.map((sLink: LinkTypeBinding) => getLinkType(sLink)); -} - -export function getFilteredData(response: SparqlResponse): Dictionary { - const sInstances = response.results.bindings; - const instancesMap: Dictionary = {}; - - for (const sInst of sInstances) { - if (sInst.inst.type === 'literal') { - continue; - } - if (!instancesMap[sInst.inst.value]) { - instancesMap[sInst.inst.value] = getElementInfo(sInst); - } else { - enrichElement(instancesMap[sInst.inst.value], sInst); - } - }; - return instancesMap; -} - -export function enrichElement(element: ElementModel, sInst: ElementBinding) { - if (!element) { return; } - if (sInst.label) { - const localized = getLocalizedString(sInst.label); - - const currentLabels = element.label.values; - const isAutogeneratedLabel = currentLabels.length === 1 && - !currentLabels[0].lang && currentLabels[0].text === getNameFromId(element.id); - - if (isAutogeneratedLabel) { - element.label.values = [localized]; - } else if (element.label.values.every(value => !isLocalizedEqual(value, localized))) { - element.label.values.push(localized); - } - } - if (sInst.class && element.types.indexOf(sInst.class.value) < 0) { - element.types.push(sInst.class.value); - } - if (sInst.propType && sInst.propType.value !== LABEL_URI) { - let property: Property = element.properties[sInst.propType.value]; - if (!property) { - property = element.properties[sInst.propType.value] = { - type: 'string', // sInst.propType.value, - values: [], - }; - } - const propertyValue = getPropertyValue(sInst.propValue); - if (property.values.every(value => !isLocalizedEqual(value, propertyValue))) { - property.values.push(propertyValue); - } - } -} - -function isLocalizedEqual(left: LocalizedString, right: LocalizedString) { - return left.lang === right.lang && left.text === right.text; -} - -export function getNameFromId(id: string): string { - const sharpIndex = id.indexOf('#'); - if (sharpIndex !== -1) { - return id.substring(sharpIndex + 1, id.length); - } else { - const tokens = id.split('/'); - return tokens[tokens.length - 1]; - } -} - -export function getLocalizedString(label?: RdfLiteral, id?: string): LocalizedString { - if (label) { - return { - text: label.value, - lang: label['xml:lang'], - }; - } else if (id) { - return { - text: getNameFromId(id), - lang: '', - }; - } else { - return undefined; - } -} - -export function getInstCount(instcount: RdfLiteral): number { - return (instcount ? +instcount.value : NaN); -} - -/** - * This extension of ClassModel is used only in processing, parent links are not needed in UI (yet?) - */ -export interface HierarchicalClassModel extends ClassModel { - parent: string -} - -export function getClassModel(node: ClassBinding): HierarchicalClassModel { - return { - id: node.class.value, - children: [], - label: { values: [getLocalizedString(node.label, node.class.value)] }, - count: getInstCount(node.instcount), - parent: node.parent ? node.parent.value : undefined - }; -} - -export function getPropertyModel(node: PropertyBinding): PropertyModel { - return { - id: node.prop.value, - label: { values: [getLocalizedString(node.label, node.prop.value)] }, - }; -} - -export function getLinkType(sLinkType: LinkTypeBinding): LinkType { - return { - id: sLinkType.link.value, - label: { values: [getLocalizedString(sLinkType.label, sLinkType.link.value)] }, - count: getInstCount(sLinkType.instcount), - }; -} - -export function getPropertyValue(propValue?: RdfLiteral): LocalizedString { - if (!propValue) { return undefined; } - return { - lang: propValue['xml:lang'], - text: propValue.value, - }; -} - -export function getElementInfo(sInfo: ElementBinding): ElementModel { - const elementInfo: ElementModel = { - id: sInfo.inst.value, - label: { values: [getLocalizedString(sInfo.label, sInfo.inst.value)] }, - types: (sInfo.class ? [ sInfo.class.value ] : []), - properties: {}, - }; - - if (sInfo.propType && sInfo.propType.value !== LABEL_URI) { - elementInfo.properties[sInfo.propType.value] = { - type: 'string', // sInst.propType.value, - values: [getPropertyValue(sInfo.propValue)], - }; - } - - return elementInfo; -} - -export function getLinkInfo(sLinkInfo: LinkBinding): LinkModel { - if (!sLinkInfo) { return undefined; } - return { - linkTypeId: sLinkInfo.type.value, - sourceId: sLinkInfo.source.value, - targetId: sLinkInfo.target.value, - }; -} - -export function getLinkTypeInfo(sLinkInfo: LinkTypeInfoBinding): LinkType { - if (!sLinkInfo) { return undefined; } - return { - id: sLinkInfo.typeId.value, - label: { values: [getLocalizedString(sLinkInfo.label, sLinkInfo.typeId.value)] }, - count: getInstCount(sLinkInfo.instcount), - }; -} diff --git a/DKBFrontEnd/vendor/src/ontodia/data/sparql/sparqlDataProvider.ts b/DKBFrontEnd/vendor/src/ontodia/data/sparql/sparqlDataProvider.ts deleted file mode 100644 index b02bcd9d8..000000000 --- a/DKBFrontEnd/vendor/src/ontodia/data/sparql/sparqlDataProvider.ts +++ /dev/null @@ -1,429 +0,0 @@ -import 'whatwg-fetch'; -import * as N3 from 'n3'; -import { DataProvider, FilterParams } from '../provider'; -import { Dictionary, ClassModel, LinkType, ElementModel, LinkModel, LinkCount, PropertyModel } from '../model'; -import { - getClassTree, - getClassInfo, - getPropertyInfo, - getLinkTypes, - getElementsInfo, - getLinksInfo, - getLinksTypesOf, - getFilteredData, - getEnrichedElementsInfo, - getLinkTypesInfo, -} from './responseHandler'; -import { - ClassBinding, ElementBinding, LinkBinding, PropertyBinding, - LinkTypeBinding, LinkTypeInfoBinding, ElementImageBinding, SparqlResponse, Triple, RdfNode, -} from './sparqlModels'; -import { SparqlDataProviderSettings, OWLStatsSettings } from './sparqlDataProviderSettings'; - -export enum SparqlQueryMethod { GET = 1, POST } - -/** - * Runtime settings of SPARQL data provider - */ -export interface SparqlDataProviderOptions { - - /** - * sparql endpoint URL to use - */ - endpointUrl: string; - - // there are two options for fetching images: specify imagePropertyUris - // to use as image properties or specify a function to fetch image URLs - - /** - * properties to use as image URLs - */ - imagePropertyUris?: string[]; - - /** - * you can specify prepareImages function to extract image URL from element model - */ - prepareImages?: (elementInfo: Dictionary) => Promise>; - - /** - * wether to use GET (more compatible (Virtuozo), more error-prone due to large request URLs) - * or POST(less compatible, better on large data sets) - */ - queryMethod?: SparqlQueryMethod; - - /* - * what property to use as instance labels. This will override dataLabelProperty from settings - */ - labelProperty?: string; -} - -export class SparqlDataProvider implements DataProvider { - dataLabelProperty: string; - constructor( - private options: SparqlDataProviderOptions, - private settings: SparqlDataProviderSettings = OWLStatsSettings - ) { - this.dataLabelProperty = options.labelProperty ? options.labelProperty : settings.dataLabelProperty; - } - - classTree(): Promise { - const query = this.settings.defaultPrefix + this.settings.classTreeQuery; - return this.executeSparqlQuery(query).then(getClassTree); - } - - propertyInfo(params: { propertyIds: string[] }): Promise> { - const ids = params.propertyIds.map(escapeIri).map(id => ` ( ${id} )`).join(' '); - const query = this.settings.defaultPrefix + ` - SELECT ?prop ?label - WHERE { - ?prop ${this.settings.schemaLabelProperty} ?label. - VALUES (?prop) {${ids}}. - } - `; - return this.executeSparqlQuery(query).then(getPropertyInfo); - } - - classInfo(params: { classIds: string[] }): Promise { - const ids = params.classIds.map(escapeIri).map(id => ` ( ${id} )`).join(' '); - const query = this.settings.defaultPrefix + ` - SELECT ?class ?label ?instcount - WHERE { - ?class ${this.settings.schemaLabelProperty} ?label. - VALUES (?class) {${ids}}. - BIND("" as ?instcount) - } - `; - return this.executeSparqlQuery(query).then(getClassInfo); - } - - linkTypesInfo(params: {linkTypeIds: string[]}): Promise { - const ids = params.linkTypeIds.map(escapeIri).map(id => ` ( ${id} )`).join(' '); - const query = this.settings.defaultPrefix + ` - SELECT ?typeId ?label ?instcount - WHERE { - ?typeId ${this.settings.schemaLabelProperty} ?label. - VALUES (?typeId) {${ids}}. - BIND("" as ?instcount) - } - `; - return this.executeSparqlQuery(query).then(getLinkTypesInfo); - } - - linkTypes(): Promise { - const query = this.settings.defaultPrefix + ` - SELECT ?link ?instcount ?label - WHERE { - ${this.settings.linkTypesPattern} - OPTIONAL {?link ${this.settings.schemaLabelProperty} ?label.} - } - `; - return this.executeSparqlQuery(query).then(getLinkTypes); - } - - elementInfo(params: { elementIds: string[]; }): Promise> { - const ids = params.elementIds.map(escapeIri).map(id => ` (${id})`).join(' '); - const query = this.settings.defaultPrefix - + resolveTemplate(this.settings.elementInfoQuery, {ids: ids, dataLabelProperty: this.dataLabelProperty}); - return this.executeSparqlQuery(query) - .then(elementsInfo => getElementsInfo(elementsInfo, params.elementIds)) - .then(elementModels => { - if (this.options.prepareImages) { - return this.prepareElementsImage(elementModels); - } else if (this.options.imagePropertyUris && this.options.imagePropertyUris.length) { - return this.enrichedElementsInfo(elementModels, this.options.imagePropertyUris); - } else { - return elementModels; - } - }); - } - - private enrichedElementsInfo( - elementsInfo: Dictionary, - types: string[] - ): Promise> { - const ids = Object.keys(elementsInfo).map(escapeIri).map(id => ` ( ${id} )`).join(' '); - const typesString = types.map(escapeIri).map(id => ` ( ${id} )`).join(' '); - - const query = this.settings.defaultPrefix + ` - SELECT ?inst ?linkType ?image - WHERE {{ - VALUES (?inst) {${ids}} - VALUES (?linkType) {${typesString}} - ${this.settings.imageQueryPattern} - }} - `; - return this.executeSparqlQuery(query) - .then(imageResponse => getEnrichedElementsInfo(imageResponse, elementsInfo)).catch((err) => { - console.log(err); - return elementsInfo; - }); - } - - private prepareElementsImage( - elementsInfo: Dictionary - ): Promise> { - return this.options.prepareImages(elementsInfo).then(images => { - for (const key in images) { - if (images.hasOwnProperty(key) && elementsInfo[key]) { - elementsInfo[key].image = images[key]; - } - } - return elementsInfo; - }); - } - - linksInfo(params: { - elementIds: string[]; - linkTypeIds: string[]; - }): Promise { - const ids = params.elementIds.map(escapeIri).map(id => ` ( ${id} )`).join(' '); - const query = this.settings.defaultPrefix + ` - SELECT ?source ?type ?target - WHERE { - ?source ?type ?target. - VALUES (?source) {${ids}} - VALUES (?target) {${ids}} - } - `; - return this.executeSparqlQuery(query).then(getLinksInfo); - } - - linkTypesOf(params: { elementId: string; }): Promise { - const elementIri = escapeIri(params.elementId); - const query = this.settings.defaultPrefix - + resolveTemplate(this.settings.linkTypesOfQuery, {elementIri: elementIri}); - return this.executeSparqlQuery(query).then(getLinksTypesOf); - }; - - - linkElements(params: { - elementId: string; - linkId: string; - limit: number; - offset: number - }): Promise> { - // for sparql we have rich filtering features and we just reuse filter. - return this.filter({ - refElementId: params.elementId, - refElementLinkId: params.linkId, - limit: params.limit, - offset: params.offset, - languageCode: ''}); - } - - filter(params: FilterParams): Promise> { - if (params.limit === 0) { params.limit = 100; } - - let refQueryPart = ''; - // link to element with specified link type - if (params.refElementId && params.refElementLinkId) { - const refElementIRI = escapeIri(params.refElementId); - const refElementLinkIRI = escapeIri(params.refElementLinkId); - refQueryPart = `{ - ${refElementIRI} ${refElementLinkIRI} ?inst . - } UNION { - ?inst ${refElementLinkIRI} ${refElementIRI} . - }`; - } - - // all links to current element - if (params.refElementId && !params.refElementLinkId) { - const refElementIRI = escapeIri(params.refElementId); - refQueryPart = `{ - ${refElementIRI} ?link ?inst . - } UNION { - ?inst ?link ${refElementIRI} . - } - ${this.settings.filterRefElementLinkPattern} - `; - } - - if (!params.refElementId && params.refElementLinkId) { - throw new Error(`Can't execute refElementLink filter without refElement`); - } - - let elementTypePart: string; - if (params.elementTypeId) { - const elementTypeIri = escapeIri(params.elementTypeId); - elementTypePart = resolveTemplate(this.settings.filterTypePattern, {elementTypeIri: elementTypeIri}); - } else { - elementTypePart = ''; - } - - let textSearchPart: string; - if (params.text) { - const text = params.text; - textSearchPart = resolveTemplate( - this.settings.fullTextSearch.queryPattern, - {text: text, dataLabelProperty: this.dataLabelProperty} - ); - } else { - textSearchPart = ''; - } - - let query = `${this.settings.defaultPrefix} - ${this.settings.fullTextSearch.prefix} - - SELECT ?inst ?class ?label - WHERE { - { - SELECT DISTINCT ?inst ?score WHERE { - ${elementTypePart} - ${refQueryPart} - ${textSearchPart} - ${this.settings.filterAdditionalRestriction} - ${this.settings.fullTextSearch.extractLabel ? sparqlExtractLabel('?inst', '?extractedLabel') : ''} - } ORDER BY DESC(?score) LIMIT ${params.limit} OFFSET ${params.offset} - } - ${resolveTemplate(this.settings.filterElementInfoPattern, {dataLabelProperty: this.dataLabelProperty})} - } ORDER BY DESC(?score) - `; - - return this.executeSparqlQuery(query).then(getFilteredData); - }; - - executeSparqlQuery(query: string) { - const method = this.options.queryMethod ? this.options.queryMethod : SparqlQueryMethod.GET; - return executeSparqlQuery(this.options.endpointUrl, query, method); - } - - executeSparqlConstruct(query: string) : Promise { - const method = this.options.queryMethod ? this.options.queryMethod : SparqlQueryMethod.GET; - return executeSparqlConstruct(this.options.endpointUrl, query, method); - } -} - -function resolveTemplate(template: string, values: Dictionary) { - let result = template; - for (const replaceKey in values) { - const replaceValue = values[replaceKey]; - result = result.replace(new RegExp('\\${' + replaceKey + '}', 'g'), replaceValue); - } - return result; -} - -export function executeSparqlQuery(endpoint: string, query: string, method: SparqlQueryMethod): Promise> { - let internalQuery: Promise; - if (method == SparqlQueryMethod.GET) { - internalQuery = queryInternal({ - url: `${endpoint}?query=` + encodeURIComponent(query), - body: null, - headers: { - 'Accept': 'application/sparql-results+json', - }, - method: 'GET', - }); - } else { - internalQuery = queryInternal({ - url: endpoint, - body: query, - headers: { - 'Accept': 'application/sparql-results+json', - 'Content-Type': 'application/sparql-query', - }, - method: 'POST', - }); - } - return internalQuery.then((response): Promise> => { - if (response.ok) { - return response.json(); - } else { - const error = new Error(response.statusText); - (error).response = response; - throw error; - } - }); -}; - -export function executeSparqlConstruct(endpoint: string, query: string, method: SparqlQueryMethod): Promise { - let internalQuery: Promise; - if (method == SparqlQueryMethod.GET) { - internalQuery = queryInternal({ - url: `${endpoint}?query=` + encodeURIComponent(query), - body: null, - headers: { - 'Accept': 'text/turtle', - }, - method: 'GET', - }); - } else { - internalQuery = queryInternal({ - url: endpoint, - body: query, - headers: { - 'Accept': 'text/turtle', - 'Content-Type': 'application/sparql-query', - }, - method: 'POST', - }); - } - return new Promise((resolve, reject) => { - internalQuery.then(response => { - if (response.ok) { - return response.text(); - } else { - const error = new Error(response.statusText); - (error).response = response; - throw error; - } - }).then(turtleText => { - let triples: Triple[] = []; - N3.Parser().parse(turtleText, (error, triple, hash) => { - if (triple) { - triples.push({ - subject: toRdfNode(triple.subject), - predicate: toRdfNode(triple.predicate), - object: toRdfNode(triple.object), - }); - } else { - resolve(triples); - } - }); - }); - }); -} - - - -function toRdfNode(entity: string): RdfNode { - if (entity.length >= 2 && entity[0] === '"' && entity[entity.length - 1] === '"') { - return {type: 'literal', value: entity.substring(1, entity.length - 1), 'xml:lang': ''}; - } else { - return {type: 'uri', value: entity}; - } -} - -function queryInternal(params: { - url: string, - body: string, - headers: any, - method: string, -}) { - return fetch(params.url, { - method: params.method, - body: params.body, - credentials: 'same-origin', - mode: 'cors', - cache: 'default', - headers: params.headers, - }); -} - -function sparqlExtractLabel(subject: string, label: string): string { - return ` - BIND ( str( ${subject} ) as ?uriStr) - BIND ( strafter(?uriStr, "#") as ?label3) - BIND ( strafter(strafter(?uriStr, "//"), "/") as ?label6) - BIND ( strafter(?label6, "/") as ?label5) - BIND ( strafter(?label5, "/") as ?label4) - BIND (if (?label3 != "", ?label3, - if (?label4 != "", ?label4, - if (?label5 != "", ?label5, ?label6))) as ${label}) - `; -}; - -function escapeIri(iri: string) { - return `<${iri}>`; -} - -export default SparqlDataProvider; diff --git a/DKBFrontEnd/vendor/src/ontodia/data/sparql/sparqlDataProviderSettings.ts b/DKBFrontEnd/vendor/src/ontodia/data/sparql/sparqlDataProviderSettings.ts deleted file mode 100644 index d028046e4..000000000 --- a/DKBFrontEnd/vendor/src/ontodia/data/sparql/sparqlDataProviderSettings.ts +++ /dev/null @@ -1,306 +0,0 @@ -/** - * this is dataset-schema specific settings - */ -export interface SparqlDataProviderSettings { - /** - * default prefix to be used in every query - */ - defaultPrefix: string; - /** - * property to use as label in schema (classes, properties) - */ - schemaLabelProperty: string; - - /** - * property to use as instance label - * todo: make it an array - */ - dataLabelProperty: string; - - /** - * full-text search settings - */ - fullTextSearch: FullTextSearchSettings; - - /** - * query to retreive class tree. Should return class, label, parent, instcount (optional) - */ - classTreeQuery: string; - - /** - * link types pattern - what to consider a link on initial fetch - */ - linkTypesPattern: string; - - /** - * query for fetching all information on element: labels, classes, properties - */ - elementInfoQuery: string; - - /** - * this should return image URL for ?inst as instance and ?linkType for image property IRI - * todo: move to runtime settings instead? proxying is runtime thing - */ - imageQueryPattern: string; - - /** - * link types of returns possible link types from specified instance with statistics - */ - linkTypesOfQuery: string; - - /** - * when fetching all links from element, we could specify additional filter - */ - filterRefElementLinkPattern: string; - - /** - * filter by type pattern. One could use transitive type resolution here. - */ - filterTypePattern: string; - - /** - * how to fetch elements info when fetching data. - */ - filterElementInfoPattern: string; - - /** - * imposes additional filtering on elements within filter - */ - filterAdditionalRestriction: string; -} - -/** - * Full text search settings, - * developer could use anything from search extensions of triplestore to regular expressions match - * See wikidata and dbpedia examples for reusing full text search capabilities of Blazegraph and Virtuozo - */ -export interface FullTextSearchSettings { - /** - * prefix to use in FTS queries - */ - prefix: string; - - /** - * query pattern should return ?inst and ?score for given ${text}. - */ - queryPattern: string; - - /** - * try to extract label from IRI for usage in search purposes. - * If you have no labels in the dataset and want to search, you - * can use ?extractedLabel as something to search for. - */ - extractLabel?: boolean; -} - -export const WikidataSettings: SparqlDataProviderSettings = { - defaultPrefix: - `PREFIX rdfs: - PREFIX rdf: - PREFIX wdt: - PREFIX wd: - PREFIX owl: - -`, - - schemaLabelProperty: 'rdfs:label', - dataLabelProperty: 'rdfs:label', - - fullTextSearch: { - prefix: 'PREFIX bds: ' + '\n', - queryPattern: ` - ?inst rdfs:label ?searchLabel. - SERVICE bds:search { - ?searchLabel bds:search "\${text}*" ; - bds:minRelevance '0.5' ; - bds:matchAllTerms 'true' . - } - BIND(IF(STRLEN(?strInst) > 33, - 0-(SUBSTR(?strInst, 33)), - -10000) as ?score) - `, - }, - - classTreeQuery: ` - SELECT distinct ?class ?label ?parent WHERE { - ?class rdfs:label ?label. - { ?class wdt:P279 wd:Q35120. } - UNION - { ?parent wdt:P279 wd:Q35120. - ?class wdt:P279 ?parent. } - UNION - { ?parent wdt:P279/wdt:P279 wd:Q35120. - ?class wdt:P279 ?parent. } - } - `, - - // todo: think more, maybe add a limit here? - linkTypesPattern: `?link wdt:P279* wd:Q18616576. - BIND(0 as ?instcount) -`, - - elementInfoQuery: ` - SELECT ?inst ?class ?label ?propType ?propValue - WHERE { - OPTIONAL { - { ?inst wdt:P31 ?class } UNION - { ?inst wdt:P31 ?realClass . - ?realClass wdt:P279 | wdt:P279/wdt:P279 ?class } - } - OPTIONAL {?inst rdfs:label ?label} - OPTIONAL { - ?inst ?propType ?propValue . - FILTER (isLiteral(?propValue)) - } - } VALUES (?inst) {\${ids}} - `, - imageQueryPattern: ` { ?inst ?linkType ?fullImage } union { ?inst wdt:P163/wdt:P18 ?fullImage } - BIND(CONCAT("https://commons.wikimedia.org/w/thumb.php?f=", - STRAFTER(STR(?fullImage), "Special:FilePath/"), "&w=200") AS ?image)`, - - linkTypesOfQuery: ` - SELECT ?link (count(distinct ?object) as ?instcount) - WHERE { - { \${elementIri} ?link ?object } - UNION { ?object ?link \${elementIri} } - #this is to prevent some junk appear on diagram, but can really slow down execution on complex objects - FILTER ISIRI(?object) - FILTER exists {?object ?someprop ?someobj} - FILTER regex(STR(?link), "direct") - } GROUP BY ?link - `, - filterRefElementLinkPattern: 'FILTER regex(STR(?link), "direct")', - filterTypePattern: `?inst wdt:P31 ?instType. ?instType wdt:P279* \${elementTypeIri} . ${'\n'}`, - filterAdditionalRestriction: `FILTER ISIRI(?inst) - BIND(STR(?inst) as ?strInst) - FILTER exists {?inst ?someprop ?someobj} -`, - filterElementInfoPattern: `OPTIONAL {?inst wdt:P31 ?foundClass} - BIND (coalesce(?foundClass, owl:Thing) as ?class) - OPTIONAL {?inst rdfs:label ?label} -`, -}; - -export const OWLRDFSSettings: SparqlDataProviderSettings = { - defaultPrefix: - `PREFIX rdfs: - PREFIX rdf: - PREFIX owl: - -`, - schemaLabelProperty: 'rdfs:label', - dataLabelProperty: 'rdfs:label', - fullTextSearch: { - prefix: '', - queryPattern: - ` OPTIONAL {?inst \${dataLabelProperty} ?search1} - FILTER regex(COALESCE(str(?search1), str(?extractedLabel)), "\${text}", "i") - BIND(0 as ?score) -`, - extractLabel: true, - }, - classTreeQuery: ` - SELECT ?class ?label ?parent - WHERE { - { - ?class a rdfs:Class - } UNION { - ?class a owl:Class - } - OPTIONAL { ?class rdfs:label ?label.} - OPTIONAL {?class rdfs:subClassOf ?parent} - } - `, - - // todo: think more, maybe add a limit here? - linkTypesPattern: `{ ?link a rdf:Property - } UNION { - ?link a owl:ObjectProperty - } - BIND('' as ?instcount) -`, - elementInfoQuery: ` - SELECT ?inst ?class ?label ?propType ?propValue - WHERE { - OPTIONAL {?inst rdf:type ?class . } - OPTIONAL {?inst \${dataLabelProperty} ?label} - OPTIONAL {?inst ?propType ?propValue. - FILTER (isLiteral(?propValue)) } - } VALUES (?inst) {\${ids}} - `, - imageQueryPattern: `{ ?inst ?linkType ?image } UNION { [] ?linkType ?inst. BIND(?inst as ?image) }`, - linkTypesOfQuery: ` - SELECT ?link (count(distinct ?object) as ?instcount) - WHERE { - { \${elementIri} ?link ?object FILTER ISIRI(?object)} - UNION { ?object ?link \${elementIri} } - } GROUP BY ?link - `, - filterRefElementLinkPattern: '', - filterTypePattern: `?inst rdf:type \${elementTypeIri} . ${'\n'}`, - filterElementInfoPattern: `OPTIONAL {?inst rdf:type ?foundClass} - BIND (coalesce(?foundClass, owl:Thing) as ?class) - OPTIONAL {?inst \${dataLabelProperty} ?label}`, - filterAdditionalRestriction: '', -}; - -export const OWLStatsSettings: SparqlDataProviderSettings = {...OWLRDFSSettings, - classTreeQuery: ` - SELECT ?class ?instcount ?label ?parent - WHERE { - {SELECT ?class (count(?inst) as ?instcount) - WHERE { - ?inst rdf:type ?class. - } GROUP BY ?class } UNION - { - ?class rdf:type rdfs:Class - } UNION { - ?class rdf:type owl:Class - } - OPTIONAL { ?class rdfs:label ?label.} - OPTIONAL {?class rdfs:subClassOf ?parent} - } - `, -}; - -export const DBPediaSettings: SparqlDataProviderSettings = {...OWLRDFSSettings, - fullTextSearch: { - prefix: 'PREFIX dbo: \n', - queryPattern: ` - ?inst rdfs:label ?searchLabel. - ?searchLabel bif:contains "\${text}". - ?inst dbo:wikiPageID ?origScore . - BIND(0-?origScore as ?score) - `, - }, - - classTreeQuery: ` - SELECT distinct ?class ?label ?parent WHERE { - ?class rdfs:label ?label. - OPTIONAL {?class rdfs:subClassOf ?parent} - ?root rdfs:subClassOf owl:Thing. - ?class rdfs:subClassOf? | rdfs:subClassOf/rdfs:subClassOf ?root - } - `, - - elementInfoQuery: ` - SELECT ?inst ?class ?label ?propType ?propValue - WHERE { - ?inst rdf:type ?class . - ?inst rdfs:label ?label . - FILTER (!contains(str(?class), 'http://dbpedia.org/class/yago')) - OPTIONAL {?inst ?propType ?propValue. - FILTER (isLiteral(?propValue)) } - } VALUES (?inst) {\${ids}} - `, - filterElementInfoPattern: ` - OPTIONAL {?inst rdf:type ?foundClass. FILTER (!contains(str(?foundClass), 'http://dbpedia.org/class/yago'))} - BIND (coalesce(?foundClass, owl:Thing) as ?class) - OPTIONAL {?inst \${dataLabelProperty} ?label}`, - imageQueryPattern: ` { ?inst ?linkType ?fullImage } UNION { [] ?linkType ?inst. BIND(?inst as ?fullImage) } - BIND(CONCAT("https://commons.wikimedia.org/w/thumb.php?f=", - STRAFTER(STR(?fullImage), "Special:FilePath/"), "&w=200") AS ?image) -`, - -}; - diff --git a/DKBFrontEnd/vendor/src/ontodia/data/sparql/sparqlModels.ts b/DKBFrontEnd/vendor/src/ontodia/data/sparql/sparqlModels.ts deleted file mode 100644 index dd7cda57b..000000000 --- a/DKBFrontEnd/vendor/src/ontodia/data/sparql/sparqlModels.ts +++ /dev/null @@ -1,68 +0,0 @@ -export type RdfNode = RdfIri | RdfLiteral; - -export interface RdfIri { - type: 'uri'; - value: string; -} - -export interface RdfLiteral { - type: 'literal'; - value: string; - datatype?: string; - 'xml:lang': string; -} - -export interface Triple { - subject: RdfNode; - predicate: RdfNode; - object: RdfNode; -} - -export interface ElementBinding { - inst: RdfLiteral; - class?: RdfLiteral; - label?: RdfLiteral; - propType?: RdfLiteral; - propValue?: RdfLiteral; -} - -export interface ClassBinding { - class: RdfIri; - instcount?: RdfLiteral; - label?: RdfLiteral; - parent?: RdfIri; -} - -export interface PropertyBinding { - prop: RdfIri; - label?: RdfLiteral; -} - -export interface LinkBinding { - source: RdfIri; - type: RdfIri; - target: RdfIri; -} - -export interface LinkTypeBinding { - link: RdfIri; - instcount?: RdfLiteral; - label?: RdfLiteral; -} - -export interface LinkTypeInfoBinding { - typeId: RdfIri; - label?: RdfLiteral; - instcount?: RdfLiteral; -} - -export interface ElementImageBinding { - inst: RdfIri; - linkType: RdfIri; - image: RdfIri; -} - -export interface SparqlResponse { - head: { vars: string[] }; - results: { bindings: Binding[] }; -} diff --git a/DKBFrontEnd/vendor/src/ontodia/diagram/dataFetchingThread.ts b/DKBFrontEnd/vendor/src/ontodia/diagram/dataFetchingThread.ts deleted file mode 100644 index 717615835..000000000 --- a/DKBFrontEnd/vendor/src/ontodia/diagram/dataFetchingThread.ts +++ /dev/null @@ -1,29 +0,0 @@ -const DEFAULT_WAITING_TIME = 200; - -export class DataFetchingThread { - private fetchingPromise: Promise = null; - private fetchingQueue: string[] = []; - private waitingTime: number; - - constructor(waitingTime?: number) { - this.waitingTime = waitingTime || DEFAULT_WAITING_TIME; - } - - public startFetchingThread(typeId: string): Promise { - this.fetchingQueue.push(typeId); - if (this.fetchingPromise) { - return Promise.resolve([]); - } else { - this.fetchingPromise = new Promise((resolve) => { - setTimeout(() => { - this.fetchingPromise = null; - const queue = this.fetchingQueue; - this.fetchingQueue = []; - resolve(queue); - }, 200); - }); - return this.fetchingPromise; - } - } - -} diff --git a/DKBFrontEnd/vendor/src/ontodia/diagram/elementLayer.tsx b/DKBFrontEnd/vendor/src/ontodia/diagram/elementLayer.tsx deleted file mode 100644 index 1d9b1a2ef..000000000 --- a/DKBFrontEnd/vendor/src/ontodia/diagram/elementLayer.tsx +++ /dev/null @@ -1,292 +0,0 @@ -import * as React from 'react'; -import { findDOMNode } from 'react-dom'; -import * as joint from 'jointjs'; -import * as Backbone from 'backbone'; -import { hcl } from 'd3-color'; - -import { Property } from '../data/model'; - -import { TemplateProps } from '../customization/props'; -import { HandlebarsTemplate } from '../customization/handlebarsTemplate'; - -import { Element } from './elements'; -import { uri2name } from './model'; -import { DiagramView } from './view'; - -export interface Props { - paper: joint.dia.Paper; - view: DiagramView; -} - -export class ElementLayer extends React.Component { - private readonly listener = new Backbone.Model(); - - private layer: HTMLDivElement; - - render() { - const models = this.props.view.model.elements; - - const ctm = this.props.paper.viewport.getCTM(); - const scale = {x: ctm.a, y: ctm.d}; - const translate = {x: ctm.e, y: ctm.f}; - - return
    this.layer = layer} - style={{ - position: 'absolute', left: 0, top: 0, - transform: `translate(${translate.x}px,${translate.y}px) scale(${scale.x},${scale.y})`, - }}> - {models.map(model => )} -
    ; - } - - componentDidMount() { - const {paper} = this.props; - const graph = paper.model; - this.listener.listenTo(graph, 'add remove reset', this.updateAll); - this.listener.listenTo(paper, 'scale', this.updateAll); - this.listener.listenTo(paper, 'translate resize', this.updateAll); - } - - private updateAll = () => this.forceUpdate(); - - componentWillUnmount() { - this.listener.stopListening(); - } - - private updateElementSize = (element: Element, node: HTMLDivElement) => { - const {clientWidth, clientHeight} = node; - element.set('size', {width: clientWidth, height: clientHeight}); - } -} - -interface OverlayedElementProps { - model: Element; - view: DiagramView; - onResize: (model: Element, node: HTMLDivElement) => void; - onRender: (model: Element, node: HTMLDivElement) => void; -} - -interface OverlayedElementState { - readonly templateProps?: TemplateProps; -} - -class OverlayedElement extends React.Component { - private readonly listener = new Backbone.Model(); - - private typesObserver = new KeyedObserver({ - subscribe: key => { - const type = this.props.view.model.getClassesById(key); - if (type) { this.listener.listenTo(type, 'change:label', this.rerenderTemplate); } - }, - unsubscribe: key => { - const type = this.props.view.model.getClassesById(key); - if (type) { this.listener.stopListening(type); } - }, - }); - - private propertyObserver = new KeyedObserver({ - subscribe: key => { - const property = this.props.view.model.getPropertyById(key); - if (property) { this.listener.listenTo(property, 'change:label', this.rerenderTemplate); } - }, - unsubscribe: key => { - const property = this.props.view.model.getPropertyById(key); - if (property) { this.listener.stopListening(property); } - }, - }); - - constructor(props: OverlayedElementProps) { - super(props); - this.state = { - templateProps: this.templateProps(), - }; - } - - private rerenderTemplate = () => this.setState({templateProps: this.templateProps()}); - - render(): React.ReactElement { - const {model, view, onResize, onRender} = this.props; - - this.typesObserver.observe(model.template.types); - this.propertyObserver.observe(Object.keys(model.template.properties)); - - const template = view.getElementTemplate(model.template.types); - - const {x = 0, y = 0} = model.get('position') || {}; - let transform = `translate(${x}px,${y}px)`; - - const angle = model.get('angle') || 0; - if (angle) { transform += `rotate(${angle}deg)`; } - - return
    onResize(model, findDOMNode(this) as HTMLDivElement)} - onError={() => onResize(model, findDOMNode(this) as HTMLDivElement)} - onClick={e => { - if (e.target instanceof HTMLElement && e.target.localName === 'a') { - const anchor = e.target as HTMLAnchorElement; - model.iriClick(anchor.href); - e.preventDefault(); - } - }} - onDoubleClick={() => { - model.isExpanded = !model.isExpanded; - }} - ref={node => { - if (!node) { return; } - // set `model-id` to translate mouse events to paper - node.setAttribute('model-id', model.id); - onRender(model, node); - }}> - {typeof template === 'string' - ? onResize(model, findDOMNode(this) as HTMLDivElement)} /> - : React.createElement(template, this.state.templateProps)} -
    ; - } - - componentDidMount() { - const {model, view} = this.props; - this.listener.listenTo(view, 'change:language', this.rerenderTemplate); - this.listener.listenTo(model, 'state:loaded', this.rerenderTemplate); - this.listener.listenTo(model, 'focus-on-me', () => { - const element = findDOMNode(this) as HTMLElement; - if (element) { element.focus(); } - }); - this.listener.listenTo(model, 'change', () => { - let invalidateRendering = false, - invalidateAll = false; - - for (const changedKey in model.changed) { - if (!model.changed.hasOwnProperty(changedKey)) { continue; } - if (changedKey === 'size') { - /* ignore size changes */ - } else if (changedKey === 'position' || changedKey === 'angle') { - invalidateRendering = true; - } else { - invalidateAll = true; - } - } - - if (invalidateAll) { - this.rerenderTemplate(); - } else if (invalidateRendering) { - this.forceUpdate(); - } - }); - } - - componentWillUnmount() { - this.listener.stopListening(); - } - - shouldComponentUpdate(nextProps: OverlayedElementProps, nextState: OverlayedElementState) { - return nextState !== this.state; - } - - componentDidUpdate() { - this.props.onResize(this.props.model, findDOMNode(this) as HTMLDivElement); - } - - private templateProps(): TemplateProps { - const {model, view} = this.props; - - const types = model.template.types.length > 0 - ? view.getElementTypeString(model.template) : 'Thing'; - const label = view.getLocalizedText(model.template.label.values).text; - const {color, icon} = this.styleFor(model); - const propsAsList = this.getPropertyTable(); - - return { - types, - label, - color, - icon, - iri: model.template.id, - imgUrl: model.template.image, - isExpanded: model.isExpanded, - props: model.template.properties, - propsAsList, - }; - } - - private getPropertyTable(): Array<{ id: string; name: string; property: Property; }> { - const {model, view} = this.props; - - if (!model.template.properties) { return []; } - - const propTable = Object.keys(model.template.properties).map(key => { - const property = view ? view.model.getPropertyById(key) : undefined; - const name = view ? view.getLocalizedText(property.label.values).text : uri2name(key); - return { - id: key, - name: name, - property: model.template.properties[key], - }; - }); - - propTable.sort((a, b) => { - const aLabel = (a.name || a.id).toLowerCase(); - const bLabel = (b.name || b.id).toLowerCase(); - return aLabel.localeCompare(bLabel); - }); - return propTable; - } - - private styleFor(model: Element) { - const {color: {h, c, l}, icon} = this.props.view.getTypeStyle(model.template.types); - return { - icon: icon ? icon : 'ontodia-default-icon', - color: hcl(h, c, l).toString(), - }; - } -} - -class KeyedObserver { - private observedKeys = this.createMap(); - - private subscribe: (key: string) => void; - private unsubscribe: (key: string) => void; - - constructor(params: { - subscribe: (key: string) => void; - unsubscribe: (key: string) => void; - }) { - this.subscribe = params.subscribe; - this.unsubscribe = params.unsubscribe; - } - - private createMap(): { [key: string]: V; } { - const map = Object.create(null); - delete map['hint']; - return map; - } - - observe(keys: string[]) { - const newObservedKeys = this.createMap(); - - for (const key of keys) { - if (newObservedKeys[key]) { continue; } - newObservedKeys[key] = true; - if (!this.observedKeys[key]) { - this.subscribe(key); - } - } - - for (const key in this.observedKeys) { - if (!newObservedKeys[key]) { - this.unsubscribe(key); - } - } - - this.observedKeys = newObservedKeys; - } -} diff --git a/DKBFrontEnd/vendor/src/ontodia/diagram/elements.ts b/DKBFrontEnd/vendor/src/ontodia/diagram/elements.ts deleted file mode 100644 index 853f156c7..000000000 --- a/DKBFrontEnd/vendor/src/ontodia/diagram/elements.ts +++ /dev/null @@ -1,194 +0,0 @@ -import * as Backbone from 'backbone'; -import * as joint from 'jointjs'; - -import { ClassModel, ElementModel, LocalizedString } from '../data/model'; -import { DiagramModel, PreventLinksLoading } from './model'; - -export class UIElement extends joint.shapes.basic.Generic { - markup: string; - defaults() { - return joint.util.deepSupplement({ - type: 'element', - size: { width: 250, height: 50 }, - }, joint.shapes.basic.Generic.prototype.defaults); - } -} -UIElement.prototype.markup = ''; - -/** - * Properties: - * isExpanded: boolean - * position: { x: number, y: number } - * size: { width: number, height: number } - * angle: number - degrees - * - * Events: - * state:loaded - * add-to-filter - * focus-on-me - * action:iriClick - */ -export class Element extends UIElement { - template: ElementModel; - /** All in and out links of the element */ - links: Link[] = []; - - get isExpanded(): boolean { return this.get('isExpanded'); } - set isExpanded(value: boolean) { this.set('isExpanded', value); } - - initialize() { - joint.shapes.basic.Generic.prototype.initialize.apply(this, arguments); - this.set('z', 1); - // element is collapsed by default - if (!this.has('isExpanded')) { this.set('isExpanded', false); } - } - - addToFilter(linkType?: FatLinkType) { - this.trigger('add-to-filter', this, linkType); - } - - focus() { - this.trigger('focus-on-me', this); - } - - iriClick(iri: string) { - this.trigger('action:iriClick', iri); - } -} - -/** - * Properties: - * id: string - * label: { values: LocalizedString[] } - * count: number - */ -export class FatClassModel extends Backbone.Model { - model: ClassModel; - - get label(): { values: LocalizedString[] } { return this.get('label'); } - - constructor(classModel: ClassModel) { - super({id: classModel.id}); - this.model = classModel; - this.set('label', classModel.label); - this.set('count', classModel.count); - } -} - -/** - * Properties: - * id: string - * label: { values: LocalizedString[] } - */ -export class RichProperty extends Backbone.Model { - get label(): { values: LocalizedString[] } { return this.get('label'); } - - constructor(model: { - id: string; - label: { values: LocalizedString[] }; - }) { - super({id: model.id}); - this.set('label', model.label); - } -} - -/** - * Properties: - * typeId: string - * typeIndex: number - * source: { id: string } - * target: { id: string } - * layoutOnly: boolean -- link exists only in layout (instead of underlying data) - * - * Events: - * state:loaded - */ -export class Link extends joint.dia.Link { - arrowheadMarkup: string; - get markup() { - if (typeof this.typeIndex !== 'number') { - throw new Error('Missing typeIndex when intializing link\'s markup'); - } - return `` - + `` - + `` - + `` - + ``; - } - - get typeIndex(): number { return this.get('typeIndex'); } - set typeIndex(value: number) { this.set('typeIndex', value); } - - get typeId(): string { return this.get('typeId'); } - - get sourceId(): string { return this.get('source').id; } - get targetId(): string { return this.get('target').id; } - - get layoutOnly(): boolean { return this.get('layoutOnly'); } - set layoutOnly(value: boolean) { this.set('layoutOnly', value); } - - initialize(attributes?: {id: string}) { - this.set('labels', [{position: 0.5}]); - } -} -Link.prototype.arrowheadMarkup = null; - -export function linkMarkerKey(linkTypeIndex: number, startMarker: boolean) { - return `ontodia-${startMarker ? 'mstart' : 'mend'}-${linkTypeIndex}`; -} - -/** - * Properties: - * visible: boolean - * showLabel: boolean - * isNew?: boolean - * label?: { values: LocalizedString[] } - */ -export class FatLinkType extends Backbone.Model { - private diagram: DiagramModel; - - readonly index: number; - - get label(): { values: LocalizedString[] } { return this.get('label'); } - set label(value: { values: LocalizedString[] }) { this.set('label', value); } - - get visible(): boolean { return this.get('visible'); } - setVisibility( - params: { visible: boolean; showLabel: boolean; }, - options?: PreventLinksLoading, - ) { - this.set(params, options); - } - - constructor(params: { - id: string; - index: number; - label: { values: LocalizedString[] }; - diagram: DiagramModel; - }) { - super({ - id: params.id, - label: params.label, - visible: true, - showLabel: true, - }); - this.index = params.index; - this.diagram = params.diagram; - this.listenTo(this, 'change:visible', this.onVisibilityChanged); - } - - private onVisibilityChanged(self: this, visible: boolean, options: PreventLinksLoading) { - if (visible) { - if (!options.preventLoading) { - this.diagram.requestLinksOfType([this.id]); - } - } else { - const links = [...this.diagram.linksOfType(this.id)]; - for (const link of links) { - link.remove(); - } - } - } -} diff --git a/DKBFrontEnd/vendor/src/ontodia/diagram/layoutData.ts b/DKBFrontEnd/vendor/src/ontodia/diagram/layoutData.ts deleted file mode 100644 index a3278a2ca..000000000 --- a/DKBFrontEnd/vendor/src/ontodia/diagram/layoutData.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { pick } from 'lodash'; - -export interface LayoutData { - readonly cells: LayoutCell[]; -} - -export type LayoutCell = LayoutElement | LayoutLink; - -export interface LayoutElement { - type: 'element'; - id: string; - position: { x: number; y: number; }; - size?: any; - angle?: number; - isExpanded?: boolean; -} - -export interface LayoutLink { - type: 'link'; - id: string; - typeId: string; - source: { id: string }; - target: { id: string }; - vertices?: Array<{ x: number; y: number; }>; -} - -const serializedCellProperties = [ - 'id', 'type', // common properties - 'size', 'angle', 'isExpanded', 'position', // element properties - 'typeId', 'source', 'target', 'vertices', // link properties -]; - -export function normalizeImportedCell(cell: Cell): Cell { - let newCell: any = pick(cell, serializedCellProperties); - if (newCell.type === 'Ontodia.Element') { - newCell.type = 'element'; - } - return newCell; -} - -export function cleanExportedLayout(layout: LayoutData): LayoutData { - const cells = layout.cells.map(cell => pick(cell, serializedCellProperties) as LayoutCell); - return {cells}; -} diff --git a/DKBFrontEnd/vendor/src/ontodia/diagram/linkView.ts b/DKBFrontEnd/vendor/src/ontodia/diagram/linkView.ts deleted file mode 100644 index 952e89162..000000000 --- a/DKBFrontEnd/vendor/src/ontodia/diagram/linkView.ts +++ /dev/null @@ -1,89 +0,0 @@ -import * as joint from 'jointjs'; -import { merge } from 'lodash'; - -import { isIE11 } from '../viewUtils/detectBrowser'; - -import { Link, FatLinkType } from './elements'; -import { DiagramView } from './view'; - -export class LinkView extends joint.dia.LinkView { - model: Link; - - paper?: { diagramView?: DiagramView }; - - private view: DiagramView; - - initialize() { - joint.dia.LinkView.prototype.initialize.apply(this, arguments); - this.listenTo(this.model, 'change:layoutOnly', this.updateLabel); - } - render(): LinkView { - if (!this.view && this.paper && this.paper.diagramView) { - this.setView(this.paper.diagramView); - } - const result: any = super.render(); - return result; - } - getTypeModel(): FatLinkType { - return this.view.model.getLinkType(this.model.get('typeId')); - } - private setView(view: DiagramView) { - this.view = view; - this.listenTo(this.view, 'change:language', this.updateLabel); - - const typeModel = this.getTypeModel(); - this.listenTo(typeModel, 'change:showLabel', this.updateLabel); - this.listenTo(typeModel, 'change:label', this.updateLabel); - - this.updateLabelWithOptions({silent: true}); - } - - private updateLabel() { - this.updateLabelWithOptions(); - } - - private updateLabelWithOptions(options?: { silent?: boolean }) { - const linkTypeId: string = this.model.get('typeId'); - const typeModel = this.view.model.getLinkType(linkTypeId); - - const style = this.view.getLinkStyle(this.model.get('typeId')); - merge(style, {connection: {'stroke-dasharray': this.model.layoutOnly ? '5,5' : null}}); - - let linkAttributes: joint.dia.LinkAttributes = { - labels: style.labels, - connector: style.connector, - router: style.router, - z: 0, - }; - if (style.connection) { - merge(linkAttributes, {attrs: {'.connection': style.connection}}); - } - - const showLabels = typeModel && typeModel.get('showLabel'); - const labelAttributes = showLabels ? [{ - position: 0.5, - attrs: {text: { - text: this.view.getLinkLabel(linkTypeId).text, - }}, - }] : []; - - merge(linkAttributes, {labels: labelAttributes}); - this.model.set(linkAttributes, options); - } -} - -if (isIE11()) { - // workaround for "Dynamically updated SVG path with a marker-end does not update" issue - // https://connect.microsoft.com/IE/feedback/details/801938/ - (LinkView.prototype as any).update = function (this: LinkView) { - (joint.dia.LinkView.prototype as any).update.apply(this, arguments); - const path = (this.el as HTMLElement).querySelector('.connection') as SVGPathElement; - if (path) { - const pathParent = path.parentNode; - if (pathParent) { - pathParent.removeChild(path); - pathParent.insertBefore(path, pathParent.firstChild); - } - } - }; -} diff --git a/DKBFrontEnd/vendor/src/ontodia/diagram/model.ts b/DKBFrontEnd/vendor/src/ontodia/diagram/model.ts deleted file mode 100644 index a855fc317..000000000 --- a/DKBFrontEnd/vendor/src/ontodia/diagram/model.ts +++ /dev/null @@ -1,586 +0,0 @@ -import * as Backbone from 'backbone'; -import { each, size, values, keyBy, defaults, uniqueId } from 'lodash'; -import * as joint from 'jointjs'; - -import { - Dictionary, LocalizedString, LinkType, ClassModel, ElementModel, LinkModel, -} from '../data/model'; -import { DataProvider } from '../data/provider'; - -import { LayoutData, LayoutElement, normalizeImportedCell, cleanExportedLayout } from './layoutData'; -import { Element, Link, FatLinkType, FatClassModel, RichProperty } from './elements'; -import { DataFetchingThread } from './dataFetchingThread'; - -export type IgnoreCommandHistory = { ignoreCommandManager?: boolean }; -export type PreventLinksLoading = { preventLoading?: boolean; }; - -type ChangeVisibilityOptions = { isFromHandler?: boolean }; - -/** - * Model of diagram. - * - * Properties: - * isViewOnly: boolean - * - * Events: - * state:beginLoad - * state:endLoad (diagramElementCount?: number) - * state:loadError (error: any) - * state:renderStart - * state:renderDone - * state:dataLoaded - * - * history:undo - * history:redo - * history:reset - * history:initBatchCommand - * history:storeBatchCommand - */ -export class DiagramModel extends Backbone.Model { - graph = new joint.dia.Graph(); - - dataProvider: DataProvider; - - classTree: ClassTreeElement[]; - private classesById: Dictionary = {}; - private propertyLabelById: Dictionary = {}; - - private nextLinkTypeIndex = 0; - private linkTypes: Dictionary; - - private linksByType: Dictionary = {}; - - private classFetchingThread: DataFetchingThread; - private linkFetchingThread: DataFetchingThread; - private propertyLabelFetchingThread: DataFetchingThread; - - constructor(isViewOnly = false) { - super(); - this.set('isViewOnly', isViewOnly); - this.initializeExternalAddRemoveSupport(); - this.classFetchingThread = new DataFetchingThread(); - this.linkFetchingThread = new DataFetchingThread(); - this.propertyLabelFetchingThread = new DataFetchingThread(); - } - - isViewOnly(): boolean { return this.get('isViewOnly'); } - - get cells(): Backbone.Collection { return this.graph.get('cells'); } - get elements() { return this.graph.getElements() as Element[]; } - get links() { return this.graph.getLinks() as Link[]; } - - getElement(elementId: string): Element | undefined { - const cell = this.cells.get(elementId); - return cell instanceof Element ? cell : undefined; - } - - getLinkType(linkTypeId: string): FatLinkType | undefined { - return this.linkTypes[linkTypeId]; - } - - linksOfType(linkTypeId: string): ReadonlyArray { return this.linksByType[linkTypeId] || []; } - - sourceOf(link: Link) { return this.getElement(link.get('source').id); } - targetOf(link: Link) { return this.getElement(link.get('target').id); } - isSourceAndTargetVisible(link: Link): boolean { - return Boolean(this.sourceOf(link) && this.targetOf(link)); - } - - undo() { this.trigger('history:undo'); } - redo() { this.trigger('history:redo'); } - resetHistory() { this.trigger('history:reset'); } - initBatchCommand() { this.trigger('history:initBatchCommand'); } - storeBatchCommand() { this.trigger('history:storeBatchCommand'); } - - private initializeExternalAddRemoveSupport() { - // override graph.addCell to support CommandManager's undo/redo - const superAddCell = this.graph.addCell; - this.graph['addCell'] = (cell: any, options: any) => { - if (cell instanceof Element || cell instanceof Link) { - superAddCell.call(this.graph, cell, options); - } else if (cell.type === 'link') { - this.createLink({ - sourceId: cell.source.id, - targetId: cell.target.id, - linkTypeId: cell.typeId, - suggestedId: cell.id, - vertices: cell.vertices, - }); - } else if (cell.type === 'element') { - const {id, position, angle, isExpanded} = cell as LayoutElement; - const element = new Element({id, position, angle, isExpanded}); - element.template = placeholderTemplateFromIri(cell.id); - superAddCell.call(this.graph, element, options); - this.requestElementData([element]); - this.requestLinksOfType(); - } else { - superAddCell.call(this.graph, cell, options); - } - }; - // listen to external add/remove calls to graph (Halo's remove for example) - this.listenTo(this.graph, 'add', (cell: joint.dia.Cell) => { - if (cell instanceof Link) { - const linkType = this.getLinkType(cell.get('typeId')); - linkType.set('visible', true); - } - }); - this.listenTo(this.graph, 'remove', (cell: joint.dia.Cell) => { - if (cell instanceof Link) { - const {typeId, sourceId, targetId} = cell; - this.removeLinkReferences({linkTypeId: typeId, sourceId, targetId}); - } - }); - } - - createNewDiagram(dataProvider: DataProvider): Promise { - this.dataProvider = dataProvider; - this.trigger('state:beginLoad'); - - return Promise.all([ - this.dataProvider.classTree(), - this.dataProvider.linkTypes(), - ]).then(([classTree, linkTypes]: [ClassModel[], LinkType[]]) => { - this.setClassTree(classTree); - this.initLinkTypes(linkTypes); - this.trigger('state:endLoad', 0); - this.initLinkSettings(); - return this.initDiagram({preloadedElements: {}, markLinksAsLayoutOnly: false}); - }).catch(err => { - console.error(err); - this.trigger('state:endLoad', null, err.errorKind, err.message); - }); - } - - private initLinkTypes(linkTypes: LinkType[]) { - this.linkTypes = {}; - each(linkTypes, ({id, label}: LinkType) => { - const linkType = new FatLinkType({id, label, diagram: this, index: this.nextLinkTypeIndex++}); - this.linkTypes[linkType.id] = linkType; - }); - } - - importLayout(params: { - dataProvider: DataProvider; - preloadedElements?: Dictionary; - layoutData?: LayoutData; - validateLinks?: boolean; - linkSettings?: LinkTypeOptions[]; - hideUnusedLinkTypes?: boolean; - }): Promise { - this.dataProvider = params.dataProvider; - this.trigger('state:beginLoad'); - - return Promise.all([ - this.dataProvider.classTree(), - this.dataProvider.linkTypes(), - ]).then(([classTree, linkTypes]) => { - this.setClassTree(classTree); - this.initLinkTypes(linkTypes); - this.trigger('state:endLoad', size(params.preloadedElements)); - this.initLinkSettings(params.linkSettings); - return this.initDiagram({ - layoutData: params.layoutData, - preloadedElements: params.preloadedElements || {}, - markLinksAsLayoutOnly: params.validateLinks || false, - hideUnusedLinkTypes: params.hideUnusedLinkTypes, - }).then(() => { - if (params.validateLinks) { this.requestLinksOfType(); } - }); - }).catch(err => { - console.error(err); - this.trigger('state:endLoad', null, err.errorKind, err.message); - }); - } - - exportLayout(): { - layoutData: LayoutData; - linkSettings: LinkTypeOptions[]; - } { - const layoutData = cleanExportedLayout(this.graph.toJSON()); - const linkSettings = values(this.linkTypes).map((type: FatLinkType) => ({ - id: type.id, - visible: type.get('visible'), - showLabel: type.get('showLabel'), - })); - return {layoutData, linkSettings}; - } - - private setClassTree(rootClasses: ClassModel[]) { - this.classTree = rootClasses; - const addClass = (cl: ClassTreeElement) => { - this.classesById[cl.id] = new FatClassModel(cl); - each(cl.children, addClass); - }; - each(rootClasses, addClass); - } - - private initDiagram(params: { - layoutData?: LayoutData; - preloadedElements: Dictionary; - markLinksAsLayoutOnly: boolean; - hideUnusedLinkTypes?: boolean; - }): Promise { - const {layoutData, preloadedElements, markLinksAsLayoutOnly, hideUnusedLinkTypes} = params; - return new Promise((resolve, reject) => { - this.graph.trigger('batch:start', {batchName: 'to-back'}); - - this.listenToOnce(this, 'state:renderDone', () => { - if (hideUnusedLinkTypes) { - this.hideUnusedLinkTypes(); - } - this.graph.trigger('batch:stop', {batchName: 'to-back'}); - - resolve(); - // notify when graph model is fully initialized - this.trigger('state:dataLoaded'); - }); - - this.initLayout(layoutData || {cells: []}, preloadedElements, markLinksAsLayoutOnly); - }); - } - - private initLinkSettings(linkSettings?: LinkTypeOptions[]) { - if (linkSettings) { - const existingDefaults = { visible: false, showLabel: true }; - const indexedSettings = keyBy(linkSettings, 'id'); - each(this.linkTypes, (type, typeId) => { - const settings = indexedSettings[typeId] || {isNew: true}; - const options: PreventLinksLoading = {preventLoading: true}; - type.set(defaults(settings, existingDefaults), options); - }); - } else { - const newDefaults = { visible: true, showLabel: true }; - const options: PreventLinksLoading = {preventLoading: true}; - each(this.linkTypes, type => type.set(newDefaults, options)); - } - } - - private initLayout( - layoutData: LayoutData, - preloadedElements: Dictionary, - markLinksAsLayoutOnly: boolean, - ) { - this.linksByType = {}; - - const cellModels: joint.dia.Cell[] = []; - const elementToRequestData: Element[] = []; - - for (const layoutCell of layoutData.cells) { - let cell = normalizeImportedCell(layoutCell); - if (cell.type === 'element') { - // set size to zero to always recompute it on the first render - const element = new Element({...cell, size: {width: 0, height: 0}}); - const template = preloadedElements[cell.id]; - if (!template) { - elementToRequestData.push(element); - } - element.template = template || placeholderTemplateFromIri(cell.id); - cellModels.push(element); - } else if (cell.type === 'link') { - const link = new Link(cell); - link.layoutOnly = markLinksAsLayoutOnly; - link.typeIndex = this.createLinkType(link.typeId).index; - cellModels.push(link); - } - } - - this.requestElementData(elementToRequestData); - this.trigger('state:renderStart'); - this.graph.resetCells(cellModels); - - for (const link of this.links) { - this.registerLink(link); - } - } - - private hideUnusedLinkTypes() { - const unusedLinkTypes = {...this.linkTypes}; - for (const link of this.links) { - delete unusedLinkTypes[link.typeId]; - } - for (const typeId in unusedLinkTypes) { - if (!unusedLinkTypes.hasOwnProperty(typeId)) { continue; } - const unusedLinkType = unusedLinkTypes[typeId]; - unusedLinkType.set('visible', false); - } - } - - createElement(idOrModel: string | ElementModel): Element { - const id = typeof idOrModel === 'string' ? idOrModel : idOrModel.id; - const existing = this.getElement(id); - if (existing) { return existing; } - - const model = typeof idOrModel === 'string' - ? placeholderTemplateFromIri(idOrModel) : idOrModel; - - const element = new Element({id: model.id}); - element.template = model; - - this.graph.addCell(element); - return element; - } - - requestElementData(elements: Element[]) { - if (elements.length == 0) return Promise.resolve([]); - return this.dataProvider.elementInfo({elementIds: elements.map(e => e.id)}) - .then(models => this.onElementInfoLoaded(models)) - .catch(err => { - console.error(err); - return Promise.reject(err); - }); - } - - requestLinksOfType(linkTypeIds?: string[]) { - let linkTypes = linkTypeIds; - if (!linkTypes) { - linkTypeIds = values(this.linkTypes).map(type => type.id); - } - return this.dataProvider.linksInfo({ - elementIds: this.graph.getElements().map(element => element.id), - linkTypeIds: linkTypeIds, - }).then(links => this.onLinkInfoLoaded(links)) - .catch(err => { - console.error(err); - return Promise.reject(err); - }); - } - - getPropertyById(labelId: string): RichProperty { - if (!this.propertyLabelById[labelId]) { - this.propertyLabelById[labelId] = new RichProperty({ - id: labelId, - label: {values: [{lang: '', text: uri2name(labelId)}]}, - }); - this.propertyLabelFetchingThread.startFetchingThread(labelId).then(propertyIds => { - if (!this.dataProvider.propertyInfo) { return; } - if (propertyIds.length === 0) { return; } - this.dataProvider.propertyInfo({propertyIds}).then(propertyModels => { - for (const propertyId in propertyModels) { - if (!Object.hasOwnProperty.call(propertyModels, propertyId)) { continue; } - const propertyModel = propertyModels[propertyId]; - if (!this.propertyLabelById[propertyModel.id]) { continue; } - this.propertyLabelById[propertyModel.id].set('label', propertyModel.label); - } - }); - }); - } - return this.propertyLabelById[labelId]; - } - - getClassesById(typeId: string): FatClassModel { - if (!this.classesById[typeId]) { - this.classesById[typeId] = new FatClassModel({ - id: typeId, - label: { values: [{lang: '', text: uri2name(typeId)}] }, - count: 0, - children: [], - }); - this.classFetchingThread.startFetchingThread(typeId).then(typeIds => { - if (typeIds.length > 0) { - this.dataProvider.classInfo({classIds: typeIds}).then(classes => { - for (const cl of classes) { - if (!this.classesById[cl.id]) { continue; } - this.classesById[cl.id].set('label', cl.label); - this.classesById[cl.id].set('count', cl.count); - } - }); - } - }); - } - return this.classesById[typeId]; - } - - createLinkType(linkTypeId: string): FatLinkType { - if (this.linkTypes.hasOwnProperty(linkTypeId)) { - return this.linkTypes[linkTypeId]; - } - - const defaultLabel = {values: [{text: uri2name(linkTypeId), lang: ''}]}; - const fatLinkType = new FatLinkType({ - id: linkTypeId, - index: this.nextLinkTypeIndex++, - label: defaultLabel, - diagram: this, - }); - - this.linkFetchingThread.startFetchingThread(linkTypeId).then(linkTypeIds => { - if (linkTypeIds.length > 0) { - this.dataProvider.linkTypesInfo({linkTypeIds}).then(linkTypesInfo => { - for (const lt of linkTypesInfo) { - if (!this.linkTypes[lt.id]) { continue; } - this.linkTypes[lt.id].label = lt.label; - } - }); - } - }); - - this.linkTypes[linkTypeId] = fatLinkType; - return fatLinkType; - } - - private onElementInfoLoaded(elements: Dictionary) { - for (const id of Object.keys(elements)) { - const element = this.getElement(id); - if (element) { - element.template = elements[id]; - element.trigger('state:loaded'); - } - } - } - - private onLinkInfoLoaded(links: LinkModel[]) { - this.initBatchCommand(); - for (const linkModel of links) { - this.createLink(linkModel); - } - this.storeBatchCommand(); - } - - createLink(linkModel: LinkModel & { - suggestedId?: string; - vertices?: Array<{ x: number; y: number; }>; - }, options?: IgnoreCommandHistory): Link | undefined { - const existingLink = this.getLink(linkModel); - if (existingLink) { - if (existingLink.layoutOnly) { - existingLink.set('layoutOnly', false, {ignoreCommandManager: true} as IgnoreCommandHistory); - } - return existingLink; - } - - const {linkTypeId, sourceId, targetId, suggestedId, vertices} = linkModel; - const suggestedIdAvailable = Boolean(suggestedId && !this.cells.get(suggestedId)); - - const link = new Link({ - id: suggestedIdAvailable ? suggestedId : `link_${generateRandomID()}`, - typeId: linkTypeId, - source: {id: sourceId}, - target: {id: targetId}, - vertices, - }); - - if (this.isSourceAndTargetVisible(link) && this.createLinkType(link.typeId).visible) { - this.registerLink(link); - this.graph.addCell(link, options); - return link; - } - return undefined; - } - - private registerLink(link: Link) { - const typeId = link.typeId; - if (!this.linksByType.hasOwnProperty(typeId)) { - this.linksByType[typeId] = []; - } - this.linksByType[typeId].push(link); - - if (link.typeIndex === undefined) { - link.typeIndex = this.createLinkType(typeId).index; - } - - this.sourceOf(link).links.push(link); - this.targetOf(link).links.push(link); - } - - getLink(linkModel: LinkModel): Link | undefined { - const source = this.getElement(linkModel.sourceId); - if (!source) { return undefined; } - const index = findLinkIndex(source.links, linkModel); - return index >= 0 && source.links[index]; - } - - private removeLinkReferences(linkModel: LinkModel) { - const source = this.getElement(linkModel.sourceId); - removeLinkFrom(source && source.links, linkModel); - - const target = this.getElement(linkModel.targetId); - removeLinkFrom(target && target.links, linkModel); - - const linksOfType = this.linksByType[linkModel.linkTypeId]; - removeLinkFrom(linksOfType, linkModel); - } -} - -export default DiagramModel; - -export interface ClassTreeElement { - id: string; - label: { values: LocalizedString[] }; - count: number; - children: ClassTreeElement[]; - a_attr?: { - href: string; - draggable: boolean; - }; -} - -export interface LinkTypeOptions { - id: string; - visible: boolean; - showLabel?: boolean; -} - -function placeholderTemplateFromIri(iri: string): ElementModel { - return { - id: iri, - types: [], - label: {values: [{lang: '', text: uri2name(iri)}]}, - properties: {}, - }; -} - -function removeLinkFrom(links: Link[], model: LinkModel) { - if (!links) { return; } - const index = findLinkIndex(links, model); - links.splice(index, 1); -} - -function findLinkIndex(haystack: Link[], needle: LinkModel) { - const {sourceId, targetId, linkTypeId} = needle; - for (let i = 0; i < haystack.length; i++) { - const link = haystack[i]; - if (link.sourceId === sourceId && - link.targetId === targetId && - link.typeId === linkTypeId - ) { - return i; - } - } - return -1; -} - -/** Generates random 16-digit hexadecimal string. */ -function generateRandomID() { - function randomHalfDigits() { - return Math.floor((1 + Math.random()) * 0x100000000) - .toString(16).substring(1); - } - // generate by half because of restricted numerical precision - return randomHalfDigits() + randomHalfDigits(); -} - -export function uri2name(uri: string): string { - const hashIndex = uri.lastIndexOf('#'); - if (hashIndex !== -1 && hashIndex !== uri.length - 1) { - return uri.substring(hashIndex + 1); - } - const lastPartStart = uri.lastIndexOf('/'); - if (lastPartStart !== -1 && lastPartStart !== uri.length - 1) { - return uri.substring(lastPartStart + 1); - } - return uri; -} - -export function chooseLocalizedText(texts: LocalizedString[], language: string): LocalizedString { - if (texts.length === 0) { return null; } - // undefined if default language string isn't present - let defaultLanguageValue: LocalizedString; - for (const text of texts) { - if (text.lang === language) { - return text; - } else if (text.lang === '') { - defaultLanguageValue = text; - } - } - return typeof defaultLanguageValue === 'undefined' ? texts[0] : defaultLanguageValue; -} diff --git a/DKBFrontEnd/vendor/src/ontodia/diagram/paperArea.tsx b/DKBFrontEnd/vendor/src/ontodia/diagram/paperArea.tsx deleted file mode 100644 index 6684b5364..000000000 --- a/DKBFrontEnd/vendor/src/ontodia/diagram/paperArea.tsx +++ /dev/null @@ -1,442 +0,0 @@ -import * as Backbone from 'backbone'; -import * as joint from 'jointjs'; -import * as React from 'react'; -import { render as reactDOMRender, unmountComponentAtNode } from 'react-dom'; -import { debounce } from 'lodash'; - -import { Spinner, Props as SpinnerProps } from '../viewUtils/spinner'; - -import { DiagramModel } from './model'; - -export interface Props { - model: DiagramModel; - paper: joint.dia.Paper; - preventTextSelection: () => void; - zoomOptions?: { - min?: number; - max?: number; - /** Used when zooming to fit to limit zoom of small diagrams */ - maxFit?: number; - fitPadding?: number; - }; - panningAlwaysActive?: boolean; - onDragDrop?: (e: DragEvent, paperPosition: { x: number; y: number; }) => void; -} - -export interface ZoomOptions { - pivot?: { x: number; y: number; }; -} - -export class PaperArea extends React.Component { - private readonly listener = new Backbone.Model(); - - private area: HTMLDivElement; - private paper: joint.dia.Paper; - - private spinnerElement: SVGGElement; - - private pageSize: { x: number; y: number; }; - - private padding = {x: 0, y: 0}; - private center: { x: number; y: number; }; - private previousOrigin: { x: number; y: number; }; - - private isPanning = false; - private panningOrigin: { pageX: number; pageY: number; }; - private panningScrollOrigin: { scrollLeft: number; scrollTop: number; }; - - render() { - return
    this.area = area} - onMouseDown={this.onAreaPointerDown} - onWheel={this.onWheel}> -
    ; - } - - componentDidMount() { - this.paper = this.props.paper; - - this.pageSize = { - x: this.paper.options.width, - y: this.paper.options.height, - }; - (this.paper.svg as any as HTMLElement).style.overflow = 'visible'; - this.area.appendChild(this.paper.el); - this.updatePaperMargins(); - this.centerTo(); - - this.spinnerElement = document.createElementNS('http://www.w3.org/2000/svg', 'g'); - this.paper.svg.appendChild(this.spinnerElement); - - this.listener.listenTo(this.paper, 'scale', this.onPaperScale); - this.listener.listenTo(this.paper, 'resize', this.onPaperResize); - this.listener.listenTo(this.paper, 'translate', this.onPaperTranslate); - this.listener.listenTo(this.paper, 'blank:pointerdown', (e: MouseEvent) => { - if (this.shouldStartPanning(e)) { - e.preventDefault(); - this.startPanning(e); - } - }); - this.listener.listenTo(this.paper, 'render:done', () => { - this.adjustPaper(); - this.centerTo(); - }); - this.listener.listenTo(this.paper, 'cell:pointerdown', () => { - this.props.preventTextSelection(); - }); - // automatic paper adjust on element dragged - this.listener.listenTo(this.paper, 'cell:pointerup', this.adjustPaper); - this.listener.listenTo(this.paper.options.model, - 'add remove change:position', debounce(this.adjustPaper, 50)); - this.listener.listenTo(this.paper.options.model, 'change:size', this.adjustPaper); - this.listener.listenTo(this.paper, 'ontodia:adjustSize', this.adjustPaper); - - this.area.addEventListener('dragover', this.onDragOver); - this.area.addEventListener('drop', this.onDragDrop); - - const model = this.props.model; - this.listener.listenTo(model, 'state:beginLoad', () => this.showIndicator()); - this.listener.listenTo(model, 'state:endLoad', - (elementCount: number) => this.renderLoadingIndicator(elementCount)); - this.listener.listenTo(model, 'state:loadError', - (error: any) => this.renderLoadingIndicator(undefined, error)); - this.listener.listenTo(model, 'state:renderStart', () => { - unmountComponentAtNode(this.spinnerElement); - }); - this.listener.listenTo(model, 'state:dataLoaded', () => { - this.zoomToFit(); - }); - } - - shouldComponentUpdate() { - return false; - } - - componentWillUnmount() { - this.stopPanning(); - this.listener.stopListening(); - this.area.removeEventListener('dragover', this.onDragOver); - this.area.removeEventListener('drop', this.onDragDrop); - unmountComponentAtNode(this.spinnerElement); - } - - clientToPaperCoords(areaClientX: number, areaClientY: number) { - const ctm = this.paper.viewport.getCTM(); - let x = areaClientX + this.area.scrollLeft - this.padding.x - ctm.e; - x /= ctm.a; - let y = areaClientY + this.area.scrollTop - this.padding.y - ctm.f; - y /= ctm.d; - return {x, y}; - } - - /** Returns bounding box of paper content in paper coordinates. */ - getContentFittingBox() { - return joint.V(this.paper.viewport).bbox(true, this.paper.svg); - } - - /** Returns paper size in paper coordinates. */ - getPaperSize(): { width: number; height: number; } { - const scale = this.getScale(); - const {width, height} = this.paper.options; - return {width: width / scale, height: height / scale}; - } - - adjustPaper = () => { - this.center = this.clientToPaperCoords( - this.area.clientWidth / 2, this.area.clientHeight / 2); - - const scale = this.getScale(); - // bbox in paper coordinates - const bboxPaper = this.getContentFittingBox(); - // bbox in area client coordinates - const bboxArea = { - left: bboxPaper.x * scale, - right: (bboxPaper.x + bboxPaper.width) * scale, - top: bboxPaper.y * scale, - bottom: (bboxPaper.y + bboxPaper.height) * scale, - }; - - const gridWidth = this.pageSize.x * scale; - const gridHeight = this.pageSize.y * scale; - - // bbox in integer grid coordinates (open-closed intervals) - const bboxGrid = { - left: Math.floor(bboxArea.left / gridWidth), - right: Math.ceil(bboxArea.right / gridWidth), - top: Math.floor(bboxArea.top / gridHeight), - bottom: Math.ceil(bboxArea.bottom / gridHeight), - }; - - const oldOrigin = this.paper.options.origin; - const newOrigin = { - x: (-bboxGrid.left) * gridWidth, - y: (-bboxGrid.top) * gridHeight, - }; - if (newOrigin.x !== oldOrigin.x || newOrigin.y !== oldOrigin.y) { - this.paper.setOrigin(newOrigin.x, newOrigin.y); - } - - const oldWidth = this.paper.options.width; - const oldHeight = this.paper.options.height; - const newWidth = Math.max(bboxGrid.right - bboxGrid.left, 1) * gridWidth; - const newHeight = Math.max(bboxGrid.bottom - bboxGrid.top, 1) * gridHeight; - if (newWidth !== oldWidth || newHeight !== oldHeight) { - this.paper.setDimensions(newWidth, newHeight); - } - - this.updatePaperMargins(); - } - - private updatePaperMargins() { - const previousPadding = this.padding; - this.padding = { - x: Math.ceil(this.area.clientWidth * 0.75), - y: Math.ceil(this.area.clientHeight * 0.75), - }; - - const paddingUnchanged = - this.padding.x === previousPadding.x && - this.padding.y === previousPadding.y; - if (paddingUnchanged) { return; } - - const paperElement: HTMLElement = this.paper.el; - paperElement.style.marginLeft = `${this.padding.x}px`; - paperElement.style.marginRight = `${this.padding.x}px`; - paperElement.style.marginTop = `${this.padding.y}px`; - paperElement.style.marginBottom = `${this.padding.y}px`; - - if (previousPadding) { - this.area.scrollLeft += this.padding.x - previousPadding.x; - this.area.scrollTop += this.padding.y - previousPadding.y; - } - } - - private onPaperScale = (scaleX: number, scaleY: number, originX: number, originY: number) => { - this.adjustPaper(); - if (originX !== undefined || originY !== undefined) { - this.centerTo({x: originX, y: originY}); - } - }; - - private onPaperResize = () => { - if (this.center) { - this.centerTo(this.center); - } - }; - - private onPaperTranslate = (originX: number, originY: number) => { - if (this.previousOrigin) { - const {x, y} = this.previousOrigin; - const translatedX = originX - x; - const translatedY = originY - y; - // update visible area when paper change origin without resizing - // e.g. paper shinks from left side and grows from right - this.area.scrollLeft += translatedX; - this.area.scrollTop += translatedY; - } - this.previousOrigin = {x: originX, y: originY}; - } - - private shouldStartPanning(e: MouseEvent | React.MouseEvent) { - return e.ctrlKey || e.shiftKey || this.props.panningAlwaysActive; - } - - private onAreaPointerDown = (e: React.MouseEvent) => { - if (e.target === this.area) { - if (this.shouldStartPanning(e)) { - e.preventDefault(); - this.startPanning(e); - } - } - }; - - private startPanning(event: { pageX: number; pageY: number; }) { - this.props.preventTextSelection(); - - const {pageX, pageY} = event; - this.panningOrigin = {pageX, pageY}; - const {scrollLeft, scrollTop} = this.area; - this.panningScrollOrigin = {scrollLeft, scrollTop}; - - this.isPanning = true; - document.addEventListener('mousemove', this.onPointerMove); - document.addEventListener('mouseup', this.stopPanning); - } - - private onPointerMove = (e: MouseEvent) => { - if (this.isPanning) { - const offsetX = e.pageX - this.panningOrigin.pageX; - const offsetY = e.pageY - this.panningOrigin.pageY; - this.area.scrollLeft = this.panningScrollOrigin.scrollLeft - offsetX; - this.area.scrollTop = this.panningScrollOrigin.scrollTop - offsetY; - } - }; - - private stopPanning = () => { - if (this.isPanning) { - this.isPanning = false; - document.removeEventListener('mousemove', this.onPointerMove); - document.removeEventListener('mouseup', this.stopPanning); - } - }; - - private onWheel = (e: React.WheelEvent) => { - if (e.ctrlKey) { - e.preventDefault(); - const delta = Math.max(-1, Math.min(1, e.deltaY)); - const {offsetLeft, offsetTop} = this.area; - const pivot = this.clientToPaperCoords( - e.pageX - offsetLeft, - e.pageY - offsetTop); - this.zoomBy(-delta * 0.1, {pivot}); - } - }; - - centerTo(paperPosition?: { x: number; y: number; }) { - const ctm = this.paper.viewport.getCTM(); - let clientX: number; - let clientY: number; - - if (paperPosition) { - const scale = ctm.a; - clientX = paperPosition.x * scale; - clientY = paperPosition.y * scale; - } else { - const x1 = -ctm.e; - const y1 = -ctm.f; - const x2 = x1 + this.paper.options.width; - const y2 = y1 + this.paper.options.height; - clientX = (x1 + x2) / 2; - clientY = (y1 + y2) / 2; - } - - const {clientWidth, clientHeight} = this.area; - this.updatePaperMargins(); - this.area.scrollLeft = clientX - clientWidth / 2 + ctm.e + this.padding.x; - this.area.scrollTop = clientY - clientHeight / 2 + ctm.f + this.padding.y; - } - - centerContent() { - const {x, y, width, height} = this.paper.viewport.getBBox(); - const viewportCenter = { - x: x + width / 2, - y: y + height / 2, - }; - this.centerTo(viewportCenter); - } - - getScale() { - const ctm = this.paper.viewport.getCTM(); - // scale should be uniform (scaleX == scaleY) - // and no rotation present, so - // ctm.a == ctm.d and ctm.b == ctm.c == 0 - return ctm.a; - } - - setScale(value: number, options: ZoomOptions = {}) { - let scale = value; - - const {zoomOptions = {}} = this.props; - const {min, max} = zoomOptions; - if (min !== undefined) { scale = Math.max(scale, min); } - if (max !== undefined) { scale = Math.min(scale, max); } - - const center = this.clientToPaperCoords( - this.area.clientWidth / 2, this.area.clientHeight / 2); - let pivot: { x: number; y: number; }; - if (options.pivot) { - const {x, y} = options.pivot; - const previousScale = this.getScale(); - const scaledBy = scale / previousScale; - pivot = { - x: x - (x - center.x) / scaledBy, - y: y - (y - center.y) / scaledBy, - }; - } else { - pivot = center; - } - - this.paper.scale(scale, scale); - this.centerTo(pivot); - } - - zoomBy(value: number, options: ZoomOptions = {}) { - this.setScale(this.getScale() + value, options); - } - - zoomToFit() { - if (this.paper.options.model.get('cells').length === 0) { - this.centerTo(); - return; - } - - const {x: originX, y: originY} = this.paper.options.origin; - const fittingBBox = { - x: originX, - y: originY, - width: this.area.clientWidth, - height: this.area.clientHeight, - }; - const {zoomOptions = {}} = this.props; - this.paper.scaleContentToFit({ - fittingBBox, - padding: (this.props.zoomOptions || {}).fitPadding, - minScale: zoomOptions.min, - maxScale: zoomOptions.maxFit || zoomOptions.max, - }); - this.paper.setOrigin(originX, originY); - - this.adjustPaper(); - this.centerContent(); - } - - private onDragOver = (e: DragEvent) => { - // Necessary. Allows us to drop. - if (e.preventDefault) { e.preventDefault(); } - e.dataTransfer.dropEffect = 'move'; - return false; - }; - - private onDragDrop = (e: DragEvent) => { - if (this.props.onDragDrop) { - const {offsetLeft, offsetTop} = this.area; - const paperPosition = this.clientToPaperCoords( - e.pageX - offsetLeft, e.pageY - offsetTop); - this.props.onDragDrop(e, paperPosition); - } - }; - - private renderSpinner(props: SpinnerProps = {}) { - const paperRect = this.paper.svg.getBoundingClientRect(); - const x = props.statusText ? paperRect.width / 3 : paperRect.width / 2; - const position = {x, y: paperRect.height / 2}; - reactDOMRender(, this.spinnerElement); - } - - showIndicator(operation?: Promise) { - this.centerTo(); - this.renderSpinner(); - - if (operation) { - operation.then(() => { - unmountComponentAtNode(this.spinnerElement); - }).catch(error => { - console.error(error); - this.renderSpinner({statusText: 'Unknown error occured', errorOccured: true}); - }); - } - } - - private renderLoadingIndicator(elementCount: number | undefined, error?: any) { - const WARN_ELEMENT_COUNT = 70; - if (error) { - this.renderSpinner({statusText: error.statusText || error.message, errorOccured: true}); - } else if (elementCount > WARN_ELEMENT_COUNT) { - this.renderSpinner({statusText: - `The diagram contains more than ${WARN_ELEMENT_COUNT} ` + - `elements. Please wait until it is fully loaded.`}); - } else { - this.renderSpinner(); - } - }; -} diff --git a/DKBFrontEnd/vendor/src/ontodia/diagram/separatedElementView.ts b/DKBFrontEnd/vendor/src/ontodia/diagram/separatedElementView.ts deleted file mode 100644 index 907e684d5..000000000 --- a/DKBFrontEnd/vendor/src/ontodia/diagram/separatedElementView.ts +++ /dev/null @@ -1,44 +0,0 @@ -import * as joint from 'jointjs'; - -import { Element } from './elements'; -import { DiagramView } from './view'; - -const DEBUG_BOUNDS = false; - -export class SeparatedElementView extends joint.dia.ElementView { - model: Element; - - paper?: { diagramView?: DiagramView }; - private view: DiagramView; - - private rect: SVGRectElement; - - render() { - const result = super.render(); - if (!this.view && this.paper && this.paper.diagramView) { - this.setView(this.paper.diagramView); - } - - this.rect = (this.el as SVGElement).querySelector('.rootOfUI') as SVGRectElement; - this.rect.setAttribute('cursor', 'pointer'); - if (DEBUG_BOUNDS) { - this.rect.style.fill = 'green'; - this.rect.style.stroke = 'red'; - this.rect.style.strokeWidth = '3'; - } - - this.updateSize(); - return result; - } - - private setView(view: DiagramView) { - this.view = view; - this.listenTo(this.model, 'change:size', this.updateSize); - } - - private updateSize = () => { - const size = this.model.get('size') || {width: 0, height: 0}; - this.rect.setAttribute('width', size.width || 0); - this.rect.setAttribute('height', size.height || 0); - } -} diff --git a/DKBFrontEnd/vendor/src/ontodia/diagram/view.ts b/DKBFrontEnd/vendor/src/ontodia/diagram/view.ts deleted file mode 100644 index b2968579a..000000000 --- a/DKBFrontEnd/vendor/src/ontodia/diagram/view.ts +++ /dev/null @@ -1,535 +0,0 @@ -import { hcl } from 'd3-color'; -import * as Backbone from 'backbone'; -import * as joint from 'jointjs'; -import { merge, cloneDeep } from 'lodash'; -import { createElement } from 'react'; -import { render as reactDOMRender, unmountComponentAtNode } from 'react-dom'; - -import { - TypeStyleResolver, - LinkStyleResolver, - TemplateResolver, - CustomTypeStyle, - ElementTemplate, - LinkStyle, LinkMarkerStyle, -} from '../customization/props'; -import { DefaultTypeStyleBundle } from '../customization/defaultTypeStyles'; -import { DefaultLinkStyleBundle } from '../customization/defaultLinkStyles'; -import { DefaultTemplate } from '../customization/defaultTemplate'; -import { DefaultTemplateBundle } from '../customization/templates/defaultTemplates'; - -import { Halo } from '../viewUtils/halo'; -import { ConnectionsMenu } from '../viewUtils/connectionsMenu'; -import { - toSVG, ToSVGOptions, toDataURL, ToDataURLOptions, -} from '../viewUtils/toSvg'; - -import { Dictionary, ElementModel, LocalizedString } from '../data/model'; - -import { DiagramModel, chooseLocalizedText, uri2name } from './model'; -import { Element, FatClassModel, linkMarkerKey } from './elements'; - -import { LinkView } from './linkView'; -import { SeparatedElementView } from './separatedElementView'; -import { ElementLayer } from './elementLayer'; - -export interface DiagramViewOptions { - typeStyleResolvers?: TypeStyleResolver[]; - linkStyleResolvers?: LinkStyleResolver[]; - templatesResolvers?: TemplateResolver[]; - disableDefaultHalo?: boolean; -} - -export interface TypeStyle { - color: { h: number; c: number; l: number; }; - icon?: string; -} - -const DefaultToSVGOptions: ToSVGOptions = { - elementsToRemoveSelector: '.link-tools, .marker-vertices', - convertImagesToDataUris: true, -}; - -/** - * Properties: - * language: string - * - * Events: - * (private) dispose - fires on view dispose - */ -export class DiagramView extends Backbone.Model { - private typeStyleResolvers: TypeStyleResolver[]; - private linkStyleResolvers: LinkStyleResolver[]; - private templatesResolvers: TemplateResolver[]; - - paper: joint.dia.Paper; - halo: Halo; - connectionsMenu: ConnectionsMenu; - - readonly selection = new Backbone.Collection(); - - private colorSeed = 0x0BADBEEF; - - private linkMarkers: Dictionary<{ - start: SVGMarkerElement; - end: SVGMarkerElement; - }> = {}; - - constructor( - public readonly model: DiagramModel, - public readonly options: DiagramViewOptions = {} - ) { - super(); - this.setLanguage('en'); - this.paper = new joint.dia.Paper({ - model: this.model.graph, - gridSize: 1, - elementView: SeparatedElementView, - linkView: LinkView, - width: 1500, - height: 800, - async: true, - preventContextMenu: false, - guard: (evt, view) => { - // filter right mouse button clicks - if (evt.type === 'mousedown' && evt.button !== 0) { return true; } - return false; - }, - }); - (this.paper as any).diagramView = this; - - this.typeStyleResolvers = options.typeStyleResolvers - ? options.typeStyleResolvers : DefaultTypeStyleBundle; - - this.linkStyleResolvers = options.linkStyleResolvers - ? this.options.linkStyleResolvers : DefaultLinkStyleBundle; - - this.templatesResolvers = options.templatesResolvers - ? options.templatesResolvers : DefaultTemplateBundle; - - this.listenTo(this.paper, 'render:done', () => { - this.model.trigger('state:renderDone'); - }); - this.listenTo(model, 'state:dataLoaded', () => { - this.model.resetHistory(); - }); - } - - getLanguage(): string { return this.get('language'); } - setLanguage(value: string) { this.set('language', value); } - - cancelSelection() { this.selection.reset([]); } - - print() { - toSVG(this.paper, DefaultToSVGOptions).then(svg => { - const printWindow = window.open('', undefined, 'width=1280,height=720'); - printWindow.document.write(svg); - printWindow.print(); - }); - } - - exportSVG(): Promise { - return toSVG(this.paper, {...DefaultToSVGOptions, preserveDimensions: true}); - } - - exportPNG(options: ToDataURLOptions = {}): Promise { - return toDataURL(this.paper, { - ...options, - svgOptions: {...DefaultToSVGOptions, ...options.svgOptions}, - }); - } - - adjustPaper() { - this.paper.trigger('ontodia:adjustSize'); - } - - initializePaperComponents() { - this.configureElementLayer(); - if (!this.model.isViewOnly()) { - this.configureSelection(); - this.configureDefaultHalo(); - document.addEventListener('keyup', this.onKeyUp); - this.onDispose(() => document.removeEventListener('keyup', this.onKeyUp)); - } - } - - private configureElementLayer() { - const container = document.createElement('div'); - this.paper.el.appendChild(container); - reactDOMRender(createElement(ElementLayer, {paper: this.paper, view: this}), container); - this.onDispose(() => { - unmountComponentAtNode(container); - this.paper.el.removeChild(container); - }); - } - - private onKeyUp = (e: KeyboardEvent) => { - const DELETE_KEY_CODE = 46; - if (e.keyCode === DELETE_KEY_CODE && - document.activeElement.localName !== 'input' - ) { - this.removeSelectedElements(); - } - }; - - private removeSelectedElements() { - const elementsToRemove = this.selection.toArray(); - if (elementsToRemove.length === 0) { return; } - - this.cancelSelection(); - this.model.graph.trigger('batch:start'); - for (const element of elementsToRemove) { - element.remove(); - } - this.model.graph.trigger('batch:stop'); - }; - - private configureSelection() { - if (this.model.isViewOnly()) { return; } - - this.listenTo(this.paper, 'cell:pointerup', (cellView: joint.dia.CellView, evt: MouseEvent) => { - // We don't want a Halo for links. - if (cellView.model instanceof joint.dia.Link) { return; } - if (evt.ctrlKey || evt.shiftKey || evt.metaKey) { return; } - const element = cellView.model as Element; - this.selection.reset([element]); - element.focus(); - }); - - let pointerScreenCoords = {x: NaN, y: NaN}; - this.listenTo(this.paper, 'blank:pointerdown', (evt: MouseEvent) => { - pointerScreenCoords = {x: evt.screenX, y: evt.screenY}; - }); - - this.listenTo(this.paper, 'blank:pointerup', (evt: MouseEvent) => { - if (evt.screenX !== pointerScreenCoords.x || evt.screenY !== pointerScreenCoords.y) { return; } - this.selection.reset(); - this.hideNavigationMenu(); - if (document.activeElement) { - (document.activeElement as HTMLElement).blur(); - } - }); - } - - private configureDefaultHalo() { - if (this.options.disableDefaultHalo) { return; } - - const container = document.createElement('div'); - this.paper.el.appendChild(container); - - const renderDefaultHalo = (selectedElement?: Element) => { - let cellView: joint.dia.CellView = undefined; - if (selectedElement) { - cellView = this.paper.findViewByModel(selectedElement); - } - reactDOMRender(createElement(Halo, { - paper: this.paper, - diagramView: this, - cellView: cellView, - onDelete: () => this.removeSelectedElements(), - onExpand: () => { - cellView.model.set('isExpanded', !cellView.model.get('isExpanded')); - }, - navigationMenuOpened: Boolean(this.connectionsMenu), - onToggleNavigationMenu: () => { - if (this.connectionsMenu) { - this.hideNavigationMenu(); - } else { - this.showNavigationMenu(selectedElement); - } - renderDefaultHalo(selectedElement); - }, - onAddToFilter: () => selectedElement.addToFilter(), - }), container); - }; - - this.listenTo(this.selection, 'add remove reset', () => { - const selected = this.selection.length === 1 ? this.selection.first() : undefined; - if (this.connectionsMenu && selected !== this.connectionsMenu.cellView.model) { - this.hideNavigationMenu(); - } - renderDefaultHalo(selected); - }); - - renderDefaultHalo(); - this.onDispose(() => { - unmountComponentAtNode(container); - this.paper.el.removeChild(container); - }); - } - - showNavigationMenu(element: Element) { - const cellView = this.paper.findViewByModel(element); - this.connectionsMenu = new ConnectionsMenu({ - paper: this.paper, - view: this, - cellView, - onClose: () => { - this.connectionsMenu.remove(); - this.connectionsMenu = undefined; - }, - }); - } - - hideNavigationMenu() { - if (this.connectionsMenu) { - this.connectionsMenu.remove(); - this.connectionsMenu = undefined; - } - } - - onDragDrop(e: DragEvent, paperPosition: { x: number; y: number; }) { - e.preventDefault(); - let elementIds: string[]; - try { - elementIds = JSON.parse(e.dataTransfer.getData('application/x-ontodia-elements')); - } catch (ex) { - try { - elementIds = JSON.parse(e.dataTransfer.getData('text')); // IE fix - } catch (ex) { - const draggedUri = e.dataTransfer.getData('text/uri-list'); - // element dragged from the class tree has URI of the form: - // # - const uriFromTreePrefix = window.location.href.split('#')[0] + '#'; - const uri = draggedUri.indexOf(uriFromTreePrefix) === 0 - ? draggedUri.substring(uriFromTreePrefix.length) : draggedUri; - elementIds = [uri]; - } - } - if (!elementIds || elementIds.length === 0) { return; } - - this.model.initBatchCommand(); - - let elementsToSelect: Element[] = []; - - let totalXOffset = 0; - let {x, y} = paperPosition; - for (const elementId of elementIds) { - const center = elementIds.length === 1; - const element = this.createElementAt(elementId, {x: x + totalXOffset, y, center}); - totalXOffset += element.get('size').width + 20; - - elementsToSelect.push(element); - element.focus(); - } - - this.model.requestElementData(elementsToSelect); - this.model.requestLinksOfType(); - this.selection.reset(elementsToSelect); - - this.model.storeBatchCommand(); - } - - private createElementAt(elementId: string, position: { x: number; y: number; center?: boolean; }) { - const element = this.model.createElement(elementId); - - let {x, y} = position; - const size: { width: number; height: number; } = element.get('size'); - if (position.center) { - x -= size.width / 2; - y -= size.height / 2; - } - element.set('position', {x, y}); - - return element; - } - - public getLocalizedText(texts: LocalizedString[]): LocalizedString { - return chooseLocalizedText(texts, this.getLanguage()); - } - - public getElementTypeString(elementModel: ElementModel): string { - return elementModel.types.map((typeId: string) => { - const type = this.model.getClassesById(typeId); - return this.getElementTypeLabel(type).text; - }).sort().join(', '); - } - - public getElementTypeLabel(type: FatClassModel): LocalizedString { - const label = this.getLocalizedText(type.get('label').values); - return label ? label : { text: uri2name(type.id), lang: '' }; - } - - public getLinkLabel(linkTypeId: string): LocalizedString { - const type = this.model.getLinkType(linkTypeId); - const label = type ? this.getLocalizedText(type.get('label').values) : null; - return label ? label : { text: uri2name(linkTypeId), lang: '' }; - } - - public getTypeStyle(types: string[]): TypeStyle { - types.sort(); - - let customStyle: CustomTypeStyle; - for (const resolver of this.typeStyleResolvers) { - const result = resolver(types); - if (result) { - customStyle = result; - break; - } - } - - const icon = customStyle ? customStyle.icon : undefined; - let color: { h: number; c: number; l: number; }; - if (customStyle && customStyle.color) { - color = hcl(customStyle.color); - } else { - const hue = getHueFromClasses(types, this.colorSeed); - color = {h: hue, c: 40, l: 75}; - } - return {icon, color}; - } - - public registerElementStyleResolver(resolver: TypeStyleResolver): TypeStyleResolver { - this.typeStyleResolvers.unshift(resolver); - return resolver; - } - - public unregisterElementStyleResolver(resolver: TypeStyleResolver): TypeStyleResolver { - const index = this.typeStyleResolvers.indexOf(resolver); - if (index !== -1) { - return this.typeStyleResolvers.splice(index, 1)[0]; - } else { - return undefined; - } - } - - public getElementTemplate(types: string[]): ElementTemplate { - for (const resolver of this.templatesResolvers) { - const result = resolver(types); - if (result) { - return result; - } - } - return DefaultTemplate; - } - - public registerTemplateResolver(resolver: TemplateResolver): TemplateResolver { - this.templatesResolvers.unshift(resolver); - return resolver; - } - - public unregisterTemplateResolver(resolver: TemplateResolver): TemplateResolver { - const index = this.templatesResolvers.indexOf(resolver); - if (index !== -1) { - return this.templatesResolvers.splice(index, 1)[0]; - } else { - return undefined; - } - } - - getLinkStyle(linkTypeId: string): LinkStyle { - let style = getDefaultLinkStyle(); - for (const resolver of this.linkStyleResolvers) { - const result = resolver(linkTypeId); - if (result) { - merge(style, cloneDeep(result)); - break; - } - } - if (!this.linkMarkers[linkTypeId]) { - this.linkMarkers[linkTypeId] = { - start: this.createLinkMarker(linkTypeId, true, style.markerSource), - end: this.createLinkMarker(linkTypeId, false, style.markerTarget), - }; - } - return style; - } - - private createLinkMarker(linkTypeId: string, startMarker: boolean, style: LinkMarkerStyle) { - if (!style) { return undefined; } - - const SVG_NAMESPACE: 'http://www.w3.org/2000/svg' = 'http://www.w3.org/2000/svg'; - const defs = this.paper.svg.getElementsByTagNameNS(SVG_NAMESPACE, 'defs')[0]; - const marker = document.createElementNS(SVG_NAMESPACE, 'marker'); - const linkTypeIndex = this.model.getLinkType(linkTypeId).index; - marker.setAttribute('id', linkMarkerKey(linkTypeIndex, startMarker)); - marker.setAttribute('markerWidth', style.width.toString()); - marker.setAttribute('markerHeight', style.height.toString()); - marker.setAttribute('orient', 'auto'); - - let xOffset = startMarker ? 0 : (style.width - 1); - marker.setAttribute('refX', xOffset.toString()); - marker.setAttribute('refY', (style.height / 2).toString()); - marker.setAttribute('markerUnits', 'userSpaceOnUse'); - - const path = document.createElementNS(SVG_NAMESPACE, 'path'); - path.setAttribute('d', style.d); - if (style.fill !== undefined) { path.setAttribute('fill', style.fill); } - if (style.stroke !== undefined) { path.setAttribute('stroke', style.stroke); } - if (style.strokeWidth !== undefined) { path.setAttribute('stroke-width', style.strokeWidth); } - - marker.appendChild(path); - defs.appendChild(marker); - return marker; - } - - public registerLinkStyleResolver(resolver: LinkStyleResolver): LinkStyleResolver { - this.linkStyleResolvers.unshift(resolver); - return resolver; - } - - public unregisterLinkStyleResolver(resolver: LinkStyleResolver): LinkStyleResolver { - const index = this.linkStyleResolvers.indexOf(resolver); - if (index !== -1) { - return this.linkStyleResolvers.splice(index, 1)[0]; - } else { - return undefined; - } - } - - public getOptions(): DiagramViewOptions { - return this.options; - } - - private onDispose(handler: () => void) { - this.listenTo(this, 'dispose', handler); - } - - dispose() { - if (!this.paper) { return; } - this.trigger('dispose'); - this.stopListening(); - this.paper.remove(); - this.paper = undefined; - } -} - -function getHueFromClasses(classes: string[], seed?: number): number { - let hash = seed; - for (const name of classes) { - hash = hashFnv32a(name, hash); - } - const MAX_INT32 = 0x7fffffff; - return 360 * ((hash === undefined ? 0 : hash) / MAX_INT32); -} - -function getDefaultLinkStyle(): LinkStyle { - return { - markerTarget: {d: 'M0,0 L0,8 L9,4 z', width: 9, height: 8, fill: 'black'}, - }; -} - -/** - * Calculate a 32 bit FNV-1a hash - * Found here: https://gist.github.com/vaiorabbit/5657561 - * Ref.: http://isthe.com/chongo/tech/comp/fnv/ - * - * @param {string} str the input value - * @param {boolean} [asString=false] set to true to return the hash value as - * 8-digit hex string instead of an integer - * @param {integer} [seed] optionally pass the hash of the previous chunk - * @returns {integer | string} - */ -function hashFnv32a(str: string, seed = 0x811c9dc5): number { - /* tslint:disable:no-bitwise */ - let i: number, l: number, hval = seed & 0x7fffffff; - - for (i = 0, l = str.length; i < l; i++) { - hval ^= str.charCodeAt(i); - hval += (hval << 1) + (hval << 4) + (hval << 7) + (hval << 8) + (hval << 24); - } - return hval >>> 0; - /* tslint:enable:no-bitwise */ -} - -export default DiagramView; diff --git a/DKBFrontEnd/vendor/src/ontodia/tutorial/tutorial.ts b/DKBFrontEnd/vendor/src/ontodia/tutorial/tutorial.ts deleted file mode 100644 index d308eca31..000000000 --- a/DKBFrontEnd/vendor/src/ontodia/tutorial/tutorial.ts +++ /dev/null @@ -1,27 +0,0 @@ -import * as $ from 'jquery'; -import { introJs } from 'intro.js'; - -export interface TutorialProps { - 'data-position': string; - 'data-step': string; - 'data-intro-id': string; - 'data-intro': string; -} - -const helpAlreadySeenKey = 'helpPopupDisable'; - -export function showTutorial() { - introJs() - .setOption('showStepNumbers', false) - .onexit(() => { - localStorage.setItem(helpAlreadySeenKey, 'true'); - }).oncomplete(() => { - localStorage.setItem(helpAlreadySeenKey, 'true'); - }).start(); -} - -export function showTutorialIfNotSeen() { - if (!localStorage.getItem(helpAlreadySeenKey)) { - showTutorial(); - } -} diff --git a/DKBFrontEnd/vendor/src/ontodia/viewUtils/collectionView.ts b/DKBFrontEnd/vendor/src/ontodia/viewUtils/collectionView.ts deleted file mode 100644 index eb16c5011..000000000 --- a/DKBFrontEnd/vendor/src/ontodia/viewUtils/collectionView.ts +++ /dev/null @@ -1,74 +0,0 @@ -import * as Backbone from 'backbone'; -import * as _ from 'lodash'; -import * as $ from 'jquery'; - -export interface CollectionViewOptions extends Backbone.ViewOptions { - childView: any; /* typeof Backbone.View */ - childOptions: Backbone.ViewOptions; -} - -export class CollectionView extends Backbone.View { - private childView: any; /* typeof Backbone.View */ - private childOptions: Backbone.ViewOptions; - private childViews: Backbone.View[]; - private isRendered = false; - - constructor(options: CollectionViewOptions) { - super(options); - this.onAdd = this.onAdd.bind(this); - this.onRemove = this.onRemove.bind(this); - this.onReset = this.onReset.bind(this); - - if (!options.childView) { throw new Error('No child view constructor provided'); } - if (!options.childOptions) { throw new Error('No child view options provided'); } - - this.childView = options.childView; - this.childOptions = options.childOptions; - this.childViews = []; - - this.collection.each(this.onAdd); - this.collection.bind('add', this.onAdd); - this.collection.bind('remove', this.onRemove); - this.collection.bind('reset', this.onReset); - } - - private onAdd(model: TModel) { - const childView: Backbone.View = new this.childView( - _.extend({ model: model }, this.childOptions)); - - this.childViews.push(childView); - - if (this.isRendered) { - $(this.el).append(childView.render().el); - } - } - - private onRemove(model: TModel) { - const viewToRemove = _.filter(this.childViews, cv => cv.model === model)[0]; - if (viewToRemove) { - this.childViews = _.without(this.childViews, viewToRemove); - viewToRemove.remove(); - } - } - - private onReset() { - // 'reset' event on collection do not trigger - // 'add' and 'remove' events on models - removeAllViews(this.childViews); - this.collection.each(this.onAdd); - } - - public render(): CollectionView { - this.isRendered = true; - $(this.el).empty(); - _.each(this.childViews, cv => $(this.el).append(cv.render().el)); - return this; - } -} - -export default CollectionView; - -export function removeAllViews(views: Backbone.View[]) { - _.each(views, view => { view.remove(); }); - views.length = 0; -} diff --git a/DKBFrontEnd/vendor/src/ontodia/viewUtils/connectionsMenu.tsx b/DKBFrontEnd/vendor/src/ontodia/viewUtils/connectionsMenu.tsx deleted file mode 100644 index 379e33fbf..000000000 --- a/DKBFrontEnd/vendor/src/ontodia/viewUtils/connectionsMenu.tsx +++ /dev/null @@ -1,744 +0,0 @@ -import * as Backbone from 'backbone'; -import * as joint from 'jointjs'; -import * as React from 'react'; -import * as ReactDOM from 'react-dom'; - -import { FatLinkType, Element } from '../diagram/elements'; -import DiagramView from '../diagram/view'; -import { chooseLocalizedText } from '../diagram/model'; - -import { Dictionary, LocalizedString, ElementModel } from '../data/model'; - -type Label = { values: LocalizedString[] }; -export interface ReactElementModel { - model: ElementModel; - presentOnDiagram: boolean; -} - -const MENU_OFFSET = 40; -const ALL_RELATED_ELEMENTS_LINK: FatLinkType = new FatLinkType({ - id: 'allRelatedElements', - index: -1, - label: { values: [{lang: '', text: 'All'}] }, - diagram: null, -}); - -export interface ConnectionsMenuOptions { - paper: joint.dia.Paper; - view: DiagramView; - cellView: joint.dia.CellView; - onClose: () => void; -} - -export class ConnectionsMenu { - private container: HTMLElement; - private handler: Backbone.Model; - private view: DiagramView; - private state: 'loading' | 'error' | 'completed'; - - private links: FatLinkType[]; - private countMap: { [linkTypeId: string]: number }; - - private selectedLink: FatLinkType; - private objects: ReactElementModel[]; - - public cellView: joint.dia.CellView; - - constructor(private options: ConnectionsMenuOptions) { - this.container = document.createElement('div'); - this.options.paper.el.appendChild(this.container); - - this.cellView = this.options.cellView; - this.view = this.options.view; - - this.handler = new Backbone.Model(); - this.handler.listenTo(this.options.cellView.model, - 'change:isExpanded change:position change:size', this.render); - this.handler.listenTo(this.options.paper, 'scale', this.render); - this.handler.listenTo(this.view, 'change:language', this.render); - - this.loadLinks(); - this.render(); - } - - private subscribeOnLinksEevents(linksOfElement: FatLinkType[]) { - for (const link of linksOfElement) { - this.handler.listenTo(link, 'change:label', this.render); - this.handler.listenTo(link, 'change:visible', this.render); - this.handler.listenTo(link, 'change:showLabel', this.render); - }; - } - - private unsubscribeOnLinksEevents(linksOfElement: FatLinkType[]) { - for (const link of linksOfElement) { - this.handler.stopListening(link); - }; - } - - private loadLinks() { - this.state = 'loading'; - this.links = []; - this.countMap = {}; - this.view.model.dataProvider.linkTypesOf({elementId: this.cellView.model.id}) - .then(linkTypes => { - this.state = 'completed'; - - const countMap: Dictionary = {}; - const links: FatLinkType[] = []; - for (const linkCount of linkTypes) { - countMap[linkCount.id] = linkCount.count; - links.push(this.view.model.getLinkType(linkCount.id)); - } - - let totalCount = 0; - Object.keys(countMap).forEach(key => totalCount += countMap[key]); - countMap['allRelatedElements'] = totalCount; - - this.countMap = countMap; - - this.unsubscribeOnLinksEevents(this.links); - this.links = links; - this.subscribeOnLinksEevents(this.links); - - this.render(); - }) - .catch(err => { - console.error(err); - this.state = 'error'; - this.render(); - }); - } - - private loadObjects(link: FatLinkType) { - this.state = 'loading'; - this.selectedLink = link; - this.objects = []; - const requestsCount = Math.ceil(this.countMap[link.id] / 100); - - const requests: Promise>[] = []; - for (let i = 0; i < requestsCount; i++) { - requests.push( - this.view.model.dataProvider.linkElements({ - elementId: this.cellView.model.id, - linkId: (link === ALL_RELATED_ELEMENTS_LINK ? undefined : this.selectedLink.id), - limit: 100, - offset: i * 100 - }) - ); - } - - Promise.all(requests).then(results => { - this.state = 'completed'; - this.objects = []; - results.forEach(elements => { - Object.keys(elements).forEach(key => this.objects.push({ - model: elements[key], - presentOnDiagram: Boolean(this.view.model.getElement(key)), - })); - }); - this.render(); - }).catch(err => { - console.error(err); - this.state = 'error'; - this.render(); - }); - } - - private addSelectedElements = (selectedObjects: ReactElementModel[]) => { - const positionBoxSide = Math.round(Math.sqrt(selectedObjects.length)) + 1; - const GRID_STEP = 100; - let pos; - if (this.cellView.model instanceof joint.dia.Element) { - pos = this.cellView.model.position(); // the position() is more stable than getBBox - } else { - pos = this.cellView.getBBox(); - } - const startX = pos.x - positionBoxSide * GRID_STEP / 2; - const startY = pos.y - positionBoxSide * GRID_STEP / 2; - let xi = 0; - let yi = 0; - - const addedElements: Element[] = []; - selectedObjects.forEach(el => { - let element = this.view.model.getElement(el.model.id); - if (!element) { element = this.view.model.createElement(el.model); } - addedElements.push(element); - - if (xi > positionBoxSide) { - xi = 0; - yi++; - } - if (xi === Math.round(positionBoxSide / 2)) { - xi++; - } - if (yi === Math.round(positionBoxSide / 2)) { - yi++; - } - element.position(startX + (xi++) * GRID_STEP, startY + (yi) * GRID_STEP); - }); - - const hasChosenLinkType = this.selectedLink && this.selectedLink !== ALL_RELATED_ELEMENTS_LINK; - if (hasChosenLinkType && !this.selectedLink.visible) { - // prevent loading here because of .requestLinksOfType() call - this.selectedLink.setVisibility({visible: true, showLabel: true}, {preventLoading: true}); - } - - this.view.model.requestElementData(addedElements); - this.view.model.requestLinksOfType(); - - this.options.view.adjustPaper(); - this.options.onClose(); - }; - - private onExpandLink = (link: FatLinkType) => { - if (this.selectedLink !== link || !this.objects) { - this.loadObjects(link); - } - this.render(); - }; - - private onMoveToFilter = (link: FatLinkType) => { - if (link === ALL_RELATED_ELEMENTS_LINK) { - const element = this.cellView.model as Element; - element.addToFilter(); - // this.options.onClose(); - } else { - const selectedElement = this.view.model.getElement(this.cellView.model.id); - selectedElement.addToFilter(link); - // this.options.onClose(); - } - }; - - private render = () => { - const connectionsData = { - links: this.links || [], - countMap: this.countMap || {}, - }; - - let objectsData: { - selectedLink: FatLinkType; - objects: ReactElementModel[]; - } = null; - - if (this.selectedLink && this.objects) { - objectsData = { - selectedLink: this.selectedLink, - objects: this.objects, - }; - } - - ReactDOM.render(React.createElement(ConnectionsMenuMarkup, { - cellView: this.options.cellView, - connectionsData: connectionsData, - objectsData: objectsData, - state: this.state, - lang: this.view.getLanguage(), - onExpandLink: this.onExpandLink, - onPressAddSelected: this.addSelectedElements, - onMoveToFilter: this.onMoveToFilter, - }), this.container); - }; - - remove() { - this.handler.stopListening(); - ReactDOM.unmountComponentAtNode(this.container); - this.options.paper.el.removeChild(this.container); - } -} - -export interface ConnectionsMenuMarkupProps { - cellView: joint.dia.CellView; - - connectionsData: { - links: FatLinkType[]; - countMap: { [linkTypeId: string]: number }; - }; - - objectsData?: { - selectedLink?: FatLinkType; - objects: ReactElementModel[]; - }; - - lang: string; - state: 'loading' | 'error' | 'completed'; - - onExpandLink?: (link: FatLinkType) => void; - onPressAddSelected?: (selectedObjects: ReactElementModel[]) => void; - onMoveToFilter?: (link: FatLinkType) => void; -} - -export class ConnectionsMenuMarkup - extends React.Component { - - constructor (props: ConnectionsMenuMarkupProps) { - super(props); - this.state = { filterKey: '', panel: 'connections' }; - } - - private onChangeFilter = (e: React.FormEvent) => { - this.state.filterKey = e.currentTarget.value; - this.setState(this.state); - }; - - private getTitle = () => { - if (this.props.objectsData && this.state.panel === 'objects') { - return 'Objects'; - } else if (this.props.connectionsData && this.state.panel === 'connections') { - return 'Connections'; - } - return 'Error'; - }; - - private onExpandLink = (link: FatLinkType) => { - this.setState({ filterKey: '', panel: 'objects' }); - this.props.onExpandLink(link); - }; - - private onCollapseLink = () => { - this.setState({ filterKey: '', panel: 'connections' }); - }; - - private getBreadCrumbs = () => { - return (this.props.objectsData && this.state.panel === 'objects' ? - - Connections{'\u00A0' + '/' + '\u00A0'} - { - chooseLocalizedText( - this.props.objectsData.selectedLink.get('label').values, - this.props.lang - ).text.toLowerCase() - } - - : '' - ); - }; - - private getBody = () => { - if (this.props.state === 'error') { - return ; - } else if (this.props.objectsData && this.state.panel === 'objects') { - return ; - } else if (this.props.connectionsData && this.state.panel === 'connections') { - if (this.props.state === 'loading') { - return ; - } - return ; - } else { - return
    ; - } - }; - - render() { - const bBox = this.props.cellView.getBBox(); - const style = { - top: (bBox.y + bBox.height / 2 - 150), - left: (bBox.x + bBox.width + MENU_OFFSET), - backgroundColor: 'white', - border: '1px solid black', - }; - - return ( -
    - - {this.getBreadCrumbs()} -
    - -
    -
    -
    -
    -
    - {this.getBody()} -
    - ); - } -} - -export interface ConnectionsListProps { - data: { - links: FatLinkType[]; - countMap: { [linkTypeId: string]: number }; - }; - lang: string; - filterKey: string; - - onExpandLink?: (link: FatLinkType) => void; - onMoveToFilter?: (link: FatLinkType) => void; -} - -export class ConnectionsList extends React.Component { - - constructor (props: ConnectionsListProps) { - super(props); - } - - private compareLinks = (a: FatLinkType, b: FatLinkType) => { - const aLabel: Label = a.get('label'); - const bLabel: Label = b.get('label'); - const aText = (aLabel ? chooseLocalizedText(aLabel.values, this.props.lang).text.toLowerCase() : null); - const bText = (bLabel ? chooseLocalizedText(bLabel.values, this.props.lang).text.toLowerCase() : null); - - if (aText < bText) { - return -1; - } - - if (aText > bText) { - return 1; - } - - return 0; - }; - - private getLinks = () => { - return (this.props.data.links || []).filter(link => { - const label: Label = link.get('label'); - const text = (label ? chooseLocalizedText(label.values, this.props.lang).text.toLowerCase() : null); - return (!this.props.filterKey) || (text && text.indexOf(this.props.filterKey.toLowerCase()) !== -1); - }) - .sort(this.compareLinks); - }; - - private getViews = (links: FatLinkType[]) => { - const countMap = this.props.data.countMap || {}; - const views: React.ReactElement[] = []; - for (const link of links) { - views.push( - - ); - } - return views; - }; - - render() { - const links = this.getLinks(); - const views = this.getViews(links); - - let viewList: React.ReactElement | React.ReactElement[]; - if (views.length === 0) { - viewList = ; - } else { - viewList = views; - if (links.length > 1) { - const countMap = this.props.data.countMap || {}; - viewList = [ - , -
    , - ].concat(viewList); - } - } - - return
      {viewList}
    ; - } -} - -export interface LinkInPopupMenuProps { - link: FatLinkType; - count: number; - lang?: string; - filterKey?: string; - onExpandLink?: (link: FatLinkType) => void; - onMoveToFilter?: (link: FatLinkType) => void; -} - -export class LinkInPopupMenu extends React.Component { - constructor(props: LinkInPopupMenuProps) { - super(props); - } - - private onExpandLink = () => { - this.props.onExpandLink(this.props.link); - }; - - private onMoveToFilter = (evt: React.MouseEvent) => { - evt.stopPropagation(); - this.props.onMoveToFilter(this.props.link); - }; - - render() { - const countIcon = (this.props.count > 0 ? - {this.props.count} : ''); - - const fullText = chooseLocalizedText(this.props.link.get('label').values, this.props.lang).text; - const textLine = getColoredText(fullText, this.props.filterKey); - - return ( -
  • -
    - {textLine} -
    - {countIcon} - -
    -
  • - ); - } -} - -export interface ObjectsPanelProps { - data: { - selectedLink?: FatLinkType; - objects: ReactElementModel[] - }; - loading?: boolean; - lang?: string; - filterKey?: string; - onPressAddSelected?: (selectedObjects: ReactElementModel[]) => void; -} - -export class ObjectsPanel extends React.Component { - - constructor(props: ObjectsPanelProps) { - super(props); - this.state = { checkMap: {}, selectAll: 'checked' }; - this.updateCheckMap(); - } - - private updateCheckMap = () => { - this.props.data.objects.forEach(element => { - if (this.state.checkMap[element.model.id] === undefined) { - this.state.checkMap[element.model.id] = true; - } - }); - }; - - private onCheckboxChanged = (object: ReactElementModel, value: boolean) => { - if (this.state.checkMap[object.model.id] === value) { - return; - } - this.state.checkMap[object.model.id] = value; - - const filtered = this.getFilteredObjects().map(o => o.model.id); - const keys = Object.keys(this.state.checkMap).filter(key => filtered.indexOf(key) !== -1); - - const unchekedListElementLength = keys.filter(key => !this.state.checkMap[key]).length; - if (!value && unchekedListElementLength === keys.length) { - this.state.selectAll = 'unchecked'; - } else if (unchekedListElementLength === 0) { - this.state.selectAll = 'checked'; - } else { - this.state.selectAll = 'undefined'; - } - this.setState(this.state); - }; - - private onSelectAll = () => { - let checked = !this.selectAllValue(); - if (checked) { - this.state.selectAll = 'checked'; - } else { - this.state.selectAll = 'unchecked'; - } - const filtered = this.getFilteredObjects().filter(o => !o.presentOnDiagram).map(o => o.model.id); - const keys = Object.keys(this.state.checkMap).filter(key => filtered.indexOf(key) !== -1); - keys.forEach(key => { - this.state.checkMap[key] = checked; - }); - this.setState(this.state); - }; - - private selectAllValue = () => { - if (this.state.selectAll === 'undefined' || this.state.selectAll === 'checked') { - return true; - } else { - return false; - } - }; - - private getFilteredObjects = (): ReactElementModel[] => { - return this.props.data.objects - .filter(element => { - const label: Label = element.model.label; - const text = (label ? chooseLocalizedText(label.values, this.props.lang).text.toLowerCase() : null); - return (!this.props.filterKey) || (text && text.indexOf(this.props.filterKey.toLowerCase()) !== -1); - }); - }; - - private getObjects = (list: ReactElementModel[]) => { - const keyMap: Dictionary = {}; - return list.filter(obj => { - if (keyMap[obj.model.id]) { - return false; - } else { - keyMap[obj.model.id] = true; - return true; - } - }).map(obj => { - return ; - }); - }; - - private addSelected = () => { - this.props.onPressAddSelected( - this.getFilteredObjects().filter(el => this.state.checkMap[el.model.id] && !el.presentOnDiagram) - ); - }; - - render() { - this.updateCheckMap(); - const objects = this.getFilteredObjects(); - const objectViews = this.getObjects(objects); - const activeObjCount = objects.filter(el => this.state.checkMap[el.model.id] && !el.presentOnDiagram).length; - const countString = activeObjCount.toString() + '\u00A0of\u00A0' + this.props.data.objects.length; - return
    -
    - {/*nothing*/}} - disabled={this.props.data.objects.length === 0}/> - Select All -
    - {( - this.props.loading ? - - :
    - {objectViews} -
    - )} -
    - - -
    -
    ; - } -} - -export interface ElementInPopupMenuProps { - element: ReactElementModel; - onCheckboxChanged?: (object: ReactElementModel, value: boolean) => void; - lang?: string; - checked?: boolean; - filterKey?: string; -} - -export class ElementInPopupMenu extends React.Component { - constructor(props: ElementInPopupMenuProps) { - super(props); - this.state = { checked: this.props.checked }; - } - - private onCheckboxChange = () => { - if (this.props.element.presentOnDiagram) { - return; - } - this.state.checked = !this.state.checked; - this.setState(this.state); - this.props.onCheckboxChanged(this.props.element, this.state.checked); - }; - - componentWillReceiveProps(props: ElementInPopupMenuProps) { - this.setState({ checked: props.checked }); - } - - render() { - const fullText = chooseLocalizedText(this.props.element.model.label.values, this.props.lang).text; - const textLine = getColoredText(fullText, this.props.filterKey); - return ( -
  • - {/*nothing*/}} - className='element-in-popup-menu__checkbox' - disabled={this.props.element.presentOnDiagram}/> -
    - {textLine} -
    -
  • - ); - } -} - -function getColoredText(fullText: string, filterKey: string) { - if (filterKey) { - filterKey = filterKey.toLowerCase(); - const leftIndex = fullText.toLowerCase().indexOf(filterKey); - const rightIndex = leftIndex + filterKey.length; - let firstPart = ''; - let selectedPart = ''; - let lastPart = ''; - - if (leftIndex === 0) { - selectedPart = fullText.substring(0, rightIndex); - } else { - firstPart = fullText.substring(0, leftIndex); - selectedPart = fullText.substring(leftIndex, rightIndex); - } - if (rightIndex <= fullText.length) { - lastPart = fullText.substring(rightIndex, fullText.length); - } - return - {firstPart}{selectedPart}{lastPart} - ; - } else { - return {fullText}; - } -} diff --git a/DKBFrontEnd/vendor/src/ontodia/viewUtils/detectBrowser.ts b/DKBFrontEnd/vendor/src/ontodia/viewUtils/detectBrowser.ts deleted file mode 100644 index 860b935af..000000000 --- a/DKBFrontEnd/vendor/src/ontodia/viewUtils/detectBrowser.ts +++ /dev/null @@ -1,4 +0,0 @@ - -export function isIE11() { - return !((window as any).ActiveXObject) && 'ActiveXObject' in window; -} diff --git a/DKBFrontEnd/vendor/src/ontodia/viewUtils/halo.tsx b/DKBFrontEnd/vendor/src/ontodia/viewUtils/halo.tsx deleted file mode 100644 index a2b33348e..000000000 --- a/DKBFrontEnd/vendor/src/ontodia/viewUtils/halo.tsx +++ /dev/null @@ -1,85 +0,0 @@ -import * as Backbone from 'backbone'; -import * as joint from 'jointjs'; -import * as React from 'react'; - -import { DiagramView } from '../diagram/view'; - -export interface Props { - paper: joint.dia.Paper; - cellView: joint.dia.CellView; - diagramView: DiagramView; - onDelete?: () => void; - onExpand?: () => void; - navigationMenuOpened?: boolean; - onToggleNavigationMenu?: () => void; - onAddToFilter?: () => void; -} - -const CLASS_NAME = 'ontodia-halo'; - -export class Halo extends React.Component { - private handler = new Backbone.Model(); - - componentWillMount() { - this.handler.listenTo(this.props.paper, 'translate resize scale', () => this.forceUpdate()); - this.listenToCell(this.props.cellView); - } - - componentWillReceiveProps(nextProps: Props) { - if (nextProps.cellView !== this.props.cellView) { - if (this.props.cellView) { this.handler.stopListening(this.props.cellView.model); } - this.listenToCell(nextProps.cellView); - } - } - - listenToCell(cellView: joint.dia.CellView) { - if (cellView) { - this.handler.listenTo(cellView.model, - 'change:isExpanded change:position change:size', () => this.forceUpdate()); - } - } - - componentWillUnmount() { - this.props.diagramView.hideNavigationMenu(); - this.handler.stopListening(); - } - - render() { - if (!this.props.cellView) { - return
    ; - } - - const {cellView, navigationMenuOpened} = this.props; - const cellExpanded = cellView.model.get('isExpanded'); - - const bbox = this.props.cellView.getBBox(); - const style = { - top: bbox.y, - left: bbox.x, - height: bbox.height, - width: bbox.width, - }; - - return ( -
    -
    - -
    - -
    - -
    -
    - ); - } -} diff --git a/DKBFrontEnd/vendor/src/ontodia/viewUtils/layout.ts b/DKBFrontEnd/vendor/src/ontodia/viewUtils/layout.ts deleted file mode 100644 index f64984f3d..000000000 --- a/DKBFrontEnd/vendor/src/ontodia/viewUtils/layout.ts +++ /dev/null @@ -1,148 +0,0 @@ -import * as cola from 'webcola'; - -export interface LayoutNode { - id?: string; - x: number; - y: number; - width: number; - height: number; - bounds?: any; - innerBounds?: any; -} - -export interface LayoutLink { - source: LayoutNode; - target: LayoutNode; -} - -export function forceLayout(params: { - nodes: LayoutNode[]; - links: LayoutLink[]; - preferredLinkLength: number; -}) { - const layout = new cola.Layout() - .nodes(params.nodes) - .links(params.links) - .convergenceThreshold(1e-9) - .jaccardLinkLengths(params.preferredLinkLength) - .handleDisconnected(true); - layout.start(30, 0, 10, undefined, false); -} - -export function removeOverlaps(nodes: LayoutNode[]) { - const nodeRectangles: cola.vpsc.Rectangle[] = []; - for (const node of nodes) { - nodeRectangles.push(new cola.vpsc.Rectangle( - node.x, node.x + node.width, - node.y, node.y + node.height)); - } - - cola.vpsc.removeOverlaps(nodeRectangles); - - for (let i = 0; i < nodeRectangles.length; i++) { - const node = nodes[i]; - const rectangle = nodeRectangles[i]; - node.x = rectangle.x; - node.y = rectangle.y; - } -} - -export function translateToPositiveQuadrant(params: { - nodes: LayoutNode[]; - padding?: { x: number; y: number; }; -}) { - let minX = Infinity, minY = Infinity; - for (const node of params.nodes) { - minX = Math.min(minX, node.x); - minY = Math.min(minY, node.y); - } - - const {padding = {x: 0, y: 0}} = params; - for (const node of params.nodes) { - node.x = node.x - minX + padding.x; - node.y = node.y - minY + padding.y; - } -} - -export function translateToCenter(params: { - nodes: LayoutNode[]; - paperSize: { width: number; height: number; }; - contentBBox: { x: number, y: number, width: number; height: number; }; -}) { - const {paperSize, contentBBox} = params; - const graphPos = { - x: (paperSize.width - contentBBox.width) / 2 - contentBBox.x, - y: (paperSize.height - contentBBox.height) / 2 - contentBBox.y, - }; - - for (const node of params.nodes) { - node.x = graphPos.x + node.x; - node.y = graphPos.y + node.y; - } -} - -export function uniformGrid(params: { - rows: number; - cellSize: { x: number; y: number; }; -}): (cellIndex: number) => LayoutNode { - return cellIndex => { - const row = Math.floor(cellIndex / params.rows); - const column = cellIndex - row * params.rows; - return { - x: column * params.cellSize.x, - y: row * params.cellSize.y, - width: params.cellSize.x, - height: params.cellSize.y, - }; - }; -} - -export function padded( - nodes: LayoutNode[], - padding: { x: number; y: number; } | undefined, - transform: () => void, -) { - if (padding) { - for (const node of nodes) { - node.x -= padding.x; - node.y -= padding.y; - node.width += 2 * padding.x; - node.height += 2 * padding.y; - } - } - - transform(); - - if (padding) { - for (const node of nodes) { - node.x += padding.x; - node.y += padding.y; - node.width -= 2 * padding.x; - node.height -= 2 * padding.y; - } - } -} - -export function flowLayout(params: { - nodes: LayoutNode[]; - links: Link[]; - preferredLinkLength: number; - route: (link: Link, path: any[]) => void -}) { - const layout = new cola.Layout() - .nodes(params.nodes) - .links(params.links) - .avoidOverlaps(true) - .flowLayout('x', params.preferredLinkLength) - .jaccardLinkLengths(params.preferredLinkLength); - layout.start(30, 0, 10, undefined, false); - - for (const node of params.nodes) { - node.innerBounds = node.bounds.inflate(-50); - } - - layout.prepareEdgeRouting(50 / 3); - for (const link of params.links) { - params.route(link, layout.routeEdge(link, undefined)); - } -} diff --git a/DKBFrontEnd/vendor/src/ontodia/viewUtils/spinner.tsx b/DKBFrontEnd/vendor/src/ontodia/viewUtils/spinner.tsx deleted file mode 100644 index fd470047d..000000000 --- a/DKBFrontEnd/vendor/src/ontodia/viewUtils/spinner.tsx +++ /dev/null @@ -1,31 +0,0 @@ -import * as React from 'react'; - -export interface Props { - size?: number; - position?: { x: number; y: number; }; - maxWidth?: number; - statusText?: string; - errorOccured?: boolean; -} - -const CLASS_NAME = 'ontodia-spinner'; - -export class Spinner extends React.Component { - render() { - let {position = {x: 0, y: 0}, size = 50, statusText, errorOccured} = this.props; - - const textLeftMargin = 5; - const pathGeometry = 'm3.47,-19.7 a20,20 0 1,1 -6.95,0 m0,0 l-6,5 m6,-5 l-8,-0' + - (errorOccured ? 'M-8,-8L8,8M-8,8L8,-8' : ''); - - return - - - - {statusText} - ; - } -} diff --git a/DKBFrontEnd/vendor/src/ontodia/viewUtils/toSvg.ts b/DKBFrontEnd/vendor/src/ontodia/viewUtils/toSvg.ts deleted file mode 100644 index e2088a903..000000000 --- a/DKBFrontEnd/vendor/src/ontodia/viewUtils/toSvg.ts +++ /dev/null @@ -1,346 +0,0 @@ -import * as _ from 'lodash'; -import * as joint from 'jointjs'; - -import { isIE11 } from './detectBrowser'; - -export interface ToSVGOptions { - preserveDimensions?: boolean; - convertImagesToDataUris?: boolean; - blacklistedCssAttributes?: string[]; - elementsToRemoveSelector?: string; -} - -type Bounds = { width: number; height: number; }; - -/** - * Padding (in px) for elements of exported SVG to - * mitigate issues with elements body overflow caused by missing styles - * in exported image. - */ -const ForeignObjectSizePadding = 2; - -export function toSVG(paper: joint.dia.Paper, opt: ToSVGOptions = {}): Promise { - if (isIE11()) { - return Promise.reject(new Error( - 'Export to SVG is not supported in the Internet Explorer')); - } - - const viewportTransform = paper.viewport.getAttribute('transform'); - paper.viewport.setAttribute('transform', ''); - - const bbox = paper.getContentBBox(); - const {svgClone, imageBounds} = clonePaperSvg(paper, ForeignObjectSizePadding); - - paper.viewport.setAttribute('transform', viewportTransform || ''); - - svgClone.removeAttribute('style'); - if (opt.preserveDimensions) { - svgClone.setAttribute('width', bbox.width.toString()); - svgClone.setAttribute('height', bbox.height.toString()); - } else { - svgClone.setAttribute('width', '100%'); - svgClone.setAttribute('height', '100%'); - } - svgClone.setAttribute('viewBox', `${bbox.x} ${bbox.y} ${bbox.width} ${bbox.height}`); - - const nodes = svgClone.querySelectorAll('img'); - const convertImagesStartingAt = (index: number, done: () => void) => { - if (index >= nodes.length) { - done(); - return; - } - const img = nodes[index]; - const {width, height} = imageBounds[nodeRelativePath(svgClone, img)]; - img.setAttribute('width', width.toString()); - img.setAttribute('height', height.toString()); - if (opt.convertImagesToDataUris) { - joint.util.imageToDataUri(img.src, (err, dataUri) => { - // check for empty svg data URI which happens when mockJointXHR catches an exception - if (dataUri && dataUri !== 'data:image/svg+xml,') { img.src = dataUri; } - convertImagesStartingAt(index + 1, done); - }); - } else { - convertImagesStartingAt(index + 1, done); - } - }; - - return new Promise(resolve => { - const mock = mockJointXHR(); - convertImagesStartingAt(0, () => { - mock.dispose(); - resolve(); - }); - }).then(() => { - // workaround to include only ontodia-related stylesheets - const cssTexts = extractCSSFromDocument(text => text.indexOf('.ontodia') >= 0); - - const defs = document.createElementNS('http://www.w3.org/2000/svg', 'defs'); - defs.innerHTML = ``; - svgClone.insertBefore(defs, svgClone.firstChild); - - if (opt.elementsToRemoveSelector) { - foreachNode(svgClone.querySelectorAll(opt.elementsToRemoveSelector), - node => node.remove()); - } - - return new XMLSerializer().serializeToString(svgClone); - }); -} - -function extractCSSFromDocument(shouldInclude: (cssText: string) => boolean): string[] { - const cssTexts: string[] = []; - for (let i = 0; i < document.styleSheets.length; i++) { - let rules: CSSRuleList; - try { - const cssSheet = document.styleSheets[i] as CSSStyleSheet; - rules = cssSheet.cssRules || cssSheet.rules; - if (!rules) { continue; } - } catch (e) { continue; } - - const ruleTexts: string[] = []; - let allowToInclude = false; - - for (let j = 0; j < rules.length; j++) { - const rule = rules[j]; - if (rule instanceof CSSStyleRule) { - const text = rule.cssText; - ruleTexts.push(rule.cssText); - if (shouldInclude(text)) { - allowToInclude = true; - } - } - } - - if (allowToInclude) { - cssTexts.push(ruleTexts.join('\n')); - } - } - return cssTexts; -} - -function clonePaperSvg(paper: joint.dia.Paper, elementSizePadding: number): { - svgClone: SVGElement; - imageBounds: { [path: string]: Bounds }; -} { - const svgClone = paper.svg.cloneNode(true) as SVGElement; - const imageBounds: { [path: string]: Bounds } = {}; - - const cells: Backbone.Collection = paper.model.get('cells'); - foreachNode(svgClone.querySelectorAll('g.element'), separatedView => { - const modelId = separatedView.getAttribute('model-id'); - const overlayedView = (paper.el as HTMLElement).querySelector( - `.ontodia-overlayed-element[model-id='${modelId}']`); - if (!overlayedView) { return; } - - const newRoot = document.createElementNS('http://www.w3.org/2000/svg', 'foreignObject'); - const model = cells.get(modelId); - const modelSize = model.get('size'); - newRoot.setAttribute('width', modelSize.width + elementSizePadding); - newRoot.setAttribute('height', modelSize.height + elementSizePadding); - const overlayedViewContent = overlayedView.firstChild as HTMLElement; - newRoot.appendChild(overlayedViewContent.cloneNode(true)); - - separatedView.setAttribute('class', - `${separatedView.getAttribute('class')} ontodia-exported-element`); - const oldRoot = separatedView.querySelector('.rootOfUI'); - const rootParent = oldRoot.parentElement; - rootParent.removeChild(oldRoot); - rootParent.appendChild(newRoot); - - foreachNode(overlayedViewContent.querySelectorAll('img'), img => { - const rootPath = nodeRelativePath(svgClone, rootParent); - const imgPath = nodeRelativePath(overlayedViewContent, img); - // combine path "from SVG to root" and "from root to image" - // with additional separator to consider newly added nodes - imageBounds[rootPath + ':0:0:' + imgPath] = { - width: img.clientWidth, - height: img.clientHeight, - }; - }); - }); - - return {svgClone, imageBounds}; -} - -/** - * Mock XMLHttpRequest for joint.util.imageToDataUri as workaround to uncatchable - * DOMException in synchronous xhr.send() call when Joint trying to load SVG image. - * - * @param onSyncSendError callback called on error - */ -function mockJointXHR(onSyncSendError?: (e: any) => void): { dispose: () => void } { - try { - const oldXHR = XMLHttpRequest; - XMLHttpRequest = class { - xhr = new oldXHR(); - responseText = ''; - open(...args: any[]) { this.xhr.open.apply(this.xhr, args); } - send(...args: any[]) { - try { - this.xhr.send.apply(this.xhr, args); - } catch (e) { - if (onSyncSendError) { onSyncSendError(e); } - } - } - } as any; - let disposed = false; - const dispose = () => { - if (disposed) { return; } - disposed = true; - XMLHttpRequest = oldXHR; - }; - return {dispose}; - } catch (e) { - // do nothing if failed to mock XHR - return {dispose: () => { /* nothing */ }}; - } -} - -function foreachNode(nodeList: NodeListOf, callback: (node: T) => void) { - for (let i = 0; i < nodeList.length; i++) { - callback(nodeList[i]); - } -} - -/** - * Returns colon-separeted path from `parent` to `child` where each part - * corresponds to child index at each tree level. - * - * @example - *
    - * - *
      - *
    • - *
    • - *
    - *
    - * - * nodeRelativePath(root, target) === '1:0' - */ -function nodeRelativePath(parent: Node, child: Node) { - const path: number[] = []; - let current = child; - while (current && current !== parent) { - let sibling = current; - let indexAtLevel = 0; - while (sibling = sibling.previousSibling) { - indexAtLevel++; - } - path.unshift(indexAtLevel); - current = current.parentNode; - } - return path.join(':'); -} - -export interface ToDataURLOptions { - /** 'image/png' | 'image/jpeg' | ... */ - type?: string; - width?: number; - height?: number; - padding?: number; - backgroundColor?: string; - quality?: number; - svgOptions?: ToSVGOptions; -} - -export function toDataURL(paper: joint.dia.Paper, options?: ToDataURLOptions): Promise { - return new Promise((resolve, reject) => { - options = options || {}; - options.type = options.type || 'image/png'; - - let imageRect: Bounds; - let contentHeight: number; - let contentWidth: number; - let padding = options.padding || 0; - - const clientRect = paper.viewport.getBoundingClientRect(); - imageRect = fitRectKeepingAspectRatio( - clientRect.width || 1, clientRect.height || 1, - options.width, options.height); - - padding = Math.min(padding, imageRect.width / 2 - 1, imageRect.height / 2 - 1); - contentWidth = imageRect.width - 2 * padding; - contentHeight = imageRect.height - 2 * padding; - - const img = new Image(); - img.onload = function () { - let dataURL: string; - let context: CanvasRenderingContext2D; - let canvas: HTMLCanvasElement; - - function createCanvas() { - canvas = document.createElement('canvas'); - canvas.width = imageRect.width; - canvas.height = imageRect.height; - context = canvas.getContext('2d'); - context.fillStyle = options.backgroundColor || 'white'; - context.fillRect(0, 0, imageRect.width, imageRect.height); - } - - createCanvas(); - try { - context.drawImage(img, padding, padding, contentWidth, contentHeight); - dataURL = canvas.toDataURL(options.type, options.quality); - resolve(dataURL); - } catch (e) { - reject(e); - return; - } - }; - const svgOptions = _.clone(options.svgOptions || {convertImagesToDataUris: true}); - svgOptions.convertImagesToDataUris = true; - toSVG(paper, svgOptions).then(svgString => { - svgString = svgString - .replace('width="100%"', 'width="' + contentWidth + '"') - .replace('height="100%"', 'height="' + contentHeight + '"'); - img.src = 'data:image/svg+xml,' + encodeURIComponent(svgString); - }); - }); -} - -export function fitRectKeepingAspectRatio( - sourceWidth: number, sourceHeight: number, - targetWidth: number, targetHeight: number, -): { width: number; height: number; } { - if (!targetWidth && !targetHeight) { - return {width: sourceWidth, height: sourceHeight}; - } - const sourceAspectRatio = sourceWidth / sourceHeight; - targetWidth = targetWidth || targetHeight * sourceAspectRatio; - targetHeight = targetHeight || targetWidth / sourceAspectRatio; - if (targetHeight * sourceAspectRatio <= targetWidth) { - return {width: targetHeight * sourceAspectRatio, height: targetHeight}; - } else { - return {width: targetWidth, height: targetWidth / sourceAspectRatio}; - } -} - -/** - * Creates and returns a blob from a data URL (either base64 encoded or not). - * - * @param {string} dataURL The data URL to convert. - * @return {Blob} A blob representing the array buffer data. - */ -export function dataURLToBlob(dataURL: string): Blob { - const BASE64_MARKER = ';base64,'; - if (dataURL.indexOf(BASE64_MARKER) === -1) { - const parts = dataURL.split(','); - const contentType = parts[0].split(':')[1]; - const raw = decodeURIComponent(parts[1]); - - return new Blob([raw], {type: contentType}); - } - - const parts = dataURL.split(BASE64_MARKER); - const contentType = parts[0].split(':')[1]; - const raw = window.atob(parts[1]); - const rawLength = raw.length; - - const uInt8Array = new Uint8Array(rawLength); - - for (let i = 0; i < rawLength; ++i) { - uInt8Array[i] = raw.charCodeAt(i); - } - - return new Blob([uInt8Array], {type: contentType}); -} diff --git a/DKBFrontEnd/vendor/src/ontodia/widgets/classTree.ts b/DKBFrontEnd/vendor/src/ontodia/widgets/classTree.ts deleted file mode 100644 index 4da397e1d..000000000 --- a/DKBFrontEnd/vendor/src/ontodia/widgets/classTree.ts +++ /dev/null @@ -1,152 +0,0 @@ -import * as Backbone from 'backbone'; -import * as _ from 'lodash'; -import * as $ from 'jquery'; - -import { Dictionary } from '../data/model'; - -import { ClassTreeElement } from '../diagram/model'; -import DiagramView from '../diagram/view'; - -// bundling jstree to solve issues with multiple jquery packages, -// when jstree sets itself as plugin to wrong version of jquery -const jstreeJQuery = require('exports?require("jquery")!jstree'); -require('jstree/dist/themes/default/style.css'); - -interface TreeClassModel extends ClassTreeElement { - text?: string; - type?: string; -} - -export interface ClassTreeOptions extends Backbone.ViewOptions { - view: DiagramView; -} - -const CLASS_NAME = 'ontodia-class-tree'; - -/** - * Events: - * action:classSelected(classId: string) - */ -export class ClassTree extends Backbone.View { - private filter: JQuery = null; - private tree: JQuery = null; - private rest: JQuery = null; - private view: DiagramView; - - constructor(options: ClassTreeOptions) { - super(_.extend({className: CLASS_NAME}, options)); - let selfLink = this; - this.$el.addClass(_.result(this, 'className') as string); - this.view = options.view; - this.model.set('language', this.view.getLanguage(), {silent: true}); - this.listenTo(this.view, 'change:language', this.onLanguageChanged); - - this.rest = $(`
    `); - this.tree = $(`
    `).appendTo(this.rest); - - // Input for search in classTree - this.filter = $(`
    `); - - let innerDiv = $(`
    `).appendTo(this.filter); - let searchInput = - $('') - .appendTo(innerDiv); - - this.listenTo(this.view.model, 'state:dataLoaded', () => { - let model = this.view.model; - let tree = model.classTree; - const iconMap = this.updateClassLabels(tree); - this.setUrls(tree); - this.getJSTree().jstree({ - 'plugins': ['types', 'sort', 'search'], - 'core': {'data': tree}, - 'types': iconMap, - 'sort': (firstClassId: string, secondClassId: string) => { - return (model.getClassesById(firstClassId).model as TreeClassModel).text.localeCompare( - (model.getClassesById(secondClassId).model as TreeClassModel).text); - }, - 'search': { - 'case_insensitive': true, - 'show_only_matches': true, - }, - }); - - this.getJSTree().on('select_node.jstree', (e, data) => { - this.trigger('action:classSelected', data.selected[0]); - }); - - searchInput.keyup(function (this: HTMLInputElement) { - let searchString = $(this).val(); - selfLink.getJSTree().jstree('search', searchString); - }); - }); - } - - private updateClassLabels(roots: ClassTreeElement[]): Dictionary<{icon: string}> { - const iconMap: Dictionary<{ icon: string }> = { - 'default': {icon: 'default-tree-icon'}, - 'has-not-children': {icon: 'default-tree-icon'}, - 'has-children': {icon: 'parent-tree-icon'}, - }; - - if (roots) { - for (let i = 0; i < roots.length; i++) { - let element = roots[i] as TreeClassModel; - const icon = this.view.getTypeStyle([element.id]).icon; - let iconId: string; - if (icon) { - iconId = _.uniqueId('iconId'); - iconMap[iconId] = {icon: icon + ' ontodia-tree-icon'}; - } - - if ('children' in element) { - const innerMap = this.updateClassLabels(element.children); - Object.keys(innerMap).forEach(key => { - iconMap[key] = innerMap[key]; - }); - - if (element.children.length !== 0) { - element.type = (iconId ? iconId : 'has-children'); - } else { - element.type = (iconId ? iconId : 'has-not-children'); - } - } else { - element.type = (iconId ? iconId : 'has-not-children'); - } - - element.text = this.view.getLocalizedText(element.label.values).text + (!isNaN(element.count) ? ' (' + element.count + ')' : ''); - } - } - - return iconMap; - } - - private getJSTree() { - return jstreeJQuery(this.tree.get(0)); - } - - private onLanguageChanged() { - // this.updateClassLabels(this.view.model.classTree); - let jsTree = this.getJSTree().jstree(true); - (jsTree as any).settings.core.data = this.view.model.classTree; - jsTree.refresh(/* do not show loading indicator */ true, undefined); - } - - private setUrls(tree: ClassTreeElement[]) { - tree.forEach(el => { - this.setUrlsRec(el); - }); - } - private setUrlsRec(root: ClassTreeElement) { - root.a_attr = { href: '#' + root.id, draggable: true }; - root.children.forEach(el => this.setUrlsRec(el)); - } - - render(): ClassTree { - this.filter.appendTo(this.$el); - this.rest.appendTo(this.$el); - return this; - } -} - -export default ClassTree; diff --git a/DKBFrontEnd/vendor/src/ontodia/widgets/instancesSearch.tsx b/DKBFrontEnd/vendor/src/ontodia/widgets/instancesSearch.tsx deleted file mode 100644 index 9926453cf..000000000 --- a/DKBFrontEnd/vendor/src/ontodia/widgets/instancesSearch.tsx +++ /dev/null @@ -1,297 +0,0 @@ -import * as React from 'react'; -import * as Backbone from 'backbone'; - -import { Dictionary, ElementModel, LocalizedString } from '../data/model'; -import { FilterParams } from '../data/provider'; - -import { uri2name } from '../diagram/model'; -import { DiagramView } from '../diagram/view'; - -import { ListElementView } from './listElementView'; - -export interface InstancesSearchProps { - className?: string; - view: DiagramView; - criteria: SearchCriteria; - onCriteriaChanged: (criteria: SearchCriteria) => void; -} - -export interface SearchCriteria { - readonly text?: string; - readonly elementTypeId?: string; - readonly refElementId?: string; - readonly refElementLinkId?: string; -} - -export interface State { - readonly inputText?: string; - readonly quering?: boolean; - readonly resultId?: number; - readonly error?: any; - readonly items?: ReadonlyArray; - readonly moreItemsAvailable?: boolean; - readonly selectedItems?: Readonly>; -} - -const CLASS_NAME = 'ontodia-instances-search'; - -export class InstancesSearch extends React.Component { - private readonly listener = new Backbone.Model(); - - private currentRequest: FilterParams; - - constructor(props: InstancesSearchProps) { - super(props); - this.state = { - selectedItems: {}, - resultId: 0, - }; - } - - render() { - const ENTER_KEY_CODE = 13; - - const className = `${CLASS_NAME} stateBasedProgress ${this.props.className || ''}`; - const progressState = - this.state.quering ? 'querying' : - this.state.error ? 'error' : - this.state.items ? 'finished' : undefined; - - const searchTerm = this.state.inputText === undefined - ? this.props.criteria.text : this.state.inputText; - - return
    -
    -
    -
    -
    -
    - {this.renderCriteria()} -
    - this.setState({inputText: e.currentTarget.value})} - onKeyUp={e => { - if (e.keyCode === ENTER_KEY_CODE) { - this.submitCriteriaUpdate(); - } - }} /> - - - -
    -
    - {/* specify resultId as key to reset scroll position when loaded new search results */} -
    - {this.renderSearchResults()} -
    - -
    -
    -
    ; - } - - private renderCriteria(): React.ReactElement { - const {criteria = {}, view} = this.props; - const criterions: React.ReactElement[] = []; - - if (criteria.elementTypeId) { - const classInfo = view.model.getClassesById(criteria.elementTypeId); - const classLabel = view.getLocalizedText(classInfo.label.values).text; - criterions.push(
    - {this.renderRemoveCriterionButtons(() => this.props.onCriteriaChanged( - {...this.props.criteria, elementTypeId: undefined}))} - Has type {classLabel} -
    ); - } else if (criteria.refElementId) { - const element = view.model.getElement(criteria.refElementId); - const template = element && element.template; - const elementLabel = formatLabel( - view, criteria.refElementId, template && template.label); - - const linkType = criteria.refElementLinkId && view.model.getLinkType(criteria.refElementLinkId); - const linkTypeLabel = linkType && formatLabel(view, linkType.id, linkType.label); - - criterions.push(
    - {this.renderRemoveCriterionButtons(() => this.props.onCriteriaChanged( - {...this.props.criteria, refElementId: undefined, refElementLinkId: undefined}))} - Connected to {elementLabel} - {criteria.refElementLinkId ? [ - ' through ', - {linkTypeLabel}, - ] : []} -
    ); - } - - return
    {criterions}
    ; - } - - private renderRemoveCriterionButtons(onClick: () => void) { - return
    - -
    ; - } - - private renderSearchResults(): React.ReactElement { - const items = this.state.items || []; - return
      - {items.map((model, index) => this.setState({ - selectedItems: { - ...this.state.selectedItems, - [model.id]: !this.state.selectedItems[model.id], - }, - })} - onDragStart={e => { - const elementIds = Object.keys({...this.state.selectedItems, [model.id]: true}); - try { - e.dataTransfer.setData('application/x-ontodia-elements', JSON.stringify(elementIds)); - } catch (ex) { // IE fix - e.dataTransfer.setData('text', JSON.stringify(elementIds)); - } - return false; - }} />, - )} -
    ; - } - - private submitCriteriaUpdate() { - let text = this.state.inputText === undefined ? this.props.criteria.text : this.state.inputText; - text = text === '' ? undefined : text; - this.props.onCriteriaChanged({...this.props.criteria, text}); - } - - componentDidMount() { - this.listener.listenTo(this.props.view, 'change:language', () => this.forceUpdate()); - this.listener.listenTo(this.props.view.model.cells, 'add remove reset', () => { - const selectedItems: Dictionary = {...this.state.selectedItems}; - for (const id of Object.keys(selectedItems)) { - if (selectedItems[id] && this.props.view.model.getElement(id)) { - delete selectedItems[id]; - } - } - this.setState({selectedItems}); - }); - this.queryItems(false); - } - - componentWillReceiveProps(nextProps: InstancesSearchProps) { - const languageChanged = this.currentRequest - ? this.currentRequest.languageCode !== nextProps.view.getLanguage() : false; - - if (this.props.criteria !== nextProps.criteria || languageChanged) { - this.setState({inputText: undefined}, () => this.queryItems(false)); - } - } - - componentWillUnmount() { - this.listener.stopListening(); - this.currentRequest = undefined; - } - - private queryItems(loadMoreItems: boolean) { - let request: FilterParams; - if (loadMoreItems) { - if (!this.currentRequest) { - throw new Error('Cannot request more items without initial request.'); - } - const {offset, limit} = this.currentRequest; - request = {...this.currentRequest, offset: offset + limit}; - } else { - request = createRequest(this.props.criteria, this.props.view.getLanguage()); - } - - if (!(request.text || request.elementTypeId || request.refElementId || request.refElementLinkId)) { - this.setState({ - quering: false, - error: undefined, - items: undefined, - moreItemsAvailable: false, - selectedItems: {}, - }); - return; - } - - this.currentRequest = request; - this.setState({ - quering: true, - error: undefined, - moreItemsAvailable: false, - }); - - this.props.view.model.dataProvider.filter(request).then(elements => { - if (this.currentRequest !== request) { return; } - this.processFilterData(elements); - }).catch(error => { - if (this.currentRequest !== request) { return; } - console.error(error); - this.setState({error}); - }); - } - - private processFilterData(elements: Dictionary) { - const selectedItems: Dictionary = {...this.state.selectedItems}; - - const newItems: ElementModel[] = []; - for (const elementId in elements) { - if (!elements.hasOwnProperty(elementId)) { continue; } - - let element = elements[elementId]; - newItems.push(element); - - delete selectedItems[element.id]; - } - - const requestedAdditionalItems = this.currentRequest.offset > 0; - const items = requestedAdditionalItems - ? this.state.items.concat(newItems) : newItems; - - let resultId = this.state.resultId; - if (!requestedAdditionalItems) { resultId += 1; } - - this.setState({ - quering: false, - resultId, - items, - error: undefined, - moreItemsAvailable: newItems.length >= this.currentRequest.limit, - selectedItems, - }); - } -} - -function createRequest(criteria: SearchCriteria, language: string): FilterParams { - return { - text: criteria.text, - elementTypeId: criteria.elementTypeId, - refElementId: criteria.refElementId, - refElementLinkId: criteria.refElementLinkId, - offset: 0, - limit: 100, - languageCode: language ? language : 'en', - }; -} - -function formatLabel(view: DiagramView, uri: string, label?: { values: LocalizedString[] }) { - return label ? view.getLocalizedText(label.values).text : uri2name(uri); -} diff --git a/DKBFrontEnd/vendor/src/ontodia/widgets/linksToolbox.tsx b/DKBFrontEnd/vendor/src/ontodia/widgets/linksToolbox.tsx deleted file mode 100644 index b20e84759..000000000 --- a/DKBFrontEnd/vendor/src/ontodia/widgets/linksToolbox.tsx +++ /dev/null @@ -1,384 +0,0 @@ -import * as _ from 'lodash'; -import * as React from 'react'; -import * as ReactDOM from 'react-dom'; -import * as Backbone from 'backbone'; - -import LinkTypesToolboxModel from './linksToolboxModel'; -import { Element, FatLinkType } from '../diagram/elements'; -import DiagramView from '../diagram/view'; -import { chooseLocalizedText } from '../diagram/model'; - -export { LinkTypesToolboxModel }; -export interface LinkInToolBoxProps { - link: FatLinkType; - count: number; - language?: string; - onPressFilter?: (type: FatLinkType) => void; - filterKey?: string; -} - -import { LocalizedString } from '../data/model'; -type Label = { values: LocalizedString[] }; - -type LinkTypeVisibility = 'invisible' | 'withoutLabels' | 'allVisible'; - -/** - * Events: - * filter-click(link: FatLinkType) - when filter button clicked - */ -export class LinkInToolBox extends React.Component { - constructor(props: LinkInToolBoxProps) { - super(props); - } - - private onPressFilter = () => { - if (this.props.onPressFilter) { - this.props.onPressFilter(this.props.link); - } - }; - - private changeState = (state: LinkTypeVisibility) => { - if (state === 'invisible') { - this.props.link.setVisibility({visible: false, showLabel: false}); - } else if (state === 'withoutLabels') { - this.props.link.setVisibility({visible: true, showLabel: false}); - } else if (state === 'allVisible') { - this.props.link.setVisibility({visible: true, showLabel: true}); - } - }; - - private isChecked = (stateName: LinkTypeVisibility): boolean => { - let curState: LinkTypeVisibility; - if (!this.props.link.get('visible')) { - curState = 'invisible'; - } else if (!this.props.link.get('showLabel')) { - curState = 'withoutLabels'; - } else { - curState = 'allVisible'; - } - return stateName === curState; - }; - - private getText = () => { - const label: Label = this.props.link.get('label'); - const fullText = chooseLocalizedText(label.values, this.props.language).text.toLowerCase(); - if (this.props.filterKey) { - const filterKey = this.props.filterKey.toLowerCase(); - const leftIndex = fullText.toLowerCase().indexOf(filterKey); - const rightIndex = leftIndex + filterKey.length; - let firstPart = ''; - let selectedPart = ''; - let lastPart = ''; - - if (leftIndex === 0) { - selectedPart = fullText.substring(0, rightIndex); - } else { - firstPart = fullText.substring(0, leftIndex); - selectedPart = fullText.substring(leftIndex, rightIndex); - } - if (rightIndex <= fullText.length) { - lastPart = fullText.substring(rightIndex, fullText.length); - } - return - {firstPart}{selectedPart}{lastPart} - ; - } else { - return {fullText}; - } - } - - render() { - const newIcon = (this.props.link.get('isNew') ? new : ''); - const countIcon = (this.props.count > 0 ? {this.props.count} : ''); - const badgeContainer = (newIcon || countIcon ?
    {newIcon}{countIcon}
    : ''); - - return ( -
  • - - - - - -
    {this.getText()}
    - {badgeContainer} - -
  • - ); - } -} - -export interface LinkTypesToolboxProps extends Backbone.ViewOptions { - links: FatLinkType[]; - countMap?: { [linkTypeId: string]: number }; - label?: { values: LocalizedString[] }; - language?: string; - dataState?: string; - filterCallback?: (type: FatLinkType) => void; -} - -export class LinkTypesToolbox extends React.Component { - constructor(props: LinkTypesToolboxProps) { - super(props); - this.state = {filterKey: ''}; - } - - private compareLinks = (a: FatLinkType, b: FatLinkType) => { - const aLabel: Label = a.get('label'); - const bLabel: Label = b.get('label'); - const aText = (aLabel ? chooseLocalizedText(aLabel.values, this.props.language).text.toLowerCase() : null); - const bText = (bLabel ? chooseLocalizedText(bLabel.values, this.props.language).text.toLowerCase() : null); - - if (aText < bText) { - return -1; - } - - if (aText > bText) { - return 1; - } - - return 0; - } - - private onChangeInput = (e: React.SyntheticEvent) => { - this.setState({filterKey: e.currentTarget.value}); - } - - private onDropFilter = () => { - this.setState({filterKey: ''}); - } - - private changeState = (state: LinkTypeVisibility, links: FatLinkType[]) => { - if (state === 'invisible') { - for (const link of links) { - link.setVisibility({visible: false, showLabel: false}); - } - } else if (state === 'withoutLabels') { - for (const link of links) { - link.setVisibility({visible: true, showLabel: false}); - } - } else if (state === 'allVisible') { - for (const link of links) { - link.setVisibility({visible: true, showLabel: true}); - } - } - }; - - private getLinks = () => { - return (this.props.links || []).filter(link => { - const label: Label = link.get('label'); - const text = (label ? chooseLocalizedText(label.values, this.props.language).text.toLowerCase() : null); - return (!this.state.filterKey) || (text && text.indexOf(this.state.filterKey.toLowerCase()) !== -1); - }) - .sort(this.compareLinks); - } - - private getViews = (links: FatLinkType[]) => { - const countMap = this.props.countMap || {}; - const views: React.ReactElement[] = []; - for (const link of links) { - views.push( - - ); - } - return views; - } - - render() { - const className = 'link-types-toolbox'; - - const dataState = this.props.dataState || null; - const links = this.getLinks(); - const views = this.getViews(links); - - let connectedTo: React.ReactElement = null; - if (this.props.label) { - const selectedElementLabel = chooseLocalizedText( - this.props.label.values, this.props.language).text.toLowerCase(); - connectedTo = ( -

    - Connected to{'\u00A0'} - {selectedElementLabel} -

    - ); - } - - let dropButton: React.ReactElement = null; - if (this.state.filterKey) { - dropButton = ; - } - - return ( -
    -
    -
    - - {dropButton} -
    -
    -
    - - - -
    -  Switch all -
    -
    -
    -
    -
    -
    -
    - {connectedTo} -
    -
      {views}
    -
    -
    -
    - ); - } -} - -export interface LinkTypesToolboxShellProps extends Backbone.ViewOptions { - view: DiagramView; -} - -export class LinkTypesToolboxShell extends Backbone.View { - private view: DiagramView; - private dataState: string; - private filterCallback: (type: FatLinkType) => void; - private linksOfElement: FatLinkType[] = []; - private countMap: { [linkTypeId: string]: number }; - - constructor(public props: LinkTypesToolboxShellProps) { - super(_.extend({ tagName: 'div' }, props)); - - this.view = props.view; - - this.listenTo(this.view, 'change:language', this.render); - this.listenTo(this.view.model, 'state:dataLoaded', this.render); - this.listenTo(this.view, 'change:language', this.updateLinks); - - this.listenTo(this.view.selection, 'add remove reset', _.debounce(() => { - const single = this.view.selection.length === 1 - ? this.view.selection.first() : null; - if (single !== this.model.get('selectedElement')) { - this.model.set('selectedElement', single); - } - this.updateLinks(); - }, 50)); - - this.listenTo(this.model, 'state:beginQuery', () => { this.setDataState('querying'); }); - this.listenTo(this.model, 'state:queryError', () => this.setDataState('error')); - this.listenTo(this.model, 'state:endQuery', () => { - this.setDataState(this.model.connectionsOfSelectedElement ? 'finished' : null); - this.updateLinks(); - }); - - this.filterCallback = (linkType: FatLinkType) => { - let selectedElement: Element = this.model.get('selectedElement'); - selectedElement.addToFilter(linkType); - }; - } - - private setDataState(dataState: string) { - this.dataState = dataState; - this.render(); - } - - private updateLinks() { - this.unsubscribeOnLinksEevents(); - - if (this.model.connectionsOfSelectedElement) { - this.countMap = this.model.connectionsOfSelectedElement; - const linkTypeIds = _.keys(this.model.connectionsOfSelectedElement); - this.linksOfElement = linkTypeIds.map(id => { - return this.view.model.createLinkType(id); - }); - this.subscribeOnLinksEevents(this.linksOfElement); - } else { - this.linksOfElement = null; - this.countMap = {}; - } - this.render(); - } - - private subscribeOnLinksEevents(linksOfElement: FatLinkType[]) { - for (const link of linksOfElement) { - this.listenTo(link, 'change:label', this.render); - this.listenTo(link, 'change:visible', this.render); - this.listenTo(link, 'change:showLabel', this.render); - }; - } - - private unsubscribeOnLinksEevents() { - if (!this.linksOfElement) { return; } - for (const link of this.linksOfElement) { - this.stopListening(link); - } - } - - public getReactComponent() { - let selectedElement: Element = this.model.get('selectedElement'); - - return (); - } - - render(): LinkTypesToolboxShell { - ReactDOM.render(this.getReactComponent(), this.el); - return this; - } - - remove() { - this.unsubscribeOnLinksEevents(); - return this; - } -} - -export default LinkTypesToolboxShell; diff --git a/DKBFrontEnd/vendor/src/ontodia/widgets/linksToolboxModel.ts b/DKBFrontEnd/vendor/src/ontodia/widgets/linksToolboxModel.ts deleted file mode 100644 index eb94fabb5..000000000 --- a/DKBFrontEnd/vendor/src/ontodia/widgets/linksToolboxModel.ts +++ /dev/null @@ -1,52 +0,0 @@ -import * as Backbone from 'backbone'; - -import { Element } from '../diagram/elements'; -import DiagramModel from '../diagram/model'; - -/** - * Model of 'connections' component. - * - * Properties: - * selectedElement: Element - * - * Events: - * state:beginQuery - * state:endQuery - * state:queryError - */ -export class LinkTypesToolboxModel extends Backbone.Model { - connectionsOfSelectedElement: { [linkTypeId: string]: number }; - - private currentRequest: { elementId: string; }; - - constructor(public diagram: DiagramModel) { - super(); - this.listenTo(this, 'change:selectedElement', this.onSelectedElementChanged); - } - - private onSelectedElementChanged(self: LinkTypesToolboxModel, element: Element) { - this.trigger('state:beginQuery'); - if (element) { - const request = {elementId: element.id}; - this.currentRequest = request; - this.diagram.dataProvider.linkTypesOf(request).then(linkTypes => { - if (this.currentRequest !== request) { return; } - this.connectionsOfSelectedElement = {}; - for (const linkType of linkTypes) { - this.connectionsOfSelectedElement[linkType.id] = linkType.count; - } - this.trigger('state:endQuery'); - }).catch(error => { - if (this.currentRequest !== request) { return; } - console.error(error); - this.trigger('state:queryError'); - }); - } else { - this.currentRequest = null; - this.connectionsOfSelectedElement = null; - this.trigger('state:endQuery'); - } - } -} - -export default LinkTypesToolboxModel; diff --git a/DKBFrontEnd/vendor/src/ontodia/widgets/listElementView.tsx b/DKBFrontEnd/vendor/src/ontodia/widgets/listElementView.tsx deleted file mode 100644 index 049de7a62..000000000 --- a/DKBFrontEnd/vendor/src/ontodia/widgets/listElementView.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import * as React from 'react'; -import { hcl } from 'd3-color'; - -import { ElementModel } from '../data/model'; -import { DiagramView } from '../diagram/view'; - -export interface ListElementViewProps extends React.HTMLProps { - view: DiagramView; - model: Readonly; - disabled?: boolean; - selected?: boolean; -} - -const CLASS_NAME = 'ontodia-list-element-view'; - -export class ListElementView extends React.Component { - render() { - const {view, model, selected, disabled, ...otherProps} = this.props; - - const {h, c, l} = view.getTypeStyle(model.types).color; - const frontColor = (selected && !disabled) ? hcl(h, c, l * 1.2) : hcl('white'); - - const disabledClass = disabled ? `${CLASS_NAME}--disabled` : ''; - const className = `${CLASS_NAME} ${disabledClass} ${otherProps.className || ''}`; - - return
  • -
    - {view.getLocalizedText(model.label.values).text} -
    -
  • ; - } -} diff --git a/DKBFrontEnd/vendor/src/ontodia/widgets/toolbar.tsx b/DKBFrontEnd/vendor/src/ontodia/widgets/toolbar.tsx deleted file mode 100644 index ccb84c3e4..000000000 --- a/DKBFrontEnd/vendor/src/ontodia/widgets/toolbar.tsx +++ /dev/null @@ -1,159 +0,0 @@ -import * as React from 'react'; - -export interface Props { - onSaveDiagram?: () => void; - onSaveToSelf?: () => void; - onEditAtMainSite?: () => void; - onResetDiagram?: () => void; - onForceLayout: () => void; - onZoomIn: () => void; - onZoomOut: () => void; - onZoomToFit: () => void; - onUndo: () => void; - onRedo: () => void; - onExportSVG: (link: HTMLAnchorElement) => void; - onExportPNG: (link: HTMLAnchorElement) => void; - onPrint: () => void; - onShare?: () => void; - onChangeLanguage: (language: string) => void; - onShowTutorial: () => void; - isEmbeddedMode?: boolean; - isDiagramSaved?: boolean; -} - -export interface State { - showModal: boolean; -} - -const CLASS_NAME = 'ontodia-toolbar'; - -export class EditorToolbar extends React.Component { - private downloadImageLink: HTMLAnchorElement; - - constructor(props: Props) { - super(props); - this.state = {showModal: false}; - } - - private onChangeLanguage = (event: React.SyntheticEvent) => { - const value = event.currentTarget.value; - this.props.onChangeLanguage(value); - }; - - private onExportSVG = () => { - this.props.onExportSVG(this.downloadImageLink); - }; - - private onExportPNG = () => { - this.props.onExportPNG(this.downloadImageLink); - }; - - render() { - const intro = '

    Toolbox

    ' + - '

    You can use additional tools for working with your diagram, such as choosing between automatic ' + - 'layouts or fit diagram to screen, etc.

    ' + - '

    Don’t forget to save diagrams, it always comes handy after all.

    '; - - let btnSaveDiagram = ( - - ); - - let btnEditAtMainSite = ( - - ); - - let btnShare = ( - - ); - - let btnHelp = ( - - ); - - const nonEmbedded = !this.props.isEmbeddedMode; - return ( -
    -
    - {nonEmbedded - ? (this.props.onSaveDiagram ? btnSaveDiagram : undefined) - : (this.props.onEditAtMainSite ? btnEditAtMainSite : undefined)} - {this.props.onSaveToSelf ? ( - - ) : undefined} - {(this.props.isDiagramSaved && this.props.onResetDiagram) ? ( - - ) : undefined} - - - - - {(nonEmbedded && this.props.onUndo) ? ( - - ) : undefined} - {(nonEmbedded && this.props.onRedo) ? ( - - ) : undefined} - - - - {(nonEmbedded && this.props.onShare) ? btnShare : undefined} - - {nonEmbedded ? : undefined} - - - {nonEmbedded ? btnHelp : undefined} -
    - { this.downloadImageLink = link; }} - style={{display: 'none', visibility: 'collapse'}}/> -
    - ); - } -} - -export default EditorToolbar; diff --git a/DKBFrontEnd/vendor/src/ontodia/workspace/accordion.tsx b/DKBFrontEnd/vendor/src/ontodia/workspace/accordion.tsx deleted file mode 100644 index 9b37f2bdb..000000000 --- a/DKBFrontEnd/vendor/src/ontodia/workspace/accordion.tsx +++ /dev/null @@ -1,205 +0,0 @@ -import * as React from 'react'; - -import { AccordionItem, Props as ItemProps } from './accordionItem'; - -export interface Props { - onStartResize?: () => void; - /** AccordionItem[] */ - children?: React.ReactElement[]; -} - -export interface State { - /** - * Items' sizes in pixels. - * Undefined until first resize or toggle initiated by user. - **/ - readonly sizes?: number[]; - /** - * Per-item collapsed state: true if corresponding item is collapsed; - * otherwise false. - */ - readonly collapsed?: boolean[]; - readonly resizing?: boolean; -} - -const CLASS_NAME = 'ontodia-accordion'; - -export class Accordion extends React.Component { - private element: HTMLDivElement; - - private items: AccordionItem[] = []; - private originSizes: ReadonlyArray; - private originCollapsed: ReadonlyArray; - private originTotalHeight: number; - - constructor(props: Props) { - super(props); - this.state = { - collapsed: React.Children.map(this.props.children, () => false), - resizing: false, - }; - } - - render() { - const {resizing} = this.state; - return ( -
    this.element = element}> - {this.renderItems()} -
    - ); - } - - private renderItems() { - const {sizes, collapsed} = this.state; - const {children} = this.props; - const childCount = React.Children.count(children); - const totalHeight = this.element ? this.element.clientHeight : undefined; - - return React.Children.map(children, (child: React.ReactElement, index: number) => { - const lastChild = index === children.length - 1; - const height = sizes - ? (collapsed[index] ? sizes[index] : `${100 * sizes[index] / totalHeight}%`) - : `${100 / childCount}%`; - - const additionalProps: Partial & React.Props = { - ref: element => this.items[index] = element, - collapsed: collapsed[index], - height, - onChangeCollapsed: newState => this.onItemChangeCollapsed(index, newState), - onBeginDragHandle: lastChild ? undefined : () => this.onBeginDragHandle(index), - onDragHandle: lastChild ? undefined : (dx, dy) => this.onDragHandle(index, dx, dy), - onEndDragHandle: this.onEndDragHandle, - }; - return React.cloneElement(child, additionalProps); - }); - } - - private onBeginDragHandle = (itemIndex: number) => { - this.originTotalHeight = this.element.clientHeight; - this.originSizes = this.computeEffectiveItemHeights(); - this.originCollapsed = [...this.state.collapsed]; - this.setState({resizing: true}, () => { - if (this.props.onStartResize) { - this.props.onStartResize(); - } - }); - } - - private onEndDragHandle = () => { - this.setState({resizing: false}); - } - - private computeEffectiveItemHeights(): number[] { - return this.items.map((item, index) => { - if (this.state.collapsed[index]) { - return item.header.clientHeight; - } else { - return item.element.offsetHeight; - } - }); - } - - private sizeWhenCollapsed = (index: number) => { - const item = this.items[index]; - return item.header.clientHeight + (item.element.offsetHeight - item.element.clientHeight); - } - - private onDragHandle = (itemIndex: number, dx: number, dy: number) => { - const sizes = [...this.originSizes]; - const collapsed = [...this.originCollapsed]; - - new SizeDistributor( - sizes, collapsed, this.originTotalHeight, this.sizeWhenCollapsed, - ).distribute(itemIndex + 1, dy); - - this.setState({sizes, collapsed}); - } - - private onItemChangeCollapsed(itemIndex: number, itemCollapsed: boolean) { - const totalHeight = this.element.clientHeight; - const sizes = this.computeEffectiveItemHeights(); - const collapsed = [...this.state.collapsed]; - - const effectiveSize = sizes[itemIndex]; - - const collapsedSize = this.sizeWhenCollapsed(itemIndex); - const distributor = new SizeDistributor( - sizes, collapsed, totalHeight, this.sizeWhenCollapsed); - - if (itemCollapsed) { - const splitShift = Math.max(effectiveSize - collapsedSize, 0); - sizes[itemIndex] = collapsedSize; - if (itemIndex === sizes.length - 1) { - distributor.expand(splitShift, 0, itemIndex); - } else { - distributor.expand(splitShift, itemIndex + 1, sizes.length); - } - } else { - const shift = (totalHeight / sizes.length) - collapsedSize; - let freeSize = distributor.collapse(shift, itemIndex + 1, sizes.length); - freeSize = Math.max(freeSize, distributor.leftoverSize()); - if (freeSize < shift) { - freeSize += distributor.collapse(shift - freeSize, 0, itemIndex); - } - const newSize = Math.round(collapsedSize + freeSize); - sizes[itemIndex] = newSize; - } - - collapsed[itemIndex] = itemCollapsed; - - this.setState({sizes, collapsed}); - } -} - -class SizeDistributor { - constructor( - readonly sizes: number[], - readonly collapsed: boolean[], - readonly totalSize: number, - readonly sizeWhenCollapsed: (index: number) => number, - ) {} - - distribute(splitIndex: number, splitShift: number) { - if (splitShift > 0) { - let freeSize = this.collapse(splitShift, splitIndex, this.sizes.length); - freeSize = Math.max(freeSize, this.leftoverSize()); - this.expand(freeSize, 0, splitIndex); - } else { - let freeSize = this.collapse(-splitShift, 0, splitIndex); - freeSize = Math.max(freeSize, this.leftoverSize()); - this.expand(freeSize, splitIndex, this.sizes.length); - } - } - - collapse(shift: number, from: number, to: number) { - if (shift <= 0) { return 0; } - let shiftLeft = shift; - for (let i = to - 1; i >= from; i--) { - if (this.collapsed[i]) { continue; } - const size = this.sizes[i]; - const collapsedSize = this.sizeWhenCollapsed(i); - const newSize = Math.round(Math.max(size - shiftLeft, collapsedSize)); - shiftLeft = shiftLeft - (size - newSize); - this.sizes[i] = newSize; - this.collapsed[i] = newSize <= collapsedSize; - } - return shift - shiftLeft; - } - - expand(shift: number, from: number, to: number) { - if (shift <= 0) { return 0; } - const firstOpenFromEnd = this.collapsed.lastIndexOf(false, to - 1); - const index = (firstOpenFromEnd >= from) ? firstOpenFromEnd : (to - 1); - const oldSize = this.sizes[index]; - const newSize = Math.round(oldSize + shift); - this.sizes[index] = newSize; - this.collapsed[index] = newSize <= this.sizeWhenCollapsed(index); - return newSize - oldSize; - } - - leftoverSize() { - const sizeSum = this.sizes.reduce((sum, size) => sum + size, 0); - return Math.max(this.totalSize - sizeSum, 0); - } -} diff --git a/DKBFrontEnd/vendor/src/ontodia/workspace/accordionItem.tsx b/DKBFrontEnd/vendor/src/ontodia/workspace/accordionItem.tsx deleted file mode 100644 index 200628d02..000000000 --- a/DKBFrontEnd/vendor/src/ontodia/workspace/accordionItem.tsx +++ /dev/null @@ -1,58 +0,0 @@ -import * as React from 'react'; - -import { TutorialProps } from '../tutorial/tutorial'; - -import { DraggableHandle } from './draggableHandle'; - -export interface Props { - heading: string; - bodyClassName?: string; - bodyRef?: (body: HTMLDivElement) => void; - tutorialProps?: TutorialProps; - children?: React.ReactNode; - - // props provided by Accordion - collapsed?: boolean; - height?: number | string; - onChangeCollapsed?: (collapsed: boolean) => void; - onBeginDragHandle?: () => void; - onDragHandle?: (dx: number, dy: number) => void; - onEndDragHandle?: () => void; -} - -const CLASS_NAME = 'ontodia-accordion-item'; - -export class AccordionItem extends React.Component { - private _element: HTMLDivElement; - private _header: HTMLDivElement; - - get element() { return this._element; } - get header() { return this._header; } - - render() { - const { - heading, bodyClassName, children, tutorialProps, bodyRef, - collapsed, height, onBeginDragHandle, onDragHandle, onEndDragHandle, - } = this.props; - const shouldRenderHandle = onBeginDragHandle && onDragHandle && onEndDragHandle; - - return
    this._element = element} - style={{height}} - {...tutorialProps}> -
    -
    this._header = header} - onClick={() => this.props.onChangeCollapsed(!collapsed)}>{heading}
    -
    - {children ? children : -
    } -
    -
    - {shouldRenderHandle ? onBeginDragHandle()} - onDragHandle={(e, x, y) => onDragHandle(x, y)} - onEndDragHandle={e => onEndDragHandle()} /> : null} -
    ; - } -} diff --git a/DKBFrontEnd/vendor/src/ontodia/workspace/draggableHandle.tsx b/DKBFrontEnd/vendor/src/ontodia/workspace/draggableHandle.tsx deleted file mode 100644 index 3c448eea3..000000000 --- a/DKBFrontEnd/vendor/src/ontodia/workspace/draggableHandle.tsx +++ /dev/null @@ -1,62 +0,0 @@ -import * as React from 'react'; - -export interface Props extends React.HTMLAttributes { - onBeginDragHandle: (e: React.MouseEvent) => void; - onDragHandle: (e: MouseEvent, dx: number, dy: number) => void; - onEndDragHandle?: (e: MouseEvent) => void; -} - -export class DraggableHandle extends React.Component { - private isHoldingMouse = false; - private originPageX: number; - private originPageY: number; - - render() { - // remove custom handlers from `div` props - // tslint:disable-next-line:no-unused-variable - const {onBeginDragHandle, onDragHandle, onEndDragHandle, ...props} = this.props; - return
    - {this.props.children} -
    ; - } - - componentWillUnmount() { - this.removeListeners(); - } - - private onHandleMouseDown = (e: React.MouseEvent) => { - if (e.target !== e.currentTarget) { return; } - if (this.isHoldingMouse) { return; } - - const LEFT_BUTTON = 0; - if (e.button !== LEFT_BUTTON) { return; } - - this.isHoldingMouse = true; - this.originPageX = e.pageX; - this.originPageY = e.pageY; - document.addEventListener('mousemove', this.onMouseMove); - document.addEventListener('mouseup', this.onMouseUp); - this.props.onBeginDragHandle(e); - } - - private onMouseMove = (e: MouseEvent) => { - if (!this.isHoldingMouse) { return; } - e.preventDefault(); - this.props.onDragHandle(e, e.pageX - this.originPageX, e.pageY - this.originPageY); - } - - private onMouseUp = (e: MouseEvent) => { - this.removeListeners(); - if (this.props.onEndDragHandle) { - this.props.onEndDragHandle(e); - } - } - - private removeListeners() { - if (this.isHoldingMouse) { - this.isHoldingMouse = false; - document.removeEventListener('mousemove', this.onMouseMove); - document.removeEventListener('mouseup', this.onMouseUp); - } - } -} diff --git a/DKBFrontEnd/vendor/src/ontodia/workspace/resizableSidebar.tsx b/DKBFrontEnd/vendor/src/ontodia/workspace/resizableSidebar.tsx deleted file mode 100644 index b08d68fb2..000000000 --- a/DKBFrontEnd/vendor/src/ontodia/workspace/resizableSidebar.tsx +++ /dev/null @@ -1,114 +0,0 @@ -import * as React from 'react'; - -import { TutorialProps } from '../tutorial/tutorial'; - -import { DraggableHandle } from './draggableHandle'; - -export interface Props { - className?: string; - dockSide?: DockSide; - defaultWidth?: number; - minWidth?: number; - maxWidth?: number; - initiallyOpen?: boolean; - onOpenOrClose?: (open: boolean) => void; - onStartResize: () => void; - tutorialProps?: TutorialProps; - children?: React.ReactNode; -} - -export enum DockSide { - Left = 1, - Right, -} - -export interface State { - readonly open?: boolean; - readonly width?: number; -} - -const CLASS_NAME = 'ontodia-drag-resizable-column'; - -export class ResizableSidebar extends React.Component { - static readonly defaultProps: Partial = { - dockSide: DockSide.Left, - minWidth: 0, - maxWidth: 500, - defaultWidth: 275, - initiallyOpen: true, - }; - - private originWidth: number; - - constructor(props: Props) { - super(props); - const {initiallyOpen} = this.props; - this.state = { - open: initiallyOpen, - width: this.defaultWidth(), - }; - } - - private defaultWidth() { - const {defaultWidth, maxWidth} = this.props; - return Math.min(defaultWidth, maxWidth); - } - - render() { - const isDockedLeft = this.props.dockSide === DockSide.Left; - const {open, width} = this.state; - - const className = `${CLASS_NAME} ` + - `${CLASS_NAME}--${isDockedLeft ? 'docked-left' : 'docked-right'} ` + - `${CLASS_NAME}--${open ? 'opened' : 'closed'} ` + - `${this.props.className || ''}`; - - return
    - {this.props.children} - -
    this.toggle({open: !this.state.open})}> -
    -
    -
    ; - } - - private onBeginDragHandle = () => { - this.originWidth = this.state.open ? this.state.width : 0; - this.props.onStartResize(); - } - - private onDragHandle = (e: MouseEvent, dx: number, dy: number) => { - let xDifference = dx; - if (this.props.dockSide === DockSide.Right) { - xDifference = -xDifference; - } - const newWidth = this.originWidth + xDifference; - const clampedWidth = Math.max(Math.min(newWidth, this.props.maxWidth), this.props.minWidth); - this.toggle({open: clampedWidth > this.props.minWidth, newWidth: clampedWidth}); - } - - private toggle(params: { - open: boolean; - newWidth?: number; - }) { - const {open, newWidth} = params; - const openChanged = open !== this.state.open; - const onStateChanged = () => { - if (openChanged && this.props.onOpenOrClose) { - this.props.onOpenOrClose(open); - } - }; - - const useDefaultWidth = open && this.state.width === 0 && newWidth === undefined; - if (useDefaultWidth) { - this.setState({open, width: this.defaultWidth()}, onStateChanged); - } else { - this.setState(newWidth === undefined ? {open} : {open, width: newWidth}, onStateChanged); - } - } -} diff --git a/DKBFrontEnd/vendor/src/ontodia/workspace/workspace.ts b/DKBFrontEnd/vendor/src/ontodia/workspace/workspace.ts deleted file mode 100644 index a54b09070..000000000 --- a/DKBFrontEnd/vendor/src/ontodia/workspace/workspace.ts +++ /dev/null @@ -1,230 +0,0 @@ -import { Component, createElement, ReactElement } from 'react'; -import * as Backbone from 'backbone'; - -import { DiagramModel } from '../diagram/model'; -import { Link, FatLinkType } from '../diagram/elements'; -import { DiagramView, DiagramViewOptions } from '../diagram/view'; -import { - forceLayout, removeOverlaps, padded, translateToPositiveQuadrant, - LayoutNode, LayoutLink, translateToCenter, -} from '../viewUtils/layout'; -import { ClassTree } from '../widgets/classTree'; -import { LinkTypesToolboxShell, LinkTypesToolboxModel } from '../widgets/linksToolbox'; -import { dataURLToBlob } from '../viewUtils/toSvg'; - -import { EditorToolbar, Props as EditorToolbarProps } from '../widgets/toolbar'; -import { SearchCriteria } from '../widgets/instancesSearch'; -import { showTutorial, showTutorialIfNotSeen } from '../tutorial/tutorial'; - -import { WorkspaceMarkup, Props as MarkupProps } from './workspaceMarkup'; - -export interface Props { - onSaveDiagram?: (workspace: Workspace) => void; - onShareDiagram?: (workspace: Workspace) => void; - onEditAtMainSite?: (workspace: Workspace) => void; - isViewOnly?: boolean; - isDiagramSaved?: boolean; - hideTutorial?: boolean; - viewOptions?: DiagramViewOptions; -} - -export interface State { - readonly criteria?: SearchCriteria; -} - -export class Workspace extends Component { - static readonly defaultProps: { [K in keyof Props]?: any } = { - hideTutorial: true, - }; - - private markup: WorkspaceMarkup; - - private readonly model: DiagramModel; - private readonly diagram: DiagramView; - private tree: ClassTree; - private linksToolbox: LinkTypesToolboxShell; - - constructor(props: Props) { - super(props); - this.model = new DiagramModel(this.props.isViewOnly); - this.diagram = new DiagramView(this.model, this.props.viewOptions); - this.state = {}; - } - - render(): ReactElement { - return createElement(WorkspaceMarkup, { - ref: markup => { this.markup = markup; }, - isViewOnly: this.props.isViewOnly, - view: this.diagram, - searchCriteria: this.state.criteria, - onSearchCriteriaChanged: criteria => this.setState({criteria}), - toolbar: createElement(EditorToolbar, { - onUndo: this.undo, - onRedo: this.redo, - onZoomIn: this.zoomIn, - onZoomOut: this.zoomOut, - onZoomToFit: this.zoomToFit, - onPrint: this.print, - onExportSVG: this.exportSvg, - onExportPNG: this.exportPng, - onShare: this.props.onShareDiagram ? () => this.props.onShareDiagram(this) : undefined, - onSaveDiagram: () => this.props.onSaveDiagram(this), - onForceLayout: () => { - this.forceLayout(); - this.zoomToFit(); - }, - onChangeLanguage: this.changeLanguage, - onShowTutorial: showTutorial, - onEditAtMainSite: () => this.props.onEditAtMainSite(this), - isEmbeddedMode: this.props.isViewOnly, - isDiagramSaved: this.props.isDiagramSaved, - }), - } as MarkupProps & React.ClassAttributes); - } - - componentDidMount() { - this.diagram.initializePaperComponents(); - - if (this.props.isViewOnly) { return; } - - this.tree = new ClassTree({ - model: new Backbone.Model(this.diagram.model), - view: this.diagram, - el: this.markup.classTreePanel, - }).render(); - - this.tree.on('action:classSelected', (classId: string) => { - this.setState({criteria: {elementTypeId: classId}}); - }); - this.model.graph.on('add-to-filter', (element: Element, linkType?: FatLinkType) => { - this.setState({criteria: {refElementId: element.id, refElementLinkId: linkType && linkType.id}}); - }); - - this.linksToolbox = new LinkTypesToolboxShell({ - model: new LinkTypesToolboxModel(this.model), - view: this.diagram, - el: this.markup.linkTypesPanel, - }); - - if (!this.props.hideTutorial) { - showTutorialIfNotSeen(); - } - } - - componentWillUnmount() { - if (this.tree) { - this.tree.remove(); - } - - this.diagram.dispose(); - } - - getModel() { return this.model; } - getDiagram() { return this.diagram; } - - preventTextSelectionUntilMouseUp() { this.markup.preventTextSelection(); } - - zoomToFit = () => { - this.markup.paperArea.zoomToFit(); - } - - showWaitIndicatorWhile(promise: Promise) { - this.markup.paperArea.showIndicator(promise); - } - - forceLayout = () => { - const nodes: LayoutNode[] = []; - const nodeById: { [id: string]: LayoutNode } = {}; - for (const element of this.model.elements) { - const size = element.get('size'); - const position = element.get('position'); - const node: LayoutNode = { - id: element.id, - x: position.x, - y: position.y, - width: size.width, - height: size.height, - }; - nodeById[element.id] = node; - nodes.push(node); - } - - type LinkWithReference = LayoutLink & { link: Link }; - const links: LinkWithReference[] = []; - for (const link of this.model.links) { - if (!this.model.isSourceAndTargetVisible(link)) { continue; } - const source = this.model.sourceOf(link); - const target = this.model.targetOf(link); - links.push({ - link, - source: nodeById[source.id], - target: nodeById[target.id], - }); - } - - forceLayout({nodes, links, preferredLinkLength: 200}); - padded(nodes, {x: 10, y: 10}, () => removeOverlaps(nodes)); - translateToPositiveQuadrant({nodes, padding: {x: 150, y: 150}}); - for (const node of nodes) { - this.model.getElement(node.id).position(node.x, node.y); - } - this.markup.paperArea.adjustPaper(); - translateToCenter({ - nodes, - paperSize: this.markup.paperArea.getPaperSize(), - contentBBox: this.markup.paperArea.getContentFittingBox(), - }); - - for (const node of nodes) { - this.model.getElement(node.id).position(node.x, node.y); - } - - for (const {link} of links) { - link.set('vertices', []); - } - } - - exportSvg = (link: HTMLAnchorElement) => { - this.diagram.exportSVG().then(svg => { - link.download = 'diagram.svg'; - const xmlEncodingHeader = ''; - link.href = window.URL.createObjectURL( - new Blob([xmlEncodingHeader + svg], {type: 'image/svg+xml'})); - link.click(); - }); - } - - exportPng = (link: HTMLAnchorElement) => { - this.diagram.exportPNG({backgroundColor: 'white'}).then(dataUri => { - link.download = 'diagram.png'; - link.href = window.URL.createObjectURL(dataURLToBlob(dataUri)); - link.click(); - }); - } - - undo = () => { - this.model.undo(); - } - - redo = () => { - this.model.redo(); - } - - zoomIn = () => { - this.markup.paperArea.zoomBy(0.2); - } - - zoomOut = () => { - this.markup.paperArea.zoomBy(-0.2); - } - - print = () => { - this.diagram.print(); - } - - changeLanguage = (language: string) => { - this.diagram.setLanguage(language); - } -} - -export default Workspace; diff --git a/DKBFrontEnd/vendor/src/ontodia/workspace/workspaceMarkup.tsx b/DKBFrontEnd/vendor/src/ontodia/workspace/workspaceMarkup.tsx deleted file mode 100644 index d0bc7ea1a..000000000 --- a/DKBFrontEnd/vendor/src/ontodia/workspace/workspaceMarkup.tsx +++ /dev/null @@ -1,176 +0,0 @@ -import * as React from 'react'; - -import { DiagramView } from '../diagram/view'; -import { PaperArea } from '../diagram/paperArea'; - -import { InstancesSearch, SearchCriteria } from '../widgets/instancesSearch'; - -import { ResizableSidebar, DockSide } from './resizableSidebar'; -import { Accordion } from './accordion'; -import { AccordionItem } from './accordionItem'; - -export interface Props { - toolbar: React.ReactElement; - view: DiagramView; - isViewOnly?: boolean; - - searchCriteria?: SearchCriteria; - onSearchCriteriaChanged: (criteria: SearchCriteria) => void; -} - -const INTRO_CLASSES = `

    Navigate through class tree and click a class to select it.

    -

    When the class is selected, its instances are shown in Instances panel

    -

    Double-click the class expands it and displays its subclasses.

    `; - -const INTRO_INSTANCES = `

    Instances of the selected class are displayed here.

    -

    You can select one or several instances and drag-and-drop them directly on canvas to - start your diagram.

    `; - -const INTRO_DIAGRAM = `

    Main working area

    Zooming: Ctrl-mousewheel or pinch-zoom on touchpad

    -

    Pan: Ctrl-mouse drag or mouse wheel

    Filtering related instances
    -

    When you select an element on the diagram the Ontodia shows a funnel icon underneath the - element. By clicking the funnel icon, you can filter the related elements into the Instances panel.

    -

    Then related elements can be drag-and-dropped into the diagram.

    -

    By repeating it you can navigate from one element to another as far as you like and your way - will be shown on the diagram.

    `; - -const INTRO_CONNECTIONS = `

    Connections panel lists all the connection present in the data source.

    -

    You can define which connections Ontodia should display and which should stay hidden.

    -

    You can also change the way they are shown on the diagram: it’s either with the name above - them or without it.

    `; - -const INTRO_RESIZE = `

    Panels can be resized and collapsed.

    `; - -export class WorkspaceMarkup extends React.Component { - element: HTMLElement; - classTreePanel: HTMLElement; - linkTypesPanel: HTMLElement; - paperArea: PaperArea; - - private untilMouseUpClasses: string[] = []; - - render() { - let leftPanel = ( - this.untilMouseUp({ - preventTextSelection: true, - horizontalResizing: true, - })} - tutorialProps={{ - 'data-position': 'right', - 'data-step': '7', - 'data-intro-id': 'resize', - 'data-intro': INTRO_RESIZE, - }}> - this.untilMouseUp({ - preventTextSelection: true, - verticalResizing: true, - })}> - this.classTreePanel = e} - tutorialProps={{ - 'data-position': 'right', - 'data-step': '1', - 'data-intro-id': 'tree-view', - 'data-intro': INTRO_CLASSES, - }}> - - - - - - - ); - - let rightPanel = ( - this.untilMouseUp({ - preventTextSelection: true, - horizontalResizing: true, - })}> - this.untilMouseUp({ - preventTextSelection: true, - verticalResizing: true, - })}> - this.linkTypesPanel = e} - tutorialProps={{ - 'data-position': 'left', - 'data-step': '4', - 'data-intro-id': 'link-types-toolbox', - 'data-intro': INTRO_CONNECTIONS, - }}> - - - - ); - - return ( -
    this.element = e} className='ontodia'> -
    {this.props.toolbar}
    -
    - {!this.props.isViewOnly ? leftPanel : null} -
    - this.paperArea = el} - model={this.props.view.model} - paper={this.props.view.paper} - zoomOptions={{min: 0.2, max: 2, maxFit: 1, fitPadding: 20}} - preventTextSelection={() => this.preventTextSelection()} - onDragDrop={(e, position) => this.props.view.onDragDrop(e, position)} /> -
    - {!this.props.isViewOnly ? rightPanel : null} -
    -
    - ); - } - - componentDidMount() { - document.addEventListener('mouseup', this.onDocumentMouseUp); - } - - componentWillUnmount() { - document.removeEventListener('mouseup', this.onDocumentMouseUp); - } - - preventTextSelection() { - this.untilMouseUp({preventTextSelection: true}); - } - - private untilMouseUp(params: { - preventTextSelection?: boolean; - horizontalResizing?: boolean; - verticalResizing?: boolean; - }) { - this.untilMouseUpClasses = []; - if (params.preventTextSelection) { - this.untilMouseUpClasses.push('ontodia--unselectable'); - } - if (params.horizontalResizing) { - this.untilMouseUpClasses.push('ontodia--horizontal-resizing'); - } - if (params.verticalResizing) { - this.untilMouseUpClasses.push('ontodia--vertical-resizing'); - } - - for (const className of this.untilMouseUpClasses) { - this.element.classList.add(className); - } - } - - private onDocumentMouseUp = () => { - for (const className of this.untilMouseUpClasses) { - this.element.classList.remove(className); - } - this.untilMouseUpClasses = []; - } -} - -export default WorkspaceMarkup; diff --git a/DKBFrontEnd/vendor/styles/_misc.scss b/DKBFrontEnd/vendor/styles/_misc.scss deleted file mode 100644 index cedd487db..000000000 --- a/DKBFrontEnd/vendor/styles/_misc.scss +++ /dev/null @@ -1,5 +0,0 @@ -/* JointJS */ -.link-tools .tool-remove { display: none } -.link-tools .tool-options { display: none } -.marker-arrowheads { display: none } -.selection .handle.rotate { display: none; } /* disables the rotate tool */ diff --git a/DKBFrontEnd/vendor/styles/diagram/_connectionsMenu.scss b/DKBFrontEnd/vendor/styles/diagram/_connectionsMenu.scss deleted file mode 100644 index debc963fe..000000000 --- a/DKBFrontEnd/vendor/styles/diagram/_connectionsMenu.scss +++ /dev/null @@ -1,244 +0,0 @@ -.ontodia-connections-menu { - position: absolute; - width: 300px; - height: 300px; - border-radius: 3px; - display: flex; - flex-direction: column; - box-shadow: 0px 4px 15px 0px rgba(0, 0, 0, 0.38); -} - -.ontodia-connections-menu_bread-crumbs { - padding: 10px; - padding-bottom: 0px; - overflow: hidden; - text-overflow: ellipsis; - height: 27px; - min-height: 27px; - flex-grow: 0; -} - -.ontodia-connections-menu__title-label { - position: absolute; - top: -11px; - left: 10px; - background: white; - padding-left: 3px; - padding-right: 3px; - border-radius: 6px; -} - -.ontodia-connections-menu_search-line { - padding: 10px; -} - -.ontodia-connections-menu_links-list { - padding: 5px; - overflow-x: hidden; - overflow-y: auto; - border-top: 1px solid #dbdbdb; - flex-grow: 1; - margin-bottom: 0px; -} - -.ocm_links-list-empty { - display: flex; - align-items: center; -} - -.ontodia-connections-menu_links-list__empty { - width: 100%; - position: relative; - font-size: x-large; - color: #cbcbcb; - text-align: center; -} - -.ontodia-connections-menu__loading, -.ontodia-connections-menu__error { - width: 100%; - height: 100%; - position: relative; - font-size: x-large; - display: flex; - color: #cbcbcb; - align-items: center; - justify-content: center; -} -.ontodia-connections-menu__loading-objects { - border: 1px solid gray; - flex-grow: 1; - box-shadow: inset 0px 0px 23px -8px gray; - background-color: whitesmoke; - position: relative; - font-size: x-large; - display: flex; - color: #cbcbcb; - align-items: center; - justify-content: center; - margin-bottom: 5px; -} - -.ontodia-connections-menu__progress-bar { - opacity: 0; - height: 0px; - -webkit-transition: 0.3s; - -moz-transition: 0.3s; - transition: 0.3s; - - &--loading { - height: 10px; - opacity: 1; - } - - &--error { - height: 10px; - opacity: 1; - > .progress-bar { background-color: #E72F2F; } - } -} - -.element-in-popup-menu { - display: flex; - padding: 5px 10px; - margin: 5px 10px; - border-radius: 5px; -} -.element-in-popup-menu:hover { - background-color: #e6e6e6; -} - -.element-in-popup-menu.unchecked { - background-color: rgba(255, 255, 255, 0.79); -} -.element-in-popup-menu_disabled-line { - pointer-events: none; - cursor: not-allowed; -} - -.element-in-popup-menu__checkbox { - min-width: 13px; -} - -.element-in-popup-menu__link-label { - flex-grow: 1; - margin-left: 5px; - overflow: hidden; - text-overflow: ellipsis; -} - -.link-in-popup-menu { - display: flex; - padding: 5px 5px 5px 10px; - border-radius: 5px; - align-items: center; - margin-bottom: 4px; - box-shadow: 0px 0px 23px -5px #dbdbdb inset; -} - -.link-in-popup-menu:hover { - background-color: whitesmoke; -} - -.link-in-popup-menu__link-title { - flex-grow: 1; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; -} - -.link-in-popup-menu__count { - float: right; - margin-left: 10px; -} -.link-in-popup-menu__count.badge { - min-width: 21px; -} - -.link-in-popup-menu__navigate-button { - float: right; - background-image: url("../images/expand-link.png"); - width: 16px; - height: 16px; - opacity: 0.5; - margin-left: 10px; - min-width: 16px; - background-size: cover; -} - -.link-in-popup-menu__navigate-button:hover { - opacity: 1; -} - -.ontodia-connections-menu_links-list__loading { - text-align: center; - width: 100%; - position: relative; - font-size: x-large; - color: #cbcbcb; -} - -.ontodia-connections-menu_links-list__hr { - margin-top: 10px; - margin-bottom: 10px; -} - -.ontodia-connections-menu_objects-panel { - flex-grow: 1; - padding: 10px; - position: relative; - display: flex; - flex-direction: column; - padding-top: 0px; -} - -.ontodia-connections-menu_objects-panel__select-all { - white-space: nowrap; - margin-bottom: 5px; - display: flex; - - input { - display: inline-block; - } - - .undefined { - opacity: 0.3; - } - - span { - margin-left: 5px; - } -} - - -.ontodia-connections-menu_objects-panel_bottom-panel { - height: 25px; - white-space: nowrap; -} - -.ontodia-connections-menu_objects-panel_bottom-panel__count-label { - height: 25px; - float: left; - padding: 0px 5px; - font-size: larger; - display: flex; - align-items: center; - max-width: 60%; -} - -.btn.ontodia-connections-menu_objects-panel_bottom-panel__add-button { - height: 25px; - padding-top: 1px; - padding-bottom: 2px; -} - -.ontodia-connections-menu_objects-panel_objects-list { - border: 1px solid gray; - height: 0; - flex-grow: 1; - box-shadow: inset 0px 0px 23px -8px gray; - background-color: whitesmoke; - overflow-x: hidden; - overflow-y: scroll; - margin-bottom: 5px; -} diff --git a/DKBFrontEnd/vendor/styles/diagram/_elementLayer.scss b/DKBFrontEnd/vendor/styles/diagram/_elementLayer.scss deleted file mode 100644 index 15044ad44..000000000 --- a/DKBFrontEnd/vendor/styles/diagram/_elementLayer.scss +++ /dev/null @@ -1,24 +0,0 @@ -.ontodia-overlayed-element { - cursor: move; - outline: none; -} - -.ontodia-overlayed-element, -.ontodia-exported-element { - // set defaults for all inherited properties - box-sizing: border-box; - color: black; - font-family: "Helvetica Neue",Helvetica,Arial,sans-serif; - font-size: 14px; - line-height: 1.42857143; - - // http://stackoverflow.com/questions/6664460/line-height-affects-images - img { vertical-align: middle; } -} - -// remove link fill on exported SVG -.link .connection { fill: none; } -.link .connection-wrap { - fill: none; - opacity: 0; -} diff --git a/DKBFrontEnd/vendor/styles/diagram/_halo.scss b/DKBFrontEnd/vendor/styles/diagram/_halo.scss deleted file mode 100644 index 3259e9b79..000000000 --- a/DKBFrontEnd/vendor/styles/diagram/_halo.scss +++ /dev/null @@ -1,75 +0,0 @@ -.ontodia-halo { - position: absolute; - pointer-events: none; - - @mixin halo-button { - position: absolute; - background-size: cover; - cursor: pointer; - pointer-events: auto; - opacity: 0.5; - transition: opacity 0.3s; - width: 16px; - height: 16px; - } - - &__navigate { - @include halo-button; - bottom: calc(50% - 10px); - right: -17px; - margin-left: -8px; - - &:hover { - opacity: 1; - } - - &--open { - background-image: url("../images/connections.png"); - } - - &--closed { - background-image: url("../images/close-connections.png"); - } - } - - &__delete { - @include halo-button; - background-image: url("../images/delete.png"); - top: -16px; - right: -16px; - - &:hover { - opacity: 1; - } - } - - &__expand { - @include halo-button; - bottom: -17px; - left: 50%; - margin-left: -8px; - - &:hover { - opacity: 1; - } - - &--open { - background-image: url("../images/expand-properties.png"); - } - - &--closed { - background-image: url("../images/collapse-properties.png"); - } - } - - &__add-to-filter { - @include halo-button; - background-image: url("../images/add-to-filter.png"); - bottom: -17px; - right: -17px; - - &:hover { - opacity: 1; - } - } -} diff --git a/DKBFrontEnd/vendor/styles/diagram/_paperArea.scss b/DKBFrontEnd/vendor/styles/diagram/_paperArea.scss deleted file mode 100644 index 8037d27f5..000000000 --- a/DKBFrontEnd/vendor/styles/diagram/_paperArea.scss +++ /dev/null @@ -1,24 +0,0 @@ -.paper-area { - flex: auto; - cursor: default; - overflow: scroll; - - // create new layer to to fix “repaints on scroll” bottleneck - -webkit-transform: translateZ(0); - -moz-transform: translateZ(0); - transform: translateZ(0); - - background-image: url('../images/transparent-background.png'); - .paper { - margin: 0; - position: relative; - display: inline-block; - border: 1px solid black; - background-color: white; - } -} - -.uiElementView__iri { - fill: #969696; - font-size: smaller; -} diff --git a/DKBFrontEnd/vendor/styles/main.scss b/DKBFrontEnd/vendor/styles/main.scss deleted file mode 100644 index 0c46c20ba..000000000 --- a/DKBFrontEnd/vendor/styles/main.scss +++ /dev/null @@ -1,26 +0,0 @@ -@import "misc"; - -@import "diagram/connectionsMenu"; -@import "diagram/elementLayer"; -@import "diagram/halo"; -@import "diagram/paperArea"; - -@import "viewUtils/spinner"; - -@import "widgets/classTree"; -@import "widgets/instancesSearch"; -@import "widgets/linksToolbox"; -@import "widgets/listElementView"; -@import "widgets/progress"; -@import "widgets/toolbar"; - -@import "workspace/accordion"; -@import "workspace/resizableSidebar"; -@import "workspace/workspace"; - -@import "templates/icons"; -@import "templates/bigIcon"; -@import "templates/defaultElement"; -@import "templates/leftBar"; -@import "templates/organization"; -@import "templates/person"; diff --git a/DKBFrontEnd/vendor/styles/templates/_bigIcon.scss b/DKBFrontEnd/vendor/styles/templates/_bigIcon.scss deleted file mode 100644 index 99b06b2ba..000000000 --- a/DKBFrontEnd/vendor/styles/templates/_bigIcon.scss +++ /dev/null @@ -1,153 +0,0 @@ -.ontodia-big-icon-container { - max-width: 400px; - float: left; -} - -.ontodia-big-icon-template { - border-radius: 10px; - border-style: solid; - border-width: 1px; -} - -.ontodia-big-icon-template_body { - margin-left: 13px; - height: 100%; - border-radius: 3px; - border-top-right-radius: 10px; - border-bottom-right-radius: 10px; - border-left-style: solid; - border-left-width: 1px; - padding: 3px 6px 3px 6px; - background: white; - display: flex; - align-items: center; - justify-content: space-between; - overflow: hidden; -} - -.ontodia-big-icon-template_body__label { - font-size: 19px; - white-space: nowrap; - font-weight: 100; - margin-bottom: -7px; - width: 100%; - overflow: hidden; - text-overflow: ellipsis; -} - -.ontodia-big-icon-template_body_type-container { - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - font-size: 11px; - font-style: italic; - color: #afafaf; - font-weight: 100; - display: flex; -} - -.ontodia-big-icon-template_body_type-container__type { - width: 0; - flex-grow: 1; - overflow: hidden; - text-overflow: ellipsis; -} - -.ontodia-big-icon-template_body__icon { - position: inherit !important; - font-size: x-large; - margin: 5px 6px 5px 15px; - display: flex; -} - -.ontodia-big-icon-template_property { - border-radius: 10px; - background-color: white; - margin-top: 5px; - border: 1px solid; -} - -.ontodia-big-icon-template_property__image { - width: 100%; - border-top-left-radius: 10px; - border-top-right-radius: 10px; - border-bottom: 1px solid; -} - -.ontodia-big-icon-template_property_content { - width: 100%; - height: 100%; - padding: 9px; -} - -.ontodia-big-icon-template_property_content_iri-line { - width: 100%; - overflow: hidden; - display: flex; -} - -.ontodia-big-icon-template_property_content_iri-line__label { - font-size: 12px; - font-weight: 100; - margin-right: 4px; - color: #b6b6b6; -} - -.ontodia-big-icon-template_property_content_iri-line__iri { - font-size: 12px; - width: 100%; - overflow: hidden; - white-space: nowrap; - text-overflow: ellipsis; -} - -.ontodia-big-icon-template_property_content_iri-line__iri a { - color: #b6b6b6; -} - -.ontodia-big-icon-template_property_content__hr { - margin: 5px 0px 5px 0px; -} - -.ontodia-big-icon-template_property_content_property-table { - font-size: 15px; - font-weight: 100; - max-height: 200px; - overflow-y: scroll; - overflow-x: hidden; -} - -.ontodia-big-icon-template_property_content_property-table_row { - white-space: nowrap; -} - -.ontodia-big-icon-template_property_content_property-table_row__key { - display: inline-block; - width: 50%; - text-overflow: ellipsis; - overflow: hidden; - vertical-align: top; -} - -.ontodia-big-icon-template_property_content_property-table_row_key { - display: inline-block; - width: 50%; - text-overflow: ellipsis; - overflow: hidden; - vertical-align: top; -} - -.ontodia-big-icon-template_property_content_property-table_row_key_values { - display: inline-block; - width: 50%; - text-overflow: ellipsis; - overflow: hidden; -} - -.ontodia-big-icon-template_property_content_property-table_row_key_values__value { - width: 100%; - overflow: hidden; - text-overflow: ellipsis; - white-space: initial; - padding-right: 10px; -} diff --git a/DKBFrontEnd/vendor/styles/templates/_defaultElement.scss b/DKBFrontEnd/vendor/styles/templates/_defaultElement.scss deleted file mode 100644 index ba200f8ef..000000000 --- a/DKBFrontEnd/vendor/styles/templates/_defaultElement.scss +++ /dev/null @@ -1,142 +0,0 @@ -.ontodia-default-template { - max-width: 450px; - float: left; - border-radius: 12px; - border-style: solid; - border-width: 1px; - - &__thumbnail { - text-align: center; - > img { - max-width: 200px; - border-bottom: 1px solid; - } - } - - &[data-expanded='true'] &__thumbnail > img { - max-width: 350px; - } -} - -.ontodia-default-template_type-line { - padding: 0px 7px; - color: white; - height: 18px; - margin-bottom: 2px; - overflow: hidden; - display: flex; - align-items: baseline; - margin-top: -3px; -} - -div.ontodia-default-template_type-line__icon { - position: inherit !important; - margin-right: 4px; -} - -.ontodia-default-template_type-line_text-container { - flex-grow: 1; - overflow: hidden; - text-overflow: ellipsis; - width: 0; -} -.ontodia-default-template_type-line_text-container__text { - display: inline; - white-space: nowrap; - font-size: 12px; -} - -.ontodia-default-template_body { - border-bottom-left-radius: 12px; - border-bottom-right-radius: 12px; - border-top-style: solid; - border-top-width: 1px; - background: white; - padding: 7px 10px 8px 10px; - overflow: hidden; - display: flex; - flex-direction: column; -} - -.ontodia-default-template_body__label { - font-size: 19px; - font-weight: 100; - overflow: hidden; - text-overflow: ellipsis; - margin-bottom: 0; - white-space: nowrap; - word-wrap: break-word; -} - -.ontodia-default-template_body_expander { - width: 100%; - overflow: hidden; - display: flex; -} - -.ontodia-default-template_body_expander__iri_label { - font-size: 12px; - font-weight: 100; - margin-right: 15px; - color: #b6b6b6; -} - -.ontodia-default-template_body_expander_iri { - font-size: 12px; - width: 100%; - overflow: hidden; - white-space: nowrap; - text-overflow: ellipsis; -} - -.ontodia-default-template_body_expander_iri__link { - color: #b6b6b6; -} - -.ontodia-default-template_body_expander__hr { - margin: 5px 0px 5px 0px; -} - -.ontodia-default-template_body_expander_property-table { - font-size: 15px; - font-weight: 100; - margin-bottom: 5px; - max-height: 200px; - overflow-y: scroll; - overflow-x: hidden; -} - -.ontodia-default-template_body_expander_property-table_row { - white-space: nowrap; -} - -.ontodia-default-template_body_expander_property-table_row__key { - display: inline-block; - width: 50%; - text-overflow: ellipsis; - overflow: hidden; - vertical-align: top; -} - -.ontodia-default-template_body_expander_property-table_row_key { - display: inline-block; - width: 50%; - text-overflow: ellipsis; - overflow: hidden; - vertical-align: top; -} - -.ontodia-default-template_body_expander_property-table_row_key_values { - display: inline-block; - width: 50%; - text-overflow: ellipsis; - overflow: hidden; -} - -.ontodia-default-template_body_expander_property-table_row_key_values__value { - width: 100%; - overflow: hidden; - text-overflow: ellipsis; - white-space: initial; - padding-right: 10px; -} diff --git a/DKBFrontEnd/vendor/styles/templates/_icons.scss b/DKBFrontEnd/vendor/styles/templates/_icons.scss deleted file mode 100644 index 8382b682a..000000000 --- a/DKBFrontEnd/vendor/styles/templates/_icons.scss +++ /dev/null @@ -1,104 +0,0 @@ -.ontodia-default-icon::after { - content: "\25EF"; - min-width: 10px; - min-height: 10px; - border-radius: 100px; - overflow: hidden; - font-style: normal; - font-size: 12px; -} - -.ontodia-class-icon::after { - content: "C"; - font-weight: bold; - min-width: 10px; - min-height: 10px; - border-radius: 100px; - overflow: hidden; - font-style: normal; -} -.jstree-icon.jstree-themeicon-custom.ontodia-tree-icon.ontodia-class-icon { - color: #eaac77; - background-color: #fff6f0; - border: 1px solid #d99292; -} - -.ontodia-object-property-icon::after { - content: "OP"; - font-weight: bold; - min-width: 10px; - min-height: 10px; - border-radius: 100px; - overflow: hidden; - font-style: normal; -} - -.jstree-icon.jstree-themeicon-custom.ontodia-tree-icon.ontodia-object-property-icon { - font-size: 11px; - color: #34c7f3; - border: 1px solid #2dd6e6; -} - -.ontodia-datatype-property-icon::after { - content: "DP"; - font-weight: bold; - min-width: 10px; - min-height: 10px; - border-radius: 100px; - overflow: hidden; - font-style: normal; -} -.jstree-icon.jstree-themeicon-custom.ontodia-tree-icon.ontodia-datatype-property-icon { - font-size: 11px; - color: #34c7f3; -} - -.ontodia-person-icon::after { - content: "\1F464"; - min-width: 10px; - min-height: 10px; - border-radius: 100px; - overflow: hidden; - font-style: normal; -} - -.ontodia-country-icon::after { - content: "\2690"; //U+2690 - min-width: 10px; - min-height: 10px; - border-radius: 100px; - overflow: hidden; - font-style: normal; -} - -.jstree-icon.jstree-themeicon-custom.ontodia-tree-icon.ontodia-person-icon { - color: #eb7777; -} - -.ontodia-organization-icon::after { - content: "Org"; - font-weight: bold; - min-width: 10px; - min-height: 10px; - overflow: hidden; - font-style: normal; -} -.jstree-icon.jstree-themeicon-custom.ontodia-tree-icon.ontodia-organization-icon { - font-size: 9px; - color: #4c9d6c; - background-color: #dcffe2; - border: 1px solid #69b286; -} -.jstree-default .jstree-icon.jstree-themeicon-custom.ontodia-tree-icon { - height: 20px; - width: 20px; - line-height: 20px; -} -.jstree-icon.jstree-themeicon-custom.ontodia-tree-icon { - color: #1573b0; - background-color: aliceblue; - border-radius: 15px; - border: 1px solid #92bdd9; - overflow: hidden; - font-size: 15px; -} diff --git a/DKBFrontEnd/vendor/styles/templates/_leftBar.scss b/DKBFrontEnd/vendor/styles/templates/_leftBar.scss deleted file mode 100644 index 26f4fd929..000000000 --- a/DKBFrontEnd/vendor/styles/templates/_leftBar.scss +++ /dev/null @@ -1,132 +0,0 @@ -.ontodia-left-bar-template { - max-width: 400px; - float: left; - border-radius: 10px; - border-style: solid; - border-width: 1px; -} - -.ontodia-left-bar-template_body { - height: 100%; - border-radius: 2px; - border-top-right-radius: 10px; - border-bottom-right-radius: 10px; - border-left-style: solid; - border-left-width: 1px; - padding: 2px 10px 0px 6px; - margin-left: 13px; - background: white; - overflow: hidden; -} - -.ontodia-left-bar-template_body__image { - width: 100%; - margin: 5px 0px; - border: 1px solid #bdbdbd; -} - -.ontodia-left-bar-template_body_type-line { - display: flex; - overflow: hidden; - margin-top: 0px; - margin-bottom: -3px; - align-items: baseline; -} - -.ontodia-left-bar-template_body_type-line__icon { - position: inherit !important; - margin-right: 4px; -} - -.ontodia-left-bar-template_body_type-line__type { - white-space: nowrap; - font-size: 12px; - font-weight: 100; - width: 0; - flex-grow: 1; - overflow: hidden; - text-overflow: ellipsis; -} - -.ontodia-left-bar-template_body__label { - font-size: 19px; - white-space: nowrap; - font-weight: 100; - margin-bottom: -3px; - width: 100%; - overflow: hidden; - text-overflow: ellipsis; -} - -.ontodia-left-bar-template_body_expander { - width: 100%; - overflow: hidden; - display: flex; -} - -.ontodia-left-bar-template_body_expander__iri_label { - font-size: 12px; - font-weight: 100; - margin-right: 4px; - color: #b6b6b6; -} - -.ontodia-left-bar-template_body_expander_iri { - font-size: 12px; - width: 100%; - overflow: hidden; - white-space: nowrap; - text-overflow: ellipsis; -} - -.ontodia-left-bar-template_body_expander_iri__link { - color: #b6b6b6; -} - -.ontodia-left-bar-template_body_expander__hr { - margin: 5px 0px 5px 0px; -} - -.ontodia-left-bar-template_body_expander_property-table { - font-size: 15px; - font-weight: 100; - margin-bottom: 5px; - max-height: 200px; - overflow-y: scroll; - overflow-x: hidden; -} - -.ontodia-left-bar-template_body_expander_property-table_row { - white-space: nowrap; -} - -.ontodia-left-bar-template_body_expander_property-table_row__key { - display: inline-block; - width: 50%; - text-overflow: ellipsis; - overflow: hidden; - vertical-align: top; -} - -.ontodia-left-bar-template_body_expander_property-table_row_key { - display: inline-block; - width: 50%; - text-overflow: ellipsis; - overflow: hidden; - vertical-align: top; -} - -.ontodia-left-bar-template_body_expander_property-table_row_key_values { - display: inline-block; - width: 50%; - text-overflow: ellipsis; - overflow: hidden; -} - -.ontodia-left-bar-template_body_expander_property-table_row_key_values__value { - width: 100%; - overflow: hidden; - text-overflow: ellipsis; - white-space: initial; - padding-right: 10px; -} diff --git a/DKBFrontEnd/vendor/styles/templates/_organization.scss b/DKBFrontEnd/vendor/styles/templates/_organization.scss deleted file mode 100644 index 01707a34f..000000000 --- a/DKBFrontEnd/vendor/styles/templates/_organization.scss +++ /dev/null @@ -1,52 +0,0 @@ -.ontodia-organization-template { - border: 2px solid; - max-width: 400px; - border-radius: 2px; - - &__properties { - width: 100%; - } -} - -.ontodia-organization-template_body { - height: 100%; - border-radius: 2px; - padding: 3px 12px 3px 12px; - background: white; - display: flex; - align-items: stretch; - justify-content: space-between; - overflow: hidden; - flex-direction: column; -} - -.ontodia-organization-template_body__logo { - position: inherit !important; - font-size: x-large; - margin: 5px 0px; - border: 1px solid; - padding: 5px 6px; - flex-grow: 1; - display: flex; - justify-content: center; - align-items: center; -} - -.ontodia-organization-template_body_data { - flex-grow: 1; -} - -.ontodia-organization-template_body_data__types { - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - font-size: 12px; - font-weight: 100; -} - -.ontodia-organization-template_body_data__label { - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - margin-bottom: 0px; -} diff --git a/DKBFrontEnd/vendor/styles/templates/_person.scss b/DKBFrontEnd/vendor/styles/templates/_person.scss deleted file mode 100644 index 2defcebcf..000000000 --- a/DKBFrontEnd/vendor/styles/templates/_person.scss +++ /dev/null @@ -1,170 +0,0 @@ -.ontodia-person-container { - max-width: 400px; - float: left; -} - -.ontodia-person-template { - border-radius: 10px; - border-style: solid; - border-width: 1px; -} - -.ontodia-person-template_body { - margin-left: 13px; - border-radius: 3px; - border-top-right-radius: 10px; - border-bottom-right-radius: 10px; - border-left-style: solid; - border-left-width: 1px; - padding: 3px 12px 3px 0px; - background: white; - display: flex; - align-items: center; - justify-content: space-between; - overflow: hidden; -} - -.ontodia-person-template_body_main-part__label { - font-size: 19px; - white-space: nowrap; - font-weight: 100; - margin-bottom: -7px; - width: 100%; - overflow: hidden; - text-overflow: ellipsis; -} - -.ontodia-person-template_body_main-part_type-container { - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - font-size: 11px; - font-style: italic; - color: #afafaf; - font-weight: 100; - display: flex; -} - -.ontodia-person-template_body_main-part_type-container__type { - width: 0; - flex-grow: 1; - overflow: hidden; - text-overflow: ellipsis; -} - -.ontodia-person-template_body__icon { - position: inherit !important; - font-size: 30px; - margin: 5px 10px 5px 10px; - border: 1px solid; - /*padding: 5px 6px;*/ - flex-grow: 0; -} - -.ontodia-person-template_body_photo { - position: inherit !important; - font-size: x-large; - margin: 5px 8px 5px 8px; - border: 1px solid; - flex-grow: 0; - height: 40px; -} - -.ontodia-person-template_body_photo__image { - height: 100%; -} - -.ontodia-person-template_body_main-part { - flex-grow: 1; -} - -.ontodia-person-template_property { - border-radius: 10px; - background-color: white; - margin-top: 5px; - border: 1px solid; -} - -.ontodia-person-template_property_content { - width: 100%; - padding: 9px; -} - -.ontodia-person-template_property_content_iri-line { - width: 100%; - overflow: hidden; - display: flex; -} - -.ontodia-person-template_property_content_iri-line__label { - font-size: 12px; - font-weight: 100; - margin-right: 4px; - color: #b6b6b6; -} - -.ontodia-person-template_property_content_iri-line__iri { - font-size: 12px; - width: 100%; - overflow: hidden; - white-space: nowrap; - text-overflow: ellipsis; -} - -.ontodia-person-template_property_content_iri-line__iri a { - color: #b6b6b6; -} - -.ontodia-person-template_property__image { - width: 100%; - border-top-left-radius: 10px; - border-top-right-radius: 10px; - border-bottom: 1px solid; -} - -.ontodia-person-template_property_content__hr { - margin: 5px 0px 5px 0px; -} - -.ontodia-person-template_property_content_property-table { - font-size: 15px; - font-weight: 100; - max-height: 200px; - overflow-y: scroll; - overflow-x: hidden; -} - -.ontodia-person-template_property_content_property-table_row { - white-space: nowrap; -} - -.ontodia-person-template_property_content_property-table_row__key { - display: inline-block; - width: 50%; - text-overflow: ellipsis; - overflow: hidden; - vertical-align: top; -} - -.ontodia-person-template_property_content_property-table_row_key { - display: inline-block; - width: 50%; - text-overflow: ellipsis; - overflow: hidden; - vertical-align: top; -} - -.ontodia-person-template_property_content_property-table_row_key_values { - display: inline-block; - width: 50%; - text-overflow: ellipsis; - overflow: hidden; -} - -.ontodia-person-template_property_content_property-table_row_key_values__value { - width: 100%; - overflow: hidden; - text-overflow: ellipsis; - white-space: initial; - padding-right: 10px; -} diff --git a/DKBFrontEnd/vendor/styles/viewUtils/_spinner.scss b/DKBFrontEnd/vendor/styles/viewUtils/_spinner.scss deleted file mode 100644 index 99f5d8232..000000000 --- a/DKBFrontEnd/vendor/styles/viewUtils/_spinner.scss +++ /dev/null @@ -1,17 +0,0 @@ -.ontodia-spinner { - &__arrow { - animation-name: ontodia-spinner-rotation; - animation-duration: 1.5s; - animation-timing-function: cubic-bezier(0.645, 0.045, 0.355, 1); - animation-iteration-count: infinite; - } - - &[data-error='true'] &__arrow { - animation-iteration-count: 1; - } -} - -@keyframes ontodia-spinner-rotation { - 0% { transform: rotate(0deg); } - 100% { transform: rotate(360deg); } -} diff --git a/DKBFrontEnd/vendor/styles/widgets/_classTree.scss b/DKBFrontEnd/vendor/styles/widgets/_classTree.scss deleted file mode 100644 index 5fee685b5..000000000 --- a/DKBFrontEnd/vendor/styles/widgets/_classTree.scss +++ /dev/null @@ -1,44 +0,0 @@ -.ontodia-class-tree { - flex: auto; - display: flex; - flex-direction: column; - - &__filter { - flex-shrink: 0; - margin: 10px 0 10px 0; - } - - &__filter-group { - margin-left: 10px; - margin-right: 10px; - } - - &__rest { - height: 0; - flex-grow: 1; - overflow-y: scroll; - border-top: 1px solid rgb(221, 221, 221); - } - - .jstree-icon.default-tree-icon::after { - content: url("../images/tree-leaf.png"); - max-width: 19px; - max-height: 19px; - margin: 2px; - } - - .ontodia-icon { - display: inline-block; - width: 1em; - height: 1em; - background-size: auto 100%; - vertical-align: middle; - } - - .jstree-icon.parent-tree-icon::after { - content: url("../images/tree-leaf-folder.png"); - max-width: 19px; - max-height: 19px; - margin: 2px; - } -} diff --git a/DKBFrontEnd/vendor/styles/widgets/_instancesSearch.scss b/DKBFrontEnd/vendor/styles/widgets/_instancesSearch.scss deleted file mode 100644 index c7ecff205..000000000 --- a/DKBFrontEnd/vendor/styles/widgets/_instancesSearch.scss +++ /dev/null @@ -1,73 +0,0 @@ -.ontodia-instances-search { - flex: auto; - display: flex; - flex-direction: column; - - &__criteria { - flex-shrink: 0; - margin: 10px 0 10px 0; - } - - &__criterions { - padding-left: 15px; - margin-bottom: 10px; - &:empty { margin-bottom: 0; } - } - - &__criterion { - display: block; - position: relative; - width: 100%; - } - - &__criterion-class { - border: black 1px dashed; - background: rgb(255, 210, 33); - padding: 0 .5em 0 .5em; - word-wrap: break-word; - } - - &__criterion-element { - border: black 1px dashed; - background: rgb(255, 131, 92); - padding: 0 .5em 0 .5em; - word-wrap: break-word; - } - - &__criterion-link-type { - border: black 1px dashed; - background: rgb(202, 255, 206); - padding: 0 .5em 0 .5em; - word-wrap: break-word; - } - - &__criterion-remove { - float: right; - margin: 0 10px 4px 4px; - } - - &__text-criteria { margin: 0 10px; } - - &__rest { - height: 0; - flex-grow: 1; - overflow-y: scroll; - border-top: 1px solid rgb(221, 221, 221); - } - - &__results { - padding-left: 0; - padding-top: 10px; - margin: 0 10px 0 10px; - } - - &[data-state='finished'] &__results:empty:before { - content: 'No items correspond to the specified criteria.'; - font-style: italic; - } - - &__rest-end { margin: 5px 10px 15px 10px; } - &__load-more { - width: 100%; - } -} diff --git a/DKBFrontEnd/vendor/styles/widgets/_linksToolbox.scss b/DKBFrontEnd/vendor/styles/widgets/_linksToolbox.scss deleted file mode 100644 index 09a553df7..000000000 --- a/DKBFrontEnd/vendor/styles/widgets/_linksToolbox.scss +++ /dev/null @@ -1,136 +0,0 @@ -.link-types-toolbox { - flex: auto; - display: flex; - flex-direction: column; - margin-bottom: 0; - - &__heading { - padding: 10px; - } - - &__searching-box { - display: flex; - align-items: center; - } - - &__clearSearch { - margin-left: -25px; - -webkit-appearance: none; - padding: 0; - cursor: pointer; - background: 0 0; - border: 0; - } - - &__switch-all { - margin-top: 5px; - } - - &__rest { - border-top: 1px solid #dddddd; - flex: auto; - display: flex; - flex-direction: column; - } -} - -.link-types-toolbox .panel-heading { - flex-shrink: 0; - -webkit-flex-shrink: 0; /* safari 8 */ -} -.link-types-toolbox .link-lists { - flex: auto; - height: 0; - overflow-y: scroll; -} -.link-types-toolbox ul { - margin-bottom: 0; -} -.link-types-toolbox .links-heading { - margin-left: .4em; -} -.link-types-toolbox .links-heading span { - border: black 1px dashed; - background: rgb(255, 131, 92); - padding: 0 .5em 0 .5em; - word-wrap: break-word; - line-height: 1.3; -} - -.link-types-toolbox__heading .link-types-toolbox-controls { - padding: 5px 15px; - font-size: 14px; - font-style: italic; -} -.link-types-toolbox__heading .link-types-toolbox-controls > span { - padding-left: .3em; -} - -.list-group .linkInToolBox { - padding: 0 0 0 5px; - word-break: break-word; -} -.linkInToolBox > div { - display: inline; -} -.linkInToolBox .label { - margin-left: .5em; - white-space: normal; - word-wrap: normal; -} - -.linkInToolBox .badge { - display: none; - margin-left: .5em; - white-space: normal; - word-wrap: normal; -} -.connected-links .linkInToolBox .badge { - /* show connection count badge only in "Connected to Element" list */ - display: inline; -} -.linkInToolBox .link-title { - font-size: 16px; - color: black; - display: inline; -} -.linkInToolBox .btn-group { - float: left; - margin-top: 2px; - margin-right: 6px; - margin-bottom: 2px; -} -.linkInToolBox .btn.btn-default { - border-color: rgb(195, 195, 195); -} -.linkInToolBox .filter-button { - display: none; - float: right; - margin: 3px; - cursor: pointer; - opacity: 0.4; - transition: opacity 200ms 0ms; -} -.linkInToolBox:hover .filter-button { - opacity: 1.0; - transition: opacity 200ms 0ms; -} -.connected-links .linkInToolBox .filter-button { - /* show filter button only in "Connected to Element" list */ - display: inline; -} -.linkInToolBox .filter-button img { - content: url("../images/add-to-filter.png"); - width: 20px; - height: 20px; -} -.link-in-popup-menu .filter-button img { - opacity: 0.4; - margin-left: 10px; - content: url("../images/add-to-filter.png"); - width: 20px; - height: 20px; -} -.link-in-popup-menu .filter-button img:hover { - opacity: 1; -} diff --git a/DKBFrontEnd/vendor/styles/widgets/_listElementView.scss b/DKBFrontEnd/vendor/styles/widgets/_listElementView.scss deleted file mode 100644 index b1397c596..000000000 --- a/DKBFrontEnd/vendor/styles/widgets/_listElementView.scss +++ /dev/null @@ -1,25 +0,0 @@ -.ontodia-list-element-view { - display: block; - background: #808080; - padding: 1px 1px 1px 20px; - border-radius: 10px; - margin: 0 0 2px 0; - opacity: 1.0; - cursor: move; - - &--disabled { - opacity: 0.4; - cursor: default; - } - - &__label { - background: white; - border-radius: 10px; - font-family: "Andale Mono", sans-serif; - font-size: 15px; - min-height: 1.3em; - padding-left: 7px; - padding-right: 5px; - overflow-wrap: break-word; - } -} diff --git a/DKBFrontEnd/vendor/styles/widgets/_progress.scss b/DKBFrontEnd/vendor/styles/widgets/_progress.scss deleted file mode 100644 index cf9a87973..000000000 --- a/DKBFrontEnd/vendor/styles/widgets/_progress.scss +++ /dev/null @@ -1,27 +0,0 @@ -.stateBasedProgress .progress { - flex-shrink: 0; - -webkit-flex-shrink: 0; /* safari 8 */ - width: 100%; - border-radius: 0; - margin-bottom: 0; -} - -.stateBasedProgress:not([data-state]) .progress { - height: 0; -} - -.stateBasedProgress[data-state='querying'] .progress, -.stateBasedProgress[data-state='error'] .progress { - /* property name | duration | delay */ - transition: height 300ms 300ms; -} - -.stateBasedProgress[data-state='error'] .progress-bar { - background-color: #E72F2F; -} - -.stateBasedProgress[data-state='finished'] .progress { - height: 0; - /* property name | duration | delay */ - transition: height 200ms 0ms; -} diff --git a/DKBFrontEnd/vendor/styles/widgets/_toolbar.scss b/DKBFrontEnd/vendor/styles/widgets/_toolbar.scss deleted file mode 100644 index 310da42fb..000000000 --- a/DKBFrontEnd/vendor/styles/widgets/_toolbar.scss +++ /dev/null @@ -1,23 +0,0 @@ -.ontodia-toolbar { - &__language-selector { - padding: 5px; - margin-top: 4px; - - > label > span { vertical-align: middle; } - } -} - -.ontodia-toolbar { - background: rgba(0, 0, 0, 0.15); -} -.ontodia-toolbar > .btn-group { - margin-left: 10px; -} -.ontodia-toolbar > .btn-group > button { - margin-top: 5px; - margin-bottom: 5px; -} -.ontodia-toolbar .ontodia-toolbar__undo, -.ontodia-toolbar .ontodia-toolbar__redo { - display: none; -} diff --git a/DKBFrontEnd/vendor/styles/workspace/_accordion.scss b/DKBFrontEnd/vendor/styles/workspace/_accordion.scss deleted file mode 100644 index 63b769599..000000000 --- a/DKBFrontEnd/vendor/styles/workspace/_accordion.scss +++ /dev/null @@ -1,81 +0,0 @@ -.ontodia-accordion { - flex: auto; - flex-direction: column; - height: 100%; - - &:not(&--resizing) .ontodia-accordion-item { - transition: height 0.3s ease-in-out; - } -} - -.ontodia-accordion-item { - display: flex; - flex-direction: column; - position: relative; - border-top: 1px solid lightgray; - - &__handle { - position: absolute; - height: 5px; - bottom: -2.5px; - left: 0; - width: 100%; - z-index: 2; - cursor: ns-resize; - } - - &__inner { - flex: auto; - display: flex; - flex-direction: column; - overflow: hidden; - } - - &__body { - flex: auto; - display: flex; - flex-direction: column; - } - - &__header { - padding-left: 20px; - position: relative; - - flex-shrink: 0; - font-size: 16px; - background: #E4E4E4; - cursor: default; - /* unselectable */ - -webkit-touch-callout: none; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - - &:before { - border-top: 6px solid #555555; - border-left: 3.5px solid transparent; - border-right: 3.5px solid transparent; - content: ""; - position: absolute; - top: 50%; - left: 7px; - margin-top: -3px; - - -webkit-transition: 0.1s; - -moz-transition: 0.1s; - transition: 0.1s; - } - } - - &--collapsed &__header:before { - -webkit-transform: rotate(-90deg); - -moz-transform: rotate(-90deg); - -ms-transform: rotate(-90deg); - transform: rotate(-90deg); - } - - &--collapsed &__body { - display: none; - } -} diff --git a/DKBFrontEnd/vendor/styles/workspace/_resizableSidebar.scss b/DKBFrontEnd/vendor/styles/workspace/_resizableSidebar.scss deleted file mode 100644 index d88b3df36..000000000 --- a/DKBFrontEnd/vendor/styles/workspace/_resizableSidebar.scss +++ /dev/null @@ -1,73 +0,0 @@ -.ontodia-drag-resizable-column { - display: flex; - flex-direction: column; - position: relative; - - &__handle { - background: #fff url("../images/resizable-column-handle.png") repeat; - height: 100%; - position: absolute; - top: 0; - width: 8px; - z-index: 2; - -webkit-transition: 0.3s; - -moz-transition: 0.3s; - transition: 0.3s; - cursor: ew-resize; - } - - &__handle-btn { - background: #eee; - cursor: pointer; - height: 40px; - position: absolute; - top: 50%; - left: 0; - margin-top: -20px; - width: 100%; - z-index: 1; - -webkit-transition: 0.3s; - -moz-transition: 0.3s; - transition: 0.3s; - - &::before { - background-position: 0 0 ; - background-repeat: no-repeat; - background-size: cover; - content: ""; - height: 6px; - position: absolute; - top: 50%; - left: 50%; - margin-top: -3px; - margin-left: -3px; - width: 6px; - -webkit-transition: 0.3s; - -moz-transition: 0.3s; - transition: 0.3s; - } - - &:hover { - background: #b3b3b3; - transform: scale(1.2); - } - } - - &--closed &__handle-btn { - &::before { transform: rotate(180deg); } - } - - &--docked-left { margin-right: 8px; } - &--docked-left &__handle { right: -8px; } - &--docked-left &__handle-btn { - &::before { background-image: url("../images/arrow-left.png"); } - &:hover::before { background-image: url("../images/arrow-left1.png"); } - } - - &--docked-right { margin-left: 8px; } - &--docked-right &__handle { left: -8px; } - &--docked-right &__handle-btn { - &::before { background-image: url("../images/arrow-right.png"); } - &:hover::before { background-image: url("../images/arrow-right1.png"); } - } -} diff --git a/DKBFrontEnd/vendor/styles/workspace/_workspace.scss b/DKBFrontEnd/vendor/styles/workspace/_workspace.scss deleted file mode 100644 index e4fde793f..000000000 --- a/DKBFrontEnd/vendor/styles/workspace/_workspace.scss +++ /dev/null @@ -1,36 +0,0 @@ -.ontodia { - display: flex; - flex-direction: column; - height: 100%; - box-sizing: border-box; - - &__header { - display: flex; - flex-direction: column; - flex: 0 0 auto; - } - - &__workspace { - display: flex; - flex: auto; - overflow: hidden; - } - - &__main-panel { - display: flex; - flex: auto; - overflow: hidden; - width: 0; - } - - &--unselectable { - -webkit-touch-callout: none; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - } - - &--horizontal-resizing * { cursor: ew-resize !important; } - &--vertical-resizing * { cursor: ns-resize !important; } -} diff --git a/DKBFrontEnd/vendor/tsconfig.json b/DKBFrontEnd/vendor/tsconfig.json deleted file mode 100644 index 8f76ebd97..000000000 --- a/DKBFrontEnd/vendor/tsconfig.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "compilerOptions": { - "target": "es5", - "module": "commonjs", - "jsx": "react", - "lib": [ - "dom", - "es2015" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "noImplicitReturns": true - }, - "include": [ - "./index.ts", - "./src/**/*.ts", - "./src/**/*.tsx", - "./typings/index.d.ts", - "./typings/local.d.ts" - ], - "compileOnSave": false -} diff --git a/DKBFrontEnd/vendor/tslint.json b/DKBFrontEnd/vendor/tslint.json deleted file mode 100644 index 601f87a24..000000000 --- a/DKBFrontEnd/vendor/tslint.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "rules": { - "class-name": true, - "comment-format": [true, "check-space"], - "curly": true, - "eofline": true, - "forin": true, - "indent": [true, "spaces"], - "label-position": true, - "label-undefined": true, - "max-line-length": [true, 120], - "member-access": false, - "member-ordering": [false, "public-before-private", "static-before-instance", "variables-before-functions"], - "no-arg": true, - "no-bitwise": true, - "no-console": [true, "debug", "info", "time", "timeEnd", "trace"], - "no-construct": true, - "no-debugger": true, - "no-duplicate-key": true, - "no-duplicate-variable": true, - "no-empty": true, - "no-eval": true, - "no-inferrable-types": true, - "no-shadowed-variable": true, - "no-string-literal": false, - "no-switch-case-fall-through": true, - "no-trailing-whitespace": true, - "no-unused-expression": true, - "no-unused-variable": true, - "no-unreachable": true, - "no-use-before-declare": true, - "no-var-keyword": true, - "object-literal-sort-keys": false, - "one-line": [true, - "check-open-brace", - "check-catch", - "check-else", - "check-finally", - "check-whitespace" - ], - "quotemark": [true, "single", "avoid-escape"], - "radix": true, - "semicolon": [true, "always"], - "trailing-comma": [true, - { - "singleline": "never", - "multiline": "always" - }], - "triple-equals": [true, "allow-null-check"], - "typedef-whitespace": [true, - { - "call-signature": "nospace", - "index-signature": "nospace", - "parameter": "nospace", - "property-declaration": "nospace", - "variable-declaration": "nospace" - }, { - "call-signature": "onespace", - "index-signature": "onespace", - "parameter": "onespace", - "property-declaration": "onespace", - "variable-declaration": "onespace" - }], - "variable-name": false, - "whitespace": [true, "check-branch", "check-decl", "check-operator", "check-separator", "check-type"] - } -} diff --git a/DKBFrontEnd/vendor/typings/README b/DKBFrontEnd/vendor/typings/README deleted file mode 100644 index 4396d8333..000000000 --- a/DKBFrontEnd/vendor/typings/README +++ /dev/null @@ -1,9 +0,0 @@ -See https://github.com/Microsoft/TypeScript-Handbook/blob/master/pages/declaration%20files/Library%20Structures.md -for declaration files authoring. - -/globals - global libraries installed from Typings -/modules - modular libraries installed from Typings -/local - global libraries authored by us -/local-modules - modular libraries authored by us - -Important: modular libraries should follow pattern {library-name}/index.d.ts diff --git a/DKBFrontEnd/vendor/typings/globals/jstree/index.d.ts b/DKBFrontEnd/vendor/typings/globals/jstree/index.d.ts deleted file mode 100644 index a691ccb4c..000000000 --- a/DKBFrontEnd/vendor/typings/globals/jstree/index.d.ts +++ /dev/null @@ -1,1909 +0,0 @@ -// Generated by typings -// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/00dd9a1cf6c5b748d51e6d470ce6117bb383ea6c/jstree/jstree.d.ts -interface JQueryStatic { - /** - * holds all jstree related functions and variables, - * including the actual class and methods to create, - * access and manipulate instances. - * @property jstree - * @type {JSTreeStatic} - */ - jstree?: JSTreeStatic; -} - -interface JQuery { - /** - * Create an instance, get an instance or invoke a command on a instance. - * - * If there is no instance associated with the current node a new one is created - * and `arg` is used to extend `$.jstree.defaults` for this new instance. There would be no return value (chaining is not broken). - * - * If there is an existing instance and `arg` is a string the command specified by `arg` is executed on the instance, - * with any additional arguments passed to the function. If the function returns a value it will be returned (chaining could break depending on function). - * - * If there is an existing instance and `arg` is not a string the instance itself is returned (similar to `$.jstree.reference`). - * - * In any other case - nothing is returned and chaining is not broken. - * - * __Examples__ - * - * $('#tree1').jstree(); // creates an instance - * $('#tree2').jstree({ plugins : [] }); // create an instance with some options - * $('#tree1').jstree('open_node', '#branch_1'); // call a method on an existing instance, passing additional arguments - * $('#tree2').jstree(); // get an existing instance (or create an instance) - * $('#tree2').jstree(true); // get an existing instance (will not create new instance) - * $('#branch_1').jstree().select_node('#branch_1'); // get an instance (using a nested element and call a method) - * - * @name $().jstree([arg]) - * @param {String|Object} arg - * @return {Mixed} - */ - jstree(): JSTree; - jstree(options: JSTreeStaticDefaults): JSTree; - jstree(arg: boolean): JSTree; - jstree(...args: any[]): any; -} - -interface JSTreeStatic { - /** - * specifies the jstree version in use - * @name $.jstree.version - */ - version: string; - - /** - * holds all the default options used when creating new instances - * @name $.jstree.defaults - */ - defaults: JSTreeStaticDefaults; - - /** - * stores all loaded jstree plugins (used internally) - * @name $.jstree.plugins - */ - plugins: any[]; - path: string; - idregex: any; - root: string; - - /** - * creates a jstree instance - * @name $.jstree.create(el [, options]) - * @param {DOMElement|jQuery|String} el the element to create the instance on, can be jQuery extended or a selector - * @param {Object} options options for this instance (extends `$.jstree.defaults`) - * @return {jsTree} the new instance - */ - create(el: HTMLElement|JQuery|string, options?: JSTreeStaticDefaults): JSTree; - - /** - * remove all traces of jstree from the DOM and destroy all instances - * @name $.jstree.destroy() - */ - destroy(): void; - - /** - * the jstree class constructor, used only internally - * @private - * @name $.jstree.core(id) - * @param {Number} id this instance's index - */ - core(id: number): void; - - /** - * get a reference to an existing instance - * - * __Examples__ - * - * // provided a container with an ID of "tree", and a nested node with an ID of "branch" - * // all of there will return the same instance - * $.jstree.reference('tree'); - * $.jstree.reference('#tree'); - * $.jstree.reference($('#tree')); - * $.jstree.reference(document.getElementByID('tree')); - * $.jstree.reference('branch'); - * $.jstree.reference('#branch'); - * $.jstree.reference($('#branch')); - * $.jstree.reference(document.getElementByID('branch')); - * - * @name $.jstree.reference(needle) - * @param {DOMElement|jQuery|String} needle - * @return {jsTree|null} the instance or `null` if not found - */ - reference(needle: HTMLElement|JQuery|string): JSTree; -} - -interface JSTreeStaticDefaults { - /** - * configure which plugins will be active on an instance. - * Should be an array of strings, where each element is a plugin name. - * The default is `[]` - * @name $.jstree.defaults.plugins - */ - plugins: string[]; - - /** - * stores all defaults for the core - * @name $.jstree.defaults.core - */ - core: JSTreeStaticDefaultsCore; - - /** - * stores all defaults for the checkbox plugin - */ - checkbox?: JSTreeStaticDefaultsCheckbox; - - /** - * stores all defaults for the contextmenu plugin - */ - contextmenu?: JSTreeStaticDefaultsContextMenu; - - /** - * stores all defaults for the drag'n'drop plugin - */ - dnd?: JSTreeStaticDefaultsDragNDrop; - - /** - * Adds massload functionality to jsTree, so that multiple nodes can be loaded in a single request (only useful with lazy loading). - */ - massload?: JSTreeStaticDefaultsMassload; - - /** - * stores all defaults for the search plugin - */ - search?: JSTreeStaticDefaultsSearch; - - /** - * the settings function used to sort the nodes. - * It is executed in the tree's context, accepts two nodes as arguments and should return `1` or `-1`. - * @name $.jstree.defaults.sort - * @plugin sort - */ - sort?: (x: any, y: any) => number; - - /** - * stores all defaults for the state plugin - */ - state?: JSTreeStaticDefaultsState; - - /** - * An object storing all types as key value pairs, - * where the key is the type name and the value is an object - * that could contain following keys (all optional). - * max_children the maximum number of immediate children this node type can have. - * Do not specify or set to -1 for unlimited. - * max_depth the maximum number of nesting this node type can have. - * A value of 1 would mean that the node can have children, but no grandchildren. - * Do not specify or set to -1 for unlimited. - * valid_children an array of node type strings, that nodes of this type can have as children. - * Do not specify or set to -1 for no limits. - * icon a string - can be a path to an icon or a className, if using an image - * that is in the current directory use a ./ prefix, otherwise it will be detected as a class. - * Omit to use the default icon from your theme. - * There are two predefined types: - * # represents the root of the tree, for example max_children would control the maximum number of root nodes. - * default represents the default node - any settings here will be applied to all nodes that do not have a type specified. - */ - types?: any; - - /** - * stores all defaults for the unique plugin - * @name $.jstree.defaults.unique - * @plugin unique - */ - unique?: JSTreeStaticDefaultsUnique; -} - -interface JSTreeStaticDefaultsCore { - /** - * data configuration - * - * If left as `false` the HTML inside the jstree container element is used to populate the tree (that should be an unordered list with list items). - * - * You can also pass in a HTML string or a JSON array here. - * - * It is possible to pass in a standard jQuery-like AJAX config and jstree will automatically determine if the response is JSON or HTML and use that to populate the tree. - * In addition to the standard jQuery ajax options here you can suppy functions for `data` and `url`, the functions will be run in the current instance's scope and a param will be passed indicating which node is being loaded, the return value of those functions will be used. - * - * The last option is to specify a function, that function will receive the node being loaded as argument and a second param which is a function which should be called with the result. - * - * __Examples__ - * - * // AJAX - * $('#tree').jstree({ - * 'core' : { - * 'data' : { - * 'url' : '/get/children/', - * 'data' : function (node) { - * return { 'id' : node.id }; - * } - * } - * }); - * - * // direct data - * $('#tree').jstree({ - * 'core' : { - * 'data' : [ - * 'Simple root node', - * { - * 'id' : 'node_2', - * 'text' : 'Root node with options', - * 'state' : { 'opened' : true, 'selected' : true }, - * 'children' : [ { 'text' : 'Child 1' }, 'Child 2'] - * } - * ] - * }); - * - * // function - * $('#tree').jstree({ - * 'core' : { - * 'data' : function (obj, callback) { - * callback.call(this, ['Root 1', 'Root 2']); - * } - * }); - * - * @name $.jstree.defaults.core.data - */ - data?: any; - - /** - * configure the various strings used throughout the tree - * - * You can use an object where the key is the string you need to replace and the value is your replacement. - * Another option is to specify a function which will be called with an argument of the needed string and should return the replacement. - * If left as `false` no replacement is made. - * - * __Examples__ - * - * $('#tree').jstree({ - * 'core' : { - * 'strings' : { - * 'Loading ...' : 'Please wait ...' - * } - * } - * }); - * - * @name $.jstree.defaults.core.strings - */ - strings?: any; - - /** - * determines what happens when a user tries to modify the structure of the tree - * If left as `false` all operations like create, rename, delete, move or copy are prevented. - * You can set this to `true` to allow all interactions or use a function to have better control. - * - * __Examples__ - * - * $('#tree').jstree({ - * 'core' : { - * 'check_callback' : function (operation, node, node_parent, node_position, more) { - * // operation can be 'create_node', 'rename_node', 'delete_node', 'move_node' or 'copy_node' - * // in case of 'rename_node' node_position is filled with the new node name - * return operation === 'rename_node' ? true : false; - * } - * } - * }); - * - * @name $.jstree.defaults.core.check_callback - */ - check_callback?: any; - - /** - * a callback called with a single object parameter in the instance's scope when something goes wrong (operation prevented, ajax failed, etc) - * @name $.jstree.defaults.core.error - */ - error: () => any; - - /** - * the open / close animation duration in milliseconds - set this to `false` to disable the animation (default is `200`) - * @name $.jstree.defaults.core.animation - */ - animation?: any; - - /** - * a boolean indicating if multiple nodes can be selected - * @name $.jstree.defaults.core.multiple - */ - multiple?: boolean; - - /** - * theme configuration object - * @name $.jstree.defaults.core.themes - */ - themes?: JSTreeStaticDefaultsCoreThemes; - - /** - * if left as `true` all parents of all selected nodes will be opened once the tree loads (so that all selected nodes are visible to the user) - * @name $.jstree.defaults.core.expand_selected_onload - */ - expand_selected_onload?: boolean; - - /** - * if left as `true` web workers will be used to parse incoming JSON data where possible, so that the UI will not be blocked by large requests. - * Workers are however about 30% slower. Defaults to `true` - * @name $.jstree.defaults.core.worker - */ - worker?: boolean; - - /** - * Force node text to plain text (and escape HTML). Defaults to `false` - * @name $.jstree.defaults.core.force_text - */ - force_text?: boolean; - - /** - * Should the node should be toggled if the text is double clicked . Defaults to `true` - * @name $.jstree.defaults.core.dblclick_toggle - */ - dblclick_toggle?: boolean; -} - -interface JSTreeStaticDefaultsCoreThemes { - /** - * the name of the theme to use (if left as `false` the default theme is used) - * @name $.jstree.defaults.core.themes.name - */ - name?: string; - - /** - * the URL of the theme's CSS file, leave this as `false` if you have manually included the theme CSS (recommended). You can set this to `true` too which will try to autoload the theme. - * @name $.jstree.defaults.core.themes.url - */ - url?: string; - - /** - * the location of all jstree themes - only used if `url` is set to `true` - * @name $.jstree.defaults.core.themes.dir - */ - dir?: string; - - /** - * a boolean indicating if connecting dots are shown - * @name $.jstree.defaults.core.themes.dots - */ - dots?: boolean; - - /** - * a boolean indicating if node icons are shown - * @name $.jstree.defaults.core.themes.icons - */ - icons?: boolean; - - /** - * a boolean indicating if the tree background is striped - * @name $.jstree.defaults.core.themes.stripes - */ - stripes?: boolean; - - /** - * a string (or boolean `false`) specifying the theme variant to use (if the theme supports variants) - * @name $.jstree.defaults.core.themes.variant - */ - variant?: any; - - /** - * a boolean specifying if a reponsive version of the theme should kick in on smaller screens (if the theme supports it). Defaults to `false`. - * @name $.jstree.defaults.core.themes.responsive - */ - responsive?: boolean; -} - -interface JSTreeStaticDefaultsCheckbox { - /** - * a boolean indicating if checkboxes should be visible (can be changed at a later time using `show_checkboxes()` and `hide_checkboxes`). Defaults to `true`. - * @name $.jstree.defaults.checkbox.visible - * @plugin checkbox - */ - visible: boolean; - - /** - * a boolean indicating if checkboxes should cascade down and have an undetermined state. Defaults to `true`. - * @name $.jstree.defaults.checkbox.three_state - * @plugin checkbox - */ - three_state: boolean; - - /** - * a boolean indicating if clicking anywhere on the node should act as clicking on the checkbox. Defaults to `true`. - * @name $.jstree.defaults.checkbox.whole_node - * @plugin checkbox - */ - whole_node: boolean; - - /** - * a boolean indicating if the selected style of a node should be kept, or removed. Defaults to `true`. - * @name $.jstree.defaults.checkbox.keep_selected_style - * @plugin checkbox - */ - keep_selected_style: boolean; - - /** - * This setting controls how cascading and undetermined nodes are applied. - * If 'up' is in the string - cascading up is enabled, if 'down' is in the string - cascading down is enabled, if 'undetermined' is in the string - undetermined nodes will be used. - * If `three_state` is set to `true` this setting is automatically set to 'up+down+undetermined'. Defaults to ''. - * @name $.jstree.defaults.checkbox.cascade - * @plugin checkbox - */ - cascade: boolean; - - /** - * This setting controls if checkbox are bound to the general tree selection - * or to an internal array maintained by the checkbox plugin. - * Defaults to `true`, only set to `false` if you know exactly what you are doing. - * @name $.jstree.defaults.checkbox.tie_selection - * @plugin checkbox - */ - tie_selection: boolean; -} - -interface JSTreeStaticDefaultsContextMenu { - /** - * a boolean indicating if the node should be selected when the context menu is invoked on it. Defaults to `true`. - * @name $.jstree.defaults.contextmenu.select_node - * @plugin contextmenu - */ - select_node: boolean; - - /** - * a boolean indicating if the menu should be shown aligned with the node. Defaults to `true`, otherwise the mouse coordinates are used. - * @name $.jstree.defaults.contextmenu.show_at_node - * @plugin contextmenu - */ - show_at_node: boolean; - - /** - * an object of actions, or a function that accepts a node and a callback function and calls the callback function with an object of actions available for that node (you can also return the items too). - * - * Each action consists of a key (a unique name) and a value which is an object with the following properties (only label and action are required). Once a menu item is activated the `action` function will be invoked with an object containing the following keys: item - the contextmenu item definition as seen below, reference - the DOM node that was used (the tree node), element - the contextmenu DOM element, position - an object with x/y properties indicating the position of the menu. - * - * * `separator_before` - a boolean indicating if there should be a separator before this item - * * `separator_after` - a boolean indicating if there should be a separator after this item - * * `_disabled` - a boolean indicating if this action should be disabled - * * `label` - a string - the name of the action (could be a function returning a string) - * * `title` - a string - an optional tooltip for the item - * * `action` - a function to be executed if this item is chosen, the function will receive - * * `icon` - a string, can be a path to an icon or a className, if using an image that is in the current directory use a `./` prefix, otherwise it will be detected as a class - * * `shortcut` - keyCode which will trigger the action if the menu is open (for example `113` for rename, which equals F2) - * * `shortcut_label` - shortcut label (like for example `F2` for rename) - * * `submenu` - an object with the same structure as $.jstree.defaults.contextmenu.items which can be used to create a submenu - each key will be rendered as a separate option in a submenu that will appear once the current item is hovered - * - * @name $.jstree.defaults.contextmenu.items - * @plugin contextmenu - */ - items: any; -} - -interface JSTreeStaticDefaultsDragNDrop { - /** - * a boolean indicating if a copy should be possible while dragging (by pressint the meta key or Ctrl). Defaults to `true`. - * @name $.jstree.defaults.dnd.copy - * @plugin dnd - */ - copy: boolean; - - /** - * a number indicating how long a node should remain hovered while dragging to be opened. Defaults to `500`. - * @name $.jstree.defaults.dnd.open_timeout - * @plugin dnd - */ - open_timeout: number; - - /** - * a function invoked each time a node is about to be dragged, invoked in the tree's scope and receives the nodes about to be dragged as an argument (array) - return `false` to prevent dragging - * @name $.jstree.defaults.dnd.is_draggable - * @plugin dnd - */ - is_draggable: boolean; - - /** - * a boolean indicating if checks should constantly be made while the user is dragging the node (as opposed to checking only on drop), default is `true` - * @name $.jstree.defaults.dnd.check_while_dragging - * @plugin dnd - */ - check_while_dragging: boolean; - - /** - * a boolean indicating if nodes from this tree should only be copied with dnd (as opposed to moved), default is `false` - * @name $.jstree.defaults.dnd.always_copy - * @plugin dnd - */ - always_copy: boolean; - - /** - * when dropping a node "inside", this setting indicates the position the node should go to - it can be an integer or a string: "first" (same as 0) or "last", default is `0` - * @name $.jstree.defaults.dnd.inside_pos - * @plugin dnd - */ - inside_pos: any; - - /** - * when starting the drag on a node that is selected this setting controls if all selected nodes are dragged or only the single node, default is `true`, which means all selected nodes are dragged when the drag is started on a selected node - * @name $.jstree.defaults.dnd.drag_selection - * @plugin dnd - */ - drag_selection: boolean; - - /** - * controls whether dnd works on touch devices. If left as boolean true dnd will work the same as in desktop browsers, which in some cases may impair scrolling. If set to boolean false dnd will not work on touch devices. There is a special third option - string "selected" which means only selected nodes can be dragged on touch devices. - * @name $.jstree.defaults.dnd.touch - * @plugin dnd - */ - touch: boolean; - - /** - * controls whether items can be dropped anywhere on the node, not just on the anchor, by default only the node anchor is a valid drop target. Works best with the wholerow plugin. If enabled on mobile depending on the interface it might be hard for the user to cancel the drop, since the whole tree container will be a valid drop target. - * @name $.jstree.defaults.dnd.large_drop_target - * @plugin dnd - */ - large_drop_target: boolean; - - /** - * controls whether a drag can be initiated from any part of the node and not just the text/icon part, works best with the wholerow plugin. Keep in mind it can cause problems with tree scrolling on mobile depending on the interface - in that case set the touch option to "selected". - * @name $.jstree.defaults.dnd.large_drag_target - * @plugin dnd - */ - large_drag_target: boolean; - - /** - * controls whether use HTML5 dnd api instead of classical. That will allow better integration of dnd events with other HTML5 controls. - * @reference http://caniuse.com/#feat=dragndrop - * @name $.jstree.defaults.dnd.use_html5 - * @plugin dnd - */ - use_html5: boolean; -} - -interface JSTreeStaticDefaultsMassload { - /** - * massload configuration - * - * It is possible to set this to a standard jQuery-like AJAX config. - * In addition to the standard jQuery ajax options here you can supply functions for `data` and `url`, the functions will be run in the current instance's scope and a param will be passed indicating which node IDs need to be loaded, the return value of those functions will be used. - * - * You can also set this to a function, that function will receive the node IDs being loaded as argument and a second param which is a function (callback) which should be called with the result. - * - * Both the AJAX and the function approach rely on the same return value - an object where the keys are the node IDs, and the value is the children of that node as an array. - * - * { - * "id1" : [{ "text" : "Child of ID1", "id" : "c1" }, { "text" : "Another child of ID1", "id" : "c2" }], - * "id2" : [{ "text" : "Child of ID2", "id" : "c3" }] - * } - * - * @name $.jstree.defaults.massload - * @plugin massload - */ - - url: any; - - data: any; -} - -interface JSTreeStaticDefaultsSearch { - /** - * a jQuery-like AJAX config, which jstree uses if a server should be queried for results. - * - * A `str` (which is the search string) parameter will be added with the request, - * an optional `inside` parameter will be added if the search is limited to a node id. - * The expected result is a JSON array with nodes that need to be opened so that matching nodes will be revealed. - * Leave this setting as `false` to not query the server. You can also set this to a function, - * which will be invoked in the instance's scope and receive 3 parameters - the search string, - * the callback to call with the array of nodes to load, and the optional node ID to limit the search to - * @name $.jstree.defaults.search.ajax - * @plugin search - */ - ajax: any; - - /** - * Indicates if the search should be fuzzy or not (should `chnd3` match `child node 3`). Default is `true`. - * @name $.jstree.defaults.search.fuzzy - * @plugin search - */ - fuzzy: boolean; - - /** - * Indicates if the search should be case sensitive. Default is `false`. - * @name $.jstree.defaults.search.case_sensitive - * @plugin search - */ - case_sensitive: boolean; - - /** - * Indicates if the tree should be filtered (by default) to show only matching nodes - * (keep in mind this can be a heavy on large trees in old browsers). - * This setting can be changed at runtime when calling the search method. Default is `false`. - * @name $.jstree.defaults.search.show_only_matches - * @plugin search - */ - show_only_matches: boolean; - - /** - * Indicates if the children of matched element are shown (when show_only_matches is true) - * This setting can be changed at runtime when calling the search method. Default is `false`. - * @name $.jstree.defaults.search.show_only_matches_children - * @plugin search - */ - show_only_matches_children: boolean; - - /** - * Indicates if all nodes opened to reveal the search result, - * should be closed when the search is cleared or a new search is performed. Default is `true`. - * @name $.jstree.defaults.search.close_opened_onclear - * @plugin search - */ - close_opened_onclear: boolean; - - /** - * Indicates if only leaf nodes should be included in search results. Default is `false`. - * @name $.jstree.defaults.search.search_leaves_only - * @plugin search - */ - search_leaves_only: boolean; - - /** - * If set to a function it wil be called in the instance's scope with two arguments - - * search string and node (where node will be every node in the structure, so use with caution). - * If the function returns a truthy value the node will be considered a match - * (it might not be displayed if search_only_leaves is set to true and the node is not a leaf). Default is `false`. - * @name $.jstree.defaults.search.search_callback - * @plugin search - */ - search_callback: any; -} - -interface JSTreeStaticDefaultsState { - /** - * A string for the key to use when saving the current tree (change if using multiple trees in your project). Defaults to `jstree`. - * @name $.jstree.defaults.state.key - * @plugin state - */ - key: string; - - /** - * A space separated list of events that trigger a state save. Defaults to `changed.jstree open_node.jstree close_node.jstree`. - * @name $.jstree.defaults.state.events - * @plugin state - */ - events: string; - - /** - * Time in milliseconds after which the state will expire. Defaults to 'false' meaning - no expire. - * @name $.jstree.defaults.state.ttl - * @plugin state - */ - ttl: any; - - /** - * A function that will be executed prior to restoring state with one argument - the state object. Can be used to clear unwanted parts of the state. - * @name $.jstree.defaults.state.filter - * @plugin state - */ - filter: any; -} - -interface JSTreeStaticDefaultsUnique { - /** - * Indicates if the comparison should be case sensitive. Default is `false`. - * @name $.jstree.defaults.unique.case_sensitive - * @plugin unique - */ - case_sensitive: boolean; - /** - * A callback executed in the instance's scope when a new node is created - * and the name is already taken, the two arguments are the conflicting name and the counter. - * The default will produce results like `New node (2)`. - * @name $.jstree.defaults.unique.duplicate - * @plugin unique - */ - duplicate: (name: string, counter: number) => string; -} - -interface JSTree extends JQuery { - /** - * used to decorate an instance with a plugin. Used internally. - * @private - * @name plugin(deco [, opts]) - * @param {String} deco the plugin to decorate with - * @param {Object} opts options for the plugin - * @return {jsTree} - */ - plugin: (deco: string, opts?: any) => JSTree; - - /** - * used to decorate an instance with a plugin. Used internally. - * @private - * @name init(el, options) - * @param {DOMElement|jQuery|String} el the element we are transforming - * @param {Object} options options for this instance - * @trigger init.jstree, loading.jstree, loaded.jstree, ready.jstree, changed.jstree - */ - init: (el: HTMLElement|JQuery|string, options:any) => void; - - /** - * destroy an instance - * @name destroy() - * @param {Boolean} keep_html if not set to `true` the container will be emptied, otherwise the current DOM elements will be kept intact - */ - destroy: (keep_html?: boolean) => void; - - /** - * part of the destroying of an instance. Used internally. - * @private - * @name teardown() - */ - teardown: () => void; - - /** - * bind all events. Used internally. - * @private - * @name bind() - */ - bind: () => any; - - /** - * part of the destroying of an instance. Used internally. - * @private - * @name unbind() - */ - unbind: () => any; - - /** - * trigger an event. Used internally. - * @private - * @name trigger(ev [, data]) - * @param {String} ev the name of the event to trigger - * @param {Object} data additional data to pass with the event - */ - /* - * defined in JQuery - */ - // trigger: (ev: string, data?: Object) => any; - - /** - * returns the jQuery extended instance container - * @name get_container() - * @return {jQuery} - */ - get_container: () => JQuery; - - /** - * returns the jQuery extended main UL node inside the instance container. Used internally. - * @private - * @name get_container_ul() - * @return {jQuery} - */ - get_container_ul: () => JQuery; - - /** - * gets string replacements (localization). Used internally. - * @private - * @name get_string(key) - * @param {String} key - * @return {String} - */ - get_string: (key: string) => string; - - /** - * gets the first child of a DOM node. Used internally. - * @private - * @name _firstChild(dom) - * @param {DOMElement} dom - * @return {DOMElement} - */ - _firstChild: (dom: HTMLElement) => HTMLElement; - - /** - * gets the next sibling of a DOM node. Used internally. - * @private - * @name _nextSibling(dom) - * @param {DOMElement} dom - * @return {DOMElement} - */ - _nextSibling: (dom: HTMLElement) => HTMLElement; - - /** - * gets the previous sibling of a DOM node. Used internally. - * @private - * @name _previousSibling(dom) - * @param {DOMElement} dom - * @return {DOMElement} - */ - _previousSibling: (dom: HTMLElement) => HTMLElement; - - /** - * get the JSON representation of a node (or the actual jQuery extended DOM node) by using any input (child DOM element, ID string, selector, etc) - * @name get_node(obj [, as_dom]) - * @param {mixed} obj - * @param {Boolean} as_dom - * @return {Object|jQuery} - */ - get_node: (obj: any, as_dom?: boolean) => any; - - /** - * get the path to a node, either consisting of node texts, or of node IDs, optionally glued together (otherwise an array) - * @name get_path(obj [, glue, ids]) - * @param {mixed} obj the node - * @param {String} glue if you want the path as a string - pass the glue here (for example '/'), if a falsy value is supplied here, an array is returned - * @param {Boolean} ids if set to true build the path using ID, otherwise node text is used - * @return {mixed} - */ - get_path: (obj: any, glue?: string, ids?: boolean) => any; - - /** - * get the next visible node that is below the `obj` node. If `strict` is set to `true` only sibling nodes are returned. - * @name get_next_dom(obj [, strict]) - * @param {mixed} obj - * @param {Boolean} strict - * @return {jQuery} - */ - get_next_dom: (obj: any, strict?: boolean) => JQuery; - - /** - * get the previous visible node that is above the `obj` node. If `strict` is set to `true` only sibling nodes are returned. - * @name get_prev_dom(obj [, strict]) - * @param {mixed} obj - * @param {Boolean} strict - * @return {jQuery} - */ - get_prev_dom: (obj: any, strict?: boolean) => JQuery; - - /** - * get the parent ID of a node - * @name get_parent(obj) - * @param {mixed} obj - * @return {String} - */ - get_parent: (obj: any) => string; - - /** - * get a jQuery collection of all the children of a node (node must be rendered) - * @name get_children_dom(obj) - * @param {mixed} obj - * @return {jQuery} - */ - get_children_dom: (obj: any) => JQuery; - - /** - * checks if a node has children - * @name is_parent(obj) - * @param {mixed} obj - * @return {Boolean} - */ - is_parent: (obj: any) => boolean; - - /** - * checks if a node is loaded (its children are available) - * @name is_loaded(obj) - * @param {mixed} obj - * @return {Boolean} - */ - is_loaded: (obj: any) => boolean; - - /** - * check if a node is currently loading (fetching children) - * @name is_loading(obj) - * @param {mixed} obj - * @return {Boolean} - */ - is_loading: (obj: any) => boolean; - - /** - * check if a node is opened - * @name is_open(obj) - * @param {mixed} obj - * @return {Boolean} - */ - is_open: (obj: any) => boolean; - - /** - * check if a node is in a closed state - * @name is_closed(obj) - * @param {mixed} obj - * @return {Boolean} - */ - is_closed: (obj: any) => boolean; - - /** - * check if a node has no children - * @name is_leaf(obj) - * @param {mixed} obj - * @return {Boolean} - */ - is_leaf: (obj: any) => boolean; - - /** - * loads a node (fetches its children using the `core.data` setting). Multiple nodes can be passed to by using an array. - * @name load_node(obj [, callback]) - * @param {mixed} obj - * @param {function} callback a function to be executed once loading is conplete, the function is executed in the instance's scope - * and receives two arguments - the node and a boolean status - * @return {Boolean} - * @trigger load_node.jstree - */ - load_node: (obj: any, callback: (node: any, status: boolean) => void) => boolean; - - /** - * load an array of nodes (will also load unavailable nodes as soon as the appear in the structure). Used internally. - * @private - * @name _load_nodes(nodes [, callback]) - * @param {array} nodes - * @param {function} callback a function to be executed once loading is complete, the function is executed in the instance's scope and receives one argument - the array passed to _load_nodes - * @param {Boolean} is_callback - if false reloads node (AP - original comment missing in source code) - * @param {Boolean} force_reload - if true force reloads node (AP - original comment missing in source code) - */ - _load_nodes: (nodes: any[], callback?: (nodes: any[]) => void, is_callback?: boolean, force_reload?: boolean) => void; - - /** - * loads all unloaded nodes - * @name load_all([obj, callback]) - * @param {mixed} obj the node to load recursively, omit to load all nodes in the tree - * @param {function} callback a function to be executed once loading all the nodes is complete, - * @trigger load_all.jstree - */ - load_all: (obj: any, callback: () => void) => void; - - /** - * handles the actual loading of a node. Used only internally. - * @private - * @name _load_node(obj [, callback]) - * @param {mixed} obj - * @param {function} callback a function to be executed once loading is complete, the function is executed in the instance's scope and receives one argument - a boolean status - * @return {Boolean} - */ - _load_node: (obj: any, callback?: (status: boolean) => void) => boolean; - - /** - * adds a node to the list of nodes to redraw. Used only internally. - * @private - * @name _node_changed(obj) - * @param {mixed} obj - */ - _node_changed: (obj: any) => void; - - /** - * appends HTML content to the tree. Used internally. - * @private - * @name _append_html_data(obj, data) - * @param {mixed} obj the node to append to - * @param {String} data the HTML string to parse and append - * @param {function} callback function which takes boolean flag executes after append (AP: originally lack of comment) - * @trigger model.jstree, changed.jstree - */ - _append_html_data: (dom: any, data: string, cb: (flag: boolean) => void) => void; - - /** - * appends JSON content to the tree. Used internally. - * @private - * @name _append_json_data(obj, data) - * @param {mixed} dom the node to append to - * @param {String} data the JSON object to parse and append - * @param {function} cb function which takes boolean flag executes after append (AP: originally lack of comment) - * @param {Boolean} force_processing internal param - do not set - * @trigger model.jstree, changed.jstree - */ - _append_json_data: (dom: any, data: string, cb: (flag: boolean) => void, force_processing: boolean) => void; - - /** - * parses a node from a jQuery object and appends them to the in memory tree model. Used internally. - * @private - * @name _parse_model_from_html(d [, p, ps]) - * @param {jQuery} d the jQuery object to parse - * @param {String} p the parent ID - * @param {Array} ps list of all parents - * @return {String} the ID of the object added to the model - */ - _parse_model_from_html: (d: JQuery, p?: string, ps?: any[]) => string; - - /** - * parses a node from a JSON object (used when dealing with flat data, which has no nesting of children, but has id and parent properties) and appends it to the in memory tree model. Used internally. - * @private - * @name _parse_model_from_flat_json(d [, p, ps]) - * @param {Object} d the JSON object to parse - * @param {String} p the parent ID - * @param {Array} ps list of all parents - * @return {String} the ID of the object added to the model - */ - _parse_model_from_flat_json: (d: any, p?: string, ps?: any[]) => string; - - /** - * parses a node from a JSON object and appends it to the in memory tree model. Used internally. - * @private - * @name _parse_model_from_json(d [, p, ps]) - * @param {Object} d the JSON object to parse - * @param {String} p the parent ID - * @param {Array} ps list of all parents - * @return {String} the ID of the object added to the model - */ - _parse_model_from_json: (d: any, p?: string, ps?: any[]) => string; - - /** - * redraws all nodes that need to be redrawn. Used internally. - * @private - * @name _redraw() - * @trigger redraw.jstree - */ - _redraw: () => void ; - - /** - * redraws all nodes that need to be redrawn or optionally - the whole tree - * @name redraw([full]) - * @param {Boolean} full if set to `true` all nodes are redrawn. - */ - redraw: (full?: boolean) => void; - - /** - * redraws a single node's children. Used internally. - * @private - * @name draw_children(node) - * @param {mixed} node the node whose children will be redrawn - */ - draw_children: (node: any) => void; - - /** - * redraws a single node. Used internally. - * @private - * @name redraw_node(node, deep, is_callback, force_render) - * @param {mixed} node the node to redraw - * @param {Boolean} deep should child nodes be redrawn too - * @param {Boolean} is_callback is this a recursion call - * @param {Boolean} force_render should children of closed parents be drawn anyway - */ - redraw_node: (node: any, deep: boolean, is_callback: boolean, force_render: boolean) => void; - - /** - * opens a node, revaling its children. If the node is not loaded it will be loaded and opened once ready. - * @name open_node(obj [, callback, animation]) - * @param {mixed} obj the node to open - * @param {Function} callback a function to execute once the node is opened - * @param {Number} animation the animation duration in milliseconds - * when opening the node (overrides the `core.animation` setting). Use `false` for no animation. - * @trigger open_node.jstree, after_open.jstree, before_open.jstree - */ - open_node: (obj: any, callback?: any, animation?: any) => void; - - /** - * opens every parent of a node (node should be loaded) - * @name _open_to(obj) - * @param {mixed} obj the node to reveal - * @private - */ - _open_to: (obj:any) => void; - - /** - * closes a node, hiding its children - * @name close_node(obj [, animation]) - * @param {mixed} obj the node to close - * @param {Number} animation the animation duration in milliseconds - * when closing the node (overrides the `core.animation` setting). Use `false` for no animation. - * @trigger close_node.jstree, after_close.jstree - */ - close_node: (obj: any, animation?: any) => void; - - /** - * toggles a node - closing it if it is open, opening it if it is closed - * @name toggle_node(obj) - * @param {mixed} obj the node to toggle - */ - toggle_node: (obj: any) => void; - - /** - * opens all nodes within a node (or the tree), revaling their children. If the node is not loaded it will be loaded and opened once ready. - * @name open_all([obj, animation, original_obj]) - * @param {mixed} obj the node to open recursively, omit to open all nodes in the tree - * @param {Number} animation the animation duration in milliseconds when opening the nodes, the default is no animation - * @param {jQuery} reference to the node that started the process (internal use) - * @trigger open_all.jstree - */ - open_all: (obj?: any, animation?: number, original_obj?: any) => void; - - /** - * closes all nodes within a node (or the tree), revaling their children - * @name close_all([obj, animation]) - * @param {mixed} obj the node to close recursively, omit to close all nodes in the tree - * @param {Number} animation the animation duration in milliseconds when closing the nodes, the default is no animation - * @trigger close_all.jstree - */ - close_all: (obj?: any, animation?: number) => void; - - /** - * checks if a node is disabled (not selectable) - * @name is_disabled(obj) - * @param {mixed} obj - * @return {Boolean} - */ - is_disabled: (obj: any) => boolean; - - /** - * enables a node - so that it can be selected - * @name enable_node(obj) - * @param {mixed} obj the node to enable - * @trigger enable_node.jstree - */ - enable_node: (obj: any) => boolean; - - /** - * disables a node - so that it can not be selected - * @name disable_node(obj) - * @param {mixed} obj the node to disable - * @trigger disable_node.jstree - */ - disable_node: (obj: any) => boolean; - - /** - * determines if a node is hidden - * @name is_hidden(obj) - * @param {mixed} obj the node - */ - is_hidden: (obj: any) => boolean; - - /** - * hides a node - it is still in the structure but will not be visible - * @name hide_node(obj) - * @param {mixed} obj the node to hide - * @param {Boolean} skip_redraw internal parameter controlling if redraw is called - * @trigger hide_node.jstree - */ - hide_node: (obj: any, skip_redraw: boolean) => boolean; - - /** - * shows a node - * @name show_node(obj) - * @param {mixed} obj the node to show - * @param {Boolean} skip_redraw internal parameter controlling if redraw is called - * @trigger show_node.jstree - */ - show_node: (obj: any, skip_redraw: boolean) => boolean; - - /** - * hides all nodes - * @name hide_all() - * @trigger hide_all.jstree - */ - hide_all: (skip_redraw: boolean) => boolean; - - /** - * shows all nodes - * @name show_all() - * @trigger show_all.jstree - */ - show_all: (skip_redraw: boolean) => boolean; - - /** - * called when a node is selected by the user. Used internally. - * @private - * @name activate_node(obj, e) - * @param {mixed} obj the node - * @param {Object} e the related event - * @trigger activate_node.jstree, changed.jstree - */ - activate_node: (obj: any, e: any) => void; - - /** - * applies the hover state on a node, called when a node is hovered by the user. Used internally. - * @private - * @name hover_node(obj) - * @param {mixed} obj - * @trigger hover_node.jstree - */ - hover_node: (obj: any) => void; - - /** - * removes the hover state from a nodecalled when a node is no longer hovered by the user. Used internally. - * @private - * @name dehover_node(obj) - * @param {mixed} obj - * @trigger dehover_node.jstree - */ - dehover_node: (obj: any) => void; - - /** - * select a node - * @name select_node(obj [, supress_event, prevent_open]) - * @param {mixed} obj an array can be used to select multiple nodes - * @param {Boolean} supress_event if set to `true` the `changed.jstree` event won't be triggered - * @param {Boolean} prevent_open if set to `true` parents of the selected node won't be opened - * @trigger select_node.jstree, changed.jstree - */ - select_node: (obj: any, supress_event?: boolean, prevent_open?: boolean, e?: any) => any; - - /** - * deselect a node - * @name deselect_node(obj [, supress_event]) - * @param {mixed} obj an array can be used to deselect multiple nodes - * @param {Boolean} supress_event if set to `true` the `changed.jstree` event won't be triggered - * @trigger deselect_node.jstree, changed.jstree - */ - deselect_node: (obj: any, supress_event?: boolean, e?: any) => void; - - /** - * select all nodes in the tree - * @name select_all([supress_event]) - * @param {Boolean} supress_event if set to `true` the `changed.jstree` event won't be triggered - * @trigger select_all.jstree, changed.jstree - */ - select_all: (supress_event?: boolean) => void; - - /** - * deselect all selected nodes - * @name deselect_all([supress_event]) - * @param {Boolean} supress_event if set to `true` the `changed.jstree` event won't be triggered - * @trigger deselect_all.jstree, changed.jstree - */ - deselect_all: (supress_event?: boolean) => void; - - /** - * checks if a node is selected - * @name is_selected(obj) - * @param {mixed} obj - * @return {Boolean} - */ - is_selected: (obj: any) => boolean; - - /** - * get an array of all selected nodes - * @name get_selected([full]) - * @param {mixed} full if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned - * @return {Array} - */ - get_selected: (full?: any) => any[]; - - /** - * get an array of all top level selected nodes (ignoring children of selected nodes) - * @name get_top_selected([full]) - * @param {mixed} full if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned - * @return {Array} - */ - get_top_selected: (full?: any) => any[]; - - /** - * get an array of all bottom level selected nodes (ignoring selected parents) - * @name get_top_selected([full]) - * @param {mixed} full if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned - * @return {Array} - */ - get_bottom_selected: (full?: any) => any[]; - - /** - * gets the current state of the tree so that it can be restored later with `set_state(state)`. Used internally. - * @name get_state() - * @private - * @return {Object} - */ - get_state: () => any; - - /** - * sets the state of the tree. Used internally. - * @name set_state(state [, callback]) - * @private - * @param {Object} state the state to restore - * @param {Function} callback an optional function to execute once the state is restored. - * @trigger set_state.jstree - */ - set_state: (state: any, callback: () => void) => void; - - /** - * refreshes the tree - all nodes are reloaded with calls to `load_node`. - * @name refresh() - * @param {Boolean} skip_loading an option to skip showing the loading indicator - * @param {Mixed} forget_state if set to `true` state will not be reapplied, - * if set to a function (receiving the current state as argument) the result of that function will be used as state - * @trigger refresh.jstree - */ - refresh: (skip_loading: boolean, forget_state: any) => void; - - /** - * refreshes a node in the tree (reload its children) all opened nodes inside that node are reloaded with calls to `load_node`. - * @name refresh_node(obj) - * @param {mixed} obj the node - * @trigger refresh_node.jstree - */ - refresh_node: (obj: any) => void; - - /** - * set (change) the ID of a node - * @name set_id(obj, id) - * @param {mixed} obj the node - * @param {String} id the new ID - * @return {Boolean} - */ - set_id: (obj: any, id: string) => boolean; - - /** - * get the text value of a node - * @name get_text(obj) - * @param {mixed} obj the node - * @return {String} - */ - get_text: (obj: any) => string; - - /** - * set the text value of a node. Used internally, please use `rename_node(obj, val)`. - * @private - * @name set_text(obj, val) - * @param {mixed} obj the node, you can pass an array to set the text on multiple nodes - * @param {String} val the new text value - * @return {Boolean} - * @trigger set_text.jstree - */ - set_text: (obj:any, val:string) => boolean; - - /** - * gets a JSON representation of a node (or the whole tree) - * @name get_json([obj, options]) - * @param {mixed} obj - * @param {Object} options - * @param {Boolean} options.no_state do not return state information - * @param {Boolean} options.no_id do not return ID - * @param {Boolean} options.no_children do not include children - * @param {Boolean} options.no_data do not include node data - * @param {Boolean} options.no_li_attr do not include LI attributes - * @param {Boolean} options.no_a_attr do not include A attributes - * @param {Boolean} options.flat return flat JSON instead of nested - * @return {Object} - */ - get_json: (obj?: any, options?: JSTreeGetJsonOptions, flat?: boolean) => any; - - /** - * create a new node (do not confuse with load_node) - * @name create_node([obj, node, pos, callback, is_loaded]) - * @param {mixed} par the parent node (to create a root node use either "#" (string) or `null`) - * @param {mixed} node the data for the new node (a valid JSON object, or a simple string with the name) - * @param {mixed} pos the index at which to insert the node, "first" and "last" are also supported, default is "last" - * @param {Function} callback a function to be called once the node is created - * @param {Boolean} is_loaded internal argument indicating if the parent node was succesfully loaded - * @return {String} the ID of the newly create node - * @trigger model.jstree, create_node.jstree - */ - create_node: (par?: any, node?: any, pos?: any, callback?: any, is_loaded?: boolean) => string; - - /** - * set the text value of a node - * @name rename_node(obj, val) - * @param {mixed} obj the node, you can pass an array to rename multiple nodes to the same name - * @param {String} val the new text value - * @return {Boolean} - * @trigger rename_node.jstree - */ - rename_node: (obj: any, val: string) => boolean; - - /** - * remove a node - * @name delete_node(obj) - * @param {mixed} obj the node, you can pass an array to delete multiple nodes - * @return {Boolean} - * @trigger delete_node.jstree, changed.jstree - */ - delete_node: (obj: any) => boolean; - - /** - * check if an operation is premitted on the tree. Used internally. - * @private - * @name check(chk, obj, par, pos) - * @param {String} chk the operation to check, can be "create_node", "rename_node", "delete_node", "copy_node" or "move_node" - * @param {mixed} obj the node - * @param {mixed} par the parent - * @param {mixed} pos the position to insert at, or if "rename_node" - the new name - * @param {mixed} more some various additional information, for example if a "move_node" operations is triggered by DND this will be the hovered node - * @return {Boolean} - */ - check: (chk: string, obj: any, par: any, pos: any, more: any) => boolean; - - /** - * get the last error - * @name last_error() - * @return {Object} - */ - last_error: () => any; - - /** - * move a node to a new parent - * @name move_node(obj, par [, pos, callback, is_loaded]) - * @param {mixed} obj the node to move, pass an array to move multiple nodes - * @param {mixed} par the new parent - * @param {mixed} pos the position to insert at (besides integer values, "first" and "last" are supported, as well as "before" and "after"), defaults to integer `0` - * @param {function} callback a function to call once the move is completed, receives 3 arguments - the node, the new parent and the position - * @param {Boolean} is_loaded internal parameter indicating if the parent node has been loaded - * @param {Boolean} skip_redraw internal parameter indicating if the tree should be redrawn - * @param {Boolean} instance internal parameter indicating if the node comes from another instance - * @trigger move_node.jstree - */ - move_node: (obj: any, par: any, pos?: any, callback?: (node: any, new_par: any, pos: any) => void, is_loaded?: boolean, skip_redraw?: boolean, origin?: boolean) => void; - - /** - * copy a node to a new parent - * @name copy_node(obj, par [, pos, callback, is_loaded]) - * @param {mixed} obj the node to copy, pass an array to copy multiple nodes - * @param {mixed} par the new parent - * @param {mixed} pos the position to insert at (besides integer values, "first" and "last" are supported, as well as "before" and "after"), defaults to integer `0` - * @param {function} callback a function to call once the move is completed, receives 3 arguments - the node, the new parent and the position - * @param {Boolean} is_loaded internal parameter indicating if the parent node has been loaded - * @param {Boolean} skip_redraw internal parameter indicating if the tree should be redrawn - * @param {Boolean} instance internal parameter indicating if the node comes from another instance - * @trigger model.jstree copy_node.jstree - */ - copy_node: (obj: any, par: any, pos?: any, callback?: (node: any, new_par: any, pos: any) => void, is_loaded?: boolean, skip_redraw?: boolean, origin?: boolean) => void; - - /** - * cut a node (a later call to `paste(obj)` would move the node) - * @name cut(obj) - * @param {mixed} obj multiple objects can be passed using an array - * @trigger cut.jstree - */ - cut: (obj: any) => void; - - /** - * copy a node (a later call to `paste(obj)` would copy the node) - * @name copy(obj) - * @param {mixed} obj multiple objects can be passed using an array - * @trigger copy.jstre - */ - copy: (obj: any) => void; - - /** - * get the current buffer (any nodes that are waiting for a paste operation) - * @name get_buffer() - * @return {Object} an object consisting of `mode` ("copy_node" or "move_node"), `node` (an array of objects) and `inst` (the instance) - */ - get_buffer: () => Buffer; - - /** - * check if there is something in the buffer to paste - * @name can_paste() - * @return {Boolean} - */ - can_paste: () => boolean; - - /** - * copy or move the previously cut or copied nodes to a new parent - * @name paste(obj [, pos]) - * @param {mixed} obj the new parent - * @param {mixed} pos the position to insert at (besides integer, "first" and "last" are supported), defaults to integer `0` - * @trigger paste.jstree - */ - paste: (obj: any, pos: any) => void; - - /** - * clear the buffer of previously copied or cut nodes - * @name clear_buffer() - * @trigger clear_buffer.jstree - */ - clear_buffer: () => void; - - /** - * put a node in edit mode (input field to rename the node) - * @name edit(obj [, default_text, callback]) - * @param {mixed} obj - * @param {String} default_text the text to populate the input with (if omitted or set to a non-string value the node's text value is used) - * @param {Function} callback a function to be called once the text box is blurred, it is called in the instance's scope and receives the node, a status parameter (true if the rename is successful, false otherwise) and a boolean indicating if the user cancelled the edit. You can access the node's title using .text - */ - edit: (obj: any, default_text?: string, callback?: (node: any, status: boolean, canceled: boolean) => void) => void; - - /** - * changes the theme - * @name set_theme(theme_name [, theme_url]) - * @param {String} theme_name the name of the new theme to apply - * @param {mixed} theme_url the location of the CSS file for this theme. Omit or set to `false` - * if you manually included the file. Set to `true` to autoload from the `core.themes.dir` directory. - * @trigger set_theme.jstree - */ - set_theme: (theme_name: string, theme_url?: any) => void; - - /** - * gets the name of the currently applied theme name - * @name get_theme() - * @return {String} - */ - get_theme: () => string; - - /** - * changes the theme variant (if the theme has variants) - * @name set_theme_variant(variant_name) - * @param {String|Boolean} variant_name the variant to apply (if `false` is used the current variant is removed) - */ - set_theme_variant: (variant_name: any) => void; - - /** - * gets the name of the currently applied theme variant - * @name get_theme() - * @return {String} - */ - get_theme_variant: () => string; - - /** - * shows a striped background on the container (if the theme supports it) - * @name show_stripes() - */ - show_stripes: () => void; - - /** - * hides the striped background on the container - * @name hide_stripes() - */ - hide_stripes: () => void; - - /** - * toggles the striped background on the container - * @name toggle_stripes() - */ - toggle_stripes: () => void; - - /** - * shows the connecting dots (if the theme supports it) - * @name show_dots() - */ - show_dots: () => void; - - /** - * hides the connecting dots - * @name hide_dots() - */ - hide_dots: () => void; - - /** - * toggles the connecting dots - * @name toggle_dots() - */ - toggle_dots: () => void; - - /** - * show the node icons - * @name show_icons() - */ - show_icons: () => void; - - /** - * hide the node icons - * @name hide_icons() - */ - hide_icons: () => void; - - /** - * toggle the node icons - * @name toggle_icons() - */ - toggle_icons: () => void; - - /** - * set the node icon for a node - * @name set_icon(obj, icon) - * @param {mixed} obj - * @param {String} icon the new icon - can be a path to an icon or a className, - * if using an image that is in the current directory use a `./` prefix, otherwise it will be detected as a class - */ - set_icon: (obj: any, icon: string) => void; - - /** - * get the node icon for a node - * @name get_icon(obj) - * @param {mixed} obj - * @return {String} - */ - get_icon: (obj: any) => string; - - /** - * hide the icon on an individual node - * @name hide_icon(obj) - * @param {mixed} obj - */ - hide_icon: (obj: any) => void; - - /** - * show the icon on an individual node - * @name show_icon(obj) - * @param {mixed} obj - */ - show_icon: (obj: any) => void; - - /** - * checkbox plugin - */ - - /** - * set the undetermined state where and if necessary. Used internally. - * @private - * @name _undetermined() - * @plugin checkbox - */ - _undetermined: () => void; - - /** - * show the node checkbox icons - * @name show_checkboxes() - * @plugin checkbox - */ - show_checkboxes: () => void; - - /** - * hide the node checkbox icons - * @name hide_checkboxes() - * @plugin checkbox - */ - hide_checkboxes: () => void; - - /** - * toggle the node icons - * @name toggle_checkboxes() - * @plugin checkbox - */ - toggle_checkboxes: () => void; - - /** - * checks if a node is in an undetermined state - * @name is_undetermined(obj) - * @param {mixed} obj - * @return {Boolean} - */ - is_undetermined: (obj: any) => boolean; - - /** - * disable a node's checkbox - * @name disable_checkbox(obj) - * @param {mixed} obj an array can be used too - * @trigger disable_checkbox.jstree - * @plugin checkbox - */ - disable_checkbox: (obj: any) => boolean; - - /** - * enable a node's checkbox - * @name disable_checkbox(obj) - * @param {mixed} obj an array can be used too - * @trigger enable_checkbox.jstree - * @plugin checkbox - */ - enable_checkbox: (obj: any) => boolean; - - /** - * check a node (only if tie_selection in checkbox settings is false, otherwise select_node will be called internally) - * @name check_node(obj) - * @param {mixed} obj an array can be used to check multiple nodes - * @trigger check_node.jstree - * @plugin checkbox - */ - check_node: (obj: any, e: any) => any; - - /** - * uncheck a node (only if tie_selection in checkbox settings is false, otherwise deselect_node will be called internally) - * @name deselect_node(obj) - * @param {mixed} obj an array can be used to deselect multiple nodes - * @trigger uncheck_node.jstree - * @plugin checkbox - */ - uncheck_node: (obj: any, e: any) => any; - - /** - * checks all nodes in the tree (only if tie_selection in checkbox settings is false, otherwise select_all will be called internally) - * @name check_all() - * @trigger check_all.jstree, changed.jstree - * @plugin checkbox - */ - check_all: () => any; - - /** - * uncheck all checked nodes (only if tie_selection in checkbox settings is false, otherwise deselect_all will be called internally) - * @name uncheck_all() - * @trigger uncheck_all.jstree - * @plugin checkbox - */ - uncheck_all: () => any; - - /** - * checks if a node is checked (if tie_selection is on in the settings this function will return the same as is_selected) - * @name is_checked(obj) - * @param {mixed} obj - * @return {Boolean} - * @plugin checkbox - */ - is_checked: (obj: any) => boolean; - - /** - * get an array of all checked nodes (if tie_selection is on in the settings this function will return the same as get_selected) - * @name get_checked([full]) - * @param {mixed} full if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned - * @return {Array} - * @plugin checkbox - */ - get_checked: (full: any) => any[]; - - /** - * get an array of all top level checked nodes (ignoring children of checked nodes) (if tie_selection is on in the settings this function will return the same as get_top_selected) - * @name get_top_checked([full]) - * @param {mixed} full if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned - * @return {Array} - * @plugin checkbox - */ - get_top_checked: (full: any) => any[]; - - /** - * get an array of all bottom level checked nodes (ignoring selected parents) (if tie_selection is on in the settings this function will return the same as get_bottom_selected) - * @name get_bottom_checked([full]) - * @param {mixed} full if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned - * @return {Array} - * @plugin checkbox - */ - get_bottom_checked: (full: any) => any[]; - - /** - * context menu plugin - */ - - /** - * prepare and show the context menu for a node - * @name show_contextmenu(obj [, x, y]) - * @param {mixed} obj the node - * @param {Number} x the x-coordinate relative to the document to show the menu at - * @param {Number} y the y-coordinate relative to the document to show the menu at - * @param {Object} e the event if available that triggered the contextmenu - * @plugin contextmenu - * @trigger show_contextmenu.jstree - */ - show_contextmenu: (obj: any, x?: number, y?: number, e?: any) => void; - - /** - * show the prepared context menu for a node - * @name _show_contextmenu(obj, x, y, i) - * @param {mixed} obj the node - * @param {Number} x the x-coordinate relative to the document to show the menu at - * @param {Number} y the y-coordinate relative to the document to show the menu at - * @param {Number} i the object of items to show - * @plugin contextmenu - * @trigger show_contextmenu.jstree - * @private - */ - _show_contextmenu: (obj: any, x: number, y: number, i: number) => void; - - /** - * search plugin - */ - - /** - * used to search the tree nodes for a given string - * @name search(str [, skip_async]) - * @param {String} str the search string - * @param {Boolean} skip_async if set to true server will not be queried even if configured - * @param {Boolean} show_only_matches if set to true only matching nodes will be shown (keep in mind this can be very slow on large trees or old browsers) - * @param {mixed} inside an optional node to whose children to limit the search - * @param {Boolean} append if set to true the results of this search are appended to the previous search - * @param {Boolean} show_only_matches_children show only matched children - * @plugin search - * @trigger search.jstree - */ - search: (str: string, skip_async?: boolean, show_only_matches?: boolean, inside?: any, append?: boolean, show_only_matches_children?: boolean) => void; - - /** - * used to clear the last search (removes classes and shows all nodes if filtering is on) - * @name clear_search() - * @plugin search - * @trigger clear_search.jstree - */ - clear_search: () => void; - - /** - * opens nodes that need to be opened to reveal the search results. Used only internally. - * @private - * @name _search_open(d) - * @param {Array} d an array of node IDs - * @plugin search - */ - _search_open: (d: string[]) => void; - - /** - * sort plugin - */ - - /** - * used to sort a node's children - * @private - * @name sort(obj [, deep]) - * @param {mixed} obj the node - * @param {Boolean} deep if set to `true` nodes are sorted recursively. - * @plugin sort - * @trigger search.jstree - */ - sort: (obj: any, deep?: boolean) => void; - - /** - * state plugin - */ - - /** - * save the state - * @name save_state() - * @plugin state - */ - save_state: () => void; - - /** - * restore the state from the user's computer - * @name restore_state() - * @plugin state - */ - restore_state: () => void; - - /** - * clear the state on the user's computer - * @name clear_state() - * @plugin state - */ - clear_state: () => void; - - /** - * types plugin - */ - - /** - * used to retrieve the type settings object for a node - * @name get_rules(obj) - * @param {mixed} obj the node to find the rules for - * @return {Object} - * @plugin types - */ - get_rules: (obj: any) => any; - - /** - * used to retrieve the type string or settings object for a node - * @name get_type(obj [, rules]) - * @param {mixed} obj the node to find the rules for - * @param {Boolean} rules if set to `true` instead of a string the settings object will be returned - * @return {String|Object} - * @plugin types - */ - get_type: (obj: any, rules?: any) => any; - - /** - * used to change a node's type - * @name set_type(obj, type) - * @param {mixed} obj the node to change - * @param {String} type the new type - * @plugin types - */ - set_type: (obj: any, type: string) => any; -} - -interface JSTreeGetJsonOptions { - /** - * do not return state information - */ - no_state: boolean; - - /** - * do not return ID - */ - no_id: boolean; - - /** - * do not include children - */ - no_children: boolean; - - /** - * do not include node data - */ - no_data: boolean; - - /** - * do not include LI attributes - */ - no_li_attr: boolean; - - /** - * do not include A attributes - */ - no_a_attr: boolean; - - /** - * return flat JSON instead of nested - */ - flat: boolean; -} - -interface JSTreeBindOptions { - inst?: any; - args?: any; - rslt?: any; - rlbk?: any; -} - -interface Buffer { - mode: string; - node: any[]; - inst: any; -} diff --git a/DKBFrontEnd/vendor/typings/globals/jstree/typings.json b/DKBFrontEnd/vendor/typings/globals/jstree/typings.json deleted file mode 100644 index 83064e642..000000000 --- a/DKBFrontEnd/vendor/typings/globals/jstree/typings.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "resolution": "main", - "tree": { - "src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/00dd9a1cf6c5b748d51e6d470ce6117bb383ea6c/jstree/jstree.d.ts", - "raw": "registry:dt/jstree#0.0.0+20160815165627", - "typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/00dd9a1cf6c5b748d51e6d470ce6117bb383ea6c/jstree/jstree.d.ts" - } -} diff --git a/DKBFrontEnd/vendor/typings/index.d.ts b/DKBFrontEnd/vendor/typings/index.d.ts deleted file mode 100644 index 224e9fc89..000000000 --- a/DKBFrontEnd/vendor/typings/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/DKBFrontEnd/vendor/typings/local-modules/d3/index.d.ts b/DKBFrontEnd/vendor/typings/local-modules/d3/index.d.ts deleted file mode 100644 index 4fd941379..000000000 --- a/DKBFrontEnd/vendor/typings/local-modules/d3/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -declare module 'd3' { - export type Dispatch = any; -} diff --git a/DKBFrontEnd/vendor/typings/local-modules/detect-browser/index.d.ts b/DKBFrontEnd/vendor/typings/local-modules/detect-browser/index.d.ts deleted file mode 100644 index 14d21e7db..000000000 --- a/DKBFrontEnd/vendor/typings/local-modules/detect-browser/index.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -declare module DetectBrowser { - const name: string; - const version: string; -} - -declare module 'detect-browser' { - export = DetectBrowser; -} diff --git a/DKBFrontEnd/vendor/typings/local-modules/handlebars/index.d.ts b/DKBFrontEnd/vendor/typings/local-modules/handlebars/index.d.ts deleted file mode 100644 index ea85fb98f..000000000 --- a/DKBFrontEnd/vendor/typings/local-modules/handlebars/index.d.ts +++ /dev/null @@ -1,290 +0,0 @@ -// Generated by typings -// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/6c95a70c7498a144915c36660c6698ddaeb431b4/handlebars/handlebars.d.ts -declare module "handlebars" { -namespace Handlebars { - export function registerHelper(name: string, fn: Function, inverse?: boolean): void; - export function registerHelper(name: Object): void; - export function registerPartial(name: string, str: any): void; - export function unregisterHelper(name: string): void; - export function unregisterPartial(name: string): void; - export function K(): void; - export function createFrame(object: any): any; - export function Exception(message: string): void; - export function log(level: number, obj: any): void; - export function parse(input: string): hbs.AST.Program; - export function compile(input: any, options?: CompileOptions): HandlebarsTemplateDelegate; - export function precompile(input: any, options?: PrecompileOptions): TemplateSpecification; - export function template(precompilation: TemplateSpecification): HandlebarsTemplateDelegate; - - export function create(): typeof Handlebars; - - export var SafeString: typeof hbs.SafeString; - export var escapeExpression: typeof hbs.Utils.escapeExpression; - export var Utils: typeof hbs.Utils; - export var logger: Logger; - export var templates: HandlebarsTemplates; - export var helpers: any; - - export function registerDecorator(name: string, fn: Function): void; - export function registerDecorator(obj: {[name: string] : Function}): void; - export function unregisterDecorator(name: string): void; - - export function noConflict(): typeof Handlebars; - - export module AST { - export var helpers: hbs.AST.helpers; - } - - interface ICompiler { - accept(node: hbs.AST.Node): void; - Program(program: hbs.AST.Program): void; - BlockStatement(block: hbs.AST.BlockStatement): void; - PartialStatement(partial: hbs.AST.PartialStatement): void; - PartialBlockStatement(partial: hbs.AST.PartialBlockStatement): void; - DecoratorBlock(decorator: hbs.AST.DecoratorBlock): void; - Decorator(decorator: hbs.AST.Decorator): void; - MustacheStatement(mustache: hbs.AST.MustacheStatement): void; - ContentStatement(content: hbs.AST.ContentStatement): void; - CommentStatement(comment?: hbs.AST.CommentStatement): void; - SubExpression(sexpr: hbs.AST.SubExpression): void; - PathExpression(path: hbs.AST.PathExpression): void; - StringLiteral(str: hbs.AST.StringLiteral): void; - NumberLiteral(num: hbs.AST.NumberLiteral): void; - BooleanLiteral(bool: hbs.AST.BooleanLiteral): void; - UndefinedLiteral(): void; - NullLiteral(): void; - Hash(hash: hbs.AST.Hash): void; - } - - export class Visitor implements ICompiler { - accept(node: hbs.AST.Node): void; - acceptKey(node: hbs.AST.Node, name: string): void; - acceptArray(arr: hbs.AST.Expression[]): void; - Program(program: hbs.AST.Program): void; - BlockStatement(block: hbs.AST.BlockStatement): void; - PartialStatement(partial: hbs.AST.PartialStatement): void; - PartialBlockStatement(partial: hbs.AST.PartialBlockStatement): void; - DecoratorBlock(decorator: hbs.AST.DecoratorBlock): void; - Decorator(decorator: hbs.AST.Decorator): void; - MustacheStatement(mustache: hbs.AST.MustacheStatement): void; - ContentStatement(content: hbs.AST.ContentStatement): void; - CommentStatement(comment?: hbs.AST.CommentStatement): void; - SubExpression(sexpr: hbs.AST.SubExpression): void; - PathExpression(path: hbs.AST.PathExpression): void; - StringLiteral(str: hbs.AST.StringLiteral): void; - NumberLiteral(num: hbs.AST.NumberLiteral): void; - BooleanLiteral(bool: hbs.AST.BooleanLiteral): void; - UndefinedLiteral(): void; - NullLiteral(): void; - Hash(hash: hbs.AST.Hash): void; - } - - /** - * Implement this interface on your MVW/MVVM/MVC views such as Backbone.View - **/ - interface HandlebarsTemplatable { - template: HandlebarsTemplateDelegate; - } - - interface HandlebarsTemplateDelegate { - (context: any, options?: any): string; - } - - interface HandlebarsTemplates { - [index: string]: HandlebarsTemplateDelegate; - } - - interface TemplateSpecification { - - } - - interface CompileOptions { - data?: boolean; - compat?: boolean; - knownHelpers?: { - helperMissing?: boolean; - blockHelperMissing?: boolean; - each?: boolean; - if?: boolean; - unless?: boolean; - with?: boolean; - log?: boolean; - lookup?: boolean; - } - knownHelpersOnly?: boolean; - noEscape?: boolean; - strict?: boolean; - assumeObjects?: boolean; - preventIndent?: boolean; - ignoreStandalone?: boolean; - explicitPartialContext?: boolean; - } - - interface PrecompileOptions extends CompileOptions { - srcName?: string; - destName?: string; - } - - namespace hbs { - class SafeString { - constructor(str: string); - static toString(): string; - } - - namespace Utils { - function escapeExpression(str: string): string; - function createFrame(obj: Object): Object; - function isEmpty(obj: any) : boolean; - function extend(obj: any, ...source: any[]): any; - function toString(obj: any): string; - function isArray(obj: any): boolean; - function isFunction(obj: any): boolean; - } - } - - interface Logger { - DEBUG: number; - INFO: number; - WARN: number; - ERROR: number; - level: number; - - methodMap: { [level: number]: string }; - - log(level: number, obj: string): void; - } - - namespace hbs { - namespace AST { - interface Node { - type: string; - loc: SourceLocation; - } - - interface SourceLocation { - source: string; - start: Position; - end: Position; - } - - interface Position { - line: number; - column: number; - } - - interface Program extends Node { - body: Statement[]; - blockParams: string[]; - } - - interface Statement extends Node {} - - interface MustacheStatement extends Statement { - path: PathExpression | Literal; - params: Expression[]; - hash: Hash; - escaped: boolean; - strip: StripFlags; - } - - interface Decorator extends MustacheStatement { } - - interface BlockStatement extends Statement { - path: PathExpression; - params: Expression[]; - hash: Hash; - program: Program; - inverse: Program; - openStrip: StripFlags; - inverseStrip: StripFlags; - closeStrip: StripFlags; - } - - interface DecoratorBlock extends BlockStatement { } - - interface PartialStatement extends Statement { - name: PathExpression | SubExpression; - params: Expression[]; - hash: Hash; - indent: string; - strip: StripFlags; - } - - interface PartialBlockStatement extends Statement { - name: PathExpression | SubExpression; - params: Expression[], - hash: Hash, - program: Program, - openStrip: StripFlags, - closeStrip: StripFlags - } - - interface ContentStatement extends Statement { - value: string; - original: StripFlags; - } - - interface CommentStatement extends Statement { - value: string; - strip: StripFlags; - } - - interface Expression extends Node {} - - interface SubExpression extends Expression { - path: PathExpression; - params: Expression[]; - hash: Hash; - } - - interface PathExpression extends Expression { - data: boolean; - depth: number; - parts: string[]; - original: string; - } - - interface Literal extends Expression {} - interface StringLiteral extends Literal { - value: string; - original: string; - } - - interface BooleanLiteral extends Literal { - value: boolean; - original: boolean; - } - - interface NumberLiteral extends Literal { - value: number; - original: number; - } - - interface UndefinedLiteral extends Literal {} - - interface NullLiteral extends Literal {} - - interface Hash extends Node { - pairs: HashPair[]; - } - - interface HashPair extends Node { - key: string; - value: Expression; - } - - interface StripFlags { - open: boolean; - close: boolean; - } - - interface helpers { - helperExpression(node: Node): boolean; - scopeId(path: PathExpression): boolean; - simpleId(path: PathExpression): boolean; - } - } - } -} - export = Handlebars; -} diff --git a/DKBFrontEnd/vendor/typings/local-modules/handlebars/typings.json b/DKBFrontEnd/vendor/typings/local-modules/handlebars/typings.json deleted file mode 100644 index afe2b904e..000000000 --- a/DKBFrontEnd/vendor/typings/local-modules/handlebars/typings.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "resolution": "main", - "tree": { - "src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/6c95a70c7498a144915c36660c6698ddaeb431b4/handlebars/handlebars.d.ts", - "raw": "registry:dt/handlebars#4.0.5+20160804082238", - "typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/6c95a70c7498a144915c36660c6698ddaeb431b4/handlebars/handlebars.d.ts" - } -} diff --git a/DKBFrontEnd/vendor/typings/local-modules/intro.js/index.d.ts b/DKBFrontEnd/vendor/typings/local-modules/intro.js/index.d.ts deleted file mode 100644 index 564e09981..000000000 --- a/DKBFrontEnd/vendor/typings/local-modules/intro.js/index.d.ts +++ /dev/null @@ -1,24 +0,0 @@ - -declare module "intro.js" { - interface IntroJs { - start(): IntroJs; - goToStep(step: number): IntroJs; - nextStep(): IntroJs; - previousStep(): IntroJs; - exit(): IntroJs; - setOption(option: string, value: string|number|boolean): IntroJs; - setOptions(options: { [option: string]: string|number|boolean }): IntroJs; - refresh(): IntroJs; - addHints(): IntroJs; - onhintclick(providedCallback: () => void): IntroJs; - onhintsadded(providedCallback: () => void): IntroJs; - onhintclose(providedCallback: () => void): IntroJs; - oncomplete(providedCallback: () => void): IntroJs; - onexit(providedCallback: () => void): IntroJs; - onchange(providedCallback: () => void): IntroJs; - onbeforechange(providedCallback: () => void): IntroJs; - onafterchange(providedCallback: (element: HTMLElement) => void): IntroJs; - } - - export function introJs(targetElm?: HTMLElement): IntroJs; -} diff --git a/DKBFrontEnd/vendor/typings/local-modules/jointjs/index.d.ts b/DKBFrontEnd/vendor/typings/local-modules/jointjs/index.d.ts deleted file mode 100644 index 2369447ef..000000000 --- a/DKBFrontEnd/vendor/typings/local-modules/jointjs/index.d.ts +++ /dev/null @@ -1,373 +0,0 @@ -// Type definitions for Joint JS 0.6 -// Project: http://www.jointjs.com/ -// Definitions by: Aidan Reel , David Durman -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -declare module 'jointjs' { - import * as Backbone from 'backbone'; - -namespace joint { - - namespace dia { - - interface IElementSize { - width: number; - height: number; - } - - /** - * The model holding all the cells (elements and links) of the diagram. - * The collection of all the cells is stored in the property cells. - */ - class Graph extends Backbone.Model { - initialize(): void; - fromJSON(json: any): void; - clear(): void; - /** - * Add a new cell to the graph. If cell is an array, all the cells in the array will be added to the graph. - */ - addCell(cell: Cell, options?: any): void; - /** - * Add new cells to the graph. This is just a syntactic sugar to the addCell method. - * Calling addCell with an array of cells is an equivalent to calling addCells. - */ - addCells(cells: Cell[], options?: any): void; - getConnectedLinks(cell: Cell, options?: any): Link[]; - disconnectLinks(cell: Cell): void; - removeLinks(cell: Cell[]): void; - getElements(): Element[]; - getLinks(): Link[]; - /** - * Reset cells in the graph. Update all the cells in the graph in one bulk. - * This is a more efficient method of adding cells to the graph if you you want to - * replace all the cells in one go. - * @param cells - * @param options optionally contain additional data that is passed over to - * the event listeners of the graph reset event - */ - resetCells(cells: Cell[], options?: any): void; - hasActiveBatch(name: string): void; - } - - class Cell extends Backbone.Model { - toJSON(): void; - remove(options?: any): void; - toFront(): void; - toBack(): void; - getBBox(): void; - embed(cell: Cell): void; - unembed(cell: Cell): void; - getEmbeddedCells(): Cell[]; - clone(opt?: any): Backbone.Model; // @todo: return can either be Cell or Cell[]. - attr(attrs: any): Cell; - attr(path: string, value: any): Cell; - } - - class Element extends Cell { - position(x?: number, y?: number): {x: number; y: number}; - translate(tx: number, ty?: number): Element; - resize(width: number, height: number, opt?: any): Element; - rotate(angle: number, absolute?: boolean): Element; - } - - class Link extends Cell { - defaults(): any; - disconnect(): Link; - label(idx?: number, value?: LinkLabelAttributes): any; // @todo: returns either a label under idx or Link if both idx and value were passed - } - - export interface LinkLabelAttributes { - position?: number; - attrs?: { - rect?: { - fill?: string; - 'stroke'?: string; - 'stroke-width'?: number; - }; - text?: { - fill?: string; - 'stroke'?: string; - 'stroke-width'?: number; - }; - }; - } - - export interface LinkAttributes { - attrs?: { - '.connection'?: { - fill?: string; - stroke?: string; - 'stroke-width'?: number; - 'stroke-dasharray'?: string; - }, - '.marker-source'?: { - fill?: string; - stroke?: string; - 'stroke-width'?: number; - d?: string; - }, - '.marker-target'?: { - fill?: string; - stroke?: string; - 'stroke-width'?: number; - d?: string; - } - }; - labels?: LinkLabelAttributes[]; - connector?: { - name?: string; - args?: { - radius?: number; - }; - }; - router?: { - name?: string; - args?: { - startDirections?: string[]; - endDirections?: string[]; - excludeTypes?: string[]; - }; - }; - z?: number; - } - - interface PaperFitToContentOptions { - gridWidth?: number; - gridHeight?: number; - padding?: number | {top: number; right: number; bottom: number; left: number;} - allowNewOrigin?: string; // one of ['negative'|'positive'|'any'] - minWidth?: number; - minHeight?: number; - maxWidth?: number; - maxHeight?: number; - } - interface PaperScaleToFitOptions { - padding?: number; - preserveAspectRatio?: boolean; - minScale?: number; - maxScale?: number; - minScaleX?: number; - minScaleY?: number; - maxScaleX?: number; - maxScaleY?: number; - scaleGrid?: number; - fittingBBox?: {x?: number; y?: number; width?: number; height?: number;} - } - interface PaperOptions extends Backbone.ViewOptions { - gridSize?: number; - elementView?: typeof ElementView; - linkView?: typeof LinkView; - width?: number; - height?: number; - origin?: { x: number; y: number; }; - async?: boolean; - preventContextMenu?: boolean; - guard?: (evt: any, view: joint.dia.CellView) => boolean; - } - class Paper extends Backbone.View { - constructor(options?: PaperOptions); - options: PaperOptions; - svg: SVGElement; - viewport: SVGGElement; - setDimensions(width: number, height: number): void; - scale(sx: number, sy?: number, ox?: number, oy?: number): Paper; - rotate(deg: number, ox?: number, oy?: number): Paper; // @todo not released yet though it's in the source code already - findView(el: any): CellView; - findViewByModel(modelOrId: any): CellView; - findViewsFromPoint(p: { x: number; y: number; }): CellView[]; - findViewsInArea(r: { x: number; y: number; width: number; height: number; }): CellView[]; - fitToContent(opt?: PaperFitToContentOptions): void; - snapToGrid(p: { x: number; y: number; }): { x: number; y: number; }; - scaleContentToFit(opt?: PaperScaleToFitOptions): void; - toPNG(callback: (png: string) => void): void; - toSVG(callback: (svg: string) => void): void; - openAsSVG(): void; - print(): void; - getContentBBox(): g.rect; - setOrigin(x: number, y: number): void; - } - - class ElementView extends CellView { - scale(sx: number, sy: number): void; - resize(): void; - update(cell?: any, renderingOnlyAttrs?: any): void; - } - - class CellView extends Backbone.View { - getBBox(): { x: number; y: number; width: number; height: number; }; - highlight(el?: any): void; - unhighlight(el?: any): void; - findMagnet(el: any): void; - getSelector(el: any): void; - } - - class LinkView extends CellView { - getConnectionLength(): number; - getPointAtLength(length: number): { x: number; y: number; }; - } - - /** Rappid only */ - class CommandManager extends Backbone.Model { - constructor(options?: CommandManagerOptions); - initialize(): void; - undo(): void; - initBatchCommand(): void; - storeBatchCommand(): void; - redo(): void; - reset(): void; - } - - /** Rappid only */ - interface CommandManagerOptions { - graph: Graph; - cmdBeforeAdd?: (cmdName: string, cell: Cell, graph: Graph, options: any) => boolean; - } - } - - namespace ui { - /** Rappid only */ - class PaperScroller extends Backbone.View { - startPanning(evt: MouseEvent): void; - zoom(size: any, opts: any): void; - zoomToFit(params: any): void; - toLocalPoint(x: number, y: number): {x: number; y: number}; - center(): void; - adjustPaper(): void; - } - - /** Rappid only */ - interface SnaplinesOptions extends Backbone.ViewOptions { - paper: joint.dia.Paper; - } - - /** Rappid only */ - class Snaplines extends Backbone.View { - constructor(options: SnaplinesOptions); - startListening(): void; - } - - /** Rappid only */ - interface SelectionViewOptions extends Backbone.ViewOptions { - paper: joint.dia.Paper; - graph: joint.dia.Graph; - } - - /** Rappid only */ - class SelectionView extends Backbone.View { - constructor(options: SelectionViewOptions); - startSelecting(evt: MouseEvent): void; - cancelSelection(): void; - createSelectionBox(view: joint.dia.CellView): void; - destroySelectionBox(view: joint.dia.CellView): void; - } - - /** Rappid only */ - class Halo extends Backbone.View { - constructor(options: HaloOptions); - options: HaloOptions; - addHandle(options: { name:string; position: string; icon: string; }): void; - removeHandle(name: string): void; - changeHandle(name: string, options: { position: string; icon: string; }): void; - } - - /** Rappid only */ - interface HaloOptions { - graph: joint.dia.Graph; - paper: joint.dia.Paper; - cellView: joint.dia.CellView; - /** - * The preferred side for a self-loop link created from Halo ("top"|"bottom"|"left"|"right"), default is "top" - */ - linkLoopPreferredSide?: string; - /** - * The self-loop link width in pixels, default is 40 - */ - linkLoopWidth?: number; - /** - * The angle increments the rotate action snaps to, default is 15 - */ - rotateAngleGrid?: number; - /** - * A function that returns an HTML string with the content that will be used in the information box below the element. - * Default is x,y,width,height coordinates and dimensions of the element. - */ - boxContent?: boolean | ((cellView: joint.dia.CellView, boxDOMElement: HTMLElement) => string); - /** - * If set to true, the model position and dimensions will be used as a basis for the Halo tools position. - * By default, this is set to false which causes the Halo tools position be based on the bounding box of - * the element view. Sometimes though, your shapes can have certain SVG sub elements that stick out - * of the view and you don't want these sub elements to affect the Halo tools position. - * In this case, set the useModelGeometry to true. - */ - useModelGeometry?: boolean; - } - } - - namespace shapes { - module basic { - class Generic extends joint.dia.Element { } - class Rect extends Generic { } - class Text extends Generic { } - class Circle extends Generic { } - class Image extends Generic { } - } - } - - namespace util { - function uuid(): string; - function guid(obj: any): string; - function mixin(objects: any[]): any; - function supplement(objects: any[]): any; - function deepMixin(objects: any[]): any; - function deepSupplement(objects: any, defaultIndicator?: any): any; - function imageToDataUri(url: string, callback: (error: Error, dataUri: string) => void): void; - function normalizeEvent(params: any): any; - } - - function V(element: SVGElement): V; - - interface V { - node: SVGAElement; - attr(name: string): string; - attr(name: string, value: string): void; - attr(attrs: {}): void; - scale(): {sx: number; sy: number;} - bbox(withoutTransformations?: boolean, target?: Element): g.rect; - } - - export namespace g { - function point(x: number, y: number): point; - function point(p: {x: number; y: number;}): point; - interface point { - x: number; - y: number; - } - - function rect(x: number, y: number, w: number, h: number): rect; - interface rect { - x: number; - y: number; - width: number; - height: number; - toString(): string; - origin(): point; - corner(): point; - topRight(): point; - bottomLeft(): point; - center(): point; - intersect(r: rect): boolean; - /// @return 'left' | 'right' | 'top' | 'bottom' - sideNearestToPoint(p: point): string; - containsPoint(p: point): boolean; - containsRect(r: rect): boolean; - pointNearestToPoint(p: point): point; - intersectionWithLineFromCenterToPoint(p: point, angle: number): point; - moveAndExpand(r: rect): rect; - round(decimals: number): rect; - normalize(): rect; - bbox(angle: number): rect; - } - } -} - export = joint; -} diff --git a/DKBFrontEnd/vendor/typings/local-modules/n3/index.d.ts b/DKBFrontEnd/vendor/typings/local-modules/n3/index.d.ts deleted file mode 100644 index afaaacdb0..000000000 --- a/DKBFrontEnd/vendor/typings/local-modules/n3/index.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -declare module "n3" { - class N3Parser { - parse( - string: string, - callback: (error: any, triple: Triple | undefined, prefix: any) => any - ): void; - } - - function Parser(): N3Parser; - - interface Triple { - subject: string; - predicate: string; - object: string; - } -} diff --git a/DKBFrontEnd/vendor/typings/local-modules/webcola/index.d.ts b/DKBFrontEnd/vendor/typings/local-modules/webcola/index.d.ts deleted file mode 100644 index 9b5a12dab..000000000 --- a/DKBFrontEnd/vendor/typings/local-modules/webcola/index.d.ts +++ /dev/null @@ -1,978 +0,0 @@ -declare module 'webcola' { - import * as D3 from 'd3'; - function applyPacking(graphs: Array, w: any, h: any, node_size: any, desired_ratio?: number): void; - function separateGraphs(nodes: any, links: any): any[]; - export module vpsc { - - class PositionStats { - scale: number; - AB: number; - AD: number; - A2: number; - constructor(scale: number); - addVariable(v: Variable): void; - getPosn(): number; - } - class Constraint { - left: Variable; - right: Variable; - gap: number; - equality: boolean; - lm: number; - active: boolean; - unsatisfiable: boolean; - constructor(left: Variable, right: Variable, gap: number, equality?: boolean); - slack(): number; - } - class Variable { - desiredPosition: number; - weight: number; - scale: number; - offset: number; - block: Block; - cIn: Constraint[]; - cOut: Constraint[]; - constructor(desiredPosition: number, weight?: number, scale?: number); - dfdv(): number; - position(): number; - visitNeighbours(prev: Variable, f: (c: Constraint, next: Variable) => void): void; - } - class Block { - vars: Variable[]; - posn: number; - ps: PositionStats; - blockInd: number; - constructor(v: Variable); - private addVariable(v); - updateWeightedPosition(): void; - private compute_lm(v, u, postAction); - private populateSplitBlock(v, prev); - traverse(visit: (c: Constraint) => any, acc: any[], v?: Variable, prev?: Variable): void; - findMinLM(): Constraint; - private findMinLMBetween(lv, rv); - private findPath(v, prev, to, visit); - isActiveDirectedPathBetween(u: Variable, v: Variable): boolean; - static split(c: Constraint): Block[]; - private static createSplitBlock(startVar); - splitBetween(vl: Variable, vr: Variable): { - constraint: Constraint; - lb: Block; - rb: Block; - }; - mergeAcross(b: Block, c: Constraint, dist: number): void; - cost(): number; - } - class Blocks { - vs: Variable[]; - private list; - constructor(vs: Variable[]); - cost(): number; - insert(b: Block): void; - remove(b: Block): void; - merge(c: Constraint): void; - forEach(f: (b: Block, i: number) => void): void; - updateBlockPositions(): void; - split(inactive: Constraint[]): void; - } - class Solver { - vs: Variable[]; - cs: Constraint[]; - bs: Blocks; - inactive: Constraint[]; - static LAGRANGIAN_TOLERANCE: number; - static ZERO_UPPERBOUND: number; - constructor(vs: Variable[], cs: Constraint[]); - cost(): number; - setStartingPositions(ps: number[]): void; - setDesiredPositions(ps: number[]): void; - private mostViolated(); - satisfy(): void; - solve(): number; - } - } - export module vpsc { - - interface Leaf { - bounds: Rectangle; - variable: Variable; - } - interface Group { - bounds: Rectangle; - padding: number; - stiffness: number; - leaves: Leaf[]; - groups: Group[]; - minVar: Variable; - maxVar: Variable; - } - function computeGroupBounds(g: Group): Rectangle; - class Rectangle { - x: number; - X: number; - y: number; - Y: number; - constructor(x: number, X: number, y: number, Y: number); - static empty(): Rectangle; - cx(): number; - cy(): number; - overlapX(r: Rectangle): number; - overlapY(r: Rectangle): number; - setXCentre(cx: number): void; - setYCentre(cy: number): void; - width(): number; - height(): number; - union(r: Rectangle): Rectangle; - /** - * return any intersection points between the given line and the sides of this rectangle - * @method lineIntersection - * @param x1 number first x coord of line - * @param y1 number first y coord of line - * @param x2 number second x coord of line - * @param y2 number second y coord of line - * @return any intersection points found - */ - lineIntersections(x1: number, y1: number, x2: number, y2: number): Array<{ - x: number; - y: number; - }>; - /** - * return any intersection points between a line extending from the centre of this rectangle to the given point, - * and the sides of this rectangle - * @method lineIntersection - * @param x2 number second x coord of line - * @param y2 number second y coord of line - * @return any intersection points found - */ - rayIntersection(x2: number, y2: number): { - x: number; - y: number; - }; - vertices(): { - x: number; - y: number; - }[]; - static lineIntersection(x1: number, y1: number, x2: number, y2: number, x3: number, y3: number, x4: number, y4: number): { - x: number; - y: number; - }; - inflate(pad: number): Rectangle; - } - function makeEdgeBetween(link: any, source: Rectangle, target: Rectangle, ah: number): void; - function makeEdgeTo(s: { - x: number; - y: number; - }, target: Rectangle, ah: number): { - x: number; - y: number; - }; - function generateXConstraints(rs: Rectangle[], vars: Variable[]): Constraint[]; - function generateYConstraints(rs: Rectangle[], vars: Variable[]): Constraint[]; - function generateXGroupConstraints(root: Group): Constraint[]; - function generateYGroupConstraints(root: Group): Constraint[]; - function removeOverlaps(rs: Rectangle[]): void; - interface GraphNode extends Leaf { - fixed: boolean; - width: number; - height: number; - x: number; - y: number; - px: number; - py: number; - } - class IndexedVariable extends Variable { - index: number; - constructor(index: number, w: number); - } - class Projection { - private nodes; - private groups; - private rootGroup; - private avoidOverlaps; - private xConstraints; - private yConstraints; - private variables; - constructor(nodes: GraphNode[], groups: Group[], rootGroup?: Group, constraints?: any[], avoidOverlaps?: boolean); - private createSeparation(c); - private makeFeasible(c); - private createAlignment(c); - private createConstraints(constraints); - private setupVariablesAndBounds(x0, y0, desired, getDesired); - xProject(x0: number[], y0: number[], x: number[]): void; - yProject(x0: number[], y0: number[], y: number[]): void; - projectFunctions(): { - (x0: number[], y0: number[], r: number[]): void; - }[]; - private project(x0, y0, start, desired, getDesired, cs, generateConstraints, updateNodeBounds, updateGroupBounds); - private solve(vs, cs, starting, desired); - } - } - export module geom { - - class Point { - x: number; - y: number; - } - class LineSegment { - x1: number; - y1: number; - x2: number; - y2: number; - constructor(x1: number, y1: number, x2: number, y2: number); - } - class PolyPoint extends Point { - polyIndex: number; - } - /** tests if a point is Left|On|Right of an infinite line. - * @param points P0, P1, and P2 - * @return >0 for P2 left of the line through P0 and P1 - * =0 for P2 on the line - * <0 for P2 right of the line - */ - function isLeft(P0: Point, P1: Point, P2: Point): number; - /** - * returns the convex hull of a set of points using Andrew's monotone chain algorithm - * see: http://geomalgorithms.com/a10-_hull-1.html#Monotone%20Chain - * @param S array of points - * @return the convex hull as an array of points - */ - function ConvexHull(S: Point[]): Point[]; - function clockwiseRadialSweep(p: Point, P: Point[], f: (point: Point) => void): void; - function tangent_PolyPolyC(V: Point[], W: Point[], t1: (a: Point, b: Point[]) => number, t2: (a: Point, b: Point[]) => number, cmp1: (a: Point, b: Point, c: Point) => boolean, cmp2: (a: Point, b: Point, c: Point) => boolean): { - t1: number; - t2: number; - }; - function LRtangent_PolyPolyC(V: Point[], W: Point[]): { - t1: number; - t2: number; - }; - function RLtangent_PolyPolyC(V: Point[], W: Point[]): { - t1: number; - t2: number; - }; - function LLtangent_PolyPolyC(V: Point[], W: Point[]): { - t1: number; - t2: number; - }; - function RRtangent_PolyPolyC(V: Point[], W: Point[]): { - t1: number; - t2: number; - }; - class BiTangent { - t1: number; - t2: number; - constructor(t1: number, t2: number); - } - class BiTangents { - rl: BiTangent; - lr: BiTangent; - ll: BiTangent; - rr: BiTangent; - } - class TVGPoint extends Point { - vv: VisibilityVertex; - } - class VisibilityVertex { - id: number; - polyid: number; - polyvertid: number; - p: TVGPoint; - constructor(id: number, polyid: number, polyvertid: number, p: TVGPoint); - } - class VisibilityEdge { - source: VisibilityVertex; - target: VisibilityVertex; - constructor(source: VisibilityVertex, target: VisibilityVertex); - length(): number; - } - class TangentVisibilityGraph { - P: TVGPoint[][]; - V: VisibilityVertex[]; - E: VisibilityEdge[]; - constructor(P: TVGPoint[][], g0?: { - V: VisibilityVertex[]; - E: VisibilityEdge[]; - }); - addEdgeIfVisible(u: TVGPoint, v: TVGPoint, i1: number, i2: number): void; - addPoint(p: TVGPoint, i1: number): VisibilityVertex; - private intersectsPolys(l, i1, i2); - } - function tangents(V: Point[], W: Point[]): BiTangents; - function polysOverlap(p: Point[], q: Point[]): boolean; - } - /** - * @module cola - */ - - /** - * Descent respects a collection of locks over nodes that should not move - * @class Locks - */ - class Locks { - locks: any; - /** - * add a lock on the node at index id - * @method add - * @param id index of node to be locked - * @param x required position for node - */ - add(id: number, x: number[]): void; - /** - * @method clear clear all locks - */ - clear(): void; - /** - * @isEmpty - * @returns false if no locks exist - */ - isEmpty(): boolean; - /** - * perform an operation on each lock - * @apply - */ - apply(f: (id: number, x: number[]) => void): void; - } - /** - * Uses a gradient descent approach to reduce a stress or p-stress goal function over a graph with specified ideal edge lengths or a square matrix of dissimilarities. - * The standard stress function over a graph nodes with position vectors x,y,z is (mathematica input): - * stress[x_,y_,z_,D_,w_]:=Sum[w[[i,j]] (length[x[[i]],y[[i]],z[[i]],x[[j]],y[[j]],z[[j]]]-d[[i,j]])^2,{i,Length[x]-1},{j,i+1,Length[x]}] - * where: D is a square matrix of ideal separations between nodes, w is matrix of weights for those separations - * length[x1_, y1_, z1_, x2_, y2_, z2_] = Sqrt[(x1 - x2)^2 + (y1 - y2)^2 + (z1 - z2)^2] - * below, we use wij = 1/(Dij^2) - * - * @class Descent - */ - class Descent { - D: number[][]; - G: number[][]; - threshold: number; - /** Hessian Matrix - * @property H {number[][][]} - */ - H: number[][][]; - /** gradient vector - * @property G {number[][]} - */ - g: number[][]; - /** positions vector - * @property x {number[][]} - */ - x: number[][]; - /** - * @property k {number} dimensionality - */ - k: number; - /** - * number of data-points / nodes / size of vectors/matrices - * @property n {number} - */ - n: number; - locks: Locks; - private static zeroDistance; - private minD; - private Hd; - private a; - private b; - private c; - private d; - private e; - private ia; - private ib; - private xtmp; - numGridSnapNodes: number; - snapGridSize: number; - snapStrength: number; - scaleSnapByMaxH: boolean; - private random; - project: { - (x0: number[], y0: number[], r: number[]): void; - }[]; - /** - * @method constructor - * @param x {number[][]} initial coordinates for nodes - * @param D {number[][]} matrix of desired distances between pairs of nodes - * @param G {number[][]} [default=null] if specified, G is a matrix of weights for goal terms between pairs of nodes. - * If G[i][j] > 1 and the separation between nodes i and j is greater than their ideal distance, then there is no contribution for this pair to the goal - * If G[i][j] <= 1 then it is used as a weighting on the contribution of the variance between ideal and actual separation between i and j to the goal function - */ - constructor(x: number[][], D: number[][], G?: number[][]); - static createSquareMatrix(n: number, f: (i: number, j: number) => number): number[][]; - private offsetDir(); - computeDerivatives(x: number[][]): void; - private static dotProd(a, b); - private static rightMultiply(m, v, r); - computeStepSize(d: number[][]): number; - reduceStress(): number; - private static copy(a, b); - private stepAndProject(x0, r, d, stepSize); - private static mApply(m, n, f); - private matrixApply(f); - private computeNextPosition(x0, r); - run(iterations: number): number; - rungeKutta(): number; - private static mid(a, b, m); - takeDescentStep(x: number[], d: number[], stepSize: number): void; - computeStress(): number; - } - class PseudoRandom { - seed: number; - private a; - private c; - private m; - private range; - constructor(seed?: number); - getNext(): number; - getNextBetween(min: number, max: number): number; - } - export module powergraph { - - interface LinkAccessor { - getSourceIndex(l: Link): number; - getTargetIndex(l: Link): number; - getType(l: Link): number; - } - class PowerEdge { - source: any; - target: any; - type: number; - constructor(source: any, target: any, type: number); - } - class Configuration { - private linkAccessor; - modules: Module[]; - roots: ModuleSet[]; - R: number; - constructor(n: number, edges: Link[], linkAccessor: LinkAccessor, rootGroup?: any[]); - private initModulesFromGroup(group); - merge(a: Module, b: Module, k?: number): Module; - private rootMerges(k?); - greedyMerge(): boolean; - private nEdges(a, b); - getGroupHierarchy(retargetedEdges: PowerEdge[]): any[]; - allEdges(): PowerEdge[]; - static getEdges(modules: ModuleSet, es: PowerEdge[]): void; - } - class Module { - id: number; - outgoing: LinkSets; - incoming: LinkSets; - children: ModuleSet; - definition: any; - gid: number; - constructor(id: number, outgoing?: LinkSets, incoming?: LinkSets, children?: ModuleSet, definition?: any); - getEdges(es: PowerEdge[]): void; - isLeaf(): boolean; - isIsland(): boolean; - isPredefined(): boolean; - } - class ModuleSet { - table: any; - count(): number; - intersection(other: ModuleSet): ModuleSet; - intersectionCount(other: ModuleSet): number; - contains(id: number): boolean; - add(m: Module): void; - remove(m: Module): void; - forAll(f: (m: Module) => void): void; - modules(): Module[]; - } - class LinkSets { - sets: any; - n: number; - count(): number; - contains(id: number): boolean; - add(linktype: number, m: Module): void; - remove(linktype: number, m: Module): void; - forAll(f: (ms: ModuleSet, linktype: number) => void): void; - forAllModules(f: (m: Module) => void): void; - intersection(other: LinkSets): LinkSets; - } - function getGroups(nodes: any[], links: Link[], la: LinkAccessor, rootGroup?: any[]): { - groups: any[]; - powerEdges: PowerEdge[]; - }; - } - /** - * @module cola - */ - - interface LinkAccessor { - getSourceIndex(l: Link): number; - getTargetIndex(l: Link): number; - } - interface LinkLengthAccessor extends LinkAccessor { - setLength(l: Link, value: number): void; - } - /** modify the specified link lengths based on the symmetric difference of their neighbours - * @class symmetricDiffLinkLengths - */ - function symmetricDiffLinkLengths(links: Link[], la: LinkLengthAccessor, w?: number): void; - /** modify the specified links lengths based on the jaccard difference between their neighbours - * @class jaccardLinkLengths - */ - function jaccardLinkLengths(links: Link[], la: LinkLengthAccessor, w?: number): void; - interface IConstraint { - left: number; - right: number; - gap: number; - } - interface DirectedEdgeConstraints { - axis: string; - gap: number; - } - interface LinkSepAccessor extends LinkAccessor { - getMinSeparation(l: Link): number; - } - /** generate separation constraints for all edges unless both their source and sink are in the same strongly connected component - * @class generateDirectedEdgeConstraints - */ - function generateDirectedEdgeConstraints(n: number, links: Link[], axis: string, la: LinkSepAccessor): IConstraint[]; - export class PairingHeap { - elem: T; - private subheaps; - constructor(elem: T); - toString(selector: any): string; - forEach(f: any): void; - count(): number; - min(): T; - empty(): boolean; - contains(h: PairingHeap): boolean; - isHeap(lessThan: (a: T, b: T) => boolean): boolean; - insert(obj: T, lessThan: any): PairingHeap; - merge(heap2: PairingHeap, lessThan: any): PairingHeap; - removeMin(lessThan: (a: T, b: T) => boolean): PairingHeap; - mergePairs(lessThan: (a: T, b: T) => boolean): PairingHeap; - decreaseKey(subheap: PairingHeap, newValue: T, setHeapNode: (e: T, h: PairingHeap) => void, lessThan: (a: T, b: T) => boolean): PairingHeap; - } - /** - * @class PriorityQueue a min priority queue backed by a pairing heap - */ - export class PriorityQueue { - private lessThan; - private root; - constructor(lessThan: (a: T, b: T) => boolean); - /** - * @method top - * @return the top element (the min element as defined by lessThan) - */ - top(): T; - /** - * @method push - * put things on the heap - */ - push(...args: T[]): PairingHeap; - /** - * @method empty - * @return true if no more elements in queue - */ - empty(): boolean; - /** - * @method isHeap check heap condition (for testing) - * @return true if queue is in valid state - */ - isHeap(): boolean; - /** - * @method forEach apply f to each element of the queue - * @param f function to apply - */ - forEach(f: any): void; - /** - * @method pop remove and return the min element from the queue - */ - pop(): T; - /** - * @method reduceKey reduce the key value of the specified heap node - */ - reduceKey(heapNode: PairingHeap, newKey: T, setHeapNode?: (e: T, h: PairingHeap) => void): void; - toString(selector: any): string; - /** - * @method count - * @return number of elements in queue - */ - count(): number; - } - /** - * @module shortestpaths - */ - export module shortestpaths { - - /** - * calculates all-pairs shortest paths or shortest paths from a single node - * @class Calculator - * @constructor - * @param n {number} number of nodes - * @param es {Edge[]} array of edges - */ - class Calculator { - n: number; - es: Link[]; - private neighbours; - constructor(n: number, es: Link[], getSourceIndex: (link: Link) => number, getTargetIndex: (link: Link) => number, getLength: (link: Link) => number); - /** - * compute shortest paths for graph over n nodes with edges an array of source/target pairs - * edges may optionally have a length attribute. 1 is the default. - * Uses Johnson's algorithm. - * - * @method DistanceMatrix - * @return the distance matrix - */ - DistanceMatrix(): number[][]; - /** - * get shortest paths from a specified start node - * @method DistancesFromNode - * @param start node index - * @return array of path lengths - */ - DistancesFromNode(start: number): number[]; - PathFromNodeToNode(start: number, end: number): number[]; - PathFromNodeToNodeWithPrevCost(start: number, end: number, prevCost: (u: number, v: number, w: number) => number): number[]; - private dijkstraNeighbours(start, dest?); - } - } - /** - * @module cola - */ - - /** - * The layout process fires three events: - * - start: layout iterations started - * - tick: fired once per iteration, listen to this to animate - * - end: layout converged, you might like to zoom-to-fit or something at notification of this event - */ - enum EventType { - start = 0, - tick = 1, - end = 2, - } - interface Event { - type: EventType; - alpha: number; - stress?: number; - listener?: () => void; - } - interface Node { - x: number; - y: number; - } - interface Link { - source: NodeType; - target: NodeType; - length?: number; - } - /** - * Main interface to cola layout. - * @class Layout - */ - class Layout { - private _canvasSize; - private _linkDistance; - private _defaultNodeSize; - private _linkLengthCalculator; - private _linkType; - private _avoidOverlaps; - private _handleDisconnected; - private _alpha; - private _lastStress; - private _running; - private _nodes; - private _groups; - private _variables; - private _rootGroup; - private _links; - private _constraints; - private _distanceMatrix; - private _descent; - private _directedLinkConstraints; - private _threshold; - private _visibilityGraph; - private _groupCompactness; - protected event: any; - on(e: EventType | string, listener: (event: Event) => void): Layout; - protected trigger(e: Event): void; - protected kick(): void; - /** - * iterate the layout. Returns true when layout converged. - */ - protected tick(): boolean; - /** - * the list of nodes. - * If nodes has not been set, but links has, then we instantiate a nodes list here, of the correct size, - * before returning it. - * @property nodes {Array} - * @default empty list - */ - nodes(): Array; - nodes(v: Array): Layout; - /** - * a list of hierarchical groups defined over nodes - * @property groups {Array} - * @default empty list - */ - groups(): Array; - groups(x: Array): Layout; - powerGraphGroups(f: Function): Layout; - /** - * if true, the layout will not permit overlaps of the node bounding boxes (defined by the width and height properties on nodes) - * @property avoidOverlaps - * @type bool - * @default false - */ - avoidOverlaps(): boolean; - avoidOverlaps(v: boolean): Layout; - /** - * if true, the layout will not permit overlaps of the node bounding boxes (defined by the width and height properties on nodes) - * @property avoidOverlaps - * @type bool - * @default false - */ - handleDisconnected(): boolean; - handleDisconnected(v: boolean): Layout; - /** - * causes constraints to be generated such that directed graphs are laid out either from left-to-right or top-to-bottom. - * a separation constraint is generated in the selected axis for each edge that is not involved in a cycle (part of a strongly connected component) - * @param axis {string} 'x' for left-to-right, 'y' for top-to-bottom - * @param minSeparation {number|link=>number} either a number specifying a minimum spacing required across all links or a function to return the minimum spacing for each link - */ - flowLayout(axis: string, minSeparation: number | ((t: any) => number)): Layout; - /** - * links defined as source, target pairs over nodes - * @property links {array} - * @default empty list - */ - links(): Array>; - links(x: Array>): Layout; - /** - * list of constraints of various types - * @property constraints - * @type {array} - * @default empty list - */ - constraints(): Array; - constraints(c: Array): Layout; - /** - * Matrix of ideal distances between all pairs of nodes. - * If unspecified, the ideal distances for pairs of nodes will be based on the shortest path distance between them. - * @property distanceMatrix - * @type {Array of Array of Number} - * @default null - */ - distanceMatrix(): Array>; - distanceMatrix(d: Array>): Layout; - /** - * Size of the layout canvas dimensions [x,y]. Currently only used to determine the midpoint which is taken as the starting position - * for nodes with no preassigned x and y. - * @property size - * @type {Array of Number} - */ - size(): Array; - size(x: Array): Layout; - /** - * Default size (assume nodes are square so both width and height) to use in packing if node width/height are not specified. - * @property defaultNodeSize - * @type {Number} - */ - defaultNodeSize(): number; - defaultNodeSize(x: number): Layout; - /** - * The strength of attraction between the group boundaries to each other. - * @property defaultNodeSize - * @type {Number} - */ - groupCompactness(): number; - groupCompactness(x: number): Layout; - /** - * links have an ideal distance, The automatic layout will compute layout that tries to keep links (AKA edges) as close as possible to this length. - */ - linkDistance(): number; - linkDistance(): (t: any) => number; - linkDistance(x: number): Layout; - linkDistance(x: (t: any) => number): Layout; - linkType(f: Function | number): Layout; - convergenceThreshold(): number; - convergenceThreshold(x: number): Layout; - alpha(): number; - alpha(x: number): Layout; - getLinkLength(link: any): number; - static setLinkLength(link: any, length: number): void; - getLinkType(link: any): number; - linkAccessor: { - getSourceIndex: (e: any) => any; - getTargetIndex: (e: any) => any; - setLength: (link: any, length: number) => void; - getType: (l: any) => any; - }; - /** - * compute an ideal length for each link based on the graph structure around that link. - * you can use this (for example) to create extra space around hub-nodes in dense graphs. - * In particular this calculation is based on the "symmetric difference" in the neighbour sets of the source and target: - * i.e. if neighbours of source is a and neighbours of target are b then calculation is: sqrt(|a union b| - |a intersection b|) - * Actual computation based on inspection of link structure occurs in start(), so links themselves - * don't have to have been assigned before invoking this function. - * @param {number} [idealLength] the base length for an edge when its source and start have no other common neighbours (e.g. 40) - * @param {number} [w] a multiplier for the effect of the length adjustment (e.g. 0.7) - */ - symmetricDiffLinkLengths(idealLength: number, w?: number): Layout; - /** - * compute an ideal length for each link based on the graph structure around that link. - * you can use this (for example) to create extra space around hub-nodes in dense graphs. - * In particular this calculation is based on the "symmetric difference" in the neighbour sets of the source and target: - * i.e. if neighbours of source is a and neighbours of target are b then calculation is: |a intersection b|/|a union b| - * Actual computation based on inspection of link structure occurs in start(), so links themselves - * don't have to have been assigned before invoking this function. - * @param {number} [idealLength] the base length for an edge when its source and start have no other common neighbours (e.g. 40) - * @param {number} [w] a multiplier for the effect of the length adjustment (e.g. 0.7) - */ - jaccardLinkLengths(idealLength: number, w?: number): Layout; - /** - * start the layout process - * @method start - * @param {number} [initialUnconstrainedIterations=0] unconstrained initial layout iterations - * @param {number} [initialUserConstraintIterations=0] initial layout iterations with user-specified constraints - * @param {number} [initialAllConstraintsIterations=0] initial layout iterations with all constraints including non-overlap - * @param {number} [gridSnapIterations=0] iterations of "grid snap", which pulls nodes towards grid cell centers - grid of size node[0].width - only really makes sense if all nodes have the same width and height - * @param [keepRunning=true] keep iterating asynchronously via the tick method - */ - start( - initialUnconstrainedIterations?: number, - initialUserConstraintIterations?: number, - initialAllConstraintsIterations?: number, - gridSnapIterations?: number, - keepRunning?: boolean - ): Layout; - resume(): Layout; - stop(): Layout; - prepareEdgeRouting(nodeMargin?: number): void; - routeEdge(d: any, draw: any): any[]; - static getSourceIndex(e: any): any; - static getTargetIndex(e: any): any; - static linkId(e: any): string; - static dragStart(d: any): void; - static dragEnd(d: any): void; - static mouseOver(d: any): void; - static mouseOut(d: any): void; - } - - class D3StyleLayoutAdaptor extends Layout { - event: D3.Dispatch; - trigger(e: Event): void; - kick(): void; - drag: () => any; - constructor(); - on(eventType: EventType | string, listener: () => void): D3StyleLayoutAdaptor; - } - /** - * provides an interface for use with d3: - * - uses the d3 event system to dispatch layout events such as: - * o "start" (start layout process) - * o "tick" (after each layout iteration) - * o "end" (layout converged and complete). - * - uses the d3 timer to queue layout iterations. - * - sets up d3.behavior.drag to drag nodes - * o use `node.call(.drag)` to make nodes draggable - * returns an instance of the Layout itself with which the user - * can interact directly. - */ - function d3adaptor(): D3StyleLayoutAdaptor; - - interface NodeAccessor { - getChildren(v: Node): number[]; - getBounds(v: Node): vpsc.Rectangle; - } - class NodeWrapper { - id: number; - rect: vpsc.Rectangle; - children: number[]; - leaf: boolean; - parent: NodeWrapper; - ports: Vert[]; - constructor(id: number, rect: vpsc.Rectangle, children: number[]); - } - class Vert { - id: number; - x: number; - y: number; - node: NodeWrapper; - line: any; - constructor(id: number, x: number, y: number, node?: NodeWrapper, line?: any); - } - class LongestCommonSubsequence { - s: T[]; - t: T[]; - length: number; - si: number; - ti: number; - reversed: boolean; - constructor(s: T[], t: T[]); - private static findMatch(s, t); - getSequence(): T[]; - } - class GridRouter { - originalnodes: Node[]; - groupPadding: number; - leaves: any[]; - groups: NodeWrapper[]; - nodes: NodeWrapper[]; - cols: any; - rows: any; - root: any; - verts: Vert[]; - edges: any; - backToFront: any; - obstacles: any; - passableEdges: any; - private avg(a); - private getGridDim(axis); - private getDepth(v); - private midPoints(a); - constructor(originalnodes: Node[], accessor: NodeAccessor, groupPadding?: number); - private findLineage(v); - private findAncestorPathBetween(a, b); - siblingObstacles(a: any, b: any): any; - static getSegmentSets(routes: any, x: any, y: any): any[]; - static nudgeSegs(x: string, y: string, routes: any, segments: any, leftOf: any, gap: number): void; - static nudgeSegments(routes: any, x: string, y: string, leftOf: (e1: number, e2: number) => boolean, gap: number): void; - routeEdges(edges: Edge[], gap: number, source: (e: Edge) => number, target: (e: Edge) => number): geom.Point[][][]; - static unreverseEdges(routes: any, routePaths: any): void; - static angleBetween2Lines(line1: geom.Point[], line2: geom.Point[]): number; - private static isLeft(a, b, c); - private static getOrder(pairs); - static orderEdges(edges: any): (l: number, r: number) => boolean; - static makeSegments(path: geom.Point[]): geom.Point[][]; - route(s: number, t: number): geom.Point[]; - static getRoutePath(route: geom.Point[][], cornerradius: number, arrowwidth: number, arrowheight: number): { - routepath: string; - arrowpath: string; - }; - } - /** - * Use cola to do a layout in 3D!! Yay. - * Pretty simple for the moment. - */ - - class Link3D { - source: number; - target: number; - length: number; - constructor(source: number, target: number); - actualLength(x: number[][]): number; - } - class Node3D { - x: number; - y: number; - z: number; - fixed: boolean; - constructor(x?: number, y?: number, z?: number); - } - class Layout3D { - nodes: Node3D[]; - links: Link3D[]; - idealLinkLength: number; - static dims: string[]; - static k: number; - result: number[][]; - constructor(nodes: Node3D[], links: Link3D[], idealLinkLength: number); - linkLength(l: Link3D): number; - descent: Descent; - start(iterations?: number): Layout3D; - tick(): number; - } -} diff --git a/DKBFrontEnd/vendor/typings/local.d.ts b/DKBFrontEnd/vendor/typings/local.d.ts deleted file mode 100644 index 8498b9786..000000000 --- a/DKBFrontEnd/vendor/typings/local.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -/// -/// -/// -/// -/// -/// -/// -/// -/// diff --git a/DKBFrontEnd/vendor/typings/local/bootstrap.jquery/bootstrap.jquery.d.ts b/DKBFrontEnd/vendor/typings/local/bootstrap.jquery/bootstrap.jquery.d.ts deleted file mode 100644 index 1fcecdc0f..000000000 --- a/DKBFrontEnd/vendor/typings/local/bootstrap.jquery/bootstrap.jquery.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -interface JQuery { - /** - * Shows or hides a modal dialog - **/ - modal(showOrHide: string): void; - modal(options: { - backdrop: string; - keyboard: boolean; - show: boolean; - }): void; - - serializeObject(): any; - deserialize(data: any): void; - - fileupload(options: { - url: string; - dataType: string; - done: (e: any, data: any) => void; - progressall: (e: any, data: any) => void; - start: (e: any, data: any) => void; - onRemove: (id: string) => void; - }): JQuery; -} - -interface JQuerySupport { - fileInput?: boolean; -} diff --git a/DKBFrontEnd/vendor/typings/local/require/require.d.ts b/DKBFrontEnd/vendor/typings/local/require/require.d.ts deleted file mode 100644 index 3325410cd..000000000 --- a/DKBFrontEnd/vendor/typings/local/require/require.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -declare var require: { - (path: string): T; - (paths: string[], callback: (...modules: any[]) => void): void; - ensure: (paths: string[], callback: (require: (path: string) => T) => void) => void; -}; \ No newline at end of file diff --git a/DKBFrontEnd/vendor/webpack.config.js b/DKBFrontEnd/vendor/webpack.config.js deleted file mode 100644 index bf0daca2a..000000000 --- a/DKBFrontEnd/vendor/webpack.config.js +++ /dev/null @@ -1,56 +0,0 @@ -var webpack = require('webpack'); -var path = require('path'); - -var npmDir = path.join(__dirname, 'node_modules'); - -// if BUNDLE_PEERS is set, we'll produce bundle with all dependencies -var bundlePeers = Boolean(process.env.BUNDLE_PEERS); - -module.exports = { - entry: { - ontodia: path.join(__dirname, 'src', 'index.ts'), - }, - resolve: { - extensions: ['', '.ts', '.tsx', '.webpack.js', '.web.js', '.js'], - alias: { - // Backbone provided by joint.js, to prevent module duplication which - // causes errors when Ontodia uses Backbone models from joint.js - 'backbone': path.join(npmDir, 'backbone', 'backbone.js'), - // awful and temporary workaround to reference browser bundle instead of node's, see: - // https://github.com/wycats/handlebars.js/issues/1102 - 'handlebars': path.join(npmDir, 'handlebars', 'dist', 'handlebars.min.js'), - }, - }, - module: { - loaders: [ - {test: /\.ts$|\.tsx$/, loader: 'ts-loader'}, - {test: /\.css$/, loader: 'style-loader!css-loader'}, - {test: /\.scss$/, loader: 'style-loader!css-loader!sass-loader'}, - {test: /\.jpe?g$/, loader: 'url-loader?mimetype=image/jpeg'}, - {test: /\.gif$/, loader: 'url-loader?mimetype=image/gif'}, - {test: /\.png$/, loader: 'url-loader?mimetype=image/png'}, - ], - }, - plugins: [], - output: { - path: path.join(__dirname, 'dist'), - filename: 'ontodia.js', - library: 'Ontodia', - libraryTarget: 'umd', - }, - externals: !bundlePeers ? { - 'd3-color': true, - 'intro.js': true, - 'jointjs': true, - 'jquery': true, - 'handlebars': true, - 'lodash': true, - 'n3': true, - 'react': true, - 'react-dom': true, - 'backbone': true, - 'webcola': true, - 'whatwg-fetch': true, - } : {}, - devtool: '#source-map', -}; diff --git a/DKBFrontEnd/vendor/webpack.demo.config.js b/DKBFrontEnd/vendor/webpack.demo.config.js deleted file mode 100644 index d8f4fcc02..000000000 --- a/DKBFrontEnd/vendor/webpack.demo.config.js +++ /dev/null @@ -1,115 +0,0 @@ -var webpack = require('webpack'); -var path = require('path'); - -var CommonsChunkPlugin = require("webpack/lib/optimize/CommonsChunkPlugin"); -var HtmlWebpackPlugin = require('html-webpack-plugin'); - -var npmDir = path.join(__dirname, 'node_modules'); - -module.exports = { - entry: { - demo: path.join(__dirname, 'src', 'examples', 'demo.ts'), - sparql: path.join(__dirname, 'src', 'examples', 'sparql.ts'), - dbpedia: path.join(__dirname, 'src', 'examples', 'dbpedia.ts'), - sparqlNoStats: path.join(__dirname, 'src', 'examples', 'sparqlNoStats.ts'), - sparqlConstruct: path.join(__dirname, 'src', 'examples', 'sparqlConstruct.ts'), - sparqlRDFGraph: path.join(__dirname, 'src', 'examples', 'sparqlRDFGraph.ts'), - styleCustomization: path.join(__dirname, 'src', 'examples', 'styleCustomization.ts'), - wikidata: path.join(__dirname, 'src', 'examples', 'wikidata.ts'), - wikidataGraph: path.join(__dirname, 'src', 'examples', 'wikidataGraph.ts'), - }, - resolve: { - extensions: ['', '.ts', '.tsx', '.webpack.js', '.web.js', '.js'], - alias: { - // Backbone provided by joint.js, to prevent module duplication which - // causes errors when Ontodia uses Backbone models from joint.js - 'backbone': path.join(npmDir, 'backbone', 'backbone.js'), - // awful and temporary workaround to reference browser bundle instead of node's, see: - // https://github.com/wycats/handlebars.js/issues/1102 - 'handlebars': path.join(npmDir, 'handlebars', 'dist', 'handlebars.min.js'), - }, - }, - module: { - loaders: [ - {test: /\.ts$|\.tsx$/, loader: 'ts-loader'}, - {test: /\.css$/, loader: 'style-loader!css-loader'}, - {test: /\.scss$/, loader: 'style-loader!css-loader!sass-loader'}, - {test: /\.jpe?g$/, loader: 'url-loader?mimetype=image/jpeg'}, - {test: /\.gif$/, loader: 'url-loader?mimetype=image/gif'}, - {test: /\.png$/, loader: 'url-loader?mimetype=image/png'}, - ], - }, - plugins: [ - new HtmlWebpackPlugin({ - title: 'Ontodia Local Demo', - chunks: ['commons', 'demo'], - template: path.join(__dirname, 'src', 'examples', 'template.ejs'), - }), - new HtmlWebpackPlugin({ - filename: 'sparql.html', - title: 'Ontodia SparQL Demo', - chunks: ['commons', 'sparql'], - template: path.join(__dirname, 'src', 'examples', 'template.ejs'), - }), - new HtmlWebpackPlugin({ - filename: 'dbpedia.html', - title: 'Ontodia DBPedia SparQL Demo', - chunks: ['commons', 'dbpedia'], - template: path.join(__dirname, 'src', 'examples', 'template.ejs'), - }), - new HtmlWebpackPlugin({ - filename: 'sparqlNoStats.html', - title: 'Ontodia SparQL Demo', - chunks: ['commons', 'sparqlNoStats'], - template: path.join(__dirname, 'src', 'examples', 'template.ejs'), - }), - new HtmlWebpackPlugin({ - filename: 'sparqlConstruct.html', - title: 'Ontodia SparQL Construct Demo', - chunks: ['commons', 'sparqlConstruct'], - template: path.join(__dirname, 'src', 'examples', 'template.ejs'), - }), - new HtmlWebpackPlugin({ - filename: 'sparqlRDFGraph.html', - title: 'Ontodia SparQL RDF Graph Demo', - chunks: ['commons', 'sparqlRDFGraph'], - template: path.join(__dirname, 'src', 'examples', 'template.ejs'), - }), - new HtmlWebpackPlugin({ - filename: 'styleCustomization.html', - title: 'Ontodia Style Customization Demo', - chunks: ['commons', 'styleCustomization', ], - template: path.join(__dirname, 'src', 'examples', 'template.ejs'), - }), - new HtmlWebpackPlugin({ - filename: 'wikidata.html', - title: 'Ontodia Wikidata Demo', - chunks: ['commons', 'wikidata', ], - template: path.join(__dirname, 'src', 'examples', 'template.ejs'), - }), - new HtmlWebpackPlugin({ - filename: 'wikidataGraph.html', - title: 'Ontodia Wikidata with graph Demo', - chunks: ['commons', 'wikidataGraph', ], - template: path.join(__dirname, 'src', 'examples', 'template.ejs'), - }), - new CommonsChunkPlugin('commons', 'commons.chunk.js'), - ], - output: { - path: path.join(__dirname, 'dist', 'examples'), - filename: '[name].bundle.js', - chunkFilename: '[id].chunk.js', - publicPath: '/', - }, - devtool: '#source-map', - devServer: { - proxy: { - "/sparql-endpoint**": { - target: process.env.SPARQL_ENDPOINT, - pathRewrite: {'/sparql-endpoint' : ''}, - changeOrigin: true, - secure: false, - }, - }, - }, -}; diff --git a/README b/README index 9df243454..0e6603a58 100644 --- a/README +++ b/README @@ -8,11 +8,6 @@ Directory layout Impala dkb_schema.sql -./DKBFrontEnd/ # Web interface - src/ # Application - deployment/ # Scripts and helpers for Web server deployment - vendor/ # Vendor code (currently for Ontodia) - ./Utils/ # Data and database management scripts Virtuoso/ load_ontology.sh