Skip to content

Commit

Permalink
towards v1.0.s
Browse files Browse the repository at this point in the history
  • Loading branch information
odungern committed Sep 3, 2021
1 parent ef335dc commit 6ae21a8
Show file tree
Hide file tree
Showing 15 changed files with 391 additions and 308 deletions.
Binary file modified .vs/SpecIF-Viewer/v16/.suo
Binary file not shown.
1 change: 0 additions & 1 deletion .vs/VSWorkspaceState.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@
"\\src\\vendor\\assets\\javascripts",
"\\src\\vendor\\assets\\stylesheets"
],
"SelectedNode": "\\src\\vendor\\assets\\stylesheets\\SpecIF.default.css",
"PreviewInSolutionExplorer": false
}
Binary file modified .vs/slnx.sqlite
Binary file not shown.
171 changes: 159 additions & 12 deletions src/config/definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
Author: [email protected], Berlin
License and terms of use: Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
We appreciate any correction, comment or contribution via e-mail to [email protected]
.. or even better as Github issue (https://github.com/GfSE/SpecIF-Viewer/issues)
*/
const CONFIG:any = {};
CONFIG.appVersion = "1.0.r",
CONFIG.appVersion = "1.0.s",
CONFIG.specifVersion = "1.0";
CONFIG.imgURL = './vendor/assets/images';
// CONFIG.userNameAnonymous = 'anonymous'; // as configured in the server
Expand Down Expand Up @@ -406,9 +407,6 @@ const CONFIG:any = {};
// A list of statement types by title,
// is used for example to recognize a statement to create when importing an xls sheet:
CONFIG.statementClasses = [
"SpecIF:contains",
"SpecIF:satisfies",
"SpecIF:implements",
'IREB:refines',
'IREB:refinedBy',
'oslc_rm:satisfies',
Expand All @@ -427,11 +425,8 @@ const CONFIG:any = {};
'oslc_rm:decomposedBy',
"oslc_rm:constrains",
"oslc_rm:constrainedBy",
"SpecIF:dependsOn",
"SysML:traces",
"SysML:isDerivedFrom",
"SpecIF:duplicates",
"SpecIF:contradicts",
"SysML:isAssociatedWith",
"SysML:isComposedOf",
"SysML:isAggregatedBy",
Expand All @@ -440,19 +435,39 @@ const CONFIG:any = {};
"SysML:includes",
"SysML:isSpecializationOf",
"SysML:isGeneralizationOf",
"SpecIF:inheritsFrom",
"SpecIF:refersTo",
"SpecIF:sameAs",
"owl:sameAs",
"rdf:type",
'IR:refersTo'
'IR:refersTo',
"SpecIF:contains",
"SpecIF:satisfies",
"SpecIF:implements",
"SpecIF:serves",
"SpecIF:stores",
"SpecIF:reads",
"SpecIF:writes",
"SpecIF:precedes",
"SpecIF:dependsOn",
"SpecIF:duplicates",
"SpecIF:contradicts",
"SpecIF:inheritsFrom",
"SpecIF:refersTo",
"SpecIF:sameAs"
];
/* // List of lists with equivalent resource types, e.g. in different notations or standards;
// The term appearing in the first position of an equivalence list is the preferred one:
// ToDo: Very similar purpose as the vocabulary translation below.
CONFIG.eqivalentTypes = [
];
*/
CONFIG.nativeProperties = new Map([
["dcterms:created", { name: "createdAt", type: "xs:dateTime", check: function (val: string): boolean { return val.length > 0 && RE.IsoDate.test(val) } }],
["SpecIF:createdAt", { name: "createdAt", type: "xs:dateTime", check: function (val: string): boolean { return val.length > 0 && RE.IsoDate.test(val) } }],
["dcterms:creator", { name: "createdBy", type: "xs:dateTime", check: function (): boolean { return true } }],
["SpecIF:createdBy", { name: "createdBy", type: "xs:dateTime", check: function (): boolean { return true } }],
["dcterms:modified", { name: "changedAt", type: "xs:dateTime", check: function (val: string): boolean { return val.length > 0 && RE.IsoDate.test(val) } }],
["SpecIF:changedAt", { name: "changedAt", type: "xs:dateTime", check: function (val: string): boolean { return val.length > 0 && RE.IsoDate.test(val) } }],
["SpecIF:changedBy", { name: "changedBy", type:"xs:dateTime", check: function (): boolean { return true }}]
]);
CONFIG.icons = new Map([
['FMC:Actor',"■"],
['FMC:State',"●"],
Expand All @@ -466,6 +481,133 @@ const CONFIG:any = {};
["IR:Annotation","☛"]
]);

const vocabulary = {
// Translate between different vocabularies such as ReqIF, Dublin Core, OSLC and SpecIF:
property: {
// for properyTypes and properties:
specif: function (iT: string): string {
// Target language: SpecIF
var oT = '';
switch (iT.specifIdOf().toLowerCase()) {
case "_berschrift":
case "title":
case "titel":
case "dc_title":
case "specif_heading": // 'SpecIF:Heading' has been used falsely as property title
case "reqif_chaptername":
case "reqif_name": oT = CONFIG.propClassTitle; break;
case "description":
case "beschreibung":
case "text":
case "dc_description":
// case "reqif_changedescription":
case "reqif_description":
case "reqif_text": oT = CONFIG.propClassDesc; break;
case "reqif_revision": oT = "SpecIF:Revision"; break;
case "specif_stereotype": // deprecated, for compatibility, not to confound with "UML:Stereotype"
case "specif_subclass": // deprecated, for compatibility
case "reqif_category": oT = CONFIG.propClassType; break;
case 'specif_id': // deprecated, for compatibility
case "reqif_foreignid": oT = CONFIG.propClassId; break;
case "specif_state": // deprecated, for compatibility
case "reqif_foreignstate": oT = "SpecIF:Status"; break;
case "dc_author":
case "dcterms_author": // deprecated, for compatibility
case "reqif_foreigncreatedby": oT = "dcterms:creator"; break;
case "specif_createdat": oT = "dcterms:modified"; break;
// case "reqif_foreignmodifiedby": oT = ""; break;
// case "reqif_foreigncreatedon": oT = ""; break;
// case "reqif_foreigncreatedthru": oT = ""; break;
// case "reqif_fitcriteria": oT = ""; break;
// case "reqif_prefix": oT = ""; break;
// case "reqif_associatedfiles": oT = ""; break;
// case "reqif_project": oT = ""; break;
// case "reqif_chapternumber": oT = ""; break;
default: oT = iT;
};
return oT;
},
reqif: function (iT: string): string {
// Target language: ReqIF
var oT = '';
switch (iT.specifIdOf().toLowerCase()) {
case "dcterms_title": oT = "ReqIF.Name"; break;
case "dcterms_description": oT = "ReqIF.Text"; break;
case "dcterms_identifier": oT = "ReqIF.ForeignId"; break;
case "specif_heading": oT = "ReqIF.ChapterName"; break; // for compatibility
case "specif_category":
case "dcterms_type": oT = "ReqIF.Category"; break;
case "specif_revision": oT = "ReqIF.Revision"; break;
case "specif_state": // deprecated, for compatibility
case "specif_status": oT = "ReqIF.ForeignState"; break;
case "dcterms_author": // deprecated, for compatibility
case "dcterms_creator": oT = "ReqIF.ForeignCreatedBy"; break;
// case "specif_createdat":
// case "dcterms_modified": oT = "ReqIF.ForeignCreatedAt"; // exists?
default: oT = iT;
};
return oT;
}
},
resource: {
// for resourceClasses and resources:
specif: function (iT: string): string {
// Target language: SpecIF
var oT = '';
switch (iT.specifIdOf().toLowerCase()) {
case 'actors':
case 'actor':
case 'akteure':
case 'akteur': oT = "FMC:Actor"; break;
case 'states':
case 'state':
case 'zustände':
case 'zustand': oT = "FMC:State"; break;
case 'events':
case 'event':
case 'ereignisse':
case 'ereignis': oT = "FMC:Event"; break;
case 'anforderungen':
case 'anforderung':
case 'requirements':
case 'requirement':
case 'specif_requirement': oT = "IREB:Requirement"; break;
case 'merkmale':
case 'merkmal':
case 'features':
case 'feature': oT = "SpecIF:Feature"; break;
case 'annotations':
case 'annotationen':
case 'annotation': oT = "IR:Annotation"; break;
case 'user_stories':
case 'user_story': oT = 'SpecIF:UserStory'; break;
case 'specif_view':
case 'fmc_plan': oT = CONFIG.resClassDiagram; break;
case 'specif_folder': oT = CONFIG.resClassFolder; break;
case 'specif_hierarchyroot':
case 'specif_hierarchy': oT = CONFIG.resClassOutline; break;
default: oT = iT;
};
return oT;
/* },
reqif: function( iT:string ):string {
// no translation to OSLC or ReqIF, because both don't have a vocabulary for resources
return iT */
}
},
statement: {
// for statementClasses and statements:
specif: function (iT: string): string {
// Target language: SpecIF
var oT = '';
switch (iT.specifIdOf().toLowerCase()) {
default: oT = iT
};
return oT;
}
}
};

/////////////////////////////////////////////////
// Regular expressions:
const RE:any = {};
Expand All @@ -474,6 +616,10 @@ const RE:any = {};
// RE.Email = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/; // http://www.w3resource.com/javascript/form/javascript-sample-registration-form-validation.php
RE.Email = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i;

/* see: https://stackoverflow.com/questions/3143070/javascript-regex-iso-datetime
* RE.DateTime = /(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))/
*/

// Reliably recognize an URI, not validate an URI:
// text strings are be encoded for json, thus '\t', '\r\n' or '\n' may be contained explicitly
RE.URI = /(^|\s|>)((https?:\/\/|www\.)([^\s\/.$?#=]+\.)*([^\s\/.$?#=]+\.[\w]{2,4})(\/[^\s\?#]*?)*(\?[^\s#]+?)?(#\S+?)?)(\.\s|:\s|\s|\.<|:<|<|\.$|:$|$)/g;
Expand Down Expand Up @@ -539,7 +685,8 @@ const RE:any = {};
const reSO = '<object ([^>]+)(/>|>([^<]*?)</object>)';
RE.tagSingleObject = new RegExp( reSO, 'g' );
RE.tagNestedObjects = new RegExp( '<object ([^>]+)>[\\s]*'+reSO+'([\\s\\S]*?)</object>', 'g' );
RE.quote = /"([a-z0-9_].*?)"|'([a-z0-9_].*?)'/i;
RE.inQuotes = /"(\S[^"]*?\S)"|'(\S[^']*?\S)'/i; // empty space in the middle allowed, but not as first and last character
RE.inBrackets = /\((\S[^\)]*?\S)\)|\[(\S[^\]]*?\S)\]/i; // empty space in the middle allowed, but not as first and last character

