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

Annotate non-relevant data when saving #3065

Closed
ebruchez opened this Issue Jan 9, 2017 · 10 comments

Comments

Projects
1 participant
@ebruchez
Collaborator

ebruchez commented Jan 9, 2017

The use case is to provide the ability to retrieve data from the database and prune non-relevant data.

Additionally (maybe as a separate RFE), pruning could then applied to the data by the REST API by providing a URL parameter.

+1 from customer

@ebruchez

This comment has been minimized.

Show comment
Hide comment
@ebruchez

ebruchez Jan 9, 2017

Collaborator

Maybe we could add an option at the xf:submission level (see also #1179) to support adding an annotation (maybe with a custom-defined attribute) like fr:relevant="false" on elements. Say with xxf:annotate-relevant="fr:relevant".

We would need to document that:

  • this only applies to elements
  • this only applies to newly-saved data

You could consider an option to update existing data in the database, but this is not entirely obvious, as relevance data can depend from user identity and permissions (for example, a section showing only to a manager).

Collaborator

ebruchez commented Jan 9, 2017

Maybe we could add an option at the xf:submission level (see also #1179) to support adding an annotation (maybe with a custom-defined attribute) like fr:relevant="false" on elements. Say with xxf:annotate-relevant="fr:relevant".

We would need to document that:

  • this only applies to elements
  • this only applies to newly-saved data

You could consider an option to update existing data in the database, but this is not entirely obvious, as relevance data can depend from user identity and permissions (for example, a section showing only to a manager).

@ebruchez ebruchez self-assigned this Jan 31, 2017

@ebruchez ebruchez added this to the 2017.1 milestone Jan 31, 2017

@ebruchez

This comment has been minimized.

Show comment
Hide comment
@ebruchez

ebruchez Feb 15, 2017

Collaborator

Is there a use case for other annotations? Like readonly, calculated, required? What about valid?

Collaborator

ebruchez commented Feb 15, 2017

Is there a use case for other annotations? Like readonly, calculated, required? What about valid?

@ebruchez

This comment has been minimized.

Show comment
Hide comment
@ebruchez

ebruchez Feb 15, 2017

Collaborator

The annotation must annotate the ancestor closest from the root. say a section is non-relevant, I would like to see:

<my-section fr:relevant="false">
  <my-grid>
     ...

And I don't want to see further fr:relevant="false" within the <my-section> element.

Collaborator

ebruchez commented Feb 15, 2017

The annotation must annotate the ancestor closest from the root. say a section is non-relevant, I would like to see:

<my-section fr:relevant="false">
  <my-grid>
     ...

And I don't want to see further fr:relevant="false" within the <my-section> element.

@ebruchez

This comment has been minimized.

Show comment
Hide comment
@ebruchez

ebruchez Feb 16, 2017

Collaborator

We already have this:

xxf:annotate="error warning info"

Could we extend this to:

xxf:annotate="error warning info relevant"

Tokens can be combined, of course.

This would yield:

<my-section xxf:relevant="false">

It is probably acceptable to use the xxf namespace. We could add an option to specify another namespace, such as:

xxf:annotate-namespace="fr"
Collaborator

ebruchez commented Feb 16, 2017

We already have this:

xxf:annotate="error warning info"

Could we extend this to:

xxf:annotate="error warning info relevant"

Tokens can be combined, of course.

This would yield:

<my-section xxf:relevant="false">

It is probably acceptable to use the xxf namespace. We could add an option to specify another namespace, such as:

xxf:annotate-namespace="fr"
@ebruchez

This comment has been minimized.

Show comment
Hide comment
@ebruchez

ebruchez Feb 16, 2017

Collaborator
  • implement XForms support
  • implement Form Runner support
    • annotate by default when saving
    • de-annotate when reading
    • option to annotate with send
      • we have prune="true|false", and we should switch to relevant="keep|prune|blank" nonrelevant="keep|remove|empty"
  • consider whether xxf:relevant is ok or whether we want fr:relevant instead
  • persistence proxy
    • reading data, by default raw, support at least prune remove in addition
  • switch to using nonrelevant as send and proxy parameter names (if positive feedback from XForms 2.0 WG on #1179)
  • test
  • doc
    • xxf:annotate="relevant=fr:relevant", defaults to xxf:relevant in XForms
      • mention that this also remove any fr:relevant attributes in the document
    • xxf:annotate="error warning info" (doesn't seem to be documented)
    • send: relevant="keep|prune|blank" nonrelevant="keep|remove|empty", deprecate prune="true|false"
    • persistence API parameters
Collaborator

ebruchez commented Feb 16, 2017

  • implement XForms support
  • implement Form Runner support
    • annotate by default when saving
    • de-annotate when reading
    • option to annotate with send
      • we have prune="true|false", and we should switch to relevant="keep|prune|blank" nonrelevant="keep|remove|empty"
  • consider whether xxf:relevant is ok or whether we want fr:relevant instead
  • persistence proxy
    • reading data, by default raw, support at least prune remove in addition
  • switch to using nonrelevant as send and proxy parameter names (if positive feedback from XForms 2.0 WG on #1179)
  • test
  • doc
    • xxf:annotate="relevant=fr:relevant", defaults to xxf:relevant in XForms
      • mention that this also remove any fr:relevant attributes in the document
    • xxf:annotate="error warning info" (doesn't seem to be documented)
    • send: relevant="keep|prune|blank" nonrelevant="keep|remove|empty", deprecate prune="true|false"
    • persistence API parameters

@ebruchez ebruchez added the XForms label Feb 16, 2017

@ebruchez

This comment has been minimized.

Show comment
Hide comment
@ebruchez

ebruchez Feb 17, 2017

Collaborator

For reading, the persistence proxy should ideally do the work.

What about a URL parameter:

relevant=prune|blank|keep|raw
  • prune: prune non-relevant elements
  • blank:
    • remove xxf:relevant attributes
    • blank non-relevant elements
  • keep:
    • remove xxf:relevant attributes
    • keep non-relevant elements
  • raw: return XML as is is stored in the database

Maybe non-relevant data should be blanked in the first place, in which case we wouldn't need the blank option (see #1179).

Collaborator

ebruchez commented Feb 17, 2017

For reading, the persistence proxy should ideally do the work.

What about a URL parameter:

relevant=prune|blank|keep|raw
  • prune: prune non-relevant elements
  • blank:
    • remove xxf:relevant attributes
    • blank non-relevant elements
  • keep:
    • remove xxf:relevant attributes
    • keep non-relevant elements
  • raw: return XML as is is stored in the database

Maybe non-relevant data should be blanked in the first place, in which case we wouldn't need the blank option (see #1179).

@ebruchez

This comment has been minimized.

Show comment
Hide comment
@ebruchez

ebruchez Feb 17, 2017

Collaborator

If the persistence proxy removes the attributes by default, then it must parse, stream, remove the attributes, and serialize the XML. Do we want to do this?

  • Alternatively, fr-persistence-model could remove the attributes after loading.
  • Also, the submission should filter all xxf:relevant attributes when xxf:annotate="relevant" is present.
Collaborator

ebruchez commented Feb 17, 2017

If the persistence proxy removes the attributes by default, then it must parse, stream, remove the attributes, and serialize the XML. Do we want to do this?

  • Alternatively, fr-persistence-model could remove the attributes after loading.
  • Also, the submission should filter all xxf:relevant attributes when xxf:annotate="relevant" is present.
@ebruchez

This comment has been minimized.

Show comment
Hide comment
@ebruchez

ebruchez Mar 16, 2017

Collaborator

For the name of the attribute, we could enhance the syntax of xxf:annotate:

xxf:annotate="id relevant=fr:relevant"

To customize everything, you might need:

  • whether to add the attribute when relevant and/or non-relevant
  • name of attribute
  • value of the attribute for relevant/non-relevant

But I don't think we need to customize all that at this point:

  • relevant is inherited and being non-relevant takes over, so placing the attribute on outermost non-relevant elements only is good enough
  • false as value is reasonable
Collaborator

ebruchez commented Mar 16, 2017

For the name of the attribute, we could enhance the syntax of xxf:annotate:

xxf:annotate="id relevant=fr:relevant"

To customize everything, you might need:

  • whether to add the attribute when relevant and/or non-relevant
  • name of attribute
  • value of the attribute for relevant/non-relevant

But I don't think we need to customize all that at this point:

  • relevant is inherited and being non-relevant takes over, so placing the attribute on outermost non-relevant elements only is good enough
  • false as value is reasonable

ebruchez added a commit that referenced this issue Mar 17, 2017

ebruchez added a commit that referenced this issue Mar 17, 2017

Implement #1179 and #3065
- XForms
  - `xxf:annotate="relevant"`
  - `xxf:annotate="token=qname"`
  - `relevant="keep|blank|prune"`
  - update XForms XML Schema
- Form Runner
  - `save` defaults to `annotate="relevant"`
  - remove `fr:relevant` attributes upon reading
  - `send` deprecates `prune` and uses `relevant`
  - persistence proxy
    - support `relevant=prune` on data GET
  - `relevant="false"` → `relevant="keep"`

ebruchez added a commit that referenced this issue Mar 17, 2017

@ebruchez

This comment has been minimized.

Show comment
Hide comment
@ebruchez

ebruchez Mar 24, 2017

Collaborator

RESOLUTION: Switch to using nonrelevant as send and proxy parameter names.

Collaborator

ebruchez commented Mar 24, 2017

RESOLUTION: Switch to using nonrelevant as send and proxy parameter names.

@ebruchez ebruchez added this to Needs Doc in Orbeon Forms 2017.1 Apr 27, 2017

ebruchez added a commit that referenced this issue Apr 28, 2017

Fix #3172 following #1179 and #3065
- fix use of prune vs. relevant
- also support pruned node in submission without error
@ebruchez

This comment has been minimized.

Show comment
Hide comment
Collaborator

ebruchez commented May 15, 2017

@ebruchez ebruchez closed this May 15, 2017

@ebruchez ebruchez moved this from Missing Doc to Done in Orbeon Forms 2017.1 May 15, 2017

@ebruchez ebruchez removed the Missing Doc label May 25, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment