Adding ISModel Definition

This commit is contained in:
Luca Frosini 2019-10-16 11:48:47 +02:00
parent 6b6de30af8
commit f18fe6b9de
19 changed files with 149 additions and 10 deletions

View File

@ -0,0 +1,8 @@
import { ISManageable } from './ISManageable';
import { Header } from './properties/Header';
export interface ER extends ISManageable {
header: Header;
}

View File

@ -0,0 +1,3 @@
export interface ISManageable {
'@class': string;
}

View File

@ -0,0 +1,10 @@
import { Entity } from './Entity';
import { IsParentOf } from '../relations/IsParentOf';
export interface Context extends Entity {
name: string;
parent: IsParentOf<Context, Context>;
children: Array<IsParentOf<Context, Context>>;
}

View File

@ -0,0 +1,6 @@
import { ER } from '../ER';
// tslint:disable-next-line: no-empty-interface
export interface Entity extends ER {
}

View File

@ -0,0 +1,6 @@
import { Entity } from './Entity';
// tslint:disable-next-line: no-empty-interface
export interface Facet extends Entity {
}

View File

@ -0,0 +1,11 @@
import { Entity } from './Entity';
import { ConsistsOf } from '../relations/ConsistsOf';
import { IsRelatedTo } from '../relations/IsRelatedTo';
import { Facet } from './Facet';
export interface Resource extends Entity {
consistsOf: Array<ConsistsOf<Resource, Facet>>;
isRelatedTo: Array<IsRelatedTo<Resource, Resource>>;
}

View File

@ -0,0 +1,5 @@
import { Property } from './Property';
export interface Encrypted extends Property {
value: string;
}

View File

@ -0,0 +1,9 @@
import { Property } from './Property';
export interface Header extends Property {
'uuid': string;
'creator': string;
'modifiedBy': string;
'creationTime': string;
'lastUpdateTime': string;
}

View File

@ -0,0 +1,39 @@
import { Property } from './Property';
export enum RemoveConstraint {
/*
* When the source Entity is removed also the target
* Entity is removed but if and only if the latter has no other
* incoming Relation.
*/
cascadeWhenOrphan,
/*
* When the source Entity is removed also the target
* Entity is removed.
*/
cascade,
/*
* When the source Entity is removed the target Entity
* is keep.
*/
keep
}
export enum AddConstraint {
propagate,
unpropagate
}
export interface PropagationConstraint extends Property {
remove: RemoveConstraint;
add: AddConstraint;
}

View File

@ -0,0 +1,6 @@
import { ISManageable } from '../ISManageable';
// tslint:disable-next-line: no-empty-interface
export interface Property extends ISManageable {
}

View File

@ -0,0 +1,7 @@
import { Resource } from '../entities/Resource';
import { Relation } from './Relation';
import { Facet } from '../entities/Facet';
export interface ConsistsOf<Out extends Resource, In extends Facet> extends Relation<Out, In> {
}

View File

@ -0,0 +1,7 @@
import { Resource } from '../entities/Resource';
import { ConsistsOf } from './ConsistsOf';
import { Facet } from '../entities/Facet';
export interface IsIdentifiedBy<Out extends Resource, In extends Facet> extends ConsistsOf<Out, In> {
}

View File

@ -0,0 +1,7 @@
import { Context } from '../entities/Context';
import { Relation } from './Relation';
export interface IsParentOf<Out extends Context, In extends Context>
extends Relation<Out, In> {
}

View File

@ -0,0 +1,6 @@
import { Resource } from '../entities/Resource';
import { Relation } from './Relation';
export interface IsRelatedTo<Out extends Resource, In extends Resource> extends Relation<Out, In> {
}

View File

@ -0,0 +1,9 @@
import { Entity } from '../entities/Entity';
import { ER } from '../ER';
export interface Relation<Out extends Entity, In extends Entity> extends ER {
source: Out;
target: In;
}

View File

@ -1,4 +1,4 @@
export interface ISType {
export interface TypeDefinition {
name: string;
description: string | null;
abstract: boolean;

View File

@ -1,7 +1,7 @@
import { Component, OnInit } from '@angular/core';
import { IsService } from '../is.service';
import { Type } from '../type';
import { ISType } from '../ISType';
import { TypeDefinition } from '../is-model/types/TypeDefinition';
@Component({
selector: 'app-resource-types-tree',
@ -20,7 +20,7 @@ export class ResourceTypesTreeComponent implements OnInit {
this.isService.getResourceTypes(isTypes => { this.resources = this.analyseTypes(isTypes); });
}
analyseUnassociated(type: Type, map: Map<string, Type>, unassociated: Map<string, ISType>) {
analyseUnassociated(type: Type, map: Map<string, Type>, unassociated: Map<string, TypeDefinition>) {
const associated: string[] = new Array();
for (const name of unassociated.keys()) {
@ -38,7 +38,7 @@ export class ResourceTypesTreeComponent implements OnInit {
}
analyseType(isType: ISType, map: Map<string, Type>, unassociated: Map<string, ISType>) {
analyseType(isType: TypeDefinition, map: Map<string, Type>, unassociated: Map<string, TypeDefinition>) {
const type: Type = new Type(isType);
@ -55,10 +55,10 @@ export class ResourceTypesTreeComponent implements OnInit {
}
}
analyseTypes(isTypes: ISType[]): Type[] {
analyseTypes(isTypes: TypeDefinition[]): Type[] {
const map = new Map<string, Type>();
const unassociated = new Map<string, ISType>();
const unassociated = new Map<string, TypeDefinition>();
for (const isType of isTypes) {
this.analyseType(isType, map, unassociated);

View File

@ -1,4 +1,4 @@
import { ISType } from './ISType';
import { TypeDefinition } from './ISType';
export class Type {
@ -8,7 +8,7 @@ export class Type {
parent: Type;
children: Type[];
constructor(isType: ISType) {
constructor(isType: TypeDefinition) {
this.name = isType.name;
this.description = isType.description;
this.abstract = isType.abstract;

View File

@ -1,6 +1,6 @@
import { ISType } from './ISType';
import { TypeDefinition } from './ISType';
export const types: ISType[] = [
export const types: TypeDefinition[] = [
{
"name": "Resource",
"description": null,