All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.xowl.infra.server.site.modules.db-rules-new.js Maven / Gradle / Ivy

There is a newer version: 2.3.4
Show newest version
// 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);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy