Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Lehrstuhl für Informations- und Automatisierungssysteme
PyI40AAS
Commits
61efb9d1
Verified
Commit
61efb9d1
authored
Nov 01, 2021
by
Leon Mauritz Möller
Browse files
remove View
and all references to it
parent
896ba81f
Pipeline
#578373
passed with stages
in 2 minutes and 45 seconds
Changes
27
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
aas/adapter/_generic.py
View file @
61efb9d1
...
...
@@ -42,7 +42,6 @@ KEY_ELEMENTS: Dict[model.KeyElements, str] = {
model
.
KeyElements
.
RELATIONSHIP_ELEMENT
:
'RelationshipElement'
,
model
.
KeyElements
.
SUBMODEL_ELEMENT
:
'SubmodelElement'
,
model
.
KeyElements
.
SUBMODEL_ELEMENT_COLLECTION
:
'SubmodelElementCollection'
,
model
.
KeyElements
.
VIEW
:
'View'
,
model
.
KeyElements
.
GLOBAL_REFERENCE
:
'GlobalReference'
,
model
.
KeyElements
.
FRAGMENT_REFERENCE
:
'FragmentReference'
}
...
...
aas/adapter/json/aasJSONSchema.json
View file @
61efb9d1
...
...
@@ -192,12 +192,6 @@
"$ref"
:
"#/definitions/Reference"
}
},
"views"
:
{
"type"
:
"array"
,
"items"
:
{
"$ref"
:
"#/definitions/View"
}
},
"security"
:
{
"$ref"
:
"#/definitions/Security"
}
...
...
@@ -295,7 +289,6 @@
"RelationshipElement"
,
"SubmodelElement"
,
"SubmodelElementCollection"
,
"View"
,
"GlobalReference"
,
"FragmentReference"
]
...
...
@@ -323,7 +316,6 @@
"RelationshipElement"
,
"SubmodelElement"
,
"SubmodelElementCollection"
,
"View"
,
"GlobalReference"
,
"FragmentReference"
,
"Constraint"
,
...
...
@@ -752,22 +744,6 @@
}
]
},
"View"
:
{
"allOf"
:
[
{
"$ref"
:
"#/definitions/Referable"
},
{
"$ref"
:
"#/definitions/HasDataSpecification"
},
{
"$ref"
:
"#/definitions/HasSemantics"
},
{
"properties"
:
{
"containedElements"
:
{
"type"
:
"array"
,
"items"
:
{
"$ref"
:
"#/definitions/Reference"
}
}
}
}
]
},
"ConceptDescription"
:
{
"allOf"
:
[
{
"$ref"
:
"#/definitions/Identifiable"
},
...
...
aas/adapter/json/json_deserialization.py
View file @
61efb9d1
...
...
@@ -167,7 +167,6 @@ class AASFromJsonDecoder(json.JSONDecoder):
'AssetAdministrationShell'
:
cls
.
_construct_asset_administration_shell
,
'AssetInformation'
:
cls
.
_construct_asset_information
,
'IdentifierKeyValuePair'
:
cls
.
_construct_identifier_key_value_pair
,
'View'
:
cls
.
_construct_view
,
'ConceptDescription'
:
cls
.
_construct_concept_description
,
'Qualifier'
:
cls
.
_construct_qualifier
,
'Extension'
:
cls
.
_construct_extension
,
...
...
@@ -406,10 +405,6 @@ class AASFromJsonDecoder(json.JSONDecoder):
if
not
cls
.
stripped
and
'submodels'
in
dct
:
for
sm_data
in
_get_ts
(
dct
,
'submodels'
,
list
):
ret
.
submodel
.
add
(
cls
.
_construct_aas_reference
(
sm_data
,
model
.
Submodel
))
if
not
cls
.
stripped
and
'views'
in
dct
:
for
view
in
_get_ts
(
dct
,
'views'
,
list
):
if
_expect_type
(
view
,
model
.
View
,
str
(
ret
),
cls
.
failsafe
):
ret
.
view
.
add
(
view
)
if
'security'
in
dct
:
ret
.
security
=
cls
.
_construct_security
(
_get_ts
(
dct
,
'security'
,
dict
))
if
'derivedFrom'
in
dct
:
...
...
@@ -417,17 +412,6 @@ class AASFromJsonDecoder(json.JSONDecoder):
model
.
AssetAdministrationShell
)
return
ret
@
classmethod
def
_construct_view
(
cls
,
dct
:
Dict
[
str
,
object
],
object_class
=
model
.
View
)
->
model
.
View
:
ret
=
object_class
(
_get_ts
(
dct
,
'idShort'
,
str
))
cls
.
_amend_abstract_attributes
(
ret
,
dct
)
if
'containedElements'
in
dct
:
for
element_data
in
_get_ts
(
dct
,
'containedElements'
,
list
):
# TODO: remove the following type: ignore comments when mypy supports abstract types for Type[T]
# see https://github.com/python/mypy/issues/5374
ret
.
contained_element
.
add
(
cls
.
_construct_aas_reference
(
element_data
,
model
.
Referable
))
# type: ignore
return
ret
@
classmethod
def
_construct_concept_description
(
cls
,
dct
:
Dict
[
str
,
object
],
object_class
=
model
.
ConceptDescription
)
\
->
model
.
ConceptDescription
:
...
...
aas/adapter/json/json_serialization.py
View file @
61efb9d1
...
...
@@ -91,8 +91,6 @@ class AASToJsonEncoder(json.JSONEncoder):
return
self
.
_basic_event_to_json
(
obj
)
if
isinstance
(
obj
,
model
.
Entity
):
return
self
.
_entity_to_json
(
obj
)
if
isinstance
(
obj
,
model
.
View
):
return
self
.
_view_to_json
(
obj
)
if
isinstance
(
obj
,
model
.
ConceptDescription
):
return
self
.
_concept_description_to_json
(
obj
)
if
isinstance
(
obj
,
model
.
Property
):
...
...
@@ -315,19 +313,6 @@ class AASToJsonEncoder(json.JSONEncoder):
# transformation functions to serialize classes from model.aas
# ############################################################
@
classmethod
def
_view_to_json
(
cls
,
obj
:
model
.
View
)
->
Dict
[
str
,
object
]:
"""
serialization of an object from class View to json
:param obj: object of class View
:return: dict with the serialized attributes of this object
"""
data
=
cls
.
_abstract_classes_to_json
(
obj
)
if
obj
.
contained_element
:
data
[
'containedElements'
]
=
list
(
obj
.
contained_element
)
return
data
@
classmethod
def
_identifier_key_value_pair_to_json
(
cls
,
obj
:
model
.
IdentifierKeyValuePair
)
->
Dict
[
str
,
object
]:
"""
...
...
@@ -441,8 +426,6 @@ class AASToJsonEncoder(json.JSONEncoder):
data
[
"assetInformation"
]
=
obj
.
asset_information
if
not
cls
.
stripped
and
obj
.
submodel
:
data
[
"submodels"
]
=
list
(
obj
.
submodel
)
if
not
cls
.
stripped
and
obj
.
view
:
data
[
"views"
]
=
list
(
obj
.
view
)
if
obj
.
security
:
data
[
"security"
]
=
obj
.
security
return
data
...
...
aas/adapter/xml/AAS.xsd
View file @
61efb9d1
...
...
@@ -52,7 +52,6 @@
<element
maxOccurs=
"1"
minOccurs=
"0"
name=
"derivedFrom"
type=
"aas:reference_t"
/>
<element
maxOccurs=
"1"
minOccurs=
"0"
name=
"submodelRefs"
type=
"aas:submodelRefs_t"
/>
<element
maxOccurs=
"1"
minOccurs=
"1"
name=
"assetInformation"
type=
"aas:assetInformation_t"
/>
<element
maxOccurs=
"1"
minOccurs=
"0"
name=
"views"
type=
"aas:views_t"
/>
</sequence>
</complexType>
<complexType
name=
"assetAdministrationShells_t"
>
...
...
@@ -284,7 +283,6 @@
<enumeration
value=
"Submodel"
/>
<enumeration
value=
"SubmodelElement"
/>
<enumeration
value=
"SubmodelElementCollection"
/>
<enumeration
value=
"View"
/>
</restriction>
</simpleType>
</attribute>
...
...
@@ -471,19 +469,6 @@
<extension
base=
"anySimpleType"
/>
</simpleContent>
</complexType>
<complexType
name=
"view_t"
>
<sequence>
<group
ref=
"aas:referable"
/>
<group
ref=
"aas:hasSemantics"
/>
<group
ref=
"aas:hasDataSpecification"
/>
<element
name=
"containedElements"
type=
"aas:containedElements_t"
/>
</sequence>
</complexType>
<complexType
name=
"views_t"
>
<sequence>
<element
maxOccurs=
"unbounded"
minOccurs=
"0"
name=
"view"
type=
"aas:view_t"
/>
</sequence>
</complexType>
<element
name=
"aasenv"
type=
"aas:aasenv_t"
/>
<element
name=
"key"
type=
"aas:key_t"
/>
<group
name=
"dataElement"
>
...
...
aas/adapter/xml/IEC61360.xsd
View file @
61efb9d1
...
...
@@ -75,7 +75,6 @@
<enumeration
value=
"Submodel"
/>
<enumeration
value=
"SubmodelElement"
/>
<enumeration
value=
"SubmodelElementCollection"
/>
<enumeration
value=
"View"
/>
</restriction>
</simpleType>
</attribute>
...
...
aas/adapter/xml/xml_deserialization.py
View file @
61efb9d1
...
...
@@ -618,17 +618,6 @@ class AASFromXmlDecoder:
"""
return
object_class
()
@
classmethod
def
construct_view
(
cls
,
element
:
etree
.
Element
,
object_class
=
model
.
View
,
**
_kwargs
:
Any
)
->
model
.
View
:
view
=
object_class
(
_child_text_mandatory
(
element
,
NS_AAS
+
"idShort"
))
contained_elements
=
element
.
find
(
NS_AAS
+
"containedElements"
)
if
contained_elements
is
not
None
:
for
ref
in
_failsafe_construct_multiple
(
contained_elements
.
findall
(
NS_AAS
+
"containedElementRef"
),
cls
.
_construct_referable_reference
,
cls
.
failsafe
):
view
.
contained_element
.
add
(
ref
)
cls
.
_amend_abstract_attributes
(
view
,
element
)
return
view
@
classmethod
def
construct_submodel_element
(
cls
,
element
:
etree
.
Element
,
**
kwargs
:
Any
)
->
model
.
SubmodelElement
:
"""
...
...
@@ -919,10 +908,6 @@ class AASFromXmlDecoder:
for
ref
in
_child_construct_multiple
(
submodels
,
NS_AAS
+
"submodelRef"
,
cls
.
_construct_submodel_reference
,
cls
.
failsafe
):
aas
.
submodel
.
add
(
ref
)
views
=
element
.
find
(
NS_AAS
+
"views"
)
if
views
is
not
None
:
for
view
in
_child_construct_multiple
(
views
,
NS_AAS
+
"view"
,
cls
.
construct_view
,
cls
.
failsafe
):
aas
.
view
.
add
(
view
)
derived_from
=
_failsafe_construct
(
element
.
find
(
NS_AAS
+
"derivedFrom"
),
cls
.
_construct_asset_administration_shell_reference
,
cls
.
failsafe
)
if
derived_from
is
not
None
:
...
...
@@ -1189,7 +1174,6 @@ class XMLConstructables(enum.Enum):
QUALIFIER
=
enum
.
auto
()
IDENTIFIER
=
enum
.
auto
()
SECURITY
=
enum
.
auto
()
VIEW
=
enum
.
auto
()
OPERATION_VARIABLE
=
enum
.
auto
()
ANNOTATED_RELATIONSHIP_ELEMENT
=
enum
.
auto
()
BASIC_EVENT
=
enum
.
auto
()
...
...
@@ -1254,8 +1238,6 @@ def read_aas_xml_element(file: IO, construct: XMLConstructables, failsafe: bool
constructor
=
decoder_
.
construct_identifier
elif
construct
==
XMLConstructables
.
SECURITY
:
constructor
=
decoder_
.
construct_security
elif
construct
==
XMLConstructables
.
VIEW
:
constructor
=
decoder_
.
construct_view
elif
construct
==
XMLConstructables
.
OPERATION_VARIABLE
:
constructor
=
decoder_
.
construct_operation_variable
elif
construct
==
XMLConstructables
.
ANNOTATED_RELATIONSHIP_ELEMENT
:
...
...
aas/adapter/xml/xml_serialization.py
View file @
61efb9d1
...
...
@@ -311,23 +311,6 @@ def value_list_to_xml(obj: model.ValueList,
# ##############################################################
def
view_to_xml
(
obj
:
model
.
View
,
tag
:
str
=
NS_AAS
+
"view"
)
->
etree
.
Element
:
"""
Serialization of objects of class :class:`~aas.model.aas.View` to XML
:param obj: object of class :class:`~aas.model.aas.View`
:param tag: Namespace+Tag of the ElementTree object. Default is "aas:view"
:return: Serialized ElementTree object
"""
et_view
=
abstract_classes_to_xml
(
tag
,
obj
)
et_contained_elements
=
_generate_element
(
name
=
NS_AAS
+
"containedElements"
)
if
obj
.
contained_element
:
for
contained_element
in
obj
.
contained_element
:
et_contained_elements
.
append
(
reference_to_xml
(
contained_element
,
NS_AAS
+
"containedElementRef"
))
et_view
.
append
(
et_contained_elements
)
return
et_view
def
identifier_key_value_pair_to_xml
(
obj
:
model
.
IdentifierKeyValuePair
,
tag
:
str
=
NS_AAS
+
"identifierKeyValuePair"
)
\
->
etree
.
Element
:
"""
...
...
@@ -526,11 +509,6 @@ def asset_administration_shell_to_xml(obj: model.AssetAdministrationShell,
et_submodels
.
append
(
reference_to_xml
(
reference
,
tag
=
NS_AAS
+
"submodelRef"
))
et_aas
.
append
(
et_submodels
)
et_aas
.
append
(
asset_information_to_xml
(
obj
.
asset_information
,
tag
=
NS_AAS
+
"assetInformation"
))
if
obj
.
view
:
et_views
=
_generate_element
(
NS_AAS
+
"views"
)
for
view
in
obj
.
view
:
et_views
.
append
(
view_to_xml
(
view
,
NS_AAS
+
"view"
))
et_aas
.
append
(
et_views
)
return
et_aas
...
...
aas/examples/data/_helper.py
View file @
61efb9d1
...
...
@@ -726,7 +726,6 @@ class AASDataChecker(DataChecker):
self
.
check_attribute_equal
(
object_
,
'derived_from'
,
expected_value
.
derived_from
)
self
.
check_contained_element_length
(
object_
,
'submodel'
,
model
.
AASReference
,
len
(
expected_value
.
submodel
))
self
.
check_contained_element_length
(
object_
,
'view'
,
model
.
View
,
len
(
expected_value
.
view
))
for
expected_ref
in
expected_value
.
submodel
:
ref
=
self
.
_find_reference
(
expected_ref
,
object_
.
submodel
)
if
self
.
check
(
ref
is
not
None
,
'Submodel Reference {} must exist'
.
format
(
repr
(
expected_ref
))):
...
...
@@ -737,17 +736,6 @@ class AASDataChecker(DataChecker):
'references'
.
format
(
repr
(
object_
)),
value
=
found_elements
)
for
expected_view
in
expected_value
.
view
:
try
:
view
=
object_
.
get_referable
(
expected_view
.
id_short
)
self
.
check_view_equal
(
view
,
expected_view
)
# type: ignore
except
KeyError
:
self
.
check
(
False
,
'View {} must exist'
.
format
(
repr
(
expected_view
)))
found_elements
=
self
.
_find_extra_elements_by_id_short
(
object_
.
view
,
expected_value
.
view
)
self
.
check
(
found_elements
==
set
(),
'Asset Administration Shell {} must not have extra '
'views'
.
format
(
repr
(
object_
)),
value
=
found_elements
)
def
check_security_equal
(
self
,
object_
:
model
.
Security
,
expected_value
:
model
.
Security
):
"""
...
...
@@ -760,30 +748,6 @@ class AASDataChecker(DataChecker):
# TODO: if security is specified
pass
def
check_view_equal
(
self
,
object_
:
model
.
View
,
expected_value
:
model
.
View
):
"""
Checks if the given View objects are equal
:param object_: Given View object to check
:param expected_value: expected View object
:return:
"""
self
.
_check_referable_equal
(
object_
,
expected_value
)
self
.
_check_has_semantics_equal
(
object_
,
expected_value
)
self
.
check_contained_element_length
(
object_
,
'contained_element'
,
model
.
AASReference
,
len
(
expected_value
.
contained_element
))
for
expected_ref
in
expected_value
.
contained_element
:
ref
=
self
.
_find_reference
(
expected_ref
,
object_
.
contained_element
)
if
self
.
check
(
ref
is
not
None
,
'View Reference {} must exist'
.
format
(
repr
(
expected_ref
))):
self
.
_check_reference_equal
(
ref
,
expected_ref
)
# type: ignore
found_elements
=
self
.
_find_extra_object
(
object_
.
contained_element
,
expected_value
.
contained_element
,
model
.
AASReference
)
self
.
check
(
found_elements
==
set
(),
'View Reference {} must not have extra '
'submodel element references'
.
format
(
repr
(
object_
)),
value
=
found_elements
)
def
check_concept_description_equal
(
self
,
object_
:
model
.
ConceptDescription
,
expected_value
:
model
.
ConceptDescription
):
"""
...
...
aas/examples/data/example_aas.py
View file @
61efb9d1
...
...
@@ -626,7 +626,6 @@ def create_example_asset_administration_shell() -> \
id_type
=
model
.
KeyType
.
IRI
),),
model
.
Submodel
),
},
view
=
[],
derived_from
=
model
.
AASReference
((
model
.
Key
(
type_
=
model
.
KeyElements
.
ASSET_ADMINISTRATION_SHELL
,
value
=
'https://acplt.org/TestAssetAdministrationShell2'
,
id_type
=
model
.
KeyType
.
IRI
),),
...
...
aas/examples/data/example_aas_missing_attributes.py
View file @
61efb9d1
...
...
@@ -345,14 +345,6 @@ def create_example_asset_administration_shell() -> model.AssetAdministrationShel
:return: example asset administration shell
"""
view
=
model
.
View
(
id_short
=
'ExampleView'
,
contained_element
=
{
model
.
AASReference
((
model
.
Key
(
type_
=
model
.
KeyElements
.
SUBMODEL
,
value
=
'https://acplt.org/Test_Submodel_Missing'
,
id_type
=
model
.
KeyType
.
IRI
),),
model
.
Submodel
)})
view_2
=
model
.
View
(
id_short
=
'ExampleView2'
)
submodel_element_file
=
model
.
File
(
id_short
=
'ThumbnailFile'
,
...
...
@@ -397,7 +389,6 @@ def create_example_asset_administration_shell() -> model.AssetAdministrationShel
value
=
'https://acplt.org/Test_Submodel_Missing'
,
id_type
=
model
.
KeyType
.
IRI
),),
model
.
Submodel
)},
view
=
[
view
,
view_2
],
derived_from
=
None
)
return
asset_administration_shell
...
...
aas/model/__init__.py
View file @
61efb9d1
...
...
@@ -45,7 +45,6 @@ KEY_ELEMENTS_CLASSES: Dict[Type[Referable], KeyElements] = {
AssetAdministrationShell
:
KeyElements
.
ASSET_ADMINISTRATION_SHELL
,
ConceptDescription
:
KeyElements
.
CONCEPT_DESCRIPTION
,
Submodel
:
KeyElements
.
SUBMODEL
,
View
:
KeyElements
.
VIEW
,
Entity
:
KeyElements
.
ENTITY
,
BasicEvent
:
KeyElements
.
BASIC_EVENT
,
Event
:
KeyElements
.
EVENT
,
...
...
aas/model/aas.py
View file @
61efb9d1
...
...
@@ -12,7 +12,6 @@ AssetAdministrationShell.
This module contains the following classes from an up-to-down-level:
- :class:`~.AssetAdministrationShell`
- :class:`~.AssetInformation`
- :class:`~.View`
"""
from
typing
import
Optional
,
Set
,
Iterable
...
...
@@ -22,55 +21,6 @@ from .security import Security
from
.submodel
import
File
,
Submodel
class
View
(
base
.
Referable
,
base
.
UniqueIdShortNamespace
,
base
.
HasSemantics
):
"""
A view is a collection of referable elements w.r.t. to a specific viewpoint of one or more stakeholders.
todo: what does this exactly?
:ivar id_short: Identifying string of the element within its name space. (inherited from
:class:`~aas.model.base.Referable`)
:ivar contained_element: Unordered list of :class:`AASReferences <aas.model.base.AASReference>` to elements
of class :class:`~aas.model.base.Referable`
:ivar display_name: Can be provided in several languages. (inherited from :class:`~aas.model.base.Referable`)
:ivar category: The category is a value that gives further meta information w.r.t. to the class of the element.
It affects the expected existence of attributes and the applicability of constraints.
(inherited from :class:`~aas.model.base.Referable`)
:ivar description: Description or comments on the element. (inherited from :class:`~aas.model.base.Referable`)
:ivar parent: Reference to the next referable parent element of the element. (inherited from
:class:`~aas.model.base.Referable`)
:ivar semantic_id: Identifier of the semantic definition of the element. It is called semantic id of the
element. The semantic id may either reference an external global id or it may reference a
referable model element of kind=Type that defines the semantics of the element.
(inherited from from :class:`~aas.model.base.HasSemantics`)
:ivar extension: An extension of the element.
(from :class:`~aas.model.base.HasExtensions`)
"""
def
__init__
(
self
,
id_short
:
str
,
contained_element
:
Optional
[
Set
[
base
.
AASReference
]]
=
None
,
display_name
:
Optional
[
base
.
LangStringSet
]
=
None
,
category
:
Optional
[
str
]
=
None
,
description
:
Optional
[
base
.
LangStringSet
]
=
None
,
parent
:
Optional
[
base
.
UniqueIdShortNamespace
]
=
None
,
semantic_id
:
Optional
[
base
.
Reference
]
=
None
,
extension
:
Iterable
[
base
.
Extension
]
=
()):
"""
TODO: Add instruction what to do after construction
"""
super
().
__init__
()
self
.
id_short
=
id_short
self
.
contained_element
:
Set
[
base
.
AASReference
]
=
set
()
if
contained_element
is
None
else
contained_element
self
.
display_name
:
Optional
[
base
.
LangStringSet
]
=
dict
()
if
display_name
is
None
else
display_name
self
.
category
=
category
self
.
description
:
Optional
[
base
.
LangStringSet
]
=
dict
()
if
description
is
None
else
description
self
.
parent
:
Optional
[
base
.
UniqueIdShortNamespace
]
=
parent
self
.
semantic_id
:
Optional
[
base
.
Reference
]
=
semantic_id
self
.
extension
=
base
.
NamespaceSet
(
self
,
[(
"name"
,
True
)],
extension
)
class
AssetInformation
:
"""
In AssetInformation identifying meta data of the asset that is represented by an AAS is defined.
...
...
@@ -152,8 +102,6 @@ class AssetAdministrationShell(base.Identifiable, base.UniqueIdShortNamespace):
:ivar ~.security: Definition of the security relevant aspects of the AAS. (Initialization-parameter: `security_`)
:ivar ~.submodel: Unordered list of :class:`submodels <aas.model.submodel.Submodel>` to describe typically the asset
of an AAS. (Initialization-parameter: `submodel_`)
:ivar view: Unordered list of stakeholder specific :class:`views <aas.model.aas.View>` that can group the elements
of the AAS.
:ivar derived_from: The :class:`reference <aas.model.base.AASReference>` to the AAS the AAs was derived from
:ivar extension: An extension of the element.
(from :class:`~aas.model.base.HasExtensions`)
...
...
@@ -169,7 +117,6 @@ class AssetAdministrationShell(base.Identifiable, base.UniqueIdShortNamespace):
administration
:
Optional
[
base
.
AdministrativeInformation
]
=
None
,
security
:
Optional
[
Security
]
=
None
,
submodel
:
Optional
[
Set
[
base
.
AASReference
[
Submodel
]]]
=
None
,
view
:
Iterable
[
View
]
=
(),
derived_from
:
Optional
[
base
.
AASReference
[
"AssetAdministrationShell"
]]
=
None
,
extension
:
Iterable
[
base
.
Extension
]
=
()):
super
().
__init__
()
...
...
@@ -184,5 +131,4 @@ class AssetAdministrationShell(base.Identifiable, base.UniqueIdShortNamespace):
self
.
derived_from
:
Optional
[
base
.
AASReference
[
"AssetAdministrationShell"
]]
=
derived_from
self
.
security
:
Optional
[
Security
]
=
security
self
.
submodel
:
Set
[
base
.
AASReference
[
Submodel
]]
=
set
()
if
submodel
is
None
else
submodel
self
.
view
:
base
.
NamespaceSet
[
View
]
=
base
.
NamespaceSet
(
self
,
[(
"id_short"
,
True
)],
view
)
self
.
extension
=
base
.
NamespaceSet
(
self
,
[(
"name"
,
True
)],
extension
)
aas/model/base.py
View file @
61efb9d1
...
...
@@ -92,7 +92,6 @@ class KeyElements(Enum):
:cvar RELATIONSHIP_ELEMENT: :class:`~aas.model.submodel.RelationshipElement`
:cvar SUBMODEL_ELEMENT: :class:`~aas.model.submodel.SubmodelElement`
:cvar SUBMODEL_ELEMENT_COLLECTION: :class:`~aas.model.submodel.SubmodelElementCollection`
:cvar VIEW: :class:`~aas.model.aas.View`
**KeyElements starting from 2000**
...
...
@@ -127,7 +126,8 @@ class KeyElements(Enum):
RELATIONSHIP_ELEMENT
=
1015
SUBMODEL_ELEMENT
=
1016
SUBMODEL_ELEMENT_COLLECTION
=
1017
VIEW
=
1018
# keep _VIEW = 1018 as a protected enum member here, so 1018 isn't reused in the enum by a future referable
_VIEW
=
1018
# KeyElements starting from 2000
GLOBAL_REFERENCE
=
2000
...
...
aas/model/concept.py
View file @
61efb9d1
...
...
@@ -27,8 +27,7 @@ ALLOWED_CONCEPT_DESCRIPTION_CATEGORIES: Set[str] = {
"EVENT"
,
"ENTITY"
,
"APPLICATION_CLASS"
,
"QUALIFIER"
,
"VIEW"
"QUALIFIER"
}
...
...
aas/util/traversal.py
View file @
61efb9d1
...
...
@@ -34,8 +34,7 @@ def walk_submodel(collection: Union[model.Submodel, model.SubmodelElementCollect
def
walk_semantic_ids_recursive
(
root
:
model
.
Referable
)
->
Iterator
[
model
.
Reference
]:
"""
Traverse an AAS object hierarchy (e.g. an AAS with its :class:`Views <aas.model.aas.View>` or a
:class:`~aas.model.submodel.Submodel` with all recursively contained
Traverse an AAS object hierarchy (e.g. a :class:`~aas.model.submodel.Submodel` with all recursively contained
:class:`SubmodelElements <aas.model.submodel.SubmodelElements>`) recursively and return all non-empty (!= None)
semanticIds.
...
...
test/adapter/json/test_json_deserialization.py
View file @
61efb9d1
...
...
@@ -409,22 +409,16 @@ class JsonDeserializationStrippedObjectsTest(unittest.TestCase):
"type": "Submodel",
"value": "http://acplt.org/test_submodel"
}]
}],
"views": [{
"modelType": {"name": "View"},
"idShort": "test_view"
}]
}"""
# check if JSON with submodels
and views
can be parsed successfully
# check if JSON with submodels can be parsed successfully
aas
=
json
.
loads
(
data
,
cls
=
StrictAASFromJsonDecoder
)
self
.
assertIsInstance
(
aas
,
model
.
AssetAdministrationShell
)
assert
isinstance
(
aas
,
model
.
AssetAdministrationShell
)
self
.
assertEqual
(
len
(
aas
.
submodel
),
1
)
self
.
assertEqual
(
len
(
aas
.
view
),
1
)
# check if submodels
and views
are ignored in stripped mode
# check if submodels are ignored in stripped mode
aas
=
json
.
loads
(
data
,
cls
=
StrictStrippedAASFromJsonDecoder
)
self
.
assertIsInstance
(
aas
,
model
.
AssetAdministrationShell
)
assert
isinstance
(
aas
,
model
.
AssetAdministrationShell
)
self
.
assertEqual
(
len
(
aas
.
submodel
),
0
)
self
.
assertEqual
(
len
(
aas
.
view
),
0
)
test/adapter/json/test_json_serialization.py
View file @
61efb9d1
...
...
@@ -228,8 +228,7 @@ class JsonSerializationStrippedObjectsTest(unittest.TestCase):
aas
=
model
.
AssetAdministrationShell
(
model
.
AssetInformation
(
global_asset_id
=
asset_ref
),
model
.
Identifier
(
"http://acplt.org/test_aas"
,
model
.
IdentifierType
.
IRI
),
submodel
=
{
submodel_ref
},
view
=
[
model
.
View
(
"test_view"
)]
submodel
=
{
submodel_ref
}
)
self
.
_checkNormalAndStripped
({
"submodels"
,
"views"
},
aas
)
self
.
_checkNormalAndStripped
({
"submodels"
},
aas
)
test/adapter/xml/test_xml_deserialization.py
View file @
61efb9d1
...
...
@@ -473,29 +473,22 @@ class XmlDeserializationStrippedObjectsTest(unittest.TestCase):
</aas:keys>
</aas:submodelRef>
</aas:submodelRefs>
<aas:views>
<aas:view>
<aas:idShort>test_view</aas:idShort>
</aas:view>
</aas:views>
</aas:assetAdministrationShell>
"""
bytes_io
=
io
.
BytesIO
(
xml
.
encode
(
"utf-8"
))
# check if XML with submodelRef
and views
can be parsed successfully
# check if XML with submodelRef can be parsed successfully
aas
=
read_aas_xml_element
(
bytes_io
,
XMLConstructables
.
ASSET_ADMINISTRATION_SHELL
,
failsafe
=
False
)
self
.
assertIsInstance
(
aas
,
model
.
AssetAdministrationShell
)
assert
isinstance
(
aas
,
model
.
AssetAdministrationShell
)
self
.
assertEqual
(
len
(
aas
.
submodel
),
1
)
self
.
assertEqual
(
len
(
aas
.
view
),
1
)
# check if submodelRef
and views are
ignored in stripped mode
# check if submodelRef
is
ignored in stripped mode
aas
=
read_aas_xml_element
(
bytes_io
,
XMLConstructables
.
ASSET_ADMINISTRATION_SHELL
,
failsafe
=
False
,
stripped
=
True
)
self
.
assertIsInstance
(
aas
,
model
.
AssetAdministrationShell
)
assert
isinstance
(
aas
,
model
.
AssetAdministrationShell
)
self
.
assertEqual
(
len
(
aas
.
submodel
),
0
)
self
.
assertEqual
(
len
(
aas
.
view
),
0
)
class
XmlDeserializationDerivingTest
(
unittest
.
TestCase
):
...
...
test/compliance_tool/files/test_demo_full_example.json
View file @
61efb9d1
...
...
@@ -243,31 +243,6 @@
}
]
}
],
"views"
:
[
{
"idShort"
:
"ExampleView"
,
"modelType"
:
{
"name"
:
"View"
},
"containedElements"
:
[
{
"keys"
:
[
{
"type"
:
"Submodel"
,
"idType"
:
"IRI"
,
"value"
:
"https://acplt.org/Test_Submodel_Missing"
}
]
}
]
},
{
"idShort"
:
"ExampleView2"
,
"modelType"
:
{
"name"
:
"View"
}
}
]
}
],
...
...
Prev
1
2
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.