incubator-triplesoup-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From leosim...@apache.org
Subject svn commit: r509187 - in /incubator/triplesoup/code/trunk: modules/ modules/pysoup/ modules/pysoup/pysoup/ modules/pysoup/scripts/ tests/ tests/01-basic-self-test/
Date Mon, 19 Feb 2007 13:01:12 GMT
Author: leosimons
Date: Mon Feb 19 05:01:11 2007
New Revision: 509187

URL: http://svn.apache.org/viewvc?view=rev&rev=509187
Log:
Start on some tooling to allow setting up basic triplesoup tests.

 * modules/pysoup/: simple python scripts to allow basic remote RDF database
   management over HTTP and a SQL-like language.

 * tests/: simple bash-based integration testing framework. See README.txt.
 
 * test/s01-basic-self-test/: simple test of modules/pysoup/ demonstrating how
   those tools are meant to be used.


Added:
    incubator/triplesoup/code/trunk/modules/
    incubator/triplesoup/code/trunk/modules/pysoup/
    incubator/triplesoup/code/trunk/modules/pysoup/pysoup/
    incubator/triplesoup/code/trunk/modules/pysoup/pysoup/__init__.py   (with props)
    incubator/triplesoup/code/trunk/modules/pysoup/pysoup/client.py   (with props)
    incubator/triplesoup/code/trunk/modules/pysoup/pysoup/parser.py   (with props)
    incubator/triplesoup/code/trunk/modules/pysoup/scripts/
    incubator/triplesoup/code/trunk/modules/pysoup/scripts/admin.cgi   (with props)
    incubator/triplesoup/code/trunk/modules/pysoup/scripts/edit.cgi   (with props)
    incubator/triplesoup/code/trunk/modules/pysoup/scripts/get.cgi   (with props)
    incubator/triplesoup/code/trunk/tests/
    incubator/triplesoup/code/trunk/tests/01-basic-self-test/
    incubator/triplesoup/code/trunk/tests/01-basic-self-test/create-drop-load.tsql
    incubator/triplesoup/code/trunk/tests/01-basic-self-test/foaf.n3
    incubator/triplesoup/code/trunk/tests/01-basic-self-test/run.sh   (with props)
    incubator/triplesoup/code/trunk/tests/FIXTURE.txt   (with props)
    incubator/triplesoup/code/trunk/tests/README.txt   (with props)
    incubator/triplesoup/code/trunk/tests/run.sh   (with props)

Added: incubator/triplesoup/code/trunk/modules/pysoup/pysoup/__init__.py
URL: http://svn.apache.org/viewvc/incubator/triplesoup/code/trunk/modules/pysoup/pysoup/__init__.py?view=auto&rev=509187
==============================================================================
    (empty)

