├── .github └── FUNDING.yml ├── .gitignore ├── Makefile ├── README.md ├── dbpedia └── test.lisp ├── freebase_client └── test.lisp ├── geonames └── test.lisp ├── knowledgebooks_nlp ├── FastTag.lisp ├── KBtm.lisp ├── Makefile ├── README.txt ├── cat-tags.lisp ├── data │ ├── FastTagData.lisp │ ├── cat-data-tables.lisp │ └── names │ │ ├── PlaceData.ldat │ │ ├── StopWords.ldat │ │ ├── names.companies │ │ ├── names.female │ │ ├── names.last │ │ ├── names.male │ │ └── names.products ├── example.lisp ├── find-names-places.lisp ├── kbnlp.asd ├── load-misc-data.lisp ├── load.lisp ├── misc-utils.lisp ├── names.lisp ├── package.lisp ├── places.lisp ├── summarize.lisp └── to-xml.lisp ├── lgpl-3.0.txt ├── opencalais ├── load.lisp ├── opencalais-data-store.lisp ├── opencalais-lib.lisp └── test-opencalais.lisp ├── quick_start_allegrograph_lisp_embedded ├── geoloc.lisp ├── prolog.lisp ├── quickstart.lisp ├── sample_news.nt └── text.lisp ├── rdf └── rdfext.lisp ├── reasoning ├── news2.nt └── reasoning.lisp ├── sparql ├── news.n3 ├── news.nt ├── news_ns.nt └── sparql_query.lisp ├── test_data ├── news_articles │ ├── economy_1.txt │ ├── economy_2.txt │ ├── news_1.txt │ └── news_2.txt ├── rdfa_data │ ├── ivan-herman-foaf.html │ ├── marktest.html │ ├── test.rb │ └── wikipedia-ex.html └── xml │ ├── FactBook.xml │ ├── USstates.xml │ └── classification_tags.xml ├── utils ├── chunga-1.1.1 │ ├── CHANGELOG.txt │ ├── chunga.asd │ ├── conditions.lisp │ ├── doc │ │ └── index.html │ ├── input.lisp │ ├── known-words.lisp │ ├── output.lisp │ ├── packages.lisp │ ├── read.lisp │ ├── specials.lisp │ ├── streams.lisp │ └── util.lisp ├── cl-base64-3.3.3 │ ├── COPYING │ ├── cl-base64.asd │ ├── decode.lisp │ ├── encode.lisp │ ├── package.lisp │ └── tests.lisp ├── cl-geonames │ ├── AUTHORS │ ├── BUGS │ ├── INSTALL │ ├── NEWS │ ├── README │ ├── TODO │ ├── cl-geonames-test.asd │ ├── cl-geonames.asd │ ├── etc │ │ └── lift-standard.config │ ├── misc │ │ └── ut-cover.lisp │ ├── src │ │ ├── api.lisp │ │ ├── conditions.lisp │ │ ├── package.lisp │ │ └── specials.lisp │ └── test │ │ ├── api.lisp │ │ ├── definition.lisp │ │ ├── package.lisp │ │ ├── specials.lisp │ │ └── unit-tests.lisp ├── cl-json_0.4.0 │ ├── CONTRIBUTORS │ ├── LICENSE │ ├── cl-json.asd │ ├── doc │ │ ├── cl-json.html │ │ └── style.css │ ├── src │ │ ├── camel-case.lisp │ │ ├── common.lisp │ │ ├── decoder-args.lisp │ │ ├── decoder.lisp │ │ ├── encoder.lisp │ │ ├── json-rpc.lisp │ │ ├── objects.lisp │ │ ├── package.lisp │ │ └── utils.lisp │ └── t │ │ ├── fail1.json │ │ ├── fail10.json │ │ ├── fail11.json │ │ ├── fail12.json │ │ ├── fail13.json │ │ ├── fail14.json │ │ ├── fail15.json │ │ ├── fail16.json │ │ ├── fail17.json │ │ ├── fail18.json │ │ ├── fail19.json │ │ ├── fail2.json │ │ ├── fail20.json │ │ ├── fail21.json │ │ ├── fail22.json │ │ ├── fail23.json │ │ ├── fail24.json │ │ ├── fail3.json │ │ ├── fail4.json │ │ ├── fail5.json │ │ ├── fail6.json │ │ ├── fail7.json │ │ ├── fail8.json │ │ ├── fail9.json │ │ ├── package.lisp │ │ ├── pass1.json │ │ ├── pass2.json │ │ ├── pass3.json │ │ ├── testdecoder.lisp │ │ ├── testencoder.lisp │ │ ├── testjson.lisp │ │ └── testmisc.lisp ├── drakma-1.2.3 │ ├── CHANGELOG.txt │ ├── conditions.lisp │ ├── cookies.lisp │ ├── doc │ │ └── index.html │ ├── drakma.asd │ ├── packages.lisp │ ├── read.lisp │ ├── request.lisp │ ├── specials.lisp │ └── util.lisp ├── file-utils.lisp ├── flexi-streams-1.0.7 │ ├── CHANGELOG │ ├── ascii.lisp │ ├── code-pages.lisp │ ├── conditions.lisp │ ├── decode.lisp │ ├── doc │ │ ├── foo.txt │ │ └── index.html │ ├── encode.lisp │ ├── external-format.lisp │ ├── flexi-streams.asd │ ├── in-memory.lisp │ ├── input.lisp │ ├── io.lisp │ ├── iso-8859.lisp │ ├── koi8-r.lisp │ ├── length.lisp │ ├── lw-char-stream.lisp │ ├── mapping.lisp │ ├── output.lisp │ ├── packages.lisp │ ├── specials.lisp │ ├── stream.lisp │ ├── strings.lisp │ ├── test │ │ ├── README │ │ ├── hebrew_latin8_cr.txt │ │ ├── hebrew_latin8_crlf.txt │ │ ├── hebrew_latin8_lf.txt │ │ ├── hebrew_utf8_cr.txt │ │ ├── hebrew_utf8_crlf.txt │ │ ├── hebrew_utf8_lf.txt │ │ ├── kafka_cp1252_cr.txt │ │ ├── kafka_cp1252_crlf.txt │ │ ├── kafka_cp1252_lf.txt │ │ ├── kafka_latin1_cr.txt │ │ ├── kafka_latin1_crlf.txt │ │ ├── kafka_latin1_lf.txt │ │ ├── kafka_utf8_cr.txt │ │ ├── kafka_utf8_crlf.txt │ │ ├── kafka_utf8_lf.txt │ │ ├── packages.lisp │ │ ├── russian_koi8r_cr.txt │ │ ├── russian_koi8r_crlf.txt │ │ ├── russian_koi8r_lf.txt │ │ ├── russian_utf8_cr.txt │ │ ├── russian_utf8_crlf.txt │ │ ├── russian_utf8_lf.txt │ │ ├── test.lisp │ │ ├── tilton_ascii_cr.txt │ │ ├── tilton_ascii_crlf.txt │ │ ├── tilton_ascii_lf.txt │ │ ├── tilton_utf8_cr.txt │ │ ├── tilton_utf8_crlf.txt │ │ ├── tilton_utf8_lf.txt │ │ ├── unicode_demo_ucs2_cr_be.txt │ │ ├── unicode_demo_ucs2_cr_le.txt │ │ ├── unicode_demo_ucs2_crlf_be.txt │ │ ├── unicode_demo_ucs2_crlf_le.txt │ │ ├── unicode_demo_ucs2_lf_be.txt │ │ ├── unicode_demo_ucs2_lf_le.txt │ │ ├── unicode_demo_ucs4_cr_be.txt │ │ ├── unicode_demo_ucs4_cr_le.txt │ │ ├── unicode_demo_ucs4_crlf_be.txt │ │ ├── unicode_demo_ucs4_crlf_le.txt │ │ ├── unicode_demo_ucs4_lf_be.txt │ │ ├── unicode_demo_ucs4_lf_le.txt │ │ ├── unicode_demo_utf8_cr.txt │ │ ├── unicode_demo_utf8_crlf.txt │ │ └── unicode_demo_utf8_lf.txt │ └── util.lisp ├── lisp-unit.lisp ├── puri-1.5.5 │ ├── LICENSE │ ├── README │ ├── puri.asd │ ├── src.lisp │ ├── tests.lisp │ └── uri.html ├── s-xml │ ├── ChangeLog │ ├── Makefile │ ├── doc │ │ ├── S-XML.html │ │ ├── index.html │ │ └── style.css │ ├── s-xml.asd │ ├── src │ │ ├── dom.lisp │ │ ├── lxml-dom.lisp │ │ ├── package.lisp │ │ ├── sxml-dom.lisp │ │ ├── xml-struct-dom.lisp │ │ └── xml.lisp │ └── test │ │ ├── all-tests.lisp │ │ ├── ant-build-file.xml │ │ ├── counter.lisp │ │ ├── echo.lisp │ │ ├── plist.xml │ │ ├── remove-markup.lisp │ │ ├── simple.xml │ │ ├── test-lxml-dom.lisp │ │ ├── test-sxml-dom.lisp │ │ ├── test-xml-struct-dom.lisp │ │ ├── test-xml.lisp │ │ ├── tracer.lisp │ │ └── xhtml-page.xml ├── split-sequence │ ├── README.cCLan-install │ ├── split-sequence.asd │ └── split-sequence.lisp ├── trivial-gray-streams-2008-11-02 │ ├── COPYING │ ├── CVS │ │ ├── Entries │ │ ├── Repository │ │ └── Root │ ├── Makefile │ ├── README │ ├── mixin.lisp │ ├── package.lisp │ └── trivial-gray-streams.asd ├── usocket-0.4.1 │ ├── LICENSE │ ├── Makefile │ ├── README │ ├── TODO │ ├── backend │ │ ├── allegro.lisp │ │ ├── armedbear.lisp │ │ ├── clisp.lisp │ │ ├── cmucl.lisp │ │ ├── lispworks.lisp │ │ ├── openmcl.lisp │ │ ├── sbcl.lisp │ │ └── scl.lisp │ ├── condition.lisp │ ├── doc │ │ ├── backends.txt │ │ └── design.txt │ ├── notes │ │ ├── abcl-socket.txt │ │ ├── active-sockets-apis.txt │ │ ├── address-apis.txt │ │ ├── allegro-socket.txt │ │ ├── clisp-sockets.txt │ │ ├── cmucl-sockets.txt │ │ ├── errors.txt │ │ ├── lw-sockets.txt │ │ ├── openmcl-sockets.txt │ │ ├── sb-bsd-sockets.txt │ │ └── usock-sockets.txt │ ├── package.lisp │ ├── run-usocket-tests.sh │ ├── test │ │ ├── abcl.conf.in │ │ ├── allegro.conf.in │ │ ├── clisp.conf.in │ │ ├── cmucl.conf.in │ │ ├── package.lisp │ │ ├── sbcl.conf.in │ │ ├── test-usocket.lisp │ │ ├── usocket-test.asd │ │ └── your-lisp.conf.in │ ├── usocket.asd │ └── usocket.lisp └── yason │ ├── LICENSE │ ├── doc.xml │ ├── encode.lisp │ ├── package.lisp │ ├── parse.lisp │ └── yason.asd └── web_app ├── Beijing.txt ├── backend.lisp ├── init.nt ├── test.lisp ├── web ├── about.clp ├── browser.clp ├── footer.clp ├── header.clp ├── images │ ├── background.gif │ ├── background_left.gif │ └── menu.gif ├── layout.css ├── left_bar.clp ├── login.clp └── upload.clp └── webapp.lisp /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: mark-watson # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | clean: 2 | rm -f */*.fasl */*/*.fasl */*/*/*.fasl */*/*/*/*.fasl -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # lisp_practical_semantic_web 2 | Examples from the Lisp version of my semantic web book 3 | 4 | You can read all of my books for free on my 5 | website [https://markwatson.com](https://markwatson.com). 6 | 7 | If you would like to support my work please consider purchasing my books on [Leanpub](https://leanpub.com/u/markwatson) and star my git repositories that you find useful on [GitHub](https://github.com/mark-watson?tab=repositories&q=&type=public). You can also interact with me on social media on [Mastodon](https://mastodon.social/@mark_watson) and [Twitter](https://twitter.com/mark_l_watson). 8 | -------------------------------------------------------------------------------- /dbpedia/test.lisp: -------------------------------------------------------------------------------- 1 | (require :agraph) 2 | 3 | ;; from Franz documentation: 4 | 5 | (sparql.client::run-sparql-remote "http://dbpedia.org/sparql" " 6 | PREFIX dbpedia: 7 | PREFIX foaf: 8 | PREFIX xsd: 9 | SELECT ?person { 10 | ?person dbpedia:birthPlace . 11 | } 12 | LIMIT 10" :results-format :alists) 13 | -------------------------------------------------------------------------------- /freebase_client/test.lisp: -------------------------------------------------------------------------------- 1 | (require :aserve) 2 | (in-package :net.aserve.client) 3 | 4 | (push "../utils/yason/" asdf:*central-registry*) 5 | (asdf:operate 'asdf:load-op 'yason) 6 | 7 | (defvar mql-url "http://api.freebase.com/api/service/mqlread?query=") 8 | 9 | (defvar *h* (make-hash-table :test #'equal)) 10 | (defvar *h2* (make-hash-table :test #'equal)) 11 | (setf (gethash "name" *h2*) "Mark Louis Watson") 12 | (setf (gethash "type" *h2*) (make-array 0)) 13 | (setf (gethash "query" *h*) (list *h2*)) 14 | 15 | (defvar *hs* 16 | (with-output-to-string 17 | (sstrm) 18 | (json:encode *h* sstrm))) 19 | 20 | (defvar *s* (concatenate 'string mql-url (net.aserve.client::uriencode-string *hs*))) 21 | 22 | (defvar *str-results* (do-http-request *s*)) 23 | 24 | (format t "Results:~%~%~A~%~%" *str-results*) 25 | 26 | (defvar *results* (json:parse *str-results*)) 27 | 28 | (maphash 29 | #'(lambda (key val) (format t "key: ~A value: ~A~%" key val)) 30 | (car (gethash "result" *results*))) 31 | 32 | -------------------------------------------------------------------------------- /geonames/test.lisp: -------------------------------------------------------------------------------- 1 | (push "../utils/cl-json_0.4.0/" asdf:*central-registry*) 2 | (asdf:operate 'asdf:load-op :cl-json) 3 | 4 | (push "../utils/s-xml/" asdf:*central-registry*) 5 | (asdf:operate 'asdf:load-op :s-xml) 6 | 7 | (push "../utils/split-sequence/" asdf:*central-registry*) 8 | (asdf:operate 'asdf:load-op :split-sequence) 9 | 10 | (push "../utils/usocket-0.4.1/" asdf:*central-registry*) 11 | (asdf:operate 'asdf:load-op :usocket) 12 | 13 | (push "../utils/trivial-gray-streams-2008-11-02/" asdf:*central-registry*) 14 | (asdf:operate 'asdf:load-op :trivial-gray-streams) 15 | 16 | (push "../utils/flexi-streams-1.0.7/" asdf:*central-registry*) 17 | (asdf:operate 'asdf:load-op :flexi-streams) 18 | 19 | (push "../utils/chunga-1.1.1/" asdf:*central-registry*) 20 | (asdf:operate 'asdf:load-op :chunga) 21 | 22 | (push "../utils/cl-base64-3.3.3/" asdf:*central-registry*) 23 | (asdf:operate 'asdf:load-op :cl-base64) 24 | 25 | (push "../utils/puri-1.5.5/" asdf:*central-registry*) 26 | (asdf:operate 'asdf:load-op :puri) 27 | 28 | (push "../utils/drakma-1.2.3/" asdf:*central-registry*) 29 | (asdf:operate 'asdf:load-op :drakma) 30 | 31 | (push "../utils/cl-geonames/" asdf:*central-registry*) 32 | (asdf:operate 'asdf:load-op :cl-geonames) 33 | 34 | (cl-geonames:geo-country-info :country '("FR" "GB" "ES")) 35 | -------------------------------------------------------------------------------- /knowledgebooks_nlp/KBtm.lisp: -------------------------------------------------------------------------------- 1 | (in-package :kbnlp) 2 | 3 | ;; Copyright Mark Watson 2008-2010. All Rights Reserved. 4 | ;; License: LGPL version 3 (http://www.gnu.org/licenses/lgpl-3.0.txt) 5 | 6 | ;; data structures 7 | 8 | (defstruct text 9 | url 10 | title 11 | summary 12 | category-tags 13 | human-names 14 | place-names 15 | text 16 | tags) 17 | 18 | (defun make-text-object (words &key (url "") (title "")) 19 | (if (typep words 'string) (setq words (words-from-string words))) 20 | (let* ((txt-obj (make-text :text words :url url :title title))) ;;; :classification cat))) 21 | (setf (text-tags txt-obj) (parse words)) 22 | (let ((names-places (find-names-places txt-obj))) 23 | (setf (text-human-names txt-obj) (car names-places)) 24 | (setf (text-place-names txt-obj) (cadr names-places))) 25 | (setf (text-category-tags txt-obj) 26 | (mapcar #'(lambda (x) (list (car x) (/ (cadr x) 1000000.0))) (get-word-list-category (text-text txt-obj)))) 27 | (setf (text-summary txt-obj) (summarize txt-obj)) 28 | txt-obj)) 29 | 30 | 31 | -------------------------------------------------------------------------------- /knowledgebooks_nlp/Makefile: -------------------------------------------------------------------------------- 1 | clean: 2 | rm -f *.fasl 3 | rm -f */*.fasl 4 | rm -f */*/*.fasl 5 | rm -f */*/*/*.fasl 6 | rm -f */*/*/*/*.fasl 7 | rm -f *~ 8 | rm -f */*~ 9 | rm -f */*/*~ 10 | rm -f */*/*/*~ 11 | rm -f */*/*/*/*~ 12 | rm -r -f test2 13 | rm -f autoloads.out 14 | -------------------------------------------------------------------------------- /knowledgebooks_nlp/README.txt: -------------------------------------------------------------------------------- 1 | License: this entire project is licensed using the LGPL version 3. This 2 | license is compatible with the Apache 2 license so you can use this code 3 | in projects where the rest of the code is under the Apache 2 license. 4 | 5 | Tuesday, July 14, 2009: 6 | 7 | I am cloning this project from KBtextmaster_lisp, creating: KBnlp. I did 8 | this by removing: 9 | 10 | web app stuff 11 | wordnet support 12 | xml-rpc server support 13 | some anaphora resolution support 14 | some linking support 15 | code using CIA World Factbook data 16 | 17 | I have added new code from my natively compiled NLP command line 18 | toolkit (written in Scheme, built with Gambit-C Scheme). 19 | 20 | The purpose of creating the KBnlp sub-project is to create a useful 21 | NLP library in Common Lisp that other people will have an easier time 22 | working with: the KBtextmaster_lisp code base has been developed between 23 | 1998 and 2008 and the code base is more than a little crufty. KBnlp 24 | contains a lot of refactoring and general code cleanup. 25 | 26 | The LGPL license also applies to the data files provided in the 27 | subdirectory "data". I have attempted to reduce the size of the 28 | data for human names, places, and products by eliminating terms 29 | and words that are seldom used. 30 | 31 | I work as a consultant: please consider hiring me to customize 32 | my NLP libraries (both KBnlp and KBtextmaster_lisp) for your 33 | projects. 34 | 35 | -Mark Watson http://markwatson.com 36 | -------------------------------------------------------------------------------- /knowledgebooks_nlp/cat-tags.lisp: -------------------------------------------------------------------------------- 1 | (in-package :kbnlp) 2 | 3 | ;; access functions for determining category tags 4 | 5 | ;; Copyright Mark Watson 2008-2010. All Rights Reserved. 6 | ;; License: LGPL version 3 (http://www.gnu.org/licenses/lgpl-3.0.txt) 7 | 8 | (defvar categoryHashtables) 9 | (defvar categoryNames) 10 | 11 | (defun get-cat-tag-names () 12 | categoryNames) 13 | 14 | (defun get-word-list-category (words) 15 | (let ((v nil) 16 | (x nil) 17 | (ss nil) 18 | (cat-hash nil) 19 | ;;(tags nil) 20 | (word nil) 21 | (len nil) 22 | (len2 nil)) 23 | 24 | (defun list-sort (x) 25 | ;;(pprint x) 26 | (sort x #'(lambda (x y) 27 | (> (cadr x) (cadr y))))) 28 | 29 | ;;(setf words (words-from-string words)) 30 | ;;(setf tags (parse words)) 31 | (setf len (length words)) 32 | (setf len2 (length categoryHashtables)) 33 | (setf v (make-array len2 :initial-element 0)) 34 | ;;(pprint v) 35 | (do ((k 0 (+ k 1))) 36 | ((equal k len)) 37 | (setf word (string-downcase (aref words k))) 38 | (do ((i 0 (+ i 1))) 39 | ((equal i len2)) 40 | (setf cat-hash (nth i categoryHashtables)) 41 | (setf x (gethash word cat-hash)) 42 | (if x 43 | (setf (aref v i) (+ x (aref v i)))))) 44 | (setf ss '()) 45 | (do ((i 0 (+ i 1))) 46 | ((equal i len2)) 47 | (if (> (aref v i) 0.01) 48 | (setf ss (cons (list (nth i categoryNames) (round (* (aref v i) 10))) ss)))) 49 | (setf ss (list-sort ss)) 50 | (let ((cutoff (/ (cadar ss) 2)) 51 | (v '())) 52 | (dolist (hit ss) 53 | (if (> (cadr hit) cutoff) 54 | (setf v (cons hit v)))) 55 | (reverse v)))) 56 | 57 | 58 | ;; test: (get-word-list-category (words-from-string "banking in Europe is a good business. The Euro is strong and account balances are up. Interest rates are remaining steady.")) 59 | -------------------------------------------------------------------------------- /knowledgebooks_nlp/data/names/names.companies: -------------------------------------------------------------------------------- 1 | IBM 2 | Disney 3 | -------------------------------------------------------------------------------- /knowledgebooks_nlp/data/names/names.products: -------------------------------------------------------------------------------- 1 | Coke 2 | Pepsi 3 | -------------------------------------------------------------------------------- /knowledgebooks_nlp/example.lisp: -------------------------------------------------------------------------------- 1 | (asdf:operate 'asdf:load-op :kbnlp) 2 | 3 | (in-package :kbnlp) 4 | 5 | (defvar x) 6 | (setf x (kbnlp:make-text-object "President Bill Clinton ran for president of the USA in two elections. George W Bush also ran twice. Bill Clinton took a long vacation in Europe to visit his daughter. Bill Clinton said that banking in Europe is a good business. The Euro is strong and account balances are up. Interest rates are remaining steady. The question is whether or not the US dollar remains the world's reserve currency - if not, the US economy will face a depression. In their zeal to protect their members from politically hazardous votes on issues such as gay marriage and gun control, Democrats running the House of Representatives are taking extraordinary steps to muzzle Republicans in this summer's debates on spending bills. 7 | 8 | On Thursday, for example, Republicans had hoped to force debates on abortion, school vouchers and medical marijuana, as well as gay marriage and gun control, as part of House consideration of the federal government's contribution to the District of Columbia's city budget. The group went to Florida and Alaska. 9 | 10 | No way, Democrats said. 11 | 12 | At issue are 12 bills totaling more than $1.2 trillion in annual appropriations bills for funding most government programs — usually low-profile legislation that typically dominates the work of the House in June and July. For decades, those bills have come to the floor under an open process that allows any member to try to amend them. Often those amendments are an effort to change government policy by adding or subtracting money for carrying it out. Relentlessly rising unemployment is triggering more home foreclosures, threatening the Obama administration's efforts to end the housing crisis and diminishing hopes the economy will rebound with vigor. 13 | 14 | In past recessions, the housing industry helped get the economy back on track. Home builders ramped up production, expecting buyers to take advantage of lower prices and jump into the market. But not this time. 15 | 16 | These days, homeowners who got fixed-rate prime mortgages because they had good credit can't make their payments because they're out of work. That means even more foreclosures and further declines in home values. 17 | 18 | The initial surge in foreclosures in 2007 and 2008 was tied to subprime mortgages issued during the housing boom to people with shaky credit. That crisis has ebbed, but it has been replaced by more traditional foreclosures tied to the recession. 19 | 20 | Unemployment stood at 9.5 percent in June " :title "test doc 1" :url "http://knowledgebooks.com/docs/001")) 21 | 22 | (pprint x) 23 | -------------------------------------------------------------------------------- /knowledgebooks_nlp/find-names-places.lisp: -------------------------------------------------------------------------------- 1 | (in-package :kbnlp) 2 | 3 | ;; Copyright Mark Watson 2008-2010. All Rights Reserved. 4 | ;; License: LGPL version 3 (http://www.gnu.org/licenses/lgpl-3.0.txt) 5 | 6 | (defun remove-shorter-names (lst &aux (c-lst lst) (num (length lst))) 7 | (dotimes (i num) 8 | (dotimes (j num) 9 | (if (not (= i j)) 10 | (let ((s-i (nth i lst)) 11 | (s-j (nth j lst))) 12 | (if (and 13 | (> (length s-i) (length s-j)) 14 | (> (length s-j) 6)) 15 | (if (search s-j s-i) 16 | (setf c-lst (remove s-j c-lst :test #'string-equal)))))))) 17 | c-lst) 18 | 19 | ;; 20 | ;; wrapper for finding human names and place names in a text object 21 | ;; 22 | (defun find-names-places (txt-object) 23 | (let* ((words (text-text txt-object)) 24 | (tags (text-tags txt-object)) 25 | (place-indices (find-places words nil)) 26 | (name-indices (find-names words tags place-indices)) 27 | (name-list (remove-duplicates (build-list-find-name-helper words name-indices) :test #'equal)) 28 | (place-list (remove-duplicates (build-list-find-name-helper words place-indices) :test #'equal))) 29 | (let ((ret '())) 30 | (dolist (x name-list) 31 | (if (search " " x) 32 | (setq ret (cons x ret)))) 33 | (setq name-list (reverse ret))) 34 | (list 35 | (remove-shorter-names name-list) 36 | (remove-shorter-names place-list)))) 37 | 38 | (defun build-list-find-name-helper (v indices) 39 | (let ((ret '())) 40 | (dolist (x indices) 41 | (let* ((start (car x)) 42 | (stop (cadr x)) 43 | (str "") 44 | (num (- stop start))) 45 | (dotimes (i num) 46 | (if (equal i 0) 47 | (setq str (concatenate 'string str (aref v (+ i start)) " ")) 48 | (if (equal i (1- num)) 49 | (setq str (concatenate 'string str (aref v (+ i start)))) 50 | (setq str (concatenate 'string str (aref v (+ i start)) " "))))) 51 | (setq ret (cons (string-trim '(#\Space) str) ret)))) 52 | (reverse ret))) 53 | 54 | ;; test: (find-names-places (car *all-text-objects*)) 55 | 56 | ;; Test: (dolist (x *all-text-objects*) (find-names-places x)) 57 | -------------------------------------------------------------------------------- /knowledgebooks_nlp/kbnlp.asd: -------------------------------------------------------------------------------- 1 | ;; This file is part of KnowledgeBooks NLP Library 2 | ;; 3 | ;; Copyright (c) 2005-2010 Mark Watson 4 | ;; License: AGPL version 3 (or alternative approved by author) 5 | ;; 6 | ;; All rights reserved. 7 | 8 | ;;;; -*- Mode: LISP -*- 9 | 10 | ;; to load: (asdf:operate 'asdf:load-op :kbnlp) 11 | 12 | ;;(in-package :cl-user) 13 | 14 | ;;(load "load.lisp") 15 | 16 | (in-package :asdf) 17 | 18 | (defsystem :kbnlp 19 | :name "kbnlp" 20 | :author "" 21 | :version "1" 22 | :maintainer "" 23 | :licence "AGPL" 24 | :description "" 25 | :long-description "" 26 | 27 | :components ((:file "package") 28 | (:file "KBtm" :depends-on ("package")) 29 | (:file "data/FastTagData" :depends-on ("package")) 30 | (:file "FastTag" :depends-on ("package")) 31 | (:file "data/cat-data-tables" :depends-on ("package")) 32 | (:file "cat-tags" :depends-on ("package")) 33 | (:file "load-misc-data" :depends-on ("package")) 34 | (:file "names" :depends-on ("package")) 35 | (:file "places" :depends-on ("package")) 36 | (:file "find-names-places" :depends-on ("package")) 37 | (:file "summarize" :depends-on ("package")) 38 | (:file "misc-utils" :depends-on ("package")))) 39 | 40 | -------------------------------------------------------------------------------- /knowledgebooks_nlp/load.lisp: -------------------------------------------------------------------------------- 1 | 2 | (load "FastTag") 3 | 4 | (defpackage kbnlp 5 | (:use :cl :asdf) 6 | (:export 7 | :make-text-object) 8 | (:documentation "Mark Watson's NLP utilities released under the AGPL")) 9 | 10 | (in-package :kbnlp) 11 | 12 | (load "KBtm") 13 | (in-package :kbnlp) 14 | 15 | (defun cload (path) 16 | (format t "\n*** starting to load ~A\n" path) 17 | (compile-file (format nil "~A.lisp" path)) 18 | (load (format nil "~A.fasl" path)) 19 | (format t "\n*** done loading ~A\n" path)) 20 | 21 | 22 | (load "data/FastTagData.lisp") 23 | (load "data/cat-data-tables.lisp") 24 | (load "load-misc-data") 25 | (cload "names") 26 | (cload "places") 27 | 28 | (cload "cat-tags") 29 | (cload "summarize") 30 | (cload "to-xml") 31 | (cload "find-names-places") 32 | (cload "stem-text") 33 | 34 | ;;; utilities: 35 | (cload "misc-utils") 36 | 37 | -------------------------------------------------------------------------------- /knowledgebooks_nlp/misc-utils.lisp: -------------------------------------------------------------------------------- 1 | ;; utility functions 2 | 3 | (in-package :kbnlp) 4 | 5 | ;; Copyright Mark Watson 2008-2010. All Rights Reserved. 6 | ;; License: LGPL version 3 (http://www.gnu.org/licenses/lgpl-3.0.txt) 7 | 8 | (defun flatten (list) 9 | (if (null list) 10 | (list) 11 | (if (atom (car list)) 12 | (cons (car list) (flatten (cdr list))) 13 | (flatten (append (car list) (cdr list)))))) 14 | 15 | (defun dump-hash-table (hash) 16 | (defun helper-dh (key val) 17 | (format t "key: ~A val:~A~%" key val)) 18 | (maphash #'helper-dh hash)) 19 | 20 | (defun array->list (arr &aux ret) 21 | (dotimes (i (length arr)) 22 | (if (aref arr i) 23 | (push (aref arr i) ret))) 24 | (nreverse ret)) 25 | 26 | 27 | (defun replace-all (string part replacement &key (test #'char=)) 28 | "Returns a new string in which all the occurences of the part 29 | is replaced with replacement." 30 | (with-output-to-string (out) 31 | (loop with part-length = (length part) 32 | for old-pos = 0 then (+ pos part-length) 33 | for pos = (search part string 34 | :start2 old-pos 35 | :test test) 36 | do (write-string string out 37 | :start old-pos 38 | :end (or pos (length string))) 39 | when pos do (write-string replacement out) 40 | while pos))) 41 | 42 | 43 | (defun collect-2-lists (l1 l2) 44 | (loop for x in l1 45 | for y in l2 46 | collect (list x y))) 47 | 48 | ;(collect-2-lists '(1 2 3) '(the cat ran)) 49 | 50 | -------------------------------------------------------------------------------- /knowledgebooks_nlp/package.lisp: -------------------------------------------------------------------------------- 1 | (defpackage kbnlp 2 | (:use :cl :asdf) 3 | (:export 4 | :make-text-object) 5 | (:documentation "Mark Watson's NLP utilities released under the AGPL")) 6 | 7 | -------------------------------------------------------------------------------- /knowledgebooks_nlp/places.lisp: -------------------------------------------------------------------------------- 1 | ;;(in-package :names) 2 | 3 | (in-package :kbnlp) 4 | 5 | ;;#+(or xanalys lispworks) 6 | ;;(proclaim '(optimize (speed 3) (space 0) (debug 0))) 7 | 8 | ;; count number of places 9 | (defun count-places (&aux (count 0)) 10 | (maphash 11 | #'(lambda (key value) (setq count (1+ count))) 12 | place-hash) 13 | count) 14 | 15 | ;; 16 | ;; utility for detecting place names in a word list 17 | ;; 18 | ;; 19 | ;; argument: a list of words as strings 20 | ;; return: a list of lists. each sub-list contains a starting and ending index) 21 | ;; 22 | (defun find-places (words exclusion-list) 23 | (let* ((len (length words)) 24 | (ret '()) 25 | word) 26 | (dotimes (i len) 27 | (setq word (aref words i)) 28 | ;; process 3 word place names: 29 | (if (< i (- len 2)) 30 | (if (and 31 | (not-in-list-find-places-helper ret i (+ i 3)) 32 | (not-in-list-find-places-helper exclusion-list i (+ i 3))) 33 | (let ((words (concatenate 'string word " " (aref words (1+ i)) " " (aref words (+ i 2))))) 34 | (if (gethash words place-hash) 35 | (setq ret (cons (list i (+ i 3)) ret)))))) 36 | ;; process 2 word place names: 37 | (if (< i (1- len)) 38 | (if (and 39 | (not-in-list-find-places-helper ret i (+ i 2)) 40 | (not-in-list-find-places-helper exclusion-list i (+ i 2))) 41 | (let ((words (concatenate 'string word " " (aref words (1+ i))))) 42 | (if (gethash words place-hash) 43 | (setq ret (cons (list i (+ i 2)) ret)))))) 44 | ;; 1 word place names: 45 | (if (and 46 | (not-in-list-find-places-helper ret i (+ i 1)) 47 | (not-in-list-find-places-helper exclusion-list i (+ i 1))) 48 | (if (gethash word place-hash) 49 | (setq ret (cons (list i (1+ i)) ret))))) 50 | ;;(print (list "debug: places:" (reverse ret))) 51 | (reverse ret))) 52 | 53 | (defun not-in-list-find-places-helper (a-list start end &aux (rval t)) 54 | (dolist (x a-list) 55 | (let ((i1 (car x)) 56 | (i2 (cadr x))) 57 | (if (or 58 | (and 59 | (>= start i1) 60 | (<= start i2)) 61 | (and 62 | (>= end i1) 63 | (<= end i2))) 64 | (setq rval nil)))) 65 | rval) 66 | 67 | 68 | ;; test: (find-places '("President" "Bush" "went" "to" "San" "Diego")) 69 | (defun test-places () 70 | (let* ((words '#("President" "Bush" "went" "to" "France" "and" "Germany" "to" "meet" "Ms" "." "Jones"))) 71 | (find-places words '((10 11))))) 72 | -------------------------------------------------------------------------------- /knowledgebooks_nlp/summarize.lisp: -------------------------------------------------------------------------------- 1 | (in-package :kbnlp) 2 | 3 | ;; 4 | ; This function performs a simple summarization by forming a word use histogram 5 | ; and after tossing out common words (stemmed, of course), ranking sentences 6 | ; based on how frequently words are used in them. 7 | ;; 8 | 9 | ;; Copyright Mark Watson 2001-2010. All Rights Reserved. 10 | ;; License: LGPL version 3 (http://www.gnu.org/licenses/lgpl-3.0.txt) 11 | 12 | (defun summarize (txt-obj &optional (num-return 3)) 13 | (let* ((words (text-text txt-obj)) 14 | (num-words (length words)) 15 | (cats (text-category-tags txt-obj)) 16 | (sentence-count 0) 17 | best-sentences sentence (score 0)) 18 | ;; loop over sentences: 19 | (dotimes (i num-words) 20 | (let* ((word (svref words i))) 21 | (dolist (cat cats) 22 | (let* ((hash (gethash (car cat) categoryToHash)) 23 | (value (gethash word hash))) 24 | (if value 25 | (setq score (+ score (* 0.01 value (cadr cat))))))) 26 | (push word sentence) 27 | (if (or (equal word ".") (equal word "!") (equal word ";")) 28 | (let () 29 | (setq sentence (reverse sentence)) 30 | (setq score (/ score (1+ (length sentence)))) 31 | (setq sentence-count (1+ sentence-count)) 32 | ;;(format t "~%~A : ~A~%" sentence score) 33 | ;; process this sentence: 34 | (if (and (> score 1.0) (> (length sentence) 4) (< (length sentence) 30)) 35 | (progn 36 | (setq sentence 37 | (reduce #'(lambda (x y) (concatenate 'string x " " y)) (coerce sentence 'list))) 38 | (push (list sentence score) best-sentences))) 39 | (setf sentence nil score 0))))) 40 | (setf best-sentences (sort best-sentences #'(lambda (x y) (> (cadr x) (cadr y))))) 41 | (if best-sentences 42 | (replace-all 43 | (reduce #'(lambda (x y) (concatenate 'string x " " y)) (mapcar #'(lambda (x) (car x)) best-sentences)) 44 | " ." ".") 45 | ""))) 46 | 47 | 48 | -------------------------------------------------------------------------------- /opencalais/load.lisp: -------------------------------------------------------------------------------- 1 | ;; load and run Open Calais example 2 | 3 | (load "opencalais-lib") 4 | 5 | ;;(setf x (cl-user::entities-from-opencalais-query "Senator Hiliary Clinton spoke with the president of France. Clinton and John Smith talked on the airplane going to California. IBM and Pepsi contributed to Clinton's campaign.")) 6 | 7 | (load "opencalais-data-store") 8 | 9 | (load "test-opencalais") 10 | -------------------------------------------------------------------------------- /opencalais/opencalais-data-store.lisp: -------------------------------------------------------------------------------- 1 | ;; Use the opencalais-lib.lisp utilities to create 2 | ;; an RDF data store. Assume that a AG RDF repository is open. 3 | 4 | ;; Copyright Mark Watson 2008-2010. All Rights Reserved. 5 | ;; License: LGPL version 3 (http://www.gnu.org/licenses/lgpl-3.0.txt) 6 | 7 | (require :agraph) 8 | 9 | (in-package :db.agraph.user ) 10 | (enable-!-reader) 11 | 12 | (register-namespace "kb" "http:/knowledgebooks.com/rdfs#") 13 | 14 | (let ((hash (make-hash-table :test #'equal))) 15 | (setf (gethash "Country" hash) !kb:containsCountry) 16 | (setf (gethash "Person" hash) !kb:containsPerson) 17 | (setf (gethash "Company" hash) !kb:containsCompany) 18 | (setf (gethash "ProvinceOrState" hash) !kb:containsState) 19 | (setf (gethash "Product" hash) !kb:containsProduct) 20 | (setf (gethash "Position" hash) !kb:containsProduct) 21 | (defun get-rdf-predicate-from-entity-type (entity-type) 22 | (let ((et (gethash entity-type hash))) 23 | (if (not et) 24 | (progn 25 | (setf et entity-type) ;; just use a string literal 26 | (format t 27 | "Warning: entity-type ~S not defined in opencalais-data-store.lisp~%" entity-type))) 28 | et))) 29 | 30 | (defun add-entities-to-rdf-store (subject-uri text) 31 | "subject-uri if the subject for triples that this function defines" 32 | (maphash 33 | #'(lambda (key val) 34 | (dolist (entity-val val) 35 | (add-triple 36 | subject-uri 37 | (get-rdf-predicate-from-entity-type key) 38 | (literal entity-val)))) 39 | (cl-user::entities-from-opencalais-query text))) 40 | 41 | 42 | -------------------------------------------------------------------------------- /opencalais/opencalais-lib.lisp: -------------------------------------------------------------------------------- 1 | ;; Copyright Mark Watson 2008-2010. All Rights Reserved. 2 | ;; License: LGPL version 3 (http://www.gnu.org/licenses/lgpl-3.0.txt) 3 | 4 | ;;(eval-when (compile load eval) 5 | ;; (require :aserve)) ;; to pick up client library 6 | ;;(require :agraph)) 7 | 8 | (require :aserve) 9 | (push "../utils/split-sequence/" asdf:*central-registry*) 10 | (asdf:operate 'asdf:load-op :split-sequence) 11 | 12 | (defvar *my-opencalais-key* (sys::getenv "OPEN_CALAIS_KEY")) 13 | 14 | (defvar *PARAMS* 15 | (concatenate 'string 16 | "¶msXML=" 17 | (cl-user::MAKE-ESCAPED-STRING ""))) 18 | 19 | (defun entities-from-opencalais-query (query &aux url results index1 index2 lines tokens hash) 20 | (setf hash (make-hash-table :test #'equal)) 21 | (setf url 22 | (concatenate 'string 23 | "http://api.opencalais.com/enlighten/calais.asmx/Enlighten?" 24 | "licenseID=" 25 | *my-opencalais-key* 26 | "&content=" 27 | (cl-user::MAKE-ESCAPED-STRING query) 28 | *PARAMS*)) 29 | (setf results (net.aserve.client:do-http-request url)) 30 | (setq index1 (search "terms of service.-->" results)) 31 | (setq index1 (search "<!--" results :start2 index1)) 32 | (setq index2 (search "-->" results :start2 index1)) 33 | (setq results (subseq results (+ index1 7) index2)) 34 | (setq lines 35 | (split-sequence:split-sequence #\Newline results)) 36 | (dolist (line lines) 37 | (setq index1 (search ": " line)) 38 | (if index1 39 | (let ((key (subseq line 0 index1)) 40 | (values (split-sequence:split-sequence ", " (subseq line (+ index1 2))))) 41 | (if (not (string-equal "Relations" key)) 42 | (setf (gethash key hash) values))))) 43 | (maphash 44 | #'(lambda (key val) (format t "key: ~S val: ~S~%" key val)) 45 | hash) 46 | hash) 47 | 48 | 49 | ;; (setf x (entities-from-opencalais-query "Senator Hiliary Clinton spoke with the president of France. Clinton and John Smith talked on the airplane going to California. IBM and Pepsi contributed to Clinton's campaign.")) 50 | 51 | 52 | (defun replace-all (string part replacement &key (test #'char=)) 53 | "Returns a new string in which all the occurrences of the part 54 | is replaced with replacement." 55 | (with-output-to-string (out) 56 | (loop with part-length = (length part) 57 | for old-pos = 0 then (+ pos part-length) 58 | for pos = (search part string 59 | :start2 old-pos 60 | :test test) 61 | do (write-string string out 62 | :start old-pos 63 | :end (or pos (length string))) 64 | when pos do (write-string replacement out) 65 | while pos))) 66 | 67 | 68 | -------------------------------------------------------------------------------- /opencalais/test-opencalais.lisp: -------------------------------------------------------------------------------- 1 | (require :agraph) 2 | (in-package :db.agraph.user) 3 | 4 | (create-triple-store "/tmp/rdfstore_1") 5 | 6 | ;;(cl-user::add-entities-to-rdf-store ! "Senator Hiliary Clinton spoke with the president of France. Clinton and John Smith talked on the airplane going to California. IBM and Pepsi contributed to Clinton's campaign.") 7 | 8 | (print-triples (get-triples-list) :format :concise) 9 | 10 | (print-triples 11 | (get-triples-list 12 | :p (get-rdf-predicate-from-entity-type "Company") 13 | :o (literal "Pepsi")) 14 | :format :concise) 15 | -------------------------------------------------------------------------------- /quick_start_allegrograph_lisp_embedded/geoloc.lisp: -------------------------------------------------------------------------------- 1 | (require :agraph) 2 | 3 | ;; Copyright Mark Watson 2001-2010. All Rights Reserved. 4 | ;; License: LGPL version 3 (http://www.gnu.org/licenses/lgpl-3.0.txt) 5 | 6 | (in-package :db.agraph.user) 7 | (enable-!-reader) 8 | (register-namespace "g" "http://knowledgebooks.com/geo#") 9 | (create-triple-store "/tmp/geospatial-test") 10 | 11 | 12 | ;; define some locations in Verde Valley, Arizona: 13 | (defvar *locs* 14 | '(("Verde_Valley_Ranger_Station" 34.7666667 -112.1416667) 15 | ("Verde_Valley_School" 34.8047596 -111.8060388) 16 | ("Sedona" 34.8697222 -111.7602778) 17 | ("Cottonwood" 34.739 -112.009) 18 | ("Jerome" 34.75 -112.11) 19 | ("Flagstaff" 35.20 -111.63) 20 | ("Clarkdale" 34.76 -112.05) 21 | ("Mount_Wilson" 35.996 -114.611) 22 | ("Tuzigoot" 34.56 -111.84))) 23 | 24 | (defvar *min-lat* (reduce #'min (mapcar #'cadr *locs*))) 25 | (defvar *max-lat* (reduce #'max (mapcar #'cadr *locs*))) 26 | (defvar *min-lon* (reduce #'min (mapcar #'caddr *locs*))) 27 | (defvar *max-lon* (reduce #'max (mapcar #'caddr *locs*))) 28 | 29 | ;; create a type: 30 | (setf offset 5.0) 31 | (flet ((fixup (num direction) 32 | (if (eq direction :min) 33 | (- num offset) 34 | (+ num offset)))) 35 | (setf *verde-valley-arizona* 36 | (db.agraph:register-latitude-striping-in-miles 37 | 3 38 | :lat-min (fixup *min-lat* :min) 39 | :lat-max (fixup *max-lat* :max) 40 | :lon-min (fixup *min-lon* :min) 41 | :lon-max (fixup *max-lon* :max)))) 42 | 43 | (add-geospatial-subtype-to-db *verde-valley-arizona*) 44 | 45 | (dolist (loc *locs*) 46 | (let ((name (intern-resource (format nil "http://knowledgebooks.com/geo#~a" (car loc))))) 47 | (print name) 48 | (add-triple name !g:isAt3 (longitude-latitude->upi *verde-valley-arizona* (caddr loc) (cadr loc))))) 49 | 50 | (index-all-triples :wait t) 51 | 52 | 53 | (print 54 | (count-cursor 55 | (get-triples-haversine-miles *verde-valley-arizona* !g:isAt3 -112.009 34.739 30.0))) 56 | 57 | (dolist (distance '(50.0 30.0 10.0 5.0)) 58 | (format t "~%~%Checking with distance = ~A~%" distance) 59 | (let ((cursor (get-triples-haversine-miles *verde-valley-arizona* !g:isAt3 -112.009 34.739 distance))) 60 | (while (cursor-next-p cursor) 61 | (print (cursor-next-row cursor))))) 62 | 63 | -------------------------------------------------------------------------------- /quick_start_allegrograph_lisp_embedded/prolog.lisp: -------------------------------------------------------------------------------- 1 | (require :agraph) 2 | (in-package :db.agraph.user) 3 | 4 | (enable-!-reader) ; enable the ! reader macro 5 | 6 | (create-triple-store "/tmp/rdfstore_prolog_1" :if-exists :supersede) 7 | 8 | (register-namespace "kb" "http://knowledgebooks.com/ontology/#") 9 | 10 | (load-ntriples #p"quick_start_allegrograph_lisp_embedded/sample_news.nt") 11 | 12 | (print-triples (get-triples-list)) 13 | 14 | (select (?s ?p ?o) 15 | (q- ?s ?p ?o)) 16 | 17 | (select (?news_uri ?summary) 18 | (q- ?news_uri !kb:summary ?summary)) 19 | 20 | (select (?news_uri ?summary) 21 | (q- ?news_uri !kb:summary ?summary) 22 | (q- ?news_uri !kb:storyType !kb:disaster)) 23 | -------------------------------------------------------------------------------- /quick_start_allegrograph_lisp_embedded/quickstart.lisp: -------------------------------------------------------------------------------- 1 | (require :agraph) 2 | (in-package :db.agraph.user) 3 | 4 | ;; Copyright Mark Watson 2001-2010. All Rights Reserved. 5 | ;; License: LGPL version 3 (http://www.gnu.org/licenses/lgpl-3.0.txt) 6 | 7 | (enable-!-reader) ; enable the ! reader macro 8 | 9 | (create-triple-store "/tmp/rdfstore_1") 10 | (register-namespace "kb" "http://knowledgebooks.com/rdfs#") 11 | 12 | (resource "http://demo_news/12931") 13 | (defvar *demo-article* (resource "http://demo_news/12931")) 14 | *demo-article* 15 | 16 | (add-triple *demo-article* !rdf:type !kb:article) 17 | (add-triple *demo-article* !kb:containsPerson !"Barack Obama") 18 | 19 | (get-triple-by-id 2) 20 | (defvar *triple* (get-triple-by-id 2)) 21 | 22 | ;; get triples as a list: 23 | (get-triples-list :o !"Barack Obama") 24 | 25 | ;; get triples using a cursor: 26 | (setq a-cursor (get-triples :s *demo-article*)) 27 | (while (cursor-next-p a-cursor) 28 | (print (cursor-next-row a-cursor))) ; cursor-next returns a vector, not a triple 29 | 30 | (print-triple *triple* :format :concise) 31 | (print-triple *triple*) 32 | (print-triples (list *triple*)) 33 | 34 | ;; queries: 35 | (print-triples (get-triples)) 36 | (print-triples (get-triples :s *demo-article*)) 37 | (print-triples 38 | (get-triples :s *demo-article* :o !kb:article)) 39 | 40 | ;; write triple store to a file in NTriple format: 41 | (with-open-file 42 | (output "/tmp/sample.ntriple" 43 | :direction :output 44 | :if-does-not-exist :create) 45 | (print-triples (get-triples) :stream output :format :ntriple)) 46 | 47 | -------------------------------------------------------------------------------- /quick_start_allegrograph_lisp_embedded/sample_news.nt: -------------------------------------------------------------------------------- 1 | . 2 | 3 | "Oak Creek flooded last week affecting 5 businesses" . 4 | 5 | . 6 | 7 | "The fire on Bear Mountain was caused by lightening" . 8 | 9 | . 10 | 11 | . 12 | 13 | "Trout fishing season started last weekend" . 14 | 15 | . 16 | -------------------------------------------------------------------------------- /quick_start_allegrograph_lisp_embedded/text.lisp: -------------------------------------------------------------------------------- 1 | (require :agraph) 2 | (in-package :db.agraph.user) 3 | 4 | ;; Copyright Mark Watson 2001-2010. All Rights Reserved. 5 | ;; License: LGPL version 3 (http://www.gnu.org/licenses/lgpl-3.0.txt) 6 | 7 | (enable-!-reader) ; enable the ! reader macro 8 | 9 | (create-triple-store "/tmp/index_test") 10 | (register-namespace "kb" "http://knowledgebooks.com/rdfs#") 11 | 12 | (register-freetext-predicate !kb:containsPerson) 13 | 14 | (freetext-registered-predicates) ; print out all predicates registered to have objects indexed 15 | 16 | (resource "http://demo_news/12931") 17 | (defvar *demo-article* (resource "http://demo_news/12931")) 18 | *demo-article* 19 | 20 | (add-triple *demo-article* !rdf:type !kb:article) 21 | (add-triple *demo-article* !kb:containsPerson !"Barack Obama") 22 | (add-triple *demo-article* !kb:containsPerson !"Bill Clinton") 23 | (add-triple *demo-article* !kb:containsPerson !"Bill Jones") 24 | 25 | (print (freetext-get-ids "Clinton")) 26 | 27 | ;; get results using a cursor (recommended): 28 | (iterate-cursor (triple (freetext-get-triples '(and "Bill" "Jones"))) 29 | (print triple)) 30 | (iterate-cursor (triple (freetext-get-triples "Bill")) 31 | (print triple)) 32 | (iterate-cursor (triple (freetext-get-triples '(or "Jones" "Clinton"))) 33 | (print triple)) 34 | 35 | ;; get results as a list: 36 | (print 37 | (freetext-get-triples-list '(or "Bill" "Barack"))) 38 | 39 | -------------------------------------------------------------------------------- /rdf/rdfext.lisp: -------------------------------------------------------------------------------- 1 | ;; demonstration of AllegroGraph RDF extensions: 2 | 3 | (require :agraph) 4 | (in-package :db.agraph.user) 5 | 6 | (create-triple-store "/tmp/rdfstore_1") 7 | 8 | ;; default data store is kept in *db* 9 | *db* 10 | 11 | (register-namespace "kb" "http://knowledgebooks.com/rdfs#") 12 | 13 | (resource "http://demo_news/12931") 14 | (defvar *demo-article* (resource "http://demo_news/12931")) 15 | 16 | (add-triple *demo-article* !rdf:type !kb:article :db *db* :g !"news-data") 17 | (add-triple *demo-article* !kb:containsPerson !"Barack Obama" :db *db* :g !"news-data") 18 | 19 | (add-triple *demo-article* !kb:processed !"yes" :db *db* :g !"work-flow") 20 | 21 | ;; query on optional graph value: 22 | (print-triples (get-triples :g !"work-flow")) 23 | 24 | 25 | (get-triple-by-id 3) 26 | -------------------------------------------------------------------------------- /sparql/news.n3: -------------------------------------------------------------------------------- 1 | @prefix kb: . 2 | @prefix rdfs: . 3 | 4 | kb:containsCity rdfs:subPropertyOf kb:containsPlace . 5 | 6 | kb:containsCountry rdfs:subPropertyOf kb:containsPlace . 7 | 8 | kb:containsState rdfs:subPropertyOf kb:containsPlace . 9 | 10 | kb:containsCity "Burlington" , "Denver" , "St. Paul" , "Chicago" , "Quincy" , "CHICAGO" , "Iowa City" ; 11 | kb:containsRegion "U.S. Midwest" , "Midwest" ; 12 | kb:containsCountry "United States" , "Japan" ; 13 | kb:containsState "Minnesota" , "Illinois" , "Mississippi" , "Iowa" ; 14 | kb:containsOrganization "National Guard" , "U.S. Department of Agriculture" , "White House" , "Chicago Board of Trade" , "Department of Transportation" ; 15 | kb:containsPerson "Dena Gray-Fisher" , "Donald Miller" , "Glenn Hollander" , "Rich Feltes" , "George W. Bush" ; 16 | kb:containsIndustryTerm "food inflation" , "food" , "finance ministers" , "oil" . 17 | 18 | kb:containsCity "Washington" , "FLINT" , "Baghdad" , "Arlington" , "Flint" ; 19 | kb:containsCountry "United States" , "Afghanistan" , "Iraq" ; 20 | kb:containsState "Illinois" , "Virginia" , "Arizona" , "Michigan" ; 21 | kb:containsOrganization "White House" , "Obama administration" , "Iraqi government" ; 22 | kb:containsPerson "David Petraeus" , "John McCain" , "Hoshiyar Zebari" , "Barack Obama" , "George W. Bush" , "Carly Fiorina" ; 23 | kb:containsIndustryTerm "oil prices" . 24 | 25 | kb:containsCity "WASHINGTON" ; 26 | kb:containsCountry "United States" , "Pakistan" , "Islamic Republic of Iran" ; 27 | kb:containsState "Maryland" ; 28 | kb:containsOrganization "University of Maryland" , "United Nations" ; 29 | kb:containsPerson "Ban Ki-moon" , "Gordon Brown" , "Hu Jintao" , "George W. Bush" , "Pervez Musharraf" , "Vladimir Putin" , "Steven Kull" , "Mahmoud Ahmadinejad" . 30 | 31 | kb:containsCity "Sao Paulo" , "Kuala Lumpur" ; 32 | kb:containsRegion "Midwest" ; 33 | kb:containsCountry "United States" , "Britain" , "Saudi Arabia" , "Spain" , "Italy" , "India" , "France" , "Canada" , "Russia" , "Germany" , "China" , "Japan" , "South Korea" ; 34 | kb:containsOrganization "Federal Reserve Bank" , "European Union" , "European Central Bank" , "European Commission" ; 35 | kb:containsPerson "Lee Myung-bak" , "Rajat Nag" , "Luiz Inacio Lula da Silva" , "Jeffrey Lacker" ; 36 | kb:containsCompany "Development Bank Managing" , "Reuters" , "Richmond Federal Reserve Bank" ; 37 | kb:containsIndustryTerm "central bank" , "food" , "energy costs" , "finance ministers" , "crude oil prices" , "oil prices" , "oil shock" , "food prices" , "Finance ministers" , "Oil prices" , "oil" . 38 | -------------------------------------------------------------------------------- /sparql/sparql_query.lisp: -------------------------------------------------------------------------------- 1 | (require :agraph) 2 | (in-package :db.agraph.user) 3 | 4 | (create-triple-store "/tmp/rdfstore_1") 5 | (register-namespace "kb" "http:://knowledgebooks.com/ontology#") 6 | (register-namespace "test_news" "http://news.yahoo.com/s/nm/20080616/ts_nm") 7 | 8 | (load-ntriples "news.nt") 9 | 10 | ;; warning: the following generates an XML response: 11 | 12 | (sparql:run-sparql " 13 | PREFIX kb: 14 | SELECT ?article_uri ?city_name WHERE { 15 | ?article_uri kb:containsCity ?city_name . 16 | }") 17 | 18 | 19 | ;; generate a list of hash tables response: 20 | 21 | (defvar *r1* 22 | (sparql:run-sparql " 23 | PREFIX kb: 24 | SELECT ?article_uri ?city_name WHERE { 25 | ?article_uri kb:containsCity ?city_name . 26 | }" 27 | :results-format :hashes)) 28 | 29 | (dolist (result *r1*) 30 | (maphash 31 | #'(lambda (key value) 32 | (format t " key: ~S value: ~S~%" 33 | key value)) 34 | result)) 35 | 36 | ;; try an ASK query: 37 | 38 | (sparql:run-sparql " 39 | PREFIX kb: 40 | ASK { 41 | ?any_article kb:containsCity 'Chicago' 42 | }" 43 | :results-format :boolean) 44 | 45 | ;; query that returns a list of arrays for each result: 46 | 47 | (sparql:run-sparql " 48 | PREFIX kb: 49 | SELECT ?article_uri ?city_name WHERE { 50 | ?article_uri kb:containsCity ?city_name . 51 | }" 52 | :results-format :arrays) 53 | 54 | ;; query to find all cities and people mentioned in each article: 55 | 56 | (sparql:run-sparql " 57 | PREFIX kb: 58 | SELECT ?article_uri ?city_name ?person_name WHERE { 59 | ?article_uri kb:containsCity ?city_name . 60 | ?article_uri kb:containsPerson ?person_name . 61 | }" 62 | :results-format :arrays) 63 | 64 | ;; using regular expression filters: 65 | 66 | (sparql:run-sparql " 67 | PREFIX kb: 68 | SELECT ?article_uri WHERE { 69 | ?article_uri kb:containsPerson ?person_name . 70 | FILTER regex(?person_name, '^*Putin*') 71 | }" 72 | :results-format :lists) 73 | 74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /test_data/news_articles/economy_1.txt: -------------------------------------------------------------------------------- 1 | The plan to move toxic mortgage-related debt off the balance sheets of U.S. banks and 2 | other institutions, and into a massive government portfolio, represents an all-out 3 | attack on the worst financial crisis since the Great Depression. 4 | 5 | Under authority sought by the U.S. Treasury Department, the government could 6 | purchase as much as $700 billion in mortgage-related assets from U.S.-headquartered 7 | institutions. 8 | 9 | Decisions by the treasury secretary related to the buyback program could not be 10 | reviewed by any court, according to a copy of the department's draft legislation. 11 | 12 | But the financial "house of cards was much bigger, and it started to stretch 13 | beyond just Wall Street. 14 | 15 | -------------------------------------------------------------------------------- /test_data/news_articles/economy_2.txt: -------------------------------------------------------------------------------- 1 | 2 | The legislation Congress passed this summer that gave the authority to rescue 3 | Fannie and Freddie boosted the limit on the national debt by $800 billion 4 | to $10.6 trillion. 5 | 6 | The legislation the administration is now seeking to authorize the financial 7 | system bailout, according to a draft obtained by The Associated Press, would 8 | boost that debt limit to $11.3 trillion, up another $1.3 trillion. 9 | 10 | It is the rapidly rising debt that is cause for concern. The government is 11 | already spending more than $400 billion a year just to pay interest on 12 | the national debt. The higher that debt goes, the higher the government's 13 | borrowing costs and the less it has to spend on other programs. 14 | -------------------------------------------------------------------------------- /test_data/news_articles/news_1.txt: -------------------------------------------------------------------------------- 1 | Which Barack Obama will show up for the first presidential debate? 2 | ADVERTISEMENT 3 | 4 | It could be the tone-deaf debater who condescendingly told Hillary Rodham Clinton during a Democratic debate that she was "likable enough." 5 | 6 | Or perhaps the confident candidate who absorbed a jab from Clinton about using her husband's former advisers and responded with a devastating one-liner of his own: "Hillary, I'm looking forward to you advising me as well." 7 | 8 | For a man known as a powerful speaker, Obama has rarely wowed people in political debates. He can come across as lifeless, aloof and windy. 9 | 10 | But Obama didn't make any serious mistakes in the many debates during the Democratic primary, or when he was running for the U.S. Senate in Illinois. He sometimes showed flashes of wit and charm. And, with a couple of exceptions, he got better with time. 11 | 12 | "A year ago, he was not nearly as polished," said Timothy O'Donnell, a professor at the University of Mary Washington and chairman of the collegiate National Debate Tournament. "He equivocates less. He's quicker with examples." 13 | 14 | O'Donnell says staying on offense will be key if Obama wants to shape the discussion and reach undecided voters. 15 | 16 | The Illinois senator failed to do that in what is often mentioned as his worst performance in a major debate, an April 16 confrontation with Clinton in Philadelphia. 17 | 18 | With Obama on the verge of wrapping up the nomination, the moderators focused on his potential weaknesses, asking questions about Obama's former minister, his policy on flag lapel pins and his comments about rural people clinging to guns and religion. 19 | 20 | Obama seemed deflated by the questioning and failed to steer the debate toward his theme of change. His performance did little to reassure nervous supporters. 21 | 22 | In another debate, Obama was asked how he'd respond militarily if terrorists attacked two American cities simultaneously. Rather than display any passion, Obama discussed emergency response procedures and intelligence-gathering. 23 | 24 | A flat performance is one thing; the big worry is a single thoughtless remark that sticks in voters' minds. Obama still catches flak for a few remarks from the primary debates. 25 | 26 | In last year's YouTube debate, Obama said he would be willing to meet the leaders of nations such as Cuba, Iran and North Korea without preconditions. 27 | -------------------------------------------------------------------------------- /test_data/news_articles/news_2.txt: -------------------------------------------------------------------------------- 1 | Presidential candidate Barack Obama urged the Federal Reserve and the Treasury on Thursday to take emergency steps to keep credit flowing to the troubled housing market, saying it would help stem the crisis sweeping financial markets. 2 | 3 | "The events of the past few days have made clear that we need to do more right now," the Democratic senator from Illinois told a campaign rally in New Mexico. 4 | 5 | "That is why I am calling on the Treasury and the Federal Reserve to use their emergency authorities to maintain the flow of credit, to support the availability of mortgages, and to ensure that our financial system is well-capitalized." 6 | 7 | In an effort to free up bank-to-bank lending frozen by the Wall Street upheaval, the Fed made an extra $180 billion available to major central banks to lend to their local commercial banks to get U.S. dollars circulating in overnight and short-term money markets. 8 | 9 | The latest move brought to $247 billion the total amount of dollars the Fed was providing to other central banks. 10 | 11 | As Wall Street grapples with the worst crisis since the Great Depression, the financial turmoil has become the top theme on the campaign trail where Obama is locked in a tight race with his Republican rival John McCain. 12 | 13 | The woes at a series of financial firms such as Lehman Brothers Holdings and American International Group are adding to economic anxiety among Americans already struggling with job losses and declining home values. 14 | 15 | In addition to calling for a short-term boost to the mortgage market by the Fed and Treasury, Obama also called for legislation that he said would provide a longer-term remedy to the Wall Street turbulence by giving policy makers better tools for managing problems. 16 | -------------------------------------------------------------------------------- /test_data/rdfa_data/test.rb: -------------------------------------------------------------------------------- 1 | require 'pp' 2 | require 'rubygems' 3 | require 'rdfa' 4 | class MyClass 5 | acts_as_rdfa_parser 6 | end 7 | c = MyClass.new 8 | source = File.open("wikipedia-ex-html", "r").read 9 | results = c.parse(source) 10 | pp results 11 | -------------------------------------------------------------------------------- /test_data/rdfa_data/wikipedia-ex.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 8 | 9 | John's Home Page 10 | 11 | 12 | 13 | 14 |

