-
Notifications
You must be signed in to change notification settings - Fork 45
WIP VOWL notation for owl #78
base: master
Are you sure you want to change the base?
Conversation
@toefl Thanks, I'll look at the changes shortly. |
I deleted the commented code sections. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see comments in files.
@@ -685,7 +685,7 @@ | |||
"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" | |||
"http://www.w3.org/2002/07/owl#Thing" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need to change default example? Do you need it to demo something? I expect there are enough classes in this example to showcase visualization customization.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to experiment with the data. Returned as it was
|
||
const CLASS_NAME = 'ontodia-big-icon-owl_template'; | ||
|
||
export class BigIconTemplateOwl extends Component<TemplateProps, {}> { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
view: DiagramView; | ||
} | ||
|
||
export class ElementLayerOwl extends React.Component<Props, void> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you really need to clone this class? Maybe there is some other way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I'll try differently later
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done without clone class ElementLayer
styles/diagram/_elementLayerOwl.scss
Outdated
@@ -0,0 +1,35 @@ | |||
.ontodia-overlayed-owl_element { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need to copy every css class, with scss you can easily use existing ones and override only properties you need.
|
||
import { TemplateProps } from '../props'; | ||
|
||
const CLASS_NAME = 'ontodia-VOWLClass_template'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, use consistent naming for CSS classes: ontodia-vowl-class-template
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
|
||
const CLASS_NAME = 'ontodia-VOWLDatatypeObjectProperty_template'; | ||
|
||
export class VOWLDatatypeObjectPropertyTemplate extends Component<TemplateProps, {}> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the better name for this template would be just VowlPropertyTemplate
and corresponding CSS class ontodia-vowl-property-template
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
const CLASS_NAME = 'ontodia-VOWLDatatypeObjectProperty_template'; | ||
|
||
export class VOWLDatatypeObjectPropertyTemplate extends Component<TemplateProps, {}> { | ||
public SetColor(types: any) : string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method should be private and called getColor
(because it doesn't actually set anything).
Also consider changing the type of types
parameter to string
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
|
||
import { TemplateProps } from '../props'; | ||
|
||
const CLASS_NAME = 'ontodia-default-owl_template'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-> ontodia-default-owl-template
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
|
||
const CLASS_NAME = 'ontodia-default-owl_template'; | ||
|
||
export class DefaultElementTemplateOwl extends React.Component<TemplateProps, {}> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DefaultElementTemplateOwl
-> DefaultOwlTemplate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
src/ontodia/diagram/elementLayer.tsx
Outdated
|
||
var divStyle; | ||
if ( window.location.href == "http://localhost:10444/vowl.html" ) | ||
divStyle = {position: 'absolute', transform, borderStyle: "solid", borderWidth: '1px', borderRadius: '15px', borderColor: "grey", padding: '5px'} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the better way to add this styles is to specify them in .scss
for VOWL templates.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was asked not to clone this class for vowl. Therefore, it remains the same. Depending on the values in the select I override the necessary properties for ElementLayer.
I leave without changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This module (elementLayer
) shouldn't contain any domain-related logic, especially like overriding styles for specific URIs (it also wouldn't work on any other deployment URI, so it isn't a good idea anyway).
Instead, a right way to do this is to add this styles directly to VOWL-related templates' scss
-styles, so they could work in any environment.
|
||
const CLASS_NAME = 'ontodia-VOWLClass_template'; | ||
|
||
export class VOWLClassTemplate extends Component<TemplateProps, {}> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
VOWLClassTemplate
-> VowlClassTemplate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
src/ontodia/diagram/view.ts
Outdated
@@ -16,7 +16,7 @@ import { | |||
} from '../customization/props'; | |||
import { DefaultTypeStyleBundle } from '../customization/defaultTypeStyles'; | |||
import { DefaultLinkTemplateBundle } from '../customization/defaultLinkStyles'; | |||
import { DefaultElementTemplate, DefaultTemplateBundle } from '../customization/templates'; | |||
import { DefaultElementTemplateOwl, DefaultTemplateBundle } from '../customization/templates'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes should be unnecessary (see comments for stc/ontodia/customization/templates/index.ts
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not understand how to satisfy your remarks. I need help
src/ontodia/widgets/toolbar.tsx
Outdated
@@ -20,6 +20,7 @@ export interface Props { | |||
|
|||
const CLASS_NAME = 'ontodia-toolbar'; | |||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, discard all unnecessary whitespace / formatting changes here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
} | ||
} | ||
|
||
.ontodia-VOWLDatatypeObjectProperty_template_body { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use SASS nested selectors for styles here, e.g.:
.ontodia-vowl-property-template {
&__body {
...
}
&__body-type-line {
...
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
I use the automatic formatting of the code by means of VisualCode. I think it will not be a problem. |
I recommend to install TSLint extension for VSCode to see all style warnings directly in the editor. |
@@ -0,0 +1,73 @@ | |||
import * as React from 'react'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please rename this file to VowlClass.tsx
to match component's name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
|
||
const CLASS_NAME = 'ontodia-vowl-property-template'; | ||
|
||
export class vowlPropertyTemplate extends Component<TemplateProps, {}> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Class names usually start with uppercase character: vowlPropertyTemplate
-> VowlPropertyTemplate
.
Also don't forget to rename the file itself (to vowlProperty.tsx
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
types.indexOf('http://xmlns.com/foaf/0.1/Organization') !== -1 | ||
) { | ||
return OrganizationTemplate; | ||
if (window.location.href === 'http://localhost:10444/vowl.html') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be better to create separate VowlTemplateBundle
like this instead:
export const VowlTemplateBundle: TemplateResolver[] = [
types => {
// Use new templates here
if (types.indexOf('http://www.w3.org/2000/01/rdf-schema#Class') !== -1) {
return VowlClassTemplate;
} ...
}
]
and then just import and use this bundle instead in the src/examples/demoOwl.ts
:
import { VowlTemplateBundle } from '../index';
...
const props: WorkspaceProps & ClassAttributes<Workspace> = {
...
viewOptions: {
linkTemplateResolvers: ...
templatesResolvers: VowlTemplateBundle,
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
VowlTemplateBundle has been added
src/examples/demoOwl.ts
Outdated
viewOptions: { | ||
linkTemplateResolvers: [ | ||
type => { | ||
if (type.indexOf('subClassOf') !== -1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Always use braces for block statements:
if (type.indexOf('subClassOf') !== -1) {
return CUSTOM_LINK_TEMPLATE_SUBCLASSOF;
} else {
return CUSTOM_LINK_TEMPLATE;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
const CLASS_NAME = 'ontodia-default-owl-template'; | ||
|
||
export class DefaultOwlTemplate extends React.Component<TemplateProps, {}> { | ||
private GetColor(types: string): string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In javascript (and typescript) methods' names (and other functions' names in general) usually starts with lower-case character, e.g.:
private getColor(types: string): string { ... }
public isThing(types: any): boolean { ... }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
padding-right: 10px; | ||
} | ||
|
||
.link.joint-theme-default:hover { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put this style change into CUSTOM_LINK_TEMPLATE
or CUSTOM_LINK_TEMPLATE_SUBCLASSOF
instead of globally overriding style for all links.
overflow: hidden; | ||
padding: 7px 10px 0px 10px; | ||
&:hover | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move this brace to the previous line.
<div className={CLASS_NAME}> | ||
<div className={`${CLASS_NAME}__main-part`}> | ||
<div className='ontodia-vowl-class-template_body'> | ||
<div style={{flexGrow: 1, overflow: 'hidden', textOverflow: 'ellipsis'}}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, extract all inline styles for elements in markup for this template into corresponding scss
file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -0,0 +1,182 @@ | |||
.ontodia-default-owl-template { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please rename this file to _defaultOwl.scss
to match component's name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -0,0 +1,132 @@ | |||
.ontodia-vowl-property-template { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please rename this file to _vowlProperty.scss
to match component's name.
Fix styles of the links labels
* Add pointer callbacks to the API * Fix displaying the spinner
- support element nesting (grouping) through EmbeddedLayer; - import data from outside to RDFDataProvider; - merge statistics in composite data provider.
Nested nodes
…n Ontodia. Now uri2name was improved so it's more difficult to get empty label.
Remove the uri2name from rdf/sparql data providers and check labels
- workaround bug when parser encounters rdf:parseType="Collection"; - support blank nodes; - imporove guessing file type by extension; - throw errors with more detailed messages; - fix initialization data race issues; - use async/await for implementation.
…105) * Fixed default OWL/RDFS SPARQL config to display only links user can navigate * Updated configuration to support blank nodes.
No description provided.