annotator_store 1.0.0.pre → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +8 -20
- data/config/routes.rb +0 -1
- data/db/migrate/20141013113654_create_annotator_store.rb +8 -31
- data/lib/annotator_store/version.rb +1 -1
- metadata +18 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 43b816e26d213ee0689e56a6b43c70faac7e4b89
|
4
|
+
data.tar.gz: 33b50d049831ea7d930d46696a62fa22883967d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 61825fac6af6a847c1fda2f5607e52a4a99af8c9095bb4eb5eeaf4f4f638e11da0a9c03990ab0e4ce1cea7c4435be3233029f8a0c24eaf3ac817336763941958
|
7
|
+
data.tar.gz: 2499df60e7292ffafd03175e1acd8172b62e6c00fe5a92891355f65f665921252892402043c325cad831d1276813bb0c6ef94f4b34cc037cfe50e86c6eea68e5
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -78,22 +78,13 @@ And then from the `APP_ROOT` execute:
|
|
78
78
|
|
79
79
|
$ bundle install
|
80
80
|
|
81
|
-
Configure your database credentials in `config/database.yml` and then run the
|
82
|
-
migrations to create the tables to store the annotations.
|
83
|
-
database of choice you'll need to set the `DB` environment variable when running
|
84
|
-
the migrations. There are slight variations in the structure of the DB when
|
85
|
-
using MySQL and PostgreSQL. The default setting is PostgreSQL if not set.
|
81
|
+
Configure your database credentials in your `config/database.yml` file and then run the
|
82
|
+
migrations to create the tables to store the annotations.
|
86
83
|
|
87
84
|
# Copy migrations over from the engine
|
88
85
|
$ rake annotator_store:install:migrations
|
89
86
|
|
90
|
-
# To run the copied migration
|
91
|
-
$ DB=mysql rake db:migrate
|
92
|
-
|
93
|
-
# To run the copied migration when using PostgreSQL
|
94
|
-
$ DB=postgres rake db:migrate
|
95
|
-
|
96
|
-
# To run the copied migration without specifying type (defaults to postgres)
|
87
|
+
# To run the copied migration
|
97
88
|
$ rake db:migrate
|
98
89
|
|
99
90
|
Then mount it in `config/routes.rb`:
|
@@ -112,7 +103,7 @@ An annotation is a JSON document that contains a number of fields describing the
|
|
112
103
|
position and content of an annotation within a specified document:
|
113
104
|
|
114
105
|
{
|
115
|
-
"id":
|
106
|
+
"id": 1, # unique id (added by backend)
|
116
107
|
"annotator_schema_version": "v1.0", # schema version: default v1.0
|
117
108
|
"created": "2011-05-24T18:52:08.036814", # created datetime in iso8601 format (added by backend)
|
118
109
|
"updated": "2011-05-26T12:17:05.012544", # updated datetime in iso8601 format (added by backend)
|
@@ -129,9 +120,6 @@ position and content of an annotation within a specified document:
|
|
129
120
|
]
|
130
121
|
}
|
131
122
|
|
132
|
-
For PostgreSQL the primary key of the annotation will be a UUID while for MySQL it
|
133
|
-
will be a normal integer id.
|
134
|
-
|
135
123
|
|
136
124
|
API Endpoints
|
137
125
|
-------------
|
@@ -192,7 +180,7 @@ Returns (example):
|
|
192
180
|
|
193
181
|
$ curl http://example.com/annotator_store/annotations
|
194
182
|
{
|
195
|
-
"id":
|
183
|
+
"id": 1,
|
196
184
|
"text": "Annotation text",
|
197
185
|
...
|
198
186
|
}
|
@@ -208,7 +196,7 @@ Returns (example):
|
|
208
196
|
|
209
197
|
$ curl http://example.com/annotator_store/annotations/d41d8cd98f00b204e9800998ecf8427e
|
210
198
|
{
|
211
|
-
"id":
|
199
|
+
"id": 1,
|
212
200
|
"text": "Annotation text",
|
213
201
|
...
|
214
202
|
}
|
@@ -226,7 +214,7 @@ Returns (example):
|
|
226
214
|
|
227
215
|
$ curl http://example.com/annotator_store/annotations/d41d8cd98f00b204e9800998ecf8427e
|
228
216
|
{
|
229
|
-
"id":
|
217
|
+
"id": 1,
|
230
218
|
"text": "Annotation text",
|
231
219
|
...
|
232
220
|
}
|
@@ -261,7 +249,7 @@ Returns (example):
|
|
261
249
|
"total": 43127,
|
262
250
|
"rows": [
|
263
251
|
{
|
264
|
-
"id":
|
252
|
+
"id": 1,
|
265
253
|
"text": "Updated annotation text",
|
266
254
|
...
|
267
255
|
},
|
data/config/routes.rb
CHANGED
@@ -1,43 +1,20 @@
|
|
1
|
-
# This migration executes differently depending on the database set via the DB
|
2
|
-
# environment variable. For PostgreSQL we use UUIDs ... for MySQL we use normal
|
3
|
-
# primary keys.
|
4
1
|
class CreateAnnotatorStore < ActiveRecord::Migration
|
5
2
|
def self.up
|
6
|
-
|
7
|
-
database_type = ENV['DB'] || 'postgres'
|
8
|
-
if database_type == 'postgres'
|
9
|
-
enable_extension 'plpgsql' unless extension_enabled?('plpgsql')
|
10
|
-
enable_extension 'uuid-ossp' unless extension_enabled?('uuid-ossp')
|
11
|
-
options = { id: :uuid, default: 'uuid_generate_v4()' }
|
12
|
-
else
|
13
|
-
options = {}
|
14
|
-
end
|
15
|
-
|
16
|
-
# Table to store annotations
|
17
|
-
create_table :annotator_store_annotations, options do |t|
|
3
|
+
create_table :annotator_store_annotations do |t|
|
18
4
|
t.string :version # Schema version
|
19
5
|
t.text :text # Content of annotation
|
20
6
|
t.text :quote # The annotated text
|
21
7
|
t.string :uri # URI of annotated document
|
22
|
-
t.timestamps # Time created_at and updated_at
|
8
|
+
t.timestamps # Time created_at and updated_at for annotation
|
23
9
|
end
|
24
10
|
|
25
|
-
# Table to store ranges covered by an annotation since each annotation could
|
26
|
-
# have many ranges ... at least by design in annotator.js but not yet
|
27
|
-
# implemented. Since the associated annotation's primary could be a UUID, at
|
28
|
-
# least in the case of PostgreSQL, we'll have to apply some logic to cater
|
29
|
-
# for the different scenarios.
|
30
11
|
create_table :annotator_store_ranges do |t|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
end
|
36
|
-
t.
|
37
|
-
t.string :end # Relative XPath to end element
|
38
|
-
t.integer :start_offset # Character offset within start element
|
39
|
-
t.integer :end_offset # Character offset within end element
|
40
|
-
t.timestamps
|
12
|
+
t.references :annotation, index: true # Associated annotation's id
|
13
|
+
t.string :start # Relative XPath to start element
|
14
|
+
t.string :end # Relative XPath to end element
|
15
|
+
t.integer :start_offset # Character offset within start element
|
16
|
+
t.integer :end_offset # Character offset within end element
|
17
|
+
t.timestamps # Time created_at and updated_at for range
|
41
18
|
end
|
42
19
|
end
|
43
20
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: annotator_store
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Job King'ori Maina
|
@@ -122,6 +122,20 @@ dependencies:
|
|
122
122
|
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rubocop
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
125
139
|
- !ruby/object:Gem::Dependency
|
126
140
|
name: jbuilder
|
127
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -200,12 +214,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
200
214
|
version: 1.9.3
|
201
215
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
202
216
|
requirements:
|
203
|
-
- - "
|
217
|
+
- - ">="
|
204
218
|
- !ruby/object:Gem::Version
|
205
|
-
version:
|
219
|
+
version: '0'
|
206
220
|
requirements: []
|
207
221
|
rubyforge_project:
|
208
|
-
rubygems_version: 2.
|
222
|
+
rubygems_version: 2.4.5
|
209
223
|
signing_key:
|
210
224
|
specification_version: 4
|
211
225
|
summary: Rails engine to implement a Ruby backend store implementation for Annotator.
|