John's Home Page

15 |

My name is John D and I like 16 | Einstürzende Neubauten. 18 |

19 |

20 | My favorite 21 | book is the inspiring Weaving the Web by 23 | Tim Berners-Lee 24 |

25 | 26 | 27 | -------------------------------------------------------------------------------- /utils/chunga-1.1.1/CHANGELOG.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mark-watson/lisp_practical_semantic_web/cb55635a973b0330e0628ed3a59fcf5388eb5b67/utils/chunga-1.1.1/CHANGELOG.txt -------------------------------------------------------------------------------- /utils/chunga-1.1.1/chunga.asd: -------------------------------------------------------------------------------- 1 | ;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*- 2 | ;;; $Header: /usr/local/cvsrep/chunga/chunga.asd,v 1.20 2008/05/24 18:38:30 edi Exp $ 3 | 4 | ;;; Copyright (c) 2006-2010, Dr. Edmund Weitz. All rights reserved. 5 | 6 | ;;; Redistribution and use in source and binary forms, with or without 7 | ;;; modification, are permitted provided that the following conditions 8 | ;;; are met: 9 | 10 | ;;; * Redistributions of source code must retain the above copyright 11 | ;;; notice, this list of conditions and the following disclaimer. 12 | 13 | ;;; * Redistributions in binary form must reproduce the above 14 | ;;; copyright notice, this list of conditions and the following 15 | ;;; disclaimer in the documentation and/or other materials 16 | ;;; provided with the distribution. 17 | 18 | ;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED 19 | ;;; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | ;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | ;;; ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 22 | ;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | ;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 24 | ;;; GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | ;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | ;;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 27 | ;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | ;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | (asdf:defsystem :chunga 31 | :serial t 32 | :version "1.1.1" 33 | :depends-on (:trivial-gray-streams) 34 | :components ((:file "packages") 35 | (:file "specials") 36 | (:file "util") 37 | (:file "known-words") 38 | (:file "conditions") 39 | (:file "read") 40 | (:file "streams") 41 | (:file "input") 42 | (:file "output"))) 43 | -------------------------------------------------------------------------------- /utils/chunga-1.1.1/packages.lisp: -------------------------------------------------------------------------------- 1 | ;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*- 2 | ;;; $Header: /usr/local/cvsrep/chunga/packages.lisp,v 1.19 2008/05/24 18:38:30 edi Exp $ 3 | 4 | ;;; Copyright (c) 2006-2010, Dr. Edmund Weitz. All rights reserved. 5 | 6 | ;;; Redistribution and use in source and binary forms, with or without 7 | ;;; modification, are permitted provided that the following conditions 8 | ;;; are met: 9 | 10 | ;;; * Redistributions of source code must retain the above copyright 11 | ;;; notice, this list of conditions and the following disclaimer. 12 | 13 | ;;; * Redistributions in binary form must reproduce the above 14 | ;;; copyright notice, this list of conditions and the following 15 | ;;; disclaimer in the documentation and/or other materials 16 | ;;; provided with the distribution. 17 | 18 | ;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED 19 | ;;; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | ;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | ;;; ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 22 | ;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | ;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 24 | ;;; GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | ;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | ;;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 27 | ;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | ;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | (in-package :cl-user) 31 | 32 | (defpackage :chunga 33 | (:use :cl :trivial-gray-streams) 34 | #+:lispworks 35 | (:import-from :lw :when-let) 36 | (:export :*accept-bogus-eols* 37 | :*current-error-message* 38 | :*treat-semicolon-as-continuation* 39 | :assert-char 40 | :as-keyword 41 | :as-capitalized-string 42 | :chunga-error 43 | :chunga-warning 44 | :chunked-input-stream 45 | :chunked-input-stream-extensions 46 | :chunked-input-stream-trailers 47 | :chunked-io-stream 48 | :chunked-output-stream 49 | :chunked-stream 50 | :chunked-stream-input-chunking-p 51 | :chunked-stream-output-chunking-p 52 | :chunked-stream-stream 53 | :input-chunking-body-corrupted 54 | :input-chunking-unexpected-end-of-file 55 | :make-chunked-stream 56 | :read-http-headers 57 | :peek-char* 58 | :read-char* 59 | :read-line* 60 | :read-name-value-pair 61 | :read-name-value-pairs 62 | :read-token 63 | :skip-whitespace 64 | :syntax-error 65 | :token-char-p 66 | :trim-whitespace 67 | :with-character-stream-semantics)) 68 | 69 | -------------------------------------------------------------------------------- /utils/cl-base64-3.3.3/COPYING: -------------------------------------------------------------------------------- 1 | Copyright (c) 2002-2003 by Kevin Rosenberg 2 | 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions 7 | are met: 8 | 1. Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | 2. Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | 3. The name of the Authors may not be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR 17 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 20 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23 | BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 | OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 26 | IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | -------------------------------------------------------------------------------- /utils/cl-base64-3.3.3/cl-base64.asd: -------------------------------------------------------------------------------- 1 | ;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*- 2 | ;;;; ************************************************************************* 3 | ;;;; FILE IDENTIFICATION 4 | ;;;; 5 | ;;;; Name: cl-base64.asd 6 | ;;;; Purpose: ASDF definition file for Cl-Base64 7 | ;;;; Programmer: Kevin M. Rosenberg 8 | ;;;; Date Started: Dec 2002 9 | ;;;; 10 | ;;;; $Id$ 11 | ;;;; ************************************************************************* 12 | 13 | (in-package #:cl-user) 14 | (defpackage #:cl-base64-system (:use #:asdf #:cl)) 15 | (in-package #:cl-base64-system) 16 | 17 | 18 | (defsystem cl-base64 19 | :name "cl-base64" 20 | :author "Kevin M. Rosenberg based on initial code by Juri Pakaste" 21 | :version "3.1" 22 | :maintainer "Kevin M. Rosenberg " 23 | :licence "BSD-style" 24 | :description "Base64 encoding and decoding with URI support." 25 | :components 26 | ((:file "package") 27 | (:file "encode" :depends-on ("package")) 28 | (:file "decode" :depends-on ("package")) 29 | )) 30 | 31 | (defmethod perform ((o test-op) (c (eql (find-system 'cl-base64)))) 32 | (operate 'load-op 'cl-base64-tests) 33 | (operate 'test-op 'cl-base64-tests :force t)) 34 | 35 | (defsystem cl-base64-tests 36 | :depends-on (cl-base64 ptester kmrcl) 37 | :components 38 | ((:file "tests"))) 39 | 40 | (defmethod perform ((o test-op) (c (eql (find-system 'cl-base64-tests)))) 41 | (operate 'load-op 'cl-base64-tests) 42 | (or (funcall (intern (symbol-name '#:do-tests) 43 | (find-package '#:cl-base64-tests))) 44 | (error "test-op failed"))) 45 | -------------------------------------------------------------------------------- /utils/cl-base64-3.3.3/package.lisp: -------------------------------------------------------------------------------- 1 | ;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10 -*- 2 | ;;;; ************************************************************************* 3 | ;;;; FILE IDENTIFICATION 4 | ;;;; 5 | ;;;; Name: package.lisp 6 | ;;;; Purpose: Package definition for cl-base64 7 | ;;;; Programmer: Kevin M. Rosenberg 8 | ;;;; Date Started: Dec 2002 9 | ;;;; 10 | ;;;; $Id$ 11 | ;;;; 12 | ;;;; ************************************************************************* 13 | 14 | (defpackage #:cl-base64 15 | (:nicknames #:base64) 16 | (:use #:cl) 17 | (:export #:base64-stream-to-integer 18 | #:base64-string-to-integer 19 | #:base64-string-to-string 20 | #:base64-stream-to-string 21 | #:base64-string-to-stream 22 | #:base64-stream-to-stream 23 | #:base64-string-to-usb8-array 24 | #:base64-stream-to-usb8-array 25 | #:string-to-base64-string 26 | #:string-to-base64-stream 27 | #:usb8-array-to-base64-string 28 | #:usb8-array-to-base64-stream 29 | #:stream-to-base64-string 30 | #:stream-to-base64-stream 31 | #:integer-to-base64-string 32 | #:integer-to-base64-stream 33 | 34 | ;; For creating custom encode/decode tables 35 | #:*uri-encode-table* 36 | #:*uri-decode-table* 37 | #:make-decode-table 38 | 39 | #:test-base64 40 | )) 41 | 42 | (in-package #:cl-base64) 43 | 44 | 45 | (defvar *encode-table* 46 | "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/") 47 | (declaim (type simple-string *encode-table*)) 48 | 49 | (defvar *uri-encode-table* 50 | "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_") 51 | (declaim (type simple-string *uri-encode-table*)) 52 | 53 | (deftype decode-table () '(simple-array fixnum (256))) 54 | 55 | (defun make-decode-table (encode-table) 56 | (let ((dt (make-array 256 :adjustable nil :fill-pointer nil 57 | :element-type 'fixnum 58 | :initial-element -1))) 59 | (declare (type decode-table dt)) 60 | (loop for char of-type character across encode-table 61 | for index of-type fixnum from 0 below 64 62 | do (setf (aref dt (the fixnum (char-code char))) index)) 63 | dt)) 64 | 65 | (defvar *decode-table* (make-decode-table *encode-table*)) 66 | 67 | (defvar *uri-decode-table* (make-decode-table *uri-encode-table*)) 68 | 69 | (defvar *pad-char* #\=) 70 | (defvar *uri-pad-char* #\.) 71 | (declaim (type character *pad-char* *uri-pad-char*)) 72 | -------------------------------------------------------------------------------- /utils/cl-base64-3.3.3/tests.lisp: -------------------------------------------------------------------------------- 1 | ;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*- 2 | ;;;; ************************************************************************* 3 | ;;;; FILE IDENTIFICATION 4 | ;;;; 5 | ;;;; Name: test.lisp 6 | ;;;; Purpose: Regression tests for cl-base64 7 | ;;;; Programmer: Kevin M. Rosenberg 8 | ;;;; Date Started: Jan 2003 9 | ;;;; 10 | ;;;; $Id$ 11 | ;;;; ************************************************************************* 12 | 13 | (in-package #:cl-user) 14 | 15 | (defpackage #:cl-base64-tests 16 | (:use #:cl #:kmrcl #:cl-base64 #:ptester)) 17 | 18 | (in-package #:cl-base64-tests) 19 | 20 | (defun do-tests () 21 | (with-tests (:name "cl-base64 tests") 22 | (let ((*break-on-test-failures* t)) 23 | (do* ((length 0 (+ 3 length)) 24 | (string (make-string length) (make-string length)) 25 | (usb8 (make-usb8-array length) (make-usb8-array length)) 26 | (integer (random (expt 10 length)) (random (expt 10 length)))) 27 | ((>= length 300)) 28 | (dotimes (i length) 29 | (declare (fixnum i)) 30 | (let ((code (random 256))) 31 | (setf (schar string i) (code-char code)) 32 | (setf (aref usb8 i) code))) 33 | 34 | (do* ((columns 0 (+ columns 4))) 35 | ((> columns length)) 36 | ;; Test against cl-base64 routines 37 | (test integer (base64-string-to-integer 38 | (integer-to-base64-string integer :columns columns))) 39 | (test string (base64-string-to-string 40 | (string-to-base64-string string :columns columns)) 41 | :test #'string=) 42 | 43 | ;; Test against AllegroCL built-in routines 44 | #+allegro 45 | (progn 46 | (test integer (excl:base64-string-to-integer 47 | (integer-to-base64-string integer :columns columns))) 48 | (test integer (base64-string-to-integer 49 | (excl:integer-to-base64-string integer))) 50 | (test (string-to-base64-string string :columns columns) 51 | (excl:usb8-array-to-base64-string usb8 52 | (if (zerop columns) 53 | nil 54 | columns)) 55 | :test #'string=) 56 | (test string (base64-string-to-string 57 | (excl:usb8-array-to-base64-string 58 | usb8 59 | (if (zerop columns) 60 | nil 61 | columns))) 62 | :test #'string=)))))) 63 | t) 64 | 65 | 66 | (defun time-routines () 67 | (let* ((str "abcdefghijklmnopqwertyu1234589jhwf2ff") 68 | (usb8 (string-to-usb8-array str)) 69 | (int 12345678901234567890) 70 | (n 50000)) 71 | (time-iterations n (integer-to-base64-string int)) 72 | (time-iterations n (string-to-base64-string str)) 73 | #+allego 74 | (progn 75 | (time-iterations n (excl:integer-to-base64-string int)) 76 | (time-iterations n (excl:usb8-array-to-base64-string usb8))))) 77 | 78 | 79 | ;;#+run-test (test-base64) 80 | -------------------------------------------------------------------------------- /utils/cl-geonames/AUTHORS: -------------------------------------------------------------------------------- 1 | ----------------- 2 | -- cl-geonames -- 3 | ----------------- 4 | 5 | Developpeurs : 6 | 7 | Nicolas Lamirault 8 | -------------------------------------------------------------------------------- /utils/cl-geonames/BUGS: -------------------------------------------------------------------------------- 1 | ----------------- 2 | -- cl-geonames -- 3 | ----------------- 4 | 5 | * Webservice geo-postal-code-country-info * 6 | 7 | 8 | CL-USER> (cl-geonames::geo-postal-code-country-info) 9 | URL http://ws.geonames.org/postalCodeCountryInfo? 10 | invalid array index 0 for "" (should be nonnegative and <0) 11 | [Condition of type SIMPLE-TYPE-ERROR] 12 | 13 | Restarts: 14 | 0: [ABORT-REQUEST] Abort handling SLIME request. 15 | 1: [ABORT] Exit debugger, returning to top level. 16 | 17 | Backtrace: 18 | 0: (JSON::READ-JSON-NUMBER #) 19 | 1: (JSON:DECODE-JSON-FROM-STRING 20 | " 21 | 22 | 23 | AS 24 | American Samoa 25 | 1 26 | 96799 27 | 96799 28 | ..) 29 | 2: (SB-INT:EVAL-IN-LEXENV 30 | (CL-GEONAMES::GEO-POSTAL-CODE-COUNTRY-INFO) 31 | #) 32 | 3: (SWANK::EVAL-REGION 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /utils/cl-geonames/INSTALL: -------------------------------------------------------------------------------- 1 | ----------------- 2 | -- cl-geonames -- 3 | ----------------- 4 | 5 | 6 | ** Required softwares ** 7 | 8 | You will need : 9 | 10 | - ASDF : http://www.cliki.net/asdf 11 | - drakma : http://weitz.de/drakma/ 12 | 13 | 14 | 15 | ** ASDF ** 16 | 17 | In /usr/share/common-lisp/systems, create a symbolic link 18 | to the system definition file (cl-geonames.asd) 19 | or 20 | add the cl-geonames directory to *central-directory* of ASDF : 21 | (push "/directory/cl-geonames/" asdf:*central-registry*) 22 | 23 | 24 | 25 | ** Load ** 26 | 27 | In the Lisp system : 28 | (asdf:operate 'asdf:load-op :cl-geonames) 29 | 30 | 31 | 32 | Local variables: 33 | mode: outline 34 | paragraph-separate: "[ ^L]*$" 35 | end: 36 | -------------------------------------------------------------------------------- /utils/cl-geonames/NEWS: -------------------------------------------------------------------------------- 1 | ----------------- 2 | -- cl-geonames -- 3 | ----------------- 4 | 5 | 6 | ** Version 0.1 ** 7 | 8 | * WebService * 9 | 10 | Implements : 11 | - search 12 | - postal code search 13 | - placename lookup 14 | - find near by postal code 15 | - find near by postal code geocoding 16 | - postal code country info 17 | - find near by place name 18 | - country info 19 | - country code 20 | - country subdivision 21 | - elevation srtm3 22 | - elevation gtopo30 23 | 24 | 25 | 26 | 27 | Local variables: 28 | mode: outline 29 | paragraph-separate: "[ ^L]*$" 30 | end: 31 | -------------------------------------------------------------------------------- /utils/cl-geonames/README: -------------------------------------------------------------------------------- 1 | ----------------- 2 | -- cl-geonames -- 3 | ----------------- 4 | 5 | A Common Lisp wrapper around the geonames web service. 6 | 7 | http://www.geonames.org 8 | 9 | and web services available : 10 | 11 | http://www.geonames.org/export/web-services.html 12 | 13 | 14 | 15 | 16 | Features of Geoname Web Services API supported : 17 | 18 | [x] Search 19 | [x] Postal Code Search 20 | [x] Placename lookup with postalcode (JSON) 21 | [x] Find nearby postal codes / reverse geocoding 22 | [x] Postal code country info 23 | [x] Find nearby place name / reverse geocoding 24 | [x] Country Info (Bounding Box, Capital, Area in square km, Population) 25 | [x] CountryCode / reverse geocoding 26 | [x] Country Subdivision / reverse geocoding 27 | [x] Elevation - SRTM3 28 | [x] Elevation - GTOPO30 29 | [x] Timezone 30 | 31 | 32 | 33 | Local variables: 34 | mode: outline 35 | paragraph-separate: "[ ^L]*$" 36 | end: 37 | 38 | 39 | -------------------------------------------------------------------------------- /utils/cl-geonames/TODO: -------------------------------------------------------------------------------- 1 | ----------------- 2 | -- cl-geonames -- 3 | ----------------- 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /utils/cl-geonames/cl-geonames-test.asd: -------------------------------------------------------------------------------- 1 | ;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*- 2 | 3 | ;;;; ************************************************************************* 4 | ;;;; FILE IDENTIFICATION 5 | ;;;; 6 | ;;;; Name: cl-geonames-test.asd 7 | ;;;; Purpose: ASDF definition for cl-geonames-test 8 | ;;;; Programmer: Nicolas Lamirault 9 | ;;;; 10 | ;;;; This file, part of cl-geonames, is Copyright (c) 2008 by Nicolas Lamirault 11 | ;;;; 12 | ;;;; cl-geonames users are granted the rights to distribute and use this software 13 | ;;;; as governed by the terms of the Lisp Lesser GNU Public License 14 | ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL. 15 | ;;;; 16 | ;;;; ************************************************************************* 17 | 18 | 19 | (in-package :asdf) 20 | 21 | 22 | (defsystem cl-geonames-test 23 | :name "cl-geonames-test" 24 | :author "Nicolas Lamirault " 25 | :maintainer "Nicolas Lamirault " 26 | :version "0.1" 27 | :licence "Lisp Lesser GNU General Public License" 28 | :description "Unit Tests for the Common Lisp wrapper of Geonames API." 29 | :depends-on (:cl-geonames :lift) 30 | :components 31 | ((:module :test 32 | :components 33 | ((:file "package") 34 | (:file "definition" :depends-on ("package")) 35 | (:file "specials" :depends-on ("package")) 36 | (:file "api" :depends-on ("specials" "definition")) 37 | (:file "unit-tests" :depends-on ("api")) 38 | )))) 39 | 40 | -------------------------------------------------------------------------------- /utils/cl-geonames/cl-geonames.asd: -------------------------------------------------------------------------------- 1 | ;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*- 2 | 3 | ;;;; ************************************************************************* 4 | ;;;; FILE IDENTIFICATION 5 | ;;;; 6 | ;;;; Name: cl-geonames.asd 7 | ;;;; Purpose: ASDF definition for cl-geonames 8 | ;;;; Programmer: Nicolas Lamirault 9 | ;;;; 10 | ;;;; This file, part of cl-geonames, is Copyright (c) 2006 by Nicolas Lamirault 11 | ;;;; 12 | ;;;; cl-geonames users are granted the rights to distribute and use this software 13 | ;;;; as governed by the terms of the Lisp Lesser GNU Public License 14 | ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL. 15 | ;;;; 16 | ;;;; ************************************************************************* 17 | 18 | 19 | (in-package :asdf) 20 | 21 | 22 | (defsystem cl-geonames 23 | :name "cl-geonames" 24 | :author "Nicolas Lamirault " 25 | :maintainer "Nicolas Lamirault " 26 | :version "0.1" 27 | :licence "Lisp Lesser GNU General Public License" 28 | :description "Common Lisp API of the Geonames web service." 29 | :depends-on (:drakma :cl-json :s-xml) 30 | :components 31 | ((:module :src 32 | :components 33 | ((:file "package") 34 | (:file "specials" :depends-on ("package")) 35 | (:file "conditions" :depends-on ("package")) 36 | (:file "api" :depends-on ("specials" "conditions")))))) 37 | -------------------------------------------------------------------------------- /utils/cl-geonames/etc/lift-standard.config: -------------------------------------------------------------------------------- 1 | ;;; 2 | ;;; Cl-Geonames Unit Tests Configuration 3 | ;;; 4 | 5 | ;;; configuration for LIFT tests 6 | 7 | ;; settings 8 | (:if-dribble-exists :supersede) 9 | (:dribble "lift.dribble") 10 | (:print-length 10) 11 | (:print-level 5) 12 | (:print-test-case-names t) 13 | 14 | 15 | ;; suites to run 16 | (cl-geonames-test) 17 | 18 | ;; report properties 19 | (:report-property :title "cl-geonames | Test results") 20 | (:report-property :relative-to cl-geonames-test) 21 | 22 | 23 | 24 | (:report-property :style-sheet "test-style.css") 25 | (:report-property :if-exists :supersede) 26 | (:report-property :format :html) 27 | (:report-property :name "misc/test-results/test-report.html") 28 | (:report-property :unique-name t) 29 | (:build-report) 30 | 31 | (:report-property :unique-name t) 32 | (:report-property :format :describe) 33 | (:report-property :name "misc/test-results/test-report.txt") 34 | (:build-report) 35 | 36 | 37 | (:report-property :format :save) 38 | (:report-property :name "misc/test-results/test-report.sav") 39 | (:build-report) 40 | 41 | (:report-property :format :describe) 42 | (:report-property :full-pathname *standard-output*) 43 | (:build-report) 44 | 45 | -------------------------------------------------------------------------------- /utils/cl-geonames/misc/ut-cover.lisp: -------------------------------------------------------------------------------- 1 | ;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*- 2 | 3 | ;;;; ************************************************************************* 4 | ;;;; FILE IDENTIFICATION 5 | ;;;; 6 | ;;;; Name: ut-cover.lisp 7 | ;;;; Purpose: Unit tests coverage. 8 | ;;;; Programmer: Nicolas Lamirault 9 | ;;;; 10 | ;;;; This file, part of cl-geonames, is Copyright (c) 2008 by Nicolas Lamirault 11 | ;;;; 12 | ;;;; cl-geonames users are granted the rights to distribute and use this software 13 | ;;;; as governed by the terms of the Lisp Lesser GNU Public License 14 | ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL. 15 | ;;;; 16 | ;;;; ************************************************************************* 17 | 18 | 19 | 20 | (require :sb-cover) 21 | (declaim (optimize sb-cover:store-coverage-data)) 22 | (asdf:oos 'asdf:load-op :cl-geonames-test) 23 | (cl-geonames-test:run-cl-geonames-tests) 24 | (sb-cover:report "/tmp/cl-geonames-coverage/") 25 | (declaim (optimize (sb-cover:store-coverage-data 0))) 26 | 27 | -------------------------------------------------------------------------------- /utils/cl-geonames/src/conditions.lisp: -------------------------------------------------------------------------------- 1 | ;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*- 2 | 3 | ;;;; ************************************************************************* 4 | ;;;; FILE IDENTIFICATION 5 | ;;;; 6 | ;;;; Name: conditions.lisp 7 | ;;;; Purpose: cl-geonames conditions. 8 | ;;;; Programmer: Nicolas Lamirault 9 | ;;;; 10 | ;;;; This file, part of cl-geonames, is Copyright (c) 2007 by Nicolas Lamirault 11 | ;;;; 12 | ;;;; cl-geonames users are granted the rights to distribute and use this software 13 | ;;;; as governed by the terms of the Lisp Lesser GNU Public License 14 | ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL. 15 | ;;;; 16 | ;;;; ************************************************************************* 17 | 18 | 19 | (in-package :cl-geonames) 20 | 21 | 22 | 23 | (define-condition geonames-error (simple-error) 24 | () 25 | (:documentation "Main Geonames error.")) 26 | 27 | 28 | (define-condition geonames-query-error (geonames-error) 29 | ((message :reader message 30 | :initarg :message 31 | :documentation "Explanation message.")) 32 | (:documentation "Geonames query error.") 33 | (:report (lambda (condition stream) 34 | (format stream "Geonames error ~A." (message condition))))) 35 | 36 | 37 | (define-condition geonames-request-error (geonames-error) 38 | ((code :reader code 39 | :initarg :code 40 | :documentation "The error code.") 41 | (message :reader message 42 | :initarg :message 43 | :documentation "Explanation message.")) 44 | (:documentation "Geonames request error.") 45 | (:report (lambda (condition stream) 46 | (format stream "Geonames error ~A : ~A." 47 | (code condition) (message condition))))) 48 | 49 | 50 | (define-condition geonames-output-error (geonames-error) 51 | ((output :reader output 52 | :initarg :output 53 | :documentation "The output format.")) 54 | (:documentation "Geonames output error.") 55 | (:report (lambda (condition stream) 56 | (format stream "Geonames unknown output ~A." (output condition))))) 57 | 58 | -------------------------------------------------------------------------------- /utils/cl-geonames/src/package.lisp: -------------------------------------------------------------------------------- 1 | ;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*- 2 | 3 | ;;;; ************************************************************************* 4 | ;;;; FILE IDENTIFICATION 5 | ;;;; 6 | ;;;; Name: package.lisp 7 | ;;;; Purpose: Package definition file for cl-geonames 8 | ;;;; Programmer: Nicolas Lamirault 9 | ;;;; 10 | ;;;; This file, part of cl-geonames, is Copyright (c) 2006 by Nicolas Lamirault 11 | ;;;; 12 | ;;;; cl-geonames users are granted the rights to distribute and use this software 13 | ;;;; as governed by the terms of the Lisp Lesser GNU Public License 14 | ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL. 15 | ;;;; 16 | ;;;; ************************************************************************* 17 | 18 | 19 | (defpackage :cl-geonames 20 | (:use :cl) 21 | (:documentation "Geonames Common Lisp package") 22 | (:export #:geo-search 23 | #:geo-postal-code-search 24 | #:geo-placename-lookup 25 | #:geo-find-nearby-postal-code 26 | #:geo-find-nearby-postal-code-geocoding 27 | #:geo-postal-code-country-info 28 | #:geo-find-nearby-place-name 29 | #:geo-country-info 30 | #:geo-country-code 31 | #:geo-country-subdivision 32 | #:geo-elevation-srtm3 33 | #:geo-elevation-gtopo30 34 | #:geo-timezone 35 | 36 | ;; Conditions 37 | 38 | #:geonames-error 39 | #:geonames-request-error 40 | #:geonames-output-error 41 | 42 | ;; Dev 43 | 44 | #:*debug* 45 | )) 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /utils/cl-geonames/src/specials.lisp: -------------------------------------------------------------------------------- 1 | ;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*- 2 | 3 | ;;;; ************************************************************************* 4 | ;;;; FILE IDENTIFICATION 5 | ;;;; 6 | ;;;; Name: specials.lisp 7 | ;;;; Purpose: cl-geonames specials informations. 8 | ;;;; Programmer: Nicolas Lamirault 9 | ;;;; 10 | ;;;; This file, part of cl-geonames, is Copyright (c) 2006 by Nicolas Lamirault 11 | ;;;; 12 | ;;;; cl-geonames users are granted the rights to distribute and use this software 13 | ;;;; as governed by the terms of the Lisp Lesser GNU Public License 14 | ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL. 15 | ;;;; 16 | ;;;; ************************************************************************* 17 | 18 | 19 | (in-package :cl-geonames) 20 | 21 | 22 | (defparameter *geonames-server* "http://ws.geonames.org") 23 | 24 | 25 | (defparameter *geonames-search* "/search~A?" 26 | "Web service for the geonames full text search") 27 | 28 | 29 | (defparameter *geonames-postal-code-search* "/postalCodeSearch~A?" 30 | "Web service to retreive postal codes and places.") 31 | 32 | 33 | (defparameter *geonames-placename-lookup* "/postalCodeLookup~A?" 34 | "Web service to retrieve placename lookup with postal code.") 35 | 36 | 37 | (defparameter *geonames-find-near-postal-code* "/findNearbyPostalCodes~A?" 38 | "Web service to find nearby postal codes / reverse geocoding") 39 | 40 | 41 | (defparameter *geonames-postal-code-country* "/postalCodeCountryInfo~A?" 42 | "Web service to retrieve countries for which postal code geocoding is available.") 43 | 44 | 45 | (defparameter *geonames-find-near-place-name* "/findNearbyPlaceName~A?" 46 | "Web service to find nearby place name / reverse geocoding") 47 | 48 | 49 | (defparameter *geonames-country-info* "/countryInfo~A?" 50 | "Web service to retrieve informations about countries") 51 | 52 | 53 | (defparameter *geonames-country-code* "/countrycode~A?" 54 | "Web service to retreive country code from latitude/longitude.") 55 | 56 | 57 | (defparameter *geonames-country-subdivision* "/countrySubdivision~A?" 58 | "Web service to retreive the administrative subdivison (state, province,...).") 59 | 60 | 61 | (defparameter *geonames-elevation-srtm3* "/srtm3~A?" 62 | "Web service to retreive the elevation in meters according to srtm3.") 63 | 64 | 65 | (defparameter *geonames-elevation-gtopo30* "/gtopo30~A?" 66 | "Web service to retreive the elevation in meters according to gtopo30.") 67 | 68 | 69 | (defparameter *geonames-timezone* "/timezone~A?" 70 | "Web service to retreive the timezone at the lat/lng.") 71 | 72 | 73 | 74 | (defparameter *debug* nil "If T, active some logs.") -------------------------------------------------------------------------------- /utils/cl-geonames/test/definition.lisp: -------------------------------------------------------------------------------- 1 | ;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*- 2 | 3 | ;;;; ************************************************************************* 4 | ;;;; FILE IDENTIFICATION 5 | ;;;; 6 | ;;;; Name: definition.lisp 7 | ;;;; Purpose: Definition of the Common Lisp Geonames API Unit Tests. 8 | ;;;; Programmer: Nicolas Lamirault 9 | ;;;; 10 | ;;;; This file, part of cl-geonames, is Copyright (c) 2008 by Nicolas Lamirault 11 | ;;;; 12 | ;;;; cl-geonames are granted the rights to distribute and use this software 13 | ;;;; as governed by the terms of the Lisp Lesser GNU Public License 14 | ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL. 15 | ;;;; 16 | ;;;; ************************************************************************* 17 | 18 | (in-package :cl-geonames-test) 19 | 20 | 21 | (lift:deftestsuite cl-geonames-test () ()) 22 | 23 | 24 | -------------------------------------------------------------------------------- /utils/cl-geonames/test/package.lisp: -------------------------------------------------------------------------------- 1 | ;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*- 2 | 3 | ;;;; ************************************************************************* 4 | ;;;; FILE IDENTIFICATION 5 | ;;;; 6 | ;;;; Name: package.lisp 7 | ;;;; Purpose: Package definition file for cl-geonames-test 8 | ;;;; Programmer: Nicolas Lamirault 9 | ;;;; 10 | ;;;; This file, part of cl-geonames, is Copyright (c) 2008 by Nicolas Lamirault 11 | ;;;; 12 | ;;;; clitter users are granted the rights to distribute and use this software 13 | ;;;; as governed by the terms of the Lisp Lesser GNU Public License 14 | ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL. 15 | ;;;; 16 | ;;;; ************************************************************************* 17 | 18 | 19 | (defpackage :cl-geonames-test 20 | (:use :cl) 21 | (:documentation "Unit Tests for cl-geonames package.") 22 | (:export #:run-cl-geonames-tests)) 23 | -------------------------------------------------------------------------------- /utils/cl-geonames/test/specials.lisp: -------------------------------------------------------------------------------- 1 | ;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*- 2 | 3 | ;;;; ************************************************************************* 4 | ;;;; FILE IDENTIFICATION 5 | ;;;; 6 | ;;;; Name: specials.lisp 7 | ;;;; Purpose: Some variables used by the Common Lisp Geonames API Unit Tests. 8 | ;;;; Programmer: Nicolas Lamirault 9 | ;;;; 10 | ;;;; This file, part of cl-geonames, is Copyright (c) 2008 by Nicolas Lamirault 11 | ;;;; 12 | ;;;; cl-geonames are granted the rights to distribute and use this software 13 | ;;;; as governed by the terms of the Lisp Lesser GNU Public License 14 | ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL. 15 | ;;;; 16 | ;;;; ************************************************************************* 17 | 18 | (in-package :cl-geonames-test) 19 | 20 | 21 | 22 | (defparameter *cl-geonames-path* 23 | (namestring 24 | (asdf:component-relative-pathname (asdf:find-system :cl-geonames))) 25 | "Directory with contains cl-geonames source files.") 26 | 27 | 28 | -------------------------------------------------------------------------------- /utils/cl-geonames/test/unit-tests.lisp: -------------------------------------------------------------------------------- 1 | ;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*- 2 | 3 | ;;;; ************************************************************************* 4 | ;;;; FILE IDENTIFICATION 5 | ;;;; 6 | ;;;; Name: unit-tests.lisp 7 | ;;;; Purpose: Common Lisp Geonames API Unit Tests. 8 | ;;;; Programmer: Nicolas Lamirault 9 | ;;;; 10 | ;;;; This file, part of cl-geonames, is Copyright (c) 2008 by Nicolas Lamirault 11 | ;;;; 12 | ;;;; cl-geonames are granted the rights to distribute and use this software 13 | ;;;; as governed by the terms of the Lisp Lesser GNU Public License 14 | ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL. 15 | ;;;; 16 | ;;;; ************************************************************************* 17 | 18 | (in-package :cl-geonames-test) 19 | 20 | 21 | (defun run-cl-geonames-tests () 22 | "Run the cl-geonames unit tests." 23 | (let ((config-file (concatenate 'string 24 | *cl-geonames-path* 25 | "etc/lift-standard.config"))) 26 | (lift:run-tests :config config-file))) 27 | 28 | -------------------------------------------------------------------------------- /utils/cl-json_0.4.0/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | Boris Smilga 2 | Hans Hübner 3 | Henrik Hjelte 4 | Pascal Bourguignon 5 | Ian Eslick 6 | Nathan Hawkins 7 | -------------------------------------------------------------------------------- /utils/cl-json_0.4.0/LICENSE: -------------------------------------------------------------------------------- 1 | (This is the MIT / X Consortium license as taken from 2 | http://www.opensource.org/licenses/mit-license.html) 3 | 4 | Copyright (c) 2006-2008 Henrik Hjelte 5 | Copyright (c) 2008 Hans Hübner (code from the program YASON) 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining 8 | a copy of this software and associated documentation files (the 9 | "Software"), to deal in the Software without restriction, including 10 | without limitation the rights to use, copy, modify, merge, publish, 11 | distribute, sublicense, and/or sell copies of the Software, and to 12 | permit persons to whom the Software is furnished to do so, subject to 13 | the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be 16 | included in all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 22 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 23 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 24 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25 | -------------------------------------------------------------------------------- /utils/cl-json_0.4.0/cl-json.asd: -------------------------------------------------------------------------------- 1 | ;;; -*- lisp -*- 2 | ;;; Copyright (c) 2006-2008 Henrik Hjelte 3 | ;;; All rights reserved. 4 | ;;; See the file LICENSE for terms of use and distribution. 5 | 6 | (in-package #:cl-user) 7 | 8 | (defpackage #:json-system 9 | (:use #:cl #:asdf)) 10 | 11 | (in-package #:json-system) 12 | 13 | (pushnew :cl-json *features*) 14 | #+(or mcl openmcl cmu sbcl clisp ecl scl lispworks allegro) 15 | (pushnew :cl-json-clos *features*) 16 | 17 | (defsystem :cl-json 18 | :name "cl-json" 19 | :description "JSON in Lisp. JSON (JavaScript Object Notation) is a lightweight data-interchange format." 20 | :version "0.4.0" 21 | :maintainer "Henrik Hjelte " 22 | :licence "MIT" 23 | :components ((:static-file "cl-json.asd") 24 | (:module :src 25 | :components ((:file "package") 26 | (:file "common" :depends-on ("package")) 27 | #+cl-json-clos 28 | (:file "objects" :depends-on ("package")) 29 | (:file "camel-case" :depends-on ("package")) 30 | (:file "decoder" :depends-on ("common" #+cl-json-clos "objects" "camel-case")) 31 | (:file "encoder" :depends-on ("common" #+cl-json-clos "objects" "camel-case")) 32 | (:file "utils" :depends-on ("decoder" "encoder")) 33 | (:file "json-rpc" :depends-on ("package" "common" "utils" "encoder" "decoder")))))) 34 | 35 | (defsystem :cl-json.test 36 | :depends-on (:cl-json :fiveam ) 37 | :components ((:module :t 38 | :components ((:file "package") 39 | (:file "testjson" :depends-on ("package" "testdecoder" "testencoder" "testmisc")) 40 | (:file "testmisc" :depends-on ("package" "testdecoder" "testencoder")) 41 | (:file "testdecoder" :depends-on ("package")) 42 | (:file "testencoder" :depends-on ("package")))))) 43 | -------------------------------------------------------------------------------- /utils/cl-json_0.4.0/doc/style.css: -------------------------------------------------------------------------------- 1 | .header { 2 | font-size: medium; 3 | background-color:#336699; 4 | color:#ffffff; 5 | border-style:solid; 6 | border-width: 5px; 7 | border-color:#002244; 8 | padding: 1mm 1mm 1mm 5mm; 9 | } 10 | 11 | .footer { 12 | font-size: small; 13 | font-style: italic; 14 | text-align: right; 15 | background-color:#336699; 16 | color:#ffffff; 17 | border-style:solid; 18 | border-width: 2px; 19 | border-color:#002244; 20 | padding: 1mm 1mm 1mm 1mm; 21 | } 22 | 23 | .footer a:link { 24 | font-weight:bold; 25 | color:#ffffff; 26 | background-color: #336699; 27 | text-decoration:underline; 28 | } 29 | 30 | .footer a:visited { 31 | font-weight:bold; 32 | color:#ffffff; 33 | background-color: #336699; 34 | text-decoration:underline; 35 | } 36 | 37 | .footer a:hover { 38 | font-weight:bold; 39 | color:#002244; 40 | background-color: #336699; 41 | text-decoration:underline; } 42 | 43 | .check {font-size: x-small; 44 | text-align:right;} 45 | 46 | .check a:link { font-weight:bold; 47 | color:#a0a0ff; 48 | background-color: #FFFFFF; 49 | text-decoration:underline; } 50 | 51 | .check a:visited { font-weight:bold; 52 | color:#a0a0ff; 53 | background-color: #FFFFFF; 54 | text-decoration:underline; } 55 | 56 | .check a:hover { font-weight:bold; 57 | color:#000000; 58 | background-color: #FFFFFF; 59 | text-decoration:underline; } 60 | 61 | -------------------------------------------------------------------------------- /utils/cl-json_0.4.0/src/common.lisp: -------------------------------------------------------------------------------- 1 | ;;;; Copyright (c) 2006-2008 Henrik Hjelte 2 | ;;;; All rights reserved. 3 | ;;;; See the file LICENSE for terms of use and distribution. 4 | 5 | (in-package :json) 6 | 7 | (defmacro let-gensyms ((&rest names) &body body) 8 | `(let ,(loop for name in names collect `(,name (gensym))) 9 | ,@body)) 10 | 11 | ;;; Custom variables 12 | 13 | (eval-when (:compile-toplevel :load-toplevel) 14 | 15 | (defvar *custom-vars* nil) 16 | 17 | (defmacro with-shadowed-custom-vars (&body body) 18 | `(let ,(loop for (var) in *custom-vars* 19 | collect `(,var (if (boundp ',var) ,var))) 20 | ,@body)) 21 | 22 | (defun custom-key-to-variable (key) 23 | (car (rassoc key *custom-vars*))) 24 | 25 | (defmacro loop-on-custom ((key var &optional value) &rest clauses) 26 | (if value 27 | (destructuring-bind (key-args . clauses) clauses 28 | `(loop for (,key ,value) on ,key-args by #'cddr 29 | for ,var = (custom-key-to-variable ,key) 30 | if ,var ,@clauses)) 31 | `(loop for (,var . ,key) in *custom-vars* 32 | ,@clauses))) 33 | 34 | (defmacro set-custom-vars (&rest customizations) 35 | `(setq 36 | ,@(loop-on-custom (key var value) customizations 37 | append (list var value)))) 38 | 39 | (defmacro bind-custom-vars ((&rest customizations) &body body) 40 | `(let ,(loop-on-custom (key var value) customizations 41 | collect (list var value)) 42 | ,@body)) 43 | 44 | ) 45 | 46 | (defmacro define-custom-var ((key name) &rest other-args) 47 | `(eval-when (:compile-toplevel :load-toplevel) 48 | (progn (pushnew '(,name . ,key) *custom-vars* :test #'equal) 49 | (defvar ,name ,@other-args)))) 50 | 51 | 52 | ;;; Characters 53 | 54 | (defparameter +json-lisp-escaped-chars+ 55 | '((#\" . #\") 56 | (#\\ . #\\) 57 | (#\/ . #\/) 58 | (#\b . #\Backspace) 59 | (#\f . #\ ) 60 | (#\n . #\Newline) 61 | (#\r . #\Return) 62 | (#\t . #\Tab) 63 | (#\u . (4 . 16))) 64 | "Mapping between JSON String escape sequences and Lisp chars.") 65 | 66 | (defvar *use-strict-json-rules* t 67 | "If non-nil, signal error on unrecognized escape sequences in JSON 68 | Strings. If nil, translate any such sequence to the char after 69 | slash.") 70 | 71 | 72 | ;;; Symbols 73 | 74 | (defparameter +json-lisp-symbol-tokens+ 75 | '(("true" . t) 76 | ("null" . nil) 77 | ("false" . nil)) 78 | "Mapping between JSON literal names and Lisp boolean values.") 79 | 80 | (defvar *json-symbols-package* (find-package 'keyword) 81 | "The package where JSON Object keys etc. are interned. 82 | Default KEYWORD, NIL = use current *PACKAGE*.") 83 | 84 | (defun json-intern (string) 85 | "Intern STRING in the current *JSON-SYMBOLS-PACKAGE*." 86 | (intern string (or *json-symbols-package* *package*))) 87 | 88 | (defvar *json-identifier-name-to-lisp* 'camel-case-to-lisp 89 | "Designator for a function which maps string (a JSON Object key) to 90 | string (name of a Lisp symbol).") 91 | 92 | (defvar *lisp-identifier-name-to-json* 'lisp-to-camel-case 93 | "Designator for a function which maps string (name of a Lisp symbol) 94 | to string (e. g. JSON Object key).") 95 | -------------------------------------------------------------------------------- /utils/cl-json_0.4.0/t/fail1.json: -------------------------------------------------------------------------------- 1 | "A JSON payload should be an object or array, not a string." -------------------------------------------------------------------------------- /utils/cl-json_0.4.0/t/fail10.json: -------------------------------------------------------------------------------- 1 | {"Extra value after close": true} "misplaced quoted value" -------------------------------------------------------------------------------- /utils/cl-json_0.4.0/t/fail11.json: -------------------------------------------------------------------------------- 1 | {"Illegal expression": 1 + 2} -------------------------------------------------------------------------------- /utils/cl-json_0.4.0/t/fail12.json: -------------------------------------------------------------------------------- 1 | {"Illegal invocation": alert()} -------------------------------------------------------------------------------- /utils/cl-json_0.4.0/t/fail13.json: -------------------------------------------------------------------------------- 1 | {"Numbers cannot have leading zeroes": 013} -------------------------------------------------------------------------------- /utils/cl-json_0.4.0/t/fail14.json: -------------------------------------------------------------------------------- 1 | {"Numbers cannot be hex": 0x14} -------------------------------------------------------------------------------- /utils/cl-json_0.4.0/t/fail15.json: -------------------------------------------------------------------------------- 1 | ["Illegal backslash escape: \x15"] -------------------------------------------------------------------------------- /utils/cl-json_0.4.0/t/fail16.json: -------------------------------------------------------------------------------- 1 | ["Illegal backslash escape: \'"] -------------------------------------------------------------------------------- /utils/cl-json_0.4.0/t/fail17.json: -------------------------------------------------------------------------------- 1 | ["Illegal backslash escape: \017"] -------------------------------------------------------------------------------- /utils/cl-json_0.4.0/t/fail18.json: -------------------------------------------------------------------------------- 1 | [[[[[[[[[[[[[[[[[[[["Too deep"]]]]]]]]]]]]]]]]]]]] -------------------------------------------------------------------------------- /utils/cl-json_0.4.0/t/fail19.json: -------------------------------------------------------------------------------- 1 | {"Missing colon" null} -------------------------------------------------------------------------------- /utils/cl-json_0.4.0/t/fail2.json: -------------------------------------------------------------------------------- 1 | ["Unclosed array" -------------------------------------------------------------------------------- /utils/cl-json_0.4.0/t/fail20.json: -------------------------------------------------------------------------------- 1 | {"Double colon":: null} -------------------------------------------------------------------------------- /utils/cl-json_0.4.0/t/fail21.json: -------------------------------------------------------------------------------- 1 | {"Comma instead of colon", null} -------------------------------------------------------------------------------- /utils/cl-json_0.4.0/t/fail22.json: -------------------------------------------------------------------------------- 1 | ["Colon instead of comma": false] -------------------------------------------------------------------------------- /utils/cl-json_0.4.0/t/fail23.json: -------------------------------------------------------------------------------- 1 | ["Bad value", truth] -------------------------------------------------------------------------------- /utils/cl-json_0.4.0/t/fail24.json: -------------------------------------------------------------------------------- 1 | ['single quote'] -------------------------------------------------------------------------------- /utils/cl-json_0.4.0/t/fail3.json: -------------------------------------------------------------------------------- 1 | {unquoted_key: "keys must be quoted} -------------------------------------------------------------------------------- /utils/cl-json_0.4.0/t/fail4.json: -------------------------------------------------------------------------------- 1 | ["extra comma",] -------------------------------------------------------------------------------- /utils/cl-json_0.4.0/t/fail5.json: -------------------------------------------------------------------------------- 1 | ["double extra comma",,] -------------------------------------------------------------------------------- /utils/cl-json_0.4.0/t/fail6.json: -------------------------------------------------------------------------------- 1 | [ , "<-- missing value"] -------------------------------------------------------------------------------- /utils/cl-json_0.4.0/t/fail7.json: -------------------------------------------------------------------------------- 1 | ["Comma after the close"], -------------------------------------------------------------------------------- /utils/cl-json_0.4.0/t/fail8.json: -------------------------------------------------------------------------------- 1 | ["Extra close"]] -------------------------------------------------------------------------------- /utils/cl-json_0.4.0/t/fail9.json: -------------------------------------------------------------------------------- 1 | {"Extra comma": true,} -------------------------------------------------------------------------------- /utils/cl-json_0.4.0/t/package.lisp: -------------------------------------------------------------------------------- 1 | (defpackage :json-test 2 | (:use :json :json-rpc :common-lisp :5am ) 3 | (:import-from #+(or mcl openmcl) #:ccl 4 | #+cmu #:clos-mop 5 | #+sbcl #:sb-mop 6 | #+(or clisp ecl lispworks) #:clos 7 | #+allegro #:mop 8 | #:finalize-inheritance)) 9 | 10 | (in-package :json-test) 11 | (def-suite json) -------------------------------------------------------------------------------- /utils/cl-json_0.4.0/t/pass1.json: -------------------------------------------------------------------------------- 1 | [ 2 | "JSON Test Pattern pass1", 3 | {"object with 1 member":["array with 1 element"]}, 4 | {}, 5 | [], 6 | -42, 7 | true, 8 | false, 9 | null, 10 | { 11 | "integer": 1234567890, 12 | "real": -9876.543210, 13 | "e": 0.123456789e-12, 14 | "E": 1.234567890E+34, 15 | "": 23456789012E666, 16 | "zero": 0, 17 | "one": 1, 18 | "space": " ", 19 | "quote": "\"", 20 | "backslash": "\\", 21 | "controls": "\b\f\n\r\t", 22 | "slash": "/ & \/", 23 | "alpha": "abcdefghijklmnopqrstuvwyz", 24 | "ALPHA": "ABCDEFGHIJKLMNOPQRSTUVWYZ", 25 | "digit": "0123456789", 26 | "special": "`1~!@#$%^&*()_+-={':[,]}|;.?", 27 | "hex": "\u0123\u4567\u89AB\uCDEF\uabcd\uef4A", 28 | "true": true, 29 | "false": false, 30 | "null": null, 31 | "array":[ ], 32 | "object":{ }, 33 | "address": "50 St. James Street", 34 | "url": "http://www.JSON.org/", 35 | "comment": "// /* */": " ", 37 | " s p a c e d " :[1,2 , 3 38 | 39 | , 40 | 41 | 4 , 5 , 6 ,7 ], 42 | "compact": [1,2,3,4,5,6,7], 43 | "jsontext": "{\"object with 1 member\":[\"array with 1 element\"]}", 44 | "quotes": "" \u0022 %22 0x22 034 "", 45 | "\/\\\"\uCAFE\uBABE\uAB98\uFCDE\ubcda\uef4A\b\f\n\r\t`1~!@#$%^&*()_+-=[]{}|;:',./<>?" 46 | : "A key can be any string" 47 | }, 48 | 0.5 ,98.6 49 | , 50 | 99.44 51 | , 52 | 53 | 1066 54 | 55 | 56 | ,"rosebud"] -------------------------------------------------------------------------------- /utils/cl-json_0.4.0/t/pass2.json: -------------------------------------------------------------------------------- 1 | [[[[[[[[[[[[[[[[[[["Not too deep"]]]]]]]]]]]]]]]]]]] -------------------------------------------------------------------------------- /utils/cl-json_0.4.0/t/pass3.json: -------------------------------------------------------------------------------- 1 | { 2 | "JSON Test Pattern pass3": { 3 | "The outermost value": "must be an object or array.", 4 | "In this test": "It is an object." 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /utils/cl-json_0.4.0/t/testjson.lisp: -------------------------------------------------------------------------------- 1 | (in-package :json-test) 2 | (run! 'json) -------------------------------------------------------------------------------- /utils/cl-json_0.4.0/t/testmisc.lisp: -------------------------------------------------------------------------------- 1 | (in-package :json-test) 2 | (in-suite json) 3 | 4 | (test test-json-bind 5 | (json-bind (hello hi ciao) "{\"hello\":100,\"hi\":5}" 6 | (is (= hello 100)) 7 | (is (= hi 5)) 8 | (is-false ciao))) 9 | 10 | 11 | (test test-json-bind-advanced 12 | (json-bind (hello-world 13 | sub-obj.property 14 | sub-obj.missing-property 15 | sub-obj.even-deeper-obj.some-stuff) 16 | "{\"helloWorld\":100,\"subObj\":{\"property\":20,\"evenDeeperObj\":{\"someStuff\":\"Guten Tag\"}}}" 17 | (is (= hello-world 100)) 18 | (is (= sub-obj.property 20)) 19 | (is-false sub-obj.missing-property) 20 | (is (string= sub-obj.even-deeper-obj.some-stuff "Guten Tag")))) 21 | 22 | ;;; Invalidated by the patch ``Re-implemented JSON-BIND (to illustrate 23 | ;;; dynamic customization).'' (Wed Jan 21 20:49:22 MSK 2009) 24 | ; 25 | ; (test test-json-bind-with-alist 26 | ; (with-decoder-simple-list-semantics 27 | ; (let ((the-alist (decode-json-from-string "{\"hello\":100,\"hi\":5}"))) 28 | ; (json-bind (hello hi ciao) the-alist 29 | ; (is (= hello 100)) 30 | ; (is (= hi 5)) 31 | ; (is-false ciao))))) 32 | ; 33 | ; (test assoc-lookup 34 | ; (is (equalp '(json::cdas widget-id (json::cdas parent data)) 35 | ; (macroexpand-1 '(json::assoc-lookup parent widget-id data))))) 36 | 37 | 38 | (defun-json-rpc foo (x y) 39 | "Adds two numbers" 40 | (+ x y)) 41 | 42 | 43 | (test test-json-rpc 44 | (with-decoder-simple-list-semantics 45 | (let (result) 46 | (setf result (json-rpc:invoke-rpc "{\"method\":\"foo\",\"params\":[1,2],\"id\":999}")) 47 | (is (string= result "{\"result\":3,\"error\":null,\"id\":999}"))))) 48 | 49 | (test test-json-rpc-unknown-fn 50 | (with-decoder-simple-list-semantics 51 | (let ((*json-symbols-package* (find-package :json-test)) 52 | result) 53 | (setf result (json-rpc:invoke-rpc "{\"method\":\"secretmethod\",\"params\":[1,2],\"id\":\"my id\"}")) 54 | (json-bind (result error id) result 55 | (is-false result) 56 | (is-true error) 57 | (is (string= id "my id")))))) 58 | -------------------------------------------------------------------------------- /utils/drakma-1.2.3/CHANGELOG.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mark-watson/lisp_practical_semantic_web/cb55635a973b0330e0628ed3a59fcf5388eb5b67/utils/drakma-1.2.3/CHANGELOG.txt -------------------------------------------------------------------------------- /utils/drakma-1.2.3/doc/index.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mark-watson/lisp_practical_semantic_web/cb55635a973b0330e0628ed3a59fcf5388eb5b67/utils/drakma-1.2.3/doc/index.html -------------------------------------------------------------------------------- /utils/drakma-1.2.3/drakma.asd: -------------------------------------------------------------------------------- 1 | ;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*- 2 | ;;; $Header: /usr/local/cvsrep/drakma/drakma.asd,v 1.49 2008/05/24 03:21:22 edi Exp $ 3 | 4 | ;;; Copyright (c) 2006-2010, Dr. Edmund Weitz. All rights reserved. 5 | 6 | ;;; Redistribution and use in source and binary forms, with or without 7 | ;;; modification, are permitted provided that the following conditions 8 | ;;; are met: 9 | 10 | ;;; * Redistributions of source code must retain the above copyright 11 | ;;; notice, this list of conditions and the following disclaimer. 12 | 13 | ;;; * Redistributions in binary form must reproduce the above 14 | ;;; copyright notice, this list of conditions and the following 15 | ;;; disclaimer in the documentation and/or other materials 16 | ;;; provided with the distribution. 17 | 18 | ;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED 19 | ;;; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | ;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | ;;; ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 22 | ;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | ;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 24 | ;;; GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | ;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | ;;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 27 | ;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | ;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | (in-package :cl-user) 31 | 32 | #+:lispworks 33 | (unless (find-symbol "STREAM-WRITE-TIMEOUT" :stream) 34 | (pushnew :lw-does-not-have-write-timeout *features*)) 35 | 36 | (defpackage :drakma-asd 37 | (:use :cl :asdf)) 38 | 39 | (in-package :drakma-asd) 40 | 41 | (defvar *drakma-version-string* "1.2.3" 42 | "Drakma's version number as a string.") 43 | 44 | ;; we export its name so we can import it later 45 | (export '*drakma-version-string*) 46 | 47 | (defsystem :drakma 48 | :serial t 49 | :version #.*drakma-version-string* 50 | :components ((:file "packages") 51 | (:file "specials") 52 | (:file "conditions") 53 | (:file "util") 54 | (:file "read") 55 | (:file "cookies") 56 | (:file "request")) 57 | :depends-on (:puri 58 | :cl-base64 59 | :chunga 60 | :flexi-streams 61 | #-:lispworks :usocket 62 | #-(or :lispworks :allegro) :cl+ssl)) 63 | -------------------------------------------------------------------------------- /utils/drakma-1.2.3/packages.lisp: -------------------------------------------------------------------------------- 1 | ;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*- 2 | ;;; $Header: /usr/local/cvsrep/drakma/packages.lisp,v 1.22 2008/01/14 01:57:01 edi Exp $ 3 | 4 | ;;; Copyright (c) 2006-2010, Dr. Edmund Weitz. All rights reserved. 5 | 6 | ;;; Redistribution and use in source and binary forms, with or without 7 | ;;; modification, are permitted provided that the following conditions 8 | ;;; are met: 9 | 10 | ;;; * Redistributions of source code must retain the above copyright 11 | ;;; notice, this list of conditions and the following disclaimer. 12 | 13 | ;;; * Redistributions in binary form must reproduce the above 14 | ;;; copyright notice, this list of conditions and the following 15 | ;;; disclaimer in the documentation and/or other materials 16 | ;;; provided with the distribution. 17 | 18 | ;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED 19 | ;;; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | ;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | ;;; ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 22 | ;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | ;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 24 | ;;; GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | ;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | ;;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 27 | ;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | ;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | (in-package :cl-user) 31 | 32 | (defpackage :drakma 33 | (:use :cl :puri :flexi-streams :chunga) 34 | ;; the variable defined in the ASDF system definition 35 | (:import-from :drakma-asd :*drakma-version-string*) 36 | (:shadow :syntax-error :parameter-error) 37 | (:export :*allow-dotless-cookie-domains-p* 38 | :*body-format-function* 39 | :*remove-duplicate-cookies-p* 40 | :*drakma-default-external-format* 41 | :*header-stream* 42 | :*ignore-unparseable-cookie-dates-p* 43 | :*text-content-types* 44 | :cookie 45 | :cookie-error 46 | :cookie-error-cookie 47 | :cookie-date-parse-error 48 | :cookie-domain 49 | :cookie-expires 50 | :cookie-http-only-p 51 | :cookie-jar 52 | :cookie-jar-cookies 53 | :cookie-name 54 | :cookie-path 55 | :cookie-securep 56 | :cookie-value 57 | :cookie= 58 | :delete-old-cookies 59 | :drakma-condition 60 | :drakma-error 61 | :drakma-warning 62 | :get-content-type 63 | :header-value 64 | :http-request 65 | :parameter-error 66 | :parameter-present-p 67 | :parameter-value 68 | :parse-cookie-date 69 | :read-tokens-and-parameters 70 | :split-tokens 71 | :syntax-error)) 72 | -------------------------------------------------------------------------------- /utils/file-utils.lisp: -------------------------------------------------------------------------------- 1 | ;; Posted by Rob Warnock on comp.lang.lisp: 2 | 3 | (defun file-string (path) 4 | "Sucks up an entire file from PATH into a freshly-allocated string, 5 | returning two values: the string and the number of bytes read." 6 | (with-open-file (s path) 7 | (let* ((len (file-length s)) 8 | (data (make-string len))) 9 | (values data (read-sequence data s))))) 10 | 11 | -------------------------------------------------------------------------------- /utils/flexi-streams-1.0.7/CHANGELOG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mark-watson/lisp_practical_semantic_web/cb55635a973b0330e0628ed3a59fcf5388eb5b67/utils/flexi-streams-1.0.7/CHANGELOG -------------------------------------------------------------------------------- /utils/flexi-streams-1.0.7/ascii.lisp: -------------------------------------------------------------------------------- 1 | ;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: FLEXI-STREAMS; Base: 10 -*- 2 | ;;; $Header: /usr/local/cvsrep/flexi-streams/ascii.lisp,v 1.9 2008/05/18 21:32:15 edi Exp $ 3 | 4 | ;;; Copyright (c) 2005-2008, Dr. Edmund Weitz. All rights reserved. 5 | 6 | ;;; Redistribution and use in source and binary forms, with or without 7 | ;;; modification, are permitted provided that the following conditions 8 | ;;; are met: 9 | 10 | ;;; * Redistributions of source code must retain the above copyright 11 | ;;; notice, this list of conditions and the following disclaimer. 12 | 13 | ;;; * Redistributions in binary form must reproduce the above 14 | ;;; copyright notice, this list of conditions and the following 15 | ;;; disclaimer in the documentation and/or other materials 16 | ;;; provided with the distribution. 17 | 18 | ;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED 19 | ;;; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | ;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | ;;; ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 22 | ;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | ;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 24 | ;;; GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | ;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | ;;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 27 | ;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | ;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | (in-package :flexi-streams) 31 | 32 | (defconstant +ascii-table+ 33 | ;; currently not used, but we leave it in here just in case... 34 | (make-decoding-table '(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533 65533)) 35 | "An array enumerating the character codes for the US-ASCII 36 | encoding.") 37 | -------------------------------------------------------------------------------- /utils/flexi-streams-1.0.7/doc/foo.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mark-watson/lisp_practical_semantic_web/cb55635a973b0330e0628ed3a59fcf5388eb5b67/utils/flexi-streams-1.0.7/doc/foo.txt -------------------------------------------------------------------------------- /utils/flexi-streams-1.0.7/flexi-streams.asd: -------------------------------------------------------------------------------- 1 | ;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*- 2 | ;;; $Header: /usr/local/cvsrep/flexi-streams/flexi-streams.asd,v 1.79 2008/08/26 10:59:22 edi Exp $ 3 | 4 | ;;; Copyright (c) 2005-2008, Dr. Edmund Weitz. All rights reserved. 5 | 6 | ;;; Redistribution and use in source and binary forms, with or without 7 | ;;; modification, are permitted provided that the following conditions 8 | ;;; are met: 9 | 10 | ;;; * Redistributions of source code must retain the above copyright 11 | ;;; notice, this list of conditions and the following disclaimer. 12 | 13 | ;;; * Redistributions in binary form must reproduce the above 14 | ;;; copyright notice, this list of conditions and the following 15 | ;;; disclaimer in the documentation and/or other materials 16 | ;;; provided with the distribution. 17 | 18 | ;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED 19 | ;;; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | ;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | ;;; ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 22 | ;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | ;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 24 | ;;; GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | ;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | ;;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 27 | ;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | ;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | (in-package :cl-user) 31 | 32 | (defpackage :flexi-streams-system 33 | (:use :asdf :cl)) 34 | 35 | (in-package :flexi-streams-system) 36 | 37 | (defsystem :flexi-streams 38 | :version "1.0.7" 39 | :serial t 40 | :components ((:file "packages") 41 | (:file "mapping") 42 | (:file "ascii") 43 | (:file "koi8-r") 44 | (:file "iso-8859") 45 | (:file "code-pages") 46 | (:file "specials") 47 | (:file "util") 48 | (:file "conditions") 49 | (:file "external-format") 50 | (:file "length") 51 | (:file "encode") 52 | (:file "decode") 53 | (:file "in-memory") 54 | (:file "stream") 55 | #+:lispworks (:file "lw-char-stream") 56 | (:file "output") 57 | (:file "input") 58 | (:file "io") 59 | (:file "strings")) 60 | :depends-on (:trivial-gray-streams)) 61 | 62 | (defsystem :flexi-streams-test 63 | :components ((:module "test" 64 | :serial t 65 | :components ((:file "packages") 66 | (:file "test")))) 67 | :depends-on (:flexi-streams)) 68 | 69 | (defmethod perform ((o test-op) (c (eql (find-system 'flexi-streams)))) 70 | (operate 'load-op 'flexi-streams-test) 71 | (funcall (intern (symbol-name :run-all-tests) 72 | (find-package :flexi-streams-test)))) 73 | -------------------------------------------------------------------------------- /utils/flexi-streams-1.0.7/koi8-r.lisp: -------------------------------------------------------------------------------- 1 | ;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: FLEXI-STREAMS; Base: 10 -*- 2 | ;;; $Header: /usr/local/cvsrep/flexi-streams/koi8-r.lisp,v 1.2 2008/05/18 21:32:15 edi Exp $ 3 | 4 | ;;; Copyright (c) 2006, Igor Plekhov. All rights reserved. 5 | ;;; Copyright (c) 2006-2008, Dr. Edmund Weitz. All rights reserved. 6 | 7 | ;;; Redistribution and use in source and binary forms, with or without 8 | ;;; modification, are permitted provided that the following conditions 9 | ;;; are met: 10 | 11 | ;;; * Redistributions of source code must retain the above copyright 12 | ;;; notice, this list of conditions and the following disclaimer. 13 | 14 | ;;; * Redistributions in binary form must reproduce the above 15 | ;;; copyright notice, this list of conditions and the following 16 | ;;; disclaimer in the documentation and/or other materials 17 | ;;; provided with the distribution. 18 | 19 | ;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED 20 | ;;; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | ;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ;;; ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 23 | ;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24 | ;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 25 | ;;; GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | ;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 27 | ;;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 | ;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | ;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | (in-package :flexi-streams) 32 | 33 | ;; http://unicode.org/Public/MAPPINGS/VENDORS/MISC/KOI8-R.TXT 34 | (defconstant +koi8-r-table+ 35 | (make-decoding-table '(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 9472 9474 9484 9488 9492 9496 9500 9508 9516 9524 9532 9600 9604 9608 9612 9616 9617 9618 9619 8992 9632 8729 8730 8776 8804 8805 160 8993 176 178 183 247 9552 9553 9554 1105 9555 9556 9557 9558 9559 9560 9561 9562 9563 9564 9565 9566 9567 9568 9569 1025 9570 9571 9572 9573 9574 9575 9576 9577 9578 9579 9580 169 1102 1072 1073 1094 1076 1077 1092 1075 1093 1080 1081 1082 1083 1084 1085 1086 1087 1103 1088 1089 1090 1091 1078 1074 1100 1099 1079 1096 1101 1097 1095 1098 1070 1040 1041 1062 1044 1045 1060 1043 1061 1048 1049 1050 1051 1052 1053 1054 1055 1071 1056 1057 1058 1059 1046 1042 1068 1067 1047 1064 1069 1065 1063 1066)) 36 | "An array enumerating the character codes for the KOI8-R encoding.") 37 | -------------------------------------------------------------------------------- /utils/flexi-streams-1.0.7/test/README: -------------------------------------------------------------------------------- 1 | The reference files in this directory were created/converted using a 2 | mixture of GNU recode and the native internationalization facilities 3 | of LispWorks and AllegroCL, i.e. we're not testing FLEXI-STREAMS 4 | against files created by itself (which would be kind of useless). -------------------------------------------------------------------------------- /utils/flexi-streams-1.0.7/test/hebrew_latin8_cr.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mark-watson/lisp_practical_semantic_web/cb55635a973b0330e0628ed3a59fcf5388eb5b67/utils/flexi-streams-1.0.7/test/hebrew_latin8_cr.txt -------------------------------------------------------------------------------- /utils/flexi-streams-1.0.7/test/hebrew_latin8_crlf.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mark-watson/lisp_practical_semantic_web/cb55635a973b0330e0628ed3a59fcf5388eb5b67/utils/flexi-streams-1.0.7/test/hebrew_latin8_crlf.txt -------------------------------------------------------------------------------- /utils/flexi-streams-1.0.7/test/hebrew_latin8_lf.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mark-watson/lisp_practical_semantic_web/cb55635a973b0330e0628ed3a59fcf5388eb5b67/utils/flexi-streams-1.0.7/test/hebrew_latin8_lf.txt -------------------------------------------------------------------------------- /utils/flexi-streams-1.0.7/test/hebrew_utf8_cr.txt: -------------------------------------------------------------------------------- 1 | :ץראה תאו םימשה תא םיהלא ארב תישארב א 1 םוהת ינפ-לע ךשחו והבו והת התיה ץראהו ב 2 :םימה ינפ-לע תפחרמ םיהלא חורו :רוא-יהיו רוא יהי םיהלא רמאיו ג 3 םיהלא לדביו בוט-יכ רואה-תא םיהלא אריו ד 4 :ךשחה ןיבו רואה ןיב הליל ארק ךשחלו םוי רואל םיהלא ארקיו ה 5 :דחא םוי רקב-יהיו ברע-יהיו יהיו םימה ךותב עיקר יהי םיהלא רמאיו ו 6 :םימל םימ ןיב לידבמ רשא םימה ןיב לדביו עיקרה-תא םיהלא שעיו ז 7 עיקרל לעמ רשא םימה ןיבו עיקרל תחתמ :ןכ-יהיו רקב-יהיו ברע-יהיו םימש עיקרל םיהלא ארקיו ח 8 :ינש םוי םוקמ-לא םימשה תחתמ םימה ווקי םיהלא רמאיו ט 9 :ןכ-יהיו השביה הארתו דחא ארק םימה הוקמלו ץרא השביל םיהלא ארקיו י 10 :בוט-יכ םיהלא אריו םימי ערז עירזמ בשע אשד ץראה אשדת םיהלא רמאיו אי 11 ץראה-לע וב-וערז רשא ונימל ירפ השע ירפ ץע :ןכ-יהיו ץעו והנימל ערז עירזמ בשע אשד ץראה אצותו בי 12 םיהלא אריו והנימל וב-וערז רשא ירפ-השע :בוט-יכ :ישילש םוי רקב-יהיו ברע-יהיו גי 13 לידבהל םימשה עיקרב תראמ יהי םיהלא רמאיו די 14 םידעומלו תתאל ויהו הלילה ןיבו םויה ןיב :םינשו םימילו ץראה-לע ריאהל םימשה עיקרב תרואמל ויהו וט 15 :ןכ-יהיו רואמה-תא םילדגה תראמה ינש-תא םיהלא שעיו זט 16 תלשממל ןטקה רואמה-תאו םויה תלשממל לדגה :םיבכוכה תאו הלילה ריאהל םימשה עיקרב םיהלא םתא ןתיו זי 17 :ץראה-לע ןיבו רואה ןיב לידבהלו הלילבו םויב לשמלו חי 18 :בוט-יכ םיהלא אריו ךשחה :יעיבר םוי רקב-יהיו ברע-יהיו טי 19 ףועו היח שפנ ץרש םימה וצרשי םיהלא רמאיו כ 20 :םימשה עיקר ינפ-לע ץראה-לע ףפועי שפנ-לכ תאו םילדגה םנינתה-תא םיהלא ארביו אכ 21 תאו םהנימל םימה וצרש רשא תשמרה היחה :בוט-יכ םיהלא אריו והנימל ףנכ ףוע-לכ ואלמו וברו ורפ רמאל םיהלא םתא ךרביו בכ 22 :ץראב ברי ףועהו םימיב םימה-תא :ישימח םוי רקב-יהיו ברע-יהיו גכ 23 המהב הנימל היח שפנ ץראה אצות םיהלא רמאיו דכ 24 :ןכ-יהיו הנימל ץרא-ותיחו שמרו המהבה-תאו הנימל ץראה תיח-תא םיהלא שעיו הכ 25 םיהלא אריו והנימל המדאה שמר-לכ תאו הנימל :בוט-יכ ונתומדכ ונמלצב םדא השענ םיהלא רמאיו וכ 26 המהבבו םימשה ףועבו םיה תגדב ודריו :ץראה-לע שמרה שמרה-לכבו ץראה-לכבו ארב םיהלא םלצב ומלצב םדאה-תא םיהלא ארביו זכ 27 :םתא ארב הבקנו רכז ותא וברו ורפ םיהלא םהל רמאיו םיהלא םתא ךרביו חכ 28 ףועבו םיה תגדב ודרו השבכו ץראה-תא ואלמו :ץראה-לע תשמרה היח-לכבו םימשה ערז בשע-לכ-תא םכל יתתנ הנה םיהלא רמאיו טכ 29 וב-רשא ץעה-לכ-תאו ץראה-לכ ינפ-לע רשא ערז :הלכאל היהי םכל ערז ערז ץע-ירפ שמור לכלו םימשה ףוע-לכלו ץראה תיח-לכלו ל 30 בשע קרי-לכ-תא היח שפנ וב-רשא ץראה-לע :ןכ-יהיו הלכאל דאמ בוט-הנהו השע רשא-לכ-תא םיהלא אריו אל 31 :יששה םוי רקב-יהיו בר -------------------------------------------------------------------------------- /utils/flexi-streams-1.0.7/test/hebrew_utf8_crlf.txt: -------------------------------------------------------------------------------- 1 | :ץראה תאו םימשה תא םיהלא ארב תישארב א 1 2 | םוהת ינפ-לע ךשחו והבו והת התיה ץראהו ב 2 3 | :םימה ינפ-לע תפחרמ םיהלא חורו 4 | :רוא-יהיו רוא יהי םיהלא רמאיו ג 3 5 | םיהלא לדביו בוט-יכ רואה-תא םיהלא אריו ד 4 6 | :ךשחה ןיבו רואה ןיב 7 | הליל ארק ךשחלו םוי רואל םיהלא ארקיו ה 5 8 | :דחא םוי רקב-יהיו ברע-יהיו 9 | יהיו םימה ךותב עיקר יהי םיהלא רמאיו ו 6 10 | :םימל םימ ןיב לידבמ 11 | רשא םימה ןיב לדביו עיקרה-תא םיהלא שעיו ז 7 12 | עיקרל לעמ רשא םימה ןיבו עיקרל תחתמ 13 | :ןכ-יהיו 14 | רקב-יהיו ברע-יהיו םימש עיקרל םיהלא ארקיו ח 8 15 | :ינש םוי 16 | םוקמ-לא םימשה תחתמ םימה ווקי םיהלא רמאיו ט 9 17 | :ןכ-יהיו השביה הארתו דחא 18 | ארק םימה הוקמלו ץרא השביל םיהלא ארקיו י 10 19 | :בוט-יכ םיהלא אריו םימי 20 | ערז עירזמ בשע אשד ץראה אשדת םיהלא רמאיו אי 11 21 | ץראה-לע וב-וערז רשא ונימל ירפ השע ירפ ץע 22 | :ןכ-יהיו 23 | ץעו והנימל ערז עירזמ בשע אשד ץראה אצותו בי 12 24 | םיהלא אריו והנימל וב-וערז רשא ירפ-השע 25 | :בוט-יכ 26 | :ישילש םוי רקב-יהיו ברע-יהיו גי 13 27 | לידבהל םימשה עיקרב תראמ יהי םיהלא רמאיו די 14 28 | םידעומלו תתאל ויהו הלילה ןיבו םויה ןיב 29 | :םינשו םימילו 30 | ץראה-לע ריאהל םימשה עיקרב תרואמל ויהו וט 15 31 | :ןכ-יהיו 32 | רואמה-תא םילדגה תראמה ינש-תא םיהלא שעיו זט 16 33 | תלשממל ןטקה רואמה-תאו םויה תלשממל לדגה 34 | :םיבכוכה תאו הלילה 35 | ריאהל םימשה עיקרב םיהלא םתא ןתיו זי 17 36 | :ץראה-לע 37 | ןיבו רואה ןיב לידבהלו הלילבו םויב לשמלו חי 18 38 | :בוט-יכ םיהלא אריו ךשחה 39 | :יעיבר םוי רקב-יהיו ברע-יהיו טי 19 40 | ףועו היח שפנ ץרש םימה וצרשי םיהלא רמאיו כ 20 41 | :םימשה עיקר ינפ-לע ץראה-לע ףפועי 42 | שפנ-לכ תאו םילדגה םנינתה-תא םיהלא ארביו אכ 21 43 | תאו םהנימל םימה וצרש רשא תשמרה היחה 44 | :בוט-יכ םיהלא אריו והנימל ףנכ ףוע-לכ 45 | ואלמו וברו ורפ רמאל םיהלא םתא ךרביו בכ 22 46 | :ץראב ברי ףועהו םימיב םימה-תא 47 | :ישימח םוי רקב-יהיו ברע-יהיו גכ 23 48 | המהב הנימל היח שפנ ץראה אצות םיהלא רמאיו דכ 24 49 | :ןכ-יהיו הנימל ץרא-ותיחו שמרו 50 | המהבה-תאו הנימל ץראה תיח-תא םיהלא שעיו הכ 25 51 | םיהלא אריו והנימל המדאה שמר-לכ תאו הנימל 52 | :בוט-יכ 53 | ונתומדכ ונמלצב םדא השענ םיהלא רמאיו וכ 26 54 | המהבבו םימשה ףועבו םיה תגדב ודריו 55 | :ץראה-לע שמרה שמרה-לכבו ץראה-לכבו 56 | ארב םיהלא םלצב ומלצב םדאה-תא םיהלא ארביו זכ 27 57 | :םתא ארב הבקנו רכז ותא 58 | וברו ורפ םיהלא םהל רמאיו םיהלא םתא ךרביו חכ 28 59 | ףועבו םיה תגדב ודרו השבכו ץראה-תא ואלמו 60 | :ץראה-לע תשמרה היח-לכבו םימשה 61 | ערז בשע-לכ-תא םכל יתתנ הנה םיהלא רמאיו טכ 29 62 | וב-רשא ץעה-לכ-תאו ץראה-לכ ינפ-לע רשא ערז 63 | :הלכאל היהי םכל ערז ערז ץע-ירפ 64 | שמור לכלו םימשה ףוע-לכלו ץראה תיח-לכלו ל 30 65 | בשע קרי-לכ-תא היח שפנ וב-רשא ץראה-לע 66 | :ןכ-יהיו הלכאל 67 | דאמ בוט-הנהו השע רשא-לכ-תא םיהלא אריו אל 31 68 | :יששה םוי רקב-יהיו בר 69 | -------------------------------------------------------------------------------- /utils/flexi-streams-1.0.7/test/hebrew_utf8_lf.txt: -------------------------------------------------------------------------------- 1 | :ץראה תאו םימשה תא םיהלא ארב תישארב א 1 2 | םוהת ינפ-לע ךשחו והבו והת התיה ץראהו ב 2 3 | :םימה ינפ-לע תפחרמ םיהלא חורו 4 | :רוא-יהיו רוא יהי םיהלא רמאיו ג 3 5 | םיהלא לדביו בוט-יכ רואה-תא םיהלא אריו ד 4 6 | :ךשחה ןיבו רואה ןיב 7 | הליל ארק ךשחלו םוי רואל םיהלא ארקיו ה 5 8 | :דחא םוי רקב-יהיו ברע-יהיו 9 | יהיו םימה ךותב עיקר יהי םיהלא רמאיו ו 6 10 | :םימל םימ ןיב לידבמ 11 | רשא םימה ןיב לדביו עיקרה-תא םיהלא שעיו ז 7 12 | עיקרל לעמ רשא םימה ןיבו עיקרל תחתמ 13 | :ןכ-יהיו 14 | רקב-יהיו ברע-יהיו םימש עיקרל םיהלא ארקיו ח 8 15 | :ינש םוי 16 | םוקמ-לא םימשה תחתמ םימה ווקי םיהלא רמאיו ט 9 17 | :ןכ-יהיו השביה הארתו דחא 18 | ארק םימה הוקמלו ץרא השביל םיהלא ארקיו י 10 19 | :בוט-יכ םיהלא אריו םימי 20 | ערז עירזמ בשע אשד ץראה אשדת םיהלא רמאיו אי 11 21 | ץראה-לע וב-וערז רשא ונימל ירפ השע ירפ ץע 22 | :ןכ-יהיו 23 | ץעו והנימל ערז עירזמ בשע אשד ץראה אצותו בי 12 24 | םיהלא אריו והנימל וב-וערז רשא ירפ-השע 25 | :בוט-יכ 26 | :ישילש םוי רקב-יהיו ברע-יהיו גי 13 27 | לידבהל םימשה עיקרב תראמ יהי םיהלא רמאיו די 14 28 | םידעומלו תתאל ויהו הלילה ןיבו םויה ןיב 29 | :םינשו םימילו 30 | ץראה-לע ריאהל םימשה עיקרב תרואמל ויהו וט 15 31 | :ןכ-יהיו 32 | רואמה-תא םילדגה תראמה ינש-תא םיהלא שעיו זט 16 33 | תלשממל ןטקה רואמה-תאו םויה תלשממל לדגה 34 | :םיבכוכה תאו הלילה 35 | ריאהל םימשה עיקרב םיהלא םתא ןתיו זי 17 36 | :ץראה-לע 37 | ןיבו רואה ןיב לידבהלו הלילבו םויב לשמלו חי 18 38 | :בוט-יכ םיהלא אריו ךשחה 39 | :יעיבר םוי רקב-יהיו ברע-יהיו טי 19 40 | ףועו היח שפנ ץרש םימה וצרשי םיהלא רמאיו כ 20 41 | :םימשה עיקר ינפ-לע ץראה-לע ףפועי 42 | שפנ-לכ תאו םילדגה םנינתה-תא םיהלא ארביו אכ 21 43 | תאו םהנימל םימה וצרש רשא תשמרה היחה 44 | :בוט-יכ םיהלא אריו והנימל ףנכ ףוע-לכ 45 | ואלמו וברו ורפ רמאל םיהלא םתא ךרביו בכ 22 46 | :ץראב ברי ףועהו םימיב םימה-תא 47 | :ישימח םוי רקב-יהיו ברע-יהיו גכ 23 48 | המהב הנימל היח שפנ ץראה אצות םיהלא רמאיו דכ 24 49 | :ןכ-יהיו הנימל ץרא-ותיחו שמרו 50 | המהבה-תאו הנימל ץראה תיח-תא םיהלא שעיו הכ 25 51 | םיהלא אריו והנימל המדאה שמר-לכ תאו הנימל 52 | :בוט-יכ 53 | ונתומדכ ונמלצב םדא השענ םיהלא רמאיו וכ 26 54 | המהבבו םימשה ףועבו םיה תגדב ודריו 55 | :ץראה-לע שמרה שמרה-לכבו ץראה-לכבו 56 | ארב םיהלא םלצב ומלצב םדאה-תא םיהלא ארביו זכ 27 57 | :םתא ארב הבקנו רכז ותא 58 | וברו ורפ םיהלא םהל רמאיו םיהלא םתא ךרביו חכ 28 59 | ףועבו םיה תגדב ודרו השבכו ץראה-תא ואלמו 60 | :ץראה-לע תשמרה היח-לכבו םימשה 61 | ערז בשע-לכ-תא םכל יתתנ הנה םיהלא רמאיו טכ 29 62 | וב-רשא ץעה-לכ-תאו ץראה-לכ ינפ-לע רשא ערז 63 | :הלכאל היהי םכל ערז ערז ץע-ירפ 64 | שמור לכלו םימשה ףוע-לכלו ץראה תיח-לכלו ל 30 65 | בשע קרי-לכ-תא היח שפנ וב-רשא ץראה-לע 66 | :ןכ-יהיו הלכאל 67 | דאמ בוט-הנהו השע רשא-לכ-תא םיהלא אריו אל 31 68 | :יששה םוי רקב-יהיו בר 69 | -------------------------------------------------------------------------------- /utils/flexi-streams-1.0.7/test/kafka_cp1252_cr.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mark-watson/lisp_practical_semantic_web/cb55635a973b0330e0628ed3a59fcf5388eb5b67/utils/flexi-streams-1.0.7/test/kafka_cp1252_cr.txt -------------------------------------------------------------------------------- /utils/flexi-streams-1.0.7/test/kafka_cp1252_crlf.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mark-watson/lisp_practical_semantic_web/cb55635a973b0330e0628ed3a59fcf5388eb5b67/utils/flexi-streams-1.0.7/test/kafka_cp1252_crlf.txt -------------------------------------------------------------------------------- /utils/flexi-streams-1.0.7/test/kafka_cp1252_lf.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mark-watson/lisp_practical_semantic_web/cb55635a973b0330e0628ed3a59fcf5388eb5b67/utils/flexi-streams-1.0.7/test/kafka_cp1252_lf.txt -------------------------------------------------------------------------------- /utils/flexi-streams-1.0.7/test/kafka_latin1_cr.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mark-watson/lisp_practical_semantic_web/cb55635a973b0330e0628ed3a59fcf5388eb5b67/utils/flexi-streams-1.0.7/test/kafka_latin1_cr.txt -------------------------------------------------------------------------------- /utils/flexi-streams-1.0.7/test/kafka_latin1_crlf.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mark-watson/lisp_practical_semantic_web/cb55635a973b0330e0628ed3a59fcf5388eb5b67/utils/flexi-streams-1.0.7/test/kafka_latin1_crlf.txt -------------------------------------------------------------------------------- /utils/flexi-streams-1.0.7/test/kafka_latin1_lf.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mark-watson/lisp_practical_semantic_web/cb55635a973b0330e0628ed3a59fcf5388eb5b67/utils/flexi-streams-1.0.7/test/kafka_latin1_lf.txt -------------------------------------------------------------------------------- /utils/flexi-streams-1.0.7/test/packages.lisp: -------------------------------------------------------------------------------- 1 | ;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*- 2 | ;;; $Header: /usr/local/cvsrep/flexi-streams/test/packages.lisp,v 1.8 2008/08/01 10:12:43 edi Exp $ 3 | 4 | ;;; Copyright (c) 2006-2008, Dr. Edmund Weitz. All rights reserved. 5 | 6 | ;;; Redistribution and use in source and binary forms, with or without 7 | ;;; modification, are permitted provided that the following conditions 8 | ;;; are met: 9 | 10 | ;;; * Redistributions of source code must retain the above copyright 11 | ;;; notice, this list of conditions and the following disclaimer. 12 | 13 | ;;; * Redistributions in binary form must reproduce the above 14 | ;;; copyright notice, this list of conditions and the following 15 | ;;; disclaimer in the documentation and/or other materials 16 | ;;; provided with the distribution. 17 | 18 | ;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED 19 | ;;; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | ;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | ;;; ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 22 | ;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | ;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 24 | ;;; GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | ;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | ;;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 27 | ;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | ;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | (in-package :cl-user) 31 | 32 | (defpackage :flexi-streams-test 33 | (:use :cl :flexi-streams) 34 | (:import-from :flexi-streams 35 | :with-unique-names 36 | :with-rebinding 37 | :char* 38 | :normalize-external-format) 39 | (:export :run-all-tests)) 40 | -------------------------------------------------------------------------------- /utils/flexi-streams-1.0.7/test/russian_koi8r_cr.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mark-watson/lisp_practical_semantic_web/cb55635a973b0330e0628ed3a59fcf5388eb5b67/utils/flexi-streams-1.0.7/test/russian_koi8r_cr.txt -------------------------------------------------------------------------------- /utils/flexi-streams-1.0.7/test/russian_koi8r_crlf.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mark-watson/lisp_practical_semantic_web/cb55635a973b0330e0628ed3a59fcf5388eb5b67/utils/flexi-streams-1.0.7/test/russian_koi8r_crlf.txt -------------------------------------------------------------------------------- /utils/flexi-streams-1.0.7/test/russian_koi8r_lf.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mark-watson/lisp_practical_semantic_web/cb55635a973b0330e0628ed3a59fcf5388eb5b67/utils/flexi-streams-1.0.7/test/russian_koi8r_lf.txt -------------------------------------------------------------------------------- /utils/flexi-streams-1.0.7/test/russian_utf8_cr.txt: -------------------------------------------------------------------------------- 1 | Зарегистрируйтесь сейчас на Десятую Международную Конференцию по Unicode, которая состоится 10-12 марта 1997 года в Майнце в Германии. Конференция соберет широкий круг экспертов по вопросам глобального Интернета и Unicode, локализации и интернационализации, воплощению и применению Unicode в различных операционных системах и программных приложениях, шрифтах, верстке и многоязычных компьютерных системах. -------------------------------------------------------------------------------- /utils/flexi-streams-1.0.7/test/russian_utf8_crlf.txt: -------------------------------------------------------------------------------- 1 | Зарегистрируйтесь сейчас на Десятую Международную Конференцию по 2 | Unicode, которая состоится 10-12 марта 1997 года в Майнце в Германии. 3 | Конференция соберет широкий круг экспертов по вопросам глобального 4 | Интернета и Unicode, локализации и интернационализации, воплощению и 5 | применению Unicode в различных операционных системах и программных 6 | приложениях, шрифтах, верстке и многоязычных компьютерных системах. 7 | -------------------------------------------------------------------------------- /utils/flexi-streams-1.0.7/test/russian_utf8_lf.txt: -------------------------------------------------------------------------------- 1 | Зарегистрируйтесь сейчас на Десятую Международную Конференцию по 2 | Unicode, которая состоится 10-12 марта 1997 года в Майнце в Германии. 3 | Конференция соберет широкий круг экспертов по вопросам глобального 4 | Интернета и Unicode, локализации и интернационализации, воплощению и 5 | применению Unicode в различных операционных системах и программных 6 | приложениях, шрифтах, верстке и многоязычных компьютерных системах. 7 | -------------------------------------------------------------------------------- /utils/flexi-streams-1.0.7/test/unicode_demo_ucs2_cr_be.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mark-watson/lisp_practical_semantic_web/cb55635a973b0330e0628ed3a59fcf5388eb5b67/utils/flexi-streams-1.0.7/test/unicode_demo_ucs2_cr_be.txt -------------------------------------------------------------------------------- /utils/flexi-streams-1.0.7/test/unicode_demo_ucs2_cr_le.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mark-watson/lisp_practical_semantic_web/cb55635a973b0330e0628ed3a59fcf5388eb5b67/utils/flexi-streams-1.0.7/test/unicode_demo_ucs2_cr_le.txt -------------------------------------------------------------------------------- /utils/flexi-streams-1.0.7/test/unicode_demo_ucs2_crlf_be.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mark-watson/lisp_practical_semantic_web/cb55635a973b0330e0628ed3a59fcf5388eb5b67/utils/flexi-streams-1.0.7/test/unicode_demo_ucs2_crlf_be.txt -------------------------------------------------------------------------------- /utils/flexi-streams-1.0.7/test/unicode_demo_ucs2_crlf_le.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mark-watson/lisp_practical_semantic_web/cb55635a973b0330e0628ed3a59fcf5388eb5b67/utils/flexi-streams-1.0.7/test/unicode_demo_ucs2_crlf_le.txt -------------------------------------------------------------------------------- /utils/flexi-streams-1.0.7/test/unicode_demo_ucs2_lf_be.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mark-watson/lisp_practical_semantic_web/cb55635a973b0330e0628ed3a59fcf5388eb5b67/utils/flexi-streams-1.0.7/test/unicode_demo_ucs2_lf_be.txt -------------------------------------------------------------------------------- /utils/flexi-streams-1.0.7/test/unicode_demo_ucs2_lf_le.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mark-watson/lisp_practical_semantic_web/cb55635a973b0330e0628ed3a59fcf5388eb5b67/utils/flexi-streams-1.0.7/test/unicode_demo_ucs2_lf_le.txt -------------------------------------------------------------------------------- /utils/flexi-streams-1.0.7/test/unicode_demo_ucs4_cr_be.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mark-watson/lisp_practical_semantic_web/cb55635a973b0330e0628ed3a59fcf5388eb5b67/utils/flexi-streams-1.0.7/test/unicode_demo_ucs4_cr_be.txt -------------------------------------------------------------------------------- /utils/flexi-streams-1.0.7/test/unicode_demo_ucs4_cr_le.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mark-watson/lisp_practical_semantic_web/cb55635a973b0330e0628ed3a59fcf5388eb5b67/utils/flexi-streams-1.0.7/test/unicode_demo_ucs4_cr_le.txt -------------------------------------------------------------------------------- /utils/flexi-streams-1.0.7/test/unicode_demo_ucs4_crlf_be.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mark-watson/lisp_practical_semantic_web/cb55635a973b0330e0628ed3a59fcf5388eb5b67/utils/flexi-streams-1.0.7/test/unicode_demo_ucs4_crlf_be.txt -------------------------------------------------------------------------------- /utils/flexi-streams-1.0.7/test/unicode_demo_ucs4_crlf_le.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mark-watson/lisp_practical_semantic_web/cb55635a973b0330e0628ed3a59fcf5388eb5b67/utils/flexi-streams-1.0.7/test/unicode_demo_ucs4_crlf_le.txt -------------------------------------------------------------------------------- /utils/flexi-streams-1.0.7/test/unicode_demo_ucs4_lf_be.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mark-watson/lisp_practical_semantic_web/cb55635a973b0330e0628ed3a59fcf5388eb5b67/utils/flexi-streams-1.0.7/test/unicode_demo_ucs4_lf_be.txt -------------------------------------------------------------------------------- /utils/flexi-streams-1.0.7/test/unicode_demo_ucs4_lf_le.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mark-watson/lisp_practical_semantic_web/cb55635a973b0330e0628ed3a59fcf5388eb5b67/utils/flexi-streams-1.0.7/test/unicode_demo_ucs4_lf_le.txt -------------------------------------------------------------------------------- /utils/puri-1.5.5/README: -------------------------------------------------------------------------------- 1 | PURI - Portable URI Library 2 | =========================== 3 | 4 | AUTHORS 5 | ------- 6 | Franz, Inc 7 | Kevin Rosenberg 8 | 9 | 10 | DOWNLOAD 11 | -------- 12 | Puri home: http://files.b9.com/puri/ 13 | Portable tester home: http://files.b9.com/tester/ 14 | 15 | 16 | SUPPORTED PLATFORMS 17 | ------------------- 18 | AllegroCL, CLISP, CMUCL, Lispworks, OpenMCL, SBCL 19 | 20 | 21 | OVERVIEW 22 | -------- 23 | This is portable Universal Resource Identifier library for Common Lisp 24 | programs. It parses URI according to the RFC 2396 specification. It's 25 | is based on Franz, Inc's opensource URI package and has been ported to 26 | work other CL implementations. It is licensed under the LLGPL which 27 | is included in this distribution. 28 | 29 | A regression suite is included which uses Franz's open-source tester 30 | library. I've ported that library for use on other CL 31 | implementations. Puri completes 126/126 regression tests successfully. 32 | 33 | Franz's unmodified documentation file is included in the file 34 | uri.html. 35 | 36 | 37 | DIFFERENCES BETWEEN PURI and NET.URI 38 | ------------------------------------ 39 | 40 | * Puri uses the package 'puri while NET.URI uses the package 'net.uri 41 | 42 | * To signal an error parsing a URI, Puri uses the condition 43 | :uri-parse-error while NET.URI uses the condition :parse-error. This 44 | divergence occurs because Franz's parse-error condition uses 45 | :format-control and :format-arguments slots which are not in the ANSI 46 | specification for the parse-error condition. 47 | -------------------------------------------------------------------------------- /utils/puri-1.5.5/puri.asd: -------------------------------------------------------------------------------- 1 | ;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*- 2 | ;;;; Programmer: Kevin Rosenberg 3 | 4 | 5 | (in-package #:cl-user) 6 | (defpackage #:puri-system (:use #:cl #:asdf)) 7 | (in-package #:puri-system) 8 | 9 | 10 | (defsystem puri 11 | :name "cl-puri" 12 | :maintainer "Kevin M. Rosenberg " 13 | :licence "GNU Lesser General Public License" 14 | :description "Portable Universal Resource Indentifier Library" 15 | :components 16 | ((:file "src"))) 17 | 18 | (defmethod perform ((o test-op) (c (eql (find-system 'puri)))) 19 | (oos 'load-op 'puri-tests) 20 | (oos 'test-op 'puri-tests)) 21 | 22 | (defsystem puri-tests 23 | :depends-on (:puri :ptester) 24 | :components 25 | ((:file "tests"))) 26 | 27 | (defmethod perform ((o test-op) (c (eql (find-system 'puri-tests)))) 28 | (or (funcall (intern (symbol-name '#:do-tests) 29 | (find-package :puri-tests))) 30 | (error "test-op failed"))) 31 | 32 | (defmethod operation-done-p ((o test-op) (c (eql (find-system 'puri-tests)))) 33 | (values nil)) 34 | -------------------------------------------------------------------------------- /utils/s-xml/ChangeLog: -------------------------------------------------------------------------------- 1 | 2005-11-20 Sven Van Caekenberghe 2 | 3 | * added xml prefix namespace as per REC-xml-names-19990114 (by Rudi Schlatte) 4 | 5 | 2005-11-06 Sven Van Caekenberghe 6 | 7 | * removed Debian packaging directory (on Luca's request) 8 | * added CDATA support (patch contributed by Peter Van Eynde pvaneynd@mailworks.org) 9 | 10 | 2005-08-30 Sven Van Caekenberghe 11 | 12 | * added Debian packaging directory (contributed by Luca Capello luca@pca.it) 13 | * added experimental XML namespace support 14 | 15 | 2005-02-03 Sven Van Caekenberghe 16 | 17 | * release 5 (cvs tag RELEASE_5) 18 | * added :start and :end keywords to print-string-xml 19 | * fixed a bug: in a tag containing whitespace, like the parser collapsed 20 | and ingnored all whitespace and considered the tag to be empty! 21 | this is now fixed and a unit test has been added 22 | * cleaned up xml character escaping a bit: single quotes and all normal whitespace 23 | (newline, return and tab) is preserved a unit test for this has been added 24 | * IE doesn't understand the ' XML entity, so I've commented that out for now. 25 | Also, using actual newlines for newlines is probably better than using #xA, 26 | which won't get any end of line conversion by the server or user agent. 27 | 28 | June 2004 Sven Van Caekenberghe 29 | 30 | * release 4 31 | * project moved to common-lisp.net, renamed to s-xml, 32 | * added examples counter, tracer and remove-markup, improved documentation 33 | 34 | 13 Jan 2004 Sven Van Caekenberghe 35 | 36 | * release 3 37 | * added ASDF systems 38 | * optimized print-string-xml 39 | 40 | 10 Jun 2003 Sven Van Caekenberghe 41 | 42 | * release 2 43 | * added echo-xml function: we are no longer taking the car when 44 | the last seed is returned from start-parse-xml 45 | 46 | 25 May 2003 Sven Van Caekenberghe 47 | 48 | * release 1 49 | * first public release of working code 50 | * tested on OpenMCL 51 | * rewritten to be event-based, to improve efficiency and 52 | to optionally use different DOM representations 53 | * more documentation 54 | 55 | end of 2002 Sven Van Caekenberghe 56 | 57 | * release 0 58 | * as part of an XML-RPC implementation 59 | 60 | $Id: ChangeLog,v 1.5 2005/11/20 14:24:33 scaekenberghe Exp $ 61 | -------------------------------------------------------------------------------- /utils/s-xml/Makefile: -------------------------------------------------------------------------------- 1 | # $Id: Makefile,v 1.3 2004/07/08 19:31:22 scaekenberghe Exp $ 2 | 3 | default: 4 | @echo Possible targets: 5 | @echo clean-openmcl --- remove all '*.dfsl' recursively 6 | @echo clean-lw --- remove all '*.nfasl' recursively 7 | @echo clean-emacs --- remove all '*~' recursively 8 | @echo clean --- all of the above 9 | 10 | clean-openmcl: 11 | find . -name "*.dfsl" | xargs rm 12 | 13 | clean-lw: 14 | find . -name "*.nfasl" | xargs rm 15 | 16 | clean-emacs: 17 | find . -name "*~" | xargs rm 18 | 19 | clean: clean-openmcl clean-lw clean-emacs 20 | 21 | # 22 | # This can obviously only be done by a specific person in a very specific context ;-) 23 | # 24 | 25 | PRJ=s-xml 26 | ACCOUNT=scaekenberghe 27 | CVSRT=:ext:$(ACCOUNT)@common-lisp.net:/project/$(PRJ)/cvsroot 28 | 29 | release: 30 | rm -rf /tmp/$(PRJ) /tmp/public_html /tmp/$(PRJ).tgz /tmp/$(PRJ).tgz.asc 31 | cd /tmp; cvs -d$(CVSRT) export -r HEAD $(PRJ); cvs -d$(CVSRT) export -r HEAD public_html 32 | mv /tmp/public_html /tmp/$(PRJ)/doc 33 | cd /tmp; gnutar cvfz $(PRJ).tgz $(PRJ); gpg -a -b $(PRJ).tgz 34 | scp /tmp/$(PRJ).tgz $(ACCOUNT)@common-lisp.net:/project/$(PRJ)/public_html 35 | scp /tmp/$(PRJ).tgz.asc $(ACCOUNT)@common-lisp.net:/project/$(PRJ)/public_html 36 | -------------------------------------------------------------------------------- /utils/s-xml/doc/style.css: -------------------------------------------------------------------------------- 1 | 2 | .header { 3 | font-size: medium; 4 | background-color:#336699; 5 | color:#ffffff; 6 | border-style:solid; 7 | border-width: 5px; 8 | border-color:#002244; 9 | padding: 1mm 1mm 1mm 5mm; 10 | } 11 | 12 | .footer { 13 | font-size: small; 14 | font-style: italic; 15 | text-align: right; 16 | background-color:#336699; 17 | color:#ffffff; 18 | border-style:solid; 19 | border-width: 2px; 20 | border-color:#002244; 21 | padding: 1mm 1mm 1mm 1mm; 22 | } 23 | 24 | .footer a:link { 25 | font-weight:bold; 26 | color:#ffffff; 27 | text-decoration:underline; 28 | } 29 | 30 | .footer a:visited { 31 | font-weight:bold; 32 | color:#ffffff; 33 | text-decoration:underline; 34 | } 35 | 36 | .footer a:hover { 37 | font-weight:bold; 38 | color:#002244; 39 | text-decoration:underline; } 40 | 41 | .check {font-size: x-small; 42 | text-align:right;} 43 | 44 | .check a:link { font-weight:bold; 45 | color:#a0a0ff; 46 | text-decoration:underline; } 47 | 48 | .check a:visited { font-weight:bold; 49 | color:#a0a0ff; 50 | text-decoration:underline; } 51 | 52 | .check a:hover { font-weight:bold; 53 | color:#000000; 54 | text-decoration:underline; } 55 | -------------------------------------------------------------------------------- /utils/s-xml/s-xml.asd: -------------------------------------------------------------------------------- 1 | ;;;; -*- Mode: LISP -*- 2 | ;;;; 3 | ;;;; $Id: s-xml.asd,v 1.2 2005/12/14 21:49:04 scaekenberghe Exp $ 4 | ;;;; 5 | ;;;; The S-XML ASDF system definition 6 | ;;;; 7 | ;;;; Copyright (C) 2002, 2004 Sven Van Caekenberghe, Beta Nine BVBA. 8 | ;;;; 9 | ;;;; You are granted the rights to distribute and use this software 10 | ;;;; as governed by the terms of the Lisp Lesser General Public License 11 | ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL. 12 | 13 | (in-package :asdf) 14 | 15 | (defsystem :s-xml 16 | :name "S-XML" 17 | :author "Sven Van Caekenberghe " 18 | :version "3" 19 | :maintainer "Sven Van Caekenberghe , Brian Mastenbrook <>, Rudi Schlatte <>" 20 | :licence "Lisp Lesser General Public License (LLGPL)" 21 | :description "Simple Common Lisp XML Parser" 22 | :long-description "S-XML is a Common Lisp implementation of a simple XML parser, with a SAX-like and DOM interface" 23 | 24 | :components 25 | ((:module 26 | :src 27 | :components ((:file "package") 28 | (:file "xml" :depends-on ("package")) 29 | (:file "dom" :depends-on ("package" "xml")) 30 | (:file "lxml-dom" :depends-on ("dom")) 31 | (:file "sxml-dom" :depends-on ("dom")) 32 | (:file "xml-struct-dom" :depends-on ("dom")))))) 33 | 34 | ;;;; eof 35 | -------------------------------------------------------------------------------- /utils/s-xml/src/dom.lisp: -------------------------------------------------------------------------------- 1 | ;;;; -*- mode: lisp -*- 2 | ;;;; 3 | ;;;; $Id: dom.lisp,v 1.2 2005/08/29 15:01:47 scaekenberghe Exp $ 4 | ;;;; 5 | ;;;; This is the generic simple DOM parser and printer interface. 6 | ;;;; 7 | ;;;; Copyright (C) 2002, 2004 Sven Van Caekenberghe, Beta Nine BVBA. 8 | ;;;; 9 | ;;;; You are granted the rights to distribute and use this software 10 | ;;;; as governed by the terms of the Lisp Lesser General Public License 11 | ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL. 12 | 13 | (in-package :s-xml) 14 | 15 | ;;; top level DOM parser interface 16 | 17 | (defgeneric parse-xml-dom (stream output-type) 18 | (:documentation "Parse a character stream as XML and generate a DOM of output-type")) 19 | 20 | (defun parse-xml (stream &key (output-type :lxml)) 21 | "Parse a character stream as XML and generate a DOM of output-type, defaulting to :lxml" 22 | (parse-xml-dom stream output-type)) 23 | 24 | (defun parse-xml-string (string &key (output-type :lxml)) 25 | "Parse a string as XML and generate a DOM of output-type, defaulting to :lxml" 26 | (with-input-from-string (stream string) 27 | (parse-xml-dom stream output-type))) 28 | 29 | (defun parse-xml-file (filename &key (output-type :lxml)) 30 | "Parse a character file as XML and generate a DOM of output-type, defaulting to :lxml" 31 | (with-open-file (in filename :direction :input) 32 | (parse-xml-dom in output-type))) 33 | 34 | ;;; top level DOM printer interface 35 | 36 | (defgeneric print-xml-dom (dom input-type stream pretty level) 37 | (:documentation "Generate XML output on a character stream from a DOM of input-type, optionally pretty printing using level")) 38 | 39 | (defun print-xml (dom &key (stream t) (pretty nil) (input-type :lxml) (header)) 40 | "Generate XML output on a character stream (t by default) from a DOM of input-type (:lxml by default), optionally pretty printing (off by default), or adding a header (none by default)" 41 | (when header (format stream header)) 42 | (when pretty (terpri stream)) 43 | (print-xml-dom dom input-type stream pretty 1)) 44 | 45 | (defun print-xml-string (dom &key (pretty nil) (input-type :lxml)) 46 | "Generate XML output to a string from a DOM of input-type (:lxml by default), optionally pretty printing (off by default)" 47 | (with-output-to-string (stream) 48 | (print-xml dom :stream stream :pretty pretty :input-type input-type))) 49 | 50 | ;;; shared/common support functions 51 | 52 | (defun print-spaces (n stream &optional (preceding-newline t)) 53 | (when preceding-newline 54 | (terpri stream)) 55 | (loop :repeat n 56 | :do (write-char #\Space stream))) 57 | 58 | (defun print-solitary-tag (tag stream) 59 | (write-char #\< stream) 60 | (print-identifier tag stream) 61 | (write-string "/>" stream)) 62 | 63 | (defun print-closing-tag (tag stream) 64 | (write-string " stream)) 67 | 68 | (defun print-attribute (name value stream) 69 | (write-char #\space stream) 70 | (print-identifier name stream t) 71 | (write-string "=\"" stream) 72 | (print-string-xml value stream) 73 | (write-char #\" stream)) 74 | 75 | ;;;; eof 76 | -------------------------------------------------------------------------------- /utils/s-xml/src/package.lisp: -------------------------------------------------------------------------------- 1 | ;;;; -*- mode: lisp -*- 2 | ;;;; 3 | ;;;; $Id: package.lisp,v 1.6 2005/11/20 14:24:34 scaekenberghe Exp $ 4 | ;;;; 5 | ;;;; This is a Common Lisp implementation of a very basic XML parser. 6 | ;;;; The parser is non-validating. 7 | ;;;; The API into the parser is pure functional parser hook model that comes from SSAX, 8 | ;;;; see also http://pobox.com/~oleg/ftp/Scheme/xml.html or http://ssax.sourceforge.net 9 | ;;;; Different DOM models are provided, an XSML, an LXML and a xml-element struct based one. 10 | ;;;; 11 | ;;;; Copyright (C) 2002, 2003, 2004, 2005 Sven Van Caekenberghe, Beta Nine BVBA. 12 | ;;;; 13 | ;;;; You are granted the rights to distribute and use this software 14 | ;;;; as governed by the terms of the Lisp Lesser General Public License 15 | ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL. 16 | 17 | (defpackage s-xml 18 | (:use common-lisp) 19 | (:export 20 | ;; main parser interface 21 | #:start-parse-xml 22 | #:print-string-xml 23 | #:xml-parser-error #:xml-parser-error-message #:xml-parser-error-args #:xml-parser-error-stream 24 | #:xml-parser-state #:get-entities #:get-seed 25 | #:get-new-element-hook #:get-finish-element-hook #:get-text-hook 26 | ;; dom parser and printer 27 | #:parse-xml-dom #:parse-xml #:parse-xml-string #:parse-xml-file 28 | #:print-xml-dom #:print-xml #:print-xml-string 29 | ;; xml-element structure 30 | #:make-xml-element #:xml-element-children #:xml-element-name 31 | #:xml-element-attribute #:xml-element-attributes 32 | #:xml-element-p #:new-xml-element #:first-xml-element-child 33 | ;; namespaces 34 | #:*ignore-namespaces* #:*local-namespace* #:*namespaces* 35 | #:*require-existing-symbols* #:*auto-export-symbols* #:*auto-create-namespace-packages* 36 | #:find-namespace #:register-namespace #:get-prefix #:get-uri #:get-package 37 | #:resolve-identifier #:extend-namespaces #:print-identifier #:split-identifier) 38 | (:documentation 39 | "A simple XML parser with an efficient, purely functional, event-based interface as well as a DOM interface")) 40 | 41 | ;;;; eof 42 | -------------------------------------------------------------------------------- /utils/s-xml/test/all-tests.lisp: -------------------------------------------------------------------------------- 1 | ;;;; -*- mode: lisp -*- 2 | ;;;; 3 | ;;;; $Id: all-tests.lisp,v 1.1.1.1 2004/06/07 18:49:58 scaekenberghe Exp $ 4 | ;;;; 5 | ;;;; Load and execute all unit and functional tests 6 | ;;;; 7 | ;;;; Copyright (C) 2002, 2004 Sven Van Caekenberghe, Beta Nine BVBA. 8 | ;;;; 9 | ;;;; You are granted the rights to distribute and use this software 10 | ;;;; as governed by the terms of the Lisp Lesser General Public License 11 | ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL. 12 | 13 | (load (merge-pathnames "test-xml" *load-pathname*) :verbose t) 14 | (load (merge-pathnames "test-xml-struct-dom" *load-pathname*) :verbose t) 15 | (load (merge-pathnames "test-lxml-dom" *load-pathname*) :verbose t) 16 | (load (merge-pathnames "test-sxml-dom" *load-pathname*) :verbose t) 17 | 18 | ;;;; eof -------------------------------------------------------------------------------- /utils/s-xml/test/counter.lisp: -------------------------------------------------------------------------------- 1 | ;;;; -*- mode: lisp -*- 2 | ;;;; 3 | ;;;; $Id: counter.lisp,v 1.2 2004/06/11 11:14:43 scaekenberghe Exp $ 4 | ;;;; 5 | ;;;; A simple SSAX counter example that can be used as a performance test 6 | ;;;; 7 | ;;;; Copyright (C) 2004 Sven Van Caekenberghe, Beta Nine BVBA. 8 | ;;;; 9 | ;;;; You are granted the rights to distribute and use this software 10 | ;;;; as governed by the terms of the Lisp Lesser General Public License 11 | ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL. 12 | 13 | (in-package :s-xml) 14 | 15 | (defclass count-xml-seed () 16 | ((elements :initform 0) 17 | (attributes :initform 0) 18 | (characters :initform 0))) 19 | 20 | (defun count-xml-new-element-hook (name attributes seed) 21 | (declare (ignore name)) 22 | (incf (slot-value seed 'elements)) 23 | (incf (slot-value seed 'attributes) (length attributes)) 24 | seed) 25 | 26 | (defun count-xml-text-hook (string seed) 27 | (incf (slot-value seed 'characters) (length string)) 28 | seed) 29 | 30 | (defun count-xml (in) 31 | "Parse a toplevel XML element from stream in, counting elements, attributes and characters" 32 | (start-parse-xml in 33 | (make-instance 'xml-parser-state 34 | :seed (make-instance 'count-xml-seed) 35 | :new-element-hook #'count-xml-new-element-hook 36 | :text-hook #'count-xml-text-hook))) 37 | 38 | (defun count-xml-file (pathname) 39 | "Parse XMl from the file at pathname, counting elements, attributes and characters" 40 | (with-open-file (in pathname) 41 | (let ((result (count-xml in))) 42 | (with-slots (elements attributes characters) result 43 | (format t 44 | "~a contains ~d XML elements, ~d attributes and ~d characters.~%" 45 | pathname elements attributes characters))))) 46 | 47 | ;;;; eof 48 | -------------------------------------------------------------------------------- /utils/s-xml/test/echo.lisp: -------------------------------------------------------------------------------- 1 | ;;;; -*- mode: lisp -*- 2 | ;;;; 3 | ;;;; $Id: echo.lisp,v 1.1 2005/08/17 13:44:30 scaekenberghe Exp $ 4 | ;;;; 5 | ;;;; A simple example as well as a useful tool: parse, echo and pretty print XML 6 | ;;;; 7 | ;;;; Copyright (C) 2002, 2004 Sven Van Caekenberghe, Beta Nine BVBA. 8 | ;;;; 9 | ;;;; You are granted the rights to distribute and use this software 10 | ;;;; as governed by the terms of the Lisp Lesser General Public License 11 | ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL. 12 | 13 | (in-package :s-xml) 14 | 15 | (defun indent (stream count) 16 | (loop :repeat (* count 2) :do (write-char #\space stream))) 17 | 18 | (defclass echo-xml-seed () 19 | ((stream :initarg :stream) 20 | (level :initarg :level :initform 0))) 21 | 22 | #+NIL 23 | (defmethod print-object ((seed echo-xml-seed) stream) 24 | (with-slots (stream level) seed 25 | (print-unreadable-object (seed stream :type t) 26 | (format stream "level=~d" level)))) 27 | 28 | (defun echo-xml-new-element-hook (name attributes seed) 29 | (with-slots (stream level) seed 30 | (indent stream level) 31 | (format stream "<~a" name) 32 | (dolist (attribute (reverse attributes)) 33 | (format stream " ~a=\'" (car attribute)) 34 | (print-string-xml (cdr attribute) stream) 35 | (write-char #\' stream)) 36 | (format stream ">~%") 37 | (incf level) 38 | seed)) 39 | 40 | (defun echo-xml-finish-element-hook (name attributes parent-seed seed) 41 | (declare (ignore attributes parent-seed)) 42 | (with-slots (stream level) seed 43 | (decf level) 44 | (indent stream level) 45 | (format stream "~%" name) 46 | seed)) 47 | 48 | (defun echo-xml-text-hook (string seed) 49 | (with-slots (stream level) seed 50 | (indent stream level) 51 | (print-string-xml string stream) 52 | (terpri stream) 53 | seed)) 54 | 55 | (defun echo-xml (in out) 56 | "Parse a toplevel XML element from stream in, echoing and pretty printing the result to stream out" 57 | (start-parse-xml in 58 | (make-instance 'xml-parser-state 59 | :seed (make-instance 'echo-xml-seed :stream out) 60 | :new-element-hook #'echo-xml-new-element-hook 61 | :finish-element-hook #'echo-xml-finish-element-hook 62 | :text-hook #'echo-xml-text-hook))) 63 | 64 | ;;;; eof 65 | -------------------------------------------------------------------------------- /utils/s-xml/test/plist.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | AppleDockIconEnabled 6 | 7 | AppleNavServices:GetFile:0:Path 8 | file://localhost/Users/sven/Pictures/ 9 | AppleNavServices:GetFile:0:Position 10 | 11 | AOUBXw== 12 | 13 | AppleNavServices:GetFile:0:Size 14 | 15 | AAAAAAFeAcI= 16 | 17 | AppleNavServices:PutFile:0:Disclosure 18 | 19 | AQ== 20 | 21 | AppleNavServices:PutFile:0:Path 22 | file://localhost/Users/sven/Desktop/ 23 | AppleNavServices:PutFile:0:Position 24 | 25 | AUIBVQ== 26 | 27 | AppleNavServices:PutFile:0:Size 28 | 29 | AAAAAACkAdY= 30 | 31 | AppleSavePanelExpanded 32 | YES 33 | NSDefaultOpenDirectory 34 | ~/Desktop 35 | NSNoBigString 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /utils/s-xml/test/remove-markup.lisp: -------------------------------------------------------------------------------- 1 | ;;;; -*- mode: lisp -*- 2 | ;;;; 3 | ;;;; $Id: remove-markup.lisp,v 1.1 2004/06/11 11:14:43 scaekenberghe Exp $ 4 | ;;;; 5 | ;;;; Remove markup from an XML document using the SSAX interface 6 | ;;;; 7 | ;;;; Copyright (C) 2004 Sven Van Caekenberghe, Beta Nine BVBA. 8 | ;;;; 9 | ;;;; You are granted the rights to distribute and use this software 10 | ;;;; as governed by the terms of the Lisp Lesser General Public License 11 | ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL. 12 | 13 | (in-package :s-xml) 14 | 15 | (defun remove-xml-markup (in) 16 | (let* ((state (make-instance 'xml-parser-state 17 | :text-hook #'(lambda (string seed) (cons string seed)))) 18 | (result (start-parse-xml in state))) 19 | (apply #'concatenate 'string (nreverse result)))) 20 | 21 | ;;;; eof -------------------------------------------------------------------------------- /utils/s-xml/test/simple.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Hello World! 5 | 6 | -------------------------------------------------------------------------------- /utils/s-xml/test/test-lxml-dom.lisp: -------------------------------------------------------------------------------- 1 | ;;;; -*- mode: lisp -*- 2 | ;;;; 3 | ;;;; $Id: test-lxml-dom.lisp,v 1.2 2005/11/06 12:44:48 scaekenberghe Exp $ 4 | ;;;; 5 | ;;;; Unit and functional tests for lxml-dom.lisp 6 | ;;;; 7 | ;;;; Copyright (C) 2002, 2004 Sven Van Caekenberghe, Beta Nine BVBA. 8 | ;;;; 9 | ;;;; You are granted the rights to distribute and use this software 10 | ;;;; as governed by the terms of the Lisp Lesser General Public License 11 | ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL. 12 | 13 | (in-package :s-xml) 14 | 15 | (assert 16 | (equal (with-input-from-string (stream " ") 17 | (parse-xml stream :output-type :lxml)) 18 | :|foo|)) 19 | 20 | (assert 21 | (equal (parse-xml-string "this is some text" 22 | :output-type :lxml) 23 | '(:|tag1| 24 | ((:|tag2| :|att1| "one")) 25 | "this is some text"))) 26 | 27 | (assert 28 | (equal (parse-xml-string "<foo>" 29 | :output-type :lxml) 30 | '(:TAG ""))) 31 | 32 | (assert 33 | (equal (parse-xml-string 34 | "

This is some bold text, with a leading & trailing space

" 35 | :output-type :lxml) 36 | '(:p 37 | ((:index :item "one")) 38 | " This is some " 39 | (:b "bold") 40 | " text, with a leading & trailing space "))) 41 | 42 | (assert 43 | (consp (parse-xml-file (merge-pathnames "xhtml-page.xml" *load-pathname*) 44 | :output-type :lxml))) 45 | 46 | (assert 47 | (consp (parse-xml-file (merge-pathnames "ant-build-file.xml" *load-pathname*) 48 | :output-type :lxml))) 49 | 50 | (assert 51 | (consp (parse-xml-file (merge-pathnames "plist.xml" *load-pathname*) 52 | :output-type :lxml))) 53 | 54 | (assert 55 | (string-equal (print-xml-string :|foo| :input-type :lxml) 56 | "")) 57 | 58 | (assert 59 | (string-equal (print-xml-string '((:|foo| :|bar| "1")) :input-type :lxml) 60 | "")) 61 | 62 | (assert 63 | (string-equal (print-xml-string '(:foo "some text") :input-type :lxml) 64 | "some text")) 65 | 66 | (assert 67 | (string-equal (print-xml-string '(:|foo| :|bar|) :input-type :lxml) 68 | "")) 69 | 70 | (assert (string-equal (second 71 | (with-input-from-string (stream "Hello, world!]]>") 72 | (parse-xml stream :output-type :lxml))) 73 | "Hello, world!")) 74 | 75 | (assert (string-equal (second 76 | (with-input-from-string (stream "Hello, < world!]]>") 77 | (parse-xml stream :output-type :lxml))) 78 | "Hello, < world!")) 79 | 80 | ;;;; eof -------------------------------------------------------------------------------- /utils/s-xml/test/test-sxml-dom.lisp: -------------------------------------------------------------------------------- 1 | ;;;; -*- mode: lisp -*- 2 | ;;;; 3 | ;;;; $Id: test-sxml-dom.lisp,v 1.1.1.1 2004/06/07 18:49:59 scaekenberghe Exp $ 4 | ;;;; 5 | ;;;; Unit and functional tests for sxml-dom.lisp 6 | ;;;; 7 | ;;;; Copyright (C) 2002, 2004 Sven Van Caekenberghe, Beta Nine BVBA. 8 | ;;;; 9 | ;;;; You are granted the rights to distribute and use this software 10 | ;;;; as governed by the terms of the Lisp Lesser General Public License 11 | ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL. 12 | 13 | (in-package :s-xml) 14 | 15 | (assert 16 | (equal (with-input-from-string (stream " ") 17 | (parse-xml stream :output-type :sxml)) 18 | '(:|foo|))) 19 | 20 | (assert 21 | (equal (parse-xml-string "this is some text" 22 | :output-type :sxml) 23 | '(:|tag1| 24 | (:|tag2| (:@ (:|att1| "one"))) 25 | "this is some text"))) 26 | 27 | (assert 28 | (equal (parse-xml-string "<foo>" 29 | :output-type :sxml) 30 | '(:TAG ""))) 31 | 32 | (assert 33 | (equal (parse-xml-string 34 | "

