org.xowl.infra.server.site.modules.db-rules-new.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of xowl-server Show documentation
Show all versions of xowl-server Show documentation
Provides the facilities for serving datasets on a network
// Copyright (c) 2016 Association Cénotélie (cenotelie.fr)
// Provided under LGPL v3
var xowl = new XOWL();
var dbName = getParameterByName("db");
var DEFAULT_RULE =
"PREFIX rdf: \n" +
"PREFIX rdfs: \n" +
"PREFIX xsd: \n" +
"PREFIX owl: \n" +
"PREFIX xowl: \n\n" +
"rule distinct xowl:myrule {\n" +
" ?x rdf:type ?y .\n" +
" NOT (?x rdf:type owl:Class)\n" +
"} => {\n" +
" ?x rdf:type xowl:MyClass\n" +
"}";
function init() {
doSetupPage(xowl, true, [
{name: "Database " + dbName, uri: "db.html?db=" + encodeURIComponent(dbName)},
{name: "Rules", uri: "db-rules.html?db=" + encodeURIComponent(dbName)},
{name: "New Rule"}
], function() {
if (!dbName || dbName === null || dbName === "")
return;
document.getElementById("field-rule-definition").value = DEFAULT_RULE;
});
}
function onCreateRule() {
var definition = document.getElementById('field-rule-definition').value;
if (definition === null || definition === "")
return;
if (!onOperationRequest("Adding new rule ..."))
return;
xowl.addDBRule(function (status, type, content) {
if (onOperationEnded(status, content)) {
displayMessage("success", "The rule has been inserted.");
waitAndGo("db-rules.html?db=" + encodeURIComponent(dbName));
}
}, dbName, definition);
}