Class ReadAasxFile.XmlReader
java.lang.Object
de.iip_ecosphere.platform.configuration.easyProducer.aas.ReadAasxFile.XmlReader
- Enclosing class:
ReadAasxFile
Reads AAS xml nodes.
- Author:
- Holger Eichelberger, SSE
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate classRepresents an AAS concept description.private static interfaceHandler for unknown/specific fields.private static interfaceConsumes a qualifier. -
Field Summary
FieldsModifier and TypeFieldDescription -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidprivate voidprivate voidApplies a concept description toelt.private StringgetAttributeValue(Node node, String attribute, String dflt) Returns the string value of an XML attribute.private booleangetBoolean(Node node) Reads the given node as a Boolean.private StringgetDescription(Node node, AasField field, boolean inferEnum, boolean addMissingLang) Reads the given node as a description value.private static StringReturns the name ofnode, stripping potential prefixes like "aas:".private StringgetSemanticId(String idType, String id) Returns a semantic id in platform notation.private StringgetSemanticId(Node node) Returns a semantic id in style of the AAS abstraction of the platform.private booleanisSemanticIdValidKey(String type) Returns whethertypeis a valid key type for a semantic id.private AasFieldreadAasProperty(Node node, String type, AasSmeType smeType, ReadAasxFile.XmlReader.FieldHandler handler) Reads an AAS property.private StringreadAdministration(Node node) Reads the administration entry to the version information if specified.private ReadAasxFile.AasTypeResultreadAsAasType(Node node, AasSmeType smeType) private voidreadConceptDescription(Node node) Reads a concept description fromnode.private voidreadConceptDescriptions(Node node) Reads concept descriptions fromnode.private voidReads an embedded data specification fromnodeintocd.private voidReads a data specification according to IEC61360 fromnodeintocd.private StringreadDisplayName(Node node) Reads the display name.private voidReads an embedded data specification fromnodeintocd.private voidReads an embedded data specification fromnodeintocd.private voidreadFieldAsNewType(Node field, AasType parentType, AasSmeType smeType) Reads a field as new type and registers the type.(package private) AasSpecSummaryreadFromXml(Document document, String specNumber) Reads from the given XML document.private voidReads an IEC61360 definition fromnodeintocd.private StringreadKeyAsSemanticId(Node node) Reads a key node with subelements as semantic id.private voidreadLangStringTextType(Node node, Map<String, String> desc) Reads a LangStringTextType.private voidreadQualifier(Node node, Consumer<int[]> cardinalitySetter, Consumer<String> exampleValueSetter, ReadAasxFile.XmlReader.QualifierConsumer fallbackConsumer) Reads the qualifiers, may be cardinalities or example values.private StringreadSemanticId(Node node) Reads a semantic id innode.private voidreadSubmodelElement(Node node, AasType type) Reads a submodel elements.private StringreadSubmodels(Node node) Reads a set of submodels.private <E extends AbstractAasElement>
voidregisterSemanticId(Map<String, List<E>> map, E element) Registers a semantic id.private voidsetExampleValues(String data, AasField field) Sets example values splitting the actual value indataheuristically into multiple ones if needed.
-
Field Details
-
types
-
semIdTypes
-
semIdFields
-
enums
-
enumsHandler
-
semIdEnums
-
concepts
-
-
Constructor Details
-
XmlReader
private XmlReader()
-
-
Method Details
-
readFromXml
Reads from the given XML document.- Parameters:
document- the documentspecNumber- the specification number- Returns:
- the spec summary for
IvmlWriter
-
getName
Returns the name ofnode, stripping potential prefixes like "aas:".- Parameters:
node- the node- Returns:
- the node name name, eventually without prefix
-
registerSemanticId
Registers a semantic id.- Type Parameters:
E- the element type- Parameters:
map- the map storing the id-element relationselement- the element to register
-
applyConceptDescription
private void applyConceptDescription(AbstractAasElement elt, ReadAasxFile.XmlReader.ConceptDescription cd) Applies a concept description toelt.- Parameters:
elt- the element to apply tocd- the concept description
-
readSubmodels
Reads a set of submodels.- Parameters:
node- the XML node representing the submodels- Returns:
- the version
-
readAsAasType
- Parameters:
node- the XML node to be readsmeType- the SME type- Returns:
- the reading result
-
readDisplayName
Reads the display name.- Parameters:
node- the node containing the display name contents- Returns:
- the display name, may be empty for none
-
addType
- Parameters:
type- the type to add
-
readAdministration
Reads the administration entry to the version information if specified.- Parameters:
node- the node- Returns:
- the version, or null
-
readQualifier
private void readQualifier(Node node, Consumer<int[]> cardinalitySetter, Consumer<String> exampleValueSetter, ReadAasxFile.XmlReader.QualifierConsumer fallbackConsumer) Reads the qualifiers, may be cardinalities or example values.- Parameters:
node- the node representing the qualifierscardinalitySetter- setter for the cardinalitiesexampleValueSetter- setter for example valuesfallbackConsumer- in case that qualifier type is not known, may be null
-
readSubmodelElement
Reads a submodel elements.- Parameters:
node- the XML node representing the submodeltype- the parent type where to add the fields to
-
readFieldAsNewType
Reads a field as new type and registers the type.- Parameters:
field- the XML node representing the fieldparentType- the parent type where to add the fieldsmeType- the SME type of the field/type
-
addField
- Parameters:
type- the typefield- the field
-
setExampleValues
Sets example values splitting the actual value indataheuristically into multiple ones if needed.- Parameters:
data- the datafield- the target field
-
readConceptDescriptions
Reads concept descriptions fromnode.- Parameters:
node- the XML node representing the concept descriptions
-
readConceptDescription
Reads a concept description fromnode.- Parameters:
node- the XML node representing the concept description
-
readEmbeddedDataSpecifications
private void readEmbeddedDataSpecifications(Node node, ReadAasxFile.XmlReader.ConceptDescription cd) Reads an embedded data specification fromnodeintocd.- Parameters:
node- the XML node representing the concept descriptioncd- the concept description
-
readEmbeddedDataSpecification
Reads an embedded data specification fromnodeintocd.- Parameters:
node- the XML node representing the concept descriptioncd- the concept description
-
readDataSpecificationContent
Reads an embedded data specification fromnodeintocd.- Parameters:
node- the XML node representing the concept descriptioncd- the concept description
-
readDataSpecificationIEC61360
Reads a data specification according to IEC61360 fromnodeintocd.- Parameters:
node- the XML node representing the concept descriptioncd- the concept description
-
readIECdefinition
Reads an IEC61360 definition fromnodeintocd.- Parameters:
node- the XML node representing the concept descriptioncd- the concept description
-
readAasProperty
private AasField readAasProperty(Node node, String type, AasSmeType smeType, ReadAasxFile.XmlReader.FieldHandler handler) Reads an AAS property.- Parameters:
node- the node representing the propertytype- the type to use (if not specified innode)smeType- the SME typehandler- optional handler for unhandled entries- Returns:
- the created field
-
getBoolean
Reads the given node as a Boolean.- Parameters:
node- the node- Returns:
- the boolean value
-
getDescription
Reads the given node as a description value.- Parameters:
node- the nodefield- the target field if enums shall be inferred from the description; may then overridethe value typeinferEnum- infer enum specs iffieldis not nulladdMissingLang- add missing languagefieldis not null and multi-language property- Returns:
- the pre-formatted description value
-
readLangStringTextType
Reads a LangStringTextType.- Parameters:
node- the node to read fromdesc- the mapping to write information into
-
getSemanticId
Returns a semantic id in style of the AAS abstraction of the platform.- Parameters:
node- the node from which to read the semantic id- Returns:
- the semantic id, may be empty
-
isSemanticIdValidKey
Returns whethertypeis a valid key type for a semantic id.- Parameters:
type- the type- Returns:
truefor valid,falseelse
-
readKeyAsSemanticId
Reads a key node with subelements as semantic id.- Parameters:
node- the node- Returns:
- the semantic id, may be empty
-
readSemanticId
Reads a semantic id innode.- Parameters:
node- the node- Returns:
- the semantic id in platform abstraction format
-
getSemanticId
Returns a semantic id in platform notation.- Parameters:
idType- the id typeid- the id- Returns:
- the composed id, may be
id
-
getAttributeValue
Returns the string value of an XML attribute.- Parameters:
node- the node holding the attributeattribute- the attribute namedflt- the default value to return if the attribute was not found- Returns:
dfltor the value ofattributeinnode
-