-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: Conceptial improvements for namespace
Changes: - Update basic code for adding new Entitty after release meta-model version 2.2.0.
- Loading branch information
1 parent
9a764b3
commit c110836
Showing
47 changed files
with
2,863 additions
and
0 deletions.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
core/esmf-aspect-meta-model-java/src/main/java/org/eclipse/esmf/metamodel/Namespace.java
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package org.eclipse.esmf.metamodel; | ||
|
||
/** | ||
* A Namespace is Structure Element for describing namespace and providing user readable information about Namespace. | ||
* | ||
* @since SAMM 2.2.0 | ||
*/ | ||
public interface Namespace extends StructureElement { | ||
} |
25 changes: 25 additions & 0 deletions
25
...spect-meta-model-java/src/main/java/org/eclipse/esmf/metamodel/impl/DefaultNamespace.java
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package org.eclipse.esmf.metamodel.impl; | ||
|
||
import java.util.List; | ||
|
||
import org.eclipse.esmf.metamodel.Namespace; | ||
import org.eclipse.esmf.metamodel.Property; | ||
import org.eclipse.esmf.metamodel.loader.MetaModelBaseAttributes; | ||
import org.eclipse.esmf.metamodel.visitor.AspectVisitor; | ||
|
||
public class DefaultNamespace extends ModelElementImpl implements Namespace { | ||
|
||
public DefaultNamespace( final MetaModelBaseAttributes metaModelBaseAttributes ) { | ||
super( metaModelBaseAttributes ); | ||
} | ||
|
||
@Override | ||
public List<Property> getProperties() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public <T, C> T accept( AspectVisitor<T, C> visitor, C context ) { | ||
return null; | ||
} | ||
} |
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
21 changes: 21 additions & 0 deletions
21
...a/src/main/java/org/eclipse/esmf/metamodel/loader/instantiator/NamespaceInstantiator.java
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package org.eclipse.esmf.metamodel.loader.instantiator; | ||
|
||
import org.apache.jena.rdf.model.Resource; | ||
import org.eclipse.esmf.metamodel.Namespace; | ||
import org.eclipse.esmf.metamodel.impl.DefaultNamespace; | ||
import org.eclipse.esmf.metamodel.loader.Instantiator; | ||
import org.eclipse.esmf.metamodel.loader.MetaModelBaseAttributes; | ||
import org.eclipse.esmf.metamodel.loader.ModelElementFactory; | ||
|
||
public class NamespaceInstantiator extends Instantiator<Namespace> { | ||
|
||
public NamespaceInstantiator( final ModelElementFactory modelElementFactory ) { | ||
super( modelElementFactory, Namespace.class ); | ||
} | ||
|
||
@Override | ||
public Namespace apply( final Resource namespace ) { | ||
final MetaModelBaseAttributes metaModelBaseAttributes = buildBaseAttributes( namespace ); | ||
return new DefaultNamespace( metaModelBaseAttributes); | ||
} | ||
} |
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
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
74 changes: 74 additions & 0 deletions
74
...-document-generators/src/main/resources/diagram/samm_2_2_0/abstractentity2boxmodel.sparql
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 |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# Copyright (c) 2023 Robert Bosch Manufacturing Solutions GmbH | ||
# | ||
# See the AUTHORS file(s) distributed with this work for additional | ||
# information regarding authorship. | ||
# | ||
# This Source Code Form is subject to the terms of the Mozilla Public | ||
# License, v. 2.0. If a copy of the MPL was not distributed with this | ||
# file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
# | ||
# SPDX-License-Identifier: MPL-2.0 | ||
|
||
prefix samm: <urn:samm:org.eclipse.esmf.samm:meta-model:2.1.0#> | ||
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> | ||
prefix xsd: <http://www.w3.org/2001/XMLSchema#> | ||
prefix : <urn:samm:org.eclipse.esmf.samm:meta-model:2.1.0/boxmodel#> | ||
prefix func: <urn:samm:org.eclipse.esmf.samm:function:2.0.0#> | ||
|
||
# Generates boxes for Abstract Entities | ||
construct { | ||
?abstractEntityBox a :Box . | ||
?abstractEntityBox :prototype "Abstract Entity" . | ||
?abstractEntityBox :title ?abstractEntityName . | ||
?abstractEntityBox :modelElement ?abstractEntity . | ||
?abstractEntityBox :entries ( | ||
[ | ||
a :Entry ; | ||
:title "preferredName" ; | ||
:text ?preferredName | ||
] | ||
[ | ||
a :Entry ; | ||
:title "description" ; | ||
:text ?description | ||
] | ||
[ | ||
a :Entry ; | ||
:title "see" ; | ||
:text ?seeValues | ||
] | ||
) | ||
} where { | ||
?abstractEntity rdf:type samm:AbstractEntity . | ||
bind( strafter( str( ?abstractEntity ), "#" ) as ?abstractEntityName ) | ||
|
||
bind( concat( ?abstractEntityName, "AbstractEntity" ) as ?boxName ) | ||
bind( iri( concat( func:getNamespace( ?abstractEntity ), ?boxName ) ) as ?abstractEntityBox ) | ||
|
||
optional { | ||
?abstractEntity samm:preferredName ?preferredNameValue . | ||
filter( lang( ?preferredNameValue ) = "en" ) | ||
bind( xsd:string( ?preferredNameValue ) as ?preferredName ) | ||
} | ||
|
||
optional { | ||
?abstractEntity samm:description ?descriptionValue . | ||
filter( lang( ?descriptionValue ) = "en" ) | ||
bind( xsd:string( ?descriptionValue ) as ?description ) | ||
} | ||
|
||
optional { | ||
{ | ||
select ( group_concat( ?seeValue; separator=", " ) as ?seeValues ) ?abstractEntity | ||
where { | ||
select * | ||
where { | ||
?abstractEntity rdf:type samm:AbstractEntity . | ||
?abstractEntity samm:see ?seeValue . | ||
} | ||
order by str( ?seeValue ) | ||
} | ||
group by ?abstractEntity | ||
} | ||
} | ||
} |
83 changes: 83 additions & 0 deletions
83
...ocument-generators/src/main/resources/diagram/samm_2_2_0/abstractproperty2boxmodel.sparql
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 |
---|---|---|
@@ -0,0 +1,83 @@ | ||
# Copyright (c) 2023 Robert Bosch Manufacturing Solutions GmbH | ||
# | ||
# See the AUTHORS file(s) distributed with this work for additional | ||
# information regarding authorship. | ||
# | ||
# This Source Code Form is subject to the terms of the Mozilla Public | ||
# License, v. 2.0. If a copy of the MPL was not distributed with this | ||
# file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
# | ||
# SPDX-License-Identifier: MPL-2.0 | ||
|
||
prefix samm: <urn:samm:org.eclipse.esmf.samm:meta-model:2.1.0#> | ||
prefix samm-e: <urn:samm:org.eclipse.esmf.samm:entity:2.1.0#> | ||
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> | ||
prefix xsd: <http://www.w3.org/2001/XMLSchema#> | ||
prefix : <urn:samm:org.eclipse.esmf.samm:meta-model:2.1.0/boxmodel#> | ||
prefix func: <urn:samm:org.eclipse.esmf.samm:function:2.0.0#> | ||
|
||
# Generates boxes for Properties | ||
construct { | ||
?propertyBox a :Box . | ||
?propertyBox :prototype "AbstractProperty" . | ||
?propertyBox :title ?propertyName . | ||
?propertyBox :modelElement ?property . | ||
?propertyBox :entries ( | ||
[ | ||
a :Entry ; | ||
:title "preferredName" ; | ||
:text ?preferredName | ||
] | ||
[ | ||
a :Entry ; | ||
:title "description" ; | ||
:text ?description | ||
] | ||
[ | ||
a :Entry ; | ||
:title "see" ; | ||
:text ?seeValues | ||
] | ||
) | ||
} where { | ||
#process Properties defined in the Aspect Model being processed | ||
{ | ||
?property rdf:type samm:AbstractProperty . | ||
bind( strafter( str( ?property ), "#" ) as ?propertyName ) . | ||
|
||
bind( concat( ?propertyName, "AbstractProperty" ) as ?boxName ) | ||
bind( iri( concat( func:getNamespace( ?property ), ?boxName ) ) as ?propertyBox ) | ||
|
||
optional { | ||
?property samm:preferredName ?preferredNameValue . | ||
filter( lang( ?preferredNameValue ) = "en" ) | ||
bind( xsd:string( ?preferredNameValue ) as ?preferredName ) | ||
} | ||
|
||
optional { | ||
?property samm:description ?descriptionValue . | ||
filter( lang( ?descriptionValue ) = "en" ) | ||
bind( xsd:string( ?descriptionValue ) as ?description ) | ||
} | ||
|
||
#subquery which concatenates all values for the samm:see attributes | ||
optional { | ||
select * where { | ||
?property rdf:type samm:Property . | ||
filter( str( ?subQueryProperty ) = str( ?property ) ) | ||
{ | ||
select ?subQueryProperty ( group_concat( ?seeValue; separator=", " ) as ?seeValues ) | ||
where { | ||
select * | ||
where { | ||
?subQueryProperty rdf:type samm:Property . | ||
?subQueryProperty samm:see ?seeValue . | ||
} | ||
order by str( ?seeValue ) | ||
} | ||
group by ?subQueryProperty | ||
} | ||
} | ||
} | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
...t-generators/src/main/resources/diagram/samm_2_2_0/aspect-operation-edges2boxmodel.sparql
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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Copyright (c) 2023 Robert Bosch Manufacturing Solutions GmbH | ||
# | ||
# See the AUTHORS file(s) distributed with this work for additional | ||
# information regarding authorship. | ||
# | ||
# This Source Code Form is subject to the terms of the Mozilla Public | ||
# License, v. 2.0. If a copy of the MPL was not distributed with this | ||
# file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
# | ||
# SPDX-License-Identifier: MPL-2.0 | ||
|
||
prefix samm: <urn:samm:org.eclipse.esmf.samm:meta-model:2.1.0#> | ||
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> | ||
prefix : <urn:samm:org.eclipse.esmf.samm:meta-model:2.1.0/boxmodel#> | ||
prefix func: <urn:samm:org.eclipse.esmf.samm:function:2.0.0#> | ||
|
||
# Generate edges between Aspects and Operations | ||
construct { | ||
?edge a :Edge . | ||
?edge :title "operation" . | ||
?edge :from ?from . | ||
?edge :to ?to . | ||
} where { | ||
?aspect a samm:Aspect . | ||
bind( strafter( str( ?aspect ), "#" ) as ?aspectName ) . | ||
?operation a samm:Operation . | ||
bind( strafter( str( ?operation ), "#" ) as ?operationName ) . | ||
filter( exists { ?aspect samm:operations/rdf:rest*/rdf:first ?operation } ) | ||
|
||
bind( concat( ?aspectName, "Aspect" ) as ?aspectBoxName ) | ||
bind( iri( concat( func:getNamespace( ?aspect ), ?aspectBoxName ) ) as ?from ) | ||
bind( concat( ?operationName, "Operation" ) as ?operationBoxName ) | ||
bind( iri( concat( func:getNamespace( ?operation ), ?operationBoxName ) ) as ?to ) | ||
|
||
bind( iri( concat( func:getNamespace( ?aspect ), ?aspectBoxName, "_To_", ?operationBoxName ) ) as ?edge ) | ||
} |
82 changes: 82 additions & 0 deletions
82
...nt-generators/src/main/resources/diagram/samm_2_2_0/aspect-property-edges2boxmodel.sparql
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 |
---|---|---|
@@ -0,0 +1,82 @@ | ||
# Copyright (c) 2023 Robert Bosch Manufacturing Solutions GmbH | ||
# | ||
# See the AUTHORS file(s) distributed with this work for additional | ||
# information regarding authorship. | ||
# | ||
# This Source Code Form is subject to the terms of the Mozilla Public | ||
# License, v. 2.0. If a copy of the MPL was not distributed with this | ||
# file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
# | ||
# SPDX-License-Identifier: MPL-2.0 | ||
|
||
prefix samm: <urn:samm:org.eclipse.esmf.samm:meta-model:2.1.0#> | ||
prefix samm-e: <urn:samm:org.eclipse.esmf.samm:entity:2.1.0#> | ||
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> | ||
prefix xsd: <http://www.w3.org/2001/XMLSchema#> | ||
prefix : <urn:samm:org.eclipse.esmf.samm:meta-model:2.1.0/boxmodel#> | ||
prefix func: <urn:samm:org.eclipse.esmf.samm:function:2.0.0#> | ||
|
||
# Generates edges between Aspects or Entities or Abstract Entities and Properties | ||
construct { | ||
?edge a :Edge . | ||
?edge :title ?title . | ||
?edge :from ?from . | ||
?edge :to ?to . | ||
} where { | ||
# Aspect/Entity/Abstract Entity -> Property Edges (properties) | ||
?aspectOrEntityOrAbstractEntity rdf:type ?class . | ||
filter( ?class in ( samm:Aspect, samm:Entity, samm:AbstractEntity ) ) | ||
|
||
bind( strafter( str( ?aspectOrEntityOrAbstractEntity ), "#" ) as ?aspectOrEntityOrAbstractEntityName ) . | ||
|
||
?property rdf:type ?propertyClass . | ||
filter( ?propertyClass in ( samm:Property, samm:AbstractProperty ) ) | ||
|
||
bind( strafter( str( ?property ), "#" ) as ?propertyName ) . | ||
filter( exists { ?aspectOrEntityOrAbstractEntity samm:properties/rdf:rest*/rdf:first/samm:property? ?property } ) | ||
|
||
bind( str( ?class ) as ?fullClassName ) | ||
bind( strafter( ?fullClassName, "#" ) as ?typeName ) | ||
bind( concat( ?aspectOrEntityOrAbstractEntityName, ?typeName ) as ?aspectOrEntityOrAbstractEntityBoxName ) | ||
bind( iri( concat( func:getNamespace( ?aspectOrEntityOrAbstractEntity ), ?aspectOrEntityOrAbstractEntityBoxName ) ) as ?from ) | ||
|
||
bind( if( exists { ?property a samm:AbstractProperty }, "AbstractProperty", "Property" ) as ?propertyClassName ) | ||
bind( concat( ?propertyName, ?propertyClassName ) as ?propertyBoxName ) | ||
bind( iri( concat( func:getNamespace( ?property ), ?propertyBoxName ) ) as ?to ) | ||
|
||
bind( iri( concat( func:getNamespace( ?aspectOrEntityOrAbstractEntity ), ?aspectOrEntityOrAbstractEntityBoxName, "_To_", ?propertyBoxName ) ) as ?edge ) | ||
|
||
optional { | ||
?aspectOrEntityOrAbstractEntity samm:properties/rdf:rest*/rdf:first ?propertyNode . | ||
?propertyNode samm:property ?property . | ||
?propertyNode samm:optional true . | ||
?propertyNode samm:payloadName ?payloadName | ||
bind( concat( "property (optional) (", str( ?payloadName ), ")" ) as ?title ) | ||
} | ||
|
||
optional { | ||
?aspectOrEntityOrAbstractEntity samm:properties/rdf:rest*/rdf:first ?propertyNode . | ||
?propertyNode samm:property ?property . | ||
?propertyNode samm:optional true . | ||
bind( "property (optional)" as ?title ) | ||
} | ||
|
||
optional { | ||
?aspectOrEntityOrAbstractEntity samm:properties/rdf:rest*/rdf:first ?propertyNode . | ||
?propertyNode samm:property ?property . | ||
?propertyNode samm:notInPayload true . | ||
bind( "property (not in payload)" as ?title ) | ||
} | ||
|
||
optional { | ||
?aspectOrEntityOrAbstractEntity samm:properties/rdf:rest*/rdf:first ?propertyNode . | ||
?propertyNode samm:property ?property . | ||
?propertyNode samm:payloadName ?payloadName | ||
bind( concat( "property (", str( ?payloadName ), ")" ) as ?title ) | ||
} | ||
|
||
optional { | ||
?aspectOrEntityOrAbstractEntity samm:properties/rdf:rest*/rdf:first ?propertyNode . | ||
bind( "property" as ?title ) | ||
} | ||
} |
Oops, something went wrong.