actinput=0;
numeroazioniannullate=0;
}
+
+// @processorURL@ will be substituted by the searchEngine using
+// the correct value
+var processorURL="@processorURL@";
+
+function ask_uwobo(url)
+ {
+ return (top.topurl+"/ask_uwobo?url="+escape(processorURL + "apply?xmluri=" + escape(url) + "&keys=T1%2CT2%2CL%2CE¶m.processorURL="+escape(processorURL)+"¶m.getterURL=http%3A//mowgli.cs.unibo.it%3A58081/¶m.proofcheckerURL=http%3A//mowgli.cs.unibo.it%3A58084/¶m.draw_graphURL=http%3A//mowgli.cs.unibo.it%3A58083/¶m.uri_set_queueURL=http%3A//mowgli.cs.unibo.it%3A58082/¶m.UNICODEvsSYMBOL=unicode¶m.keys=d_c%2CC1%2CHC2%2CL¶m.thkeys=T1%2CT2%2CL%2CE¶m.embedkeys=d_c%2CTC1%2CHC2%2CL¶m.doctype-public=-//W3C//DTD%20XHTML%201.0%20Transitional//EN¶m.encoding=iso-8859-1¶m.thencoding=iso-8859-1¶m.media-type=text/html¶m.thmedia-type=text/html¶m.interfaceURL=http%3A//helm.cs.unibo.it/helm/html/cic/index.html¶m.thinterfaceURL=http%3A//helm.cs.unibo.it/helm/html/theory/index.html¶m.CICURI=dummy:query_result¶m.naturalLanguage=yes¶m.annotations=no¶m.topurl=http://helm.cs.unibo.it/helm&prop.method=html"));
+ }
function help(w) // quando invocata, visualizza l' help relativo ad un oggetto. Di solito è legata ad un evento onFocus o onMouseOver.
{
hw.document.close();
switch (w) {
+ case -10: hw.document.write("Insert an <a href="+top.topurl+top.action+"grammarpdq.html#Id target=gw>Id</a> or an <a href="+top.topurl+top.action+"grammarpdq.html#Uri target=gw>Uri</a> here.")
+ break;
case -9: hw.document.write("By clicking this you may add or remove aliases as you wish.")
break;
case -81: hw.document.write("Allows you to recover your last input")
break;
case -8: hw.document.write("Allows you to delete your last input")
break;
- case -7: hw.document.write("Erases your query and starts a new pre-defined query.")
+ case -7: hw.document.write("Erases your query and starts a new pre-defined query, you will keep your list of aliases.")
break;
case -6: hw.document.write("Puts this string in the current cursor position. This button works only with Internet Explorer.")
break;
break;
case -3: hw.document.write("Substitutes your query with the text written in the area above. Unless you have a good knowledge of MathQL, it's recommended that you use this only to recover errors.")
break;
- case -2: hw.document.write("This is the edit/submit window. You can modify your query here, but be aware that no syntax check will be performed and that if you enter a <a href=grammar.html#rvar target=gw>variable</a> it won't be available for quick composition later. You may also want to add a <a href=grammar.html#set target=gw>set</a>, a <a href=grammar.html#val target=gw>val</a> or a <a href=grammar.html#boole target=gw>boole</a> somewhere in the query. If you do, write '<set>','<val>' or '<bol>' in the point you'd like it to appear, or use the buttons on the right if you are using IE. When you're done with the query, click the Submit button.")
+ case -2: hw.document.write("This is the edit/submit window. You can modify your query here, but be aware that no syntax check will be performed and that if you enter a <a href="+top.topurl+top.action+"grammar.html#rvar target=gw>variable</a> it won't be available for quick composition later. You may also want to add a <a href="+top.topurl+top.action+"grammar.html#set target=gw>set</a>, a <a href="+top.topurl+top.action+"grammar.html#val target=gw>val</a> or a <a href="+top.topurl+top.action+"grammar.html#boole target=gw>boole</a> somewhere in the query. If you do, write '<set>','<val>' or '<bol>' in the point you'd like it to appear, or use the buttons on the right if you are using IE. When you're done with the query, click the Submit button.")
break;
case -1: hw.document.write("You may see the grammar here.")
break;
break;
case 1: hw.document.write("You may enter an arbitrary statement here; be careful since syntax errors won't be detected.");
break;
- case 2: hw.document.write("Enter an <a href=grammar.html#attr_list target=gw>attr_list</a> here.");
+ case 2: hw.document.write("Enter an <a href="+top.topurl+top.action+"grammar.html#attr_list target=gw>attr_list</a> here.");
break;
- case 3: hw.document.write("Enter an <a href=grammar.html#id target=gw>id</a> here.");
+ case 3: hw.document.write("Enter an <a href="+top.topurl+top.action+"grammar.html#id target=gw>id</a> here.");
break;
- case 4: hw.document.write("You must select one previously entered <a href=grammar.html#rvar target=gw>rvar</a>. If you haven't already entered at least one, you can't choose this. ");
+ case 4: hw.document.write("You must select one previously entered <a href="+top.topurl+top.action+"grammar.html#rvar target=gw>rvar</a>. If you haven't already entered at least one, you can't choose this. ");
break;
- case 5: hw.document.write("Enter a <a href=grammar.html#path target=gw>path</a> here.");
+ case 5: hw.document.write("Enter a <a href="+top.topurl+top.action+"grammar.html#path target=gw>path</a> here.");
break;
- case 6: hw.document.write("You must select one previously entered <a href=grammar.html#svar target=gw>svar</a>. If you haven't already entered at least one, you can't choose this. ");
+ case 6: hw.document.write("You must select one previously entered <a href="+top.topurl+top.action+"grammar.html#svar target=gw>svar</a>. If you haven't already entered at least one, you can't choose this. ");
break;
- case 7: hw.document.write("Enter a <a href=grammar.html#string_list target=gw>string_list</a> here.");
+ case 7: hw.document.write("Enter a <a href="+top.topurl+top.action+"grammar.html#string_list target=gw>string_list</a> here.");
break;
- case 8: hw.document.write("You must select one <a href=grammar.html#vvar target=gw>vvar</a> previously entered as an 'attr'. If you haven't already entered at least one, you can't choose this. ");
+ case 8: hw.document.write("You must select one <a href="+top.topurl+top.action+"grammar.html#vvar target=gw>vvar</a> previously entered as an 'attr'. If you haven't already entered at least one, you can't choose this. ");
break;
- case 81: hw.document.write("You must select one <a href=grammar.html#vvar target=gw>vvar</a> previously entered in a 'let' statement. If you haven't already entered at least one, you can't choose this. ");
+ case 81: hw.document.write("You must select one <a href="+top.topurl+top.action+"grammar.html#vvar target=gw>vvar</a> previously entered in a 'let' statement. If you haven't already entered at least one, you can't choose this. ");
break;
- case 9: hw.document.write("Enter a single <a href=grammar.html#quoted_string target=gw>quoted_string</a> here.");
+ case 9: hw.document.write("Enter a single <a href="+top.topurl+top.action+"grammar.html#quoted_string target=gw>quoted_string</a> here.");
break;
}
}
{quotpath=quotpath.replace(">",">");}
return (quotpath);
}
+function idcheck(ident)
+ {
+ lettera=/[a-zA-Z]/;
+ partediid=/[a-zA-Z0-9_\-\']/;
+ if (!lettera.test(ident.charAt(0))){alert("an Id must begin with a letter.");return(0)}
+ while (ident.length>0)
+ {
+ ident=ident.substring(1,(ident.length));
+ if (ident.length>0){
+ if (!partediid.test(ident.charAt(0))){alert(ident.charAt(0)+" is not a valid character for an Id.");return(0);}
+ }}
+ return(1)
+ }
+function uricheck(ident)
+ {
+ cifra=/[0-9]/
+ cic=ident.substring(0,5);//alert(cic);
+ if (cic!="cic:/"){alert("an Uri must begin with the string 'cic:/'");return(0);}
+ ident=ident.substring(5,ident.length);//alert(ident);
+ if (ident.indexOf(".")<0){alert("an Uri must contain a '.'");return(0);}
+ ident1=ident.substring(0,ident.indexOf("."));//alert(ident1);
+ ident2=ident.substring(ident.indexOf(".")+1,ident.length);//alert(ident2);
+ while (ident1.length>0)
+ {
+ if (ident1.indexOf("/")>-1)
+ {
+ if (idcheck(ident1.substring(0,ident1.indexOf("/")))==0){return (0)}
+ ident1=ident1.substring(ident1.indexOf("/")+1,ident1.length);//alert(ident1);
+ }
+ else {if (idcheck(ident1)==0){return (0)}
+ ident1="";}
+ }
+ if (ident2=="con"||ident2=="var"){return(1)}
+ if (ident2.substring(0,6)!="ind#1/"){alert ("syntax error in the Uri.");return(0);}
+ ident2=ident2.substring(6,ident2.length);//alert(ident2);
+ if (!cifra.test(ident2.charAt(0))){alert ("syntax error in the Uri.");return(0);}
+ if (ident2.indexOf("/")>-1)
+ {
+ while (ident2.charAt(0)!="/")
+ {
+ //alert(ident2);
+ if (!cifra.test(ident2.charAt(0))){alert ("syntax error in the Uri.");return(0);}
+ ident2=ident2.substring(1,ident2.length);
+ }
+ }
+ while (ident2.length>0)
+ {
+ //alert(ident2);
+ ident2=ident2.substring(1,ident2.length);
+ if (ident2.length>0){
+ if (!cifra.test(ident2.charAt(0))){alert ("syntax error in the Uri.");return(0);}
+ }}
+
+ return(1)
+ }
function gramcheck(how,what) // esegue il controllo sintattico sulla stringa "what", controllando che rispetti i requisiti indicati dalla clausola "how". Se qualcosa non è ok, la variabile "wrong" viene posta ad 1 e la stringa da aggiungere viene ignorata, mentre viene visualizzato un apposito messaggio di errore.
{
var slash=0;
ltr=pq.slice(pq.indexOf("[?"));
ltr=ltr.substring(ltr.indexOf("[?"),(ltr.length-ltr.indexOf("[?"))-(ltr.length-ltr.indexOf("]")-1));
wto=ltr.substring(2,5);
- if (wto=="set") {window.open(top.topurl+"/getpage?url=set.html","cw");pq="";}
- else if (wto=="val") {window.open(top.topurl+"/getpage?url=val.html","cw");pq="";}
- else if (wto=="bol") {window.open(top.topurl+"/getpage?url=boole.html","cw");pq="";}
+ if (wto=="set") {window.open(top.topurl+action+"set.html","cw");pq="";}
+ else if (wto=="val") {window.open(top.topurl+action+"val.html","cw");pq="";}
+ else if (wto=="bol") {window.open(top.topurl+action+"boole.html","cw");pq="";}
else pq=pq.substring(pq.indexOf("[?")+2,pq.length);
}
- else {window.open(top.topurl+"/getpage?url=blank.html","cw");pq="";}
+ else {window.open(top.topurl+action+"blank.html","cw");pq="";}
}
}
function aggform() // aggiorna il form nel frame centrale. Invocata ad ogni cambio della variabile "query".
qw.document.write(query);
aggform();
sw.apply();
- if (query=="*"){cw.location=top.topurl+"/getpage?url=set.html";ltr="*";} else {aggcw();}
+ if (query=="*"){cw.location=top.topurl+action+"set.html";ltr="*";} else {aggcw();}
cw.focus();
}
}
while (fb.indexOf("[set]")>-1){
if (fb.indexOf("set")>0)
{
- fb=fb.replace("[set]","<A HREF="+top.topurl+"/getpage?url=set.html target=cw onclick=top.savelink("+top.storeps+",'s')>[?set"+top.storeps+"]</A>");
+ fb=fb.replace("[set]","<A HREF="+top.topurl+action+"set.html target=cw onclick=top.savelink("+top.storeps+",'s')>[?set"+top.storeps+"]</A>");
top.storeps++;
}
}
while (fb.indexOf("[val]")>-1){
if (fb.indexOf("val")>0)
{
- fb=fb.replace("[val]","<A HREF="+top.topurl+"/getpage?url=val.html target=cw onclick=top.savelink("+top.storepv+",'v')>[?val"+top.storepv+"]</A>");
+ fb=fb.replace("[val]","<A HREF="+top.topurl+action+"val.html target=cw onclick=top.savelink("+top.storepv+",'v')>[?val"+top.storepv+"]</A>");
top.storepv++;
}
}
while (fb.indexOf("[boole]")>-1){
if (fb.indexOf("boole")>0)
{
- fb=fb.replace("[boole]","<A HREF="+top.topurl+"/getpage?url=boole.html target=cw onclick=top.savelink("+top.storepb+",'b')>[?bol"+top.storepb+"]</A>");
+ fb=fb.replace("[boole]","<A HREF="+top.topurl+action+"boole.html target=cw onclick=top.savelink("+top.storepb+",'b')>[?bol"+top.storepb+"]</A>");
top.storepb++;
}
}
}
function aggq() // aggiorna la query sostituendo l' ultimo link editato con la stringa inserita, poi aggiorna tutti i frame.
{
- //window.open(top.topurl+"/getpage?url=summary.html","cw");
+ //window.open(top.topurl+action+"summary.html","cw");
qw.document.close();
fb=stadd;
nst=ltr.substring(5,(ltr.length-1));// alert(nst+" "+ltr);
- query=query.replace("<A HREF="+top.topurl+"/getpage?url=set.html target=cw onclick=top.savelink("+nst+",'s')>"+ltr+"</A>",ltr);
- query=query.replace("<A HREF="+top.topurl+"/getpage?url=val.html target=cw onclick=top.savelink("+nst+",'v')>"+ltr+"</A>",ltr);
- query=query.replace("<A HREF="+top.topurl+"/getpage?url=boole.html target=cw onclick=top.savelink("+nst+",'b')>"+ltr+"</A>",ltr);
+ query=query.replace("<A HREF="+top.topurl+action+"set.html target=cw onclick=top.savelink("+nst+",'s')>"+ltr+"</A>",ltr);
+ query=query.replace("<A HREF="+top.topurl+action+"val.html target=cw onclick=top.savelink("+nst+",'v')>"+ltr+"</A>",ltr);
+ query=query.replace("<A HREF="+top.topurl+action+"boole.html target=cw onclick=top.savelink("+nst+",'b')>"+ltr+"</A>",ltr);
parse();
query=query.replace(ltr,fb);
actinput++;storia[actinput]=query;numeroazioniannullate=0;//alert (actinput+" "+storia.length);
aggcw();
cw.focus();
}
- var topurl=document.location.protocol+'//'+document.location.host;
+var topurl=document.location.protocol+'//'+document.location.host;
+//var topurl="";
+var action="/getpage?url=";
+//var action="";
+
+
+// UTILITY FUNCTIONS FOR templateambigpdq1.html
+function templateambigpdq1_armageddon()
+ {
+ top.initialize();
+ top.window.open(top.topurl+top.action+"start.html","qw");
+ top.window.open(top.topurl+top.action+"blank.html","cw");
+ top.window.open(top.topurl+top.action+"blank.html","hw");
+ top.window.open(top.topurl+top.action+"blank.html","gw");
+ top.window.open(top.topurl+top.action+"blank.html","sw");
+ }
+
+function templateambigpdq1_resetta()
+ {
+ if (confirm("This will erase your query and start a new one. Are you sure you want to do this?"))
+ {templateambigpdq1_armageddon();}
+ }
+
+function templateambigpdq1_listauri(document,elenco)
+ {
+ for (i=0;i<elenco.length;i++)
+ {
+ document.write("<input type=checkbox name=uricheck value="+elenco[i]+"> "+elenco[i]+"<br>");
+ }
+ }
+
+function templateambigpdq1_invia(document,top,elenco,ident)
+ {
+ vecchiavlds=top.vlds.length;
+ stringa=top.topurl+"/searchPattern?term="+top.terminecic;
+ stringa=stringa+"&aliases="+top.listaliases;
+ stringa=stringa+"&choices=";
+ var choices = "";
+ top.vlds[top.vlds.length]=ident;
+ for (j=0;j<elenco.length;j++)
+ {
+ if (document.disamb.uricheck[j].checked)
+ {
+ top.vlds[top.vlds.length]=document.disamb.uricheck[j].value;
+ }
+ }
+ top.vlds[top.vlds.length]=";";
+ for (j=0;j<top.vlds.length;j++)
+ {
+ choices=choices+(top.vlds[j]==";"?";":escape(top.vlds[j]))+" ";
+ }
+ choices=choices.substring(0,choices.length-2);
+ stringa=stringa+escape(choices);
+ if (top.vlds.length==vecchiavlds){alert("You must select at least one of the options.");}
+ else
+ {
+ window.open(ask_uwobo(stringa),"cw");
+ }
+ }
+
+ function templateambigpdq1_selezionaCostanti(document,elenco) {
+ for (i=0; i<elenco.length; i++) {
+ if (elenco[i].substring(elenco[i].length-4, elenco[i].length) != ".var") {
+ document.disamb.uricheck[i].checked = true;
+ } else {
+ document.disamb.uricheck[i].checked = false;
+ }
+ }
+ }
+
+
+
+// UTILITY FUNCTIONS FOR templateambigpdq2.html
+function templateambigpdq2_armageddon()
+ {
+ top.initialize();
+ top.window.open(top.topurl+top.action+"start.html","qw");
+ top.window.open(top.topurl+top.action+"blank.html","cw");
+ top.window.open(top.topurl+top.action+"blank.html","hw");
+ top.window.open(top.topurl+top.action+"blank.html","gw");
+ top.window.open(top.topurl+top.action+"blank.html","sw");
+ }
+
+function templateambigpdq2_resetta()
+ {
+ if (confirm("This will erase your query and start a new one. Are you sure you want to do this?"))
+ {templateambigpdq2_armageddon();}
+ }
+
+function templateambigpdq2_listainterpretazioni(document,elenco,labels)
+ {
+ for (i=0;i<elenco.length;i++)
+ {
+ document.write("<input type=radio name=interp value="+elenco[i]+"> "+labels[i]+"<br />");
+ }
+ }
+
+function templateambigpdq2_invia(document,elenco)
+ {
+ stringa=top.topurl+"/searchPattern?term="+top.terminecic;
+ stringa=stringa+"&aliases="+(top.listaliases==""?"":"%20");
+ controllo=stringa.length;
+ for (j=0;j<elenco.length;j++)
+ {
+ if (document.disamb.interp[j].checked)
+ {
+ stringa=stringa+escape(elenco[j]);
+
+ // TODO da implementare nella terza fase
+ //top.aliasglob[top.aliasglob.length]=document.disamb.interp[j].value;
+
+ //for (k=0;k<top.aliasglob.length;k++){alert(top.aliasglob[k])}
+ //top.listaliases=top.listaliases+document.disamb.interp[j].value;//in caso di query ulteriori con la stessa lista di alias
+ }
+
+ }
+ if (stringa.length!=controllo)
+ {
+ window.open(ask_uwobo(stringa),"cw");
+ }
+ else {alert("You must choose one option.");}
+ }
+
+
+
+// UTILITY FUNCTIONS FOR templateambigpdq3.html
+function templateambigpdq3_init(aliases)
+{
+ top.aliasglob = new Array();
+ for (i=0; i<aliases.length; i++) {
+ top.aliasglob[i] = aliases[i];
+ }
+ top.vlds=new Array();
+ top.window.open(top.topurl+top.action+"editorpdq.html", "sw");
+}
</SCRIPT>
</HEAD>
<script>
- document.write(' <FRAMESET ROWS="69%,31%"> <FRAMESET COLS="40%,60%"> <FRAMESET ROWS="46%,54%"> <FRAME NAME="qw" SRC="'+topurl+'/getpage?url=start.html"> <FRAME NAME="sw" SRC="'+topurl+'/getpage?url=blank.html"> </FRAMESET> <FRAME NAME="cw" SRC="'+topurl+'/getpage?url=blank.html"> </FRAMESET> <FRAMESET COLS="49%,51%"> <FRAME NAME="gw" SRC="'+topurl+'/getpage?url=blank.html" onFocus="help(-1)";> <FRAME NAME="hw" SRC="'+topurl+'/getpage?url=blank.html"> </FRAMESET> </FRAMESET>');
+ document.write(' <FRAMESET ROWS="69%,31%"> <FRAMESET COLS="40%,60%"> <FRAMESET ROWS="46%,54%"> <FRAME NAME="qw" SRC="'+topurl+action+'start.html"> <FRAME NAME="sw" SRC="'+topurl+action+'blank.html"> </FRAMESET> <FRAME NAME="cw" SRC="'+topurl+action+'blank.html"> </FRAMESET> <FRAMESET COLS="49%,51%"> <FRAME NAME="gw" SRC="'+topurl+action+'blank.html" onFocus="help(-1)";> <FRAME NAME="hw" SRC="'+topurl+action+'blank.html"> </FRAMESET> </FRAMESET>');
</script>
</HTML>