Skip to content

Commit

Permalink
profile and code fix
Browse files Browse the repository at this point in the history
  • Loading branch information
kirkhess committed Mar 21, 2018
1 parent 7b508cf commit 49d5610
Show file tree
Hide file tree
Showing 14 changed files with 1,085 additions and 939 deletions.
76 changes: 66 additions & 10 deletions builds/bfe.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -572,10 +572,12 @@ bfe.define('src/bfe', ['require', 'exports', 'module', 'src/bfestore', 'src/bfel
var ampm = "a";
if (min<10)
min = "0"+min;
if (hr>12){
hr-=12;
if (hr>=12){
ampm = "p";
}
}
if (hr > 12){
hr-=12;
}
return (d.getMonth() + 1) + '-' + d.getDate() + '-' + d.getFullYear() + ' ' + hr + ':' + min + ampm;
}
},
Expand Down Expand Up @@ -606,7 +608,7 @@ bfe.define('src/bfe', ['require', 'exports', 'module', 'src/bfestore', 'src/bfel

//default
//var spoints = editorconfig.startingPoints[0].menuItems[0];
if (rowData.profile !== "profile:bf2:Load:Work"){
if (rowData.profile !== "profile:bf2:Load:Work" && rowData.profile !== "profile:bf2:IBC:Instance"){
var menuIndex = _.findIndex(_(editorconfig.startingPoints).chain().find({
menuItems: [{
useResourceTemplates: [rowData.profile]
Expand All @@ -619,11 +621,18 @@ bfe.define('src/bfe', ['require', 'exports', 'module', 'src/bfestore', 'src/bfel
useResourceTemplates: [rowData.profile]
}]
}).value().menuItems[menuIndex]
} else {
} else if (rowData.profile === "profile:bf2:Load:Work"){
var spoints = { label: "Loaded Work",
type: ["http://id.loc.gov/ontologies/bibframe/Work"],
useResourceTemplates:["profile:bf2:Load:Work"]
};
} else if (rowData.profile === "profile:bf2:IBC:Instance") {

var spoints = { label: "IBC",
type: ["http://id.loc.gov/ontologies/bibframe/Instance"],
useResourceTemplates:["profile:bf2:IBC:Instance"]
};

}

var bTypes = [];
Expand Down Expand Up @@ -760,18 +769,38 @@ bfe.define('src/bfe', ['require', 'exports', 'module', 'src/bfestore', 'src/bfel
bfestore.loadtemplates = temptemplates;
var url = $(this.parentElement).find("#bfeditor-loaduriInput").val();
editorconfig.retrieve.callback(url, bfestore, bfestore.loadtemplates, bfelog, function(loadtemplates) {
//converter uses bf:person intead of personal name
_.each(_.where(bfeditor.bfestore.store, {"p":"http://www.w3.org/1999/02/22-rdf-syntax-ns#type", "o": "http://id.loc.gov/ontologies/bibframe/Person"}), function(triple) {
triple.o = "http://www.loc.gov/mads/rdf/v1#PersonalName"
});
//converter uses bf:organization intead of corporate name
_.each(_.where(bfeditor.bfestore.store, {"p":"http://www.w3.org/1999/02/22-rdf-syntax-ns#type", "o": "http://id.loc.gov/ontologies/bibframe/Organization"}), function(triple) {
triple.o = "http://www.loc.gov/mads/rdf/v1#CorporateName"
});
//eliminate duplicate type bf:Contributor
_.each(_.where(bfeditor.bfestore.store, {"p":"http://www.w3.org/1999/02/22-rdf-syntax-ns#type", "o": "http://id.loc.gov/ontologies/bflc/PrimaryContribution"}), function(triple) {
bfeditor.bfestore.store = _.reject(bfeditor.bfestore.store, _.find(bfeditor.bfestore.store, {"s":triple.s, "p":"http://www.w3.org/1999/02/22-rdf-syntax-ns#type", "o": "http://id.loc.gov/ontologies/bibframe/Contribution"}))
});

//Text to Work
_.each(_.where(bfeditor.bfestore.store, {"p":"http://www.w3.org/1999/02/22-rdf-syntax-ns#type", "o": "http://id.loc.gov/ontologies/bibframe/Text"}), function(triple) {
bfeditor.bfestore.store = _.reject(bfeditor.bfestore.store, _.find(bfeditor.bfestore.store, {"s":triple.s, "p":"http://www.w3.org/1999/02/22-rdf-syntax-ns#type", "o": "http://id.loc.gov/ontologies/bibframe/Text"}))
});

bfestore.loadtemplates.data = bfeditor.bfestore.store;
$('[href=#create]').tab('show');
$('#bfeditor-formdiv').show();
if($('#bfeditor-messagediv').length){
$('#bfeditor-messagediv').remove();
}

//weird bnode prob
_.each(bfeditor.bfestore.store, function(el) {
if( el.o.startsWith("_:_:"))
el.o = "_:" + el.o.split("_:")[2];

});


cbLoadTemplates();
});

Expand Down Expand Up @@ -799,7 +828,7 @@ bfe.define('src/bfe', ['require', 'exports', 'module', 'src/bfestore', 'src/bfel

var spoints = { label: "Monograph",
type: ["http://id.loc.gov/ontologies/bibframe/Instance"],
useResourceTemplates:["profile:bf2:Monograph:Instance"]
useResourceTemplates:["profile:bf2:IBC:Instance"]
};

bfeditor.bfestore.store = [];
Expand Down Expand Up @@ -838,6 +867,10 @@ bfe.define('src/bfe', ['require', 'exports', 'module', 'src/bfestore', 'src/bfel
_.each(_.where(bfeditor.bfestore.store, {"p":"http://www.w3.org/1999/02/22-rdf-syntax-ns#type", "o": "http://id.loc.gov/ontologies/bibframe/Person"}), function(triple) {
triple.o = "http://www.loc.gov/mads/rdf/v1#PersonalName"
});
//converter uses bf:organization intead of corporate name
_.each(_.where(bfeditor.bfestore.store, {"p":"http://www.w3.org/1999/02/22-rdf-syntax-ns#type", "o": "http://id.loc.gov/ontologies/bibframe/Organization"}), function(triple) {
triple.o = "http://www.loc.gov/mads/rdf/v1#CorporateName"
});
//eliminate duplicate type bf:Contributor
_.each(_.where(bfeditor.bfestore.store, {"p":"http://www.w3.org/1999/02/22-rdf-syntax-ns#type", "o": "http://id.loc.gov/ontologies/bflc/PrimaryContribution"}), function(triple) {
bfeditor.bfestore.store = _.reject(bfeditor.bfestore.store, _.find(bfeditor.bfestore.store, {"s":triple.s, "p":"http://www.w3.org/1999/02/22-rdf-syntax-ns#type", "o": "http://id.loc.gov/ontologies/bibframe/Contribution"}))
Expand All @@ -853,6 +886,22 @@ bfe.define('src/bfe', ['require', 'exports', 'module', 'src/bfestore', 'src/bfel
bfeditor.bfestore.store = _.reject(bfeditor.bfestore.store, _.find(bfeditor.bfestore.store, {"p":"http://id.loc.gov/ontologies/bflc/itemOf"}));
}

_.each(_.where(bfeditor.bfestore.store, {"p": "http://id.loc.gov/ontologies/bibframe/adminMetadata"}), function(am){;
var adminTriple = {};
adminTriple.s = am.o;
adminTriple.p = "http://id.loc.gov/ontologies/bflc/profile";
adminTriple.o = bfeditor.bfestore.profile;
adminTriple.otype = "literal";
bfeditor.bfestore.store.push(adminTriple)

adminTriple = {};
adminTriple.s = am.o;
adminTriple.p = "http://id.loc.gov/ontologies/bflc/procInfo";
adminTriple.o = "ibc update";
adminTriple.otype = "literal";
bfeditor.bfestore.store.push(adminTriple)
});

// _.each(_.where(bfeditor.bfestore.store, {"p":"http://www.w3.org/1999/02/22-rdf-syntax-ns#type"}), function(triple) {
// _.each(_.where(bfeditor.bfestore.store, {"s":triple.s, "p":"http://www.w3.org/1999/02/22-rdf-syntax-ns#type"}), function (typeTriple){
// console.log(typeTriple.s + typeTriple.o);
Expand Down Expand Up @@ -3553,9 +3602,9 @@ bfe.define('src/bfestore', ['require', 'exports', 'module'], function(require, e
data = data.replace(/xmlns:ns1=/g, "xmlns:bf=");
data = data.replace(/ns1:/g, "bf:");

data = data.replace(/xmlns:ns2=/g, "xmlns:madsrdf=");
//data = data.replace(/xmlns:ns2=/g, "xmlns:madsrdf=");
data = data.replace(/ns2:/g, "madsrdf:");

data = data.replace(/xmlns:ns2=\"madsrdf:\"/g, "");
callback(data)
},
error: function(XMLHttpRequest, status, err) {
Expand Down Expand Up @@ -4155,9 +4204,16 @@ bfe.define('src/lookups/lcshared', ['require', 'exports', 'module'], function(re
for (var s = 0; s < suggestions[1].length; s++) {
var l = suggestions[1][s];
var u = suggestions[3][s];
if (suggestions.length ===5){
var i = suggestions[4][s];
var li = l + " ("+i+")";
} else {
var li = l;
}

typeahead_source.push({
uri: u,
value: l
value: li
});
}
}
Expand Down
1 change: 1 addition & 0 deletions static/js/config-dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@
"static/profiles/bibframe/BIBFRAME 2.0 Rare Materials.json",
"static/profiles/bibframe/BIBFRAME 2.0 Sound Recording: Audio CD-R.json",
"static/profiles/bibframe/BIBFRAME 2.0 Load.json",
"static/profiles/bibframe/BIBFRAME 2.0 IBC.json"
],
"startingPoints": [
{"menuGroup": "Monograph",
Expand Down
13 changes: 0 additions & 13 deletions static/profiles/bibframe/BIBFRAME 2.0 Agents.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,6 @@
"propertyLabel": "Fuller Form of Name (RDA 9.5) CORE IF ...",
"remark": "http://www.loc.gov/mads/rdf/v1#"
},
{
"mandatory": "false",
"repeatable": "true",
"type": "literal",
"resourceTemplates": [],
"valueConstraint": {
"valueTemplateRefs": [],
"useValuesFrom": [],
"valueDataType": {}
},
"propertyURI": "http://www.loc.gov/mads/rdf/v1#classification",
"propertyLabel": "Classification number"
},
{
"mandatory": "false",
"repeatable": "true",
Expand Down
2 changes: 1 addition & 1 deletion static/profiles/bibframe/BIBFRAME 2.0 Cartographic.json
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,7 @@
"resourceTemplates": [],
"valueConstraint": {
"valueTemplateRefs": [
"profile:bf2:Cartography:Item"
"profile:bf2:Cartographic:Item"
],
"useValuesFrom": [],
"valueDataType": {}
Expand Down
7 changes: 4 additions & 3 deletions static/profiles/bibframe/BIBFRAME 2.0 Form.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
{
"mandatory": "false",
"repeatable": "false",
"type": "lookup",
"type": "resource",
"resourceTemplates": [],
"valueConstraint": {
"valueTemplateRefs": [],
Expand All @@ -45,11 +45,12 @@
"dataTypeURI": "",
"remark": "http://id.loc.gov/ontologies/bibframe/GeographicCoverage"
},
"repeatable": "false"
"repeatable": "false",
"remark": "http://id.loc.gov/ontologies/bflc/target"
},
"propertyLabel": "(Geographic) Coverage of the Content (RDA 7.3)",
"remark": "http://access.rdatoolkit.org/7.3.html",
"propertyURI": "http://id.loc.gov/ontologies/bflc/target"
"propertyURI": "http://id.loc.gov/ontologies/bibframe/GeographicCoverage"
},
{
"mandatory": "false",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@
"useValuesFrom": [],
"valueDataType": {}
},
"propertyLabel": "Credits",
"propertyLabel": "Cast/Credits",
"remark": "http://access.rdatoolkit.org/2.17.3.5.html",
"propertyURI": "http://id.loc.gov/ontologies/bibframe/credits"
},
Expand Down Expand Up @@ -1280,12 +1280,12 @@
"valueDataType": {}
},
"propertyURI": "http://www.w3.org/2000/01/rdf-schema#label",
"propertyLabel": "Credits note"
"propertyLabel": "Cast/credits note"
}
],
"id": "profile:bf2:35mmFeatureFilm:Credits",
"resourceURI": "http://id.loc.gov/ontologies/bibframe/Credits",
"resourceLabel": "Credits note"
"resourceLabel": "Cast/Credits note"
},
{
"propertyTemplates": [
Expand Down Expand Up @@ -1519,7 +1519,7 @@
{
"mandatory": "false",
"repeatable": "true",
"type": "lookup",
"type": "target",
"resourceTemplates": [],
"valueConstraint": {
"valueTemplateRefs": [],
Expand All @@ -1533,7 +1533,7 @@
},
"propertyLabel": "Sound Content (RDA 7.18)",
"remark": "http://access.rdatoolkit.org/7.18.html",
"propertyURI": "http://www.w3.org/1999/02/22-rdf-syntax-ns#value"
"propertyURI": "http://id.loc.gov/ontologies/bflc/target"
},
{
"mandatory": "false",
Expand Down Expand Up @@ -1639,7 +1639,7 @@
{
"mandatory": "false",
"repeatable": "true",
"type": "lookup",
"type": "target",
"resourceTemplates": [],
"valueConstraint": {
"valueTemplateRefs": [],
Expand All @@ -1651,7 +1651,7 @@
"remark": "http://id.loc.gov/ontologies/bibframe/PlaybackChannels"
}
},
"propertyURI": "http://www.w3.org/1999/02/22-rdf-syntax-ns#value",
"propertyURI": "http://id.loc.gov/ontologies/bflc/target",
"propertyLabel": "Configuration of Playback Channels (RDA 3.16.8)",
"remark": "http://access.rdatoolkit.org/3.16.8.html"
},
Expand Down Expand Up @@ -1681,7 +1681,7 @@
{
"mandatory": "false",
"repeatable": "true",
"type": "lookup",
"type": "target",
"resourceTemplates": [],
"valueConstraint": {
"valueTemplateRefs": [],
Expand All @@ -1693,7 +1693,7 @@
"remark": "http://id.loc.gov/ontologies/bibframe/PlaybackCharacteristic"
}
},
"propertyURI": "http://www.w3.org/1999/02/22-rdf-syntax-ns#value",
"propertyURI": "http://id.loc.gov/ontologies/bflc/target",
"propertyLabel": "Special Playback Characteristic (RDA 3.16.9)",
"remark": "http://access.rdatoolkit.org/3.16.9.html"
}
Expand Down
Loading

0 comments on commit 49d5610

Please sign in to comment.