Propchange: incubator/triplesoup/code/trunk/modules/pysoup/pysoup/__init__.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/triplesoup/code/trunk/modules/pysoup/pysoup/__init__.py
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: incubator/triplesoup/code/trunk/modules/pysoup/pysoup/__init__.py
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/triplesoup/code/trunk/modules/pysoup/pysoup/client.py
URL: http://svn.apache.org/viewvc/incubator/triplesoup/code/trunk/modules/pysoup/pysoup/client.py?view=auto&rev=509187
==============================================================================
--- incubator/triplesoup/code/trunk/modules/pysoup/pysoup/client.py (added)
+++ incubator/triplesoup/code/trunk/modules/pysoup/pysoup/client.py Mon Feb 19 05:01:11 2007
@@ -0,0 +1,184 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+import httplib
+from pysoup import parser
+from HTMLParser import HTMLParser
+from urllib import quote
+import re
+
+class StripHTMLParser(HTMLParser):
+    def handle_data(self,data):
+        data=data.strip()
+        data=data.replace('\n\n', '\n')
+        data=data.replace('  ', ' ')
+        print data
+
+def print_error_response(response):
+    print "  Response:"
+    version = "HTTP/1.0"
+    if response.version == 11:
+        version = "HTTP/1.1"
+    print version, response.status, response.reason
+    for (header,value) in response.getheaders():
+        print "%s: %s" % (header,value)
+    print
+    p = StripHTMLParser()
+    p.feed(response.read())
+    p.close()
+
+class ErrorListener:
+    def error(self, statuscode, http_response):
+        pass
+
+class CommandHandler:
+    format="RDF/XML"
+    host="localhost"
+    debug_level=1
+    readpath="/pysoup/get.cgi"
+    editpath="/pysoup/edit.cgi"
+    adminpath="/pysoup/admin.cgi"
+    
+    def __init__(self,error_listener=ErrorListener()):
+        self.error_listener=error_listener
+    
+    def load_data(self,dbname,filename):
+        print 'LOAD DATA INFILE "%s" INTO DATABASE %s; /* host: %s */' % (filename, dbname,
self.host)
+        data=open(filename).read()
+        path="%s?dbname=%s&format=%s" % (self.editpath,quote(dbname),quote(self.format))
+        
+        conn = httplib.HTTPConnection(self.host)
+        try:
+            if self.debug_level > 2:
+                print "  Request:"
+                print "POST %s HTTP/1.0" % (path,)
+                print ""
+                print data
+            conn.request("POST", path, data)
+            response = conn.getresponse()
+            if response.status < 200 or response.status > 299:
+                self.error_listener.error(response.status, response)
+                if self.debug_level == 0:
+                    print "FAILED!"
+                if self.debug_level > 0:
+                    print "  An error occurred..."
+                    print "    Host:   %s" % self.host
+                    print "    Path:   %s" % path
+                    print "    DB:     %s" % dbname
+                    print "    Format: %s" % self.format
+                    print "    Data:   %s" % filename
+                if self.debug_level == 1:
+                    print "    Response:", response.status, response.reason
+                if self.debug_level > 1:
+                    print_error_response(response)
+        finally:
+            conn.close()
+        
+        
+    def create_database(self,dbname):
+        print 'CREATE RDF DATABASE %s; /* host: %s */' % (dbname, self.host)
+        path="%s?action=create_database&dbname=%s" % (self.adminpath,quote(dbname))
+        
+        conn = httplib.HTTPConnection(self.host)
+        try:
+            if self.debug_level > 2:
+                print "  Request:"
+                print "POST %s HTTP/1.0" % (path,)
+                print ""
+            conn.request("POST", path)
+            response = conn.getresponse()
+            if response.status < 200 or response.status > 299:
+                self.error_listener.error(response.status, response)
+                if self.debug_level == 0:
+                    print "FAILED!"
+                if self.debug_level > 0:
+                    print "  An error occurred..."
+                    print "    Host: %s" % self.host
+                    print "    Path: %s" % path
+                    print "    DB: %s" % dbname
+                if self.debug_level == 1:
+                    print "    Response:", response.status, response.reason
+                if self.debug_level > 1:
+                    print_error_response(response)
+            else:
+                print "Created database %s:%s" % (self.host,dbname)
+        finally:
+            conn.close()
+
+    def drop_database(self,dbname):
+        print 'DROP RDF DATABASE %s; /* host: %s */' % (dbname, self.host)
+        path="%s?action=drop_database&dbname=%s" % (self.adminpath,quote(dbname))
+        
+        conn = httplib.HTTPConnection(self.host)
+        try:
+            if self.debug_level > 2:
+                print "  Request:"
+                print "POST %s HTTP/1.0" % (path,)
+                print ""
+            conn.request("POST", path)
+            response = conn.getresponse()
+            if response.status < 200 or response.status > 299:
+                self.error_listener.error(response.status, response)
+                if self.debug_level == 0:
+                    print "FAILED!"
+                if self.debug_level > 0:
+                    print "  An error occurred..."
+                    print "    Host: %s" % self.host
+                    print "    Path: %s" % path
+                    print "    DB: %s" % dbname
+                if self.debug_level == 1:
+                    print "    Response:", response.status, response.reason
+                if self.debug_level > 1:
+                    print_error_response(response)
+            else:
+                print "Dropped database %s:%s" % (self.host,dbname)
+        finally:
+            conn.close()
+
+    def set_property(self,key,value):
+        print 'SET PROPERTY %s = "%s";' % (key, value)
+        if key == "rdf_format":
+            self.format=value
+        elif key == "host":
+            self.host=value
+        elif key == "debug_level":
+            debugno=int(value)
+            if debugno < 0 or debugno > 9:
+                raise "debug level should be between 0 and 9"
+            self.debug_level = debugno
+        else:
+            raise "unknown property %s" % (key,)
+
+def run_script(filename):
+    print 'Running script "%s"' % (filename,)
+    script=open(filename).read()
+    
+    class MyErrorListener(ErrorListener):
+        exit_status = 0
+        def error(self, responsecode, http_response):
+            self.exit_status = 1
+    
+    listener=MyErrorListener()
+    
+    parser.run(script, CommandHandler(listener))
+    return listener.exit_status
+
+if __name__=="__main__":
+    import sys
+    for script in sys.argv[1:]:
+        exit_status = run_script(script)
+        sys.exit(exit_status)
\ No newline at end of file

