xproc / notes

Notes and other informal scriblings about XProc
10 stars 4 forks source link

Annotations #18

Open ndw opened 8 years ago

ndw commented 8 years ago

It would be nice to provide annotations as well.

htInEdin commented 8 years ago

Norman Walsh writes:

It would be nice to provide annotations as well.

Is that different from meta-data? I presume so, but I didn't understand it when someone mentioned annotations this morning, and I still don't :-(.

ht

   Henry S. Thompson, School of Informatics, University of Edinburgh
  10 Crichton Street, Edinburgh EH8 9AB, SCOTLAND -- (44) 131 650-4440
            Fax: (44) 131 650-4587, e-mail: ht@inf.ed.ac.uk
                   URL: http://www.ltg.ed.ac.uk/~ht/

[mail from me always has a .sig like this -- mail without it is forged spam]

xquery commented 8 years ago

this is about meta data on the step itself ... to be able to introspect ... though we could achieve the same with a concept of read only option I guess.

htInEdin commented 8 years ago

James Fuller writes:

this is about meta data on the step itself ... to be able to introspect ... though we could achieve the same with a concept of read only option I guess.

Example? Still not getting it, sorry.

ht

   Henry S. Thompson, School of Informatics, University of Edinburgh
  10 Crichton Street, Edinburgh EH8 9AB, SCOTLAND -- (44) 131 650-4440
            Fax: (44) 131 650-4587, e-mail: ht@inf.ed.ac.uk
                   URL: http://www.ltg.ed.ac.uk/~ht/

[mail from me always has a .sig like this -- mail without it is forged spam]

xquery commented 8 years ago

https://www.w3.org/TR/xquery-30/#id-annotations

annotations in XQuery are the closest analog ... with RESTXQ being a good example usage

http://exquery.github.io/exquery/exquery-restxq-specification/restxq-1.0-specification.html

ndw commented 8 years ago

It's just a form of structured metadata that can be used for the purposes of introspection. Consider this example from XQuery:

declare %foo function name() {...}

The "%foo" part is an annotation. I can, at runtime, ask what annotations does a particular function have or ask for a list of all of the functions that have a particular annotation.

These can be used directly by the processor but they can also be used by users as an extension point.

As an example of the former, consider the case where you want to define a module of XProc steps and flows. Perhaps it is convenient to modularize the code in a particular way such that there is a "flushthemanifolds" step or flow but you do not want that step or flow to be part of the module's public API. We could define an annotation, %private, that has the effect of making any step or flow so annotated invisible outside of the module. Then you could have:

step publicSomething() { ... flushthemanifolds() ... } step publicSomethingElse() { ... flushthemanifolds() ... } step %private flushthemanifolds() { .... }

Anyone importing this module can call the two public steps but cannot call the %private one.

An example of user extension would be using annotations to identify steps or flows that have particular REST semantics.

It's very handy.

htInEdin commented 8 years ago

Norman Walsh writes:

It's just a form of structured metadata that can be used for the purposes of introspection. Consider this example from XQuery:

...

Thanks, got it.

ht

   Henry S. Thompson, School of Informatics, University of Edinburgh
  10 Crichton Street, Edinburgh EH8 9AB, SCOTLAND -- (44) 131 650-4440
            Fax: (44) 131 650-4587, e-mail: ht@inf.ed.ac.uk
                   URL: http://www.ltg.ed.ac.uk/~ht/

[mail from me always has a .sig like this -- mail without it is forged spam]