SysML到OSLC资源的转换方法

    技术2022-07-10  130

    SysML到OSLC资源的转换方法

    涉及到SysML到OSLC资源的转换,需要使用其进行转换使用

    OSLC资源的表现形式为的RDF,RDF是一种主谓宾的形式的三元组。使用这种标准的资源属性促进了资源的可操作性质。客户端只需要的理解所检索的资源属性语义,OSLC适配器需要理解所传入更新的资源属性语义。

    OSLC对需求的资源shape具有标准化的属性

    oslc_rm:elaboratedBy oslc_rm:elabroates oslc_rm:speicfiedBy oscl_rm:specifies

    OSLC资源的转换实例

    RDF形式的OSLC资源

    <rdf:Description rdf:about="http://myDomain.com/myTool/services/myModel/requirements/Req1"> <rdf:type rdf:resource="http://open-services.net/ns/rm#Requirement"/> <oslc_rm:satisfiedBy rdf:resource="http://myDomain.com/myTool/services/myModel/blocks/BlockA "/> </rdf:Description>

    RDF形式的OSCL需求资源

    <rdf:Description rdf:about="http://myDomain.com/myTool/services/myModel/requirements/Req1"> <rdf:type rdf:resource="http://open-services.net/ns/rm#Requirement"/> <oslc_rm:satisfiedBy rdf:resource="http://myDomain.com/myTool/services/myModel/blocks/BlockA "/> </rdf:Description>

    RDF形式的OSLC需求资源Shape

    <oslc:ResourceShape rdf:about="https://myDomain.com/myTool/shapes/ShapeID23"> <oslc:describes rdf:resource="http://open-services.net/ns/rm#Requirement"/> <oslc:property> <oslc:Property> <oslc:name>satisfiedBy</oslc:name> <oslc:propertyDefinition rdf:resource="http://open-service.net/ns/rm#satisfiedBy"/> <oslc:occurs rdf:resource="http://open-service.net/ns/core#Zero-or-many"/> <oslc:range rdf:resource="http://open-services.net/ns/core#Any"/> </oslc:Property> </oslc:property> </oslc:ResourceShape>

    OSLC资源Shap相当于一种可以在OSLC服务上进行验证与指定的RDF词汇,针对不同的应用领域如请求的变更、测试用例等有不同的资源形式

    SysML的映射规则

    SysML的Rationale 是记录决策、需求设计 以及其他决策的认证,Rationale可以添加任何的模型元素以及关系。例如其允许添加一个指向详细文档的Rationale等。

    因为SysML是基于UML的,所以其基本的映射规则相似。即:

    Stereotype/MetaClass => Resource Shape (当MateClass不是抽象类的时候)

    Stereotype/Metaclass properties => Resource Shape properties

    – Property name => name attribute

    – Property multiplicity => occurs attribute

    – Property type => range attribute

    – Property value type (e.g. literal or reference) => valueType attribute

    • Primitive data type => not mapped to a resource shape. 不映射到资源Shape只映射基本数据的引用

    • Enumeration => not mapped to a resource shape. 不映射到资源Shape只映射枚举类型的引用. If a stereotype/metaclass property type is an enumeration, the enumeration and its literals are mapped to an Allowed Values section within the resource shape describing the stereotype/metaclass

    SysML的映射方法

    使用SysML建模软件将相应的模型转化为OMG的XMI格式将XMI格式的转换为Ecore将SysML中重用UML部分的限定名转换为相应的可处理文本在Ecore中解析SysML的概要文件以及UML的元模型,以RDF的形式创建相应的OSLC资源Shape

    项目需要的库

    <dependency> <groupId>org.eclipse.emf</groupId> <artifactId>org.eclipse.emf.ecore</artifactId> <version>2.22.0</version> </dependency> <dependency> <groupId>org.eclipse.emf</groupId> <artifactId>common</artifactId> <version>2.2.3</version> </dependency> <dependency> <groupId>org.eclipse.emf</groupId> <artifactId>org.eclipse.emf.ecore.xmi</artifactId> <version>2.16.0</version> </dependency>
    Processed: 0.011, SQL: 12