commit | 3bbf730ebce611ec563dde3712eb92bca2607b9e | [log] [tgz] |
---|---|---|
author | Randall Leeds <randall@apache.org> | Sat Aug 22 20:32:56 2020 -0700 |
committer | Randall Leeds <randall@apache.org> | Sun Aug 30 17:23:04 2020 -0700 |
tree | ca215f09e96f48cdd5a36b3659f8cfbb00bdcaef | |
parent | 0121bd274d0d1f1e92b4bc09705e10a646586cc2 [diff] |
Eliminate extraneous interfaces Make several changes to eliminate unnecessary type definitions. Remove the centrally-exported selector interfaces from the selector package and migrate them to where they are used. The selector package need not commit to the existence of any particular set of selectors. In the future, the apache-annotator package may consolidate the existing selector definitions and export them under a unified namespace. Remove the matcher interface in favor of being explicit and verbose about function types. Simplify the type signature for makeRefinable. The selector is defined as an interface, thus callers are free to pass anything that extends it, so there is no need to parametrize its type. Use the same type definition for the input and output of the selector creator. Define the DOM match functions in terms of Range and place the burden on the caller to pass a Range. Remove the unused scope functions. This change may hurt the developer experience, but that will require some experience and feedback.
Apache Annotator provides annotation enabling code for browsers, servers, and humans.
We‘re currently pre-releasing development copies of each library that makes up the sum total of Apache Annotator’s code. You can grab any of them from our npm organization.
$ # for example... $ npm install --save @annotator/dom
We use Lerna to juggle the various Apache Annotator libraries. If you‘d like to contribute, you’ll need the following:
$ yarn install
$ yarn test
$ yarn start
Once the test server has started, you can browse a local demo, and run tests in a browser by visiting http://localhost:8080/
.
Many Annotations refer to part of a resource, rather than all of it, as the Target. We call that part of the resource a Segment (of Interest). A Selector is used to describe how to determine the Segment from within the Source resource.
The W3C Web Annotation Data Model outlines a number of different selectors. See table below for full list and status.
Selector | Description | Implementation Status |
---|---|---|
Text Quote | This Selector describes a range of text, including some of the text immediately before (a prefix) and after (a suffix) it to distinguish between multiple copies of the same sequence of characters. | Yes |
CSS | CSS Selectors allow for a wide variety of well supported ways to describe the path to an element in a web page. | Yes |
Text Position | This Selector describes a range of text by recording the start and end positions of the selection in the stream. | No |
Fragment | Uses the fragment part of an IRI defined by the representation's media type. | No |
XPath | Implements an XPath based selection. | No |
Data Postion | Similar to the Text Position Selector, the Data Position Selector uses the same properties but works at the byte in bitstream level rather than the character in text level. | No |
SVG | An SvgSelector defines an area through the use of the Scalable Vector Graphics standard. | No |
Range | A Range Selector can be used to identify the beginning and the end of the selection by using other Selectors. | Yes |
Refinement | Select a part of a selection, rather than as a selection of the complete resource. |
If you have any Web Annotation Data Model JSON documents, you can validate them using the validate
script:
$ yarn validate --url https://raw.githubusercontent.com/w3c/web-annotation-tests/master/tools/samples/correct/anno1.json
With the --url
option you can pass in a URL or a local path to a JSON file.
Valid:
https://raw.githubusercontent.com/w3c/web-annotation-tests/master/tools/samples/correct/anno1.json
Invalid:
https://raw.githubusercontent.com/w3c/web-annotation-tests/master/tools/samples/incorrect/anno1.json
Apache License 2.0
Apache Rat (Release Audit Tool) is a preferred code license checking tool used by the ASF. The included .ratignore
file contains a list of files to exclude from scans.
To check for included licenses, run the following and view the output report:
java -jar ~/bin/apache-rat-0.13/apache-rat-0.13.jar -E .ratignore -d . > rat_report.txt
Apache Annotator is currently undergoing incubation at The Apache Software Foundation.
See the accompanying DISCLAIMER file for details.