This is some bold text, with a leading & trailing space

" 35 | :output-type :sxml) 36 | '(:p 37 | (:index (:@ (:item "one"))) 38 | " This is some " 39 | (:b "bold") 40 | " text, with a leading & trailing space "))) 41 | 42 | (assert 43 | (consp (parse-xml-file (merge-pathnames "xhtml-page.xml" *load-pathname*) 44 | :output-type :sxml))) 45 | 46 | (assert 47 | (consp (parse-xml-file (merge-pathnames "ant-build-file.xml" *load-pathname*) 48 | :output-type :sxml))) 49 | 50 | (assert 51 | (consp (parse-xml-file (merge-pathnames "plist.xml" *load-pathname*) 52 | :output-type :sxml))) 53 | 54 | (assert 55 | (string-equal (print-xml-string '(:|foo|) :input-type :sxml) 56 | "")) 57 | 58 | (assert 59 | (string-equal (print-xml-string '(:|foo| (:@ (:|bar| "1"))) :input-type :sxml) 60 | "")) 61 | 62 | (assert 63 | (string-equal (print-xml-string '(:foo "some text") :input-type :sxml) 64 | "some text")) 65 | 66 | (assert 67 | (string-equal (print-xml-string '(:|foo| (:|bar|)) :input-type :sxml) 68 | "")) 69 | 70 | ;;;; eof -------------------------------------------------------------------------------- /utils/s-xml/test/test-xml-struct-dom.lisp: -------------------------------------------------------------------------------- 1 | ;;;; -*- mode: lisp -*- 2 | ;;;; 3 | ;;;; $Id: test-xml-struct-dom.lisp,v 1.2 2005/08/29 15:01:49 scaekenberghe Exp $ 4 | ;;;; 5 | ;;;; Unit and functional tests for xml-struct-dom.lisp 6 | ;;;; 7 | ;;;; Copyright (C) 2002, 2004 Sven Van Caekenberghe, Beta Nine BVBA. 8 | ;;;; 9 | ;;;; You are granted the rights to distribute and use this software 10 | ;;;; as governed by the terms of the Lisp Lesser General Public License 11 | ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL. 12 | 13 | (in-package :s-xml) 14 | 15 | (assert 16 | (xml-equal (with-input-from-string (stream " ") 17 | (parse-xml stream :output-type :xml-struct)) 18 | (make-xml-element :name :|foo|))) 19 | 20 | (assert 21 | (xml-equal (parse-xml-string "this is some text" 22 | :output-type :xml-struct) 23 | (make-xml-element :name :|tag1| 24 | :children (list (make-xml-element :name :|tag2| 25 | :attributes '((:|att1| . "one"))) 26 | "this is some text")))) 27 | 28 | (assert 29 | (xml-equal (parse-xml-string "<foo>" 30 | :output-type :xml-struct) 31 | (make-xml-element :name :|tag| 32 | :children (list "")))) 33 | 34 | (assert 35 | (xml-equal (parse-xml-string 36 | "