Propchange: incubator/triplesoup/code/trunk/modules/pysoup/pysoup/client.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/triplesoup/code/trunk/modules/pysoup/pysoup/client.py
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: incubator/triplesoup/code/trunk/modules/pysoup/pysoup/client.py
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/triplesoup/code/trunk/modules/pysoup/pysoup/parser.py
URL: http://svn.apache.org/viewvc/incubator/triplesoup/code/trunk/modules/pysoup/pysoup/parser.py?view=auto&rev=509187
==============================================================================
--- incubator/triplesoup/code/trunk/modules/pysoup/pysoup/parser.py (added)
+++ incubator/triplesoup/code/trunk/modules/pysoup/pysoup/parser.py Mon Feb 19 05:01:11 2007
@@ -0,0 +1,384 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+"""
+Silly example parser for a limited version of SQL-like RDF manipulation statements.
+
+Supported syntax:
+
+  CREATE RDF DATABASE <dbname>;
+  DROP RDF DATABASE <dbname>;
+  SET <property>=<value>;
+  /* c-style comments */
+  LOAD DATA INFILE <filename> INTO DATABASE <dbname>;
+
+with
+
+  <dbname>   matching [a-zA-Z][a-zA-Z0-9]{1,31}
+  <property> matching [^=]
+  <value>    matching .*
+
+and further
+
+  * support for quoting of <value> using double quotes ""
+    * escape a double quote using a backslash - \"
+    * escape a backslash using another backslash - \\
+    * can embed newlines and the like
+  * no support for nested c-style comments
+    * that means no */ _inside_ of the comment
+  * pretty tolerant of whitespace, newlines, and empty statements
+"""
+
+import re
+
+TS_NORMAL=0
+TS_QUOTED_STRING=1
+TS_C_STYLE_COMMENT=2
+
+T_QUOTED_STRING=0
+T_C_STYLE_COMMENT=1
+T_WORD=2
+T_END_OF_STATEMENT=3
+
+def tokenize(stream):
+    # generator to turn a string-like object (a character generator) into tokens
+    c      = None
+    prevC  = None
+    prevC2 = None
+    state  = TS_NORMAL
+    oldbuf = ""
+    buf    = ""
+    
+    #print """c, prevC, prevC2, state, buf"""
+    for c in stream:
+            #print "%s, %5s, %6s, %5s, %3s" % (c,prevC,prevC2,state,buf)
+            if state == TS_NORMAL:
+                if c == '"':
+                    if prevC=="/":
+                        raise "invalid rogue character /"
+                    # begin-of-quote
+                    # ...also acts as split-token-char
+                    if buf != "":
+                        # got a keyword
+                        yield (T_WORD, buf)
+                        buf   = ""
+                    else:
+                        # ignore-able whitespace
+                        pass
+                    state=TS_QUOTED_STRING
+                elif c =="*":
+                    # might be begin-of-comment
+                    if prevC == "/":
+                        # begin-of-comment
+                        # ...also acts as split-token-char
+                        buf=buf[:-1] # strip appended / of /*
+                        if buf != "":
+                            yield (T_WORD, buf)
+                            buf   = ""
+                        else:
+                            # ignore-able whitespace
+                            buf   = "" # still prepare for comment
+                        state=TS_C_STYLE_COMMENT
+                    else:
+                        # not begin-of-comment
+                        raise "invalid rogue character *"
+                elif c ==" " or c=="\t" or c=="\n":
+                    # split-token-char
+                    if buf != "":
+                        # got a keyword
+                        yield (T_WORD, buf)
+                        buf   = ""
+                    else:
+                        # ignore-able whitespace
+                        pass
+                elif c ==";":
+                    # end-of-statement
+                    # ...also acts as split-token-char
+                    if buf != "":
+                        # got a keyword
+                        yield (T_WORD, buf)
+                        buf   = ""
+                    else:
+                        # ignore-able whitespace
+                        pass
+                    yield (T_END_OF_STATEMENT,)
+                    buf = ""
+                else:
+                    # not special-case, so fill-up-token
+                    buf = buf + c
+                    
+            elif state == TS_QUOTED_STRING:
+                if c == "\\":
+                    if prevC == "\\":
+                        # two backslashes, eg, \\
+                        pass
+                    else:
+                        # just one backslash so far, eg \
+                        buf = buf + c
+                elif c == '"':
+                    # might be end-of-quote
+                    if prevC == "\\":
+                        # might be escaped
+                        if prevC2 == "\\":
+                            # two backslashes followed by quote, eg \\", so end-of-quote
+                            #assert buf.last == "\\"
+                            yield (T_QUOTED_STRING, buf)
+                            buf   = ""
+                            state = TS_NORMAL
+                        else:
+                            # backslash followed by quote, eg \"
+                            # not end-of-quote, so fill-up-quote
+                            buf = buf + c
+                    else:
+                        # not escaped, so end-of-quote
+                        yield (T_QUOTED_STRING, buf)
+                        buf   = ""
+                        state = TS_NORMAL
+                else:
+                    # not end-of-quote, so fill-up-quote
+                    buf = buf + c
+                    
+            elif state == TS_C_STYLE_COMMENT:
+                if c == "/":
+                    # might be end-of-comment
+                    if prevC == "*":
+                        # end-of-comment
+                        yield (T_C_STYLE_COMMENT, buf[:-1].strip()) # strip appended * of
*/, and strip beginning/trailing whitespace
+                        buf = ""
+                        state = TS_NORMAL
+                    else:
+                        # not end-of-comment, so fill-up-comment
+                        buf = buf + c
+                else:
+                    # not end-of-comment, so fill-up-comment
+                    buf = buf + c
+                    
+            else:
+                raise "invalid state"
+            
+            prevC2=prevC
+            prevC=c
+
+
+def normalize_equals_sign(tokens):
+    # generator to go from [a =] --> [a=]
+    #             and from [a =...] --> [a=...]
+    prev_token = None
+    last_token = None
+    for token in tokens:
+        last_token = token
+        if token[0] == T_WORD and token[1].startswith("="):
+            if not prev_token:
+                raise "illegal syntax: assigning ('=') to void"
+            if not prev_token[0] == T_WORD:
+                raise "illegal syntax: assigning to non-word"
+            if prev_token[1].endswith('='):
+                raise "illegal syntax: double assignment ('==')"
+                
+            prev_token = (prev_token[0], prev_token[1]+token[1])
+        else:
+            to_yield = prev_token
+            prev_token = token
+            if to_yield:
+                yield to_yield
+    yield last_token
+
+
+def normalize_tokens_assignment(tokens):
+    # generator to go from [foo=] [...] -> [foo=...]
+    prev_token = None
+    last_token = None
+    for token in tokens:
+        last_token = token
+        
+        if prev_token:
+            if prev_token[0] == T_WORD:
+                if prev_token[1].endswith("="):
+                    if token[0] == T_QUOTED_STRING or token[0] == T_WORD:
+                        prev_token = (prev_token[0], prev_token[1]+token[1])
+                        token = None
+                    else:
+                        raise "illegal syntax: assignment ('=') followed by %s" % (nexttoken)
+            to_yield = prev_token
+            prev_token = token
+            yield to_yield
+        else:
+            prev_token = token
+            
+    yield last_token
+
+
+def parse_statement(tokens, handler):
+    token = tokens.next()
+    while token[0] == T_C_STYLE_COMMENT or token[0] == T_END_OF_STATEMENT:
+        token = tokens.next()
+        
+    if token[0] != T_WORD:
+        raise "illegal syntax: statement must start with a word"
+    
+    if re.search("^SET$", token[1], re.I):
+        # handle SET <key> = <value>;
+        token = tokens.next()
+        if token[0] != T_WORD and token[0] != T_QUOTED_STRING:
+            raise "illegal syntax: statement must start with a word"
+        
+        result=re.search("^([^=]+)=(.*)", token[1], re.S).groups()
+        if not result:
+            raise "illegal syntax: SET must be followed by key = value"
+        (key,value)=result
+        
+        token = tokens.next()
+        if not token[0] == T_END_OF_STATEMENT:
+            raise "illegal syntax: SET statement missing terminating ';'"
+        
+        handler.set_property(key, value)
+    elif re.search("^CREATE$", token[1], re.I):
+        token = tokens.next()
+        if token[0] != T_WORD:
+            raise "illegal syntax: CREATE must be followed a word"
+        if re.search("^RDF$", token[1], re.I):
+            token = tokens.next()
+            if token[0] != T_WORD:
+                raise "illegal syntax: CREATE RDF must be followed a word"
+            if re.search("^DATABASE$", token[1], re.I):
+                # handle CREATE RDF DATABASE <name>;
+                token = tokens.next()
+                if token[0] != T_WORD and token[0] != T_QUOTED_STRING:
+                    raise "illegal syntax: CREATE RDF DATABASE must be followed by a database
name"
+                if not re.search("^[a-zA-Z][a-zA-Z0-9]{1,31}$", token[1], re.I):
+                    raise "illegal syntax: bad database name %s" % (token[1],)
+                dbname=token[1]
+                token = tokens.next()
+                if not token[0] == T_END_OF_STATEMENT:
+                    raise "illegal syntax: CREATE RDF DATABASE statement missing terminating
';'"
+                handler.create_database(dbname)
+            else:
+                raise "illegal syntax: don't know how to create %s" % (token[1],)
+        else:
+            raise "illegal syntax: don't know how to create %s" % (token[1],)
+    elif re.search("^DROP$", token[1], re.I):
+        token = tokens.next()
+        if token[0] != T_WORD:
+            raise "illegal syntax: DROP must be followed a word"
+        if re.search("^RDF$", token[1], re.I):
+            token = tokens.next()
+            if token[0] != T_WORD:
+                raise "illegal syntax: DROP RDF must be followed a word"
+            if re.search("^DATABASE$", token[1], re.I):
+                # handle CREATE RDF DATABASE <name>;
+                token = tokens.next()
+                if token[0] != T_WORD and token[0] != T_QUOTED_STRING:
+                    raise "illegal syntax: DROP RDF DATABASE must be followed by a database
name"
+                if not re.search("^[a-zA-Z][a-zA-Z0-9]{1,31}$", token[1], re.I):
+                    raise "illegal syntax: bad database name %s" % (token[1],)
+                dbname=token[1]
+                token = tokens.next()
+                if not token[0] == T_END_OF_STATEMENT:
+                    raise "illegal syntax: DROP RDF DATABASE statement missing terminating
';'"
+                handler.drop_database(dbname)
+            else:
+                raise "illegal syntax: don't know how to drop %s" % (token[1],)
+        else:
+            raise "illegal syntax: don't know how to drop %s" % (token[1],)
+    elif re.search("^LOAD$", token[1], re.I):
+        token = tokens.next()
+        if not re.search("^DATA$", token[1], re.I):
+            raise "illegal syntax: LOAD must be followed by DATA"
+        token = tokens.next()
+        if not re.search("^INFILE$", token[1], re.I):    
+            raise "illegal syntax: LOAD DATA must be followed by INFILE"
+        
+        token = tokens.next()
+        if token[0] != T_WORD and token[0] != T_QUOTED_STRING:
+            raise "illegal syntax: LOAD DATA INFILE must be followed by a file name"
+        filename=token[1]
+        
+        token = tokens.next()
+        if token[0] != T_WORD or not re.search("^INTO$", token[1], re.I):
+            raise "illegal syntax: LOAD DATA INFILE <filename> must be followed by
INTO"
+        token = tokens.next()
+        if token[0] != T_WORD or not re.search("^DATABASE$", token[1], re.I):
+            raise "illegal syntax: LOAD DATA INFILE <filename> INTO must be followed
by DATABASE"
+        
+        token = tokens.next()
+        if token[0] != T_WORD and token[0] != T_QUOTED_STRING:
+            raise "illegal syntax: LOAD DATA INFILE <filename> INTO DATABASE must be
followed by database name"
+        if not re.search("^[a-zA-Z][a-zA-Z0-9]{1,31}$", token[1], re.I):
+            raise "illegal syntax: bad database name %s" % (token[1],)
+        dbname=token[1]
+                
+        token = tokens.next()
+        if not token[0] == T_END_OF_STATEMENT:
+            raise "illegal syntax: LOAD DATA INFILE statement missing terminating ';'"
+        
+        handler.load_data(dbname, filename)
+    else:
+        raise "illegal syntax: don't know how to %s" % (token[1],)
+
+
+def parse(tokens, handler):
+    try:
+        while True:
+            parse_statement(tokens, handler)
+    except StopIteration:
+        pass
+
+def run(script, handler):
+    parse(normalize_tokens_assignment(normalize_equals_sign(tokenize(script))), handler)
+
+
+if __name__=="__main__":
+    # basic self-test...
+    commands="""
+/* Set the debug level to
+   1 to get *verbose* output... */
+SET debug_level =1;
+
+/* Set the rdf format default to N3 for this session */
+set rdf_format  =     "rdf/n3";
+
+CREATE RDF DATABASE test1;
+LOAD DATA INFILE 
+          "foo.n3" INTO DATABASE test1;
+DROP RDF DATABASE test1;
+"""
+    tokens=normalize_tokens_assignment(normalize_equals_sign(tokenize(commands)))
+
+    class Handler:
+        def load_data(self,dbname,filename):
+            if not dbname == "test1" or not filename == "foo.n3":
+                raise "test FAILED"
+            #print 'load_data("%s","%s")' % (dbname, filename)
+
+        def create_database(self,dbname):
+            if not dbname == "test1":
+                raise "test FAILED"
+            #print 'create_database("%s")' % (dbname,)
+
+        def drop_database(self,dbname):
+            if not dbname == "test1":
+                raise "test FAILED"
+            #print 'drop_database("%s")' % (dbname,)
+
+        def set_property(self,key,value):
+            if not key in ["debug_level", "rdf_format"]:
+                raise "test FAILED"
+            if not value in ["1", "rdf/n3"]:
+                raise "test FAILED"
+            #print 'set_property("%s","""%s""")' % (key,value)
+
+    run(commands, Handler())

