Class ReadAasxFile.XmlReader

java.lang.Object
de.iip_ecosphere.platform.configuration.easyProducer.aas.ReadAasxFile.XmlReader
Enclosing class:
ReadAasxFile

private static class ReadAasxFile.XmlReader extends Object
Reads AAS xml nodes.
Author:
Holger Eichelberger, SSE
  • Field Details

  • Constructor Details

    • XmlReader

      private XmlReader()
  • Method Details

    • readFromXml

      AasSpecSummary readFromXml(Document document, String specNumber)
      Reads from the given XML document.
      Parameters:
      document - the document
      specNumber - the specification number
      Returns:
      the spec summary for IvmlWriter
    • getName

      private static String getName(Node node)
      Returns the name of node, stripping potential prefixes like "aas:".
      Parameters:
      node - the node
      Returns:
      the node name name, eventually without prefix
    • registerSemanticId

      private <E extends AbstractAasElement> void registerSemanticId(Map<String,List<E>> map, E element)
      Registers a semantic id.
      Type Parameters:
      E - the element type
      Parameters:
      map - the map storing the id-element relations
      element - the element to register
    • applyConceptDescription

      private void applyConceptDescription(AbstractAasElement elt, ReadAasxFile.XmlReader.ConceptDescription cd)
      Applies a concept description to elt.
      Parameters:
      elt - the element to apply to
      cd - the concept description
    • readSubmodels

      private String readSubmodels(Node node)
      Reads a set of submodels.
      Parameters:
      node - the XML node representing the submodels
      Returns:
      the version
    • readAsAasType

      private ReadAasxFile.AasTypeResult readAsAasType(Node node, AasSmeType smeType)
      Reads the given node as AasType with given smeType.
      Parameters:
      node - the XML node to be read
      smeType - the SME type
      Returns:
      the reading result
    • readDisplayName

      private String readDisplayName(Node node)
      Reads the display name.
      Parameters:
      node - the node containing the display name contents
      Returns:
      the display name, may be empty for none
    • addType

      private void addType(AasType type)
      Adds a type to types and registers type with semIdTypes.
      Parameters:
      type - the type to add
    • readAdministration

      private String readAdministration(Node node)
      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 qualifiers
      cardinalitySetter - setter for the cardinalities
      exampleValueSetter - setter for example values
      fallbackConsumer - in case that qualifier type is not known, may be null
    • readSubmodelElement

      private void readSubmodelElement(Node node, AasType type)
      Reads a submodel elements.
      Parameters:
      node - the XML node representing the submodel
      type - the parent type where to add the fields to
    • readFieldAsNewType

      private void readFieldAsNewType(Node field, AasType parentType, AasSmeType smeType)
      Reads a field as new type and registers the type.
      Parameters:
      field - the XML node representing the field
      parentType - the parent type where to add the field
      smeType - the SME type of the field/type
    • addField

      private void addField(AasType type, AasField field)
      Adds field to type registering field with semIdFields.
      Parameters:
      type - the type
      field - the field
    • setExampleValues

      private void setExampleValues(String data, AasField field)
      Sets example values splitting the actual value in data heuristically into multiple ones if needed.
      Parameters:
      data - the data
      field - the target field
    • readConceptDescriptions

      private void readConceptDescriptions(Node node)
      Reads concept descriptions from node.
      Parameters:
      node - the XML node representing the concept descriptions
    • readConceptDescription

      private void readConceptDescription(Node node)
      Reads a concept description from node.
      Parameters:
      node - the XML node representing the concept description
    • readEmbeddedDataSpecifications

      private void readEmbeddedDataSpecifications(Node node, ReadAasxFile.XmlReader.ConceptDescription cd)
      Reads an embedded data specification from node into cd.
      Parameters:
      node - the XML node representing the concept description
      cd - the concept description
    • readEmbeddedDataSpecification

      private void readEmbeddedDataSpecification(Node node, ReadAasxFile.XmlReader.ConceptDescription cd)
      Reads an embedded data specification from node into cd.
      Parameters:
      node - the XML node representing the concept description
      cd - the concept description
    • readDataSpecificationContent

      private void readDataSpecificationContent(Node node, ReadAasxFile.XmlReader.ConceptDescription cd)
      Reads an embedded data specification from node into cd.
      Parameters:
      node - the XML node representing the concept description
      cd - the concept description
    • readDataSpecificationIEC61360

      private void readDataSpecificationIEC61360(Node node, ReadAasxFile.XmlReader.ConceptDescription cd)
      Reads a data specification according to IEC61360 from node into cd.
      Parameters:
      node - the XML node representing the concept description
      cd - the concept description
    • readIECdefinition

      private void readIECdefinition(Node node, ReadAasxFile.XmlReader.ConceptDescription cd)
      Reads an IEC61360 definition from node into cd.
      Parameters:
      node - the XML node representing the concept description
      cd - 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 property
      type - the type to use (if not specified in node)
      smeType - the SME type
      handler - optional handler for unhandled entries
      Returns:
      the created field
    • getBoolean

      private boolean getBoolean(Node node)
      Reads the given node as a Boolean.
      Parameters:
      node - the node
      Returns:
      the boolean value
    • getDescription

      private String getDescription(Node node, AasField field, boolean inferEnum, boolean addMissingLang)
      Reads the given node as a description value.
      Parameters:
      node - the node
      field - the target field if enums shall be inferred from the description; may then override the value type
      inferEnum - infer enum specs if field is not null
      addMissingLang - add missing language field is not null and multi-language property
      Returns:
      the pre-formatted description value
    • readLangStringTextType

      private void readLangStringTextType(Node node, Map<String,String> desc)
      Reads a LangStringTextType.
      Parameters:
      node - the node to read from
      desc - the mapping to write information into
    • getSemanticId

      private String getSemanticId(Node node)
      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

      private boolean isSemanticIdValidKey(String type)
      Returns whether type is a valid key type for a semantic id.
      Parameters:
      type - the type
      Returns:
      true for valid, false else
    • readKeyAsSemanticId

      private String readKeyAsSemanticId(Node node)
      Reads a key node with subelements as semantic id.
      Parameters:
      node - the node
      Returns:
      the semantic id, may be empty
    • readSemanticId

      private String readSemanticId(Node node)
      Reads a semantic id in node.
      Parameters:
      node - the node
      Returns:
      the semantic id in platform abstraction format
    • getSemanticId

      private String getSemanticId(String idType, String id)
      Returns a semantic id in platform notation.
      Parameters:
      idType - the id type
      id - the id
      Returns:
      the composed id, may be id
    • getAttributeValue

      private String getAttributeValue(Node node, String attribute, String dflt)
      Returns the string value of an XML attribute.
      Parameters:
      node - the node holding the attribute
      attribute - the attribute name
      dflt - the default value to return if the attribute was not found
      Returns:
      dflt or the value of attribute in node