This is some bold text, with a leading & trailing space

" 37 | :output-type :xml-struct) 38 | (make-xml-element :name :p 39 | :children (list (make-xml-element :name :index 40 | :attributes '((:item . "one"))) 41 | " This is some " 42 | (make-xml-element :name :b 43 | :children (list "bold")) 44 | " text, with a leading & trailing space ")))) 45 | 46 | (assert 47 | (xml-element-p (parse-xml-file (merge-pathnames "xhtml-page.xml" *load-pathname*) 48 | :output-type :xml-struct))) 49 | 50 | (assert 51 | (xml-element-p (parse-xml-file (merge-pathnames "ant-build-file.xml" *load-pathname*) 52 | :output-type :xml-struct))) 53 | 54 | (assert 55 | (xml-element-p (parse-xml-file (merge-pathnames "plist.xml" *load-pathname*) 56 | :output-type :xml-struct))) 57 | 58 | (assert 59 | (string-equal (print-xml-string (make-xml-element :name "foo") 60 | :input-type :xml-struct) 61 | "")) 62 | 63 | (assert 64 | (string-equal (print-xml-string (make-xml-element :name "foo" :attributes '((:|bar| . "1"))) 65 | :input-type :xml-struct) 66 | "")) 67 | 68 | (assert 69 | (string-equal (print-xml-string (make-xml-element :name "foo" :children (list "some text")) 70 | :input-type :xml-struct) 71 | "some text")) 72 | 73 | (assert 74 | (string-equal (print-xml-string (make-xml-element :name "foo" :children (list (make-xml-element :name "bar"))) 75 | :input-type :xml-struct) 76 | "")) 77 | 78 | ;;;; eof -------------------------------------------------------------------------------- /utils/s-xml/test/test-xml.lisp: -------------------------------------------------------------------------------- 1 | ;;;; -*- mode: lisp -*- 2 | ;;;; 3 | ;;;; $Id: test-xml.lisp,v 1.3 2005/11/06 12:44:48 scaekenberghe Exp $ 4 | ;;;; 5 | ;;;; Unit and functional tests for xml.lisp 6 | ;;;; 7 | ;;;; Copyright (C) 2002, 2004 Sven Van Caekenberghe, Beta Nine BVBA. 8 | ;;;; 9 | ;;;; You are granted the rights to distribute and use this software 10 | ;;;; as governed by the terms of the Lisp Lesser General Public License 11 | ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL. 12 | 13 | (in-package :s-xml) 14 | 15 | (assert 16 | (whitespace-char-p (character " "))) 17 | 18 | (assert 19 | (whitespace-char-p (character " "))) 20 | 21 | (assert 22 | (whitespace-char-p (code-char 10))) 23 | 24 | (assert 25 | (whitespace-char-p (code-char 13))) 26 | 27 | (assert 28 | (not (whitespace-char-p #\A))) 29 | 30 | (assert 31 | (char= (with-input-from-string (stream " ABC") 32 | (skip-whitespace stream)) 33 | #\A)) 34 | 35 | (assert 36 | (char= (with-input-from-string (stream "ABC") 37 | (skip-whitespace stream)) 38 | #\A)) 39 | 40 | (assert 41 | (string-equal (with-output-to-string (stream) (print-string-xml "" stream)) 42 | "<foo>")) 43 | 44 | (assert 45 | (string-equal (with-output-to-string (stream) (print-string-xml "' '" stream)) 46 | "' '")) 47 | 48 | (assert 49 | (let ((string (map 'string #'identity '(#\return #\tab #\newline)))) 50 | (string-equal (with-output-to-string (stream) (print-string-xml string stream)) 51 | string))) 52 | 53 | (defun simple-echo-xml (in out) 54 | (start-parse-xml 55 | in 56 | (make-instance 'xml-parser-state 57 | :new-element-hook #'(lambda (name attributes seed) 58 | (declare (ignore seed)) 59 | (format out "<~a~:{ ~a='~a'~}>" 60 | name 61 | (mapcar #'(lambda (p) (list (car p) (cdr p))) 62 | (reverse attributes)))) 63 | :finish-element-hook #'(lambda (name attributes parent-seed seed) 64 | (declare (ignore attributes parent-seed seed)) 65 | (format out "" name)) 66 | :text-hook #'(lambda (string seed) 67 | (declare (ignore seed)) 68 | (princ string out))))) 69 | 70 | (defun simple-echo-xml-string (string) 71 | (with-input-from-string (in string) 72 | (with-output-to-string (out) 73 | (simple-echo-xml in out)))) 74 | 75 | (assert 76 | (let ((xml "TextMore text!")) 77 | (equal (simple-echo-xml-string xml) 78 | xml))) 79 | 80 | (assert 81 | (let ((xml "