Propchange: incubator/triplesoup/code/trunk/modules/pysoup/pysoup/parser.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/triplesoup/code/trunk/modules/pysoup/pysoup/parser.py
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: incubator/triplesoup/code/trunk/modules/pysoup/pysoup/parser.py
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/triplesoup/code/trunk/modules/pysoup/scripts/admin.cgi
URL: http://svn.apache.org/viewvc/incubator/triplesoup/code/trunk/modules/pysoup/scripts/admin.cgi?view=auto&rev=509187
==============================================================================
--- incubator/triplesoup/code/trunk/modules/pysoup/scripts/admin.cgi (added)
+++ incubator/triplesoup/code/trunk/modules/pysoup/scripts/admin.cgi Mon Feb 19 05:01:11 2007
@@ -0,0 +1,26 @@
+#!/usr/bin/env python
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+import cgi
+import cgitb; cgitb.enable()
+
+print "Status: 500 Internal Server Error"
+print "Content-Type: text/plain\n"
+
+print "Sorry, server not yet implemented.\n"

Propchange: incubator/triplesoup/code/trunk/modules/pysoup/scripts/admin.cgi
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/triplesoup/code/trunk/modules/pysoup/scripts/admin.cgi
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/triplesoup/code/trunk/modules/pysoup/scripts/admin.cgi
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: incubator/triplesoup/code/trunk/modules/pysoup/scripts/admin.cgi
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/triplesoup/code/trunk/modules/pysoup/scripts/edit.cgi
URL: http://svn.apache.org/viewvc/incubator/triplesoup/code/trunk/modules/pysoup/scripts/edit.cgi?view=auto&rev=509187
==============================================================================
--- incubator/triplesoup/code/trunk/modules/pysoup/scripts/edit.cgi (added)
+++ incubator/triplesoup/code/trunk/modules/pysoup/scripts/edit.cgi Mon Feb 19 05:01:11 2007
@@ -0,0 +1,26 @@
+#!/usr/bin/env python
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+import cgi
+import cgitb; cgitb.enable()
+
+print "Status: 500 Internal Server Error"
+print "Content-Type: text/plain\n"
+
+print "Sorry, server not yet implemented.\n"