const tagStr = "(<\\/?)([a-z]{1,10}(?: [^<>]+)?\\/?>)";
RE.tag = new RegExp( tagStr, 'g' );
Expand Down
8 changes: 4 additions & 4 deletions src/config/moduleManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Author: [email protected], Berlin
License and terms of use: Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
We appreciate any correction, comment or contribution via e-mail to [email protected]
.. or even better as Github issue (https://github.com/GfSE/SpecIF-Viewer/issues)
*/

interface IModule {
Expand Down Expand Up @@ -553,7 +554,8 @@ var app:IApp,
return true;

// libraries:
// case "config": getScript( loadPath+'config/definitions.js' ); return true;
/* case "config": getScript( loadPath+'config/definitions.js' ); return true;
case 'checkSpecif': getScript('https://specif.de/v' + CONFIG.specifVersion + '/check.js'); return true; */
case "types": getScript( loadPath+'types/specif.types.js'); return true;
case "i18n": switch( browser.language.slice(0,2) ) {
case 'de': getScript( loadPath+'config/locales/iLaH-de.i18n.js' )
Expand Down Expand Up @@ -590,12 +592,10 @@ var app:IApp,
case 'bpmn2specif': getScript( loadPath+'vendor/assets/javascripts/BPMN2SpecIF.js' ); return true;
case 'archimate2specif': getScript( loadPath+'vendor/assets/javascripts/archimate2SpecIF.js' ); return true;
case 'reqif2specif': getScript( loadPath+'vendor/assets/javascripts/reqif2specif.js' ); return true;
case 'checkSpecif': getScript( 'https://specif.de/v'+CONFIG.specifVersion+'/check.js' ); return true;
case 'statementsGraph': loadM( 'graphViz' );
getScript( loadPath+'modules/graph.js' ); return true;
/* case CONFIG.objectTable: loadM( 'dataTable' );
// loadM( 'dataTableButtons' );
// loadM( 'zip' ); // needed for Excel export
getScript( loadPath+'modules/objectTable-0.93.1.js' ); return true;
case "serverPouch": loadM('pouchDB');
getScript(loadPath + 'modules/serverPouch.mod.js'); return true; */
Expand All @@ -605,7 +605,7 @@ var app:IApp,
case 'importAny': loadM( 'zip' );
getScript( loadPath+'modules/importAny.mod.js' ); return true;
case 'ioSpecif': loadM( 'jsonSchema' );
loadM( 'checkSpecif' );
// loadM( 'checkSpecif' );
getScript( loadPath+'modules/ioSpecif.mod.js' ); return true;
case 'ioReqif': loadM( 'reqif2specif' );
getScript( loadPath+'modules/ioReqif.mod.js' ); return true;
Expand Down
42 changes: 21 additions & 21 deletions src/embedded.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,27 +115,27 @@ function embeddedSpecif():IApp {
self.ioSpecif.toSpecif(str2ab(data))
.done(function (newD: SpecIF) {
specif.check( newD )
.then( (dta: SpecIF)=>{
var opts = {
deduplicate: true,
addGlossary: true,
collectProcesses: false
};
self.cache.create( dta, opts )
.done( function() {
message.show( i18n.lookup( 'MsgImportSuccessful', dta.title ), {severity:"success",duration:CONFIG.messageDisplayTimeShort} );
setTimeout( function() {
// change view to browse the content:
moduleManager.show({ view: '#'+CONFIG.specifications /*, urlParams:urlP */ });
self.busy.reset();
},
CONFIG.showTimelag
);
})
.fail( stdError );
},
stdError
);
.then( (dta: SpecIF)=>{
var opts = {
deduplicate: true,
addGlossary: true,
collectProcesses: false
};
self.cache.create( dta, opts )
.done( function() {
message.show( i18n.lookup( 'MsgImportSuccessful', dta.title ), {severity:"success",duration:CONFIG.messageDisplayTimeShort} );
setTimeout( function() {
// change view to browse the content:
moduleManager.show({ view: '#'+CONFIG.specifications /*, urlParams:urlP */ });
self.busy.reset();
},
CONFIG.showTimelag
);
})
.fail( stdError );
},
stdError
);
})
.fail( stdError );
};
Expand Down
Loading

0 comments on commit 6ae21a8

Please sign in to comment.