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

WIP VOWL notation for owl#78

Open
toefl wants to merge 74 commits into
metaphacts:masterfrom
toefl:master
Open

WIP VOWL notation for owl#78
toefl wants to merge 74 commits into
metaphacts:masterfrom
toefl:master

Conversation

@toefl
Copy link
Copy Markdown
Contributor

@toefl toefl commented Oct 31, 2017

No description provided.

@AlexeyMz
Copy link
Copy Markdown
Contributor

@toefl Thanks, I'll look at the changes shortly.

@toefl
Copy link
Copy Markdown
Contributor Author

toefl commented Nov 2, 2017

I deleted the commented code sections.
The next step is to use two kinds of visualization at once.
Work in progress

Copy link
Copy Markdown
Member

@yuricus yuricus left a 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.

"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"
Copy link
Copy Markdown
Member

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.

Copy link
Copy Markdown
Contributor Author

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, {}> {
Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed

Comment thread src/ontodia/diagram/elementLayerOwl.tsx Outdated
view: DiagramView;
}

export class ElementLayerOwl extends React.Component<Props, void> {
Copy link
Copy Markdown
Member

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?

Copy link
Copy Markdown
Contributor Author

@toefl toefl Nov 5, 2017

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

Copy link
Copy Markdown
Contributor Author

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

Comment thread styles/diagram/_elementLayerOwl.scss Outdated
@@ -0,0 +1,35 @@
.ontodia-overlayed-owl_element {
Copy link
Copy Markdown
Member

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';
Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Contributor Author

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, {}> {
Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Contributor Author

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 {
Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Contributor Author

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';
Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

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, {}> {
Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

Comment thread 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'}
Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Contributor Author

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.

Copy link
Copy Markdown
Contributor

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, {}> {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

VOWLClassTemplate -> VowlClassTemplate

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

Comment thread src/ontodia/diagram/view.ts Outdated
import { DefaultTypeStyleBundle } from '../customization/defaultTypeStyles';
import { DefaultLinkTemplateBundle } from '../customization/defaultLinkStyles';
import { DefaultElementTemplate, DefaultTemplateBundle } from '../customization/templates';
import { DefaultElementTemplateOwl, DefaultTemplateBundle } from '../customization/templates';
Copy link
Copy Markdown
Contributor

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).

Copy link
Copy Markdown
Contributor Author

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

Comment thread src/ontodia/widgets/toolbar.tsx Outdated

const CLASS_NAME = 'ontodia-toolbar';


Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Contributor Author

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 {
Copy link
Copy Markdown
Contributor

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 {
    ...
  }
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

@toefl
Copy link
Copy Markdown
Contributor Author

toefl commented Nov 13, 2017

I use the automatic formatting of the code by means of VisualCode. I think it will not be a problem.

@AlexeyMz
Copy link
Copy Markdown
Contributor

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';
Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Contributor Author

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, {}> {
Copy link
Copy Markdown
Contributor

@AlexeyMz AlexeyMz Nov 13, 2017

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).

Copy link
Copy Markdown
Contributor Author

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') {
Copy link
Copy Markdown
Contributor

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,
    }
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

VowlTemplateBundle has been added

Comment thread src/examples/demoOwl.ts Outdated
viewOptions: {
linkTemplateResolvers: [
type => {
if (type.indexOf('subClassOf') !== -1)
Copy link
Copy Markdown
Contributor

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;
}

Copy link
Copy Markdown
Contributor Author

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 {
Copy link
Copy Markdown
Contributor

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 { ... }

Copy link
Copy Markdown
Contributor Author

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 {
Copy link
Copy Markdown
Contributor

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
{
Copy link
Copy Markdown
Contributor

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'}}>
Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Contributor Author

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 {
Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Contributor Author

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 {
Copy link
Copy Markdown
Contributor

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.

Olga Belyaeva and others added 30 commits February 7, 2018 16:01
* 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.
…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.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants