--- /dev/null
+function mkRDFURI(uri)
+{
+ var prefix = "helm:rdf:www.cs.unibo.it/helm/rdf/backward//";
+ var re1 = /#xpointer\(1\/(\d+)\/(\d+)\)/;
+ var re2 = /#xpointer\(1\/(\d+)\)/;
+ // Just one of the following replace will do something
+ uri = uri.replace(re1,",$1,$2");
+ uri = uri.replace(re2,",$1");
+
+ return (prefix + uri);
+}
+
+function removeXPointer(uri)
+{
+ //var re = /#xpointer(\.*)/;
+ // CSC: Why the r.e.s below work and the one above does not?
+ var re1 = /#xpointer\(1\/(\d+)\/(\d+)\)/;
+ var re2 = /#xpointer\(1\/(\d+)\)/;
+ var res = uri.replace(re1,"");
+ res = res.replace(re2,"");
+
+ return res;
+}
+
+
+// (use_rdf_uri==true) if the stylesheet must be applied to the
+// metadata; (use_rdf_uri==false) otherwise
+function mkGraphURL(uri,keys,use_rdf_uri,use_default_uri_set_size)
+{
+ var getterURL = unescape(getParam("param.getterURL"));
+ var draw_graphURL = unescape(getParam("param.draw_graphURL"));
+ var url= setParam(location.href,"keys",keys);
+ var rdfuri = mkRDFURI(uri);
+ url = setParam(url,"xmluri", getterURL + 'getxml%3Furi%3D' +
+ (use_rdf_uri ? rdfuri : removeXPointer(uri)));
+ url = setParam(url,"param.CICURI",escape(uri));
+ var uri_set_size =
+ use_default_uri_set_size ? -1 : document.uri_set_size.elements[0].value;
+ if (uri_set_size > 0)
+ url = setParam(url,"param.uri_set_size",uri_set_size);
+ url = draw_graphURL + 'draw?url=' + escape(url);
+ var url2 = setParam(location.href,"keys","MGL,RT");
+ url2 = setParam(url2,"xmluri",escape(url));
+ if (uri_set_size > 0)
+ url2 = setParam(url2,"param.uri_set_size",uri_set_size);
+ return url2;
+}
+
+function mkDepURL(uri,use_default_uri_set_size)
+{
+ return mkGraphURL(uri,"MDG",0,use_default_uri_set_size);
+}
+
+
+function mkMetaURL(uri,use_default_uri_set_size)
+{
+ return mkGraphURL(uri,"MMG",1,use_default_uri_set_size);
+}
+
+function mkCICURL(uri)
+{
+ var rawuri = removeXPointer(uri);
+ var getterURL = getParam("param.getterURL");
+ var interfaceURL = unescape(getParam("param.interfaceURL"));
+ var url= setParam(location.href,"keys",getParam("param.keys"));
+ url = setParam(url,"xmluri", getterURL + 'getxml%3Furi%3D' + rawuri);
+ url = setParam(url,"param.CICURI",rawuri);
+ url = interfaceURL + "?url=" + escape(url);
+ return url;
+}