Propchange: incubator/triplesoup/code/trunk/modules/pysoup/scripts/edit.cgi
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/triplesoup/code/trunk/modules/pysoup/scripts/edit.cgi
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/triplesoup/code/trunk/modules/pysoup/scripts/edit.cgi
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: incubator/triplesoup/code/trunk/modules/pysoup/scripts/edit.cgi
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/triplesoup/code/trunk/modules/pysoup/scripts/get.cgi
URL: http://svn.apache.org/viewvc/incubator/triplesoup/code/trunk/modules/pysoup/scripts/get.cgi?view=auto&rev=509187
==============================================================================
--- incubator/triplesoup/code/trunk/modules/pysoup/scripts/get.cgi (added)
+++ incubator/triplesoup/code/trunk/modules/pysoup/scripts/get.cgi Mon Feb 19 05:01:11 2007
@@ -0,0 +1,26 @@
+#!/usr/bin/env python
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+import cgi
+import cgitb; cgitb.enable()
+
+print "Status: 500 Internal Server Error"
+print "Content-Type: text/plain\n"
+
+print "Sorry, server not yet implemented.\n"

Propchange: incubator/triplesoup/code/trunk/modules/pysoup/scripts/get.cgi
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/triplesoup/code/trunk/modules/pysoup/scripts/get.cgi
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/triplesoup/code/trunk/modules/pysoup/scripts/get.cgi
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: incubator/triplesoup/code/trunk/modules/pysoup/scripts/get.cgi
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/triplesoup/code/trunk/tests/01-basic-self-test/create-drop-load.tsql
URL: http://svn.apache.org/viewvc/incubator/triplesoup/code/trunk/tests/01-basic-self-test/create-drop-load.tsql?view=auto&rev=509187
==============================================================================
--- incubator/triplesoup/code/trunk/tests/01-basic-self-test/create-drop-load.tsql (added)
+++ incubator/triplesoup/code/trunk/tests/01-basic-self-test/create-drop-load.tsql Mon Feb
19 05:01:11 2007
@@ -0,0 +1,6 @@
+SET debug_level = 3;
+SET rdf_format = "rdf/n3";
+
+CREATE RDF DATABASE "basicselftest01";
+LOAD DATA INFILE "foaf.n3" INTO DATABASE "basicselftest01";
+DROP RDF DATABASE "basicselftest01";

