flora-commits Mailing List for Flora-2
Brought to you by:
kifer
You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(59) |
Jun
(43) |
Jul
(4) |
Aug
(4) |
Sep
(102) |
Oct
(20) |
Nov
(47) |
Dec
(32) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(24) |
Feb
(34) |
Mar
(72) |
Apr
(36) |
May
(10) |
Jun
(46) |
Jul
(36) |
Aug
(24) |
Sep
(37) |
Oct
(27) |
Nov
(43) |
Dec
(40) |
| 2004 |
Jan
(35) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(30) |
Aug
(83) |
Sep
(68) |
Oct
(38) |
Nov
(3) |
Dec
(7) |
| 2005 |
Jan
(9) |
Feb
(31) |
Mar
(46) |
Apr
(73) |
May
(21) |
Jun
(1) |
Jul
(32) |
Aug
(33) |
Sep
(3) |
Oct
(28) |
Nov
(4) |
Dec
(23) |
| 2006 |
Jan
(22) |
Feb
(2) |
Mar
(12) |
Apr
(23) |
May
(73) |
Jun
(14) |
Jul
|
Aug
(20) |
Sep
(14) |
Oct
(5) |
Nov
|
Dec
(14) |
| 2007 |
Jan
(54) |
Feb
(81) |
Mar
(286) |
Apr
(313) |
May
(154) |
Jun
(85) |
Jul
(8) |
Aug
(11) |
Sep
(12) |
Oct
(14) |
Nov
(6) |
Dec
(6) |
| 2008 |
Jan
|
Feb
|
Mar
(1) |
Apr
(12) |
May
(4) |
Jun
|
Jul
(13) |
Aug
(22) |
Sep
|
Oct
|
Nov
|
Dec
|
| 2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(46) |
Jun
(43) |
Jul
(46) |
Aug
(9) |
Sep
(13) |
Oct
(31) |
Nov
(42) |
Dec
(18) |
| 2014 |
Jan
(7) |
Feb
(7) |
Mar
(11) |
Apr
(13) |
May
(16) |
Jun
(6) |
Jul
(17) |
Aug
|
Sep
(2) |
Oct
|
Nov
(1) |
Dec
|
| 2015 |
Jan
|
Feb
(17) |
Mar
(4) |
Apr
(3) |
May
(2) |
Jun
(3) |
Jul
(2) |
Aug
(3) |
Sep
|
Oct
|
Nov
|
Dec
|
| 2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
(2) |
| 2017 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
| 2019 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
|
|
|
|
1
|
2
|
3
(5) |
|
4
|
5
|
6
|
7
|
8
|
9
|
10
|
|
11
(12) |
12
(2) |
13
(202) |
14
(1) |
15
|
16
|
17
|
|
18
|
19
|
20
|
21
|
22
(5) |
23
(24) |
24
|
|
25
|
26
(5) |
27
(1) |
28
(29) |
29
|
30
|
31
|
|
From: Michael K. <ki...@us...> - 2007-03-28 22:51:21
|
Update of /cvsroot/flora/flora2/datatypes In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv18564/datatypes Modified Files: flrdatatype.P Log Message: added primitives to filter out answers. Index: flrdatatype.P =================================================================== RCS file: /cvsroot/flora/flora2/datatypes/flrdatatype.P,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- flrdatatype.P 28 Mar 2007 01:37:50 -0000 1.10 +++ flrdatatype.P 28 Mar 2007 22:51:20 -0000 1.11 @@ -148,6 +148,7 @@ flora_builtin_datatype(FL_BOOL). flora_builtin_datatype(FL_CHARLIST). flora_builtin_datatype(FL_LISTTYPE). +flora_builtin_datatype(FL_NUMBER). flora_primitive_datatype(FL_STRING). flora_primitive_datatype(FL_INTEGER). |
|
From: Michael K. <ki...@us...> - 2007-03-28 22:51:21
|
Update of /cvsroot/flora/flora2/syslib In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv18564/syslib Modified Files: flranswer.P Log Message: added primitives to filter out answers. Index: flranswer.P =================================================================== RCS file: /cvsroot/flora/flora2/syslib/flranswer.P,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- flranswer.P 9 Jun 2004 06:41:53 -0000 1.3 +++ flranswer.P 28 Mar 2007 22:51:20 -0000 1.4 @@ -44,6 +44,8 @@ :- import shell/5 from shell. +:- import flora_builtin_datatype/1 from flrdatatype. + :- import flora_stdfdbk_string/2, flora_stdfdbk_string/1, @@ -227,3 +229,14 @@ flora_handle_end_of_call :- flora_handle_trace, fail. /********************************************************************/ + +/******************************************************************** + filters to get rid of some classes +********************************************************************/ + +flora_noncomposite_class(C) :- + C \= (_;C1), var(C1), C \= (C2;_), var(C2), + C \= (_,C3), var(C3), C \= (C4,_), var(C4), + C \= (_ - C5), var(C5), C \= (C6 - _), var(C6). + +flora_nonbuiltin_class(C) :- \+flora_builtin_datatype(C). |
|
From: Michael K. <ki...@us...> - 2007-03-28 22:11:59
|
Update of /cvsroot/flora/flora2/java/API/net/sourceforge/flora/javaAPI/src In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv2790/java/API/net/sourceforge/flora/javaAPI/src Modified Files: PrologFlora.java FloraObject.java Log Message: added builtin uri prefixes xsd, owl, rdf, rdfs Modified java interface so toString() would use flora_decode_oid_as_atom and thus display answers correctly. Index: PrologFlora.java =================================================================== RCS file: /cvsroot/flora/flora2/java/API/net/sourceforge/flora/javaAPI/src/PrologFlora.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- PrologFlora.java 10 Feb 2007 01:25:58 -0000 1.5 +++ PrologFlora.java 28 Mar 2007 22:11:22 -0000 1.6 @@ -57,7 +57,8 @@ "consult(flora2)", "bootstrap_flora", "import ('_load')/1, ('_add')/1 from flora2", - "import flora_query/4 from flora2" + "import flora_query/4 from flora2", + "import flora_decode_oid_as_atom/2 from flrdecode" }); } Index: FloraObject.java =================================================================== RCS file: /cvsroot/flora/flora2/java/API/net/sourceforge/flora/javaAPI/src/FloraObject.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- FloraObject.java 10 Feb 2007 01:25:58 -0000 1.6 +++ FloraObject.java 28 Mar 2007 22:11:22 -0000 1.7 @@ -36,6 +36,7 @@ import java.io.IOException; import net.sourceforge.flora.javaAPI.util.*; import com.declarativa.interprolog.TermModel; +import com.declarativa.interprolog.PrologOperatorsContext; /** This class is the glue between the high-level generated Java classes and the low-level interface. It contains the logic to @@ -74,6 +75,7 @@ public String toString () { + /* if (floraOID.isAtom() || floraOID.isVar() || floraOID.isList() || floraOID.isNumber()) return floraOID.toString(); @@ -85,6 +87,53 @@ return ((TermModel)session.flora.engine.deterministicGoal(query,"[Model]")[0]).toString(); } + */ + String query = + "flora_decode_oid_as_atom((" + toQuotedString(this.floraOID) + "),Printable), " + + "buildTermModel(Printable,Model)"; + return ((TermModel)session.flora.engine.deterministicGoal(query,"[Model]")[0]).toString(); + } + + /* This is a modified method from Interprolog's TermModel.java */ + private static String toQuotedString (TermModel modObj) { + String nodeString = + (modObj.node instanceof String ? + "'"+modObj.node.toString()+"'" : modObj.node.toString()); + if (modObj.getChildCount()==0) + return nodeString; + else if (modObj.isList()) { + return listToQuotedString(modObj); + } else { + StringBuffer s= + new StringBuffer(nodeString+"(" + +toQuotedString(modObj.children[0])); + for (int i=1;i<modObj.children.length;i++){ + s.append(","+toQuotedString(modObj.children[i])); + } + return s+")"; + } + } + + /* This is a modified method from Interprolog's TermModel.java */ + private static final int listMaxLength=1000; + private static String listToQuotedString(TermModel term) { + int i; + StringBuffer s = new StringBuffer("["); + TermModel temp = term; + for( i = 0 ; i < listMaxLength ; i++ ){ + s.append(toQuotedString(temp.children[0])); // head + temp = temp.children[1]; + if (temp.isListEnd()) break; + if( ! temp.isList() ) break ; // tail is not a list + s.append(',') ; + } + if( i == listMaxLength ) + s.append("..."); + else if ( ! temp.isListEnd() ) { + s.append('|') ; + s.append(toQuotedString(temp)); + } + return s + "]"; } |
|
From: Michael K. <ki...@us...> - 2007-03-28 22:11:59
|
Update of /cvsroot/flora/flora2/java/API/examples/fooExample In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv2790/java/API/examples/fooExample Modified Files: fooExample.java foo.flr Log Message: added builtin uri prefixes xsd, owl, rdf, rdfs Modified java interface so toString() would use flora_decode_oid_as_atom and thus display answers correctly. Index: foo.flr =================================================================== RCS file: /cvsroot/flora/flora2/java/API/examples/fooExample/foo.flr,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- foo.flr 25 May 2006 02:49:48 -0000 1.2 +++ foo.flr 28 Mar 2007 22:11:24 -0000 1.3 @@ -32,3 +32,6 @@ mary[ancestors->{sally, bill, bob, anne}]. +p(f(a,b)). +p("2002-12-23T12:33:45.444"^^_dateTime). +p("12:33:45.444"^^xsd#time). Index: fooExample.java =================================================================== RCS file: /cvsroot/flora/flora2/java/API/examples/fooExample/fooExample.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- fooExample.java 25 Dec 2006 00:13:29 -0000 1.6 +++ fooExample.java 28 Mar 2007 22:11:23 -0000 1.7 @@ -79,6 +79,18 @@ Object Yobj = firstmatch.get("?Y"); System.out.println(" " + Xobj + " : " + Yobj); } + + // Another use of ExecuteQuery/2: with data types + Vector<String> vars2 = new Vector<String>(); + vars2.add("?X"); + Iterator allmatches2 = session.ExecuteQuery("p(?X) @ example.",vars2); + HashMap firstmatch2; + System.out.println("Query: p(?X) @ example."); + while (allmatches2.hasNext()) { + firstmatch2 = (HashMap)allmatches2.next(); + Object Xobj = firstmatch2.get("?X"); + System.out.println("?X = " + Xobj); + } /******************************************************************* Examples of the high-level API |
|
From: Michael K. <ki...@us...> - 2007-03-28 22:11:59
|
Update of /cvsroot/flora/flora2/syslib In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv2790/syslib Modified Files: flrprefixdef.P Log Message: added builtin uri prefixes xsd, owl, rdf, rdfs Modified java interface so toString() would use flora_decode_oid_as_atom and thus display answers correctly. Index: flrprefixdef.P =================================================================== RCS file: /cvsroot/flora/flora2/syslib/flrprefixdef.P,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- flrprefixdef.P 28 Mar 2007 01:37:48 -0000 1.3 +++ flrprefixdef.P 28 Mar 2007 22:11:22 -0000 1.4 @@ -30,16 +30,46 @@ #include "flora_exceptions.flh" -:- import flora_concat_atoms/2 - from flrporting. - -:- import flora_shell_prefixdef/3 from flrregistry. +:- import + flora_shell_prefixdef/3, + flora_coder_prefixdef/2 + from flrregistry. :- export - FLLIBPREFIXDEF/3. + flora_runtime_uriprefix_expansion/3, + flora_compiletime_uriprefix_expansion/2, + flora_clear_compiletime_uriprefixes/0, + flora_clear_runtime_uriprefixes/0, + FLLIBPREFIXDEF/3, + FLLIBPREFIXDEF/2. -FLLIBPREFIXDEF(Mod,NameCode,BodyCode) :- - flora_concat_atoms(['flora_prefix_',NameCode],PrefixCode), - retractall(flora_shell_prefixdef(Mod,PrefixCode,_)), - assert(flora_shell_prefixdef(Mod,PrefixCode,BodyCode)). +FLLIBPREFIXDEF(Mod,Prefix,Expansion) :- + retractall(flora_shell_prefixdef(Mod,Prefix,_)), + assert(flora_shell_prefixdef(Mod,Prefix,Expansion)). +FLLIBPREFIXDEF(Prefix,Expansion) :- + retractall(flora_coder_prefixdef(Prefix,_)), + assert(flora_coder_prefixdef(Prefix,Expansion)). + +flora_clear_compiletime_uriprefixes :- retractall(flora_coder_prefixdef(_,_)). +flora_clear_runtime_uriprefixes :- retractall(flora_shell_prefixdef(_,_,_)). + + + +standard_definitions(xsd,'http://www.w3.org/2001/XMLSchema#'). +standard_definitions(rdf,'http://www.w3.org/1999/02/22-rdf-syntax-ns#'). +standard_definitions(rdfs,'http://www.w3.org/2000/01/rdf-schema#'). +standard_definitions(owl,'http://www.w3.org/2002/07/owl#'). + + +flora_runtime_uriprefix_expansion(Mod,Prefix,Def) :- + flora_shell_prefixdef(Mod,Prefix,Def), + !. +flora_runtime_uriprefix_expansion(_Mod,Prefix,Def) :- + standard_definitions(Prefix,Def). + +flora_compiletime_uriprefix_expansion(Prefix,Def) :- + flora_coder_prefixdef(Prefix,Def), + !. +flora_compiletime_uriprefix_expansion(Prefix,Def) :- + standard_definitions(Prefix,Def). |
|
From: Michael K. <ki...@us...> - 2007-03-28 22:11:33
|
Update of /cvsroot/flora/flora2 In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv2790 Modified Files: flrshell.P flrshell.H flrcoder.P flrcoder.H Log Message: added builtin uri prefixes xsd, owl, rdf, rdfs Modified java interface so toString() would use flora_decode_oid_as_atom and thus display answers correctly. Index: flrcoder.P =================================================================== RCS file: /cvsroot/flora/flora2/flrcoder.P,v retrieving revision 1.54 retrieving revision 1.55 diff -u -d -r1.54 -r1.55 --- flrcoder.P 28 Mar 2007 01:37:51 -0000 1.54 +++ flrcoder.P 28 Mar 2007 22:11:27 -0000 1.55 @@ -317,7 +317,7 @@ flora_extern_code(TermList,Status) :- flora_set_counter(using_debug_prefix,1), flora_write_codelist(TermList,Status), - retractall(flora_coder_prefixdef(_,_)), + flora_clear_compiletime_uriprefixes, flora_set_counter(using_debug_prefix,0), !. @@ -774,8 +774,7 @@ !, is_pratom(PrefixName,NameAtom,_Index1), is_pratom(PrefixBody,BodyAtom,_Index2), - clear_coder_prefixdef(NameAtom), - set_coder_prefixdef(NameAtom,BodyAtom). + FLLIBPREFIXDEF(NameAtom,BodyAtom). flora_write_struct(Term,_Prefix,Status) :- is_prurisq(Term,Prefix,Localname), @@ -2041,7 +2040,7 @@ ; is_pratom(Localname,LocalAtom,_Index2) ), - (get_coder_prefixdef(PrefixAtom,PrefixBody) + (flora_compiletime_uriprefix_expansion(PrefixAtom,PrefixBody) -> flora_concat_atoms([PrefixBody,LocalAtom],UriAtm), atom_codes(UriAtm,UriCodes), @@ -2062,7 +2061,7 @@ ; is_pratom(Localname,LocalAtom,_Index2) ), - (get_shell_prefixdef(WS,PrefixAtom,PrefixBody) + (flora_runtime_uriprefix_expansion(WS,PrefixAtom,PrefixBody) -> flora_concat_atoms([PrefixBody,LocalAtom],UriAtm), atom_codes(UriAtm,UriCodes), @@ -2071,18 +2070,6 @@ Status = [Error] ). -get_coder_prefixdef(PrefixAtom,PrefixDef) :- - flora_concat_atoms(['flora_prefix_',PrefixAtom],Prefix1), - flora_coder_prefixdef(Prefix1,PrefixDef). -get_shell_prefixdef(WS,PrefixAtom,PrefixDef) :- - flora_concat_atoms(['flora_prefix_',PrefixAtom],Prefix1), - flora_shell_prefixdef(WS,Prefix1,PrefixDef). -set_coder_prefixdef(PrefixAtom,Value) :- - flora_concat_atoms(['flora_prefix_',PrefixAtom],Prefix1), - assert(flora_coder_prefixdef(Prefix1,Value)). -clear_coder_prefixdef(PrefixAtom) :- - flora_concat_atoms(['flora_prefix_',PrefixAtom],Prefix1), - retractall(flora_coder_prefixdef(Prefix1,_)). %% Term can be a variable (unbound), if this is called from build_* %% or it is a bound parsed datatype obj Index: flrcoder.H =================================================================== RCS file: /cvsroot/flora/flora2/flrcoder.H,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- flrcoder.H 28 Mar 2007 01:37:51 -0000 1.21 +++ flrcoder.H 28 Mar 2007 22:11:28 -0000 1.22 @@ -24,6 +24,9 @@ ** */ +:- compiler_options([xpp_on]). + +#include "flora_terms.flh" :- import format/2 from format. @@ -50,14 +53,16 @@ %% Undefinedness support :- dynamic using_debug_prefix(_). -:- import - flora_coder_prefixdef/2, - flora_shell_prefixdef/3 - from flrregistry. - :- import flora_parse_datatype/4 from flrdatatype_parse. :- import flora_canonical_type_name/2 from flrdatatype. +:- import + flora_runtime_uriprefix_expansion/3, + flora_compiletime_uriprefix_expansion/2, + flora_clear_compiletime_uriprefixes/0, + FLLIBPREFIXDEF/2 + from flrprefixdef. + :- export flora_divide_program/3, flora_extern_code/2, Index: flrshell.P =================================================================== RCS file: /cvsroot/flora/flora2/flrshell.P,v retrieving revision 1.30 retrieving revision 1.31 diff -u -d -r1.30 -r1.31 --- flrshell.P 6 Feb 2007 15:17:42 -0000 1.30 +++ flrshell.P 28 Mar 2007 22:11:27 -0000 1.31 @@ -142,6 +142,7 @@ '_all', '_chatter', flora_set_counter(flora_shell_loaded,1), + flora_clear_runtime_uriprefixes, %% just a precaution !. Index: flrshell.H =================================================================== RCS file: /cvsroot/flora/flora2/flrshell.H,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- flrshell.H 6 Feb 2007 15:17:42 -0000 1.14 +++ flrshell.H 28 Mar 2007 22:11:27 -0000 1.15 @@ -77,6 +77,8 @@ :- import flora_shreset_arguments/0 from flrarguments. +:- import flora_clear_runtime_uriprefixes/0 from flrprefixdef. + %%:- import flora_shreset_prolog/0 from flrprolog. :- import |
|
From: Michael K. <ki...@us...> - 2007-03-28 22:11:29
|
Update of /cvsroot/flora/flora2/docs In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv2790/docs Modified Files: flora2.tex Log Message: added builtin uri prefixes xsd, owl, rdf, rdfs Modified java interface so toString() would use flora_decode_oid_as_atom and thus display answers correctly. Index: flora2.tex =================================================================== RCS file: /cvsroot/flora/flora2/docs/flora2.tex,v retrieving revision 1.170 retrieving revision 1.171 diff -u -d -r1.170 -r1.171 --- flora2.tex 28 Mar 2007 01:37:49 -0000 1.170 +++ flora2.tex 28 Mar 2007 22:11:24 -0000 1.171 @@ -7134,34 +7134,60 @@ catch\{...\}} primitive are also specified as Prolog terms. he primitive takes care of the Prolog-to-HiLog conversion automatically. -\section{Data Types}\label{sec-data-types} +\section{Primitive Data Types}\label{sec-data-types} An extensive data type support is being planned for \FLORA in the future. At present, apart from the built-in \emph{integer}, \emph{real}, and \emph{string} data types, the only other supported data types are {\tt - \_uri}, (universal resource identifier), {\tt \_time}, and {\tt \_dateTime}. + \_uri}, (universal resource identifier), {\tt \_time}, {\tt \_date}, and +{\tt \_dateTime}. -\subsection{URI Data Type}\label{sec-uri} +Following the now accepted practice on the Semantic Web, \FLORA denotes the +constants that belong to a particular primitive data type using the idiom +{\tt "\emph{literal}"$\hat{~}\hat{~}$\emph{type}}. The \emph{literal} part represents +the value of the constant and the \emph{type} part is the type. For +instance, {\tt "2004-12-24"$\hat{~}\hat{~}$\_date}, {\tt + "2004-12-24T15:33:44"$\hat{~}\hat{~}$\_dateTime}. +The type can be any atom. Typically types are alphanumeric atoms, like the +builtin types {\tt \_dateTime}, or URIs, like +'http://www.w3.org/2001/XMLSchema\#dateTime'. In fact, many of the builtin +primitive types in \FLORA correspond to XML Schema primitive data types +and are synonymous with them. For instance, {\tt \_dateTime} is synonymous with +'http://www.w3.org/2001/XMLSchema\#dateTime'. -URIs can come in the usual full form or in an abbreviated form -known as \emph{sQName} (serialized qualified name) or \emph{curi} -form (compact URI). +Some primitive types have shorthand notation. For instance, The canonical +representation for a URI object {\tt http://foo@bar/moo} is +{\tt "http://foo@bar/moo"$\hat{~}\hat{~}$\_uri}, but its shorthand notation is +{\tt \_"http://foo@bar/moo"}. -A \emph{full URI} is a sequence of characters enclosed between \_ and the -double quotes. For instance, {\tt \_"http://w3.org/"}. The string inside -the double quotes is supposed to be a syntactically valid URI. +Variables can be \emph{typed}, i.e., restricted to be bound only to +objects of a particular primitive data type. The notation is +{\tt ?\emph{variablename}$\hat{~}\hat{~}$\emph{typename}}. +For instance, the variable {\tt ?X$\hat{~}\hat{~}$\_time} +can be bound only to constants that have the primitive types {\tt \_time}. -An \emph{sQName} or a \emph{compact form} of a URI (curi) consists of a +\subsection{The \_uri Data Type}\label{sec-uri} + +The canonical representation of the constants of type URI is +{\tt "\emph{some uri}"$\hat{~}\hat{~}$\_uri}, where \emph{literal} must have +a lexical form corresponding to URIs on the WWW. URIs have shorthand notation +{\tt \_"\emph{some uri}"}, as mentioned before. + + +URIs can come in the usual full form or in an abbreviated form +known as a \emph{curi} form (for \emph{compact URI}). + +An a \emph{compact form} of a URI (curi) consists of a prefix and a local-name as follows: \emph{PREFIXNAME\#LOCALNAME}. Here \emph{PREFIXNAME} is an alphanumeric identifier that must be defined as a shortcut for a URI elsewhere (see below). \emph{LOCALNAME} can be a string, an alphanumeric identifier, or a quoted atom. (If \emph{LOCALNAME} contains non-alphanumeric symbols, it must be enclosed in double quotes as in {\tt - "ab\%20"}.) An sQName is treated as a macro that expands into a full URI + "ab\%20"}.) A compact URI is treated as a macro that expands into a full URI by concatenating the expansion of \emph{PREFIXNAME} with LOCALNAME. -The prefix of an sQName must be defined as follows: +The prefix of a compact URI must be defined as follows: %% \begin{verbatim} :- uriprefix PREFIXNAME = PREFIXURI. @@ -7231,6 +7257,26 @@ will be {\tt D}. Note that a reference to {\tt W3\#...} in a module where the prefix {\tt W3} is not defined will result in an error. +For convenience, some URI prefixes are predefined: +%% +\begin{verbatim} +xsd 'http://www.w3.org/2001/XMLSchema#' +rdf 'http://www.w3.org/1999/02/22-rdf-syntax-ns#' +rdfs 'http://www.w3.org/2000/01/rdf-schema#' +owl 'http://www.w3.org/2002/07/owl#' +\end{verbatim} +%% +However, one can always override these builtin definitions using either a +compile time directive {\tt uriprefix} or a runtime query {\tt uriprefix}. + +\subsection{ The Primitive Type \_date} + +\subsection{ The Primitive Type \_time} + +\subsection{ The Primitive Type \_dateTime} + +\subsection{ The Primitive Type \_duration} + \section{Debugging User Programs}\label{sec-debugging} |
|
From: Michael K. <ki...@us...> - 2007-03-28 22:11:28
|
Update of /cvsroot/flora/flora2/closure In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv2790/closure Modified Files: flrtypes.fli Log Message: added builtin uri prefixes xsd, owl, rdf, rdfs Modified java interface so toString() would use flora_decode_oid_as_atom and thus display answers correctly. Index: flrtypes.fli =================================================================== RCS file: /cvsroot/flora/flora2/closure/flrtypes.fli,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- flrtypes.fli 24 Feb 2007 19:04:22 -0000 1.20 +++ flrtypes.fli 28 Mar 2007 22:11:27 -0000 1.21 @@ -10,13 +10,16 @@ %% We don't want the silent isa relationships to be shown by the debugger -silent_isa(X,FL_LONG,_Caller) :- integer(X). +silent_isa(X,FL_INTEGER,_Caller) :- integer(X). +silent_isa(X,FL_INTEGER,_Caller) :- X = FL_DATATYPE(_,FL_INTEGER). silent_isa(X,FL_LONG,_Caller) :- X = FL_DATATYPE(_,FL_LONG). -silent_isa(X,FL_INTEGER,_Caller) :- silent_isa(X,FL_LONG,_Caller). +silent_isa(X,FL_LONG,_Caller) :- silent_isa(X,FL_INTEGER,_Caller). -silent_isa(X,FL_DOUBLE,_Caller) :- float(X). +silent_isa(X,FL_FLOAT,_Caller) :- float(X). +silent_isa(X,FL_FLOAT,_Caller) :- X = FL_DATATYPE(_,FL_FLOAT). silent_isa(X,FL_DOUBLE,_Caller) :- X = FL_DATATYPE(_,FL_DOUBLE). -silent_isa(X,FL_FLOAT,_Caller) :- silent_isa(X,FL_DOUBLE,_Caller). +silent_isa(X,FL_DECIMAL,_Caller) :- X = FL_DATATYPE(_,FL_DECIMAL). +silent_isa(X,FL_DOUBLE,_Caller) :- silent_isa(X,FL_FLOAT,_Caller). silent_isa(X,FL_DECIMAL,_Caller) :- silent_isa(X,FL_DOUBLE,_Caller). %% number = integer \/ float |
|
From: Michael K. <ki...@us...> - 2007-03-28 10:44:07
|
Update of /cvsroot/flora/flora2-visualizer In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv23993 Added Files: .cvsignore Log Message: --- NEW FILE: .cvsignore --- .metadata |
|
From: Michael K. <ki...@us...> - 2007-03-28 10:36:52
|
Update of /cvsroot/flora/flora2-visualizer/net.sourceforge.flora.eclipse.texteditor In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv21045/net.sourceforge.flora.eclipse.texteditor Modified Files: .cvsignore Log Message: Index: .cvsignore =================================================================== RCS file: /cvsroot/flora/flora2-visualizer/net.sourceforge.flora.eclipse.texteditor/.cvsignore,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- .cvsignore 23 Mar 2007 09:57:20 -0000 1.1 +++ .cvsignore 28 Mar 2007 10:36:19 -0000 1.2 @@ -1 +1,2 @@ -*.class \ No newline at end of file +*.class +bin |
|
From: Michael K. <ki...@us...> - 2007-03-28 10:36:52
|
Update of /cvsroot/flora/flora2-visualizer/net.sourceforge.flora.eclipse.visualizer In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv21045/net.sourceforge.flora.eclipse.visualizer Modified Files: .cvsignore Log Message: Index: .cvsignore =================================================================== RCS file: /cvsroot/flora/flora2-visualizer/net.sourceforge.flora.eclipse.visualizer/.cvsignore,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- .cvsignore 23 Mar 2007 09:57:29 -0000 1.1 +++ .cvsignore 28 Mar 2007 10:36:18 -0000 1.2 @@ -1 +1,2 @@ -*.class \ No newline at end of file +*.class +bin |
|
From: Michael K. <ki...@us...> - 2007-03-28 10:36:52
|
Update of /cvsroot/flora/flora2-visualizer/net.sourceforge.flora.eclipse In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv21045/net.sourceforge.flora.eclipse Modified Files: .cvsignore Log Message: Index: .cvsignore =================================================================== RCS file: /cvsroot/flora/flora2-visualizer/net.sourceforge.flora.eclipse/.cvsignore,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- .cvsignore 23 Mar 2007 09:56:31 -0000 1.1 +++ .cvsignore 28 Mar 2007 10:36:18 -0000 1.2 @@ -1 +1,2 @@ -*.class \ No newline at end of file +*.class +bin |
|
From: Michael K. <ki...@us...> - 2007-03-28 10:36:30
|
Update of /cvsroot/flora/flora2-visualizer/net.sourceforge.flora.eclipse.libHolder In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv21045/net.sourceforge.flora.eclipse.libHolder Modified Files: .cvsignore Log Message: Index: .cvsignore =================================================================== RCS file: /cvsroot/flora/flora2-visualizer/net.sourceforge.flora.eclipse.libHolder/.cvsignore,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- .cvsignore 23 Mar 2007 09:57:00 -0000 1.1 +++ .cvsignore 28 Mar 2007 10:36:21 -0000 1.2 @@ -1 +1,2 @@ -*.class \ No newline at end of file +*.class +bin |
|
From: Michael K. <ki...@us...> - 2007-03-28 10:36:30
|
Update of /cvsroot/flora/flora2-visualizer/net.sourceforge.flora.eclipse.module In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv21045/net.sourceforge.flora.eclipse.module Modified Files: .cvsignore Log Message: Index: .cvsignore =================================================================== RCS file: /cvsroot/flora/flora2-visualizer/net.sourceforge.flora.eclipse.module/.cvsignore,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- .cvsignore 23 Mar 2007 09:58:14 -0000 1.1 +++ .cvsignore 28 Mar 2007 10:36:19 -0000 1.2 @@ -1 +1,2 @@ -*.class \ No newline at end of file +*.class +bin |
|
From: Michael K. <ki...@us...> - 2007-03-28 10:36:30
|
Update of /cvsroot/flora/flora2-visualizer/net.sourceforge.flora.eclipse.console In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv21045/net.sourceforge.flora.eclipse.console Modified Files: .cvsignore Log Message: Index: .cvsignore =================================================================== RCS file: /cvsroot/flora/flora2-visualizer/net.sourceforge.flora.eclipse.console/.cvsignore,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- .cvsignore 23 Mar 2007 09:56:43 -0000 1.1 +++ .cvsignore 28 Mar 2007 10:36:22 -0000 1.2 @@ -1 +1,2 @@ -*.class \ No newline at end of file +*.class +bin |
|
From: Michael K. <ki...@us...> - 2007-03-28 10:34:55
|
Update of /cvsroot/flora/flora2-visualizer/net.sourceforge.flora.eclipse.reasoner In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv20258/net.sourceforge.flora.eclipse.reasoner Modified Files: .cvsignore Log Message: Index: .cvsignore =================================================================== RCS file: /cvsroot/flora/flora2-visualizer/net.sourceforge.flora.eclipse.reasoner/.cvsignore,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- .cvsignore 23 Mar 2007 09:51:33 -0000 1.1 +++ .cvsignore 28 Mar 2007 10:34:50 -0000 1.2 @@ -3,4 +3,5 @@ *.flh *.fld *.P -*.xwam \ No newline at end of file +*.xwam +bin |
|
From: Michael K. <ki...@us...> - 2007-03-28 10:34:26
|
Update of /cvsroot/flora/flora2-visualizer/net.sourceforge.flora.eclipse.reasoner/flr In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv20237/net.sourceforge.flora.eclipse.reasoner/flr Added Files: .cvsignore Log Message: --- NEW FILE: .cvsignore --- *.class *.fdb *.flh *.fld *.P *.xwam |
|
From: Daniel W. <dan...@us...> - 2007-03-28 09:34:48
|
Update of /cvsroot/flora/flora2-visualizer/net.sourceforge.flora.eclipse.texteditor/src/net/sourceforge/flora/eclipse/texteditor/format/elements In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv29893/src/net/sourceforge/flora/eclipse/texteditor/format/elements Added Files: FloraCommentToken.java FloraSourceToken.java FloraToken.java FloraWhitespaceToken.java FloraSourceText.java FloraStringToken.java Log Message: changed the source formatter --- NEW FILE: FloraCommentToken.java --- package net.sourceforge.flora.eclipse.texteditor.format.elements; public class FloraCommentToken extends FloraToken { public FloraCommentToken(String text) { setText(text); } } --- NEW FILE: FloraWhitespaceToken.java --- package net.sourceforge.flora.eclipse.texteditor.format.elements; import net.sourceforge.flora.eclipse.texteditor.format.FloraDocumentFormatter; public class FloraWhitespaceToken extends FloraToken { public FloraWhitespaceToken(String text) { setText(text); } public boolean hasNewline() { if (getText().indexOf("\n") >= 0) return true; if (getText().indexOf("\r") >= 0) return true; return false; } public String getTrimmedText() { if (hasNewline()) { StringBuffer out = new StringBuffer(); for (char c : getText().toCharArray()) if (FloraDocumentFormatter.isLineDelimiterChar(c)) out.append(c); return out.toString(); } else return " "; } } --- NEW FILE: FloraSourceText.java --- package net.sourceforge.flora.eclipse.texteditor.format.elements; import java.util.ArrayList; import net.sourceforge.flora.eclipse.texteditor.format.FloraIndentationHandler; public class FloraSourceText { public ArrayList<FloraToken> text; protected FloraIndentationHandler indentationHandler; public FloraSourceText() { text = new ArrayList<FloraToken>(); indentationHandler = new FloraIndentationHandler(); } public void addToken(FloraToken token) { if (token.getText().length() > 0) text.add(token); } public String getText() { adjustWhitespaces(); StringBuffer buffer = new StringBuffer(); for (FloraToken token : text) buffer.append(token.toString()); return buffer.toString(); } public void adjustWhitespaces() { indentationHandler = new FloraIndentationHandler(); StringBuffer lineBuffer = new StringBuffer(); FloraToken predecessorToken = null; FloraToken currentToken = null; FloraToken successorToken = null; int lookAhead = 0; for (int i = 0; i < text.size(); ++i) { predecessorToken = currentToken; currentToken = successorToken; successorToken = text.get(i); if (currentToken != null) { if (currentToken instanceof FloraSourceToken) { if (i > lookAhead) indentationHandler.handle(currentToken.getText(), lineBuffer, successorToken == null ? false : (successorToken instanceof FloraWhitespaceToken ? ((FloraWhitespaceToken) successorToken).hasNewline() : false)); lineBuffer.append(currentToken.getText()); } else if (currentToken instanceof FloraWhitespaceToken) { FloraWhitespaceToken whitespaceToken = (FloraWhitespaceToken) currentToken; if (successorToken instanceof FloraCommentToken) { // buffer.append(whitespaceToken.getText()); } else { if (whitespaceToken.hasNewline()) { lineBuffer = new StringBuffer(); // look ahead (handle following decreasers) FloraToken test; for (int j = i; j < text.size(); ++j) { test = text.get(j); if (test instanceof FloraSourceToken) { FloraSourceToken floraSourceToken = (FloraSourceToken) test; if (indentationHandler.isDecreaser(floraSourceToken.getText())) { indentationHandler.handle(floraSourceToken.getText(), new StringBuffer(), false); lookAhead = j; } else break; } else if (test instanceof FloraWhitespaceToken) { FloraWhitespaceToken floraWhitespaceToken = (FloraWhitespaceToken) test; if (floraWhitespaceToken.hasNewline()) break; } else { break; } } whitespaceToken.setText(whitespaceToken.getTrimmedText() + indentationHandler.getIndentation()); lineBuffer.append(indentationHandler.getIndentation()); } else { boolean whitespace = true; if (predecessorToken != null) { if (predecessorToken instanceof FloraSourceToken) { FloraSourceToken pred = (FloraSourceToken) predecessorToken; if (!pred.hasSucceedingWhitespace()) { whitespace = false; } } } if (successorToken != null) { if (successorToken instanceof FloraSourceToken) { FloraSourceToken succ = (FloraSourceToken) successorToken; if (succ.hasPredeceedingWhitespace()) { whitespace = false; } } } if (whitespace) whitespaceToken.setText(whitespaceToken.getTrimmedText()); else whitespaceToken.setText(""); lineBuffer.append(whitespaceToken.getText()); } } } else { lineBuffer.append(currentToken.getText()); } } } } public String toString() { return getText(); } public String getIndentation() { FloraIndentationHandler tempHandler = new FloraIndentationHandler(); StringBuffer lineBuffer = new StringBuffer(); FloraToken currentToken = null; FloraToken successorToken = null; for (int i = 0; i < text.size(); ++i) { currentToken = successorToken; successorToken = text.get(i); if (currentToken != null) { if (currentToken instanceof FloraSourceToken) tempHandler.handle(currentToken.getText(), lineBuffer, successorToken == null ? false : (successorToken instanceof FloraWhitespaceToken ? ((FloraWhitespaceToken) successorToken).hasNewline() : false)); lineBuffer.append(currentToken.getText()); } } return tempHandler.getIndentation(); } public FloraIndentationHandler getIndentationHandler() { return indentationHandler; } } --- NEW FILE: FloraStringToken.java --- package net.sourceforge.flora.eclipse.texteditor.format.elements; public class FloraStringToken extends FloraToken { public FloraStringToken(String text) { setText(text); } } --- NEW FILE: FloraSourceToken.java --- package net.sourceforge.flora.eclipse.texteditor.format.elements; import net.sourceforge.flora.eclipse.FloraKeywords; public class FloraSourceToken extends FloraToken { public FloraSourceToken(String text) { setText(text); } public boolean hasPredeceedingWhitespace() { if (getText().equals(FloraKeywords.COMMA)) return false; if (getText().equals(FloraKeywords.DOT)) return false; if (getText().equals(FloraKeywords.SEMICOLON)) return false; if (getText().equals(FloraKeywords.SQUARE_BRACKET_CLOSE)) return false; if (getText().equals(FloraKeywords.SQUARE_BRACKET_OPEN)) return false; if (getText().equals(FloraKeywords.PARENTHESIS_CLOSE)) return false; if (getText().equals(FloraKeywords.PARENTHESIS_OPEN)) return false; if (getText().equals(FloraKeywords.CURLY_BRACKET_OPEN)) return false; if (getText().equals(FloraKeywords.CURLY_BRACKET_CLOSE)) return false; if (getText().equals(FloraKeywords.COLON)) return false; if (getText().equals(FloraKeywords.DOUBLE_COLON)) return false; if (getText().equals(FloraKeywords.EQUALITY)) return false; if (getText().equals(FloraKeywords.AT)) return false; for (String arrow : FloraKeywords.getValueReferenceConectives()) if (getText().equals(arrow)) return false; return true; } public boolean hasSucceedingWhitespace() { if (getText().equals(FloraKeywords.SQUARE_BRACKET_OPEN)) return false; if (getText().equals(FloraKeywords.PARENTHESIS_OPEN)) return false; if (getText().equals(FloraKeywords.CURLY_BRACKET_OPEN)) return false; if (getText().equals(FloraKeywords.COLON)) return false; if (getText().equals(FloraKeywords.DOUBLE_COLON)) return false; if (getText().equals(FloraKeywords.EQUALITY)) return false; if (getText().equals(FloraKeywords.PERCENT)) return false; if (getText().equals(FloraKeywords.HASH)) return false; if (getText().equals(FloraKeywords.UNDERSCORE_HASH)) return false; if (getText().equals(FloraKeywords.AT)) return false; for (String arrow : FloraKeywords.getValueReferenceConectives()) if (getText().equals(arrow)) return false; return true; } } --- NEW FILE: FloraToken.java --- package net.sourceforge.flora.eclipse.texteditor.format.elements; public abstract class FloraToken { private String text = ""; public String getText() { return text; } public void setText(String text) { this.text = text; } public String toString() { return getText(); } } |
|
From: Daniel W. <dan...@us...> - 2007-03-28 09:34:48
|
Update of /cvsroot/flora/flora2-visualizer/net.sourceforge.flora.eclipse.texteditor/src/net/sourceforge/flora/eclipse/texteditor/format In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv29893/src/net/sourceforge/flora/eclipse/texteditor/format Modified Files: FloraAutoIndentStrategy.java FloraDocumentFormatter.java FloraIndentationHandler.java Added Files: FloraLexer.java Removed Files: ModelReaderFactory.java FloraReader.java Log Message: changed the source formatter Index: FloraIndentationHandler.java =================================================================== RCS file: /cvsroot/flora/flora2-visualizer/net.sourceforge.flora.eclipse.texteditor/src/net/sourceforge/flora/eclipse/texteditor/format/FloraIndentationHandler.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- FloraIndentationHandler.java 26 Mar 2007 14:35:19 -0000 1.2 +++ FloraIndentationHandler.java 28 Mar 2007 09:34:31 -0000 1.3 @@ -33,16 +33,31 @@ indentations.push(new FloraIndentationModification(indentation, "", "")); } - public void handle(String word, StringBuffer buffer, boolean followedByNewline) { + public void handle(String token, StringBuffer buffer, boolean followedByNewline) { for (String inc : increasers) - if (word.contains(inc)) + if (token.contains(inc)) push(inc, buffer, followedByNewline); for (String dec : decreasers) - if (word.contains(dec)) + if (token.contains(dec)) pop(dec); } - + + public boolean isIncreaser(String token) { + for (String inc : increasers) + if (token.contains(inc)) + return true; + return false; + } + + public boolean isDecreaser(String token) { + for (String dec : decreasers) + if (token.contains(dec)) + return true; + return false; + } + + // TODO buffer is just a line!?! protected void push(String indentationIncreaser, StringBuffer buffer, boolean followedByNewline) { int indentation = 0; if (followedByNewline) { Index: FloraAutoIndentStrategy.java =================================================================== RCS file: /cvsroot/flora/flora2-visualizer/net.sourceforge.flora.eclipse.texteditor/src/net/sourceforge/flora/eclipse/texteditor/format/FloraAutoIndentStrategy.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- FloraAutoIndentStrategy.java 26 Mar 2007 14:35:19 -0000 1.2 +++ FloraAutoIndentStrategy.java 28 Mar 2007 09:34:31 -0000 1.3 @@ -4,6 +4,8 @@ import java.io.StringReader; import net.sourceforge.flora.eclipse.FloraKeywords; +import net.sourceforge.flora.eclipse.texteditor.format.elements.FloraSourceText; +import net.sourceforge.flora.eclipse.texteditor.format.elements.FloraSourceToken; import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.DefaultIndentLineAutoEditStrategy; @@ -52,7 +54,7 @@ return; } if ("\t".equals(command.text)) { - smartIndentTab(document, command); + smartIndentAfterTab(document, command); return; } super.customizeDocumentCommand(document, command); @@ -280,9 +282,13 @@ private int getWhitespaceEnd(IDocument document, int position) throws BadLocationException { int currentPosition = position; - char currentCharacter; + char currentCharacter = (char) -1; do { - currentCharacter = document.getChar(currentPosition); + if (currentPosition < document.getLength()) + currentCharacter = document.getChar(currentPosition); + else + return document.getLength(); + currentPosition++; if (currentCharacter == '\\') { // ignore escaped characters @@ -308,43 +314,34 @@ try { int p = (command.offset == docLength ? command.offset - 1 : command.offset); - int line = document.getLineOfOffset(p); + int line = document.getLineOfOffset(command.offset); StringBuffer buf = new StringBuffer(command.text); + char nextChar; + if (command.offset < docLength) + nextChar = document.getChar(command.offset); + else + nextChar = (char) -1; boolean followedByDecreaser = false; for (String decreaser : FloraIndentationHandler.decreasers) { - if (document.getChar(command.offset) == decreaser.charAt(0)) + if (nextChar == decreaser.charAt(0)) followedByDecreaser = true; } - if (command.offset < docLength && followedByDecreaser) { - - int end = command.offset; - int start = findStartOfCommand(document, line, end, 0); - String text = document.get(start, end - start); - FloraReader reader = new FloraReader(); - try { - reader.setReader(new StringReader(text), 0); - reader.getIndentationHandler().pop(Character.toString(document.getChar(command.offset))); - buf.append(reader.getIndentationHandler().getIndentation()); - } catch (IOException e) { - e.printStackTrace(); - } - - } else { - - int end = command.offset; - int start = findStartOfCommand(document, line, end, 0); - String text = document.get(start, end - start); - FloraReader reader = new FloraReader(); - try { - reader.setReader(new StringReader(text), 0); - buf.append(reader.getIndentationHandler().getIndentation()); - } catch (IOException e) { - e.printStackTrace(); - } + int end = command.offset; + int start = findStartOfCommand(document, line, p, 0); + String text = document.get(start, end - start); + FloraLexer lexer = new FloraLexer(new StringReader(text)); + FloraSourceText lexText = null; + try { + lexText = lexer.lex(); + if (followedByDecreaser) + lexText.addToken(new FloraSourceToken(Character.toString(nextChar))); + buf.append(lexText.getIndentation()); + } catch (IOException e) { } + command.text = buf.toString(); } catch (BadLocationException excp) { @@ -360,7 +357,7 @@ * @param command - * the command being performed */ - protected void smartIndentTab(IDocument document, DocumentCommand command) { + protected void smartIndentAfterTab(IDocument document, DocumentCommand command) { int docLength = document.getLength(); if (command.offset == -1 || docLength == 0) @@ -368,11 +365,15 @@ try { int p = (command.offset == docLength ? command.offset - 1 : command.offset); - int line = document.getLineOfOffset(p); + int line = document.getLineOfOffset(command.offset); int lineOffset = document.getLineOffset(line); - char nextChar = document.getChar(command.offset); + char nextChar; + if (command.offset < docLength) + nextChar = document.getChar(command.offset); + else + nextChar = (char) -1; - StringBuffer buf = new StringBuffer(/* command.text */); + StringBuffer buf = new StringBuffer(); // process indentation boolean followedByDecreaser = false; @@ -381,25 +382,25 @@ followedByDecreaser = true; } - int end = command.offset; - int start = findStartOfCommand(document, line, end, 0); - String text = document.get(start, end - start); - FloraReader reader = new FloraReader(); + int start = findStartOfCommand(document, line, p, 0); + String text = document.get(start, p - start); + FloraLexer lexer = new FloraLexer(new StringReader(text)); + FloraSourceText lexText = null; try { - reader.setReader(new StringReader(text), 0); - if (command.offset < docLength && followedByDecreaser) - reader.getIndentationHandler().pop(Character.toString(nextChar)); + lexText = lexer.lex(); + if (followedByDecreaser) + lexText.addToken(new FloraSourceToken(Character.toString(nextChar))); } catch (IOException e) { - e.printStackTrace(); } // if (charAt(command.offset) == (whitespace or EOF)) - if ((nextChar == (char) -1) || Character.isWhitespace(nextChar)) { + if ((nextChar == (char) -1) || FloraDocumentFormatter.isIndentChar(nextChar)) { // insert processed indentation - // TODO first trim denn calc and insert? command.offset = lineOffset; document.replace(lineOffset, getWhitespaceEnd(document, lineOffset) - lineOffset, ""); - buf.append(reader.getIndentationHandler().getIndentation()); + buf.append(lexText.getIndentation()); + } else if (FloraDocumentFormatter.isLineDelimiterChar(nextChar)) { + buf.append(command.text); } else { String indentation = getIndentOfLine(document, line); int currentIndentation = 0; @@ -407,30 +408,26 @@ if (c == ' ') currentIndentation += 1; else - currentIndentation += reader.getIndentationHandler().getTabSize(); + currentIndentation += lexText.getIndentationHandler().getTabSize(); int processedIndentation = 0; - for (char c : reader.getIndentationHandler().getIndentation().toCharArray()) + for (char c : lexText.getIndentation().toCharArray()) if (c == ' ') processedIndentation += 1; else - processedIndentation += reader.getIndentationHandler().getTabSize(); + processedIndentation += lexText.getIndentationHandler().getTabSize(); // if current indentation >= processed indentation if (currentIndentation >= processedIndentation) { // insert tab buf.append(command.text); - } - // else - else { - + } else {// else // insert processed indentation command.offset = lineOffset; document.replace(lineOffset, getWhitespaceEnd(document, lineOffset) - lineOffset, ""); - buf.append(reader.getIndentationHandler().getIndentation()); + buf.append(lexText.getIndentation()); } } - //TODO check empty line ?? command.text = buf.toString(); --- FloraReader.java DELETED --- --- NEW FILE: FloraLexer.java --- package net.sourceforge.flora.eclipse.texteditor.format; import java.io.IOException; import java.io.Reader; import net.sourceforge.flora.eclipse.FloraKeywords; import net.sourceforge.flora.eclipse.texteditor.format.elements.FloraCommentToken; import net.sourceforge.flora.eclipse.texteditor.format.elements.FloraSourceText; import net.sourceforge.flora.eclipse.texteditor.format.elements.FloraStringToken; import net.sourceforge.flora.eclipse.texteditor.format.elements.FloraSourceToken; import net.sourceforge.flora.eclipse.texteditor.format.elements.FloraWhitespaceToken; public class FloraLexer { protected Reader reader; public FloraLexer(Reader reader) { setReader(reader); } public void setReader(Reader reader) { this.reader = reader; } protected FloraSourceText lex() throws IOException { FloraSourceText text = new FloraSourceText(); while (reader.read() >= 0) { reader.reset(); if (testForComment()) { text.addToken(new FloraWhitespaceToken(readWhitespaceToken())); text.addToken(new FloraCommentToken(readComment())); } else if (testForString()) { text.addToken(new FloraWhitespaceToken(readWhitespaceToken())); text.addToken(new FloraStringToken(readString())); } else { text.addToken(new FloraWhitespaceToken(readWhitespaceToken())); text.addToken(new FloraSourceToken(readToken())); } reader.mark(0); } return text; } protected String readWhitespaceToken() throws IOException { StringBuffer whitespaces = new StringBuffer(); char c = (char) -1; int s; reader.mark(0); while ((s = reader.read()) >= 0) { c = (char) s; if (FloraDocumentFormatter.isWhitespace(c)) { whitespaces.append(c); } else { break; } reader.mark(0); } reader.reset(); return whitespaces.toString(); } protected String readString() throws IOException { char c; char quoteSign; boolean isEscaped = false; StringBuffer temp = new StringBuffer(); reader.mark(1); c = (char) reader.read(); if (!(Character.toString(c).equals(FloraKeywords.SINGLE_QUOTE) || Character.toString(c).equals(FloraKeywords.DOUBLE_QUOTE))) { reader.reset(); return ""; } quoteSign = c; temp.append(c); while ((c = (char) reader.read()) >= 0) { temp.append(c); if (c == '\\') { isEscaped = !isEscaped; } else if (isEscaped) { isEscaped = !isEscaped; } else if (c == quoteSign) { isEscaped = !isEscaped; reader.mark(0); char test = (char) reader.read(); reader.reset(); if (test == quoteSign) // double quote escape continue; else break; } } return temp.toString(); } protected String readComment() throws IOException { char c; StringBuffer buffer = new StringBuffer(); reader.mark(2); c = (char) reader.read(); buffer.append(c); if (c != '/') { reader.reset(); return ""; } c = (char) reader.read(); buffer.append(c); if (c == '/') { do { reader.mark(0); c = (char) reader.read(); if (!FloraDocumentFormatter.isLineDelimiterChar(c)) buffer.append(c); else { reader.reset(); break; } } while (c != (char) -1); } else if (c == '*') { do { reader.mark(0); c = (char) reader.read(); buffer.append(c); if (c == '/') if (buffer.toString().endsWith("*/")) break; } while (c != (char) -1); } else { reader.reset(); return ""; } return buffer.toString(); } protected String readToken() throws IOException { StringBuffer word = new StringBuffer(); char c; int s; reader.mark(0); while ((s = reader.read()) >= 0) { c = (char) s; if ((FloraDocumentFormatter.isWhitespace(c))) break; if ((word.length() > 0)) { if (FloraKeywords.isDelimiterPart(word.toString())) { if (!FloraKeywords.isDelimiterPart(word.toString() + c)) { break; } } else { if (FloraKeywords.isDelimiterStart(c)) break; } } word.append(c); reader.mark(0); } reader.reset(); return word.toString(); } protected boolean testForComment() throws IOException { boolean comment = false; char test; reader.mark(0); do { test = (char) reader.read(); } while (FloraDocumentFormatter.isWhitespace(test)); if (test == '/') { test = (char) reader.read(); if (test == '/') { comment = true; } else if (test == '*') { comment = true; } } reader.reset(); return comment; } protected boolean testForString() throws IOException { boolean comment = false; char test; reader.mark(0); do { test = (char) reader.read(); } while (FloraDocumentFormatter.isWhitespace(test)); if (test == '"') { comment = true; } else if (test == '\'') { comment = true; } reader.reset(); return comment; } } Index: FloraDocumentFormatter.java =================================================================== RCS file: /cvsroot/flora/flora2-visualizer/net.sourceforge.flora.eclipse.texteditor/src/net/sourceforge/flora/eclipse/texteditor/format/FloraDocumentFormatter.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- FloraDocumentFormatter.java 13 Mar 2007 22:47:26 -0000 1.1 +++ FloraDocumentFormatter.java 28 Mar 2007 09:34:31 -0000 1.2 @@ -56,8 +56,11 @@ private void copyNode(Reader stringReader, StringBuffer out) throws IOException { - FloraReader commandReader = ModelReaderFactory.createReaderFor(stringReader); - out.append(commandReader.getFormattedText()); +// FloraReader commandReader = ModelReaderFactory.createReaderFor(stringReader); +// out.append(commandReader.getFormattedText()); + + FloraLexer lexer = new FloraLexer(stringReader); + out.append(lexer.lex().toString()); } /** --- ModelReaderFactory.java DELETED --- |
|
From: Daniel W. <dan...@us...> - 2007-03-28 09:34:48
|
Update of /cvsroot/flora/flora2-visualizer/net.sourceforge.flora.eclipse/src/net/sourceforge/flora/eclipse In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv29878/src/net/sourceforge/flora/eclipse Modified Files: FloraKeywords.java Log Message: changed the source formatter Index: FloraKeywords.java =================================================================== RCS file: /cvsroot/flora/flora2-visualizer/net.sourceforge.flora.eclipse/src/net/sourceforge/flora/eclipse/FloraKeywords.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- FloraKeywords.java 13 Mar 2007 22:26:27 -0000 1.1 +++ FloraKeywords.java 28 Mar 2007 09:34:26 -0000 1.2 @@ -27,6 +27,7 @@ public static String PERCENT = "%"; public static String HASH = "#"; public static String UNDERSCORE_HASH = "_#"; + public static String AT = "@"; public static String ARROW = "->"; public static String STAR_ARROW = "*->"; @@ -114,7 +115,7 @@ /** * returns all Flora-Keywords * - * @return a ArrayList containing all Flora-Keywords + * @return an ArrayList containing all Flora-Keywords */ public static ArrayList<String> getFloraKeywords() { ArrayList<String> result = new ArrayList<String>(); @@ -142,7 +143,7 @@ /** * returns all System-Keywords * - * @return a ArrayList containing all System-Keywords + * @return an ArrayList containing all System-Keywords */ public static ArrayList<String> getSystemKeywords() { ArrayList<String> result = new ArrayList<String>(); @@ -188,7 +189,7 @@ * returns all Keywords. The returned value conains all Keywords * from {@link #getFloraKeywords()} and {@link #getSystemKeywords()} * - * @return a ArrayList containing all Keywords. + * @return an ArrayList containing all Keywords. */ public static ArrayList<String> getAllKeywords() { ArrayList<String> result = new ArrayList<String>(); @@ -200,7 +201,7 @@ /** * returns all Delimiters * - * @return a ArrayList containing all Delimiters + * @return an ArrayList containing all Delimiters */ public static ArrayList<String> getDelimiters() { ArrayList<String> result = new ArrayList<String>(); @@ -226,7 +227,7 @@ /** * returns all Signs * - * @return a ArrayList containing all Signs + * @return an ArrayList containing all Signs */ public static ArrayList<String> getSigns() { ArrayList<String> result = new ArrayList<String>(); @@ -243,7 +244,7 @@ /** * returns all Value-Reference-Conectives * - * @return a ArrayList containing all Value-Reference-Conectives + * @return an ArrayList containing all Value-Reference-Conectives */ public static ArrayList<String> getValueReferenceConectives() { ArrayList<String> result = new ArrayList<String>(); |
|
From: Daniel W. <dan...@us...> - 2007-03-28 09:34:48
|
Update of /cvsroot/flora/flora2-visualizer/net.sourceforge.flora.eclipse.texteditor/src/net/sourceforge/flora/eclipse/texteditor/editor/scanners In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv29893/src/net/sourceforge/flora/eclipse/texteditor/editor/scanners Modified Files: FloraCodeScanner.java Log Message: changed the source formatter Index: FloraCodeScanner.java =================================================================== RCS file: /cvsroot/flora/flora2-visualizer/net.sourceforge.flora.eclipse.texteditor/src/net/sourceforge/flora/eclipse/texteditor/editor/scanners/FloraCodeScanner.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- FloraCodeScanner.java 26 Mar 2007 08:35:23 -0000 1.2 +++ FloraCodeScanner.java 28 Mar 2007 09:34:32 -0000 1.3 @@ -79,6 +79,11 @@ } rules.add(wordRule); + // @ - Sign (must be befor signRule) + WordRule atSignRule = new WordRule(new AtSignDetector(), defaultToken); + atSignRule.addWord("@", atSignToken); + rules.add(atSignRule); + // Signs WordRule signRule = new WordRule(new SignDetector(), defaultToken); for (String keyword : FloraKeywords.getSigns()) { @@ -86,11 +91,6 @@ } rules.add(signRule); - // @ - Sign - WordRule atSignRule = new WordRule(new AtSignDetector(), defaultToken); - atSignRule.addWord("@", atSignToken); - rules.add(atSignRule); - setRules(rules.toArray(new IRule[] {})); } |
|
From: Daniel W. <dan...@us...> - 2007-03-28 09:34:47
|
Update of /cvsroot/flora/flora2-visualizer/net.sourceforge.flora.eclipse.texteditor/src/net/sourceforge/flora/eclipse/texteditor/format/elements In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv29856/src/net/sourceforge/flora/eclipse/texteditor/format/elements Log Message: Directory /cvsroot/flora/flora2-visualizer/net.sourceforge.flora.eclipse.texteditor/src/net/sourceforge/flora/eclipse/texteditor/format/elements added to the repository |
|
From: Michael K. <ki...@us...> - 2007-03-28 01:59:12
|
Update of /cvsroot/flora/flora2 In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv14365 Modified Files: flrparser.P Log Message: changed primitive data type syntax to conform to RIF and RDF Index: flrparser.P =================================================================== RCS file: /cvsroot/flora/flora2/flrparser.P,v retrieving revision 1.111 retrieving revision 1.112 diff -u -d -r1.111 -r1.112 --- flrparser.P 28 Mar 2007 01:37:50 -0000 1.111 +++ flrparser.P 28 Mar 2007 01:59:10 -0000 1.112 @@ -1206,7 +1206,7 @@ %% will fail and hence the second case. ( %% If TermCode is a list - append - %% Happens when exported like (t1,t2) >> (m1,m2,m3) + %% Happens when exported things like (t1,t2) >> (m1,m2,m3) append(TermCode,InitTermCode,List) ; @@ -1392,10 +1392,10 @@ When the same module exports the term, the variable WS will be NULL. Else, it may be an atom or a variable. ATOM: ?- (export foo)@bar. - VARIABLE: ?- (export foo)@WS. + VARIABLE: ?- (export foo)@?WS. In the latter case, the variable WS needs to be instantaited when the program is loaded else an error (Attempt to export from an invalid or - uninstantiated module/term.) will be reported. + uninstantiated module/term) will be reported. ****************************************************************************/ flora_export_parse_body_term(Term,WS,Code,Status) :- flora_body(Term,WS,WS,Code,Status). @@ -1411,7 +1411,7 @@ flora_comma_separated_list(CANOTERM(Funct,N,FL_PARENTHESIS,Args,If,Ip),ModuleList), flora_pathexplist(ModuleList,NULL,OtherModuleList,Status). -%% general case, term>>m1,m2,m3...mn. Modules NOT enclosed within paranthesis. +%% general case, term>>m1,m2,m3...mn. Modules NOT enclosed within parentheses. flora_export_parse_modules(OtherModules,OtherModuleList,Status) :- %% the other module names flora_pathexplist(OtherModules,NULL,OtherModuleList,Status). @@ -2426,8 +2426,7 @@ %% Handle THIS MODULE specification, e.g., a[b->c]@ _@. flora_workspace(CanoniTerm,FLORAUSERMOD(ThisModToken),Status) :- %% When _@ is specified as a module, we treat it - %% syntactically as FLORAUSERMOD and not FLORASYSMOD - even - %% if _@ occurs in a system module. + %% as a user module even if _@ occurs in a system module. %% This is because _@ doesn't require us to notify flrlibman.P that a %% system module needs to be loaded. %% However, in case of a system module _@ gets substituted with |
|
From: Michael K. <ki...@us...> - 2007-03-28 01:38:20
|
Update of /cvsroot/flora/flora2/syslib In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv5565/syslib Modified Files: flrprefixdef.P flrdecode.P Log Message: changed primitive data type syntax to conform to RIF and RDF Index: flrprefixdef.P =================================================================== RCS file: /cvsroot/flora/flora2/syslib/flrprefixdef.P,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- flrprefixdef.P 19 Jun 2006 21:38:21 -0000 1.2 +++ flrprefixdef.P 28 Mar 2007 01:37:48 -0000 1.3 @@ -41,5 +41,5 @@ FLLIBPREFIXDEF(Mod,NameCode,BodyCode) :- flora_concat_atoms(['flora_prefix_',NameCode],PrefixCode), - (flora_shell_prefixdef(Mod,PrefixCode,_)->retract(flora_shell_prefixdef(Mod,PrefixCode,_));true), + retractall(flora_shell_prefixdef(Mod,PrefixCode,_)), assert(flora_shell_prefixdef(Mod,PrefixCode,BodyCode)). Index: flrdecode.P =================================================================== RCS file: /cvsroot/flora/flora2/syslib/flrdecode.P,v retrieving revision 1.50 retrieving revision 1.51 diff -u -d -r1.50 -r1.51 --- flrdecode.P 11 Mar 2007 23:19:14 -0000 1.50 +++ flrdecode.P 28 Mar 2007 01:37:48 -0000 1.51 @@ -789,10 +789,10 @@ %% data types decode_literal_internal(FL_DATATYPE(Term,Type), Code, _Level,_Depth) :- !, - (var(Term) -> Code = [Type, '?', Term] + (var(Term) -> Code = ['?', Term, FL_DATATYPE_CONNECTOR, Type] ; flora_printable_type_representation(Term,[TypeName,TypeLit]), - Code = [TypeName,'"',TypeLit,'"'] + Code = ['"',TypeLit,'"',FL_DATATYPE_CONNECTOR,TypeName] ). decode_literal_internal(FLLIBNEWMODULE(_ThisModule,NewModuleName), |
|
From: Michael K. <ki...@us...> - 2007-03-28 01:38:11
|
Update of /cvsroot/flora/flora2/docs In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv5565/docs Modified Files: flora2.tex Log Message: changed primitive data type syntax to conform to RIF and RDF Index: flora2.tex =================================================================== RCS file: /cvsroot/flora/flora2/docs/flora2.tex,v retrieving revision 1.169 retrieving revision 1.170 diff -u -d -r1.169 -r1.170 --- flora2.tex 22 Mar 2007 00:38:00 -0000 1.169 +++ flora2.tex 28 Mar 2007 01:37:49 -0000 1.170 @@ -558,8 +558,8 @@ pose queries and invoke methods for the objects defined in the program. There is an important special case of the {\tt \_load} and {\tt [...]} command -when the file name is {\tt \_\_} (two underscores). In that case, instead of looking for the -program file {\tt \_\_.flr}, \FLORA starts reading user input. At this +when the file name is {\tt .} (period). In that case, instead of looking for the +program file {\tt ..flr}, \FLORA starts reading user input. At this point, the user can start typing in program clauses, which the system saves in a temporary file. When the user is done and types the end of file character {\tt Control-D} (Unix) or {\tt Control-Z} (Windows), |