-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from gdcc/fundregror
Fundreg and ROR support - merged to make it easier to access for testing in IQSS/dataverse#9151
- Loading branch information
Showing
6 changed files
with
632 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
[ | ||
{ | ||
"field-name": "grantNumberAgency", | ||
"term-uri-field": "grantNumberAgency", | ||
"js-url": ["/cvoc/js/fundreg.js","/cvoc/js/cvocutils.js"], | ||
"protocol": "fundreg", | ||
"retrieval-uri": "https://data.crossref.org/fundingdata/funder/{0}", | ||
"allow-free-text": true, | ||
"prefix": "http://dx.doi.org/10.13039/", | ||
"managed-fields": {}, | ||
"languages":"", | ||
"vocabs": { | ||
"funders": { | ||
"uriSpace": "http://dx.doi.org/10.13039/" | ||
} | ||
}, | ||
"retrieval-filtering": { | ||
"@context": { | ||
"termName": "https://schema.org/name", | ||
"scheme": "http://www.w3.org/2004/02/skos/core#inScheme", | ||
"lang": "@language", | ||
"content": "@value" | ||
}, | ||
"scheme": { | ||
"pattern": "http://data.crossref.org/fundingdata/vocabulary" | ||
}, | ||
"termName": { | ||
"pattern": "{0}", | ||
"params": ["/altLabel/Label=*/literalForm"] | ||
}, | ||
"@type": { | ||
"pattern": "https://schema.org/Organization" | ||
} | ||
} | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
[ | ||
{ | ||
"field-name": "authorAffiliation", | ||
"term-uri-field": "authorAffiliation", | ||
"js-url": ["/cvoc/js/ror.js","/cvoc/js/cvocutils.js"], | ||
"protocol": "ror", | ||
"retrieval-uri": "https://api.ror.org/organizations/{0}", | ||
"allow-free-text": true, | ||
"prefix": "https://ror.org/", | ||
"managed-fields": {}, | ||
"languages":"", | ||
"vocabs": { | ||
"rors": { | ||
"uriSpace": "https://ror.org/" | ||
} | ||
}, | ||
"retrieval-filtering": { | ||
"@context": { | ||
"termName": "https://schema.org/name", | ||
"scheme": "http://www.w3.org/2004/02/skos/core#inScheme", | ||
"lang": "@language", | ||
"content": "@value" | ||
}, | ||
"scheme": { | ||
"pattern": "http://www.grid.ac/ontology/" | ||
}, | ||
"termName": { | ||
"pattern": "{0}", | ||
"params": ["/name"] | ||
}, | ||
"@type": { | ||
"pattern": "https://schema.org/Organization" | ||
} | ||
} | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
//Common Methods - used in more than one script | ||
|
||
// Put the text in a result that matches the term in a span with class | ||
// select2-rendered__match that can be styled (e.g. bold) | ||
function markMatch2(text, term) { | ||
// Find where the match is | ||
var match = text.toUpperCase().indexOf(term.toUpperCase()); | ||
var $result = $('<span></span>'); | ||
// If there is no match, move on | ||
if (match < 0) { | ||
return $result.text(text); | ||
} | ||
|
||
// Put in whatever text is before the match | ||
$result.text(text.substring(0, match)); | ||
|
||
// Mark the match | ||
var $match = $('<span class="select2-rendered__match"></span>'); | ||
$match.text(text.substring(match, match + term.length)); | ||
|
||
// Append the matching text | ||
$result.append($match); | ||
|
||
// Put in whatever is after the match | ||
$result.append(text.substring(match + term.length)); | ||
|
||
return $result; | ||
} | ||
|
||
function storeValue(prefix, id, value) { | ||
try { | ||
if(localStorage.getItem(prefix + id)==null) { | ||
// Store the most recent 1000 values across all scripts | ||
//ToDo: Use IndexedDB to manage storage for each script separately and avoid impacting other tools using localStorage | ||
if (localStorage.length > 1000) { | ||
localStorage.removeItem(localStorage.key(0)); | ||
} | ||
localStorage.setItem(prefix + id, value); | ||
} | ||
} catch (e) { | ||
console.log("Problem using localStorage: " + e); | ||
} | ||
} | ||
|
||
function getValue(prefix, id) { | ||
try { | ||
let altNames=''; | ||
let name = localStorage.getItem(prefix + id); | ||
if(name !== null) { | ||
let pos = name.indexOf('#'); | ||
if(pos > 0) { | ||
altNames=name.substring(pos+1).split(','); | ||
name=name.substring(0, pos); | ||
} | ||
} | ||
return {name, altNames}; | ||
} catch (e) { | ||
console.log("Problem getting value from localStorage: " + e); | ||
} | ||
} |
Oops, something went wrong.