Class RowProcessor
java.lang.Object
de.iip_ecosphere.platform.configuration.easyProducer.aas.RowProcessor
Processes individual rows in an IDTA specification table.
- Author:
- Holger Eichelberger, SSE
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final booleanprivate intprivate booleanprivate booleanprivate static Patternprivate intprivate static Patternprivate intprivate intprivate AasFieldprivate intprivate intprivate String[]private Stringprivate intprivate Stringprivate String[]private intprivate static Patternprivate Stringprivate static Patternprivate de.iip_ecosphere.platform.support.Versionprivate Stringprivate String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) voidaddDataToRow(String data) Adds (cell) data for the actual row.private voidaddLastEnumLiteral(AasEnumLiteral literal) Adds enum literals.private booleancontainsPlainType(List<AasType> types, String[] ids) Doestypescontains a plain non-aspect type with idShort fromids.(package private) voidendRow()Notifies that collecting data for a row has ended and the collected information shall be classified and processed.(package private) voidNotifies that the end of a specification section has been reached and that temporary information for the last section shall be cleared for the next section.private voidIs called as anParsingUtils.AasEnumResultHandlerif a new enumeration instance was added.private static StringgetEnumLiteralIdentifier(String idShort) Returns the identifier to be used for an enum literal.private static de.iip_ecosphere.platform.support.logging.LoggerReturns the logger of this class.(package private) AasSpecSummaryReturns the summary result.private booleanhasRawData(int untilIndex) Returns whether collect data for a row contains data until the given index.private static booleanisSemanticIdSpec(String value, boolean followedBySpace) Returns whethervalueseems to be a specification of a semantic id.private booleanisValueExampleIgnore(String data) Returns whether a value/example entry can be ignored.mapPlainTypes(List<AasType> aasTypes) Collects and maps the plain non-aspect types intoaasTypes.parseMappedSemanticIds(String value) Parses a mapping of semantic IDs in case of an aspect type (IDTA-02017-1-0).private voidIn case that field rows are split into two, post-process the last field by adding the field's description and example values.private static StringpreprocessSemanticIdSpec(String value) Preprocesses a semantic id specification.private voidprocessFieldCardinality(String data, AasField field) Processes the fourth field cell, potentially containing the field cardinality.private voidProcesses four data cells.private voidTurns four data cells into an AAS field.private voidprocessSemanticIdDescription(String data, AasField field) Processes the second field cell containing the semantic id and the description, potentially with enums.private String[]processSmeTypeIdShort(String data, AasField field) Processes the field part in the first cell, containing the SME type and the idShort.private voidProcesses two column tables usually indicating a submodel or a submodel element collection.private voidprocessValueTypeExample(String data, AasField field) Processes the third field cell containing the value type and an optional example.private voidprocessValueTypeExampleOneLine(String line, AasField field) Processes a value type/example entry on a single line.private static String[]pruneExamples(String[] data) Prunes examples for "see section" entries.private String[]Prunes the given ids for alternative markers.(package private) voidNotified when reading of the specification is completed.private static StringremoveNote(String data) Removes a note description text ifCFG_REMOVE_NOTES.private voidRetokenizestokensfor separatorsep, if giving checkingconditionon follow-up strings after a new token.private voidsetExampleValues(String data, List<String> more, AasField field) Sets the example value(s).private voidsetFieldDescription(String description, AasField field) Sets the field description, considers in-place "isCaseOf" information and notes.private voidsetOnCurrent(Consumer<AasType> setter, String field) Callssetteron the currentAasType.private static voidsetSemanticId(Consumer<String> setter, String value, boolean considerFallback) Extracts, converts and finally sets a semantic id passed in fromvaluethroughsetter.private voidsplitMultiLanguageExample(List<String> tokens) Tries to split thetokensinto multi-language example strings.(package private) voidstartRow()Notifies about starting a data row.private voidstoreAsCurrent(List<AasType> newCurrent) StoresnewCurrentas the current type being processed.private static StringstripTitleDate(String value) If there is a date given at the end of the title, remove that.private inttoCardinality(String data) Interpretsdataas a single cardinality value.private static String[]toIdsBySeparator(String idShort) SplitsidShortinto multiple ids if certain (varying) conditions/formats apply.
-
Field Details
-
CFG_REMOVE_NOTES
private static final boolean CFG_REMOVE_NOTES- See Also:
-
titlePattern
-
langStringEnd
-
seeSection
-
extensionDesc
-
aasTypes
-
aasEnums
-
enumsHandler
-
current
-
rawData
-
lastRawData
-
maxRawIndex
private int maxRawIndex -
column
private int column -
lastHeader1Row
private int lastHeader1Row -
lastHeader2Row
private int lastHeader2Row -
row
private int row -
version
private de.iip_ecosphere.platform.support.Version version -
versionIdentifier
-
versionedName
-
projectName
-
specNumber
-
lastField
-
lastEnum
-
lastSemanticIdRaw
-
deferredTypes
-
genericFields
-
genericTypeCount
private int genericTypeCount -
currentTypeIsAspect
private boolean currentTypeIsAspect -
currentMultiSemIdProcessed
private boolean currentMultiSemIdProcessed -
lastEnum1Row
private int lastEnum1Row -
lastEnum2Row
private int lastEnum2Row
-
-
Constructor Details
-
RowProcessor
RowProcessor()
-
-
Method Details
-
startRow
void startRow()Notifies about starting a data row. Further data passed in throughaddDataToRow(String)is collected for the actual row untilendRow()is called. -
addDataToRow
Adds (cell) data for the actual row.- Parameters:
data- the data, may be null
-
enumAdded
Is called as anParsingUtils.AasEnumResultHandlerif a new enumeration instance was added.- Parameters:
en- the enumeration
-
stripTitleDate
If there is a date given at the end of the title, remove that.- Parameters:
value- the title string value- Returns:
valueor a shortened version
-
setOnCurrent
Callssetteron the currentAasType. Logs a warning if there is no current instance.- Parameters:
setter- the setterfield- the field name
-
hasRawData
private boolean hasRawData(int untilIndex) Returns whether collect data for a row contains data until the given index.- Parameters:
untilIndex- the index to check for until- Returns:
truefor relevant data,falseelse
-
endRow
void endRow()Notifies that collecting data for a row has ended and the collected information shall be classified and processed.- See Also:
-
addLastEnumLiteral
Adds enum literals.- Parameters:
literal- the literal to add
-
getEnumLiteralIdentifier
Returns the identifier to be used for an enum literal.- Parameters:
idShort- the idShort- Returns:
- the identifier or null
-
endSection
void endSection()Notifies that the end of a specification section has been reached and that temporary information for the last section shall be cleared for the next section. -
processTwoColumns
private void processTwoColumns()Processes two column tables usually indicating a submodel or a submodel element collection. -
toIdsBySeparator
SplitsidShortinto multiple ids if certain (varying) conditions/formats apply.- Parameters:
idShort- the idShort(s) to split- Returns:
- the splitted idShort(s)
-
parseMappedSemanticIds
Parses a mapping of semantic IDs in case of an aspect type (IDTA-02017-1-0).- Parameters:
value- the raw semanticID value of the type- Returns:
- the mapped semantic ids or null
-
pruneIds
Prunes the given ids for alternative markers.- Parameters:
ids- the ids- Returns:
- the pruned ids
-
containsPlainType
Doestypescontains a plain non-aspect type with idShort fromids.- Parameters:
types- the types to searchids- the IDs to look for- Returns:
trueif found,falseelse
-
preprocessSemanticIdSpec
Preprocesses a semantic id specification.- Parameters:
value- the value to preprocess- Returns:
- the preprocessed value
-
isSemanticIdSpec
Returns whethervalueseems to be a specification of a semantic id.- Parameters:
value- the valuefollowedBySpace- whether a following whitespace (occurs in some cases) shall specifically be checked and be there- Returns:
trueifvalueseems to be a semantic id,falseelse
-
setSemanticId
Extracts, converts and finally sets a semantic id passed in fromvaluethroughsetter.- Parameters:
setter- the semanticId settervalue- the actual value representing the semantic id (usually prefixed by [IRI] or [IRDI])considerFallback- in case that there is no semantic id type given, try a full resolution viaSemanticIdRecognizer; may not be needed if a conceptdescription is supposed to override the semantic id
-
processFourColumns
private void processFourColumns()Processes four data cells. This may detect the first/second head line of the specification field tables, pass on the following lines toprocessFourColumnsAsField()or ignore the lines in case of other four column tables.- See Also:
-
postProcessFourColumns
private void postProcessFourColumns()In case that field rows are split into two, post-process the last field by adding the field's description and example values.- See Also:
-
processFourColumnsAsField
private void processFourColumnsAsField()Turns four data cells into an AAS field.- See Also:
-
processSmeTypeIdShort
Processes the field part in the first cell, containing the SME type and the idShort.- Parameters:
data- the cell datafield- the field to be modified as a side effect.- Returns:
- additional fields in the same row, usually null
-
processSemanticIdDescription
Processes the second field cell containing the semantic id and the description, potentially with enums.- Parameters:
data- the cell datafield- the field to be modified as a side effect
-
removeNote
Removes a note description text ifCFG_REMOVE_NOTES.- Parameters:
data- the data to remove the text from- Returns:
dataor modifieddata
-
setFieldDescription
Sets the field description, considers in-place "isCaseOf" information and notes.- Parameters:
description- the raw descriptionfield- the target field to set the description on- See Also:
-
isValueExampleIgnore
Returns whether a value/example entry can be ignored.- Parameters:
data- the data- Returns:
truefor ignore,falseelse
-
processValueTypeExample
Processes the third field cell containing the value type and an optional example.- Parameters:
data- the cell datafield- the field to be modified as a side effect- See Also:
-
processValueTypeExampleOneLine
Processes a value type/example entry on a single line.- Parameters:
line- the linefield- the target field
-
setExampleValues
Sets the example value(s).- Parameters:
data- the data representing the example(s),may be nullmore- optional more example values, may be null for nonefield- the field to set the values on
-
pruneExamples
Prunes examples for "see section" entries.- Parameters:
data- the example data- Returns:
- the pruned data, may be null
-
retokenize
Retokenizestokensfor separatorsep, if giving checkingconditionon follow-up strings after a new token. Currently applied only iftokenslength is 1.- Parameters:
sep- the separator to look fortokens- the tokens (to be modified as a side effect)condition- optional next-token condition, may be null
-
splitMultiLanguageExample
Tries to split thetokensinto multi-language example strings. Shall be applied only if the field is a multi-language property field.- Parameters:
tokens- the tokens
-
processFieldCardinality
Processes the fourth field cell, potentially containing the field cardinality.- Parameters:
data- the cell datafield- the field to be modified as side effect
-
toCardinality
Interpretsdataas a single cardinality value.- Parameters:
data- the data to be interpreted- Returns:
- the cardinality value, -1 for "*", or the minimum integer value for none
-
storeAsCurrent
StoresnewCurrentas the current type being processed. If there was a current type before, add that to the result, i.e., the list of detected types.- Parameters:
newCurrent- the new current type(s), may be null for none
-
mapPlainTypes
Collects and maps the plain non-aspect types intoaasTypes.- Parameters:
aasTypes- the types to map- Returns:
- the idShort-type-mapping
-
readingCompleted
void readingCompleted()Notified when reading of the specification is completed.- See Also:
-
getSummary
AasSpecSummary getSummary()Returns the summary result.- Returns:
- the summary
-
getLogger
private static de.iip_ecosphere.platform.support.logging.Logger getLogger()Returns the logger of this class.- Returns:
- the logger
-