Added: incubator/triplesoup/code/trunk/tests/01-basic-self-test/foaf.n3
URL: http://svn.apache.org/viewvc/incubator/triplesoup/code/trunk/tests/01-basic-self-test/foaf.n3?view=auto&rev=509187
==============================================================================
--- incubator/triplesoup/code/trunk/tests/01-basic-self-test/foaf.n3 (added)
+++ incubator/triplesoup/code/trunk/tests/01-basic-self-test/foaf.n3 Mon Feb 19 05:01:11 2007
@@ -0,0 +1,17 @@
+@keywords a.
+@prefix : <http://xmlns.com/foaf/0.1/>.
+@prefix dc: <http://purl.org/dc/elements/1.1/>.
+@prefix h: <#>.
+
+h:this a PersonalProfileDocument;
+    maker h:me;
+    primaryTopic h:me.
+
+h:me a Person; 
+    homepage <http://www.leosimons.com/>;
+    mbox_sha1sum "61b90cc881bde4eaec17ff510c5bbef16ea7bfed";
+    name "Leo Simons"; 
+    gender "male";
+    title "Mr"; 
+    givenname "Leo";
+    family_name "Simons".

Added: incubator/triplesoup/code/trunk/tests/01-basic-self-test/run.sh
URL: http://svn.apache.org/viewvc/incubator/triplesoup/code/trunk/tests/01-basic-self-test/run.sh?view=auto&rev=509187
==============================================================================
--- incubator/triplesoup/code/trunk/tests/01-basic-self-test/run.sh (added)
+++ incubator/triplesoup/code/trunk/tests/01-basic-self-test/run.sh Mon Feb 19 05:01:11 2007
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+PYTHONPATH=`pwd`/../../modules/pysoup
+PYTHONPATH=$PYTHONPATH python $PYTHONPATH/pysoup/client.py create-drop-load.tsql || exit
1

