Skip to content

Commit

Permalink
v1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
kirkhess committed Oct 18, 2018
1 parent 1eff60e commit 3cf9544
Show file tree
Hide file tree
Showing 8 changed files with 108 additions and 223 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ tmp
examples
node_modules
builds/*
documentation/*
docs/plato/*

*.html
static/js/config-*.js
Expand Down
2 changes: 1 addition & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ module.exports = function(grunt) {
},
tests: {
files: {
'documentation/plato': ['src/**/*.js', 'static/js/config*.js']
'docs/plato': ['src/**/*.js', 'static/js/config*.js']
},
},
},
Expand Down
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ Twitter's [Bootstrap] and a few additional custom CSS declarations.
[demo-page]: http://bibframe.org/bibliomata/bfe/index.html
[ontology]: http://id.loc.gov/ontologies/bibframe/
[bfi]: http://www.loc.gov/bibframe/
[profilespec]: http://bibframe.org/documentation/bibframe-profilespec/

Getting Started
---------------
Expand All @@ -47,10 +46,8 @@ Documentation
-------------

* [API]
* [Lookups][lookups-info]

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


Demo?
Expand Down Expand Up @@ -187,7 +184,6 @@ Specification][profilespec].
[dryice]: https://github.com/mozilla/dryice
[ace]: https://github.com/ajaxorg/ace
[Zepheira]: https://zepheira.com/
[profilespec]: http://bibframe.org/documentation/bibframe-profilespec/


Contributors
Expand Down
192 changes: 85 additions & 107 deletions docs/bfe-api.md
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Contents