")) 82 | (equal (simple-echo-xml-string xml) 83 | xml))) 84 | 85 | ;;;; eof -------------------------------------------------------------------------------- /utils/s-xml/test/tracer.lisp: -------------------------------------------------------------------------------- 1 | ;;;; -*- mode: lisp -*- 2 | ;;;; 3 | ;;;; $Id: tracer.lisp,v 1.2 2004/06/11 11:14:43 scaekenberghe Exp $ 4 | ;;;; 5 | ;;;; A simple SSAX tracer example that can be used to understand how the hooks are called 6 | ;;;; 7 | ;;;; Copyright (C) 2004 Sven Van Caekenberghe, Beta Nine BVBA. 8 | ;;;; 9 | ;;;; You are granted the rights to distribute and use this software 10 | ;;;; as governed by the terms of the Lisp Lesser General Public License 11 | ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL. 12 | 13 | (in-package :s-xml) 14 | 15 | (defun trace-xml-log (level msg &rest args) 16 | (indent *standard-output* level) 17 | (apply #'format *standard-output* msg args) 18 | (terpri *standard-output*)) 19 | 20 | (defun trace-xml-new-element-hook (name attributes seed) 21 | (let ((new-seed (cons (1+ (car seed)) (1+ (cdr seed))))) 22 | (trace-xml-log (car seed) 23 | "(new-element :name ~s :attributes ~:[()~;~:*~s~] :seed ~s) => ~s" 24 | name attributes seed new-seed) 25 | new-seed)) 26 | 27 | (defun trace-xml-finish-element-hook (name attributes parent-seed seed) 28 | (let ((new-seed (cons (1- (car seed)) (1+ (cdr seed))))) 29 | (trace-xml-log (car parent-seed) 30 | "(finish-element :name ~s :attributes ~:[()~;~:*~s~] :parent-seed ~s :seed ~s) => ~s" 31 | name attributes parent-seed seed new-seed) 32 | new-seed)) 33 | 34 | (defun trace-xml-text-hook (string seed) 35 | (let ((new-seed (cons (car seed) (1+ (cdr seed))))) 36 | (trace-xml-log (car seed) 37 | "(text :string ~s :seed ~s) => ~s" 38 | string seed new-seed) 39 | new-seed)) 40 | 41 | (defun trace-xml (in) 42 | "Parse and trace a toplevel XML element from stream in" 43 | (start-parse-xml in 44 | (make-instance 'xml-parser-state 45 | :seed (cons 0 0) 46 | ;; seed car is xml element nesting level 47 | ;; seed cdr is ever increasing from element to element 48 | :new-element-hook #'trace-xml-new-element-hook 49 | :finish-element-hook #'trace-xml-finish-element-hook 50 | :text-hook #'trace-xml-text-hook))) 51 | 52 | (defun trace-xml-file (pathname) 53 | "Parse and trace XMl from the file at pathname" 54 | (with-open-file (in pathname) 55 | (trace-xml in))) 56 | 57 | ;;;; eof 58 | -------------------------------------------------------------------------------- /utils/split-sequence/README.cCLan-install: -------------------------------------------------------------------------------- 1 | 1. Make a symlink in "~/lisp-systems/"[*] pointing to the .asd file 2 | 2. Start your asdf-enabled lisp 3 | 2a. Ensure that "~/lisp-systems/"[*] is in asdf:*central-registry* 4 | 3. At the lisp prompt, type '(asdf:oos 'asdf:load-op "split-sequence")'. This 5 | will compile and load the system into your running lisp. 6 | 7 | [*] This path ("~/lisp-systems/") is only a suggestion; the important 8 | thing is that asdf know where to find the .asd file. Adsf uses the 9 | contents of the variable ASDF:*CENTRAL-REGISTRY* to find its system 10 | definitions. 11 | 12 | These instructions were automatically generated by cCLan software. Use 13 | at your own peril. 14 | -------------------------------------------------------------------------------- /utils/split-sequence/split-sequence.asd: -------------------------------------------------------------------------------- 1 | ;;; -*- Lisp -*- mode 2 | (defpackage #:split-sequence-system (:use #:cl #:asdf)) 3 | (in-package :split-sequence-system) 4 | 5 | (defsystem :split-sequence 6 | :version "20011114.1" 7 | :components ((:file "split-sequence"))) 8 | -------------------------------------------------------------------------------- /utils/trivial-gray-streams-2008-11-02/COPYING: -------------------------------------------------------------------------------- 1 | Copyright (c) 2005 David Lichteblau 2 | 3 | Permission is hereby granted, free of charge, to any person 4 | obtaining a copy of this software and associated documentation files 5 | (the "Software"), to deal in the Software without restriction, 6 | including without limitation the rights to use, copy, modify, merge, 7 | publish, distribute, sublicense, and/or sell copies of the Software, 8 | and to permit persons to whom the Software is furnished to do so, 9 | subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 18 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 19 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /utils/trivial-gray-streams-2008-11-02/CVS/Entries: -------------------------------------------------------------------------------- 1 | /COPYING/1.1/Sun Dec 4 23:41:05 2005// 2 | /Makefile/1.1.1.1/Wed Nov 9 22:11:00 2005// 3 | /README/1.3/Thu Sep 14 17:45:36 2006// 4 | /mixin.lisp/1.7/Sat Nov 1 03:13:22 2008// 5 | /package.lisp/1.5/Wed Sep 10 16:36:29 2008// 6 | /trivial-gray-streams.asd/1.1.1.1/Wed Nov 9 22:11:00 2005// 7 | D 8 | -------------------------------------------------------------------------------- /utils/trivial-gray-streams-2008-11-02/CVS/Repository: -------------------------------------------------------------------------------- 1 | trivial-gray-streams 2 | -------------------------------------------------------------------------------- /utils/trivial-gray-streams-2008-11-02/CVS/Root: -------------------------------------------------------------------------------- 1 | :pserver:anonymous:anonymous@common-lisp.net:/project/cl-plus-ssl/cvsroot 2 | -------------------------------------------------------------------------------- /utils/trivial-gray-streams-2008-11-02/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: clean 2 | clean: 3 | rm -f *.fasl *.x86f *.fas *.ufsl *.lib *.pfsl 4 | -------------------------------------------------------------------------------- /utils/trivial-gray-streams-2008-11-02/README: -------------------------------------------------------------------------------- 1 | trivial-gray-streams 2 | ==================== 3 | 4 | This system provides an extremely thin compatibility layer for gray 5 | streams. It is nearly *too* trivial for a complete package, except that 6 | I have copy&pasted this code into enough projects now that I decided to 7 | factor it out once again now, and then *never* have to touch it again. 8 | 9 | 10 | How to use it 11 | ============= 12 | 13 | 1. Use the package TRIVIAL-GRAY-STREAMS instead of whatever 14 | implementation-specific package you would have to use otherwise to 15 | get at gray stream symbols. 16 | 2. For STREAM-READ-SEQUENCE and STREAM-WRITE-SEQUENCE, notice that we 17 | use two required arguments and allow additional keyword arguments. 18 | So the lambda list when defining a method on either function should look 19 | like this: 20 | (stream sequence start end &key) 21 | 3. In order for (2) to work on all Lisps, make sure to subclass all your 22 | stream classes from TRIVIAL-GRAY-STREAM-MIXIN if you intend to define 23 | methods on those two generic functions. 24 | 25 | 26 | Extensions 27 | ========== 28 | 29 | Generic function STREAM-READ-SEQUENCE (stream sequence start end &key) 30 | Generic function STREAM-WRITE-SEQUENCE (stream sequence start end &key) 31 | 32 | See above. 33 | 34 | Generic function STREAM-FILE-POSITION (stream) => file position 35 | Generic function (SETF STREAM-FILE-POSITION) (position-spec stream) => successp 36 | 37 | Will only be called by LispWorks and CLISP. 38 | -------------------------------------------------------------------------------- /utils/trivial-gray-streams-2008-11-02/package.lisp: -------------------------------------------------------------------------------- 1 | (in-package :trivial-gray-streams-system) 2 | 3 | #+cmu 4 | (eval-when (:compile-toplevel :load-toplevel :execute) 5 | (require :gray-streams)) 6 | 7 | #+allegro 8 | (eval-when (:compile-toplevel :load-toplevel :execute) 9 | (unless (fboundp 'stream:stream-write-string) 10 | (require "streamc.fasl"))) 11 | 12 | #+ecl 13 | (eval-when (:compile-toplevel :load-toplevel :execute) 14 | (gray::redefine-cl-functions)) 15 | 16 | (macrolet 17 | ((frob () 18 | (let 19 | ((common-symbols 20 | '(#:fundamental-stream #:fundamental-input-stream 21 | #:fundamental-output-stream #:fundamental-character-stream 22 | #:fundamental-binary-stream #:fundamental-character-input-stream 23 | #:fundamental-character-output-stream 24 | #:fundamental-binary-input-stream 25 | #:fundamental-binary-output-stream #:stream-read-char 26 | #:stream-unread-char #:stream-read-char-no-hang 27 | #:stream-peek-char #:stream-listen #:stream-read-line 28 | #:stream-clear-input #:stream-write-char #:stream-line-column 29 | #:stream-start-line-p #:stream-write-string #:stream-terpri 30 | #:stream-fresh-line #:stream-finish-output #:stream-force-output 31 | #:stream-clear-output #:stream-advance-to-column 32 | #:stream-read-byte #:stream-write-byte))) 33 | `(defpackage :trivial-gray-streams 34 | (:use :cl) 35 | (:import-from #+sbcl :sb-gray 36 | #+allegro :excl 37 | #+cmu :ext 38 | #+clisp :gray 39 | #+openmcl :ccl 40 | #+lispworks :stream 41 | #+ecl :gray 42 | #-(or sbcl allegro cmu clisp openmcl lispworks ecl) ... 43 | ,@common-symbols) 44 | (:export #:trivial-gray-stream-mixin 45 | #:stream-read-sequence 46 | #:stream-write-sequence 47 | #:stream-file-position 48 | ,@common-symbols))))) 49 | (frob)) 50 | -------------------------------------------------------------------------------- /utils/trivial-gray-streams-2008-11-02/trivial-gray-streams.asd: -------------------------------------------------------------------------------- 1 | ;;; -*- mode: lisp -*- 2 | 3 | (defpackage :trivial-gray-streams-system 4 | (:use :cl :asdf)) 5 | (in-package :trivial-gray-streams-system) 6 | 7 | (defsystem :trivial-gray-streams 8 | :serial t 9 | :components ((:file "package") (:file "mixin"))) 10 | -------------------------------------------------------------------------------- /utils/usocket-0.4.1/LICENSE: -------------------------------------------------------------------------------- 1 | (This is the MIT / X Consortium license as taken from 2 | http://www.opensource.org/licenses/mit-license.html) 3 | 4 | Copyright (c) 2003 Erik Enge 5 | Copyright (c) 2006-2007 Erik Huelsmann 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining 8 | a copy of this software and associated documentation files (the 9 | "Software"), to deal in the Software without restriction, including 10 | without limitation the rights to use, copy, modify, merge, publish, 11 | distribute, sublicense, and/or sell copies of the Software, and to 12 | permit persons to whom the Software is furnished to do so, subject to 13 | the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be 16 | included in all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 22 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 23 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 24 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25 | -------------------------------------------------------------------------------- /utils/usocket-0.4.1/Makefile: -------------------------------------------------------------------------------- 1 | # $Id: Makefile 80 2006-02-12 10:09:49Z ehuelsmann $ 2 | # $URL: svn+ssh://ehuelsmann@common-lisp.net/project/usocket/svn/usocket/tags/0.4.1/Makefile $ 3 | 4 | clean: 5 | find -name -o -name "*~" -o -name "*.err" -o -name "*.x86f" -o -name "*.lib" -o -name "*.fas" -o -name "*.fasl" -o -name "*.faslmt" -o -name "*.ufsl" -o -name "*.abcl" | xargs rm 6 | 7 | commit: 8 | make clean; svn up; svn ci 9 | 10 | -------------------------------------------------------------------------------- /utils/usocket-0.4.1/TODO: -------------------------------------------------------------------------------- 1 | 2 | - Implement wait-for-input-internal for 3 | * SBCL Win32 4 | 5 | - Implement errors for (the alien interface code of) 6 | * SBCL Unix 7 | * CMUCL Unix 8 | * OpenMCL 9 | 10 | 11 | - Extend ABCL socket support with the 4 java errors in java.net.* 12 | so that they can map to our usocket errors instead of mapping 13 | all errors to unknown-error. 14 | 15 | - Add INET6 support. 16 | 17 | For more TODO items, see http://trac.common-lisp.net/usocket/report. 18 | -------------------------------------------------------------------------------- /utils/usocket-0.4.1/doc/backends.txt: -------------------------------------------------------------------------------- 1 | -*- text -*- 2 | 3 | $Id: backends.txt 182 2007-01-19 23:43:12Z ehuelsmann $ 4 | 5 | A document to describe which APIs a backend should implement. 6 | 7 | 8 | Each backend should implement: 9 | 10 | Functions: 11 | 12 | - handle-condition 13 | - socket-connect 14 | - socket-listen 15 | - get-hosts-by-name [ optional ] 16 | - get-host-by-address [ optional ] 17 | 18 | 19 | Methods: 20 | 21 | - socket-close 22 | - socket-accept 23 | - get-local-name 24 | - get-peer-name 25 | 26 | and - for ip sockets - these methods: 27 | 28 | - get-local-address 29 | - get-local-port 30 | - get-peer-address 31 | - get-peer-port 32 | 33 | 34 | An error-handling function, resolving implementation specific errors 35 | to this list of errors: 36 | 37 | - address-in-use-error 38 | - address-not-available-error 39 | - bad-file-descriptor-error 40 | - connection-refused-error 41 | - invalid-argument-error 42 | - no-buffers-error 43 | - operation-not-supported-error 44 | - operation-not-permitted-error 45 | - protocol-not-supported-error 46 | - socket-type-not-supported-error 47 | - network-unreachable-error 48 | - network-down-error 49 | - network-reset-error 50 | - host-down-error 51 | - host-unreachable-error 52 | - shutdown-error 53 | - timeout-error 54 | - unkown-error 55 | 56 | and these conditions: 57 | 58 | - interrupted-condition 59 | - unkown-condition 60 | -------------------------------------------------------------------------------- /utils/usocket-0.4.1/notes/abcl-socket.txt: -------------------------------------------------------------------------------- 1 | 2 | ABCL provides a callback interface to java objects, next to these calls: 3 | 4 | - ext:make-socket 5 | - ext:socket-close 6 | - ext:make-server-socket 7 | - ext:socket-accept 8 | - ext:get-socket-stream (returning an io-stream) 9 | 10 | abcl-swank (see SLIME) shows how to call directly into java. 11 | 12 | 13 | See for the sockets implementation: 14 | 15 | - src/org/armedbear/lisp 16 | * socket.lisp 17 | * socket_stream.java 18 | * SocketStream.java 19 | -------------------------------------------------------------------------------- /utils/usocket-0.4.1/notes/active-sockets-apis.txt: -------------------------------------------------------------------------------- 1 | -*- text -*- 2 | 3 | A document to summarizing which API's of the different implementations 4 | are associated with 'Step 1'. 5 | 6 | Interface to be implemented in step 1: 7 | 8 | - socket-connect 9 | - socket-close 10 | - get-host-by-address 11 | - get-hosts-by-name 12 | 13 | (and something to do with errors; maybe move this to step 1a?) 14 | 15 | SBCL 16 | ==== 17 | 18 | sockets: 19 | - socket-bind 20 | - make-instance 'inet-socket 21 | - socket-make-stream 22 | - socket-connect (ip vector-quad) port 23 | - socket-close 24 | 25 | DNS name resolution: 26 | - get-host-by-name 27 | - get-host-by-address 28 | - ::host-ent-addresses 29 | - host-ent-name 30 | 31 | 32 | CMUCL 33 | ===== 34 | 35 | sockets: 36 | - ext:connect-to-inet-socket (ip integer) port 37 | - sys:make-fd-stream 38 | - ext:close-socket 39 | 40 | DNS name resolution: 41 | - ext:host-entry-name 42 | - ext::lookup-host-entry 43 | - ext:host-entry-addr-list 44 | - ext:lookup-host-entry 45 | 46 | 47 | ABCL 48 | ==== 49 | 50 | sockets 51 | - ext:socket-connect (hostname string) port 52 | - ext:get-socket-stream 53 | - ext:socket-close 54 | 55 | 56 | clisp 57 | ===== 58 | 59 | sockets 60 | - socket-connect port (hostname string) 61 | - close (socket) 62 | 63 | 64 | Allegro 65 | ======= 66 | 67 | sockets 68 | - make-socket 69 | - socket-connect 70 | - close 71 | 72 | DNS resolution 73 | - lookup-hostname 74 | - ipaddr-to-hostname 75 | 76 | -------------------------------------------------------------------------------- /utils/usocket-0.4.1/notes/address-apis.txt: -------------------------------------------------------------------------------- 1 | 2 | -*- text -*- 3 | 4 | Step 2 of the master plan: Implementing (get-local-address sock) and 5 | (get-peer-address sock). 6 | 7 | 8 | Step 2 is about implementing: 9 | 10 | (get-local-address sock) -> ip 11 | (get-peer-address sock) -> ip 12 | (get-local-port sock) -> port 13 | (get-peer-port sock) -> port 14 | (get-local-name sock) -> ip, port 15 | (get-peer-name sock) -> ip, port 16 | 17 | 18 | ABCL 19 | ==== 20 | 21 | FFI / J-calls to "getLocalAddress"+"getAddress", "getLocalPort" (local) 22 | FFI / J-calls to "getInetAddress"+"getAddress", "getPort" (peer) 23 | 24 | (see SLIME / swank-abcl.lisp for an example on how to do that) 25 | 26 | 27 | Allegro 28 | ======= 29 | 30 | (values (socket:remote-host sock) 31 | (socket:remote-port)) -> 32bit ip, port 32 | 33 | (values (socket:local-host sock) 34 | (socket:local-port sock)) -> 32bit ip, port 35 | 36 | CLISP 37 | ===== 38 | 39 | (socket:socket-stream-local sock nil) -> address (as dotted quad), port 40 | (socket:socket-stream-peer sock nil) -> address (as dotted quad), port 41 | 42 | 43 | CMUCL 44 | ===== 45 | 46 | (ext:get-peer-host-and-port sock-fd) -> 32-bit-addr, port (peer) 47 | (ext:get-socket-host-and-port sock-fd) -> 32-bit-addr, port (local) 48 | 49 | 50 | LispWorks 51 | ========= 52 | 53 | (comm:socket-stream-address sock-stream) -> 32-bit-addr, port 54 | or: (comm:get-socket-address sock) -> 32-bit-addr, port 55 | 56 | (comm:socket-stream-peer-address sock-stream) -> 32-bit-addr, port 57 | or: (comm:get-socket-peer-address sock) -> 32-bit-addr, port 58 | 59 | 60 | OpenMCL 61 | ======= 62 | 63 | (values (ccl:local-host sock) (ccl:local-port sock)) -> 32-bit ip, port 64 | (values (ccl:remote-host sock) (ccl:remote-port sock)) -> 32-bit ip, port 65 | 66 | 67 | SBCL 68 | ==== 69 | 70 | (sb-bsd-sockets:socket-name sock) -> vector-quad, port 71 | (sb-bsd-sockets:socket-peer-name sock) -> vector-quad, port 72 | 73 | 74 | -------------------------------------------------------------------------------- /utils/usocket-0.4.1/notes/allegro-socket.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | (require :sock) 4 | 5 | accept-connection (sock passive-socket) &key wait Generic function. 6 | dotted-to-ipaddr dotted &key errorp Function. 7 | ipaddr-to-dotted ipaddr &key values Function. 8 | ipaddr-to-hostname ipaddr Function. 9 | lookup-hostname hostname 10 | lookup-port portname protocol Function. 11 | make-socket &key type format address-family connect &allow-other-keys Function. 12 | with-pending-connect &body body Macro. 13 | receive-from (sock datagram-socket) size &key buffer extract Generic function. 14 | send-to sock &key 15 | shutdown sock &key direction 16 | socket-control stream &key output-chunking output-chunking-eof input-chunking 17 | socket-os-fd sock Generic function. 18 | 19 | remote-host socket Generic function. 20 | local-host socket Generic function. 21 | local-port socket 22 | 23 | remote-filename socket 24 | local-filename socket 25 | remote-port socket 26 | socket-address-family socket 27 | socket-connect socket 28 | socket-format socket 29 | socket-type socket 30 | 31 | errors 32 | 33 | :address-in-use Local socket address already in use 34 | :address-not-available Local socket address not available 35 | :network-down Network is down 36 | :network-reset Network has been reset 37 | :connection-aborted Connection aborted 38 | :connection-reset Connection reset by peer 39 | :no-buffer-space No buffer space 40 | :shutdown Connection shut down 41 | :connection-timed-out Connection timed out 42 | :connection-refused Connection refused 43 | :host-down Host is down 44 | :host-unreachable Host is unreachable 45 | :unknown Unknown error 46 | 47 | -------------------------------------------------------------------------------- /utils/usocket-0.4.1/notes/clisp-sockets.txt: -------------------------------------------------------------------------------- 1 | http://clisp.cons.org/impnotes.html#socket 2 | 3 | (SOCKET:SOCKET-SERVER &OPTIONAL [port-or-socket]) 4 | (SOCKET:SOCKET-SERVER-HOST socket-server) 5 | (SOCKET:SOCKET-SERVER-PORT socket-server) 6 | (SOCKET:SOCKET-WAIT socket-server &OPTIONAL [seconds [microseconds]]) 7 | (SOCKET:SOCKET-ACCEPT socket-server &KEY :ELEMENT-TYPE :EXTERNAL-FORMAT :BUFFERED :TIMEOUT) 8 | (SOCKET:SOCKET-CONNECT port &OPTIONAL [host] &KEY :ELEMENT-TYPE :EXTERNAL-FORMAT :BUFFERED :TIMEOUT) 9 | (SOCKET:SOCKET-STATUS socket-stream-or-list &OPTIONAL [seconds [microseconds]]) 10 | (SOCKET:SOCKET-STREAM-HOST socket-stream) 11 | (SOCKET:SOCKET-STREAM-PORT socket-stream) 12 | (SOCKET:SOCKET-SERVICE-PORT &OPTIONAL service-name (protocol "tcp")) 13 | (SOCKET:SOCKET-STREAM-PEER socket-stream [do-not-resolve-p]) 14 | (SOCKET:SOCKET-STREAM-LOCAL socket-stream [do-not-resolve-p]) 15 | (SOCKET:SOCKET-STREAM-SHUTDOWN socket-stream direction) 16 | (SOCKET:SOCKET-OPTIONS socket-server &REST {option}*) 17 | 18 | 19 | (posix:resolve-host-ipaddr &optional host) 20 | 21 | with the host-ent structure: 22 | 23 | name - host name 24 | aliases - LIST of aliases 25 | addr-list - LIST of IPs as dotted quads (IPv4) or coloned octets (IPv6) 26 | addrtype - INTEGER address type IPv4 or IPv6 27 | 28 | 29 | Errors are of type 30 | 31 | SYSTEM::SIMPLE-OS-ERROR 32 | with a 1 element (integer) SYSTEM::$FORMAT-ARGUMENTS list 33 | 34 | This integer stores the OS error reported; meaning WSA* codes on Win32 35 | and E* codes on *nix, only: unix.lisp in CMUCL shows 36 | BSD, Linux and SRV4 have different number assignments for the same 37 | E* constant names :-( 38 | 39 | -------------------------------------------------------------------------------- /utils/usocket-0.4.1/notes/cmucl-sockets.txt: -------------------------------------------------------------------------------- 1 | http://cvs2.cons.org/ftp-area/cmucl/doc/cmu-user/internet.html 2 | 3 | $Id: cmucl-sockets.txt 91 2006-02-13 08:01:51Z ehuelsmann $ 4 | 5 | extensions:lookup-host-entry host 6 | 7 | [structure] 8 | host-entry 9 | 10 | name aliases addr-type addr-list 11 | 12 | [Function] 13 | extensions:create-inet-listener port &optional kind &key :reuse-address :backlog :interface 14 | => socket fd 15 | 16 | [Function] 17 | extensions:accept-tcp-connection unconnected 18 | => socket fd, address 19 | 20 | [Function] 21 | extensions:connect-to-inet-socket host port &optional kind 22 | => socket fd 23 | 24 | [Function] 25 | extensions:close-socket socket 26 | 27 | 28 | 29 | [Private function] 30 | extensions::get-peer-host-and-port socket-fd 31 | 32 | [Private function] 33 | extentsions::get-socket-host-and-port socket-fd 34 | 35 | 36 | 37 | There's currently only 1 condition to be raised: 38 | 39 | SOCKET-ERROR (derived from SIMPLE-ERROR) 40 | which has a SOCKET-ERRNO slot containing the unix error number. 41 | 42 | 43 | 44 | 45 | [Function] 46 | extensions:add-oob-handler fd char handler 47 | 48 | [Function] 49 | extensions:remove-oob-handler fd char 50 | 51 | [Function] 52 | extensions:remove-all-oob-handlers fd 53 | 54 | [Function] 55 | extensions:send-character-out-of-band fd char 56 | 57 | [Function] 58 | extensions:create-inet-socket &optional type 59 | => socket fd 60 | 61 | [Function] 62 | extensions:get-socket-option socket level optname 63 | 64 | [Function] 65 | extensions:set-socket-option socket level optname optval 66 | 67 | [Function] 68 | extensions:ip-string addr 69 | 70 | -------------------------------------------------------------------------------- /utils/usocket-0.4.1/notes/errors.txt: -------------------------------------------------------------------------------- 1 | EADDRINUSE 48 address-in-use-error 2 | EADDRNOTAVAIL 49 address-not-available-error 3 | EAGAIN interrupted-error ;; not 1 error code: bsd == 11; non-bsd == 35 4 | EBADF 9 bad-file-descriptor-error 5 | ECONNREFUSED 61 connection-refused-error 6 | EINTR 4 interrupted-error 7 | EINVAL 22 invalid-argument-error 8 | ENOBUFS 55 no-buffers-error 9 | ENOMEM 12 out-of-memory-error 10 | EOPNOTSUPP 45 operation-not-supported-error 11 | EPERM 1 operation-not-permitted-error 12 | EPROTONOSUPPORT 43 protocol-not-supported-error 13 | ESOCKTNOSUPPORT 44 socket-type-not-supported-error 14 | ENETUNREACH 51 network-unreachable-error 15 | ENETDOWN 50 network-down-error 16 | ENETRESET 52 network-reset-error 17 | ESHUTDOWN 58 already-shutdown-error 18 | ETIMEDOUT 60 connection-timeout-error 19 | EHOSTDOWN 64 host-down-error 20 | EHOSTUNREACH 65 host-unreachable-error 21 | -------------------------------------------------------------------------------- /utils/usocket-0.4.1/notes/lw-sockets.txt: -------------------------------------------------------------------------------- 1 | 2 | $Id: lw-sockets.txt 91 2006-02-13 08:01:51Z ehuelsmann $ 3 | 4 | http://www.lispworks.com/reference/lwu41/lwref/LWRM_37.HTM 5 | 6 | Package: COMM 7 | 8 | ip-address-string 9 | socket-stream-address 10 | socket-stream-peer-address 11 | start-up-server 12 | start-up-server-and-mp 13 | string-ip-address 14 | with-noticed-socket-stream 15 | 16 | Needed components for usocket: 17 | 18 | comm::get-fd-from-socket socket-fd 19 | => socket-fd 20 | 21 | comm::accept-connection-to-socket socket-fd 22 | => socket-fd 23 | 24 | comm::close-socket 25 | comm::create-tcp-socket-for-service 26 | => socket-fd 27 | 28 | open-tcp-stream peer-host peer-port &key direction element-type 29 | => socket-stream 30 | 31 | get-host-entry (see http://www.lispworks.com/documentation/lw445/LWRM/html/lwref-30.htm#pgfId-897837) 32 | get-socket-address 33 | 34 | get-socket-peer-address 35 | => address, port 36 | 37 | socket-stream socket-fd 38 | => stream 39 | 40 | socket socket-stream (guessed from http://www.lispworks.com/documentation/lw445/LWRM/html/lwref-43.htm) 41 | => socket-fd 42 | -------------------------------------------------------------------------------- /utils/usocket-0.4.1/notes/openmcl-sockets.txt: -------------------------------------------------------------------------------- 1 | http://openmcl.clozure.com/Doc/sockets.html 2 | 3 | make-socket [Function] 4 | accept-connection [Function] 5 | dotted-to-ipaddr [Function] 6 | ipaddr-to-dotted [Function] 7 | ipaddr-to-hostname [Function] 8 | lookup-hostname [Function] 9 | lookup-port [Function] 10 | receive-from [Function] 11 | send-to [Function] 12 | shutdown [Function] 13 | socket-os-fd [Function] 14 | remote-port [Function] 15 | local-host [Function] 16 | local-port [Function] 17 | 18 | socket-address-family [Function] 19 | 20 | socket-connect [Function] 21 | socket-format [Function] 22 | socket-type [Function] 23 | socket-error [Class] 24 | socket-error-code [Function] 25 | socket-error-identifier [Function] 26 | socket-error-situation [Function] 27 | close [method] 28 | -------------------------------------------------------------------------------- /utils/usocket-0.4.1/notes/usock-sockets.txt: -------------------------------------------------------------------------------- 1 | Package: 2 | 3 | clisp : socket 4 | cmucl : extensions 5 | sbcl : sb-bsd-sockets 6 | lw : comm 7 | openmcl: openmcl-socket 8 | allegro: sock 9 | 10 | Connecting (TCP/inet only) 11 | 12 | clisp : socket-connect port &optional [host] &key :element-type :external-format :buffered :timeout = > socket-stream 13 | cmucl : connect-to-inet-socket host port &optional kind => file descriptor 14 | sbcl : sb-socket-connect socket &rest address => socket 15 | lw : open-tcp-stream hostname service &key direction element-type buffered => stream-object 16 | openmcl: socket-connect socket => :active, :passive or nil 17 | allegro: make-socket (&rest args &key type format connect address-family eol) => socket 18 | 19 | Closing 20 | 21 | clisp : close socket 22 | cmucl : close-socket socket 23 | sbcl : socket-close socket 24 | lw : close socket 25 | openmcl: close socket 26 | allegro: close socket 27 | 28 | Errors -------------------------------------------------------------------------------- /utils/usocket-0.4.1/package.lisp: -------------------------------------------------------------------------------- 1 | ;;;; $Id: package.lisp 452 2008-10-22 07:18:07Z ctian $ 2 | ;;;; $URL: svn+ssh://ehuelsmann@common-lisp.net/project/usocket/svn/usocket/tags/0.4.1/package.lisp $ 3 | 4 | ;;;; See the LICENSE file for licensing information. 5 | 6 | #+lispworks (cl:require "comm") 7 | 8 | (cl:eval-when (:execute :load-toplevel :compile-toplevel) 9 | (cl:defpackage :usocket 10 | (:use :cl) 11 | (:export #:*wildcard-host* 12 | #:*auto-port* 13 | 14 | #:socket-connect ; socket constructors and methods 15 | #:socket-listen 16 | #:socket-accept 17 | #:socket-close 18 | #:get-local-address 19 | #:get-peer-address 20 | #:get-local-port 21 | #:get-peer-port 22 | #:get-local-name 23 | #:get-peer-name 24 | 25 | #:wait-for-input ; waiting for input-ready state (select() like) 26 | #:make-wait-list 27 | #:add-waiter 28 | #:remove-waiter 29 | #:remove-all-waiters 30 | 31 | #:with-connected-socket ; convenience macros 32 | #:with-server-socket 33 | #:with-client-socket 34 | #:with-socket-listener 35 | 36 | #:usocket ; socket object and accessors 37 | #:stream-usocket 38 | #:stream-server-usocket 39 | #:socket 40 | #:socket-stream 41 | 42 | #:host-byte-order ; IP(v4) utility functions 43 | #:hbo-to-dotted-quad 44 | #:hbo-to-vector-quad 45 | #:vector-quad-to-dotted-quad 46 | #:dotted-quad-to-vector-quad 47 | #:ip= 48 | #:ip/= 49 | 50 | #:integer-to-octet-buffer ; Network utility functions 51 | #:octet-buffer-to-integer 52 | #:port-to-octet-buffer 53 | #:port-from-octet-buffer 54 | #:ip-to-octet-buffer 55 | #:ip-from-octet-buffer 56 | 57 | #:with-mapped-conditions 58 | 59 | #:socket-condition ; conditions 60 | #:ns-condition 61 | #:socket-error ; errors 62 | #:ns-error 63 | #:unknown-condition 64 | #:ns-unknown-condition 65 | #:unknown-error 66 | #:ns-unknown-error 67 | 68 | #:insufficient-implementation ; conditions regarding usocket support level 69 | #:unsupported 70 | #:unimplemented 71 | ))) 72 | 73 | -------------------------------------------------------------------------------- /utils/usocket-0.4.1/run-usocket-tests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Test script to be run from the usocket source root 4 | # 5 | # Unfortunately, it currently works only with SBCL 6 | # in my setup... 7 | # 8 | # I need to figure out how to setup ASDF with the other lisps 9 | # I have installed: cmucl, ABCL, clisp, allegro and lispworks 10 | 11 | cd `dirname $0`/test 12 | rm tests.log 13 | 14 | if test -z "$1" ; then 15 | lisps=*.conf 16 | else 17 | lisps=$1 18 | fi 19 | 20 | for my_lisp_conf in $lisps ; do 21 | 22 | 23 | args= 24 | lisp_bin= 25 | lisp_name= 26 | lisp_exit="(quit result)" 27 | 28 | . $my_lisp_conf 29 | 30 | if test -z "$lisp_bin" ; then 31 | echo "YOU NEED TO SET A LISP BINARY IN YOUR CONF FILE" 32 | exit 1 33 | fi 34 | 35 | if test -z "$lisp_name" ; then 36 | lisp_name="`basename \"$lisp_bin\"`" 37 | fi 38 | 39 | echo " 40 | #-sbcl (load \"asdf.lisp\") 41 | 42 | (asdf:operate #-sbcl 'asdf:load-source-op 43 | #+sbcl 'asdf:load-op :usocket-test) 44 | 45 | (let ((result (if (usocket-test:do-tests) 1 0))) 46 | $lisp_exit) 47 | " | $lisp_bin $args 48 | 49 | if test $? -eq 1 ; then 50 | echo "PASS: $lisp_name" >> tests.log 51 | else 52 | echo "FAIL: $lisp_name" >> tests.log 53 | fi 54 | 55 | echo "Above the test results gathered for $lisp_name." 56 | 57 | done 58 | -------------------------------------------------------------------------------- /utils/usocket-0.4.1/test/abcl.conf.in: -------------------------------------------------------------------------------- 1 | # lisp binary test setup file 2 | 3 | args= 4 | 5 | # lisp_bin is required! 6 | lisp_bin=~/src/abcl-0.0.9/abcl 7 | lisp_name=ArmedBear 8 | 9 | # lisp_exit is required! 10 | lisp_exit="(quit :status result)" 11 | -------------------------------------------------------------------------------- /utils/usocket-0.4.1/test/allegro.conf.in: -------------------------------------------------------------------------------- 1 | # lisp binary test setup file 2 | 3 | args="-batch" 4 | 5 | # lisp_bin is required! 6 | lisp_bin="~/src/acl/acl70_trial/alisp" 7 | lisp_name=Allegro 8 | 9 | # lisp_exit is required! 10 | lisp_exit="(exit result :no-unwind t)" 11 | -------------------------------------------------------------------------------- /utils/usocket-0.4.1/test/clisp.conf.in: -------------------------------------------------------------------------------- 1 | # lisp binary test setup file 2 | 3 | args= 4 | 5 | # lisp_bin is required! 6 | lisp_bin=clisp 7 | lisp_name=clisp 8 | 9 | # lisp_exit is required! 10 | lisp_exit="(quit result)" 11 | -------------------------------------------------------------------------------- /utils/usocket-0.4.1/test/cmucl.conf.in: -------------------------------------------------------------------------------- 1 | # lisp binary test setup file 2 | 3 | args= 4 | 5 | # lisp_bin is required! 6 | lisp_bin="~/src/bin/lisp" 7 | lisp_name=CMUCL 8 | 9 | # lisp_exit is required! 10 | lisp_exit="(unix:unix-exit result)" 11 | -------------------------------------------------------------------------------- /utils/usocket-0.4.1/test/package.lisp: -------------------------------------------------------------------------------- 1 | ;;;; $Id: package.lisp 57 2006-02-07 19:39:46Z ehuelsmann $ 2 | ;;;; $URL: svn+ssh://ehuelsmann@common-lisp.net/project/usocket/svn/usocket/tags/0.4.1/test/package.lisp $ 3 | 4 | ;;;; See the LICENSE file for licensing information. 5 | 6 | (in-package :cl-user) 7 | 8 | (eval-when (:execute :load-toplevel :compile-toplevel) 9 | (defpackage :usocket-test 10 | (:use :cl :regression-test) 11 | (:nicknames :usoct) 12 | (:export :do-tests :run-usocket-tests))) 13 | 14 | -------------------------------------------------------------------------------- /utils/usocket-0.4.1/test/sbcl.conf.in: -------------------------------------------------------------------------------- 1 | # lisp binary test setup file 2 | 3 | args= 4 | 5 | # lisp_bin is required! 6 | lisp_bin=sbcl 7 | lisp_name=SBCL 8 | 9 | # lisp_exit is required! 10 | lisp_exit="(quit status :recklessly-p t)" 11 | -------------------------------------------------------------------------------- /utils/usocket-0.4.1/test/usocket-test.asd: -------------------------------------------------------------------------------- 1 | ;;;; $Id: usocket-test.asd 46 2006-02-06 20:50:07Z ehuelsmann $ 2 | ;;;; $URL: svn+ssh://ehuelsmann@common-lisp.net/project/usocket/svn/usocket/tags/0.4.1/test/usocket-test.asd $ 3 | 4 | ;;;; See the LICENSE file for licensing information. 5 | 6 | (in-package #:cl-user) 7 | 8 | (defpackage #:usocket-test-system 9 | (:use #:cl #:asdf)) 10 | 11 | (in-package #:usocket-test-system) 12 | 13 | (defsystem usocket-test 14 | :name "usocket-test" 15 | :author "Erik Enge" 16 | :version "0.1.0" 17 | :licence "MIT" 18 | :description "Tests for usocket" 19 | :depends-on (:usocket :rt) 20 | :components ((:file "package") 21 | (:file "test-usocket" 22 | :depends-on ("package")))) 23 | -------------------------------------------------------------------------------- /utils/usocket-0.4.1/test/your-lisp.conf.in: -------------------------------------------------------------------------------- 1 | # lisp binary test setup file 2 | 3 | args= 4 | 5 | # lisp_bin is required! 6 | lisp_bin= 7 | lisp_name= 8 | 9 | # lisp_exit is required! 10 | lisp_exit= 11 | -------------------------------------------------------------------------------- /utils/usocket-0.4.1/usocket.asd: -------------------------------------------------------------------------------- 1 | 2 | ;;;; $Id: usocket.asd 486 2008-12-27 21:53:50Z ehuelsmann $ 3 | ;;;; $URL: svn+ssh://ehuelsmann@common-lisp.net/project/usocket/svn/usocket/tags/0.4.1/usocket.asd $ 4 | 5 | ;;;; See the LICENSE file for licensing information. 6 | 7 | (in-package #:cl-user) 8 | 9 | (defpackage #:usocket-system 10 | (:use #:cl #:asdf)) 11 | 12 | (in-package #:usocket-system) 13 | 14 | (defsystem usocket 15 | :name "usocket" 16 | :author "Erik Enge & Erik Huelsmann" 17 | :version "0.4.1" 18 | :licence "MIT" 19 | :description "Universal socket library for Common Lisp" 20 | :depends-on (:split-sequence 21 | #+sbcl :sb-bsd-sockets) 22 | :components ((:file "package") 23 | (:file "usocket" 24 | :depends-on ("package")) 25 | (:file "condition" 26 | :depends-on ("usocket")) 27 | #+clisp (:file "clisp" :pathname "backend/clisp" 28 | :depends-on ("condition")) 29 | #+cmu (:file "cmucl" :pathname "backend/cmucl" 30 | :depends-on ("condition")) 31 | #+scl (:file "scl" :pathname "backend/scl" 32 | :depends-on ("condition")) 33 | #+(or sbcl ecl) (:file "sbcl" :pathname "backend/sbcl" 34 | :depends-on ("condition")) 35 | #+lispworks (:file "lispworks" :pathname "backend/lispworks" 36 | :depends-on ("condition")) 37 | #+openmcl (:file "openmcl" :pathname "backend/openmcl" 38 | :depends-on ("condition")) 39 | #+allegro (:file "allegro" :pathname "backend/allegro" 40 | :depends-on ("condition")) 41 | #+armedbear (:file "armedbear" :pathname "backend/armedbear" 42 | :depends-on ("condition")) 43 | )) 44 | -------------------------------------------------------------------------------- /utils/yason/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2008 Hans Hübner 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | - Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | 11 | - Redistributions in binary form must reproduce the above copyright 12 | notice, this list of conditions and the following disclaimer in 13 | the documentation and/or other materials provided with the 14 | distribution. 15 | 16 | - Neither the name BKNR nor the names of its contributors may be 17 | used to endorse or promote products derived from this software 18 | without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | -------------------------------------------------------------------------------- /utils/yason/package.lisp: -------------------------------------------------------------------------------- 1 | ;; This file is part of yason, a Common Lisp JSON parser/encoder 2 | ;; 3 | ;; Copyright (c) 2008 Hans Hübner 4 | ;; All rights reserved. 5 | ;; 6 | ;; Please see the file LICENSE in the distribution. 7 | 8 | (defpackage :yason 9 | 10 | (:use :cl) 11 | 12 | (:nicknames :json) 13 | 14 | (:export 15 | ;; Parser 16 | #:parse 17 | #:*parse-object-key-fn* 18 | #:*parse-object-as-alist* 19 | #:*parse-json-arrays-as-vectors* 20 | #:*parse-json-booleans-as-symbols* 21 | 22 | #:true 23 | #:false 24 | 25 | ;; Basic encoder interface 26 | #:encode 27 | #:encode-slots 28 | #:encode-object 29 | #:encode-plist 30 | #:encode-alist 31 | 32 | ;; Streaming encoder interface 33 | #:with-output 34 | #:with-output-to-string* 35 | #:no-json-output-context 36 | #:with-array 37 | #:encode-array-element 38 | #:encode-array-elements 39 | #:with-object 40 | #:encode-object-element 41 | #:encode-object-elements 42 | #:with-object-element 43 | #:with-response)) 44 | -------------------------------------------------------------------------------- /utils/yason/yason.asd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mark-watson/lisp_practical_semantic_web/cb55635a973b0330e0628ed3a59fcf5388eb5b67/utils/yason/yason.asd -------------------------------------------------------------------------------- /web_app/init.nt: -------------------------------------------------------------------------------- 1 | "8000" . 2 | "demo" . 3 | "demo" . 4 | -------------------------------------------------------------------------------- /web_app/test.lisp: -------------------------------------------------------------------------------- 1 | (load "../utils/lisp-unit.lisp") 2 | (use-package :lisp-unit) 3 | (load "backend.lisp") 4 | 5 | (lisp-unit:define-test "create-doc-test1" 6 | (add-document "file:///test1.doc" "test title" "John Smith went to Mexico") 7 | (pprint (db.agraph.user::print-triples (db.agraph.user::get-triples))) 8 | (let ((person-list (db.agraph.user::get-triples-list :p !kb:docPersonEntity)) 9 | (place-list (db.agraph.user::get-triples-list :p !kb:docPlaceEntity))) 10 | (lisp-unit:assert-equal 11 | (db.agraph.user::part->string 12 | (db.agraph.user::object (car person-list))) 13 | "\"John Smith\"") 14 | (lisp-unit:assert-equal 15 | (db.agraph.user::part->string 16 | (db.agraph.user::object (car place-list))) 17 | "\"Mexico\""))) 18 | 19 | (lisp-unit:define-test "print-triples" 20 | (print-all-docs) 21 | (lisp-unit:assert-equal t t)) 22 | 23 | (lisp-unit:define-test "good-login" 24 | (lisp-unit:assert-equal t (valid-login? "demo" "demo"))) 25 | 26 | (lisp-unit:define-test "bad-login" 27 | (lisp-unit:assert-equal nil (valid-login? "demo" "demo2"))) 28 | 29 | (run-tests) 30 | 31 | (db.agraph.user::delete-triples :o !kb:document) 32 | (db.agraph.user::delete-triples :p !kb:docText) 33 | (db.agraph.user::delete-triples :p !kb:docTitle) 34 | (db.agraph.user::delete-triples :p !kb:docPersonEntity) 35 | (db.agraph.user::delete-triples :p !kb:docPlaceEntity) 36 | (db.agraph.user::delete-triples :p !kb:docTag) 37 | (db.agraph.user::delete-triples :p !kb:doc) 38 | -------------------------------------------------------------------------------- /web_app/web/about.clp: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 |
6 | 7 |

