{"id":46,"date":"2016-06-26T15:57:29","date_gmt":"2016-06-26T14:57:29","guid":{"rendered":"http:\/\/reldb.org\/wordpress\/?page_id=46"},"modified":"2016-06-26T15:57:29","modified_gmt":"2016-06-26T14:57:29","slug":"architectural-overview","status":"publish","type":"page","link":"https:\/\/reldb.org\/c\/index.php\/read\/architectural-overview\/","title":{"rendered":"Architectural Overview"},"content":{"rendered":"<h1>Architectural Overview<\/h1>\n<p>The <i>Rel<\/i> server is constructed from several major components:<\/p>\n<ul>\n<li>A simple stack-based virtual machine, implemented in Java, which supports operator (function) definition and execution, simple expression evaluation, flow control, types, static type checking, and variables;<\/li>\n<li>Oracle&#8217;s (formerly SleepyCat Software&#8217;s) Java version of the Berkeley DB, used as a storage engine;<\/li>\n<li>The <i>Rel<\/i> kernel, which implements the relational algebra, interfaces with the storage engine, and compiles and executes <b>Tutorial D<\/b> constructs on the virtual machine.<\/li>\n<li>A language interpreter, which recognises <b>Tutorial D<\/b> syntax and interacts with the <i>Rel<\/i> kernel to process <b>Tutorial D<\/b> code and expressions and generate appropriate results. The language parser has been constructed using the JavaCC parser\/scanner generator, available at <a href=\"https:\/\/javacc.dev.java.net\/\">https:\/\/javacc.dev.java.net<\/a>. No other external tools, other than a Java compiler, are required to build <i>Rel<\/i>.<\/li>\n<li>A session and connection manager, which handles communication between clients and the language parser.<\/li>\n<\/ul>\n<p>A running <i>Rel<\/i> server listens on a communications channel (implemented as a socket) for incoming requests for connections from clients. Each new client connection establishes a new session inside the <i>Rel<\/i> engine. Each session is an independent entity, sharing only relvars with other running sessions.<\/p>\n<p>The simple DBrowser client bundled with <i>Rel<\/i> permits immediate evaluation of expressions on a <i>Rel<\/i> server. For example:<\/p>\n<blockquote>\n<pre><code>3 + 4\r\n<\/code><\/pre>\n<\/blockquote>\n<p>Produces the following result:<\/p>\n<blockquote>\n<pre><code>7\r\n<\/code><\/pre>\n<\/blockquote>\n<p>Responses generated by the <i>Rel<\/i> engine are presented using Tutorial D syntax where appropriate. For example, entering the following literal relation:<\/p>\n<blockquote>\n<pre><code>RELATION {TUPLE {x 1, y \"fish\"}, TUPLE {x 2, y \"zap\"}}\r\n<\/code><\/pre>\n<\/blockquote>\n<p>Produces the following response:<\/p>\n<blockquote>\n<pre><code>RELATION {x INTEGER, y CHAR} {\r\n\tTUPLE {x 1, y \"fish\"},\r\n\tTUPLE {x 2, y \"zap\"}}\r\n<\/code><\/pre>\n<\/blockquote>\n<p>Similarly, executing a relational expression:<\/p>\n<blockquote>\n<pre><code>RELATION {TUPLE {x 1}} UNION RELATION {TUPLE {x 2}}\r\n<\/code><\/pre>\n<\/blockquote>\n<p>Produces the following response:<\/p>\n<blockquote>\n<pre><code>RELATION {x INTEGER} {\r\n\tTUPLE {x 1},\r\n\tTUPLE {x 2}}\r\n<\/code><\/pre>\n<\/blockquote>\n<p>The use of <b>Tutorial D<\/b> syntax in responses is consistent and intuitive, and it means sophisticated clients may employ a parser based on a subset of the <b>Tutorial D<\/b> server grammar, rather than having to design and implement a separate result parser. In the future, this approach will be used to develop a client API that conforms to a JDBC (Java Data Base Connectivity) standard. This will allow <i>Rel<\/i> to be used by any Java application that supports JDBC, as long as the application does not require SQL syntax. Obviously, this may be extended to ODBC (Open Data Base Connectivity) as well.<\/p>\n<p>The use of the same syntax for data input and results also has value in an educational or development setting, as raw output from the server may be fed as input back into the server.<\/p>\n<p><i>Rel<\/i> recognises <b>Tutorial D<\/b> constructs as specified in The Third Manifesto, plus alternative syntax shown in Date&#8217;s &#8220;An Introduction to Database Systems,&#8221; except for syntax features that are not yet implemented and which are noted under &#8220;Current Limitations and Work in Progress,&#8221; below. For example, a real relvar may be defined either as:<\/p>\n<blockquote>\n<pre><code>VAR myRelVar REAL RELATION ...\r\n<\/code><\/pre>\n<\/blockquote>\n<p>&#8230;or&#8230;<\/p>\n<blockquote>\n<pre><code>VAR myRelVar BASE RELATION ...\r\n<\/code><\/pre>\n<\/blockquote>\n<p>The former is The Third Manifesto syntax, the latter is &#8220;An Introduction to Database Systems&#8221; syntax.<\/p>\n<p><i>Rel<\/i> is implemented as a <a href=\"http:\/\/java.sun.com\/\" target=\"_sunjava\">Java<\/a> application, and should run on any host that supports a J2SE 7.x platform. It has been extensively tested on Linux, Mac OS X and various versions of Microsoft Windows including Windows 8.1.<\/p>\n<p>Java was chosen for two reasons:<\/p>\n<ol>\n<li>It is cross platform, obviating the need to recompile for various platforms and environments.<\/li>\n<li>Java&#8217;s automated memory management allows development effort to focus on the problem domain without having to deal with hazardous materials, jagged edges, and unsafe working conditions such as memory leaks, pointers to deleted or freed objects, references vs. pointers, and object ownership issues &#8212; at least not to the same degree required with (for example) C and C++.<\/li>\n<\/ol>\n<p>The provided software distribution consists of two Java applications: a <i>Rel<\/i> database server and the interactive client called DBrowser. The DBrowser client sends user-entered Tutoral D code and expressions to the <i>Rel<\/i> server, which in turn parses and executes them and returns the results to DBrowser for display. <i>Rel<\/i> is multi-user, and will service multiple DBrowser sessions on the local host and other hosts via a network. For convenience, if there is no <i>Rel<\/i> server running when DBrowser is started, it will automatically start up a local <i>Rel<\/i> server. This eliminates the need to explicitly load a server before using the client.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Architectural Overview The Rel server is constructed from several major components: A simple stack-based virtual machine, implemented in Java, which supports operator (function) definition and execution, simple expression evaluation, flow control, types, static type checking, and variables; Oracle&#8217;s (formerly SleepyCat Software&#8217;s) Java version of the Berkeley DB, used as a storage engine; The Rel kernel, <a href=\"https:\/\/reldb.org\/c\/index.php\/read\/architectural-overview\/\" rel=\"nofollow\"><span class=\"sr-only\">Read more about Architectural Overview<\/span>[&hellip;]<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":17,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":"","_links_to":"","_links_to_target":""},"class_list":["post-46","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/reldb.org\/c\/index.php\/wp-json\/wp\/v2\/pages\/46","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/reldb.org\/c\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/reldb.org\/c\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/reldb.org\/c\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/reldb.org\/c\/index.php\/wp-json\/wp\/v2\/comments?post=46"}],"version-history":[{"count":1,"href":"https:\/\/reldb.org\/c\/index.php\/wp-json\/wp\/v2\/pages\/46\/revisions"}],"predecessor-version":[{"id":47,"href":"https:\/\/reldb.org\/c\/index.php\/wp-json\/wp\/v2\/pages\/46\/revisions\/47"}],"up":[{"embeddable":true,"href":"https:\/\/reldb.org\/c\/index.php\/wp-json\/wp\/v2\/pages\/17"}],"wp:attachment":[{"href":"https:\/\/reldb.org\/c\/index.php\/wp-json\/wp\/v2\/media?parent=46"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}