Skip to content
This repository has been archived by the owner on Sep 26, 2024. It is now read-only.

WIP VOWL notation for owl #78

Open
wants to merge 74 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
c7385b8
Select for owl has been added
toefl Oct 21, 2017
e911164
Export changed for class and datatype
toefl Oct 22, 2017
4de3a56
Changes for import owl templates bigIcon and defaultElement
toefl Oct 22, 2017
373a7af
Owl templates added
toefl Oct 22, 2017
c270701
Styles for datatypeProperty and ObjectProperty added
toefl Oct 22, 2017
943985e
<hr> tags color has been fixed
toefl Oct 22, 2017
6b3809e
Trying for add thing styles. Troubles with comment for Thing
toefl Oct 23, 2017
539dfb9
Problems with things comment was fixed
toefl Oct 24, 2017
497c495
Problems with comments was fixed.
toefl Oct 25, 2017
2333451
Merge branch 'master' of https://github.com/toefl/Ontodia-org
toefl Oct 25, 2017
f30038b
Tabulatioin
toefl Oct 25, 2017
ca0166b
Changes with templates color
Oct 28, 2017
0ea5e59
Owl marks were added
Oct 30, 2017
733ad20
Comments for owl notation were deleted.
Nov 2, 2017
7e853f0
Merge branch 'master' of https://github.com/ontodia-org/ontodia
Nov 5, 2017
e67ebbe
VOWL classes renamed
Nov 5, 2017
968cd58
Added possibility to use both visualization. Excess classes removed
Nov 8, 2017
517f58e
Merge branch 'master' of https://github.com/ontodia-org/ontodia
Nov 11, 2017
8850feb
Refactoring by comments Alexey
Nov 13, 2017
e17fb56
Installed TSLint. Fixed remarks
Nov 13, 2017
18bfa7a
Rename VOWLClass.tsx to vowlClass.tsx
toefl Nov 13, 2017
504eb09
Refactoring by comments Alexey
Nov 29, 2017
e0b6ef4
Merge branch 'master' of https://github.com/toefl/ontodia
Nov 29, 2017
ec65573
refactoring
Nov 29, 2017
31caaf5
Rename _vowlClass.scss to _VowlClass.scss
toefl Nov 29, 2017
3862ae3
Rename _vowlProperty.scss to _VowlProperty.scss
toefl Nov 29, 2017
12ce8a2
Rename vowlClass.tsx to VowlClass.tsx
toefl Nov 29, 2017
a2d7123
Update main.scss
toefl Nov 29, 2017
26b1010
corrected typos
Nov 29, 2017
8965c51
Merge branch 'master' of https://github.com/toefl/ontodia
Nov 29, 2017
1f87b6c
Merge branch 'master' of https://github.com/ontodia-org/ontodia
Dec 3, 2017
0d445c6
IE11 Compatibility. (Export PNG/SVG)
Ladone3 Jan 10, 2018
eac5133
Clearing code for PR.
Ladone3 Jan 23, 2018
ebdd46e
Function isFinite was moved to polyfills.ts. Unnecessary dependencies…
Ladone3 Jan 24, 2018
ae6ecd9
Fixes after getting changes
Jan 28, 2018
2e6571d
Rename VowlClass.tsx to vowlClass.tsx
toefl Jan 28, 2018
ca0af3d
Rename VowlProperty.tsx to vowlProperty.tsx
toefl Jan 28, 2018
70f04e3
rdfLoader was improved. In case of getting file fetching error we thr…
Feb 1, 2018
09857e9
Updated linkConfigurations processing to reflect recent linkTypesOf c…
yuricus Feb 6, 2018
afcd1ff
Fix exporting PNG, add SUPPORT_IE environment variable to build with …
AlexeyMz Jan 30, 2018
29093da
Merge pull request #87 from ontodia-org/IE11-compatibility
AlexeyMz Feb 6, 2018
e8df5ee
Add ability to set external widgets, expose internal events and methods:
Ladone3 Jan 30, 2018
bf2bb2e
Naming changes related to internal API
AlexeyMz Feb 6, 2018
91248ae
Merge pull request #93 from ontodia-org/external-widgets
AlexeyMz Feb 6, 2018
dea0aad
Fix styles of the links labels
Feb 5, 2018
676a908
Refactor LinkLayer, use getBBox() to measure link labels
AlexeyMz Feb 7, 2018
9f0dfd5
Merge pull request #91 from ontodia-org/links-labels-styles
AlexeyMz Feb 7, 2018
413109a
Add missing IE polyfills, don't render property table in collapsed de…
AlexeyMz Feb 7, 2018
dbec30c
Add pointer callbacks to the API, fix loading spinner centering (#94)
blolg Feb 7, 2018
7c704f2
Add checking the existence of a link marker in the mount callback (#95)
blolg Feb 8, 2018
334206a
Update README.md
Feb 12, 2018
a2ed2e1
Add rewriting https to http when we create element. (#97)
Feb 15, 2018
97c7138
Improve error indication. (#100)
Feb 15, 2018
9f49263
Support element nesting, import RDF data, merge composite statistics.
Dec 13, 2017
79e0cb8
Refactor DiagramModel, fix InstancesSearch, use better typings for El…
AlexeyMz Feb 15, 2018
11682ae
Add .iri helper property to DiagramElement
AlexeyMz Feb 22, 2018
ef83da8
Merge pull request #81 from ontodia-org/nested-nodes
AlexeyMz Feb 22, 2018
4c3b9c3
Fix bug with self-routing. Add halo refresh on connectionMenu hiding.…
Feb 22, 2018
eb4e550
Add .panning property and fire PointerEvent even if modifier key is p…
Feb 22, 2018
e7d1c1c
Make PaperArea available from workspace, rename internal_ prefix to j…
Feb 26, 2018
df4cc15
Remove the uri2name from rdf/sparql data providers and check labels i…
Ladone3 Feb 14, 2018
9a97996
Extract getLocalizedText() logic into formalLocalizedLabel()
AlexeyMz Feb 26, 2018
43413e4
Merge pull request #96 from ontodia-org/fixing-labels
AlexeyMz Feb 26, 2018
cbdf339
Update CHANGELOG.md
AlexeyMz Feb 26, 2018
9cc1228
Fix and refactor RdfDataProvider: (#98)
Mar 2, 2018
e5a6d71
Vectorize "delete", "navigate" and "close navigation" icons in Halo
AlexeyMz Mar 5, 2018
6fcee50
Refactor module structure
AlexeyMz Mar 5, 2018
c3a5c1b
Reverted changing element IRI from https to http
yuricus Mar 13, 2018
5f16dfe
Polyfill the remove method in IE (#104)
blolg Mar 14, 2018
cf2e16d
Fixed OWL/RDFS SPARQL config to display only links user can navigate …
yuricus Mar 20, 2018
6a7c308
Ontodia tree. Work in propgress.
Mar 28, 2018
101dde8
File to import has been renamed
Mar 28, 2018
b30fb6c
Rename _VowlClass.scss to _vowlClass.scss
toefl Mar 28, 2018
d842e88
Rename _VowlProperty.scss to _vowlProperty.scss
toefl Mar 28, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions src/examples/demoOwl.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import { createElement, ClassAttributes } from 'react';
import * as ReactDOM from 'react-dom';

import { Workspace, WorkspaceProps, DemoDataProvider, LinkTemplate } from '../index';

import { onPageLoad, tryLoadLayoutFromLocalStorage, saveLayoutToLocalStorage } from './common';

require('jointjs/css/layout.css');
require('jointjs/css/themes/default.css');

const CUSTOM_LINK_TEMPLATE_SUBCLASSOF: LinkTemplate = {
renderLink: () => ({
connection: {
stroke: 'black',
'stroke-width': 2,
'stroke-dasharray':'5,5',
},
label: {
attrs: {text: {fill: 'black'}},
},
}),
};
const CUSTOM_LINK_TEMPLATE: LinkTemplate = {
renderLink: () => ({
connection: {
stroke: 'black',
'stroke-width': 2,
},
label: {
attrs: {text: {fill: 'black'}},
},
}),
};
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<Workspace> = {
ref: onWorkspaceMounted,
onSaveDiagram: workspace => {
const {layoutData} = workspace.getModel().exportLayout();
window.location.hash = saveLayoutToLocalStorage(layoutData);
window.location.reload();
},
viewOptions: {
linkTemplateResolvers: [
type => {
if ( type.indexOf('subClassOf') !== -1 )
return CUSTOM_LINK_TEMPLATE_SUBCLASSOF;
else
return CUSTOM_LINK_TEMPLATE;
}
],
},
};

onPageLoad(container => ReactDOM.render(createElement(Workspace, props), container));

73 changes: 73 additions & 0 deletions src/ontodia/customization/templates/bigIconOwl.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import * as React from 'react';
import { Component } from 'react';

import { CrossOriginImage } from '../../viewUtils/crossOriginImage';

import { TemplateProps } from '../props';

const CLASS_NAME = 'ontodia-big-icon-owl_template';

export class BigIconTemplateOwl extends Component<TemplateProps, {}> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you're providing templates for OWL/VOWL notation please name templates and files appropriately. For example, VOWLClassTemplate, VOWLPropertyTemplate, etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

render() {
const {color, imgUrl, icon, types, label, isExpanded, iri, propsAsList} = this.props;
return (
<div className={CLASS_NAME}>
<div className={`${CLASS_NAME}__main-part`}>
<div className='ontodia-big-icon-owl_template_body'>
<div style={{flexGrow: 1, overflow: 'hidden', textOverflow: 'ellipsis'}}>
<span title={label} className='ontodia-big-icon-owl_template_body__label'>
{label}
</span>
<div title={types} className='ontodia-big-icon-owl_template_body_type-container'>
<div className='ontodia-big-icon-owl_template_body_type-container__type'>{types}</div>
</div>
</div>
</div>
</div>
{isExpanded ? (
<div className='ontodia-big-icon-owl_template_property'
style={{borderColor: 'black'}}>
{imgUrl ? (
<CrossOriginImage className={`${CLASS_NAME}__picture`}
style={{borderColor: 'black'}}
imageProps={{src: imgUrl, className: `${CLASS_NAME}__picture-image`}}
/>
) : null}
<div className='ontodia-big-icon-owl_template_property_content'>
<div className='ontodia-big-icon-owl_template_property_content_iri-line'>
<div className='ontodia-big-icon-owl_template_property_content_iri-line__label'>
IRI:
</div>
<div className='ontodia-big-icon-owl_template_property_content_iri-line__iri'>
<a href={iri} title={iri}>{iri}</a>
</div>
</div>

<hr className='ontodia-big-icon-owl_template_property_content__hr'
style={{borderTop:'solid', borderWidth:'1px', borderTopColor:'black'}}/>
{propsAsList.length ? (
<div className='ontodia-big-icon-owl_template_property_content_property-table'>
{propsAsList.map(({name, id, property}) => (
<div key={id} className='ontodia-big-icon-owl_template_property_content_property-table_row'>
<div className='ontodia-big-icon-owl_template_property_content_property-table_row__key'
title={name + ' ' + id}>
{name}
</div>
<div className='ontodia-big-icon-owl_template_property_content_property-table_row_key_values'>
{property.values.map(({text}, index) => (
<div className='ontodia-big-icon-owl_template_property_content_property-table_row_key_values__value'
key={index} title={text}>
{text}
</div>
))}
</div>
</div>
))}
</div>
) : 'no properties'}
</div>
</div>
) : null}
</div>);
}
}
151 changes: 151 additions & 0 deletions src/ontodia/customization/templates/defaultOwl.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
import * as React from 'react';

import { CrossOriginImage } from '../../viewUtils/crossOriginImage';

import { TemplateProps } from '../props';

const CLASS_NAME = 'ontodia-default-owl_template';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-> ontodia-default-owl-template

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


export class DefaultElementTemplateOwl extends React.Component<TemplateProps, {}> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DefaultElementTemplateOwl -> DefaultOwlTemplate

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

public SetColor(types: any) : string {
if ( types.indexOf("Datatype") != -1 )
return '#fc3';
else if (types.indexOf("AnnotationProperty") != -1)
return '#ccc';
else if (types.indexOf("Property") != -1)
return '#0588f9fc';
else if (types.indexOf("Ontology") != -1)
return '#c9c';
else return undefined;
}
public ItIsThing(types: any) : boolean {
if ( types.indexOf("Datatype") != -1 ||
types.indexOf("Property") != -1 ||
types.indexOf("Ontology") != -1
)
return false;
else return true;
}

render() {
const props = this.props;
const {color, imgUrl, icon, types, label, isExpanded, iri, propsAsList} = this.props;

const image = props.imgUrl ? (
<CrossOriginImage className={`${CLASS_NAME}__thumbnail`}
imageProps={{src: props.imgUrl}} />
) : undefined;

let propertyTable: React.ReactElement<any>;
if (props.propsAsList && props.propsAsList.length > 0) {
propertyTable = <div className='ontodia-default-owl_template_body_expander_property-table'>
{props.propsAsList.map(prop => {
const values = prop.property.values.map(({text}, index) => (
<div className='ontodia-default-owl_template_body_expander_property-table_row_key_values__value'
key={index} title={text}>
{text}
</div>
));
return (
<div key={prop.id} className='ontodia-default-owl_template_body_expander_property-table_row'>
<div title={prop.name + ' (' + prop.id + ')'}
className='ontodia-default-owl_template_body_expander_property-table_row__key'>
{prop.name}
</div>
<div className='ontodia-default-owl_template_body_expander_property-table_row_key_values'>
{values}
</div>
</div>
);
})}
</div>;
} else {
propertyTable = <div>no properties</div>;
}

const expander = props.isExpanded ? (
<div className='ontodia-big-icon-owl_template_property'
style={{borderColor: 'black'}}>
{imgUrl ? (
<CrossOriginImage className={`${CLASS_NAME}__picture`}
style={{borderColor: 'black'}}
imageProps={{src: imgUrl, className: `${CLASS_NAME}__picture-image`}}
/>
) : null}
<div className='ontodia-big-icon-owl_template_property_content'>
<div className='ontodia-big-icon-owl_template_property_content_iri-line'>
<div className='ontodia-big-icon-owl_template_property_content_iri-line__label'>
IRI:
</div>
<div className='ontodia-big-icon-owl_template_property_content_iri-line__iri'>
<a href={iri} title={iri}>{iri}</a>
</div>
</div>

<hr className='ontodia-big-icon-owl_template_property_content__hr'
style={{borderTop:'solid', borderWidth:'1px', borderTopColor:'black'}}/>
{propsAsList.length ? (
<div className='ontodia-big-icon-owl_template_property_content_property-table'>
{propsAsList.map(({name, id, property}) => (
<div key={id} className='ontodia-big-icon-owl_template_property_content_property-table_row'>
<div className='ontodia-big-icon-owl_template_property_content_property-table_row__key'
title={name + ' ' + id}>
{name}
</div>
<div className='ontodia-big-icon-owl_template_property_content_property-table_row_key_values'>
{property.values.map(({text}, index) => (
<div className='ontodia-big-icon-owl_template_property_content_property-table_row_key_values__value'
key={index} title={text}>
{text}
</div>
))}
</div>
</div>
))}
</div>
) : 'no properties'}
</div>
</div>
) : undefined;

if ( !this.ItIsThing(this.props.types) ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove extra spaces around if condition.

Also something is wrong with indentation in this block (opening and closing brace indentation level doesn't match).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

return (
<div>
<div>
<div className='ontodia-default-owl_template'
style={{ borderColor: "black", backgroundColor:this.SetColor(this.props.types)}}
data-expanded={this.props.isExpanded}>
{image}
<div className='ontodia-default-owl_template_body'>
<label className='ontodia-default-owl_template_body__label' title={props.label}>
{props.label}
<div title={props.types} className='ontodia-big-icon-owl_template_body_type-container'>
<div className='ontodia-big-icon-owl_template_body_type-container__type'>{props.types}</div>
</div>
</label>
</div>
</div>
</div>
{expander}
</div>
);
}
else {
return (
<div className='ontodia-default-owl_thing_template'
data-expanded={this.props.isExpanded}>
{image}
<div className='ontodia-default-owl_thing_template_body'>
<label className='ontodia-default-owl_thing_template_body__label' title={props.label}>
{props.label}
<div title={props.types} className='ontodia-big-icon-owl_template_body_type-container'>
<div className='ontodia-big-icon-owl_template_body_type-container__type'>{props.types}</div>
</div>
</label>
</div>
{expander}
</div>
);
}
}
}
13 changes: 9 additions & 4 deletions src/ontodia/customization/templates/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import { TemplateResolver } from '../props';

import { BigIconTemplateOwl } from './bigIconOwl';
import { BigIconTemplate } from './bigIcon';
import { LeftBarTemplateOwl } from './leftBarOwl';
import { LeftBarTemplate } from './leftBar';
import { OrganizationTemplate } from './organization';
import { PersonTemplate } from './person';

export * from './defaultOwl';
export * from './bigIconOwl';
export * from './leftBarOwl';
export * from './default';
export * from './bigIcon';
export * from './leftBar';
Expand All @@ -14,13 +19,13 @@ export * from './person';
export const DefaultTemplateBundle: TemplateResolver[] = [
types => {
if (types.indexOf('http://www.w3.org/2000/01/rdf-schema#Class') !== -1) {
return BigIconTemplate;
return BigIconTemplateOwl;
} else if (types.indexOf('http://www.w3.org/2002/07/owl#Class') !== -1) {
return BigIconTemplate;
return BigIconTemplateOwl;
} else if (types.indexOf('http://www.w3.org/2002/07/owl#ObjectProperty') !== -1) {
return LeftBarTemplate;
return LeftBarTemplateOwl;
} else if (types.indexOf('http://www.w3.org/2002/07/owl#DatatypeProperty') !== -1) {
return LeftBarTemplate;
return LeftBarTemplateOwl;
} else if (types.indexOf('http://xmlns.com/foaf/0.1/Person') !== -1 ||
types.indexOf('http://www.wikidata.org/entity/Q5') !== -1 ) {
return PersonTemplate;
Expand Down
Loading