* [`bfe`](#bfe)
* [Configuring `bfe`](#configuring-bfe)
* [`bfelookup`](#bfelookup)
* [`bfestore`](#bfestore)
* [`bfelog`](#bfelog)

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

#### `config` Properties

#### Example (Kitchen sink)
Required

```javascript
{
"baseURI": "http://example.org/",
"profiles": [
"/static/profiles/bibframe/Agents.json",
"/static/profiles/bibframe/Annotations.json",
"/static/profiles/bibframe/Authorities.json",
"/static/profiles/bibframe/Entities.json",
"/static/profiles/bibframe/WIA.json",
],
"startingPoints": [
{
"menuGroup": "BIBFRAME Generic",
"menuItems": [
{
label: "New HeldItem",
useResourceTemplates: [ "profile:bf:HeldItem" ]
},
{
label: "New Instance",
useResourceTemplates: [ "profile:bf:Instance" ]
},
{
label: "New Work",
useResourceTemplates: [ "profile:bf:Work" ]
},
{
label: "New Work, Instance, & HeldItem",
useResourceTemplates: [ "profile:bf:Work", "profile:bf:Instance", "profile:bf:HeldItem" ]
},
]
}
],
"lookups": {
"http://id.loc.gov/authorities/names": {
"name": "LCNAF",
"load": "src/lookups/lcnames"
},
"http://id.loc.gov/authorities/subjects": {
"name": "LCSH",
"load": "src/lookups/lcsubjects"
}
},
"load": [
{
"templateID": "profile:bf:Work",
"defaulturi": "http://id.loc.gov/resources/bibs/5226",
"source": {
"location": "http://id.loc.gov/resources/bibs/5226.bibframe_raw.jsonp",
"requestType": "jsonp"
}
},
{
"templateID": "profile:bf:Instance",
"defaulturi": "_:b105resourcesbibs5226"
}
],
"return": {
"format": "jsonld-expanded",
"callback": myCB
}
}
```
* `url`: (String) the url for the server, which in the example config is set to
rectoBase, which by default is `http://localhost:3000`, or the value of RECTOBASE
which is set in env.js by env.sh.

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

Required
* `profiles`: (Array) locations (URLs) of Profiles to be
loaded. Profiles should be in the form of a JSON array with one or
more objects that contain a "name" and a "json" property with the
Expand Down Expand Up @@ -150,46 +92,75 @@ Required
`useResourceTemplates` expects the identifier value of a resource template (not
the identifer for a Profile). If more than one resource template identifier is
listed, then the multiple resource templates are combine into one form for
editing. For more about the distinction see the [BIBFRAME Profile Specification][profilespec].

editing.
```json
"startingPoints": [
{"menuGroup": "Monograph",
"menuItems": [
{
label: "Instance",
type: ["http://id.loc.gov/ontologies/bibframe/Instance"],
useResourceTemplates: [ "profile:bf2:Monograph:Instance" ]
},
{
label: "Work",
type: ["http://id.loc.gov/ontologies/bibframe/Work"],
useResourceTemplates: [ "profile:bf2:Monograph:Work" ]
}

]}
]
```

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

Javascript console during runtime. Default is "True".
* lookups: (Object) an object of objects. The object's key is a scheme identifier used or
expected to be used with the useValuesFrom property constraint from a property in a
property template which is part of a profile's resource template. Each object consists of
two properties. name is a label/identifier for the lookup. It is used by the typeahead library.
load is the location of the Javascript file the contains the functions required to populate
the typeahead drop down selection list and then to process the selected item.

<!-- section links -->
----------------

[profilespec]: http://bibframe.org/documentation/bibframe-profilespec/
[lookups-info]: https://github.com/lcnetdev/bfe/blob/master/docs/bfe-lookups.md
### `bfelookup`

`bfe` Lookups
----------------

A `bfe` lookup is a Javascript function that contains logic to fetch typeahead suggestions,
format those suggestions for display, and, after a suggestion is selected, a
lookup performs post-selection processing and returns the data to the editor.

Each lookup must contain three exported objects:

* `scheme` - (String) representing the scheme identifier. This is used to match
the lookup with the appropriate declaration in the `useValuesFrom` declaration
in the profile.
* `source` - (Function) expects two parameters - `query, process` - and
ultimately returns a list of objects each with a `uri` property and `value`
property, the latter containing the humand readable text to display.
* `getResource` - (Function) expects four parameters: `subjecturi, propertyuri,
selected, process`. `subjecturi` is the URI for the resource being described.
`propertyuri` is the property uri of the property that invoked the lookup.
`selected` is the selected item, it has two properties `uri` and `value`, about
which see `source` above. Finally, `process` is the callback. At the end, `process` is called with
one parameter, which is an array of triples formatted according to the [`bfestore`](#bfestore).
It is not necessary to include the `guid` property for each triple; that is added
after the data is returned to the editor.

Lookups can be created and dynamically loaded at run time. See [configuring
`bfe`](#configuring-bfe). If a 'key' of a dynamically loaded lookup is the same
as a pre-existing/pre-loaded lookup, the pre-loaded one is overwritten and not
used.

<!-- section links -->

----------------

Expand Down Expand Up @@ -224,21 +195,27 @@ Is the store itself. The store is an array of triples of the following form.
}
]
```
#### bfe.bfestore.jsonld2store
Expects expanded jsonld, and converts the jsonld to an array of triples.

#### bfe.bfestore.rdfxml2store
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.

#### bfe.bfestore.storeDedup()
#### bfe.bfestore.store2rdfxml

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

#### bfe.bfestore.store2text()
#### bfe.bfestore.n32store

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

#### bfe.bfestore.store2jsonldExpanded()
#### bfe.bfestore.store2turtle()

Returns the store as JSON object formatted according to jsonld expanded syntax.
Returns the store formatted as turtle, for use in the preview pane.

#### bfe.bfestore.store2jsonldcompacted
Returns the store formatted as compacted jsonld, for use in the preview pane.

----------------

Expand Down Expand Up @@ -286,3 +263,4 @@ Returns the log as a JSON object. Sample:
```



39 changes: 0 additions & 39 deletions docs/bfe-lookups.md

This file was deleted.

18 changes: 18 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,24 @@ Change Log
This change log pertains to builds.

----------------

* 1.0.0 (2018-10-18)
* Fixes for labels
* Set rectoBase using env variable; use env.sh to populate
* Updated documentation

* 0.4.0 (2018-09-24)
* Fixes for #13, #14, #15, #16, #17, #18, #19
* This release is incorporated into Recto lcnetdev/recto as a submodule.
* Please change the rectoBase variable in static/js/config.js and static/js/config-dev.js to your path.

* 0.3.1 (2018-03-26)
* Minor profile and code fixes

* 0.3.0 (2018-03-21)
* LC BIBFRAME 2.0 Pilot version
* Includes BIBFRAME 2.0 Profiles

* 0.2.0 (2015-10-20)
* Replace dryice with grunt
* Refactor build w/o request.js (deprecated)
Expand Down
3 changes: 1 addition & 2 deletions src/bfe.js
Original file line number Diff line number Diff line change
Expand Up @@ -1127,7 +1127,6 @@ bfe.define('src/bfe', ['require', 'exports', 'src/bfestore', 'src/bfelogging', '
$('#bfeditor-cancel', form.form).attr('tabindex', tabIndices++);

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

// bfeditor.bfestore.store2turtle(jsonstr, humanizedPanel);
Expand Down Expand Up @@ -1163,7 +1162,7 @@ bfe.define('src/bfe', ['require', 'exports', 'src/bfestore', 'src/bfelogging', '
var $preview = $('<div id="bfeditor-previewPanel" class="col-md-10 main panel-group">\
<div class="panel panel-default"><div class="panel-heading">\
<h3 class="panel-title"><a role="button" data-toggle="collapse" href="#humanized">Preview</a></h3></div>\
<div class="panel-collapse collapse in" id="humanized"><div class="panel-body"><pre>' + humanized + '</pre></div></div>\
<div class="panel-collapse collapse in" id="humanized"><div class="panel-body"><pre></pre></div></div>\
<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>\
<div class="panel-collapse collapse in" id="jsonld"><div class="panel-body"><pre>' + JSON.stringify(jsonstr, undefined, ' ') + '</pre></div></div>\
<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>\
Expand Down
Loading

0 comments on commit 3cf9544

Please sign in to comment.