-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature: Conceptual improvements for namespace #425
Closed
Yauhenikapl
wants to merge
3
commits into
eclipse-esmf:main
from
bci-oss:10898-Conceptual_improvements_for_namespaces
Closed
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -142,6 +142,8 @@ ImmutableList.<String> builder().addAll( queryFilesForAllMetaModelVersions ) | |
.addAll( queryFilesForMetaModelVersionsAsOf2_0_0 ) | ||
.build() ); | ||
|
||
//TODO: Add new version of SAMM 2.2.0 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This might not be necessary if #407 is merged before. |
||
|
||
ARQ.init(); | ||
model = versionedModel.getModel(); | ||
metaModelVersion = KnownVersion.fromVersionString( versionedModel.getMetaModelVersion().toString() ) | ||
|
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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should not extends StructureElement; since it does not have Properties like Aspects and Entities.