Skip to content

Instantly share code, notes, and snippets.

@kefo
Created May 2, 2014 19:41
Show Gist options
  • Save kefo/21dfaa1e73c610eaddab to your computer and use it in GitHub Desktop.
Save kefo/21dfaa1e73c610eaddab to your computer and use it in GitHub Desktop.
DC in BFE
<!DOCTYPE html>
<html>
<head>
<title>BF Editor: Dublin Core Example</title>
<script type="text/javascript" src="http://bibframe.org/static/bfe/builds/bfe.min.js"></script>
<link rel="stylesheet" href="http://bibframe.org//static/bfe/builds/bfe.min.css" />
<script type="text/javascript">
function myCB(jsonld) {
var humanized = bfeditor.bfestore.store2text();
document.body.scrollTop = document.documentElement.scrollTop = 0;
document.getElementById("bfeditor").innerHTML = '<div class="row"><div class="col-md-12 text-right"><a href="dc.html"><button type="button" class="btn btn-default btn-lg">Start Over</button></a></div></div><h1>Simple HTML View</h1><pre>' + humanized + '</pre><br /><h1>JSONLD-Expanded</h1><pre>' + JSON.stringify(jsonld, undefined, " ") + '</pre>';
}
var config = {
"baseURI": "http://example.org/",
"profiles": [
"dc.json"
],
"startingPoints": [
{
"menuGroup": "Dublin Core",
"menuItems": [
{
label: "Simple, all literals",
useResourceTemplates: [ "profile:dc:simple1" ]
},
{
label: "Simple, uses lookups",
useResourceTemplates: [ "profile:dc:simple2" ]
}
]
}
],
"return": {
"format": "jsonld-expanded",
"callback": myCB
}
}
</script>
</head>
<body>
<div class="container">
<div id="bfeditor" />
</div>
<script type="text/javascript">
var bfeditor = bfe.fulleditor(config, "bfeditor");
</script>
</body>
</html>
{
"Profile": {
"id": "profile:dc:simple",
"title": "DC Simple Profile",
"description": "Contains two resource templates. One assumes literals; the other uses built-in lookups, which are BIBFRAME specific.",
"resourceTemplates": [
{
"resourceURI": "http://www.w3.org/2000/01/rdf-schema#Resource",
"id": "profile:dc:simple1",
"resourceLabel": "Resource",
"propertyTemplates": [
{
"propertyURI": "http://purl.org/dc/elements/1.1/title",
"propertyLabel": "Title",
"type": "literal"
},
{
"propertyURI": "http://purl.org/dc/elements/1.1/creator",
"propertyLabel": "Creator",
"type": "literal"
},
{
"propertyURI": "http://purl.org/dc/elements/1.1/subject",
"propertyLabel": "Subject",
"type": "literal"
},
{
"propertyURI": "http://purl.org/dc/elements/1.1/description",
"propertyLabel": "Description",
"type": "literal"
},
{
"propertyURI": "http://purl.org/dc/elements/1.1/publisher",
"propertyLabel": "Publisher",
"type": "literal"
},
{
"propertyURI": "http://purl.org/dc/elements/1.1/contributor",
"propertyLabel": "Contributor",
"type": "literal"
},
{
"propertyURI": "http://purl.org/dc/elements/1.1/date",
"propertyLabel": "Date",
"type": "literal"
},
{
"propertyURI": "http://purl.org/dc/elements/1.1/type",
"propertyLabel": "Type",
"type": "literal"
},
{
"propertyURI": "http://purl.org/dc/elements/1.1/format",
"propertyLabel": "Format",
"type": "literal"
},
{
"propertyURI": "http://purl.org/dc/elements/1.1/identifier",
"propertyLabel": "Identifier",
"type": "literal"
},
{
"propertyURI": "http://purl.org/dc/elements/1.1/source",
"propertyLabel": "Source",
"type": "literal"
},
{
"propertyURI": "http://purl.org/dc/elements/1.1/language",
"propertyLabel": "Language",
"type": "literal"
},
{
"propertyURI": "http://purl.org/dc/elements/1.1/relation",
"propertyLabel": "Relation",
"type": "literal"
},
{
"propertyURI": "http://purl.org/dc/elements/1.1/coverage",
"propertyLabel": "Coverage",
"type": "literal"
},
{
"propertyURI": "http://purl.org/dc/elements/1.1/rights",
"propertyLabel": "Rights",
"type": "literal"
}
]
},
{
"resourceURI": "http://www.w3.org/2000/01/rdf-schema#Resource",
"id": "profile:dc:simple2",
"resourceLabel": "Resource",
"propertyTemplates": [
{
"propertyURI": "http://purl.org/dc/elements/1.1/title",
"propertyLabel": "Title",
"type": "literal"
},
{
"propertyURI": "http://purl.org/dc/elements/1.1/creator",
"propertyLabel": "Creator",
"type": "resource",
"valueConstraint": {
"useValuesFrom": [
"http://id.loc.gov/authorities/names"
]
}
},
{
"propertyURI": "http://purl.org/dc/elements/1.1/subject",
"propertyLabel": "Subject",
"type": "resource",
"valueConstraint": {
"useValuesFrom": [
"http://id.loc.gov/authorities/subjects"
]
}
},
{
"propertyURI": "http://purl.org/dc/elements/1.1/description",
"propertyLabel": "Description",
"type": "literal"
},
{
"propertyURI": "http://purl.org/dc/elements/1.1/publisher",
"propertyLabel": "Publisher",
"type": "literal"
},
{
"propertyURI": "http://purl.org/dc/elements/1.1/contributor",
"propertyLabel": "Contributor",
"type": "resource",
"valueConstraint": {
"useValuesFrom": [
"http://id.loc.gov/authorities/names"
]
}
},
{
"propertyURI": "http://purl.org/dc/elements/1.1/date",
"propertyLabel": "Date",
"type": "literal"
},
{
"propertyURI": "http://purl.org/dc/elements/1.1/type",
"propertyLabel": "Type",
"type": "literal"
},
{
"propertyURI": "http://purl.org/dc/elements/1.1/format",
"propertyLabel": "Format",
"type": "literal"
},
{
"propertyURI": "http://purl.org/dc/elements/1.1/identifier",
"propertyLabel": "Identifier",
"type": "literal"
},
{
"propertyURI": "http://purl.org/dc/elements/1.1/source",
"propertyLabel": "Source",
"type": "literal"
},
{
"propertyURI": "http://purl.org/dc/elements/1.1/language",
"propertyLabel": "Language",
"type": "resource",
"valueConstraint": {
"useValuesFrom": [
"http://id.loc.gov/vocabulary/languages"
]
}
},
{
"propertyURI": "http://purl.org/dc/elements/1.1/relation",
"propertyLabel": "Relation",
"type": "resource",
"valueConstraint": {
"valueTemplateRefs": [
"profile:dc:simple2"
]
}
},
{
"propertyURI": "http://purl.org/dc/elements/1.1/coverage",
"propertyLabel": "Coverage",
"type": "literal"
},
{
"propertyURI": "http://purl.org/dc/elements/1.1/rights",
"propertyLabel": "Rights",
"type": "literal"
}
]
}
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment