@@ -572,10 +572,12 @@ bfe.define('src/bfe', ['require', 'exports', 'module', 'src/bfestore', 'src/bfel
572572 var ampm = "a" ;
573573 if ( min < 10 )
574574 min = "0" + min ;
575- if ( hr > 12 ) {
576- hr -= 12 ;
575+ if ( hr >= 12 ) {
577576 ampm = "p" ;
578- }
577+ }
578+ if ( hr > 12 ) {
579+ hr -= 12 ;
580+ }
579581 return ( d . getMonth ( ) + 1 ) + '-' + d . getDate ( ) + '-' + d . getFullYear ( ) + ' ' + hr + ':' + min + ampm ;
580582 }
581583 } ,
@@ -606,7 +608,7 @@ bfe.define('src/bfe', ['require', 'exports', 'module', 'src/bfestore', 'src/bfel
606608
607609 //default
608610 //var spoints = editorconfig.startingPoints[0].menuItems[0];
609- if ( rowData . profile !== "profile:bf2:Load:Work" ) {
611+ if ( rowData . profile !== "profile:bf2:Load:Work" && rowData . profile !== "profile:bf2:IBC:Instance" ) {
610612 var menuIndex = _ . findIndex ( _ ( editorconfig . startingPoints ) . chain ( ) . find ( {
611613 menuItems : [ {
612614 useResourceTemplates : [ rowData . profile ]
@@ -619,11 +621,18 @@ bfe.define('src/bfe', ['require', 'exports', 'module', 'src/bfestore', 'src/bfel
619621 useResourceTemplates : [ rowData . profile ]
620622 } ]
621623 } ) . value ( ) . menuItems [ menuIndex ]
622- } else {
624+ } else if ( rowData . profile === "profile:bf2:Load:Work" ) {
623625 var spoints = { label : "Loaded Work" ,
624626 type : [ "http://id.loc.gov/ontologies/bibframe/Work" ] ,
625627 useResourceTemplates :[ "profile:bf2:Load:Work" ]
626628 } ;
629+ } else if ( rowData . profile === "profile:bf2:IBC:Instance" ) {
630+
631+ var spoints = { label : "IBC" ,
632+ type : [ "http://id.loc.gov/ontologies/bibframe/Instance" ] ,
633+ useResourceTemplates :[ "profile:bf2:IBC:Instance" ]
634+ } ;
635+
627636 }
628637
629638 var bTypes = [ ] ;
@@ -760,18 +769,38 @@ bfe.define('src/bfe', ['require', 'exports', 'module', 'src/bfestore', 'src/bfel
760769 bfestore . loadtemplates = temptemplates ;
761770 var url = $ ( this . parentElement ) . find ( "#bfeditor-loaduriInput" ) . val ( ) ;
762771 editorconfig . retrieve . callback ( url , bfestore , bfestore . loadtemplates , bfelog , function ( loadtemplates ) {
772+ //converter uses bf:person intead of personal name
773+ _ . 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 ) {
774+ triple . o = "http://www.loc.gov/mads/rdf/v1#PersonalName"
775+ } ) ;
776+ //converter uses bf:organization intead of corporate name
777+ _ . 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 ) {
778+ triple . o = "http://www.loc.gov/mads/rdf/v1#CorporateName"
779+ } ) ;
780+ //eliminate duplicate type bf:Contributor
781+ _ . 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 ) {
782+ 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" } ) )
783+ } ) ;
784+
785+ //Text to Work
786+ _ . 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 ) {
787+ 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" } ) )
788+ } ) ;
789+
763790 bfestore . loadtemplates . data = bfeditor . bfestore . store ;
764791 $ ( '[href=#create]' ) . tab ( 'show' ) ;
765792 $ ( '#bfeditor-formdiv' ) . show ( ) ;
766793 if ( $ ( '#bfeditor-messagediv' ) . length ) {
767794 $ ( '#bfeditor-messagediv' ) . remove ( ) ;
768795 }
769796
797+ //weird bnode prob
770798 _ . each ( bfeditor . bfestore . store , function ( el ) {
771799 if ( el . o . startsWith ( "_:_:" ) )
772800 el . o = "_:" + el . o . split ( "_:" ) [ 2 ] ;
773-
774801 } ) ;
802+
803+
775804 cbLoadTemplates ( ) ;
776805 } ) ;
777806
@@ -799,7 +828,7 @@ bfe.define('src/bfe', ['require', 'exports', 'module', 'src/bfestore', 'src/bfel
799828
800829 var spoints = { label : "Monograph" ,
801830 type : [ "http://id.loc.gov/ontologies/bibframe/Instance" ] ,
802- useResourceTemplates :[ "profile:bf2:Monograph :Instance" ]
831+ useResourceTemplates :[ "profile:bf2:IBC :Instance" ]
803832 } ;
804833
805834 bfeditor . bfestore . store = [ ] ;
@@ -838,6 +867,10 @@ bfe.define('src/bfe', ['require', 'exports', 'module', 'src/bfestore', 'src/bfel
838867 _ . 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 ) {
839868 triple . o = "http://www.loc.gov/mads/rdf/v1#PersonalName"
840869 } ) ;
870+ //converter uses bf:organization intead of corporate name
871+ _ . 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 ) {
872+ triple . o = "http://www.loc.gov/mads/rdf/v1#CorporateName"
873+ } ) ;
841874 //eliminate duplicate type bf:Contributor
842875 _ . 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 ) {
843876 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" } ) )
@@ -853,6 +886,22 @@ bfe.define('src/bfe', ['require', 'exports', 'module', 'src/bfestore', 'src/bfel
853886 bfeditor . bfestore . store = _ . reject ( bfeditor . bfestore . store , _ . find ( bfeditor . bfestore . store , { "p" :"http://id.loc.gov/ontologies/bflc/itemOf" } ) ) ;
854887 }
855888
889+ _ . each ( _ . where ( bfeditor . bfestore . store , { "p" : "http://id.loc.gov/ontologies/bibframe/adminMetadata" } ) , function ( am ) { ;
890+ var adminTriple = { } ;
891+ adminTriple . s = am . o ;
892+ adminTriple . p = "http://id.loc.gov/ontologies/bflc/profile" ;
893+ adminTriple . o = bfeditor . bfestore . profile ;
894+ adminTriple . otype = "literal" ;
895+ bfeditor . bfestore . store . push ( adminTriple )
896+
897+ adminTriple = { } ;
898+ adminTriple . s = am . o ;
899+ adminTriple . p = "http://id.loc.gov/ontologies/bflc/procInfo" ;
900+ adminTriple . o = "ibc update" ;
901+ adminTriple . otype = "literal" ;
902+ bfeditor . bfestore . store . push ( adminTriple )
903+ } ) ;
904+
856905// _.each(_.where(bfeditor.bfestore.store, {"p":"http://www.w3.org/1999/02/22-rdf-syntax-ns#type"}), function(triple) {
857906// _.each(_.where(bfeditor.bfestore.store, {"s":triple.s, "p":"http://www.w3.org/1999/02/22-rdf-syntax-ns#type"}), function (typeTriple){
858907// console.log(typeTriple.s + typeTriple.o);
@@ -3553,9 +3602,9 @@ bfe.define('src/bfestore', ['require', 'exports', 'module'], function(require, e
35533602 data = data . replace ( / x m l n s : n s 1 = / g, "xmlns:bf=" ) ;
35543603 data = data . replace ( / n s 1 : / g, "bf:" ) ;
35553604
3556- data = data . replace ( / x m l n s : n s 2 = / g, "xmlns:madsrdf=" ) ;
3605+ // data = data.replace(/xmlns:ns2=/g, "xmlns:madsrdf=");
35573606 data = data . replace ( / n s 2 : / g, "madsrdf:" ) ;
3558-
3607+ data = data . replace ( / x m l n s : n s 2 = \" m a d s r d f : \" / g , "" ) ;
35593608 callback ( data )
35603609 } ,
35613610 error : function ( XMLHttpRequest , status , err ) {
@@ -4155,9 +4204,16 @@ bfe.define('src/lookups/lcshared', ['require', 'exports', 'module'], function(re
41554204 for ( var s = 0 ; s < suggestions [ 1 ] . length ; s ++ ) {
41564205 var l = suggestions [ 1 ] [ s ] ;
41574206 var u = suggestions [ 3 ] [ s ] ;
4207+ if ( suggestions . length === 5 ) {
4208+ var i = suggestions [ 4 ] [ s ] ;
4209+ var li = l + " (" + i + ")" ;
4210+ } else {
4211+ var li = l ;
4212+ }
4213+
41584214 typeahead_source . push ( {
41594215 uri : u ,
4160- value : l
4216+ value : li
41614217 } ) ;
41624218 }
41634219 }
0 commit comments