Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
sf.addCallback('done', expand) // @@@@@@@ This can really mess up existing work
sf.addCallback('fail', expand) // Need to do if there s one a gentle resync of page with store
var returnConditions = [] // this is quite a general way to do cut and paste programming
// I might make a class for this
if (subject.uri && subject.uri.split(':')[0] === 'rdf') {
// what is this? -tim
render()
return
}
for (var i = 0; i < returnConditions.length; i++) {
var returnCode
if (returnCode === returnConditions[i](subject)) {
render()
UI.log.debug('outline 1815')
if (returnCode[1]) outlineElement.removeChild(outlineElement.lastChild)
return
}
}
if (
subject.uri &&
!immediate &&
!UI.widgets.isAudio(subject) &&
!UI.widgets.isVideo(subject) && // Never parse videos as data
!kb.holds(
subject,
UI.ns.rdf('type'),
$rdf.Util.mediaTypeClass('application/pdf')
)
) {
// or PDF
function addMenuItem (predicate) {
if (table.firstChild && table.firstChild.className === 'no-suggest') {
table.removeChild(table.firstChild)
}
var Label = UI.utils.predicateLabelForXML(predicate, false)
// Label = Label.slice(0,1).toUpperCase() + Label.slice(1);
if (!predicate.uri) return // bnode
var theNamespace = '??'
for (var name in NameSpaces) {
UI.log.debug(NameSpaces[name])
if (UI.rdf.Util.string_startswith(predicate.uri, NameSpaces[name])) {
theNamespace = name
break
}
}
var tr = table.appendChild(myDocument.createElement('tr'))
tr.setAttribute('about', predicate)
var th = tr.appendChild(myDocument.createElement('th'))
th.appendChild(myDocument.createElement('div')).appendChild(
myDocument.createTextNode(Label)
)
tr.appendChild(myDocument.createElement('td')).appendChild(
myDocument.createTextNode(theNamespace.toUpperCase())
)
}
function saveQuery (selection, qs) {
// var qs = outline.qs // @@
var q = new UI.rdf.Query()
var n = selection.length
var i, sel, st, tr
for (i = 0; i < n; i++) {
sel = selection[i]
tr = sel.parentNode
st = tr.AJAR_statement
UI.log.debug('Statement ' + st)
if (sel.getAttribute('class').indexOf('pred') >= 0) {
UI.log.info(' We have a predicate')
makeQueryRow(q, tr)
}
if (sel.getAttribute('class').indexOf('obj') >= 0) {
UI.log.info(' We have an object')
makeQueryRow(q, tr, true)
}
}
qs.addQuery(q)
function resetOutliner (pat) {
var n = pat.statements.length
var pattern, tr
for (let i = 0; i < n; i++) {
pattern = pat.statements[i]
tr = pattern.tr
// UI.log.debug('tr: ' + tr.AJAR_statement);
this.checkLicence = function checkLicense (statement) {
var licenses = kb.each(
statement.why,
kb.sym('http://creativecommons.org/ns#license')
)
UI.log.info('licenses:' + statement.why + ': ' + licenses)
for (let i = 0; i < licenses.length; i++) {
for (let j = 0; j < this.checkedLicenses.length; j++) {
if (this.checkedLicenses[j] && licenses[i].uri === licenseURI[j]) {
return true
// theClass += ' licOkay' // icon_expand
// break
}
}
}
return false
}
return this
outliner.UserInput.sparqler.insert_statement(statement, function (
uri,
success,
errorBody
) {
tx.className = 'question'
if (!success) {
UI.log.alert(
null,
'Message',
'Error occurs while inserting ' +
statement +
'\n\n' +
errorBody
)
input.checked = false // rollback UI
return
}
kb.add(
statement.subject,
statement.predicate,
statement.object,
statement.why
)
) {
return false
}
if (
inverse &&
pred.uri === 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type'
) {
return false
}
return true
}
var outliner = context.getOutliner(dom)
var kb = context.session.store
// var outline = outliner; // @@
UI.log.info('@defaultPane.render, dom is now ' + dom.location)
subject = kb.canon(subject)
var div = dom.createElement('div')
div.setAttribute('class', 'defaultPane')
// appendRemoveIcon(div, subject, div)
var plist = kb.statementsMatching(subject)
outliner.appendPropertyTRs(div, plist, false, filter)
plist = kb.statementsMatching(undefined, undefined, subject)
outliner.appendPropertyTRs(div, plist, true, filter)
if (
subject.termType === 'Literal' &&
subject.value.slice(0, 7) === 'http://'
) {
outliner.appendPropertyTRs(
div,
[$rdf.st(kb.sym(subject.value), UI.ns.link('uri'), subject)],
UI.log.warn(
'The node you attempted to edit has a request still pending.\n' +
'Please wait for the request to finish (the text will turn black)\n' +
'before editing this node again.'
)
return true
}
var target = selectedTd
var about = this.getStatementAbout(target) // timbl - to avoid alert from random clicks
if (!about) return
try {
var obj = UI.utils.getTerm(target)
var trNode = UI.utils.ancestor(target, 'TR')
} catch (e) {
UI.log.warn('userinput.js: ' + e + UI.utils.getAbout(kb, selectedTd))
UI.log.error(target + ' getStatement Error:' + e)
}
try {
var tdNode = trNode.lastChild
} catch (e) {
UI.log.error(e + '@' + target)
}
// seems to be a event handling problem of firefox3
/*
if (e.type!='keypress'&&(selectedTd.className=='undetermined selected'||selectedTd.className=='undetermined')){
this.Refill(e,selectedTd);
return;
}
*/
// ignore clicking trNode.firstChild (be careful for <div> or <span>)</span></div>
'\n\n' +
errorBody
)
input.checked = false // rollback UI
return
}
kb.add(
statement.subject,
statement.predicate,
statement.object,
statement.why
)
})
} catch (e) {
UI.log.error('Data write fails:' + e)
UI.log.alert('Data write fails:' + e)
input.checked = false // rollback UI
tx.className = 'question'
}
} else {
// Remove link
try {
outliner.UserInput.sparqler.delete_statement(statement, function (
uri,
success,
errorBody
) {
tx.className = 'question'
if (!success) {
UI.log.alert(
'Error occurs while deleting ' +
statement +
function benchmark (f) {
var args = []
for (var i = arguments.length - 1; i > 0; i--) args[i - 1] = arguments[i]
// UI.log.debug('BENCHMARK: args=' + args.join());
var begin = new Date().getTime()
var returnValue = f.apply(f, args)
var end = new Date().getTime()
UI.log.info(
'BENCHMARK: kb delta: ' +
(kb.statements.length - benchmark.lastkbsize) +
', time elapsed for ' +
f +
' was ' +
(end - begin) +
'ms'
)
benchmark.lastkbsize = kb.statements.length
return returnValue
} // benchmark
function termFrom (fromCode) {
var term = outline.clipboard[fromCode].shift()
if (term === null) {
UI.log.warn('no more element in clipboard!')
return
}
switch (fromCode) {
case 'predicates':
case 'objects':
var allArray = outline.clipboard.all
for (var i = 0; true; i++) {
if (term.sameTerm(allArray[i])) {
allArray.splice(i, 1)
break
}
}
break
case 'all':
throw new Error(
'hostorical code not understood - what is theCollection?'