Skip to content

Commit 3cf9544

Browse files
committed
v1.0.0
1 parent 1eff60e commit 3cf9544

File tree

8 files changed

+108
-223
lines changed

8 files changed

+108
-223
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ tmp
22
examples
33
node_modules
44
builds/*
5-
documentation/*
5+
docs/plato/*
66

77
*.html
88
static/js/config-*.js

Gruntfile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ module.exports = function(grunt) {
4141
},
4242
tests: {
4343
files: {
44-
'documentation/plato': ['src/**/*.js', 'static/js/config*.js']
44+
'docs/plato': ['src/**/*.js', 'static/js/config*.js']
4545
},
4646
},
4747
},

README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ Twitter's [Bootstrap] and a few additional custom CSS declarations.
2121
[demo-page]: http://bibframe.org/bibliomata/bfe/index.html
2222
[ontology]: http://id.loc.gov/ontologies/bibframe/
2323
[bfi]: http://www.loc.gov/bibframe/
24-
[profilespec]: http://bibframe.org/documentation/bibframe-profilespec/
2524

2625
Getting Started
2726
---------------
@@ -47,10 +46,8 @@ Documentation
4746
-------------
4847

4948
* [API]
50-
* [Lookups][lookups-info]
5149

5250
[API]: https://github.com/lcnetdev/bfe/blob/master/docs/bfe-api.md
53-
[lookups-info]: https://github.com/lcnetdev/bfe/blob/master/docs/bfe-lookups.md
5451

5552

5653
Demo?
@@ -187,7 +184,6 @@ Specification][profilespec].
187184
[dryice]: https://github.com/mozilla/dryice
188185
[ace]: https://github.com/ajaxorg/ace
189186
[Zepheira]: https://zepheira.com/
190-
[profilespec]: http://bibframe.org/documentation/bibframe-profilespec/
191187

192188

193189
Contributors

docs/bfe-api.md

100755100644
Lines changed: 85 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Contents
99

1010
* [`bfe`](#bfe)
1111
* [Configuring `bfe`](#configuring-bfe)
12+
* [`bfelookup`](#bfelookup)
1213
* [`bfestore`](#bfestore)
1314
* [`bfelog`](#bfelog)
1415

@@ -51,76 +52,17 @@ to load and, if invoking the "full editor," the structure of the left-side menu.
5152
Providing a `return` description is generally necessary in order to provide a
5253
callback function for when the user hits the `save` button.
5354

55+
#### `config` Properties
5456

55-
#### Example (Kitchen sink)
57+
Required
5658

57-
```javascript
58-
{
59-
"baseURI": "http://example.org/",
60-
"profiles": [
61-
"/static/profiles/bibframe/Agents.json",
62-
"/static/profiles/bibframe/Annotations.json",
63-
"/static/profiles/bibframe/Authorities.json",
64-
"/static/profiles/bibframe/Entities.json",
65-
"/static/profiles/bibframe/WIA.json",
66-
],
67-
"startingPoints": [
68-
{
69-
"menuGroup": "BIBFRAME Generic",
70-
"menuItems": [
71-
{
72-
label: "New HeldItem",
73-
useResourceTemplates: [ "profile:bf:HeldItem" ]
74-
},
75-
{
76-
label: "New Instance",
77-
useResourceTemplates: [ "profile:bf:Instance" ]
78-
},
79-
{
80-
label: "New Work",
81-
useResourceTemplates: [ "profile:bf:Work" ]
82-
},
83-
{
84-
label: "New Work, Instance, & HeldItem",
85-
useResourceTemplates: [ "profile:bf:Work", "profile:bf:Instance", "profile:bf:HeldItem" ]
86-
},
87-
]
88-
}
89-
],
90-
"lookups": {
91-
"http://id.loc.gov/authorities/names": {
92-
"name": "LCNAF",
93-
"load": "src/lookups/lcnames"
94-
},
95-
"http://id.loc.gov/authorities/subjects": {
96-
"name": "LCSH",
97-
"load": "src/lookups/lcsubjects"
98-
}
99-
},
100-
"load": [
101-
{
102-
"templateID": "profile:bf:Work",
103-
"defaulturi": "http://id.loc.gov/resources/bibs/5226",
104-
"source": {
105-
"location": "http://id.loc.gov/resources/bibs/5226.bibframe_raw.jsonp",
106-
"requestType": "jsonp"
107-
}
108-
},
109-
{
110-
"templateID": "profile:bf:Instance",
111-
"defaulturi": "_:b105resourcesbibs5226"
112-
}
113-
],
114-
"return": {
115-
"format": "jsonld-expanded",
116-
"callback": myCB
117-
}
118-
}
119-
```
59+
* `url`: (String) the url for the server, which in the example config is set to
60+
rectoBase, which by default is `http://localhost:3000`, or the value of RECTOBASE
61+
which is set in env.js by env.sh.
12062

121-
#### `config` Properties
63+
* `baseURI`: (String) the base URI to use when minting new identifiers. Defaults
64+
to `http://example.org/`.
12265

123-
Required
12466
* `profiles`: (Array) locations (URLs) of Profiles to be
12567
loaded. Profiles should be in the form of a JSON array with one or
12668
more objects that contain a "name" and a "json" property with the
@@ -150,46 +92,75 @@ Required
15092
`useResourceTemplates` expects the identifier value of a resource template (not
15193
the identifer for a Profile). If more than one resource template identifier is
15294
listed, then the multiple resource templates are combine into one form for
153-
editing. For more about the distinction see the [BIBFRAME Profile Specification][profilespec].
154-
95+
editing.
96+
```json
97+
"startingPoints": [
98+
{"menuGroup": "Monograph",
99+
"menuItems": [
100+
{
101+
label: "Instance",
102+
type: ["http://id.loc.gov/ontologies/bibframe/Instance"],
103+
useResourceTemplates: [ "profile:bf2:Monograph:Instance" ]
104+
},
105+
{
106+
label: "Work",
107+
type: ["http://id.loc.gov/ontologies/bibframe/Work"],
108+
useResourceTemplates: [ "profile:bf2:Monograph:Work" ]
109+
}
110+
111+
]}
112+
]
113+
```
155114

156115
Optional
157-
* `baseURI`: (String) the base URI to use when minting new identifiers. Defaults
158-
to `http://example.org/`.
159-
* `load`: (Array) Instructs which resource templates to automatically load into
160-
the editor. This is essential when using the "form only" editor. Each member
161-
of the `load` object contains minimally one property, `templateID`.
162-
`templateID` is the resource template identifier of the resource template to
163-
be loaded. Each resource template - each object - represents a resource.
164-
If multiple objects are specified, the resource templates will be
165-
combined and displayed as one large form, similar to identifing multiple resource
166-
template identifiers of the `useResourceTemplates` property of a menu item (see
167-
`startingPoints` above). Each object may also specify a `defaultURI` to use
168-
for the resource being loaded/edited. In order to "edit" existing data, the
169-
`source` property should be used. `source` is an object that indicates the
170-
`location` of the data to be loaded for editing and the `requestType`. `location`
171-
should be a full URL (content-negotation is not supported). `requestType` may
172-
be either 'jsonp' or 'json'. 'json' should only be used when not attempting a
173-
cross-domain request.
116+
* `basedbURI`: URI for posting triples for publication in a triplestore
117+
* `resourceURI`: Base URI for resources in the triplestore.
174118
* `logging`: (Object) with two properties. `level` indicates the level of logging
175119
desired. INFO and DEBUG are the two options. DEBUG is verbose. Default is
176120
INFO. `toConsole` is a boolean value. "True" will write the output to the
177-
Javascript console during runtime. Default is "True".
178-
* `lookups`: (Object) an object of objects. The object's key is a scheme identifier
179-
used or expected to be used with the `useValuesFrom` property constraint from
180-
a property in a property template which is part of a profile's resource template.
181-
For more about the `useValuesFrom` property, see the [Profile Specification][profilespec].
182-
Each object consists of two properties. `name` is a label/identifier for the lookup.
183-
It is used by the typeahead library. `load` is the location of the Javascript
184-
file the contains the functions required to populate the typeahead drop down
185-
selection list and then to process the selected item. You can read more about [lookups
186-
here][lookups-info].
187-
121+
Javascript console during runtime. Default is "True".
122+
* lookups: (Object) an object of objects. The object's key is a scheme identifier used or
123+
expected to be used with the useValuesFrom property constraint from a property in a
124+
property template which is part of a profile's resource template. Each object consists of
125+
two properties. name is a label/identifier for the lookup. It is used by the typeahead library.
126+
load is the location of the Javascript file the contains the functions required to populate
127+
the typeahead drop down selection list and then to process the selected item.
188128

189129
<!-- section links -->
130+
----------------
190131

191-
[profilespec]: http://bibframe.org/documentation/bibframe-profilespec/
192-
[lookups-info]: https://github.com/lcnetdev/bfe/blob/master/docs/bfe-lookups.md
132+
### `bfelookup`
133+
134+
`bfe` Lookups
135+
----------------
136+
137+
A `bfe` lookup is a Javascript function that contains logic to fetch typeahead suggestions,
138+
format those suggestions for display, and, after a suggestion is selected, a
139+
lookup performs post-selection processing and returns the data to the editor.
140+
141+
Each lookup must contain three exported objects:
142+
143+
* `scheme` - (String) representing the scheme identifier. This is used to match
144+
the lookup with the appropriate declaration in the `useValuesFrom` declaration
145+
in the profile.
146+
* `source` - (Function) expects two parameters - `query, process` - and
147+
ultimately returns a list of objects each with a `uri` property and `value`
148+
property, the latter containing the humand readable text to display.
149+
* `getResource` - (Function) expects four parameters: `subjecturi, propertyuri,
150+
selected, process`. `subjecturi` is the URI for the resource being described.
151+
`propertyuri` is the property uri of the property that invoked the lookup.
152+
`selected` is the selected item, it has two properties `uri` and `value`, about
153+
which see `source` above. Finally, `process` is the callback. At the end, `process` is called with
154+
one parameter, which is an array of triples formatted according to the [`bfestore`](#bfestore).
155+
It is not necessary to include the `guid` property for each triple; that is added
156+
after the data is returned to the editor.
157+
158+
Lookups can be created and dynamically loaded at run time. See [configuring
159+
`bfe`](#configuring-bfe). If a 'key' of a dynamically loaded lookup is the same
160+
as a pre-existing/pre-loaded lookup, the pre-loaded one is overwritten and not
161+
used.
162+
163+
<!-- section links -->
193164

194165
----------------
195166

@@ -224,21 +195,27 @@ Is the store itself. The store is an array of triples of the following form.
224195
}
225196
]
226197
```
198+
#### bfe.bfestore.jsonld2store
199+
Expects expanded jsonld, and converts the jsonld to an array of triples.
200+
201+
#### bfe.bfestore.rdfxml2store
202+
Using ajax uses `http://rdf-translator.appstpot.com` to convert rdfxml to jsonld, which used the helper function `jsonldcompascted2store` to expand the jsonld and normalize blanknodes and identifiers. Used with Load Marc in editor.
227203

228-
#### bfe.bfestore.storeDedup()
204+
#### bfe.bfestore.store2rdfxml
229205

230-
Returns the store after deduping. Nominally clears the store of duplicate triples.
231-
It is usually not necessary to call this; the store is deduped before calling the
232-
below methods.
206+
Using jsonld, converts the jsonld to nquads, which is converted to turtle by N3.js. The prefixes are set and the turtle
207+
is sent to rapper using a rest api on recto. Used in the preview pane.
233208

234-
#### bfe.bfestore.store2text()
209+
#### bfe.bfestore.n32store
235210

236-
Returns the store formatted as text. This is a throw away function designed to
237-
provide quick and dirty human-readable access to the data in the store.
211+
Using N3.js, convert n3/turtle to quads, which is passed to jsonld, expanded and pushed into the bfestore.
238212

239-
#### bfe.bfestore.store2jsonldExpanded()
213+
#### bfe.bfestore.store2turtle()
240214

241-
Returns the store as JSON object formatted according to jsonld expanded syntax.
215+
Returns the store formatted as turtle, for use in the preview pane.
216+
217+
#### bfe.bfestore.store2jsonldcompacted
218+
Returns the store formatted as compacted jsonld, for use in the preview pane.
242219

243220
----------------
244221

@@ -286,3 +263,4 @@ Returns the log as a JSON object. Sample:
286263
```
287264

288265

266+

docs/bfe-lookups.md

Lines changed: 0 additions & 39 deletions
This file was deleted.

docs/changelog.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,24 @@ Change Log
55
This change log pertains to builds.
66

77
----------------
8+
9+
* 1.0.0 (2018-10-18)
10+
* Fixes for labels
11+
* Set rectoBase using env variable; use env.sh to populate
12+
* Updated documentation
13+
14+
* 0.4.0 (2018-09-24)
15+
* Fixes for #13, #14, #15, #16, #17, #18, #19
16+
* This release is incorporated into Recto lcnetdev/recto as a submodule.
17+
* Please change the rectoBase variable in static/js/config.js and static/js/config-dev.js to your path.
18+
19+
* 0.3.1 (2018-03-26)
20+
* Minor profile and code fixes
21+
22+
* 0.3.0 (2018-03-21)
23+
* LC BIBFRAME 2.0 Pilot version
24+
* Includes BIBFRAME 2.0 Profiles
25+
826
* 0.2.0 (2015-10-20)
927
* Replace dryice with grunt
1028
* Refactor build w/o request.js (deprecated)

src/bfe.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1127,7 +1127,6 @@ bfe.define('src/bfe', ['require', 'exports', 'src/bfestore', 'src/bfelogging', '
11271127
$('#bfeditor-cancel', form.form).attr('tabindex', tabIndices++);
11281128

11291129
$('#bfeditor-preview', form.form).click(function () {
1130-
var humanized = bfeditor.bfestore.store2text();
11311130
var jsonstr = bfeditor.bfestore.store2jsonldExpanded();
11321131

11331132
// bfeditor.bfestore.store2turtle(jsonstr, humanizedPanel);
@@ -1163,7 +1162,7 @@ bfe.define('src/bfe', ['require', 'exports', 'src/bfestore', 'src/bfelogging', '
11631162
var $preview = $('<div id="bfeditor-previewPanel" class="col-md-10 main panel-group">\
11641163
<div class="panel panel-default"><div class="panel-heading">\
11651164
<h3 class="panel-title"><a role="button" data-toggle="collapse" href="#humanized">Preview</a></h3></div>\
1166-
<div class="panel-collapse collapse in" id="humanized"><div class="panel-body"><pre>' + humanized + '</pre></div></div>\
1165+
<div class="panel-collapse collapse in" id="humanized"><div class="panel-body"><pre></pre></div></div>\
11671166
<div class="panel panel-default"><div class="panel-heading"><h3 class="panel-title"><a role="button" data-toggle="collapse" href="#jsonld">JSONLD</a></h3></div>\
11681167
<div class="panel-collapse collapse in" id="jsonld"><div class="panel-body"><pre>' + JSON.stringify(jsonstr, undefined, ' ') + '</pre></div></div>\
11691168
<div class="panel panel-default"><div class="panel-heading"><h3 class="panel-title"><a role="button" data-toggle="collapse" href="#rdfxml">RDF-XML</a></h3></div>\

0 commit comments

Comments
 (0)