Propchange: incubator/triplesoup/code/trunk/tests/01-basic-self-test/run.sh
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/triplesoup/code/trunk/tests/01-basic-self-test/run.sh
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/triplesoup/code/trunk/tests/01-basic-self-test/run.sh
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: incubator/triplesoup/code/trunk/tests/01-basic-self-test/run.sh
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/triplesoup/code/trunk/tests/FIXTURE.txt
URL: http://svn.apache.org/viewvc/incubator/triplesoup/code/trunk/tests/FIXTURE.txt?view=auto&rev=509187
==============================================================================
--- incubator/triplesoup/code/trunk/tests/FIXTURE.txt (added)
+++ incubator/triplesoup/code/trunk/tests/FIXTURE.txt Mon Feb 19 05:01:11 2007
@@ -0,0 +1,11 @@
+These tests need a running pysoup server on localhost; for example, configure
+apache as follows...
+
+	ScriptAlias /pysoup/ "path/to/code/trunk/modules/pysoup/scripts"
+
+	<Directory "path/to/code/trunk/modules/pysoup/scripts">
+	    AllowOverride None
+	    Options None
+	    Order allow,deny
+	    Allow from all
+	</Directory>

Propchange: incubator/triplesoup/code/trunk/tests/FIXTURE.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/triplesoup/code/trunk/tests/FIXTURE.txt
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: incubator/triplesoup/code/trunk/tests/FIXTURE.txt
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/triplesoup/code/trunk/tests/README.txt
URL: http://svn.apache.org/viewvc/incubator/triplesoup/code/trunk/tests/README.txt?view=auto&rev=509187
==============================================================================
--- incubator/triplesoup/code/trunk/tests/README.txt (added)
+++ incubator/triplesoup/code/trunk/tests/README.txt Mon Feb 19 05:01:11 2007
@@ -0,0 +1,29 @@
+Running this test suite
+-----------------------
+
+ * follow any needed steps for test fixture set up; see FIXTURE.txt
+
+ * run using a simple
+
+   ./run.sh
+
+
+Writing a test
+--------------
+
+ * Create a new test directory following the established naming pattern.
+
+   * do not name the directory starting with a "_"
+
+ * Add a script file called run.sh into that directory.
+
+   * Invoke whatever you want from that file to run the test.
+
+   * use "exit 1" to indicate a test FAILURE
+
+   * use "exit 2" to indicate a test NO RESULT (when a missing precondition
+     means its not possible to run the test)
+
+   * use "exit 0" to indicate a test SUCCESS
+
+ * the main run.sh will pick up the new test automatically.

