-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
391 additions
and
308 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
@@ -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', | ||
|
@@ -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", | ||
|
@@ -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',"●"], | ||
|
@@ -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 = {}; | ||
|
@@ -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; | ||
|
@@ -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' ); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 { | ||
|
@@ -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' ) | ||
|
@@ -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; */ | ||
|
@@ -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; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.