Knowledge is Power

8 | Knowledge by itself is a worthy goal. Power in business 9 | comes from the application of knowledge to solve problems. 10 | Use a complete Open Source software stack that includes 11 | AI technology for information extraction, document repositories 12 | and a standards based web application. 13 | 14 |
15 | 16 |
17 | 18 | 19 | -------------------------------------------------------------------------------- /web_app/web/browser.clp: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 |

Free form search of Knowledge Sources

5 |
6 | 7 |
8 | 9 |
10 | 11 | 12 |
13 | 14 | 15 | -------------------------------------------------------------------------------- /web_app/web/footer.clp: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /web_app/web/header.clp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Knowledge Based Semantic Portal 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /web_app/web/images/background.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mark-watson/lisp_practical_semantic_web/cb55635a973b0330e0628ed3a59fcf5388eb5b67/web_app/web/images/background.gif -------------------------------------------------------------------------------- /web_app/web/images/background_left.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mark-watson/lisp_practical_semantic_web/cb55635a973b0330e0628ed3a59fcf5388eb5b67/web_app/web/images/background_left.gif -------------------------------------------------------------------------------- /web_app/web/images/menu.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mark-watson/lisp_practical_semantic_web/cb55635a973b0330e0628ed3a59fcf5388eb5b67/web_app/web/images/menu.gif -------------------------------------------------------------------------------- /web_app/web/layout.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 1px; 3 | background: url(images/background.gif); 4 | height: 95%; 5 | } 6 | 7 | ul { 8 | list-style: none; 9 | margin: 0; 10 | padding: 0; 11 | } 12 | 13 | #menu { 14 | width: 135px; 15 | border-style: solid solid none solid; 16 | border-color: #94AA74; 17 | border-size: 1px; 18 | border-width: 1px; 19 | margin: 3px; 20 | } 21 | 22 | #menu li a { 23 | height: 32px; 24 | voice-family: "\"}\""; 25 | voice-family: inherit; 26 | height: 24px; 27 | text-decoration: none; 28 | } 29 | 30 | #menu li a:link, #menu li a:visited { 31 | color: #5E7830; 32 | display: block; 33 | background: url(images/menu.gif); 34 | padding: 8px 0 0 10px; 35 | } 36 | 37 | #menu li a:hover { 38 | color: #26370A; 39 | background: url(images/menu.gif) 0 -32px; 40 | padding: 8px 0 0 10px; 41 | } 42 | 43 | #menu li a:active { 44 | color: #26370A; 45 | background: url(images/menu.gif) 0 -64px; 46 | padding: 8px 0 0 10px; 47 | } 48 | 49 | #header { 50 | height: 35px; 51 | padding-left: 30%; 52 | } 53 | 54 | #centerposition { 55 | padding-right: 5px; 56 | padding-left: 170px; 57 | overflow: auto; 58 | } 59 | 60 | #footer { 61 | padding-left: 175px; 62 | position: absolute; bottom: 0; 63 | center; 64 | } 65 | 66 | #left { 67 | width: 150px; 68 | height: 100%; 69 | position: absolute; 70 | top: 0px; 71 | left: 0px; 72 | padding: 10px 0px 10px 6px; 73 | background: url(images/background_left.gif); 74 | } 75 | 76 | -------------------------------------------------------------------------------- /web_app/web/left_bar.clp: -------------------------------------------------------------------------------- 1 |
2 | 9 | 10 |
-------------------------------------------------------------------------------- /web_app/web/login.clp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Login to: Knowledge Based Semantic Portal 5 | 6 | 7 | 8 | 9 |
10 |
11 |

Knowledge Based Semantic Portal Login

12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
User name:
Password:
24 |
25 |
26 | Note: this is a demo for the Common Lisp edition of "Practical Semantic Web programming" 27 |

28 |
29 |
30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /web_app/web/upload.clp: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | Last file upload was completed OK. 6 | 7 |

File upload to repository

8 | 9 |
10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 | 22 | 23 |
File to upload:
19 | 20 | 21 |
24 |
25 | 26 |
27 | 28 | 29 | 30 | 31 | --------------------------------------------------------------------------------