Propchange: incubator/triplesoup/code/trunk/tests/README.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/triplesoup/code/trunk/tests/README.txt
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: incubator/triplesoup/code/trunk/tests/README.txt
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/triplesoup/code/trunk/tests/run.sh
URL: http://svn.apache.org/viewvc/incubator/triplesoup/code/trunk/tests/run.sh?view=auto&rev=509187
==============================================================================
--- incubator/triplesoup/code/trunk/tests/run.sh (added)
+++ incubator/triplesoup/code/trunk/tests/run.sh Mon Feb 19 05:01:11 2007
@@ -0,0 +1,69 @@
+#!/usr/bin/env bash
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+tests=`find . -type d -mindepth 1 -maxdepth 1 -not -name '_*' -not -name '.svn' | sort`
+
+exitstatus=0
+failed=0
+success=0
+noresult=0
+total=0
+log=""
+
+for test in $tests; do
+    total=$(( $total + 1 ))
+    echo "Running $test..."
+    cd $test
+    ./run.sh
+    myexitstatus=$?
+    msg="SUCCESS"
+    if [[ $myexitstatus -ne 0 ]]; then
+        exitstatus=$myexitstatus
+        if [[ $myexitstatus -eq 2 ]]; then
+            noresult=$(( $noresult + 1 ))
+            msg="NO RESULT"
+        else
+            failed=$(( $failed + 1 ))
+            msg="FAILED"
+        fi
+    else
+        success=$(( $success + 1 ))
+    fi
+    cd ..
+    log="$log
+$test...$msg"
+done
+
+cat <<END
+
+
+Test report
+-----------------------------------------------------$log
+
+Test summary
+-----------------------------------------------------
+Successes:     `printf %02d $success`
+Failures:      `printf %02d $failed`
+No results:    `printf %02d $noresult`
+               --
+        Total: `printf %02d $total`
+-----------------------------------------------------
+END
+
+exit $exitstatus

Propchange: incubator/triplesoup/code/trunk/tests/run.sh
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/triplesoup/code/trunk/tests/run.sh
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/triplesoup/code/trunk/tests/run.sh
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: incubator/triplesoup/code/trunk/tests/run.sh
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message