Skip to content
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

CopyData has stopped working #3368

Closed
matthias-ronge opened this issue Mar 31, 2020 · 6 comments
Closed

CopyData has stopped working #3368

matthias-ronge opened this issue Mar 31, 2020 · 6 comments
Labels

Comments

@matthias-ronge
Copy link
Collaborator

matthias-ronge commented Mar 31, 2020

The following message is displayed: UnsupportedOperationException: Dead code pending removal

Screenshot

Script: action:copyData @LegalNoteAndTermsOfUse = "FZRV1.0";

@matthias-ronge
Copy link
Collaborator Author

matthias-ronge commented Apr 1, 2020

The function is fundamentally broken. It was partially deleted. The remaining fragments are still based on the UGH replacement classes. The functionality must be fundamentally re-implemented.

@Kathrin-Huber clarifies whether functionality should be implemented again.

@matthias-ronge matthias-ronge changed the title KitodoScript has stopped working CopyData has stopped working Apr 8, 2020
@matthias-ronge
Copy link
Collaborator Author

The decision is: The functionality is still needed and should be repaired.

@matthias-ronge
Copy link
Collaborator Author

matthias-ronge commented Feb 19, 2021

Syntax (suggestion):

Command               := ( ( CopyExpression | DeleteExpression ) ';' )*

CopyExpression        := ReplacementMode? Limit? WriteMetadataSelector Operator
                         ( ReadMetadataSelector | String | VariableSelector )+ ';'?

DeleteExpression      := '-' Limit? ( '/' | DivisionPath+ ) KeyPath

ReplacementMode       := ( '+' | '?' )

Limit                 := '(' <max count> ')'

WriteMetadataSelector := ( '/' | DivisionPath+ ) KeyPath Domain?

DivisionPath          := '*'? '/' ( <division ID> | '*' ) ( '[' ( <index> | '>' | '*' ) ']' )?

KeyPath               := ( '@' <key ID> )+ ( '[' FindRx ']') ?

FindRx                := ( '@' <key ID> )* '~' '/' <regular expression> '/' 'i'?

Domain                := '$' ( "description" | "digitalProvenance" | "rights" | "technical" | "source" |
                               "mets:div" )

Operator              := '=' ( '`' <format string> '`' )?

ReadMetadataSelector  := '^'* ( '/' | DivisionPath+ | '#' <level> DivisionPath* ) KeyPath ReplaceRx?

ReplaceRx             := '~' '/' <regular expression> '/' <replacement string> '/' ( 'g' | 'i' )*

String                := '"' <string> '"'

VariableSelector      := '$' <field name>

Command: A command can consist of one or more copy and/or delete expressions. Several expressions must be separated by semicolon. The last expression may be terminated by a semicolon. There may be spaces between the commands.

Copy expression: Expression to copy metadata. There may be spaces between the arguments.

Delete expression: Expression to delete metadata.

Replacement mode: Default replacement mode (no indication) is “replace”: If the rule has results on the right hand side, delete all metadata entries on the left hand side, if any, then put the results in place. “Add” (+) will add the results on the left hand side, without deleting. “Add if empty” (?) will only add the results on the left if there is nothing that would need to be deleted, else the rule does nothing.

Limit: Without limit, all results are copied. This may be used to limit the number of results to be written. ‹max count› should be an integer ≥ 1.

Write metadata selector: Defines where to write the metadata.

Division path: Path to the <div> to which the metadata is written. If starting with a star (*), select all divisions independent of their depth in the structure map. ‹division ID› is the division’s ID, as defined in the ruleset. A star * means any. Optionally, in square brackets ([]), the (zero-based) index of the division can be given, or a right pointing angle bracket (>) to indicate the last, or a star (*) indicating all (which will mean that the copying will be done for each of them).

Key path: Path to the metadata key. ‹key ID› is the ID of the key as defined in the ruleset. May be repeated in case of grouped keys. Supports additional find regex to match only values matching the regular expression.

Find RX: Regular expression to match. May match on a sub-key in grouped keys.

Domain: Domain in which to write the new values. description if omitted.

Operator: Assignment operator. May be followed by a format string in back-ticks to give a formatting rule.

Read metadata selector: Defines where from to read the metadata. A circumflex (^) indicates reading from the parent document instead. ‹level› indicates the level of the write metadata selector to whose position to correspond. Support a string replace regular expression.

Replace RX: Regular expression to process the string data.

String: Put a literal string. Double quotes and backslashes inside the string must be escaped using backslash.

Variable selector: Put a value from the internal data object (syntax like field access in JSF).

@apiller
Copy link

apiller commented Oct 22, 2021

It would be useful to reactivate this function. Otherwise the structure isn't visible in the DFG-Viewer and the whole structuring-work is useless or has to be done twice.

@andre-hohmann
Copy link
Collaborator

It would be useful to reactivate this function. Otherwise the structure isn't visible in the DFG-Viewer and the whole structuring-work is useless or has to be done twice.

I am not sure, if this is the correct issue for this comment. The copyData-Script can be used to add/delete/overwrite values in metadata fields and does in my opinion not influence the structuring work or the display in the DFG-Viewer.

In addition, there will be other Scripts to add, copy or delete Metadata of the processes,

@Kathrin-Huber
Copy link
Contributor

This has been reimplemented

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants