From 6b5046bb8c42dbfeab904875bc2e73856cfc39a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADtor=20Santos=20Costa?= Date: Tue, 15 Mar 2011 16:22:56 +0000 Subject: [PATCH] use external modules. --- .gitmodules | 13 +- include/SWI-Prolog.h | 3 +- library/dialect/swi/fli/swi.c | 9 +- packages/PLStream/pl-os.c | 2 +- packages/RDF | 1 + packages/RDF/ChangeLog | 280 - packages/RDF/Makefile.in | 135 - packages/RDF/Makefile.mak | 51 - packages/RDF/README | 12 - packages/RDF/config.h.in | 19 - packages/RDF/configure.in | 9 - packages/RDF/online.pl | 457 - packages/RDF/pretty_print.pl | 169 - packages/RDF/rdf.pl | 418 - packages/RDF/rdf2pl.doc | 475 - packages/RDF/rdf_diagram.pl | 509 - packages/RDF/rdf_ntriples.pl | 342 - packages/RDF/rdf_parser.pl | 632 - packages/RDF/rdf_triple.pl | 414 - packages/RDF/rdf_write.pl | 642 - packages/RDF/rdfs.rdfs | 237 - packages/RDF/rewrite.pl | 161 - packages/RDF/suite/ex_19.rdf | 12 - packages/RDF/suite/ok/ex_19.ok | 14 - packages/RDF/suite/ok/t1.ok | 1 - packages/RDF/suite/ok/t11.ok | 1 - packages/RDF/suite/ok/t12.ok | 1 - packages/RDF/suite/ok/t13.ok | 1 - packages/RDF/suite/ok/t14.ok | 3 - packages/RDF/suite/ok/t15.ok | 3 - packages/RDF/suite/ok/t16.ok | 3 - packages/RDF/suite/ok/t17.ok | 3 - packages/RDF/suite/ok/t18.ok | 3 - packages/RDF/suite/ok/t19.ok | 4 - packages/RDF/suite/ok/t2.ok | 3 - packages/RDF/suite/ok/t20.ok | 4 - packages/RDF/suite/ok/t21.ok | 7 - packages/RDF/suite/ok/t22.ok | 5 - packages/RDF/suite/ok/t24.ok | 5 - packages/RDF/suite/ok/t26.ok | 8 - packages/RDF/suite/ok/t27.ok | 12 - packages/RDF/suite/ok/t28.ok | 3 - packages/RDF/suite/ok/t29.ok | 3 - packages/RDF/suite/ok/t3.ok | 3 - packages/RDF/suite/ok/t30.ok | 12 - packages/RDF/suite/ok/t31.ok | 17 - packages/RDF/suite/ok/t32.ok | 15 - packages/RDF/suite/ok/t33.ok | 2 - packages/RDF/suite/ok/t36.ok | 4 - packages/RDF/suite/ok/t37.ok | 7 - packages/RDF/suite/ok/t38.ok | 128 - packages/RDF/suite/ok/t39.ok | 9 - packages/RDF/suite/ok/t4.ok | 6 - packages/RDF/suite/ok/t40.ok | 4 - packages/RDF/suite/ok/t41.ok | 3 - packages/RDF/suite/ok/t42.ok | 4 - packages/RDF/suite/ok/t5.ok | 7 - packages/RDF/suite/ok/t6.ok | 4 - packages/RDF/suite/ok/t7.ok | 5 - packages/RDF/suite/ok/t8.ok | 3 - packages/RDF/suite/ok/types.ok | 6 - packages/RDF/suite/ok/xmllit.ok | 2 - packages/RDF/suite/ok/xsdtypes.ok | 2 - packages/RDF/suite/t1.rdf | 10 - packages/RDF/suite/t11.rdf | 7 - packages/RDF/suite/t12.rdf | 11 - packages/RDF/suite/t13.rdf | 9 - packages/RDF/suite/t14.rdf | 12 - packages/RDF/suite/t15.rdf | 11 - packages/RDF/suite/t16.rdf | 15 - packages/RDF/suite/t17.rdf | 15 - packages/RDF/suite/t18.rdf | 12 - packages/RDF/suite/t19.rdf | 17 - packages/RDF/suite/t2.rdf | 8 - packages/RDF/suite/t20.rdf | 17 - packages/RDF/suite/t21.rdf | 19 - packages/RDF/suite/t22.rdf | 17 - packages/RDF/suite/t24.rdf | 15 - packages/RDF/suite/t26.rdf | 16 - packages/RDF/suite/t27.rdf | 30 - packages/RDF/suite/t28.rdf | 15 - packages/RDF/suite/t29.rdf | 15 - packages/RDF/suite/t3.rdf | 15 - packages/RDF/suite/t30.rdf | 26 - packages/RDF/suite/t31.rdf | 36 - packages/RDF/suite/t32.rdf | 43 - packages/RDF/suite/t33.rdf | 18 - packages/RDF/suite/t36.rdf | 15 - packages/RDF/suite/t37.rdf | 15 - packages/RDF/suite/t38.rdf | 190 - packages/RDF/suite/t39.rdf | 25 - packages/RDF/suite/t4.rdf | 14 - packages/RDF/suite/t40.rdf | 11 - packages/RDF/suite/t41.rdf | 15 - packages/RDF/suite/t42.rdf | 16 - packages/RDF/suite/t5.rdf | 15 - packages/RDF/suite/t6.rdf | 15 - packages/RDF/suite/t7.rdf | 17 - packages/RDF/suite/t8.rdf | 16 - packages/RDF/suite/types.rdf | 22 - packages/RDF/suite/xmllit.rdf | 19 - packages/RDF/suite/xsdtypes.rdf | 19 - packages/RDF/test_rdf.pl | 318 - packages/RDF/test_write.pl | 158 - packages/RDF/w3c_test.pl | 467 - packages/http | 2 +- packages/semweb | 1 + packages/semweb/ChangeLog | 1030 -- packages/semweb/Makefile.in | 205 - packages/semweb/Makefile.mak | 67 - packages/semweb/NOTES | 13 - packages/semweb/README | 33 - packages/semweb/TODO | 32 - packages/semweb/Tests/Turtle/README.txt | 20 - packages/semweb/Tests/Turtle/bad-00.ttl | 2 - packages/semweb/Tests/Turtle/bad-01.ttl | 3 - packages/semweb/Tests/Turtle/bad-02.ttl | 3 - packages/semweb/Tests/Turtle/bad-03.ttl | 3 - packages/semweb/Tests/Turtle/bad-04.ttl | 3 - packages/semweb/Tests/Turtle/bad-05.ttl | 4 - packages/semweb/Tests/Turtle/bad-06.ttl | 3 - packages/semweb/Tests/Turtle/bad-07.ttl | 4 - packages/semweb/Tests/Turtle/bad-08.ttl | 2 - packages/semweb/Tests/Turtle/bad-09.ttl | 3 - packages/semweb/Tests/Turtle/bad-10.ttl | 3 - packages/semweb/Tests/Turtle/bad-11.ttl | 3 - packages/semweb/Tests/Turtle/bad-12.ttl | 3 - packages/semweb/Tests/Turtle/bad-13.ttl | 3 - packages/semweb/Tests/Turtle/bad-14.ttl | 6 - packages/semweb/Tests/Turtle/manifest-bad.ttl | 88 - packages/semweb/Tests/Turtle/manifest.ttl | 215 - packages/semweb/Tests/Turtle/rdf-schema.out | 126 - packages/semweb/Tests/Turtle/rdf-schema.ttl | 156 - packages/semweb/Tests/Turtle/rdfq-results.out | 36 - packages/semweb/Tests/Turtle/rdfq-results.ttl | 39 - .../semweb/Tests/Turtle/rdfs-namespace.out | 131 - .../semweb/Tests/Turtle/rdfs-namespace.ttl | 160 - packages/semweb/Tests/Turtle/test-00.out | 1 - packages/semweb/Tests/Turtle/test-00.ttl | 2 - packages/semweb/Tests/Turtle/test-01.out | 3 - packages/semweb/Tests/Turtle/test-01.ttl | 7 - packages/semweb/Tests/Turtle/test-02.out | 3 - packages/semweb/Tests/Turtle/test-02.ttl | 5 - packages/semweb/Tests/Turtle/test-03.out | 3 - packages/semweb/Tests/Turtle/test-03.ttl | 5 - packages/semweb/Tests/Turtle/test-04.out | 2 - packages/semweb/Tests/Turtle/test-04.ttl | 4 - packages/semweb/Tests/Turtle/test-05.out | 4 - packages/semweb/Tests/Turtle/test-05.ttl | 4 - packages/semweb/Tests/Turtle/test-06.out | 1 - packages/semweb/Tests/Turtle/test-06.ttl | 3 - packages/semweb/Tests/Turtle/test-07.out | 5 - packages/semweb/Tests/Turtle/test-07.ttl | 3 - packages/semweb/Tests/Turtle/test-08.out | 1 - packages/semweb/Tests/Turtle/test-08.ttl | 3 - packages/semweb/Tests/Turtle/test-09.out | 4 - packages/semweb/Tests/Turtle/test-09.ttl | 10 - packages/semweb/Tests/Turtle/test-10.out | 5 - packages/semweb/Tests/Turtle/test-10.ttl | 5 - packages/semweb/Tests/Turtle/test-11.out | 4 - packages/semweb/Tests/Turtle/test-11.ttl | 10 - packages/semweb/Tests/Turtle/test-12.out | 4 - packages/semweb/Tests/Turtle/test-12.ttl | 9 - packages/semweb/Tests/Turtle/test-13.out | 2 - packages/semweb/Tests/Turtle/test-13.ttl | 7 - packages/semweb/Tests/Turtle/test-14.out | 10000 --------------- packages/semweb/Tests/Turtle/test-14.ttl | 10002 ---------------- packages/semweb/Tests/Turtle/test-15.out | 10000 --------------- packages/semweb/Tests/Turtle/test-15.ttl | 3 - packages/semweb/Tests/Turtle/test-16.out | 10000 --------------- packages/semweb/Tests/Turtle/test-16.ttl | 10002 ---------------- packages/semweb/Tests/Turtle/test-17.out | 1 - packages/semweb/Tests/Turtle/test-17.ttl | 6 - packages/semweb/Tests/Turtle/test-18.out | 2 - packages/semweb/Tests/Turtle/test-18.ttl | 9 - packages/semweb/Tests/Turtle/test-19.out | 1 - packages/semweb/Tests/Turtle/test-19.ttl | 4 - packages/semweb/Tests/Turtle/test-20.out | 2 - packages/semweb/Tests/Turtle/test-20.ttl | 6 - packages/semweb/Tests/Turtle/test-21.out | 3 - packages/semweb/Tests/Turtle/test-21.ttl | 4 - packages/semweb/Tests/Turtle/test-22.out | 3 - packages/semweb/Tests/Turtle/test-22.ttl | 4 - packages/semweb/Tests/Turtle/test-23.out | 1 - packages/semweb/Tests/Turtle/test-23.ttl | 3 - packages/semweb/Tests/Turtle/test-24.out | 2 - packages/semweb/Tests/Turtle/test-24.ttl | 3 - packages/semweb/Tests/Turtle/test-25.out | 7 - packages/semweb/Tests/Turtle/test-25.ttl | 14 - packages/semweb/Tests/Turtle/test-26.out | 1 - packages/semweb/Tests/Turtle/test-26.ttl | 4 - packages/semweb/Tests/Turtle/test-27.out | 1 - packages/semweb/Tests/Turtle/test-27.ttl | 5 - packages/semweb/Tests/Turtle/test-28-out.ttl | 6 - packages/semweb/Tests/Turtle/test-28.out | 22 - packages/semweb/Tests/Turtle/test-28.ttl | 22 - packages/semweb/Tests/Turtle/test-29.out | 1 - packages/semweb/Tests/Turtle/test-29.ttl | 1 - packages/semweb/Tests/Turtle/test-30.out | 5 - packages/semweb/Tests/Turtle/test-30.ttl | 12 - packages/semweb/Tests/lit.pl | 41 - packages/semweb/Tests/subprop.pl | 32 - packages/semweb/Tests/test-001.rdf | 17 - packages/semweb/Tests/test-002.rdf.gz | Bin 229 -> 0 bytes packages/semweb/atom.c | 731 -- packages/semweb/atom.h | 64 - packages/semweb/atom_map.c | 1161 -- packages/semweb/avl.c | 941 -- packages/semweb/avl.h | 131 - packages/semweb/common.mk | 13 - packages/semweb/config.h.in | 93 - packages/semweb/configure.in | 15 - packages/semweb/dc.rdfs | 198 - packages/semweb/debug.c | 46 - packages/semweb/debug.h | 45 - packages/semweb/eor.rdfs | 95 - packages/semweb/figs/modules.pd | Bin 23242 -> 0 bytes packages/semweb/figs/modules.pdf | Bin 6980 -> 0 bytes packages/semweb/hash.c | 108 - packages/semweb/hash.h | 73 - packages/semweb/litmap_test.pl | 176 - packages/semweb/lock.c | 744 -- packages/semweb/lock.h | 87 - packages/semweb/md5.c | 381 - packages/semweb/md5.h | 91 - packages/semweb/modules.gif | Bin 4985 -> 0 bytes packages/semweb/murmur.c | 171 - packages/semweb/murmur.h | 18 - packages/semweb/owl.owl | 287 - packages/semweb/pltotex.pl | 60 - packages/semweb/quote.c | 116 - packages/semweb/rdf_cache.pl | 217 - packages/semweb/rdf_compare.pl | 101 - packages/semweb/rdf_db.c | 6708 ----------- packages/semweb/rdf_db.h | 275 - packages/semweb/rdf_db.pl | 2193 ---- packages/semweb/rdf_edit.pl | 1101 -- packages/semweb/rdf_http_plugin.pl | 166 - packages/semweb/rdf_library.pl | 789 -- packages/semweb/rdf_library.ttl | 77 - packages/semweb/rdf_litindex.pl | 702 -- packages/semweb/rdf_persistency.pl | 1108 -- packages/semweb/rdf_portray.pl | 172 - packages/semweb/rdf_turtle.pl | 910 -- packages/semweb/rdf_turtle_write.pl | 1165 -- packages/semweb/rdf_zlib_plugin.pl | 50 - packages/semweb/rdflib.doc | 429 - packages/semweb/rdfs.pl | 469 - packages/semweb/rdfs.rdfs | 263 - packages/semweb/rnd_test.pl | 288 - packages/semweb/semweb.doc | 2276 ---- packages/semweb/sparql_client.pl | 319 - packages/semweb/test.pl | 96 - packages/semweb/test_rdf_db.pl | 989 -- packages/semweb/test_turtle.pl | 246 - packages/semweb/turtle.c | 608 - packages/semweb/turtle_base.pl | 99 - packages/semweb/turtle_chars.c | 79 - packages/semweb/turtle_chars.pl | 131 - packages/semweb/unicode_map.c | 1026 -- packages/semweb/unicode_map.pl | 322 - packages/sgml | 1 + packages/sgml/COPYING | 6 - packages/sgml/ChangeLog | 716 -- packages/sgml/DTD/HTML4.dcl | 88 - packages/sgml/DTD/HTML4.dtd | 1092 -- packages/sgml/DTD/HTML4.soc | 6 - packages/sgml/DTD/HTMLlat1.ent | 195 - packages/sgml/DTD/HTMLspec.ent | 77 - packages/sgml/DTD/HTMLsym.ent | 241 - packages/sgml/FILES | 20 - packages/sgml/INSTALL | 167 - packages/sgml/Makefile.in | 233 - packages/sgml/Makefile.mak | 79 - packages/sgml/RDF/.cvsignore | 9 - packages/sgml/RDF/.gitignore | 4 - packages/sgml/RDF/ChangeLog | 237 - packages/sgml/RDF/Makefile.in | 128 - packages/sgml/RDF/Makefile.mak | 51 - packages/sgml/RDF/README | 12 - packages/sgml/RDF/configure.in | 32 - packages/sgml/RDF/install-sh | 238 - packages/sgml/RDF/online.html | 177 - packages/sgml/RDF/online.pl | 457 - packages/sgml/RDF/pretty_print.pl | 167 - packages/sgml/RDF/rdf-parser | 35 - packages/sgml/RDF/rdf.html | 156 - packages/sgml/RDF/rdf.pl | 456 - packages/sgml/RDF/rdf2pl.doc | 475 - packages/sgml/RDF/rdf_diagram.pl | 492 - packages/sgml/RDF/rdf_ntriples.pl | 311 - packages/sgml/RDF/rdf_parser.pl | 724 -- packages/sgml/RDF/rdf_test.pl | 347 - packages/sgml/RDF/rdf_triple.pl | 461 - packages/sgml/RDF/rdf_write.pl | 635 - packages/sgml/RDF/rdfs.rdfs | 237 - packages/sgml/RDF/rewrite.pl | 144 - packages/sgml/RDF/suite/ex_19.rdf | 12 - packages/sgml/RDF/suite/ok/ex_19.ok | 14 - packages/sgml/RDF/suite/ok/t1.ok | 1 - packages/sgml/RDF/suite/ok/t10.ok | 4 - packages/sgml/RDF/suite/ok/t11.ok | 1 - packages/sgml/RDF/suite/ok/t12.ok | 1 - packages/sgml/RDF/suite/ok/t13.ok | 1 - packages/sgml/RDF/suite/ok/t14.ok | 3 - packages/sgml/RDF/suite/ok/t15.ok | 3 - packages/sgml/RDF/suite/ok/t16.ok | 3 - packages/sgml/RDF/suite/ok/t17.ok | 3 - packages/sgml/RDF/suite/ok/t18.ok | 3 - packages/sgml/RDF/suite/ok/t19.ok | 4 - packages/sgml/RDF/suite/ok/t2.ok | 3 - packages/sgml/RDF/suite/ok/t20.ok | 4 - packages/sgml/RDF/suite/ok/t21.ok | 7 - packages/sgml/RDF/suite/ok/t22.ok | 5 - packages/sgml/RDF/suite/ok/t23.ok | 1 - packages/sgml/RDF/suite/ok/t24.ok | 5 - packages/sgml/RDF/suite/ok/t25.ok | 13 - packages/sgml/RDF/suite/ok/t26.ok | 8 - packages/sgml/RDF/suite/ok/t27.ok | 12 - packages/sgml/RDF/suite/ok/t28.ok | 3 - packages/sgml/RDF/suite/ok/t29.ok | 3 - packages/sgml/RDF/suite/ok/t3.ok | 3 - packages/sgml/RDF/suite/ok/t30.ok | 12 - packages/sgml/RDF/suite/ok/t31.ok | 17 - packages/sgml/RDF/suite/ok/t32.ok | 15 - packages/sgml/RDF/suite/ok/t33.ok | 2 - packages/sgml/RDF/suite/ok/t34.ok | 44 - packages/sgml/RDF/suite/ok/t35.ok | 8 - packages/sgml/RDF/suite/ok/t36.ok | 4 - packages/sgml/RDF/suite/ok/t37.ok | 7 - packages/sgml/RDF/suite/ok/t38.ok | 128 - packages/sgml/RDF/suite/ok/t39.ok | 9 - packages/sgml/RDF/suite/ok/t4.ok | 6 - packages/sgml/RDF/suite/ok/t40.ok | 4 - packages/sgml/RDF/suite/ok/t41.ok | 3 - packages/sgml/RDF/suite/ok/t42.ok | 4 - packages/sgml/RDF/suite/ok/t5.ok | 7 - packages/sgml/RDF/suite/ok/t6.ok | 4 - packages/sgml/RDF/suite/ok/t7.ok | 5 - packages/sgml/RDF/suite/ok/t8.ok | 3 - packages/sgml/RDF/suite/ok/t9.ok | 9 - packages/sgml/RDF/suite/ok/types.ok | 6 - packages/sgml/RDF/suite/ok/xmllit.ok | 2 - packages/sgml/RDF/suite/ok/xsdtypes.ok | 2 - packages/sgml/RDF/suite/t1.rdf | 10 - packages/sgml/RDF/suite/t10.rdf | 12 - packages/sgml/RDF/suite/t11.rdf | 7 - packages/sgml/RDF/suite/t12.rdf | 11 - packages/sgml/RDF/suite/t13.rdf | 9 - packages/sgml/RDF/suite/t14.rdf | 12 - packages/sgml/RDF/suite/t15.rdf | 11 - packages/sgml/RDF/suite/t16.rdf | 15 - packages/sgml/RDF/suite/t17.rdf | 15 - packages/sgml/RDF/suite/t18.rdf | 12 - packages/sgml/RDF/suite/t19.rdf | 17 - packages/sgml/RDF/suite/t2.rdf | 8 - packages/sgml/RDF/suite/t20.rdf | 17 - packages/sgml/RDF/suite/t21.rdf | 19 - packages/sgml/RDF/suite/t22.rdf | 17 - packages/sgml/RDF/suite/t23.rdf | 11 - packages/sgml/RDF/suite/t24.rdf | 15 - packages/sgml/RDF/suite/t25.rdf | 12 - packages/sgml/RDF/suite/t26.rdf | 16 - packages/sgml/RDF/suite/t27.rdf | 30 - packages/sgml/RDF/suite/t28.rdf | 15 - packages/sgml/RDF/suite/t29.rdf | 15 - packages/sgml/RDF/suite/t3.rdf | 15 - packages/sgml/RDF/suite/t30.rdf | 26 - packages/sgml/RDF/suite/t31.rdf | 36 - packages/sgml/RDF/suite/t32.rdf | 43 - packages/sgml/RDF/suite/t33.rdf | 18 - packages/sgml/RDF/suite/t34.rdf | 28 - packages/sgml/RDF/suite/t35.rdf | 15 - packages/sgml/RDF/suite/t36.rdf | 15 - packages/sgml/RDF/suite/t37.rdf | 15 - packages/sgml/RDF/suite/t38.rdf | 190 - packages/sgml/RDF/suite/t39.rdf | 25 - packages/sgml/RDF/suite/t4.rdf | 14 - packages/sgml/RDF/suite/t40.rdf | 11 - packages/sgml/RDF/suite/t41.rdf | 15 - packages/sgml/RDF/suite/t42.rdf | 16 - packages/sgml/RDF/suite/t5.rdf | 15 - packages/sgml/RDF/suite/t6.rdf | 15 - packages/sgml/RDF/suite/t7.rdf | 17 - packages/sgml/RDF/suite/t8.rdf | 16 - packages/sgml/RDF/suite/t9.rdf | 12 - packages/sgml/RDF/suite/types.rdf | 22 - packages/sgml/RDF/suite/xmllit.rdf | 19 - packages/sgml/RDF/suite/xsdtypes.rdf | 19 - packages/sgml/RDF/w3c_test.pl | 467 - packages/sgml/RDF/write_test.pl | 155 - packages/sgml/TODO | 26 - packages/sgml/Test/amp.sgml | 7 - packages/sgml/Test/att.xml | 3 - packages/sgml/Test/badxmlent.xml | 5 - packages/sgml/Test/bar.sgml | 8 - packages/sgml/Test/bat.sgml | 68 - packages/sgml/Test/cdata.sgml | 8 - packages/sgml/Test/ce.sgml | 7 - packages/sgml/Test/cent-nul.xml | 1 - packages/sgml/Test/cent-utf8.xml | 19 - packages/sgml/Test/cmt.sgml | 13 - packages/sgml/Test/comment.xml | 10 - packages/sgml/Test/conref.sgml | 8 - packages/sgml/Test/conref2.sgml | 10 - packages/sgml/Test/crlf.sgml | 11 - packages/sgml/Test/defent.sgml | 10 - packages/sgml/Test/entent.sgml | 10 - packages/sgml/Test/estag.sgml | 10 - packages/sgml/Test/foo.sgml | 7 - packages/sgml/Test/i.sgml | 12 - packages/sgml/Test/layout.xml | 11 - packages/sgml/Test/mapbug.sgml | 41 - packages/sgml/Test/ment.sgml | 7 - packages/sgml/Test/minus2.xml | 3 - packages/sgml/Test/netc.sgml | 12 - packages/sgml/Test/ng.sgml | 10 - packages/sgml/Test/noent.sgml | 14 - packages/sgml/Test/not.sgml | 13 - packages/sgml/Test/ok/amp.ok | 1 - packages/sgml/Test/ok/att.ok | 2 - packages/sgml/Test/ok/badxmlent.ok | 2 - packages/sgml/Test/ok/bar.ok | 1 - packages/sgml/Test/ok/bat.ok | 2 - packages/sgml/Test/ok/cdata.ok | 2 - packages/sgml/Test/ok/ce.ok | 1 - packages/sgml/Test/ok/cent-nul.ok | 2 - packages/sgml/Test/ok/cent-utf8.ok | 2 - packages/sgml/Test/ok/cmt.ok | 1 - packages/sgml/Test/ok/comment.ok | 2 - packages/sgml/Test/ok/conref.ok | 1 - packages/sgml/Test/ok/conref2.ok | 2 - packages/sgml/Test/ok/crlf.ok | 2 - packages/sgml/Test/ok/defent.ok | 2 - packages/sgml/Test/ok/entent.ok | 1 - packages/sgml/Test/ok/estag.ok | 2 - packages/sgml/Test/ok/foo.ok | 1 - packages/sgml/Test/ok/i.ok | 1 - packages/sgml/Test/ok/layout.ok | 2 - packages/sgml/Test/ok/mapbug.ok | 2 - packages/sgml/Test/ok/ment.ok | 2 - packages/sgml/Test/ok/minus2.ok | 2 - packages/sgml/Test/ok/netc.ok | 2 - packages/sgml/Test/ok/ng.ok | 2 - packages/sgml/Test/ok/noent.ok | 1 - packages/sgml/Test/ok/not.ok | 1 - packages/sgml/Test/ok/oma.ok | 2 - packages/sgml/Test/ok/omit1.ok | 1 - packages/sgml/Test/ok/per.ok | 1 - packages/sgml/Test/ok/pi.ok | 2 - packages/sgml/Test/ok/rcdata.ok | 1 - packages/sgml/Test/ok/rdefent.ok | 2 - packages/sgml/Test/ok/rsre.ok | 2 - packages/sgml/Test/ok/sdata.ok | 1 - packages/sgml/Test/ok/shortval.ok | 1 - packages/sgml/Test/ok/simple.ok | 2 - packages/sgml/Test/ok/sr.ok | 1 - packages/sgml/Test/ok/sr2.ok | 1 - packages/sgml/Test/ok/ugh.ok | 1 - packages/sgml/Test/ok/utf8-cent.ok | 2 - packages/sgml/Test/ok/utf8-ru.ok | 2 - packages/sgml/Test/ok/utf8.ok | 2 - packages/sgml/Test/ok/wchar.ok | 2 - packages/sgml/Test/ok/wcharlong.ok | 2 - packages/sgml/Test/oma.sgml | 8 - packages/sgml/Test/omit1.sgml | 14 - packages/sgml/Test/per.sgml | 9 - packages/sgml/Test/pi.xml | 3 - packages/sgml/Test/rcdata.sgml | 19 - packages/sgml/Test/rdefent.sgml | 9 - packages/sgml/Test/rsre.sgml | 18 - packages/sgml/Test/sdata.sgml | 8 - packages/sgml/Test/shortval.sgml | 6 - packages/sgml/Test/simple.xml | 1 - packages/sgml/Test/sr.sgml | 20 - packages/sgml/Test/sr2.sgml | 25 - packages/sgml/Test/test.pl | 169 - packages/sgml/Test/ugh.sgml | 9 - packages/sgml/Test/utf8-cent.xml | 7 - packages/sgml/Test/utf8-ru.xml | 3 - packages/sgml/Test/utf8.xml | 10 - packages/sgml/Test/wchar.xml | 11 - packages/sgml/Test/wcharlong.xml | 16 - packages/sgml/Test/wrtest.pl | 241 - packages/sgml/VERSION | 1 - packages/sgml/catalog.c | 672 -- packages/sgml/catalog.h | 64 - packages/sgml/charmap.c | 104 - packages/sgml/configure.in | 114 - packages/sgml/dtd.h | 481 - packages/sgml/dtd2pl.1 | 51 - packages/sgml/dtd2pl.c | 94 - packages/sgml/error.c | 185 - packages/sgml/error.h | 46 - packages/sgml/install-sh | 238 - packages/sgml/iso_639.pl | 628 - packages/sgml/make.bat | 3 - packages/sgml/model.c | 524 - packages/sgml/model.h | 47 - packages/sgml/parser.c | 5598 --------- packages/sgml/parser.h | 239 - packages/sgml/pltotex.pl | 76 - packages/sgml/prolog.c | 520 - packages/sgml/prolog.h | 42 - packages/sgml/pwp.pl | 638 - packages/sgml/quote.c | 479 - packages/sgml/sgml.c | 455 - packages/sgml/sgml.doc | 1376 --- packages/sgml/sgml.pl | 451 - packages/sgml/sgml2pl.c | 2606 ---- packages/sgml/sgml_mode.html | 115 - packages/sgml/sgml_mode.pl | 1081 -- packages/sgml/sgml_write.pl | 819 -- packages/sgml/sgmldefs.h | 85 - packages/sgml/utf8.c | 117 - packages/sgml/utf8.h | 45 - packages/sgml/util.c | 804 -- packages/sgml/util.h | 118 - packages/sgml/xml_unicode.c | 1258 -- packages/sgml/xml_unicode.h | 41 - packages/sgml/xml_unicode.pl | 436 - packages/sgml/xmlns.c | 255 - packages/sgml/xmlns.h | 44 - packages/sgml/xpath.pl | 336 - packages/sgml/xsdp_types.pl | 223 - 525 files changed, 26 insertions(+), 122497 deletions(-) create mode 160000 packages/RDF delete mode 100644 packages/RDF/ChangeLog delete mode 100644 packages/RDF/Makefile.in delete mode 100644 packages/RDF/Makefile.mak delete mode 100644 packages/RDF/README delete mode 100644 packages/RDF/config.h.in delete mode 100644 packages/RDF/configure.in delete mode 100644 packages/RDF/online.pl delete mode 100644 packages/RDF/pretty_print.pl delete mode 100644 packages/RDF/rdf.pl delete mode 100644 packages/RDF/rdf2pl.doc delete mode 100644 packages/RDF/rdf_diagram.pl delete mode 100644 packages/RDF/rdf_ntriples.pl delete mode 100644 packages/RDF/rdf_parser.pl delete mode 100644 packages/RDF/rdf_triple.pl delete mode 100644 packages/RDF/rdf_write.pl delete mode 100644 packages/RDF/rdfs.rdfs delete mode 100644 packages/RDF/rewrite.pl delete mode 100644 packages/RDF/suite/ex_19.rdf delete mode 100644 packages/RDF/suite/ok/ex_19.ok delete mode 100644 packages/RDF/suite/ok/t1.ok delete mode 100644 packages/RDF/suite/ok/t11.ok delete mode 100644 packages/RDF/suite/ok/t12.ok delete mode 100644 packages/RDF/suite/ok/t13.ok delete mode 100644 packages/RDF/suite/ok/t14.ok delete mode 100644 packages/RDF/suite/ok/t15.ok delete mode 100644 packages/RDF/suite/ok/t16.ok delete mode 100644 packages/RDF/suite/ok/t17.ok delete mode 100644 packages/RDF/suite/ok/t18.ok delete mode 100644 packages/RDF/suite/ok/t19.ok delete mode 100644 packages/RDF/suite/ok/t2.ok delete mode 100644 packages/RDF/suite/ok/t20.ok delete mode 100644 packages/RDF/suite/ok/t21.ok delete mode 100644 packages/RDF/suite/ok/t22.ok delete mode 100644 packages/RDF/suite/ok/t24.ok delete mode 100644 packages/RDF/suite/ok/t26.ok delete mode 100644 packages/RDF/suite/ok/t27.ok delete mode 100644 packages/RDF/suite/ok/t28.ok delete mode 100644 packages/RDF/suite/ok/t29.ok delete mode 100644 packages/RDF/suite/ok/t3.ok delete mode 100644 packages/RDF/suite/ok/t30.ok delete mode 100644 packages/RDF/suite/ok/t31.ok delete mode 100644 packages/RDF/suite/ok/t32.ok delete mode 100644 packages/RDF/suite/ok/t33.ok delete mode 100644 packages/RDF/suite/ok/t36.ok delete mode 100644 packages/RDF/suite/ok/t37.ok delete mode 100644 packages/RDF/suite/ok/t38.ok delete mode 100644 packages/RDF/suite/ok/t39.ok delete mode 100644 packages/RDF/suite/ok/t4.ok delete mode 100644 packages/RDF/suite/ok/t40.ok delete mode 100644 packages/RDF/suite/ok/t41.ok delete mode 100644 packages/RDF/suite/ok/t42.ok delete mode 100644 packages/RDF/suite/ok/t5.ok delete mode 100644 packages/RDF/suite/ok/t6.ok delete mode 100644 packages/RDF/suite/ok/t7.ok delete mode 100644 packages/RDF/suite/ok/t8.ok delete mode 100644 packages/RDF/suite/ok/types.ok delete mode 100644 packages/RDF/suite/ok/xmllit.ok delete mode 100644 packages/RDF/suite/ok/xsdtypes.ok delete mode 100644 packages/RDF/suite/t1.rdf delete mode 100644 packages/RDF/suite/t11.rdf delete mode 100644 packages/RDF/suite/t12.rdf delete mode 100644 packages/RDF/suite/t13.rdf delete mode 100644 packages/RDF/suite/t14.rdf delete mode 100644 packages/RDF/suite/t15.rdf delete mode 100644 packages/RDF/suite/t16.rdf delete mode 100644 packages/RDF/suite/t17.rdf delete mode 100644 packages/RDF/suite/t18.rdf delete mode 100644 packages/RDF/suite/t19.rdf delete mode 100644 packages/RDF/suite/t2.rdf delete mode 100644 packages/RDF/suite/t20.rdf delete mode 100644 packages/RDF/suite/t21.rdf delete mode 100644 packages/RDF/suite/t22.rdf delete mode 100644 packages/RDF/suite/t24.rdf delete mode 100644 packages/RDF/suite/t26.rdf delete mode 100644 packages/RDF/suite/t27.rdf delete mode 100644 packages/RDF/suite/t28.rdf delete mode 100644 packages/RDF/suite/t29.rdf delete mode 100644 packages/RDF/suite/t3.rdf delete mode 100644 packages/RDF/suite/t30.rdf delete mode 100644 packages/RDF/suite/t31.rdf delete mode 100644 packages/RDF/suite/t32.rdf delete mode 100644 packages/RDF/suite/t33.rdf delete mode 100644 packages/RDF/suite/t36.rdf delete mode 100644 packages/RDF/suite/t37.rdf delete mode 100644 packages/RDF/suite/t38.rdf delete mode 100644 packages/RDF/suite/t39.rdf delete mode 100644 packages/RDF/suite/t4.rdf delete mode 100644 packages/RDF/suite/t40.rdf delete mode 100644 packages/RDF/suite/t41.rdf delete mode 100644 packages/RDF/suite/t42.rdf delete mode 100644 packages/RDF/suite/t5.rdf delete mode 100644 packages/RDF/suite/t6.rdf delete mode 100644 packages/RDF/suite/t7.rdf delete mode 100644 packages/RDF/suite/t8.rdf delete mode 100644 packages/RDF/suite/types.rdf delete mode 100644 packages/RDF/suite/xmllit.rdf delete mode 100644 packages/RDF/suite/xsdtypes.rdf delete mode 100644 packages/RDF/test_rdf.pl delete mode 100644 packages/RDF/test_write.pl delete mode 100644 packages/RDF/w3c_test.pl create mode 160000 packages/semweb delete mode 100644 packages/semweb/ChangeLog delete mode 100755 packages/semweb/Makefile.in delete mode 100644 packages/semweb/Makefile.mak delete mode 100644 packages/semweb/NOTES delete mode 100644 packages/semweb/README delete mode 100644 packages/semweb/TODO delete mode 100644 packages/semweb/Tests/Turtle/README.txt delete mode 100644 packages/semweb/Tests/Turtle/bad-00.ttl delete mode 100644 packages/semweb/Tests/Turtle/bad-01.ttl delete mode 100644 packages/semweb/Tests/Turtle/bad-02.ttl delete mode 100644 packages/semweb/Tests/Turtle/bad-03.ttl delete mode 100644 packages/semweb/Tests/Turtle/bad-04.ttl delete mode 100644 packages/semweb/Tests/Turtle/bad-05.ttl delete mode 100644 packages/semweb/Tests/Turtle/bad-06.ttl delete mode 100644 packages/semweb/Tests/Turtle/bad-07.ttl delete mode 100644 packages/semweb/Tests/Turtle/bad-08.ttl delete mode 100644 packages/semweb/Tests/Turtle/bad-09.ttl delete mode 100644 packages/semweb/Tests/Turtle/bad-10.ttl delete mode 100644 packages/semweb/Tests/Turtle/bad-11.ttl delete mode 100644 packages/semweb/Tests/Turtle/bad-12.ttl delete mode 100644 packages/semweb/Tests/Turtle/bad-13.ttl delete mode 100644 packages/semweb/Tests/Turtle/bad-14.ttl delete mode 100644 packages/semweb/Tests/Turtle/manifest-bad.ttl delete mode 100644 packages/semweb/Tests/Turtle/manifest.ttl delete mode 100644 packages/semweb/Tests/Turtle/rdf-schema.out delete mode 100644 packages/semweb/Tests/Turtle/rdf-schema.ttl delete mode 100644 packages/semweb/Tests/Turtle/rdfq-results.out delete mode 100644 packages/semweb/Tests/Turtle/rdfq-results.ttl delete mode 100644 packages/semweb/Tests/Turtle/rdfs-namespace.out delete mode 100644 packages/semweb/Tests/Turtle/rdfs-namespace.ttl delete mode 100644 packages/semweb/Tests/Turtle/test-00.out delete mode 100644 packages/semweb/Tests/Turtle/test-00.ttl delete mode 100644 packages/semweb/Tests/Turtle/test-01.out delete mode 100644 packages/semweb/Tests/Turtle/test-01.ttl delete mode 100644 packages/semweb/Tests/Turtle/test-02.out delete mode 100644 packages/semweb/Tests/Turtle/test-02.ttl delete mode 100644 packages/semweb/Tests/Turtle/test-03.out delete mode 100644 packages/semweb/Tests/Turtle/test-03.ttl delete mode 100644 packages/semweb/Tests/Turtle/test-04.out delete mode 100644 packages/semweb/Tests/Turtle/test-04.ttl delete mode 100644 packages/semweb/Tests/Turtle/test-05.out delete mode 100644 packages/semweb/Tests/Turtle/test-05.ttl delete mode 100644 packages/semweb/Tests/Turtle/test-06.out delete mode 100644 packages/semweb/Tests/Turtle/test-06.ttl delete mode 100644 packages/semweb/Tests/Turtle/test-07.out delete mode 100644 packages/semweb/Tests/Turtle/test-07.ttl delete mode 100644 packages/semweb/Tests/Turtle/test-08.out delete mode 100644 packages/semweb/Tests/Turtle/test-08.ttl delete mode 100644 packages/semweb/Tests/Turtle/test-09.out delete mode 100644 packages/semweb/Tests/Turtle/test-09.ttl delete mode 100644 packages/semweb/Tests/Turtle/test-10.out delete mode 100644 packages/semweb/Tests/Turtle/test-10.ttl delete mode 100644 packages/semweb/Tests/Turtle/test-11.out delete mode 100644 packages/semweb/Tests/Turtle/test-11.ttl delete mode 100644 packages/semweb/Tests/Turtle/test-12.out delete mode 100644 packages/semweb/Tests/Turtle/test-12.ttl delete mode 100644 packages/semweb/Tests/Turtle/test-13.out delete mode 100644 packages/semweb/Tests/Turtle/test-13.ttl delete mode 100644 packages/semweb/Tests/Turtle/test-14.out delete mode 100644 packages/semweb/Tests/Turtle/test-14.ttl delete mode 100644 packages/semweb/Tests/Turtle/test-15.out delete mode 100644 packages/semweb/Tests/Turtle/test-15.ttl delete mode 100644 packages/semweb/Tests/Turtle/test-16.out delete mode 100644 packages/semweb/Tests/Turtle/test-16.ttl delete mode 100644 packages/semweb/Tests/Turtle/test-17.out delete mode 100644 packages/semweb/Tests/Turtle/test-17.ttl delete mode 100644 packages/semweb/Tests/Turtle/test-18.out delete mode 100644 packages/semweb/Tests/Turtle/test-18.ttl delete mode 100644 packages/semweb/Tests/Turtle/test-19.out delete mode 100644 packages/semweb/Tests/Turtle/test-19.ttl delete mode 100644 packages/semweb/Tests/Turtle/test-20.out delete mode 100644 packages/semweb/Tests/Turtle/test-20.ttl delete mode 100644 packages/semweb/Tests/Turtle/test-21.out delete mode 100644 packages/semweb/Tests/Turtle/test-21.ttl delete mode 100644 packages/semweb/Tests/Turtle/test-22.out delete mode 100644 packages/semweb/Tests/Turtle/test-22.ttl delete mode 100644 packages/semweb/Tests/Turtle/test-23.out delete mode 100644 packages/semweb/Tests/Turtle/test-23.ttl delete mode 100644 packages/semweb/Tests/Turtle/test-24.out delete mode 100644 packages/semweb/Tests/Turtle/test-24.ttl delete mode 100644 packages/semweb/Tests/Turtle/test-25.out delete mode 100644 packages/semweb/Tests/Turtle/test-25.ttl delete mode 100644 packages/semweb/Tests/Turtle/test-26.out delete mode 100644 packages/semweb/Tests/Turtle/test-26.ttl delete mode 100644 packages/semweb/Tests/Turtle/test-27.out delete mode 100644 packages/semweb/Tests/Turtle/test-27.ttl delete mode 100644 packages/semweb/Tests/Turtle/test-28-out.ttl delete mode 100644 packages/semweb/Tests/Turtle/test-28.out delete mode 100644 packages/semweb/Tests/Turtle/test-28.ttl delete mode 100644 packages/semweb/Tests/Turtle/test-29.out delete mode 100644 packages/semweb/Tests/Turtle/test-29.ttl delete mode 100644 packages/semweb/Tests/Turtle/test-30.out delete mode 100644 packages/semweb/Tests/Turtle/test-30.ttl delete mode 100644 packages/semweb/Tests/lit.pl delete mode 100644 packages/semweb/Tests/subprop.pl delete mode 100644 packages/semweb/Tests/test-001.rdf delete mode 100644 packages/semweb/Tests/test-002.rdf.gz delete mode 100644 packages/semweb/atom.c delete mode 100644 packages/semweb/atom.h delete mode 100644 packages/semweb/atom_map.c delete mode 100644 packages/semweb/avl.c delete mode 100644 packages/semweb/avl.h delete mode 100644 packages/semweb/common.mk delete mode 100644 packages/semweb/config.h.in delete mode 100644 packages/semweb/configure.in delete mode 100644 packages/semweb/dc.rdfs delete mode 100644 packages/semweb/debug.c delete mode 100644 packages/semweb/debug.h delete mode 100644 packages/semweb/eor.rdfs delete mode 100644 packages/semweb/figs/modules.pd delete mode 100644 packages/semweb/figs/modules.pdf delete mode 100644 packages/semweb/hash.c delete mode 100644 packages/semweb/hash.h delete mode 100644 packages/semweb/litmap_test.pl delete mode 100644 packages/semweb/lock.c delete mode 100755 packages/semweb/lock.h delete mode 100644 packages/semweb/md5.c delete mode 100644 packages/semweb/md5.h delete mode 100644 packages/semweb/modules.gif delete mode 100644 packages/semweb/murmur.c delete mode 100644 packages/semweb/murmur.h delete mode 100644 packages/semweb/owl.owl delete mode 100644 packages/semweb/pltotex.pl delete mode 100644 packages/semweb/quote.c delete mode 100644 packages/semweb/rdf_cache.pl delete mode 100644 packages/semweb/rdf_compare.pl delete mode 100644 packages/semweb/rdf_db.c delete mode 100644 packages/semweb/rdf_db.h delete mode 100644 packages/semweb/rdf_db.pl delete mode 100644 packages/semweb/rdf_edit.pl delete mode 100644 packages/semweb/rdf_http_plugin.pl delete mode 100644 packages/semweb/rdf_library.pl delete mode 100644 packages/semweb/rdf_library.ttl delete mode 100644 packages/semweb/rdf_litindex.pl delete mode 100644 packages/semweb/rdf_persistency.pl delete mode 100644 packages/semweb/rdf_portray.pl delete mode 100644 packages/semweb/rdf_turtle.pl delete mode 100644 packages/semweb/rdf_turtle_write.pl delete mode 100644 packages/semweb/rdf_zlib_plugin.pl delete mode 100644 packages/semweb/rdflib.doc delete mode 100644 packages/semweb/rdfs.pl delete mode 100644 packages/semweb/rdfs.rdfs delete mode 100644 packages/semweb/rnd_test.pl delete mode 100644 packages/semweb/semweb.doc delete mode 100644 packages/semweb/sparql_client.pl delete mode 100644 packages/semweb/test.pl delete mode 100644 packages/semweb/test_rdf_db.pl delete mode 100644 packages/semweb/test_turtle.pl delete mode 100644 packages/semweb/turtle.c delete mode 100644 packages/semweb/turtle_base.pl delete mode 100644 packages/semweb/turtle_chars.c delete mode 100644 packages/semweb/turtle_chars.pl delete mode 100644 packages/semweb/unicode_map.c delete mode 100644 packages/semweb/unicode_map.pl create mode 160000 packages/sgml delete mode 100644 packages/sgml/COPYING delete mode 100644 packages/sgml/ChangeLog delete mode 100644 packages/sgml/DTD/HTML4.dcl delete mode 100644 packages/sgml/DTD/HTML4.dtd delete mode 100644 packages/sgml/DTD/HTML4.soc delete mode 100644 packages/sgml/DTD/HTMLlat1.ent delete mode 100644 packages/sgml/DTD/HTMLspec.ent delete mode 100644 packages/sgml/DTD/HTMLsym.ent delete mode 100644 packages/sgml/FILES delete mode 100644 packages/sgml/INSTALL delete mode 100755 packages/sgml/Makefile.in delete mode 100644 packages/sgml/Makefile.mak delete mode 100644 packages/sgml/RDF/.cvsignore delete mode 100644 packages/sgml/RDF/.gitignore delete mode 100644 packages/sgml/RDF/ChangeLog delete mode 100644 packages/sgml/RDF/Makefile.in delete mode 100644 packages/sgml/RDF/Makefile.mak delete mode 100644 packages/sgml/RDF/README delete mode 100644 packages/sgml/RDF/configure.in delete mode 100755 packages/sgml/RDF/install-sh delete mode 100644 packages/sgml/RDF/online.html delete mode 100644 packages/sgml/RDF/online.pl delete mode 100644 packages/sgml/RDF/pretty_print.pl delete mode 100755 packages/sgml/RDF/rdf-parser delete mode 100644 packages/sgml/RDF/rdf.html delete mode 100644 packages/sgml/RDF/rdf.pl delete mode 100644 packages/sgml/RDF/rdf2pl.doc delete mode 100644 packages/sgml/RDF/rdf_diagram.pl delete mode 100644 packages/sgml/RDF/rdf_ntriples.pl delete mode 100644 packages/sgml/RDF/rdf_parser.pl delete mode 100644 packages/sgml/RDF/rdf_test.pl delete mode 100644 packages/sgml/RDF/rdf_triple.pl delete mode 100644 packages/sgml/RDF/rdf_write.pl delete mode 100644 packages/sgml/RDF/rdfs.rdfs delete mode 100644 packages/sgml/RDF/rewrite.pl delete mode 100644 packages/sgml/RDF/suite/ex_19.rdf delete mode 100644 packages/sgml/RDF/suite/ok/ex_19.ok delete mode 100644 packages/sgml/RDF/suite/ok/t1.ok delete mode 100644 packages/sgml/RDF/suite/ok/t10.ok delete mode 100644 packages/sgml/RDF/suite/ok/t11.ok delete mode 100644 packages/sgml/RDF/suite/ok/t12.ok delete mode 100644 packages/sgml/RDF/suite/ok/t13.ok delete mode 100644 packages/sgml/RDF/suite/ok/t14.ok delete mode 100644 packages/sgml/RDF/suite/ok/t15.ok delete mode 100644 packages/sgml/RDF/suite/ok/t16.ok delete mode 100644 packages/sgml/RDF/suite/ok/t17.ok delete mode 100644 packages/sgml/RDF/suite/ok/t18.ok delete mode 100644 packages/sgml/RDF/suite/ok/t19.ok delete mode 100644 packages/sgml/RDF/suite/ok/t2.ok delete mode 100644 packages/sgml/RDF/suite/ok/t20.ok delete mode 100644 packages/sgml/RDF/suite/ok/t21.ok delete mode 100644 packages/sgml/RDF/suite/ok/t22.ok delete mode 100644 packages/sgml/RDF/suite/ok/t23.ok delete mode 100644 packages/sgml/RDF/suite/ok/t24.ok delete mode 100644 packages/sgml/RDF/suite/ok/t25.ok delete mode 100644 packages/sgml/RDF/suite/ok/t26.ok delete mode 100644 packages/sgml/RDF/suite/ok/t27.ok delete mode 100644 packages/sgml/RDF/suite/ok/t28.ok delete mode 100644 packages/sgml/RDF/suite/ok/t29.ok delete mode 100644 packages/sgml/RDF/suite/ok/t3.ok delete mode 100644 packages/sgml/RDF/suite/ok/t30.ok delete mode 100644 packages/sgml/RDF/suite/ok/t31.ok delete mode 100644 packages/sgml/RDF/suite/ok/t32.ok delete mode 100644 packages/sgml/RDF/suite/ok/t33.ok delete mode 100644 packages/sgml/RDF/suite/ok/t34.ok delete mode 100644 packages/sgml/RDF/suite/ok/t35.ok delete mode 100644 packages/sgml/RDF/suite/ok/t36.ok delete mode 100644 packages/sgml/RDF/suite/ok/t37.ok delete mode 100644 packages/sgml/RDF/suite/ok/t38.ok delete mode 100644 packages/sgml/RDF/suite/ok/t39.ok delete mode 100644 packages/sgml/RDF/suite/ok/t4.ok delete mode 100644 packages/sgml/RDF/suite/ok/t40.ok delete mode 100644 packages/sgml/RDF/suite/ok/t41.ok delete mode 100644 packages/sgml/RDF/suite/ok/t42.ok delete mode 100644 packages/sgml/RDF/suite/ok/t5.ok delete mode 100644 packages/sgml/RDF/suite/ok/t6.ok delete mode 100644 packages/sgml/RDF/suite/ok/t7.ok delete mode 100644 packages/sgml/RDF/suite/ok/t8.ok delete mode 100644 packages/sgml/RDF/suite/ok/t9.ok delete mode 100644 packages/sgml/RDF/suite/ok/types.ok delete mode 100644 packages/sgml/RDF/suite/ok/xmllit.ok delete mode 100644 packages/sgml/RDF/suite/ok/xsdtypes.ok delete mode 100644 packages/sgml/RDF/suite/t1.rdf delete mode 100644 packages/sgml/RDF/suite/t10.rdf delete mode 100644 packages/sgml/RDF/suite/t11.rdf delete mode 100644 packages/sgml/RDF/suite/t12.rdf delete mode 100644 packages/sgml/RDF/suite/t13.rdf delete mode 100644 packages/sgml/RDF/suite/t14.rdf delete mode 100644 packages/sgml/RDF/suite/t15.rdf delete mode 100644 packages/sgml/RDF/suite/t16.rdf delete mode 100644 packages/sgml/RDF/suite/t17.rdf delete mode 100644 packages/sgml/RDF/suite/t18.rdf delete mode 100644 packages/sgml/RDF/suite/t19.rdf delete mode 100644 packages/sgml/RDF/suite/t2.rdf delete mode 100644 packages/sgml/RDF/suite/t20.rdf delete mode 100644 packages/sgml/RDF/suite/t21.rdf delete mode 100644 packages/sgml/RDF/suite/t22.rdf delete mode 100644 packages/sgml/RDF/suite/t23.rdf delete mode 100644 packages/sgml/RDF/suite/t24.rdf delete mode 100644 packages/sgml/RDF/suite/t25.rdf delete mode 100644 packages/sgml/RDF/suite/t26.rdf delete mode 100644 packages/sgml/RDF/suite/t27.rdf delete mode 100644 packages/sgml/RDF/suite/t28.rdf delete mode 100644 packages/sgml/RDF/suite/t29.rdf delete mode 100644 packages/sgml/RDF/suite/t3.rdf delete mode 100644 packages/sgml/RDF/suite/t30.rdf delete mode 100644 packages/sgml/RDF/suite/t31.rdf delete mode 100644 packages/sgml/RDF/suite/t32.rdf delete mode 100644 packages/sgml/RDF/suite/t33.rdf delete mode 100644 packages/sgml/RDF/suite/t34.rdf delete mode 100644 packages/sgml/RDF/suite/t35.rdf delete mode 100644 packages/sgml/RDF/suite/t36.rdf delete mode 100644 packages/sgml/RDF/suite/t37.rdf delete mode 100644 packages/sgml/RDF/suite/t38.rdf delete mode 100644 packages/sgml/RDF/suite/t39.rdf delete mode 100644 packages/sgml/RDF/suite/t4.rdf delete mode 100644 packages/sgml/RDF/suite/t40.rdf delete mode 100644 packages/sgml/RDF/suite/t41.rdf delete mode 100644 packages/sgml/RDF/suite/t42.rdf delete mode 100644 packages/sgml/RDF/suite/t5.rdf delete mode 100644 packages/sgml/RDF/suite/t6.rdf delete mode 100644 packages/sgml/RDF/suite/t7.rdf delete mode 100644 packages/sgml/RDF/suite/t8.rdf delete mode 100644 packages/sgml/RDF/suite/t9.rdf delete mode 100644 packages/sgml/RDF/suite/types.rdf delete mode 100644 packages/sgml/RDF/suite/xmllit.rdf delete mode 100644 packages/sgml/RDF/suite/xsdtypes.rdf delete mode 100644 packages/sgml/RDF/w3c_test.pl delete mode 100644 packages/sgml/RDF/write_test.pl delete mode 100644 packages/sgml/TODO delete mode 100644 packages/sgml/Test/amp.sgml delete mode 100644 packages/sgml/Test/att.xml delete mode 100644 packages/sgml/Test/badxmlent.xml delete mode 100644 packages/sgml/Test/bar.sgml delete mode 100644 packages/sgml/Test/bat.sgml delete mode 100644 packages/sgml/Test/cdata.sgml delete mode 100644 packages/sgml/Test/ce.sgml delete mode 100644 packages/sgml/Test/cent-nul.xml delete mode 100644 packages/sgml/Test/cent-utf8.xml delete mode 100644 packages/sgml/Test/cmt.sgml delete mode 100644 packages/sgml/Test/comment.xml delete mode 100644 packages/sgml/Test/conref.sgml delete mode 100644 packages/sgml/Test/conref2.sgml delete mode 100644 packages/sgml/Test/crlf.sgml delete mode 100644 packages/sgml/Test/defent.sgml delete mode 100644 packages/sgml/Test/entent.sgml delete mode 100644 packages/sgml/Test/estag.sgml delete mode 100644 packages/sgml/Test/foo.sgml delete mode 100644 packages/sgml/Test/i.sgml delete mode 100644 packages/sgml/Test/layout.xml delete mode 100644 packages/sgml/Test/mapbug.sgml delete mode 100644 packages/sgml/Test/ment.sgml delete mode 100644 packages/sgml/Test/minus2.xml delete mode 100644 packages/sgml/Test/netc.sgml delete mode 100644 packages/sgml/Test/ng.sgml delete mode 100644 packages/sgml/Test/noent.sgml delete mode 100644 packages/sgml/Test/not.sgml delete mode 100644 packages/sgml/Test/ok/amp.ok delete mode 100644 packages/sgml/Test/ok/att.ok delete mode 100644 packages/sgml/Test/ok/badxmlent.ok delete mode 100644 packages/sgml/Test/ok/bar.ok delete mode 100644 packages/sgml/Test/ok/bat.ok delete mode 100644 packages/sgml/Test/ok/cdata.ok delete mode 100644 packages/sgml/Test/ok/ce.ok delete mode 100644 packages/sgml/Test/ok/cent-nul.ok delete mode 100644 packages/sgml/Test/ok/cent-utf8.ok delete mode 100644 packages/sgml/Test/ok/cmt.ok delete mode 100644 packages/sgml/Test/ok/comment.ok delete mode 100644 packages/sgml/Test/ok/conref.ok delete mode 100644 packages/sgml/Test/ok/conref2.ok delete mode 100644 packages/sgml/Test/ok/crlf.ok delete mode 100644 packages/sgml/Test/ok/defent.ok delete mode 100644 packages/sgml/Test/ok/entent.ok delete mode 100644 packages/sgml/Test/ok/estag.ok delete mode 100644 packages/sgml/Test/ok/foo.ok delete mode 100644 packages/sgml/Test/ok/i.ok delete mode 100644 packages/sgml/Test/ok/layout.ok delete mode 100644 packages/sgml/Test/ok/mapbug.ok delete mode 100644 packages/sgml/Test/ok/ment.ok delete mode 100644 packages/sgml/Test/ok/minus2.ok delete mode 100644 packages/sgml/Test/ok/netc.ok delete mode 100644 packages/sgml/Test/ok/ng.ok delete mode 100644 packages/sgml/Test/ok/noent.ok delete mode 100644 packages/sgml/Test/ok/not.ok delete mode 100644 packages/sgml/Test/ok/oma.ok delete mode 100644 packages/sgml/Test/ok/omit1.ok delete mode 100644 packages/sgml/Test/ok/per.ok delete mode 100644 packages/sgml/Test/ok/pi.ok delete mode 100644 packages/sgml/Test/ok/rcdata.ok delete mode 100644 packages/sgml/Test/ok/rdefent.ok delete mode 100644 packages/sgml/Test/ok/rsre.ok delete mode 100644 packages/sgml/Test/ok/sdata.ok delete mode 100644 packages/sgml/Test/ok/shortval.ok delete mode 100644 packages/sgml/Test/ok/simple.ok delete mode 100644 packages/sgml/Test/ok/sr.ok delete mode 100644 packages/sgml/Test/ok/sr2.ok delete mode 100644 packages/sgml/Test/ok/ugh.ok delete mode 100644 packages/sgml/Test/ok/utf8-cent.ok delete mode 100644 packages/sgml/Test/ok/utf8-ru.ok delete mode 100644 packages/sgml/Test/ok/utf8.ok delete mode 100644 packages/sgml/Test/ok/wchar.ok delete mode 100644 packages/sgml/Test/ok/wcharlong.ok delete mode 100644 packages/sgml/Test/oma.sgml delete mode 100644 packages/sgml/Test/omit1.sgml delete mode 100644 packages/sgml/Test/per.sgml delete mode 100644 packages/sgml/Test/pi.xml delete mode 100644 packages/sgml/Test/rcdata.sgml delete mode 100644 packages/sgml/Test/rdefent.sgml delete mode 100644 packages/sgml/Test/rsre.sgml delete mode 100644 packages/sgml/Test/sdata.sgml delete mode 100644 packages/sgml/Test/shortval.sgml delete mode 100644 packages/sgml/Test/simple.xml delete mode 100644 packages/sgml/Test/sr.sgml delete mode 100644 packages/sgml/Test/sr2.sgml delete mode 100644 packages/sgml/Test/test.pl delete mode 100644 packages/sgml/Test/ugh.sgml delete mode 100644 packages/sgml/Test/utf8-cent.xml delete mode 100644 packages/sgml/Test/utf8-ru.xml delete mode 100644 packages/sgml/Test/utf8.xml delete mode 100644 packages/sgml/Test/wchar.xml delete mode 100644 packages/sgml/Test/wcharlong.xml delete mode 100644 packages/sgml/Test/wrtest.pl delete mode 100644 packages/sgml/VERSION delete mode 100644 packages/sgml/catalog.c delete mode 100644 packages/sgml/catalog.h delete mode 100644 packages/sgml/charmap.c delete mode 100644 packages/sgml/configure.in delete mode 100644 packages/sgml/dtd.h delete mode 100644 packages/sgml/dtd2pl.1 delete mode 100644 packages/sgml/dtd2pl.c delete mode 100644 packages/sgml/error.c delete mode 100644 packages/sgml/error.h delete mode 100755 packages/sgml/install-sh delete mode 100644 packages/sgml/iso_639.pl delete mode 100755 packages/sgml/make.bat delete mode 100644 packages/sgml/model.c delete mode 100644 packages/sgml/model.h delete mode 100644 packages/sgml/parser.c delete mode 100644 packages/sgml/parser.h delete mode 100644 packages/sgml/pltotex.pl delete mode 100644 packages/sgml/prolog.c delete mode 100644 packages/sgml/prolog.h delete mode 100644 packages/sgml/pwp.pl delete mode 100644 packages/sgml/quote.c delete mode 100644 packages/sgml/sgml.c delete mode 100644 packages/sgml/sgml.doc delete mode 100644 packages/sgml/sgml.pl delete mode 100644 packages/sgml/sgml2pl.c delete mode 100644 packages/sgml/sgml_mode.html delete mode 100644 packages/sgml/sgml_mode.pl delete mode 100644 packages/sgml/sgml_write.pl delete mode 100644 packages/sgml/sgmldefs.h delete mode 100644 packages/sgml/utf8.c delete mode 100644 packages/sgml/utf8.h delete mode 100644 packages/sgml/util.c delete mode 100644 packages/sgml/util.h delete mode 100644 packages/sgml/xml_unicode.c delete mode 100644 packages/sgml/xml_unicode.h delete mode 100644 packages/sgml/xml_unicode.pl delete mode 100644 packages/sgml/xmlns.c delete mode 100644 packages/sgml/xmlns.h delete mode 100644 packages/sgml/xpath.pl delete mode 100644 packages/sgml/xsdp_types.pl diff --git a/.gitmodules b/.gitmodules index 20b16e203..57cbc0f88 100644 --- a/.gitmodules +++ b/.gitmodules @@ -9,10 +9,19 @@ url = git://yap.dcc.fc.up.pt/jpl [submodule "packages/zlib"] path = packages/zlib - url = git://yap.git.sourceforge.net/gitroot/yap/zlib + url = ssh://vsc@yap.git.sourceforge.net/gitroot/yap/zlib [submodule "packages/http"] path = packages/http url = ssh://vsc@yap.git.sourceforge.net/gitroot/yap/http [submodule "packages/clib"] path = packages/clib - url = git://yap.git.sourceforge.net/gitroot/yap/clib + url = ssh://vsc@yap.git.sourceforge.net/gitroot/yap/clib +[submodule "packages/sgml"] + path = packages/sgml + url = ssh://vsc@yap.git.sourceforge.net/gitroot/yap/sgml +[submodule "packages/RDF"] + path = packages/RDF + url = ssh://vsc@yap.git.sourceforge.net/gitroot/yap/RDF +[submodule "packages/semweb"] + path = packages/semweb + url = ssh://vsc@yap.git.sourceforge.net/gitroot/yap/semweb diff --git a/include/SWI-Prolog.h b/include/SWI-Prolog.h index aa0e3b5ce..ce53a124f 100755 --- a/include/SWI-Prolog.h +++ b/include/SWI-Prolog.h @@ -765,7 +765,8 @@ X_API int PL_warning(const char *msg, ...); */ #define PL_FIRST_CALL (0) -#define PL_CUTTED (1) +#define PL_CUTTED (1) /* deprecated */ +#define PL_PRUNED (1) #define PL_REDO (2) #define PL_retry(n) return _PL_retry(n) diff --git a/library/dialect/swi/fli/swi.c b/library/dialect/swi/fli/swi.c index 553bc8823..e1451eedb 100755 --- a/library/dialect/swi/fli/swi.c +++ b/library/dialect/swi/fli/swi.c @@ -2192,13 +2192,20 @@ PL_discard_foreign_frame(fid_t f) { CACHE_REGS open_query *env = (open_query *)f; + if (execution != env) { + /* handle the case where we do not want to kill the last open frame */ + open_query *env0 = execution; + while (env0 && env0 != env) env0 = env0->old; + if (!env0) + return; + } CurSlot = env->slots; while (B->cp_b != (choiceptr)(LCL0-env->b)) B = B->cp_b; backtrack(); CP = env->cp; P = env->p; - execution = execution->old; + execution = env->old; ASP = LCL0-CurSlot; B = B->cp_b; free(env); diff --git a/packages/PLStream/pl-os.c b/packages/PLStream/pl-os.c index 37b9b9eea..67d9a2c91 100755 --- a/packages/PLStream/pl-os.c +++ b/packages/PLStream/pl-os.c @@ -631,7 +631,7 @@ TemporaryFile(const char *id, int *fdp) } retry: -#if defined(_unix__) || defined(__APPLE__) +#if defined(__unix__) || defined(__APPLE__) { static int MTOK_temp_counter = 0; const char *sep = id[0] ? "_" : ""; diff --git a/packages/RDF b/packages/RDF new file mode 160000 index 000000000..613a7199e --- /dev/null +++ b/packages/RDF @@ -0,0 +1 @@ +Subproject commit 613a7199e420a734717f2887c17b4fc3ef30f67e diff --git a/packages/RDF/ChangeLog b/packages/RDF/ChangeLog deleted file mode 100644 index d392dca98..000000000 --- a/packages/RDF/ChangeLog +++ /dev/null @@ -1,280 +0,0 @@ -[Sep 10 2009] - - * MODIFIED: Dropped support for old RDF Bag/Alt/Seq syntax. - - * ENHANCED: Speedup processing of xml: properties in RDF/XML parser. - - * ENHANCED: Compile-time expansion of the term-rewriter that is used by - the RDF/XML parser. - -[Aug 20 2009] - - * FIXED: Support for \U in rdf_ntriples.pl (used to parse W3C test results) - -[Jul 30 2009] - - * CLEANUP: Modernise rdf.pl and rdf_db.pl module handling. - -[Jul 2 2009] - - * FIXED: handle rdf:datatype earlier (compliant to the revised RDF syntax - specs). This fixes empty strings using - - - Spotted by Chris Mungall - -[Jun 22 2009] - - * FIXED: avoid bnodes in types nodes for rdf_write_xml/2. - -[Jun 9 2009] - - * FIXED: RDF typed-nodes (... descriptions) if the expansion of ns contains %-escaped characters. Jochem Liem. - -[Mar 19 2009] - - * CLEANUP: Removed all trailing whitespace from all source-files. This avoids many GIT (merge) warnings. -[Mar 12 2009] - - * MODIFIED: Renamed concat_atom/2,3 into atomic_list_concat/2,3 for compatibility. Moved the old predicates into library(backcomp). It is adviced to update your code, but 99% of the code will remain working because the old definitions are autoloaded. - -[Mar 6 2009] - - * FIXED: rdf_write_xml with different encodings. Patch by Keri Harris. -[Jan 21 2009] - - * FIXED: RDF writer: write valid XML if the namespace entity contains characters - that must be %-escaped. Jacopo Urbani. - -[Jan 13 2009] - - * FIXED: RDF/XML could save illegal XML if multiple namespaces are used - for predicates where one namespace is a prefix of another one. Jacopo Urbani. -[Dec 19 2008] - - * ADDED: Pass content_length through process_rdf/3 -[Sep 11 2008] - - * PORT: Add AC_PREREQ to configure.h for systems that auto-select autoconf - versions. After tip by Ulrich Neumerkel. - -[Aug 11 2008] - - * INSTALL: Remove all configure files from the git repository -[Apr 18 2008] - - * MODIFIED: Renamed hash_term/2 to term_hash/2. Added hash_term/2 to - library(backcomp), so most code should not notice this. -[Feb 28 2008] - - * FIXED: rdf_write_xml/2 loops if it encounters an rdf:Bag. - -[Feb 18 2008] - - * FIXED: More fixes for proper handling of rdf:Bag - -[Feb 13 2008] - - * FIXED: Emit rdf:Bag attributes (etc.) as rdf:li - - * FIXED: possible failure in rdf_write_xml with http://t-d-b.org? - -[Jan 14 2008] - - * FIXED: Bug#343: Handling bnodes in rdf_write_xml. Yver Raimond. - - * FIXED: Added support for rdf:NodeID to rdf_write_xml/2. Yves Raimond. - -[Dec 13 2007] - - * FIXED: library(rdf_write) to deal with operators. Related to Bug#332 - -Oct 29, 2007 - - * FIXED: extract namespaces used in typed literals. Yves Raimond. - -Jul 9, 2007 - - * FIXED: xml:lang with empty literals. Jochem Liem. - -Jun 14, 2007 - - * FIXED: return rdf:parseType="Literal" as literal of type - rdf:XMLLiteral. - -Jan 18, 2007 - - * ADDED: embedded(Bool) option to process_rdf/3 - -Jun 25, 2006 - - * CLEANUP: Delete unused global variable. - -Jun 5, 2006 - - * FIXED: use UTF-8 decoder from new library(utf8). Our own internal one - was broken. - -Apr 25, 2006 - - * FIXED: decoding of unicode-URIs using UTF-8 over %XX%XX. - -Apr 13, 2006 - - * ADDED: library rdf_write to write an RDF file from a list of triples. - -Dec 8, 2005 - - * FIXED: xmlns attributes in descriptions. Bijan Parsia - -Nov 23, 2005 - - * ADDED: option db(DB) to parse_rdf/2. - -Nov 10, 2005 - - * COMMENT: Comment use of IRI - -Jul 7, 2005 - - * ADDED: Pass entity(Name, Value) to XML parser - -Jul 5, 2005 - - * FIXED: Perform proper URI decoding to Unicode atoms - -Jul 4, 2005 - - * FIXED: Make "make check" work from the build directory. - -Mar 31, 2005 - - * FIXED: memory leak in process_rdf/2 - -Mar 29, 2005 - - * FIXED: dataType --> datatype (Vangelis Vassiliadis) - -Oct 21, 2004 - - * FIXED: Bug#196: avoid need for autoloading. Sandro Hawke. - -Sep 13, 2004 - - * ADDED: namespaces(-NameSpaces) option to load_rdf/3 and process_rdf/3 - to query the document namespace declarations. - -Aug 13, 2004 - - * MODIFIED: load_rdf/3 no longer returns resources as Prefix:URI, but - instead returns the plain atoms. - -Jul 31, 2004 - - * ADDED: converted rdf_nt.pl into public rdf_ntriples.pl library for - loading data in the W3C ntriple format. - -Jun 29, 2004 - - * FIXED: sharing code for blank nodes. Broken in recent cleanup. - -Jun 17, 2004 - - * CLEANUP: start/end of loading a file, use option/3 from library - -Apr 21, 2004 - - * ADDED: Support for xml:lang and rdf:dataType attributes. - - * INTERNAL: Use global variables rather than assert/retract for - keeping track of the state for process_rdf/3. - -Nov 29, 2003 - - * ADDED: warning for incorrect and multiple definitions of rdf:ID. - Maarten Menken. - -Nov 7, 2003 - - * ADDED: process_rdf/3: allow processing from a stream - -Oct 6, 2003 - - * MODIFIED: synopsis of process_rdf/3 to - process_rdf(+File, :OnTriples, +Options) for consistency and to allow - extending the option list. Old calls are mapped to the new. - - * Added option blank_nodes(share) to load_rdf/3 and process_rdf/3. - -Aug 18, 2003 - - * Guarantee that anonymous ids start with __ - -Mar 20, 2003 - - * Fixed exception in cleanup. Dominique de Waleffe. - -Feb 28, 2003 - - * ADDED: Use BaseURI to create non-conflicting anonymous resources. - - * FIXED: rdf_parser:global_id to ignore xml:base for absolute URIs - -Jan 17, 2003 - - * FIXED: online.pl (web frontend) to avoid using goal/1 option for the - xml parser. Now uses 4.0.8 clib memfile library primitives. - - * FIXED: process_rdf/3, Peter Marks. - - * ADDED: parseType="Collection", satisfying the W3C Working Draft - 8 November 2002. - -################################################################ -# Sumary of incompatibilities: -# -# Many problems in nested bag handling, changing output of -# suite/t5.rdf -# -# Content of Alt-container was incorrectly rendered as rdf:li -# instead of rdf:_1, rdf:_2, etc (suite/t27.rdf). -################################################################ - - * ADDED: Translate rdf:li predicates into _1, _2, etc. - - * FIXED: parseType=Literal to avoid extraneous [..] around the value - -Oct 28, 2002 - - * CLEANUP: pass base-uri as attribute, preparing for xml:base and making - the parser ready for multi-threading. - -Sep 16, 2002 - - * MODIFIED: Allow for unqualified attribute-names - - * ADDED: "make check" - -Older entries - - * FIXED: Type-exception in atom_chars/2 - - * FIXED: handling mixed literal and object - (space canonisation problem). - - * CGI Demo: report errors generated before a fatal exception. - - * FIXED: handling of propertyElt of the form - rdf:ID="myid" rdf:parseType="Resource" - - * For objects, map NameSpace:Local to the simple concatenation of the two. - This implies: - - # Subjects are always atoms - # Predicates are NameSpace:LocalName or simply Name - # Objects are atoms (URI) or literal(Value) - - * Warn on things that cannot be converted into an RDF-object rather then - failing silently. - - * Removed some undesirable choice-points. diff --git a/packages/RDF/Makefile.in b/packages/RDF/Makefile.in deleted file mode 100644 index d9fc07efc..000000000 --- a/packages/RDF/Makefile.in +++ /dev/null @@ -1,135 +0,0 @@ -################################################################ -# SWI-Prolog `RDF' package -# Author: Jan Wielemaker. jan@swi.psy.uva.nl -# Copyright: LGPL (see COPYING or www.gnu.org -################################################################ - -.SUFFIXES: .tex .dvi .doc .pl - -SHELL=@SHELL@ - - -ifeq (@PROLOG_SYSTEM@,yap) - -prefix = @prefix@ -exec_prefix = @exec_prefix@ -ROOTDIR = $(prefix) -EROOTDIR = @exec_prefix@ - -srcdir=@srcdir@ - -BINDIR = $(EROOTDIR)/bin -LIBDIR=@libdir@ -YAPLIBDIR=@libdir@/Yap -SHAREDIR=$(EROOTDIR)/share/Yap - -PL=@INSTALL_ENV@ $(DESTDIR)$(BINDIR)/yap $(DESTDIR)$(YAPLIBDIR)/startup.yss -LN_S=@LN_S@ - -INSTALLDIR=$(SHAREDIR) - -else # SWI - -srcdir=. - -PLBASE=@PLBASE@ -PLARCH=@PLARCH@ -PL=@PL@ -XPCEBASE=$(PLBASE)/xpce -PKGDOC=$(PLBASE)/doc/packages -PCEHOME=../xpce - -LIBDIR=$(PLBASE)/library -INSTALLDIR=$(LIBDIR) - -endif - -DOCTOTEX=$(PCEHOME)/bin/doc2tex -PLTOTEX=$(PCEHOME)/bin/pl2tex -RUNTEX=../../man/runtex -LATEX=latex -DOC=rdf2pl -TEX=$(DOC).tex -DVI=$(DOC).dvi -PDF=$(DOC).pdf -HTML=$(DOC).html - -INSTALL=@INSTALL@ -INSTALL_PROGRAM=@INSTALL_PROGRAM@ -INSTALL_DATA=@INSTALL_DATA@ - -LIBPL= $(srcdir)/rdf.pl $(srcdir)/rdf_parser.pl $(srcdir)/rdf_triple.pl $(srcdir)/rewrite.pl \ - $(srcdir)/rdf_ntriples.pl $(srcdir)/rdf_write.pl -XPCEPL= $(srcdir)/rdf_diagram.pl - -all: - @echo "Nothing to do for this package" - - -ifeq (@PROLOG_SYSTEM@,yap) -install: $(LIBPL) - $(INSTALL_DATA) $(LIBPL) $(DESTDIR)$(INSTALLDIR) - $(PL) -f none -g make -t halt -else -install: $(LIBPL) xpce-install - $(INSTALL_DATA) $(LIBPL) $(DESTDIR)$(INSTALLDIR) - $(PL) -f none -g make -t halt -endif - -ln-install:: - @$(MAKE) INSTALL_DATA=../ln-install install - -xpce-install: $(XPCEPL) - if [ -d $(DESTDIR)$(XPCEBASE) ]; then \ - $(INSTALL) -m 644 $(XPCEPL) $(DESTDIR)$(XPCEBASE)/prolog/lib; \ - fi - -rpm-install: install - -pdf-install:: - -$(INSTALL_DATA) $(DOC).pdf $(DESTDIR)$(PKGDOC) - -html-install:: - -$(INSTALL_DATA) $(DOC).html $(DESTDIR)$(PKGDOC) - -uninstall: - (cd $(PLBASE)/library && rm -f $(LIBPL)) - $(PL) -f none -g make -t halt - -check:: - $(PL) -q -f $(srcdir)/test_rdf.pl -g true -t test_rdf - $(PL) -q -f $(srcdir)/test_write.pl -g true -t test_write - -################################################################ -# Documentation -################################################################ - -doc: $(PDF) $(HTML) -pdf: $(PDF) -html: $(HTML) - -$(HTML): $(TEX) - latex2html $(DOC) - mv html/index.html $@ - -$(PDF): $(TEX) - $(RUNTEX) --pdf $(DOC) - -$(TEX): $(DOCTOTEX) - -.doc.tex: - $(DOCTOTEX) $*.doc > $*.tex -.pl.tex: - $(PLTOTEX) $*.pl > $*.tex - -################################################################ -# Clean -################################################################ - -clean: - rm -f *~ *% config.log - -distclean: clean - rm -f $(TARGETS) config.h config.cache config.status Makefile - rm -f $(TEX) - $(RUNTEX) --clean $(DOC) diff --git a/packages/RDF/Makefile.mak b/packages/RDF/Makefile.mak deleted file mode 100644 index aada36637..000000000 --- a/packages/RDF/Makefile.mak +++ /dev/null @@ -1,51 +0,0 @@ -################################################################ -# Build the SWI-Prolog RDF package for MS-Windows -# NOTE: This package requires the SGML package -# -# Author: Jan Wielemaker -# -# Use: -# nmake /f Makefile.mak -# nmake /f Makefile.mak install -################################################################ - -PLHOME=..\.. -!include $(PLHOME)\src\rules.mk - -all: - -!IF "$(CFG)" == "rt" -install:: -!ELSE -install:: - copy rdf.pl "$(PLBASE)\library" - copy rdf_parser.pl "$(PLBASE)\library" - copy rdf_triple.pl "$(PLBASE)\library" - copy rewrite.pl "$(PLBASE)\library" - copy rdf_ntriples.pl "$(PLBASE)\library" - copy rdf_write.pl "$(PLBASE)\library" - $(MAKEINDEX) -!ENDIF - -xpce-install:: - copy rdf_diagram.pl "$(PLBASE)\xpce\prolog\lib" - $(MAKEINDEX) - -html-install:: - copy rdf2pl.html "$(PKGDOC)" - -uninstall:: - del "$(PLBASE)\library\rdf.pl" - del "$(PLBASE)\library\rdf_parser.pl" - del "$(PLBASE)\library\rdf_triple.pl" - del "$(PLBASE)\library\rewrite.pl" - del "$(PLBASE)\library\rdf_ntriples.pl" - del "$(PLBASE)\library\rdf_write.pl" - $(MAKEINDEX) - -clean:: - if exist *~ del *~ - -distclean: clean - - diff --git a/packages/RDF/README b/packages/RDF/README deleted file mode 100644 index 149fd04c3..000000000 --- a/packages/RDF/README +++ /dev/null @@ -1,12 +0,0 @@ ----+ RDF/XML parser and writer - -This directory implements the RDF/XML parser on top of the SWI-Prolog -XML parser. The main entry point is provided by load_rdf/3 or the -call-back version process_rdf/3. - -In addition, rdf_write.pl provides writing (serialization) of an RDD/XML -document from a list of triples. - - * [[load_rdf/3]] - * [[process_rdf/3]] - * [[rdf_write_xml/2]] diff --git a/packages/RDF/config.h.in b/packages/RDF/config.h.in deleted file mode 100644 index e4345dca2..000000000 --- a/packages/RDF/config.h.in +++ /dev/null @@ -1,19 +0,0 @@ -/* config.h.in. Generated from configure.in by autoheader. */ - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the home page for this package. */ -#undef PACKAGE_URL - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION diff --git a/packages/RDF/configure.in b/packages/RDF/configure.in deleted file mode 100644 index 2fd0e18c3..000000000 --- a/packages/RDF/configure.in +++ /dev/null @@ -1,9 +0,0 @@ -dnl Process this file with autoconf to produce a configure script. - -AC_INIT(install-sh) -AC_PREREQ([2.50]) -AC_CONFIG_HEADER(config.h) - -m4_include([../ac_swi_noc.m4]) - -AC_OUTPUT(Makefile) diff --git a/packages/RDF/online.pl b/packages/RDF/online.pl deleted file mode 100644 index 94d196094..000000000 --- a/packages/RDF/online.pl +++ /dev/null @@ -1,457 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog RDF parser - - Author: Jan Wielemaker - E-mail: jan@swi.psy.uva.nl - WWW: http://www.swi.psy.uva.nl/projects/SWI-Prolog/ - Copying: LGPL-2. See the file COPYING or http://www.gnu.org - - Copyright (C) 1990-2000 SWI, University of Amsterdam. All rights reserved. -*/ - - -:- use_module(library(cgi)). -:- use_module(library(sgml)). -:- use_module(rdf). -:- use_module(rdf_parser). -:- use_module(rewrite). -:- use_module(pretty_print). - -term_expansion(F, T) :- rew_term_expansion(F, T). -goal_expansion(F, T) :- rew_goal_expansion(F, T). - -:- dynamic new_rdf_namespace/1. - -parse(Text, RDFTerm, Triples) :- - parse_atom(Text, Term), - ( find_rdf(Term, RDFTerm) - -> true - ; RDFTerm = Term - ), - xml_to_rdf(RDFTerm, [], Triples). - -find_rdf(Term, RDFTerm) :- - RDFTerm = element(NS:'RDF', _, _), - term_member(RDFTerm, Term), !, - ( rdf_name_space(NS) - -> true - ; assert(rdf_parser:rdf_name_space(NS)), - assert(new_rdf_namespace(NS)) - ). - -term_member(X, X). -term_member(X, Compound) :- - compound(Compound), - arg(_, Compound, Arg), - term_member(X, Arg). - -% parse_atom(+Atom, -Term, +Options -% -% Parse and atom into a structured term - -parse_atom(Atom, Term) :- - atom_to_memory_file(Atom, MemFile), - open_memory_file(MemFile, read, Stream), - new_sgml_parser(Parser, []), - set_sgml_parser(Parser, dialect(xmlns)), - set_sgml_parser(Parser, space(sgml)), - sgml_parse(Parser, - [ source(Stream), - document(Term) - ]), - free_sgml_parser(Parser), - close(Stream), - free_memory_file(MemFile). - - - /******************************* - * HTML GENERATION * - *******************************/ - -:- op(100, fx, #). -:- op(110, xfx, ::). - -emit([]) :- !. -emit([H|T]) :- !, - emit(H), - emit(T). -emit(Fmt-Args) :- !, - format(Fmt, Args), - retractall(nl_done(_)). -emit(#Term) :- !, - #Term. -emit(#Term::Content) :- !, - #Term::Content. -emit(Atom) :- - write(Atom), - retractall(nl_done(_)). - -#Term::Content :- - Term =.. [Name|Attributes], - layout(before(open, Name)), - format('<~w', [Name]), - attlist(Attributes), - format('>', []), - retractall(nl_done(_)), - layout(after(open, Name)), - emit(Content), - end_tag(Name). -#pre(Text) :- !, - sgml_quote(Text, Quoted), - #pre::Quoted. -#box(Text) :- !, - box(Text, '#e0e0e0'). -#box(Text, Colour) :- !, - box(Text, Colour). -#Term :- - Term =.. [Name|Attributes], - layout(before(open, Name)), - format('<~w', [Name]), - attlist(Attributes), - format('>', []), - retractall(nl_done(_)), - layout(after(open, Name)), - end_tag(Name). - -end_tag(Name) :- - blines(Name, _, o), !. -end_tag(Name) :- - layout(before(close, Name)), - format('', [Name]), - retractall(nl_done(_)), - layout(after(close, Name)). - - -layout(before(open, Name)) :- - blines(Name, N-_, _), !, - nls(N). -layout(after(open, Name)) :- - blines(Name, _-N, _), !, - nls(N). -layout(before(close, Name)) :- - blines(Name, _, N-_), !, - nls(N). -layout(after(close, Name)) :- - blines(Name, _, _-N), !, - nls(N). -layout(_) :- - retractall(nl_done(_)). - -:- dynamic - nl_done/1. - -nls(N) :- - ( nl_done(Done) - -> true - ; Done = 0 - ), - ToDo is N - Done, - New is max(N, Done), - retractall(nl_done(Done)), - assert(nl_done(New)), - do_nl(ToDo). - -do_nl(N) :- - N > 0, !, - nl, - NN is N - 1, - do_nl(NN). -do_nl(_). - -blines(tr, 1-0, 0-0). -blines(table, 2-1, 1-1). -blines(form, 2-1, 1-1). -blines(h1, 2-0, 0-1). -blines(h2, 2-0, 0-2). -blines(h3, 2-0, 0-2). -blines(h4, 2-0, 0-2). -blines(p, 2-1, o). % omitted end-tag - -attlist([]). -attlist([Name=Value|T]) :- !, - sgml_quote_value(Value, Quoted), - format(' ~w=~w', [Name, Quoted]), - attlist(T). -attlist([Name|T]) :- - format(' ~w', [Name]), - attlist(T). - -head(Title) :- - emit([ 'Content-type: text/html\n\n', - '\n', - '\n', - '~w~n'-[Title], - '\n\n', - '\n' - ]). -foot :- - emit([ '\n', - '\n' - ]). - - -pre(Text) :- - sgml_quote(Text, Quoted), - #pre::Quoted. - -box(Text, Colour) :- - emit('

\n'), - #table(width='80%', align=center, border=6, bgcolor=Colour):: - [#tr::[#td(nowrap)::[#pre(Text)]]]. - - - /******************************* - * QUOTING * - *******************************/ - -sgml_quote_value(Value, Arg) :- - atom_chars(Value, Chars), - ( name_chars(Chars) - -> Arg = Value - ; sgml_quote_chars(Chars, Quoted), - atom_chars(Arg, Quoted) - ). - -name_chars([H|T]) :- - char_type(H, alpha), - all_alnum(T). - -all_alnum([]). -all_alnum([H|T]) :- - char_type(H, csymf), - all_alnum(T). - -sgml_quote_chars(L, ['"'|T]) :- - sgml_quote2(L, T, ['"']). - -sgml_quote2([], T, T). -sgml_quote2([H|T0], List, Rest) :- - sgml_quote_char(H, List, T), !, - sgml_quote2(T0, T, Rest). -sgml_quote2([H|T0], [H|T], Rest) :- - sgml_quote2(T0, T, Rest). - -sgml_quote_char('<', [&, l, t, ;|T], T). -sgml_quote_char('>', [&, g, t, ;|T], T). -sgml_quote_char('&', [&, a, m, p, ;|T], T). -sgml_quote_char('"', [&, q, u, o, t, ;|T], T). -%sgml_quote_char('\'', [&, a, p, o, s, ;|T], T). - -sgml_quote(Text, Quoted) :- - atom_chars(Text, Chars), - sgml_quote2(Chars, QuotedChars, []), - atom_chars(Quoted, QuotedChars). - - - /******************************* - * PAGE GENERATION * - *******************************/ - -parsed(Time, Triples) :- - length(Triples, Len), - #h2::'RDF statement parsed successfully', - #p::[ 'Your RDF statement has been parsed in ~2f seconds, '-[Time], - 'creating ', #b::Len, ' triples. ', - 'Please find the created triples in the table below.' - ], - ( getenv('HTTP_REFERER', Referer) - -> #p::[ 'If you want to try another RDF statement, please go ', - 'back to ', #a(href=Referer)::'the request form', '.' - ] - ; true - ). - -rdf_table(Triples) :- - maplist(triple_row, Triples, TripleRows), - #p, - #table(caption='RDF triples', - align=center, border=2, cellpadding=3):: - [ #tr::[#th::'Subject', #th::'Predicate', #th::'Object'] - | TripleRows - ]. - -triple_row(rdf(Subj, Pred, Obj), #tr::[#td::S,#td::P,#td::O]) :- - cell(Subj, S), - cell(Pred, P), - cell(Obj, O). - -cell(rdf:Local, [#em::rdf, :, #b::Local]) :- !. -cell(literal(X), [#b::'literal(', X, #b::')']) :- !. -cell(each(X), [#b::'each(', X, #b::')']) :- !. -cell(pefix(X), [#b::'prefix(', X, #b::')']) :- !. -cell(NS:Local, [NS, :, #b::Local]) :- !. -cell(V, [T]) :- - sformat(T, '~p', [V]). - - /******************************* - * ERRORS * - *******************************/ - -show_errors :- - getenv('ERROR_FILE', File), - size_file(File, Size), - Size > 0, !, - read_file(File, Data), - #h4::[#font(color=red):: - 'The following errors occurred while processing your request'], - #p, - #box(Data, '#ff8c00'). -show_errors. - -show_new_namepace :- - new_rdf_namespace(NS), !, - #h4::[#font(color=red)::'Warning: unofficial RDF Namespace'], - #p::['It appears your RDF description uses the unofficial ', - 'name space ', #b::NS, '. ', - 'This name space has been added for RDF.' - ]. -show_new_namepace. - - - /******************************* - * COMMENT * - *******************************/ - -comment(TextId) :- - #h4::'


Comment', - #p::[ 'If you do not agree with the output or have other comments, ', - 'Please write them in the text-area below and submit them' - ], - getenv('REQUEST_URI', Script), - #form(method=post, action=Script):: - [ #input(type=hidden, name=id, value=TextId), - #table(align=center):: - [ #tr::[#td::[#textarea(name=comment, cols=64, rows=10)]], - #tr::[#td(align=right)::['E-mail: ', #input(name=mail)]], - #tr::[#td(align=right)::[#input(type=submit)]] - ] - ]. - - - /******************************* - * REQUEST * - *******************************/ - -request_location('Online-requests'). - -% Save the request and return a local identifier for it. - -save_request(Text, Id) :- - request_dir(Dir, Date), - atomic_list_concat([Dir, /, Date], DateDir), - ensure_dir(DateDir), - between(1, 10000, N), - atomic_list_concat([DateDir, /, N, '.rdf'], File), - \+ exists_file(File), !, - open(File, write, Fd), - format(Fd, '~w~n', [Text]), - close(Fd), - atomic_list_concat([Date, /, N], Id). - -request_dir(BaseDir, Date) :- - get_time(Time), - convert_time(Time, Y, M, D, _, _, _, _), - request_location(BaseDir), - atomic_list_concat([D, -, M, -, Y], Date). - -ensure_dir(Dir) :- - exists_directory(Dir), !. -ensure_dir(Dir) :- - make_directory(Dir). - -save_comment(Id, Mail, Comment) :- - request_location(Base), - atomic_list_concat([Base, '/', Id], FileBase), - absolute_file_name(FileBase, AbsFileBase), - absolute_file_name(Base, AbsBase), - sub_atom(AbsFileBase, 0, _, _, AbsBase), % verify in tree - atom_concat(AbsFileBase, '.cmt', CmtFile), - open(CmtFile, write, Fd), - format(Fd, 'E-mail: ~w~n~n~w~n', [Mail, Comment]), - close(Fd). - - - /******************************* - * ENTRY * - *******************************/ - -main :- - cgi_get_form(Arguments), - ( ( memberchk(attachment(Text), Arguments), - Text \== '' - ; memberchk(rdf(Text), Arguments) - ) - -> save_request(Text, TextId), - ( OldTime is cputime, - parse(Text, _Prolog, Triples), - Time is cputime - OldTime - -> head('RDF Triples'), - parsed(Time, Triples), - show_errors, - show_new_namepace, - rdf_table(Triples), - comment(TextId), - foot - ; head('Failed to parse'), - #p::[ 'I failed to parse your request' ], - show_errors, - comment(TextId), - foot - ), - halt - ; memberchk(comment(Comment), Arguments), - memberchk(id(Id), Arguments), - memberchk(mail(Mail), Arguments) - -> save_comment(Id, Mail, Comment), - head('Thanks for comment'), - #p::'Thank you for your comments', - foot, - halt - ). -main :- - head('Failed'), - #p::[ 'This CGI-script failed to understand your request' ], - foot, - halt. - -go :- - catch(main, E, error(E)). - -error(E) :- - message_to_string(E, Msg), - head('Failed to parse'), - show_errors, - #p::[ 'An exception was raised while parsing your request:' ], - #pre(Msg), - foot, - halt. - - - /******************************* - * TEST * - *******************************/ - -test :- - read_file('suite/t1.rdf', Text), - catch(parse(Text, _Prolog, Triples), E, error(E)), - head('RDF Triples'), - rdf_table(Triples), - foot. - - - /******************************* - * UTIL * - *******************************/ - -read_file(File, Atom) :- - open(File, read, Fd), - get_code(Fd, C), - read_stream(C, Fd, Chars), - close(Fd), - atom_codes(Atom, Chars). - -read_stream(-1, _, []) :- !. -read_stream(C0, Fd, [C0|T]) :- - get_code(Fd, C), - read_stream(C, Fd, T). diff --git a/packages/RDF/pretty_print.pl b/packages/RDF/pretty_print.pl deleted file mode 100644 index b7468ffca..000000000 --- a/packages/RDF/pretty_print.pl +++ /dev/null @@ -1,169 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog SGML/XML parser - - Author: Jan Wielemaker - E-mail: jan@swi.psy.uva.nl - WWW: http://www.swi.psy.uva.nl/projects/SWI-Prolog/ - Copying: LGPL-2. See the file COPYING or http://www.gnu.org - - Copyright (C) 1990-2000 SWI, University of Amsterdam. All rights reserved. -*/ - -:- module(dia_pretty_print, - [ pretty_print/1 - ]). - -:- expects_dialect(swi). - -:- require([ atom_length/2 - , between/3 - , forall/2 - , is_list/1 - , member/2 - , memberchk/2 - ]). - - -pretty_print(Term) :- - numbervars(Term, 0, _), - pp(Term, 0), - write('.'), nl, fail. -pretty_print(_). - - -pp(Term, _Indent) :- - atomic(Term), !, - writeq(Term). -pp(Var, _Indent) :- - var(Var), !, - write(Var). -pp(Var, _Indent) :- - Var = '$VAR'(_), !, - print(Var). -pp('$aref'(Name), _Indent) :- !, - write(Name). -pp(Module:Term, Indent) :- - atomic(Module), !, - writeq(Module), write(:), - pp(Term, Indent). -pp([A1 = V1|ArgList], Indent) :- % [] is done by `atomic'! - is_list(ArgList), - forall(member(A, ArgList), A = (_ = _)), - longest_attribute([A1 = V1|ArgList], 0, L), !, - NewIndent is Indent + 2, - ( L > 9, Indent < 25, length(ArgList, Args), Args > 1 - -> ArgIndent is Indent + 4, - ValGoal = (nl, indent(ArgIndent)) - ; ArgIndent is Indent + 6 + L, - ValGoal = write(' ') - ), - write('[ '), - pp(A1, Indent), term_length(A1, L1), - tab(L-L1), write(' ='), ValGoal, - pp(V1, ArgIndent), - forall(member(A = V, ArgList), - (write(','), nl, - indent(NewIndent), - pp(A, Indent), term_length(A, LA), tab(L-LA), - write(' ='), ValGoal, pp(V, ArgIndent))), - nl, - indent(Indent), - write(']'). -pp([H|T], Indent) :- - is_list(T), !, - write('[ '), - NewIndent is Indent + 2, - pp(H, NewIndent), - forall(member(E, T), - (write(','), nl, - indent(NewIndent), - pp(E, NewIndent))), - nl, - indent(Indent), - write(']'). -pp(Term, Indent) :- - functor(Term, Name, 2), - current_op(_, Type, Name), - memberchk(Type, [xfx, yfx]), !, - arg(1, Term, A1), - arg(2, Term, A2), - pp(A1, Indent), format(' ~q ', [Name]), pp(A2, Indent). -pp(Term, Indent) :- - functor(Term, Name, _Arity), - atom_length(Name, L), - NewIndent is Indent + L + 1, - format('~q(', Name), - ( term_argument_length(Term, AL), - NewIndent + AL < 72 - -> Wrap = nowrap - ; Wrap = wrap - ), - forall(generate_arg(I, Term, Arg), - pparg(I, Arg, Wrap, NewIndent)), - write(')'). - -generate_arg(ArgN, Term, Arg) :- - functor(Term, _, Arity), - between(1, Arity, ArgN), - arg(ArgN, Term, Arg). - -pparg(1, Term, _, Indent) :- !, - pp(Term, Indent). -pparg(_, Term, wrap, Indent) :- !, - write(','), nl, - indent(Indent), - pp(Term, Indent). -pparg(_, Term, _, Indent) :- - write(', '), - pp(Term, Indent). - -longest_attribute([], L, L). -longest_attribute([A = _|T], L0, L) :- - term_length(A, AL), - max(L0, AL, L1), - longest_attribute(T, L1, L). - -term_length(A, AL) :- - atomic(A), !, - atom_length(A, AL). -term_length(Var, AL) :- - var(Var), !, - AL = 1. -term_length('$VAR'(N), AL) :- - varname(N, L), - length(L, AL). -term_length('$aref'(N), AL) :- - atom_length(N, AL). - -term_argument_length(Term, L) :- - term_argument_length(Term, 1, 0, L). - -term_argument_length(Term, A, L0, L) :- - arg(A, Term, Arg), !, - term_length(Arg, AL), - L1 is AL + L0, - NA is A + 1, - term_argument_length(Term, NA, L1, L). -term_argument_length(_, _, L, L). - - -max(A, B, M) :- - ( A >= B - -> M = A - ; M = B - ). - - -varname(N, [C]) :- - N < 26, !, - C is N + 0'A. -varname(N, [C1, C2]) :- - C1 is N // 26 + 0'A, - C2 is N mod 26 + 0'A. - -indent(I) :- - Tabs is I // 8, - forall(between(1, Tabs, _), put(9)), - Spaces is I mod 8, - tab(Spaces). diff --git a/packages/RDF/rdf.pl b/packages/RDF/rdf.pl deleted file mode 100644 index 06a67f302..000000000 --- a/packages/RDF/rdf.pl +++ /dev/null @@ -1,418 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog - - Author: Jan Wielemaker - E-mail: wielemak@science.uva.nl - WWW: http://www.swi-prolog.org - Copyright (C): 2002-2007, University of Amsterdam - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - As a special exception, if you link this library with other files, - compiled with a Free Software compiler, to produce an executable, this - library does not by itself cause the resulting executable to be covered - by the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - - -:- module(rdf, - [ load_rdf/2, % +File, -Triples - load_rdf/3, % +File, -Triples, :Options - xml_to_rdf/3, % +XML, -Triples, +Options - process_rdf/3 % +File, :OnTriples, :Options - ]). - -:- expects_dialect(swi). -:- assert(system:swi_io). - -:- meta_predicate - load_rdf(+, -, :), - process_rdf(+, :, :). - -:- use_module(library(sgml)). % Basic XML loading -:- use_module(library(option)). % option/3 -:- use_module(library(lists)). -:- use_module(rdf_parser). % Basic parser -:- use_module(rdf_triple). % Generate triples - -%% load_rdf(+File, -Triples) is det. -%% load_rdf(+File, -Triples, :Options) is det. -% -% Parse an XML file holding an RDF term into a list of RDF triples. -% see rdf_triple.pl for a definition of the output format. Options: -% -% * base_uri(+URI) -% URI to use as base -% -% * expand_foreach(+Bool) -% Apply each(Container, Pred, Object) on the members of -% Container -% -% * namespaces(-Namespaces:list(NS=URL)) -% Return list of namespaces declared using xmlns:NS=URL in -% the document. This can be used to update the namespace -% list with rdf_register_ns/2. -% -% @see Use process_rdf/3 for processing large documents in -% _|call-back|_ style. - -load_rdf(File, Triples) :- - load_rdf(File, Triples, []). - -load_rdf(File, Triples, M:Options0) :- - entity_options(Options0, EntOptions, Options1), - meta_options(load_meta_option, M:Options1, Options), - init_ns_collect(Options, NSList), - load_structure(File, - [ RDFElement - ], - [ dialect(xmlns), - space(sgml), - call(xmlns, rdf:on_xmlns) - | EntOptions - ]), - rdf_start_file(Options, Cleanup), - call_cleanup(xml_to_rdf(RDFElement, Triples0, Options), - rdf_end_file(Cleanup)), - exit_ns_collect(NSList), - post_process(Options, Triples0, Triples). - -entity_options([], [], []). -entity_options([H|T0], Entities, Rest) :- - ( H = entity(_,_) - -> Entities = [H|ET], - entity_options(T0, ET, Rest) - ; Rest = [H|RT], - entity_options(T0, Entities, RT) - ). - -load_meta_option(convert_typed_literal). - -%% xml_to_rdf(+XML, -Triples, +Options) - -xml_to_rdf(XML, Triples, Options) :- - is_list(Options), !, - make_rdf_state(Options, State, _), - xml_to_plrdf(XML, RDF, State), - rdf_triples(RDF, Triples). -xml_to_rdf(XML, BaseURI, Triples) :- - atom(BaseURI), !, - xml_to_rdf(XML, Triples, [base_uri(BaseURI)]). - - - /******************************* - * POST-PROCESSING * - *******************************/ - -post_process([], Triples, Triples). -post_process([expand_foreach(true)|T], Triples0, Triples) :- !, - expand_each(Triples0, Triples1), - post_process(T, Triples1, Triples). -post_process([_|T], Triples0, Triples) :- !, - post_process(T, Triples0, Triples). - - - /******************************* - * EXPAND * - *******************************/ - -expand_each(Triples0, Triples) :- - select(rdf(each(Container), Pred, Object), - Triples0, Triples1), !, - each_triples(Triples1, Container, Pred, Object, Triples2), - expand_each(Triples2, Triples). -expand_each(Triples, Triples). - -each_triples([], _, _, _, []). -each_triples([H0|T0], Container, P, O, - [H0, rdf(S,P,O)|T]) :- - H0 = rdf(Container, rdf:A, S), - member_attribute(A), !, - each_triples(T0, Container, P, O, T). -each_triples([H|T0], Container, P, O, [H|T]) :- - each_triples(T0, Container, P, O, T). - -member_attribute(A) :- - sub_atom(A, 0, _, _, '_'). % must check number? - - - /******************************* - * BIG FILES * - *******************************/ - -%% process_rdf(+Input, :OnObject, :Options) -% -% Process RDF from Input. Input is either an atom or a term of the -% format stream(Handle). For each encountered description, call -% OnObject(+Triples) to handle the triples resulting from the -% description. Defined Options are: -% -% * base_uri(+URI) -% Determines the reference URI. -% -% * db(DB) -% When loading from a stream, the source is taken from -% this option or -if non-existent- from base_uri. -% -% * lang(LanguageID) -% Set initial language (as xml:lang) -% -% * convert_typed_literal(:Convertor) -% Call Convertor(+Type, +Content, -RDFObject) to create -% a triple rdf(S, P, RDFObject) instead of rdf(S, P, -% literal(type(Type, Content)). -% -% * namespaces(-Namespaces:list(NS=URL)) -% Return list of namespaces declared using xmlns:NS=URL in -% the document. This can be used to update the namespace -% list with rdf_register_ns/2. -% -% * entity(Name, Value) -% Overrule entity values found in the file -% -% * embedded(Boolean) -% If =true=, do not give warnings if rdf:RDF is embedded -% in other XML data. - -process_rdf(File, OnObject, M:Options0) :- - is_list(Options0), !, - entity_options(Options0, EntOptions, Options1), - meta_options(load_meta_option, M:Options1, Options2), - process_options(Options2, ProcessOptions, Options), - option(base_uri(BaseURI), Options, ''), - rdf_start_file(Options, Cleanup), - strip_module(OnObject, Module, Pred), - nb_setval(rdf_object_handler, Module:Pred), - nb_setval(rdf_options, Options), - nb_setval(rdf_state, -), - init_ns_collect(Options, NSList), - ( File = stream(In) - -> Source = BaseURI - ; is_stream(File) - -> In = File, - option(db(Source), Options, BaseURI) - ; open(File, read, In, [type(binary)]), - Close = In, - Source = File - ), - new_sgml_parser(Parser, [dtd(DTD)]), - def_entities(EntOptions, DTD), - set_sgml_parser(Parser, file(Source)), - set_sgml_parser(Parser, dialect(xmlns)), - set_sgml_parser(Parser, space(sgml)), - do_process_rdf(Parser, In, NSList, Close, Cleanup, ProcessOptions). -process_rdf(File, BaseURI, OnObject) :- - process_rdf(File, OnObject, [base_uri(BaseURI)]). - -def_entities([], _). -def_entities([entity(Name, Value)|T], DTD) :- !, - def_entity(DTD, Name, Value), - def_entities(T, DTD). -def_entities([_|T0], DTD) :- - def_entities(T0, DTD). - -def_entity(DTD, Name, Value) :- - open_dtd(DTD, [], Stream), - xml_quote_attribute(Value, QValue), - format(Stream, '~n', [Name, QValue]), - close(Stream). - - -do_process_rdf(Parser, In, NSList, Close, Cleanup, Options) :- - call_cleanup(( sgml_parse(Parser, - [ source(In), - call(begin, rdf:on_begin), - call(xmlns, rdf:on_xmlns) - | Options - ]), - exit_ns_collect(NSList) - ), - cleanup_process(Close, Cleanup, Parser)). - -cleanup_process(In, Cleanup, Parser) :- - ( var(In) - -> true - ; close(In) - ), - free_sgml_parser(Parser), - nb_delete(rdf_options), - nb_delete(rdf_object_handler), - nb_delete(rdf_state), - nb_delete(rdf_nslist), - rdf_end_file(Cleanup). - -on_begin(NS:'RDF', Attr, _) :- - rdf_name_space(NS), !, - nb_getval(rdf_options, Options), - make_rdf_state(Options, State0, _), - rdf_modify_state(Attr, State0, State), - nb_setval(rdf_state, State). -on_begin(Tag, Attr, Parser) :- - nb_getval(rdf_state, State), - ( State == (-) - -> nb_getval(rdf_options, RdfOptions), - ( memberchk(embedded(true), RdfOptions) - -> true - ; print_message(warning, rdf(unexpected(Tag, Parser))) - ) - ; get_sgml_parser(Parser, line(Start)), - get_sgml_parser(Parser, file(File)), - sgml_parse(Parser, - [ document(Content), - parse(content) - ]), - nb_getval(rdf_object_handler, OnTriples), - element_to_plrdf(element(Tag, Attr, Content), Objects, State), - rdf_triples(Objects, Triples), - call(OnTriples, Triples, File:Start) - ). - -%% on_xmlns(+NS, +URL, +Parser) -% -% Build up the list of encountered xmlns:NS=URL declarations. We -% use destructive assignment here as an alternative to -% assert/retract, ensuring thread-safety and better performance. - -on_xmlns(NS, URL, _Parser) :- - ( nb_getval(rdf_nslist, List), - List = list(L0) - -> nb_linkarg(1, List, [NS=URL|L0]) - ; true - ). - -init_ns_collect(Options, NSList) :- - ( option(namespaces(NSList), Options, -), - NSList \== (-) - -> nb_setval(rdf_nslist, list([])) - ; nb_setval(rdf_nslist, -), - NSList = (-) - ). - -exit_ns_collect(NSList) :- - ( NSList == (-) - -> true - ; nb_getval(rdf_nslist, list(NSList)) - ). - - -process_options(Options, Process, RestOptions) :- - select_option(content_length(Len), Options, RestOptions), !, - Process = [content_length(Len)]. -process_options(Options, [], Options). - - - /******************************* - * MESSAGES * - *******************************/ - -:- multifile - prolog:message/3. - -% Catch messages. sgml/4 is generated by the SGML2PL binding. - -prolog:message(rdf(unparsed(Data))) --> - { phrase(unparse_xml(Data), XML) - }, - [ 'RDF: Failed to interpret "~s"'-[XML] ]. -prolog:message(rdf(shared_blank_nodes(N))) --> - [ 'RDF: Shared ~D blank nodes'-[N] ]. -prolog:message(rdf(not_a_name(Name))) --> - [ 'RDF: argument to rdf:ID is not an XML name: ~p'-[Name] ]. -prolog:message(rdf(redefined_id(Id))) --> - [ 'RDF: rdf:ID ~p: multiple definitions'-[Id] ]. -prolog:message(rdf(unexpected(Tag, Parser))) --> - { get_sgml_parser(Parser, file(File)), - get_sgml_parser(Parser, line(Line)) - }, - [ 'RDF: ~w:~d: Unexpected element ~w'-[File, Line, Tag] ]. - - - /******************************* - * XML-TO-TEXT * - *******************************/ - -unparse_xml([]) --> !, - []. -unparse_xml([H|T]) --> !, - unparse_xml(H), - unparse_xml(T). -unparse_xml(Atom) --> - { atom(Atom) - }, !, - atom(Atom). -unparse_xml(element(Name, Attr, Content)) --> - "<", - identifier(Name), - attributes(Attr), - ( { Content == [] - } - -> "/>" - ; ">", - unparse_xml(Content) - ). - -attributes([]) --> - []. -attributes([H|T]) --> - attribute(H), - attributes(T). - -attribute(Name=Value) --> - " ", - identifier(Name), - "=", - value(Value). - -identifier(NS:Local) --> !, - "{", atom(NS), "}", - atom(Local). -identifier(Local) --> - atom(Local). - -atom(Atom, Text, Rest) :- - atom_codes(Atom, Chars), - append(Chars, Rest, Text). - -value(Value) --> - { atom_codes(Value, Chars) - }, - "\"", - quoted(Chars), - "\"". - -quoted([]) --> - []. -quoted([H|T]) --> - quote(H), !, - quoted(T). - -quote(0'<) --> "<". -quote(0'>) --> ">". -quote(0'") --> """. -quote(0'&) --> "&". -quote(X) --> [X]. - - - /******************************* - * XREF * - *******************************/ - -:- multifile prolog:meta_goal/2. -prolog:meta_goal(process_rdf(_,G,_), [G+2]). - -:- retract(system:swi_io). % diff --git a/packages/RDF/rdf2pl.doc b/packages/RDF/rdf2pl.doc deleted file mode 100644 index 31b3732a7..000000000 --- a/packages/RDF/rdf2pl.doc +++ /dev/null @@ -1,475 +0,0 @@ -\documentclass[11pt]{article} -\usepackage{pl} -\usepackage{html} -\usepackage{times} - -\onefile -\htmloutput{html} % Output directory -\htmlmainfile{index} % Main document file -\bodycolor{white} % Page colour - -\newcommand{\elem}[1]{{\tt\string<#1\string>}} - -\begin{document} - -\title{SWI-Prolog RDF parser} -\author{Jan Wielemaker \\ - HCS, \\ - University of Amsterdam \\ - The Netherlands \\ - E-mail: \email{jan@swi-prolog.org}} - -\maketitle - -\begin{abstract} -\url[RDF]{http://www.w3.org/RDF/} ({\bf R}esource {\bf D}escription {\bf -F}ormat) is a \url[W3C]{http://www.w3.org/} standard for expressing -meta-data about web-resources. It has two representations providing -the same semantics. RDF documents are normally transferred as XML -documents using the RDF-XML syntax. This format is unsuitable for -processing. The parser defined here converts an RDF-XML document into -the \jargon{triple} notation. The library \pllib{rdf_write} creates -an RDF/XML document from a list of triples. -\end{abstract} - -\vfill - -\tableofcontents - -\vfill -\vfill - -\newpage - -\section{Introduction} - -RDF is a promising standard for representing meta-data about documents -on the web as well as exchanging frame-based data (e.g. ontologies). RDF -is often associated with `semantics on the web'. It consists of a formal -data-model defined in terms of \jargon{triples}. In addition, a -\jargon{graph} model is defined for visualisation and an XML application -is defined for exchange. - -`Semantics on the web' is also associated with the Prolog programming -language. It is assumed that Prolog is a suitable vehicle to reason with -the data expressed in RDF models. Most of the related web-infra -structure (e.g. XML parsers, DOM implementations) are defined in Java, -Perl, C or C+{+}. - -Various routes are available to the Prolog user. Low-level XML parsing -is due to its nature best done in C or C+{+}. These languages produce -fast code. As XML/SGML are at the basis of most of the other web-related -formats we will benefit most here. XML and SGML, being very stable -specifications, make fast compiled languages even more attractive. - -But what about RDF? RDF-XML is defined in XML, and provided with a -Prolog term representing the XML document processing it according to the -RDF syntax is quick and easy in Prolog. The alternative, getting yet -another library and language attached to the system, is getting less -attractive. In this document we explore the suitability of Prolog for -processing XML documents in general and into RDF in particular. - - -\section{Parsing RDF in Prolog} - -We realised an RDF compiler in Prolog on top of the {\bf sgml2pl} -package (providing a name-space sensitive XML parser). The -transformation is realised in two passes. - -The first pass rewrites the XML term into a Prolog term conveying the -same information in a more friendly manner. This transformation is -defined in a high-level pattern matching language defined on top of -Prolog with properties similar to DCG (Definite Clause Grammar). - -The source of this translation is very close to the BNF notation used by -the \url[specification]{http://www.w3.org/TR/REC-rdf-syntax/}, so -correctness is `obvious'. Below is a part of the definition for RDF -containers. Note that XML elements are represented using a term of the -format: - -\begin{quote} - \term{element}{Name, [AttrName = Value...], [Content ...]} -\end{quote} - -\begin{code} -memberElt(LI) ::= - \referencedItem(LI). -memberElt(LI) ::= - \inlineItem(LI). - -referencedItem(LI) ::= - element(\rdf(li), - [ \resourceAttr(LI) ], - []). - -inlineItem(literal(LI)) ::= - element(\rdf(li), - [ \parseLiteral ], - LI). -inlineItem(description(description, _, _, Properties)) ::= - element(\rdf(li), - [ \parseResource ], - \propertyElts(Properties)). -inlineItem(LI) ::= - element(\rdf(li), - [], - [\rdf_object(LI)]), !. % inlined object -inlineItem(literal(LI)) ::= - element(\rdf(li), - [], - [LI]). % string value -\end{code} - -Expression in the rule that are prefixed by the \verb$\$ operator acts -as invocation of another rule-set. The body-term is converted into -a term where all rule-references are replaced by variables. The -resulting term is matched and translation of the arguments is achieved -by calling the appropriate rule. Below is the Prolog code for the -{\bf referencedItem} rule: - -\begin{code} -referencedItem(A, element(B, [C], [])) :- - rdf(li, B), - resourceAttr(A, C). -\end{code} - -Additional code can be added using a notation close to the Prolog -DCG notation. Here is the rule for a description, producing -properties both using {\bf propAttrs} and {\bf propertyElts}. - -\begin{code} -description(description, About, BagID, Properties) ::= - element(\rdf('Description'), - \attrs([ \?idAboutAttr(About), - \?bagIdAttr(BagID) - | \propAttrs(PropAttrs) - ]), - \propertyElts(PropElts)), - { !, append(PropAttrs, PropElts, Properties) - }. -\end{code} - - -\section{Predicates} - -The parser is designed to operate in various environments and therefore -provides interfaces at various levels. First we describe the top level -defined in \pllib{rdf}, simply parsing a RDF-XML file into a list of -triples. Please note these are {\em not} asserted into the database -because it is not necessarily the final format the user wishes to reason -with and it is not clean how the user wants to deal with multiple RDF -documents. Some options are using global URI's in one pool, in Prolog -modules or using an additional argument. - -\begin{description} - \predicate{load_rdf}{2}{+File, -Triples} -Same as \term{load_rdf}{File, Triples, []}. - - \predicate{load_rdf}{3}{+File, -Triples, +Options} -Read the RDF-XML file \arg{File} and return a list of \arg{Triples}. -\arg{Options} defines additional processing options. Currently defined -options are: - - \begin{description} - \termitem{base_uri}{BaseURI} -If provided local identifiers and identifier-references are globalised -using this URI. If omited or the atom \verb$[]$, local identifiers are -not tagged. - - \termitem{blank_nodes}{Mode} -If \arg{Mode} is \const{share} (default), blank-node properties (i.e.\ -complex properties without identifier) are reused if they result in -exactly the same triple-set. Two descriptions are shared if their -intermediate description is the same. This means they should produce the -same set of triples in the same order. The value \const{noshare} creates -a new resource for each blank node. - - \termitem{expand_foreach}{Boolean} -If \arg{Boolean} is \const{true}, expand \const{rdf:aboutEach} into -a set of triples. By default the parser generates -\term{rdf}{each(Container), Predicate, Subject}. - - \termitem{lang}{Lang} -Define the initial language (i.e.\ pretend there is an \const{xml:lang} -declaration in an enclosing element). - - \termitem{ignore_lang}{Bool} -If \const{true}, \const{xml:lang} declarations in the document are -ignored. This is mostly for compatibility with older versions of -this library that did not support language identifiers. - - \termitem{convert_typed_literal}{:ConvertPred} -If the parser finds a literal with the \const{rdf:datatype}=\arg{Type} -attribute, call \term{ConvertPred}{+Type, +Content, -Literal}. -\arg{Content} is the XML element contentas returned by the XML -parser (a list). The predicate must unify \arg{Literal} -with a Prolog representation of \arg{Content} according to -\arg{Type} or throw an exception if the conversion cannot be made. - -This option servers two purposes. First of all it can be used -to ignore type declarations for backward compatibility of this -library. Second it can be used to convert typed literals to -a meaningful Prolog representation. E.g.\ convert '42' to the -Prolog integer 42 if the type is \const{xsd:int} or a related -type. - - \termitem{namespaces}{-List} -Unify \arg{List} with a list of \arg{NS}=\arg{URL} for each -encountered \const{xmlns}:\arg{NS}=\arg{URL} declaration found -in the source. - - \termitem{entity}{+Name, +Value} -Overrule entity declaration in file. As it is common practice -to declare namespaces using entities in RDF/XML, this option -allows for changing the namespace without changing the file. -Multiple of these options are allowed. - \end{description} - -The \arg{Triples} list is a list of \term{rdf}{Subject, Predicate, -Object} triples. \arg{Subject} is either a plain resource (an atom), -or one of the terms \term{each}{URI} or \term{prefix}{URI} with the -obvious meaning. \arg{Predicate} is either a plain atom for -explicitely non-qualified names or a term -\mbox{\arg{NameSpace}{\bf :}\arg{Name}}. If \arg{NameSpace} is the -defined RDF name space it is returned as the atom \const{rdf}. -Finally, \arg{Object} is a URI, a \arg{Predicate} or a term of the -format \term{literal}{Value} for literal values. \arg{Value} is -either a plain atom or a parsed XML term (list of atoms and elements). -\end{description} - - -\subsection{RDF Object representation} \label{sec:rdfobject} - -The \emph{Object} (3rd) part of a triple can have several different -types. If the object is a resource it is returned as either a plain -atom or a term \mbox{\arg{NameSpace}{\bf :}\arg{Name}}. If it is a -literal it is returned as \term{literal}{Value}, where \arg{Value} -takes one of the formats defined below. - -\begin{itemlist} - \item [An atom] -If the literal \arg{Value} is a plain atom is a literal value not -subject to a datatype or \const{xml:lang} qualifier. - - \item [\term{lang}{LanguageID, Atom}] -If the literal is subject to an \const{xml:lang} qualifier -\arg{LanguageID} specifies the language and \arg{Atom} the -actual text. - - \item [A list] -If the literal is an XML literal as created by -\mbox{parseType="Literal"}, the raw output of the XML parser for the -content of the element is returned. This content is a list of -\term{element}{Name, Attributes, Content} and atoms for CDATA parts as -described with the SWI-Prolog \url[SGML/XML -parser]{http://www.swi-prolog.org/packages/sgml2pl.html} - - \item [\term{type}{Type, StringValue}] -If the literal has an \verb$rdf:datatype=$\arg{Type} a term of this -format is returned. -\end{itemlist} - - -\subsection{Name spaces} - -XML name spaces are identified using a URI. Unfortunately various URI's -are in common use to refer to RDF. The \file{rdf_parser.pl} module -therefore defines the namespace as a multifile/1 predicate, that can be -extended by the user. For example, to parse the \url[Netscape -OpenDirectory]{http://www.mozilla.org/rdf/doc/inference.html} -\file{structure.rdf} file, the following declarations are used: - -\begin{code} -:- multifile - rdf_parser:rdf_name_space/1. - -rdf_parser:rdf_name_space('http://www.w3.org/TR/RDF/'). -rdf_parser:rdf_name_space('http://directory.mozilla.org/rdf'). -rdf_parser:rdf_name_space('http://dmoz.org/rdf'). -\end{code} - -The initial definition of this predicate is given below. - -\begin{code} -rdf_name_space('http://www.w3.org/1999/02/22-rdf-syntax-ns#'). -rdf_name_space('http://www.w3.org/TR/REC-rdf-syntax'). -\end{code} - - -\subsection{Low-level access} - -The above defined load_rdf/[2,3] is not always suitable. For example, it -cannot deal with documents where the RDF statement is embedded in an XML -document. It also cannot deal with really large documents (e.g.\ the -Netscape OpenDirectory project, currently about 90 MBytes), without huge -amounts of memory. - -For really large documents, the {\bf sgml2pl} parser can be programmed -to handle the content of a specific element (i.e. \elem{rdf:RDF}) -element-by-element. The parsing primitives defined in this section -can be used to process these one-by-one. - -\begin{description} - \predicate{xml_to_rdf}{3}{+XML, +BaseURI, -Triples} -Process an XML term produced by load_structure/3 using the -\term{dialect}{xmlns} output option. \arg{XML} is either -a complete \elem{rdf:RDF} element, a list of RDF-objects -(container or description) or a single description of container. - - \predicate{process_rdf}{3}{+Input, :OnTriples, +Options} - -Exploits the call-back interface of {\bf sgml2pl}, calling -\term{\arg{OnTriples}}{Triples, File:Line} with the list of triples -resulting from a single top level RDF object for each RDF element in the -input as well as the source-location where the description started. -\arg{Input} is either a file name or term \term{stream}{Stream}. When -using a stream all triples are associated to the value of the -\const{base_uri} option. This predicate can be used to process arbitrary -large RDF files as the file is processed object-by-object. The example -below simply asserts all triples into the database: - -\begin{code} -assert_list([], _). -assert_list([H|T], Source) :- - assert(H), - assert_list(T, Source). - -?- process_rdf('structure,rdf', assert_list, []). -\end{code} - -\arg{Options} are described with load_rdf/3. The option -\const{expand_foreach} is not supported as the container may be in a -different description. Additional it provides \const{embedded}: - - \begin{description} - \termitem{embedded}{Boolean} -The predicate process_rdf/3 processes arbitrary XML documents, only -interpreting the content of \const{rdf:RDF} elements. If this option -is \const{false} (default), it gives a warning on elements that are -not processed. The option \term{embedded}{true} can be used to -process RDF embedded in \jargon{xhtml} without warnings. - \end{description} - -\end{description} - - - - -\section{Writing RDF graphs} - -The library \pllib{rdf_write} provides the inverse of load_rdf/2 using -the predicate rdf_write_xml/2. In most cases the RDF parser is used in -combination with the Semweb package providing \pllib{semweb/rdf_db}. -This library defines rdf_save/2 to save a named RDF graph from the -database to a file. This library writes a list of rdf terms to a stream. -It has been developed for the SeRQL server which computes an RDF graph -that needs to be transmitted in an HTTP request. As we see this as a -typical use-case scenario the library only provides writing to a stream. - -\begin{description} - \predicate{rdf_write_xml}{2}{+Stream, +Triples} -Write an RDF/XML document to \arg{Stream} from the list of \arg{Triples}. -\arg{Stream} must use one of the following Prolog stream encodings: -\const{ascii}, \const{iso_latin_1} or \const{utf8}. Characters that -cannot be represented in the encoding are represented as XML entities. -Using ASCII is a good idea for documents that can be represented almost -completely in ASCII. For more international documents using UTF-8 creates -a more compact document that is easier to read. - -\begin{code} -rdf_write(File, Triples) :- - open(File, write, Out, [encoding(utf8)]), - call_cleanup(rdf_write_xml(Out, Triples), - close(Out)). -\end{code} -\end{description} - - -\section{Testing the RDF translator} - -A test-suite and driver program are provided by \file{rdf_test.pl} in -the source directory. To run these tests, load this file into Prolog in -the distribution directory. The test files are in the directory -\file{suite} and the proper output in \file{suite/ok}. Predicates -provided by \file{rdf_test.pl}: - -\begin{description} - \predicate{suite}{1}{+N} -Run test \arg{N} using the file \file{suite/tN.rdf} and display the -RDF source, the intermediate Prolog representation and the resulting -triples. - \predicate{passed}{1}{+N} -Process \file{suite/tN.rdf} and store the resulting triples in -\file{suite/ok/tN.pl} for later validation by test/0. - \predicate{test}{0}{} -Run all tests and classify the result. -\end{description} - -\appendix - -\section{Metrics} - -It took three days to write and one to document the Prolog RDF parser. -A significant part of the time was spent understanding the RDF -specification. - -The size of the source (including comments) is given in the table -below. - -\begin{center} -\begin{tabular}{|rrr|l|l|} -\hline -\bf lines & \bf words & \bf bytes & \bf file & \bf function \\ -\hline - 109 & 255 & 2663 & rdf.pl & Driver program \\ - 312 & 649 & 6416 & rdf_parser.pl & 1-st phase parser \\ - 246 & 752 & 5852 & rdf_triple.pl & 2-nd phase parser \\ - 126 & 339 & 2596 & rewrite.pl & rule-compiler \\ -\hline - 793 & 1995 & 17527 & total & \\ -\hline -\end{tabular} -\end{center} - - -We also compared the performance using an RDF-Schema file generated by -\url[Protege-2000]{http://www.smi.stanford.edu/projects/protege/} and -interpreted as RDF. This file contains 162 descriptions in 50 Kbytes, -resulting in 599 triples. Environment: Intel Pentium-II/450 with -384 Mbytes memory running SuSE Linux 6.3. - -The parser described here requires 0.15 seconds excluding 0.13 seconds -Prolog startup time to process this file. The \url[Pro -Solutions]{http://www.pro-solutions.com/rdfdemo/} parser (written in -Perl) requires 1.5 seconds exluding 0.25 seconds startup time. - - -\section{Installation} - -\subsection{Unix systems} - -Installation on Unix system uses the commonly found {\em configure}, -{\em make} and {\em make install} sequence. SWI-Prolog should be -installed before building this package. If SWI-Prolog is not installed -as \program{pl}, the environment variable \env{PL} must be set to the -name of the SWI-Prolog executable. Installation is now accomplished -using: - -\begin{code} -% ./configure -% make -% make install -\end{code} - -This installs the Prolog library files in \file{$PLBASE/library}, where -\file{$PLBASE} refers to the SWI-Prolog `home-directory'. - -\subsection{Windows} - -Run the file \file{setup.pl} by double clicking it. This will install -the required files into the SWI-Prolog directory and update the -library directory. - -\end{document} - - diff --git a/packages/RDF/rdf_diagram.pl b/packages/RDF/rdf_diagram.pl deleted file mode 100644 index 7eb56e3d5..000000000 --- a/packages/RDF/rdf_diagram.pl +++ /dev/null @@ -1,509 +0,0 @@ -/* Part of SWI-Prolog - - Author: Jan Wielemaker - E-mail: J.Wielemaker@uva.nl - WWW: http://www.swi-prolog.org - Copyright (C): 2010, University of Amsterdam - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - As a special exception, if you link this library with other files, - compiled with a Free Software compiler, to produce an executable, this - library does not by itself cause the resulting executable to be covered - by the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -:- module(rdf_diagram, - [ rdf_diagram_from_file/1 % +File - ]). -:- use_module(library(pce)). -:- use_module(library(pce_tagged_connection)). -:- use_module(library(autowin)). -:- use_module(library(pce_report)). -:- use_module(library(print_graphics)). -:- use_module(library(rdf_parser)). % get access to declared namespaces - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -This file defines the class rdf_diagram, a window capable of showing a -set of triples. - -The predicate rdf_diagram_from_file(+File) is a simple demo and useful -tool to show RDF from simple RDF files. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - - - /******************************* - * SIMPLE ENTRY * - *******************************/ - -% rdf_diagram_from_file(+File) -% -% Show the triples from File in a window. - -rdf_diagram_from_file(File) :- - absolute_file_name(File, - [ access(read), - extensions([rdf,rdfs,owl,'']) - ], AbsFile), - load_rdf(AbsFile, Triples, - [ expand_foreach(true) - ]), - new(D, rdf_diagram(string('RDF diagram for %s', File))), - send(new(report_dialog), below, D), - send(D, triples, Triples), - send(D, open). - - - /******************************* - * CLASS RDF-DIAGRAM * - *******************************/ - -:- pce_begin_class(rdf_diagram, auto_sized_picture, - "Show set of RDF triples in a window"). -:- use_class_template(print_graphics). - -variable(auto_layout, bool := @on, both, "Automatically layout on resize"). -variable(type_in_node, bool := @on, both, "Display type inside node"). - -initialise(D, Label:[name]) :-> - send_super(D, initialise, Label), - send(D, scrollbars, both), - send(D, fill_popup), - send(D, resize_message, - if(and(D?auto_layout == @on, - D?focus_recogniser == @nil), - message(D, layout))). - -fill_popup(D) :-> - send(D, popup, new(P, popup)), - send_list(P, append, - [ menu_item(layout, message(D, layout)), - gap, - menu_item(print, message(D, print)) - ]). - -:- pce_group(triples). - -append(D, Triple:prolog) :-> - "Append and rdf(Subject, Predicate, Object) triple":: - ( subject_name(Triple, SubjectName), - get(D, resource, SubjectName, Subject), - ( get(D, type_in_node, @on), - is_type(Triple) - -> object_resource(Triple, ObjectName), - send(Subject, type, ObjectName) - ; predicate_name(Triple, PredName), - ( object_resource(Triple, ObjectName) - -> get(D, resource, ObjectName, Object) - ; object_literal(Triple, Literal) - -> get(D, literal, Literal, Object) - ), - send(Subject, connect, PredName, Object) - ) - -> true - ; term_to_atom(Triple, Atom), - ignore(send(D, report, error, - 'Failed to display triple: %s', Atom)) - ). - -triples(D, Triples:prolog) :-> - "Show disgram from Prolog triples":: - send(D, clear), - forall(member(T, Triples), - send(D, append, T)), - send(D, layout). - -resource(D, Resource:name) :-> - "Add Resource to diagram":: - get(D, resource, Resource, @on, _). - -resource(D, Resource:name, Create:[bool], Subject:rdf_resource) :<- - "Get reference for a subject or create one":: - ( get(D, member, Resource, Subject) - -> true - ; Create \== @off, - get(D, create_resource, Resource, Subject), - send(D, display, Subject, D?visible?center) - ). - -literal(D, Value:prolog, Gr:rdf_literal) :<- - "Display a literal. Don't try to re-use":: - ( literal_name(Value, Name), - get(D, member, Name, Gr) - -> true - ; get(D, create_literal, Value, Gr), - send(D, display, Gr, D?visible?center) - ). - - -create_resource(D, Resource:name, Subject:rdf_resource) :<- - "Create visualisation of Resource":: - new(Subject, rdf_resource(Resource, D)). - - -create_literal(_D, Value:prolog, Gr:rdf_literal) :<- - "Create visualisation of literal":: - new(Gr, rdf_literal(Value)). - - -node_label(_D, Resource:name, Label:name) :<- - "Generate label to show for a node":: - local_name(Resource, Label). - - -:- pce_group(layout). - -layout(D) :-> - "Produce automatic layout":: - new(Nodes, chain), - send(D?graphicals, for_all, - if(message(@arg1, instance_of, rdf_any), - message(Nodes, append, @arg1))), - send(Nodes?head, layout, 2, 40, - iterations := 200, - area := D?visible, - network := Nodes). - -copy_layout(D, From:rdf_diagram, Subst:prolog) :-> - "Copy the layout from another windows":: - send(D?graphicals, for_some, - message(D, copy_location, @arg1, From, prolog(Subst))). - -copy_location(_D, Obj:graphical, From:rdf_diagram, Subst:prolog) :-> - "Copy location of a single RDF object":: - ( send(Obj, instance_of, rdf_any) - -> ( get(Obj, name, Name), - find(From, Name, Subst, FromObj) - -> format('Copied location of ~p from ~p~n', [Obj, FromObj]), - get(FromObj, center, Center), - send(Obj, center, Center) - ) - ; true - ). - -find(D, Name, _Subst, Obj) :- - get(D, member, Name, Obj). -find(D, Name, Subst, Obj) :- - member(Name=AltName, Subst), - atom_concat('_:', AltName, FullAltName), - get(D, member, FullAltName, Obj). -find(D, Name, Subst, _) :- - format('Cannot find ~w in ~p, Subst =~n', [Name, D]), - pp(Subst), - fail. - - -:- pce_end_class(rdf_diagram). - - - /******************************* - * SHAPES * - *******************************/ - -:- pce_begin_class(rdf_connection, tagged_connection, - "Represents a triple"). - -:- pce_global(@rdf_link, new(link(link, link, - line(0,0,0,0,second)))). - -initialise(C, Gr1:graphical, Gr2:graphical, Pred:name, Ctx:[object]) :-> - "Create from predicate":: - send_super(C, initialise, Gr1, Gr2, @rdf_link), - send(C, tag, rdf_label(Pred, italic, Ctx)). - -ideal_length(C, Len:int) :<- - "Layout: compute the desired length":: - get(C, height, H), - ( H < 40 - -> get(C, tag, Tag), - get(Tag, width, W), - Len is W + 30 - ; Len = 40 - ). - -:- pce_end_class(rdf_connection). - -:- pce_begin_class(rdf_any(name), figure, - "Represent an RDF resource or literal"). - -handle(w/2, 0, link, north). -handle(w, h/2, link, east). -handle(w/2, h, link, south). -handle(0, h/2, link, west). - -initialise(F, Ref:name) :-> - "Create visualisation":: - send_super(F, initialise), - send(F, name, Ref). - -connect(F, Pred:name, Object:graphical) :-> - new(_C, rdf_connection(F, Object, Pred, F)). - -:- pce_global(@rdf_any_recogniser, - make_rdf_any_recogniser). -:- pce_global(@rdf_any_popup, - make_rdf_any_popup). - -make_rdf_any_recogniser(G) :- - new(M1, move_gesture(left)), - new(M2, move_network_gesture(left, c)), - new(P, popup_gesture(@receiver?popup)), - new(G, handler_group(M1, M2, P)). - -popup(_F, Popup:popup) :<- - "Create popup menu":: - Popup = @rdf_any_popup. - -make_rdf_any_popup(Popup) :- - new(Popup, popup), - Gr = @arg1, - send(Popup, append, - menu_item(layout, message(Gr, layout))). - -event(F, Ev:event) :-> - ( \+ send(Ev, is_a, ms_right_down), - send_super(F, event, Ev) - -> true - ; send(@rdf_any_recogniser, event, Ev) - ). - -node_label(F, Resource:name, Label:name) :<- - "Return label to use for a resource":: - get(F, device, Dev), - ( send(Dev, has_get_method, node_label) - -> get(Dev, node_label, Resource, Label) - ; local_name(Resource, Label) - ). - -:- pce_end_class(rdf_any). - - -:- pce_begin_class(move_network_gesture, move_gesture, - "Move network of connected graphicals"). - -variable(outline, box, get, - "Box used to indicate move"). -variable(network, chain*, both, - "Stored value of the network"). -variable(origin, point, get, - "Start origin of network"). - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -The gesture maintains an outline, the selection to be moved and the -positon where the move orginiated. The outline itself is given a -normal move_gesture to make it move on dragging. This move_gesture -should operate on the same button and modifier. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -initialise(G, B:[button_name], M:[modifier]) :-> - send(G, send_super, initialise, B, M), - send(G, slot, outline, new(Box, box(0,0))), - send(G, slot, origin, point(0,0)), - send(Box, texture, dotted), - send(Box, recogniser, move_gesture(G?button, G?modifier)). - -initiate(G, Ev:event) :-> - get(Ev, receiver, Gr), - get(Gr, device, Dev), - get(G, outline, Outline), - get(Gr, network, Network), - send(G, network, Network), - new(Union, area(0,0,0,0)), - send(Network, for_all, message(Union, union, @arg1?area)), - send(G?origin, copy, Union?position), - send(Outline, area, Union), - send(Union, done), - send(Dev, display, Outline), - ignore(send(Ev, post, Outline)). - -drag(G, Ev) :-> - send(Ev, post, G?outline). - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Terminate. First undisplay the outline. Next calculate by how much -the outline has been dragged and move all objects of the selection by -this amount. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -terminate(G, Ev:event) :-> - ignore(send(G, drag, Ev)), - get(G, outline, Outline), - send(Outline, device, @nil), - get(Outline?area?position, difference, G?origin, Offset), - get(G, network, Network), - send(Network, for_all, message(@arg1, relative_move, Offset)), - send(G, network, @nil). - -:- pce_end_class(move_network_gesture). - - - -:- pce_begin_class(rdf_label, text, - "Label for an RDF relation"). - -variable(resource, name, get, "Represented predicate"). - -initialise(L, Pred:name, Font:font, Context:[object]) :-> - ( Context == @default - -> local_name(Pred, Label) - ; get(Context, node_label, Pred, Label) - ), - send_super(L, initialise, Label, center, Font), - send(L, slot, resource, Pred), - send(L, background, @default). - -:- pce_global(@rdf_label_recogniser, - make_rdf_label_recogniser). - -make_rdf_label_recogniser(G) :- - new(G, handler_group), - send(G, append, - handler(area_enter, message(@receiver, identify))), - send(G, append, - handler(area_exit, message(@receiver, report, status, ''))), - send(G, append, popup_gesture(new(P, popup))), - send_list(P, append, - [ menu_item(copy, - message(@display, copy, @arg1?resource)) - ]). - -event(F, Ev:event) :-> - ( send_super(F, event, Ev) - -> true - ; send(@rdf_label_recogniser, event, Ev) - ). - -identify(L) :-> - send(L, report, status, '%s', L?resource). - -:- pce_end_class. - - - -:- pce_begin_class(rdf_resource, rdf_any, - "Represent an RDF resource"). - -initialise(F, Ref:name, Ctx:[object]) :-> - "Create visualisation":: - send_super(F, initialise, Ref), - send(F, display, ellipse(100, 50), point(-50,-25)), - send(F, display, new(T, rdf_label(Ref, normal, Ctx))), - send(T, center, point(0,0)). - -type(F, Type:name) :-> - send(F, display, new(TL, rdf_label(Type, small, F))), - send(TL, center, point(0,14)), - get(F, member, ellipse, E), - send(E, shadow, 2). - -identify(F) :-> - send(F, report, status, 'Resource %s', F?name). - -:- pce_end_class(rdf_resource). - - -:- pce_begin_class(rdf_literal, rdf_any, - "Represent an RDF literal value"). - -variable(value, prolog, get, "Represented literal value"). - -initialise(F, Value:prolog) :-> - "Create visualisation":: - send(F, slot, value, Value), - literal_label(Value, Label), - atom_concat('__lit:', Label, Id), - send_super(F, initialise, Id), - send(F, display, new(B, box)), - send(B, fill_pattern, colour(grey80)), - send(B, pen, 0), - send(F, display, new(T, text(Label, center))), - send(T, center, point(0,0)), - send(F, fit). - -literal_label(literal(Value0), Value) :- !, - literal_label(Value0, Value). -literal_label(xml(Value0), Value) :- !, - literal_label(Value0, Value). -literal_label(Value, Value) :- - atomic(Value), !. -literal_label(Value, Label) :- - term_to_atom(Value, Label). - -literal_name(Value, Name) :- - literal_label(Value, Label), - atom_concat('__lit:', Label, Name). - -fit(F) :-> - "Make box fit contents":: - get(F, member, text, Text), - get(Text?area, clone, Area), - send(Area, increase, 3), - get(F, member, box, Box), - send(Box, area, Area). - -:- pce_end_class(rdf_literal). - - - - - - - /******************************* - * PRIMITIVES * - *******************************/ - -subject_name(rdf(Name0, _, _), Name) :- - resource_name(Name0, Name). -predicate_name(rdf(_, Name0, _), Name) :- - resource_name(Name0, Name). -object_resource(rdf(_, _, Name0), Name) :- - resource_name(Name0, Name). -object_literal(rdf(_,_,Literal), Literal). - - -resource_name(Name, Name) :- - atom(Name), !. -resource_name(rdf:Local, Name) :- !, % known namespaces - atomic_list_concat([rdf, :, Local], Name). -resource_name(NS:Local, Name) :- !, - atom_concat(NS, Local, Name). -resource_name(node(Anon), Name) :- % Not for predicates - atom_concat('_:', Anon, Name). - -is_type(rdf(_, rdf:type, _)) :- !. % our parser -is_type(rdf(_, Pred, _)) :- % our parser - atom(Pred), - rdf_name_space(NS), - atom_concat(NS, type, Pred), !. - -% local_name(+Resource, -Label) -% -% Return easy readable local name - -local_name(Resource, Local) :- - sub_atom(Resource, _, _, A, #), - sub_atom(Resource, _, A, 0, Local), - \+ sub_atom(Local, _, _, _, #), !. -local_name(Resource, Local) :- - atom_concat('rdf:', Local, Resource), !. -local_name(Resource, Local) :- - file_base_name(Resource, Local), - Local \== ''. -local_name(Resource, Resource). - diff --git a/packages/RDF/rdf_ntriples.pl b/packages/RDF/rdf_ntriples.pl deleted file mode 100644 index b930e30f9..000000000 --- a/packages/RDF/rdf_ntriples.pl +++ /dev/null @@ -1,342 +0,0 @@ -/* Part of SWI-Prolog - - Author: Jan Wielemaker - E-mail: J.Wielemaker@uva.nl - WWW: http://www.swi-prolog.org - Copyright (C): 2010, University of Amsterdam - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - As a special exception, if you link this library with other files, - compiled with a Free Software compiler, to produce an executable, this - library does not by itself cause the resulting executable to be covered - by the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -:- module(rdf_ntriples, - [ load_rdf_ntriples/2, % +File, -Triples - rdf_ntriple_part/4 % +Field, -Value, - ]). - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -This module parses n-triple files as defined by the W3C RDF working in -http://www.w3.org/TR/rdf-testcases/#ntriples. This format is a -simplified version of the RDF N3 notation used in the *.nt files that -are used to describe the normative outcome of the RDF test-cases. - -The returned list terms are of the form - - rdf(Subject, Predicate, Object) - -where - - # Subject - is an atom or node(Id) for anonymous nodes - - # Predicate - is an atom - - # Object - is an atom, node(Id), literal(Atom) or xml(Atom) -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - - -% load_rdf_ntriples(+Source, -Triples) -% -% Load a file or stream to a list of rdf(S,P,O) triples. - -load_rdf_ntriples(File, Triples) :- - open_nt_file(File, In, Close), - call_cleanup(stream_to_triples(In, Triples), Close). - -% open_nt_file(+Input, -Stream, -Close) -% -% Open Input, returning Stream and a goal to cleanup Stream if it -% was opened. - -open_nt_file(stream(Stream), Stream, true) :- !. -open_nt_file(Stream, Stream, true) :- - is_stream(Stream), !. -open_nt_file(Spec, Stream, close(Stream)) :- - absolute_file_name(Spec, - [ access(read), - extensions([nt,'']) - ], Path), - open(Path, read, Stream). - - -% rdf_ntriple_part(+Type, -Value, ) -% -% Parse one of the fields of an ntriple. This is used for the -% SWI-Prolog Sesame (www.openrdf.org) implementation to realise -% /servlets/removeStatements. I do not think public use of this -% predicate should be stimulated. - -rdf_ntriple_part(subject, Subject) --> - subject(Subject). -rdf_ntriple_part(predicate, Predicate) --> - predicate(Predicate). -rdf_ntriple_part(object, Object) --> - predicate(Object). - - -% stream_to_triples(+Stream, -ListOfTriples) -% -% Read Stream, returning all its triples - -stream_to_triples(In, Triples) :- - read_line_to_codes(In, Line), - ( Line == end_of_file - -> Triples = [] - ; phrase(line(Triples, Tail), Line), - stream_to_triples(In, Tail) - ). - -line(Triples, Tail) --> - wss, - ( comment - -> {Triples = Tail} - ; triple(Triple) - -> {Triples = [Triple|Tail]} - ). - -comment --> - "#", !, - skip_rest. -comment --> - end_of_input. - -triple(rdf(Subject, Predicate, Object)) --> - subject(Subject), ws, wss, - predicate(Predicate), ws, wss, - object(Object), wss, ".", wss. - -subject(Subject) --> - uniref(Subject), !. -subject(Subject) --> - node_id(Subject). - -predicate(Predicate) --> - uniref(Predicate). - -object(Object) --> - uniref(Object), !. -object(Object) --> - node_id(Object). -object(Object) --> - literal(Object). - - -uniref(URI) --> - "<", - escaped_uri_codes(Codes), - ">", !, - { atom_codes(URI, Codes) - }. - -node_id(node(Id)) --> % anonymous nodes - "_:", - name_start(C0), - name_codes(Codes), - { atom_codes(Id, [C0|Codes]) - }. - -literal(Literal) --> - lang_string(Literal), !. -literal(Literal) --> - xml_string(Literal). - - -% name_start(-Code) -% name_codes(-ListfCodes) -% -% Parse identifier names - -name_start(C) --> - [C], - { code_type(C, alpha) - }. - -name_codes([C|T]) --> - [C], - { code_type(C, alnum) - }, !, - name_codes(T). -name_codes([]) --> - []. - - -% escaped_uri_codes(-CodeList) -% -% Decode string holding %xx escaped characters. - -escaped_uri_codes([]) --> - []. -escaped_uri_codes([C|T]) --> - "%", [D0,D1], !, - { code_type(D0, xdigit(V0)), - code_type(D1, xdigit(V1)), - C is V0<<4 + V1 - }, - escaped_uri_codes(T). -escaped_uri_codes([C|T]) --> - "\\u", [D0,D1,D2,D3], !, - { code_type(D0, xdigit(V0)), - code_type(D1, xdigit(V1)), - code_type(D2, xdigit(V2)), - code_type(D3, xdigit(V3)), - C is V0<<12 + V1<<8 + V2<<4 + V3 - }, - escaped_uri_codes(T). -escaped_uri_codes([C|T]) --> - "\\U", [D0,D1,D2,D3,D4,D5,D6,D7], !, - { code_type(D0, xdigit(V0)), - code_type(D1, xdigit(V1)), - code_type(D2, xdigit(V2)), - code_type(D3, xdigit(V3)), - code_type(D4, xdigit(V4)), - code_type(D5, xdigit(V5)), - code_type(D6, xdigit(V6)), - code_type(D7, xdigit(V7)), - C is V0<<28 + V1<<24 + V2<<20 + V3<<16 + - V4<<12 + V5<<8 + V6<<4 + V7 - }, - escaped_uri_codes(T). -escaped_uri_codes([C|T]) --> - [C], - escaped_uri_codes(T). - - -% lang_string() -% -% Process a language string - -lang_string(String) --> - "\"", - string(Codes), - "\"", !, - { atom_codes(Atom, Codes) - }, - ( langsep - -> language(Lang), - { String = literal(lang(Lang, Atom)) - } - ; "^^" - -> uniref(Type), - { String = literal(type(Type, Atom)) - } - ; { String = literal(Atom) - } - ). - -langsep --> - "-". -langsep --> - "@". - -% xml_string(String) -% -% Handle xml"..." - -xml_string(xml(String)) --> - "xml\"", % really no whitespace? - string(Codes), - "\"", - { atom_codes(String, Codes) - }. - -string([]) --> - []. -string([C0|T]) --> - string_char(C0), - string(T). - -string_char(0'\\) --> - "\\\\". -string_char(0'") --> - "\\\"". -string_char(10) --> - "\\n". -string_char(13) --> - "\\r". -string_char(9) --> - "\\t". -string_char(C) --> - "\\u", - '4xdigits'(C). -string_char(C) --> - "\\U", - '4xdigits'(C0), - '4xdigits'(C1), - { C is C0<<16 + C1 - }. -string_char(C) --> - [C]. - -'4xdigits'(C) --> - [C0,C1,C2,C3], - { code_type(C0, xdigit(V0)), - code_type(C1, xdigit(V1)), - code_type(C2, xdigit(V2)), - code_type(C3, xdigit(V3)), - - C is V0<<12 + V1<<8 + V2<<4 + V3 - }. - -% language(-Lang) -% -% Return xml:lang language identifier. - -language(Lang) --> - lang_code(C0), - lang_codes(Codes), - { atom_codes(Lang, [C0|Codes]) - }. - -lang_code(C) --> - [C], - { C \== 0'., - \+ code_type(C, white) - }. - -lang_codes([C|T]) --> - lang_code(C), !, - lang_codes(T). -lang_codes([]) --> - []. - - - /******************************* - * BASICS * - *******************************/ - -skip_rest(_,[]). - -ws --> - [C], - { code_type(C, white) - }. - -end_of_input([], []). - - -wss --> - ws, !, - wss. -wss --> - []. diff --git a/packages/RDF/rdf_parser.pl b/packages/RDF/rdf_parser.pl deleted file mode 100644 index e3e312d14..000000000 --- a/packages/RDF/rdf_parser.pl +++ /dev/null @@ -1,632 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog - - Author: Jan Wielemaker - E-mail: J.Wielemaker@cs.vu.nl - WWW: http://www.swi-prolog.org - Copyright (C): 2002-2009, University of Amsterdam - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - As a special exception, if you link this library with other files, - compiled with a Free Software compiler, to produce an executable, this - library does not by itself cause the resulting executable to be covered - by the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -:- module(rdf_parser, - [ xml_to_plrdf/3, % +XMLTerm, -RDFTerm, +State - element_to_plrdf/3, % +ContentList, -RDFTerm, +State - make_rdf_state/3, % +Options, -State, -RestOptions - rdf_modify_state/3, % +XMLAttrs, +State0, -State - rdf_name_space/1 - ]). -:- use_module(rewrite). -:- use_module(library(sgml)). % xml_name/1 -:- use_module(library(lists)). -:- use_module(library(uri)). -:- use_module(library(record)). - -:- op(500, fx, \?). % Optional (attrs) - -term_expansion(F, T) :- rew_term_expansion(F, T). -goal_expansion(F, T) :- rew_goal_expansion(F, T). - -goal_expansion(attrs(Attrs, List), Goal) :- - translate_attrs(List, Attrs, Goal). - -translate_attrs(Var, Attrs, rewrite(Var, Attrs)) :- - var(Var), !. -translate_attrs([], _, true) :- !. -translate_attrs([H], Attrs, Goal) :- !, - ( var(H) - -> Goal = rewrite(H, Attrs) - ; H = \?Optional - -> Goal = ( member(A, Attrs), - OptRewrite - -> true - ; true - ), - expand_goal(rewrite(\Optional, A), OptRewrite) - ; Goal = ( member(A, Attrs), - Rewrite - -> true - ), - expand_goal(rewrite(H, A), Rewrite) - ). -translate_attrs([H|T], Attrs0, (G0, G1)) :- !, - ( var(H) - -> G0 = rewrite(H, Attrs0), - Attrs1 = Attrs0 - ; H = \?Optional - -> G0 = ( select(A, Attrs0, Attrs1), - OptRewrite - -> true - ; Attrs1 = Attrs0 - ), - expand_goal(rewrite(\Optional, A), OptRewrite) - ; G0 = ( select(A, Attrs0, Attrs1), - Rewrite - ), - expand_goal(rewrite(H, A), Rewrite) - ), - translate_attrs(T, Attrs1, G1). -translate_attrs(Rule, Attrs, Goal) :- - expand_goal(rewrite(Rule, Attrs), Goal). - - -:- multifile rdf_name_space/1. -:- dynamic rdf_name_space/1. - -%% rdf_name_space(?URL) is nondet. -% -% True if URL must be handled as rdf: Determines special handling -% of rdf:about, rdf:resource, etc. - - -rdf_name_space('http://www.w3.org/1999/02/22-rdf-syntax-ns#'). -rdf_name_space('http://www.w3.org/TR/REC-rdf-syntax'). - - -:- record - rdf_state(base_uri='', - lang='', - ignore_lang=false, - convert_typed_literal). - - -%% xml_to_plrdf(+RDFElementOrObject, -RDFTerm, +State) -% -% Translate an XML (using namespaces) term into an Prolog term -% representing the RDF data. This term can then be fed into -% rdf_triples/[2,3] to create a list of RDF triples. State is an -% instance of an rdf_state record. - -xml_to_plrdf(Element, RDF, State) :- - ( is_list(Element) - -> rewrite(\xml_content_objects(RDF, State), Element) - ; rewrite(\xml_objects(RDF, State), Element) - ). - -%% element_to_plrdf(+DOM, -RDFTerm, +State) -% -% Rewrite a single XML element. - -element_to_plrdf(Element, RDF, State) :- - rewrite(\nodeElementList(RDF, State), [Element]). - -xml_objects(Objects, Options0) ::= - E0, - { modify_state(E0, Options0, E, Options), !, - rewrite(\xml_objects(Objects, Options), E) - }. -xml_objects(Objects, Options) ::= - element((\rdf('RDF'), !), - _, - \nodeElementList(Objects, Options)), - !. -xml_objects(Objects, Options) ::= - element(_, _, \xml_content_objects(Objects, Options)). - -xml_content_objects([], _) ::= - []. -xml_content_objects([H|T], Options) ::= - [ \xml_objects(H, Options) - | \xml_content_objects(T, Options) - ]. - - -nodeElementList([], _Options) ::= - [], !. -nodeElementList(L, Options) ::= - [ (\ws, !) - | \nodeElementList(L, Options) - ]. -nodeElementList([H|T], Options) ::= - [ \nodeElementOrError(H, Options) - | \nodeElementList(T, Options) - ]. - -nodeElementOrError(H, Options) ::= - \nodeElement(H, Options), !. -nodeElementOrError(unparsed(Data), _Options) ::= - Data. - -nodeElement(description(Type, About, Properties), Options) ::= - \description(Type, About, Properties, Options). - - - /******************************* - * DESCRIPTION * - *******************************/ - -description(Type, About, Properties, Options0) ::= - E0, - { modify_state(E0, Options0, E, Options), !, - rewrite(\description(Type, About, Properties, Options), E) - }. -description(description, About, Properties, Options) ::= - element(\rdf('Description'), - \attrs([ \?idAboutAttr(About, Options) - | \propAttrs(PropAttrs, Options) - ]), - \propertyElts(PropElts, Options)), - { !, append(PropAttrs, PropElts, Properties) - }. -description(Type, About, Properties, Options) ::= - element(\name_uri(Type, Options), - \attrs([ \?idAboutAttr(About, Options) - | \propAttrs(PropAttrs, Options) - ]), - \propertyElts(PropElts, Options)), - { append(PropAttrs, PropElts, Properties) - }. - -propAttrs([], _) ::= - [], !. -propAttrs([H|T], Options) ::= - [ \propAttr(H, Options) - | \propAttrs(T, Options) - ]. - -propAttr(rdf:type = URI, Options) ::= - \rdf_or_unqualified(type) = \value_uri(URI, Options), !. -propAttr(Name = Literal, Options) ::= - Name = Value, - { mkliteral(Value, Literal, Options) - }. - -propertyElts([], _) ::= - [], !. -propertyElts(Elts, Options) ::= - [ (\ws, !) - | \propertyElts(Elts, Options) - ]. -propertyElts([H|T], Options) ::= - [ \propertyElt(H, Options) - | \propertyElts(T, Options) - ]. - -propertyElt(E, Options) ::= - \propertyElt(Id, Name, Value, Options), - { mkprop(Name, Value, Prop), - ( var(Id) - -> E = Prop - ; E = id(Id, Prop) - ) - }. - -mkprop(NS:Local, Value, rdf:Local = Value) :- - rdf_name_space(NS), !. -mkprop(Name, Value, Name = Value). - - -propertyElt(Id, Name, Value, Options0) ::= - E0, - { modify_state(E0, Options0, E, Options), !, - rewrite(\propertyElt(Id, Name, Value, Options), E) - }. -propertyElt(Id, Name, Value, Options) ::= - \literalPropertyElt(Id, Name, Value, Options), !. - % 5.14 emptyPropertyElt -propertyElt(Id, Name, Value, Options) ::= - element(Name, A, \all_ws), - { !, - rewrite(\emptyPropertyElt(Id, Value, Options), A) - }. - -propertyElt(_, Name, description(description, Id, Properties), Options) ::= - element(Name, - \attrs([ \parseResource, - \?idAboutAttr(Id, Options) - ]), - \propertyElts(Properties, Options)), - !. -propertyElt(_, Name, Literal, Options) ::= - element(Name, - \attrs([ \parseLiteral - ]), - Content), - { !, - literal_value(Content, Literal, Options) - }. -propertyElt(Id, Name, collection(Elements), Options) ::= - element(Name, - \attrs([ \parseCollection, - \?idAttr(Id, Options) - ]), - \nodeElementList(Elements, Options)). -propertyElt(Id, Name, Literal, Options) ::= - element(Name, - \attrs([ \?idAttr(Id, Options) - ]), - [ Value ]), - { atom(Value), !, - mkliteral(Value, Literal, Options) - }. -propertyElt(Id, Name, Value, Options) ::= - element(Name, - \attrs([ \?idAttr(Id, Options) - ]), - \an_rdf_object(Value, Options)), !. -propertyElt(Id, Name, unparsed(Value), Options) ::= - element(Name, - \attrs([ \?idAttr(Id, Options) - ]), - Value). - -literalPropertyElt(Id, Name, Literal, Options) ::= - element(Name, - \attrs([ \typeAttr(Type, Options), - \?idAttr(Id, Options) - ]), - Content), - { typed_literal(Type, Content, Literal, Options) - }. - -emptyPropertyElt(Id, Literal, Options) ::= - \attrs([ \?idAttr(Id, Options), - \?parseLiteral - | \noMoreAttrs - ]), - { !, - mkliteral('', Literal, Options) - }. -emptyPropertyElt(Id, - description(description, About, Properties), - Options) ::= - \attrs([ \?idAttr(Id, Options), - \?aboutResourceEmptyElt(About, Options), - \?parseResource - | \propAttrs(Properties, Options) - ]), !. - -aboutResourceEmptyElt(about(URI), Options) ::= - \resourceAttr(URI, Options), !. -aboutResourceEmptyElt(node(URI), _Options) ::= - \nodeIDAttr(URI). - -%% literal_value(+In, -Value, +Options) -% -% Create the literal value for rdf:parseType="Literal" attributes. -% The content is the Prolog XML DOM tree for the literal. -% -% @tbd Note that the specs demand a canonical textual representation -% of the XML data as a Unicode string. For now the user can -% achieve this using the convert_typed_literal hook. - -literal_value(Value, literal(type(rdf:'XMLLiteral', Value)), _). - -%% mkliteral(+Atom, -Object, +Options) -% -% Translate attribute value Atom into an RDF object using the -% lang(Lang) option from Options. - -mkliteral(Text, literal(Val), Options) :- - atom(Text), - ( rdf_state_lang(Options, Lang), - Lang \== '' - -> Val = lang(Lang, Text) - ; Val = Text - ). - -%% typed_literal(+Type, +Content, -Literal, +Options) -% -% Handle a literal attribute with rdf:datatype=Type qualifier. NB: -% possibly it is faster to use a global variable for the -% conversion hook. - -typed_literal(Type, Content, literal(Object), Options) :- - rdf_state_convert_typed_literal(Options, Convert), - nonvar(Convert), !, - ( catch(call(Convert, Type, Content, Object), E, true) - -> ( var(E) - -> true - ; Object = E - ) - ; Object = error(cannot_convert(Type, Content), _) - ). -typed_literal(Type, [], literal(type(Type, '')), _Options) :- !. -typed_literal(Type, [Text], literal(type(Type, Text)), _Options) :- !. -typed_literal(Type, Content, literal(type(Type, Content)), _Options). - - -idAboutAttr(id(Id), Options) ::= - \idAttr(Id, Options), !. -idAboutAttr(about(About), Options) ::= - \aboutAttr(About, Options), !. -idAboutAttr(node(About), _Options) ::= - \nodeIDAttr(About), !. - -%% an_rdf_object(-Object, +OptionsURI) -% -% Deals with an object, but there may be spaces around. I'm still -% not sure where to deal with these. Best is to ask the XML parser -% to get rid of them, So most likely this code will change if this -% happens. - -an_rdf_object(Object, Options) ::= - [ \nodeElement(Object, Options) - ], !. -an_rdf_object(Object, Options) ::= - [ (\ws, !) - | \an_rdf_object(Object, Options) - ]. -an_rdf_object(Object, Options) ::= - [ \nodeElement(Object, Options), - \ws - ], !. - -ws ::= - A, - { atom(A), - atom_chars(A, Chars), - all_blank(Chars), ! - }. -ws ::= - pi(_). - -all_ws ::= - [], !. -all_ws ::= - [\ws | \all_ws]. - -all_blank([]). -all_blank([H|T]) :- - char_type(H, space), % SWI-Prolog specific - all_blank(T). - - - /******************************* - * RDF ATTRIBUTES * - *******************************/ - -idAttr(Id, Options) ::= - \rdf_or_unqualified('ID') = \uniqueid(Id, Options). - -aboutAttr(About, Options) ::= - \rdf_or_unqualified(about) = \value_uri(About, Options). - -nodeIDAttr(About) ::= - \rdf_or_unqualified(nodeID) = About. - -resourceAttr(URI, Options) ::= - \rdf_or_unqualified(resource) = \value_uri(URI, Options). - -typeAttr(Type, Options) ::= - \rdf_or_unqualified(datatype) = \value_uri(Type, Options). - -name_uri(URI, Options) ::= - NS:Local, - { !, atom_concat(NS, Local, A), - rewrite(\value_uri(URI, Options), A) - }. -name_uri(URI, Options) ::= - \value_uri(URI, Options). - -value_uri(URI, Options) ::= - A, - { rdf_state_base_uri(Options, Base), - uri_normalized_iri(A, Base, URI) - }. - - -globalid(Id, Options) ::= - A, - { make_globalid(A, Options, Id) - }. - -uniqueid(Id, Options) ::= - A, - { unique_xml_name(A, HashID), - make_globalid(HashID, Options, Id) - }. - -unique_xml_name(Name, HashID) :- - atom_concat(#, Name, HashID), - ( xml_name(Name) - -> true - ; print_message(warning, rdf(not_a_name(Name))) - ). - -make_globalid(In, Options, Id) :- - rdf_state_base_uri(Options, Base), - uri_normalized_iri(In, Base, Id). - -parseLiteral ::= \rdf_or_unqualified(parseType) = 'Literal'. -parseResource ::= \rdf_or_unqualified(parseType) = 'Resource'. -parseCollection ::= \rdf_or_unqualified(parseType) = 'Collection'. - - - /******************************* - * PRIMITIVES * - *******************************/ - -rdf(Tag) ::= - NS:Tag, - { rdf_name_space(NS), ! - }. - -rdf_or_unqualified(Tag) ::= - Tag. -rdf_or_unqualified(Tag) ::= - NS:Tag, - { rdf_name_space(NS), ! - }. - - - /******************************* - * BASICS * - *******************************/ - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -This code is translated by the goal_expansion/2 rule at the start of -this file. We leave the original code for reference. - -attrs(Bag) ::= - L0, - { do_attrs(Bag, L0) - }. - -do_attrs([], _) :- !. -do_attrs([\?H|T], L0) :- !, % optional - ( select(X, L0, L), - rewrite(\H, X) - -> true - ; L = L0 - ), - do_attrs(T, L). -do_attrs([H|T], L0) :- - select(X, L0, L), - rewrite(H, X), !, - do_attrs(T, L). -do_attrs(C, L) :- - rewrite(C, L). -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -% \noMoreAttrs -% -% Check attribute-list is empty. Reserved xml: attributes are -% excluded from this test. - -noMoreAttrs ::= - [], !. -noMoreAttrs ::= - [ xml:_=_ - | \noMoreAttrs - ]. - -%% modify_state(+Element0, +Options0, -Element, -Options) is semidet. -% -% If Element0 contains xml:base = Base, strip it from the -% attributes list and update base_uri(_) in the Options -% -% It Element0 contains xml:lang = Lang, strip it from the -% attributes list and update lang(_) in the Options -% -% Remove all xmlns=_, xmlns:_=_ and xml:_=_. Only succeed -% if something changed. - -modify_state(element(Name, Attrs0, Content), Options0, - element(Name, Attrs, Content), Options) :- - modify_a_state(Attrs0, Options0, Attrs, Options), - Attrs0 \== Attrs. - -rdf_modify_state(Attributes, State0, State) :- - modify_a_state(Attributes, State0, _, State). - - -modify_a_state([], Options, [], Options). -modify_a_state([Name=Value|T0], Options0, T, Options) :- - modify_a(Name, Value, Options0, Options1), !, - modify_a_state(T0, Options1, T, Options). -modify_a_state([H|T0], Options0, [H|T], Options) :- - modify_a_state(T0, Options0, T, Options). - - -modify_a(xml:base, Base1, Options0, Options) :- !, - rdf_state_base_uri(Options0, Base0), - remove_fragment(Base1, Base2), - uri_normalized_iri(Base2, Base0, Base), - set_base_uri_of_rdf_state(Base, Options0, Options). -modify_a(xml:lang, Lang, Options0, Options) :- !, - rdf_state_ignore_lang(Options0, false), !, - set_lang_of_rdf_state(Lang, Options0, Options). -modify_a(xmlns, _, Options, Options). -modify_a(xmlns:_, _, Options, Options). -modify_a(xml:_, _, Options, Options). - - -%% remove_fragment(+URI, -WithoutFragment) -% -% When handling xml:base, we must delete the possible fragment. - -remove_fragment(URI, Plain) :- - sub_atom(URI, B, _, _, #), !, - sub_atom(URI, 0, B, _, Plain). -remove_fragment(URI, URI). - - - /******************************* - * HELP PCE-EMACS A BIT * - *******************************/ - -:- multifile - emacs_prolog_colours:term_colours/2, - emacs_prolog_colours:goal_classification/2. - -expand(c(X), _, X) :- !. -expand(In, Pattern, Colours) :- - compound(In), !, - In =.. [F|Args], - expand_list(Args, PatternArgs, ColourArgs), - Pattern =.. [F|PatternArgs], - Colours = functor(F) - ColourArgs. -expand(X, X, classify). - -expand_list([], [], []). -expand_list([H|T], [PH|PT], [CH|CT]) :- - expand(H, PH, CH), - expand_list(T, PT, CT). - -:- discontiguous - term_expansion/2. - -term_expansion(term_colours(C), - emacs_prolog_colours:term_colours(Pattern, Colours)) :- - expand(C, Pattern, Colours). - -term_colours((c(head(+(1))) ::= c(match), {c(body)})). -term_colours((c(head(+(1))) ::= c(match))). - -emacs_prolog_colours:goal_classification(\_, expanded). - -:- dynamic - prolog:meta_goal/2. -:- multifile - prolog:meta_goal/2, - prolog:called_by/2. - -prolog:meta_goal(rewrite(A, _), [A]). -prolog:meta_goal(\A, [A+1]). - -prolog:called_by(attrs(Attrs, _Term), Called) :- - findall(G+1, sub_term(\?G, Attrs), Called, Tail), - findall(G+1, sub_term(\G, Attrs), Tail). - - diff --git a/packages/RDF/rdf_triple.pl b/packages/RDF/rdf_triple.pl deleted file mode 100644 index 9c4ee20bc..000000000 --- a/packages/RDF/rdf_triple.pl +++ /dev/null @@ -1,414 +0,0 @@ -/* Part of SWI-Prolog - - Author: Jan Wielemaker - E-mail: J.Wielemaker@uva.nl - WWW: http://www.swi-prolog.org - Copyright (C): 2002-2010, University of Amsterdam - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - As a special exception, if you link this library with other files, - compiled with a Free Software compiler, to produce an executable, this - library does not by itself cause the resulting executable to be covered - by the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -:- module(rdf_triple, - [ rdf_triples/2, % +Parsed, -Tripples - rdf_triples/3, % +Parsed, -Tripples, +Tail - rdf_reset_ids/0, % Reset gensym id's - rdf_start_file/2, % +Options, -Cleanup - rdf_end_file/1, % +Cleanup - anon_prefix/1 % Prefix for anonynmous resources - ]). -:- use_module(library(gensym)). -:- use_module(rdf_parser). - -/** Create triples from intermediate representation - -Convert the output of xml_to_rdf/3 from library(rdf) into a list of -triples of the format described below. The intermediate representation -should be regarded a proprietary representation. - - rdf(Subject, Predicate, Object). - -Where `Subject' is - - * Atom - The subject is a resource - - * each(URI) - URI is the URI of an RDF Bag - - * prefix(Pattern) - Pattern is the prefix of a fully qualified Subject URI - -And `Predicate' is - - * Atom - The predicate is always a resource - -And `Object' is - - * Atom - URI of Object resource - - * literal(Value) - Literal value (Either a single atom or parsed XML data) -*/ - -%% rdf_triples(+Term, -Triples) is det. -%% rdf_triples(+Term, -Tridpples, +Tail) is det. -% -% Convert an object as parsed by rdf.pl into a list of rdf/3 -% triples. The identifier of the main object created is returned -% by rdf_triples/3. -% -% Input is the `content' of the RDF element in the format as -% generated by load_structure(File, Term, [dialect(xmlns)]). -% rdf_triples/3 can process both individual descriptions as -% well as the entire content-list of an RDF element. The first -% mode is suitable when using library(sgml) in `call-back' mode. - -rdf_triples(RDF, Tripples) :- - rdf_triples(RDF, Tripples, []). - -rdf_triples([]) --> !, - []. -rdf_triples([H|T]) --> !, - rdf_triples(H), - rdf_triples(T). -rdf_triples(Term) --> - triples(Term, _). - -%% triples(-Triples, -Id, +In, -Tail) -% -% DGC set processing the output of xml_to_rdf/3. Id is unified to -% the identifier of the main description. - -triples(description(Type, About, Props), Subject) --> - { var(About), - share_blank_nodes(true) - }, !, - ( { shared_description(description(Type, Props), Subject) - } - -> [] - ; { make_id('__Description', Id) - }, - triples(description(Type, about(Id), Props), Subject), - { assert_shared_description(description(Type, Props), Subject) - } - ). -triples(description(description, IdAbout, Props), Subject) --> !, - { description_id(IdAbout, Subject) - }, - properties(Props, Subject). -triples(description(TypeURI, IdAbout, Props), Subject) --> - { description_id(IdAbout, Subject) - }, - properties([ rdf:type = TypeURI - | Props - ], Subject). -triples(unparsed(Data), Id) --> - { make_id('__Error', Id), - print_message(error, rdf(unparsed(Data))) - }, - []. - - - /******************************* - * DESCRIPTIONS * - *******************************/ - -:- thread_local - node_id/2, % nodeID --> ID - unique_id/1. % known rdf:ID - -rdf_reset_node_ids :- - retractall(node_id(_,_)), - retractall(unique_id(_)). - -description_id(Id, Id) :- - var(Id), !, - make_id('__Description', Id). -description_id(about(Id), Id). -description_id(id(Id), Id) :- - ( unique_id(Id) - -> print_message(error, rdf(redefined_id(Id))) - ; assert(unique_id(Id)) - ). -description_id(each(Id), each(Id)). -description_id(prefix(Id), prefix(Id)). -description_id(node(NodeID), Id) :- - ( node_id(NodeID, Id) - -> true - ; make_id('__Node', Id), - assert(node_id(NodeID, Id)) - ). - -properties(PlRDF, Subject) --> - properties(PlRDF, 1, [], [], Subject). - -properties([], _, Bag, Bag, _) --> - []. -properties([H0|T0], N, Bag0, Bag, Subject) --> - property(H0, N, NN, Bag0, Bag1, Subject), - properties(T0, NN, Bag1, Bag, Subject). - -%% property(Property, N, NN, Subject)// is det. -% -% Generate triples for {Subject, Pred, Object}. Also generates -% triples for Object if necessary. -% -% @param Property One of -% -% * Pred = Object -% Used for normal statements -% * id(Id, Pred = Object) -% Used for reified statements - -property(Pred0 = Object, N, NN, BagH, BagT, Subject) --> % inlined object - triples(Object, Id), !, - { li_pred(Pred0, Pred, N, NN) - }, - statement(Subject, Pred, Id, _, BagH, BagT). -property(Pred0 = collection(Elems), N, NN, BagH, BagT, Subject) --> !, - { li_pred(Pred0, Pred, N, NN) - }, - statement(Subject, Pred, Object, _Id, BagH, BagT), - collection(Elems, Object). -property(Pred0 = Object, N, NN, BagH, BagT, Subject) --> !, - { li_pred(Pred0, Pred, N, NN) - }, - statement(Subject, Pred, Object, _Id, BagH, BagT). -property(id(Id, Pred0 = Object), N, NN, BagH, BagT, Subject) --> - triples(Object, ObjectId), !, - { li_pred(Pred0, Pred, N, NN) - }, - statement(Subject, Pred, ObjectId, Id, BagH, BagT). -property(id(Id, Pred0 = collection(Elems)), N, NN, BagH, BagT, Subject) --> !, - { li_pred(Pred0, Pred, N, NN) - }, - statement(Subject, Pred, Object, Id, BagH, BagT), - collection(Elems, Object). -property(id(Id, Pred0 = Object), N, NN, BagH, BagT, Subject) --> - { li_pred(Pred0, Pred, N, NN) - }, - statement(Subject, Pred, Object, Id, BagH, BagT). - -%% statement(+Subject, +Pred, +Object, +Id, +BagH, -BagT) -% -% Add a statement to the model. If nonvar(Id), we reinify the -% statement using the given Id. - -statement(Subject, Pred, Object, Id, BagH, BagT) --> - rdf(Subject, Pred, Object), - { BagH = [Id|BagT] - -> statement_id(Id) - ; BagT = BagH - }, - ( { nonvar(Id) - } - -> rdf(Id, rdf:type, rdf:'Statement'), - rdf(Id, rdf:subject, Subject), - rdf(Id, rdf:predicate, Pred), - rdf(Id, rdf:object, Object) - ; [] - ). - - -statement_id(Id) :- - nonvar(Id), !. -statement_id(Id) :- - make_id('__Statement', Id). - -%% li_pred(+Pred, -Pred, +Nth, -NextNth) -% -% Transform rdf:li predicates into _1, _2, etc. - -li_pred(rdf:li, rdf:Pred, N, NN) :- !, - NN is N + 1, - atom_concat('_', N, Pred). -li_pred(Pred, Pred, N, N). - -%% collection(+Elems, -Id) -% -% Handle the elements of a collection and return the identifier -% for the whole collection in Id. - -collection([], Nil) --> - { global_ref(rdf:nil, Nil) - }. -collection([H|T], Id) --> - triples(H, HId), - { make_id('__List', Id) - }, - rdf(Id, rdf:type, rdf:'List'), - rdf(Id, rdf:first, HId), - rdf(Id, rdf:rest, TId), - collection(T, TId). - - -rdf(S0, P0, O0) --> - { global_ref(S0, S), - global_ref(P0, P), - global_obj(O0, O) - }, - [ rdf(S, P, O) ]. - - -global_ref(In, Out) :- - ( nonvar(In), - In = NS:Local - -> ( NS == rdf, - rdf_name_space(RDF) - -> atom_concat(RDF, Local, Out) - ; atom_concat(NS, Local, Out) - ) - ; Out = In - ). - -global_obj(V, V) :- - var(V), !. -global_obj(literal(type(Local, X)), literal(type(Global, X))) :- !, - global_ref(Local, Global). -global_obj(literal(X), literal(X)) :- !. -global_obj(Local, Global) :- - global_ref(Local, Global). - - - /******************************* - * SHARING * - *******************************/ - -:- thread_local - shared_description/3, % +Hash, +Term, -Subject - share_blank_nodes/1, % Boolean - shared_nodes/1. % counter - -reset_shared_descriptions :- - retractall(shared_description(_,_,_)), - retractall(shared_nodes(_)). - -shared_description(Term, Subject) :- - term_hash(Term, Hash), - shared_description(Hash, Term, Subject), - ( retract(shared_nodes(N)) - -> N1 is N + 1 - ; N1 = 1 - ), - assert(shared_nodes(N1)). - - -assert_shared_description(Term, Subject) :- - term_hash(Term, Hash), - assert(shared_description(Hash, Term, Subject)). - - - /******************************* - * START/END * - *******************************/ - -%% rdf_start_file(+Options, -Cleanup) is det. -% -% Initialise for the translation of a file. - -rdf_start_file(Options, Cleanup) :- - rdf_reset_node_ids, % play safe - reset_shared_descriptions, - set_bnode_sharing(Options, C1), - set_anon_prefix(Options, C2), - add_cleanup(C1, C2, Cleanup). - -%% rdf_end_file(:Cleanup) is det. -% -% Cleanup reaching the end of an RDF file. - -rdf_end_file(Cleanup) :- - rdf_reset_node_ids, - ( shared_nodes(N) - -> print_message(informational, rdf(shared_blank_nodes(N))) - ; true - ), - reset_shared_descriptions, - Cleanup. - -set_bnode_sharing(Options, erase(Ref)) :- - option(blank_nodes(Share), Options, noshare), - ( Share == share - -> assert(share_blank_nodes(true), Ref), ! - ; Share == noshare - -> fail % next clause - ; throw(error(domain_error(share, Share), _)) - ). -set_bnode_sharing(_, true). - -set_anon_prefix(Options, erase(Ref)) :- - option(base_uri(BaseURI), Options), - nonvar(BaseURI), !, - atomic_list_concat(['__', BaseURI, '#'], AnonBase), - asserta(anon_prefix(AnonBase), Ref). -set_anon_prefix(_, true). - -add_cleanup(true, X, X) :- !. -add_cleanup(X, true, X) :- !. -add_cleanup(X, Y, (X, Y)). - - - /******************************* - * UTIL * - *******************************/ - -%% anon_prefix(-Prefix) is semidet. -% -% If defined, it is the prefix used to generate a blank node. - -:- thread_local - anon_prefix/1. - -make_id(For, ID) :- - anon_prefix(Prefix), !, - atom_concat(Prefix, For, Base), - gensym(Base, ID). -make_id(For, ID) :- - gensym(For, ID). - -anon_base('__Description'). -anon_base('__Statement'). -anon_base('__List'). -anon_base('__Node'). - -%% rdf_reset_ids is det. -% -% Utility predicate to reset the gensym counters for the various -% generated identifiers. This simplifies debugging and matching -% output with the stored desired output (see rdf_test.pl). - -rdf_reset_ids :- - anon_prefix(Prefix), !, - ( anon_base(Base), - atom_concat(Prefix, Base, X), - reset_gensym(X), - fail - ; true - ). -rdf_reset_ids :- - ( anon_base(Base), - reset_gensym(Base), - fail - ; true - ). diff --git a/packages/RDF/rdf_write.pl b/packages/RDF/rdf_write.pl deleted file mode 100644 index 903a24797..000000000 --- a/packages/RDF/rdf_write.pl +++ /dev/null @@ -1,642 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog - - Author: Jan Wielemaker - E-mail: J.Wielemak@uva.nl - WWW: http://www.swi-prolog.org - Copyright (C): 2004-2009, University of Amsterdam - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - As a special exception, if you link this library with other files, - compiled with a Free Software compiler, to produce an executable, this - library does not by itself cause the resulting executable to be covered - by the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -:- module(rdf_write, - [ rdf_write_xml/2 % +Stream, +Triples - ]). -:- use_module(library('semweb/rdf_db')). -:- use_module(library(lists)). -:- use_module(library(sgml)). -:- use_module(library(sgml_write)). -:- use_module(library(assoc)). -:- use_module(library(pairs)). -:- use_module(library(debug)). - -:- expects_dialect(swi). -:- assert(system:swi_io). - - -/** Write RDF/XML from a list of triples - -This module writes an RDF/XML document from a list of triples of the -format rdf(Subject, Predicate, Object). It is primarily intended for -communicating computed RDF model fragments to external programs using -RDF/XML. - -When used from the HTTP library, use the following code: - -== -reply_graph(RDF) :- - format('Content-type: application/rdf+xml; charset=UTF-8~n~n'), - rdf_write_xml(current_output, RDF). -== - -@author Jan Wielemaker -@see library(semweb/rdf_db) offers saving a named graph directly from - the RDF database. -*/ - - - /******************************* - * WRITE RDFXML * - *******************************/ - -%% rdf_write_xml(+Out:stream, +Triples:list(rdf(S,P,O))) is det. -% -% Write an RDF/XML serialization of Triples to Out. - -rdf_write_xml(Out, Triples) :- - sort(Triples, Unique), - rdf_write_header(Out, Unique), - node_id_map(Unique, AnonIDs), - rdf_write_triples(Unique, AnonIDs, Out), - rdf_write_footer(Out). - - - /******************************* - * HEADER/FOOTER * - *******************************/ - -%% rdf_write_header(+Out, +Triples) -% -% Save XML document header, doctype and open the RDF environment. -% This predicate also sets up the namespace notation. - -rdf_write_header(Out, Triples) :- - xml_encoding(Out, Enc, Encoding), - format(Out, '~n', [Encoding]), - format(Out, '', [Id, NSText]), - fail - ; true - ), - format(Out, '~N]>~n~n', []), - format(Out, '~n', []). - - -xml_encoding(Out, Enc, Encoding) :- - stream_property(Out, encoding(Enc)), - ( xml_encoding_name(Enc, Encoding) - -> true - ; throw(error(domain_error(rdf_encoding, Enc), _)) - ). - -xml_encoding_name(ascii, 'US-ASCII'). -xml_encoding_name(iso_latin_1, 'ISO-8859-1'). -xml_encoding_name(utf8, 'UTF-8'). - -%% xml_escape_parameter_entity(+In, -Out) is det. -% -% Escape % as % for entity declarations. - -xml_escape_parameter_entity(In, Out) :- - sub_atom(In, _, _, _, '%'), !, - atom_codes(In, Codes), - phrase(escape_parent(Codes), OutCodes), - atom_codes(Out, OutCodes). -xml_escape_parameter_entity(In, In). - -escape_parent([]) --> []. -escape_parent([H|T]) --> - ( { H == 37 } - -> "%" - ; [H] - ), - escape_parent(T). - -%% used_namespaces(+Triples:list(rdf(S,P,O)), -List:atom) is det. -% -% Return the list of namespace abbreviations used in a set of -% triples. - -used_namespaces(Triples, NSList) :- - decl_used_predicate_ns(Triples), - resources(Triples, Resources), - empty_assoc(A0), - put_assoc(rdf, A0, *, A1), % needed for rdf:RDF - res_used_namespaces(Resources, _NoNS, A1, A), - assoc_to_keys(A, NSList). - - -res_used_namespaces([], [], A, A). -res_used_namespaces([Resource|T], NoNS, A0, A) :- - ns(NS, Full), - Full \== '', - atom_concat(Full, _Local, Resource), !, - put_assoc(NS, A0, *, A1), - res_used_namespaces(T, NoNS, A1, A). -res_used_namespaces([R|T0], [R|T], A0, A) :- - res_used_namespaces(T0, T, A0, A). - -%% resources(+Triples:list(rdf(S,P,O)), -Resources:list(atom)) is det. -% -% Resources is the set of resources referenced in Triples. - -resources(Triples, Resources) :- - phrase(resources(Triples), Raw), - sort(Raw, Resources). - -resources([]) --> - []. -resources([rdf(S,P,O)|T]) --> - [S,P], - object_resources(O), - resources(T). - -object_resources(Atom) --> - { atom(Atom) }, !, - [ Atom ]. -object_resources(literal(type(Type, _))) --> !, - [ Type ]. -object_resources(_) --> - []. - -%% decl_used_predicate_ns(+Triples:list(rdf(S,P,O))) -% -% For every URL used as a predicate we *MUST* define a namespace -% as we cannot use names holding /, :, etc. as XML identifiers. - -:- thread_local - predicate_ns/2. - -decl_used_predicate_ns(Triples) :- - retractall(predicate_ns(_,_)), - ( member(rdf(_,P,_), Triples), - decl_predicate_ns(P), - fail - ; true - ). - -decl_predicate_ns(Pred) :- - predicate_ns(Pred, _), !. -decl_predicate_ns(Pred) :- - rdf_global_id(NS:_Local, Pred), - assert(predicate_ns(Pred, NS)), !. -decl_predicate_ns(Pred) :- - is_bag_li_predicate(Pred), !. -decl_predicate_ns(Pred) :- - atom_codes(Pred, Codes), - append(NSCodes, LocalCodes, Codes), - xml_codes(LocalCodes), !, - ( NSCodes \== [] - -> atom_codes(NS, NSCodes), - ( ns(Id, NS) - -> assert(predicate_ns(Pred, Id)) - ; between(1, infinite, N), - atom_concat(ns, N, Id), - \+ ns(Id, _) - -> rdf_register_ns(Id, NS), - print_message(informational, - rdf(using_namespace(Id, NS))) - ), - assert(predicate_ns(Pred, Id)) - ; assert(predicate_ns(Pred, -)) % no namespace used - ). - -xml_codes([]). -xml_codes([H|T]) :- - xml_code(H), - xml_codes(T). - -xml_code(X) :- - code_type(X, csym), !. -xml_code(0'-). % ' - - -rdf_write_footer(Out) :- - format(Out, '~n', []). - - - /******************************* - * ANONYMOUS IDS * - *******************************/ - -%% node_id_map(+Triples, -IdMap) is det. -% -% Create an assoc Resource -> NodeID for those anonymous resources -% in Triples that need a NodeID. This implies all anonymous -% resources that are used multiple times as object value. - -node_id_map(Triples, IdMap) :- - anonymous_objects(Triples, Objs), - msort(Objs, Sorted), - empty_assoc(IdMap0), - nodeid_map(Sorted, 0, IdMap0, IdMap). - -anonymous_objects([], []). -anonymous_objects([rdf(_,_,O)|T0], Anon) :- - rdf_is_bnode(O), !, - Anon = [O|T], - anonymous_objects(T0, T). -anonymous_objects([_|T0], T) :- - anonymous_objects(T0, T). - -nodeid_map([], _, Map, Map). -nodeid_map([H,H|T0], Id, Map0, Map) :- !, - remove_leading(H, T0, T), - atom_concat(bn, Id, NodeId), - put_assoc(H, Map0, NodeId, Map1), - Id2 is Id + 1, - nodeid_map(T, Id2, Map1, Map). -nodeid_map([_|T], Id, Map0, Map) :- - nodeid_map(T, Id, Map0, Map). - -remove_leading(H, [H|T0], T) :- !, - remove_leading(H, T0, T). -remove_leading(_, T, T). - - - /******************************* - * TRIPLES * - *******************************/ - -rdf_write_triples(Triples, NodeIDs, Out) :- - rdf_write_triples(Triples, NodeIDs, Out, [], Anon), - rdf_write_anon(Anon, NodeIDs, Out, Anon). - -rdf_write_triples([], _, _, Anon, Anon). -rdf_write_triples([H|T0], NodeIDs, Out, Anon0, Anon) :- - arg(1, H, S), - subject_triples(S, [H|T0], T, OnSubject), - ( rdf_is_bnode(S) - -> rdf_write_triples(T, NodeIDs, Out, [anon(S,_,OnSubject)|Anon0], Anon) - ; rdf_write_subject(OnSubject, S, NodeIDs, Out, Anon0), - rdf_write_triples(T, NodeIDs, Out, Anon0, Anon) - ). - -subject_triples(S, [H|T0], T, [H|M]) :- - arg(1, H, S), !, - subject_triples(S, T0, T, M). -subject_triples(_, T, T, []). - - -rdf_write_anon([], _, _, _). -rdf_write_anon([anon(Subject, Done, Triples)|T], NodeIDs, Out, Anon) :- - Done \== true, !, - Done = true, - rdf_write_subject(Triples, Subject, NodeIDs, Out, Anon), - rdf_write_anon(T, NodeIDs, Out, Anon). -rdf_write_anon([_|T], NodeIDs, Out, Anon) :- - rdf_write_anon(T, NodeIDs, Out, Anon). - -rdf_write_subject(Triples, Subject, NodeIDs, Out, Anon) :- - rdf_write_subject(Triples, Out, Subject, NodeIDs, -, 0, Anon), !, - format(Out, '~n', []). -rdf_write_subject(_, Subject, _, _, _) :- - throw(error(rdf_save_failed(Subject), 'Internal error')). - -rdf_write_subject(Triples, Out, Subject, NodeIDs, DefNS, Indent, Anon) :- - rdf_equal(rdf:type, RdfType), - select(rdf(_, RdfType,Type), Triples, Triples1), - \+ rdf_is_bnode(Type), - rdf_id(Type, DefNS, TypeId), - xml_is_name(TypeId), !, - format(Out, '~*|<', [Indent]), - rdf_write_id(Out, TypeId), - save_about(Out, Subject, NodeIDs), - save_attributes(Triples1, DefNS, Out, NodeIDs, TypeId, Indent, Anon). -rdf_write_subject(Triples, Out, Subject, NodeIDs, _DefNS, Indent, Anon) :- - format(Out, '~*| format(Out,' rdf:nodeID="~w"', [NodeID]) - ; true - ). -save_about(Out, Subject, _) :- - stream_property(Out, encoding(Encoding)), - rdf_value(Subject, QSubject, Encoding), - format(Out, ' rdf:about="~w"', [QSubject]), !. -save_about(_, _, _) :- - assertion(fail). - -%% save_attributes(+List, +DefNS, +Out, +NodeIDs, Element, +Indent, +Anon) -% -% Save the attributes. Short literal attributes are saved in the -% tag. Others as the content of the description element. The -% begin tag has already been filled. - -save_attributes(Triples, DefNS, Out, NodeIDs, Element, Indent, Anon) :- - split_attributes(Triples, InTag, InBody), - SubIndent is Indent + 2, - save_attributes2(InTag, DefNS, tag, Out, NodeIDs, SubIndent, Anon), - ( InBody == [] - -> format(Out, '/>~n', []) - ; format(Out, '>~n', []), - save_attributes2(InBody, _, body, Out, NodeIDs, SubIndent, Anon), - format(Out, '~N~*|~n', [Indent, Element]) - ). - -% split_attributes(+Triples, -HeadAttrs, -BodyAttr) -% -% Split attribute (Name=Value) list into attributes for the head -% and body. Attributes can only be in the head if they are literal -% and appear only one time in the attribute list. - -split_attributes(Triples, HeadAttr, BodyAttr) :- - duplicate_attributes(Triples, Dupls, Singles), - simple_literal_attributes(Singles, HeadAttr, Rest), - append(Dupls, Rest, BodyAttr). - -% duplicate_attributes(+Attrs, -Duplicates, -Singles) -% -% Extract attributes that appear more than onces as we cannot -% dublicate an attribute in the head according to the XML rules. - -duplicate_attributes([], [], []). -duplicate_attributes([H|T], Dupls, Singles) :- - arg(2, H, Name), - named_attributes(Name, T, D, R), - D \== [], - append([H|D], Dupls2, Dupls), !, - duplicate_attributes(R, Dupls2, Singles). -duplicate_attributes([H|T], Dupls2, [H|Singles]) :- - duplicate_attributes(T, Dupls2, Singles). - -named_attributes(_, [], [], []) :- !. -named_attributes(Name, [H|T], D, R) :- - ( arg(2, H, Name) - -> D = [H|DT], - named_attributes(Name, T, DT, R) - ; R = [H|RT], - named_attributes(Name, T, D, RT) - ). - -% simple_literal_attributes(+Attributes, -Inline, -Body) -% -% Split attributes for (literal) attributes to be used in the -% begin-tag and ones that have to go into the body of the description. - -simple_literal_attributes([], [], []). -simple_literal_attributes([H|TA], [H|TI], B) :- - in_tag_attribute(H), !, - simple_literal_attributes(TA, TI, B). -simple_literal_attributes([H|TA], I, [H|TB]) :- - simple_literal_attributes(TA, I, TB). - -in_tag_attribute(rdf(_,P,literal(Text))) :- - atom(Text), % may not have lang qualifier - atom_length(Text, Len), - Len < 60, - \+ is_bag_li_predicate(P). - - -% save_attributes(+List, +DefNS, +TagOrBody, +Out, +NodeIDs, +Indent, +Anon) -% -% Save a list of attributes. - -save_attributes2([], _, _, _, _, _, _). -save_attributes2([H|T], DefNS, Where, Out, NodeIDs, Indent, Anon) :- - save_attribute(Where, H, DefNS, Out, NodeIDs, Indent, Anon), - save_attributes2(T, DefNS, Where, Out, NodeIDs, Indent, Anon). - -%% save_attribute(+Where, +Triple, +DefNS, +Out, +NodeIDs, +Indent, +Anon) - -save_attribute(tag, rdf(_, Name, literal(Value)), DefNS, Out, _, Indent, _Anon) :- - AttIndent is Indent + 2, - rdf_att_id(Name, DefNS, NameText), - stream_property(Out, encoding(Encoding)), - xml_quote_attribute(Value, QVal, Encoding), - format(Out, '~N~*|', [AttIndent]), - rdf_write_id(Out, NameText), - format(Out, '="~w"', [QVal]). -save_attribute(body, rdf(_,Name,literal(Literal)), DefNS, Out, _, Indent, _) :- !, - rdf_p_id(Name, DefNS, NameText), - format(Out, '~N~*|<', [Indent]), - rdf_write_id(Out, NameText), - ( Literal = lang(Lang, Value) - -> rdf_id(Lang, DefNS, LangText), - format(Out, ' xml:lang="~w">', [LangText]) - ; Literal = type(Type, Value) - -> ( rdf_equal(Type, rdf:'XMLLiteral') - -> write(Out, ' rdf:parseType="Literal">'), - Value = Literal - ; stream_property(Out, encoding(Encoding)), - rdf_value(Type, QVal, Encoding), - format(Out, ' rdf:datatype="~w">', [QVal]) - ) - ; atomic(Literal) - -> write(Out, '>'), - Value = Literal - ; write(Out, ' rdf:parseType="Literal">'), - Value = Literal - ), - save_attribute_value(Value, Out, Indent), - write(Out, ''). -save_attribute(body, rdf(_, Name, Value), DefNS, Out, NodeIDs, Indent, Anon) :- - rdf_is_bnode(Value), - memberchk(anon(Value, Done, ValueTriples), Anon), !, - rdf_p_id(Name, DefNS, NameText), - format(Out, '~N~*|<', [Indent]), - rdf_write_id(Out, NameText), - ( var(Done) - -> Done = true, - SubIndent is Indent + 2, - ( rdf_equal(RdfType, rdf:type), - rdf_equal(ListClass, rdf:'List'), - memberchk(rdf(_, RdfType, ListClass), ValueTriples) - -> format(Out, ' rdf:parseType="Collection">~n', []), - rdf_save_list(ValueTriples, Out, Value, NodeIDs, DefNS, SubIndent, Anon) - ; format(Out, '>~n', []), - rdf_write_subject(ValueTriples, Out, Value, NodeIDs, DefNS, SubIndent, Anon) - ), - format(Out, '~N~*|~n', []) - ; get_assoc(Value, NodeIDs, NodeID) - -> format(Out, ' rdf:nodeID="~w"/>', [NodeID]) - ; assertion(fail) - ). -save_attribute(body, rdf(_, Name, Value), DefNS, Out, _, Indent, _Anon) :- - stream_property(Out, encoding(Encoding)), - rdf_value(Value, QVal, Encoding), - rdf_p_id(Name, DefNS, NameText), - format(Out, '~N~*|<', [Indent]), - rdf_write_id(Out, NameText), - format(Out, ' rdf:resource="~w"/>', [QVal]). - -save_attribute_value(Value, Out, _) :- % strings - atom(Value), !, - stream_property(Out, encoding(Encoding)), - xml_quote_cdata(Value, QVal, Encoding), - write(Out, QVal). -save_attribute_value(Value, Out, _) :- % numbers - number(Value), !, - writeq(Out, Value). % quoted: preserve floats -save_attribute_value(Value, Out, Indent) :- - xml_is_dom(Value), !, - XMLIndent is Indent+2, - xml_write(Out, Value, - [ header(false), - indent(XMLIndent) - ]). -save_attribute_value(Value, _Out, _) :- - throw(error(save_attribute_value(Value), _)). - -rdf_save_list(_, _, List, _, _, _, _) :- - rdf_equal(List, rdf:nil), !. -rdf_save_list(ListTriples, Out, List, NodeIDs, DefNS, Indent, Anon) :- - rdf_equal(RdfFirst, rdf:first), - memberchk(rdf(List, RdfFirst, First), ListTriples), - ( rdf_is_bnode(First), - memberchk(anon(First, true, FirstTriples), Anon) - -> nl(Out), - rdf_write_subject(FirstTriples, Out, First, NodeIDs, DefNS, Indent, Anon) - ; stream_property(Out, encoding(Encoding)), - rdf_value(First, QVal, Encoding), - format(Out, '~N~*|', - [Indent, QVal]) - ), - ( rdf_equal(RdfRest, rdf:rest), - memberchk(rdf(List, RdfRest, List2), ListTriples), - \+ rdf_equal(List2, rdf:nil), - memberchk(anon(List2, true, List2Triples), Anon) - -> rdf_save_list(List2Triples, Out, List2, NodeIDs, DefNS, Indent, Anon) - ; true - ). - -%% rdf_p_id(+Resource, +DefNS, -NSLocal) -% -% As rdf_id/3 for predicate names. Maps _: to rdf:li. -% -% @tbd Ensure we are talking about an rdf:Bag - -rdf_p_id(LI, _, 'rdf:li') :- - is_bag_li_predicate(LI), !. -rdf_p_id(Resource, DefNS, NSLocal) :- - rdf_id(Resource, DefNS, NSLocal). - -%% is_bag_li_predicate(+Pred) is semidet. -% -% True if Pred is _:N, as used for members of an rdf:Bag, rdf:Seq -% or rdf:Alt. - -is_bag_li_predicate(Pred) :- - atom_concat('_:', AN, Pred), - catch(atom_number(AN, N), _, true), integer(N), N >= 0, !. - - -%% rdf_id(+Resource, +DefNS, -NSLocal) -% -% Generate a NS:Local name for Resource given the indicated -% default namespace. This call is used for elements. - -rdf_id(Id, NS, NS:Local) :- - ns(NS, Full), - Full \== '', - atom_concat(Full, Local, Id), !. -rdf_id(Id, _, NS:Local) :- - ns(NS, Full), - Full \== '', - atom_concat(Full, Local, Id), !. -rdf_id(Id, _, Id). - - -%% rdf_write_id(+Out, +NSLocal) is det. -% -% Write an identifier. We cannot use native write on it as both NS -% and Local can be operators. - -rdf_write_id(Out, NS:Local) :- !, - format(Out, '~w:~w', [NS, Local]). -rdf_write_id(Out, Atom) :- - write(Out, Atom). - - -rdf_att_id(Id, _, NS:Local) :- - ns(NS, Full), - Full \== '', - atom_concat(Full, Local, Id), !. -rdf_att_id(Id, _, Id). - - -%% rdf_value(+Resource, -Text, +Encoding) -% -% According to "6.4 RDF URI References" of the RDF Syntax -% specification, a URI reference is UNICODE string not containing -% control sequences, represented as UTF-8 and then as escaped -% US-ASCII. -% -% NOTE: the to_be_described/1 trick ensures entity rewrite in -% resources that start with 'http://t-d-b.org?'. This is a of a -% hack to save the artchive data in the MultimediaN project. We -% should use a more general mechanism. - -rdf_value(V, Text, Encoding) :- - to_be_described(Prefix), - atom_concat(Prefix, V1, V), - ns(NS, Full), - atom_concat(Full, Local, V1), !, - rdf_quote_uri(Local, QLocal0), - xml_quote_attribute(QLocal0, QLocal, Encoding), - atomic_list_concat([Prefix, '&', NS, (';'), QLocal], Text). -rdf_value(V, Text, Encoding) :- - ns(NS, Full), - atom_concat(Full, Local, V), !, - rdf_quote_uri(Local, QLocal0), - xml_quote_attribute(QLocal0, QLocal, Encoding), - atomic_list_concat(['&', NS, (';'), QLocal], Text). -rdf_value(V, Q, Encoding) :- - rdf_quote_uri(V, Q0), - xml_quote_attribute(Q0, Q, Encoding). - -to_be_described('http://t-d-b.org?'). - - - /******************************* - * UTIL * - *******************************/ - -ns(Id, Full) :- - rdf_db:ns(Id, Full). - -:- retract(system:swi_io). - diff --git a/packages/RDF/rdfs.rdfs b/packages/RDF/rdfs.rdfs deleted file mode 100644 index 45260cf2a..000000000 --- a/packages/RDF/rdfs.rdfs +++ /dev/null @@ -1,237 +0,0 @@ - - - - -]> - - - - - - Resource - The class resource, everything. - - - - - type - Indicates membership of a class - - - - - - - Class - The concept of Class - - - - - - subClassOf - Indicates membership of a class - - - - - - - subPropertyOf - Indicates specialization of properties - - - - - - - Property - The concept of a property. - - - - - - comment - Use this for descriptions - - - - - - - label - Provides a human-readable version of a resource name. - - - - - - - domain - A domain class for a property type - - - - - - - range - A range class for a property type - - - - - - - seeAlso - A resource that provides information about the subject resource - - - - - - - - - isDefinedBy - Indicates the namespace of a resource - - - - - - - Literal - This represents the set of atomic values, eg. textual strings. - - - - - Statement - - The class of RDF statements. - - - - - subject - The subject of an RDF statement. - - - - - - - predicate - the predicate of an RDF statement. - - - - - - - object - The object of an RDF statement. - - - - - - Container - - This represents the set Containers. - - - - - Bag - An unordered collection. - - - - - - Seq - An ordered collection. - - - - - - Alt - A collection of alternatives. - - - - - - ContainerMembershipProperty - The container membership properties, rdf:1, rdf:2, ..., all of which are sub-properties of 'member'. - - - - - - member - a member of a container - - - - - - value - Identifies the principal value (usually a string) of a property when the property value is a structured resource - - - - - - - - List - The class of RDF Lists - - - - - nil - The empty list, with no items in it. If the rest of a list is nil then the list has no more items in it. - - - - - first - The first item in an RDF list. Also often called the head. - - - - - - rest - The rest of an RDF list after the first item. Also often called the tail. - - - - - - - Datatype - The class of datatypes. - - - - - XMLLiteral - The class of XML literals. - - - - - - - - diff --git a/packages/RDF/rewrite.pl b/packages/RDF/rewrite.pl deleted file mode 100644 index ccdf49a2a..000000000 --- a/packages/RDF/rewrite.pl +++ /dev/null @@ -1,161 +0,0 @@ -/* Part of SWI-Prolog - - Author: Jan Wielemaker - E-mail: J.Wielemaker@uva.nl - WWW: http://www.swi-prolog.org - Copyright (C): 2010, University of Amsterdam - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - As a special exception, if you link this library with other files, - compiled with a Free Software compiler, to produce an executable, this - library does not by itself cause the resulting executable to be covered - by the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -:- module(rewrite, - [ rewrite/2, % +Rule, +Input - rew_term_expansion/2, - rew_goal_expansion/2, - - op(1200, xfx, (::=)) - ]). -:- use_module(library(quintus)). - -:- meta_predicate - rewrite(1, +). - - /******************************* - * COMPILATION * - *******************************/ - -rew_term_expansion((Rule ::= RuleBody), (Head :- Body)) :- - translate(RuleBody, Term, Body0), - simplify(Body0, Body), - Rule =.. [Name|List], - Head =.. [Name,Term|List]. - -rew_goal_expansion(rewrite(To, From), Goal) :- - nonvar(To), - To = \Rule, - callable(Rule), - Rule =.. [Name|List], - Goal =.. [Name,From|List]. - - - /******************************* - * TOPLEVEL * - *******************************/ - -%% rewrite(:To, +From) -% -% Invoke the term-rewriting system - -rewrite(M:T, From) :- - ( var(T) - -> From = T - ; T = \Rule - -> Rule =.. [Name|List], - Goal =.. [Name,From|List], - M:Goal - ; match(T, M, From) - ). - -match(Rule, M, From) :- - translate(Rule, From, Code), - M:Code. - -translate(Var, Var, true) :- - var(Var), !. -translate((\Command, !), Var, (Goal, !)) :- !, - ( callable(Command), - Command =.. [Name|List] - -> Goal =.. [Name,Var|List] - ; Goal = rewrite(\Command, Var) - ). -translate(\Command, Var, Goal) :- !, - ( callable(Command), - Command =.. [Name|List] - -> Goal =.. [Name,Var|List] - ; Goal = rewrite(\Command, Var) - ). -translate(Atomic, Atomic, true) :- - atomic(Atomic), !. -translate(C, _, Cmd) :- - command(C, Cmd), !. -translate((A, B), T, Code) :- - ( command(A, Cmd) - -> !, translate(B, T, C), - Code = (Cmd, C) - ; command(B, Cmd) - -> !, translate(A, T, C), - Code = (C, Cmd) - ). -translate(Term0, Term, Command) :- - functor(Term0, Name, Arity), - functor(Term, Name, Arity), - translate_args(0, Arity, Term0, Term, Command). - -translate_args(N, N, _, _, true) :- !. -translate_args(I0, Arity, T0, T1, (C0,C)) :- - I is I0 + 1, - arg(I, T0, A0), - arg(I, T1, A1), - translate(A0, A1, C0), - translate_args(I, Arity, T0, T1, C). - -command(0, _) :- !, % catch variables - fail. -command({A}, A). -command(!, !). - - /******************************* - * SIMPLIFY * - *******************************/ - -%% simplify(+Raw, -Simplified) -% -% Get rid of redundant `true' goals generated by translate/3. - -simplify(V, V) :- - var(V), !. -simplify((A0,B), A) :- - B == true, !, - simplify(A0, A). -simplify((A,B0), B) :- - A == true, !, - simplify(B0, B). -simplify((A0, B0), C) :- !, - simplify(A0, A), - simplify(B0, B), - ( ( A \== A0 - ; B \== B0 - ) - -> simplify((A,B), C) - ; C = (A,B) - ). -simplify(X, X). - - /******************************* - * XREF * - *******************************/ - -:- multifile - prolog:called_by/2. - -prolog:called_by(rewrite(Spec, _Term), Called) :- - findall(G+1, sub_term(\G, Spec), Called). diff --git a/packages/RDF/suite/ex_19.rdf b/packages/RDF/suite/ex_19.rdf deleted file mode 100644 index 2c67bb089..000000000 --- a/packages/RDF/suite/ex_19.rdf +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - diff --git a/packages/RDF/suite/ok/ex_19.ok b/packages/RDF/suite/ok/ex_19.ok deleted file mode 100644 index 6929d597e..000000000 --- a/packages/RDF/suite/ok/ex_19.ok +++ /dev/null @@ -1,14 +0,0 @@ -rdf('http://example.org/basket', 'http://example.org/stuff/1.0/hasFruit', '__List1'). -rdf('#l1', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement'). -rdf('#l1', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#subject', 'http://example.org/basket'). -rdf('#l1', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate', 'http://example.org/stuff/1.0/hasFruit'). -rdf('#l1', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#object', '__List1'). -rdf('__List1', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#List'). -rdf('__List1', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', 'http://example.org/banana'). -rdf('__List1', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest', '__List2'). -rdf('__List2', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#List'). -rdf('__List2', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', 'http://example.org/apple'). -rdf('__List2', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest', '__List3'). -rdf('__List3', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#List'). -rdf('__List3', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', 'http://example.org/pear'). -rdf('__List3', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#nil'). diff --git a/packages/RDF/suite/ok/t1.ok b/packages/RDF/suite/ok/t1.ok deleted file mode 100644 index 4234741be..000000000 --- a/packages/RDF/suite/ok/t1.ok +++ /dev/null @@ -1 +0,0 @@ -rdf('http://www.w3.org/Home/Lassila', 'http://description.org/schema/':'Creator', literal('Ora Lassila')). diff --git a/packages/RDF/suite/ok/t11.ok b/packages/RDF/suite/ok/t11.ok deleted file mode 100644 index 54903a32c..000000000 --- a/packages/RDF/suite/ok/t11.ok +++ /dev/null @@ -1 +0,0 @@ -rdf('http://www.swi.psy.uva.nl/projects/SWI-Prolog/', 'http://description.org/schema/':'Creator', literal('Jan Wielemaker')). diff --git a/packages/RDF/suite/ok/t12.ok b/packages/RDF/suite/ok/t12.ok deleted file mode 100644 index 4234741be..000000000 --- a/packages/RDF/suite/ok/t12.ok +++ /dev/null @@ -1 +0,0 @@ -rdf('http://www.w3.org/Home/Lassila', 'http://description.org/schema/':'Creator', literal('Ora Lassila')). diff --git a/packages/RDF/suite/ok/t13.ok b/packages/RDF/suite/ok/t13.ok deleted file mode 100644 index 4234741be..000000000 --- a/packages/RDF/suite/ok/t13.ok +++ /dev/null @@ -1 +0,0 @@ -rdf('http://www.w3.org/Home/Lassila', 'http://description.org/schema/':'Creator', literal('Ora Lassila')). diff --git a/packages/RDF/suite/ok/t14.ok b/packages/RDF/suite/ok/t14.ok deleted file mode 100644 index e2ed4d02d..000000000 --- a/packages/RDF/suite/ok/t14.ok +++ /dev/null @@ -1,3 +0,0 @@ -rdf('http://www.w3.org', 'http://description.org/schema/Publisher', literal('World Wide Web Consortium')). -rdf('http://www.w3.org', 'http://description.org/schema/Title', literal('W3C Home Page')). -rdf('http://www.w3.org', 'http://description.org/schema/Date', literal('1998-10-03T02:27')). diff --git a/packages/RDF/suite/ok/t15.ok b/packages/RDF/suite/ok/t15.ok deleted file mode 100644 index e2ed4d02d..000000000 --- a/packages/RDF/suite/ok/t15.ok +++ /dev/null @@ -1,3 +0,0 @@ -rdf('http://www.w3.org', 'http://description.org/schema/Publisher', literal('World Wide Web Consortium')). -rdf('http://www.w3.org', 'http://description.org/schema/Title', literal('W3C Home Page')). -rdf('http://www.w3.org', 'http://description.org/schema/Date', literal('1998-10-03T02:27')). diff --git a/packages/RDF/suite/ok/t16.ok b/packages/RDF/suite/ok/t16.ok deleted file mode 100644 index 607ee12ea..000000000 --- a/packages/RDF/suite/ok/t16.ok +++ /dev/null @@ -1,3 +0,0 @@ -rdf('http://www.w3.org/Home/Lassila', 'http://description.org/schema/':'Creator', 'http://www.w3.org/staffId/85740'). -rdf('http://www.w3.org/staffId/85740', 'http://description.org/schema/':'Name', literal('Ora Lassila')). -rdf('http://www.w3.org/staffId/85740', 'http://description.org/schema/':'Email', literal('lassila@w3.org')). diff --git a/packages/RDF/suite/ok/t17.ok b/packages/RDF/suite/ok/t17.ok deleted file mode 100644 index c1976913a..000000000 --- a/packages/RDF/suite/ok/t17.ok +++ /dev/null @@ -1,3 +0,0 @@ -rdf('http://www.w3.org/staffId/85740', 'http://description.org/schema/':'Name', literal('Ora Lassila')). -rdf('http://www.w3.org/staffId/85740', 'http://description.org/schema/':'Email', literal('lassila@w3.org')). -rdf('http://www.w3.org/Home/Lassila', 'http://description.org/schema/':'Creator', 'http://www.w3.org/staffId/85740'). diff --git a/packages/RDF/suite/ok/t18.ok b/packages/RDF/suite/ok/t18.ok deleted file mode 100644 index c1976913a..000000000 --- a/packages/RDF/suite/ok/t18.ok +++ /dev/null @@ -1,3 +0,0 @@ -rdf('http://www.w3.org/staffId/85740', 'http://description.org/schema/':'Name', literal('Ora Lassila')). -rdf('http://www.w3.org/staffId/85740', 'http://description.org/schema/':'Email', literal('lassila@w3.org')). -rdf('http://www.w3.org/Home/Lassila', 'http://description.org/schema/':'Creator', 'http://www.w3.org/staffId/85740'). diff --git a/packages/RDF/suite/ok/t19.ok b/packages/RDF/suite/ok/t19.ok deleted file mode 100644 index de0eccc11..000000000 --- a/packages/RDF/suite/ok/t19.ok +++ /dev/null @@ -1,4 +0,0 @@ -rdf('http://www.w3.org/staffId/85740', rdf:type, 'http://description.org/schema/Person'). -rdf('http://www.w3.org/staffId/85740', 'http://description.org/view/':'Name', literal('Ora Lassila')). -rdf('http://www.w3.org/staffId/85740', 'http://description.org/view/':'Email', literal('lassila@w3.org')). -rdf('http://www.w3.org/Home/Lassila', 'http://description.org/schema/':'Creator', 'http://www.w3.org/staffId/85740'). diff --git a/packages/RDF/suite/ok/t2.ok b/packages/RDF/suite/ok/t2.ok deleted file mode 100644 index 288860a45..000000000 --- a/packages/RDF/suite/ok/t2.ok +++ /dev/null @@ -1,3 +0,0 @@ -rdf('JW', sex, literal(male)). -rdf('JW', employed_at, literal('SWI')). -rdf('SWI-prolog', 'http://description.org/schema/':'Creator', 'JW'). diff --git a/packages/RDF/suite/ok/t20.ok b/packages/RDF/suite/ok/t20.ok deleted file mode 100644 index de0eccc11..000000000 --- a/packages/RDF/suite/ok/t20.ok +++ /dev/null @@ -1,4 +0,0 @@ -rdf('http://www.w3.org/staffId/85740', rdf:type, 'http://description.org/schema/Person'). -rdf('http://www.w3.org/staffId/85740', 'http://description.org/view/':'Name', literal('Ora Lassila')). -rdf('http://www.w3.org/staffId/85740', 'http://description.org/view/':'Email', literal('lassila@w3.org')). -rdf('http://www.w3.org/Home/Lassila', 'http://description.org/schema/':'Creator', 'http://www.w3.org/staffId/85740'). diff --git a/packages/RDF/suite/ok/t21.ok b/packages/RDF/suite/ok/t21.ok deleted file mode 100644 index 1fa5f0a49..000000000 --- a/packages/RDF/suite/ok/t21.ok +++ /dev/null @@ -1,7 +0,0 @@ -rdf('__Bag1', rdf:type, rdf:'Bag'). -rdf('__Bag1', rdf:'_1', 'http://mycollege.edu/students/Amy'). -rdf('__Bag1', rdf:'_2', 'http://mycollege.edu/students/Tim'). -rdf('__Bag1', rdf:'_3', 'http://mycollege.edu/students/John'). -rdf('__Bag1', rdf:'_4', 'http://mycollege.edu/students/Mary'). -rdf('__Bag1', rdf:'_5', 'http://mycollege.edu/students/Sue'). -rdf('http://mycollege.edu/courses/6.001', 'http://description.org/schema/':students, '__Bag1'). diff --git a/packages/RDF/suite/ok/t22.ok b/packages/RDF/suite/ok/t22.ok deleted file mode 100644 index a342189e8..000000000 --- a/packages/RDF/suite/ok/t22.ok +++ /dev/null @@ -1,5 +0,0 @@ -rdf('__Alt1', rdf:type, rdf:'Alt'). -rdf('__Alt1', rdf:'_1', 'ftp://ftp.x.org'). -rdf('__Alt1', rdf:'_2', 'ftp://ftp.cs.purdue.edu'). -rdf('__Alt1', rdf:'_3', 'ftp://ftp.eu.net'). -rdf('http://x.org/packages/X11', 'http://description.org/schema/':'DistributionSite', '__Alt1'). diff --git a/packages/RDF/suite/ok/t24.ok b/packages/RDF/suite/ok/t24.ok deleted file mode 100644 index ea31d774b..000000000 --- a/packages/RDF/suite/ok/t24.ok +++ /dev/null @@ -1,5 +0,0 @@ -rdf('__Description1', rdf:subject, 'http://www.w3.org/Home/Lassila'). -rdf('__Description1', rdf:predicate, 'http://description.org/schema/Creator'). -rdf('__Description1', rdf:object, literal('Ora Lassila')). -rdf('__Description1', rdf:type, 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement'). -rdf('__Description1', 'http://description.org/schema/':attributedTo, literal('Ralph Swick')). diff --git a/packages/RDF/suite/ok/t26.ok b/packages/RDF/suite/ok/t26.ok deleted file mode 100644 index d0f836d36..000000000 --- a/packages/RDF/suite/ok/t26.ok +++ /dev/null @@ -1,8 +0,0 @@ -rdf('#JSPapersByDate', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Seq'). -rdf('#JSPapersByDate', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#_1', 'http://www.dogworld.com/Aug96.doc'). -rdf('#JSPapersByDate', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#_2', 'http://www.webnuts.net/Jan97.html'). -rdf('#JSPapersByDate', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#_3', 'http://www.carchat.com/Sept97.html'). -rdf('#JSPapersBySubj', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Seq'). -rdf('#JSPapersBySubj', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#_1', 'http://www.carchat.com/Sept97.html'). -rdf('#JSPapersBySubj', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#_2', 'http://www.dogworld.com/Aug96.doc'). -rdf('#JSPapersBySubj', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#_3', 'http://www.webnuts.net/Jan97.html'). diff --git a/packages/RDF/suite/ok/t27.ok b/packages/RDF/suite/ok/t27.ok deleted file mode 100644 index d336aa9c7..000000000 --- a/packages/RDF/suite/ok/t27.ok +++ /dev/null @@ -1,12 +0,0 @@ -rdf('#CreatorsAlphabeticalBySurname', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Seq'). -rdf('#CreatorsAlphabeticalBySurname', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#_1', literal('Mary Andrew')). -rdf('#CreatorsAlphabeticalBySurname', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#_2', literal('Jacky Crystal')). -rdf('http://www.foo.com/cool.html', 'http://purl.org/metadata/dublin_core#Creator', '#CreatorsAlphabeticalBySurname'). -rdf('#MirroredSites', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag'). -rdf('#MirroredSites', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#_1', 'http://www.foo.com.au/cool.html'). -rdf('#MirroredSites', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#_2', 'http://www.foo.com.it/cool.html'). -rdf('http://www.foo.com/cool.html', 'http://purl.org/metadata/dublin_core#Identifier', '#MirroredSites'). -rdf('__Description1', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Alt'). -rdf('__Description1', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#_1', literal(lang(en, 'The Coolest Web Page'))). -rdf('__Description1', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#_2', literal(lang(it, 'Il Pagio di Web Fuba'))). -rdf('http://www.foo.com/cool.html', 'http://purl.org/metadata/dublin_core#Title', '__Description1'). diff --git a/packages/RDF/suite/ok/t28.ok b/packages/RDF/suite/ok/t28.ok deleted file mode 100644 index d07bf3ca0..000000000 --- a/packages/RDF/suite/ok/t28.ok +++ /dev/null @@ -1,3 +0,0 @@ -rdf('__Description1', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#':value, literal('020 - Library Science')). -rdf('__Description1', 'http://mycorp.com/schemas/my-schema#':'Classification', literal('Dewey Decimal Code')). -rdf('http://www.webnuts.net/Jan97.html', 'http://purl.org/metadata/dublin_core#':'Subject', '__Description1'). diff --git a/packages/RDF/suite/ok/t29.ok b/packages/RDF/suite/ok/t29.ok deleted file mode 100644 index 3954da907..000000000 --- a/packages/RDF/suite/ok/t29.ok +++ /dev/null @@ -1,3 +0,0 @@ -rdf('__Description1', rdf:value, literal('200')). -rdf('__Description1', 'http://www.nist.gov/units/':units, 'http://www.nist.gov/units/Pounds'). -rdf('John_Smith', 'http://www.nist.gov/units/':weight, '__Description1'). diff --git a/packages/RDF/suite/ok/t3.ok b/packages/RDF/suite/ok/t3.ok deleted file mode 100644 index deefa2af5..000000000 --- a/packages/RDF/suite/ok/t3.ok +++ /dev/null @@ -1,3 +0,0 @@ -rdf('#JW', 'http://description.org/schema/name', literal('Jan Wielemaker')). -rdf('#JW', 'http://description.org/schema/works_at', literal('SWI')). -rdf('http://www.swi.psy.uva.nl/projects/SWI-Prolog/', 'http://description.org/schema/Creator', '#JW'). diff --git a/packages/RDF/suite/ok/t30.ok b/packages/RDF/suite/ok/t30.ok deleted file mode 100644 index 742e83e6d..000000000 --- a/packages/RDF/suite/ok/t30.ok +++ /dev/null @@ -1,12 +0,0 @@ -rdf('http://www.dlib.org', 'http://purl.org/metadata/dublin_core#Title', literal('D-Lib Program - Research in Digital Libraries')). -rdf('http://www.dlib.org', 'http://purl.org/metadata/dublin_core#Description', literal('The D-Lib program supports the community of people\n with research interests in digital libraries and electronic\n publishing.')). -rdf('http://www.dlib.org', 'http://purl.org/metadata/dublin_core#Publisher', literal('Corporation For National Research Initiatives')). -rdf('http://www.dlib.org', 'http://purl.org/metadata/dublin_core#Date', literal('1995-01-07')). -rdf('__Bag1', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag'). -rdf('__Bag1', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#_1', literal('Research; statistical methods')). -rdf('__Bag1', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#_2', literal('Education, research, related topics')). -rdf('__Bag1', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#_3', literal('Library use Studies')). -rdf('http://www.dlib.org', 'http://purl.org/metadata/dublin_core#Subject', '__Bag1'). -rdf('http://www.dlib.org', 'http://purl.org/metadata/dublin_core#Type', literal('World Wide Web Home Page')). -rdf('http://www.dlib.org', 'http://purl.org/metadata/dublin_core#Format', literal('text/html')). -rdf('http://www.dlib.org', 'http://purl.org/metadata/dublin_core#Language', literal(en)). diff --git a/packages/RDF/suite/ok/t31.ok b/packages/RDF/suite/ok/t31.ok deleted file mode 100644 index d4623723e..000000000 --- a/packages/RDF/suite/ok/t31.ok +++ /dev/null @@ -1,17 +0,0 @@ -rdf('http://www.dlib.org/dlib/may98/05contents.html', 'http://purl.org/metadata/dublin_core#Title', literal('DLIB Magazine - The Magazine for Digital Library Research\n - May 1998')). -rdf('http://www.dlib.org/dlib/may98/05contents.html', 'http://purl.org/metadata/dublin_core#Description', literal('D-LIB magazine is a monthly compilation of\n contributed stories, commentary, and briefings.')). -rdf('__Description1', 'http://purl.org/metadata/dublin_core_qualifiers#AgentType', 'http://purl.org/metadata/dublin_core_qualifiers#Editor'). -rdf('__Description1', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#value', literal('Amy Friedlander')). -rdf('http://www.dlib.org/dlib/may98/05contents.html', 'http://purl.org/metadata/dublin_core#Contributor', '__Description1'). -rdf('http://www.dlib.org/dlib/may98/05contents.html', 'http://purl.org/metadata/dublin_core#Publisher', literal('Corporation for National Research Initiatives')). -rdf('http://www.dlib.org/dlib/may98/05contents.html', 'http://purl.org/metadata/dublin_core#Date', literal('1998-01-05')). -rdf('http://www.dlib.org/dlib/may98/05contents.html', 'http://purl.org/metadata/dublin_core#Type', literal('electronic journal')). -rdf('__Bag1', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag'). -rdf('__Bag1', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#_1', literal('library use studies')). -rdf('__Bag1', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#_2', literal('magazines and newspapers')). -rdf('http://www.dlib.org/dlib/may98/05contents.html', 'http://purl.org/metadata/dublin_core#Subject', '__Bag1'). -rdf('http://www.dlib.org/dlib/may98/05contents.html', 'http://purl.org/metadata/dublin_core#Format', literal('text/html')). -rdf('http://www.dlib.org/dlib/may98/05contents.html', 'http://purl.org/metadata/dublin_core#Identifier', literal('urn:issn:1082-9873')). -rdf('__Description2', 'http://purl.org/metadata/dublin_core_qualifiers#RelationType', 'http://purl.org/metadata/dublin_core_qualifiers#IsPartOf'). -rdf('__Description2', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#value', 'http://www.dlib.org'). -rdf('http://www.dlib.org/dlib/may98/05contents.html', 'http://purl.org/metadata/dublin_core#Relation', '__Description2'). diff --git a/packages/RDF/suite/ok/t32.ok b/packages/RDF/suite/ok/t32.ok deleted file mode 100644 index 4ad411708..000000000 --- a/packages/RDF/suite/ok/t32.ok +++ /dev/null @@ -1,15 +0,0 @@ -rdf('http://www.dlib.org/dlib/may98/miller/05miller.html', 'http://purl.org/metadata/dublin_core#':'Title', literal('An Introduction to the Resource Description Framework')). -rdf('http://www.dlib.org/dlib/may98/miller/05miller.html', 'http://purl.org/metadata/dublin_core#':'Creator', literal('Eric J. Miller')). -rdf('http://www.dlib.org/dlib/may98/miller/05miller.html', 'http://purl.org/metadata/dublin_core#':'Description', literal('The Resource Description Framework (RDF) is an\n infrastructure that enables the encoding, exchange and reuse of\n structured metadata. rdf is an application of xml that imposes needed\n structural constraints to provide unambiguous methods of expressing\n semantics. rdf additionally provides a means for publishing both\n human-readable and machine-processable vocabularies designed to\n encourage the reuse and extension of metadata semantics among\n disparate information communities. the structural constraints rdf\n imposes to support the consistent encoding and exchange of\n standardized metadata provides for the interchangeability of separate\n packages of metadata defined by different resource description\n communities. ')). -rdf('http://www.dlib.org/dlib/may98/miller/05miller.html', 'http://purl.org/metadata/dublin_core#':'Publisher', literal('Corporation for National Research Initiatives')). -rdf('__Bag1', rdf:type, rdf:'Bag'). -rdf('__Bag1', rdf:'_1', literal('machine-readable catalog record formats')). -rdf('__Bag1', rdf:'_2', literal('applications of computer file organization and\n\t access methods')). -rdf('http://www.dlib.org/dlib/may98/miller/05miller.html', 'http://purl.org/metadata/dublin_core#':'Subject', '__Bag1'). -rdf('http://www.dlib.org/dlib/may98/miller/05miller.html', 'http://purl.org/metadata/dublin_core#':'Rights', literal('Copyright @ 1998 Eric Miller')). -rdf('http://www.dlib.org/dlib/may98/miller/05miller.html', 'http://purl.org/metadata/dublin_core#':'Type', literal('Electronic Document')). -rdf('http://www.dlib.org/dlib/may98/miller/05miller.html', 'http://purl.org/metadata/dublin_core#':'Format', literal('text/html')). -rdf('http://www.dlib.org/dlib/may98/miller/05miller.html', 'http://purl.org/metadata/dublin_core#':'Language', literal(en)). -rdf('__Description1', 'http://purl.org/metadata/dublin_core_qualifiers#':'RelationType', 'http://purl.org/metadata/dublin_core_qualifiers#IsPartOf'). -rdf('__Description1', rdf:value, 'http://www.dlib.org/dlib/may98/05contents.html'). -rdf('http://www.dlib.org/dlib/may98/miller/05miller.html', 'http://purl.org/metadata/dublin_core#':'Relation', '__Description1'). diff --git a/packages/RDF/suite/ok/t33.ok b/packages/RDF/suite/ok/t33.ok deleted file mode 100644 index 01924299f..000000000 --- a/packages/RDF/suite/ok/t33.ok +++ /dev/null @@ -1,2 +0,0 @@ -rdf('http://mycorp.com/papers/NobelPaper1', 'http://purl.org/metadata/dublin_core#Title', literal(type('http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral', ['Ramifications of ', element('http://www.w3.org/TR/REC-mathml':apply, [], [element('http://www.w3.org/TR/REC-mathml':power, [], []), element('http://www.w3.org/TR/REC-mathml':apply, [], [element('http://www.w3.org/TR/REC-mathml':plus, [], []), element('http://www.w3.org/TR/REC-mathml':ci, [], [a]), element('http://www.w3.org/TR/REC-mathml':ci, [], [b])]), element('http://www.w3.org/TR/REC-mathml':cn, [], ['2'])]), ' to World Peace\n ']))). -rdf('http://mycorp.com/papers/NobelPaper1', 'http://purl.org/metadata/dublin_core#Creator', literal('David Hume')). diff --git a/packages/RDF/suite/ok/t36.ok b/packages/RDF/suite/ok/t36.ok deleted file mode 100644 index a300fbb58..000000000 --- a/packages/RDF/suite/ok/t36.ok +++ /dev/null @@ -1,4 +0,0 @@ -rdf('#CreatorsAlphabeticalBySurname', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Seq'). -rdf('#CreatorsAlphabeticalBySurname', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#_1', literal('Mary Andrew')). -rdf('#CreatorsAlphabeticalBySurname', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#_2', literal('Jacky Crystal')). -rdf('http://www.foo.com/cool.html', 'http://purl.org/metadata/dublin_core#Creator', '#CreatorsAlphabeticalBySurname'). diff --git a/packages/RDF/suite/ok/t37.ok b/packages/RDF/suite/ok/t37.ok deleted file mode 100644 index e8d9b8e06..000000000 --- a/packages/RDF/suite/ok/t37.ok +++ /dev/null @@ -1,7 +0,0 @@ -rdf('JW', 'http://description.org/schema/name', literal('Jan Wielemaker')). -rdf('JW', 'http://description.org/schema/works_at', literal('SWI')). -rdf('http://www.swi.psy.uva.nl/projects/SWI-Prolog/', 'http://description.org/schema/Creator', 'JW'). -rdf('#pl-creator', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement'). -rdf('#pl-creator', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#subject', 'http://www.swi.psy.uva.nl/projects/SWI-Prolog/'). -rdf('#pl-creator', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate', 'http://description.org/schema/Creator'). -rdf('#pl-creator', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#object', 'JW'). diff --git a/packages/RDF/suite/ok/t38.ok b/packages/RDF/suite/ok/t38.ok deleted file mode 100644 index 179a92e52..000000000 --- a/packages/RDF/suite/ok/t38.ok +++ /dev/null @@ -1,128 +0,0 @@ -rdf('#Resource', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/2000/01/rdf-schema#Class'). -rdf('#Resource', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(en, 'Resource'))). -rdf('#Resource', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(fr, 'Ressource'))). -rdf('#Resource', 'http://www.w3.org/2000/01/rdf-schema#comment', literal('The most general class')). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Property'). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(en, type))). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(fr, type))). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/2000/01/rdf-schema#comment', literal('Indicates membership of a class')). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/2000/01/rdf-schema#range', '#Class'). -rdf('#comment', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Property'). -rdf('#comment', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(en, comment))). -rdf('#comment', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(fr, commentaire))). -rdf('#comment', 'http://www.w3.org/2000/01/rdf-schema#domain', '#Resource'). -rdf('#comment', 'http://www.w3.org/2000/01/rdf-schema#comment', literal('Use this for descriptions')). -rdf('#comment', 'http://www.w3.org/2000/01/rdf-schema#range', '#Literal'). -rdf('#label', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Property'). -rdf('#label', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Property'). -rdf('#label', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(en, label))). -rdf('#label', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(fr, label))). -rdf('#label', 'http://www.w3.org/2000/01/rdf-schema#domain', '#Resource'). -rdf('#label', 'http://www.w3.org/2000/01/rdf-schema#comment', literal('Provides a human-readable version of a resource name.')). -rdf('#label', 'http://www.w3.org/2000/01/rdf-schema#range', '#Literal'). -rdf('#Class', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/2000/01/rdf-schema#Class'). -rdf('#Class', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(en, 'Class'))). -rdf('#Class', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(fr, 'Classe'))). -rdf('#Class', 'http://www.w3.org/2000/01/rdf-schema#comment', literal('The concept of Class')). -rdf('#Class', 'http://www.w3.org/2000/01/rdf-schema#subClassOf', '#Resource'). -rdf('#subClassOf', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Property'). -rdf('#subClassOf', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(en, subClassOf))). -rdf('#subClassOf', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(fr, sousClasseDe))). -rdf('#subClassOf', 'http://www.w3.org/2000/01/rdf-schema#comment', literal('Indicates membership of a class')). -rdf('#subClassOf', 'http://www.w3.org/2000/01/rdf-schema#range', '#Class'). -rdf('#subClassOf', 'http://www.w3.org/2000/01/rdf-schema#domain', '#Class'). -rdf('#subPropertyOf', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Property'). -rdf('#subPropertyOf', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(en, subPropertyOf))). -rdf('#subPropertyOf', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(fr, sousPropriétéDe))). -rdf('#subPropertyOf', 'http://www.w3.org/2000/01/rdf-schema#comment', literal('Indicates specialization of properties')). -rdf('#subPropertyOf', 'http://www.w3.org/2000/01/rdf-schema#range', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Property'). -rdf('#subPropertyOf', 'http://www.w3.org/2000/01/rdf-schema#domain', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Property'). -rdf('#seeAlso', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Property'). -rdf('#seeAlso', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(en, seeAlso))). -rdf('#seeAlso', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(fr, voirAussi))). -rdf('#seeAlso', 'http://www.w3.org/2000/01/rdf-schema#comment', literal('Indicates a resource that provides information about the subject resource.')). -rdf('#seeAlso', 'http://www.w3.org/2000/01/rdf-schema#range', 'http://www.w3.org/2000/01/rdf-schema#Resource'). -rdf('#seeAlso', 'http://www.w3.org/2000/01/rdf-schema#domain', 'http://www.w3.org/2000/01/rdf-schema#Resource'). -rdf('#isDefinedBy', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Property'). -rdf('#isDefinedBy', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Property'). -rdf('#isDefinedBy', 'http://www.w3.org/2000/01/rdf-schema#subPropertyOf', '#seeAlso'). -rdf('#isDefinedBy', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(en, isDefinedBy))). -rdf('#isDefinedBy', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(fr, esDéfiniPar))). -rdf('#isDefinedBy', 'http://www.w3.org/2000/01/rdf-schema#comment', literal('Indicates a resource containing and defining the subject resource.')). -rdf('#isDefinedBy', 'http://www.w3.org/2000/01/rdf-schema#range', 'http://www.w3.org/2000/01/rdf-schema#Resource'). -rdf('#isDefinedBy', 'http://www.w3.org/2000/01/rdf-schema#domain', 'http://www.w3.org/2000/01/rdf-schema#Resource'). -rdf('#ConstraintResource', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/2000/01/rdf-schema#Class'). -rdf('#ConstraintResource', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(en, 'ConstraintResource'))). -rdf('#ConstraintResource', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(fr, 'RessourceContrainte'))). -rdf('#ConstraintResource', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', '#Class'). -rdf('#ConstraintResource', 'http://www.w3.org/2000/01/rdf-schema#subClassOf', '#Resource'). -rdf('#ConstraintResource', 'http://www.w3.org/2000/01/rdf-schema#comment', literal('Resources used to express RDF Schema constraints.')). -rdf('#ConstraintProperty', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/2000/01/rdf-schema#Class'). -rdf('#ConstraintProperty', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(en, 'ConstraintProperty'))). -rdf('#ConstraintProperty', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(fr, 'PropriétéContrainte'))). -rdf('#ConstraintProperty', 'http://www.w3.org/2000/01/rdf-schema#subClassOf', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Property'). -rdf('#ConstraintProperty', 'http://www.w3.org/2000/01/rdf-schema#subClassOf', '#ConstraintResource'). -rdf('#ConstraintProperty', 'http://www.w3.org/2000/01/rdf-schema#comment', literal('Properties used to express RDF Schema constraints.')). -rdf('#domain', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/2000/01/rdf-schema#ConstraintProperty'). -rdf('#domain', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(en, domain))). -rdf('#domain', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(fr, domaine))). -rdf('#domain', 'http://www.w3.org/2000/01/rdf-schema#comment', literal('This is how we associate a class with\n properties that its instances can have')). -rdf('#range', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/2000/01/rdf-schema#ConstraintProperty'). -rdf('#range', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(en, range))). -rdf('#range', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(fr, étendue))). -rdf('#range', 'http://www.w3.org/2000/01/rdf-schema#comment', literal('Properties that can be used in a\n schema to provide constraints')). -rdf('#range', 'http://www.w3.org/2000/01/rdf-schema#range', '#Class'). -rdf('#range', 'http://www.w3.org/2000/01/rdf-schema#domain', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Property'). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#Property', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/2000/01/rdf-schema#Class'). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#Property', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(en, 'Property'))). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#Property', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(fr, 'Propriété'))). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#Property', 'http://www.w3.org/2000/01/rdf-schema#comment', literal('The concept of a property.')). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#Property', 'http://www.w3.org/2000/01/rdf-schema#subClassOf', '#Resource'). -rdf('#Literal', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/2000/01/rdf-schema#Class'). -rdf('#Literal', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(en, 'Literal'))). -rdf('#Literal', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(fr, 'Littéral'))). -rdf('#Literal', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', '#Class'). -rdf('#Literal', 'http://www.w3.org/2000/01/rdf-schema#comment', literal('This represents the set of atomic values, eg. textual strings.')). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/2000/01/rdf-schema#Class'). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(en, 'Statement'))). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(fr, 'Déclaration'))). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement', 'http://www.w3.org/2000/01/rdf-schema#subClassOf', '#Resource'). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement', 'http://www.w3.org/2000/01/rdf-schema#comment', literal('This represents the set of reified statements.')). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#subject', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Property'). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#subject', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(en, subject))). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#subject', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(fr, sujet))). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#subject', 'http://www.w3.org/2000/01/rdf-schema#domain', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement'). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#subject', 'http://www.w3.org/2000/01/rdf-schema#range', '#Resource'). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Property'). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(en, predicate))). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(fr, prédicat))). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Property'). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate', 'http://www.w3.org/2000/01/rdf-schema#domain', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement'). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate', 'http://www.w3.org/2000/01/rdf-schema#range', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Property'). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#object', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Property'). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#object', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(en, object))). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#object', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(fr, objet))). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#object', 'http://www.w3.org/2000/01/rdf-schema#domain', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement'). -rdf('#Container', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/2000/01/rdf-schema#Class'). -rdf('#Container', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(en, 'Container'))). -rdf('#Container', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(fr, 'Enveloppe'))). -rdf('#Container', 'http://www.w3.org/2000/01/rdf-schema#subClassOf', '#Resource'). -rdf('#Container', 'http://www.w3.org/2000/01/rdf-schema#comment', literal('This represents the set Containers.')). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/2000/01/rdf-schema#Class'). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(en, 'Bag'))). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(fr, 'Ensemble'))). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag', 'http://www.w3.org/2000/01/rdf-schema#subClassOf', '#Container'). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#Seq', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/2000/01/rdf-schema#Class'). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#Seq', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(en, 'Sequence'))). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#Seq', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(fr, 'Séquence'))). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#Seq', 'http://www.w3.org/2000/01/rdf-schema#subClassOf', '#Container'). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#Alt', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/2000/01/rdf-schema#Class'). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#Alt', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(en, 'Alt'))). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#Alt', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(fr, 'Choix'))). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#Alt', 'http://www.w3.org/2000/01/rdf-schema#subClassOf', '#Container'). -rdf('#ContainerMembershipProperty', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/2000/01/rdf-schema#Class'). -rdf('#ContainerMembershipProperty', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(en, 'ContainerMembershipProperty'))). -rdf('#ContainerMembershipProperty', 'http://www.w3.org/2000/01/rdf-schema#subClassOf', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Property'). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#value', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Property'). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#value', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(en, object))). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#value', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(fr, value))). diff --git a/packages/RDF/suite/ok/t39.ok b/packages/RDF/suite/ok/t39.ok deleted file mode 100644 index a8783e805..000000000 --- a/packages/RDF/suite/ok/t39.ok +++ /dev/null @@ -1,9 +0,0 @@ -rdf('#OntologyObjectMetaClass', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/TR/1999/PR-rdf-schema-19990303#Class'). -rdf('#OntologyObjectMetaClass', 'http://www.w3.org/TR/1999/PR-rdf-schema-19990303#subClassOf', 'http://www.w3.org/TR/1999/PR-rdf-schema-19990303#Class'). -rdf('#OntologyObjectMetaClass', 'http://smi-web.stanford.edu/projects/protege/protege-rdf/protege-19992012#abstractProperty', literal(concrete)). -rdf('#identifier', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/TR/1999/PR-rdf-schema-19990303#Property'). -rdf('__Description1', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/rdfutil#facetResource'). -rdf('__Description1', 'http://www.w3.org/rdfutil#domain', '#OntologyObjectMetaClass'). -rdf('__Description1', 'http://www.w3.org/rdfutil#range', 'http://www.w3.org/TR/xmlschema-2/#string'). -rdf('__Description1', 'http://www.w3.org/rdfutil#cardinality', literal('1')). -rdf('#identifier', 'http://www.w3.org/rdfutil#facets', '__Description1'). diff --git a/packages/RDF/suite/ok/t4.ok b/packages/RDF/suite/ok/t4.ok deleted file mode 100644 index cc5a51aba..000000000 --- a/packages/RDF/suite/ok/t4.ok +++ /dev/null @@ -1,6 +0,0 @@ -rdf('http://www.w3.org/Home/Lassila', 'http://description.org/schema/Creator', literal('Ora Lassila')). -rdf('#statement1', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement'). -rdf('#statement1', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#subject', 'http://www.w3.org/Home/Lassila'). -rdf('#statement1', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate', 'http://description.org/schema/Creator'). -rdf('#statement1', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#object', literal('Ora Lassila')). -rdf('#statement1', 'http://description.org/schema/believedBy', literal('Stefan Decker')). diff --git a/packages/RDF/suite/ok/t40.ok b/packages/RDF/suite/ok/t40.ok deleted file mode 100644 index 71c6ab496..000000000 --- a/packages/RDF/suite/ok/t40.ok +++ /dev/null @@ -1,4 +0,0 @@ -rdf('__Description1', rdf:type, 'http://www.mytypes.org/schema/Bicycle'). -rdf('__Description1', wheels, literal('2')). -rdf('__Description2', rdf:type, 'http://www.mytypes.org/schema/Bicycle'). -rdf('__Description2', 'http://www.mytypes.org/schema/':wheels, literal('2')). diff --git a/packages/RDF/suite/ok/t41.ok b/packages/RDF/suite/ok/t41.ok deleted file mode 100644 index 64717aa1c..000000000 --- a/packages/RDF/suite/ok/t41.ok +++ /dev/null @@ -1,3 +0,0 @@ -rdf('#JohnWeight', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#value', literal('200')). -rdf('#JohnWeight', 'http://www.nist.gov/units/units', 'http://www.nist.gov/units/Pounds'). -rdf('John_Smith', 'http://www.nist.gov/units/weight', '#JohnWeight'). diff --git a/packages/RDF/suite/ok/t42.ok b/packages/RDF/suite/ok/t42.ok deleted file mode 100644 index 326e0a56d..000000000 --- a/packages/RDF/suite/ok/t42.ok +++ /dev/null @@ -1,4 +0,0 @@ -rdf('John_Smith', a1, literal('John')). -rdf('__Description1', v, literal('200')). -rdf('__Description1', t, literal(pounds)). -rdf('John_Smith', a1, '__Description1'). diff --git a/packages/RDF/suite/ok/t5.ok b/packages/RDF/suite/ok/t5.ok deleted file mode 100644 index 8ed206309..000000000 --- a/packages/RDF/suite/ok/t5.ok +++ /dev/null @@ -1,7 +0,0 @@ -rdf('__Description1', name, literal('Jan Wielemaker')). -rdf('__Description1', works_at, literal('SWI')). -rdf('http://www.swi.psy.uva.nl/projects/SWI-Prolog/', 'http://description.org/schema/Creator', '__Description1'). -rdf('#JW', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement'). -rdf('#JW', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#subject', 'http://www.swi.psy.uva.nl/projects/SWI-Prolog/'). -rdf('#JW', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate', 'http://description.org/schema/Creator'). -rdf('#JW', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#object', '__Description1'). diff --git a/packages/RDF/suite/ok/t6.ok b/packages/RDF/suite/ok/t6.ok deleted file mode 100644 index 281850d72..000000000 --- a/packages/RDF/suite/ok/t6.ok +++ /dev/null @@ -1,4 +0,0 @@ -rdf('__Bag1', rdf:type, rdf:'Bag'). -rdf('__Bag1', rdf:'_1', literal('Jan Wielemaker')). -rdf('__Bag1', rdf:'_2', literal('Anjo Anjewierden')). -rdf('http://www.swi.psy.uva.nl/projects/xpce/', 'http://description.org/schema/':'Creator', '__Bag1'). diff --git a/packages/RDF/suite/ok/t7.ok b/packages/RDF/suite/ok/t7.ok deleted file mode 100644 index f200bb6f8..000000000 --- a/packages/RDF/suite/ok/t7.ok +++ /dev/null @@ -1,5 +0,0 @@ -rdf('__Bag1', rdf:type, rdf:'Bag'). -rdf('__Description1', name, literal('Jan Wielemaker')). -rdf('__Description1', employed_at, literal('SWI')). -rdf('__Bag1', rdf:'_1', '__Description1'). -rdf('http://www.swi.psy.uva.nl/projects/xpce/', 'http://description.org/schema/':'Creator', '__Bag1'). diff --git a/packages/RDF/suite/ok/t8.ok b/packages/RDF/suite/ok/t8.ok deleted file mode 100644 index 8a3334be4..000000000 --- a/packages/RDF/suite/ok/t8.ok +++ /dev/null @@ -1,3 +0,0 @@ -rdf('#weight_001', 'http://www.nist.gov/RDFschema/Units', 'http://www.nist.gov/units/pounds'). -rdf('#weight_001', value, literal('200')). -rdf('John_Smith', 'http://www.nist.gov/RDFschema/Weight', '#weight_001'). diff --git a/packages/RDF/suite/ok/types.ok b/packages/RDF/suite/ok/types.ok deleted file mode 100644 index 047e7390b..000000000 --- a/packages/RDF/suite/ok/types.ok +++ /dev/null @@ -1,6 +0,0 @@ -rdf('__Description1', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/2002/07/owl#Restriction'). -rdf('http://www.w3.org/2002/03owlt/I5.8/inconsistent001#p', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/2002/07/owl#DatatypeProperty'). -rdf('http://www.w3.org/2002/03owlt/I5.8/inconsistent001#p', 'http://www.w3.org/2000/01/rdf-schema#range', 'http://www.w3.org/2001/XMLSchema#byte'). -rdf('__Description1', 'http://www.w3.org/2002/07/owl#onProperty', 'http://www.w3.org/2002/03owlt/I5.8/inconsistent001#p'). -rdf('__Description1', 'http://www.w3.org/2002/07/owl#cardinality', literal(type('http://www.w3.org/2001/XMLSchema#nonNegativeInteger', '257'))). -rdf('http://www.w3.org/2002/03owlt/I5.8/inconsistent001#john', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', '__Description1'). diff --git a/packages/RDF/suite/ok/xmllit.ok b/packages/RDF/suite/ok/xmllit.ok deleted file mode 100644 index 7806403c8..000000000 --- a/packages/RDF/suite/ok/xmllit.ok +++ /dev/null @@ -1,2 +0,0 @@ -rdf('#id1', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.swi.psy.uva.nl/test#test'). -rdf('#id1', 'http://www.swi.psy.uva.nl/test#a', literal(type('http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral', [element(b, [], [strong])]))). diff --git a/packages/RDF/suite/ok/xsdtypes.ok b/packages/RDF/suite/ok/xsdtypes.ok deleted file mode 100644 index 86bf43bb3..000000000 --- a/packages/RDF/suite/ok/xsdtypes.ok +++ /dev/null @@ -1,2 +0,0 @@ -rdf('#id1', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.swi.psy.uva.nl/test#test'). -rdf('#id1', 'http://www.swi.psy.uva.nl/test#int', literal(type('http://www.w3.org/2000/10/XMLSchema#int', '42'))). diff --git a/packages/RDF/suite/t1.rdf b/packages/RDF/suite/t1.rdf deleted file mode 100644 index 56a753b4e..000000000 --- a/packages/RDF/suite/t1.rdf +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - Ora Lassila - - diff --git a/packages/RDF/suite/t11.rdf b/packages/RDF/suite/t11.rdf deleted file mode 100644 index a9c760111..000000000 --- a/packages/RDF/suite/t11.rdf +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/packages/RDF/suite/t12.rdf b/packages/RDF/suite/t12.rdf deleted file mode 100644 index 9491f7f75..000000000 --- a/packages/RDF/suite/t12.rdf +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - Ora Lassila - - diff --git a/packages/RDF/suite/t13.rdf b/packages/RDF/suite/t13.rdf deleted file mode 100644 index 42d6b2e0c..000000000 --- a/packages/RDF/suite/t13.rdf +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - Ora Lassila - - diff --git a/packages/RDF/suite/t14.rdf b/packages/RDF/suite/t14.rdf deleted file mode 100644 index ce3d083ce..000000000 --- a/packages/RDF/suite/t14.rdf +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - World Wide Web Consortium - W3C Home Page - 1998-10-03T02:27 - - diff --git a/packages/RDF/suite/t15.rdf b/packages/RDF/suite/t15.rdf deleted file mode 100644 index 5c6b60332..000000000 --- a/packages/RDF/suite/t15.rdf +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - diff --git a/packages/RDF/suite/t16.rdf b/packages/RDF/suite/t16.rdf deleted file mode 100644 index 236add31b..000000000 --- a/packages/RDF/suite/t16.rdf +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - Ora Lassila - lassila@w3.org - - diff --git a/packages/RDF/suite/t17.rdf b/packages/RDF/suite/t17.rdf deleted file mode 100644 index 933dc074a..000000000 --- a/packages/RDF/suite/t17.rdf +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - Ora Lassila - lassila@w3.org - - - - diff --git a/packages/RDF/suite/t18.rdf b/packages/RDF/suite/t18.rdf deleted file mode 100644 index 61bde093c..000000000 --- a/packages/RDF/suite/t18.rdf +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - diff --git a/packages/RDF/suite/t19.rdf b/packages/RDF/suite/t19.rdf deleted file mode 100644 index fde4d032a..000000000 --- a/packages/RDF/suite/t19.rdf +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - Ora Lassila - lassila@w3.org - - - - diff --git a/packages/RDF/suite/t2.rdf b/packages/RDF/suite/t2.rdf deleted file mode 100644 index 1c079512b..000000000 --- a/packages/RDF/suite/t2.rdf +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - diff --git a/packages/RDF/suite/t20.rdf b/packages/RDF/suite/t20.rdf deleted file mode 100644 index 03109be63..000000000 --- a/packages/RDF/suite/t20.rdf +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - Ora Lassila - lassila@w3.org - - - - diff --git a/packages/RDF/suite/t21.rdf b/packages/RDF/suite/t21.rdf deleted file mode 100644 index 09abd8f67..000000000 --- a/packages/RDF/suite/t21.rdf +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/packages/RDF/suite/t22.rdf b/packages/RDF/suite/t22.rdf deleted file mode 100644 index 84ec1aa82..000000000 --- a/packages/RDF/suite/t22.rdf +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/packages/RDF/suite/t24.rdf b/packages/RDF/suite/t24.rdf deleted file mode 100644 index 60283abcc..000000000 --- a/packages/RDF/suite/t24.rdf +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - Ora Lassila - - Ralph Swick - - diff --git a/packages/RDF/suite/t26.rdf b/packages/RDF/suite/t26.rdf deleted file mode 100644 index d084d870b..000000000 --- a/packages/RDF/suite/t26.rdf +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - -
  • -
  • -
  • - - -
  • -
  • -
  • - - diff --git a/packages/RDF/suite/t27.rdf b/packages/RDF/suite/t27.rdf deleted file mode 100644 index 0d297ffd3..000000000 --- a/packages/RDF/suite/t27.rdf +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - Mary Andrew - Jacky Crystal - - - - - - - - - - - - - The Coolest Web Page - Il Pagio di Web Fuba - - - - diff --git a/packages/RDF/suite/t28.rdf b/packages/RDF/suite/t28.rdf deleted file mode 100644 index 15e866dff..000000000 --- a/packages/RDF/suite/t28.rdf +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - diff --git a/packages/RDF/suite/t29.rdf b/packages/RDF/suite/t29.rdf deleted file mode 100644 index 229c804e8..000000000 --- a/packages/RDF/suite/t29.rdf +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - 200 - - - - diff --git a/packages/RDF/suite/t3.rdf b/packages/RDF/suite/t3.rdf deleted file mode 100644 index 02f1c189d..000000000 --- a/packages/RDF/suite/t3.rdf +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - Jan Wielemaker - SWI - - - - diff --git a/packages/RDF/suite/t30.rdf b/packages/RDF/suite/t30.rdf deleted file mode 100644 index 2540d9f6a..000000000 --- a/packages/RDF/suite/t30.rdf +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - D-Lib Program - Research in Digital Libraries - The D-Lib program supports the community of people - with research interests in digital libraries and electronic - publishing. - Corporation For National Research Initiatives - 1995-01-07 - - - Research; statistical methods - Education, research, related topics - Library use Studies - - - World Wide Web Home Page - text/html - en - - diff --git a/packages/RDF/suite/t31.rdf b/packages/RDF/suite/t31.rdf deleted file mode 100644 index 69eed39ed..000000000 --- a/packages/RDF/suite/t31.rdf +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - DLIB Magazine - The Magazine for Digital Library Research - - May 1998 - D-LIB magazine is a monthly compilation of - contributed stories, commentary, and briefings. - - - Amy Friedlander - - Corporation for National Research Initiatives - 1998-01-05 - electronic journal - - - library use studies - magazines and newspapers - - - text/html - urn:issn:1082-9873 - - - - - - diff --git a/packages/RDF/suite/t32.rdf b/packages/RDF/suite/t32.rdf deleted file mode 100644 index 47b4aa432..000000000 --- a/packages/RDF/suite/t32.rdf +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - An Introduction to the Resource Description Framework - Eric J. Miller - The Resource Description Framework (RDF) is an - infrastructure that enables the encoding, exchange and reuse of - structured metadata. rdf is an application of xml that imposes needed - structural constraints to provide unambiguous methods of expressing - semantics. rdf additionally provides a means for publishing both - human-readable and machine-processable vocabularies designed to - encourage the reuse and extension of metadata semantics among - disparate information communities. the structural constraints rdf - imposes to support the consistent encoding and exchange of - standardized metadata provides for the interchangeability of separate - packages of metadata defined by different resource description - communities. - Corporation for National Research Initiatives - - - machine-readable catalog record formats - applications of computer file organization and - access methods - - - Copyright @ 1998 Eric Miller - Electronic Document - text/html - en - - - - - - diff --git a/packages/RDF/suite/t33.rdf b/packages/RDF/suite/t33.rdf deleted file mode 100644 index 1154b4ae0..000000000 --- a/packages/RDF/suite/t33.rdf +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - -Ramifications of ab -2 to World Peace - - David Hume - - diff --git a/packages/RDF/suite/t36.rdf b/packages/RDF/suite/t36.rdf deleted file mode 100644 index af677d04e..000000000 --- a/packages/RDF/suite/t36.rdf +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - diff --git a/packages/RDF/suite/t37.rdf b/packages/RDF/suite/t37.rdf deleted file mode 100644 index b89b6743e..000000000 --- a/packages/RDF/suite/t37.rdf +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - Jan Wielemaker - SWI - - - - diff --git a/packages/RDF/suite/t38.rdf b/packages/RDF/suite/t38.rdf deleted file mode 100644 index fa7126490..000000000 --- a/packages/RDF/suite/t38.rdf +++ /dev/null @@ -1,190 +0,0 @@ - - - - - - - - - Resource - Ressource - The most general class - - - - type - type - Indicates membership of a class - - - - - comment - commentaire - - Use this for descriptions - - - - - - label - label - - Provides a human-readable version of a resource name. - - - - - Class - Classe - The concept of Class - - - - - subClassOf - sousClasseDe - Indicates membership of a class - - - - - - subPropertyOf - sousPropriétéDe - Indicates specialization of properties - - - - - - seeAlso - voirAussi - Indicates a resource that provides information about the subject resource. - - - - - - - - isDefinedBy - esDéfiniPar - Indicates a resource containing and defining the subject resource. - - - - - - ConstraintResource - RessourceContrainte - - - Resources used to express RDF Schema constraints. - - - - ConstraintProperty - PropriétéContrainte - - - Properties used to express RDF Schema constraints. - - - - domain - domaine - This is how we associate a class with - properties that its instances can have - - - - range - étendue - Properties that can be used in a - schema to provide constraints - - - - - - Property - Propriété - The concept of a property. - - - - - Literal - Littéral - - This represents the set of atomic values, eg. textual strings. - - - - Statement - Déclaration - - This represents the set of reified statements. - - - - subject - sujet - - - - - - predicate - prédicat - - - - - - - object - objet - - - - - Container - Enveloppe - - This represents the set Containers. - - - - Bag - Ensemble - - - - - Sequence - Séquence - - - - - Alt - Choix - - - - - ContainerMembershipProperty - - - - - object - value - - - diff --git a/packages/RDF/suite/t39.rdf b/packages/RDF/suite/t39.rdf deleted file mode 100644 index 516e65f49..000000000 --- a/packages/RDF/suite/t39.rdf +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - concrete - - - - - - - - - 1 - - - - diff --git a/packages/RDF/suite/t4.rdf b/packages/RDF/suite/t4.rdf deleted file mode 100644 index f721024cd..000000000 --- a/packages/RDF/suite/t4.rdf +++ /dev/null @@ -1,14 +0,0 @@ - - - - - Ora Lassila - - - - - - Stefan Decker - - diff --git a/packages/RDF/suite/t40.rdf b/packages/RDF/suite/t40.rdf deleted file mode 100644 index 38c7aff0d..000000000 --- a/packages/RDF/suite/t40.rdf +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - 2 - - - diff --git a/packages/RDF/suite/t41.rdf b/packages/RDF/suite/t41.rdf deleted file mode 100644 index 9c072a883..000000000 --- a/packages/RDF/suite/t41.rdf +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - 200 - - - - diff --git a/packages/RDF/suite/t42.rdf b/packages/RDF/suite/t42.rdf deleted file mode 100644 index cb08c584d..000000000 --- a/packages/RDF/suite/t42.rdf +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - John - - - 200 - pounds - - - - diff --git a/packages/RDF/suite/t5.rdf b/packages/RDF/suite/t5.rdf deleted file mode 100644 index a56717b7b..000000000 --- a/packages/RDF/suite/t5.rdf +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - Jan Wielemaker - SWI - - - - diff --git a/packages/RDF/suite/t6.rdf b/packages/RDF/suite/t6.rdf deleted file mode 100644 index 61193ca24..000000000 --- a/packages/RDF/suite/t6.rdf +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - Jan Wielemaker - Anjo Anjewierden - - - - diff --git a/packages/RDF/suite/t7.rdf b/packages/RDF/suite/t7.rdf deleted file mode 100644 index 55f35ec38..000000000 --- a/packages/RDF/suite/t7.rdf +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - Jan Wielemaker - SWI - - - - - diff --git a/packages/RDF/suite/t8.rdf b/packages/RDF/suite/t8.rdf deleted file mode 100644 index bc79b4579..000000000 --- a/packages/RDF/suite/t8.rdf +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - 200 - - - - diff --git a/packages/RDF/suite/types.rdf b/packages/RDF/suite/types.rdf deleted file mode 100644 index 992e9cfb4..000000000 --- a/packages/RDF/suite/types.rdf +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - 257 - - - - - diff --git a/packages/RDF/suite/xmllit.rdf b/packages/RDF/suite/xmllit.rdf deleted file mode 100644 index 7a0220847..000000000 --- a/packages/RDF/suite/xmllit.rdf +++ /dev/null @@ -1,19 +0,0 @@ - - - - - -]> - - - - - strong - - - diff --git a/packages/RDF/suite/xsdtypes.rdf b/packages/RDF/suite/xsdtypes.rdf deleted file mode 100644 index 9bfbb85c1..000000000 --- a/packages/RDF/suite/xsdtypes.rdf +++ /dev/null @@ -1,19 +0,0 @@ - - - - - -]> - - - - - 42 - - - diff --git a/packages/RDF/test_rdf.pl b/packages/RDF/test_rdf.pl deleted file mode 100644 index 43ecb0966..000000000 --- a/packages/RDF/test_rdf.pl +++ /dev/null @@ -1,318 +0,0 @@ -/* Part of SWI-Prolog - - Author: Jan Wielemaker - E-mail: J.Wielemaker@uva.nl - WWW: http://www.swi-prolog.org - Copyright (C): 2010, University of Amsterdam - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - As a special exception, if you link this library with other files, - compiled with a Free Software compiler, to produce an executable, this - library does not by itself cause the resulting executable to be covered - by the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -:- module(test_rdf, - [ suite/1, % +Test-number - test_dir/1, % +Directory - test_file/1, % +File - time_file/1, % +File - passed/1, % +Test-numberOrFile - test_rdf/0, % run whole suite - show_ok/1 % +Test - ]). - -:- multifile - user:file_search_path/2. - -user:file_search_path(library, .). -user:file_search_path(library, '../sgml'). -user:file_search_path(library, '../clib'). -user:file_search_path(library, '..'). -user:file_search_path(foreign, '../sgml'). -user:file_search_path(foreign, '../clib'). -user:file_search_path(foreign, '../semweb'). - -:- use_module(library(sgml)). -:- use_module(library(semweb/rdf_compare)). -:- use_module(library(rdf_parser)). -:- use_module(library(rdf_triple)). -:- use_module(library(rdf)). -:- use_module(pretty_print). - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Test file for the SWI-Prolog RDF parser. Toplevel predicates: - - # test/0 - Run all tests from the `suite' directory and validate the - the result if the correct result is stored in a .ok file. - - # suite(N) - Run test on suite/t.rdf, showing RDF, intermediate - representation and triples on the console. - - # passed(N) - Parse suite/t.rdf and save the result in suite/t.ok - -The intention is to write tests, use suite/1 to make sure they are -parsed correctly and then run passed/1 to save the correct answer, so -running test/0 can validate all results. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -suite(N) :- - atomic_list_concat(['suite/t', N, '.rdf'], File), - test_file(File). - -test_file(File) :- - rdf_reset_ids, - format('************* Test ~w ***~n', [File]), - cat(File), - load_structure(File, - [ RDFElement ], - [ dialect(xmlns), - space(sgml) - ]), - rdf_start_file([], Cleanup), - make_rdf_state([base_uri('http://test.org/test/')], State, _), - xml_to_plrdf(RDFElement, RDF, State), - rdf_end_file(Cleanup), - format('============= Prolog term ==============~n', []), - pretty_print(RDF), - rdf_triples(RDF, Triples), - format('============= Triples ==================~n', []), - write_triples(Triples). - -time_file(File) :- - time(load_rdf(File, Triples)), - length(Triples, Len), - format('Created ~w triples~n', [Len]). - -passed(Id) :- - integer(Id), !, - atomic_list_concat(['suite/t', Id, '.rdf'], File), - passed(File). -passed(File) :- - rdf_reset_ids, - ok_file(File, OkFile), - load_rdf(File, Triples), - open(OkFile, write, Fd, [encoding(utf8)]), - save_triples(Triples, Fd), - close(Fd), - length(Triples, N), - format('Saved ~d triples to ~w~n', [N, OkFile]). - -:- dynamic failed/1. - -test_rdf :- - test(load_rdf), - test(process_rdf). - -test(How) :- - retractall(failed(_)), - test_dir(suite, How), - findall(F, failed(F), Failed), - ( Failed == [] - -> true - ; length(Failed, N), - format('ERROR: ~w tests failed~n', [N]), - fail - ). - - -test_dir(Dir) :- - test_dir(Dir, load_rdf). - -test_dir(Dir, How) :- - format('Tests from "~w" [~w]: ', [Dir, How]), - atom_concat(Dir, '/*.rdf', Pattern), - expand_file_name(Pattern, TestFiles), - maplist(test(How), TestFiles), - format(' done~n'). - -test(How, File) :- - format('.'), flush_output, - rdf_reset_ids, - ok_file(File, OkFile), - ( call(How, File, Triples) - -> ( catch(open(OkFile, read, Fd, [encoding(utf8)]), _, fail) - -> ( read_triples(Fd, OkTriples), - close(Fd), - rdf_equal_graphs(Triples, OkTriples, _Subst) - -> true - ; assert(failed(File)), - format('~N~w: WRONG ANSWER~n', [File]) - ) - ; format('~N~w: (no .ok file)~n', [File]) - ) - ; assert(failed(File)), - format('~N~w: PARSE FAILED~n', [File]) - ). - -ok_file(File, OkFile) :- - file_base_name(File, BaseFile), - file_name_extension(Base, _, BaseFile), - file_directory_name(File, Dir), - atomic_list_concat([Dir, /, ok, /, Base, '.ok'], OkFile). - - -save_triples([], _). -save_triples([H|T], Fd) :- - format(Fd, '~q.~n', [H]), - save_triples(T, Fd). - -read_triples(Fd, Terms) :- - read(Fd, T0), - read_triples(T0, Fd, Terms). - -read_triples(end_of_file, _, []) :- !. -read_triples(rdf(S0,P0,O0), Fd, [rdf(S,P,O)|R]) :- - global_ref(S0, S), - global_ref(P0, P), - global_obj(O0, O), - read(Fd, T1), - read_triples(T1, Fd, R). - -global_ref(rdf:Local, Global) :- - rdf_name_space(NS), !, - atom_concat(NS, Local, Global). -global_ref(NS:Local, Global) :- !, - atom_concat(NS, Local, Global). -global_ref(URI, URI). - -global_obj(literal(X), literal(X)) :- !. -global_obj(Local, Global) :- - global_ref(Local, Global). - - -write_triples([]) :- !. -write_triples([H|T]) :- !, - write_triple(H), - write_triples(T). - -write_triple(Triple) :- - is_rdf_triple(Triple), !, - Triple = rdf(S,P,O), - format('{~q, ~q, ~q}~n', [S,P,O]). -write_triple(Triple) :- - format('@@@@@ Bad Triple: ~p~n', [Triple]), - fail. - -cat(File) :- - open(File, read, Fd), - copy_stream_data(Fd, user_output), - close(Fd). - -:- dynamic triple/1. - -process_rdf(File, Triples) :- - retractall(triple(_)), - process_rdf(File, assert_triples, []), - findall(T, retract(triple(T)), Triples). - -assert_triples([], _). -assert_triples([H|T], Loc) :- - assert(triple(H)), - assert_triples(T, Loc). - - - /******************************* - * VALIDATE * - *******************************/ - -is_rdf_triple(rdf(Subject, Predicate, Object)) :- - is_subject(Subject), - is_predicate(Predicate), - is_object(Object). - -is_subject(0) :- !, fail. % Variables -is_subject(URI) :- is_uri(URI), !. -is_subject(each(URI)) :- is_uri(URI), !. -is_subject(prefix(Pattern)) :- - atom(Pattern), !. - -is_predicate(0) :- !, fail. -is_predicate(rdf:RdfPred) :- !, - is_rdf_predicate(RdfPred). -is_predicate(NS:Pred) :- !, - atom(NS), - atom(Pred). -is_predicate(Pred) :- - atom(Pred). - -is_object(0) :- !, - fail. -is_object(literal(XML)) :- !, - is_xml(XML). -is_object(rdf:RdfType) :- !, - is_rdf_type(RdfType). -is_object(URI) :- - is_uri(URI). - -is_object(Subject) :- - is_subject(Subject), !. -is_object(Pred) :- - is_predicate(Pred), !. - -is_uri(URI) :- atom(URI). - -is_xml(_XML). % for now - -is_rdf_predicate(RdfPred) :- atom(RdfPred). - -is_rdf_type(RdfType) :- atom(RdfType). - - /******************************* - * UTIL * - *******************************/ - -% find_rdf(+XMLTerm, -RDFTerm) -% -% If the document contains an embedded RDF term, return it, else -% return the whole document. The latter is a bit dubious, but good -% for the purpose of this test-file - -find_rdf(Term, RDFTerm) :- - RDFTerm = element(NS:'RDF', _, _), - term_member(RDFTerm, Term), !, - ( rdf_name_space(NS) - -> true - ; assert(rdf_parser:rdf_name_space(NS)), - assert(new_rdf_namespace(NS)) - ). -find_rdf(Term, Term). - -term_member(X, X). -term_member(X, Compound) :- - compound(Compound), - arg(_, Compound, Arg), - term_member(X, Arg). - - - /******************************* - * SHOW DIAGRAM * - *******************************/ - -show_ok(Test) :- - ok_file(Test, File), - open(File, read, Fd, [encoding(utf8)]), - read_triples(Fd, OkTriples), - close(Fd), - new(D, rdf_diagram(string('Ok for %s', File))), - send(D, triples, OkTriples), - send(D, open). - diff --git a/packages/RDF/test_write.pl b/packages/RDF/test_write.pl deleted file mode 100644 index 8be94c5e5..000000000 --- a/packages/RDF/test_write.pl +++ /dev/null @@ -1,158 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog - - Author: Jan Wielemaker - E-mail: wielemak@science.uva.nl - WWW: http://www.swi-prolog.org - Copyright (C): 1985-2007, University of Amsterdam - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - As a special exception, if you link this library with other files, - compiled with a Free Software compiler, to produce an executable, this - library does not by itself cause the resulting executable to be covered - by the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -:- module(test_rdf_write, - [ test_write/0, - run_tests/0, - run_tests/1 - ]). - - -:- use_module(library(plunit)). -:- use_module(library(rdf_write)). -:- use_module(library(sgml)). -:- use_module(library(lists)). -:- use_module(library(debug)). -:- use_module(library(semweb/rdf_db)). -:- use_module(library(rdf)). - -:- expects_dialect(swi). -:- assert(system:swi_io). - -test_write :- - run_tests([ rdf_write - ]). - - - /******************************* - * ROUND TRIP * - *******************************/ - -test_graph(Triples) :- - tmp_file(rdf, Tmp), - open(Tmp, write, Out, [encoding(utf8)]), - rdf_write_xml(Out, Triples), - close(Out), - load_rdf(Tmp, ReadTriples), - delete_file(Tmp), - compare_triples(Triples, ReadTriples, _). - - - /******************************* - * COMPARING * - *******************************/ - -% compare_triples(+PlRDF, +NTRDF, -Substitions) -% -% Compare two models and if they are equal, return a list of -% PlID = NTID, mapping NodeID elements. - - -compare_triples(A, B, Substitutions) :- - compare_list(A, B, [], Substitutions), !. - -compare_list([], [], S, S). -compare_list([H1|T1], In2, S0, S) :- - select(H2, In2, T2), - compare_triple(H1, H2, S0, S1), - compare_list(T1, T2, S1, S). - -compare_triple(rdf(Subj1,P1,O1), rdf(Subj2, P2, O2), S0, S) :- - compare_field(Subj1, Subj2, S0, S1), - compare_field(P1, P2, S1, S2), - compare_field(O1, O2, S2, S). - -compare_field(X, X, S, S) :- !. -compare_field(literal(X), xml(X), S, S) :- !. % TBD -compare_field(rdf:Name, Atom, S, S) :- - atom(Atom), - rdf_parser:rdf_name_space(NS), - atom_concat(NS, Name, Atom), !. -compare_field(NS:Name, Atom, S, S) :- - atom(Atom), - atom_concat(NS, Name, Atom), !. -compare_field(X, Id, S, S) :- - memberchk(X=Id, S), !. -compare_field(X, Y, S, [X=Y|S]) :- - \+ memberchk(X=_, S), - rdf_is_bnode(X), - rdf_is_bnode(Y), - debug(bnode, 'Assume ~w = ~w~n', [X, Y]). - - - /******************************* - * TESTS * - *******************************/ - -:- begin_tests(rdf_write). - -test(1, true) :- - test_graph([ rdf(s, p, o) - ]). -test(anon_s, true) :- - test_graph([ rdf('__s', p, o) - ]). -test(anon_o, true) :- - test_graph([ rdf(s, p, '__o') - ]). -test(anon_loop, blocked('NodeID map must check for cycles')) :- - test_graph([ rdf('__r1', p1, '__r2'), - rdf('__r2', p1, '__r1') - ]). -test(anon_loop, true) :- - test_graph([ rdf('__r1', p1, '__r2'), - rdf('__r1', p2, '__r2'), - rdf('__r2', p1, '__r1'), - rdf('__r2', p2, '__r1') - ]). -test(anon_reuse, true) :- - test_graph([ rdf('__s1', p1, '__o1'), - rdf('__s2', p1, '__o1') - ]). -test(anon_reuse, true) :- - test_graph([ rdf('__s1', p1, '__o1'), - rdf('__s2', p1, '__o1'), - rdf('__o1', name, literal(foo)) - ]). -test(literal, true) :- - test_graph([ rdf(s, p, literal(hello)) - ]). -test(lang, true) :- - test_graph([ rdf(s, p, literal(lang(en, hello))) - ]). -test(type, true) :- - test_graph([ rdf(s, p, literal(type(t, hello))) - ]). - -:- end_tests(rdf_write). - - -:- retract(system:swi_io). diff --git a/packages/RDF/w3c_test.pl b/packages/RDF/w3c_test.pl deleted file mode 100644 index 9a1c3a40a..000000000 --- a/packages/RDF/w3c_test.pl +++ /dev/null @@ -1,467 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog SGML/XML parser - - Author: Jan Wielemaker - E-mail: jan@swi.psy.uva.nl - WWW: http://www.swi.psy.uva.nl/projects/SWI-Prolog/ - Copying: LGPL-2. See the file COPYING or http://www.gnu.org - - Copyright (C) 1990-2002 SWI, University of Amsterdam. All rights reserved. -*/ - -:- module(rdf_w3c_test, - [ process_manifest/0, - process_manifest/1, - run_tests/0, % run all tests - run/0, % run selected test - show/1, % RDF diagram for File - run_test/1 % run a single test - ]). - - % get libraries locally -:- asserta(user:file_search_path(library, '.')). - -:- use_module(library(rdf)). % our RDF parser -:- use_module(library(rdf_ntriples)). % read .nt files -:- load_files([ library(pce), - library(toolbar), - library(pce_report), - rdf_diagram, - library('emacs/emacs') - ], - [ silent(true) - ]). - -:- dynamic - verbose/0. -%verbose. - -set_verbose :- - verbose, !. -set_verbose :- - assert(verbose). - -:- dynamic - rdf/3. - -ns(test, - 'http://www.w3.org/2000/10/rdf-tests/rdfcore/testSchema#'). - -local('http://www.w3.org/2000/10/rdf-tests/rdfcore/', - 'W3Ctests/'). - -process_manifest :- - process_manifest('W3Ctests/Manifest.rdf'). -process_manifest(Manifest) :- - retractall(rdf(_,_,_)), - load_rdf(Manifest, Triples), - assert_triples(Triples). - -assert_triples([]). -assert_triples([rdf(S, P, O)|T]) :- - canonise(S, Subject), - canonise(P, Predicate), - canonise(O, Object), - assert(rdf(Subject, Predicate, Object)), - assert_triples(T). - -canonise(NS:Name, N:Name) :- - ns(N, NS), !. -canonise(Absolute, N:Name) :- - atom(Absolute), - ns(N, NS), - atom_concat(NS, Name, Absolute), !. -canonise(X, X). - - -run_tests :- - process_manifest, - start_tests, - ( rdf(About, rdf:type, test:Type), - \+ rdf(About, test:status, literal('OBSOLETE')), - test_type(Type), -% once(run_test(About)), % Should not be needed - run_test(About), - fail - ; true - ), !, - report_results. - -test_type('PositiveParserTest'). -%test_type('NegativeParserTest'). - -run_test(Test) :- - rdf(Test, test:inputDocument, In), - local_file(In, InFile), - exists_file(InFile), - ( load_rdf(InFile, RDF, - [ base_uri(In), - expand_foreach(true) - ]) - -> true - ; RDF = [] - ), - Data = [ source(InFile), - result(RDF), - norm(NT), - substitutions(Substitions) - ], - % there may be alternative output - % documents - ( rdf(Test, test:outputDocument, Out), - local_file(Out, NTFile), - load_rdf_ntriples(NTFile, NT), - feedback('Comparing to ~w~n', [NTFile]), - compare_triples(RDF, NT, Substitions) - -> test_result(pass, Test, Data) - % if all fails, display the first - ; rdf(Test, test:outputDocument, Out), - local_file(Out, NTFile), - load_rdf_ntriples(NTFile, NT), - Substitions = [], - test_result(fail, Test, Data) - ). - - -local_file(URL, File) :- - local(URLPrefix, FilePrefix), - atom_concat(URLPrefix, Base, URL), !, - atom_concat(FilePrefix, Base, File). - - - /******************************* - * GUI * - *******************************/ - -:- pce_begin_class(w3c_rdf_test_gui, frame). - -initialise(F, Show:chain) :-> - send_super(F, initialise, 'W3C RDF test suite results'), - send(F, append, new(B, browser)), - send(B, hor_stretch, 100), - send(B, hor_shrink, 100), - ( send(Show, member, source) - -> new(V, emacs_view(height := 3)), - send(V, name, text) - ; true - ), - ( send(Show, member, result) - -> new(R, rdf_diagram), - send(R, name, result), - send(R, label, 'Result') - ; true - ), - ( send(Show, member, norm) - -> new(N, rdf_diagram), - send(N, name, norm), - send(N, label, 'Norm') - ; true - ), - stack_windows([V,R,N], _, W), - ( nonvar(W) - -> send(W, right, B) - ; true - ), - send(new(D, tool_dialog(F)), above, B), - send(new(report_dialog), below, B), - send(F, fill_menu, D), - send(F, fill_browser, B). - -stack_windows([], L, L). -stack_windows([H|T], W0, W) :- - var(H), !, - stack_windows(T, W0, W). -stack_windows([H|T], W0, W) :- - var(W0), !, - stack_windows(T, H, W). -stack_windows([H|T], WL, W) :- - send(H, below, WL), - stack_windows(T, H, W). - -fill_menu(F, D:tool_dialog) :-> - send_list(D, - [ append(menu_item(exit, message(F, destroy)), - file) - ]). - -fill_browser(_F, B:browser) :-> - send(B, style, pass, style(colour := dark_green)), - send(B, style, fail, style(colour := red)), - send(B?image, recogniser, - handler(ms_right_down, - and(message(B, selection, - ?(B, dict_item, @event)), - new(or)))), - send(B, popup, new(P, popup)), - send(B, select_message, message(@arg1, run)), - send_list(P, append, - [ menu_item(run, - message(@arg1, run)), - menu_item(edit, - message(@arg1, edit_test)), - gap, - menu_item(show_result, - message(@arg1, show_triples, result)), - menu_item(show_norm, - message(@arg1, show_triples, norm)), - gap, - menu_item(discussion, - message(@arg1, open_url, discussion), - condition := - message(@arg1, has_url, discussion)), - menu_item(approval, - message(@arg1, open_url, approval), - condition := - message(@arg1, has_url, approval)), - gap, - menu_item(copy_test_uri, - message(@arg1, copy_test_uri)) - ]). - - -test_result(F, Result:{pass,fail}, Test:name, Data:prolog) :-> - "Test failed":: - get(F, member, browser, B), - ( get(B, member, Test, Item) - -> send(Item, object, prolog(Data)), - send(Item, style, Result) - ; send(B, append, - rdf_test_item(Test, @default, prolog(Data), Result)) - ). - -clear(F) :-> - get(F, member, browser, B), - send(B, clear). - -summarise(F) :-> - get(F, member, browser, Browser), - new(Pass, number(0)), - new(Fail, number(0)), - send(Browser?members, for_all, - if(@arg1?style == pass, - message(Pass, plus, 1), - message(Fail, plus, 1))), - send(F, report, status, '%d tests succeeded; %d failed', - Pass, Fail). - -:- pce_end_class(w3c_rdf_test_gui). - -:- pce_begin_class(rdf_test_item, dict_item). - - -edit_test(Item) :-> - "Edit input document of test":: - get(Item, object, List), - member(source(InFile), List), - edit(file(InFile)). - -show_triples(Item, Set:{result,norm}) :-> - "Show result of our parser":: - get(Item, key, Test), - get(Item, object, List), - Term =.. [Set,Triples], - member(Term, List), - send(Item, show_diagram(Triples, - string('%s for %s', Set?label_name, Test))). - -show_diagram(_Item, Triples:prolog, Label:name) :-> - "Show diagram for triples":: - new(D, rdf_diagram(Label)), - send(new(report_dialog), below, D), - send(D, triples, Triples), - send(D, open). - -open_url(Item, Which:name) :-> - "Open associated URL in browser":: - get(Item, key, Test), - rdf(Test, test:Which, URL), - www_open_url(URL). - -has_url(Item, Which:name) :-> - "Test if item has URL":: - get(Item, key, Test), - rdf(Test, test:Which, _URL). - -run(Item) :-> - "Re-run the test":: - get(Item, key, Test), - run_test(Test), - send(Item, show). - -copy_test_uri(Item) :-> - "Copy URI of test to clipboard":: - get(Item, key, Test), - send(@display, copy, Test). - -show(Item) :-> - "Show source, result and norm diagrams":: - get(Item?image, frame, Frame), - get(Item, object, List), - ( get(Frame, member, result, Result) - -> member(result(RTriples), List), - send(Result, triples, RTriples) - ; true - ), - ( get(Frame, member, norm, Norm) - -> member(norm(NTriples), List), - send(Norm, triples, NTriples) - ; true - ), - ( get(Frame, member, text, View) - -> member(source(File), List), - send(View, text_buffer, new(TB, emacs_buffer(File))), - % scroll to RDF text - ( member(Pattern, [':RDF', 'RDF']), - get(TB, find, 0, Pattern, Start), - get(TB, scan, Start, line, 0, start, BOL) - -> send(View, scroll_to, BOL, 1) - ; true - ) - ; true - ). -% member(substitutions(Substitutions), List), -% send(Result, copy_layout, Norm, Substitutions), - -:- pce_end_class(rdf_test_item). - - -:- pce_global(@rdf_test_gui, make_rdf_test_gui). - -make_rdf_test_gui(Ref) :- - send(new(Ref, w3c_rdf_test_gui(chain(source,result))), open). - - -test_result(Result, Test, Data) :- - send(@rdf_test_gui, test_result, Result, Test, Data), - ( Result == fail, verbose - -> member(result(Our), Data), - length(Our, OurLength), - format('~N** Our Triples (~w)~n', OurLength), - pp(Our), - member(norm(Norm), Data), - length(Norm, NormLength), - format('~N** Normative Triples (~w)~n', NormLength), - pp(Norm) - ; true - ). - - - -start_tests :- - send(@rdf_test_gui, clear). - -report_results :- - send(@rdf_test_gui, summarise). - -run :- - set_verbose, - get(@rdf_test_gui, member, browser, B), - get(B, selection, DI), - get(DI, key, Test), - run_test(Test). - - - /******************************* - * SHOW A FILE * - *******************************/ - - -show(File) :- - rdf_diagram_from_file(File). - - - /******************************* - * COMPARING * - *******************************/ - -% compare_triples(+PlRDF, +NTRDF, -Substitions) -% -% Compare two models and if they are equal, return a list of -% PlID = NTID, mapping NodeID elements. - - -compare_triples(A, B, Substitutions) :- - compare_list(A, B, [], Substitutions). - -compare_list([], [], S, S). -compare_list(L1, L2, S0, S) :- - take_bag(L1, B1, E1, R1), !, - take_bag(L2, B2, E2, R2), - compare_field(B1, B2, S0, S1), - compare_bags(E1, E2, S1, S2), - compare_list(R1, R2, S2, S). -compare_list([H1|T1], In2, S0, S) :- - select(H2, In2, T2), - compare_triple(H1, H2, S0, S1), % put(.), flush_output, - compare_list(T1, T2, S1, S). - -compare_triple(rdf(Subj1,P1,O1), rdf(Subj2, P2, O2), S0, S) :- - compare_field(Subj1, Subj2, S0, S1), - compare_field(P1, P2, S1, S2), - compare_field(O1, O2, S2, S). - -compare_field(X, X, S, S) :- !. -compare_field(literal(X), xml(X), S, S) :- !. % TBD -compare_field(rdf:Name, Atom, S, S) :- - atom(Atom), - rdf_parser:rdf_name_space(NS), - atom_concat(NS, Name, Atom), !. -compare_field(NS:Name, Atom, S, S) :- - atom(Atom), - atom_concat(NS, Name, Atom), !. -compare_field(X, node(Id), S, S) :- - memberchk(X=Id, S), !. -compare_field(X, node(Id), S, [X=Id|S]) :- - \+ memberchk(X=_, S), - atom(X), - generated_prefix(Prefix), - sub_atom(X, 0, _, _, Prefix), !, - feedback('Assume ~w = ~w~n', [X, node(Id)]). - -generated_prefix(Prefix) :- - rdf_truple:anon_base(Prefix). - -% compare_bags(+Members1, +Members2, +S0, -S) -% -% Order of _1, _2, etc. are not relevant in BadID reification. Are -% they in general? Anyway, we'll normalise the order of the bags - -compare_bags([], [], S, S). -compare_bags([E1|T1], M, S0, S) :- - select(E2, M, T2), - compare_field(E1, E2, S0, S1), - compare_bags(T1, T2, S1, S). - -take_bag(Triples, Bag, Elems, RestTriples) :- - select(rdf(Bag, Type, BagClass), Triples, T1), - compare_field(rdf:type, Type, [], []), - compare_field(rdf:'Bag', BagClass, [], []), - bag_members(T1, Bag, Elems, RestTriples). - -bag_members([], _, [], []). -bag_members([rdf(Bag, IsElm, E)|T], Bag, [E|ET], Rest) :- - member_prop(IsElm), !, - bag_members(T, Bag, ET, Rest). -bag_members([T0|T], Bag, Elems, [T0|R]) :- - bag_members(T, Bag, Elems, R). - -member_prop(rdf:Name) :- - atom_codes(Name, [0'_|Codes]), - number_codes(_N, Codes), !. -member_prop(Prop) :- - atom(Prop), - rdf_parser:rdf_name_space(NS), - atom_concat(NS, Name, Prop), - atom_codes(Name, [0'_|Codes]), - number_codes(_N, Codes), !. - - -% feedback(+Format, +Args) -% -% Print if verbose - -feedback(Fmt, Args) :- - verbose, !, - format(user_error, Fmt, Args). -feedback(_, _). diff --git a/packages/http b/packages/http index 9e637343d..ce3d9bad3 160000 --- a/packages/http +++ b/packages/http @@ -1 +1 @@ -Subproject commit 9e637343dfb5b152c0d9d1f486bcadbf975f778c +Subproject commit ce3d9bad3b747209d721a058863dc8cf2b2a00eb diff --git a/packages/semweb b/packages/semweb new file mode 160000 index 000000000..e95f2d6b4 --- /dev/null +++ b/packages/semweb @@ -0,0 +1 @@ +Subproject commit e95f2d6b45b5da620d412311eeb9432a8826c158 diff --git a/packages/semweb/ChangeLog b/packages/semweb/ChangeLog deleted file mode 100644 index 05b3e7069..000000000 --- a/packages/semweb/ChangeLog +++ /dev/null @@ -1,1030 +0,0 @@ -[Sep 19 2009] - - * ADDED: Turtle write library. - -[Sep 9 2009] - - * MODIFIED: rdf_load/2 no longer shares blank nodes by default. This is - not allowed according to the standards. - -[Sep 1 2009] - - * ADDED: First version of low-level primitives for faster Turtle support - - * CLEANUP: make RDF library depend on new iri_xml_namespace/3. - -[Aug 31 2009] - - * ADDED: rdf_graph_prefixes/3 and realised various enhancements - -[Aug 26 2009] - - * FIXED: rdf_graph_prefixes/2 to return all namespaces instead of only those - that have ns/2 declarations (as the title suggests). - -[Aug 24 2009] - - * MODIFIED: RDF hook no longer accepts text/html explicitely - -[Aug 21 2009] - - * FIXED: Turtle parser to deal with files where the last line is a - non-terminated comment. Ivo Swartjes - -[Aug 20 2009] - - * ADDED: Library semweb/rdf_compare for comparing RDF graphs (mostly used by - RDF test libraries) - - * ADDED: Process the text/turtle MIME-type - - * ADDED: Turtle parser to support booleans (true and false) - -[Aug 19 2009] - - * MODIFIED: rdf_process_turtle/3 prints messages instead of aborting after - the first error. Also some progress to enhance the error messages. - - * ADDED: rdf_current_ns/2 as a replacement for rdf_db:ns/2 and rdf_graph_prefixes/2 - to query prefixes used in a specific graph. - -[Jul 31 2009] - - * FIXED: rdf_load/1 failed after unloading the data using rdf_unload/1. Willem Robert van Hage. - -[Jul 30 2009] - - * CLEANUP: Modernise rdf.pl and rdf_db.pl module handling. - -[Jul 24 2009] - - * MODIFIED: rdf_load_turtle/3 now returns IRIs instead of URIs. -[Jul 21 2009] - - * MODIFIED: Make initialization/1 ISO compliant - This patch is a modest cleanup to the implementation of '$load_file'/3 - from init.pl and provides an ISO compatible implementation of - initialization/1. This executes the argument goal *after* loading the - file rather than when encountering the directive. Often this makes no - difference, but notably load_foreign_library/1 is an exception. - Therefore we added use_foreign_library/1,2 that act as a directive and - provides proper integration with saved-states automatically. Loading - code using initialization(load_foreign_library(...)) will load the - library immediately and issue a warning. - - See initialization/1,2 for details and further hints for dealing with - possible compatibility problems. - -[Jul 19 2009] - - * FIXED: RDF Literal indexing messed up handling of 'false'. Vera Hollink. -[Jun 28 2009] - - * FIXED: RDF literal matches (literal(exact(string), X)) - -[Jun 22 2009] - - * ADDED: Efficient SPARQL compliant literal matching to RDF-DB - -[Jun 19 2009] - - * FIXED: Semweb: writing RDF/XML should not use bnodes as typed nodes. Chris Mungall. - -[Jun 17 2009] - - * FIXED: Turtle UTF-8 handling - - * FIXED: rdf_load/2: Do not record a file as loaded before completion. - - * ADDED: Semweb: Register turtle parser for .n3 files - -[Jun 16 2009] - - * FIXED: Pass Turtle test-case #10. - -[May 31 2009] - - * FIXED: RDF Transaction logging in persistency layer. Jacco van Ossenbruggen. - -[Mar 19 2009] - - * CLEANUP: Removed all trailing whitespace from all source-files. This avoids many GIT (merge) warnings. -[Mar 12 2009] - - * MODIFIED: Renamed concat_atom/2,3 into atomic_list_concat/2,3 for compatibility. Moved the old predicates into library(backcomp). It is adviced to update your code, but 99% of the code will remain working because the old definitions are autoloaded. - -[Mar 5 2009] - - * FIXED: ensure the local part after splitting a URI is a valid XML name - - * MODIFIED: Use graph(URI) instead of db(URI) for specifying the RDF graph that must be saved. db(URI) is still supported for backward compatibility. -[Jan 21 2009] - - * FIXED: RDF writer: write valid XML if the namespace entity contains characters - that must be %-escaped. Jacopo Urbani. - -[Jan 13 2009] - - * FIXED: RDF/XML could save illegal XML if multiple namespaces are used - for predicates where one namespace is a prefix of another one. Jacopo Urbani. -[Dec 19 2008] - - * ADDED: Allow for stream(Stream) as target in rdf_save/2 -[Oct 8 2008] - - * MODIFIED: rdf_load/[1,2] now raises an existence_error if the input does not exist. - - * CLEANUP: Generalise plugin interface to deal with different storage envelopes in rdf_load/2. -[Sep 23 2008] - - * ADDED: Preserve the modification time of the source URL in binary RDF files. - -[Sep 11 2008] - - * PORT: Add AC_PREREQ to configure.h for systems that auto-select autoconf - versions. After tip by Ulrich Neumerkel. - -[Aug 11 2008] - - * INSTALL: Remove all configure files from the git repository -[May 20 2008] - - * FIXED: %-escape [] when transforming URI to URL. - -[May 5 2008] - - * FIXED: rdf_quote_uri/3 not to map & to %26. Jacco van Ossenbruggen - -[Apr 27 2008] - - * FIXED: RDF-DB: predicate hash error that caused most predicates to be - hashed on the same key. Fixes slow rdf_save/2 reported by Jacco van - Ossenbruggen. Should also positively effect determinism and reliability - of rdf_estimate_complexity/4. - -[Apr 26 2008] - - * DOC: Fixed some paths in semweb documentation. Jacco van Ossenbruggen - -[Apr 18 2008] - - * MODIFIED: Renamed hash_term/2 to term_hash/2. Added hash_term/2 to - library(backcomp), so most code should not notice this. - -[Apr 17 2008] - - * FIXED: Avoid deadlock in RDF literal index when removing a literal - -[Apr 14 2008] - - * CLEANUP: Remove calls to sformat from system libraries (backward compatibility) - -[Apr 11 2008] - - * ENHANCED: rdf_litindex.pl: 40% faster building of the literal token database - -[Apr 10 2008] - - * PERFORMANCE: RDF-DB: speedup literal hash handling - -[Mar 26 2008] - - * ENHANCED: make rdfs_individual_of(+,+) semidet. - -[Mar 5 2008] - - * FIXED: determinism detection in rdf_reachable/3 - -[Feb 18 2008] - - * MODIFIED: Stricter checking in rdf_global_id/2 and rdf_global_term/2 - -[Jan 23 2008] - - * PORT: Bug#346: Allow overriding COFLAGS and CWFLAGS in package - configuration. Keri Harris. -[Dec 17 2007] - - * FIXED: Possible missing match on subproperties in rdf_has. Jacco van Ossenbruggen and Michiel Hildebrand - -[Dec 13 2007] - - * FIXED: Bug#332: operator declarations could mess up RDF/XML output. Chris Sutton - and Yves Raimond. - -[Nov 28 2007] - - * FIXED: rdf_persistency.pl now keeps track of sources - -[Nov 14 2007] - - * FIXED: RDF HTTP plugin to request application/rdf+xml. Yves Raimond. - -[Nov 11 2007] - - * ADDED: Allow deleting an inverse_of predicate property - -[Nov 8 2007] - - * ENHANCED: Minimise the time we keep a lock in rdf_load_db/1 to exploit - concurrency. - - * ADDED: silent(brief) option value to rdf_attach_db/2. Avoid some file-system - tests to speedup loading many named graphs. - - * ENHANCED: Speedup for rdf_retractall(_,_,_,DB) for empty or non-extenting - databases. - - * ENHANCED: Avoid quadratic effect when loading many graphs from many - snapshot files as used in rdf_persistency.pl. Spotted by Yves Raimond - loading 17,000 graphs. - -Oct 15, 2007 - - * FIXED: rdf_load/2 for loading .gz files. Michiel Hildebrand. - -Oct 10, 2007 - - * ADDED: register_namespaces(Bool) option to rdf_load/2 - - * FIXED: Interaction between locking and signals (possible deeadlock). - -Sep 27, 2007 - - * ADDED: option to create global RDF cache directory on demand. - - * ENHANCED: Make zlib and http plugins cooperate. - -Sep 26, 2007 - - * ADDED: rdf_turtle.pl now processed HTTP URLs transparently. - -Sep 24, 2007 - - * ADDED: also search for .gz extension for file:// URLs. - -Sep 12, 2007 - - * ADDED: @base to the turtle parser (Yves Raimond) - -Aug 20, 2007 - - * ADDED: rdf_turtle.pl: handle """long string""". Yves Raimond. - -Aug 7, 2007 - - * FIXED: Error handling for non-terminated <... URI in rdf_turtle.pl. - Jacco van Ossenbruggen. - -Jul 9, 2007 - - * MODIFIED: various issues around named graphs and sources. New option - db(DB) to rdf_load/2, new predicates rdf_graph/1 and rdf_source/2. - -Jul 4, 2007 - - * ADDED: various details to rdf_persistency to improve logging transactions. - -Jul 2, 2007 - - * MODIFIED: Pass nesting level along with begin/end of a transaction. - -Jun 29, 2007 - - * ADDED: rdf_active_transaction/1 to query active transactions. - -Jun 27, 2007 - - * FIXED: ensure rdf_attach_db/2 can be retried if the database is locked. - Enhanced the error message. - - * FIXED/ENHANCED: Possible crash in property-hierarchy handling. Replacing - with a much simpler and better algorithm. - - * ENHANCED: Do pooling on open file descriptors to journal files of - the persistency layer. - - * ADDED: Exploit concurrent/3 in loading persistent databases using - multiple CPUs. - -Jun 14, 2007 - - * FIXED: Saving literal(rdf:'XMLLiteral'). - -Jun 9, 2007 - - * FIXED: Avoid type error in literal indexing code when asserting - non-atom literals. - -Apr 27, 2007 - - * FIXED: Bug#279: handling rdfs:Container in rdfs_member/2. - -Mar 30, 2007 - - * FIXED: rdf_has/3 can return triples that should not match. Jochem - Liem. - -Mar 27, 2007 - - * FIXED: Typo in rdf_estimate_complexity/4 docs. - -Mar 14, 2007 - - * FIXED: rdf_has/3 to use empty reachability matrix after a property - is added. - - * FIXED: atom-reference issue in rdf_update/[4,5]. Jochem Liem. - -Mar 13, 2007 - - * FIXED: Send monitor events on begin/end of nested transactions. - Required to make rdf_persistency work properly if RDF operations - such as rdf_reset_db and rdf_load are nested in transactions. - -Mar 9, 2007 - - * FIXED: reset some more fields in rdf_reset_db, avoiding continuous - re-hash after rdf_reset_db/0. - - * FIXED: rdf_persistency to clear file repository on rdf_reset_db. - -Mar 8, 2007 - - * FIXED: locking issue in rdf_reachable/3 and maintaining active-query - count. Thanks to Jacco van Ossenbruggen and Michiel Hildebrand for - a reproducable case. - -Mar 6, 2007 - - * ADDED: application/rdf+xml to rdf_http_plugin.pl. Yves Raimond. - -Mar 5, 2007 - - * ADDED: rdf_load/2, allow for base_uri(-URI) to get access to the named - graph a source is loaded into. Jacco van Ossenbruggen. - -Jan 28, 2007 - - * FIXED: rdf_meta declaration for rdf_update/5. Michiel Hildebrand. - -Jan 26, 2007 - - * FIXED: Atom-referencing problem in literal index-map. - - * FIXED: Various URL/File issues in rdf_db.pl and rdf_edit.pl. Fixed - Triple20 modification issues. Anjo Anjewierden. - -Jan 18, 2007 - - * ADDED: loading of rdf embedded in xhtml. Yves Raimond. - -Jan 16, 2007 - - * FIXED: Various issues related to persistency handling after introduction - of new load plugin structure. - - * MODIFIED: Source info as created by rdf_load/2 is now always a URI. - -Jan 15, 2007 - - * FIXED: cache writing using global dir. - -Jan 2, 2007 - - * FIXED: Bug#248: bit-matrix handling. Keri Harris. - -Dec 20, 2006 - - * ENHANCED: slightly better messages from rdf_turtle.pl - -Dec 8, 2006 - - * ENHANCED: rdf_load/2 to load plugins dealing with different formats, - compression and sources such as HTTP. - - * ADDED: rdf_turtle.pl to load Turtle files. - -Nov 24, 2006 - - * FIXED: subPropertyOf issue. Michiel Hildebrand. - -Nov 9, 2006 - - * FIXED: subPropertyOf issues. Not fully checked yet. - -Oct 25, 2006 - - * FIXED: Memory leak in rdf_complexity and rdf_reachable using literal - object. - -Oct 24, 2006 - - * FIXED: Changed subject was broadcasted as object after rdf_update/4. - - * FIXED: Bug in duplicate administration when using language or type - qualified literals. Can cause assertion failure. With help from - Jacco van Ossenbruggen. - -Oct 11, 2006 - - * FIXED: Deal with new absolute_file_name sematics for file_type(directory). - -Oct 2, 2006 - - * FIXED: rdf_load/2 in combination with rdf_persistency.pl. Faster and - avoid leaking file-handles. Jacco van Ossenbruggen. - - * ADDED: rdf_persistency/2 to control whether or not a database is maintained - in the persistent database. E-culture project. - - * ADDED: numerical keys between/2, le/1 and ge/1 to rdf_find_literals/2. - E-culture project. - -Sep 11, 2006 - - * ADDED: options base_uri and write_xml_base to rdf_save/2. Jochem - Liem. - -Aug 27, 2006 - - * FIXED: Bug#199: failed to compile in single-thread mode. Keri Harris. - -Aug 16, 2006 - - * FIXED: Bug#194: Alignment problem. Keri Harris. - -Jul 27, 2006 - - * FIXED: use rdf:nodeID for bnodes that are used multiple times. - "Yves Raimond" - -Jul 11, 2006 - - * Fixed: Crash in rdf(+S, -P, literal(prefix(+Prefix), -Value)). - Michiel Hildebrand. - -Jun 26, 2006 - - * Fail silent on rdf(literal(x), ...) and rdf(S, literal(x), ...). - -Jun 21, 2006 - - * ADDED: silent(true) as option to rdf_load/2. - -Apr 10, 2006 - - * Enhanced: rdf_persistency.pl: sort files by size, assuming the schema - are generally smaller and loading them first reduces re-hashing the - database. - - * Enhanced: reduce the number of DB re-hashes by not calling the re-hash - if no subPropertyOf or predicate is involved. - -Mar 14, 2006 - - * Added: rdf_persistency.pl, copied from SeRQL library. - -Mar 13, 2006 - - * Added rdf_tokenize_literal/2 and hooks to re-use and customize literal - tokenization. - -Mar 7, 2006 - - * Completed integration of new AVL implementation. - * Added rdf_litindex.pl - -Mar 2, 2006 - - * Documented first version of literal maps, providing additional indexing - on literal values. - -Feb 28, 2006 - - * Modularization - - Moved atom-specific operations to new source file atom.c - - Moved locking operations to new source lock.c - - Moved debugging support to new source debug.c - -Feb 27, 2006 - - * Fixed: crash in rdf_update/4 modifying a literal under a transaction. - Michiel Hildebrand. - -Feb 22, 2006 - - * Fixed ordering issue on wide-character atoms. - -Feb 9, 2006 - - * Finished first version of indexed prefix and `like' search. - -Feb 5, 2006 - - * Allow 64-bit integers as arguments of literal(Int). - -Feb 1, 2006 - - * INTERNAL: completed first step of new literal handling code. System - passes internal tests under valgrind memory tests. Fixed two - memory leaks that pre-dated this change: using terms as literals - and reclaiming the temporary datastructures using in rdf_save_db/2. - -Jan 31, 2006 - - * INTERNAL: 1-st step making literals first class citizens. - * NOTE: The changes are numerous. Be aware of possible stability - problems. - -Jan 17, 2006 - - * ADDED: exported rdf_quote_uri/2 implementing unicode quoting rules for - URIs. - -Jan 11, 2006 - - * FIXED: Avoid exception in rdf_unload/1 - -Dec 18, 2005 - - * FIXED: Added simpleminded handling for updating the database from - within a monitor. - -Dec 5, 2005 - - * ADDED: Each instance of rdfs:Datatype is a subclass of rdfs:Literal - to the rules of rdf_subclass_of/2. - -Nov 24, 2005 - - * FIXED: Choicepoint in rdf_global_term/2, returning incorrect result - on backtracking. - -Nov 9, 2005 - - * FIXED: generate correct XML for datatypes in defined namespaces. - Ilmars Poikans. - -Oct 11, 2005 - - * FIXED: rdf_split_url/3 to detect local part more in line with current - URI specs. - -Sep 23, 2005 - - * ENHANCED: issue monitor events with holding write lock. - -Sep 22, 2005 - - * FIXED: mask-handling in rdf_monitor, causing incorrect callbacks. - - * FIXED: bug in cache handling by rdf_load/2, introduced in 2.3.0. - -============= -Version 2.3.0 -============= - -Sep 16, 2005 - - * FIXED: Namespace computation (broken in 5.5.30 version). - - * ADDED: rdf_transaction/2 and rdf_monitor/1. - - * MODIFIED: rdf_source/1 also returns sources added using rdf_assert/4, - i.e. setof(DB, rdf(_,_,_,DB), DBs), member(DB, DBs). - - * FIXED: rdf_update/[4,5]: unlock after type-error in action. - - -============= -Version 2.2.1 -============= - -Aug 10, 2005 - - * FIXED: Quick Save Format for wide-character atoms. Saved first - character as many times as the length of the atom. - -Aug 4, 2005 - - * ADDED: document_language(+Lang) option to rdf_save/2. Suggested - by Mark van Assem. - -Jul 15, 2005 - - * ADDED/CLEANUP: new rdf_meta/1 directive to simplify namespace - pre-processing. - -Jul 5, 2005 - - * ADDED/FIXED: Proper quoting of Unicode URI values conforming the - RDF standard. Jochem Liem. - -Jun 29, 2005 - - * FIXED: rdf:about instead of about when saving lists. Jochem Liem. - -May 24, 2005 - - * ENHANCED: Added core statistics - - * FIXED: force re-hashing while loading files to avoid slowdown. - -May 20, 2005 - - * ADDED: Allow list of files in rdf_load/[1,2] - -May 19, 2005 - - * ADDED: rdf_register_ns/3, allow overruling old alias. - -Apr 26, 2005 - - * FIXED: support UNICODE in rdf_save_db/rdf_load_db. Fabien - Todescato. - -Apr 19, 2005 - - * FIXED: rdf_retractall/[3,4] should always succeed. Bob Wielinga. - -Apr 18, 2005 - - * ADDED: rdfs_find/5: allow for unbound property list to search all - properties. - -Apr 1, 2005 - - * FIXED: memory leak creating many predicate structures on calls to - rdf(?,+,?) if the predicate does not exist. This is used by - rdf_bnode/1. - -Mar 29, 2005 - - * FIXED: rdf:dataType --> rdf:datatype - -Mar 22, 2005 - - * ADDED: rdfs_assert_list/3 (adding DB argument) - -Mar 8, 2005 - - * FIXED: rdf_unload/1: allow for deleting non-files. - -Mar 6, 2005 - - * FIXED: Added code to emit XML literal values using library(sgml_write). - -Mar 01, 2005 - - * FIXED/ADDED: encoding issues. Now allows writing RDF files using - US-ASCII, ISO latin-1 or UTF-8 (default) encoding. - -Feb 24, 2005 - - * MODIFIED: rdf_edit.pl: broadcast missing journal instead of creating - an XPCE dialog. More flexible and removes XPCE dependency. - -Feb 22, 2005 - - * FIXED: rdf_save/[1,2] to properly quote attributes. Anjo Anjewierden. - -Feb 18, 2005 - - * FIXED: rdf(X,Y,literal(lang(L,W))): not indexed query. Djamé Seddah. - -Jan 27, 2005 - - * ADDED: wide-character support in label matching (rdf_match_label/3) - and literals queries (rdf(S, P, literal(substring(foo), X))). - -Nov 29, 2004 - - * FIXED: lock language/type atom. Djamé Seddah. - -Oct 19, 2004 - - * FIXED: Bug#194: Locking problem using read access inside a - tranaction. Sandro Hawke. - - * ADDED: Do goal expansion on the argument of rdf_transaction/1. Sandro - Hawke. - -Oct 18, 2004 (version 2.2.0) - - * ADDED: rdf_transaction/1 - -Oct 13, 2004 - - * FIXED: Total reorganisation of the multi-threaded access using - redesigned locking which allows for one writer and multiple readers. - -Oct 12, 2004 - - * INTERNAL: Preparing for seperate databases by combining all global - data in a single structure. - -Oct 6, 2004 - - * ADDED/FIXED: Various issues in the documentation. - -Sep 29, 2004 - - * FIXED: Avoid continuous recomputation of `direct' (rdf) branching - factors. - -Sep 28, 2004 - - * FIXED: complexity estimate for not-indexed queries (crash). - -Sep 14, 2004 - - * ENHANCED: Actually start of with small tables and resize them if the - triple count increases. Reduces memory usage and improves speed on - erasing and re-hashing small datasets. - - * FIXED: Bug#183: memory corruption due to invalid free. Sandro Hawke. - Same test also provided other consistency errors. - -Sep 2, 2004 - - * FIXED: rdfs_subclass_of(+Class, -Super) to relate all classes - implicitely to rdfs:Resource (rdfs entailment rule). - - * FIXED: Bug#182: After rdf_retractall(_,_,_) database cannot be refilled. - Sandro Hawke. - -Sep 1, 2004 - - * FIXED: rdf_match_label(like, '*Rijn*', 'van Rijn') - - * ADDED: rdf_predicate_property/2 new properties rdfs_object_branch_factor - and rdfs_subject_branch_factor. - -Aug 31, 2004 - - * ADDED: rdf_predicate_property/2 new properties rdf_object_branch_factor - and rdf_subject_branch_factor. - -Aug 27, 2004 - - * FIXED: module problem in rdf_db.pl - -Aug 26, 2004 - - * ADDED: convert_typed_literal option to rdf_save/2. Bug#171. - Sandro Hawke. - -Aug 19, 2004 - - * ADDED: rdf_estimate_complexity/4. - - * ADDED: rdf_predicate_property(+Predicate, triples(-Count)) to find - the number of triples on a predciate. - -Aug 11, 2004 - - * FIXED: rdf_load_db/1 now updates the source registration - (rdf_source/1). - -Jul 30, 2004 - - * ADDED: rdf_atom_md5/3 for password encryption purposes. - -Jul 29, 2004 - - * ADDED: matching using the SeRQL compatible `like' operator. - -Jul 22, 2004 - - * ADDED: Namespace expansion in rdf(S,P,literal(type(xsd:int, 5))). - Bug#170. Sandro Hawke. - - * FIXED: rdf(X,X,X) and similar queries. - -Jul 15, 2004 - - * ENHANCED: Added triple garbage collector. After Bug#161 by Sandro Hawke. - - * FIXED: Bug#160: rdf_safe_header/2 implementation and documentation. - Sandro Hawke. - -Jun 29, 2004 - - * FIXED: rdf_split_url(+, +, -). Bob Wielinga. - -Jun 17, 2004 - - * FIXED: pass base_uri option to rdf_load from rdfe_load to avoid clashes - of bnodes. - -Jun 16, 2004 - - * FIXED: rdf(-,+,+) was indexed as rdf(-,+,-) if the object is a resource. - -Jun 2, 2004 - - * ADDED: rdf_is_bnode/1 - -May 22, 2004 - - * FIXED: Literal string matching broken with introduction of - language support. (Sandro Hawke) - -Apr 23, 2004 - - * ADDED: first version of lang and dataType support. Improved test-suite - -Apr 22, 2004 - - * ADDED: Support for arbitrary Prolog values for `Object'. This will be - used to support xml:lang, rdf:dataType and XML literals. - -Apr 11, 2004 - - * FIXED: rdf:parseType="Collection": XML attribute value _always_ requires - quotes. Maarten Menken. - -Apr 1, 2004 - - * FIXED: Save toplevel anonymous resources unless anon(false) is provided - in the option list of rdf_save/2. Simon Price and Dan Brickley. - - * ADDED: Option list to rdf_save/2 - -Nov 29, 2003 - - * FIXED: rdfs_individual_of(+, -) (only generated Resource). - -Nov 20, 2003 - - * FIXED: Avoid the use of typed nodes if the type-resource cannot be - expressed as an XML name. - - * FIXED: non-determinism in rdf_node/1 and rdf_bnode/1. - -Nov 17, 2003 - - * FIXED: rdfs_subclass_of/2 to make all classes a subclass of rdfs:'Class'. - - * FIXED: rdf_save/[1,2] to handle XML escapes `value' - in rdf:resource="value". - - * ADDED: rdf_bnode/1 to generate a blank node identifier as __bnode - - * ADDED: rdfs_assert_list/2 to create an rdf list from resources. - -Nov 7, 2003 - - * ADDED: Allows rdf_load/[1,2] to process a stream. Maarten Menken. - -Oct 27, 2003 - - * ADDED: installation of owl.owl. - -Oct 16, 2003 - - * MODIFIED: Add source-file to MD5 computation for triples to make it - possible to locate the journal snapshot using the MD5. - - * FIXED: Added replay of rdfe_unload/1. - -Oct 9, 2003 - - * MODIFIED: rdf_md5/2 returns a null-digest for an empty source. - -Oct 7, 2003 - - * FIXED: rdf_update/[4,5]. Duplicate administration error. - - * MODIFIED: rdfs_label(+Resource, -Label) first returns labels registered - with rdfs:label and only afterwards with sub-properties thereof. - -Oct 6, 2003 - - * MODIFIED: rdfs_individual_of(Resource, Class) implicitely assumes all - resources belong to rdfs:Resource and literal(_) belongs to rdfs:Literal. - -Oct 1, 2003 - - * MODIFIED: XSD namespace declaration in rdf_db.pl to - http://www.w3.org/2001/XMLSchema# - -Sep 30, 2003 - - * FIXED: rdfs_find: every class is supposed to be a subclass of - rdfs:Resource. Cleanup of comment - -Sep 29, 2003 - - * ENHANCED: Store and reload MD5 using rdf_save_db and rdf_load_db for - speedup of loading and (possible now) verify the integrety of a quick - load triple file. - -Sep 27, 2003 - - * ADDED: 1st version of MD5 digest from loaded sources - -Sep 24, 2003 - - * ADDED: internal administration of triples associated with each source. - Prolog based counting at the end if either very slow or not thread-safe. - -Sep 23, 2003 - - * FIXED: rdf_has(-, +, -). Didn't use proper hash-key, missing - sub-properties. - -Sep 22, 2003 - - * ADDED: rdf_reset_db/0 to clear the entire database. - -Sep 21, 2003 - - * ADDED: rdf_edit.pl: rdfe_register_ns/2 encapsulation of rdf_register_ns/2. - - * ADDED: rdfe_update/4 encapsulation of the new source action for - rdf_update/4. - -Sep 20, 2003 - - * FIXED: Unification of source-location - - * ADDED: rdfe_assert/4 (encapsulating rdf_assert/4). - - * ADDED: rdf_update/5. Allow changing the source data associated with - a triple. - - * FIXED: Memory management problem in virtual property-hierarchy roots. - -Sep 19, 2003 - - * FIXED: rdf_update() to properly update the hash-table. - -Sep 18, 2003 - - * ADDED: timestamps to transaction journal commit operations. - - * ADDED: rdf_edit.pl: named transactions. - -Sep 13, 2003 - - * FIXED: rehashing on first access/change. - - * FIXED: goal expansion for rdf_retractall/[3,4]. - - * ADDED: Handle predicates with multiple rdfs:subPropertyOf triples. - -Sep 11, 2003 - - * ENHANCED: Duplicate handling - -Sep 10, 2003 - - * FIXED: Undo/redo administration in rdf_edit.pl - -Sep 8, 2003 - - * FIXED: rollback in failed transactions. - -Sep 4, 2003 - - * FIXED: add goal-expansion to rdfe_retractall/3 - -Sep 2, 2003 - - * ADDED: rdfe_transaction_member/2 to inspect actions inside a transaction. - - * FIXED: rdfe_retractall/[3,4] to properly update the journal. - - * FIXED: rdf_assert duplicate administration (crashes rdf_retractall on - assertion failure). - -Aug 18, 2003 - - * MODIFIED: Assume ids starting with __ are anonymous - -Aug 6, 2003 - - * FIXED: namespace generation in rdf_save/2. Laura Hollink - -Aug 01, 2003 - - * ADDED: rdf_save/[1,2] to generate rdf:parseType=Collection for anonymous - rdf lists. - - * FIXED: rdf_save/[1,2] - -Jun 23, 2003 - - * ADDED: rdf_generation/1 - -Jun 20, 2003 - - * FIXED: Memory leak in rdf_reachable/3. - - * FIXED: Various installation issues - -Jun 10, 2003 - - * Initial public version diff --git a/packages/semweb/Makefile.in b/packages/semweb/Makefile.in deleted file mode 100755 index 54e505886..000000000 --- a/packages/semweb/Makefile.in +++ /dev/null @@ -1,205 +0,0 @@ -################################################################ -# Makefile template for SWI-Prolog RDF-DB package -# -# This template is used by configure to create Makefile. See -# the file INSTALL for further installation instructions. -# -# License: LGPL -# -# Special targets: -# -# ln-install Install with symbolic links -# -# Author: Jan Wielemaker (wielemak@science.uva.nl) -################################################################ - -.SUFFIXES: .tex .dvi .doc .pl - -ifeq (@PROLOG_SYSTEM@,yap) - -prefix = @prefix@ -exec_prefix = @exec_prefix@ -ROOTDIR = $(prefix) -EROOTDIR = @exec_prefix@ -abs_top_builddir = @abs_top_builddir@ - -srcdir=@srcdir@ - -BINDIR = $(EROOTDIR)/bin -LIBDIR=@libdir@ -YAPLIBDIR=@libdir@/Yap -SHAREDIR=$(ROOTDIR)/share/Yap - -SHELL=@SHELL@ -PL=@INSTALL_ENV@ $(DESTDIR)$(BINDIR)/yap $(DESTDIR)$(YAPLIBDIR)/startup.yss -EXDIR=$(YAPLIBDIR)/examples/http -LN_S=@LN_S@ -# -# -DEFS=@DEFS@ -D_YAP_NOT_INSTALLED_=1 -CC=@CC@ -CFLAGS= @SHLIB_CFLAGS@ $(YAP_EXTRAS) $(DEFS) -I$(srcdir) -I../.. -I$(srcdir)/../../include @CPPFLAGS@ -MKINDEX=true - - -SO=@SO@ -#4.1VPATH=@srcdir@:@srcdir@/OPTYap -CWD=$(PWD) -# - -LD=@DO_SECOND_LD@ @SHLIB_LD@ -LDFLAGS=@EXTRA_LIBS_FOR_SWIDLLS@ @LDFLAGS@ - -BINTARGET=$(DESTDIR)$(YAPLIBDIR) -PLTARGET=$(DESTDIR)$(SHAREDIR)/semweb - -FINAL_BINTARGET=$(YAPLIBDIR) -FINAL_PLTARGET=$(SHAREDIR) - -%.o: $(srcdir)/%.c - $(CC) -c $(CFLAGS) $< -o $@ - -else - -PL=@PL@ -PLBASE=@PLBASE@ -PLARCH=@PLARCH@ -PLINCL=@PLINCL@ -PKGDOC=$(PLBASE)/doc/packages -PCEHOME=../xpce -LIBDIR=$(PLBASE)/library/semweb - -CC=@CC@ -COFLAGS=@COFLAGS@ -CWFLAGS=@CWFLAGS@ -CMFLAGS=@CMFLAGS@ -CIFLAGS=-I. -CFLAGS=$(COFLAGS) $(CWFLAGS) $(CMFLAGS) $(CIFLAGS) @DEFS@ -LIBS=@LIBS@ -NETLIBS=@NETLIBS@ - -PUBLICPL=swipl -DOCTOTEX=$(PCEHOME)/bin/doc2tex -PLTOTEX=$(PUBLICPL) -q -s pltotex.pl -g pltotex -- -DOC=semweb -TEX=$(DOC).tex rdfturtle.tex rdfturtlewrite.tex rdfcompare.tex \ - rdfportray.tex rdflib.tex sparqlclient.tex -DVI=$(DOC).dvi -PDF=$(DOC).pdf -RUNTEX=../../man/runtex - -LD=@LD@ -LDFLAGS=@LDSOFLAGS@ - -endif - -INSTALL=@INSTALL@ -INSTALL_PROGRAM=@INSTALL_PROGRAM@ -INSTALL_DATA=@INSTALL_DATA@ - -include $(srcdir)/common.mk - -TARGETS= rdf_db.@SO@ turtle.@SO@ - -RDFDBOBJ= rdf_db.o atom.o lock.o md5.o avl.o atom_map.o debug.o \ - hash.o murmur.o - -all: $(TARGETS) - -rdf_db.@SO@: $(RDFDBOBJ) - $(LD) $(LDFLAGS) -o $@ $(RDFDBOBJ) $(LIBS) -turtle.@SO@: turtle.o - $(LD) $(LDFLAGS) -o $@ turtle.o $(LIBS) - -turtle.o: $(srcdir)/turtle.c $(srcdir)/turtle_chars.c - -install: $(TARGETS) $(LIBPL) - mkdir -p $(BINTARGET) - for f in $(TARGETS); do \ - $(INSTALL) -m 755 $$f $(BINTARGET); \ - done - mkdir -p $(PLTARGET) - for f in $(DATA) $(LIBPL) $(srcdir)/README; do \ - $(INSTALL_DATA) $$f $(PLTARGET); \ - done - $(PL) -f none -g make -t halt - -ln-install:: - $(MAKE) INSTALL=../ln-install \ - INSTALL_DATA=../ln-install \ - install - -rpm-install: install - -html-install:: - mkdir -p $(DESTDIR)$(PKGDOC) - $(INSTALL) -m 644 $(DOC).html $(DESTDIR)$(PKGDOC) - $(INSTALL) -m 644 $(srcdir)/modules.gif $(DESTDIR)$(PKGDOC) - -pdf-install:: - mkdir -p $(DESTDIR)$(PKGDOC) - $(INSTALL) -m 644 $(DOC).pdf $(DESTDIR)$(PKGDOC) - -uninstall:: - (cd $(PLBASE)/lib/$(PLARCH) && rm -f $(TARGETS)) - (cd $(PLBASE)/library && rm -f $(LIBPL)) - $(PL) -f none -g make -t halt - -rdf_db.o: $(srcdir)/quote.c $(srcdir)/unicode_map.c - -################################################################ -# Documentation -################################################################ - -pdf: $(PDF) - -$(DVI): $(TEX) - $(RUNTEX) $(DOC) - -$(PDF): $(TEX) - $(RUNTEX) --pdf $(DOC) - -html: $(TEX) - latex2html $(DOC) - -$(TEX): $(DOCTOTEX) - -rdfturtle.tex: $(srcdir)/rdf_turtle.pl - $(PLTOTEX) --section 'library(semweb/rdf_turtle)' -rdfturtlewrite.tex: $(srcdir)/rdf_turtle_write.pl - $(PLTOTEX) --section 'library(semweb/rdf_turtle_write)' -rdfcompare.tex: $(srcdir)/rdf_compare.pl - $(PLTOTEX) --section 'library(semweb/rdf_compare)' -rdfportray.tex: $(srcdir)/rdf_portray.pl - $(PLTOTEX) --section 'library(semweb/rdf_portray)' -sparqlclient.tex: $(srcdir)/sparql_client.pl - $(PLTOTEX) --section 'library(semweb/sparql_client)' - -.doc.tex: - $(DOCTOTEX) $*.doc > $*.tex - -################################################################ -# Check -################################################################ - -check:: - $(PL) -q -f $(srcdir)/test_rdf_db.pl -g test_rdf_db,halt -t 'halt(1)' - $(PL) -q -f $(srcdir)/litmap_test.pl -g test,halt -t 'halt(1)' - $(PL) -q -f $(srcdir)/test.pl -g run_tests,halt -t 'halt(1)' - $(PL) -q -f $(srcdir)/test_turtle.pl -g test_turtle,halt -t 'halt(1)' - - -################################################################ -# Clean -################################################################ - -clean: texclean - rm -f $(OBJ) *~ *.o *% a.out core config.log - -texclean: - rm -f $(TEX) $(DOC).aux $(DOC).log $(DOC).out $(DOC).toc \ - $(DOC).ilg - -distclean: clean - rm -f $(TARGETS) config.cache config.h config.status Makefile - diff --git a/packages/semweb/Makefile.mak b/packages/semweb/Makefile.mak deleted file mode 100644 index 93ff886a5..000000000 --- a/packages/semweb/Makefile.mak +++ /dev/null @@ -1,67 +0,0 @@ -################################################################ -# Build the SWI-Prolog semantic web package for MS-Windows -# -# Author: Jan Wielemaker -# -# Use: -# nmake /f Makefile.mak -# nmake /f Makefile.mak install -################################################################ - -PLHOME=..\.. -!include ..\..\src\rules.mk -!include common.mk - -LIBDIR= $(PLBASE)\library\semweb -PKGDLL=rdf_db - -OBJ= rdf_db.obj md5.obj avl.obj atom_map.obj atom.obj \ - lock.obj debug.obj hash.obj murmur.obj - -all: $(PKGDLL).dll turtle.dll - -$(PKGDLL).dll: $(OBJ) - $(LD) /dll /out:$@ $(LDFLAGS) $(OBJ) $(PLLIB) $(LIBS) -turtle.dll: turtle.obj - $(LD) /dll /out:$@ $(LDFLAGS) turtle.obj $(PLLIB) $(LIBS) - -turtle.obj: turtle.c turtle_chars.c - -!IF "$(CFG)" == "rt" -install: idll -!ELSE -install: idll ilib -!ENDIF - -idll:: - copy $(PKGDLL).dll "$(BINDIR)" - copy turtle.dll "$(BINDIR)" -ilib:: - if not exist "$(LIBDIR)/$(NULL)" $(MKDIR) "$(LIBDIR)" - @echo Copying $(LIBPL) - @for %f in ($(LIBPL)) do @copy %f "$(LIBDIR)" - @for %f in ($(DATA)) do @copy %f "$(LIBDIR)" - copy README "$(LIBDIR)\README.TXT" - $(MAKEINDEX) - -html-install:: - copy semweb.html "$(PKGDOC)" - copy modules.gif "$(PKGDOC)" -pdf-install: - copy semweb.pdf "$(PKGDOC)" - -xpce-install:: - -uninstall:: - del "$(PLBASE)\bin\$(PKGDLL).dll" - cd $(LIBDIR) & del $(LIBPL) $(DATA) README.TXT - rmdir $(LIBDIR) - $(MAKEINDEX) - -clean:: - if exist *.obj del *.obj - if exist *~ del *~ - -distclean: clean - -DEL *.dll *.lib *.exp *.pdb *.ilk 2>nul - diff --git a/packages/semweb/NOTES b/packages/semweb/NOTES deleted file mode 100644 index 7ede984bb..000000000 --- a/packages/semweb/NOTES +++ /dev/null @@ -1,13 +0,0 @@ -Indexing -======== - -The indexing omits the table BY_SPO, indexing on all three arguments but -uses BY_SP instead. It was thought not to gain that much. This -assumption was verified on real data (100,000 triple). Introducing -BY_SPO gave a slowdown of about 10%. Appearently the relatively high cost -for indexing on the complicated object field outweights the benefits. - -The patch is left for reference in BY_SPO.diff. Note that after applying -this patch the test cases no longer pass. As the failing cases were -irrelevant to the performance test I never bothered fixing this due to -the failed performance test. diff --git a/packages/semweb/README b/packages/semweb/README deleted file mode 100644 index 44ebff7c3..000000000 --- a/packages/semweb/README +++ /dev/null @@ -1,33 +0,0 @@ ----+ SWI-Prolog Semantic Web Library - ----++ Abstract - -The semweb library provides a Prolog library based on foreign-language -extensions for storing and manipulating RDF triples. It can handle quite -large sets of triples only limited by available memory. One million -triples requires about 80MB memory, so a fully equiped 32-bit machine -can handle about 25 million triples. A 64-bit machine with 32Gb memory -(just a few thousand euros in june 2009) can handle up to 150 million -triples. - - ----++ Prerequisites - -This library depends on the RDF parser library which in turn depends on -the XML parser provided by the sgml package. - - ----++ Further info - -This library defines the semantic web infrastructure for SWI-Prolog. The -library is documented in semweb.pdf or the equivalent semweb.html. If -your installation does not include this file, please visit -http://www.swi-prolog.org/packages/ - - ----++ Staying up-to-date - -This library is under active development. The recent version can be -accessed from the GIT repository under the directory pl/packages/semweb. -See http://www.swi-prolog.org/git.html for details on the central GIT -repository and instructions for browsing the repository online. diff --git a/packages/semweb/TODO b/packages/semweb/TODO deleted file mode 100644 index 3b2e8a6a6..000000000 --- a/packages/semweb/TODO +++ /dev/null @@ -1,32 +0,0 @@ -* Add indexing on source, to speedup saving a particular source as well as - rdf_retractall(_,_,_,Src). - -* Add indexing for rdf(+,+,+)? Might speedup loading (duplicate adiminstration). - -* Document hookable rdf_load/2 - -* Allow for concurrent transactions. - - - Starting a transaction obtains no lock - - Each thread has its own transaction queue - - If a thread that has a transaction starts one, this (still) - creates a nested transaction. - - Only if a transaction is about to be comitted, it obtains a - write-lock, plays the queue and releases the write lock. - - What goes wrong now? - - - If a transaction does repeated read queries, it may see different - data during its read actions. - - This could be avoided using generation-stamps, similar to Prolog - - How can queued actions interfere with each other? - - A: S0 --> S1 - - B: S0 --> S2 - - Asynchronous write is generally possible, unless it requires a re-hash. - - - Writes must remain sequentially (for the persistency and callback - assumptions). - - Can we avoid the *need* for a re-hash? This would require multiple - queries if predicate clouds are joined. - diff --git a/packages/semweb/Tests/Turtle/README.txt b/packages/semweb/Tests/Turtle/README.txt deleted file mode 100644 index 37460e60f..000000000 --- a/packages/semweb/Tests/Turtle/README.txt +++ /dev/null @@ -1,20 +0,0 @@ -These are the tests for the Turtle Terse RDF Triple Language -that must be passed by conformant systems. See - http://www.dajobe.org/2004/01/turtle/ -for the full conformance information. - -The format is a set of good tests and bad tests. - -Good tests are a pair of files: - abc.ttl abc.out -which are the input Turtle file and the expected output RDF triples, -written in N-Triples. - -bad tests are of the form - bad-XX.ttl -which must fail. - -The tests should be performed with an assumed base URI -of http://www.w3.org/2001/sw/DataAccess/df1/tests/ - -Dave diff --git a/packages/semweb/Tests/Turtle/bad-00.ttl b/packages/semweb/Tests/Turtle/bad-00.ttl deleted file mode 100644 index b1a1b3619..000000000 --- a/packages/semweb/Tests/Turtle/bad-00.ttl +++ /dev/null @@ -1,2 +0,0 @@ -# prefix name must end in a : -@prefix a <#> . diff --git a/packages/semweb/Tests/Turtle/bad-01.ttl b/packages/semweb/Tests/Turtle/bad-01.ttl deleted file mode 100644 index 533bc21db..000000000 --- a/packages/semweb/Tests/Turtle/bad-01.ttl +++ /dev/null @@ -1,3 +0,0 @@ -# Forbidden by RDF - predicate cannot be blank -@prefix : . -:a [ :b :c ] :d . diff --git a/packages/semweb/Tests/Turtle/bad-02.ttl b/packages/semweb/Tests/Turtle/bad-02.ttl deleted file mode 100644 index fd2014d0b..000000000 --- a/packages/semweb/Tests/Turtle/bad-02.ttl +++ /dev/null @@ -1,3 +0,0 @@ -# Forbidden by RDF - predicate cannot be blank -@prefix : . -:a [] :b . diff --git a/packages/semweb/Tests/Turtle/bad-03.ttl b/packages/semweb/Tests/Turtle/bad-03.ttl deleted file mode 100644 index 07a372f18..000000000 --- a/packages/semweb/Tests/Turtle/bad-03.ttl +++ /dev/null @@ -1,3 +0,0 @@ -# 'a' only allowed as a predicate -@prefix : . -a :a :b . diff --git a/packages/semweb/Tests/Turtle/bad-04.ttl b/packages/semweb/Tests/Turtle/bad-04.ttl deleted file mode 100644 index ee7246c83..000000000 --- a/packages/semweb/Tests/Turtle/bad-04.ttl +++ /dev/null @@ -1,3 +0,0 @@ -# No comma is allowed in collections -@prefix : . -:a :b ( "apple", "banana" ) . diff --git a/packages/semweb/Tests/Turtle/bad-05.ttl b/packages/semweb/Tests/Turtle/bad-05.ttl deleted file mode 100644 index 387015fe0..000000000 --- a/packages/semweb/Tests/Turtle/bad-05.ttl +++ /dev/null @@ -1,4 +0,0 @@ -# N3 {}s are not in Turtle -@prefix : . -{ :a :b :c . } :d :e . - diff --git a/packages/semweb/Tests/Turtle/bad-06.ttl b/packages/semweb/Tests/Turtle/bad-06.ttl deleted file mode 100644 index a8f1a0fca..000000000 --- a/packages/semweb/Tests/Turtle/bad-06.ttl +++ /dev/null @@ -1,3 +0,0 @@ -# is and of are not in turtle -@prefix : . -:a is :b of :c . diff --git a/packages/semweb/Tests/Turtle/bad-07.ttl b/packages/semweb/Tests/Turtle/bad-07.ttl deleted file mode 100644 index 18ea4fa6b..000000000 --- a/packages/semweb/Tests/Turtle/bad-07.ttl +++ /dev/null @@ -1,4 +0,0 @@ -# paths are not in turtle -@prefix : . -:a.:b.:c . -:a^:b^:c . diff --git a/packages/semweb/Tests/Turtle/bad-08.ttl b/packages/semweb/Tests/Turtle/bad-08.ttl deleted file mode 100644 index 07918f9ac..000000000 --- a/packages/semweb/Tests/Turtle/bad-08.ttl +++ /dev/null @@ -1,2 +0,0 @@ -@keywords something. -# @keywords is not in turtle diff --git a/packages/semweb/Tests/Turtle/bad-09.ttl b/packages/semweb/Tests/Turtle/bad-09.ttl deleted file mode 100644 index d2d76c136..000000000 --- a/packages/semweb/Tests/Turtle/bad-09.ttl +++ /dev/null @@ -1,3 +0,0 @@ -# implies is not in turtle -@prefix : . -:a => :b . diff --git a/packages/semweb/Tests/Turtle/bad-10.ttl b/packages/semweb/Tests/Turtle/bad-10.ttl deleted file mode 100644 index b5ef1f557..000000000 --- a/packages/semweb/Tests/Turtle/bad-10.ttl +++ /dev/null @@ -1,3 +0,0 @@ -# equivalence is not in turtle -@prefix : . -:a = :b . diff --git a/packages/semweb/Tests/Turtle/bad-11.ttl b/packages/semweb/Tests/Turtle/bad-11.ttl deleted file mode 100644 index 09e7b6a0b..000000000 --- a/packages/semweb/Tests/Turtle/bad-11.ttl +++ /dev/null @@ -1,3 +0,0 @@ -# @forAll is not in turtle -@prefix : . -@forAll :x . diff --git a/packages/semweb/Tests/Turtle/bad-12.ttl b/packages/semweb/Tests/Turtle/bad-12.ttl deleted file mode 100644 index cef48ff86..000000000 --- a/packages/semweb/Tests/Turtle/bad-12.ttl +++ /dev/null @@ -1,3 +0,0 @@ -# @forSome is not in turtle -@prefix : . -@forSome :x . diff --git a/packages/semweb/Tests/Turtle/bad-13.ttl b/packages/semweb/Tests/Turtle/bad-13.ttl deleted file mode 100644 index 91accf2b0..000000000 --- a/packages/semweb/Tests/Turtle/bad-13.ttl +++ /dev/null @@ -1,3 +0,0 @@ -# <= is not in turtle -@prefix : . -:a <= :b . diff --git a/packages/semweb/Tests/Turtle/bad-14.ttl b/packages/semweb/Tests/Turtle/bad-14.ttl deleted file mode 100644 index f4a7acf54..000000000 --- a/packages/semweb/Tests/Turtle/bad-14.ttl +++ /dev/null @@ -1,6 +0,0 @@ -# Test long literals with missing end -@prefix : . -:a :b """a long - literal -with -newlines diff --git a/packages/semweb/Tests/Turtle/manifest-bad.ttl b/packages/semweb/Tests/Turtle/manifest-bad.ttl deleted file mode 100644 index e8c5ba8f8..000000000 --- a/packages/semweb/Tests/Turtle/manifest-bad.ttl +++ /dev/null @@ -1,88 +0,0 @@ -@prefix rdf: . -@prefix rdfs: . -@prefix mf: . -@prefix qt: . - -<> rdf:type mf:Manifest ; - rdfs:comment "Turtle bad syntax test cases (must fail)" ; - mf:entries - ( - - [ mf:name "bad-00" ; - rdfs:comment "prefix name must end in a :" ; - mf:action [ qt:data ] ; - ] - - [ mf:name "bad-01" ; - rdfs:comment "blank predicate forbidden" ; - mf:action [ qt:data ] ; - ] - - [ mf:name "bad-02" ; - rdfs:comment "blank predicate forbidden" ; - mf:action [ qt:data ] ; - ] - - [ mf:name "bad-03" ; - rdfs:comment "a forbidden as subject" ; - mf:action [ qt:data ] ; - ] - - [ mf:name "bad-04" ; - rdfs:comment ", not allowed in collections" ; - mf:action [ qt:data ] ; - ] - - [ mf:name "bad-05" ; - rdfs:comment "{} not allowed in Turtle" ; - mf:action [ qt:data ] ; - ] - - [ mf:name "bad-06" ; - rdfs:comment "is and of not allowed in Turtle" ; - mf:action [ qt:data ] ; - ] - - [ mf:name "bad-07" ; - rdfs:comment "paths not allowed in Turtle" ; - mf:action [ qt:data ] ; - ] - - [ mf:name "bad-08" ; - rdfs:comment "@keywords not allowed in Turtle" ; - mf:action [ qt:data ] ; - ] - - [ mf:name "bad-09" ; - rdfs:comment "=> not allowed in Turtle" ; - mf:action [ qt:data ] ; - ] - - [ mf:name "bad-10" ; - rdfs:comment "= not allowed in Turtle" ; - mf:action [ qt:data ] ; - ] - - [ mf:name "bad-11" ; - rdfs:comment "@forAll not allowed in Turtle" ; - mf:action [ qt:data ] ; - ] - - [ mf:name "bad-12" ; - rdfs:comment "@forSome not allowed in Turtle" ; - mf:action [ qt:data ] ; - ] - - [ mf:name "bad-13" ; - rdfs:comment "<= not allowed in Turtle" ; - mf:action [ qt:data ] ; - ] - - [ mf:name "bad-14" ; - rdfs:comment "long literal with missing end" ; - mf:action [ qt:data ] ; - ] - - - # End of tests - ). diff --git a/packages/semweb/Tests/Turtle/manifest.ttl b/packages/semweb/Tests/Turtle/manifest.ttl deleted file mode 100644 index 6a2cae262..000000000 --- a/packages/semweb/Tests/Turtle/manifest.ttl +++ /dev/null @@ -1,215 +0,0 @@ -@prefix rdf: . -@prefix rdfs: . -@prefix mf: . -@prefix qt: . - -<> rdf:type mf:Manifest ; - rdfs:comment "Turtle good syntax test cases (must pass)" ; - mf:entries - ( - [ mf:name "test-00" ; - rdfs:comment "Blank subject" ; - mf:action [ qt:data ] ; - mf:result - ] - - [ mf:name "test-01" ; - rdfs:comment "@prefix and qnames" ; - mf:action [ qt:data ] ; - mf:result - ] - - [ mf:name "test-02" ; - rdfs:comment ", operator" ; - mf:action [ qt:data ] ; - mf:result - ] - - [ mf:name "test-03" ; - rdfs:comment "; operator" ; - mf:action [ qt:data ] ; - mf:result - ] - - [ mf:name "test-04" ; - rdfs:comment "empty [] as subject and object" ; - mf:action [ qt:data ] ; - mf:result - ] - - [ mf:name "test-05" ; - rdfs:comment "non-empty [] as subject and object" ; - mf:action [ qt:data ] ; - mf:result - ] - - [ mf:name "test-06" ; - rdfs:comment "'a' as predicate" ; - mf:action [ qt:data ] ; - mf:result - ] - - [ mf:name "test-07" ; - rdfs:comment "simple collection" ; - mf:action [ qt:data ] ; - mf:result - ] - - [ mf:name "test-08" ; - rdfs:comment "empty collection" ; - mf:action [ qt:data ] ; - mf:result - ] - - [ mf:name "test-09" ; - rdfs:comment "integer datatyped literal" ; - mf:action [ qt:data ] ; - mf:result - ] - - [ mf:name "test-10" ; - rdfs:comment "decimal integer canonicalization" ; - mf:action [ qt:data ] ; - mf:result - ] - - [ mf:name "test-11" ; - rdfs:comment "- and _ in names and qnames" ; - mf:action [ qt:data ] ; - mf:result - ] - - [ mf:name "test-12" ; - rdfs:comment "tests for rdf:_ and other qnames starting with _" ; - mf:action [ qt:data ] ; - mf:result - ] - - [ mf:name "test-13" ; - rdfs:comment "bare : allowed" ; - mf:action [ qt:data ] ; - mf:result - ] - - [ mf:name "test-14" ; - rdfs:comment "10000 triples, more than the default Bison stack size" ; - mf:action [ qt:data ] ; - mf:result - ] - - [ mf:name "test-15" ; - rdfs:comment "10000 triple objects (10000 triples)" ; - mf:action [ qt:data ] ; - mf:result - ] - - [ mf:name "test-16" ; - rdfs:comment "10000 items (10000 triples)" ; - mf:action [ qt:data ] ; - mf:result - ] - - [ mf:name "test-17" ; - rdfs:comment "simple long literal" ; - mf:action [ qt:data ] ; - mf:result - ] - - [ mf:name "test-18" ; - rdfs:comment "long literals with escapes" ; - mf:action [ qt:data ] ; - mf:result - ] - - [ mf:name "test-19" ; - rdfs:comment "floating point number" ; - mf:action [ qt:data ] ; - mf:result - ] - - [ mf:name "test-20" ; - rdfs:comment "empty literals, normal and long variant" ; - mf:action [ qt:data ] ; - mf:result - ] - - [ mf:name "test-21" ; - rdfs:comment "positive integer, decimal and doubles" ; - mf:action [ qt:data ] ; - mf:result - ] - - [ mf:name "test-22" ; - rdfs:comment "negative integer, decimal and doubles" ; - mf:action [ qt:data ] ; - mf:result - ] - - [ mf:name "test-23" ; - rdfs:comment "long literal ending in double quote" ; - mf:action [ qt:data ] ; - mf:result - ] - - [ mf:name "test-24" ; - rdfs:comment "boolean literals" ; - mf:action [ qt:data ] ; - mf:result - ] - - [ mf:name "test-25" ; - rdfs:comment "comments" ; - mf:action [ qt:data ] ; - mf:result - ] - - [ mf:name "test-26" ; - rdfs:comment "no final mewline" ; - mf:action [ qt:data ] ; - mf:result - ] - - [ mf:name "test-27" ; - rdfs:comment "duplicate prefix" ; - mf:action [ qt:data ] ; - mf:result - ] - - [ mf:name "test-28" ; - rdfs:comment "decimal data types (serializing test)" ; - mf:action [ qt:data ] ; - mf:result - ] - - [ mf:name "test-29" ; - rdfs:comment "Escaping U+0001 to U+007F in a URI" ; - mf:action [ qt:data ] ; - mf:result - ] - - [ mf:name "test-30" ; - rdfs:comment "@base" ; - mf:action [ qt:data ] ; - mf:result - ] - - [ mf:name "rdf-schema" ; - rdfs:comment "RDF Namespace document converted into Turtle" ; - mf:action [ qt:data ] ; - mf:result - ] - - [ mf:name "rdfs-namespace" ; - rdfs:comment "RDFS Namespace document converted into Turtle" ; - mf:action [ qt:data ] ; - mf:result - ] - - [ mf:name "rdfq-results" ; - rdfs:comment "Example query result from http://www.w3.org/2003/03/rdfqr-tests/recording-query-results.html" ; - mf:action [ qt:data ] ; - mf:result - ] - - # End of tests - ). diff --git a/packages/semweb/Tests/Turtle/rdf-schema.out b/packages/semweb/Tests/Turtle/rdf-schema.out deleted file mode 100644 index 94e14045a..000000000 --- a/packages/semweb/Tests/Turtle/rdf-schema.out +++ /dev/null @@ -1,126 +0,0 @@ - . - "Indicates membership of a class" . - "type"@en . - "type"@fr . - . - . - "The concept of Class" . - "Class"@en . - "Classe"@fr . - . - . - "Properties used to express RDF Schema constraints." . - "ConstraintProperty"@en . - "Propri\u00E9t\u00E9Contrainte"@fr . - . - . - . - . - "Resources used to express RDF Schema constraints." . - "ConstraintResource"@en . - "RessourceContrainte"@fr . - . - . - "This represents the set Containers." . - "Container"@en . - "Enveloppe"@fr . - . - . - "ContainerMembershipProperty"@en . - . - . - . - "This represents the set of atomic values, eg. textual strings." . - "Literal"@en . - "Litt\u00E9ral"@fr . - . - "The most general class" . - "Resource"@en . - "Ressource"@fr . - . - "Use this for descriptions" . - . - "comment"@en . - "commentaire"@fr . - . - . - "This is how we associate a class with properties that its instances can have" . - "domain"@en . - "domaine"@fr . - . - "Indicates a resource containing and defining the subject resource." . - . - "esD\u00E9finiPar"@fr . - "isDefinedBy"@en . - . - . - . - "Provides a human-readable version of a resource name." . - . - "label"@en . - "label"@fr . - . - . - "Properties that can be used in a schema to provide constraints" . - . - "range"@en . - "\u00E9tendue"@fr . - . - . - "Indicates a resource that provides information about the subject resource." . - . - "seeAlso"@en . - "voirAussi"@fr . - . - . - "Indicates membership of a class" . - . - "sousClasseDe"@fr . - "subClassOf"@en . - . - . - "Indicates specialization of properties" . - . - "sousPropri\u00E9t\u00E9De"@fr . - "subPropertyOf"@en . - . - . - "Alt"@en . - "Choix"@fr . - . - . - "Bag"@en . - "Ensemble"@fr . - . - . - "The concept of a property." . - "Property"@en . - "Propri\u00E9t\u00E9"@fr . - . - . - "Sequence"@en . - "S\u00E9quence"@fr . - . - . - "This represents the set of reified statements." . - "D\u00E9claration"@fr . - "Statement"@en . - . - . - . - "object"@en . - "objet"@fr . - . - . - "predicate"@en . - "pr\u00E9dicat"@fr . - . - . - . - "subject"@en . - "sujet"@fr . - . - . - "object"@en . - "value"@fr . - . diff --git a/packages/semweb/Tests/Turtle/rdf-schema.ttl b/packages/semweb/Tests/Turtle/rdf-schema.ttl deleted file mode 100644 index 8a61794e6..000000000 --- a/packages/semweb/Tests/Turtle/rdf-schema.ttl +++ /dev/null @@ -1,156 +0,0 @@ -# RDF Namespace document converted into Turtle - -@prefix : . -@prefix rdf: . - -rdf:type a rdf:Property; - :comment "Indicates membership of a class"; - :label "type"@en, - "type"@fr; - :range :Class . - -:Class a :Class; - :comment "The concept of Class"; - :label "Class"@en, - "Classe"@fr; - :subClassOf :Resource . - -:ConstraintProperty a :Class; - :comment "Properties used to express RDF Schema constraints."; - :label "ConstraintProperty"@en, - "Propri\u00E9t\u00E9Contrainte"@fr; - :subClassOf :ConstraintResource, - rdf:Property . - -:ConstraintResource a :Class, - :Class; - :comment "Resources used to express RDF Schema constraints."; - :label "ConstraintResource"@en, - "RessourceContrainte"@fr; - :subClassOf :Resource . - -:Container a :Class; - :comment "This represents the set Containers."; - :label "Container"@en, - "Enveloppe"@fr; - :subClassOf :Resource . - -:ContainerMembershipProperty a :Class; - :label "ContainerMembershipProperty"@en; - :subClassOf rdf:Property . - -:Literal a :Class, - :Class; - :comment "This represents the set of atomic values, eg. textual strings."; - :label "Literal"@en, - "Litt\u00E9ral"@fr . - -:Resource a :Class; - :comment "The most general class"; - :label "Resource"@en, - "Ressource"@fr . - -:comment a rdf:Property; - :comment "Use this for descriptions"; - :domain :Resource; - :label "comment"@en, - "commentaire"@fr; - :range :Literal . - -:domain a :ConstraintProperty; - :comment "This is how we associate a class with properties that its instances can have"; - :label "domain"@en, - "domaine"@fr . - -:isDefinedBy a rdf:Property; - :comment "Indicates a resource containing and defining the subject resource."; - :domain :Resource; - :label "esD\u00E9finiPar"@fr, - "isDefinedBy"@en; - :range :Resource; - :subPropertyOf :seeAlso . - -:label a rdf:Property; - :comment "Provides a human-readable version of a resource name."; - :domain :Resource; - :label "label"@en, - "label"@fr; - :range :Literal . - -:range a :ConstraintProperty; - :comment "Properties that can be used in a schema to provide constraints"; - :domain rdf:Property; - :label "range"@en, - "\u00E9tendue"@fr; - :range :Class . - -:seeAlso a rdf:Property; - :comment "Indicates a resource that provides information about the subject resource."; - :domain :Resource; - :label "seeAlso"@en, - "voirAussi"@fr; - :range :Resource . - -:subClassOf a rdf:Property; - :comment "Indicates membership of a class"; - :domain :Class; - :label "sousClasseDe"@fr, - "subClassOf"@en; - :range :Class . - -:subPropertyOf a rdf:Property; - :comment "Indicates specialization of properties"; - :domain rdf:Property; - :label "sousPropri\u00E9t\u00E9De"@fr, - "subPropertyOf"@en; - :range rdf:Property . - -rdf:Alt a :Class; - :label "Alt"@en, - "Choix"@fr; - :subClassOf :Container . - -rdf:Bag a :Class; - :label "Bag"@en, - "Ensemble"@fr; - :subClassOf :Container . - -rdf:Property a :Class; - :comment "The concept of a property."; - :label "Property"@en, - "Propri\u00E9t\u00E9"@fr; - :subClassOf :Resource . - -rdf:Seq a :Class; - :label "Sequence"@en, - "S\u00E9quence"@fr; - :subClassOf :Container . - -rdf:Statement a :Class; - :comment "This represents the set of reified statements."; - :label "D\u00E9claration"@fr, - "Statement"@en; - :subClassOf :Resource . - -rdf:object a rdf:Property; - :domain rdf:Statement; - :label "object"@en, - "objet"@fr . - -rdf:predicate a rdf:Property; - :domain rdf:Statement; - :label "predicate"@en, - "pr\u00E9dicat"@fr; - :range rdf:Property . - -rdf:subject a rdf:Property; - :domain rdf:Statement; - :label "subject"@en, - "sujet"@fr; - :range :Resource . - -rdf:value a rdf:Property; - :label "object"@en, - "value"@fr . - -: :seeAlso . diff --git a/packages/semweb/Tests/Turtle/rdfq-results.out b/packages/semweb/Tests/Turtle/rdfq-results.out deleted file mode 100644 index fb2542932..000000000 --- a/packages/semweb/Tests/Turtle/rdfq-results.out +++ /dev/null @@ -1,36 +0,0 @@ -_:genid1 "x" . -_:genid1 "123"^^ . -_:genid2 "y" . -_:genid2 . -_:genid3 . -_:genid3 _:genid1 . -_:genid3 _:genid2 . -_:genid4 "x" . -_:genid4 "2003-01-21" . -_:genid5 "y" . -_:genid5 . -_:genid6 . -_:genid6 _:genid4 . -_:genid6 _:genid5 . -_:genid7 "x" . -_:genid7 "anon1" . -_:genid8 "y" . -_:genid8 _:a . -_:genid9 . -_:genid9 _:genid7 . -_:genid9 _:genid8 . -_:genid10 "x" . -_:genid10 "anon2" . -_:genid11 "y" . -_:genid11 _:a . -_:genid12 . -_:genid12 _:genid10 . -_:genid12 _:genid11 . - . - "4"^^ . - "x" . - "y" . - _:genid3 . - _:genid6 . - _:genid9 . - _:genid12 . diff --git a/packages/semweb/Tests/Turtle/rdfq-results.ttl b/packages/semweb/Tests/Turtle/rdfq-results.ttl deleted file mode 100644 index c6e72aa7e..000000000 --- a/packages/semweb/Tests/Turtle/rdfq-results.ttl +++ /dev/null @@ -1,39 +0,0 @@ -# from http://www.w3.org/2003/03/rdfqr-tests/recording-query-results.html - -@prefix rdf: . -@prefix rs: . - - -<> rdf:type rs:ResultSet ; - rs:size 4 ; - rs:resultVariable "x" ; rs:resultVariable "y" ; - rs:solution - [ rdf:type rs:ResultSolution ; - rs:binding [ rs:variable "x" ; rs:value 123 ] ; - rs:binding [ rs:variable "y" ; rs:value ] - ] ; - - rs:solution - [ rdf:type rs:ResultSolution ; - rs:binding [ rs:variable "x" ; - rs:value "2003-01-21" ] ; - rs:binding [ rs:variable "y" ; - rs:value ] - ] ; - - rs:solution - [ rdf:type rs:ResultSolution ; - rs:binding [ rs:variable "x" ; - rs:value "anon1" ] ; - rs:binding [ rs:variable "y" ; - rs:value _:a ] - ] ; - - rs:solution - [ rdf:type rs:ResultSolution ; - rs:binding [ rs:variable "x" ; - rs:value "anon2" ] ; - rs:binding [ rs:variable "y" ; - rs:value _:a ] - ] ; - . diff --git a/packages/semweb/Tests/Turtle/rdfs-namespace.out b/packages/semweb/Tests/Turtle/rdfs-namespace.out deleted file mode 100644 index 4696f8cfb..000000000 --- a/packages/semweb/Tests/Turtle/rdfs-namespace.out +++ /dev/null @@ -1,131 +0,0 @@ - . - "Indicates membership of a class" . - . - . - "type"@en . - . - . - "A collection of alternatives."@en . - . - "Alt"@en . - . - . - "An unordered collection."@en . - . - "Bag"@en . - . - . - "The concept of a property." . - . - "Property"@en . - . - . - "An ordered collection."@en . - . - "Seq"@en . - . - . - "The class of RDF statements." . - . - "Statement"@en . - . - . - "The object of an RDF statement." . - . - . - "object"@en . - . - "the predicate of an RDF statement." . - . - . - "predicate"@en . - . - . - "The subject of an RDF statement." . - . - . - "subject"@en . - . - . - "Identifies the principal value (usually a string) of a property when the property value is a structured resource" . - . - . - "value"@en . - . - . - "The concept of Class" . - . - "Class"@en . - . - . - "This represents the set Containers." . - . - "Container"@en . - . - . - "The container membership properties, rdf:1, rdf:2, ..., all of which are sub-properties of 'member'." . - . - "ContainerMembershipProperty"@en . - . - . - "This represents the set of atomic values, eg. textual strings." . - . - "Literal"@en . - . - "The class resource, everything." . - . - "Resource"@en . - . - "Use this for descriptions" . - . - . - "comment"@en . - . - . - "A domain class for a property type" . - . - . - "domain"@en . - . - . - "Indicates the namespace of a resource" . - . - . - "isDefinedBy"@en . - . - . - . - "Provides a human-readable version of a resource name." . - . - . - "label"@en . - . - . - "a member of a container" . - . - . - "member"@en . - . - "A range class for a property type" . - . - . - "range"@en . - . - . - "A resource that provides information about the subject resource" . - . - . - "seeAlso"@en . - . - . - "Indicates membership of a class" . - . - . - "subClassOf"@en . - . - . - "Indicates specialization of properties" . - . - . - "subPropertyOf"@en . - . diff --git a/packages/semweb/Tests/Turtle/rdfs-namespace.ttl b/packages/semweb/Tests/Turtle/rdfs-namespace.ttl deleted file mode 100644 index 0d73e6bf7..000000000 --- a/packages/semweb/Tests/Turtle/rdfs-namespace.ttl +++ /dev/null @@ -1,160 +0,0 @@ -# RDFS Namespace document converted into Turtle - -@prefix : . -@prefix rdf: . - -rdf:type a rdf:Property; - :comment "Indicates membership of a class"; - :domain :Resource; - :isDefinedBy rdf:; - :label "type"@en; - :range :Class . - -rdf:Alt a :Class; - :comment "A collection of alternatives."@en; - :isDefinedBy rdf:; - :label "Alt"@en; - :subClassOf :Container . - -rdf:Bag a :Class; - :comment "An unordered collection."@en; - :isDefinedBy rdf:; - :label "Bag"@en; - :subClassOf :Container . - -rdf:Property a :Class; - :comment "The concept of a property."; - :isDefinedBy rdf:; - :label "Property"@en; - :subClassOf :Resource . - -rdf:Seq a :Class; - :comment "An ordered collection."@en; - :isDefinedBy rdf:; - :label "Seq"@en; - :subClassOf :Container . - -rdf:Statement a :Class; - :comment "The class of RDF statements."; - :isDefinedBy rdf:; - :label "Statement"@en; - :subClassOf :Resource . - -rdf:object a rdf:Property; - :comment "The object of an RDF statement."; - :domain rdf:Statement; - :isDefinedBy rdf:; - :label "object"@en . - -rdf:predicate a rdf:Property; - :comment "the predicate of an RDF statement."; - :domain rdf:Statement; - :isDefinedBy rdf:; - :label "predicate"@en; - :range rdf:Property . - -rdf:subject a rdf:Property; - :comment "The subject of an RDF statement."; - :domain rdf:Statement; - :isDefinedBy rdf:; - :label "subject"@en; - :range :Resource . - -rdf:value a rdf:Property; - :comment "Identifies the principal value (usually a string) of a property when the property value is a structured resource"; - :domain :Resource; - :isDefinedBy rdf:; - :label "value"@en . - -: :seeAlso . - -:Class a :Class; - :comment "The concept of Class"; - :isDefinedBy :; - :label "Class"@en; - :subClassOf :Resource . - -:Container a :Class; - :comment "This represents the set Containers."; - :isDefinedBy :; - :label "Container"@en; - :subClassOf :Resource . - -:ContainerMembershipProperty a :Class; - :comment "The container membership properties, rdf:1, rdf:2, ..., all of which are sub-properties of 'member'."; - :isDefinedBy :; - :label "ContainerMembershipProperty"@en; - :subClassOf rdf:Property . - -:Literal a :Class; - :comment "This represents the set of atomic values, eg. textual strings."; - :isDefinedBy :; - :label "Literal"@en . - -:Resource a :Class; - :comment "The class resource, everything."; - :isDefinedBy :; - :label "Resource"@en . - -:comment a rdf:Property; - :comment "Use this for descriptions"; - :domain :Resource; - :isDefinedBy :; - :label "comment"@en; - :range :Literal . - -:domain a rdf:Property; - :comment "A domain class for a property type"; - :domain rdf:Property; - :isDefinedBy :; - :label "domain"@en; - :range :Class . - -:isDefinedBy a rdf:Property; - :comment "Indicates the namespace of a resource"; - :domain :Resource; - :isDefinedBy :; - :label "isDefinedBy"@en; - :range :Resource; - :subPropertyOf :seeAlso . - -:label a rdf:Property; - :comment "Provides a human-readable version of a resource name."; - :domain :Resource; - :isDefinedBy :; - :label "label"@en; - :range :Literal . - -:member a rdf:Property; - :comment "a member of a container"; - :domain :Container; - :isDefinedBy :; - :label "member"@en . - -:range a rdf:Property; - :comment "A range class for a property type"; - :domain rdf:Property; - :isDefinedBy :; - :label "range"@en; - :range :Class . - -:seeAlso a rdf:Property; - :comment "A resource that provides information about the subject resource"; - :domain :Resource; - :isDefinedBy :; - :label "seeAlso"@en; - :range :Resource . - -:subClassOf a rdf:Property; - :comment "Indicates membership of a class"; - :domain :Class; - :isDefinedBy :; - :label "subClassOf"@en; - :range :Class . - -:subPropertyOf a rdf:Property; - :comment "Indicates specialization of properties"; - :domain rdf:Property; - :isDefinedBy :; - :label "subPropertyOf"@en; - :range rdf:Property . diff --git a/packages/semweb/Tests/Turtle/test-00.out b/packages/semweb/Tests/Turtle/test-00.out deleted file mode 100644 index 7f8b717e2..000000000 --- a/packages/semweb/Tests/Turtle/test-00.out +++ /dev/null @@ -1 +0,0 @@ -_:genid1 . diff --git a/packages/semweb/Tests/Turtle/test-00.ttl b/packages/semweb/Tests/Turtle/test-00.ttl deleted file mode 100644 index 78da35e60..000000000 --- a/packages/semweb/Tests/Turtle/test-00.ttl +++ /dev/null @@ -1,2 +0,0 @@ -@prefix : <#> . -[] :x :y . diff --git a/packages/semweb/Tests/Turtle/test-01.out b/packages/semweb/Tests/Turtle/test-01.out deleted file mode 100644 index 5ccb5bd20..000000000 --- a/packages/semweb/Tests/Turtle/test-01.out +++ /dev/null @@ -1,3 +0,0 @@ - . - . - . diff --git a/packages/semweb/Tests/Turtle/test-01.ttl b/packages/semweb/Tests/Turtle/test-01.ttl deleted file mode 100644 index 9070d2c41..000000000 --- a/packages/semweb/Tests/Turtle/test-01.ttl +++ /dev/null @@ -1,7 +0,0 @@ -# Test @prefix and qnames -@prefix : . -@prefix a: . -@prefix b: . -:a :b :c . -a:a a:b a:c . -:a a:a b:a . diff --git a/packages/semweb/Tests/Turtle/test-02.out b/packages/semweb/Tests/Turtle/test-02.out deleted file mode 100644 index 99732ab37..000000000 --- a/packages/semweb/Tests/Turtle/test-02.out +++ /dev/null @@ -1,3 +0,0 @@ - . - . - . diff --git a/packages/semweb/Tests/Turtle/test-02.ttl b/packages/semweb/Tests/Turtle/test-02.ttl deleted file mode 100644 index a623f3c17..000000000 --- a/packages/semweb/Tests/Turtle/test-02.ttl +++ /dev/null @@ -1,5 +0,0 @@ -# Test , operator -@prefix : . -:a :b :c, - :d, - :e . diff --git a/packages/semweb/Tests/Turtle/test-03.out b/packages/semweb/Tests/Turtle/test-03.out deleted file mode 100644 index d6ce9e8fe..000000000 --- a/packages/semweb/Tests/Turtle/test-03.out +++ /dev/null @@ -1,3 +0,0 @@ - . - . - . diff --git a/packages/semweb/Tests/Turtle/test-03.ttl b/packages/semweb/Tests/Turtle/test-03.ttl deleted file mode 100644 index 9179fa508..000000000 --- a/packages/semweb/Tests/Turtle/test-03.ttl +++ /dev/null @@ -1,5 +0,0 @@ -# Test ; operator -@prefix : . -:a :b :c ; - :d :e ; - :f :g . diff --git a/packages/semweb/Tests/Turtle/test-04.out b/packages/semweb/Tests/Turtle/test-04.out deleted file mode 100644 index 414e4b84b..000000000 --- a/packages/semweb/Tests/Turtle/test-04.out +++ /dev/null @@ -1,2 +0,0 @@ -_:genid1 . - _:genid2 . diff --git a/packages/semweb/Tests/Turtle/test-04.ttl b/packages/semweb/Tests/Turtle/test-04.ttl deleted file mode 100644 index c51814793..000000000 --- a/packages/semweb/Tests/Turtle/test-04.ttl +++ /dev/null @@ -1,4 +0,0 @@ -# Test empty [] operator; not allowed as predicate -@prefix : . -[] :a :b . -:c :d [] . diff --git a/packages/semweb/Tests/Turtle/test-05.out b/packages/semweb/Tests/Turtle/test-05.out deleted file mode 100644 index 6925d40d3..000000000 --- a/packages/semweb/Tests/Turtle/test-05.out +++ /dev/null @@ -1,4 +0,0 @@ -_:genid1 . -_:genid1 . -_:genid2 . - _:genid2 . diff --git a/packages/semweb/Tests/Turtle/test-05.ttl b/packages/semweb/Tests/Turtle/test-05.ttl deleted file mode 100644 index adcbcabd0..000000000 --- a/packages/semweb/Tests/Turtle/test-05.ttl +++ /dev/null @@ -1,4 +0,0 @@ -# Test non empty [] operator; not allowed as predicate -@prefix : . -[ :a :b ] :c :d . -:e :f [ :g :h ] . diff --git a/packages/semweb/Tests/Turtle/test-06.out b/packages/semweb/Tests/Turtle/test-06.out deleted file mode 100644 index 49961ea62..000000000 --- a/packages/semweb/Tests/Turtle/test-06.out +++ /dev/null @@ -1 +0,0 @@ - . diff --git a/packages/semweb/Tests/Turtle/test-06.ttl b/packages/semweb/Tests/Turtle/test-06.ttl deleted file mode 100644 index 9c1005cc9..000000000 --- a/packages/semweb/Tests/Turtle/test-06.ttl +++ /dev/null @@ -1,3 +0,0 @@ -# 'a' only allowed as a predicate -@prefix : . -:a a :b . diff --git a/packages/semweb/Tests/Turtle/test-07.out b/packages/semweb/Tests/Turtle/test-07.out deleted file mode 100644 index 7ab68063a..000000000 --- a/packages/semweb/Tests/Turtle/test-07.out +++ /dev/null @@ -1,5 +0,0 @@ -_:genid1 "banana" . -_:genid1 . -_:genid2 "apple" . -_:genid2 _:genid1 . - _:genid2 . diff --git a/packages/semweb/Tests/Turtle/test-07.ttl b/packages/semweb/Tests/Turtle/test-07.ttl deleted file mode 100644 index 84559403b..000000000 --- a/packages/semweb/Tests/Turtle/test-07.ttl +++ /dev/null @@ -1,3 +0,0 @@ -@prefix : . -:a :b ( "apple" "banana" ) . - diff --git a/packages/semweb/Tests/Turtle/test-08.out b/packages/semweb/Tests/Turtle/test-08.out deleted file mode 100644 index a77939cdd..000000000 --- a/packages/semweb/Tests/Turtle/test-08.out +++ /dev/null @@ -1 +0,0 @@ - . diff --git a/packages/semweb/Tests/Turtle/test-08.ttl b/packages/semweb/Tests/Turtle/test-08.ttl deleted file mode 100644 index adce0a20f..000000000 --- a/packages/semweb/Tests/Turtle/test-08.ttl +++ /dev/null @@ -1,3 +0,0 @@ -@prefix : . -:a :b ( ) . - diff --git a/packages/semweb/Tests/Turtle/test-09.out b/packages/semweb/Tests/Turtle/test-09.out deleted file mode 100644 index 5fdb90991..000000000 --- a/packages/semweb/Tests/Turtle/test-09.out +++ /dev/null @@ -1,4 +0,0 @@ -_:hasParent . -_:genid1 . -_:genid1 _:hasParent . -_:genid1 "2"^^ . diff --git a/packages/semweb/Tests/Turtle/test-09.ttl b/packages/semweb/Tests/Turtle/test-09.ttl deleted file mode 100644 index 0afe1b0ae..000000000 --- a/packages/semweb/Tests/Turtle/test-09.ttl +++ /dev/null @@ -1,10 +0,0 @@ -# Test integer datatyped literals using an OWL cardinality constraint -@prefix owl: . - -# based on examples in the OWL Reference - -_:hasParent a owl:ObjectProperty . - -[] a owl:Restriction ; - owl:onProperty _:hasParent ; - owl:maxCardinality 2 . diff --git a/packages/semweb/Tests/Turtle/test-10.out b/packages/semweb/Tests/Turtle/test-10.out deleted file mode 100644 index ff88aa6f4..000000000 --- a/packages/semweb/Tests/Turtle/test-10.out +++ /dev/null @@ -1,5 +0,0 @@ - "000000"^^ . - "0"^^ . - "000001"^^ . - "2"^^ . - "4"^^ . diff --git a/packages/semweb/Tests/Turtle/test-10.ttl b/packages/semweb/Tests/Turtle/test-10.ttl deleted file mode 100644 index 5d36360ea..000000000 --- a/packages/semweb/Tests/Turtle/test-10.ttl +++ /dev/null @@ -1,5 +0,0 @@ - 000000 . - 0 . - 000001 . - 2 . - 4 . diff --git a/packages/semweb/Tests/Turtle/test-11.out b/packages/semweb/Tests/Turtle/test-11.out deleted file mode 100644 index f936a5b66..000000000 --- a/packages/semweb/Tests/Turtle/test-11.out +++ /dev/null @@ -1,4 +0,0 @@ - "a" . - "b" . - "c" . - "d" . diff --git a/packages/semweb/Tests/Turtle/test-11.ttl b/packages/semweb/Tests/Turtle/test-11.ttl deleted file mode 100644 index 3de1a43fa..000000000 --- a/packages/semweb/Tests/Turtle/test-11.ttl +++ /dev/null @@ -1,10 +0,0 @@ -# Tests for - and _ in names, qnames -@prefix ex1: . -@prefix ex-2: . -@prefix ex3_: . -@prefix ex4-: . - -ex1:foo-bar ex1:foo_bar "a" . -ex-2:foo-bar ex-2:foo_bar "b" . -ex3_:foo-bar ex3_:foo_bar "c" . -ex4-:foo-bar ex4-:foo_bar "d" . diff --git a/packages/semweb/Tests/Turtle/test-12.out b/packages/semweb/Tests/Turtle/test-12.out deleted file mode 100644 index 67404a59a..000000000 --- a/packages/semweb/Tests/Turtle/test-12.out +++ /dev/null @@ -1,4 +0,0 @@ - "1" . - "2" . - "def" . - "678" . diff --git a/packages/semweb/Tests/Turtle/test-12.ttl b/packages/semweb/Tests/Turtle/test-12.ttl deleted file mode 100644 index 1fed9f5e0..000000000 --- a/packages/semweb/Tests/Turtle/test-12.ttl +++ /dev/null @@ -1,9 +0,0 @@ -# Tests for rdf:_ and other qnames starting with _ -@prefix rdf: . -@prefix ex: . -@prefix : . - -ex:foo rdf:_1 "1" . -ex:foo rdf:_2 "2" . -ex:foo :_abc "def" . -ex:foo :_345 "678" . diff --git a/packages/semweb/Tests/Turtle/test-13.out b/packages/semweb/Tests/Turtle/test-13.out deleted file mode 100644 index 9feb5ad00..000000000 --- a/packages/semweb/Tests/Turtle/test-13.out +++ /dev/null @@ -1,2 +0,0 @@ -_:genid1 _:genid2 . - . diff --git a/packages/semweb/Tests/Turtle/test-13.ttl b/packages/semweb/Tests/Turtle/test-13.ttl deleted file mode 100644 index a8be95beb..000000000 --- a/packages/semweb/Tests/Turtle/test-13.ttl +++ /dev/null @@ -1,7 +0,0 @@ -# Test for : allowed -@prefix : . - -[] : [] . - -: : : . - diff --git a/packages/semweb/Tests/Turtle/test-14.out b/packages/semweb/Tests/Turtle/test-14.out deleted file mode 100644 index 791b3a7ac..000000000 --- a/packages/semweb/Tests/Turtle/test-14.out +++ /dev/null @@ -1,10000 +0,0 @@ - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . diff --git a/packages/semweb/Tests/Turtle/test-14.ttl b/packages/semweb/Tests/Turtle/test-14.ttl deleted file mode 100644 index ad9dbde88..000000000 --- a/packages/semweb/Tests/Turtle/test-14.ttl +++ /dev/null @@ -1,10002 +0,0 @@ -# 10000 triples, more than the default Bison stack size -@prefix : . -:a1 :a1 :a1. -:a2 :a2 :a2. -:a3 :a3 :a3. -:a4 :a4 :a4. -:a5 :a5 :a5. -:a6 :a6 :a6. -:a7 :a7 :a7. -:a8 :a8 :a8. -:a9 :a9 :a9. -:a10 :a10 :a10. -:a11 :a11 :a11. -:a12 :a12 :a12. -:a13 :a13 :a13. -:a14 :a14 :a14. -:a15 :a15 :a15. -:a16 :a16 :a16. -:a17 :a17 :a17. -:a18 :a18 :a18. -:a19 :a19 :a19. -:a20 :a20 :a20. -:a21 :a21 :a21. -:a22 :a22 :a22. -:a23 :a23 :a23. -:a24 :a24 :a24. -:a25 :a25 :a25. -:a26 :a26 :a26. -:a27 :a27 :a27. -:a28 :a28 :a28. -:a29 :a29 :a29. -:a30 :a30 :a30. -:a31 :a31 :a31. -:a32 :a32 :a32. -:a33 :a33 :a33. -:a34 :a34 :a34. -:a35 :a35 :a35. -:a36 :a36 :a36. -:a37 :a37 :a37. -:a38 :a38 :a38. -:a39 :a39 :a39. -:a40 :a40 :a40. -:a41 :a41 :a41. -:a42 :a42 :a42. -:a43 :a43 :a43. -:a44 :a44 :a44. -:a45 :a45 :a45. -:a46 :a46 :a46. -:a47 :a47 :a47. -:a48 :a48 :a48. -:a49 :a49 :a49. -:a50 :a50 :a50. -:a51 :a51 :a51. -:a52 :a52 :a52. -:a53 :a53 :a53. -:a54 :a54 :a54. -:a55 :a55 :a55. -:a56 :a56 :a56. -:a57 :a57 :a57. -:a58 :a58 :a58. -:a59 :a59 :a59. -:a60 :a60 :a60. -:a61 :a61 :a61. -:a62 :a62 :a62. -:a63 :a63 :a63. -:a64 :a64 :a64. -:a65 :a65 :a65. -:a66 :a66 :a66. -:a67 :a67 :a67. -:a68 :a68 :a68. -:a69 :a69 :a69. -:a70 :a70 :a70. -:a71 :a71 :a71. -:a72 :a72 :a72. -:a73 :a73 :a73. -:a74 :a74 :a74. -:a75 :a75 :a75. -:a76 :a76 :a76. -:a77 :a77 :a77. -:a78 :a78 :a78. -:a79 :a79 :a79. -:a80 :a80 :a80. -:a81 :a81 :a81. -:a82 :a82 :a82. -:a83 :a83 :a83. -:a84 :a84 :a84. -:a85 :a85 :a85. -:a86 :a86 :a86. -:a87 :a87 :a87. -:a88 :a88 :a88. -:a89 :a89 :a89. -:a90 :a90 :a90. -:a91 :a91 :a91. -:a92 :a92 :a92. -:a93 :a93 :a93. -:a94 :a94 :a94. -:a95 :a95 :a95. -:a96 :a96 :a96. -:a97 :a97 :a97. -:a98 :a98 :a98. -:a99 :a99 :a99. -:a100 :a100 :a100. -:a101 :a101 :a101. -:a102 :a102 :a102. -:a103 :a103 :a103. -:a104 :a104 :a104. -:a105 :a105 :a105. -:a106 :a106 :a106. -:a107 :a107 :a107. -:a108 :a108 :a108. -:a109 :a109 :a109. -:a110 :a110 :a110. -:a111 :a111 :a111. -:a112 :a112 :a112. -:a113 :a113 :a113. -:a114 :a114 :a114. -:a115 :a115 :a115. -:a116 :a116 :a116. -:a117 :a117 :a117. -:a118 :a118 :a118. -:a119 :a119 :a119. -:a120 :a120 :a120. -:a121 :a121 :a121. -:a122 :a122 :a122. -:a123 :a123 :a123. -:a124 :a124 :a124. -:a125 :a125 :a125. -:a126 :a126 :a126. -:a127 :a127 :a127. -:a128 :a128 :a128. -:a129 :a129 :a129. -:a130 :a130 :a130. -:a131 :a131 :a131. -:a132 :a132 :a132. -:a133 :a133 :a133. -:a134 :a134 :a134. -:a135 :a135 :a135. -:a136 :a136 :a136. -:a137 :a137 :a137. -:a138 :a138 :a138. -:a139 :a139 :a139. -:a140 :a140 :a140. -:a141 :a141 :a141. -:a142 :a142 :a142. -:a143 :a143 :a143. -:a144 :a144 :a144. -:a145 :a145 :a145. -:a146 :a146 :a146. -:a147 :a147 :a147. -:a148 :a148 :a148. -:a149 :a149 :a149. -:a150 :a150 :a150. -:a151 :a151 :a151. -:a152 :a152 :a152. -:a153 :a153 :a153. -:a154 :a154 :a154. -:a155 :a155 :a155. -:a156 :a156 :a156. -:a157 :a157 :a157. -:a158 :a158 :a158. -:a159 :a159 :a159. -:a160 :a160 :a160. -:a161 :a161 :a161. -:a162 :a162 :a162. -:a163 :a163 :a163. -:a164 :a164 :a164. -:a165 :a165 :a165. -:a166 :a166 :a166. -:a167 :a167 :a167. -:a168 :a168 :a168. -:a169 :a169 :a169. -:a170 :a170 :a170. -:a171 :a171 :a171. -:a172 :a172 :a172. -:a173 :a173 :a173. -:a174 :a174 :a174. -:a175 :a175 :a175. -:a176 :a176 :a176. -:a177 :a177 :a177. -:a178 :a178 :a178. -:a179 :a179 :a179. -:a180 :a180 :a180. -:a181 :a181 :a181. -:a182 :a182 :a182. -:a183 :a183 :a183. -:a184 :a184 :a184. -:a185 :a185 :a185. -:a186 :a186 :a186. -:a187 :a187 :a187. -:a188 :a188 :a188. -:a189 :a189 :a189. -:a190 :a190 :a190. -:a191 :a191 :a191. -:a192 :a192 :a192. -:a193 :a193 :a193. -:a194 :a194 :a194. -:a195 :a195 :a195. -:a196 :a196 :a196. -:a197 :a197 :a197. -:a198 :a198 :a198. -:a199 :a199 :a199. -:a200 :a200 :a200. -:a201 :a201 :a201. -:a202 :a202 :a202. -:a203 :a203 :a203. -:a204 :a204 :a204. -:a205 :a205 :a205. -:a206 :a206 :a206. -:a207 :a207 :a207. -:a208 :a208 :a208. -:a209 :a209 :a209. -:a210 :a210 :a210. -:a211 :a211 :a211. -:a212 :a212 :a212. -:a213 :a213 :a213. -:a214 :a214 :a214. -:a215 :a215 :a215. -:a216 :a216 :a216. -:a217 :a217 :a217. -:a218 :a218 :a218. -:a219 :a219 :a219. -:a220 :a220 :a220. -:a221 :a221 :a221. -:a222 :a222 :a222. -:a223 :a223 :a223. -:a224 :a224 :a224. -:a225 :a225 :a225. -:a226 :a226 :a226. -:a227 :a227 :a227. -:a228 :a228 :a228. -:a229 :a229 :a229. -:a230 :a230 :a230. -:a231 :a231 :a231. -:a232 :a232 :a232. -:a233 :a233 :a233. -:a234 :a234 :a234. -:a235 :a235 :a235. -:a236 :a236 :a236. -:a237 :a237 :a237. -:a238 :a238 :a238. -:a239 :a239 :a239. -:a240 :a240 :a240. -:a241 :a241 :a241. -:a242 :a242 :a242. -:a243 :a243 :a243. -:a244 :a244 :a244. -:a245 :a245 :a245. -:a246 :a246 :a246. -:a247 :a247 :a247. -:a248 :a248 :a248. -:a249 :a249 :a249. -:a250 :a250 :a250. -:a251 :a251 :a251. -:a252 :a252 :a252. -:a253 :a253 :a253. -:a254 :a254 :a254. -:a255 :a255 :a255. -:a256 :a256 :a256. -:a257 :a257 :a257. -:a258 :a258 :a258. -:a259 :a259 :a259. -:a260 :a260 :a260. -:a261 :a261 :a261. -:a262 :a262 :a262. -:a263 :a263 :a263. -:a264 :a264 :a264. -:a265 :a265 :a265. -:a266 :a266 :a266. -:a267 :a267 :a267. -:a268 :a268 :a268. -:a269 :a269 :a269. -:a270 :a270 :a270. -:a271 :a271 :a271. -:a272 :a272 :a272. -:a273 :a273 :a273. -:a274 :a274 :a274. -:a275 :a275 :a275. -:a276 :a276 :a276. -:a277 :a277 :a277. -:a278 :a278 :a278. -:a279 :a279 :a279. -:a280 :a280 :a280. -:a281 :a281 :a281. -:a282 :a282 :a282. -:a283 :a283 :a283. -:a284 :a284 :a284. -:a285 :a285 :a285. -:a286 :a286 :a286. -:a287 :a287 :a287. -:a288 :a288 :a288. -:a289 :a289 :a289. -:a290 :a290 :a290. -:a291 :a291 :a291. -:a292 :a292 :a292. -:a293 :a293 :a293. -:a294 :a294 :a294. -:a295 :a295 :a295. -:a296 :a296 :a296. -:a297 :a297 :a297. -:a298 :a298 :a298. -:a299 :a299 :a299. -:a300 :a300 :a300. -:a301 :a301 :a301. -:a302 :a302 :a302. -:a303 :a303 :a303. -:a304 :a304 :a304. -:a305 :a305 :a305. -:a306 :a306 :a306. -:a307 :a307 :a307. -:a308 :a308 :a308. -:a309 :a309 :a309. -:a310 :a310 :a310. -:a311 :a311 :a311. -:a312 :a312 :a312. -:a313 :a313 :a313. -:a314 :a314 :a314. -:a315 :a315 :a315. -:a316 :a316 :a316. -:a317 :a317 :a317. -:a318 :a318 :a318. -:a319 :a319 :a319. -:a320 :a320 :a320. -:a321 :a321 :a321. -:a322 :a322 :a322. -:a323 :a323 :a323. -:a324 :a324 :a324. -:a325 :a325 :a325. -:a326 :a326 :a326. -:a327 :a327 :a327. -:a328 :a328 :a328. -:a329 :a329 :a329. -:a330 :a330 :a330. -:a331 :a331 :a331. -:a332 :a332 :a332. -:a333 :a333 :a333. -:a334 :a334 :a334. -:a335 :a335 :a335. -:a336 :a336 :a336. -:a337 :a337 :a337. -:a338 :a338 :a338. -:a339 :a339 :a339. -:a340 :a340 :a340. -:a341 :a341 :a341. -:a342 :a342 :a342. -:a343 :a343 :a343. -:a344 :a344 :a344. -:a345 :a345 :a345. -:a346 :a346 :a346. -:a347 :a347 :a347. -:a348 :a348 :a348. -:a349 :a349 :a349. -:a350 :a350 :a350. -:a351 :a351 :a351. -:a352 :a352 :a352. -:a353 :a353 :a353. -:a354 :a354 :a354. -:a355 :a355 :a355. -:a356 :a356 :a356. -:a357 :a357 :a357. -:a358 :a358 :a358. -:a359 :a359 :a359. -:a360 :a360 :a360. -:a361 :a361 :a361. -:a362 :a362 :a362. -:a363 :a363 :a363. -:a364 :a364 :a364. -:a365 :a365 :a365. -:a366 :a366 :a366. -:a367 :a367 :a367. -:a368 :a368 :a368. -:a369 :a369 :a369. -:a370 :a370 :a370. -:a371 :a371 :a371. -:a372 :a372 :a372. -:a373 :a373 :a373. -:a374 :a374 :a374. -:a375 :a375 :a375. -:a376 :a376 :a376. -:a377 :a377 :a377. -:a378 :a378 :a378. -:a379 :a379 :a379. -:a380 :a380 :a380. -:a381 :a381 :a381. -:a382 :a382 :a382. -:a383 :a383 :a383. -:a384 :a384 :a384. -:a385 :a385 :a385. -:a386 :a386 :a386. -:a387 :a387 :a387. -:a388 :a388 :a388. -:a389 :a389 :a389. -:a390 :a390 :a390. -:a391 :a391 :a391. -:a392 :a392 :a392. -:a393 :a393 :a393. -:a394 :a394 :a394. -:a395 :a395 :a395. -:a396 :a396 :a396. -:a397 :a397 :a397. -:a398 :a398 :a398. -:a399 :a399 :a399. -:a400 :a400 :a400. -:a401 :a401 :a401. -:a402 :a402 :a402. -:a403 :a403 :a403. -:a404 :a404 :a404. -:a405 :a405 :a405. -:a406 :a406 :a406. -:a407 :a407 :a407. -:a408 :a408 :a408. -:a409 :a409 :a409. -:a410 :a410 :a410. -:a411 :a411 :a411. -:a412 :a412 :a412. -:a413 :a413 :a413. -:a414 :a414 :a414. -:a415 :a415 :a415. -:a416 :a416 :a416. -:a417 :a417 :a417. -:a418 :a418 :a418. -:a419 :a419 :a419. -:a420 :a420 :a420. -:a421 :a421 :a421. -:a422 :a422 :a422. -:a423 :a423 :a423. -:a424 :a424 :a424. -:a425 :a425 :a425. -:a426 :a426 :a426. -:a427 :a427 :a427. -:a428 :a428 :a428. -:a429 :a429 :a429. -:a430 :a430 :a430. -:a431 :a431 :a431. -:a432 :a432 :a432. -:a433 :a433 :a433. -:a434 :a434 :a434. -:a435 :a435 :a435. -:a436 :a436 :a436. -:a437 :a437 :a437. -:a438 :a438 :a438. -:a439 :a439 :a439. -:a440 :a440 :a440. -:a441 :a441 :a441. -:a442 :a442 :a442. -:a443 :a443 :a443. -:a444 :a444 :a444. -:a445 :a445 :a445. -:a446 :a446 :a446. -:a447 :a447 :a447. -:a448 :a448 :a448. -:a449 :a449 :a449. -:a450 :a450 :a450. -:a451 :a451 :a451. -:a452 :a452 :a452. -:a453 :a453 :a453. -:a454 :a454 :a454. -:a455 :a455 :a455. -:a456 :a456 :a456. -:a457 :a457 :a457. -:a458 :a458 :a458. -:a459 :a459 :a459. -:a460 :a460 :a460. -:a461 :a461 :a461. -:a462 :a462 :a462. -:a463 :a463 :a463. -:a464 :a464 :a464. -:a465 :a465 :a465. -:a466 :a466 :a466. -:a467 :a467 :a467. -:a468 :a468 :a468. -:a469 :a469 :a469. -:a470 :a470 :a470. -:a471 :a471 :a471. -:a472 :a472 :a472. -:a473 :a473 :a473. -:a474 :a474 :a474. -:a475 :a475 :a475. -:a476 :a476 :a476. -:a477 :a477 :a477. -:a478 :a478 :a478. -:a479 :a479 :a479. -:a480 :a480 :a480. -:a481 :a481 :a481. -:a482 :a482 :a482. -:a483 :a483 :a483. -:a484 :a484 :a484. -:a485 :a485 :a485. -:a486 :a486 :a486. -:a487 :a487 :a487. -:a488 :a488 :a488. -:a489 :a489 :a489. -:a490 :a490 :a490. -:a491 :a491 :a491. -:a492 :a492 :a492. -:a493 :a493 :a493. -:a494 :a494 :a494. -:a495 :a495 :a495. -:a496 :a496 :a496. -:a497 :a497 :a497. -:a498 :a498 :a498. -:a499 :a499 :a499. -:a500 :a500 :a500. -:a501 :a501 :a501. -:a502 :a502 :a502. -:a503 :a503 :a503. -:a504 :a504 :a504. -:a505 :a505 :a505. -:a506 :a506 :a506. -:a507 :a507 :a507. -:a508 :a508 :a508. -:a509 :a509 :a509. -:a510 :a510 :a510. -:a511 :a511 :a511. -:a512 :a512 :a512. -:a513 :a513 :a513. -:a514 :a514 :a514. -:a515 :a515 :a515. -:a516 :a516 :a516. -:a517 :a517 :a517. -:a518 :a518 :a518. -:a519 :a519 :a519. -:a520 :a520 :a520. -:a521 :a521 :a521. -:a522 :a522 :a522. -:a523 :a523 :a523. -:a524 :a524 :a524. -:a525 :a525 :a525. -:a526 :a526 :a526. -:a527 :a527 :a527. -:a528 :a528 :a528. -:a529 :a529 :a529. -:a530 :a530 :a530. -:a531 :a531 :a531. -:a532 :a532 :a532. -:a533 :a533 :a533. -:a534 :a534 :a534. -:a535 :a535 :a535. -:a536 :a536 :a536. -:a537 :a537 :a537. -:a538 :a538 :a538. -:a539 :a539 :a539. -:a540 :a540 :a540. -:a541 :a541 :a541. -:a542 :a542 :a542. -:a543 :a543 :a543. -:a544 :a544 :a544. -:a545 :a545 :a545. -:a546 :a546 :a546. -:a547 :a547 :a547. -:a548 :a548 :a548. -:a549 :a549 :a549. -:a550 :a550 :a550. -:a551 :a551 :a551. -:a552 :a552 :a552. -:a553 :a553 :a553. -:a554 :a554 :a554. -:a555 :a555 :a555. -:a556 :a556 :a556. -:a557 :a557 :a557. -:a558 :a558 :a558. -:a559 :a559 :a559. -:a560 :a560 :a560. -:a561 :a561 :a561. -:a562 :a562 :a562. -:a563 :a563 :a563. -:a564 :a564 :a564. -:a565 :a565 :a565. -:a566 :a566 :a566. -:a567 :a567 :a567. -:a568 :a568 :a568. -:a569 :a569 :a569. -:a570 :a570 :a570. -:a571 :a571 :a571. -:a572 :a572 :a572. -:a573 :a573 :a573. -:a574 :a574 :a574. -:a575 :a575 :a575. -:a576 :a576 :a576. -:a577 :a577 :a577. -:a578 :a578 :a578. -:a579 :a579 :a579. -:a580 :a580 :a580. -:a581 :a581 :a581. -:a582 :a582 :a582. -:a583 :a583 :a583. -:a584 :a584 :a584. -:a585 :a585 :a585. -:a586 :a586 :a586. -:a587 :a587 :a587. -:a588 :a588 :a588. -:a589 :a589 :a589. -:a590 :a590 :a590. -:a591 :a591 :a591. -:a592 :a592 :a592. -:a593 :a593 :a593. -:a594 :a594 :a594. -:a595 :a595 :a595. -:a596 :a596 :a596. -:a597 :a597 :a597. -:a598 :a598 :a598. -:a599 :a599 :a599. -:a600 :a600 :a600. -:a601 :a601 :a601. -:a602 :a602 :a602. -:a603 :a603 :a603. -:a604 :a604 :a604. -:a605 :a605 :a605. -:a606 :a606 :a606. -:a607 :a607 :a607. -:a608 :a608 :a608. -:a609 :a609 :a609. -:a610 :a610 :a610. -:a611 :a611 :a611. -:a612 :a612 :a612. -:a613 :a613 :a613. -:a614 :a614 :a614. -:a615 :a615 :a615. -:a616 :a616 :a616. -:a617 :a617 :a617. -:a618 :a618 :a618. -:a619 :a619 :a619. -:a620 :a620 :a620. -:a621 :a621 :a621. -:a622 :a622 :a622. -:a623 :a623 :a623. -:a624 :a624 :a624. -:a625 :a625 :a625. -:a626 :a626 :a626. -:a627 :a627 :a627. -:a628 :a628 :a628. -:a629 :a629 :a629. -:a630 :a630 :a630. -:a631 :a631 :a631. -:a632 :a632 :a632. -:a633 :a633 :a633. -:a634 :a634 :a634. -:a635 :a635 :a635. -:a636 :a636 :a636. -:a637 :a637 :a637. -:a638 :a638 :a638. -:a639 :a639 :a639. -:a640 :a640 :a640. -:a641 :a641 :a641. -:a642 :a642 :a642. -:a643 :a643 :a643. -:a644 :a644 :a644. -:a645 :a645 :a645. -:a646 :a646 :a646. -:a647 :a647 :a647. -:a648 :a648 :a648. -:a649 :a649 :a649. -:a650 :a650 :a650. -:a651 :a651 :a651. -:a652 :a652 :a652. -:a653 :a653 :a653. -:a654 :a654 :a654. -:a655 :a655 :a655. -:a656 :a656 :a656. -:a657 :a657 :a657. -:a658 :a658 :a658. -:a659 :a659 :a659. -:a660 :a660 :a660. -:a661 :a661 :a661. -:a662 :a662 :a662. -:a663 :a663 :a663. -:a664 :a664 :a664. -:a665 :a665 :a665. -:a666 :a666 :a666. -:a667 :a667 :a667. -:a668 :a668 :a668. -:a669 :a669 :a669. -:a670 :a670 :a670. -:a671 :a671 :a671. -:a672 :a672 :a672. -:a673 :a673 :a673. -:a674 :a674 :a674. -:a675 :a675 :a675. -:a676 :a676 :a676. -:a677 :a677 :a677. -:a678 :a678 :a678. -:a679 :a679 :a679. -:a680 :a680 :a680. -:a681 :a681 :a681. -:a682 :a682 :a682. -:a683 :a683 :a683. -:a684 :a684 :a684. -:a685 :a685 :a685. -:a686 :a686 :a686. -:a687 :a687 :a687. -:a688 :a688 :a688. -:a689 :a689 :a689. -:a690 :a690 :a690. -:a691 :a691 :a691. -:a692 :a692 :a692. -:a693 :a693 :a693. -:a694 :a694 :a694. -:a695 :a695 :a695. -:a696 :a696 :a696. -:a697 :a697 :a697. -:a698 :a698 :a698. -:a699 :a699 :a699. -:a700 :a700 :a700. -:a701 :a701 :a701. -:a702 :a702 :a702. -:a703 :a703 :a703. -:a704 :a704 :a704. -:a705 :a705 :a705. -:a706 :a706 :a706. -:a707 :a707 :a707. -:a708 :a708 :a708. -:a709 :a709 :a709. -:a710 :a710 :a710. -:a711 :a711 :a711. -:a712 :a712 :a712. -:a713 :a713 :a713. -:a714 :a714 :a714. -:a715 :a715 :a715. -:a716 :a716 :a716. -:a717 :a717 :a717. -:a718 :a718 :a718. -:a719 :a719 :a719. -:a720 :a720 :a720. -:a721 :a721 :a721. -:a722 :a722 :a722. -:a723 :a723 :a723. -:a724 :a724 :a724. -:a725 :a725 :a725. -:a726 :a726 :a726. -:a727 :a727 :a727. -:a728 :a728 :a728. -:a729 :a729 :a729. -:a730 :a730 :a730. -:a731 :a731 :a731. -:a732 :a732 :a732. -:a733 :a733 :a733. -:a734 :a734 :a734. -:a735 :a735 :a735. -:a736 :a736 :a736. -:a737 :a737 :a737. -:a738 :a738 :a738. -:a739 :a739 :a739. -:a740 :a740 :a740. -:a741 :a741 :a741. -:a742 :a742 :a742. -:a743 :a743 :a743. -:a744 :a744 :a744. -:a745 :a745 :a745. -:a746 :a746 :a746. -:a747 :a747 :a747. -:a748 :a748 :a748. -:a749 :a749 :a749. -:a750 :a750 :a750. -:a751 :a751 :a751. -:a752 :a752 :a752. -:a753 :a753 :a753. -:a754 :a754 :a754. -:a755 :a755 :a755. -:a756 :a756 :a756. -:a757 :a757 :a757. -:a758 :a758 :a758. -:a759 :a759 :a759. -:a760 :a760 :a760. -:a761 :a761 :a761. -:a762 :a762 :a762. -:a763 :a763 :a763. -:a764 :a764 :a764. -:a765 :a765 :a765. -:a766 :a766 :a766. -:a767 :a767 :a767. -:a768 :a768 :a768. -:a769 :a769 :a769. -:a770 :a770 :a770. -:a771 :a771 :a771. -:a772 :a772 :a772. -:a773 :a773 :a773. -:a774 :a774 :a774. -:a775 :a775 :a775. -:a776 :a776 :a776. -:a777 :a777 :a777. -:a778 :a778 :a778. -:a779 :a779 :a779. -:a780 :a780 :a780. -:a781 :a781 :a781. -:a782 :a782 :a782. -:a783 :a783 :a783. -:a784 :a784 :a784. -:a785 :a785 :a785. -:a786 :a786 :a786. -:a787 :a787 :a787. -:a788 :a788 :a788. -:a789 :a789 :a789. -:a790 :a790 :a790. -:a791 :a791 :a791. -:a792 :a792 :a792. -:a793 :a793 :a793. -:a794 :a794 :a794. -:a795 :a795 :a795. -:a796 :a796 :a796. -:a797 :a797 :a797. -:a798 :a798 :a798. -:a799 :a799 :a799. -:a800 :a800 :a800. -:a801 :a801 :a801. -:a802 :a802 :a802. -:a803 :a803 :a803. -:a804 :a804 :a804. -:a805 :a805 :a805. -:a806 :a806 :a806. -:a807 :a807 :a807. -:a808 :a808 :a808. -:a809 :a809 :a809. -:a810 :a810 :a810. -:a811 :a811 :a811. -:a812 :a812 :a812. -:a813 :a813 :a813. -:a814 :a814 :a814. -:a815 :a815 :a815. -:a816 :a816 :a816. -:a817 :a817 :a817. -:a818 :a818 :a818. -:a819 :a819 :a819. -:a820 :a820 :a820. -:a821 :a821 :a821. -:a822 :a822 :a822. -:a823 :a823 :a823. -:a824 :a824 :a824. -:a825 :a825 :a825. -:a826 :a826 :a826. -:a827 :a827 :a827. -:a828 :a828 :a828. -:a829 :a829 :a829. -:a830 :a830 :a830. -:a831 :a831 :a831. -:a832 :a832 :a832. -:a833 :a833 :a833. -:a834 :a834 :a834. -:a835 :a835 :a835. -:a836 :a836 :a836. -:a837 :a837 :a837. -:a838 :a838 :a838. -:a839 :a839 :a839. -:a840 :a840 :a840. -:a841 :a841 :a841. -:a842 :a842 :a842. -:a843 :a843 :a843. -:a844 :a844 :a844. -:a845 :a845 :a845. -:a846 :a846 :a846. -:a847 :a847 :a847. -:a848 :a848 :a848. -:a849 :a849 :a849. -:a850 :a850 :a850. -:a851 :a851 :a851. -:a852 :a852 :a852. -:a853 :a853 :a853. -:a854 :a854 :a854. -:a855 :a855 :a855. -:a856 :a856 :a856. -:a857 :a857 :a857. -:a858 :a858 :a858. -:a859 :a859 :a859. -:a860 :a860 :a860. -:a861 :a861 :a861. -:a862 :a862 :a862. -:a863 :a863 :a863. -:a864 :a864 :a864. -:a865 :a865 :a865. -:a866 :a866 :a866. -:a867 :a867 :a867. -:a868 :a868 :a868. -:a869 :a869 :a869. -:a870 :a870 :a870. -:a871 :a871 :a871. -:a872 :a872 :a872. -:a873 :a873 :a873. -:a874 :a874 :a874. -:a875 :a875 :a875. -:a876 :a876 :a876. -:a877 :a877 :a877. -:a878 :a878 :a878. -:a879 :a879 :a879. -:a880 :a880 :a880. -:a881 :a881 :a881. -:a882 :a882 :a882. -:a883 :a883 :a883. -:a884 :a884 :a884. -:a885 :a885 :a885. -:a886 :a886 :a886. -:a887 :a887 :a887. -:a888 :a888 :a888. -:a889 :a889 :a889. -:a890 :a890 :a890. -:a891 :a891 :a891. -:a892 :a892 :a892. -:a893 :a893 :a893. -:a894 :a894 :a894. -:a895 :a895 :a895. -:a896 :a896 :a896. -:a897 :a897 :a897. -:a898 :a898 :a898. -:a899 :a899 :a899. -:a900 :a900 :a900. -:a901 :a901 :a901. -:a902 :a902 :a902. -:a903 :a903 :a903. -:a904 :a904 :a904. -:a905 :a905 :a905. -:a906 :a906 :a906. -:a907 :a907 :a907. -:a908 :a908 :a908. -:a909 :a909 :a909. -:a910 :a910 :a910. -:a911 :a911 :a911. -:a912 :a912 :a912. -:a913 :a913 :a913. -:a914 :a914 :a914. -:a915 :a915 :a915. -:a916 :a916 :a916. -:a917 :a917 :a917. -:a918 :a918 :a918. -:a919 :a919 :a919. -:a920 :a920 :a920. -:a921 :a921 :a921. -:a922 :a922 :a922. -:a923 :a923 :a923. -:a924 :a924 :a924. -:a925 :a925 :a925. -:a926 :a926 :a926. -:a927 :a927 :a927. -:a928 :a928 :a928. -:a929 :a929 :a929. -:a930 :a930 :a930. -:a931 :a931 :a931. -:a932 :a932 :a932. -:a933 :a933 :a933. -:a934 :a934 :a934. -:a935 :a935 :a935. -:a936 :a936 :a936. -:a937 :a937 :a937. -:a938 :a938 :a938. -:a939 :a939 :a939. -:a940 :a940 :a940. -:a941 :a941 :a941. -:a942 :a942 :a942. -:a943 :a943 :a943. -:a944 :a944 :a944. -:a945 :a945 :a945. -:a946 :a946 :a946. -:a947 :a947 :a947. -:a948 :a948 :a948. -:a949 :a949 :a949. -:a950 :a950 :a950. -:a951 :a951 :a951. -:a952 :a952 :a952. -:a953 :a953 :a953. -:a954 :a954 :a954. -:a955 :a955 :a955. -:a956 :a956 :a956. -:a957 :a957 :a957. -:a958 :a958 :a958. -:a959 :a959 :a959. -:a960 :a960 :a960. -:a961 :a961 :a961. -:a962 :a962 :a962. -:a963 :a963 :a963. -:a964 :a964 :a964. -:a965 :a965 :a965. -:a966 :a966 :a966. -:a967 :a967 :a967. -:a968 :a968 :a968. -:a969 :a969 :a969. -:a970 :a970 :a970. -:a971 :a971 :a971. -:a972 :a972 :a972. -:a973 :a973 :a973. -:a974 :a974 :a974. -:a975 :a975 :a975. -:a976 :a976 :a976. -:a977 :a977 :a977. -:a978 :a978 :a978. -:a979 :a979 :a979. -:a980 :a980 :a980. -:a981 :a981 :a981. -:a982 :a982 :a982. -:a983 :a983 :a983. -:a984 :a984 :a984. -:a985 :a985 :a985. -:a986 :a986 :a986. -:a987 :a987 :a987. -:a988 :a988 :a988. -:a989 :a989 :a989. -:a990 :a990 :a990. -:a991 :a991 :a991. -:a992 :a992 :a992. -:a993 :a993 :a993. -:a994 :a994 :a994. -:a995 :a995 :a995. -:a996 :a996 :a996. -:a997 :a997 :a997. -:a998 :a998 :a998. -:a999 :a999 :a999. -:a1000 :a1000 :a1000. -:a1001 :a1001 :a1001. -:a1002 :a1002 :a1002. -:a1003 :a1003 :a1003. -:a1004 :a1004 :a1004. -:a1005 :a1005 :a1005. -:a1006 :a1006 :a1006. -:a1007 :a1007 :a1007. -:a1008 :a1008 :a1008. -:a1009 :a1009 :a1009. -:a1010 :a1010 :a1010. -:a1011 :a1011 :a1011. -:a1012 :a1012 :a1012. -:a1013 :a1013 :a1013. -:a1014 :a1014 :a1014. -:a1015 :a1015 :a1015. -:a1016 :a1016 :a1016. -:a1017 :a1017 :a1017. -:a1018 :a1018 :a1018. -:a1019 :a1019 :a1019. -:a1020 :a1020 :a1020. -:a1021 :a1021 :a1021. -:a1022 :a1022 :a1022. -:a1023 :a1023 :a1023. -:a1024 :a1024 :a1024. -:a1025 :a1025 :a1025. -:a1026 :a1026 :a1026. -:a1027 :a1027 :a1027. -:a1028 :a1028 :a1028. -:a1029 :a1029 :a1029. -:a1030 :a1030 :a1030. -:a1031 :a1031 :a1031. -:a1032 :a1032 :a1032. -:a1033 :a1033 :a1033. -:a1034 :a1034 :a1034. -:a1035 :a1035 :a1035. -:a1036 :a1036 :a1036. -:a1037 :a1037 :a1037. -:a1038 :a1038 :a1038. -:a1039 :a1039 :a1039. -:a1040 :a1040 :a1040. -:a1041 :a1041 :a1041. -:a1042 :a1042 :a1042. -:a1043 :a1043 :a1043. -:a1044 :a1044 :a1044. -:a1045 :a1045 :a1045. -:a1046 :a1046 :a1046. -:a1047 :a1047 :a1047. -:a1048 :a1048 :a1048. -:a1049 :a1049 :a1049. -:a1050 :a1050 :a1050. -:a1051 :a1051 :a1051. -:a1052 :a1052 :a1052. -:a1053 :a1053 :a1053. -:a1054 :a1054 :a1054. -:a1055 :a1055 :a1055. -:a1056 :a1056 :a1056. -:a1057 :a1057 :a1057. -:a1058 :a1058 :a1058. -:a1059 :a1059 :a1059. -:a1060 :a1060 :a1060. -:a1061 :a1061 :a1061. -:a1062 :a1062 :a1062. -:a1063 :a1063 :a1063. -:a1064 :a1064 :a1064. -:a1065 :a1065 :a1065. -:a1066 :a1066 :a1066. -:a1067 :a1067 :a1067. -:a1068 :a1068 :a1068. -:a1069 :a1069 :a1069. -:a1070 :a1070 :a1070. -:a1071 :a1071 :a1071. -:a1072 :a1072 :a1072. -:a1073 :a1073 :a1073. -:a1074 :a1074 :a1074. -:a1075 :a1075 :a1075. -:a1076 :a1076 :a1076. -:a1077 :a1077 :a1077. -:a1078 :a1078 :a1078. -:a1079 :a1079 :a1079. -:a1080 :a1080 :a1080. -:a1081 :a1081 :a1081. -:a1082 :a1082 :a1082. -:a1083 :a1083 :a1083. -:a1084 :a1084 :a1084. -:a1085 :a1085 :a1085. -:a1086 :a1086 :a1086. -:a1087 :a1087 :a1087. -:a1088 :a1088 :a1088. -:a1089 :a1089 :a1089. -:a1090 :a1090 :a1090. -:a1091 :a1091 :a1091. -:a1092 :a1092 :a1092. -:a1093 :a1093 :a1093. -:a1094 :a1094 :a1094. -:a1095 :a1095 :a1095. -:a1096 :a1096 :a1096. -:a1097 :a1097 :a1097. -:a1098 :a1098 :a1098. -:a1099 :a1099 :a1099. -:a1100 :a1100 :a1100. -:a1101 :a1101 :a1101. -:a1102 :a1102 :a1102. -:a1103 :a1103 :a1103. -:a1104 :a1104 :a1104. -:a1105 :a1105 :a1105. -:a1106 :a1106 :a1106. -:a1107 :a1107 :a1107. -:a1108 :a1108 :a1108. -:a1109 :a1109 :a1109. -:a1110 :a1110 :a1110. -:a1111 :a1111 :a1111. -:a1112 :a1112 :a1112. -:a1113 :a1113 :a1113. -:a1114 :a1114 :a1114. -:a1115 :a1115 :a1115. -:a1116 :a1116 :a1116. -:a1117 :a1117 :a1117. -:a1118 :a1118 :a1118. -:a1119 :a1119 :a1119. -:a1120 :a1120 :a1120. -:a1121 :a1121 :a1121. -:a1122 :a1122 :a1122. -:a1123 :a1123 :a1123. -:a1124 :a1124 :a1124. -:a1125 :a1125 :a1125. -:a1126 :a1126 :a1126. -:a1127 :a1127 :a1127. -:a1128 :a1128 :a1128. -:a1129 :a1129 :a1129. -:a1130 :a1130 :a1130. -:a1131 :a1131 :a1131. -:a1132 :a1132 :a1132. -:a1133 :a1133 :a1133. -:a1134 :a1134 :a1134. -:a1135 :a1135 :a1135. -:a1136 :a1136 :a1136. -:a1137 :a1137 :a1137. -:a1138 :a1138 :a1138. -:a1139 :a1139 :a1139. -:a1140 :a1140 :a1140. -:a1141 :a1141 :a1141. -:a1142 :a1142 :a1142. -:a1143 :a1143 :a1143. -:a1144 :a1144 :a1144. -:a1145 :a1145 :a1145. -:a1146 :a1146 :a1146. -:a1147 :a1147 :a1147. -:a1148 :a1148 :a1148. -:a1149 :a1149 :a1149. -:a1150 :a1150 :a1150. -:a1151 :a1151 :a1151. -:a1152 :a1152 :a1152. -:a1153 :a1153 :a1153. -:a1154 :a1154 :a1154. -:a1155 :a1155 :a1155. -:a1156 :a1156 :a1156. -:a1157 :a1157 :a1157. -:a1158 :a1158 :a1158. -:a1159 :a1159 :a1159. -:a1160 :a1160 :a1160. -:a1161 :a1161 :a1161. -:a1162 :a1162 :a1162. -:a1163 :a1163 :a1163. -:a1164 :a1164 :a1164. -:a1165 :a1165 :a1165. -:a1166 :a1166 :a1166. -:a1167 :a1167 :a1167. -:a1168 :a1168 :a1168. -:a1169 :a1169 :a1169. -:a1170 :a1170 :a1170. -:a1171 :a1171 :a1171. -:a1172 :a1172 :a1172. -:a1173 :a1173 :a1173. -:a1174 :a1174 :a1174. -:a1175 :a1175 :a1175. -:a1176 :a1176 :a1176. -:a1177 :a1177 :a1177. -:a1178 :a1178 :a1178. -:a1179 :a1179 :a1179. -:a1180 :a1180 :a1180. -:a1181 :a1181 :a1181. -:a1182 :a1182 :a1182. -:a1183 :a1183 :a1183. -:a1184 :a1184 :a1184. -:a1185 :a1185 :a1185. -:a1186 :a1186 :a1186. -:a1187 :a1187 :a1187. -:a1188 :a1188 :a1188. -:a1189 :a1189 :a1189. -:a1190 :a1190 :a1190. -:a1191 :a1191 :a1191. -:a1192 :a1192 :a1192. -:a1193 :a1193 :a1193. -:a1194 :a1194 :a1194. -:a1195 :a1195 :a1195. -:a1196 :a1196 :a1196. -:a1197 :a1197 :a1197. -:a1198 :a1198 :a1198. -:a1199 :a1199 :a1199. -:a1200 :a1200 :a1200. -:a1201 :a1201 :a1201. -:a1202 :a1202 :a1202. -:a1203 :a1203 :a1203. -:a1204 :a1204 :a1204. -:a1205 :a1205 :a1205. -:a1206 :a1206 :a1206. -:a1207 :a1207 :a1207. -:a1208 :a1208 :a1208. -:a1209 :a1209 :a1209. -:a1210 :a1210 :a1210. -:a1211 :a1211 :a1211. -:a1212 :a1212 :a1212. -:a1213 :a1213 :a1213. -:a1214 :a1214 :a1214. -:a1215 :a1215 :a1215. -:a1216 :a1216 :a1216. -:a1217 :a1217 :a1217. -:a1218 :a1218 :a1218. -:a1219 :a1219 :a1219. -:a1220 :a1220 :a1220. -:a1221 :a1221 :a1221. -:a1222 :a1222 :a1222. -:a1223 :a1223 :a1223. -:a1224 :a1224 :a1224. -:a1225 :a1225 :a1225. -:a1226 :a1226 :a1226. -:a1227 :a1227 :a1227. -:a1228 :a1228 :a1228. -:a1229 :a1229 :a1229. -:a1230 :a1230 :a1230. -:a1231 :a1231 :a1231. -:a1232 :a1232 :a1232. -:a1233 :a1233 :a1233. -:a1234 :a1234 :a1234. -:a1235 :a1235 :a1235. -:a1236 :a1236 :a1236. -:a1237 :a1237 :a1237. -:a1238 :a1238 :a1238. -:a1239 :a1239 :a1239. -:a1240 :a1240 :a1240. -:a1241 :a1241 :a1241. -:a1242 :a1242 :a1242. -:a1243 :a1243 :a1243. -:a1244 :a1244 :a1244. -:a1245 :a1245 :a1245. -:a1246 :a1246 :a1246. -:a1247 :a1247 :a1247. -:a1248 :a1248 :a1248. -:a1249 :a1249 :a1249. -:a1250 :a1250 :a1250. -:a1251 :a1251 :a1251. -:a1252 :a1252 :a1252. -:a1253 :a1253 :a1253. -:a1254 :a1254 :a1254. -:a1255 :a1255 :a1255. -:a1256 :a1256 :a1256. -:a1257 :a1257 :a1257. -:a1258 :a1258 :a1258. -:a1259 :a1259 :a1259. -:a1260 :a1260 :a1260. -:a1261 :a1261 :a1261. -:a1262 :a1262 :a1262. -:a1263 :a1263 :a1263. -:a1264 :a1264 :a1264. -:a1265 :a1265 :a1265. -:a1266 :a1266 :a1266. -:a1267 :a1267 :a1267. -:a1268 :a1268 :a1268. -:a1269 :a1269 :a1269. -:a1270 :a1270 :a1270. -:a1271 :a1271 :a1271. -:a1272 :a1272 :a1272. -:a1273 :a1273 :a1273. -:a1274 :a1274 :a1274. -:a1275 :a1275 :a1275. -:a1276 :a1276 :a1276. -:a1277 :a1277 :a1277. -:a1278 :a1278 :a1278. -:a1279 :a1279 :a1279. -:a1280 :a1280 :a1280. -:a1281 :a1281 :a1281. -:a1282 :a1282 :a1282. -:a1283 :a1283 :a1283. -:a1284 :a1284 :a1284. -:a1285 :a1285 :a1285. -:a1286 :a1286 :a1286. -:a1287 :a1287 :a1287. -:a1288 :a1288 :a1288. -:a1289 :a1289 :a1289. -:a1290 :a1290 :a1290. -:a1291 :a1291 :a1291. -:a1292 :a1292 :a1292. -:a1293 :a1293 :a1293. -:a1294 :a1294 :a1294. -:a1295 :a1295 :a1295. -:a1296 :a1296 :a1296. -:a1297 :a1297 :a1297. -:a1298 :a1298 :a1298. -:a1299 :a1299 :a1299. -:a1300 :a1300 :a1300. -:a1301 :a1301 :a1301. -:a1302 :a1302 :a1302. -:a1303 :a1303 :a1303. -:a1304 :a1304 :a1304. -:a1305 :a1305 :a1305. -:a1306 :a1306 :a1306. -:a1307 :a1307 :a1307. -:a1308 :a1308 :a1308. -:a1309 :a1309 :a1309. -:a1310 :a1310 :a1310. -:a1311 :a1311 :a1311. -:a1312 :a1312 :a1312. -:a1313 :a1313 :a1313. -:a1314 :a1314 :a1314. -:a1315 :a1315 :a1315. -:a1316 :a1316 :a1316. -:a1317 :a1317 :a1317. -:a1318 :a1318 :a1318. -:a1319 :a1319 :a1319. -:a1320 :a1320 :a1320. -:a1321 :a1321 :a1321. -:a1322 :a1322 :a1322. -:a1323 :a1323 :a1323. -:a1324 :a1324 :a1324. -:a1325 :a1325 :a1325. -:a1326 :a1326 :a1326. -:a1327 :a1327 :a1327. -:a1328 :a1328 :a1328. -:a1329 :a1329 :a1329. -:a1330 :a1330 :a1330. -:a1331 :a1331 :a1331. -:a1332 :a1332 :a1332. -:a1333 :a1333 :a1333. -:a1334 :a1334 :a1334. -:a1335 :a1335 :a1335. -:a1336 :a1336 :a1336. -:a1337 :a1337 :a1337. -:a1338 :a1338 :a1338. -:a1339 :a1339 :a1339. -:a1340 :a1340 :a1340. -:a1341 :a1341 :a1341. -:a1342 :a1342 :a1342. -:a1343 :a1343 :a1343. -:a1344 :a1344 :a1344. -:a1345 :a1345 :a1345. -:a1346 :a1346 :a1346. -:a1347 :a1347 :a1347. -:a1348 :a1348 :a1348. -:a1349 :a1349 :a1349. -:a1350 :a1350 :a1350. -:a1351 :a1351 :a1351. -:a1352 :a1352 :a1352. -:a1353 :a1353 :a1353. -:a1354 :a1354 :a1354. -:a1355 :a1355 :a1355. -:a1356 :a1356 :a1356. -:a1357 :a1357 :a1357. -:a1358 :a1358 :a1358. -:a1359 :a1359 :a1359. -:a1360 :a1360 :a1360. -:a1361 :a1361 :a1361. -:a1362 :a1362 :a1362. -:a1363 :a1363 :a1363. -:a1364 :a1364 :a1364. -:a1365 :a1365 :a1365. -:a1366 :a1366 :a1366. -:a1367 :a1367 :a1367. -:a1368 :a1368 :a1368. -:a1369 :a1369 :a1369. -:a1370 :a1370 :a1370. -:a1371 :a1371 :a1371. -:a1372 :a1372 :a1372. -:a1373 :a1373 :a1373. -:a1374 :a1374 :a1374. -:a1375 :a1375 :a1375. -:a1376 :a1376 :a1376. -:a1377 :a1377 :a1377. -:a1378 :a1378 :a1378. -:a1379 :a1379 :a1379. -:a1380 :a1380 :a1380. -:a1381 :a1381 :a1381. -:a1382 :a1382 :a1382. -:a1383 :a1383 :a1383. -:a1384 :a1384 :a1384. -:a1385 :a1385 :a1385. -:a1386 :a1386 :a1386. -:a1387 :a1387 :a1387. -:a1388 :a1388 :a1388. -:a1389 :a1389 :a1389. -:a1390 :a1390 :a1390. -:a1391 :a1391 :a1391. -:a1392 :a1392 :a1392. -:a1393 :a1393 :a1393. -:a1394 :a1394 :a1394. -:a1395 :a1395 :a1395. -:a1396 :a1396 :a1396. -:a1397 :a1397 :a1397. -:a1398 :a1398 :a1398. -:a1399 :a1399 :a1399. -:a1400 :a1400 :a1400. -:a1401 :a1401 :a1401. -:a1402 :a1402 :a1402. -:a1403 :a1403 :a1403. -:a1404 :a1404 :a1404. -:a1405 :a1405 :a1405. -:a1406 :a1406 :a1406. -:a1407 :a1407 :a1407. -:a1408 :a1408 :a1408. -:a1409 :a1409 :a1409. -:a1410 :a1410 :a1410. -:a1411 :a1411 :a1411. -:a1412 :a1412 :a1412. -:a1413 :a1413 :a1413. -:a1414 :a1414 :a1414. -:a1415 :a1415 :a1415. -:a1416 :a1416 :a1416. -:a1417 :a1417 :a1417. -:a1418 :a1418 :a1418. -:a1419 :a1419 :a1419. -:a1420 :a1420 :a1420. -:a1421 :a1421 :a1421. -:a1422 :a1422 :a1422. -:a1423 :a1423 :a1423. -:a1424 :a1424 :a1424. -:a1425 :a1425 :a1425. -:a1426 :a1426 :a1426. -:a1427 :a1427 :a1427. -:a1428 :a1428 :a1428. -:a1429 :a1429 :a1429. -:a1430 :a1430 :a1430. -:a1431 :a1431 :a1431. -:a1432 :a1432 :a1432. -:a1433 :a1433 :a1433. -:a1434 :a1434 :a1434. -:a1435 :a1435 :a1435. -:a1436 :a1436 :a1436. -:a1437 :a1437 :a1437. -:a1438 :a1438 :a1438. -:a1439 :a1439 :a1439. -:a1440 :a1440 :a1440. -:a1441 :a1441 :a1441. -:a1442 :a1442 :a1442. -:a1443 :a1443 :a1443. -:a1444 :a1444 :a1444. -:a1445 :a1445 :a1445. -:a1446 :a1446 :a1446. -:a1447 :a1447 :a1447. -:a1448 :a1448 :a1448. -:a1449 :a1449 :a1449. -:a1450 :a1450 :a1450. -:a1451 :a1451 :a1451. -:a1452 :a1452 :a1452. -:a1453 :a1453 :a1453. -:a1454 :a1454 :a1454. -:a1455 :a1455 :a1455. -:a1456 :a1456 :a1456. -:a1457 :a1457 :a1457. -:a1458 :a1458 :a1458. -:a1459 :a1459 :a1459. -:a1460 :a1460 :a1460. -:a1461 :a1461 :a1461. -:a1462 :a1462 :a1462. -:a1463 :a1463 :a1463. -:a1464 :a1464 :a1464. -:a1465 :a1465 :a1465. -:a1466 :a1466 :a1466. -:a1467 :a1467 :a1467. -:a1468 :a1468 :a1468. -:a1469 :a1469 :a1469. -:a1470 :a1470 :a1470. -:a1471 :a1471 :a1471. -:a1472 :a1472 :a1472. -:a1473 :a1473 :a1473. -:a1474 :a1474 :a1474. -:a1475 :a1475 :a1475. -:a1476 :a1476 :a1476. -:a1477 :a1477 :a1477. -:a1478 :a1478 :a1478. -:a1479 :a1479 :a1479. -:a1480 :a1480 :a1480. -:a1481 :a1481 :a1481. -:a1482 :a1482 :a1482. -:a1483 :a1483 :a1483. -:a1484 :a1484 :a1484. -:a1485 :a1485 :a1485. -:a1486 :a1486 :a1486. -:a1487 :a1487 :a1487. -:a1488 :a1488 :a1488. -:a1489 :a1489 :a1489. -:a1490 :a1490 :a1490. -:a1491 :a1491 :a1491. -:a1492 :a1492 :a1492. -:a1493 :a1493 :a1493. -:a1494 :a1494 :a1494. -:a1495 :a1495 :a1495. -:a1496 :a1496 :a1496. -:a1497 :a1497 :a1497. -:a1498 :a1498 :a1498. -:a1499 :a1499 :a1499. -:a1500 :a1500 :a1500. -:a1501 :a1501 :a1501. -:a1502 :a1502 :a1502. -:a1503 :a1503 :a1503. -:a1504 :a1504 :a1504. -:a1505 :a1505 :a1505. -:a1506 :a1506 :a1506. -:a1507 :a1507 :a1507. -:a1508 :a1508 :a1508. -:a1509 :a1509 :a1509. -:a1510 :a1510 :a1510. -:a1511 :a1511 :a1511. -:a1512 :a1512 :a1512. -:a1513 :a1513 :a1513. -:a1514 :a1514 :a1514. -:a1515 :a1515 :a1515. -:a1516 :a1516 :a1516. -:a1517 :a1517 :a1517. -:a1518 :a1518 :a1518. -:a1519 :a1519 :a1519. -:a1520 :a1520 :a1520. -:a1521 :a1521 :a1521. -:a1522 :a1522 :a1522. -:a1523 :a1523 :a1523. -:a1524 :a1524 :a1524. -:a1525 :a1525 :a1525. -:a1526 :a1526 :a1526. -:a1527 :a1527 :a1527. -:a1528 :a1528 :a1528. -:a1529 :a1529 :a1529. -:a1530 :a1530 :a1530. -:a1531 :a1531 :a1531. -:a1532 :a1532 :a1532. -:a1533 :a1533 :a1533. -:a1534 :a1534 :a1534. -:a1535 :a1535 :a1535. -:a1536 :a1536 :a1536. -:a1537 :a1537 :a1537. -:a1538 :a1538 :a1538. -:a1539 :a1539 :a1539. -:a1540 :a1540 :a1540. -:a1541 :a1541 :a1541. -:a1542 :a1542 :a1542. -:a1543 :a1543 :a1543. -:a1544 :a1544 :a1544. -:a1545 :a1545 :a1545. -:a1546 :a1546 :a1546. -:a1547 :a1547 :a1547. -:a1548 :a1548 :a1548. -:a1549 :a1549 :a1549. -:a1550 :a1550 :a1550. -:a1551 :a1551 :a1551. -:a1552 :a1552 :a1552. -:a1553 :a1553 :a1553. -:a1554 :a1554 :a1554. -:a1555 :a1555 :a1555. -:a1556 :a1556 :a1556. -:a1557 :a1557 :a1557. -:a1558 :a1558 :a1558. -:a1559 :a1559 :a1559. -:a1560 :a1560 :a1560. -:a1561 :a1561 :a1561. -:a1562 :a1562 :a1562. -:a1563 :a1563 :a1563. -:a1564 :a1564 :a1564. -:a1565 :a1565 :a1565. -:a1566 :a1566 :a1566. -:a1567 :a1567 :a1567. -:a1568 :a1568 :a1568. -:a1569 :a1569 :a1569. -:a1570 :a1570 :a1570. -:a1571 :a1571 :a1571. -:a1572 :a1572 :a1572. -:a1573 :a1573 :a1573. -:a1574 :a1574 :a1574. -:a1575 :a1575 :a1575. -:a1576 :a1576 :a1576. -:a1577 :a1577 :a1577. -:a1578 :a1578 :a1578. -:a1579 :a1579 :a1579. -:a1580 :a1580 :a1580. -:a1581 :a1581 :a1581. -:a1582 :a1582 :a1582. -:a1583 :a1583 :a1583. -:a1584 :a1584 :a1584. -:a1585 :a1585 :a1585. -:a1586 :a1586 :a1586. -:a1587 :a1587 :a1587. -:a1588 :a1588 :a1588. -:a1589 :a1589 :a1589. -:a1590 :a1590 :a1590. -:a1591 :a1591 :a1591. -:a1592 :a1592 :a1592. -:a1593 :a1593 :a1593. -:a1594 :a1594 :a1594. -:a1595 :a1595 :a1595. -:a1596 :a1596 :a1596. -:a1597 :a1597 :a1597. -:a1598 :a1598 :a1598. -:a1599 :a1599 :a1599. -:a1600 :a1600 :a1600. -:a1601 :a1601 :a1601. -:a1602 :a1602 :a1602. -:a1603 :a1603 :a1603. -:a1604 :a1604 :a1604. -:a1605 :a1605 :a1605. -:a1606 :a1606 :a1606. -:a1607 :a1607 :a1607. -:a1608 :a1608 :a1608. -:a1609 :a1609 :a1609. -:a1610 :a1610 :a1610. -:a1611 :a1611 :a1611. -:a1612 :a1612 :a1612. -:a1613 :a1613 :a1613. -:a1614 :a1614 :a1614. -:a1615 :a1615 :a1615. -:a1616 :a1616 :a1616. -:a1617 :a1617 :a1617. -:a1618 :a1618 :a1618. -:a1619 :a1619 :a1619. -:a1620 :a1620 :a1620. -:a1621 :a1621 :a1621. -:a1622 :a1622 :a1622. -:a1623 :a1623 :a1623. -:a1624 :a1624 :a1624. -:a1625 :a1625 :a1625. -:a1626 :a1626 :a1626. -:a1627 :a1627 :a1627. -:a1628 :a1628 :a1628. -:a1629 :a1629 :a1629. -:a1630 :a1630 :a1630. -:a1631 :a1631 :a1631. -:a1632 :a1632 :a1632. -:a1633 :a1633 :a1633. -:a1634 :a1634 :a1634. -:a1635 :a1635 :a1635. -:a1636 :a1636 :a1636. -:a1637 :a1637 :a1637. -:a1638 :a1638 :a1638. -:a1639 :a1639 :a1639. -:a1640 :a1640 :a1640. -:a1641 :a1641 :a1641. -:a1642 :a1642 :a1642. -:a1643 :a1643 :a1643. -:a1644 :a1644 :a1644. -:a1645 :a1645 :a1645. -:a1646 :a1646 :a1646. -:a1647 :a1647 :a1647. -:a1648 :a1648 :a1648. -:a1649 :a1649 :a1649. -:a1650 :a1650 :a1650. -:a1651 :a1651 :a1651. -:a1652 :a1652 :a1652. -:a1653 :a1653 :a1653. -:a1654 :a1654 :a1654. -:a1655 :a1655 :a1655. -:a1656 :a1656 :a1656. -:a1657 :a1657 :a1657. -:a1658 :a1658 :a1658. -:a1659 :a1659 :a1659. -:a1660 :a1660 :a1660. -:a1661 :a1661 :a1661. -:a1662 :a1662 :a1662. -:a1663 :a1663 :a1663. -:a1664 :a1664 :a1664. -:a1665 :a1665 :a1665. -:a1666 :a1666 :a1666. -:a1667 :a1667 :a1667. -:a1668 :a1668 :a1668. -:a1669 :a1669 :a1669. -:a1670 :a1670 :a1670. -:a1671 :a1671 :a1671. -:a1672 :a1672 :a1672. -:a1673 :a1673 :a1673. -:a1674 :a1674 :a1674. -:a1675 :a1675 :a1675. -:a1676 :a1676 :a1676. -:a1677 :a1677 :a1677. -:a1678 :a1678 :a1678. -:a1679 :a1679 :a1679. -:a1680 :a1680 :a1680. -:a1681 :a1681 :a1681. -:a1682 :a1682 :a1682. -:a1683 :a1683 :a1683. -:a1684 :a1684 :a1684. -:a1685 :a1685 :a1685. -:a1686 :a1686 :a1686. -:a1687 :a1687 :a1687. -:a1688 :a1688 :a1688. -:a1689 :a1689 :a1689. -:a1690 :a1690 :a1690. -:a1691 :a1691 :a1691. -:a1692 :a1692 :a1692. -:a1693 :a1693 :a1693. -:a1694 :a1694 :a1694. -:a1695 :a1695 :a1695. -:a1696 :a1696 :a1696. -:a1697 :a1697 :a1697. -:a1698 :a1698 :a1698. -:a1699 :a1699 :a1699. -:a1700 :a1700 :a1700. -:a1701 :a1701 :a1701. -:a1702 :a1702 :a1702. -:a1703 :a1703 :a1703. -:a1704 :a1704 :a1704. -:a1705 :a1705 :a1705. -:a1706 :a1706 :a1706. -:a1707 :a1707 :a1707. -:a1708 :a1708 :a1708. -:a1709 :a1709 :a1709. -:a1710 :a1710 :a1710. -:a1711 :a1711 :a1711. -:a1712 :a1712 :a1712. -:a1713 :a1713 :a1713. -:a1714 :a1714 :a1714. -:a1715 :a1715 :a1715. -:a1716 :a1716 :a1716. -:a1717 :a1717 :a1717. -:a1718 :a1718 :a1718. -:a1719 :a1719 :a1719. -:a1720 :a1720 :a1720. -:a1721 :a1721 :a1721. -:a1722 :a1722 :a1722. -:a1723 :a1723 :a1723. -:a1724 :a1724 :a1724. -:a1725 :a1725 :a1725. -:a1726 :a1726 :a1726. -:a1727 :a1727 :a1727. -:a1728 :a1728 :a1728. -:a1729 :a1729 :a1729. -:a1730 :a1730 :a1730. -:a1731 :a1731 :a1731. -:a1732 :a1732 :a1732. -:a1733 :a1733 :a1733. -:a1734 :a1734 :a1734. -:a1735 :a1735 :a1735. -:a1736 :a1736 :a1736. -:a1737 :a1737 :a1737. -:a1738 :a1738 :a1738. -:a1739 :a1739 :a1739. -:a1740 :a1740 :a1740. -:a1741 :a1741 :a1741. -:a1742 :a1742 :a1742. -:a1743 :a1743 :a1743. -:a1744 :a1744 :a1744. -:a1745 :a1745 :a1745. -:a1746 :a1746 :a1746. -:a1747 :a1747 :a1747. -:a1748 :a1748 :a1748. -:a1749 :a1749 :a1749. -:a1750 :a1750 :a1750. -:a1751 :a1751 :a1751. -:a1752 :a1752 :a1752. -:a1753 :a1753 :a1753. -:a1754 :a1754 :a1754. -:a1755 :a1755 :a1755. -:a1756 :a1756 :a1756. -:a1757 :a1757 :a1757. -:a1758 :a1758 :a1758. -:a1759 :a1759 :a1759. -:a1760 :a1760 :a1760. -:a1761 :a1761 :a1761. -:a1762 :a1762 :a1762. -:a1763 :a1763 :a1763. -:a1764 :a1764 :a1764. -:a1765 :a1765 :a1765. -:a1766 :a1766 :a1766. -:a1767 :a1767 :a1767. -:a1768 :a1768 :a1768. -:a1769 :a1769 :a1769. -:a1770 :a1770 :a1770. -:a1771 :a1771 :a1771. -:a1772 :a1772 :a1772. -:a1773 :a1773 :a1773. -:a1774 :a1774 :a1774. -:a1775 :a1775 :a1775. -:a1776 :a1776 :a1776. -:a1777 :a1777 :a1777. -:a1778 :a1778 :a1778. -:a1779 :a1779 :a1779. -:a1780 :a1780 :a1780. -:a1781 :a1781 :a1781. -:a1782 :a1782 :a1782. -:a1783 :a1783 :a1783. -:a1784 :a1784 :a1784. -:a1785 :a1785 :a1785. -:a1786 :a1786 :a1786. -:a1787 :a1787 :a1787. -:a1788 :a1788 :a1788. -:a1789 :a1789 :a1789. -:a1790 :a1790 :a1790. -:a1791 :a1791 :a1791. -:a1792 :a1792 :a1792. -:a1793 :a1793 :a1793. -:a1794 :a1794 :a1794. -:a1795 :a1795 :a1795. -:a1796 :a1796 :a1796. -:a1797 :a1797 :a1797. -:a1798 :a1798 :a1798. -:a1799 :a1799 :a1799. -:a1800 :a1800 :a1800. -:a1801 :a1801 :a1801. -:a1802 :a1802 :a1802. -:a1803 :a1803 :a1803. -:a1804 :a1804 :a1804. -:a1805 :a1805 :a1805. -:a1806 :a1806 :a1806. -:a1807 :a1807 :a1807. -:a1808 :a1808 :a1808. -:a1809 :a1809 :a1809. -:a1810 :a1810 :a1810. -:a1811 :a1811 :a1811. -:a1812 :a1812 :a1812. -:a1813 :a1813 :a1813. -:a1814 :a1814 :a1814. -:a1815 :a1815 :a1815. -:a1816 :a1816 :a1816. -:a1817 :a1817 :a1817. -:a1818 :a1818 :a1818. -:a1819 :a1819 :a1819. -:a1820 :a1820 :a1820. -:a1821 :a1821 :a1821. -:a1822 :a1822 :a1822. -:a1823 :a1823 :a1823. -:a1824 :a1824 :a1824. -:a1825 :a1825 :a1825. -:a1826 :a1826 :a1826. -:a1827 :a1827 :a1827. -:a1828 :a1828 :a1828. -:a1829 :a1829 :a1829. -:a1830 :a1830 :a1830. -:a1831 :a1831 :a1831. -:a1832 :a1832 :a1832. -:a1833 :a1833 :a1833. -:a1834 :a1834 :a1834. -:a1835 :a1835 :a1835. -:a1836 :a1836 :a1836. -:a1837 :a1837 :a1837. -:a1838 :a1838 :a1838. -:a1839 :a1839 :a1839. -:a1840 :a1840 :a1840. -:a1841 :a1841 :a1841. -:a1842 :a1842 :a1842. -:a1843 :a1843 :a1843. -:a1844 :a1844 :a1844. -:a1845 :a1845 :a1845. -:a1846 :a1846 :a1846. -:a1847 :a1847 :a1847. -:a1848 :a1848 :a1848. -:a1849 :a1849 :a1849. -:a1850 :a1850 :a1850. -:a1851 :a1851 :a1851. -:a1852 :a1852 :a1852. -:a1853 :a1853 :a1853. -:a1854 :a1854 :a1854. -:a1855 :a1855 :a1855. -:a1856 :a1856 :a1856. -:a1857 :a1857 :a1857. -:a1858 :a1858 :a1858. -:a1859 :a1859 :a1859. -:a1860 :a1860 :a1860. -:a1861 :a1861 :a1861. -:a1862 :a1862 :a1862. -:a1863 :a1863 :a1863. -:a1864 :a1864 :a1864. -:a1865 :a1865 :a1865. -:a1866 :a1866 :a1866. -:a1867 :a1867 :a1867. -:a1868 :a1868 :a1868. -:a1869 :a1869 :a1869. -:a1870 :a1870 :a1870. -:a1871 :a1871 :a1871. -:a1872 :a1872 :a1872. -:a1873 :a1873 :a1873. -:a1874 :a1874 :a1874. -:a1875 :a1875 :a1875. -:a1876 :a1876 :a1876. -:a1877 :a1877 :a1877. -:a1878 :a1878 :a1878. -:a1879 :a1879 :a1879. -:a1880 :a1880 :a1880. -:a1881 :a1881 :a1881. -:a1882 :a1882 :a1882. -:a1883 :a1883 :a1883. -:a1884 :a1884 :a1884. -:a1885 :a1885 :a1885. -:a1886 :a1886 :a1886. -:a1887 :a1887 :a1887. -:a1888 :a1888 :a1888. -:a1889 :a1889 :a1889. -:a1890 :a1890 :a1890. -:a1891 :a1891 :a1891. -:a1892 :a1892 :a1892. -:a1893 :a1893 :a1893. -:a1894 :a1894 :a1894. -:a1895 :a1895 :a1895. -:a1896 :a1896 :a1896. -:a1897 :a1897 :a1897. -:a1898 :a1898 :a1898. -:a1899 :a1899 :a1899. -:a1900 :a1900 :a1900. -:a1901 :a1901 :a1901. -:a1902 :a1902 :a1902. -:a1903 :a1903 :a1903. -:a1904 :a1904 :a1904. -:a1905 :a1905 :a1905. -:a1906 :a1906 :a1906. -:a1907 :a1907 :a1907. -:a1908 :a1908 :a1908. -:a1909 :a1909 :a1909. -:a1910 :a1910 :a1910. -:a1911 :a1911 :a1911. -:a1912 :a1912 :a1912. -:a1913 :a1913 :a1913. -:a1914 :a1914 :a1914. -:a1915 :a1915 :a1915. -:a1916 :a1916 :a1916. -:a1917 :a1917 :a1917. -:a1918 :a1918 :a1918. -:a1919 :a1919 :a1919. -:a1920 :a1920 :a1920. -:a1921 :a1921 :a1921. -:a1922 :a1922 :a1922. -:a1923 :a1923 :a1923. -:a1924 :a1924 :a1924. -:a1925 :a1925 :a1925. -:a1926 :a1926 :a1926. -:a1927 :a1927 :a1927. -:a1928 :a1928 :a1928. -:a1929 :a1929 :a1929. -:a1930 :a1930 :a1930. -:a1931 :a1931 :a1931. -:a1932 :a1932 :a1932. -:a1933 :a1933 :a1933. -:a1934 :a1934 :a1934. -:a1935 :a1935 :a1935. -:a1936 :a1936 :a1936. -:a1937 :a1937 :a1937. -:a1938 :a1938 :a1938. -:a1939 :a1939 :a1939. -:a1940 :a1940 :a1940. -:a1941 :a1941 :a1941. -:a1942 :a1942 :a1942. -:a1943 :a1943 :a1943. -:a1944 :a1944 :a1944. -:a1945 :a1945 :a1945. -:a1946 :a1946 :a1946. -:a1947 :a1947 :a1947. -:a1948 :a1948 :a1948. -:a1949 :a1949 :a1949. -:a1950 :a1950 :a1950. -:a1951 :a1951 :a1951. -:a1952 :a1952 :a1952. -:a1953 :a1953 :a1953. -:a1954 :a1954 :a1954. -:a1955 :a1955 :a1955. -:a1956 :a1956 :a1956. -:a1957 :a1957 :a1957. -:a1958 :a1958 :a1958. -:a1959 :a1959 :a1959. -:a1960 :a1960 :a1960. -:a1961 :a1961 :a1961. -:a1962 :a1962 :a1962. -:a1963 :a1963 :a1963. -:a1964 :a1964 :a1964. -:a1965 :a1965 :a1965. -:a1966 :a1966 :a1966. -:a1967 :a1967 :a1967. -:a1968 :a1968 :a1968. -:a1969 :a1969 :a1969. -:a1970 :a1970 :a1970. -:a1971 :a1971 :a1971. -:a1972 :a1972 :a1972. -:a1973 :a1973 :a1973. -:a1974 :a1974 :a1974. -:a1975 :a1975 :a1975. -:a1976 :a1976 :a1976. -:a1977 :a1977 :a1977. -:a1978 :a1978 :a1978. -:a1979 :a1979 :a1979. -:a1980 :a1980 :a1980. -:a1981 :a1981 :a1981. -:a1982 :a1982 :a1982. -:a1983 :a1983 :a1983. -:a1984 :a1984 :a1984. -:a1985 :a1985 :a1985. -:a1986 :a1986 :a1986. -:a1987 :a1987 :a1987. -:a1988 :a1988 :a1988. -:a1989 :a1989 :a1989. -:a1990 :a1990 :a1990. -:a1991 :a1991 :a1991. -:a1992 :a1992 :a1992. -:a1993 :a1993 :a1993. -:a1994 :a1994 :a1994. -:a1995 :a1995 :a1995. -:a1996 :a1996 :a1996. -:a1997 :a1997 :a1997. -:a1998 :a1998 :a1998. -:a1999 :a1999 :a1999. -:a2000 :a2000 :a2000. -:a2001 :a2001 :a2001. -:a2002 :a2002 :a2002. -:a2003 :a2003 :a2003. -:a2004 :a2004 :a2004. -:a2005 :a2005 :a2005. -:a2006 :a2006 :a2006. -:a2007 :a2007 :a2007. -:a2008 :a2008 :a2008. -:a2009 :a2009 :a2009. -:a2010 :a2010 :a2010. -:a2011 :a2011 :a2011. -:a2012 :a2012 :a2012. -:a2013 :a2013 :a2013. -:a2014 :a2014 :a2014. -:a2015 :a2015 :a2015. -:a2016 :a2016 :a2016. -:a2017 :a2017 :a2017. -:a2018 :a2018 :a2018. -:a2019 :a2019 :a2019. -:a2020 :a2020 :a2020. -:a2021 :a2021 :a2021. -:a2022 :a2022 :a2022. -:a2023 :a2023 :a2023. -:a2024 :a2024 :a2024. -:a2025 :a2025 :a2025. -:a2026 :a2026 :a2026. -:a2027 :a2027 :a2027. -:a2028 :a2028 :a2028. -:a2029 :a2029 :a2029. -:a2030 :a2030 :a2030. -:a2031 :a2031 :a2031. -:a2032 :a2032 :a2032. -:a2033 :a2033 :a2033. -:a2034 :a2034 :a2034. -:a2035 :a2035 :a2035. -:a2036 :a2036 :a2036. -:a2037 :a2037 :a2037. -:a2038 :a2038 :a2038. -:a2039 :a2039 :a2039. -:a2040 :a2040 :a2040. -:a2041 :a2041 :a2041. -:a2042 :a2042 :a2042. -:a2043 :a2043 :a2043. -:a2044 :a2044 :a2044. -:a2045 :a2045 :a2045. -:a2046 :a2046 :a2046. -:a2047 :a2047 :a2047. -:a2048 :a2048 :a2048. -:a2049 :a2049 :a2049. -:a2050 :a2050 :a2050. -:a2051 :a2051 :a2051. -:a2052 :a2052 :a2052. -:a2053 :a2053 :a2053. -:a2054 :a2054 :a2054. -:a2055 :a2055 :a2055. -:a2056 :a2056 :a2056. -:a2057 :a2057 :a2057. -:a2058 :a2058 :a2058. -:a2059 :a2059 :a2059. -:a2060 :a2060 :a2060. -:a2061 :a2061 :a2061. -:a2062 :a2062 :a2062. -:a2063 :a2063 :a2063. -:a2064 :a2064 :a2064. -:a2065 :a2065 :a2065. -:a2066 :a2066 :a2066. -:a2067 :a2067 :a2067. -:a2068 :a2068 :a2068. -:a2069 :a2069 :a2069. -:a2070 :a2070 :a2070. -:a2071 :a2071 :a2071. -:a2072 :a2072 :a2072. -:a2073 :a2073 :a2073. -:a2074 :a2074 :a2074. -:a2075 :a2075 :a2075. -:a2076 :a2076 :a2076. -:a2077 :a2077 :a2077. -:a2078 :a2078 :a2078. -:a2079 :a2079 :a2079. -:a2080 :a2080 :a2080. -:a2081 :a2081 :a2081. -:a2082 :a2082 :a2082. -:a2083 :a2083 :a2083. -:a2084 :a2084 :a2084. -:a2085 :a2085 :a2085. -:a2086 :a2086 :a2086. -:a2087 :a2087 :a2087. -:a2088 :a2088 :a2088. -:a2089 :a2089 :a2089. -:a2090 :a2090 :a2090. -:a2091 :a2091 :a2091. -:a2092 :a2092 :a2092. -:a2093 :a2093 :a2093. -:a2094 :a2094 :a2094. -:a2095 :a2095 :a2095. -:a2096 :a2096 :a2096. -:a2097 :a2097 :a2097. -:a2098 :a2098 :a2098. -:a2099 :a2099 :a2099. -:a2100 :a2100 :a2100. -:a2101 :a2101 :a2101. -:a2102 :a2102 :a2102. -:a2103 :a2103 :a2103. -:a2104 :a2104 :a2104. -:a2105 :a2105 :a2105. -:a2106 :a2106 :a2106. -:a2107 :a2107 :a2107. -:a2108 :a2108 :a2108. -:a2109 :a2109 :a2109. -:a2110 :a2110 :a2110. -:a2111 :a2111 :a2111. -:a2112 :a2112 :a2112. -:a2113 :a2113 :a2113. -:a2114 :a2114 :a2114. -:a2115 :a2115 :a2115. -:a2116 :a2116 :a2116. -:a2117 :a2117 :a2117. -:a2118 :a2118 :a2118. -:a2119 :a2119 :a2119. -:a2120 :a2120 :a2120. -:a2121 :a2121 :a2121. -:a2122 :a2122 :a2122. -:a2123 :a2123 :a2123. -:a2124 :a2124 :a2124. -:a2125 :a2125 :a2125. -:a2126 :a2126 :a2126. -:a2127 :a2127 :a2127. -:a2128 :a2128 :a2128. -:a2129 :a2129 :a2129. -:a2130 :a2130 :a2130. -:a2131 :a2131 :a2131. -:a2132 :a2132 :a2132. -:a2133 :a2133 :a2133. -:a2134 :a2134 :a2134. -:a2135 :a2135 :a2135. -:a2136 :a2136 :a2136. -:a2137 :a2137 :a2137. -:a2138 :a2138 :a2138. -:a2139 :a2139 :a2139. -:a2140 :a2140 :a2140. -:a2141 :a2141 :a2141. -:a2142 :a2142 :a2142. -:a2143 :a2143 :a2143. -:a2144 :a2144 :a2144. -:a2145 :a2145 :a2145. -:a2146 :a2146 :a2146. -:a2147 :a2147 :a2147. -:a2148 :a2148 :a2148. -:a2149 :a2149 :a2149. -:a2150 :a2150 :a2150. -:a2151 :a2151 :a2151. -:a2152 :a2152 :a2152. -:a2153 :a2153 :a2153. -:a2154 :a2154 :a2154. -:a2155 :a2155 :a2155. -:a2156 :a2156 :a2156. -:a2157 :a2157 :a2157. -:a2158 :a2158 :a2158. -:a2159 :a2159 :a2159. -:a2160 :a2160 :a2160. -:a2161 :a2161 :a2161. -:a2162 :a2162 :a2162. -:a2163 :a2163 :a2163. -:a2164 :a2164 :a2164. -:a2165 :a2165 :a2165. -:a2166 :a2166 :a2166. -:a2167 :a2167 :a2167. -:a2168 :a2168 :a2168. -:a2169 :a2169 :a2169. -:a2170 :a2170 :a2170. -:a2171 :a2171 :a2171. -:a2172 :a2172 :a2172. -:a2173 :a2173 :a2173. -:a2174 :a2174 :a2174. -:a2175 :a2175 :a2175. -:a2176 :a2176 :a2176. -:a2177 :a2177 :a2177. -:a2178 :a2178 :a2178. -:a2179 :a2179 :a2179. -:a2180 :a2180 :a2180. -:a2181 :a2181 :a2181. -:a2182 :a2182 :a2182. -:a2183 :a2183 :a2183. -:a2184 :a2184 :a2184. -:a2185 :a2185 :a2185. -:a2186 :a2186 :a2186. -:a2187 :a2187 :a2187. -:a2188 :a2188 :a2188. -:a2189 :a2189 :a2189. -:a2190 :a2190 :a2190. -:a2191 :a2191 :a2191. -:a2192 :a2192 :a2192. -:a2193 :a2193 :a2193. -:a2194 :a2194 :a2194. -:a2195 :a2195 :a2195. -:a2196 :a2196 :a2196. -:a2197 :a2197 :a2197. -:a2198 :a2198 :a2198. -:a2199 :a2199 :a2199. -:a2200 :a2200 :a2200. -:a2201 :a2201 :a2201. -:a2202 :a2202 :a2202. -:a2203 :a2203 :a2203. -:a2204 :a2204 :a2204. -:a2205 :a2205 :a2205. -:a2206 :a2206 :a2206. -:a2207 :a2207 :a2207. -:a2208 :a2208 :a2208. -:a2209 :a2209 :a2209. -:a2210 :a2210 :a2210. -:a2211 :a2211 :a2211. -:a2212 :a2212 :a2212. -:a2213 :a2213 :a2213. -:a2214 :a2214 :a2214. -:a2215 :a2215 :a2215. -:a2216 :a2216 :a2216. -:a2217 :a2217 :a2217. -:a2218 :a2218 :a2218. -:a2219 :a2219 :a2219. -:a2220 :a2220 :a2220. -:a2221 :a2221 :a2221. -:a2222 :a2222 :a2222. -:a2223 :a2223 :a2223. -:a2224 :a2224 :a2224. -:a2225 :a2225 :a2225. -:a2226 :a2226 :a2226. -:a2227 :a2227 :a2227. -:a2228 :a2228 :a2228. -:a2229 :a2229 :a2229. -:a2230 :a2230 :a2230. -:a2231 :a2231 :a2231. -:a2232 :a2232 :a2232. -:a2233 :a2233 :a2233. -:a2234 :a2234 :a2234. -:a2235 :a2235 :a2235. -:a2236 :a2236 :a2236. -:a2237 :a2237 :a2237. -:a2238 :a2238 :a2238. -:a2239 :a2239 :a2239. -:a2240 :a2240 :a2240. -:a2241 :a2241 :a2241. -:a2242 :a2242 :a2242. -:a2243 :a2243 :a2243. -:a2244 :a2244 :a2244. -:a2245 :a2245 :a2245. -:a2246 :a2246 :a2246. -:a2247 :a2247 :a2247. -:a2248 :a2248 :a2248. -:a2249 :a2249 :a2249. -:a2250 :a2250 :a2250. -:a2251 :a2251 :a2251. -:a2252 :a2252 :a2252. -:a2253 :a2253 :a2253. -:a2254 :a2254 :a2254. -:a2255 :a2255 :a2255. -:a2256 :a2256 :a2256. -:a2257 :a2257 :a2257. -:a2258 :a2258 :a2258. -:a2259 :a2259 :a2259. -:a2260 :a2260 :a2260. -:a2261 :a2261 :a2261. -:a2262 :a2262 :a2262. -:a2263 :a2263 :a2263. -:a2264 :a2264 :a2264. -:a2265 :a2265 :a2265. -:a2266 :a2266 :a2266. -:a2267 :a2267 :a2267. -:a2268 :a2268 :a2268. -:a2269 :a2269 :a2269. -:a2270 :a2270 :a2270. -:a2271 :a2271 :a2271. -:a2272 :a2272 :a2272. -:a2273 :a2273 :a2273. -:a2274 :a2274 :a2274. -:a2275 :a2275 :a2275. -:a2276 :a2276 :a2276. -:a2277 :a2277 :a2277. -:a2278 :a2278 :a2278. -:a2279 :a2279 :a2279. -:a2280 :a2280 :a2280. -:a2281 :a2281 :a2281. -:a2282 :a2282 :a2282. -:a2283 :a2283 :a2283. -:a2284 :a2284 :a2284. -:a2285 :a2285 :a2285. -:a2286 :a2286 :a2286. -:a2287 :a2287 :a2287. -:a2288 :a2288 :a2288. -:a2289 :a2289 :a2289. -:a2290 :a2290 :a2290. -:a2291 :a2291 :a2291. -:a2292 :a2292 :a2292. -:a2293 :a2293 :a2293. -:a2294 :a2294 :a2294. -:a2295 :a2295 :a2295. -:a2296 :a2296 :a2296. -:a2297 :a2297 :a2297. -:a2298 :a2298 :a2298. -:a2299 :a2299 :a2299. -:a2300 :a2300 :a2300. -:a2301 :a2301 :a2301. -:a2302 :a2302 :a2302. -:a2303 :a2303 :a2303. -:a2304 :a2304 :a2304. -:a2305 :a2305 :a2305. -:a2306 :a2306 :a2306. -:a2307 :a2307 :a2307. -:a2308 :a2308 :a2308. -:a2309 :a2309 :a2309. -:a2310 :a2310 :a2310. -:a2311 :a2311 :a2311. -:a2312 :a2312 :a2312. -:a2313 :a2313 :a2313. -:a2314 :a2314 :a2314. -:a2315 :a2315 :a2315. -:a2316 :a2316 :a2316. -:a2317 :a2317 :a2317. -:a2318 :a2318 :a2318. -:a2319 :a2319 :a2319. -:a2320 :a2320 :a2320. -:a2321 :a2321 :a2321. -:a2322 :a2322 :a2322. -:a2323 :a2323 :a2323. -:a2324 :a2324 :a2324. -:a2325 :a2325 :a2325. -:a2326 :a2326 :a2326. -:a2327 :a2327 :a2327. -:a2328 :a2328 :a2328. -:a2329 :a2329 :a2329. -:a2330 :a2330 :a2330. -:a2331 :a2331 :a2331. -:a2332 :a2332 :a2332. -:a2333 :a2333 :a2333. -:a2334 :a2334 :a2334. -:a2335 :a2335 :a2335. -:a2336 :a2336 :a2336. -:a2337 :a2337 :a2337. -:a2338 :a2338 :a2338. -:a2339 :a2339 :a2339. -:a2340 :a2340 :a2340. -:a2341 :a2341 :a2341. -:a2342 :a2342 :a2342. -:a2343 :a2343 :a2343. -:a2344 :a2344 :a2344. -:a2345 :a2345 :a2345. -:a2346 :a2346 :a2346. -:a2347 :a2347 :a2347. -:a2348 :a2348 :a2348. -:a2349 :a2349 :a2349. -:a2350 :a2350 :a2350. -:a2351 :a2351 :a2351. -:a2352 :a2352 :a2352. -:a2353 :a2353 :a2353. -:a2354 :a2354 :a2354. -:a2355 :a2355 :a2355. -:a2356 :a2356 :a2356. -:a2357 :a2357 :a2357. -:a2358 :a2358 :a2358. -:a2359 :a2359 :a2359. -:a2360 :a2360 :a2360. -:a2361 :a2361 :a2361. -:a2362 :a2362 :a2362. -:a2363 :a2363 :a2363. -:a2364 :a2364 :a2364. -:a2365 :a2365 :a2365. -:a2366 :a2366 :a2366. -:a2367 :a2367 :a2367. -:a2368 :a2368 :a2368. -:a2369 :a2369 :a2369. -:a2370 :a2370 :a2370. -:a2371 :a2371 :a2371. -:a2372 :a2372 :a2372. -:a2373 :a2373 :a2373. -:a2374 :a2374 :a2374. -:a2375 :a2375 :a2375. -:a2376 :a2376 :a2376. -:a2377 :a2377 :a2377. -:a2378 :a2378 :a2378. -:a2379 :a2379 :a2379. -:a2380 :a2380 :a2380. -:a2381 :a2381 :a2381. -:a2382 :a2382 :a2382. -:a2383 :a2383 :a2383. -:a2384 :a2384 :a2384. -:a2385 :a2385 :a2385. -:a2386 :a2386 :a2386. -:a2387 :a2387 :a2387. -:a2388 :a2388 :a2388. -:a2389 :a2389 :a2389. -:a2390 :a2390 :a2390. -:a2391 :a2391 :a2391. -:a2392 :a2392 :a2392. -:a2393 :a2393 :a2393. -:a2394 :a2394 :a2394. -:a2395 :a2395 :a2395. -:a2396 :a2396 :a2396. -:a2397 :a2397 :a2397. -:a2398 :a2398 :a2398. -:a2399 :a2399 :a2399. -:a2400 :a2400 :a2400. -:a2401 :a2401 :a2401. -:a2402 :a2402 :a2402. -:a2403 :a2403 :a2403. -:a2404 :a2404 :a2404. -:a2405 :a2405 :a2405. -:a2406 :a2406 :a2406. -:a2407 :a2407 :a2407. -:a2408 :a2408 :a2408. -:a2409 :a2409 :a2409. -:a2410 :a2410 :a2410. -:a2411 :a2411 :a2411. -:a2412 :a2412 :a2412. -:a2413 :a2413 :a2413. -:a2414 :a2414 :a2414. -:a2415 :a2415 :a2415. -:a2416 :a2416 :a2416. -:a2417 :a2417 :a2417. -:a2418 :a2418 :a2418. -:a2419 :a2419 :a2419. -:a2420 :a2420 :a2420. -:a2421 :a2421 :a2421. -:a2422 :a2422 :a2422. -:a2423 :a2423 :a2423. -:a2424 :a2424 :a2424. -:a2425 :a2425 :a2425. -:a2426 :a2426 :a2426. -:a2427 :a2427 :a2427. -:a2428 :a2428 :a2428. -:a2429 :a2429 :a2429. -:a2430 :a2430 :a2430. -:a2431 :a2431 :a2431. -:a2432 :a2432 :a2432. -:a2433 :a2433 :a2433. -:a2434 :a2434 :a2434. -:a2435 :a2435 :a2435. -:a2436 :a2436 :a2436. -:a2437 :a2437 :a2437. -:a2438 :a2438 :a2438. -:a2439 :a2439 :a2439. -:a2440 :a2440 :a2440. -:a2441 :a2441 :a2441. -:a2442 :a2442 :a2442. -:a2443 :a2443 :a2443. -:a2444 :a2444 :a2444. -:a2445 :a2445 :a2445. -:a2446 :a2446 :a2446. -:a2447 :a2447 :a2447. -:a2448 :a2448 :a2448. -:a2449 :a2449 :a2449. -:a2450 :a2450 :a2450. -:a2451 :a2451 :a2451. -:a2452 :a2452 :a2452. -:a2453 :a2453 :a2453. -:a2454 :a2454 :a2454. -:a2455 :a2455 :a2455. -:a2456 :a2456 :a2456. -:a2457 :a2457 :a2457. -:a2458 :a2458 :a2458. -:a2459 :a2459 :a2459. -:a2460 :a2460 :a2460. -:a2461 :a2461 :a2461. -:a2462 :a2462 :a2462. -:a2463 :a2463 :a2463. -:a2464 :a2464 :a2464. -:a2465 :a2465 :a2465. -:a2466 :a2466 :a2466. -:a2467 :a2467 :a2467. -:a2468 :a2468 :a2468. -:a2469 :a2469 :a2469. -:a2470 :a2470 :a2470. -:a2471 :a2471 :a2471. -:a2472 :a2472 :a2472. -:a2473 :a2473 :a2473. -:a2474 :a2474 :a2474. -:a2475 :a2475 :a2475. -:a2476 :a2476 :a2476. -:a2477 :a2477 :a2477. -:a2478 :a2478 :a2478. -:a2479 :a2479 :a2479. -:a2480 :a2480 :a2480. -:a2481 :a2481 :a2481. -:a2482 :a2482 :a2482. -:a2483 :a2483 :a2483. -:a2484 :a2484 :a2484. -:a2485 :a2485 :a2485. -:a2486 :a2486 :a2486. -:a2487 :a2487 :a2487. -:a2488 :a2488 :a2488. -:a2489 :a2489 :a2489. -:a2490 :a2490 :a2490. -:a2491 :a2491 :a2491. -:a2492 :a2492 :a2492. -:a2493 :a2493 :a2493. -:a2494 :a2494 :a2494. -:a2495 :a2495 :a2495. -:a2496 :a2496 :a2496. -:a2497 :a2497 :a2497. -:a2498 :a2498 :a2498. -:a2499 :a2499 :a2499. -:a2500 :a2500 :a2500. -:a2501 :a2501 :a2501. -:a2502 :a2502 :a2502. -:a2503 :a2503 :a2503. -:a2504 :a2504 :a2504. -:a2505 :a2505 :a2505. -:a2506 :a2506 :a2506. -:a2507 :a2507 :a2507. -:a2508 :a2508 :a2508. -:a2509 :a2509 :a2509. -:a2510 :a2510 :a2510. -:a2511 :a2511 :a2511. -:a2512 :a2512 :a2512. -:a2513 :a2513 :a2513. -:a2514 :a2514 :a2514. -:a2515 :a2515 :a2515. -:a2516 :a2516 :a2516. -:a2517 :a2517 :a2517. -:a2518 :a2518 :a2518. -:a2519 :a2519 :a2519. -:a2520 :a2520 :a2520. -:a2521 :a2521 :a2521. -:a2522 :a2522 :a2522. -:a2523 :a2523 :a2523. -:a2524 :a2524 :a2524. -:a2525 :a2525 :a2525. -:a2526 :a2526 :a2526. -:a2527 :a2527 :a2527. -:a2528 :a2528 :a2528. -:a2529 :a2529 :a2529. -:a2530 :a2530 :a2530. -:a2531 :a2531 :a2531. -:a2532 :a2532 :a2532. -:a2533 :a2533 :a2533. -:a2534 :a2534 :a2534. -:a2535 :a2535 :a2535. -:a2536 :a2536 :a2536. -:a2537 :a2537 :a2537. -:a2538 :a2538 :a2538. -:a2539 :a2539 :a2539. -:a2540 :a2540 :a2540. -:a2541 :a2541 :a2541. -:a2542 :a2542 :a2542. -:a2543 :a2543 :a2543. -:a2544 :a2544 :a2544. -:a2545 :a2545 :a2545. -:a2546 :a2546 :a2546. -:a2547 :a2547 :a2547. -:a2548 :a2548 :a2548. -:a2549 :a2549 :a2549. -:a2550 :a2550 :a2550. -:a2551 :a2551 :a2551. -:a2552 :a2552 :a2552. -:a2553 :a2553 :a2553. -:a2554 :a2554 :a2554. -:a2555 :a2555 :a2555. -:a2556 :a2556 :a2556. -:a2557 :a2557 :a2557. -:a2558 :a2558 :a2558. -:a2559 :a2559 :a2559. -:a2560 :a2560 :a2560. -:a2561 :a2561 :a2561. -:a2562 :a2562 :a2562. -:a2563 :a2563 :a2563. -:a2564 :a2564 :a2564. -:a2565 :a2565 :a2565. -:a2566 :a2566 :a2566. -:a2567 :a2567 :a2567. -:a2568 :a2568 :a2568. -:a2569 :a2569 :a2569. -:a2570 :a2570 :a2570. -:a2571 :a2571 :a2571. -:a2572 :a2572 :a2572. -:a2573 :a2573 :a2573. -:a2574 :a2574 :a2574. -:a2575 :a2575 :a2575. -:a2576 :a2576 :a2576. -:a2577 :a2577 :a2577. -:a2578 :a2578 :a2578. -:a2579 :a2579 :a2579. -:a2580 :a2580 :a2580. -:a2581 :a2581 :a2581. -:a2582 :a2582 :a2582. -:a2583 :a2583 :a2583. -:a2584 :a2584 :a2584. -:a2585 :a2585 :a2585. -:a2586 :a2586 :a2586. -:a2587 :a2587 :a2587. -:a2588 :a2588 :a2588. -:a2589 :a2589 :a2589. -:a2590 :a2590 :a2590. -:a2591 :a2591 :a2591. -:a2592 :a2592 :a2592. -:a2593 :a2593 :a2593. -:a2594 :a2594 :a2594. -:a2595 :a2595 :a2595. -:a2596 :a2596 :a2596. -:a2597 :a2597 :a2597. -:a2598 :a2598 :a2598. -:a2599 :a2599 :a2599. -:a2600 :a2600 :a2600. -:a2601 :a2601 :a2601. -:a2602 :a2602 :a2602. -:a2603 :a2603 :a2603. -:a2604 :a2604 :a2604. -:a2605 :a2605 :a2605. -:a2606 :a2606 :a2606. -:a2607 :a2607 :a2607. -:a2608 :a2608 :a2608. -:a2609 :a2609 :a2609. -:a2610 :a2610 :a2610. -:a2611 :a2611 :a2611. -:a2612 :a2612 :a2612. -:a2613 :a2613 :a2613. -:a2614 :a2614 :a2614. -:a2615 :a2615 :a2615. -:a2616 :a2616 :a2616. -:a2617 :a2617 :a2617. -:a2618 :a2618 :a2618. -:a2619 :a2619 :a2619. -:a2620 :a2620 :a2620. -:a2621 :a2621 :a2621. -:a2622 :a2622 :a2622. -:a2623 :a2623 :a2623. -:a2624 :a2624 :a2624. -:a2625 :a2625 :a2625. -:a2626 :a2626 :a2626. -:a2627 :a2627 :a2627. -:a2628 :a2628 :a2628. -:a2629 :a2629 :a2629. -:a2630 :a2630 :a2630. -:a2631 :a2631 :a2631. -:a2632 :a2632 :a2632. -:a2633 :a2633 :a2633. -:a2634 :a2634 :a2634. -:a2635 :a2635 :a2635. -:a2636 :a2636 :a2636. -:a2637 :a2637 :a2637. -:a2638 :a2638 :a2638. -:a2639 :a2639 :a2639. -:a2640 :a2640 :a2640. -:a2641 :a2641 :a2641. -:a2642 :a2642 :a2642. -:a2643 :a2643 :a2643. -:a2644 :a2644 :a2644. -:a2645 :a2645 :a2645. -:a2646 :a2646 :a2646. -:a2647 :a2647 :a2647. -:a2648 :a2648 :a2648. -:a2649 :a2649 :a2649. -:a2650 :a2650 :a2650. -:a2651 :a2651 :a2651. -:a2652 :a2652 :a2652. -:a2653 :a2653 :a2653. -:a2654 :a2654 :a2654. -:a2655 :a2655 :a2655. -:a2656 :a2656 :a2656. -:a2657 :a2657 :a2657. -:a2658 :a2658 :a2658. -:a2659 :a2659 :a2659. -:a2660 :a2660 :a2660. -:a2661 :a2661 :a2661. -:a2662 :a2662 :a2662. -:a2663 :a2663 :a2663. -:a2664 :a2664 :a2664. -:a2665 :a2665 :a2665. -:a2666 :a2666 :a2666. -:a2667 :a2667 :a2667. -:a2668 :a2668 :a2668. -:a2669 :a2669 :a2669. -:a2670 :a2670 :a2670. -:a2671 :a2671 :a2671. -:a2672 :a2672 :a2672. -:a2673 :a2673 :a2673. -:a2674 :a2674 :a2674. -:a2675 :a2675 :a2675. -:a2676 :a2676 :a2676. -:a2677 :a2677 :a2677. -:a2678 :a2678 :a2678. -:a2679 :a2679 :a2679. -:a2680 :a2680 :a2680. -:a2681 :a2681 :a2681. -:a2682 :a2682 :a2682. -:a2683 :a2683 :a2683. -:a2684 :a2684 :a2684. -:a2685 :a2685 :a2685. -:a2686 :a2686 :a2686. -:a2687 :a2687 :a2687. -:a2688 :a2688 :a2688. -:a2689 :a2689 :a2689. -:a2690 :a2690 :a2690. -:a2691 :a2691 :a2691. -:a2692 :a2692 :a2692. -:a2693 :a2693 :a2693. -:a2694 :a2694 :a2694. -:a2695 :a2695 :a2695. -:a2696 :a2696 :a2696. -:a2697 :a2697 :a2697. -:a2698 :a2698 :a2698. -:a2699 :a2699 :a2699. -:a2700 :a2700 :a2700. -:a2701 :a2701 :a2701. -:a2702 :a2702 :a2702. -:a2703 :a2703 :a2703. -:a2704 :a2704 :a2704. -:a2705 :a2705 :a2705. -:a2706 :a2706 :a2706. -:a2707 :a2707 :a2707. -:a2708 :a2708 :a2708. -:a2709 :a2709 :a2709. -:a2710 :a2710 :a2710. -:a2711 :a2711 :a2711. -:a2712 :a2712 :a2712. -:a2713 :a2713 :a2713. -:a2714 :a2714 :a2714. -:a2715 :a2715 :a2715. -:a2716 :a2716 :a2716. -:a2717 :a2717 :a2717. -:a2718 :a2718 :a2718. -:a2719 :a2719 :a2719. -:a2720 :a2720 :a2720. -:a2721 :a2721 :a2721. -:a2722 :a2722 :a2722. -:a2723 :a2723 :a2723. -:a2724 :a2724 :a2724. -:a2725 :a2725 :a2725. -:a2726 :a2726 :a2726. -:a2727 :a2727 :a2727. -:a2728 :a2728 :a2728. -:a2729 :a2729 :a2729. -:a2730 :a2730 :a2730. -:a2731 :a2731 :a2731. -:a2732 :a2732 :a2732. -:a2733 :a2733 :a2733. -:a2734 :a2734 :a2734. -:a2735 :a2735 :a2735. -:a2736 :a2736 :a2736. -:a2737 :a2737 :a2737. -:a2738 :a2738 :a2738. -:a2739 :a2739 :a2739. -:a2740 :a2740 :a2740. -:a2741 :a2741 :a2741. -:a2742 :a2742 :a2742. -:a2743 :a2743 :a2743. -:a2744 :a2744 :a2744. -:a2745 :a2745 :a2745. -:a2746 :a2746 :a2746. -:a2747 :a2747 :a2747. -:a2748 :a2748 :a2748. -:a2749 :a2749 :a2749. -:a2750 :a2750 :a2750. -:a2751 :a2751 :a2751. -:a2752 :a2752 :a2752. -:a2753 :a2753 :a2753. -:a2754 :a2754 :a2754. -:a2755 :a2755 :a2755. -:a2756 :a2756 :a2756. -:a2757 :a2757 :a2757. -:a2758 :a2758 :a2758. -:a2759 :a2759 :a2759. -:a2760 :a2760 :a2760. -:a2761 :a2761 :a2761. -:a2762 :a2762 :a2762. -:a2763 :a2763 :a2763. -:a2764 :a2764 :a2764. -:a2765 :a2765 :a2765. -:a2766 :a2766 :a2766. -:a2767 :a2767 :a2767. -:a2768 :a2768 :a2768. -:a2769 :a2769 :a2769. -:a2770 :a2770 :a2770. -:a2771 :a2771 :a2771. -:a2772 :a2772 :a2772. -:a2773 :a2773 :a2773. -:a2774 :a2774 :a2774. -:a2775 :a2775 :a2775. -:a2776 :a2776 :a2776. -:a2777 :a2777 :a2777. -:a2778 :a2778 :a2778. -:a2779 :a2779 :a2779. -:a2780 :a2780 :a2780. -:a2781 :a2781 :a2781. -:a2782 :a2782 :a2782. -:a2783 :a2783 :a2783. -:a2784 :a2784 :a2784. -:a2785 :a2785 :a2785. -:a2786 :a2786 :a2786. -:a2787 :a2787 :a2787. -:a2788 :a2788 :a2788. -:a2789 :a2789 :a2789. -:a2790 :a2790 :a2790. -:a2791 :a2791 :a2791. -:a2792 :a2792 :a2792. -:a2793 :a2793 :a2793. -:a2794 :a2794 :a2794. -:a2795 :a2795 :a2795. -:a2796 :a2796 :a2796. -:a2797 :a2797 :a2797. -:a2798 :a2798 :a2798. -:a2799 :a2799 :a2799. -:a2800 :a2800 :a2800. -:a2801 :a2801 :a2801. -:a2802 :a2802 :a2802. -:a2803 :a2803 :a2803. -:a2804 :a2804 :a2804. -:a2805 :a2805 :a2805. -:a2806 :a2806 :a2806. -:a2807 :a2807 :a2807. -:a2808 :a2808 :a2808. -:a2809 :a2809 :a2809. -:a2810 :a2810 :a2810. -:a2811 :a2811 :a2811. -:a2812 :a2812 :a2812. -:a2813 :a2813 :a2813. -:a2814 :a2814 :a2814. -:a2815 :a2815 :a2815. -:a2816 :a2816 :a2816. -:a2817 :a2817 :a2817. -:a2818 :a2818 :a2818. -:a2819 :a2819 :a2819. -:a2820 :a2820 :a2820. -:a2821 :a2821 :a2821. -:a2822 :a2822 :a2822. -:a2823 :a2823 :a2823. -:a2824 :a2824 :a2824. -:a2825 :a2825 :a2825. -:a2826 :a2826 :a2826. -:a2827 :a2827 :a2827. -:a2828 :a2828 :a2828. -:a2829 :a2829 :a2829. -:a2830 :a2830 :a2830. -:a2831 :a2831 :a2831. -:a2832 :a2832 :a2832. -:a2833 :a2833 :a2833. -:a2834 :a2834 :a2834. -:a2835 :a2835 :a2835. -:a2836 :a2836 :a2836. -:a2837 :a2837 :a2837. -:a2838 :a2838 :a2838. -:a2839 :a2839 :a2839. -:a2840 :a2840 :a2840. -:a2841 :a2841 :a2841. -:a2842 :a2842 :a2842. -:a2843 :a2843 :a2843. -:a2844 :a2844 :a2844. -:a2845 :a2845 :a2845. -:a2846 :a2846 :a2846. -:a2847 :a2847 :a2847. -:a2848 :a2848 :a2848. -:a2849 :a2849 :a2849. -:a2850 :a2850 :a2850. -:a2851 :a2851 :a2851. -:a2852 :a2852 :a2852. -:a2853 :a2853 :a2853. -:a2854 :a2854 :a2854. -:a2855 :a2855 :a2855. -:a2856 :a2856 :a2856. -:a2857 :a2857 :a2857. -:a2858 :a2858 :a2858. -:a2859 :a2859 :a2859. -:a2860 :a2860 :a2860. -:a2861 :a2861 :a2861. -:a2862 :a2862 :a2862. -:a2863 :a2863 :a2863. -:a2864 :a2864 :a2864. -:a2865 :a2865 :a2865. -:a2866 :a2866 :a2866. -:a2867 :a2867 :a2867. -:a2868 :a2868 :a2868. -:a2869 :a2869 :a2869. -:a2870 :a2870 :a2870. -:a2871 :a2871 :a2871. -:a2872 :a2872 :a2872. -:a2873 :a2873 :a2873. -:a2874 :a2874 :a2874. -:a2875 :a2875 :a2875. -:a2876 :a2876 :a2876. -:a2877 :a2877 :a2877. -:a2878 :a2878 :a2878. -:a2879 :a2879 :a2879. -:a2880 :a2880 :a2880. -:a2881 :a2881 :a2881. -:a2882 :a2882 :a2882. -:a2883 :a2883 :a2883. -:a2884 :a2884 :a2884. -:a2885 :a2885 :a2885. -:a2886 :a2886 :a2886. -:a2887 :a2887 :a2887. -:a2888 :a2888 :a2888. -:a2889 :a2889 :a2889. -:a2890 :a2890 :a2890. -:a2891 :a2891 :a2891. -:a2892 :a2892 :a2892. -:a2893 :a2893 :a2893. -:a2894 :a2894 :a2894. -:a2895 :a2895 :a2895. -:a2896 :a2896 :a2896. -:a2897 :a2897 :a2897. -:a2898 :a2898 :a2898. -:a2899 :a2899 :a2899. -:a2900 :a2900 :a2900. -:a2901 :a2901 :a2901. -:a2902 :a2902 :a2902. -:a2903 :a2903 :a2903. -:a2904 :a2904 :a2904. -:a2905 :a2905 :a2905. -:a2906 :a2906 :a2906. -:a2907 :a2907 :a2907. -:a2908 :a2908 :a2908. -:a2909 :a2909 :a2909. -:a2910 :a2910 :a2910. -:a2911 :a2911 :a2911. -:a2912 :a2912 :a2912. -:a2913 :a2913 :a2913. -:a2914 :a2914 :a2914. -:a2915 :a2915 :a2915. -:a2916 :a2916 :a2916. -:a2917 :a2917 :a2917. -:a2918 :a2918 :a2918. -:a2919 :a2919 :a2919. -:a2920 :a2920 :a2920. -:a2921 :a2921 :a2921. -:a2922 :a2922 :a2922. -:a2923 :a2923 :a2923. -:a2924 :a2924 :a2924. -:a2925 :a2925 :a2925. -:a2926 :a2926 :a2926. -:a2927 :a2927 :a2927. -:a2928 :a2928 :a2928. -:a2929 :a2929 :a2929. -:a2930 :a2930 :a2930. -:a2931 :a2931 :a2931. -:a2932 :a2932 :a2932. -:a2933 :a2933 :a2933. -:a2934 :a2934 :a2934. -:a2935 :a2935 :a2935. -:a2936 :a2936 :a2936. -:a2937 :a2937 :a2937. -:a2938 :a2938 :a2938. -:a2939 :a2939 :a2939. -:a2940 :a2940 :a2940. -:a2941 :a2941 :a2941. -:a2942 :a2942 :a2942. -:a2943 :a2943 :a2943. -:a2944 :a2944 :a2944. -:a2945 :a2945 :a2945. -:a2946 :a2946 :a2946. -:a2947 :a2947 :a2947. -:a2948 :a2948 :a2948. -:a2949 :a2949 :a2949. -:a2950 :a2950 :a2950. -:a2951 :a2951 :a2951. -:a2952 :a2952 :a2952. -:a2953 :a2953 :a2953. -:a2954 :a2954 :a2954. -:a2955 :a2955 :a2955. -:a2956 :a2956 :a2956. -:a2957 :a2957 :a2957. -:a2958 :a2958 :a2958. -:a2959 :a2959 :a2959. -:a2960 :a2960 :a2960. -:a2961 :a2961 :a2961. -:a2962 :a2962 :a2962. -:a2963 :a2963 :a2963. -:a2964 :a2964 :a2964. -:a2965 :a2965 :a2965. -:a2966 :a2966 :a2966. -:a2967 :a2967 :a2967. -:a2968 :a2968 :a2968. -:a2969 :a2969 :a2969. -:a2970 :a2970 :a2970. -:a2971 :a2971 :a2971. -:a2972 :a2972 :a2972. -:a2973 :a2973 :a2973. -:a2974 :a2974 :a2974. -:a2975 :a2975 :a2975. -:a2976 :a2976 :a2976. -:a2977 :a2977 :a2977. -:a2978 :a2978 :a2978. -:a2979 :a2979 :a2979. -:a2980 :a2980 :a2980. -:a2981 :a2981 :a2981. -:a2982 :a2982 :a2982. -:a2983 :a2983 :a2983. -:a2984 :a2984 :a2984. -:a2985 :a2985 :a2985. -:a2986 :a2986 :a2986. -:a2987 :a2987 :a2987. -:a2988 :a2988 :a2988. -:a2989 :a2989 :a2989. -:a2990 :a2990 :a2990. -:a2991 :a2991 :a2991. -:a2992 :a2992 :a2992. -:a2993 :a2993 :a2993. -:a2994 :a2994 :a2994. -:a2995 :a2995 :a2995. -:a2996 :a2996 :a2996. -:a2997 :a2997 :a2997. -:a2998 :a2998 :a2998. -:a2999 :a2999 :a2999. -:a3000 :a3000 :a3000. -:a3001 :a3001 :a3001. -:a3002 :a3002 :a3002. -:a3003 :a3003 :a3003. -:a3004 :a3004 :a3004. -:a3005 :a3005 :a3005. -:a3006 :a3006 :a3006. -:a3007 :a3007 :a3007. -:a3008 :a3008 :a3008. -:a3009 :a3009 :a3009. -:a3010 :a3010 :a3010. -:a3011 :a3011 :a3011. -:a3012 :a3012 :a3012. -:a3013 :a3013 :a3013. -:a3014 :a3014 :a3014. -:a3015 :a3015 :a3015. -:a3016 :a3016 :a3016. -:a3017 :a3017 :a3017. -:a3018 :a3018 :a3018. -:a3019 :a3019 :a3019. -:a3020 :a3020 :a3020. -:a3021 :a3021 :a3021. -:a3022 :a3022 :a3022. -:a3023 :a3023 :a3023. -:a3024 :a3024 :a3024. -:a3025 :a3025 :a3025. -:a3026 :a3026 :a3026. -:a3027 :a3027 :a3027. -:a3028 :a3028 :a3028. -:a3029 :a3029 :a3029. -:a3030 :a3030 :a3030. -:a3031 :a3031 :a3031. -:a3032 :a3032 :a3032. -:a3033 :a3033 :a3033. -:a3034 :a3034 :a3034. -:a3035 :a3035 :a3035. -:a3036 :a3036 :a3036. -:a3037 :a3037 :a3037. -:a3038 :a3038 :a3038. -:a3039 :a3039 :a3039. -:a3040 :a3040 :a3040. -:a3041 :a3041 :a3041. -:a3042 :a3042 :a3042. -:a3043 :a3043 :a3043. -:a3044 :a3044 :a3044. -:a3045 :a3045 :a3045. -:a3046 :a3046 :a3046. -:a3047 :a3047 :a3047. -:a3048 :a3048 :a3048. -:a3049 :a3049 :a3049. -:a3050 :a3050 :a3050. -:a3051 :a3051 :a3051. -:a3052 :a3052 :a3052. -:a3053 :a3053 :a3053. -:a3054 :a3054 :a3054. -:a3055 :a3055 :a3055. -:a3056 :a3056 :a3056. -:a3057 :a3057 :a3057. -:a3058 :a3058 :a3058. -:a3059 :a3059 :a3059. -:a3060 :a3060 :a3060. -:a3061 :a3061 :a3061. -:a3062 :a3062 :a3062. -:a3063 :a3063 :a3063. -:a3064 :a3064 :a3064. -:a3065 :a3065 :a3065. -:a3066 :a3066 :a3066. -:a3067 :a3067 :a3067. -:a3068 :a3068 :a3068. -:a3069 :a3069 :a3069. -:a3070 :a3070 :a3070. -:a3071 :a3071 :a3071. -:a3072 :a3072 :a3072. -:a3073 :a3073 :a3073. -:a3074 :a3074 :a3074. -:a3075 :a3075 :a3075. -:a3076 :a3076 :a3076. -:a3077 :a3077 :a3077. -:a3078 :a3078 :a3078. -:a3079 :a3079 :a3079. -:a3080 :a3080 :a3080. -:a3081 :a3081 :a3081. -:a3082 :a3082 :a3082. -:a3083 :a3083 :a3083. -:a3084 :a3084 :a3084. -:a3085 :a3085 :a3085. -:a3086 :a3086 :a3086. -:a3087 :a3087 :a3087. -:a3088 :a3088 :a3088. -:a3089 :a3089 :a3089. -:a3090 :a3090 :a3090. -:a3091 :a3091 :a3091. -:a3092 :a3092 :a3092. -:a3093 :a3093 :a3093. -:a3094 :a3094 :a3094. -:a3095 :a3095 :a3095. -:a3096 :a3096 :a3096. -:a3097 :a3097 :a3097. -:a3098 :a3098 :a3098. -:a3099 :a3099 :a3099. -:a3100 :a3100 :a3100. -:a3101 :a3101 :a3101. -:a3102 :a3102 :a3102. -:a3103 :a3103 :a3103. -:a3104 :a3104 :a3104. -:a3105 :a3105 :a3105. -:a3106 :a3106 :a3106. -:a3107 :a3107 :a3107. -:a3108 :a3108 :a3108. -:a3109 :a3109 :a3109. -:a3110 :a3110 :a3110. -:a3111 :a3111 :a3111. -:a3112 :a3112 :a3112. -:a3113 :a3113 :a3113. -:a3114 :a3114 :a3114. -:a3115 :a3115 :a3115. -:a3116 :a3116 :a3116. -:a3117 :a3117 :a3117. -:a3118 :a3118 :a3118. -:a3119 :a3119 :a3119. -:a3120 :a3120 :a3120. -:a3121 :a3121 :a3121. -:a3122 :a3122 :a3122. -:a3123 :a3123 :a3123. -:a3124 :a3124 :a3124. -:a3125 :a3125 :a3125. -:a3126 :a3126 :a3126. -:a3127 :a3127 :a3127. -:a3128 :a3128 :a3128. -:a3129 :a3129 :a3129. -:a3130 :a3130 :a3130. -:a3131 :a3131 :a3131. -:a3132 :a3132 :a3132. -:a3133 :a3133 :a3133. -:a3134 :a3134 :a3134. -:a3135 :a3135 :a3135. -:a3136 :a3136 :a3136. -:a3137 :a3137 :a3137. -:a3138 :a3138 :a3138. -:a3139 :a3139 :a3139. -:a3140 :a3140 :a3140. -:a3141 :a3141 :a3141. -:a3142 :a3142 :a3142. -:a3143 :a3143 :a3143. -:a3144 :a3144 :a3144. -:a3145 :a3145 :a3145. -:a3146 :a3146 :a3146. -:a3147 :a3147 :a3147. -:a3148 :a3148 :a3148. -:a3149 :a3149 :a3149. -:a3150 :a3150 :a3150. -:a3151 :a3151 :a3151. -:a3152 :a3152 :a3152. -:a3153 :a3153 :a3153. -:a3154 :a3154 :a3154. -:a3155 :a3155 :a3155. -:a3156 :a3156 :a3156. -:a3157 :a3157 :a3157. -:a3158 :a3158 :a3158. -:a3159 :a3159 :a3159. -:a3160 :a3160 :a3160. -:a3161 :a3161 :a3161. -:a3162 :a3162 :a3162. -:a3163 :a3163 :a3163. -:a3164 :a3164 :a3164. -:a3165 :a3165 :a3165. -:a3166 :a3166 :a3166. -:a3167 :a3167 :a3167. -:a3168 :a3168 :a3168. -:a3169 :a3169 :a3169. -:a3170 :a3170 :a3170. -:a3171 :a3171 :a3171. -:a3172 :a3172 :a3172. -:a3173 :a3173 :a3173. -:a3174 :a3174 :a3174. -:a3175 :a3175 :a3175. -:a3176 :a3176 :a3176. -:a3177 :a3177 :a3177. -:a3178 :a3178 :a3178. -:a3179 :a3179 :a3179. -:a3180 :a3180 :a3180. -:a3181 :a3181 :a3181. -:a3182 :a3182 :a3182. -:a3183 :a3183 :a3183. -:a3184 :a3184 :a3184. -:a3185 :a3185 :a3185. -:a3186 :a3186 :a3186. -:a3187 :a3187 :a3187. -:a3188 :a3188 :a3188. -:a3189 :a3189 :a3189. -:a3190 :a3190 :a3190. -:a3191 :a3191 :a3191. -:a3192 :a3192 :a3192. -:a3193 :a3193 :a3193. -:a3194 :a3194 :a3194. -:a3195 :a3195 :a3195. -:a3196 :a3196 :a3196. -:a3197 :a3197 :a3197. -:a3198 :a3198 :a3198. -:a3199 :a3199 :a3199. -:a3200 :a3200 :a3200. -:a3201 :a3201 :a3201. -:a3202 :a3202 :a3202. -:a3203 :a3203 :a3203. -:a3204 :a3204 :a3204. -:a3205 :a3205 :a3205. -:a3206 :a3206 :a3206. -:a3207 :a3207 :a3207. -:a3208 :a3208 :a3208. -:a3209 :a3209 :a3209. -:a3210 :a3210 :a3210. -:a3211 :a3211 :a3211. -:a3212 :a3212 :a3212. -:a3213 :a3213 :a3213. -:a3214 :a3214 :a3214. -:a3215 :a3215 :a3215. -:a3216 :a3216 :a3216. -:a3217 :a3217 :a3217. -:a3218 :a3218 :a3218. -:a3219 :a3219 :a3219. -:a3220 :a3220 :a3220. -:a3221 :a3221 :a3221. -:a3222 :a3222 :a3222. -:a3223 :a3223 :a3223. -:a3224 :a3224 :a3224. -:a3225 :a3225 :a3225. -:a3226 :a3226 :a3226. -:a3227 :a3227 :a3227. -:a3228 :a3228 :a3228. -:a3229 :a3229 :a3229. -:a3230 :a3230 :a3230. -:a3231 :a3231 :a3231. -:a3232 :a3232 :a3232. -:a3233 :a3233 :a3233. -:a3234 :a3234 :a3234. -:a3235 :a3235 :a3235. -:a3236 :a3236 :a3236. -:a3237 :a3237 :a3237. -:a3238 :a3238 :a3238. -:a3239 :a3239 :a3239. -:a3240 :a3240 :a3240. -:a3241 :a3241 :a3241. -:a3242 :a3242 :a3242. -:a3243 :a3243 :a3243. -:a3244 :a3244 :a3244. -:a3245 :a3245 :a3245. -:a3246 :a3246 :a3246. -:a3247 :a3247 :a3247. -:a3248 :a3248 :a3248. -:a3249 :a3249 :a3249. -:a3250 :a3250 :a3250. -:a3251 :a3251 :a3251. -:a3252 :a3252 :a3252. -:a3253 :a3253 :a3253. -:a3254 :a3254 :a3254. -:a3255 :a3255 :a3255. -:a3256 :a3256 :a3256. -:a3257 :a3257 :a3257. -:a3258 :a3258 :a3258. -:a3259 :a3259 :a3259. -:a3260 :a3260 :a3260. -:a3261 :a3261 :a3261. -:a3262 :a3262 :a3262. -:a3263 :a3263 :a3263. -:a3264 :a3264 :a3264. -:a3265 :a3265 :a3265. -:a3266 :a3266 :a3266. -:a3267 :a3267 :a3267. -:a3268 :a3268 :a3268. -:a3269 :a3269 :a3269. -:a3270 :a3270 :a3270. -:a3271 :a3271 :a3271. -:a3272 :a3272 :a3272. -:a3273 :a3273 :a3273. -:a3274 :a3274 :a3274. -:a3275 :a3275 :a3275. -:a3276 :a3276 :a3276. -:a3277 :a3277 :a3277. -:a3278 :a3278 :a3278. -:a3279 :a3279 :a3279. -:a3280 :a3280 :a3280. -:a3281 :a3281 :a3281. -:a3282 :a3282 :a3282. -:a3283 :a3283 :a3283. -:a3284 :a3284 :a3284. -:a3285 :a3285 :a3285. -:a3286 :a3286 :a3286. -:a3287 :a3287 :a3287. -:a3288 :a3288 :a3288. -:a3289 :a3289 :a3289. -:a3290 :a3290 :a3290. -:a3291 :a3291 :a3291. -:a3292 :a3292 :a3292. -:a3293 :a3293 :a3293. -:a3294 :a3294 :a3294. -:a3295 :a3295 :a3295. -:a3296 :a3296 :a3296. -:a3297 :a3297 :a3297. -:a3298 :a3298 :a3298. -:a3299 :a3299 :a3299. -:a3300 :a3300 :a3300. -:a3301 :a3301 :a3301. -:a3302 :a3302 :a3302. -:a3303 :a3303 :a3303. -:a3304 :a3304 :a3304. -:a3305 :a3305 :a3305. -:a3306 :a3306 :a3306. -:a3307 :a3307 :a3307. -:a3308 :a3308 :a3308. -:a3309 :a3309 :a3309. -:a3310 :a3310 :a3310. -:a3311 :a3311 :a3311. -:a3312 :a3312 :a3312. -:a3313 :a3313 :a3313. -:a3314 :a3314 :a3314. -:a3315 :a3315 :a3315. -:a3316 :a3316 :a3316. -:a3317 :a3317 :a3317. -:a3318 :a3318 :a3318. -:a3319 :a3319 :a3319. -:a3320 :a3320 :a3320. -:a3321 :a3321 :a3321. -:a3322 :a3322 :a3322. -:a3323 :a3323 :a3323. -:a3324 :a3324 :a3324. -:a3325 :a3325 :a3325. -:a3326 :a3326 :a3326. -:a3327 :a3327 :a3327. -:a3328 :a3328 :a3328. -:a3329 :a3329 :a3329. -:a3330 :a3330 :a3330. -:a3331 :a3331 :a3331. -:a3332 :a3332 :a3332. -:a3333 :a3333 :a3333. -:a3334 :a3334 :a3334. -:a3335 :a3335 :a3335. -:a3336 :a3336 :a3336. -:a3337 :a3337 :a3337. -:a3338 :a3338 :a3338. -:a3339 :a3339 :a3339. -:a3340 :a3340 :a3340. -:a3341 :a3341 :a3341. -:a3342 :a3342 :a3342. -:a3343 :a3343 :a3343. -:a3344 :a3344 :a3344. -:a3345 :a3345 :a3345. -:a3346 :a3346 :a3346. -:a3347 :a3347 :a3347. -:a3348 :a3348 :a3348. -:a3349 :a3349 :a3349. -:a3350 :a3350 :a3350. -:a3351 :a3351 :a3351. -:a3352 :a3352 :a3352. -:a3353 :a3353 :a3353. -:a3354 :a3354 :a3354. -:a3355 :a3355 :a3355. -:a3356 :a3356 :a3356. -:a3357 :a3357 :a3357. -:a3358 :a3358 :a3358. -:a3359 :a3359 :a3359. -:a3360 :a3360 :a3360. -:a3361 :a3361 :a3361. -:a3362 :a3362 :a3362. -:a3363 :a3363 :a3363. -:a3364 :a3364 :a3364. -:a3365 :a3365 :a3365. -:a3366 :a3366 :a3366. -:a3367 :a3367 :a3367. -:a3368 :a3368 :a3368. -:a3369 :a3369 :a3369. -:a3370 :a3370 :a3370. -:a3371 :a3371 :a3371. -:a3372 :a3372 :a3372. -:a3373 :a3373 :a3373. -:a3374 :a3374 :a3374. -:a3375 :a3375 :a3375. -:a3376 :a3376 :a3376. -:a3377 :a3377 :a3377. -:a3378 :a3378 :a3378. -:a3379 :a3379 :a3379. -:a3380 :a3380 :a3380. -:a3381 :a3381 :a3381. -:a3382 :a3382 :a3382. -:a3383 :a3383 :a3383. -:a3384 :a3384 :a3384. -:a3385 :a3385 :a3385. -:a3386 :a3386 :a3386. -:a3387 :a3387 :a3387. -:a3388 :a3388 :a3388. -:a3389 :a3389 :a3389. -:a3390 :a3390 :a3390. -:a3391 :a3391 :a3391. -:a3392 :a3392 :a3392. -:a3393 :a3393 :a3393. -:a3394 :a3394 :a3394. -:a3395 :a3395 :a3395. -:a3396 :a3396 :a3396. -:a3397 :a3397 :a3397. -:a3398 :a3398 :a3398. -:a3399 :a3399 :a3399. -:a3400 :a3400 :a3400. -:a3401 :a3401 :a3401. -:a3402 :a3402 :a3402. -:a3403 :a3403 :a3403. -:a3404 :a3404 :a3404. -:a3405 :a3405 :a3405. -:a3406 :a3406 :a3406. -:a3407 :a3407 :a3407. -:a3408 :a3408 :a3408. -:a3409 :a3409 :a3409. -:a3410 :a3410 :a3410. -:a3411 :a3411 :a3411. -:a3412 :a3412 :a3412. -:a3413 :a3413 :a3413. -:a3414 :a3414 :a3414. -:a3415 :a3415 :a3415. -:a3416 :a3416 :a3416. -:a3417 :a3417 :a3417. -:a3418 :a3418 :a3418. -:a3419 :a3419 :a3419. -:a3420 :a3420 :a3420. -:a3421 :a3421 :a3421. -:a3422 :a3422 :a3422. -:a3423 :a3423 :a3423. -:a3424 :a3424 :a3424. -:a3425 :a3425 :a3425. -:a3426 :a3426 :a3426. -:a3427 :a3427 :a3427. -:a3428 :a3428 :a3428. -:a3429 :a3429 :a3429. -:a3430 :a3430 :a3430. -:a3431 :a3431 :a3431. -:a3432 :a3432 :a3432. -:a3433 :a3433 :a3433. -:a3434 :a3434 :a3434. -:a3435 :a3435 :a3435. -:a3436 :a3436 :a3436. -:a3437 :a3437 :a3437. -:a3438 :a3438 :a3438. -:a3439 :a3439 :a3439. -:a3440 :a3440 :a3440. -:a3441 :a3441 :a3441. -:a3442 :a3442 :a3442. -:a3443 :a3443 :a3443. -:a3444 :a3444 :a3444. -:a3445 :a3445 :a3445. -:a3446 :a3446 :a3446. -:a3447 :a3447 :a3447. -:a3448 :a3448 :a3448. -:a3449 :a3449 :a3449. -:a3450 :a3450 :a3450. -:a3451 :a3451 :a3451. -:a3452 :a3452 :a3452. -:a3453 :a3453 :a3453. -:a3454 :a3454 :a3454. -:a3455 :a3455 :a3455. -:a3456 :a3456 :a3456. -:a3457 :a3457 :a3457. -:a3458 :a3458 :a3458. -:a3459 :a3459 :a3459. -:a3460 :a3460 :a3460. -:a3461 :a3461 :a3461. -:a3462 :a3462 :a3462. -:a3463 :a3463 :a3463. -:a3464 :a3464 :a3464. -:a3465 :a3465 :a3465. -:a3466 :a3466 :a3466. -:a3467 :a3467 :a3467. -:a3468 :a3468 :a3468. -:a3469 :a3469 :a3469. -:a3470 :a3470 :a3470. -:a3471 :a3471 :a3471. -:a3472 :a3472 :a3472. -:a3473 :a3473 :a3473. -:a3474 :a3474 :a3474. -:a3475 :a3475 :a3475. -:a3476 :a3476 :a3476. -:a3477 :a3477 :a3477. -:a3478 :a3478 :a3478. -:a3479 :a3479 :a3479. -:a3480 :a3480 :a3480. -:a3481 :a3481 :a3481. -:a3482 :a3482 :a3482. -:a3483 :a3483 :a3483. -:a3484 :a3484 :a3484. -:a3485 :a3485 :a3485. -:a3486 :a3486 :a3486. -:a3487 :a3487 :a3487. -:a3488 :a3488 :a3488. -:a3489 :a3489 :a3489. -:a3490 :a3490 :a3490. -:a3491 :a3491 :a3491. -:a3492 :a3492 :a3492. -:a3493 :a3493 :a3493. -:a3494 :a3494 :a3494. -:a3495 :a3495 :a3495. -:a3496 :a3496 :a3496. -:a3497 :a3497 :a3497. -:a3498 :a3498 :a3498. -:a3499 :a3499 :a3499. -:a3500 :a3500 :a3500. -:a3501 :a3501 :a3501. -:a3502 :a3502 :a3502. -:a3503 :a3503 :a3503. -:a3504 :a3504 :a3504. -:a3505 :a3505 :a3505. -:a3506 :a3506 :a3506. -:a3507 :a3507 :a3507. -:a3508 :a3508 :a3508. -:a3509 :a3509 :a3509. -:a3510 :a3510 :a3510. -:a3511 :a3511 :a3511. -:a3512 :a3512 :a3512. -:a3513 :a3513 :a3513. -:a3514 :a3514 :a3514. -:a3515 :a3515 :a3515. -:a3516 :a3516 :a3516. -:a3517 :a3517 :a3517. -:a3518 :a3518 :a3518. -:a3519 :a3519 :a3519. -:a3520 :a3520 :a3520. -:a3521 :a3521 :a3521. -:a3522 :a3522 :a3522. -:a3523 :a3523 :a3523. -:a3524 :a3524 :a3524. -:a3525 :a3525 :a3525. -:a3526 :a3526 :a3526. -:a3527 :a3527 :a3527. -:a3528 :a3528 :a3528. -:a3529 :a3529 :a3529. -:a3530 :a3530 :a3530. -:a3531 :a3531 :a3531. -:a3532 :a3532 :a3532. -:a3533 :a3533 :a3533. -:a3534 :a3534 :a3534. -:a3535 :a3535 :a3535. -:a3536 :a3536 :a3536. -:a3537 :a3537 :a3537. -:a3538 :a3538 :a3538. -:a3539 :a3539 :a3539. -:a3540 :a3540 :a3540. -:a3541 :a3541 :a3541. -:a3542 :a3542 :a3542. -:a3543 :a3543 :a3543. -:a3544 :a3544 :a3544. -:a3545 :a3545 :a3545. -:a3546 :a3546 :a3546. -:a3547 :a3547 :a3547. -:a3548 :a3548 :a3548. -:a3549 :a3549 :a3549. -:a3550 :a3550 :a3550. -:a3551 :a3551 :a3551. -:a3552 :a3552 :a3552. -:a3553 :a3553 :a3553. -:a3554 :a3554 :a3554. -:a3555 :a3555 :a3555. -:a3556 :a3556 :a3556. -:a3557 :a3557 :a3557. -:a3558 :a3558 :a3558. -:a3559 :a3559 :a3559. -:a3560 :a3560 :a3560. -:a3561 :a3561 :a3561. -:a3562 :a3562 :a3562. -:a3563 :a3563 :a3563. -:a3564 :a3564 :a3564. -:a3565 :a3565 :a3565. -:a3566 :a3566 :a3566. -:a3567 :a3567 :a3567. -:a3568 :a3568 :a3568. -:a3569 :a3569 :a3569. -:a3570 :a3570 :a3570. -:a3571 :a3571 :a3571. -:a3572 :a3572 :a3572. -:a3573 :a3573 :a3573. -:a3574 :a3574 :a3574. -:a3575 :a3575 :a3575. -:a3576 :a3576 :a3576. -:a3577 :a3577 :a3577. -:a3578 :a3578 :a3578. -:a3579 :a3579 :a3579. -:a3580 :a3580 :a3580. -:a3581 :a3581 :a3581. -:a3582 :a3582 :a3582. -:a3583 :a3583 :a3583. -:a3584 :a3584 :a3584. -:a3585 :a3585 :a3585. -:a3586 :a3586 :a3586. -:a3587 :a3587 :a3587. -:a3588 :a3588 :a3588. -:a3589 :a3589 :a3589. -:a3590 :a3590 :a3590. -:a3591 :a3591 :a3591. -:a3592 :a3592 :a3592. -:a3593 :a3593 :a3593. -:a3594 :a3594 :a3594. -:a3595 :a3595 :a3595. -:a3596 :a3596 :a3596. -:a3597 :a3597 :a3597. -:a3598 :a3598 :a3598. -:a3599 :a3599 :a3599. -:a3600 :a3600 :a3600. -:a3601 :a3601 :a3601. -:a3602 :a3602 :a3602. -:a3603 :a3603 :a3603. -:a3604 :a3604 :a3604. -:a3605 :a3605 :a3605. -:a3606 :a3606 :a3606. -:a3607 :a3607 :a3607. -:a3608 :a3608 :a3608. -:a3609 :a3609 :a3609. -:a3610 :a3610 :a3610. -:a3611 :a3611 :a3611. -:a3612 :a3612 :a3612. -:a3613 :a3613 :a3613. -:a3614 :a3614 :a3614. -:a3615 :a3615 :a3615. -:a3616 :a3616 :a3616. -:a3617 :a3617 :a3617. -:a3618 :a3618 :a3618. -:a3619 :a3619 :a3619. -:a3620 :a3620 :a3620. -:a3621 :a3621 :a3621. -:a3622 :a3622 :a3622. -:a3623 :a3623 :a3623. -:a3624 :a3624 :a3624. -:a3625 :a3625 :a3625. -:a3626 :a3626 :a3626. -:a3627 :a3627 :a3627. -:a3628 :a3628 :a3628. -:a3629 :a3629 :a3629. -:a3630 :a3630 :a3630. -:a3631 :a3631 :a3631. -:a3632 :a3632 :a3632. -:a3633 :a3633 :a3633. -:a3634 :a3634 :a3634. -:a3635 :a3635 :a3635. -:a3636 :a3636 :a3636. -:a3637 :a3637 :a3637. -:a3638 :a3638 :a3638. -:a3639 :a3639 :a3639. -:a3640 :a3640 :a3640. -:a3641 :a3641 :a3641. -:a3642 :a3642 :a3642. -:a3643 :a3643 :a3643. -:a3644 :a3644 :a3644. -:a3645 :a3645 :a3645. -:a3646 :a3646 :a3646. -:a3647 :a3647 :a3647. -:a3648 :a3648 :a3648. -:a3649 :a3649 :a3649. -:a3650 :a3650 :a3650. -:a3651 :a3651 :a3651. -:a3652 :a3652 :a3652. -:a3653 :a3653 :a3653. -:a3654 :a3654 :a3654. -:a3655 :a3655 :a3655. -:a3656 :a3656 :a3656. -:a3657 :a3657 :a3657. -:a3658 :a3658 :a3658. -:a3659 :a3659 :a3659. -:a3660 :a3660 :a3660. -:a3661 :a3661 :a3661. -:a3662 :a3662 :a3662. -:a3663 :a3663 :a3663. -:a3664 :a3664 :a3664. -:a3665 :a3665 :a3665. -:a3666 :a3666 :a3666. -:a3667 :a3667 :a3667. -:a3668 :a3668 :a3668. -:a3669 :a3669 :a3669. -:a3670 :a3670 :a3670. -:a3671 :a3671 :a3671. -:a3672 :a3672 :a3672. -:a3673 :a3673 :a3673. -:a3674 :a3674 :a3674. -:a3675 :a3675 :a3675. -:a3676 :a3676 :a3676. -:a3677 :a3677 :a3677. -:a3678 :a3678 :a3678. -:a3679 :a3679 :a3679. -:a3680 :a3680 :a3680. -:a3681 :a3681 :a3681. -:a3682 :a3682 :a3682. -:a3683 :a3683 :a3683. -:a3684 :a3684 :a3684. -:a3685 :a3685 :a3685. -:a3686 :a3686 :a3686. -:a3687 :a3687 :a3687. -:a3688 :a3688 :a3688. -:a3689 :a3689 :a3689. -:a3690 :a3690 :a3690. -:a3691 :a3691 :a3691. -:a3692 :a3692 :a3692. -:a3693 :a3693 :a3693. -:a3694 :a3694 :a3694. -:a3695 :a3695 :a3695. -:a3696 :a3696 :a3696. -:a3697 :a3697 :a3697. -:a3698 :a3698 :a3698. -:a3699 :a3699 :a3699. -:a3700 :a3700 :a3700. -:a3701 :a3701 :a3701. -:a3702 :a3702 :a3702. -:a3703 :a3703 :a3703. -:a3704 :a3704 :a3704. -:a3705 :a3705 :a3705. -:a3706 :a3706 :a3706. -:a3707 :a3707 :a3707. -:a3708 :a3708 :a3708. -:a3709 :a3709 :a3709. -:a3710 :a3710 :a3710. -:a3711 :a3711 :a3711. -:a3712 :a3712 :a3712. -:a3713 :a3713 :a3713. -:a3714 :a3714 :a3714. -:a3715 :a3715 :a3715. -:a3716 :a3716 :a3716. -:a3717 :a3717 :a3717. -:a3718 :a3718 :a3718. -:a3719 :a3719 :a3719. -:a3720 :a3720 :a3720. -:a3721 :a3721 :a3721. -:a3722 :a3722 :a3722. -:a3723 :a3723 :a3723. -:a3724 :a3724 :a3724. -:a3725 :a3725 :a3725. -:a3726 :a3726 :a3726. -:a3727 :a3727 :a3727. -:a3728 :a3728 :a3728. -:a3729 :a3729 :a3729. -:a3730 :a3730 :a3730. -:a3731 :a3731 :a3731. -:a3732 :a3732 :a3732. -:a3733 :a3733 :a3733. -:a3734 :a3734 :a3734. -:a3735 :a3735 :a3735. -:a3736 :a3736 :a3736. -:a3737 :a3737 :a3737. -:a3738 :a3738 :a3738. -:a3739 :a3739 :a3739. -:a3740 :a3740 :a3740. -:a3741 :a3741 :a3741. -:a3742 :a3742 :a3742. -:a3743 :a3743 :a3743. -:a3744 :a3744 :a3744. -:a3745 :a3745 :a3745. -:a3746 :a3746 :a3746. -:a3747 :a3747 :a3747. -:a3748 :a3748 :a3748. -:a3749 :a3749 :a3749. -:a3750 :a3750 :a3750. -:a3751 :a3751 :a3751. -:a3752 :a3752 :a3752. -:a3753 :a3753 :a3753. -:a3754 :a3754 :a3754. -:a3755 :a3755 :a3755. -:a3756 :a3756 :a3756. -:a3757 :a3757 :a3757. -:a3758 :a3758 :a3758. -:a3759 :a3759 :a3759. -:a3760 :a3760 :a3760. -:a3761 :a3761 :a3761. -:a3762 :a3762 :a3762. -:a3763 :a3763 :a3763. -:a3764 :a3764 :a3764. -:a3765 :a3765 :a3765. -:a3766 :a3766 :a3766. -:a3767 :a3767 :a3767. -:a3768 :a3768 :a3768. -:a3769 :a3769 :a3769. -:a3770 :a3770 :a3770. -:a3771 :a3771 :a3771. -:a3772 :a3772 :a3772. -:a3773 :a3773 :a3773. -:a3774 :a3774 :a3774. -:a3775 :a3775 :a3775. -:a3776 :a3776 :a3776. -:a3777 :a3777 :a3777. -:a3778 :a3778 :a3778. -:a3779 :a3779 :a3779. -:a3780 :a3780 :a3780. -:a3781 :a3781 :a3781. -:a3782 :a3782 :a3782. -:a3783 :a3783 :a3783. -:a3784 :a3784 :a3784. -:a3785 :a3785 :a3785. -:a3786 :a3786 :a3786. -:a3787 :a3787 :a3787. -:a3788 :a3788 :a3788. -:a3789 :a3789 :a3789. -:a3790 :a3790 :a3790. -:a3791 :a3791 :a3791. -:a3792 :a3792 :a3792. -:a3793 :a3793 :a3793. -:a3794 :a3794 :a3794. -:a3795 :a3795 :a3795. -:a3796 :a3796 :a3796. -:a3797 :a3797 :a3797. -:a3798 :a3798 :a3798. -:a3799 :a3799 :a3799. -:a3800 :a3800 :a3800. -:a3801 :a3801 :a3801. -:a3802 :a3802 :a3802. -:a3803 :a3803 :a3803. -:a3804 :a3804 :a3804. -:a3805 :a3805 :a3805. -:a3806 :a3806 :a3806. -:a3807 :a3807 :a3807. -:a3808 :a3808 :a3808. -:a3809 :a3809 :a3809. -:a3810 :a3810 :a3810. -:a3811 :a3811 :a3811. -:a3812 :a3812 :a3812. -:a3813 :a3813 :a3813. -:a3814 :a3814 :a3814. -:a3815 :a3815 :a3815. -:a3816 :a3816 :a3816. -:a3817 :a3817 :a3817. -:a3818 :a3818 :a3818. -:a3819 :a3819 :a3819. -:a3820 :a3820 :a3820. -:a3821 :a3821 :a3821. -:a3822 :a3822 :a3822. -:a3823 :a3823 :a3823. -:a3824 :a3824 :a3824. -:a3825 :a3825 :a3825. -:a3826 :a3826 :a3826. -:a3827 :a3827 :a3827. -:a3828 :a3828 :a3828. -:a3829 :a3829 :a3829. -:a3830 :a3830 :a3830. -:a3831 :a3831 :a3831. -:a3832 :a3832 :a3832. -:a3833 :a3833 :a3833. -:a3834 :a3834 :a3834. -:a3835 :a3835 :a3835. -:a3836 :a3836 :a3836. -:a3837 :a3837 :a3837. -:a3838 :a3838 :a3838. -:a3839 :a3839 :a3839. -:a3840 :a3840 :a3840. -:a3841 :a3841 :a3841. -:a3842 :a3842 :a3842. -:a3843 :a3843 :a3843. -:a3844 :a3844 :a3844. -:a3845 :a3845 :a3845. -:a3846 :a3846 :a3846. -:a3847 :a3847 :a3847. -:a3848 :a3848 :a3848. -:a3849 :a3849 :a3849. -:a3850 :a3850 :a3850. -:a3851 :a3851 :a3851. -:a3852 :a3852 :a3852. -:a3853 :a3853 :a3853. -:a3854 :a3854 :a3854. -:a3855 :a3855 :a3855. -:a3856 :a3856 :a3856. -:a3857 :a3857 :a3857. -:a3858 :a3858 :a3858. -:a3859 :a3859 :a3859. -:a3860 :a3860 :a3860. -:a3861 :a3861 :a3861. -:a3862 :a3862 :a3862. -:a3863 :a3863 :a3863. -:a3864 :a3864 :a3864. -:a3865 :a3865 :a3865. -:a3866 :a3866 :a3866. -:a3867 :a3867 :a3867. -:a3868 :a3868 :a3868. -:a3869 :a3869 :a3869. -:a3870 :a3870 :a3870. -:a3871 :a3871 :a3871. -:a3872 :a3872 :a3872. -:a3873 :a3873 :a3873. -:a3874 :a3874 :a3874. -:a3875 :a3875 :a3875. -:a3876 :a3876 :a3876. -:a3877 :a3877 :a3877. -:a3878 :a3878 :a3878. -:a3879 :a3879 :a3879. -:a3880 :a3880 :a3880. -:a3881 :a3881 :a3881. -:a3882 :a3882 :a3882. -:a3883 :a3883 :a3883. -:a3884 :a3884 :a3884. -:a3885 :a3885 :a3885. -:a3886 :a3886 :a3886. -:a3887 :a3887 :a3887. -:a3888 :a3888 :a3888. -:a3889 :a3889 :a3889. -:a3890 :a3890 :a3890. -:a3891 :a3891 :a3891. -:a3892 :a3892 :a3892. -:a3893 :a3893 :a3893. -:a3894 :a3894 :a3894. -:a3895 :a3895 :a3895. -:a3896 :a3896 :a3896. -:a3897 :a3897 :a3897. -:a3898 :a3898 :a3898. -:a3899 :a3899 :a3899. -:a3900 :a3900 :a3900. -:a3901 :a3901 :a3901. -:a3902 :a3902 :a3902. -:a3903 :a3903 :a3903. -:a3904 :a3904 :a3904. -:a3905 :a3905 :a3905. -:a3906 :a3906 :a3906. -:a3907 :a3907 :a3907. -:a3908 :a3908 :a3908. -:a3909 :a3909 :a3909. -:a3910 :a3910 :a3910. -:a3911 :a3911 :a3911. -:a3912 :a3912 :a3912. -:a3913 :a3913 :a3913. -:a3914 :a3914 :a3914. -:a3915 :a3915 :a3915. -:a3916 :a3916 :a3916. -:a3917 :a3917 :a3917. -:a3918 :a3918 :a3918. -:a3919 :a3919 :a3919. -:a3920 :a3920 :a3920. -:a3921 :a3921 :a3921. -:a3922 :a3922 :a3922. -:a3923 :a3923 :a3923. -:a3924 :a3924 :a3924. -:a3925 :a3925 :a3925. -:a3926 :a3926 :a3926. -:a3927 :a3927 :a3927. -:a3928 :a3928 :a3928. -:a3929 :a3929 :a3929. -:a3930 :a3930 :a3930. -:a3931 :a3931 :a3931. -:a3932 :a3932 :a3932. -:a3933 :a3933 :a3933. -:a3934 :a3934 :a3934. -:a3935 :a3935 :a3935. -:a3936 :a3936 :a3936. -:a3937 :a3937 :a3937. -:a3938 :a3938 :a3938. -:a3939 :a3939 :a3939. -:a3940 :a3940 :a3940. -:a3941 :a3941 :a3941. -:a3942 :a3942 :a3942. -:a3943 :a3943 :a3943. -:a3944 :a3944 :a3944. -:a3945 :a3945 :a3945. -:a3946 :a3946 :a3946. -:a3947 :a3947 :a3947. -:a3948 :a3948 :a3948. -:a3949 :a3949 :a3949. -:a3950 :a3950 :a3950. -:a3951 :a3951 :a3951. -:a3952 :a3952 :a3952. -:a3953 :a3953 :a3953. -:a3954 :a3954 :a3954. -:a3955 :a3955 :a3955. -:a3956 :a3956 :a3956. -:a3957 :a3957 :a3957. -:a3958 :a3958 :a3958. -:a3959 :a3959 :a3959. -:a3960 :a3960 :a3960. -:a3961 :a3961 :a3961. -:a3962 :a3962 :a3962. -:a3963 :a3963 :a3963. -:a3964 :a3964 :a3964. -:a3965 :a3965 :a3965. -:a3966 :a3966 :a3966. -:a3967 :a3967 :a3967. -:a3968 :a3968 :a3968. -:a3969 :a3969 :a3969. -:a3970 :a3970 :a3970. -:a3971 :a3971 :a3971. -:a3972 :a3972 :a3972. -:a3973 :a3973 :a3973. -:a3974 :a3974 :a3974. -:a3975 :a3975 :a3975. -:a3976 :a3976 :a3976. -:a3977 :a3977 :a3977. -:a3978 :a3978 :a3978. -:a3979 :a3979 :a3979. -:a3980 :a3980 :a3980. -:a3981 :a3981 :a3981. -:a3982 :a3982 :a3982. -:a3983 :a3983 :a3983. -:a3984 :a3984 :a3984. -:a3985 :a3985 :a3985. -:a3986 :a3986 :a3986. -:a3987 :a3987 :a3987. -:a3988 :a3988 :a3988. -:a3989 :a3989 :a3989. -:a3990 :a3990 :a3990. -:a3991 :a3991 :a3991. -:a3992 :a3992 :a3992. -:a3993 :a3993 :a3993. -:a3994 :a3994 :a3994. -:a3995 :a3995 :a3995. -:a3996 :a3996 :a3996. -:a3997 :a3997 :a3997. -:a3998 :a3998 :a3998. -:a3999 :a3999 :a3999. -:a4000 :a4000 :a4000. -:a4001 :a4001 :a4001. -:a4002 :a4002 :a4002. -:a4003 :a4003 :a4003. -:a4004 :a4004 :a4004. -:a4005 :a4005 :a4005. -:a4006 :a4006 :a4006. -:a4007 :a4007 :a4007. -:a4008 :a4008 :a4008. -:a4009 :a4009 :a4009. -:a4010 :a4010 :a4010. -:a4011 :a4011 :a4011. -:a4012 :a4012 :a4012. -:a4013 :a4013 :a4013. -:a4014 :a4014 :a4014. -:a4015 :a4015 :a4015. -:a4016 :a4016 :a4016. -:a4017 :a4017 :a4017. -:a4018 :a4018 :a4018. -:a4019 :a4019 :a4019. -:a4020 :a4020 :a4020. -:a4021 :a4021 :a4021. -:a4022 :a4022 :a4022. -:a4023 :a4023 :a4023. -:a4024 :a4024 :a4024. -:a4025 :a4025 :a4025. -:a4026 :a4026 :a4026. -:a4027 :a4027 :a4027. -:a4028 :a4028 :a4028. -:a4029 :a4029 :a4029. -:a4030 :a4030 :a4030. -:a4031 :a4031 :a4031. -:a4032 :a4032 :a4032. -:a4033 :a4033 :a4033. -:a4034 :a4034 :a4034. -:a4035 :a4035 :a4035. -:a4036 :a4036 :a4036. -:a4037 :a4037 :a4037. -:a4038 :a4038 :a4038. -:a4039 :a4039 :a4039. -:a4040 :a4040 :a4040. -:a4041 :a4041 :a4041. -:a4042 :a4042 :a4042. -:a4043 :a4043 :a4043. -:a4044 :a4044 :a4044. -:a4045 :a4045 :a4045. -:a4046 :a4046 :a4046. -:a4047 :a4047 :a4047. -:a4048 :a4048 :a4048. -:a4049 :a4049 :a4049. -:a4050 :a4050 :a4050. -:a4051 :a4051 :a4051. -:a4052 :a4052 :a4052. -:a4053 :a4053 :a4053. -:a4054 :a4054 :a4054. -:a4055 :a4055 :a4055. -:a4056 :a4056 :a4056. -:a4057 :a4057 :a4057. -:a4058 :a4058 :a4058. -:a4059 :a4059 :a4059. -:a4060 :a4060 :a4060. -:a4061 :a4061 :a4061. -:a4062 :a4062 :a4062. -:a4063 :a4063 :a4063. -:a4064 :a4064 :a4064. -:a4065 :a4065 :a4065. -:a4066 :a4066 :a4066. -:a4067 :a4067 :a4067. -:a4068 :a4068 :a4068. -:a4069 :a4069 :a4069. -:a4070 :a4070 :a4070. -:a4071 :a4071 :a4071. -:a4072 :a4072 :a4072. -:a4073 :a4073 :a4073. -:a4074 :a4074 :a4074. -:a4075 :a4075 :a4075. -:a4076 :a4076 :a4076. -:a4077 :a4077 :a4077. -:a4078 :a4078 :a4078. -:a4079 :a4079 :a4079. -:a4080 :a4080 :a4080. -:a4081 :a4081 :a4081. -:a4082 :a4082 :a4082. -:a4083 :a4083 :a4083. -:a4084 :a4084 :a4084. -:a4085 :a4085 :a4085. -:a4086 :a4086 :a4086. -:a4087 :a4087 :a4087. -:a4088 :a4088 :a4088. -:a4089 :a4089 :a4089. -:a4090 :a4090 :a4090. -:a4091 :a4091 :a4091. -:a4092 :a4092 :a4092. -:a4093 :a4093 :a4093. -:a4094 :a4094 :a4094. -:a4095 :a4095 :a4095. -:a4096 :a4096 :a4096. -:a4097 :a4097 :a4097. -:a4098 :a4098 :a4098. -:a4099 :a4099 :a4099. -:a4100 :a4100 :a4100. -:a4101 :a4101 :a4101. -:a4102 :a4102 :a4102. -:a4103 :a4103 :a4103. -:a4104 :a4104 :a4104. -:a4105 :a4105 :a4105. -:a4106 :a4106 :a4106. -:a4107 :a4107 :a4107. -:a4108 :a4108 :a4108. -:a4109 :a4109 :a4109. -:a4110 :a4110 :a4110. -:a4111 :a4111 :a4111. -:a4112 :a4112 :a4112. -:a4113 :a4113 :a4113. -:a4114 :a4114 :a4114. -:a4115 :a4115 :a4115. -:a4116 :a4116 :a4116. -:a4117 :a4117 :a4117. -:a4118 :a4118 :a4118. -:a4119 :a4119 :a4119. -:a4120 :a4120 :a4120. -:a4121 :a4121 :a4121. -:a4122 :a4122 :a4122. -:a4123 :a4123 :a4123. -:a4124 :a4124 :a4124. -:a4125 :a4125 :a4125. -:a4126 :a4126 :a4126. -:a4127 :a4127 :a4127. -:a4128 :a4128 :a4128. -:a4129 :a4129 :a4129. -:a4130 :a4130 :a4130. -:a4131 :a4131 :a4131. -:a4132 :a4132 :a4132. -:a4133 :a4133 :a4133. -:a4134 :a4134 :a4134. -:a4135 :a4135 :a4135. -:a4136 :a4136 :a4136. -:a4137 :a4137 :a4137. -:a4138 :a4138 :a4138. -:a4139 :a4139 :a4139. -:a4140 :a4140 :a4140. -:a4141 :a4141 :a4141. -:a4142 :a4142 :a4142. -:a4143 :a4143 :a4143. -:a4144 :a4144 :a4144. -:a4145 :a4145 :a4145. -:a4146 :a4146 :a4146. -:a4147 :a4147 :a4147. -:a4148 :a4148 :a4148. -:a4149 :a4149 :a4149. -:a4150 :a4150 :a4150. -:a4151 :a4151 :a4151. -:a4152 :a4152 :a4152. -:a4153 :a4153 :a4153. -:a4154 :a4154 :a4154. -:a4155 :a4155 :a4155. -:a4156 :a4156 :a4156. -:a4157 :a4157 :a4157. -:a4158 :a4158 :a4158. -:a4159 :a4159 :a4159. -:a4160 :a4160 :a4160. -:a4161 :a4161 :a4161. -:a4162 :a4162 :a4162. -:a4163 :a4163 :a4163. -:a4164 :a4164 :a4164. -:a4165 :a4165 :a4165. -:a4166 :a4166 :a4166. -:a4167 :a4167 :a4167. -:a4168 :a4168 :a4168. -:a4169 :a4169 :a4169. -:a4170 :a4170 :a4170. -:a4171 :a4171 :a4171. -:a4172 :a4172 :a4172. -:a4173 :a4173 :a4173. -:a4174 :a4174 :a4174. -:a4175 :a4175 :a4175. -:a4176 :a4176 :a4176. -:a4177 :a4177 :a4177. -:a4178 :a4178 :a4178. -:a4179 :a4179 :a4179. -:a4180 :a4180 :a4180. -:a4181 :a4181 :a4181. -:a4182 :a4182 :a4182. -:a4183 :a4183 :a4183. -:a4184 :a4184 :a4184. -:a4185 :a4185 :a4185. -:a4186 :a4186 :a4186. -:a4187 :a4187 :a4187. -:a4188 :a4188 :a4188. -:a4189 :a4189 :a4189. -:a4190 :a4190 :a4190. -:a4191 :a4191 :a4191. -:a4192 :a4192 :a4192. -:a4193 :a4193 :a4193. -:a4194 :a4194 :a4194. -:a4195 :a4195 :a4195. -:a4196 :a4196 :a4196. -:a4197 :a4197 :a4197. -:a4198 :a4198 :a4198. -:a4199 :a4199 :a4199. -:a4200 :a4200 :a4200. -:a4201 :a4201 :a4201. -:a4202 :a4202 :a4202. -:a4203 :a4203 :a4203. -:a4204 :a4204 :a4204. -:a4205 :a4205 :a4205. -:a4206 :a4206 :a4206. -:a4207 :a4207 :a4207. -:a4208 :a4208 :a4208. -:a4209 :a4209 :a4209. -:a4210 :a4210 :a4210. -:a4211 :a4211 :a4211. -:a4212 :a4212 :a4212. -:a4213 :a4213 :a4213. -:a4214 :a4214 :a4214. -:a4215 :a4215 :a4215. -:a4216 :a4216 :a4216. -:a4217 :a4217 :a4217. -:a4218 :a4218 :a4218. -:a4219 :a4219 :a4219. -:a4220 :a4220 :a4220. -:a4221 :a4221 :a4221. -:a4222 :a4222 :a4222. -:a4223 :a4223 :a4223. -:a4224 :a4224 :a4224. -:a4225 :a4225 :a4225. -:a4226 :a4226 :a4226. -:a4227 :a4227 :a4227. -:a4228 :a4228 :a4228. -:a4229 :a4229 :a4229. -:a4230 :a4230 :a4230. -:a4231 :a4231 :a4231. -:a4232 :a4232 :a4232. -:a4233 :a4233 :a4233. -:a4234 :a4234 :a4234. -:a4235 :a4235 :a4235. -:a4236 :a4236 :a4236. -:a4237 :a4237 :a4237. -:a4238 :a4238 :a4238. -:a4239 :a4239 :a4239. -:a4240 :a4240 :a4240. -:a4241 :a4241 :a4241. -:a4242 :a4242 :a4242. -:a4243 :a4243 :a4243. -:a4244 :a4244 :a4244. -:a4245 :a4245 :a4245. -:a4246 :a4246 :a4246. -:a4247 :a4247 :a4247. -:a4248 :a4248 :a4248. -:a4249 :a4249 :a4249. -:a4250 :a4250 :a4250. -:a4251 :a4251 :a4251. -:a4252 :a4252 :a4252. -:a4253 :a4253 :a4253. -:a4254 :a4254 :a4254. -:a4255 :a4255 :a4255. -:a4256 :a4256 :a4256. -:a4257 :a4257 :a4257. -:a4258 :a4258 :a4258. -:a4259 :a4259 :a4259. -:a4260 :a4260 :a4260. -:a4261 :a4261 :a4261. -:a4262 :a4262 :a4262. -:a4263 :a4263 :a4263. -:a4264 :a4264 :a4264. -:a4265 :a4265 :a4265. -:a4266 :a4266 :a4266. -:a4267 :a4267 :a4267. -:a4268 :a4268 :a4268. -:a4269 :a4269 :a4269. -:a4270 :a4270 :a4270. -:a4271 :a4271 :a4271. -:a4272 :a4272 :a4272. -:a4273 :a4273 :a4273. -:a4274 :a4274 :a4274. -:a4275 :a4275 :a4275. -:a4276 :a4276 :a4276. -:a4277 :a4277 :a4277. -:a4278 :a4278 :a4278. -:a4279 :a4279 :a4279. -:a4280 :a4280 :a4280. -:a4281 :a4281 :a4281. -:a4282 :a4282 :a4282. -:a4283 :a4283 :a4283. -:a4284 :a4284 :a4284. -:a4285 :a4285 :a4285. -:a4286 :a4286 :a4286. -:a4287 :a4287 :a4287. -:a4288 :a4288 :a4288. -:a4289 :a4289 :a4289. -:a4290 :a4290 :a4290. -:a4291 :a4291 :a4291. -:a4292 :a4292 :a4292. -:a4293 :a4293 :a4293. -:a4294 :a4294 :a4294. -:a4295 :a4295 :a4295. -:a4296 :a4296 :a4296. -:a4297 :a4297 :a4297. -:a4298 :a4298 :a4298. -:a4299 :a4299 :a4299. -:a4300 :a4300 :a4300. -:a4301 :a4301 :a4301. -:a4302 :a4302 :a4302. -:a4303 :a4303 :a4303. -:a4304 :a4304 :a4304. -:a4305 :a4305 :a4305. -:a4306 :a4306 :a4306. -:a4307 :a4307 :a4307. -:a4308 :a4308 :a4308. -:a4309 :a4309 :a4309. -:a4310 :a4310 :a4310. -:a4311 :a4311 :a4311. -:a4312 :a4312 :a4312. -:a4313 :a4313 :a4313. -:a4314 :a4314 :a4314. -:a4315 :a4315 :a4315. -:a4316 :a4316 :a4316. -:a4317 :a4317 :a4317. -:a4318 :a4318 :a4318. -:a4319 :a4319 :a4319. -:a4320 :a4320 :a4320. -:a4321 :a4321 :a4321. -:a4322 :a4322 :a4322. -:a4323 :a4323 :a4323. -:a4324 :a4324 :a4324. -:a4325 :a4325 :a4325. -:a4326 :a4326 :a4326. -:a4327 :a4327 :a4327. -:a4328 :a4328 :a4328. -:a4329 :a4329 :a4329. -:a4330 :a4330 :a4330. -:a4331 :a4331 :a4331. -:a4332 :a4332 :a4332. -:a4333 :a4333 :a4333. -:a4334 :a4334 :a4334. -:a4335 :a4335 :a4335. -:a4336 :a4336 :a4336. -:a4337 :a4337 :a4337. -:a4338 :a4338 :a4338. -:a4339 :a4339 :a4339. -:a4340 :a4340 :a4340. -:a4341 :a4341 :a4341. -:a4342 :a4342 :a4342. -:a4343 :a4343 :a4343. -:a4344 :a4344 :a4344. -:a4345 :a4345 :a4345. -:a4346 :a4346 :a4346. -:a4347 :a4347 :a4347. -:a4348 :a4348 :a4348. -:a4349 :a4349 :a4349. -:a4350 :a4350 :a4350. -:a4351 :a4351 :a4351. -:a4352 :a4352 :a4352. -:a4353 :a4353 :a4353. -:a4354 :a4354 :a4354. -:a4355 :a4355 :a4355. -:a4356 :a4356 :a4356. -:a4357 :a4357 :a4357. -:a4358 :a4358 :a4358. -:a4359 :a4359 :a4359. -:a4360 :a4360 :a4360. -:a4361 :a4361 :a4361. -:a4362 :a4362 :a4362. -:a4363 :a4363 :a4363. -:a4364 :a4364 :a4364. -:a4365 :a4365 :a4365. -:a4366 :a4366 :a4366. -:a4367 :a4367 :a4367. -:a4368 :a4368 :a4368. -:a4369 :a4369 :a4369. -:a4370 :a4370 :a4370. -:a4371 :a4371 :a4371. -:a4372 :a4372 :a4372. -:a4373 :a4373 :a4373. -:a4374 :a4374 :a4374. -:a4375 :a4375 :a4375. -:a4376 :a4376 :a4376. -:a4377 :a4377 :a4377. -:a4378 :a4378 :a4378. -:a4379 :a4379 :a4379. -:a4380 :a4380 :a4380. -:a4381 :a4381 :a4381. -:a4382 :a4382 :a4382. -:a4383 :a4383 :a4383. -:a4384 :a4384 :a4384. -:a4385 :a4385 :a4385. -:a4386 :a4386 :a4386. -:a4387 :a4387 :a4387. -:a4388 :a4388 :a4388. -:a4389 :a4389 :a4389. -:a4390 :a4390 :a4390. -:a4391 :a4391 :a4391. -:a4392 :a4392 :a4392. -:a4393 :a4393 :a4393. -:a4394 :a4394 :a4394. -:a4395 :a4395 :a4395. -:a4396 :a4396 :a4396. -:a4397 :a4397 :a4397. -:a4398 :a4398 :a4398. -:a4399 :a4399 :a4399. -:a4400 :a4400 :a4400. -:a4401 :a4401 :a4401. -:a4402 :a4402 :a4402. -:a4403 :a4403 :a4403. -:a4404 :a4404 :a4404. -:a4405 :a4405 :a4405. -:a4406 :a4406 :a4406. -:a4407 :a4407 :a4407. -:a4408 :a4408 :a4408. -:a4409 :a4409 :a4409. -:a4410 :a4410 :a4410. -:a4411 :a4411 :a4411. -:a4412 :a4412 :a4412. -:a4413 :a4413 :a4413. -:a4414 :a4414 :a4414. -:a4415 :a4415 :a4415. -:a4416 :a4416 :a4416. -:a4417 :a4417 :a4417. -:a4418 :a4418 :a4418. -:a4419 :a4419 :a4419. -:a4420 :a4420 :a4420. -:a4421 :a4421 :a4421. -:a4422 :a4422 :a4422. -:a4423 :a4423 :a4423. -:a4424 :a4424 :a4424. -:a4425 :a4425 :a4425. -:a4426 :a4426 :a4426. -:a4427 :a4427 :a4427. -:a4428 :a4428 :a4428. -:a4429 :a4429 :a4429. -:a4430 :a4430 :a4430. -:a4431 :a4431 :a4431. -:a4432 :a4432 :a4432. -:a4433 :a4433 :a4433. -:a4434 :a4434 :a4434. -:a4435 :a4435 :a4435. -:a4436 :a4436 :a4436. -:a4437 :a4437 :a4437. -:a4438 :a4438 :a4438. -:a4439 :a4439 :a4439. -:a4440 :a4440 :a4440. -:a4441 :a4441 :a4441. -:a4442 :a4442 :a4442. -:a4443 :a4443 :a4443. -:a4444 :a4444 :a4444. -:a4445 :a4445 :a4445. -:a4446 :a4446 :a4446. -:a4447 :a4447 :a4447. -:a4448 :a4448 :a4448. -:a4449 :a4449 :a4449. -:a4450 :a4450 :a4450. -:a4451 :a4451 :a4451. -:a4452 :a4452 :a4452. -:a4453 :a4453 :a4453. -:a4454 :a4454 :a4454. -:a4455 :a4455 :a4455. -:a4456 :a4456 :a4456. -:a4457 :a4457 :a4457. -:a4458 :a4458 :a4458. -:a4459 :a4459 :a4459. -:a4460 :a4460 :a4460. -:a4461 :a4461 :a4461. -:a4462 :a4462 :a4462. -:a4463 :a4463 :a4463. -:a4464 :a4464 :a4464. -:a4465 :a4465 :a4465. -:a4466 :a4466 :a4466. -:a4467 :a4467 :a4467. -:a4468 :a4468 :a4468. -:a4469 :a4469 :a4469. -:a4470 :a4470 :a4470. -:a4471 :a4471 :a4471. -:a4472 :a4472 :a4472. -:a4473 :a4473 :a4473. -:a4474 :a4474 :a4474. -:a4475 :a4475 :a4475. -:a4476 :a4476 :a4476. -:a4477 :a4477 :a4477. -:a4478 :a4478 :a4478. -:a4479 :a4479 :a4479. -:a4480 :a4480 :a4480. -:a4481 :a4481 :a4481. -:a4482 :a4482 :a4482. -:a4483 :a4483 :a4483. -:a4484 :a4484 :a4484. -:a4485 :a4485 :a4485. -:a4486 :a4486 :a4486. -:a4487 :a4487 :a4487. -:a4488 :a4488 :a4488. -:a4489 :a4489 :a4489. -:a4490 :a4490 :a4490. -:a4491 :a4491 :a4491. -:a4492 :a4492 :a4492. -:a4493 :a4493 :a4493. -:a4494 :a4494 :a4494. -:a4495 :a4495 :a4495. -:a4496 :a4496 :a4496. -:a4497 :a4497 :a4497. -:a4498 :a4498 :a4498. -:a4499 :a4499 :a4499. -:a4500 :a4500 :a4500. -:a4501 :a4501 :a4501. -:a4502 :a4502 :a4502. -:a4503 :a4503 :a4503. -:a4504 :a4504 :a4504. -:a4505 :a4505 :a4505. -:a4506 :a4506 :a4506. -:a4507 :a4507 :a4507. -:a4508 :a4508 :a4508. -:a4509 :a4509 :a4509. -:a4510 :a4510 :a4510. -:a4511 :a4511 :a4511. -:a4512 :a4512 :a4512. -:a4513 :a4513 :a4513. -:a4514 :a4514 :a4514. -:a4515 :a4515 :a4515. -:a4516 :a4516 :a4516. -:a4517 :a4517 :a4517. -:a4518 :a4518 :a4518. -:a4519 :a4519 :a4519. -:a4520 :a4520 :a4520. -:a4521 :a4521 :a4521. -:a4522 :a4522 :a4522. -:a4523 :a4523 :a4523. -:a4524 :a4524 :a4524. -:a4525 :a4525 :a4525. -:a4526 :a4526 :a4526. -:a4527 :a4527 :a4527. -:a4528 :a4528 :a4528. -:a4529 :a4529 :a4529. -:a4530 :a4530 :a4530. -:a4531 :a4531 :a4531. -:a4532 :a4532 :a4532. -:a4533 :a4533 :a4533. -:a4534 :a4534 :a4534. -:a4535 :a4535 :a4535. -:a4536 :a4536 :a4536. -:a4537 :a4537 :a4537. -:a4538 :a4538 :a4538. -:a4539 :a4539 :a4539. -:a4540 :a4540 :a4540. -:a4541 :a4541 :a4541. -:a4542 :a4542 :a4542. -:a4543 :a4543 :a4543. -:a4544 :a4544 :a4544. -:a4545 :a4545 :a4545. -:a4546 :a4546 :a4546. -:a4547 :a4547 :a4547. -:a4548 :a4548 :a4548. -:a4549 :a4549 :a4549. -:a4550 :a4550 :a4550. -:a4551 :a4551 :a4551. -:a4552 :a4552 :a4552. -:a4553 :a4553 :a4553. -:a4554 :a4554 :a4554. -:a4555 :a4555 :a4555. -:a4556 :a4556 :a4556. -:a4557 :a4557 :a4557. -:a4558 :a4558 :a4558. -:a4559 :a4559 :a4559. -:a4560 :a4560 :a4560. -:a4561 :a4561 :a4561. -:a4562 :a4562 :a4562. -:a4563 :a4563 :a4563. -:a4564 :a4564 :a4564. -:a4565 :a4565 :a4565. -:a4566 :a4566 :a4566. -:a4567 :a4567 :a4567. -:a4568 :a4568 :a4568. -:a4569 :a4569 :a4569. -:a4570 :a4570 :a4570. -:a4571 :a4571 :a4571. -:a4572 :a4572 :a4572. -:a4573 :a4573 :a4573. -:a4574 :a4574 :a4574. -:a4575 :a4575 :a4575. -:a4576 :a4576 :a4576. -:a4577 :a4577 :a4577. -:a4578 :a4578 :a4578. -:a4579 :a4579 :a4579. -:a4580 :a4580 :a4580. -:a4581 :a4581 :a4581. -:a4582 :a4582 :a4582. -:a4583 :a4583 :a4583. -:a4584 :a4584 :a4584. -:a4585 :a4585 :a4585. -:a4586 :a4586 :a4586. -:a4587 :a4587 :a4587. -:a4588 :a4588 :a4588. -:a4589 :a4589 :a4589. -:a4590 :a4590 :a4590. -:a4591 :a4591 :a4591. -:a4592 :a4592 :a4592. -:a4593 :a4593 :a4593. -:a4594 :a4594 :a4594. -:a4595 :a4595 :a4595. -:a4596 :a4596 :a4596. -:a4597 :a4597 :a4597. -:a4598 :a4598 :a4598. -:a4599 :a4599 :a4599. -:a4600 :a4600 :a4600. -:a4601 :a4601 :a4601. -:a4602 :a4602 :a4602. -:a4603 :a4603 :a4603. -:a4604 :a4604 :a4604. -:a4605 :a4605 :a4605. -:a4606 :a4606 :a4606. -:a4607 :a4607 :a4607. -:a4608 :a4608 :a4608. -:a4609 :a4609 :a4609. -:a4610 :a4610 :a4610. -:a4611 :a4611 :a4611. -:a4612 :a4612 :a4612. -:a4613 :a4613 :a4613. -:a4614 :a4614 :a4614. -:a4615 :a4615 :a4615. -:a4616 :a4616 :a4616. -:a4617 :a4617 :a4617. -:a4618 :a4618 :a4618. -:a4619 :a4619 :a4619. -:a4620 :a4620 :a4620. -:a4621 :a4621 :a4621. -:a4622 :a4622 :a4622. -:a4623 :a4623 :a4623. -:a4624 :a4624 :a4624. -:a4625 :a4625 :a4625. -:a4626 :a4626 :a4626. -:a4627 :a4627 :a4627. -:a4628 :a4628 :a4628. -:a4629 :a4629 :a4629. -:a4630 :a4630 :a4630. -:a4631 :a4631 :a4631. -:a4632 :a4632 :a4632. -:a4633 :a4633 :a4633. -:a4634 :a4634 :a4634. -:a4635 :a4635 :a4635. -:a4636 :a4636 :a4636. -:a4637 :a4637 :a4637. -:a4638 :a4638 :a4638. -:a4639 :a4639 :a4639. -:a4640 :a4640 :a4640. -:a4641 :a4641 :a4641. -:a4642 :a4642 :a4642. -:a4643 :a4643 :a4643. -:a4644 :a4644 :a4644. -:a4645 :a4645 :a4645. -:a4646 :a4646 :a4646. -:a4647 :a4647 :a4647. -:a4648 :a4648 :a4648. -:a4649 :a4649 :a4649. -:a4650 :a4650 :a4650. -:a4651 :a4651 :a4651. -:a4652 :a4652 :a4652. -:a4653 :a4653 :a4653. -:a4654 :a4654 :a4654. -:a4655 :a4655 :a4655. -:a4656 :a4656 :a4656. -:a4657 :a4657 :a4657. -:a4658 :a4658 :a4658. -:a4659 :a4659 :a4659. -:a4660 :a4660 :a4660. -:a4661 :a4661 :a4661. -:a4662 :a4662 :a4662. -:a4663 :a4663 :a4663. -:a4664 :a4664 :a4664. -:a4665 :a4665 :a4665. -:a4666 :a4666 :a4666. -:a4667 :a4667 :a4667. -:a4668 :a4668 :a4668. -:a4669 :a4669 :a4669. -:a4670 :a4670 :a4670. -:a4671 :a4671 :a4671. -:a4672 :a4672 :a4672. -:a4673 :a4673 :a4673. -:a4674 :a4674 :a4674. -:a4675 :a4675 :a4675. -:a4676 :a4676 :a4676. -:a4677 :a4677 :a4677. -:a4678 :a4678 :a4678. -:a4679 :a4679 :a4679. -:a4680 :a4680 :a4680. -:a4681 :a4681 :a4681. -:a4682 :a4682 :a4682. -:a4683 :a4683 :a4683. -:a4684 :a4684 :a4684. -:a4685 :a4685 :a4685. -:a4686 :a4686 :a4686. -:a4687 :a4687 :a4687. -:a4688 :a4688 :a4688. -:a4689 :a4689 :a4689. -:a4690 :a4690 :a4690. -:a4691 :a4691 :a4691. -:a4692 :a4692 :a4692. -:a4693 :a4693 :a4693. -:a4694 :a4694 :a4694. -:a4695 :a4695 :a4695. -:a4696 :a4696 :a4696. -:a4697 :a4697 :a4697. -:a4698 :a4698 :a4698. -:a4699 :a4699 :a4699. -:a4700 :a4700 :a4700. -:a4701 :a4701 :a4701. -:a4702 :a4702 :a4702. -:a4703 :a4703 :a4703. -:a4704 :a4704 :a4704. -:a4705 :a4705 :a4705. -:a4706 :a4706 :a4706. -:a4707 :a4707 :a4707. -:a4708 :a4708 :a4708. -:a4709 :a4709 :a4709. -:a4710 :a4710 :a4710. -:a4711 :a4711 :a4711. -:a4712 :a4712 :a4712. -:a4713 :a4713 :a4713. -:a4714 :a4714 :a4714. -:a4715 :a4715 :a4715. -:a4716 :a4716 :a4716. -:a4717 :a4717 :a4717. -:a4718 :a4718 :a4718. -:a4719 :a4719 :a4719. -:a4720 :a4720 :a4720. -:a4721 :a4721 :a4721. -:a4722 :a4722 :a4722. -:a4723 :a4723 :a4723. -:a4724 :a4724 :a4724. -:a4725 :a4725 :a4725. -:a4726 :a4726 :a4726. -:a4727 :a4727 :a4727. -:a4728 :a4728 :a4728. -:a4729 :a4729 :a4729. -:a4730 :a4730 :a4730. -:a4731 :a4731 :a4731. -:a4732 :a4732 :a4732. -:a4733 :a4733 :a4733. -:a4734 :a4734 :a4734. -:a4735 :a4735 :a4735. -:a4736 :a4736 :a4736. -:a4737 :a4737 :a4737. -:a4738 :a4738 :a4738. -:a4739 :a4739 :a4739. -:a4740 :a4740 :a4740. -:a4741 :a4741 :a4741. -:a4742 :a4742 :a4742. -:a4743 :a4743 :a4743. -:a4744 :a4744 :a4744. -:a4745 :a4745 :a4745. -:a4746 :a4746 :a4746. -:a4747 :a4747 :a4747. -:a4748 :a4748 :a4748. -:a4749 :a4749 :a4749. -:a4750 :a4750 :a4750. -:a4751 :a4751 :a4751. -:a4752 :a4752 :a4752. -:a4753 :a4753 :a4753. -:a4754 :a4754 :a4754. -:a4755 :a4755 :a4755. -:a4756 :a4756 :a4756. -:a4757 :a4757 :a4757. -:a4758 :a4758 :a4758. -:a4759 :a4759 :a4759. -:a4760 :a4760 :a4760. -:a4761 :a4761 :a4761. -:a4762 :a4762 :a4762. -:a4763 :a4763 :a4763. -:a4764 :a4764 :a4764. -:a4765 :a4765 :a4765. -:a4766 :a4766 :a4766. -:a4767 :a4767 :a4767. -:a4768 :a4768 :a4768. -:a4769 :a4769 :a4769. -:a4770 :a4770 :a4770. -:a4771 :a4771 :a4771. -:a4772 :a4772 :a4772. -:a4773 :a4773 :a4773. -:a4774 :a4774 :a4774. -:a4775 :a4775 :a4775. -:a4776 :a4776 :a4776. -:a4777 :a4777 :a4777. -:a4778 :a4778 :a4778. -:a4779 :a4779 :a4779. -:a4780 :a4780 :a4780. -:a4781 :a4781 :a4781. -:a4782 :a4782 :a4782. -:a4783 :a4783 :a4783. -:a4784 :a4784 :a4784. -:a4785 :a4785 :a4785. -:a4786 :a4786 :a4786. -:a4787 :a4787 :a4787. -:a4788 :a4788 :a4788. -:a4789 :a4789 :a4789. -:a4790 :a4790 :a4790. -:a4791 :a4791 :a4791. -:a4792 :a4792 :a4792. -:a4793 :a4793 :a4793. -:a4794 :a4794 :a4794. -:a4795 :a4795 :a4795. -:a4796 :a4796 :a4796. -:a4797 :a4797 :a4797. -:a4798 :a4798 :a4798. -:a4799 :a4799 :a4799. -:a4800 :a4800 :a4800. -:a4801 :a4801 :a4801. -:a4802 :a4802 :a4802. -:a4803 :a4803 :a4803. -:a4804 :a4804 :a4804. -:a4805 :a4805 :a4805. -:a4806 :a4806 :a4806. -:a4807 :a4807 :a4807. -:a4808 :a4808 :a4808. -:a4809 :a4809 :a4809. -:a4810 :a4810 :a4810. -:a4811 :a4811 :a4811. -:a4812 :a4812 :a4812. -:a4813 :a4813 :a4813. -:a4814 :a4814 :a4814. -:a4815 :a4815 :a4815. -:a4816 :a4816 :a4816. -:a4817 :a4817 :a4817. -:a4818 :a4818 :a4818. -:a4819 :a4819 :a4819. -:a4820 :a4820 :a4820. -:a4821 :a4821 :a4821. -:a4822 :a4822 :a4822. -:a4823 :a4823 :a4823. -:a4824 :a4824 :a4824. -:a4825 :a4825 :a4825. -:a4826 :a4826 :a4826. -:a4827 :a4827 :a4827. -:a4828 :a4828 :a4828. -:a4829 :a4829 :a4829. -:a4830 :a4830 :a4830. -:a4831 :a4831 :a4831. -:a4832 :a4832 :a4832. -:a4833 :a4833 :a4833. -:a4834 :a4834 :a4834. -:a4835 :a4835 :a4835. -:a4836 :a4836 :a4836. -:a4837 :a4837 :a4837. -:a4838 :a4838 :a4838. -:a4839 :a4839 :a4839. -:a4840 :a4840 :a4840. -:a4841 :a4841 :a4841. -:a4842 :a4842 :a4842. -:a4843 :a4843 :a4843. -:a4844 :a4844 :a4844. -:a4845 :a4845 :a4845. -:a4846 :a4846 :a4846. -:a4847 :a4847 :a4847. -:a4848 :a4848 :a4848. -:a4849 :a4849 :a4849. -:a4850 :a4850 :a4850. -:a4851 :a4851 :a4851. -:a4852 :a4852 :a4852. -:a4853 :a4853 :a4853. -:a4854 :a4854 :a4854. -:a4855 :a4855 :a4855. -:a4856 :a4856 :a4856. -:a4857 :a4857 :a4857. -:a4858 :a4858 :a4858. -:a4859 :a4859 :a4859. -:a4860 :a4860 :a4860. -:a4861 :a4861 :a4861. -:a4862 :a4862 :a4862. -:a4863 :a4863 :a4863. -:a4864 :a4864 :a4864. -:a4865 :a4865 :a4865. -:a4866 :a4866 :a4866. -:a4867 :a4867 :a4867. -:a4868 :a4868 :a4868. -:a4869 :a4869 :a4869. -:a4870 :a4870 :a4870. -:a4871 :a4871 :a4871. -:a4872 :a4872 :a4872. -:a4873 :a4873 :a4873. -:a4874 :a4874 :a4874. -:a4875 :a4875 :a4875. -:a4876 :a4876 :a4876. -:a4877 :a4877 :a4877. -:a4878 :a4878 :a4878. -:a4879 :a4879 :a4879. -:a4880 :a4880 :a4880. -:a4881 :a4881 :a4881. -:a4882 :a4882 :a4882. -:a4883 :a4883 :a4883. -:a4884 :a4884 :a4884. -:a4885 :a4885 :a4885. -:a4886 :a4886 :a4886. -:a4887 :a4887 :a4887. -:a4888 :a4888 :a4888. -:a4889 :a4889 :a4889. -:a4890 :a4890 :a4890. -:a4891 :a4891 :a4891. -:a4892 :a4892 :a4892. -:a4893 :a4893 :a4893. -:a4894 :a4894 :a4894. -:a4895 :a4895 :a4895. -:a4896 :a4896 :a4896. -:a4897 :a4897 :a4897. -:a4898 :a4898 :a4898. -:a4899 :a4899 :a4899. -:a4900 :a4900 :a4900. -:a4901 :a4901 :a4901. -:a4902 :a4902 :a4902. -:a4903 :a4903 :a4903. -:a4904 :a4904 :a4904. -:a4905 :a4905 :a4905. -:a4906 :a4906 :a4906. -:a4907 :a4907 :a4907. -:a4908 :a4908 :a4908. -:a4909 :a4909 :a4909. -:a4910 :a4910 :a4910. -:a4911 :a4911 :a4911. -:a4912 :a4912 :a4912. -:a4913 :a4913 :a4913. -:a4914 :a4914 :a4914. -:a4915 :a4915 :a4915. -:a4916 :a4916 :a4916. -:a4917 :a4917 :a4917. -:a4918 :a4918 :a4918. -:a4919 :a4919 :a4919. -:a4920 :a4920 :a4920. -:a4921 :a4921 :a4921. -:a4922 :a4922 :a4922. -:a4923 :a4923 :a4923. -:a4924 :a4924 :a4924. -:a4925 :a4925 :a4925. -:a4926 :a4926 :a4926. -:a4927 :a4927 :a4927. -:a4928 :a4928 :a4928. -:a4929 :a4929 :a4929. -:a4930 :a4930 :a4930. -:a4931 :a4931 :a4931. -:a4932 :a4932 :a4932. -:a4933 :a4933 :a4933. -:a4934 :a4934 :a4934. -:a4935 :a4935 :a4935. -:a4936 :a4936 :a4936. -:a4937 :a4937 :a4937. -:a4938 :a4938 :a4938. -:a4939 :a4939 :a4939. -:a4940 :a4940 :a4940. -:a4941 :a4941 :a4941. -:a4942 :a4942 :a4942. -:a4943 :a4943 :a4943. -:a4944 :a4944 :a4944. -:a4945 :a4945 :a4945. -:a4946 :a4946 :a4946. -:a4947 :a4947 :a4947. -:a4948 :a4948 :a4948. -:a4949 :a4949 :a4949. -:a4950 :a4950 :a4950. -:a4951 :a4951 :a4951. -:a4952 :a4952 :a4952. -:a4953 :a4953 :a4953. -:a4954 :a4954 :a4954. -:a4955 :a4955 :a4955. -:a4956 :a4956 :a4956. -:a4957 :a4957 :a4957. -:a4958 :a4958 :a4958. -:a4959 :a4959 :a4959. -:a4960 :a4960 :a4960. -:a4961 :a4961 :a4961. -:a4962 :a4962 :a4962. -:a4963 :a4963 :a4963. -:a4964 :a4964 :a4964. -:a4965 :a4965 :a4965. -:a4966 :a4966 :a4966. -:a4967 :a4967 :a4967. -:a4968 :a4968 :a4968. -:a4969 :a4969 :a4969. -:a4970 :a4970 :a4970. -:a4971 :a4971 :a4971. -:a4972 :a4972 :a4972. -:a4973 :a4973 :a4973. -:a4974 :a4974 :a4974. -:a4975 :a4975 :a4975. -:a4976 :a4976 :a4976. -:a4977 :a4977 :a4977. -:a4978 :a4978 :a4978. -:a4979 :a4979 :a4979. -:a4980 :a4980 :a4980. -:a4981 :a4981 :a4981. -:a4982 :a4982 :a4982. -:a4983 :a4983 :a4983. -:a4984 :a4984 :a4984. -:a4985 :a4985 :a4985. -:a4986 :a4986 :a4986. -:a4987 :a4987 :a4987. -:a4988 :a4988 :a4988. -:a4989 :a4989 :a4989. -:a4990 :a4990 :a4990. -:a4991 :a4991 :a4991. -:a4992 :a4992 :a4992. -:a4993 :a4993 :a4993. -:a4994 :a4994 :a4994. -:a4995 :a4995 :a4995. -:a4996 :a4996 :a4996. -:a4997 :a4997 :a4997. -:a4998 :a4998 :a4998. -:a4999 :a4999 :a4999. -:a5000 :a5000 :a5000. -:a5001 :a5001 :a5001. -:a5002 :a5002 :a5002. -:a5003 :a5003 :a5003. -:a5004 :a5004 :a5004. -:a5005 :a5005 :a5005. -:a5006 :a5006 :a5006. -:a5007 :a5007 :a5007. -:a5008 :a5008 :a5008. -:a5009 :a5009 :a5009. -:a5010 :a5010 :a5010. -:a5011 :a5011 :a5011. -:a5012 :a5012 :a5012. -:a5013 :a5013 :a5013. -:a5014 :a5014 :a5014. -:a5015 :a5015 :a5015. -:a5016 :a5016 :a5016. -:a5017 :a5017 :a5017. -:a5018 :a5018 :a5018. -:a5019 :a5019 :a5019. -:a5020 :a5020 :a5020. -:a5021 :a5021 :a5021. -:a5022 :a5022 :a5022. -:a5023 :a5023 :a5023. -:a5024 :a5024 :a5024. -:a5025 :a5025 :a5025. -:a5026 :a5026 :a5026. -:a5027 :a5027 :a5027. -:a5028 :a5028 :a5028. -:a5029 :a5029 :a5029. -:a5030 :a5030 :a5030. -:a5031 :a5031 :a5031. -:a5032 :a5032 :a5032. -:a5033 :a5033 :a5033. -:a5034 :a5034 :a5034. -:a5035 :a5035 :a5035. -:a5036 :a5036 :a5036. -:a5037 :a5037 :a5037. -:a5038 :a5038 :a5038. -:a5039 :a5039 :a5039. -:a5040 :a5040 :a5040. -:a5041 :a5041 :a5041. -:a5042 :a5042 :a5042. -:a5043 :a5043 :a5043. -:a5044 :a5044 :a5044. -:a5045 :a5045 :a5045. -:a5046 :a5046 :a5046. -:a5047 :a5047 :a5047. -:a5048 :a5048 :a5048. -:a5049 :a5049 :a5049. -:a5050 :a5050 :a5050. -:a5051 :a5051 :a5051. -:a5052 :a5052 :a5052. -:a5053 :a5053 :a5053. -:a5054 :a5054 :a5054. -:a5055 :a5055 :a5055. -:a5056 :a5056 :a5056. -:a5057 :a5057 :a5057. -:a5058 :a5058 :a5058. -:a5059 :a5059 :a5059. -:a5060 :a5060 :a5060. -:a5061 :a5061 :a5061. -:a5062 :a5062 :a5062. -:a5063 :a5063 :a5063. -:a5064 :a5064 :a5064. -:a5065 :a5065 :a5065. -:a5066 :a5066 :a5066. -:a5067 :a5067 :a5067. -:a5068 :a5068 :a5068. -:a5069 :a5069 :a5069. -:a5070 :a5070 :a5070. -:a5071 :a5071 :a5071. -:a5072 :a5072 :a5072. -:a5073 :a5073 :a5073. -:a5074 :a5074 :a5074. -:a5075 :a5075 :a5075. -:a5076 :a5076 :a5076. -:a5077 :a5077 :a5077. -:a5078 :a5078 :a5078. -:a5079 :a5079 :a5079. -:a5080 :a5080 :a5080. -:a5081 :a5081 :a5081. -:a5082 :a5082 :a5082. -:a5083 :a5083 :a5083. -:a5084 :a5084 :a5084. -:a5085 :a5085 :a5085. -:a5086 :a5086 :a5086. -:a5087 :a5087 :a5087. -:a5088 :a5088 :a5088. -:a5089 :a5089 :a5089. -:a5090 :a5090 :a5090. -:a5091 :a5091 :a5091. -:a5092 :a5092 :a5092. -:a5093 :a5093 :a5093. -:a5094 :a5094 :a5094. -:a5095 :a5095 :a5095. -:a5096 :a5096 :a5096. -:a5097 :a5097 :a5097. -:a5098 :a5098 :a5098. -:a5099 :a5099 :a5099. -:a5100 :a5100 :a5100. -:a5101 :a5101 :a5101. -:a5102 :a5102 :a5102. -:a5103 :a5103 :a5103. -:a5104 :a5104 :a5104. -:a5105 :a5105 :a5105. -:a5106 :a5106 :a5106. -:a5107 :a5107 :a5107. -:a5108 :a5108 :a5108. -:a5109 :a5109 :a5109. -:a5110 :a5110 :a5110. -:a5111 :a5111 :a5111. -:a5112 :a5112 :a5112. -:a5113 :a5113 :a5113. -:a5114 :a5114 :a5114. -:a5115 :a5115 :a5115. -:a5116 :a5116 :a5116. -:a5117 :a5117 :a5117. -:a5118 :a5118 :a5118. -:a5119 :a5119 :a5119. -:a5120 :a5120 :a5120. -:a5121 :a5121 :a5121. -:a5122 :a5122 :a5122. -:a5123 :a5123 :a5123. -:a5124 :a5124 :a5124. -:a5125 :a5125 :a5125. -:a5126 :a5126 :a5126. -:a5127 :a5127 :a5127. -:a5128 :a5128 :a5128. -:a5129 :a5129 :a5129. -:a5130 :a5130 :a5130. -:a5131 :a5131 :a5131. -:a5132 :a5132 :a5132. -:a5133 :a5133 :a5133. -:a5134 :a5134 :a5134. -:a5135 :a5135 :a5135. -:a5136 :a5136 :a5136. -:a5137 :a5137 :a5137. -:a5138 :a5138 :a5138. -:a5139 :a5139 :a5139. -:a5140 :a5140 :a5140. -:a5141 :a5141 :a5141. -:a5142 :a5142 :a5142. -:a5143 :a5143 :a5143. -:a5144 :a5144 :a5144. -:a5145 :a5145 :a5145. -:a5146 :a5146 :a5146. -:a5147 :a5147 :a5147. -:a5148 :a5148 :a5148. -:a5149 :a5149 :a5149. -:a5150 :a5150 :a5150. -:a5151 :a5151 :a5151. -:a5152 :a5152 :a5152. -:a5153 :a5153 :a5153. -:a5154 :a5154 :a5154. -:a5155 :a5155 :a5155. -:a5156 :a5156 :a5156. -:a5157 :a5157 :a5157. -:a5158 :a5158 :a5158. -:a5159 :a5159 :a5159. -:a5160 :a5160 :a5160. -:a5161 :a5161 :a5161. -:a5162 :a5162 :a5162. -:a5163 :a5163 :a5163. -:a5164 :a5164 :a5164. -:a5165 :a5165 :a5165. -:a5166 :a5166 :a5166. -:a5167 :a5167 :a5167. -:a5168 :a5168 :a5168. -:a5169 :a5169 :a5169. -:a5170 :a5170 :a5170. -:a5171 :a5171 :a5171. -:a5172 :a5172 :a5172. -:a5173 :a5173 :a5173. -:a5174 :a5174 :a5174. -:a5175 :a5175 :a5175. -:a5176 :a5176 :a5176. -:a5177 :a5177 :a5177. -:a5178 :a5178 :a5178. -:a5179 :a5179 :a5179. -:a5180 :a5180 :a5180. -:a5181 :a5181 :a5181. -:a5182 :a5182 :a5182. -:a5183 :a5183 :a5183. -:a5184 :a5184 :a5184. -:a5185 :a5185 :a5185. -:a5186 :a5186 :a5186. -:a5187 :a5187 :a5187. -:a5188 :a5188 :a5188. -:a5189 :a5189 :a5189. -:a5190 :a5190 :a5190. -:a5191 :a5191 :a5191. -:a5192 :a5192 :a5192. -:a5193 :a5193 :a5193. -:a5194 :a5194 :a5194. -:a5195 :a5195 :a5195. -:a5196 :a5196 :a5196. -:a5197 :a5197 :a5197. -:a5198 :a5198 :a5198. -:a5199 :a5199 :a5199. -:a5200 :a5200 :a5200. -:a5201 :a5201 :a5201. -:a5202 :a5202 :a5202. -:a5203 :a5203 :a5203. -:a5204 :a5204 :a5204. -:a5205 :a5205 :a5205. -:a5206 :a5206 :a5206. -:a5207 :a5207 :a5207. -:a5208 :a5208 :a5208. -:a5209 :a5209 :a5209. -:a5210 :a5210 :a5210. -:a5211 :a5211 :a5211. -:a5212 :a5212 :a5212. -:a5213 :a5213 :a5213. -:a5214 :a5214 :a5214. -:a5215 :a5215 :a5215. -:a5216 :a5216 :a5216. -:a5217 :a5217 :a5217. -:a5218 :a5218 :a5218. -:a5219 :a5219 :a5219. -:a5220 :a5220 :a5220. -:a5221 :a5221 :a5221. -:a5222 :a5222 :a5222. -:a5223 :a5223 :a5223. -:a5224 :a5224 :a5224. -:a5225 :a5225 :a5225. -:a5226 :a5226 :a5226. -:a5227 :a5227 :a5227. -:a5228 :a5228 :a5228. -:a5229 :a5229 :a5229. -:a5230 :a5230 :a5230. -:a5231 :a5231 :a5231. -:a5232 :a5232 :a5232. -:a5233 :a5233 :a5233. -:a5234 :a5234 :a5234. -:a5235 :a5235 :a5235. -:a5236 :a5236 :a5236. -:a5237 :a5237 :a5237. -:a5238 :a5238 :a5238. -:a5239 :a5239 :a5239. -:a5240 :a5240 :a5240. -:a5241 :a5241 :a5241. -:a5242 :a5242 :a5242. -:a5243 :a5243 :a5243. -:a5244 :a5244 :a5244. -:a5245 :a5245 :a5245. -:a5246 :a5246 :a5246. -:a5247 :a5247 :a5247. -:a5248 :a5248 :a5248. -:a5249 :a5249 :a5249. -:a5250 :a5250 :a5250. -:a5251 :a5251 :a5251. -:a5252 :a5252 :a5252. -:a5253 :a5253 :a5253. -:a5254 :a5254 :a5254. -:a5255 :a5255 :a5255. -:a5256 :a5256 :a5256. -:a5257 :a5257 :a5257. -:a5258 :a5258 :a5258. -:a5259 :a5259 :a5259. -:a5260 :a5260 :a5260. -:a5261 :a5261 :a5261. -:a5262 :a5262 :a5262. -:a5263 :a5263 :a5263. -:a5264 :a5264 :a5264. -:a5265 :a5265 :a5265. -:a5266 :a5266 :a5266. -:a5267 :a5267 :a5267. -:a5268 :a5268 :a5268. -:a5269 :a5269 :a5269. -:a5270 :a5270 :a5270. -:a5271 :a5271 :a5271. -:a5272 :a5272 :a5272. -:a5273 :a5273 :a5273. -:a5274 :a5274 :a5274. -:a5275 :a5275 :a5275. -:a5276 :a5276 :a5276. -:a5277 :a5277 :a5277. -:a5278 :a5278 :a5278. -:a5279 :a5279 :a5279. -:a5280 :a5280 :a5280. -:a5281 :a5281 :a5281. -:a5282 :a5282 :a5282. -:a5283 :a5283 :a5283. -:a5284 :a5284 :a5284. -:a5285 :a5285 :a5285. -:a5286 :a5286 :a5286. -:a5287 :a5287 :a5287. -:a5288 :a5288 :a5288. -:a5289 :a5289 :a5289. -:a5290 :a5290 :a5290. -:a5291 :a5291 :a5291. -:a5292 :a5292 :a5292. -:a5293 :a5293 :a5293. -:a5294 :a5294 :a5294. -:a5295 :a5295 :a5295. -:a5296 :a5296 :a5296. -:a5297 :a5297 :a5297. -:a5298 :a5298 :a5298. -:a5299 :a5299 :a5299. -:a5300 :a5300 :a5300. -:a5301 :a5301 :a5301. -:a5302 :a5302 :a5302. -:a5303 :a5303 :a5303. -:a5304 :a5304 :a5304. -:a5305 :a5305 :a5305. -:a5306 :a5306 :a5306. -:a5307 :a5307 :a5307. -:a5308 :a5308 :a5308. -:a5309 :a5309 :a5309. -:a5310 :a5310 :a5310. -:a5311 :a5311 :a5311. -:a5312 :a5312 :a5312. -:a5313 :a5313 :a5313. -:a5314 :a5314 :a5314. -:a5315 :a5315 :a5315. -:a5316 :a5316 :a5316. -:a5317 :a5317 :a5317. -:a5318 :a5318 :a5318. -:a5319 :a5319 :a5319. -:a5320 :a5320 :a5320. -:a5321 :a5321 :a5321. -:a5322 :a5322 :a5322. -:a5323 :a5323 :a5323. -:a5324 :a5324 :a5324. -:a5325 :a5325 :a5325. -:a5326 :a5326 :a5326. -:a5327 :a5327 :a5327. -:a5328 :a5328 :a5328. -:a5329 :a5329 :a5329. -:a5330 :a5330 :a5330. -:a5331 :a5331 :a5331. -:a5332 :a5332 :a5332. -:a5333 :a5333 :a5333. -:a5334 :a5334 :a5334. -:a5335 :a5335 :a5335. -:a5336 :a5336 :a5336. -:a5337 :a5337 :a5337. -:a5338 :a5338 :a5338. -:a5339 :a5339 :a5339. -:a5340 :a5340 :a5340. -:a5341 :a5341 :a5341. -:a5342 :a5342 :a5342. -:a5343 :a5343 :a5343. -:a5344 :a5344 :a5344. -:a5345 :a5345 :a5345. -:a5346 :a5346 :a5346. -:a5347 :a5347 :a5347. -:a5348 :a5348 :a5348. -:a5349 :a5349 :a5349. -:a5350 :a5350 :a5350. -:a5351 :a5351 :a5351. -:a5352 :a5352 :a5352. -:a5353 :a5353 :a5353. -:a5354 :a5354 :a5354. -:a5355 :a5355 :a5355. -:a5356 :a5356 :a5356. -:a5357 :a5357 :a5357. -:a5358 :a5358 :a5358. -:a5359 :a5359 :a5359. -:a5360 :a5360 :a5360. -:a5361 :a5361 :a5361. -:a5362 :a5362 :a5362. -:a5363 :a5363 :a5363. -:a5364 :a5364 :a5364. -:a5365 :a5365 :a5365. -:a5366 :a5366 :a5366. -:a5367 :a5367 :a5367. -:a5368 :a5368 :a5368. -:a5369 :a5369 :a5369. -:a5370 :a5370 :a5370. -:a5371 :a5371 :a5371. -:a5372 :a5372 :a5372. -:a5373 :a5373 :a5373. -:a5374 :a5374 :a5374. -:a5375 :a5375 :a5375. -:a5376 :a5376 :a5376. -:a5377 :a5377 :a5377. -:a5378 :a5378 :a5378. -:a5379 :a5379 :a5379. -:a5380 :a5380 :a5380. -:a5381 :a5381 :a5381. -:a5382 :a5382 :a5382. -:a5383 :a5383 :a5383. -:a5384 :a5384 :a5384. -:a5385 :a5385 :a5385. -:a5386 :a5386 :a5386. -:a5387 :a5387 :a5387. -:a5388 :a5388 :a5388. -:a5389 :a5389 :a5389. -:a5390 :a5390 :a5390. -:a5391 :a5391 :a5391. -:a5392 :a5392 :a5392. -:a5393 :a5393 :a5393. -:a5394 :a5394 :a5394. -:a5395 :a5395 :a5395. -:a5396 :a5396 :a5396. -:a5397 :a5397 :a5397. -:a5398 :a5398 :a5398. -:a5399 :a5399 :a5399. -:a5400 :a5400 :a5400. -:a5401 :a5401 :a5401. -:a5402 :a5402 :a5402. -:a5403 :a5403 :a5403. -:a5404 :a5404 :a5404. -:a5405 :a5405 :a5405. -:a5406 :a5406 :a5406. -:a5407 :a5407 :a5407. -:a5408 :a5408 :a5408. -:a5409 :a5409 :a5409. -:a5410 :a5410 :a5410. -:a5411 :a5411 :a5411. -:a5412 :a5412 :a5412. -:a5413 :a5413 :a5413. -:a5414 :a5414 :a5414. -:a5415 :a5415 :a5415. -:a5416 :a5416 :a5416. -:a5417 :a5417 :a5417. -:a5418 :a5418 :a5418. -:a5419 :a5419 :a5419. -:a5420 :a5420 :a5420. -:a5421 :a5421 :a5421. -:a5422 :a5422 :a5422. -:a5423 :a5423 :a5423. -:a5424 :a5424 :a5424. -:a5425 :a5425 :a5425. -:a5426 :a5426 :a5426. -:a5427 :a5427 :a5427. -:a5428 :a5428 :a5428. -:a5429 :a5429 :a5429. -:a5430 :a5430 :a5430. -:a5431 :a5431 :a5431. -:a5432 :a5432 :a5432. -:a5433 :a5433 :a5433. -:a5434 :a5434 :a5434. -:a5435 :a5435 :a5435. -:a5436 :a5436 :a5436. -:a5437 :a5437 :a5437. -:a5438 :a5438 :a5438. -:a5439 :a5439 :a5439. -:a5440 :a5440 :a5440. -:a5441 :a5441 :a5441. -:a5442 :a5442 :a5442. -:a5443 :a5443 :a5443. -:a5444 :a5444 :a5444. -:a5445 :a5445 :a5445. -:a5446 :a5446 :a5446. -:a5447 :a5447 :a5447. -:a5448 :a5448 :a5448. -:a5449 :a5449 :a5449. -:a5450 :a5450 :a5450. -:a5451 :a5451 :a5451. -:a5452 :a5452 :a5452. -:a5453 :a5453 :a5453. -:a5454 :a5454 :a5454. -:a5455 :a5455 :a5455. -:a5456 :a5456 :a5456. -:a5457 :a5457 :a5457. -:a5458 :a5458 :a5458. -:a5459 :a5459 :a5459. -:a5460 :a5460 :a5460. -:a5461 :a5461 :a5461. -:a5462 :a5462 :a5462. -:a5463 :a5463 :a5463. -:a5464 :a5464 :a5464. -:a5465 :a5465 :a5465. -:a5466 :a5466 :a5466. -:a5467 :a5467 :a5467. -:a5468 :a5468 :a5468. -:a5469 :a5469 :a5469. -:a5470 :a5470 :a5470. -:a5471 :a5471 :a5471. -:a5472 :a5472 :a5472. -:a5473 :a5473 :a5473. -:a5474 :a5474 :a5474. -:a5475 :a5475 :a5475. -:a5476 :a5476 :a5476. -:a5477 :a5477 :a5477. -:a5478 :a5478 :a5478. -:a5479 :a5479 :a5479. -:a5480 :a5480 :a5480. -:a5481 :a5481 :a5481. -:a5482 :a5482 :a5482. -:a5483 :a5483 :a5483. -:a5484 :a5484 :a5484. -:a5485 :a5485 :a5485. -:a5486 :a5486 :a5486. -:a5487 :a5487 :a5487. -:a5488 :a5488 :a5488. -:a5489 :a5489 :a5489. -:a5490 :a5490 :a5490. -:a5491 :a5491 :a5491. -:a5492 :a5492 :a5492. -:a5493 :a5493 :a5493. -:a5494 :a5494 :a5494. -:a5495 :a5495 :a5495. -:a5496 :a5496 :a5496. -:a5497 :a5497 :a5497. -:a5498 :a5498 :a5498. -:a5499 :a5499 :a5499. -:a5500 :a5500 :a5500. -:a5501 :a5501 :a5501. -:a5502 :a5502 :a5502. -:a5503 :a5503 :a5503. -:a5504 :a5504 :a5504. -:a5505 :a5505 :a5505. -:a5506 :a5506 :a5506. -:a5507 :a5507 :a5507. -:a5508 :a5508 :a5508. -:a5509 :a5509 :a5509. -:a5510 :a5510 :a5510. -:a5511 :a5511 :a5511. -:a5512 :a5512 :a5512. -:a5513 :a5513 :a5513. -:a5514 :a5514 :a5514. -:a5515 :a5515 :a5515. -:a5516 :a5516 :a5516. -:a5517 :a5517 :a5517. -:a5518 :a5518 :a5518. -:a5519 :a5519 :a5519. -:a5520 :a5520 :a5520. -:a5521 :a5521 :a5521. -:a5522 :a5522 :a5522. -:a5523 :a5523 :a5523. -:a5524 :a5524 :a5524. -:a5525 :a5525 :a5525. -:a5526 :a5526 :a5526. -:a5527 :a5527 :a5527. -:a5528 :a5528 :a5528. -:a5529 :a5529 :a5529. -:a5530 :a5530 :a5530. -:a5531 :a5531 :a5531. -:a5532 :a5532 :a5532. -:a5533 :a5533 :a5533. -:a5534 :a5534 :a5534. -:a5535 :a5535 :a5535. -:a5536 :a5536 :a5536. -:a5537 :a5537 :a5537. -:a5538 :a5538 :a5538. -:a5539 :a5539 :a5539. -:a5540 :a5540 :a5540. -:a5541 :a5541 :a5541. -:a5542 :a5542 :a5542. -:a5543 :a5543 :a5543. -:a5544 :a5544 :a5544. -:a5545 :a5545 :a5545. -:a5546 :a5546 :a5546. -:a5547 :a5547 :a5547. -:a5548 :a5548 :a5548. -:a5549 :a5549 :a5549. -:a5550 :a5550 :a5550. -:a5551 :a5551 :a5551. -:a5552 :a5552 :a5552. -:a5553 :a5553 :a5553. -:a5554 :a5554 :a5554. -:a5555 :a5555 :a5555. -:a5556 :a5556 :a5556. -:a5557 :a5557 :a5557. -:a5558 :a5558 :a5558. -:a5559 :a5559 :a5559. -:a5560 :a5560 :a5560. -:a5561 :a5561 :a5561. -:a5562 :a5562 :a5562. -:a5563 :a5563 :a5563. -:a5564 :a5564 :a5564. -:a5565 :a5565 :a5565. -:a5566 :a5566 :a5566. -:a5567 :a5567 :a5567. -:a5568 :a5568 :a5568. -:a5569 :a5569 :a5569. -:a5570 :a5570 :a5570. -:a5571 :a5571 :a5571. -:a5572 :a5572 :a5572. -:a5573 :a5573 :a5573. -:a5574 :a5574 :a5574. -:a5575 :a5575 :a5575. -:a5576 :a5576 :a5576. -:a5577 :a5577 :a5577. -:a5578 :a5578 :a5578. -:a5579 :a5579 :a5579. -:a5580 :a5580 :a5580. -:a5581 :a5581 :a5581. -:a5582 :a5582 :a5582. -:a5583 :a5583 :a5583. -:a5584 :a5584 :a5584. -:a5585 :a5585 :a5585. -:a5586 :a5586 :a5586. -:a5587 :a5587 :a5587. -:a5588 :a5588 :a5588. -:a5589 :a5589 :a5589. -:a5590 :a5590 :a5590. -:a5591 :a5591 :a5591. -:a5592 :a5592 :a5592. -:a5593 :a5593 :a5593. -:a5594 :a5594 :a5594. -:a5595 :a5595 :a5595. -:a5596 :a5596 :a5596. -:a5597 :a5597 :a5597. -:a5598 :a5598 :a5598. -:a5599 :a5599 :a5599. -:a5600 :a5600 :a5600. -:a5601 :a5601 :a5601. -:a5602 :a5602 :a5602. -:a5603 :a5603 :a5603. -:a5604 :a5604 :a5604. -:a5605 :a5605 :a5605. -:a5606 :a5606 :a5606. -:a5607 :a5607 :a5607. -:a5608 :a5608 :a5608. -:a5609 :a5609 :a5609. -:a5610 :a5610 :a5610. -:a5611 :a5611 :a5611. -:a5612 :a5612 :a5612. -:a5613 :a5613 :a5613. -:a5614 :a5614 :a5614. -:a5615 :a5615 :a5615. -:a5616 :a5616 :a5616. -:a5617 :a5617 :a5617. -:a5618 :a5618 :a5618. -:a5619 :a5619 :a5619. -:a5620 :a5620 :a5620. -:a5621 :a5621 :a5621. -:a5622 :a5622 :a5622. -:a5623 :a5623 :a5623. -:a5624 :a5624 :a5624. -:a5625 :a5625 :a5625. -:a5626 :a5626 :a5626. -:a5627 :a5627 :a5627. -:a5628 :a5628 :a5628. -:a5629 :a5629 :a5629. -:a5630 :a5630 :a5630. -:a5631 :a5631 :a5631. -:a5632 :a5632 :a5632. -:a5633 :a5633 :a5633. -:a5634 :a5634 :a5634. -:a5635 :a5635 :a5635. -:a5636 :a5636 :a5636. -:a5637 :a5637 :a5637. -:a5638 :a5638 :a5638. -:a5639 :a5639 :a5639. -:a5640 :a5640 :a5640. -:a5641 :a5641 :a5641. -:a5642 :a5642 :a5642. -:a5643 :a5643 :a5643. -:a5644 :a5644 :a5644. -:a5645 :a5645 :a5645. -:a5646 :a5646 :a5646. -:a5647 :a5647 :a5647. -:a5648 :a5648 :a5648. -:a5649 :a5649 :a5649. -:a5650 :a5650 :a5650. -:a5651 :a5651 :a5651. -:a5652 :a5652 :a5652. -:a5653 :a5653 :a5653. -:a5654 :a5654 :a5654. -:a5655 :a5655 :a5655. -:a5656 :a5656 :a5656. -:a5657 :a5657 :a5657. -:a5658 :a5658 :a5658. -:a5659 :a5659 :a5659. -:a5660 :a5660 :a5660. -:a5661 :a5661 :a5661. -:a5662 :a5662 :a5662. -:a5663 :a5663 :a5663. -:a5664 :a5664 :a5664. -:a5665 :a5665 :a5665. -:a5666 :a5666 :a5666. -:a5667 :a5667 :a5667. -:a5668 :a5668 :a5668. -:a5669 :a5669 :a5669. -:a5670 :a5670 :a5670. -:a5671 :a5671 :a5671. -:a5672 :a5672 :a5672. -:a5673 :a5673 :a5673. -:a5674 :a5674 :a5674. -:a5675 :a5675 :a5675. -:a5676 :a5676 :a5676. -:a5677 :a5677 :a5677. -:a5678 :a5678 :a5678. -:a5679 :a5679 :a5679. -:a5680 :a5680 :a5680. -:a5681 :a5681 :a5681. -:a5682 :a5682 :a5682. -:a5683 :a5683 :a5683. -:a5684 :a5684 :a5684. -:a5685 :a5685 :a5685. -:a5686 :a5686 :a5686. -:a5687 :a5687 :a5687. -:a5688 :a5688 :a5688. -:a5689 :a5689 :a5689. -:a5690 :a5690 :a5690. -:a5691 :a5691 :a5691. -:a5692 :a5692 :a5692. -:a5693 :a5693 :a5693. -:a5694 :a5694 :a5694. -:a5695 :a5695 :a5695. -:a5696 :a5696 :a5696. -:a5697 :a5697 :a5697. -:a5698 :a5698 :a5698. -:a5699 :a5699 :a5699. -:a5700 :a5700 :a5700. -:a5701 :a5701 :a5701. -:a5702 :a5702 :a5702. -:a5703 :a5703 :a5703. -:a5704 :a5704 :a5704. -:a5705 :a5705 :a5705. -:a5706 :a5706 :a5706. -:a5707 :a5707 :a5707. -:a5708 :a5708 :a5708. -:a5709 :a5709 :a5709. -:a5710 :a5710 :a5710. -:a5711 :a5711 :a5711. -:a5712 :a5712 :a5712. -:a5713 :a5713 :a5713. -:a5714 :a5714 :a5714. -:a5715 :a5715 :a5715. -:a5716 :a5716 :a5716. -:a5717 :a5717 :a5717. -:a5718 :a5718 :a5718. -:a5719 :a5719 :a5719. -:a5720 :a5720 :a5720. -:a5721 :a5721 :a5721. -:a5722 :a5722 :a5722. -:a5723 :a5723 :a5723. -:a5724 :a5724 :a5724. -:a5725 :a5725 :a5725. -:a5726 :a5726 :a5726. -:a5727 :a5727 :a5727. -:a5728 :a5728 :a5728. -:a5729 :a5729 :a5729. -:a5730 :a5730 :a5730. -:a5731 :a5731 :a5731. -:a5732 :a5732 :a5732. -:a5733 :a5733 :a5733. -:a5734 :a5734 :a5734. -:a5735 :a5735 :a5735. -:a5736 :a5736 :a5736. -:a5737 :a5737 :a5737. -:a5738 :a5738 :a5738. -:a5739 :a5739 :a5739. -:a5740 :a5740 :a5740. -:a5741 :a5741 :a5741. -:a5742 :a5742 :a5742. -:a5743 :a5743 :a5743. -:a5744 :a5744 :a5744. -:a5745 :a5745 :a5745. -:a5746 :a5746 :a5746. -:a5747 :a5747 :a5747. -:a5748 :a5748 :a5748. -:a5749 :a5749 :a5749. -:a5750 :a5750 :a5750. -:a5751 :a5751 :a5751. -:a5752 :a5752 :a5752. -:a5753 :a5753 :a5753. -:a5754 :a5754 :a5754. -:a5755 :a5755 :a5755. -:a5756 :a5756 :a5756. -:a5757 :a5757 :a5757. -:a5758 :a5758 :a5758. -:a5759 :a5759 :a5759. -:a5760 :a5760 :a5760. -:a5761 :a5761 :a5761. -:a5762 :a5762 :a5762. -:a5763 :a5763 :a5763. -:a5764 :a5764 :a5764. -:a5765 :a5765 :a5765. -:a5766 :a5766 :a5766. -:a5767 :a5767 :a5767. -:a5768 :a5768 :a5768. -:a5769 :a5769 :a5769. -:a5770 :a5770 :a5770. -:a5771 :a5771 :a5771. -:a5772 :a5772 :a5772. -:a5773 :a5773 :a5773. -:a5774 :a5774 :a5774. -:a5775 :a5775 :a5775. -:a5776 :a5776 :a5776. -:a5777 :a5777 :a5777. -:a5778 :a5778 :a5778. -:a5779 :a5779 :a5779. -:a5780 :a5780 :a5780. -:a5781 :a5781 :a5781. -:a5782 :a5782 :a5782. -:a5783 :a5783 :a5783. -:a5784 :a5784 :a5784. -:a5785 :a5785 :a5785. -:a5786 :a5786 :a5786. -:a5787 :a5787 :a5787. -:a5788 :a5788 :a5788. -:a5789 :a5789 :a5789. -:a5790 :a5790 :a5790. -:a5791 :a5791 :a5791. -:a5792 :a5792 :a5792. -:a5793 :a5793 :a5793. -:a5794 :a5794 :a5794. -:a5795 :a5795 :a5795. -:a5796 :a5796 :a5796. -:a5797 :a5797 :a5797. -:a5798 :a5798 :a5798. -:a5799 :a5799 :a5799. -:a5800 :a5800 :a5800. -:a5801 :a5801 :a5801. -:a5802 :a5802 :a5802. -:a5803 :a5803 :a5803. -:a5804 :a5804 :a5804. -:a5805 :a5805 :a5805. -:a5806 :a5806 :a5806. -:a5807 :a5807 :a5807. -:a5808 :a5808 :a5808. -:a5809 :a5809 :a5809. -:a5810 :a5810 :a5810. -:a5811 :a5811 :a5811. -:a5812 :a5812 :a5812. -:a5813 :a5813 :a5813. -:a5814 :a5814 :a5814. -:a5815 :a5815 :a5815. -:a5816 :a5816 :a5816. -:a5817 :a5817 :a5817. -:a5818 :a5818 :a5818. -:a5819 :a5819 :a5819. -:a5820 :a5820 :a5820. -:a5821 :a5821 :a5821. -:a5822 :a5822 :a5822. -:a5823 :a5823 :a5823. -:a5824 :a5824 :a5824. -:a5825 :a5825 :a5825. -:a5826 :a5826 :a5826. -:a5827 :a5827 :a5827. -:a5828 :a5828 :a5828. -:a5829 :a5829 :a5829. -:a5830 :a5830 :a5830. -:a5831 :a5831 :a5831. -:a5832 :a5832 :a5832. -:a5833 :a5833 :a5833. -:a5834 :a5834 :a5834. -:a5835 :a5835 :a5835. -:a5836 :a5836 :a5836. -:a5837 :a5837 :a5837. -:a5838 :a5838 :a5838. -:a5839 :a5839 :a5839. -:a5840 :a5840 :a5840. -:a5841 :a5841 :a5841. -:a5842 :a5842 :a5842. -:a5843 :a5843 :a5843. -:a5844 :a5844 :a5844. -:a5845 :a5845 :a5845. -:a5846 :a5846 :a5846. -:a5847 :a5847 :a5847. -:a5848 :a5848 :a5848. -:a5849 :a5849 :a5849. -:a5850 :a5850 :a5850. -:a5851 :a5851 :a5851. -:a5852 :a5852 :a5852. -:a5853 :a5853 :a5853. -:a5854 :a5854 :a5854. -:a5855 :a5855 :a5855. -:a5856 :a5856 :a5856. -:a5857 :a5857 :a5857. -:a5858 :a5858 :a5858. -:a5859 :a5859 :a5859. -:a5860 :a5860 :a5860. -:a5861 :a5861 :a5861. -:a5862 :a5862 :a5862. -:a5863 :a5863 :a5863. -:a5864 :a5864 :a5864. -:a5865 :a5865 :a5865. -:a5866 :a5866 :a5866. -:a5867 :a5867 :a5867. -:a5868 :a5868 :a5868. -:a5869 :a5869 :a5869. -:a5870 :a5870 :a5870. -:a5871 :a5871 :a5871. -:a5872 :a5872 :a5872. -:a5873 :a5873 :a5873. -:a5874 :a5874 :a5874. -:a5875 :a5875 :a5875. -:a5876 :a5876 :a5876. -:a5877 :a5877 :a5877. -:a5878 :a5878 :a5878. -:a5879 :a5879 :a5879. -:a5880 :a5880 :a5880. -:a5881 :a5881 :a5881. -:a5882 :a5882 :a5882. -:a5883 :a5883 :a5883. -:a5884 :a5884 :a5884. -:a5885 :a5885 :a5885. -:a5886 :a5886 :a5886. -:a5887 :a5887 :a5887. -:a5888 :a5888 :a5888. -:a5889 :a5889 :a5889. -:a5890 :a5890 :a5890. -:a5891 :a5891 :a5891. -:a5892 :a5892 :a5892. -:a5893 :a5893 :a5893. -:a5894 :a5894 :a5894. -:a5895 :a5895 :a5895. -:a5896 :a5896 :a5896. -:a5897 :a5897 :a5897. -:a5898 :a5898 :a5898. -:a5899 :a5899 :a5899. -:a5900 :a5900 :a5900. -:a5901 :a5901 :a5901. -:a5902 :a5902 :a5902. -:a5903 :a5903 :a5903. -:a5904 :a5904 :a5904. -:a5905 :a5905 :a5905. -:a5906 :a5906 :a5906. -:a5907 :a5907 :a5907. -:a5908 :a5908 :a5908. -:a5909 :a5909 :a5909. -:a5910 :a5910 :a5910. -:a5911 :a5911 :a5911. -:a5912 :a5912 :a5912. -:a5913 :a5913 :a5913. -:a5914 :a5914 :a5914. -:a5915 :a5915 :a5915. -:a5916 :a5916 :a5916. -:a5917 :a5917 :a5917. -:a5918 :a5918 :a5918. -:a5919 :a5919 :a5919. -:a5920 :a5920 :a5920. -:a5921 :a5921 :a5921. -:a5922 :a5922 :a5922. -:a5923 :a5923 :a5923. -:a5924 :a5924 :a5924. -:a5925 :a5925 :a5925. -:a5926 :a5926 :a5926. -:a5927 :a5927 :a5927. -:a5928 :a5928 :a5928. -:a5929 :a5929 :a5929. -:a5930 :a5930 :a5930. -:a5931 :a5931 :a5931. -:a5932 :a5932 :a5932. -:a5933 :a5933 :a5933. -:a5934 :a5934 :a5934. -:a5935 :a5935 :a5935. -:a5936 :a5936 :a5936. -:a5937 :a5937 :a5937. -:a5938 :a5938 :a5938. -:a5939 :a5939 :a5939. -:a5940 :a5940 :a5940. -:a5941 :a5941 :a5941. -:a5942 :a5942 :a5942. -:a5943 :a5943 :a5943. -:a5944 :a5944 :a5944. -:a5945 :a5945 :a5945. -:a5946 :a5946 :a5946. -:a5947 :a5947 :a5947. -:a5948 :a5948 :a5948. -:a5949 :a5949 :a5949. -:a5950 :a5950 :a5950. -:a5951 :a5951 :a5951. -:a5952 :a5952 :a5952. -:a5953 :a5953 :a5953. -:a5954 :a5954 :a5954. -:a5955 :a5955 :a5955. -:a5956 :a5956 :a5956. -:a5957 :a5957 :a5957. -:a5958 :a5958 :a5958. -:a5959 :a5959 :a5959. -:a5960 :a5960 :a5960. -:a5961 :a5961 :a5961. -:a5962 :a5962 :a5962. -:a5963 :a5963 :a5963. -:a5964 :a5964 :a5964. -:a5965 :a5965 :a5965. -:a5966 :a5966 :a5966. -:a5967 :a5967 :a5967. -:a5968 :a5968 :a5968. -:a5969 :a5969 :a5969. -:a5970 :a5970 :a5970. -:a5971 :a5971 :a5971. -:a5972 :a5972 :a5972. -:a5973 :a5973 :a5973. -:a5974 :a5974 :a5974. -:a5975 :a5975 :a5975. -:a5976 :a5976 :a5976. -:a5977 :a5977 :a5977. -:a5978 :a5978 :a5978. -:a5979 :a5979 :a5979. -:a5980 :a5980 :a5980. -:a5981 :a5981 :a5981. -:a5982 :a5982 :a5982. -:a5983 :a5983 :a5983. -:a5984 :a5984 :a5984. -:a5985 :a5985 :a5985. -:a5986 :a5986 :a5986. -:a5987 :a5987 :a5987. -:a5988 :a5988 :a5988. -:a5989 :a5989 :a5989. -:a5990 :a5990 :a5990. -:a5991 :a5991 :a5991. -:a5992 :a5992 :a5992. -:a5993 :a5993 :a5993. -:a5994 :a5994 :a5994. -:a5995 :a5995 :a5995. -:a5996 :a5996 :a5996. -:a5997 :a5997 :a5997. -:a5998 :a5998 :a5998. -:a5999 :a5999 :a5999. -:a6000 :a6000 :a6000. -:a6001 :a6001 :a6001. -:a6002 :a6002 :a6002. -:a6003 :a6003 :a6003. -:a6004 :a6004 :a6004. -:a6005 :a6005 :a6005. -:a6006 :a6006 :a6006. -:a6007 :a6007 :a6007. -:a6008 :a6008 :a6008. -:a6009 :a6009 :a6009. -:a6010 :a6010 :a6010. -:a6011 :a6011 :a6011. -:a6012 :a6012 :a6012. -:a6013 :a6013 :a6013. -:a6014 :a6014 :a6014. -:a6015 :a6015 :a6015. -:a6016 :a6016 :a6016. -:a6017 :a6017 :a6017. -:a6018 :a6018 :a6018. -:a6019 :a6019 :a6019. -:a6020 :a6020 :a6020. -:a6021 :a6021 :a6021. -:a6022 :a6022 :a6022. -:a6023 :a6023 :a6023. -:a6024 :a6024 :a6024. -:a6025 :a6025 :a6025. -:a6026 :a6026 :a6026. -:a6027 :a6027 :a6027. -:a6028 :a6028 :a6028. -:a6029 :a6029 :a6029. -:a6030 :a6030 :a6030. -:a6031 :a6031 :a6031. -:a6032 :a6032 :a6032. -:a6033 :a6033 :a6033. -:a6034 :a6034 :a6034. -:a6035 :a6035 :a6035. -:a6036 :a6036 :a6036. -:a6037 :a6037 :a6037. -:a6038 :a6038 :a6038. -:a6039 :a6039 :a6039. -:a6040 :a6040 :a6040. -:a6041 :a6041 :a6041. -:a6042 :a6042 :a6042. -:a6043 :a6043 :a6043. -:a6044 :a6044 :a6044. -:a6045 :a6045 :a6045. -:a6046 :a6046 :a6046. -:a6047 :a6047 :a6047. -:a6048 :a6048 :a6048. -:a6049 :a6049 :a6049. -:a6050 :a6050 :a6050. -:a6051 :a6051 :a6051. -:a6052 :a6052 :a6052. -:a6053 :a6053 :a6053. -:a6054 :a6054 :a6054. -:a6055 :a6055 :a6055. -:a6056 :a6056 :a6056. -:a6057 :a6057 :a6057. -:a6058 :a6058 :a6058. -:a6059 :a6059 :a6059. -:a6060 :a6060 :a6060. -:a6061 :a6061 :a6061. -:a6062 :a6062 :a6062. -:a6063 :a6063 :a6063. -:a6064 :a6064 :a6064. -:a6065 :a6065 :a6065. -:a6066 :a6066 :a6066. -:a6067 :a6067 :a6067. -:a6068 :a6068 :a6068. -:a6069 :a6069 :a6069. -:a6070 :a6070 :a6070. -:a6071 :a6071 :a6071. -:a6072 :a6072 :a6072. -:a6073 :a6073 :a6073. -:a6074 :a6074 :a6074. -:a6075 :a6075 :a6075. -:a6076 :a6076 :a6076. -:a6077 :a6077 :a6077. -:a6078 :a6078 :a6078. -:a6079 :a6079 :a6079. -:a6080 :a6080 :a6080. -:a6081 :a6081 :a6081. -:a6082 :a6082 :a6082. -:a6083 :a6083 :a6083. -:a6084 :a6084 :a6084. -:a6085 :a6085 :a6085. -:a6086 :a6086 :a6086. -:a6087 :a6087 :a6087. -:a6088 :a6088 :a6088. -:a6089 :a6089 :a6089. -:a6090 :a6090 :a6090. -:a6091 :a6091 :a6091. -:a6092 :a6092 :a6092. -:a6093 :a6093 :a6093. -:a6094 :a6094 :a6094. -:a6095 :a6095 :a6095. -:a6096 :a6096 :a6096. -:a6097 :a6097 :a6097. -:a6098 :a6098 :a6098. -:a6099 :a6099 :a6099. -:a6100 :a6100 :a6100. -:a6101 :a6101 :a6101. -:a6102 :a6102 :a6102. -:a6103 :a6103 :a6103. -:a6104 :a6104 :a6104. -:a6105 :a6105 :a6105. -:a6106 :a6106 :a6106. -:a6107 :a6107 :a6107. -:a6108 :a6108 :a6108. -:a6109 :a6109 :a6109. -:a6110 :a6110 :a6110. -:a6111 :a6111 :a6111. -:a6112 :a6112 :a6112. -:a6113 :a6113 :a6113. -:a6114 :a6114 :a6114. -:a6115 :a6115 :a6115. -:a6116 :a6116 :a6116. -:a6117 :a6117 :a6117. -:a6118 :a6118 :a6118. -:a6119 :a6119 :a6119. -:a6120 :a6120 :a6120. -:a6121 :a6121 :a6121. -:a6122 :a6122 :a6122. -:a6123 :a6123 :a6123. -:a6124 :a6124 :a6124. -:a6125 :a6125 :a6125. -:a6126 :a6126 :a6126. -:a6127 :a6127 :a6127. -:a6128 :a6128 :a6128. -:a6129 :a6129 :a6129. -:a6130 :a6130 :a6130. -:a6131 :a6131 :a6131. -:a6132 :a6132 :a6132. -:a6133 :a6133 :a6133. -:a6134 :a6134 :a6134. -:a6135 :a6135 :a6135. -:a6136 :a6136 :a6136. -:a6137 :a6137 :a6137. -:a6138 :a6138 :a6138. -:a6139 :a6139 :a6139. -:a6140 :a6140 :a6140. -:a6141 :a6141 :a6141. -:a6142 :a6142 :a6142. -:a6143 :a6143 :a6143. -:a6144 :a6144 :a6144. -:a6145 :a6145 :a6145. -:a6146 :a6146 :a6146. -:a6147 :a6147 :a6147. -:a6148 :a6148 :a6148. -:a6149 :a6149 :a6149. -:a6150 :a6150 :a6150. -:a6151 :a6151 :a6151. -:a6152 :a6152 :a6152. -:a6153 :a6153 :a6153. -:a6154 :a6154 :a6154. -:a6155 :a6155 :a6155. -:a6156 :a6156 :a6156. -:a6157 :a6157 :a6157. -:a6158 :a6158 :a6158. -:a6159 :a6159 :a6159. -:a6160 :a6160 :a6160. -:a6161 :a6161 :a6161. -:a6162 :a6162 :a6162. -:a6163 :a6163 :a6163. -:a6164 :a6164 :a6164. -:a6165 :a6165 :a6165. -:a6166 :a6166 :a6166. -:a6167 :a6167 :a6167. -:a6168 :a6168 :a6168. -:a6169 :a6169 :a6169. -:a6170 :a6170 :a6170. -:a6171 :a6171 :a6171. -:a6172 :a6172 :a6172. -:a6173 :a6173 :a6173. -:a6174 :a6174 :a6174. -:a6175 :a6175 :a6175. -:a6176 :a6176 :a6176. -:a6177 :a6177 :a6177. -:a6178 :a6178 :a6178. -:a6179 :a6179 :a6179. -:a6180 :a6180 :a6180. -:a6181 :a6181 :a6181. -:a6182 :a6182 :a6182. -:a6183 :a6183 :a6183. -:a6184 :a6184 :a6184. -:a6185 :a6185 :a6185. -:a6186 :a6186 :a6186. -:a6187 :a6187 :a6187. -:a6188 :a6188 :a6188. -:a6189 :a6189 :a6189. -:a6190 :a6190 :a6190. -:a6191 :a6191 :a6191. -:a6192 :a6192 :a6192. -:a6193 :a6193 :a6193. -:a6194 :a6194 :a6194. -:a6195 :a6195 :a6195. -:a6196 :a6196 :a6196. -:a6197 :a6197 :a6197. -:a6198 :a6198 :a6198. -:a6199 :a6199 :a6199. -:a6200 :a6200 :a6200. -:a6201 :a6201 :a6201. -:a6202 :a6202 :a6202. -:a6203 :a6203 :a6203. -:a6204 :a6204 :a6204. -:a6205 :a6205 :a6205. -:a6206 :a6206 :a6206. -:a6207 :a6207 :a6207. -:a6208 :a6208 :a6208. -:a6209 :a6209 :a6209. -:a6210 :a6210 :a6210. -:a6211 :a6211 :a6211. -:a6212 :a6212 :a6212. -:a6213 :a6213 :a6213. -:a6214 :a6214 :a6214. -:a6215 :a6215 :a6215. -:a6216 :a6216 :a6216. -:a6217 :a6217 :a6217. -:a6218 :a6218 :a6218. -:a6219 :a6219 :a6219. -:a6220 :a6220 :a6220. -:a6221 :a6221 :a6221. -:a6222 :a6222 :a6222. -:a6223 :a6223 :a6223. -:a6224 :a6224 :a6224. -:a6225 :a6225 :a6225. -:a6226 :a6226 :a6226. -:a6227 :a6227 :a6227. -:a6228 :a6228 :a6228. -:a6229 :a6229 :a6229. -:a6230 :a6230 :a6230. -:a6231 :a6231 :a6231. -:a6232 :a6232 :a6232. -:a6233 :a6233 :a6233. -:a6234 :a6234 :a6234. -:a6235 :a6235 :a6235. -:a6236 :a6236 :a6236. -:a6237 :a6237 :a6237. -:a6238 :a6238 :a6238. -:a6239 :a6239 :a6239. -:a6240 :a6240 :a6240. -:a6241 :a6241 :a6241. -:a6242 :a6242 :a6242. -:a6243 :a6243 :a6243. -:a6244 :a6244 :a6244. -:a6245 :a6245 :a6245. -:a6246 :a6246 :a6246. -:a6247 :a6247 :a6247. -:a6248 :a6248 :a6248. -:a6249 :a6249 :a6249. -:a6250 :a6250 :a6250. -:a6251 :a6251 :a6251. -:a6252 :a6252 :a6252. -:a6253 :a6253 :a6253. -:a6254 :a6254 :a6254. -:a6255 :a6255 :a6255. -:a6256 :a6256 :a6256. -:a6257 :a6257 :a6257. -:a6258 :a6258 :a6258. -:a6259 :a6259 :a6259. -:a6260 :a6260 :a6260. -:a6261 :a6261 :a6261. -:a6262 :a6262 :a6262. -:a6263 :a6263 :a6263. -:a6264 :a6264 :a6264. -:a6265 :a6265 :a6265. -:a6266 :a6266 :a6266. -:a6267 :a6267 :a6267. -:a6268 :a6268 :a6268. -:a6269 :a6269 :a6269. -:a6270 :a6270 :a6270. -:a6271 :a6271 :a6271. -:a6272 :a6272 :a6272. -:a6273 :a6273 :a6273. -:a6274 :a6274 :a6274. -:a6275 :a6275 :a6275. -:a6276 :a6276 :a6276. -:a6277 :a6277 :a6277. -:a6278 :a6278 :a6278. -:a6279 :a6279 :a6279. -:a6280 :a6280 :a6280. -:a6281 :a6281 :a6281. -:a6282 :a6282 :a6282. -:a6283 :a6283 :a6283. -:a6284 :a6284 :a6284. -:a6285 :a6285 :a6285. -:a6286 :a6286 :a6286. -:a6287 :a6287 :a6287. -:a6288 :a6288 :a6288. -:a6289 :a6289 :a6289. -:a6290 :a6290 :a6290. -:a6291 :a6291 :a6291. -:a6292 :a6292 :a6292. -:a6293 :a6293 :a6293. -:a6294 :a6294 :a6294. -:a6295 :a6295 :a6295. -:a6296 :a6296 :a6296. -:a6297 :a6297 :a6297. -:a6298 :a6298 :a6298. -:a6299 :a6299 :a6299. -:a6300 :a6300 :a6300. -:a6301 :a6301 :a6301. -:a6302 :a6302 :a6302. -:a6303 :a6303 :a6303. -:a6304 :a6304 :a6304. -:a6305 :a6305 :a6305. -:a6306 :a6306 :a6306. -:a6307 :a6307 :a6307. -:a6308 :a6308 :a6308. -:a6309 :a6309 :a6309. -:a6310 :a6310 :a6310. -:a6311 :a6311 :a6311. -:a6312 :a6312 :a6312. -:a6313 :a6313 :a6313. -:a6314 :a6314 :a6314. -:a6315 :a6315 :a6315. -:a6316 :a6316 :a6316. -:a6317 :a6317 :a6317. -:a6318 :a6318 :a6318. -:a6319 :a6319 :a6319. -:a6320 :a6320 :a6320. -:a6321 :a6321 :a6321. -:a6322 :a6322 :a6322. -:a6323 :a6323 :a6323. -:a6324 :a6324 :a6324. -:a6325 :a6325 :a6325. -:a6326 :a6326 :a6326. -:a6327 :a6327 :a6327. -:a6328 :a6328 :a6328. -:a6329 :a6329 :a6329. -:a6330 :a6330 :a6330. -:a6331 :a6331 :a6331. -:a6332 :a6332 :a6332. -:a6333 :a6333 :a6333. -:a6334 :a6334 :a6334. -:a6335 :a6335 :a6335. -:a6336 :a6336 :a6336. -:a6337 :a6337 :a6337. -:a6338 :a6338 :a6338. -:a6339 :a6339 :a6339. -:a6340 :a6340 :a6340. -:a6341 :a6341 :a6341. -:a6342 :a6342 :a6342. -:a6343 :a6343 :a6343. -:a6344 :a6344 :a6344. -:a6345 :a6345 :a6345. -:a6346 :a6346 :a6346. -:a6347 :a6347 :a6347. -:a6348 :a6348 :a6348. -:a6349 :a6349 :a6349. -:a6350 :a6350 :a6350. -:a6351 :a6351 :a6351. -:a6352 :a6352 :a6352. -:a6353 :a6353 :a6353. -:a6354 :a6354 :a6354. -:a6355 :a6355 :a6355. -:a6356 :a6356 :a6356. -:a6357 :a6357 :a6357. -:a6358 :a6358 :a6358. -:a6359 :a6359 :a6359. -:a6360 :a6360 :a6360. -:a6361 :a6361 :a6361. -:a6362 :a6362 :a6362. -:a6363 :a6363 :a6363. -:a6364 :a6364 :a6364. -:a6365 :a6365 :a6365. -:a6366 :a6366 :a6366. -:a6367 :a6367 :a6367. -:a6368 :a6368 :a6368. -:a6369 :a6369 :a6369. -:a6370 :a6370 :a6370. -:a6371 :a6371 :a6371. -:a6372 :a6372 :a6372. -:a6373 :a6373 :a6373. -:a6374 :a6374 :a6374. -:a6375 :a6375 :a6375. -:a6376 :a6376 :a6376. -:a6377 :a6377 :a6377. -:a6378 :a6378 :a6378. -:a6379 :a6379 :a6379. -:a6380 :a6380 :a6380. -:a6381 :a6381 :a6381. -:a6382 :a6382 :a6382. -:a6383 :a6383 :a6383. -:a6384 :a6384 :a6384. -:a6385 :a6385 :a6385. -:a6386 :a6386 :a6386. -:a6387 :a6387 :a6387. -:a6388 :a6388 :a6388. -:a6389 :a6389 :a6389. -:a6390 :a6390 :a6390. -:a6391 :a6391 :a6391. -:a6392 :a6392 :a6392. -:a6393 :a6393 :a6393. -:a6394 :a6394 :a6394. -:a6395 :a6395 :a6395. -:a6396 :a6396 :a6396. -:a6397 :a6397 :a6397. -:a6398 :a6398 :a6398. -:a6399 :a6399 :a6399. -:a6400 :a6400 :a6400. -:a6401 :a6401 :a6401. -:a6402 :a6402 :a6402. -:a6403 :a6403 :a6403. -:a6404 :a6404 :a6404. -:a6405 :a6405 :a6405. -:a6406 :a6406 :a6406. -:a6407 :a6407 :a6407. -:a6408 :a6408 :a6408. -:a6409 :a6409 :a6409. -:a6410 :a6410 :a6410. -:a6411 :a6411 :a6411. -:a6412 :a6412 :a6412. -:a6413 :a6413 :a6413. -:a6414 :a6414 :a6414. -:a6415 :a6415 :a6415. -:a6416 :a6416 :a6416. -:a6417 :a6417 :a6417. -:a6418 :a6418 :a6418. -:a6419 :a6419 :a6419. -:a6420 :a6420 :a6420. -:a6421 :a6421 :a6421. -:a6422 :a6422 :a6422. -:a6423 :a6423 :a6423. -:a6424 :a6424 :a6424. -:a6425 :a6425 :a6425. -:a6426 :a6426 :a6426. -:a6427 :a6427 :a6427. -:a6428 :a6428 :a6428. -:a6429 :a6429 :a6429. -:a6430 :a6430 :a6430. -:a6431 :a6431 :a6431. -:a6432 :a6432 :a6432. -:a6433 :a6433 :a6433. -:a6434 :a6434 :a6434. -:a6435 :a6435 :a6435. -:a6436 :a6436 :a6436. -:a6437 :a6437 :a6437. -:a6438 :a6438 :a6438. -:a6439 :a6439 :a6439. -:a6440 :a6440 :a6440. -:a6441 :a6441 :a6441. -:a6442 :a6442 :a6442. -:a6443 :a6443 :a6443. -:a6444 :a6444 :a6444. -:a6445 :a6445 :a6445. -:a6446 :a6446 :a6446. -:a6447 :a6447 :a6447. -:a6448 :a6448 :a6448. -:a6449 :a6449 :a6449. -:a6450 :a6450 :a6450. -:a6451 :a6451 :a6451. -:a6452 :a6452 :a6452. -:a6453 :a6453 :a6453. -:a6454 :a6454 :a6454. -:a6455 :a6455 :a6455. -:a6456 :a6456 :a6456. -:a6457 :a6457 :a6457. -:a6458 :a6458 :a6458. -:a6459 :a6459 :a6459. -:a6460 :a6460 :a6460. -:a6461 :a6461 :a6461. -:a6462 :a6462 :a6462. -:a6463 :a6463 :a6463. -:a6464 :a6464 :a6464. -:a6465 :a6465 :a6465. -:a6466 :a6466 :a6466. -:a6467 :a6467 :a6467. -:a6468 :a6468 :a6468. -:a6469 :a6469 :a6469. -:a6470 :a6470 :a6470. -:a6471 :a6471 :a6471. -:a6472 :a6472 :a6472. -:a6473 :a6473 :a6473. -:a6474 :a6474 :a6474. -:a6475 :a6475 :a6475. -:a6476 :a6476 :a6476. -:a6477 :a6477 :a6477. -:a6478 :a6478 :a6478. -:a6479 :a6479 :a6479. -:a6480 :a6480 :a6480. -:a6481 :a6481 :a6481. -:a6482 :a6482 :a6482. -:a6483 :a6483 :a6483. -:a6484 :a6484 :a6484. -:a6485 :a6485 :a6485. -:a6486 :a6486 :a6486. -:a6487 :a6487 :a6487. -:a6488 :a6488 :a6488. -:a6489 :a6489 :a6489. -:a6490 :a6490 :a6490. -:a6491 :a6491 :a6491. -:a6492 :a6492 :a6492. -:a6493 :a6493 :a6493. -:a6494 :a6494 :a6494. -:a6495 :a6495 :a6495. -:a6496 :a6496 :a6496. -:a6497 :a6497 :a6497. -:a6498 :a6498 :a6498. -:a6499 :a6499 :a6499. -:a6500 :a6500 :a6500. -:a6501 :a6501 :a6501. -:a6502 :a6502 :a6502. -:a6503 :a6503 :a6503. -:a6504 :a6504 :a6504. -:a6505 :a6505 :a6505. -:a6506 :a6506 :a6506. -:a6507 :a6507 :a6507. -:a6508 :a6508 :a6508. -:a6509 :a6509 :a6509. -:a6510 :a6510 :a6510. -:a6511 :a6511 :a6511. -:a6512 :a6512 :a6512. -:a6513 :a6513 :a6513. -:a6514 :a6514 :a6514. -:a6515 :a6515 :a6515. -:a6516 :a6516 :a6516. -:a6517 :a6517 :a6517. -:a6518 :a6518 :a6518. -:a6519 :a6519 :a6519. -:a6520 :a6520 :a6520. -:a6521 :a6521 :a6521. -:a6522 :a6522 :a6522. -:a6523 :a6523 :a6523. -:a6524 :a6524 :a6524. -:a6525 :a6525 :a6525. -:a6526 :a6526 :a6526. -:a6527 :a6527 :a6527. -:a6528 :a6528 :a6528. -:a6529 :a6529 :a6529. -:a6530 :a6530 :a6530. -:a6531 :a6531 :a6531. -:a6532 :a6532 :a6532. -:a6533 :a6533 :a6533. -:a6534 :a6534 :a6534. -:a6535 :a6535 :a6535. -:a6536 :a6536 :a6536. -:a6537 :a6537 :a6537. -:a6538 :a6538 :a6538. -:a6539 :a6539 :a6539. -:a6540 :a6540 :a6540. -:a6541 :a6541 :a6541. -:a6542 :a6542 :a6542. -:a6543 :a6543 :a6543. -:a6544 :a6544 :a6544. -:a6545 :a6545 :a6545. -:a6546 :a6546 :a6546. -:a6547 :a6547 :a6547. -:a6548 :a6548 :a6548. -:a6549 :a6549 :a6549. -:a6550 :a6550 :a6550. -:a6551 :a6551 :a6551. -:a6552 :a6552 :a6552. -:a6553 :a6553 :a6553. -:a6554 :a6554 :a6554. -:a6555 :a6555 :a6555. -:a6556 :a6556 :a6556. -:a6557 :a6557 :a6557. -:a6558 :a6558 :a6558. -:a6559 :a6559 :a6559. -:a6560 :a6560 :a6560. -:a6561 :a6561 :a6561. -:a6562 :a6562 :a6562. -:a6563 :a6563 :a6563. -:a6564 :a6564 :a6564. -:a6565 :a6565 :a6565. -:a6566 :a6566 :a6566. -:a6567 :a6567 :a6567. -:a6568 :a6568 :a6568. -:a6569 :a6569 :a6569. -:a6570 :a6570 :a6570. -:a6571 :a6571 :a6571. -:a6572 :a6572 :a6572. -:a6573 :a6573 :a6573. -:a6574 :a6574 :a6574. -:a6575 :a6575 :a6575. -:a6576 :a6576 :a6576. -:a6577 :a6577 :a6577. -:a6578 :a6578 :a6578. -:a6579 :a6579 :a6579. -:a6580 :a6580 :a6580. -:a6581 :a6581 :a6581. -:a6582 :a6582 :a6582. -:a6583 :a6583 :a6583. -:a6584 :a6584 :a6584. -:a6585 :a6585 :a6585. -:a6586 :a6586 :a6586. -:a6587 :a6587 :a6587. -:a6588 :a6588 :a6588. -:a6589 :a6589 :a6589. -:a6590 :a6590 :a6590. -:a6591 :a6591 :a6591. -:a6592 :a6592 :a6592. -:a6593 :a6593 :a6593. -:a6594 :a6594 :a6594. -:a6595 :a6595 :a6595. -:a6596 :a6596 :a6596. -:a6597 :a6597 :a6597. -:a6598 :a6598 :a6598. -:a6599 :a6599 :a6599. -:a6600 :a6600 :a6600. -:a6601 :a6601 :a6601. -:a6602 :a6602 :a6602. -:a6603 :a6603 :a6603. -:a6604 :a6604 :a6604. -:a6605 :a6605 :a6605. -:a6606 :a6606 :a6606. -:a6607 :a6607 :a6607. -:a6608 :a6608 :a6608. -:a6609 :a6609 :a6609. -:a6610 :a6610 :a6610. -:a6611 :a6611 :a6611. -:a6612 :a6612 :a6612. -:a6613 :a6613 :a6613. -:a6614 :a6614 :a6614. -:a6615 :a6615 :a6615. -:a6616 :a6616 :a6616. -:a6617 :a6617 :a6617. -:a6618 :a6618 :a6618. -:a6619 :a6619 :a6619. -:a6620 :a6620 :a6620. -:a6621 :a6621 :a6621. -:a6622 :a6622 :a6622. -:a6623 :a6623 :a6623. -:a6624 :a6624 :a6624. -:a6625 :a6625 :a6625. -:a6626 :a6626 :a6626. -:a6627 :a6627 :a6627. -:a6628 :a6628 :a6628. -:a6629 :a6629 :a6629. -:a6630 :a6630 :a6630. -:a6631 :a6631 :a6631. -:a6632 :a6632 :a6632. -:a6633 :a6633 :a6633. -:a6634 :a6634 :a6634. -:a6635 :a6635 :a6635. -:a6636 :a6636 :a6636. -:a6637 :a6637 :a6637. -:a6638 :a6638 :a6638. -:a6639 :a6639 :a6639. -:a6640 :a6640 :a6640. -:a6641 :a6641 :a6641. -:a6642 :a6642 :a6642. -:a6643 :a6643 :a6643. -:a6644 :a6644 :a6644. -:a6645 :a6645 :a6645. -:a6646 :a6646 :a6646. -:a6647 :a6647 :a6647. -:a6648 :a6648 :a6648. -:a6649 :a6649 :a6649. -:a6650 :a6650 :a6650. -:a6651 :a6651 :a6651. -:a6652 :a6652 :a6652. -:a6653 :a6653 :a6653. -:a6654 :a6654 :a6654. -:a6655 :a6655 :a6655. -:a6656 :a6656 :a6656. -:a6657 :a6657 :a6657. -:a6658 :a6658 :a6658. -:a6659 :a6659 :a6659. -:a6660 :a6660 :a6660. -:a6661 :a6661 :a6661. -:a6662 :a6662 :a6662. -:a6663 :a6663 :a6663. -:a6664 :a6664 :a6664. -:a6665 :a6665 :a6665. -:a6666 :a6666 :a6666. -:a6667 :a6667 :a6667. -:a6668 :a6668 :a6668. -:a6669 :a6669 :a6669. -:a6670 :a6670 :a6670. -:a6671 :a6671 :a6671. -:a6672 :a6672 :a6672. -:a6673 :a6673 :a6673. -:a6674 :a6674 :a6674. -:a6675 :a6675 :a6675. -:a6676 :a6676 :a6676. -:a6677 :a6677 :a6677. -:a6678 :a6678 :a6678. -:a6679 :a6679 :a6679. -:a6680 :a6680 :a6680. -:a6681 :a6681 :a6681. -:a6682 :a6682 :a6682. -:a6683 :a6683 :a6683. -:a6684 :a6684 :a6684. -:a6685 :a6685 :a6685. -:a6686 :a6686 :a6686. -:a6687 :a6687 :a6687. -:a6688 :a6688 :a6688. -:a6689 :a6689 :a6689. -:a6690 :a6690 :a6690. -:a6691 :a6691 :a6691. -:a6692 :a6692 :a6692. -:a6693 :a6693 :a6693. -:a6694 :a6694 :a6694. -:a6695 :a6695 :a6695. -:a6696 :a6696 :a6696. -:a6697 :a6697 :a6697. -:a6698 :a6698 :a6698. -:a6699 :a6699 :a6699. -:a6700 :a6700 :a6700. -:a6701 :a6701 :a6701. -:a6702 :a6702 :a6702. -:a6703 :a6703 :a6703. -:a6704 :a6704 :a6704. -:a6705 :a6705 :a6705. -:a6706 :a6706 :a6706. -:a6707 :a6707 :a6707. -:a6708 :a6708 :a6708. -:a6709 :a6709 :a6709. -:a6710 :a6710 :a6710. -:a6711 :a6711 :a6711. -:a6712 :a6712 :a6712. -:a6713 :a6713 :a6713. -:a6714 :a6714 :a6714. -:a6715 :a6715 :a6715. -:a6716 :a6716 :a6716. -:a6717 :a6717 :a6717. -:a6718 :a6718 :a6718. -:a6719 :a6719 :a6719. -:a6720 :a6720 :a6720. -:a6721 :a6721 :a6721. -:a6722 :a6722 :a6722. -:a6723 :a6723 :a6723. -:a6724 :a6724 :a6724. -:a6725 :a6725 :a6725. -:a6726 :a6726 :a6726. -:a6727 :a6727 :a6727. -:a6728 :a6728 :a6728. -:a6729 :a6729 :a6729. -:a6730 :a6730 :a6730. -:a6731 :a6731 :a6731. -:a6732 :a6732 :a6732. -:a6733 :a6733 :a6733. -:a6734 :a6734 :a6734. -:a6735 :a6735 :a6735. -:a6736 :a6736 :a6736. -:a6737 :a6737 :a6737. -:a6738 :a6738 :a6738. -:a6739 :a6739 :a6739. -:a6740 :a6740 :a6740. -:a6741 :a6741 :a6741. -:a6742 :a6742 :a6742. -:a6743 :a6743 :a6743. -:a6744 :a6744 :a6744. -:a6745 :a6745 :a6745. -:a6746 :a6746 :a6746. -:a6747 :a6747 :a6747. -:a6748 :a6748 :a6748. -:a6749 :a6749 :a6749. -:a6750 :a6750 :a6750. -:a6751 :a6751 :a6751. -:a6752 :a6752 :a6752. -:a6753 :a6753 :a6753. -:a6754 :a6754 :a6754. -:a6755 :a6755 :a6755. -:a6756 :a6756 :a6756. -:a6757 :a6757 :a6757. -:a6758 :a6758 :a6758. -:a6759 :a6759 :a6759. -:a6760 :a6760 :a6760. -:a6761 :a6761 :a6761. -:a6762 :a6762 :a6762. -:a6763 :a6763 :a6763. -:a6764 :a6764 :a6764. -:a6765 :a6765 :a6765. -:a6766 :a6766 :a6766. -:a6767 :a6767 :a6767. -:a6768 :a6768 :a6768. -:a6769 :a6769 :a6769. -:a6770 :a6770 :a6770. -:a6771 :a6771 :a6771. -:a6772 :a6772 :a6772. -:a6773 :a6773 :a6773. -:a6774 :a6774 :a6774. -:a6775 :a6775 :a6775. -:a6776 :a6776 :a6776. -:a6777 :a6777 :a6777. -:a6778 :a6778 :a6778. -:a6779 :a6779 :a6779. -:a6780 :a6780 :a6780. -:a6781 :a6781 :a6781. -:a6782 :a6782 :a6782. -:a6783 :a6783 :a6783. -:a6784 :a6784 :a6784. -:a6785 :a6785 :a6785. -:a6786 :a6786 :a6786. -:a6787 :a6787 :a6787. -:a6788 :a6788 :a6788. -:a6789 :a6789 :a6789. -:a6790 :a6790 :a6790. -:a6791 :a6791 :a6791. -:a6792 :a6792 :a6792. -:a6793 :a6793 :a6793. -:a6794 :a6794 :a6794. -:a6795 :a6795 :a6795. -:a6796 :a6796 :a6796. -:a6797 :a6797 :a6797. -:a6798 :a6798 :a6798. -:a6799 :a6799 :a6799. -:a6800 :a6800 :a6800. -:a6801 :a6801 :a6801. -:a6802 :a6802 :a6802. -:a6803 :a6803 :a6803. -:a6804 :a6804 :a6804. -:a6805 :a6805 :a6805. -:a6806 :a6806 :a6806. -:a6807 :a6807 :a6807. -:a6808 :a6808 :a6808. -:a6809 :a6809 :a6809. -:a6810 :a6810 :a6810. -:a6811 :a6811 :a6811. -:a6812 :a6812 :a6812. -:a6813 :a6813 :a6813. -:a6814 :a6814 :a6814. -:a6815 :a6815 :a6815. -:a6816 :a6816 :a6816. -:a6817 :a6817 :a6817. -:a6818 :a6818 :a6818. -:a6819 :a6819 :a6819. -:a6820 :a6820 :a6820. -:a6821 :a6821 :a6821. -:a6822 :a6822 :a6822. -:a6823 :a6823 :a6823. -:a6824 :a6824 :a6824. -:a6825 :a6825 :a6825. -:a6826 :a6826 :a6826. -:a6827 :a6827 :a6827. -:a6828 :a6828 :a6828. -:a6829 :a6829 :a6829. -:a6830 :a6830 :a6830. -:a6831 :a6831 :a6831. -:a6832 :a6832 :a6832. -:a6833 :a6833 :a6833. -:a6834 :a6834 :a6834. -:a6835 :a6835 :a6835. -:a6836 :a6836 :a6836. -:a6837 :a6837 :a6837. -:a6838 :a6838 :a6838. -:a6839 :a6839 :a6839. -:a6840 :a6840 :a6840. -:a6841 :a6841 :a6841. -:a6842 :a6842 :a6842. -:a6843 :a6843 :a6843. -:a6844 :a6844 :a6844. -:a6845 :a6845 :a6845. -:a6846 :a6846 :a6846. -:a6847 :a6847 :a6847. -:a6848 :a6848 :a6848. -:a6849 :a6849 :a6849. -:a6850 :a6850 :a6850. -:a6851 :a6851 :a6851. -:a6852 :a6852 :a6852. -:a6853 :a6853 :a6853. -:a6854 :a6854 :a6854. -:a6855 :a6855 :a6855. -:a6856 :a6856 :a6856. -:a6857 :a6857 :a6857. -:a6858 :a6858 :a6858. -:a6859 :a6859 :a6859. -:a6860 :a6860 :a6860. -:a6861 :a6861 :a6861. -:a6862 :a6862 :a6862. -:a6863 :a6863 :a6863. -:a6864 :a6864 :a6864. -:a6865 :a6865 :a6865. -:a6866 :a6866 :a6866. -:a6867 :a6867 :a6867. -:a6868 :a6868 :a6868. -:a6869 :a6869 :a6869. -:a6870 :a6870 :a6870. -:a6871 :a6871 :a6871. -:a6872 :a6872 :a6872. -:a6873 :a6873 :a6873. -:a6874 :a6874 :a6874. -:a6875 :a6875 :a6875. -:a6876 :a6876 :a6876. -:a6877 :a6877 :a6877. -:a6878 :a6878 :a6878. -:a6879 :a6879 :a6879. -:a6880 :a6880 :a6880. -:a6881 :a6881 :a6881. -:a6882 :a6882 :a6882. -:a6883 :a6883 :a6883. -:a6884 :a6884 :a6884. -:a6885 :a6885 :a6885. -:a6886 :a6886 :a6886. -:a6887 :a6887 :a6887. -:a6888 :a6888 :a6888. -:a6889 :a6889 :a6889. -:a6890 :a6890 :a6890. -:a6891 :a6891 :a6891. -:a6892 :a6892 :a6892. -:a6893 :a6893 :a6893. -:a6894 :a6894 :a6894. -:a6895 :a6895 :a6895. -:a6896 :a6896 :a6896. -:a6897 :a6897 :a6897. -:a6898 :a6898 :a6898. -:a6899 :a6899 :a6899. -:a6900 :a6900 :a6900. -:a6901 :a6901 :a6901. -:a6902 :a6902 :a6902. -:a6903 :a6903 :a6903. -:a6904 :a6904 :a6904. -:a6905 :a6905 :a6905. -:a6906 :a6906 :a6906. -:a6907 :a6907 :a6907. -:a6908 :a6908 :a6908. -:a6909 :a6909 :a6909. -:a6910 :a6910 :a6910. -:a6911 :a6911 :a6911. -:a6912 :a6912 :a6912. -:a6913 :a6913 :a6913. -:a6914 :a6914 :a6914. -:a6915 :a6915 :a6915. -:a6916 :a6916 :a6916. -:a6917 :a6917 :a6917. -:a6918 :a6918 :a6918. -:a6919 :a6919 :a6919. -:a6920 :a6920 :a6920. -:a6921 :a6921 :a6921. -:a6922 :a6922 :a6922. -:a6923 :a6923 :a6923. -:a6924 :a6924 :a6924. -:a6925 :a6925 :a6925. -:a6926 :a6926 :a6926. -:a6927 :a6927 :a6927. -:a6928 :a6928 :a6928. -:a6929 :a6929 :a6929. -:a6930 :a6930 :a6930. -:a6931 :a6931 :a6931. -:a6932 :a6932 :a6932. -:a6933 :a6933 :a6933. -:a6934 :a6934 :a6934. -:a6935 :a6935 :a6935. -:a6936 :a6936 :a6936. -:a6937 :a6937 :a6937. -:a6938 :a6938 :a6938. -:a6939 :a6939 :a6939. -:a6940 :a6940 :a6940. -:a6941 :a6941 :a6941. -:a6942 :a6942 :a6942. -:a6943 :a6943 :a6943. -:a6944 :a6944 :a6944. -:a6945 :a6945 :a6945. -:a6946 :a6946 :a6946. -:a6947 :a6947 :a6947. -:a6948 :a6948 :a6948. -:a6949 :a6949 :a6949. -:a6950 :a6950 :a6950. -:a6951 :a6951 :a6951. -:a6952 :a6952 :a6952. -:a6953 :a6953 :a6953. -:a6954 :a6954 :a6954. -:a6955 :a6955 :a6955. -:a6956 :a6956 :a6956. -:a6957 :a6957 :a6957. -:a6958 :a6958 :a6958. -:a6959 :a6959 :a6959. -:a6960 :a6960 :a6960. -:a6961 :a6961 :a6961. -:a6962 :a6962 :a6962. -:a6963 :a6963 :a6963. -:a6964 :a6964 :a6964. -:a6965 :a6965 :a6965. -:a6966 :a6966 :a6966. -:a6967 :a6967 :a6967. -:a6968 :a6968 :a6968. -:a6969 :a6969 :a6969. -:a6970 :a6970 :a6970. -:a6971 :a6971 :a6971. -:a6972 :a6972 :a6972. -:a6973 :a6973 :a6973. -:a6974 :a6974 :a6974. -:a6975 :a6975 :a6975. -:a6976 :a6976 :a6976. -:a6977 :a6977 :a6977. -:a6978 :a6978 :a6978. -:a6979 :a6979 :a6979. -:a6980 :a6980 :a6980. -:a6981 :a6981 :a6981. -:a6982 :a6982 :a6982. -:a6983 :a6983 :a6983. -:a6984 :a6984 :a6984. -:a6985 :a6985 :a6985. -:a6986 :a6986 :a6986. -:a6987 :a6987 :a6987. -:a6988 :a6988 :a6988. -:a6989 :a6989 :a6989. -:a6990 :a6990 :a6990. -:a6991 :a6991 :a6991. -:a6992 :a6992 :a6992. -:a6993 :a6993 :a6993. -:a6994 :a6994 :a6994. -:a6995 :a6995 :a6995. -:a6996 :a6996 :a6996. -:a6997 :a6997 :a6997. -:a6998 :a6998 :a6998. -:a6999 :a6999 :a6999. -:a7000 :a7000 :a7000. -:a7001 :a7001 :a7001. -:a7002 :a7002 :a7002. -:a7003 :a7003 :a7003. -:a7004 :a7004 :a7004. -:a7005 :a7005 :a7005. -:a7006 :a7006 :a7006. -:a7007 :a7007 :a7007. -:a7008 :a7008 :a7008. -:a7009 :a7009 :a7009. -:a7010 :a7010 :a7010. -:a7011 :a7011 :a7011. -:a7012 :a7012 :a7012. -:a7013 :a7013 :a7013. -:a7014 :a7014 :a7014. -:a7015 :a7015 :a7015. -:a7016 :a7016 :a7016. -:a7017 :a7017 :a7017. -:a7018 :a7018 :a7018. -:a7019 :a7019 :a7019. -:a7020 :a7020 :a7020. -:a7021 :a7021 :a7021. -:a7022 :a7022 :a7022. -:a7023 :a7023 :a7023. -:a7024 :a7024 :a7024. -:a7025 :a7025 :a7025. -:a7026 :a7026 :a7026. -:a7027 :a7027 :a7027. -:a7028 :a7028 :a7028. -:a7029 :a7029 :a7029. -:a7030 :a7030 :a7030. -:a7031 :a7031 :a7031. -:a7032 :a7032 :a7032. -:a7033 :a7033 :a7033. -:a7034 :a7034 :a7034. -:a7035 :a7035 :a7035. -:a7036 :a7036 :a7036. -:a7037 :a7037 :a7037. -:a7038 :a7038 :a7038. -:a7039 :a7039 :a7039. -:a7040 :a7040 :a7040. -:a7041 :a7041 :a7041. -:a7042 :a7042 :a7042. -:a7043 :a7043 :a7043. -:a7044 :a7044 :a7044. -:a7045 :a7045 :a7045. -:a7046 :a7046 :a7046. -:a7047 :a7047 :a7047. -:a7048 :a7048 :a7048. -:a7049 :a7049 :a7049. -:a7050 :a7050 :a7050. -:a7051 :a7051 :a7051. -:a7052 :a7052 :a7052. -:a7053 :a7053 :a7053. -:a7054 :a7054 :a7054. -:a7055 :a7055 :a7055. -:a7056 :a7056 :a7056. -:a7057 :a7057 :a7057. -:a7058 :a7058 :a7058. -:a7059 :a7059 :a7059. -:a7060 :a7060 :a7060. -:a7061 :a7061 :a7061. -:a7062 :a7062 :a7062. -:a7063 :a7063 :a7063. -:a7064 :a7064 :a7064. -:a7065 :a7065 :a7065. -:a7066 :a7066 :a7066. -:a7067 :a7067 :a7067. -:a7068 :a7068 :a7068. -:a7069 :a7069 :a7069. -:a7070 :a7070 :a7070. -:a7071 :a7071 :a7071. -:a7072 :a7072 :a7072. -:a7073 :a7073 :a7073. -:a7074 :a7074 :a7074. -:a7075 :a7075 :a7075. -:a7076 :a7076 :a7076. -:a7077 :a7077 :a7077. -:a7078 :a7078 :a7078. -:a7079 :a7079 :a7079. -:a7080 :a7080 :a7080. -:a7081 :a7081 :a7081. -:a7082 :a7082 :a7082. -:a7083 :a7083 :a7083. -:a7084 :a7084 :a7084. -:a7085 :a7085 :a7085. -:a7086 :a7086 :a7086. -:a7087 :a7087 :a7087. -:a7088 :a7088 :a7088. -:a7089 :a7089 :a7089. -:a7090 :a7090 :a7090. -:a7091 :a7091 :a7091. -:a7092 :a7092 :a7092. -:a7093 :a7093 :a7093. -:a7094 :a7094 :a7094. -:a7095 :a7095 :a7095. -:a7096 :a7096 :a7096. -:a7097 :a7097 :a7097. -:a7098 :a7098 :a7098. -:a7099 :a7099 :a7099. -:a7100 :a7100 :a7100. -:a7101 :a7101 :a7101. -:a7102 :a7102 :a7102. -:a7103 :a7103 :a7103. -:a7104 :a7104 :a7104. -:a7105 :a7105 :a7105. -:a7106 :a7106 :a7106. -:a7107 :a7107 :a7107. -:a7108 :a7108 :a7108. -:a7109 :a7109 :a7109. -:a7110 :a7110 :a7110. -:a7111 :a7111 :a7111. -:a7112 :a7112 :a7112. -:a7113 :a7113 :a7113. -:a7114 :a7114 :a7114. -:a7115 :a7115 :a7115. -:a7116 :a7116 :a7116. -:a7117 :a7117 :a7117. -:a7118 :a7118 :a7118. -:a7119 :a7119 :a7119. -:a7120 :a7120 :a7120. -:a7121 :a7121 :a7121. -:a7122 :a7122 :a7122. -:a7123 :a7123 :a7123. -:a7124 :a7124 :a7124. -:a7125 :a7125 :a7125. -:a7126 :a7126 :a7126. -:a7127 :a7127 :a7127. -:a7128 :a7128 :a7128. -:a7129 :a7129 :a7129. -:a7130 :a7130 :a7130. -:a7131 :a7131 :a7131. -:a7132 :a7132 :a7132. -:a7133 :a7133 :a7133. -:a7134 :a7134 :a7134. -:a7135 :a7135 :a7135. -:a7136 :a7136 :a7136. -:a7137 :a7137 :a7137. -:a7138 :a7138 :a7138. -:a7139 :a7139 :a7139. -:a7140 :a7140 :a7140. -:a7141 :a7141 :a7141. -:a7142 :a7142 :a7142. -:a7143 :a7143 :a7143. -:a7144 :a7144 :a7144. -:a7145 :a7145 :a7145. -:a7146 :a7146 :a7146. -:a7147 :a7147 :a7147. -:a7148 :a7148 :a7148. -:a7149 :a7149 :a7149. -:a7150 :a7150 :a7150. -:a7151 :a7151 :a7151. -:a7152 :a7152 :a7152. -:a7153 :a7153 :a7153. -:a7154 :a7154 :a7154. -:a7155 :a7155 :a7155. -:a7156 :a7156 :a7156. -:a7157 :a7157 :a7157. -:a7158 :a7158 :a7158. -:a7159 :a7159 :a7159. -:a7160 :a7160 :a7160. -:a7161 :a7161 :a7161. -:a7162 :a7162 :a7162. -:a7163 :a7163 :a7163. -:a7164 :a7164 :a7164. -:a7165 :a7165 :a7165. -:a7166 :a7166 :a7166. -:a7167 :a7167 :a7167. -:a7168 :a7168 :a7168. -:a7169 :a7169 :a7169. -:a7170 :a7170 :a7170. -:a7171 :a7171 :a7171. -:a7172 :a7172 :a7172. -:a7173 :a7173 :a7173. -:a7174 :a7174 :a7174. -:a7175 :a7175 :a7175. -:a7176 :a7176 :a7176. -:a7177 :a7177 :a7177. -:a7178 :a7178 :a7178. -:a7179 :a7179 :a7179. -:a7180 :a7180 :a7180. -:a7181 :a7181 :a7181. -:a7182 :a7182 :a7182. -:a7183 :a7183 :a7183. -:a7184 :a7184 :a7184. -:a7185 :a7185 :a7185. -:a7186 :a7186 :a7186. -:a7187 :a7187 :a7187. -:a7188 :a7188 :a7188. -:a7189 :a7189 :a7189. -:a7190 :a7190 :a7190. -:a7191 :a7191 :a7191. -:a7192 :a7192 :a7192. -:a7193 :a7193 :a7193. -:a7194 :a7194 :a7194. -:a7195 :a7195 :a7195. -:a7196 :a7196 :a7196. -:a7197 :a7197 :a7197. -:a7198 :a7198 :a7198. -:a7199 :a7199 :a7199. -:a7200 :a7200 :a7200. -:a7201 :a7201 :a7201. -:a7202 :a7202 :a7202. -:a7203 :a7203 :a7203. -:a7204 :a7204 :a7204. -:a7205 :a7205 :a7205. -:a7206 :a7206 :a7206. -:a7207 :a7207 :a7207. -:a7208 :a7208 :a7208. -:a7209 :a7209 :a7209. -:a7210 :a7210 :a7210. -:a7211 :a7211 :a7211. -:a7212 :a7212 :a7212. -:a7213 :a7213 :a7213. -:a7214 :a7214 :a7214. -:a7215 :a7215 :a7215. -:a7216 :a7216 :a7216. -:a7217 :a7217 :a7217. -:a7218 :a7218 :a7218. -:a7219 :a7219 :a7219. -:a7220 :a7220 :a7220. -:a7221 :a7221 :a7221. -:a7222 :a7222 :a7222. -:a7223 :a7223 :a7223. -:a7224 :a7224 :a7224. -:a7225 :a7225 :a7225. -:a7226 :a7226 :a7226. -:a7227 :a7227 :a7227. -:a7228 :a7228 :a7228. -:a7229 :a7229 :a7229. -:a7230 :a7230 :a7230. -:a7231 :a7231 :a7231. -:a7232 :a7232 :a7232. -:a7233 :a7233 :a7233. -:a7234 :a7234 :a7234. -:a7235 :a7235 :a7235. -:a7236 :a7236 :a7236. -:a7237 :a7237 :a7237. -:a7238 :a7238 :a7238. -:a7239 :a7239 :a7239. -:a7240 :a7240 :a7240. -:a7241 :a7241 :a7241. -:a7242 :a7242 :a7242. -:a7243 :a7243 :a7243. -:a7244 :a7244 :a7244. -:a7245 :a7245 :a7245. -:a7246 :a7246 :a7246. -:a7247 :a7247 :a7247. -:a7248 :a7248 :a7248. -:a7249 :a7249 :a7249. -:a7250 :a7250 :a7250. -:a7251 :a7251 :a7251. -:a7252 :a7252 :a7252. -:a7253 :a7253 :a7253. -:a7254 :a7254 :a7254. -:a7255 :a7255 :a7255. -:a7256 :a7256 :a7256. -:a7257 :a7257 :a7257. -:a7258 :a7258 :a7258. -:a7259 :a7259 :a7259. -:a7260 :a7260 :a7260. -:a7261 :a7261 :a7261. -:a7262 :a7262 :a7262. -:a7263 :a7263 :a7263. -:a7264 :a7264 :a7264. -:a7265 :a7265 :a7265. -:a7266 :a7266 :a7266. -:a7267 :a7267 :a7267. -:a7268 :a7268 :a7268. -:a7269 :a7269 :a7269. -:a7270 :a7270 :a7270. -:a7271 :a7271 :a7271. -:a7272 :a7272 :a7272. -:a7273 :a7273 :a7273. -:a7274 :a7274 :a7274. -:a7275 :a7275 :a7275. -:a7276 :a7276 :a7276. -:a7277 :a7277 :a7277. -:a7278 :a7278 :a7278. -:a7279 :a7279 :a7279. -:a7280 :a7280 :a7280. -:a7281 :a7281 :a7281. -:a7282 :a7282 :a7282. -:a7283 :a7283 :a7283. -:a7284 :a7284 :a7284. -:a7285 :a7285 :a7285. -:a7286 :a7286 :a7286. -:a7287 :a7287 :a7287. -:a7288 :a7288 :a7288. -:a7289 :a7289 :a7289. -:a7290 :a7290 :a7290. -:a7291 :a7291 :a7291. -:a7292 :a7292 :a7292. -:a7293 :a7293 :a7293. -:a7294 :a7294 :a7294. -:a7295 :a7295 :a7295. -:a7296 :a7296 :a7296. -:a7297 :a7297 :a7297. -:a7298 :a7298 :a7298. -:a7299 :a7299 :a7299. -:a7300 :a7300 :a7300. -:a7301 :a7301 :a7301. -:a7302 :a7302 :a7302. -:a7303 :a7303 :a7303. -:a7304 :a7304 :a7304. -:a7305 :a7305 :a7305. -:a7306 :a7306 :a7306. -:a7307 :a7307 :a7307. -:a7308 :a7308 :a7308. -:a7309 :a7309 :a7309. -:a7310 :a7310 :a7310. -:a7311 :a7311 :a7311. -:a7312 :a7312 :a7312. -:a7313 :a7313 :a7313. -:a7314 :a7314 :a7314. -:a7315 :a7315 :a7315. -:a7316 :a7316 :a7316. -:a7317 :a7317 :a7317. -:a7318 :a7318 :a7318. -:a7319 :a7319 :a7319. -:a7320 :a7320 :a7320. -:a7321 :a7321 :a7321. -:a7322 :a7322 :a7322. -:a7323 :a7323 :a7323. -:a7324 :a7324 :a7324. -:a7325 :a7325 :a7325. -:a7326 :a7326 :a7326. -:a7327 :a7327 :a7327. -:a7328 :a7328 :a7328. -:a7329 :a7329 :a7329. -:a7330 :a7330 :a7330. -:a7331 :a7331 :a7331. -:a7332 :a7332 :a7332. -:a7333 :a7333 :a7333. -:a7334 :a7334 :a7334. -:a7335 :a7335 :a7335. -:a7336 :a7336 :a7336. -:a7337 :a7337 :a7337. -:a7338 :a7338 :a7338. -:a7339 :a7339 :a7339. -:a7340 :a7340 :a7340. -:a7341 :a7341 :a7341. -:a7342 :a7342 :a7342. -:a7343 :a7343 :a7343. -:a7344 :a7344 :a7344. -:a7345 :a7345 :a7345. -:a7346 :a7346 :a7346. -:a7347 :a7347 :a7347. -:a7348 :a7348 :a7348. -:a7349 :a7349 :a7349. -:a7350 :a7350 :a7350. -:a7351 :a7351 :a7351. -:a7352 :a7352 :a7352. -:a7353 :a7353 :a7353. -:a7354 :a7354 :a7354. -:a7355 :a7355 :a7355. -:a7356 :a7356 :a7356. -:a7357 :a7357 :a7357. -:a7358 :a7358 :a7358. -:a7359 :a7359 :a7359. -:a7360 :a7360 :a7360. -:a7361 :a7361 :a7361. -:a7362 :a7362 :a7362. -:a7363 :a7363 :a7363. -:a7364 :a7364 :a7364. -:a7365 :a7365 :a7365. -:a7366 :a7366 :a7366. -:a7367 :a7367 :a7367. -:a7368 :a7368 :a7368. -:a7369 :a7369 :a7369. -:a7370 :a7370 :a7370. -:a7371 :a7371 :a7371. -:a7372 :a7372 :a7372. -:a7373 :a7373 :a7373. -:a7374 :a7374 :a7374. -:a7375 :a7375 :a7375. -:a7376 :a7376 :a7376. -:a7377 :a7377 :a7377. -:a7378 :a7378 :a7378. -:a7379 :a7379 :a7379. -:a7380 :a7380 :a7380. -:a7381 :a7381 :a7381. -:a7382 :a7382 :a7382. -:a7383 :a7383 :a7383. -:a7384 :a7384 :a7384. -:a7385 :a7385 :a7385. -:a7386 :a7386 :a7386. -:a7387 :a7387 :a7387. -:a7388 :a7388 :a7388. -:a7389 :a7389 :a7389. -:a7390 :a7390 :a7390. -:a7391 :a7391 :a7391. -:a7392 :a7392 :a7392. -:a7393 :a7393 :a7393. -:a7394 :a7394 :a7394. -:a7395 :a7395 :a7395. -:a7396 :a7396 :a7396. -:a7397 :a7397 :a7397. -:a7398 :a7398 :a7398. -:a7399 :a7399 :a7399. -:a7400 :a7400 :a7400. -:a7401 :a7401 :a7401. -:a7402 :a7402 :a7402. -:a7403 :a7403 :a7403. -:a7404 :a7404 :a7404. -:a7405 :a7405 :a7405. -:a7406 :a7406 :a7406. -:a7407 :a7407 :a7407. -:a7408 :a7408 :a7408. -:a7409 :a7409 :a7409. -:a7410 :a7410 :a7410. -:a7411 :a7411 :a7411. -:a7412 :a7412 :a7412. -:a7413 :a7413 :a7413. -:a7414 :a7414 :a7414. -:a7415 :a7415 :a7415. -:a7416 :a7416 :a7416. -:a7417 :a7417 :a7417. -:a7418 :a7418 :a7418. -:a7419 :a7419 :a7419. -:a7420 :a7420 :a7420. -:a7421 :a7421 :a7421. -:a7422 :a7422 :a7422. -:a7423 :a7423 :a7423. -:a7424 :a7424 :a7424. -:a7425 :a7425 :a7425. -:a7426 :a7426 :a7426. -:a7427 :a7427 :a7427. -:a7428 :a7428 :a7428. -:a7429 :a7429 :a7429. -:a7430 :a7430 :a7430. -:a7431 :a7431 :a7431. -:a7432 :a7432 :a7432. -:a7433 :a7433 :a7433. -:a7434 :a7434 :a7434. -:a7435 :a7435 :a7435. -:a7436 :a7436 :a7436. -:a7437 :a7437 :a7437. -:a7438 :a7438 :a7438. -:a7439 :a7439 :a7439. -:a7440 :a7440 :a7440. -:a7441 :a7441 :a7441. -:a7442 :a7442 :a7442. -:a7443 :a7443 :a7443. -:a7444 :a7444 :a7444. -:a7445 :a7445 :a7445. -:a7446 :a7446 :a7446. -:a7447 :a7447 :a7447. -:a7448 :a7448 :a7448. -:a7449 :a7449 :a7449. -:a7450 :a7450 :a7450. -:a7451 :a7451 :a7451. -:a7452 :a7452 :a7452. -:a7453 :a7453 :a7453. -:a7454 :a7454 :a7454. -:a7455 :a7455 :a7455. -:a7456 :a7456 :a7456. -:a7457 :a7457 :a7457. -:a7458 :a7458 :a7458. -:a7459 :a7459 :a7459. -:a7460 :a7460 :a7460. -:a7461 :a7461 :a7461. -:a7462 :a7462 :a7462. -:a7463 :a7463 :a7463. -:a7464 :a7464 :a7464. -:a7465 :a7465 :a7465. -:a7466 :a7466 :a7466. -:a7467 :a7467 :a7467. -:a7468 :a7468 :a7468. -:a7469 :a7469 :a7469. -:a7470 :a7470 :a7470. -:a7471 :a7471 :a7471. -:a7472 :a7472 :a7472. -:a7473 :a7473 :a7473. -:a7474 :a7474 :a7474. -:a7475 :a7475 :a7475. -:a7476 :a7476 :a7476. -:a7477 :a7477 :a7477. -:a7478 :a7478 :a7478. -:a7479 :a7479 :a7479. -:a7480 :a7480 :a7480. -:a7481 :a7481 :a7481. -:a7482 :a7482 :a7482. -:a7483 :a7483 :a7483. -:a7484 :a7484 :a7484. -:a7485 :a7485 :a7485. -:a7486 :a7486 :a7486. -:a7487 :a7487 :a7487. -:a7488 :a7488 :a7488. -:a7489 :a7489 :a7489. -:a7490 :a7490 :a7490. -:a7491 :a7491 :a7491. -:a7492 :a7492 :a7492. -:a7493 :a7493 :a7493. -:a7494 :a7494 :a7494. -:a7495 :a7495 :a7495. -:a7496 :a7496 :a7496. -:a7497 :a7497 :a7497. -:a7498 :a7498 :a7498. -:a7499 :a7499 :a7499. -:a7500 :a7500 :a7500. -:a7501 :a7501 :a7501. -:a7502 :a7502 :a7502. -:a7503 :a7503 :a7503. -:a7504 :a7504 :a7504. -:a7505 :a7505 :a7505. -:a7506 :a7506 :a7506. -:a7507 :a7507 :a7507. -:a7508 :a7508 :a7508. -:a7509 :a7509 :a7509. -:a7510 :a7510 :a7510. -:a7511 :a7511 :a7511. -:a7512 :a7512 :a7512. -:a7513 :a7513 :a7513. -:a7514 :a7514 :a7514. -:a7515 :a7515 :a7515. -:a7516 :a7516 :a7516. -:a7517 :a7517 :a7517. -:a7518 :a7518 :a7518. -:a7519 :a7519 :a7519. -:a7520 :a7520 :a7520. -:a7521 :a7521 :a7521. -:a7522 :a7522 :a7522. -:a7523 :a7523 :a7523. -:a7524 :a7524 :a7524. -:a7525 :a7525 :a7525. -:a7526 :a7526 :a7526. -:a7527 :a7527 :a7527. -:a7528 :a7528 :a7528. -:a7529 :a7529 :a7529. -:a7530 :a7530 :a7530. -:a7531 :a7531 :a7531. -:a7532 :a7532 :a7532. -:a7533 :a7533 :a7533. -:a7534 :a7534 :a7534. -:a7535 :a7535 :a7535. -:a7536 :a7536 :a7536. -:a7537 :a7537 :a7537. -:a7538 :a7538 :a7538. -:a7539 :a7539 :a7539. -:a7540 :a7540 :a7540. -:a7541 :a7541 :a7541. -:a7542 :a7542 :a7542. -:a7543 :a7543 :a7543. -:a7544 :a7544 :a7544. -:a7545 :a7545 :a7545. -:a7546 :a7546 :a7546. -:a7547 :a7547 :a7547. -:a7548 :a7548 :a7548. -:a7549 :a7549 :a7549. -:a7550 :a7550 :a7550. -:a7551 :a7551 :a7551. -:a7552 :a7552 :a7552. -:a7553 :a7553 :a7553. -:a7554 :a7554 :a7554. -:a7555 :a7555 :a7555. -:a7556 :a7556 :a7556. -:a7557 :a7557 :a7557. -:a7558 :a7558 :a7558. -:a7559 :a7559 :a7559. -:a7560 :a7560 :a7560. -:a7561 :a7561 :a7561. -:a7562 :a7562 :a7562. -:a7563 :a7563 :a7563. -:a7564 :a7564 :a7564. -:a7565 :a7565 :a7565. -:a7566 :a7566 :a7566. -:a7567 :a7567 :a7567. -:a7568 :a7568 :a7568. -:a7569 :a7569 :a7569. -:a7570 :a7570 :a7570. -:a7571 :a7571 :a7571. -:a7572 :a7572 :a7572. -:a7573 :a7573 :a7573. -:a7574 :a7574 :a7574. -:a7575 :a7575 :a7575. -:a7576 :a7576 :a7576. -:a7577 :a7577 :a7577. -:a7578 :a7578 :a7578. -:a7579 :a7579 :a7579. -:a7580 :a7580 :a7580. -:a7581 :a7581 :a7581. -:a7582 :a7582 :a7582. -:a7583 :a7583 :a7583. -:a7584 :a7584 :a7584. -:a7585 :a7585 :a7585. -:a7586 :a7586 :a7586. -:a7587 :a7587 :a7587. -:a7588 :a7588 :a7588. -:a7589 :a7589 :a7589. -:a7590 :a7590 :a7590. -:a7591 :a7591 :a7591. -:a7592 :a7592 :a7592. -:a7593 :a7593 :a7593. -:a7594 :a7594 :a7594. -:a7595 :a7595 :a7595. -:a7596 :a7596 :a7596. -:a7597 :a7597 :a7597. -:a7598 :a7598 :a7598. -:a7599 :a7599 :a7599. -:a7600 :a7600 :a7600. -:a7601 :a7601 :a7601. -:a7602 :a7602 :a7602. -:a7603 :a7603 :a7603. -:a7604 :a7604 :a7604. -:a7605 :a7605 :a7605. -:a7606 :a7606 :a7606. -:a7607 :a7607 :a7607. -:a7608 :a7608 :a7608. -:a7609 :a7609 :a7609. -:a7610 :a7610 :a7610. -:a7611 :a7611 :a7611. -:a7612 :a7612 :a7612. -:a7613 :a7613 :a7613. -:a7614 :a7614 :a7614. -:a7615 :a7615 :a7615. -:a7616 :a7616 :a7616. -:a7617 :a7617 :a7617. -:a7618 :a7618 :a7618. -:a7619 :a7619 :a7619. -:a7620 :a7620 :a7620. -:a7621 :a7621 :a7621. -:a7622 :a7622 :a7622. -:a7623 :a7623 :a7623. -:a7624 :a7624 :a7624. -:a7625 :a7625 :a7625. -:a7626 :a7626 :a7626. -:a7627 :a7627 :a7627. -:a7628 :a7628 :a7628. -:a7629 :a7629 :a7629. -:a7630 :a7630 :a7630. -:a7631 :a7631 :a7631. -:a7632 :a7632 :a7632. -:a7633 :a7633 :a7633. -:a7634 :a7634 :a7634. -:a7635 :a7635 :a7635. -:a7636 :a7636 :a7636. -:a7637 :a7637 :a7637. -:a7638 :a7638 :a7638. -:a7639 :a7639 :a7639. -:a7640 :a7640 :a7640. -:a7641 :a7641 :a7641. -:a7642 :a7642 :a7642. -:a7643 :a7643 :a7643. -:a7644 :a7644 :a7644. -:a7645 :a7645 :a7645. -:a7646 :a7646 :a7646. -:a7647 :a7647 :a7647. -:a7648 :a7648 :a7648. -:a7649 :a7649 :a7649. -:a7650 :a7650 :a7650. -:a7651 :a7651 :a7651. -:a7652 :a7652 :a7652. -:a7653 :a7653 :a7653. -:a7654 :a7654 :a7654. -:a7655 :a7655 :a7655. -:a7656 :a7656 :a7656. -:a7657 :a7657 :a7657. -:a7658 :a7658 :a7658. -:a7659 :a7659 :a7659. -:a7660 :a7660 :a7660. -:a7661 :a7661 :a7661. -:a7662 :a7662 :a7662. -:a7663 :a7663 :a7663. -:a7664 :a7664 :a7664. -:a7665 :a7665 :a7665. -:a7666 :a7666 :a7666. -:a7667 :a7667 :a7667. -:a7668 :a7668 :a7668. -:a7669 :a7669 :a7669. -:a7670 :a7670 :a7670. -:a7671 :a7671 :a7671. -:a7672 :a7672 :a7672. -:a7673 :a7673 :a7673. -:a7674 :a7674 :a7674. -:a7675 :a7675 :a7675. -:a7676 :a7676 :a7676. -:a7677 :a7677 :a7677. -:a7678 :a7678 :a7678. -:a7679 :a7679 :a7679. -:a7680 :a7680 :a7680. -:a7681 :a7681 :a7681. -:a7682 :a7682 :a7682. -:a7683 :a7683 :a7683. -:a7684 :a7684 :a7684. -:a7685 :a7685 :a7685. -:a7686 :a7686 :a7686. -:a7687 :a7687 :a7687. -:a7688 :a7688 :a7688. -:a7689 :a7689 :a7689. -:a7690 :a7690 :a7690. -:a7691 :a7691 :a7691. -:a7692 :a7692 :a7692. -:a7693 :a7693 :a7693. -:a7694 :a7694 :a7694. -:a7695 :a7695 :a7695. -:a7696 :a7696 :a7696. -:a7697 :a7697 :a7697. -:a7698 :a7698 :a7698. -:a7699 :a7699 :a7699. -:a7700 :a7700 :a7700. -:a7701 :a7701 :a7701. -:a7702 :a7702 :a7702. -:a7703 :a7703 :a7703. -:a7704 :a7704 :a7704. -:a7705 :a7705 :a7705. -:a7706 :a7706 :a7706. -:a7707 :a7707 :a7707. -:a7708 :a7708 :a7708. -:a7709 :a7709 :a7709. -:a7710 :a7710 :a7710. -:a7711 :a7711 :a7711. -:a7712 :a7712 :a7712. -:a7713 :a7713 :a7713. -:a7714 :a7714 :a7714. -:a7715 :a7715 :a7715. -:a7716 :a7716 :a7716. -:a7717 :a7717 :a7717. -:a7718 :a7718 :a7718. -:a7719 :a7719 :a7719. -:a7720 :a7720 :a7720. -:a7721 :a7721 :a7721. -:a7722 :a7722 :a7722. -:a7723 :a7723 :a7723. -:a7724 :a7724 :a7724. -:a7725 :a7725 :a7725. -:a7726 :a7726 :a7726. -:a7727 :a7727 :a7727. -:a7728 :a7728 :a7728. -:a7729 :a7729 :a7729. -:a7730 :a7730 :a7730. -:a7731 :a7731 :a7731. -:a7732 :a7732 :a7732. -:a7733 :a7733 :a7733. -:a7734 :a7734 :a7734. -:a7735 :a7735 :a7735. -:a7736 :a7736 :a7736. -:a7737 :a7737 :a7737. -:a7738 :a7738 :a7738. -:a7739 :a7739 :a7739. -:a7740 :a7740 :a7740. -:a7741 :a7741 :a7741. -:a7742 :a7742 :a7742. -:a7743 :a7743 :a7743. -:a7744 :a7744 :a7744. -:a7745 :a7745 :a7745. -:a7746 :a7746 :a7746. -:a7747 :a7747 :a7747. -:a7748 :a7748 :a7748. -:a7749 :a7749 :a7749. -:a7750 :a7750 :a7750. -:a7751 :a7751 :a7751. -:a7752 :a7752 :a7752. -:a7753 :a7753 :a7753. -:a7754 :a7754 :a7754. -:a7755 :a7755 :a7755. -:a7756 :a7756 :a7756. -:a7757 :a7757 :a7757. -:a7758 :a7758 :a7758. -:a7759 :a7759 :a7759. -:a7760 :a7760 :a7760. -:a7761 :a7761 :a7761. -:a7762 :a7762 :a7762. -:a7763 :a7763 :a7763. -:a7764 :a7764 :a7764. -:a7765 :a7765 :a7765. -:a7766 :a7766 :a7766. -:a7767 :a7767 :a7767. -:a7768 :a7768 :a7768. -:a7769 :a7769 :a7769. -:a7770 :a7770 :a7770. -:a7771 :a7771 :a7771. -:a7772 :a7772 :a7772. -:a7773 :a7773 :a7773. -:a7774 :a7774 :a7774. -:a7775 :a7775 :a7775. -:a7776 :a7776 :a7776. -:a7777 :a7777 :a7777. -:a7778 :a7778 :a7778. -:a7779 :a7779 :a7779. -:a7780 :a7780 :a7780. -:a7781 :a7781 :a7781. -:a7782 :a7782 :a7782. -:a7783 :a7783 :a7783. -:a7784 :a7784 :a7784. -:a7785 :a7785 :a7785. -:a7786 :a7786 :a7786. -:a7787 :a7787 :a7787. -:a7788 :a7788 :a7788. -:a7789 :a7789 :a7789. -:a7790 :a7790 :a7790. -:a7791 :a7791 :a7791. -:a7792 :a7792 :a7792. -:a7793 :a7793 :a7793. -:a7794 :a7794 :a7794. -:a7795 :a7795 :a7795. -:a7796 :a7796 :a7796. -:a7797 :a7797 :a7797. -:a7798 :a7798 :a7798. -:a7799 :a7799 :a7799. -:a7800 :a7800 :a7800. -:a7801 :a7801 :a7801. -:a7802 :a7802 :a7802. -:a7803 :a7803 :a7803. -:a7804 :a7804 :a7804. -:a7805 :a7805 :a7805. -:a7806 :a7806 :a7806. -:a7807 :a7807 :a7807. -:a7808 :a7808 :a7808. -:a7809 :a7809 :a7809. -:a7810 :a7810 :a7810. -:a7811 :a7811 :a7811. -:a7812 :a7812 :a7812. -:a7813 :a7813 :a7813. -:a7814 :a7814 :a7814. -:a7815 :a7815 :a7815. -:a7816 :a7816 :a7816. -:a7817 :a7817 :a7817. -:a7818 :a7818 :a7818. -:a7819 :a7819 :a7819. -:a7820 :a7820 :a7820. -:a7821 :a7821 :a7821. -:a7822 :a7822 :a7822. -:a7823 :a7823 :a7823. -:a7824 :a7824 :a7824. -:a7825 :a7825 :a7825. -:a7826 :a7826 :a7826. -:a7827 :a7827 :a7827. -:a7828 :a7828 :a7828. -:a7829 :a7829 :a7829. -:a7830 :a7830 :a7830. -:a7831 :a7831 :a7831. -:a7832 :a7832 :a7832. -:a7833 :a7833 :a7833. -:a7834 :a7834 :a7834. -:a7835 :a7835 :a7835. -:a7836 :a7836 :a7836. -:a7837 :a7837 :a7837. -:a7838 :a7838 :a7838. -:a7839 :a7839 :a7839. -:a7840 :a7840 :a7840. -:a7841 :a7841 :a7841. -:a7842 :a7842 :a7842. -:a7843 :a7843 :a7843. -:a7844 :a7844 :a7844. -:a7845 :a7845 :a7845. -:a7846 :a7846 :a7846. -:a7847 :a7847 :a7847. -:a7848 :a7848 :a7848. -:a7849 :a7849 :a7849. -:a7850 :a7850 :a7850. -:a7851 :a7851 :a7851. -:a7852 :a7852 :a7852. -:a7853 :a7853 :a7853. -:a7854 :a7854 :a7854. -:a7855 :a7855 :a7855. -:a7856 :a7856 :a7856. -:a7857 :a7857 :a7857. -:a7858 :a7858 :a7858. -:a7859 :a7859 :a7859. -:a7860 :a7860 :a7860. -:a7861 :a7861 :a7861. -:a7862 :a7862 :a7862. -:a7863 :a7863 :a7863. -:a7864 :a7864 :a7864. -:a7865 :a7865 :a7865. -:a7866 :a7866 :a7866. -:a7867 :a7867 :a7867. -:a7868 :a7868 :a7868. -:a7869 :a7869 :a7869. -:a7870 :a7870 :a7870. -:a7871 :a7871 :a7871. -:a7872 :a7872 :a7872. -:a7873 :a7873 :a7873. -:a7874 :a7874 :a7874. -:a7875 :a7875 :a7875. -:a7876 :a7876 :a7876. -:a7877 :a7877 :a7877. -:a7878 :a7878 :a7878. -:a7879 :a7879 :a7879. -:a7880 :a7880 :a7880. -:a7881 :a7881 :a7881. -:a7882 :a7882 :a7882. -:a7883 :a7883 :a7883. -:a7884 :a7884 :a7884. -:a7885 :a7885 :a7885. -:a7886 :a7886 :a7886. -:a7887 :a7887 :a7887. -:a7888 :a7888 :a7888. -:a7889 :a7889 :a7889. -:a7890 :a7890 :a7890. -:a7891 :a7891 :a7891. -:a7892 :a7892 :a7892. -:a7893 :a7893 :a7893. -:a7894 :a7894 :a7894. -:a7895 :a7895 :a7895. -:a7896 :a7896 :a7896. -:a7897 :a7897 :a7897. -:a7898 :a7898 :a7898. -:a7899 :a7899 :a7899. -:a7900 :a7900 :a7900. -:a7901 :a7901 :a7901. -:a7902 :a7902 :a7902. -:a7903 :a7903 :a7903. -:a7904 :a7904 :a7904. -:a7905 :a7905 :a7905. -:a7906 :a7906 :a7906. -:a7907 :a7907 :a7907. -:a7908 :a7908 :a7908. -:a7909 :a7909 :a7909. -:a7910 :a7910 :a7910. -:a7911 :a7911 :a7911. -:a7912 :a7912 :a7912. -:a7913 :a7913 :a7913. -:a7914 :a7914 :a7914. -:a7915 :a7915 :a7915. -:a7916 :a7916 :a7916. -:a7917 :a7917 :a7917. -:a7918 :a7918 :a7918. -:a7919 :a7919 :a7919. -:a7920 :a7920 :a7920. -:a7921 :a7921 :a7921. -:a7922 :a7922 :a7922. -:a7923 :a7923 :a7923. -:a7924 :a7924 :a7924. -:a7925 :a7925 :a7925. -:a7926 :a7926 :a7926. -:a7927 :a7927 :a7927. -:a7928 :a7928 :a7928. -:a7929 :a7929 :a7929. -:a7930 :a7930 :a7930. -:a7931 :a7931 :a7931. -:a7932 :a7932 :a7932. -:a7933 :a7933 :a7933. -:a7934 :a7934 :a7934. -:a7935 :a7935 :a7935. -:a7936 :a7936 :a7936. -:a7937 :a7937 :a7937. -:a7938 :a7938 :a7938. -:a7939 :a7939 :a7939. -:a7940 :a7940 :a7940. -:a7941 :a7941 :a7941. -:a7942 :a7942 :a7942. -:a7943 :a7943 :a7943. -:a7944 :a7944 :a7944. -:a7945 :a7945 :a7945. -:a7946 :a7946 :a7946. -:a7947 :a7947 :a7947. -:a7948 :a7948 :a7948. -:a7949 :a7949 :a7949. -:a7950 :a7950 :a7950. -:a7951 :a7951 :a7951. -:a7952 :a7952 :a7952. -:a7953 :a7953 :a7953. -:a7954 :a7954 :a7954. -:a7955 :a7955 :a7955. -:a7956 :a7956 :a7956. -:a7957 :a7957 :a7957. -:a7958 :a7958 :a7958. -:a7959 :a7959 :a7959. -:a7960 :a7960 :a7960. -:a7961 :a7961 :a7961. -:a7962 :a7962 :a7962. -:a7963 :a7963 :a7963. -:a7964 :a7964 :a7964. -:a7965 :a7965 :a7965. -:a7966 :a7966 :a7966. -:a7967 :a7967 :a7967. -:a7968 :a7968 :a7968. -:a7969 :a7969 :a7969. -:a7970 :a7970 :a7970. -:a7971 :a7971 :a7971. -:a7972 :a7972 :a7972. -:a7973 :a7973 :a7973. -:a7974 :a7974 :a7974. -:a7975 :a7975 :a7975. -:a7976 :a7976 :a7976. -:a7977 :a7977 :a7977. -:a7978 :a7978 :a7978. -:a7979 :a7979 :a7979. -:a7980 :a7980 :a7980. -:a7981 :a7981 :a7981. -:a7982 :a7982 :a7982. -:a7983 :a7983 :a7983. -:a7984 :a7984 :a7984. -:a7985 :a7985 :a7985. -:a7986 :a7986 :a7986. -:a7987 :a7987 :a7987. -:a7988 :a7988 :a7988. -:a7989 :a7989 :a7989. -:a7990 :a7990 :a7990. -:a7991 :a7991 :a7991. -:a7992 :a7992 :a7992. -:a7993 :a7993 :a7993. -:a7994 :a7994 :a7994. -:a7995 :a7995 :a7995. -:a7996 :a7996 :a7996. -:a7997 :a7997 :a7997. -:a7998 :a7998 :a7998. -:a7999 :a7999 :a7999. -:a8000 :a8000 :a8000. -:a8001 :a8001 :a8001. -:a8002 :a8002 :a8002. -:a8003 :a8003 :a8003. -:a8004 :a8004 :a8004. -:a8005 :a8005 :a8005. -:a8006 :a8006 :a8006. -:a8007 :a8007 :a8007. -:a8008 :a8008 :a8008. -:a8009 :a8009 :a8009. -:a8010 :a8010 :a8010. -:a8011 :a8011 :a8011. -:a8012 :a8012 :a8012. -:a8013 :a8013 :a8013. -:a8014 :a8014 :a8014. -:a8015 :a8015 :a8015. -:a8016 :a8016 :a8016. -:a8017 :a8017 :a8017. -:a8018 :a8018 :a8018. -:a8019 :a8019 :a8019. -:a8020 :a8020 :a8020. -:a8021 :a8021 :a8021. -:a8022 :a8022 :a8022. -:a8023 :a8023 :a8023. -:a8024 :a8024 :a8024. -:a8025 :a8025 :a8025. -:a8026 :a8026 :a8026. -:a8027 :a8027 :a8027. -:a8028 :a8028 :a8028. -:a8029 :a8029 :a8029. -:a8030 :a8030 :a8030. -:a8031 :a8031 :a8031. -:a8032 :a8032 :a8032. -:a8033 :a8033 :a8033. -:a8034 :a8034 :a8034. -:a8035 :a8035 :a8035. -:a8036 :a8036 :a8036. -:a8037 :a8037 :a8037. -:a8038 :a8038 :a8038. -:a8039 :a8039 :a8039. -:a8040 :a8040 :a8040. -:a8041 :a8041 :a8041. -:a8042 :a8042 :a8042. -:a8043 :a8043 :a8043. -:a8044 :a8044 :a8044. -:a8045 :a8045 :a8045. -:a8046 :a8046 :a8046. -:a8047 :a8047 :a8047. -:a8048 :a8048 :a8048. -:a8049 :a8049 :a8049. -:a8050 :a8050 :a8050. -:a8051 :a8051 :a8051. -:a8052 :a8052 :a8052. -:a8053 :a8053 :a8053. -:a8054 :a8054 :a8054. -:a8055 :a8055 :a8055. -:a8056 :a8056 :a8056. -:a8057 :a8057 :a8057. -:a8058 :a8058 :a8058. -:a8059 :a8059 :a8059. -:a8060 :a8060 :a8060. -:a8061 :a8061 :a8061. -:a8062 :a8062 :a8062. -:a8063 :a8063 :a8063. -:a8064 :a8064 :a8064. -:a8065 :a8065 :a8065. -:a8066 :a8066 :a8066. -:a8067 :a8067 :a8067. -:a8068 :a8068 :a8068. -:a8069 :a8069 :a8069. -:a8070 :a8070 :a8070. -:a8071 :a8071 :a8071. -:a8072 :a8072 :a8072. -:a8073 :a8073 :a8073. -:a8074 :a8074 :a8074. -:a8075 :a8075 :a8075. -:a8076 :a8076 :a8076. -:a8077 :a8077 :a8077. -:a8078 :a8078 :a8078. -:a8079 :a8079 :a8079. -:a8080 :a8080 :a8080. -:a8081 :a8081 :a8081. -:a8082 :a8082 :a8082. -:a8083 :a8083 :a8083. -:a8084 :a8084 :a8084. -:a8085 :a8085 :a8085. -:a8086 :a8086 :a8086. -:a8087 :a8087 :a8087. -:a8088 :a8088 :a8088. -:a8089 :a8089 :a8089. -:a8090 :a8090 :a8090. -:a8091 :a8091 :a8091. -:a8092 :a8092 :a8092. -:a8093 :a8093 :a8093. -:a8094 :a8094 :a8094. -:a8095 :a8095 :a8095. -:a8096 :a8096 :a8096. -:a8097 :a8097 :a8097. -:a8098 :a8098 :a8098. -:a8099 :a8099 :a8099. -:a8100 :a8100 :a8100. -:a8101 :a8101 :a8101. -:a8102 :a8102 :a8102. -:a8103 :a8103 :a8103. -:a8104 :a8104 :a8104. -:a8105 :a8105 :a8105. -:a8106 :a8106 :a8106. -:a8107 :a8107 :a8107. -:a8108 :a8108 :a8108. -:a8109 :a8109 :a8109. -:a8110 :a8110 :a8110. -:a8111 :a8111 :a8111. -:a8112 :a8112 :a8112. -:a8113 :a8113 :a8113. -:a8114 :a8114 :a8114. -:a8115 :a8115 :a8115. -:a8116 :a8116 :a8116. -:a8117 :a8117 :a8117. -:a8118 :a8118 :a8118. -:a8119 :a8119 :a8119. -:a8120 :a8120 :a8120. -:a8121 :a8121 :a8121. -:a8122 :a8122 :a8122. -:a8123 :a8123 :a8123. -:a8124 :a8124 :a8124. -:a8125 :a8125 :a8125. -:a8126 :a8126 :a8126. -:a8127 :a8127 :a8127. -:a8128 :a8128 :a8128. -:a8129 :a8129 :a8129. -:a8130 :a8130 :a8130. -:a8131 :a8131 :a8131. -:a8132 :a8132 :a8132. -:a8133 :a8133 :a8133. -:a8134 :a8134 :a8134. -:a8135 :a8135 :a8135. -:a8136 :a8136 :a8136. -:a8137 :a8137 :a8137. -:a8138 :a8138 :a8138. -:a8139 :a8139 :a8139. -:a8140 :a8140 :a8140. -:a8141 :a8141 :a8141. -:a8142 :a8142 :a8142. -:a8143 :a8143 :a8143. -:a8144 :a8144 :a8144. -:a8145 :a8145 :a8145. -:a8146 :a8146 :a8146. -:a8147 :a8147 :a8147. -:a8148 :a8148 :a8148. -:a8149 :a8149 :a8149. -:a8150 :a8150 :a8150. -:a8151 :a8151 :a8151. -:a8152 :a8152 :a8152. -:a8153 :a8153 :a8153. -:a8154 :a8154 :a8154. -:a8155 :a8155 :a8155. -:a8156 :a8156 :a8156. -:a8157 :a8157 :a8157. -:a8158 :a8158 :a8158. -:a8159 :a8159 :a8159. -:a8160 :a8160 :a8160. -:a8161 :a8161 :a8161. -:a8162 :a8162 :a8162. -:a8163 :a8163 :a8163. -:a8164 :a8164 :a8164. -:a8165 :a8165 :a8165. -:a8166 :a8166 :a8166. -:a8167 :a8167 :a8167. -:a8168 :a8168 :a8168. -:a8169 :a8169 :a8169. -:a8170 :a8170 :a8170. -:a8171 :a8171 :a8171. -:a8172 :a8172 :a8172. -:a8173 :a8173 :a8173. -:a8174 :a8174 :a8174. -:a8175 :a8175 :a8175. -:a8176 :a8176 :a8176. -:a8177 :a8177 :a8177. -:a8178 :a8178 :a8178. -:a8179 :a8179 :a8179. -:a8180 :a8180 :a8180. -:a8181 :a8181 :a8181. -:a8182 :a8182 :a8182. -:a8183 :a8183 :a8183. -:a8184 :a8184 :a8184. -:a8185 :a8185 :a8185. -:a8186 :a8186 :a8186. -:a8187 :a8187 :a8187. -:a8188 :a8188 :a8188. -:a8189 :a8189 :a8189. -:a8190 :a8190 :a8190. -:a8191 :a8191 :a8191. -:a8192 :a8192 :a8192. -:a8193 :a8193 :a8193. -:a8194 :a8194 :a8194. -:a8195 :a8195 :a8195. -:a8196 :a8196 :a8196. -:a8197 :a8197 :a8197. -:a8198 :a8198 :a8198. -:a8199 :a8199 :a8199. -:a8200 :a8200 :a8200. -:a8201 :a8201 :a8201. -:a8202 :a8202 :a8202. -:a8203 :a8203 :a8203. -:a8204 :a8204 :a8204. -:a8205 :a8205 :a8205. -:a8206 :a8206 :a8206. -:a8207 :a8207 :a8207. -:a8208 :a8208 :a8208. -:a8209 :a8209 :a8209. -:a8210 :a8210 :a8210. -:a8211 :a8211 :a8211. -:a8212 :a8212 :a8212. -:a8213 :a8213 :a8213. -:a8214 :a8214 :a8214. -:a8215 :a8215 :a8215. -:a8216 :a8216 :a8216. -:a8217 :a8217 :a8217. -:a8218 :a8218 :a8218. -:a8219 :a8219 :a8219. -:a8220 :a8220 :a8220. -:a8221 :a8221 :a8221. -:a8222 :a8222 :a8222. -:a8223 :a8223 :a8223. -:a8224 :a8224 :a8224. -:a8225 :a8225 :a8225. -:a8226 :a8226 :a8226. -:a8227 :a8227 :a8227. -:a8228 :a8228 :a8228. -:a8229 :a8229 :a8229. -:a8230 :a8230 :a8230. -:a8231 :a8231 :a8231. -:a8232 :a8232 :a8232. -:a8233 :a8233 :a8233. -:a8234 :a8234 :a8234. -:a8235 :a8235 :a8235. -:a8236 :a8236 :a8236. -:a8237 :a8237 :a8237. -:a8238 :a8238 :a8238. -:a8239 :a8239 :a8239. -:a8240 :a8240 :a8240. -:a8241 :a8241 :a8241. -:a8242 :a8242 :a8242. -:a8243 :a8243 :a8243. -:a8244 :a8244 :a8244. -:a8245 :a8245 :a8245. -:a8246 :a8246 :a8246. -:a8247 :a8247 :a8247. -:a8248 :a8248 :a8248. -:a8249 :a8249 :a8249. -:a8250 :a8250 :a8250. -:a8251 :a8251 :a8251. -:a8252 :a8252 :a8252. -:a8253 :a8253 :a8253. -:a8254 :a8254 :a8254. -:a8255 :a8255 :a8255. -:a8256 :a8256 :a8256. -:a8257 :a8257 :a8257. -:a8258 :a8258 :a8258. -:a8259 :a8259 :a8259. -:a8260 :a8260 :a8260. -:a8261 :a8261 :a8261. -:a8262 :a8262 :a8262. -:a8263 :a8263 :a8263. -:a8264 :a8264 :a8264. -:a8265 :a8265 :a8265. -:a8266 :a8266 :a8266. -:a8267 :a8267 :a8267. -:a8268 :a8268 :a8268. -:a8269 :a8269 :a8269. -:a8270 :a8270 :a8270. -:a8271 :a8271 :a8271. -:a8272 :a8272 :a8272. -:a8273 :a8273 :a8273. -:a8274 :a8274 :a8274. -:a8275 :a8275 :a8275. -:a8276 :a8276 :a8276. -:a8277 :a8277 :a8277. -:a8278 :a8278 :a8278. -:a8279 :a8279 :a8279. -:a8280 :a8280 :a8280. -:a8281 :a8281 :a8281. -:a8282 :a8282 :a8282. -:a8283 :a8283 :a8283. -:a8284 :a8284 :a8284. -:a8285 :a8285 :a8285. -:a8286 :a8286 :a8286. -:a8287 :a8287 :a8287. -:a8288 :a8288 :a8288. -:a8289 :a8289 :a8289. -:a8290 :a8290 :a8290. -:a8291 :a8291 :a8291. -:a8292 :a8292 :a8292. -:a8293 :a8293 :a8293. -:a8294 :a8294 :a8294. -:a8295 :a8295 :a8295. -:a8296 :a8296 :a8296. -:a8297 :a8297 :a8297. -:a8298 :a8298 :a8298. -:a8299 :a8299 :a8299. -:a8300 :a8300 :a8300. -:a8301 :a8301 :a8301. -:a8302 :a8302 :a8302. -:a8303 :a8303 :a8303. -:a8304 :a8304 :a8304. -:a8305 :a8305 :a8305. -:a8306 :a8306 :a8306. -:a8307 :a8307 :a8307. -:a8308 :a8308 :a8308. -:a8309 :a8309 :a8309. -:a8310 :a8310 :a8310. -:a8311 :a8311 :a8311. -:a8312 :a8312 :a8312. -:a8313 :a8313 :a8313. -:a8314 :a8314 :a8314. -:a8315 :a8315 :a8315. -:a8316 :a8316 :a8316. -:a8317 :a8317 :a8317. -:a8318 :a8318 :a8318. -:a8319 :a8319 :a8319. -:a8320 :a8320 :a8320. -:a8321 :a8321 :a8321. -:a8322 :a8322 :a8322. -:a8323 :a8323 :a8323. -:a8324 :a8324 :a8324. -:a8325 :a8325 :a8325. -:a8326 :a8326 :a8326. -:a8327 :a8327 :a8327. -:a8328 :a8328 :a8328. -:a8329 :a8329 :a8329. -:a8330 :a8330 :a8330. -:a8331 :a8331 :a8331. -:a8332 :a8332 :a8332. -:a8333 :a8333 :a8333. -:a8334 :a8334 :a8334. -:a8335 :a8335 :a8335. -:a8336 :a8336 :a8336. -:a8337 :a8337 :a8337. -:a8338 :a8338 :a8338. -:a8339 :a8339 :a8339. -:a8340 :a8340 :a8340. -:a8341 :a8341 :a8341. -:a8342 :a8342 :a8342. -:a8343 :a8343 :a8343. -:a8344 :a8344 :a8344. -:a8345 :a8345 :a8345. -:a8346 :a8346 :a8346. -:a8347 :a8347 :a8347. -:a8348 :a8348 :a8348. -:a8349 :a8349 :a8349. -:a8350 :a8350 :a8350. -:a8351 :a8351 :a8351. -:a8352 :a8352 :a8352. -:a8353 :a8353 :a8353. -:a8354 :a8354 :a8354. -:a8355 :a8355 :a8355. -:a8356 :a8356 :a8356. -:a8357 :a8357 :a8357. -:a8358 :a8358 :a8358. -:a8359 :a8359 :a8359. -:a8360 :a8360 :a8360. -:a8361 :a8361 :a8361. -:a8362 :a8362 :a8362. -:a8363 :a8363 :a8363. -:a8364 :a8364 :a8364. -:a8365 :a8365 :a8365. -:a8366 :a8366 :a8366. -:a8367 :a8367 :a8367. -:a8368 :a8368 :a8368. -:a8369 :a8369 :a8369. -:a8370 :a8370 :a8370. -:a8371 :a8371 :a8371. -:a8372 :a8372 :a8372. -:a8373 :a8373 :a8373. -:a8374 :a8374 :a8374. -:a8375 :a8375 :a8375. -:a8376 :a8376 :a8376. -:a8377 :a8377 :a8377. -:a8378 :a8378 :a8378. -:a8379 :a8379 :a8379. -:a8380 :a8380 :a8380. -:a8381 :a8381 :a8381. -:a8382 :a8382 :a8382. -:a8383 :a8383 :a8383. -:a8384 :a8384 :a8384. -:a8385 :a8385 :a8385. -:a8386 :a8386 :a8386. -:a8387 :a8387 :a8387. -:a8388 :a8388 :a8388. -:a8389 :a8389 :a8389. -:a8390 :a8390 :a8390. -:a8391 :a8391 :a8391. -:a8392 :a8392 :a8392. -:a8393 :a8393 :a8393. -:a8394 :a8394 :a8394. -:a8395 :a8395 :a8395. -:a8396 :a8396 :a8396. -:a8397 :a8397 :a8397. -:a8398 :a8398 :a8398. -:a8399 :a8399 :a8399. -:a8400 :a8400 :a8400. -:a8401 :a8401 :a8401. -:a8402 :a8402 :a8402. -:a8403 :a8403 :a8403. -:a8404 :a8404 :a8404. -:a8405 :a8405 :a8405. -:a8406 :a8406 :a8406. -:a8407 :a8407 :a8407. -:a8408 :a8408 :a8408. -:a8409 :a8409 :a8409. -:a8410 :a8410 :a8410. -:a8411 :a8411 :a8411. -:a8412 :a8412 :a8412. -:a8413 :a8413 :a8413. -:a8414 :a8414 :a8414. -:a8415 :a8415 :a8415. -:a8416 :a8416 :a8416. -:a8417 :a8417 :a8417. -:a8418 :a8418 :a8418. -:a8419 :a8419 :a8419. -:a8420 :a8420 :a8420. -:a8421 :a8421 :a8421. -:a8422 :a8422 :a8422. -:a8423 :a8423 :a8423. -:a8424 :a8424 :a8424. -:a8425 :a8425 :a8425. -:a8426 :a8426 :a8426. -:a8427 :a8427 :a8427. -:a8428 :a8428 :a8428. -:a8429 :a8429 :a8429. -:a8430 :a8430 :a8430. -:a8431 :a8431 :a8431. -:a8432 :a8432 :a8432. -:a8433 :a8433 :a8433. -:a8434 :a8434 :a8434. -:a8435 :a8435 :a8435. -:a8436 :a8436 :a8436. -:a8437 :a8437 :a8437. -:a8438 :a8438 :a8438. -:a8439 :a8439 :a8439. -:a8440 :a8440 :a8440. -:a8441 :a8441 :a8441. -:a8442 :a8442 :a8442. -:a8443 :a8443 :a8443. -:a8444 :a8444 :a8444. -:a8445 :a8445 :a8445. -:a8446 :a8446 :a8446. -:a8447 :a8447 :a8447. -:a8448 :a8448 :a8448. -:a8449 :a8449 :a8449. -:a8450 :a8450 :a8450. -:a8451 :a8451 :a8451. -:a8452 :a8452 :a8452. -:a8453 :a8453 :a8453. -:a8454 :a8454 :a8454. -:a8455 :a8455 :a8455. -:a8456 :a8456 :a8456. -:a8457 :a8457 :a8457. -:a8458 :a8458 :a8458. -:a8459 :a8459 :a8459. -:a8460 :a8460 :a8460. -:a8461 :a8461 :a8461. -:a8462 :a8462 :a8462. -:a8463 :a8463 :a8463. -:a8464 :a8464 :a8464. -:a8465 :a8465 :a8465. -:a8466 :a8466 :a8466. -:a8467 :a8467 :a8467. -:a8468 :a8468 :a8468. -:a8469 :a8469 :a8469. -:a8470 :a8470 :a8470. -:a8471 :a8471 :a8471. -:a8472 :a8472 :a8472. -:a8473 :a8473 :a8473. -:a8474 :a8474 :a8474. -:a8475 :a8475 :a8475. -:a8476 :a8476 :a8476. -:a8477 :a8477 :a8477. -:a8478 :a8478 :a8478. -:a8479 :a8479 :a8479. -:a8480 :a8480 :a8480. -:a8481 :a8481 :a8481. -:a8482 :a8482 :a8482. -:a8483 :a8483 :a8483. -:a8484 :a8484 :a8484. -:a8485 :a8485 :a8485. -:a8486 :a8486 :a8486. -:a8487 :a8487 :a8487. -:a8488 :a8488 :a8488. -:a8489 :a8489 :a8489. -:a8490 :a8490 :a8490. -:a8491 :a8491 :a8491. -:a8492 :a8492 :a8492. -:a8493 :a8493 :a8493. -:a8494 :a8494 :a8494. -:a8495 :a8495 :a8495. -:a8496 :a8496 :a8496. -:a8497 :a8497 :a8497. -:a8498 :a8498 :a8498. -:a8499 :a8499 :a8499. -:a8500 :a8500 :a8500. -:a8501 :a8501 :a8501. -:a8502 :a8502 :a8502. -:a8503 :a8503 :a8503. -:a8504 :a8504 :a8504. -:a8505 :a8505 :a8505. -:a8506 :a8506 :a8506. -:a8507 :a8507 :a8507. -:a8508 :a8508 :a8508. -:a8509 :a8509 :a8509. -:a8510 :a8510 :a8510. -:a8511 :a8511 :a8511. -:a8512 :a8512 :a8512. -:a8513 :a8513 :a8513. -:a8514 :a8514 :a8514. -:a8515 :a8515 :a8515. -:a8516 :a8516 :a8516. -:a8517 :a8517 :a8517. -:a8518 :a8518 :a8518. -:a8519 :a8519 :a8519. -:a8520 :a8520 :a8520. -:a8521 :a8521 :a8521. -:a8522 :a8522 :a8522. -:a8523 :a8523 :a8523. -:a8524 :a8524 :a8524. -:a8525 :a8525 :a8525. -:a8526 :a8526 :a8526. -:a8527 :a8527 :a8527. -:a8528 :a8528 :a8528. -:a8529 :a8529 :a8529. -:a8530 :a8530 :a8530. -:a8531 :a8531 :a8531. -:a8532 :a8532 :a8532. -:a8533 :a8533 :a8533. -:a8534 :a8534 :a8534. -:a8535 :a8535 :a8535. -:a8536 :a8536 :a8536. -:a8537 :a8537 :a8537. -:a8538 :a8538 :a8538. -:a8539 :a8539 :a8539. -:a8540 :a8540 :a8540. -:a8541 :a8541 :a8541. -:a8542 :a8542 :a8542. -:a8543 :a8543 :a8543. -:a8544 :a8544 :a8544. -:a8545 :a8545 :a8545. -:a8546 :a8546 :a8546. -:a8547 :a8547 :a8547. -:a8548 :a8548 :a8548. -:a8549 :a8549 :a8549. -:a8550 :a8550 :a8550. -:a8551 :a8551 :a8551. -:a8552 :a8552 :a8552. -:a8553 :a8553 :a8553. -:a8554 :a8554 :a8554. -:a8555 :a8555 :a8555. -:a8556 :a8556 :a8556. -:a8557 :a8557 :a8557. -:a8558 :a8558 :a8558. -:a8559 :a8559 :a8559. -:a8560 :a8560 :a8560. -:a8561 :a8561 :a8561. -:a8562 :a8562 :a8562. -:a8563 :a8563 :a8563. -:a8564 :a8564 :a8564. -:a8565 :a8565 :a8565. -:a8566 :a8566 :a8566. -:a8567 :a8567 :a8567. -:a8568 :a8568 :a8568. -:a8569 :a8569 :a8569. -:a8570 :a8570 :a8570. -:a8571 :a8571 :a8571. -:a8572 :a8572 :a8572. -:a8573 :a8573 :a8573. -:a8574 :a8574 :a8574. -:a8575 :a8575 :a8575. -:a8576 :a8576 :a8576. -:a8577 :a8577 :a8577. -:a8578 :a8578 :a8578. -:a8579 :a8579 :a8579. -:a8580 :a8580 :a8580. -:a8581 :a8581 :a8581. -:a8582 :a8582 :a8582. -:a8583 :a8583 :a8583. -:a8584 :a8584 :a8584. -:a8585 :a8585 :a8585. -:a8586 :a8586 :a8586. -:a8587 :a8587 :a8587. -:a8588 :a8588 :a8588. -:a8589 :a8589 :a8589. -:a8590 :a8590 :a8590. -:a8591 :a8591 :a8591. -:a8592 :a8592 :a8592. -:a8593 :a8593 :a8593. -:a8594 :a8594 :a8594. -:a8595 :a8595 :a8595. -:a8596 :a8596 :a8596. -:a8597 :a8597 :a8597. -:a8598 :a8598 :a8598. -:a8599 :a8599 :a8599. -:a8600 :a8600 :a8600. -:a8601 :a8601 :a8601. -:a8602 :a8602 :a8602. -:a8603 :a8603 :a8603. -:a8604 :a8604 :a8604. -:a8605 :a8605 :a8605. -:a8606 :a8606 :a8606. -:a8607 :a8607 :a8607. -:a8608 :a8608 :a8608. -:a8609 :a8609 :a8609. -:a8610 :a8610 :a8610. -:a8611 :a8611 :a8611. -:a8612 :a8612 :a8612. -:a8613 :a8613 :a8613. -:a8614 :a8614 :a8614. -:a8615 :a8615 :a8615. -:a8616 :a8616 :a8616. -:a8617 :a8617 :a8617. -:a8618 :a8618 :a8618. -:a8619 :a8619 :a8619. -:a8620 :a8620 :a8620. -:a8621 :a8621 :a8621. -:a8622 :a8622 :a8622. -:a8623 :a8623 :a8623. -:a8624 :a8624 :a8624. -:a8625 :a8625 :a8625. -:a8626 :a8626 :a8626. -:a8627 :a8627 :a8627. -:a8628 :a8628 :a8628. -:a8629 :a8629 :a8629. -:a8630 :a8630 :a8630. -:a8631 :a8631 :a8631. -:a8632 :a8632 :a8632. -:a8633 :a8633 :a8633. -:a8634 :a8634 :a8634. -:a8635 :a8635 :a8635. -:a8636 :a8636 :a8636. -:a8637 :a8637 :a8637. -:a8638 :a8638 :a8638. -:a8639 :a8639 :a8639. -:a8640 :a8640 :a8640. -:a8641 :a8641 :a8641. -:a8642 :a8642 :a8642. -:a8643 :a8643 :a8643. -:a8644 :a8644 :a8644. -:a8645 :a8645 :a8645. -:a8646 :a8646 :a8646. -:a8647 :a8647 :a8647. -:a8648 :a8648 :a8648. -:a8649 :a8649 :a8649. -:a8650 :a8650 :a8650. -:a8651 :a8651 :a8651. -:a8652 :a8652 :a8652. -:a8653 :a8653 :a8653. -:a8654 :a8654 :a8654. -:a8655 :a8655 :a8655. -:a8656 :a8656 :a8656. -:a8657 :a8657 :a8657. -:a8658 :a8658 :a8658. -:a8659 :a8659 :a8659. -:a8660 :a8660 :a8660. -:a8661 :a8661 :a8661. -:a8662 :a8662 :a8662. -:a8663 :a8663 :a8663. -:a8664 :a8664 :a8664. -:a8665 :a8665 :a8665. -:a8666 :a8666 :a8666. -:a8667 :a8667 :a8667. -:a8668 :a8668 :a8668. -:a8669 :a8669 :a8669. -:a8670 :a8670 :a8670. -:a8671 :a8671 :a8671. -:a8672 :a8672 :a8672. -:a8673 :a8673 :a8673. -:a8674 :a8674 :a8674. -:a8675 :a8675 :a8675. -:a8676 :a8676 :a8676. -:a8677 :a8677 :a8677. -:a8678 :a8678 :a8678. -:a8679 :a8679 :a8679. -:a8680 :a8680 :a8680. -:a8681 :a8681 :a8681. -:a8682 :a8682 :a8682. -:a8683 :a8683 :a8683. -:a8684 :a8684 :a8684. -:a8685 :a8685 :a8685. -:a8686 :a8686 :a8686. -:a8687 :a8687 :a8687. -:a8688 :a8688 :a8688. -:a8689 :a8689 :a8689. -:a8690 :a8690 :a8690. -:a8691 :a8691 :a8691. -:a8692 :a8692 :a8692. -:a8693 :a8693 :a8693. -:a8694 :a8694 :a8694. -:a8695 :a8695 :a8695. -:a8696 :a8696 :a8696. -:a8697 :a8697 :a8697. -:a8698 :a8698 :a8698. -:a8699 :a8699 :a8699. -:a8700 :a8700 :a8700. -:a8701 :a8701 :a8701. -:a8702 :a8702 :a8702. -:a8703 :a8703 :a8703. -:a8704 :a8704 :a8704. -:a8705 :a8705 :a8705. -:a8706 :a8706 :a8706. -:a8707 :a8707 :a8707. -:a8708 :a8708 :a8708. -:a8709 :a8709 :a8709. -:a8710 :a8710 :a8710. -:a8711 :a8711 :a8711. -:a8712 :a8712 :a8712. -:a8713 :a8713 :a8713. -:a8714 :a8714 :a8714. -:a8715 :a8715 :a8715. -:a8716 :a8716 :a8716. -:a8717 :a8717 :a8717. -:a8718 :a8718 :a8718. -:a8719 :a8719 :a8719. -:a8720 :a8720 :a8720. -:a8721 :a8721 :a8721. -:a8722 :a8722 :a8722. -:a8723 :a8723 :a8723. -:a8724 :a8724 :a8724. -:a8725 :a8725 :a8725. -:a8726 :a8726 :a8726. -:a8727 :a8727 :a8727. -:a8728 :a8728 :a8728. -:a8729 :a8729 :a8729. -:a8730 :a8730 :a8730. -:a8731 :a8731 :a8731. -:a8732 :a8732 :a8732. -:a8733 :a8733 :a8733. -:a8734 :a8734 :a8734. -:a8735 :a8735 :a8735. -:a8736 :a8736 :a8736. -:a8737 :a8737 :a8737. -:a8738 :a8738 :a8738. -:a8739 :a8739 :a8739. -:a8740 :a8740 :a8740. -:a8741 :a8741 :a8741. -:a8742 :a8742 :a8742. -:a8743 :a8743 :a8743. -:a8744 :a8744 :a8744. -:a8745 :a8745 :a8745. -:a8746 :a8746 :a8746. -:a8747 :a8747 :a8747. -:a8748 :a8748 :a8748. -:a8749 :a8749 :a8749. -:a8750 :a8750 :a8750. -:a8751 :a8751 :a8751. -:a8752 :a8752 :a8752. -:a8753 :a8753 :a8753. -:a8754 :a8754 :a8754. -:a8755 :a8755 :a8755. -:a8756 :a8756 :a8756. -:a8757 :a8757 :a8757. -:a8758 :a8758 :a8758. -:a8759 :a8759 :a8759. -:a8760 :a8760 :a8760. -:a8761 :a8761 :a8761. -:a8762 :a8762 :a8762. -:a8763 :a8763 :a8763. -:a8764 :a8764 :a8764. -:a8765 :a8765 :a8765. -:a8766 :a8766 :a8766. -:a8767 :a8767 :a8767. -:a8768 :a8768 :a8768. -:a8769 :a8769 :a8769. -:a8770 :a8770 :a8770. -:a8771 :a8771 :a8771. -:a8772 :a8772 :a8772. -:a8773 :a8773 :a8773. -:a8774 :a8774 :a8774. -:a8775 :a8775 :a8775. -:a8776 :a8776 :a8776. -:a8777 :a8777 :a8777. -:a8778 :a8778 :a8778. -:a8779 :a8779 :a8779. -:a8780 :a8780 :a8780. -:a8781 :a8781 :a8781. -:a8782 :a8782 :a8782. -:a8783 :a8783 :a8783. -:a8784 :a8784 :a8784. -:a8785 :a8785 :a8785. -:a8786 :a8786 :a8786. -:a8787 :a8787 :a8787. -:a8788 :a8788 :a8788. -:a8789 :a8789 :a8789. -:a8790 :a8790 :a8790. -:a8791 :a8791 :a8791. -:a8792 :a8792 :a8792. -:a8793 :a8793 :a8793. -:a8794 :a8794 :a8794. -:a8795 :a8795 :a8795. -:a8796 :a8796 :a8796. -:a8797 :a8797 :a8797. -:a8798 :a8798 :a8798. -:a8799 :a8799 :a8799. -:a8800 :a8800 :a8800. -:a8801 :a8801 :a8801. -:a8802 :a8802 :a8802. -:a8803 :a8803 :a8803. -:a8804 :a8804 :a8804. -:a8805 :a8805 :a8805. -:a8806 :a8806 :a8806. -:a8807 :a8807 :a8807. -:a8808 :a8808 :a8808. -:a8809 :a8809 :a8809. -:a8810 :a8810 :a8810. -:a8811 :a8811 :a8811. -:a8812 :a8812 :a8812. -:a8813 :a8813 :a8813. -:a8814 :a8814 :a8814. -:a8815 :a8815 :a8815. -:a8816 :a8816 :a8816. -:a8817 :a8817 :a8817. -:a8818 :a8818 :a8818. -:a8819 :a8819 :a8819. -:a8820 :a8820 :a8820. -:a8821 :a8821 :a8821. -:a8822 :a8822 :a8822. -:a8823 :a8823 :a8823. -:a8824 :a8824 :a8824. -:a8825 :a8825 :a8825. -:a8826 :a8826 :a8826. -:a8827 :a8827 :a8827. -:a8828 :a8828 :a8828. -:a8829 :a8829 :a8829. -:a8830 :a8830 :a8830. -:a8831 :a8831 :a8831. -:a8832 :a8832 :a8832. -:a8833 :a8833 :a8833. -:a8834 :a8834 :a8834. -:a8835 :a8835 :a8835. -:a8836 :a8836 :a8836. -:a8837 :a8837 :a8837. -:a8838 :a8838 :a8838. -:a8839 :a8839 :a8839. -:a8840 :a8840 :a8840. -:a8841 :a8841 :a8841. -:a8842 :a8842 :a8842. -:a8843 :a8843 :a8843. -:a8844 :a8844 :a8844. -:a8845 :a8845 :a8845. -:a8846 :a8846 :a8846. -:a8847 :a8847 :a8847. -:a8848 :a8848 :a8848. -:a8849 :a8849 :a8849. -:a8850 :a8850 :a8850. -:a8851 :a8851 :a8851. -:a8852 :a8852 :a8852. -:a8853 :a8853 :a8853. -:a8854 :a8854 :a8854. -:a8855 :a8855 :a8855. -:a8856 :a8856 :a8856. -:a8857 :a8857 :a8857. -:a8858 :a8858 :a8858. -:a8859 :a8859 :a8859. -:a8860 :a8860 :a8860. -:a8861 :a8861 :a8861. -:a8862 :a8862 :a8862. -:a8863 :a8863 :a8863. -:a8864 :a8864 :a8864. -:a8865 :a8865 :a8865. -:a8866 :a8866 :a8866. -:a8867 :a8867 :a8867. -:a8868 :a8868 :a8868. -:a8869 :a8869 :a8869. -:a8870 :a8870 :a8870. -:a8871 :a8871 :a8871. -:a8872 :a8872 :a8872. -:a8873 :a8873 :a8873. -:a8874 :a8874 :a8874. -:a8875 :a8875 :a8875. -:a8876 :a8876 :a8876. -:a8877 :a8877 :a8877. -:a8878 :a8878 :a8878. -:a8879 :a8879 :a8879. -:a8880 :a8880 :a8880. -:a8881 :a8881 :a8881. -:a8882 :a8882 :a8882. -:a8883 :a8883 :a8883. -:a8884 :a8884 :a8884. -:a8885 :a8885 :a8885. -:a8886 :a8886 :a8886. -:a8887 :a8887 :a8887. -:a8888 :a8888 :a8888. -:a8889 :a8889 :a8889. -:a8890 :a8890 :a8890. -:a8891 :a8891 :a8891. -:a8892 :a8892 :a8892. -:a8893 :a8893 :a8893. -:a8894 :a8894 :a8894. -:a8895 :a8895 :a8895. -:a8896 :a8896 :a8896. -:a8897 :a8897 :a8897. -:a8898 :a8898 :a8898. -:a8899 :a8899 :a8899. -:a8900 :a8900 :a8900. -:a8901 :a8901 :a8901. -:a8902 :a8902 :a8902. -:a8903 :a8903 :a8903. -:a8904 :a8904 :a8904. -:a8905 :a8905 :a8905. -:a8906 :a8906 :a8906. -:a8907 :a8907 :a8907. -:a8908 :a8908 :a8908. -:a8909 :a8909 :a8909. -:a8910 :a8910 :a8910. -:a8911 :a8911 :a8911. -:a8912 :a8912 :a8912. -:a8913 :a8913 :a8913. -:a8914 :a8914 :a8914. -:a8915 :a8915 :a8915. -:a8916 :a8916 :a8916. -:a8917 :a8917 :a8917. -:a8918 :a8918 :a8918. -:a8919 :a8919 :a8919. -:a8920 :a8920 :a8920. -:a8921 :a8921 :a8921. -:a8922 :a8922 :a8922. -:a8923 :a8923 :a8923. -:a8924 :a8924 :a8924. -:a8925 :a8925 :a8925. -:a8926 :a8926 :a8926. -:a8927 :a8927 :a8927. -:a8928 :a8928 :a8928. -:a8929 :a8929 :a8929. -:a8930 :a8930 :a8930. -:a8931 :a8931 :a8931. -:a8932 :a8932 :a8932. -:a8933 :a8933 :a8933. -:a8934 :a8934 :a8934. -:a8935 :a8935 :a8935. -:a8936 :a8936 :a8936. -:a8937 :a8937 :a8937. -:a8938 :a8938 :a8938. -:a8939 :a8939 :a8939. -:a8940 :a8940 :a8940. -:a8941 :a8941 :a8941. -:a8942 :a8942 :a8942. -:a8943 :a8943 :a8943. -:a8944 :a8944 :a8944. -:a8945 :a8945 :a8945. -:a8946 :a8946 :a8946. -:a8947 :a8947 :a8947. -:a8948 :a8948 :a8948. -:a8949 :a8949 :a8949. -:a8950 :a8950 :a8950. -:a8951 :a8951 :a8951. -:a8952 :a8952 :a8952. -:a8953 :a8953 :a8953. -:a8954 :a8954 :a8954. -:a8955 :a8955 :a8955. -:a8956 :a8956 :a8956. -:a8957 :a8957 :a8957. -:a8958 :a8958 :a8958. -:a8959 :a8959 :a8959. -:a8960 :a8960 :a8960. -:a8961 :a8961 :a8961. -:a8962 :a8962 :a8962. -:a8963 :a8963 :a8963. -:a8964 :a8964 :a8964. -:a8965 :a8965 :a8965. -:a8966 :a8966 :a8966. -:a8967 :a8967 :a8967. -:a8968 :a8968 :a8968. -:a8969 :a8969 :a8969. -:a8970 :a8970 :a8970. -:a8971 :a8971 :a8971. -:a8972 :a8972 :a8972. -:a8973 :a8973 :a8973. -:a8974 :a8974 :a8974. -:a8975 :a8975 :a8975. -:a8976 :a8976 :a8976. -:a8977 :a8977 :a8977. -:a8978 :a8978 :a8978. -:a8979 :a8979 :a8979. -:a8980 :a8980 :a8980. -:a8981 :a8981 :a8981. -:a8982 :a8982 :a8982. -:a8983 :a8983 :a8983. -:a8984 :a8984 :a8984. -:a8985 :a8985 :a8985. -:a8986 :a8986 :a8986. -:a8987 :a8987 :a8987. -:a8988 :a8988 :a8988. -:a8989 :a8989 :a8989. -:a8990 :a8990 :a8990. -:a8991 :a8991 :a8991. -:a8992 :a8992 :a8992. -:a8993 :a8993 :a8993. -:a8994 :a8994 :a8994. -:a8995 :a8995 :a8995. -:a8996 :a8996 :a8996. -:a8997 :a8997 :a8997. -:a8998 :a8998 :a8998. -:a8999 :a8999 :a8999. -:a9000 :a9000 :a9000. -:a9001 :a9001 :a9001. -:a9002 :a9002 :a9002. -:a9003 :a9003 :a9003. -:a9004 :a9004 :a9004. -:a9005 :a9005 :a9005. -:a9006 :a9006 :a9006. -:a9007 :a9007 :a9007. -:a9008 :a9008 :a9008. -:a9009 :a9009 :a9009. -:a9010 :a9010 :a9010. -:a9011 :a9011 :a9011. -:a9012 :a9012 :a9012. -:a9013 :a9013 :a9013. -:a9014 :a9014 :a9014. -:a9015 :a9015 :a9015. -:a9016 :a9016 :a9016. -:a9017 :a9017 :a9017. -:a9018 :a9018 :a9018. -:a9019 :a9019 :a9019. -:a9020 :a9020 :a9020. -:a9021 :a9021 :a9021. -:a9022 :a9022 :a9022. -:a9023 :a9023 :a9023. -:a9024 :a9024 :a9024. -:a9025 :a9025 :a9025. -:a9026 :a9026 :a9026. -:a9027 :a9027 :a9027. -:a9028 :a9028 :a9028. -:a9029 :a9029 :a9029. -:a9030 :a9030 :a9030. -:a9031 :a9031 :a9031. -:a9032 :a9032 :a9032. -:a9033 :a9033 :a9033. -:a9034 :a9034 :a9034. -:a9035 :a9035 :a9035. -:a9036 :a9036 :a9036. -:a9037 :a9037 :a9037. -:a9038 :a9038 :a9038. -:a9039 :a9039 :a9039. -:a9040 :a9040 :a9040. -:a9041 :a9041 :a9041. -:a9042 :a9042 :a9042. -:a9043 :a9043 :a9043. -:a9044 :a9044 :a9044. -:a9045 :a9045 :a9045. -:a9046 :a9046 :a9046. -:a9047 :a9047 :a9047. -:a9048 :a9048 :a9048. -:a9049 :a9049 :a9049. -:a9050 :a9050 :a9050. -:a9051 :a9051 :a9051. -:a9052 :a9052 :a9052. -:a9053 :a9053 :a9053. -:a9054 :a9054 :a9054. -:a9055 :a9055 :a9055. -:a9056 :a9056 :a9056. -:a9057 :a9057 :a9057. -:a9058 :a9058 :a9058. -:a9059 :a9059 :a9059. -:a9060 :a9060 :a9060. -:a9061 :a9061 :a9061. -:a9062 :a9062 :a9062. -:a9063 :a9063 :a9063. -:a9064 :a9064 :a9064. -:a9065 :a9065 :a9065. -:a9066 :a9066 :a9066. -:a9067 :a9067 :a9067. -:a9068 :a9068 :a9068. -:a9069 :a9069 :a9069. -:a9070 :a9070 :a9070. -:a9071 :a9071 :a9071. -:a9072 :a9072 :a9072. -:a9073 :a9073 :a9073. -:a9074 :a9074 :a9074. -:a9075 :a9075 :a9075. -:a9076 :a9076 :a9076. -:a9077 :a9077 :a9077. -:a9078 :a9078 :a9078. -:a9079 :a9079 :a9079. -:a9080 :a9080 :a9080. -:a9081 :a9081 :a9081. -:a9082 :a9082 :a9082. -:a9083 :a9083 :a9083. -:a9084 :a9084 :a9084. -:a9085 :a9085 :a9085. -:a9086 :a9086 :a9086. -:a9087 :a9087 :a9087. -:a9088 :a9088 :a9088. -:a9089 :a9089 :a9089. -:a9090 :a9090 :a9090. -:a9091 :a9091 :a9091. -:a9092 :a9092 :a9092. -:a9093 :a9093 :a9093. -:a9094 :a9094 :a9094. -:a9095 :a9095 :a9095. -:a9096 :a9096 :a9096. -:a9097 :a9097 :a9097. -:a9098 :a9098 :a9098. -:a9099 :a9099 :a9099. -:a9100 :a9100 :a9100. -:a9101 :a9101 :a9101. -:a9102 :a9102 :a9102. -:a9103 :a9103 :a9103. -:a9104 :a9104 :a9104. -:a9105 :a9105 :a9105. -:a9106 :a9106 :a9106. -:a9107 :a9107 :a9107. -:a9108 :a9108 :a9108. -:a9109 :a9109 :a9109. -:a9110 :a9110 :a9110. -:a9111 :a9111 :a9111. -:a9112 :a9112 :a9112. -:a9113 :a9113 :a9113. -:a9114 :a9114 :a9114. -:a9115 :a9115 :a9115. -:a9116 :a9116 :a9116. -:a9117 :a9117 :a9117. -:a9118 :a9118 :a9118. -:a9119 :a9119 :a9119. -:a9120 :a9120 :a9120. -:a9121 :a9121 :a9121. -:a9122 :a9122 :a9122. -:a9123 :a9123 :a9123. -:a9124 :a9124 :a9124. -:a9125 :a9125 :a9125. -:a9126 :a9126 :a9126. -:a9127 :a9127 :a9127. -:a9128 :a9128 :a9128. -:a9129 :a9129 :a9129. -:a9130 :a9130 :a9130. -:a9131 :a9131 :a9131. -:a9132 :a9132 :a9132. -:a9133 :a9133 :a9133. -:a9134 :a9134 :a9134. -:a9135 :a9135 :a9135. -:a9136 :a9136 :a9136. -:a9137 :a9137 :a9137. -:a9138 :a9138 :a9138. -:a9139 :a9139 :a9139. -:a9140 :a9140 :a9140. -:a9141 :a9141 :a9141. -:a9142 :a9142 :a9142. -:a9143 :a9143 :a9143. -:a9144 :a9144 :a9144. -:a9145 :a9145 :a9145. -:a9146 :a9146 :a9146. -:a9147 :a9147 :a9147. -:a9148 :a9148 :a9148. -:a9149 :a9149 :a9149. -:a9150 :a9150 :a9150. -:a9151 :a9151 :a9151. -:a9152 :a9152 :a9152. -:a9153 :a9153 :a9153. -:a9154 :a9154 :a9154. -:a9155 :a9155 :a9155. -:a9156 :a9156 :a9156. -:a9157 :a9157 :a9157. -:a9158 :a9158 :a9158. -:a9159 :a9159 :a9159. -:a9160 :a9160 :a9160. -:a9161 :a9161 :a9161. -:a9162 :a9162 :a9162. -:a9163 :a9163 :a9163. -:a9164 :a9164 :a9164. -:a9165 :a9165 :a9165. -:a9166 :a9166 :a9166. -:a9167 :a9167 :a9167. -:a9168 :a9168 :a9168. -:a9169 :a9169 :a9169. -:a9170 :a9170 :a9170. -:a9171 :a9171 :a9171. -:a9172 :a9172 :a9172. -:a9173 :a9173 :a9173. -:a9174 :a9174 :a9174. -:a9175 :a9175 :a9175. -:a9176 :a9176 :a9176. -:a9177 :a9177 :a9177. -:a9178 :a9178 :a9178. -:a9179 :a9179 :a9179. -:a9180 :a9180 :a9180. -:a9181 :a9181 :a9181. -:a9182 :a9182 :a9182. -:a9183 :a9183 :a9183. -:a9184 :a9184 :a9184. -:a9185 :a9185 :a9185. -:a9186 :a9186 :a9186. -:a9187 :a9187 :a9187. -:a9188 :a9188 :a9188. -:a9189 :a9189 :a9189. -:a9190 :a9190 :a9190. -:a9191 :a9191 :a9191. -:a9192 :a9192 :a9192. -:a9193 :a9193 :a9193. -:a9194 :a9194 :a9194. -:a9195 :a9195 :a9195. -:a9196 :a9196 :a9196. -:a9197 :a9197 :a9197. -:a9198 :a9198 :a9198. -:a9199 :a9199 :a9199. -:a9200 :a9200 :a9200. -:a9201 :a9201 :a9201. -:a9202 :a9202 :a9202. -:a9203 :a9203 :a9203. -:a9204 :a9204 :a9204. -:a9205 :a9205 :a9205. -:a9206 :a9206 :a9206. -:a9207 :a9207 :a9207. -:a9208 :a9208 :a9208. -:a9209 :a9209 :a9209. -:a9210 :a9210 :a9210. -:a9211 :a9211 :a9211. -:a9212 :a9212 :a9212. -:a9213 :a9213 :a9213. -:a9214 :a9214 :a9214. -:a9215 :a9215 :a9215. -:a9216 :a9216 :a9216. -:a9217 :a9217 :a9217. -:a9218 :a9218 :a9218. -:a9219 :a9219 :a9219. -:a9220 :a9220 :a9220. -:a9221 :a9221 :a9221. -:a9222 :a9222 :a9222. -:a9223 :a9223 :a9223. -:a9224 :a9224 :a9224. -:a9225 :a9225 :a9225. -:a9226 :a9226 :a9226. -:a9227 :a9227 :a9227. -:a9228 :a9228 :a9228. -:a9229 :a9229 :a9229. -:a9230 :a9230 :a9230. -:a9231 :a9231 :a9231. -:a9232 :a9232 :a9232. -:a9233 :a9233 :a9233. -:a9234 :a9234 :a9234. -:a9235 :a9235 :a9235. -:a9236 :a9236 :a9236. -:a9237 :a9237 :a9237. -:a9238 :a9238 :a9238. -:a9239 :a9239 :a9239. -:a9240 :a9240 :a9240. -:a9241 :a9241 :a9241. -:a9242 :a9242 :a9242. -:a9243 :a9243 :a9243. -:a9244 :a9244 :a9244. -:a9245 :a9245 :a9245. -:a9246 :a9246 :a9246. -:a9247 :a9247 :a9247. -:a9248 :a9248 :a9248. -:a9249 :a9249 :a9249. -:a9250 :a9250 :a9250. -:a9251 :a9251 :a9251. -:a9252 :a9252 :a9252. -:a9253 :a9253 :a9253. -:a9254 :a9254 :a9254. -:a9255 :a9255 :a9255. -:a9256 :a9256 :a9256. -:a9257 :a9257 :a9257. -:a9258 :a9258 :a9258. -:a9259 :a9259 :a9259. -:a9260 :a9260 :a9260. -:a9261 :a9261 :a9261. -:a9262 :a9262 :a9262. -:a9263 :a9263 :a9263. -:a9264 :a9264 :a9264. -:a9265 :a9265 :a9265. -:a9266 :a9266 :a9266. -:a9267 :a9267 :a9267. -:a9268 :a9268 :a9268. -:a9269 :a9269 :a9269. -:a9270 :a9270 :a9270. -:a9271 :a9271 :a9271. -:a9272 :a9272 :a9272. -:a9273 :a9273 :a9273. -:a9274 :a9274 :a9274. -:a9275 :a9275 :a9275. -:a9276 :a9276 :a9276. -:a9277 :a9277 :a9277. -:a9278 :a9278 :a9278. -:a9279 :a9279 :a9279. -:a9280 :a9280 :a9280. -:a9281 :a9281 :a9281. -:a9282 :a9282 :a9282. -:a9283 :a9283 :a9283. -:a9284 :a9284 :a9284. -:a9285 :a9285 :a9285. -:a9286 :a9286 :a9286. -:a9287 :a9287 :a9287. -:a9288 :a9288 :a9288. -:a9289 :a9289 :a9289. -:a9290 :a9290 :a9290. -:a9291 :a9291 :a9291. -:a9292 :a9292 :a9292. -:a9293 :a9293 :a9293. -:a9294 :a9294 :a9294. -:a9295 :a9295 :a9295. -:a9296 :a9296 :a9296. -:a9297 :a9297 :a9297. -:a9298 :a9298 :a9298. -:a9299 :a9299 :a9299. -:a9300 :a9300 :a9300. -:a9301 :a9301 :a9301. -:a9302 :a9302 :a9302. -:a9303 :a9303 :a9303. -:a9304 :a9304 :a9304. -:a9305 :a9305 :a9305. -:a9306 :a9306 :a9306. -:a9307 :a9307 :a9307. -:a9308 :a9308 :a9308. -:a9309 :a9309 :a9309. -:a9310 :a9310 :a9310. -:a9311 :a9311 :a9311. -:a9312 :a9312 :a9312. -:a9313 :a9313 :a9313. -:a9314 :a9314 :a9314. -:a9315 :a9315 :a9315. -:a9316 :a9316 :a9316. -:a9317 :a9317 :a9317. -:a9318 :a9318 :a9318. -:a9319 :a9319 :a9319. -:a9320 :a9320 :a9320. -:a9321 :a9321 :a9321. -:a9322 :a9322 :a9322. -:a9323 :a9323 :a9323. -:a9324 :a9324 :a9324. -:a9325 :a9325 :a9325. -:a9326 :a9326 :a9326. -:a9327 :a9327 :a9327. -:a9328 :a9328 :a9328. -:a9329 :a9329 :a9329. -:a9330 :a9330 :a9330. -:a9331 :a9331 :a9331. -:a9332 :a9332 :a9332. -:a9333 :a9333 :a9333. -:a9334 :a9334 :a9334. -:a9335 :a9335 :a9335. -:a9336 :a9336 :a9336. -:a9337 :a9337 :a9337. -:a9338 :a9338 :a9338. -:a9339 :a9339 :a9339. -:a9340 :a9340 :a9340. -:a9341 :a9341 :a9341. -:a9342 :a9342 :a9342. -:a9343 :a9343 :a9343. -:a9344 :a9344 :a9344. -:a9345 :a9345 :a9345. -:a9346 :a9346 :a9346. -:a9347 :a9347 :a9347. -:a9348 :a9348 :a9348. -:a9349 :a9349 :a9349. -:a9350 :a9350 :a9350. -:a9351 :a9351 :a9351. -:a9352 :a9352 :a9352. -:a9353 :a9353 :a9353. -:a9354 :a9354 :a9354. -:a9355 :a9355 :a9355. -:a9356 :a9356 :a9356. -:a9357 :a9357 :a9357. -:a9358 :a9358 :a9358. -:a9359 :a9359 :a9359. -:a9360 :a9360 :a9360. -:a9361 :a9361 :a9361. -:a9362 :a9362 :a9362. -:a9363 :a9363 :a9363. -:a9364 :a9364 :a9364. -:a9365 :a9365 :a9365. -:a9366 :a9366 :a9366. -:a9367 :a9367 :a9367. -:a9368 :a9368 :a9368. -:a9369 :a9369 :a9369. -:a9370 :a9370 :a9370. -:a9371 :a9371 :a9371. -:a9372 :a9372 :a9372. -:a9373 :a9373 :a9373. -:a9374 :a9374 :a9374. -:a9375 :a9375 :a9375. -:a9376 :a9376 :a9376. -:a9377 :a9377 :a9377. -:a9378 :a9378 :a9378. -:a9379 :a9379 :a9379. -:a9380 :a9380 :a9380. -:a9381 :a9381 :a9381. -:a9382 :a9382 :a9382. -:a9383 :a9383 :a9383. -:a9384 :a9384 :a9384. -:a9385 :a9385 :a9385. -:a9386 :a9386 :a9386. -:a9387 :a9387 :a9387. -:a9388 :a9388 :a9388. -:a9389 :a9389 :a9389. -:a9390 :a9390 :a9390. -:a9391 :a9391 :a9391. -:a9392 :a9392 :a9392. -:a9393 :a9393 :a9393. -:a9394 :a9394 :a9394. -:a9395 :a9395 :a9395. -:a9396 :a9396 :a9396. -:a9397 :a9397 :a9397. -:a9398 :a9398 :a9398. -:a9399 :a9399 :a9399. -:a9400 :a9400 :a9400. -:a9401 :a9401 :a9401. -:a9402 :a9402 :a9402. -:a9403 :a9403 :a9403. -:a9404 :a9404 :a9404. -:a9405 :a9405 :a9405. -:a9406 :a9406 :a9406. -:a9407 :a9407 :a9407. -:a9408 :a9408 :a9408. -:a9409 :a9409 :a9409. -:a9410 :a9410 :a9410. -:a9411 :a9411 :a9411. -:a9412 :a9412 :a9412. -:a9413 :a9413 :a9413. -:a9414 :a9414 :a9414. -:a9415 :a9415 :a9415. -:a9416 :a9416 :a9416. -:a9417 :a9417 :a9417. -:a9418 :a9418 :a9418. -:a9419 :a9419 :a9419. -:a9420 :a9420 :a9420. -:a9421 :a9421 :a9421. -:a9422 :a9422 :a9422. -:a9423 :a9423 :a9423. -:a9424 :a9424 :a9424. -:a9425 :a9425 :a9425. -:a9426 :a9426 :a9426. -:a9427 :a9427 :a9427. -:a9428 :a9428 :a9428. -:a9429 :a9429 :a9429. -:a9430 :a9430 :a9430. -:a9431 :a9431 :a9431. -:a9432 :a9432 :a9432. -:a9433 :a9433 :a9433. -:a9434 :a9434 :a9434. -:a9435 :a9435 :a9435. -:a9436 :a9436 :a9436. -:a9437 :a9437 :a9437. -:a9438 :a9438 :a9438. -:a9439 :a9439 :a9439. -:a9440 :a9440 :a9440. -:a9441 :a9441 :a9441. -:a9442 :a9442 :a9442. -:a9443 :a9443 :a9443. -:a9444 :a9444 :a9444. -:a9445 :a9445 :a9445. -:a9446 :a9446 :a9446. -:a9447 :a9447 :a9447. -:a9448 :a9448 :a9448. -:a9449 :a9449 :a9449. -:a9450 :a9450 :a9450. -:a9451 :a9451 :a9451. -:a9452 :a9452 :a9452. -:a9453 :a9453 :a9453. -:a9454 :a9454 :a9454. -:a9455 :a9455 :a9455. -:a9456 :a9456 :a9456. -:a9457 :a9457 :a9457. -:a9458 :a9458 :a9458. -:a9459 :a9459 :a9459. -:a9460 :a9460 :a9460. -:a9461 :a9461 :a9461. -:a9462 :a9462 :a9462. -:a9463 :a9463 :a9463. -:a9464 :a9464 :a9464. -:a9465 :a9465 :a9465. -:a9466 :a9466 :a9466. -:a9467 :a9467 :a9467. -:a9468 :a9468 :a9468. -:a9469 :a9469 :a9469. -:a9470 :a9470 :a9470. -:a9471 :a9471 :a9471. -:a9472 :a9472 :a9472. -:a9473 :a9473 :a9473. -:a9474 :a9474 :a9474. -:a9475 :a9475 :a9475. -:a9476 :a9476 :a9476. -:a9477 :a9477 :a9477. -:a9478 :a9478 :a9478. -:a9479 :a9479 :a9479. -:a9480 :a9480 :a9480. -:a9481 :a9481 :a9481. -:a9482 :a9482 :a9482. -:a9483 :a9483 :a9483. -:a9484 :a9484 :a9484. -:a9485 :a9485 :a9485. -:a9486 :a9486 :a9486. -:a9487 :a9487 :a9487. -:a9488 :a9488 :a9488. -:a9489 :a9489 :a9489. -:a9490 :a9490 :a9490. -:a9491 :a9491 :a9491. -:a9492 :a9492 :a9492. -:a9493 :a9493 :a9493. -:a9494 :a9494 :a9494. -:a9495 :a9495 :a9495. -:a9496 :a9496 :a9496. -:a9497 :a9497 :a9497. -:a9498 :a9498 :a9498. -:a9499 :a9499 :a9499. -:a9500 :a9500 :a9500. -:a9501 :a9501 :a9501. -:a9502 :a9502 :a9502. -:a9503 :a9503 :a9503. -:a9504 :a9504 :a9504. -:a9505 :a9505 :a9505. -:a9506 :a9506 :a9506. -:a9507 :a9507 :a9507. -:a9508 :a9508 :a9508. -:a9509 :a9509 :a9509. -:a9510 :a9510 :a9510. -:a9511 :a9511 :a9511. -:a9512 :a9512 :a9512. -:a9513 :a9513 :a9513. -:a9514 :a9514 :a9514. -:a9515 :a9515 :a9515. -:a9516 :a9516 :a9516. -:a9517 :a9517 :a9517. -:a9518 :a9518 :a9518. -:a9519 :a9519 :a9519. -:a9520 :a9520 :a9520. -:a9521 :a9521 :a9521. -:a9522 :a9522 :a9522. -:a9523 :a9523 :a9523. -:a9524 :a9524 :a9524. -:a9525 :a9525 :a9525. -:a9526 :a9526 :a9526. -:a9527 :a9527 :a9527. -:a9528 :a9528 :a9528. -:a9529 :a9529 :a9529. -:a9530 :a9530 :a9530. -:a9531 :a9531 :a9531. -:a9532 :a9532 :a9532. -:a9533 :a9533 :a9533. -:a9534 :a9534 :a9534. -:a9535 :a9535 :a9535. -:a9536 :a9536 :a9536. -:a9537 :a9537 :a9537. -:a9538 :a9538 :a9538. -:a9539 :a9539 :a9539. -:a9540 :a9540 :a9540. -:a9541 :a9541 :a9541. -:a9542 :a9542 :a9542. -:a9543 :a9543 :a9543. -:a9544 :a9544 :a9544. -:a9545 :a9545 :a9545. -:a9546 :a9546 :a9546. -:a9547 :a9547 :a9547. -:a9548 :a9548 :a9548. -:a9549 :a9549 :a9549. -:a9550 :a9550 :a9550. -:a9551 :a9551 :a9551. -:a9552 :a9552 :a9552. -:a9553 :a9553 :a9553. -:a9554 :a9554 :a9554. -:a9555 :a9555 :a9555. -:a9556 :a9556 :a9556. -:a9557 :a9557 :a9557. -:a9558 :a9558 :a9558. -:a9559 :a9559 :a9559. -:a9560 :a9560 :a9560. -:a9561 :a9561 :a9561. -:a9562 :a9562 :a9562. -:a9563 :a9563 :a9563. -:a9564 :a9564 :a9564. -:a9565 :a9565 :a9565. -:a9566 :a9566 :a9566. -:a9567 :a9567 :a9567. -:a9568 :a9568 :a9568. -:a9569 :a9569 :a9569. -:a9570 :a9570 :a9570. -:a9571 :a9571 :a9571. -:a9572 :a9572 :a9572. -:a9573 :a9573 :a9573. -:a9574 :a9574 :a9574. -:a9575 :a9575 :a9575. -:a9576 :a9576 :a9576. -:a9577 :a9577 :a9577. -:a9578 :a9578 :a9578. -:a9579 :a9579 :a9579. -:a9580 :a9580 :a9580. -:a9581 :a9581 :a9581. -:a9582 :a9582 :a9582. -:a9583 :a9583 :a9583. -:a9584 :a9584 :a9584. -:a9585 :a9585 :a9585. -:a9586 :a9586 :a9586. -:a9587 :a9587 :a9587. -:a9588 :a9588 :a9588. -:a9589 :a9589 :a9589. -:a9590 :a9590 :a9590. -:a9591 :a9591 :a9591. -:a9592 :a9592 :a9592. -:a9593 :a9593 :a9593. -:a9594 :a9594 :a9594. -:a9595 :a9595 :a9595. -:a9596 :a9596 :a9596. -:a9597 :a9597 :a9597. -:a9598 :a9598 :a9598. -:a9599 :a9599 :a9599. -:a9600 :a9600 :a9600. -:a9601 :a9601 :a9601. -:a9602 :a9602 :a9602. -:a9603 :a9603 :a9603. -:a9604 :a9604 :a9604. -:a9605 :a9605 :a9605. -:a9606 :a9606 :a9606. -:a9607 :a9607 :a9607. -:a9608 :a9608 :a9608. -:a9609 :a9609 :a9609. -:a9610 :a9610 :a9610. -:a9611 :a9611 :a9611. -:a9612 :a9612 :a9612. -:a9613 :a9613 :a9613. -:a9614 :a9614 :a9614. -:a9615 :a9615 :a9615. -:a9616 :a9616 :a9616. -:a9617 :a9617 :a9617. -:a9618 :a9618 :a9618. -:a9619 :a9619 :a9619. -:a9620 :a9620 :a9620. -:a9621 :a9621 :a9621. -:a9622 :a9622 :a9622. -:a9623 :a9623 :a9623. -:a9624 :a9624 :a9624. -:a9625 :a9625 :a9625. -:a9626 :a9626 :a9626. -:a9627 :a9627 :a9627. -:a9628 :a9628 :a9628. -:a9629 :a9629 :a9629. -:a9630 :a9630 :a9630. -:a9631 :a9631 :a9631. -:a9632 :a9632 :a9632. -:a9633 :a9633 :a9633. -:a9634 :a9634 :a9634. -:a9635 :a9635 :a9635. -:a9636 :a9636 :a9636. -:a9637 :a9637 :a9637. -:a9638 :a9638 :a9638. -:a9639 :a9639 :a9639. -:a9640 :a9640 :a9640. -:a9641 :a9641 :a9641. -:a9642 :a9642 :a9642. -:a9643 :a9643 :a9643. -:a9644 :a9644 :a9644. -:a9645 :a9645 :a9645. -:a9646 :a9646 :a9646. -:a9647 :a9647 :a9647. -:a9648 :a9648 :a9648. -:a9649 :a9649 :a9649. -:a9650 :a9650 :a9650. -:a9651 :a9651 :a9651. -:a9652 :a9652 :a9652. -:a9653 :a9653 :a9653. -:a9654 :a9654 :a9654. -:a9655 :a9655 :a9655. -:a9656 :a9656 :a9656. -:a9657 :a9657 :a9657. -:a9658 :a9658 :a9658. -:a9659 :a9659 :a9659. -:a9660 :a9660 :a9660. -:a9661 :a9661 :a9661. -:a9662 :a9662 :a9662. -:a9663 :a9663 :a9663. -:a9664 :a9664 :a9664. -:a9665 :a9665 :a9665. -:a9666 :a9666 :a9666. -:a9667 :a9667 :a9667. -:a9668 :a9668 :a9668. -:a9669 :a9669 :a9669. -:a9670 :a9670 :a9670. -:a9671 :a9671 :a9671. -:a9672 :a9672 :a9672. -:a9673 :a9673 :a9673. -:a9674 :a9674 :a9674. -:a9675 :a9675 :a9675. -:a9676 :a9676 :a9676. -:a9677 :a9677 :a9677. -:a9678 :a9678 :a9678. -:a9679 :a9679 :a9679. -:a9680 :a9680 :a9680. -:a9681 :a9681 :a9681. -:a9682 :a9682 :a9682. -:a9683 :a9683 :a9683. -:a9684 :a9684 :a9684. -:a9685 :a9685 :a9685. -:a9686 :a9686 :a9686. -:a9687 :a9687 :a9687. -:a9688 :a9688 :a9688. -:a9689 :a9689 :a9689. -:a9690 :a9690 :a9690. -:a9691 :a9691 :a9691. -:a9692 :a9692 :a9692. -:a9693 :a9693 :a9693. -:a9694 :a9694 :a9694. -:a9695 :a9695 :a9695. -:a9696 :a9696 :a9696. -:a9697 :a9697 :a9697. -:a9698 :a9698 :a9698. -:a9699 :a9699 :a9699. -:a9700 :a9700 :a9700. -:a9701 :a9701 :a9701. -:a9702 :a9702 :a9702. -:a9703 :a9703 :a9703. -:a9704 :a9704 :a9704. -:a9705 :a9705 :a9705. -:a9706 :a9706 :a9706. -:a9707 :a9707 :a9707. -:a9708 :a9708 :a9708. -:a9709 :a9709 :a9709. -:a9710 :a9710 :a9710. -:a9711 :a9711 :a9711. -:a9712 :a9712 :a9712. -:a9713 :a9713 :a9713. -:a9714 :a9714 :a9714. -:a9715 :a9715 :a9715. -:a9716 :a9716 :a9716. -:a9717 :a9717 :a9717. -:a9718 :a9718 :a9718. -:a9719 :a9719 :a9719. -:a9720 :a9720 :a9720. -:a9721 :a9721 :a9721. -:a9722 :a9722 :a9722. -:a9723 :a9723 :a9723. -:a9724 :a9724 :a9724. -:a9725 :a9725 :a9725. -:a9726 :a9726 :a9726. -:a9727 :a9727 :a9727. -:a9728 :a9728 :a9728. -:a9729 :a9729 :a9729. -:a9730 :a9730 :a9730. -:a9731 :a9731 :a9731. -:a9732 :a9732 :a9732. -:a9733 :a9733 :a9733. -:a9734 :a9734 :a9734. -:a9735 :a9735 :a9735. -:a9736 :a9736 :a9736. -:a9737 :a9737 :a9737. -:a9738 :a9738 :a9738. -:a9739 :a9739 :a9739. -:a9740 :a9740 :a9740. -:a9741 :a9741 :a9741. -:a9742 :a9742 :a9742. -:a9743 :a9743 :a9743. -:a9744 :a9744 :a9744. -:a9745 :a9745 :a9745. -:a9746 :a9746 :a9746. -:a9747 :a9747 :a9747. -:a9748 :a9748 :a9748. -:a9749 :a9749 :a9749. -:a9750 :a9750 :a9750. -:a9751 :a9751 :a9751. -:a9752 :a9752 :a9752. -:a9753 :a9753 :a9753. -:a9754 :a9754 :a9754. -:a9755 :a9755 :a9755. -:a9756 :a9756 :a9756. -:a9757 :a9757 :a9757. -:a9758 :a9758 :a9758. -:a9759 :a9759 :a9759. -:a9760 :a9760 :a9760. -:a9761 :a9761 :a9761. -:a9762 :a9762 :a9762. -:a9763 :a9763 :a9763. -:a9764 :a9764 :a9764. -:a9765 :a9765 :a9765. -:a9766 :a9766 :a9766. -:a9767 :a9767 :a9767. -:a9768 :a9768 :a9768. -:a9769 :a9769 :a9769. -:a9770 :a9770 :a9770. -:a9771 :a9771 :a9771. -:a9772 :a9772 :a9772. -:a9773 :a9773 :a9773. -:a9774 :a9774 :a9774. -:a9775 :a9775 :a9775. -:a9776 :a9776 :a9776. -:a9777 :a9777 :a9777. -:a9778 :a9778 :a9778. -:a9779 :a9779 :a9779. -:a9780 :a9780 :a9780. -:a9781 :a9781 :a9781. -:a9782 :a9782 :a9782. -:a9783 :a9783 :a9783. -:a9784 :a9784 :a9784. -:a9785 :a9785 :a9785. -:a9786 :a9786 :a9786. -:a9787 :a9787 :a9787. -:a9788 :a9788 :a9788. -:a9789 :a9789 :a9789. -:a9790 :a9790 :a9790. -:a9791 :a9791 :a9791. -:a9792 :a9792 :a9792. -:a9793 :a9793 :a9793. -:a9794 :a9794 :a9794. -:a9795 :a9795 :a9795. -:a9796 :a9796 :a9796. -:a9797 :a9797 :a9797. -:a9798 :a9798 :a9798. -:a9799 :a9799 :a9799. -:a9800 :a9800 :a9800. -:a9801 :a9801 :a9801. -:a9802 :a9802 :a9802. -:a9803 :a9803 :a9803. -:a9804 :a9804 :a9804. -:a9805 :a9805 :a9805. -:a9806 :a9806 :a9806. -:a9807 :a9807 :a9807. -:a9808 :a9808 :a9808. -:a9809 :a9809 :a9809. -:a9810 :a9810 :a9810. -:a9811 :a9811 :a9811. -:a9812 :a9812 :a9812. -:a9813 :a9813 :a9813. -:a9814 :a9814 :a9814. -:a9815 :a9815 :a9815. -:a9816 :a9816 :a9816. -:a9817 :a9817 :a9817. -:a9818 :a9818 :a9818. -:a9819 :a9819 :a9819. -:a9820 :a9820 :a9820. -:a9821 :a9821 :a9821. -:a9822 :a9822 :a9822. -:a9823 :a9823 :a9823. -:a9824 :a9824 :a9824. -:a9825 :a9825 :a9825. -:a9826 :a9826 :a9826. -:a9827 :a9827 :a9827. -:a9828 :a9828 :a9828. -:a9829 :a9829 :a9829. -:a9830 :a9830 :a9830. -:a9831 :a9831 :a9831. -:a9832 :a9832 :a9832. -:a9833 :a9833 :a9833. -:a9834 :a9834 :a9834. -:a9835 :a9835 :a9835. -:a9836 :a9836 :a9836. -:a9837 :a9837 :a9837. -:a9838 :a9838 :a9838. -:a9839 :a9839 :a9839. -:a9840 :a9840 :a9840. -:a9841 :a9841 :a9841. -:a9842 :a9842 :a9842. -:a9843 :a9843 :a9843. -:a9844 :a9844 :a9844. -:a9845 :a9845 :a9845. -:a9846 :a9846 :a9846. -:a9847 :a9847 :a9847. -:a9848 :a9848 :a9848. -:a9849 :a9849 :a9849. -:a9850 :a9850 :a9850. -:a9851 :a9851 :a9851. -:a9852 :a9852 :a9852. -:a9853 :a9853 :a9853. -:a9854 :a9854 :a9854. -:a9855 :a9855 :a9855. -:a9856 :a9856 :a9856. -:a9857 :a9857 :a9857. -:a9858 :a9858 :a9858. -:a9859 :a9859 :a9859. -:a9860 :a9860 :a9860. -:a9861 :a9861 :a9861. -:a9862 :a9862 :a9862. -:a9863 :a9863 :a9863. -:a9864 :a9864 :a9864. -:a9865 :a9865 :a9865. -:a9866 :a9866 :a9866. -:a9867 :a9867 :a9867. -:a9868 :a9868 :a9868. -:a9869 :a9869 :a9869. -:a9870 :a9870 :a9870. -:a9871 :a9871 :a9871. -:a9872 :a9872 :a9872. -:a9873 :a9873 :a9873. -:a9874 :a9874 :a9874. -:a9875 :a9875 :a9875. -:a9876 :a9876 :a9876. -:a9877 :a9877 :a9877. -:a9878 :a9878 :a9878. -:a9879 :a9879 :a9879. -:a9880 :a9880 :a9880. -:a9881 :a9881 :a9881. -:a9882 :a9882 :a9882. -:a9883 :a9883 :a9883. -:a9884 :a9884 :a9884. -:a9885 :a9885 :a9885. -:a9886 :a9886 :a9886. -:a9887 :a9887 :a9887. -:a9888 :a9888 :a9888. -:a9889 :a9889 :a9889. -:a9890 :a9890 :a9890. -:a9891 :a9891 :a9891. -:a9892 :a9892 :a9892. -:a9893 :a9893 :a9893. -:a9894 :a9894 :a9894. -:a9895 :a9895 :a9895. -:a9896 :a9896 :a9896. -:a9897 :a9897 :a9897. -:a9898 :a9898 :a9898. -:a9899 :a9899 :a9899. -:a9900 :a9900 :a9900. -:a9901 :a9901 :a9901. -:a9902 :a9902 :a9902. -:a9903 :a9903 :a9903. -:a9904 :a9904 :a9904. -:a9905 :a9905 :a9905. -:a9906 :a9906 :a9906. -:a9907 :a9907 :a9907. -:a9908 :a9908 :a9908. -:a9909 :a9909 :a9909. -:a9910 :a9910 :a9910. -:a9911 :a9911 :a9911. -:a9912 :a9912 :a9912. -:a9913 :a9913 :a9913. -:a9914 :a9914 :a9914. -:a9915 :a9915 :a9915. -:a9916 :a9916 :a9916. -:a9917 :a9917 :a9917. -:a9918 :a9918 :a9918. -:a9919 :a9919 :a9919. -:a9920 :a9920 :a9920. -:a9921 :a9921 :a9921. -:a9922 :a9922 :a9922. -:a9923 :a9923 :a9923. -:a9924 :a9924 :a9924. -:a9925 :a9925 :a9925. -:a9926 :a9926 :a9926. -:a9927 :a9927 :a9927. -:a9928 :a9928 :a9928. -:a9929 :a9929 :a9929. -:a9930 :a9930 :a9930. -:a9931 :a9931 :a9931. -:a9932 :a9932 :a9932. -:a9933 :a9933 :a9933. -:a9934 :a9934 :a9934. -:a9935 :a9935 :a9935. -:a9936 :a9936 :a9936. -:a9937 :a9937 :a9937. -:a9938 :a9938 :a9938. -:a9939 :a9939 :a9939. -:a9940 :a9940 :a9940. -:a9941 :a9941 :a9941. -:a9942 :a9942 :a9942. -:a9943 :a9943 :a9943. -:a9944 :a9944 :a9944. -:a9945 :a9945 :a9945. -:a9946 :a9946 :a9946. -:a9947 :a9947 :a9947. -:a9948 :a9948 :a9948. -:a9949 :a9949 :a9949. -:a9950 :a9950 :a9950. -:a9951 :a9951 :a9951. -:a9952 :a9952 :a9952. -:a9953 :a9953 :a9953. -:a9954 :a9954 :a9954. -:a9955 :a9955 :a9955. -:a9956 :a9956 :a9956. -:a9957 :a9957 :a9957. -:a9958 :a9958 :a9958. -:a9959 :a9959 :a9959. -:a9960 :a9960 :a9960. -:a9961 :a9961 :a9961. -:a9962 :a9962 :a9962. -:a9963 :a9963 :a9963. -:a9964 :a9964 :a9964. -:a9965 :a9965 :a9965. -:a9966 :a9966 :a9966. -:a9967 :a9967 :a9967. -:a9968 :a9968 :a9968. -:a9969 :a9969 :a9969. -:a9970 :a9970 :a9970. -:a9971 :a9971 :a9971. -:a9972 :a9972 :a9972. -:a9973 :a9973 :a9973. -:a9974 :a9974 :a9974. -:a9975 :a9975 :a9975. -:a9976 :a9976 :a9976. -:a9977 :a9977 :a9977. -:a9978 :a9978 :a9978. -:a9979 :a9979 :a9979. -:a9980 :a9980 :a9980. -:a9981 :a9981 :a9981. -:a9982 :a9982 :a9982. -:a9983 :a9983 :a9983. -:a9984 :a9984 :a9984. -:a9985 :a9985 :a9985. -:a9986 :a9986 :a9986. -:a9987 :a9987 :a9987. -:a9988 :a9988 :a9988. -:a9989 :a9989 :a9989. -:a9990 :a9990 :a9990. -:a9991 :a9991 :a9991. -:a9992 :a9992 :a9992. -:a9993 :a9993 :a9993. -:a9994 :a9994 :a9994. -:a9995 :a9995 :a9995. -:a9996 :a9996 :a9996. -:a9997 :a9997 :a9997. -:a9998 :a9998 :a9998. -:a9999 :a9999 :a9999. -:a10000 :a10000 :a10000. diff --git a/packages/semweb/Tests/Turtle/test-15.out b/packages/semweb/Tests/Turtle/test-15.out deleted file mode 100644 index c0604b3b6..000000000 --- a/packages/semweb/Tests/Turtle/test-15.out +++ /dev/null @@ -1,10000 +0,0 @@ - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . diff --git a/packages/semweb/Tests/Turtle/test-15.ttl b/packages/semweb/Tests/Turtle/test-15.ttl deleted file mode 100644 index 10df17dfa..000000000 --- a/packages/semweb/Tests/Turtle/test-15.ttl +++ /dev/null @@ -1,3 +0,0 @@ -# 10000 triple objects (10000 triples) more than the default Bison stack size -@prefix : . -:a :b :c1, :c2, :c3, :c4, :c5, :c6, :c7, :c8, :c9, :c10, :c11, :c12, :c13, :c14, :c15, :c16, :c17, :c18, :c19, :c20, :c21, :c22, :c23, :c24, :c25, :c26, :c27, :c28, :c29, :c30, :c31, :c32, :c33, :c34, :c35, :c36, :c37, :c38, :c39, :c40, :c41, :c42, :c43, :c44, :c45, :c46, :c47, :c48, :c49, :c50, :c51, :c52, :c53, :c54, :c55, :c56, :c57, :c58, :c59, :c60, :c61, :c62, :c63, :c64, :c65, :c66, :c67, :c68, :c69, :c70, :c71, :c72, :c73, :c74, :c75, :c76, :c77, :c78, :c79, :c80, :c81, :c82, :c83, :c84, :c85, :c86, :c87, :c88, :c89, :c90, :c91, :c92, :c93, :c94, :c95, :c96, :c97, :c98, :c99, :c100, :c101, :c102, :c103, :c104, :c105, :c106, :c107, :c108, :c109, :c110, :c111, :c112, :c113, :c114, :c115, :c116, :c117, :c118, :c119, :c120, :c121, :c122, :c123, :c124, :c125, :c126, :c127, :c128, :c129, :c130, :c131, :c132, :c133, :c134, :c135, :c136, :c137, :c138, :c139, :c140, :c141, :c142, :c143, :c144, :c145, :c146, :c147, :c148, :c149, :c150, :c151, :c152, :c153, :c154, :c155, :c156, :c157, :c158, :c159, :c160, :c161, :c162, :c163, :c164, :c165, :c166, :c167, :c168, :c169, :c170, :c171, :c172, :c173, :c174, :c175, :c176, :c177, :c178, :c179, :c180, :c181, :c182, :c183, :c184, :c185, :c186, :c187, :c188, :c189, :c190, :c191, :c192, :c193, :c194, :c195, :c196, :c197, :c198, :c199, :c200, :c201, :c202, :c203, :c204, :c205, :c206, :c207, :c208, :c209, :c210, :c211, :c212, :c213, :c214, :c215, :c216, :c217, :c218, :c219, :c220, :c221, :c222, :c223, :c224, :c225, :c226, :c227, :c228, :c229, :c230, :c231, :c232, :c233, :c234, :c235, :c236, :c237, :c238, :c239, :c240, :c241, :c242, :c243, :c244, :c245, :c246, :c247, :c248, :c249, :c250, :c251, :c252, :c253, :c254, :c255, :c256, :c257, :c258, :c259, :c260, :c261, :c262, :c263, :c264, :c265, :c266, :c267, :c268, :c269, :c270, :c271, :c272, :c273, :c274, :c275, :c276, :c277, :c278, :c279, :c280, :c281, :c282, :c283, :c284, :c285, :c286, :c287, :c288, :c289, :c290, :c291, :c292, :c293, :c294, :c295, :c296, :c297, :c298, :c299, :c300, :c301, :c302, :c303, :c304, :c305, :c306, :c307, :c308, :c309, :c310, :c311, :c312, :c313, :c314, :c315, :c316, :c317, :c318, :c319, :c320, :c321, :c322, :c323, :c324, :c325, :c326, :c327, :c328, :c329, :c330, :c331, :c332, :c333, :c334, :c335, :c336, :c337, :c338, :c339, :c340, :c341, :c342, :c343, :c344, :c345, :c346, :c347, :c348, :c349, :c350, :c351, :c352, :c353, :c354, :c355, :c356, :c357, :c358, :c359, :c360, :c361, :c362, :c363, :c364, :c365, :c366, :c367, :c368, :c369, :c370, :c371, :c372, :c373, :c374, :c375, :c376, :c377, :c378, :c379, :c380, :c381, :c382, :c383, :c384, :c385, :c386, :c387, :c388, :c389, :c390, :c391, :c392, :c393, :c394, :c395, :c396, :c397, :c398, :c399, :c400, :c401, :c402, :c403, :c404, :c405, :c406, :c407, :c408, :c409, :c410, :c411, :c412, :c413, :c414, :c415, :c416, :c417, :c418, :c419, :c420, :c421, :c422, :c423, :c424, :c425, :c426, :c427, :c428, :c429, :c430, :c431, :c432, :c433, :c434, :c435, :c436, :c437, :c438, :c439, :c440, :c441, :c442, :c443, :c444, :c445, :c446, :c447, :c448, :c449, :c450, :c451, :c452, :c453, :c454, :c455, :c456, :c457, :c458, :c459, :c460, :c461, :c462, :c463, :c464, :c465, :c466, :c467, :c468, :c469, :c470, :c471, :c472, :c473, :c474, :c475, :c476, :c477, :c478, :c479, :c480, :c481, :c482, :c483, :c484, :c485, :c486, :c487, :c488, :c489, :c490, :c491, :c492, :c493, :c494, :c495, :c496, :c497, :c498, :c499, :c500, :c501, :c502, :c503, :c504, :c505, :c506, :c507, :c508, :c509, :c510, :c511, :c512, :c513, :c514, :c515, :c516, :c517, :c518, :c519, :c520, :c521, :c522, :c523, :c524, :c525, :c526, :c527, :c528, :c529, :c530, :c531, :c532, :c533, :c534, :c535, :c536, :c537, :c538, :c539, :c540, :c541, :c542, :c543, :c544, :c545, :c546, :c547, :c548, :c549, :c550, :c551, :c552, :c553, :c554, :c555, :c556, :c557, :c558, :c559, :c560, :c561, :c562, :c563, :c564, :c565, :c566, :c567, :c568, :c569, :c570, :c571, :c572, :c573, :c574, :c575, :c576, :c577, :c578, :c579, :c580, :c581, :c582, :c583, :c584, :c585, :c586, :c587, :c588, :c589, :c590, :c591, :c592, :c593, :c594, :c595, :c596, :c597, :c598, :c599, :c600, :c601, :c602, :c603, :c604, :c605, :c606, :c607, :c608, :c609, :c610, :c611, :c612, :c613, :c614, :c615, :c616, :c617, :c618, :c619, :c620, :c621, :c622, :c623, :c624, :c625, :c626, :c627, :c628, :c629, :c630, :c631, :c632, :c633, :c634, :c635, :c636, :c637, :c638, :c639, :c640, :c641, :c642, :c643, :c644, :c645, :c646, :c647, :c648, :c649, :c650, :c651, :c652, :c653, :c654, :c655, :c656, :c657, :c658, :c659, :c660, :c661, :c662, :c663, :c664, :c665, :c666, :c667, :c668, :c669, :c670, :c671, :c672, :c673, :c674, :c675, :c676, :c677, :c678, :c679, :c680, :c681, :c682, :c683, :c684, :c685, :c686, :c687, :c688, :c689, :c690, :c691, :c692, :c693, :c694, :c695, :c696, :c697, :c698, :c699, :c700, :c701, :c702, :c703, :c704, :c705, :c706, :c707, :c708, :c709, :c710, :c711, :c712, :c713, :c714, :c715, :c716, :c717, :c718, :c719, :c720, :c721, :c722, :c723, :c724, :c725, :c726, :c727, :c728, :c729, :c730, :c731, :c732, :c733, :c734, :c735, :c736, :c737, :c738, :c739, :c740, :c741, :c742, :c743, :c744, :c745, :c746, :c747, :c748, :c749, :c750, :c751, :c752, :c753, :c754, :c755, :c756, :c757, :c758, :c759, :c760, :c761, :c762, :c763, :c764, :c765, :c766, :c767, :c768, :c769, :c770, :c771, :c772, :c773, :c774, :c775, :c776, :c777, :c778, :c779, :c780, :c781, :c782, :c783, :c784, :c785, :c786, :c787, :c788, :c789, :c790, :c791, :c792, :c793, :c794, :c795, :c796, :c797, :c798, :c799, :c800, :c801, :c802, :c803, :c804, :c805, :c806, :c807, :c808, :c809, :c810, :c811, :c812, :c813, :c814, :c815, :c816, :c817, :c818, :c819, :c820, :c821, :c822, :c823, :c824, :c825, :c826, :c827, :c828, :c829, :c830, :c831, :c832, :c833, :c834, :c835, :c836, :c837, :c838, :c839, :c840, :c841, :c842, :c843, :c844, :c845, :c846, :c847, :c848, :c849, :c850, :c851, :c852, :c853, :c854, :c855, :c856, :c857, :c858, :c859, :c860, :c861, :c862, :c863, :c864, :c865, :c866, :c867, :c868, :c869, :c870, :c871, :c872, :c873, :c874, :c875, :c876, :c877, :c878, :c879, :c880, :c881, :c882, :c883, :c884, :c885, :c886, :c887, :c888, :c889, :c890, :c891, :c892, :c893, :c894, :c895, :c896, :c897, :c898, :c899, :c900, :c901, :c902, :c903, :c904, :c905, :c906, :c907, :c908, :c909, :c910, :c911, :c912, :c913, :c914, :c915, :c916, :c917, :c918, :c919, :c920, :c921, :c922, :c923, :c924, :c925, :c926, :c927, :c928, :c929, :c930, :c931, :c932, :c933, :c934, :c935, :c936, :c937, :c938, :c939, :c940, :c941, :c942, :c943, :c944, :c945, :c946, :c947, :c948, :c949, :c950, :c951, :c952, :c953, :c954, :c955, :c956, :c957, :c958, :c959, :c960, :c961, :c962, :c963, :c964, :c965, :c966, :c967, :c968, :c969, :c970, :c971, :c972, :c973, :c974, :c975, :c976, :c977, :c978, :c979, :c980, :c981, :c982, :c983, :c984, :c985, :c986, :c987, :c988, :c989, :c990, :c991, :c992, :c993, :c994, :c995, :c996, :c997, :c998, :c999, :c1000, :c1001, :c1002, :c1003, :c1004, :c1005, :c1006, :c1007, :c1008, :c1009, :c1010, :c1011, :c1012, :c1013, :c1014, :c1015, :c1016, :c1017, :c1018, :c1019, :c1020, :c1021, :c1022, :c1023, :c1024, :c1025, :c1026, :c1027, :c1028, :c1029, :c1030, :c1031, :c1032, :c1033, :c1034, :c1035, :c1036, :c1037, :c1038, :c1039, :c1040, :c1041, :c1042, :c1043, :c1044, :c1045, :c1046, :c1047, :c1048, :c1049, :c1050, :c1051, :c1052, :c1053, :c1054, :c1055, :c1056, :c1057, :c1058, :c1059, :c1060, :c1061, :c1062, :c1063, :c1064, :c1065, :c1066, :c1067, :c1068, :c1069, :c1070, :c1071, :c1072, :c1073, :c1074, :c1075, :c1076, :c1077, :c1078, :c1079, :c1080, :c1081, :c1082, :c1083, :c1084, :c1085, :c1086, :c1087, :c1088, :c1089, :c1090, :c1091, :c1092, :c1093, :c1094, :c1095, :c1096, :c1097, :c1098, :c1099, :c1100, :c1101, :c1102, :c1103, :c1104, :c1105, :c1106, :c1107, :c1108, :c1109, :c1110, :c1111, :c1112, :c1113, :c1114, :c1115, :c1116, :c1117, :c1118, :c1119, :c1120, :c1121, :c1122, :c1123, :c1124, :c1125, :c1126, :c1127, :c1128, :c1129, :c1130, :c1131, :c1132, :c1133, :c1134, :c1135, :c1136, :c1137, :c1138, :c1139, :c1140, :c1141, :c1142, :c1143, :c1144, :c1145, :c1146, :c1147, :c1148, :c1149, :c1150, :c1151, :c1152, :c1153, :c1154, :c1155, :c1156, :c1157, :c1158, :c1159, :c1160, :c1161, :c1162, :c1163, :c1164, :c1165, :c1166, :c1167, :c1168, :c1169, :c1170, :c1171, :c1172, :c1173, :c1174, :c1175, :c1176, :c1177, :c1178, :c1179, :c1180, :c1181, :c1182, :c1183, :c1184, :c1185, :c1186, :c1187, :c1188, :c1189, :c1190, :c1191, :c1192, :c1193, :c1194, :c1195, :c1196, :c1197, :c1198, :c1199, :c1200, :c1201, :c1202, :c1203, :c1204, :c1205, :c1206, :c1207, :c1208, :c1209, :c1210, :c1211, :c1212, :c1213, :c1214, :c1215, :c1216, :c1217, :c1218, :c1219, :c1220, :c1221, :c1222, :c1223, :c1224, :c1225, :c1226, :c1227, :c1228, :c1229, :c1230, :c1231, :c1232, :c1233, :c1234, :c1235, :c1236, :c1237, :c1238, :c1239, :c1240, :c1241, :c1242, :c1243, :c1244, :c1245, :c1246, :c1247, :c1248, :c1249, :c1250, :c1251, :c1252, :c1253, :c1254, :c1255, :c1256, :c1257, :c1258, :c1259, :c1260, :c1261, :c1262, :c1263, :c1264, :c1265, :c1266, :c1267, :c1268, :c1269, :c1270, :c1271, :c1272, :c1273, :c1274, :c1275, :c1276, :c1277, :c1278, :c1279, :c1280, :c1281, :c1282, :c1283, :c1284, :c1285, :c1286, :c1287, :c1288, :c1289, :c1290, :c1291, :c1292, :c1293, :c1294, :c1295, :c1296, :c1297, :c1298, :c1299, :c1300, :c1301, :c1302, :c1303, :c1304, :c1305, :c1306, :c1307, :c1308, :c1309, :c1310, :c1311, :c1312, :c1313, :c1314, :c1315, :c1316, :c1317, :c1318, :c1319, :c1320, :c1321, :c1322, :c1323, :c1324, :c1325, :c1326, :c1327, :c1328, :c1329, :c1330, :c1331, :c1332, :c1333, :c1334, :c1335, :c1336, :c1337, :c1338, :c1339, :c1340, :c1341, :c1342, :c1343, :c1344, :c1345, :c1346, :c1347, :c1348, :c1349, :c1350, :c1351, :c1352, :c1353, :c1354, :c1355, :c1356, :c1357, :c1358, :c1359, :c1360, :c1361, :c1362, :c1363, :c1364, :c1365, :c1366, :c1367, :c1368, :c1369, :c1370, :c1371, :c1372, :c1373, :c1374, :c1375, :c1376, :c1377, :c1378, :c1379, :c1380, :c1381, :c1382, :c1383, :c1384, :c1385, :c1386, :c1387, :c1388, :c1389, :c1390, :c1391, :c1392, :c1393, :c1394, :c1395, :c1396, :c1397, :c1398, :c1399, :c1400, :c1401, :c1402, :c1403, :c1404, :c1405, :c1406, :c1407, :c1408, :c1409, :c1410, :c1411, :c1412, :c1413, :c1414, :c1415, :c1416, :c1417, :c1418, :c1419, :c1420, :c1421, :c1422, :c1423, :c1424, :c1425, :c1426, :c1427, :c1428, :c1429, :c1430, :c1431, :c1432, :c1433, :c1434, :c1435, :c1436, :c1437, :c1438, :c1439, :c1440, :c1441, :c1442, :c1443, :c1444, :c1445, :c1446, :c1447, :c1448, :c1449, :c1450, :c1451, :c1452, :c1453, :c1454, :c1455, :c1456, :c1457, :c1458, :c1459, :c1460, :c1461, :c1462, :c1463, :c1464, :c1465, :c1466, :c1467, :c1468, :c1469, :c1470, :c1471, :c1472, :c1473, :c1474, :c1475, :c1476, :c1477, :c1478, :c1479, :c1480, :c1481, :c1482, :c1483, :c1484, :c1485, :c1486, :c1487, :c1488, :c1489, :c1490, :c1491, :c1492, :c1493, :c1494, :c1495, :c1496, :c1497, :c1498, :c1499, :c1500, :c1501, :c1502, :c1503, :c1504, :c1505, :c1506, :c1507, :c1508, :c1509, :c1510, :c1511, :c1512, :c1513, :c1514, :c1515, :c1516, :c1517, :c1518, :c1519, :c1520, :c1521, :c1522, :c1523, :c1524, :c1525, :c1526, :c1527, :c1528, :c1529, :c1530, :c1531, :c1532, :c1533, :c1534, :c1535, :c1536, :c1537, :c1538, :c1539, :c1540, :c1541, :c1542, :c1543, :c1544, :c1545, :c1546, :c1547, :c1548, :c1549, :c1550, :c1551, :c1552, :c1553, :c1554, :c1555, :c1556, :c1557, :c1558, :c1559, :c1560, :c1561, :c1562, :c1563, :c1564, :c1565, :c1566, :c1567, :c1568, :c1569, :c1570, :c1571, :c1572, :c1573, :c1574, :c1575, :c1576, :c1577, :c1578, :c1579, :c1580, :c1581, :c1582, :c1583, :c1584, :c1585, :c1586, :c1587, :c1588, :c1589, :c1590, :c1591, :c1592, :c1593, :c1594, :c1595, :c1596, :c1597, :c1598, :c1599, :c1600, :c1601, :c1602, :c1603, :c1604, :c1605, :c1606, :c1607, :c1608, :c1609, :c1610, :c1611, :c1612, :c1613, :c1614, :c1615, :c1616, :c1617, :c1618, :c1619, :c1620, :c1621, :c1622, :c1623, :c1624, :c1625, :c1626, :c1627, :c1628, :c1629, :c1630, :c1631, :c1632, :c1633, :c1634, :c1635, :c1636, :c1637, :c1638, :c1639, :c1640, :c1641, :c1642, :c1643, :c1644, :c1645, :c1646, :c1647, :c1648, :c1649, :c1650, :c1651, :c1652, :c1653, :c1654, :c1655, :c1656, :c1657, :c1658, :c1659, :c1660, :c1661, :c1662, :c1663, :c1664, :c1665, :c1666, :c1667, :c1668, :c1669, :c1670, :c1671, :c1672, :c1673, :c1674, :c1675, :c1676, :c1677, :c1678, :c1679, :c1680, :c1681, :c1682, :c1683, :c1684, :c1685, :c1686, :c1687, :c1688, :c1689, :c1690, :c1691, :c1692, :c1693, :c1694, :c1695, :c1696, :c1697, :c1698, :c1699, :c1700, :c1701, :c1702, :c1703, :c1704, :c1705, :c1706, :c1707, :c1708, :c1709, :c1710, :c1711, :c1712, :c1713, :c1714, :c1715, :c1716, :c1717, :c1718, :c1719, :c1720, :c1721, :c1722, :c1723, :c1724, :c1725, :c1726, :c1727, :c1728, :c1729, :c1730, :c1731, :c1732, :c1733, :c1734, :c1735, :c1736, :c1737, :c1738, :c1739, :c1740, :c1741, :c1742, :c1743, :c1744, :c1745, :c1746, :c1747, :c1748, :c1749, :c1750, :c1751, :c1752, :c1753, :c1754, :c1755, :c1756, :c1757, :c1758, :c1759, :c1760, :c1761, :c1762, :c1763, :c1764, :c1765, :c1766, :c1767, :c1768, :c1769, :c1770, :c1771, :c1772, :c1773, :c1774, :c1775, :c1776, :c1777, :c1778, :c1779, :c1780, :c1781, :c1782, :c1783, :c1784, :c1785, :c1786, :c1787, :c1788, :c1789, :c1790, :c1791, :c1792, :c1793, :c1794, :c1795, :c1796, :c1797, :c1798, :c1799, :c1800, :c1801, :c1802, :c1803, :c1804, :c1805, :c1806, :c1807, :c1808, :c1809, :c1810, :c1811, :c1812, :c1813, :c1814, :c1815, :c1816, :c1817, :c1818, :c1819, :c1820, :c1821, :c1822, :c1823, :c1824, :c1825, :c1826, :c1827, :c1828, :c1829, :c1830, :c1831, :c1832, :c1833, :c1834, :c1835, :c1836, :c1837, :c1838, :c1839, :c1840, :c1841, :c1842, :c1843, :c1844, :c1845, :c1846, :c1847, :c1848, :c1849, :c1850, :c1851, :c1852, :c1853, :c1854, :c1855, :c1856, :c1857, :c1858, :c1859, :c1860, :c1861, :c1862, :c1863, :c1864, :c1865, :c1866, :c1867, :c1868, :c1869, :c1870, :c1871, :c1872, :c1873, :c1874, :c1875, :c1876, :c1877, :c1878, :c1879, :c1880, :c1881, :c1882, :c1883, :c1884, :c1885, :c1886, :c1887, :c1888, :c1889, :c1890, :c1891, :c1892, :c1893, :c1894, :c1895, :c1896, :c1897, :c1898, :c1899, :c1900, :c1901, :c1902, :c1903, :c1904, :c1905, :c1906, :c1907, :c1908, :c1909, :c1910, :c1911, :c1912, :c1913, :c1914, :c1915, :c1916, :c1917, :c1918, :c1919, :c1920, :c1921, :c1922, :c1923, :c1924, :c1925, :c1926, :c1927, :c1928, :c1929, :c1930, :c1931, :c1932, :c1933, :c1934, :c1935, :c1936, :c1937, :c1938, :c1939, :c1940, :c1941, :c1942, :c1943, :c1944, :c1945, :c1946, :c1947, :c1948, :c1949, :c1950, :c1951, :c1952, :c1953, :c1954, :c1955, :c1956, :c1957, :c1958, :c1959, :c1960, :c1961, :c1962, :c1963, :c1964, :c1965, :c1966, :c1967, :c1968, :c1969, :c1970, :c1971, :c1972, :c1973, :c1974, :c1975, :c1976, :c1977, :c1978, :c1979, :c1980, :c1981, :c1982, :c1983, :c1984, :c1985, :c1986, :c1987, :c1988, :c1989, :c1990, :c1991, :c1992, :c1993, :c1994, :c1995, :c1996, :c1997, :c1998, :c1999, :c2000, :c2001, :c2002, :c2003, :c2004, :c2005, :c2006, :c2007, :c2008, :c2009, :c2010, :c2011, :c2012, :c2013, :c2014, :c2015, :c2016, :c2017, :c2018, :c2019, :c2020, :c2021, :c2022, :c2023, :c2024, :c2025, :c2026, :c2027, :c2028, :c2029, :c2030, :c2031, :c2032, :c2033, :c2034, :c2035, :c2036, :c2037, :c2038, :c2039, :c2040, :c2041, :c2042, :c2043, :c2044, :c2045, :c2046, :c2047, :c2048, :c2049, :c2050, :c2051, :c2052, :c2053, :c2054, :c2055, :c2056, :c2057, :c2058, :c2059, :c2060, :c2061, :c2062, :c2063, :c2064, :c2065, :c2066, :c2067, :c2068, :c2069, :c2070, :c2071, :c2072, :c2073, :c2074, :c2075, :c2076, :c2077, :c2078, :c2079, :c2080, :c2081, :c2082, :c2083, :c2084, :c2085, :c2086, :c2087, :c2088, :c2089, :c2090, :c2091, :c2092, :c2093, :c2094, :c2095, :c2096, :c2097, :c2098, :c2099, :c2100, :c2101, :c2102, :c2103, :c2104, :c2105, :c2106, :c2107, :c2108, :c2109, :c2110, :c2111, :c2112, :c2113, :c2114, :c2115, :c2116, :c2117, :c2118, :c2119, :c2120, :c2121, :c2122, :c2123, :c2124, :c2125, :c2126, :c2127, :c2128, :c2129, :c2130, :c2131, :c2132, :c2133, :c2134, :c2135, :c2136, :c2137, :c2138, :c2139, :c2140, :c2141, :c2142, :c2143, :c2144, :c2145, :c2146, :c2147, :c2148, :c2149, :c2150, :c2151, :c2152, :c2153, :c2154, :c2155, :c2156, :c2157, :c2158, :c2159, :c2160, :c2161, :c2162, :c2163, :c2164, :c2165, :c2166, :c2167, :c2168, :c2169, :c2170, :c2171, :c2172, :c2173, :c2174, :c2175, :c2176, :c2177, :c2178, :c2179, :c2180, :c2181, :c2182, :c2183, :c2184, :c2185, :c2186, :c2187, :c2188, :c2189, :c2190, :c2191, :c2192, :c2193, :c2194, :c2195, :c2196, :c2197, :c2198, :c2199, :c2200, :c2201, :c2202, :c2203, :c2204, :c2205, :c2206, :c2207, :c2208, :c2209, :c2210, :c2211, :c2212, :c2213, :c2214, :c2215, :c2216, :c2217, :c2218, :c2219, :c2220, :c2221, :c2222, :c2223, :c2224, :c2225, :c2226, :c2227, :c2228, :c2229, :c2230, :c2231, :c2232, :c2233, :c2234, :c2235, :c2236, :c2237, :c2238, :c2239, :c2240, :c2241, :c2242, :c2243, :c2244, :c2245, :c2246, :c2247, :c2248, :c2249, :c2250, :c2251, :c2252, :c2253, :c2254, :c2255, :c2256, :c2257, :c2258, :c2259, :c2260, :c2261, :c2262, :c2263, :c2264, :c2265, :c2266, :c2267, :c2268, :c2269, :c2270, :c2271, :c2272, :c2273, :c2274, :c2275, :c2276, :c2277, :c2278, :c2279, :c2280, :c2281, :c2282, :c2283, :c2284, :c2285, :c2286, :c2287, :c2288, :c2289, :c2290, :c2291, :c2292, :c2293, :c2294, :c2295, :c2296, :c2297, :c2298, :c2299, :c2300, :c2301, :c2302, :c2303, :c2304, :c2305, :c2306, :c2307, :c2308, :c2309, :c2310, :c2311, :c2312, :c2313, :c2314, :c2315, :c2316, :c2317, :c2318, :c2319, :c2320, :c2321, :c2322, :c2323, :c2324, :c2325, :c2326, :c2327, :c2328, :c2329, :c2330, :c2331, :c2332, :c2333, :c2334, :c2335, :c2336, :c2337, :c2338, :c2339, :c2340, :c2341, :c2342, :c2343, :c2344, :c2345, :c2346, :c2347, :c2348, :c2349, :c2350, :c2351, :c2352, :c2353, :c2354, :c2355, :c2356, :c2357, :c2358, :c2359, :c2360, :c2361, :c2362, :c2363, :c2364, :c2365, :c2366, :c2367, :c2368, :c2369, :c2370, :c2371, :c2372, :c2373, :c2374, :c2375, :c2376, :c2377, :c2378, :c2379, :c2380, :c2381, :c2382, :c2383, :c2384, :c2385, :c2386, :c2387, :c2388, :c2389, :c2390, :c2391, :c2392, :c2393, :c2394, :c2395, :c2396, :c2397, :c2398, :c2399, :c2400, :c2401, :c2402, :c2403, :c2404, :c2405, :c2406, :c2407, :c2408, :c2409, :c2410, :c2411, :c2412, :c2413, :c2414, :c2415, :c2416, :c2417, :c2418, :c2419, :c2420, :c2421, :c2422, :c2423, :c2424, :c2425, :c2426, :c2427, :c2428, :c2429, :c2430, :c2431, :c2432, :c2433, :c2434, :c2435, :c2436, :c2437, :c2438, :c2439, :c2440, :c2441, :c2442, :c2443, :c2444, :c2445, :c2446, :c2447, :c2448, :c2449, :c2450, :c2451, :c2452, :c2453, :c2454, :c2455, :c2456, :c2457, :c2458, :c2459, :c2460, :c2461, :c2462, :c2463, :c2464, :c2465, :c2466, :c2467, :c2468, :c2469, :c2470, :c2471, :c2472, :c2473, :c2474, :c2475, :c2476, :c2477, :c2478, :c2479, :c2480, :c2481, :c2482, :c2483, :c2484, :c2485, :c2486, :c2487, :c2488, :c2489, :c2490, :c2491, :c2492, :c2493, :c2494, :c2495, :c2496, :c2497, :c2498, :c2499, :c2500, :c2501, :c2502, :c2503, :c2504, :c2505, :c2506, :c2507, :c2508, :c2509, :c2510, :c2511, :c2512, :c2513, :c2514, :c2515, :c2516, :c2517, :c2518, :c2519, :c2520, :c2521, :c2522, :c2523, :c2524, :c2525, :c2526, :c2527, :c2528, :c2529, :c2530, :c2531, :c2532, :c2533, :c2534, :c2535, :c2536, :c2537, :c2538, :c2539, :c2540, :c2541, :c2542, :c2543, :c2544, :c2545, :c2546, :c2547, :c2548, :c2549, :c2550, :c2551, :c2552, :c2553, :c2554, :c2555, :c2556, :c2557, :c2558, :c2559, :c2560, :c2561, :c2562, :c2563, :c2564, :c2565, :c2566, :c2567, :c2568, :c2569, :c2570, :c2571, :c2572, :c2573, :c2574, :c2575, :c2576, :c2577, :c2578, :c2579, :c2580, :c2581, :c2582, :c2583, :c2584, :c2585, :c2586, :c2587, :c2588, :c2589, :c2590, :c2591, :c2592, :c2593, :c2594, :c2595, :c2596, :c2597, :c2598, :c2599, :c2600, :c2601, :c2602, :c2603, :c2604, :c2605, :c2606, :c2607, :c2608, :c2609, :c2610, :c2611, :c2612, :c2613, :c2614, :c2615, :c2616, :c2617, :c2618, :c2619, :c2620, :c2621, :c2622, :c2623, :c2624, :c2625, :c2626, :c2627, :c2628, :c2629, :c2630, :c2631, :c2632, :c2633, :c2634, :c2635, :c2636, :c2637, :c2638, :c2639, :c2640, :c2641, :c2642, :c2643, :c2644, :c2645, :c2646, :c2647, :c2648, :c2649, :c2650, :c2651, :c2652, :c2653, :c2654, :c2655, :c2656, :c2657, :c2658, :c2659, :c2660, :c2661, :c2662, :c2663, :c2664, :c2665, :c2666, :c2667, :c2668, :c2669, :c2670, :c2671, :c2672, :c2673, :c2674, :c2675, :c2676, :c2677, :c2678, :c2679, :c2680, :c2681, :c2682, :c2683, :c2684, :c2685, :c2686, :c2687, :c2688, :c2689, :c2690, :c2691, :c2692, :c2693, :c2694, :c2695, :c2696, :c2697, :c2698, :c2699, :c2700, :c2701, :c2702, :c2703, :c2704, :c2705, :c2706, :c2707, :c2708, :c2709, :c2710, :c2711, :c2712, :c2713, :c2714, :c2715, :c2716, :c2717, :c2718, :c2719, :c2720, :c2721, :c2722, :c2723, :c2724, :c2725, :c2726, :c2727, :c2728, :c2729, :c2730, :c2731, :c2732, :c2733, :c2734, :c2735, :c2736, :c2737, :c2738, :c2739, :c2740, :c2741, :c2742, :c2743, :c2744, :c2745, :c2746, :c2747, :c2748, :c2749, :c2750, :c2751, :c2752, :c2753, :c2754, :c2755, :c2756, :c2757, :c2758, :c2759, :c2760, :c2761, :c2762, :c2763, :c2764, :c2765, :c2766, :c2767, :c2768, :c2769, :c2770, :c2771, :c2772, :c2773, :c2774, :c2775, :c2776, :c2777, :c2778, :c2779, :c2780, :c2781, :c2782, :c2783, :c2784, :c2785, :c2786, :c2787, :c2788, :c2789, :c2790, :c2791, :c2792, :c2793, :c2794, :c2795, :c2796, :c2797, :c2798, :c2799, :c2800, :c2801, :c2802, :c2803, :c2804, :c2805, :c2806, :c2807, :c2808, :c2809, :c2810, :c2811, :c2812, :c2813, :c2814, :c2815, :c2816, :c2817, :c2818, :c2819, :c2820, :c2821, :c2822, :c2823, :c2824, :c2825, :c2826, :c2827, :c2828, :c2829, :c2830, :c2831, :c2832, :c2833, :c2834, :c2835, :c2836, :c2837, :c2838, :c2839, :c2840, :c2841, :c2842, :c2843, :c2844, :c2845, :c2846, :c2847, :c2848, :c2849, :c2850, :c2851, :c2852, :c2853, :c2854, :c2855, :c2856, :c2857, :c2858, :c2859, :c2860, :c2861, :c2862, :c2863, :c2864, :c2865, :c2866, :c2867, :c2868, :c2869, :c2870, :c2871, :c2872, :c2873, :c2874, :c2875, :c2876, :c2877, :c2878, :c2879, :c2880, :c2881, :c2882, :c2883, :c2884, :c2885, :c2886, :c2887, :c2888, :c2889, :c2890, :c2891, :c2892, :c2893, :c2894, :c2895, :c2896, :c2897, :c2898, :c2899, :c2900, :c2901, :c2902, :c2903, :c2904, :c2905, :c2906, :c2907, :c2908, :c2909, :c2910, :c2911, :c2912, :c2913, :c2914, :c2915, :c2916, :c2917, :c2918, :c2919, :c2920, :c2921, :c2922, :c2923, :c2924, :c2925, :c2926, :c2927, :c2928, :c2929, :c2930, :c2931, :c2932, :c2933, :c2934, :c2935, :c2936, :c2937, :c2938, :c2939, :c2940, :c2941, :c2942, :c2943, :c2944, :c2945, :c2946, :c2947, :c2948, :c2949, :c2950, :c2951, :c2952, :c2953, :c2954, :c2955, :c2956, :c2957, :c2958, :c2959, :c2960, :c2961, :c2962, :c2963, :c2964, :c2965, :c2966, :c2967, :c2968, :c2969, :c2970, :c2971, :c2972, :c2973, :c2974, :c2975, :c2976, :c2977, :c2978, :c2979, :c2980, :c2981, :c2982, :c2983, :c2984, :c2985, :c2986, :c2987, :c2988, :c2989, :c2990, :c2991, :c2992, :c2993, :c2994, :c2995, :c2996, :c2997, :c2998, :c2999, :c3000, :c3001, :c3002, :c3003, :c3004, :c3005, :c3006, :c3007, :c3008, :c3009, :c3010, :c3011, :c3012, :c3013, :c3014, :c3015, :c3016, :c3017, :c3018, :c3019, :c3020, :c3021, :c3022, :c3023, :c3024, :c3025, :c3026, :c3027, :c3028, :c3029, :c3030, :c3031, :c3032, :c3033, :c3034, :c3035, :c3036, :c3037, :c3038, :c3039, :c3040, :c3041, :c3042, :c3043, :c3044, :c3045, :c3046, :c3047, :c3048, :c3049, :c3050, :c3051, :c3052, :c3053, :c3054, :c3055, :c3056, :c3057, :c3058, :c3059, :c3060, :c3061, :c3062, :c3063, :c3064, :c3065, :c3066, :c3067, :c3068, :c3069, :c3070, :c3071, :c3072, :c3073, :c3074, :c3075, :c3076, :c3077, :c3078, :c3079, :c3080, :c3081, :c3082, :c3083, :c3084, :c3085, :c3086, :c3087, :c3088, :c3089, :c3090, :c3091, :c3092, :c3093, :c3094, :c3095, :c3096, :c3097, :c3098, :c3099, :c3100, :c3101, :c3102, :c3103, :c3104, :c3105, :c3106, :c3107, :c3108, :c3109, :c3110, :c3111, :c3112, :c3113, :c3114, :c3115, :c3116, :c3117, :c3118, :c3119, :c3120, :c3121, :c3122, :c3123, :c3124, :c3125, :c3126, :c3127, :c3128, :c3129, :c3130, :c3131, :c3132, :c3133, :c3134, :c3135, :c3136, :c3137, :c3138, :c3139, :c3140, :c3141, :c3142, :c3143, :c3144, :c3145, :c3146, :c3147, :c3148, :c3149, :c3150, :c3151, :c3152, :c3153, :c3154, :c3155, :c3156, :c3157, :c3158, :c3159, :c3160, :c3161, :c3162, :c3163, :c3164, :c3165, :c3166, :c3167, :c3168, :c3169, :c3170, :c3171, :c3172, :c3173, :c3174, :c3175, :c3176, :c3177, :c3178, :c3179, :c3180, :c3181, :c3182, :c3183, :c3184, :c3185, :c3186, :c3187, :c3188, :c3189, :c3190, :c3191, :c3192, :c3193, :c3194, :c3195, :c3196, :c3197, :c3198, :c3199, :c3200, :c3201, :c3202, :c3203, :c3204, :c3205, :c3206, :c3207, :c3208, :c3209, :c3210, :c3211, :c3212, :c3213, :c3214, :c3215, :c3216, :c3217, :c3218, :c3219, :c3220, :c3221, :c3222, :c3223, :c3224, :c3225, :c3226, :c3227, :c3228, :c3229, :c3230, :c3231, :c3232, :c3233, :c3234, :c3235, :c3236, :c3237, :c3238, :c3239, :c3240, :c3241, :c3242, :c3243, :c3244, :c3245, :c3246, :c3247, :c3248, :c3249, :c3250, :c3251, :c3252, :c3253, :c3254, :c3255, :c3256, :c3257, :c3258, :c3259, :c3260, :c3261, :c3262, :c3263, :c3264, :c3265, :c3266, :c3267, :c3268, :c3269, :c3270, :c3271, :c3272, :c3273, :c3274, :c3275, :c3276, :c3277, :c3278, :c3279, :c3280, :c3281, :c3282, :c3283, :c3284, :c3285, :c3286, :c3287, :c3288, :c3289, :c3290, :c3291, :c3292, :c3293, :c3294, :c3295, :c3296, :c3297, :c3298, :c3299, :c3300, :c3301, :c3302, :c3303, :c3304, :c3305, :c3306, :c3307, :c3308, :c3309, :c3310, :c3311, :c3312, :c3313, :c3314, :c3315, :c3316, :c3317, :c3318, :c3319, :c3320, :c3321, :c3322, :c3323, :c3324, :c3325, :c3326, :c3327, :c3328, :c3329, :c3330, :c3331, :c3332, :c3333, :c3334, :c3335, :c3336, :c3337, :c3338, :c3339, :c3340, :c3341, :c3342, :c3343, :c3344, :c3345, :c3346, :c3347, :c3348, :c3349, :c3350, :c3351, :c3352, :c3353, :c3354, :c3355, :c3356, :c3357, :c3358, :c3359, :c3360, :c3361, :c3362, :c3363, :c3364, :c3365, :c3366, :c3367, :c3368, :c3369, :c3370, :c3371, :c3372, :c3373, :c3374, :c3375, :c3376, :c3377, :c3378, :c3379, :c3380, :c3381, :c3382, :c3383, :c3384, :c3385, :c3386, :c3387, :c3388, :c3389, :c3390, :c3391, :c3392, :c3393, :c3394, :c3395, :c3396, :c3397, :c3398, :c3399, :c3400, :c3401, :c3402, :c3403, :c3404, :c3405, :c3406, :c3407, :c3408, :c3409, :c3410, :c3411, :c3412, :c3413, :c3414, :c3415, :c3416, :c3417, :c3418, :c3419, :c3420, :c3421, :c3422, :c3423, :c3424, :c3425, :c3426, :c3427, :c3428, :c3429, :c3430, :c3431, :c3432, :c3433, :c3434, :c3435, :c3436, :c3437, :c3438, :c3439, :c3440, :c3441, :c3442, :c3443, :c3444, :c3445, :c3446, :c3447, :c3448, :c3449, :c3450, :c3451, :c3452, :c3453, :c3454, :c3455, :c3456, :c3457, :c3458, :c3459, :c3460, :c3461, :c3462, :c3463, :c3464, :c3465, :c3466, :c3467, :c3468, :c3469, :c3470, :c3471, :c3472, :c3473, :c3474, :c3475, :c3476, :c3477, :c3478, :c3479, :c3480, :c3481, :c3482, :c3483, :c3484, :c3485, :c3486, :c3487, :c3488, :c3489, :c3490, :c3491, :c3492, :c3493, :c3494, :c3495, :c3496, :c3497, :c3498, :c3499, :c3500, :c3501, :c3502, :c3503, :c3504, :c3505, :c3506, :c3507, :c3508, :c3509, :c3510, :c3511, :c3512, :c3513, :c3514, :c3515, :c3516, :c3517, :c3518, :c3519, :c3520, :c3521, :c3522, :c3523, :c3524, :c3525, :c3526, :c3527, :c3528, :c3529, :c3530, :c3531, :c3532, :c3533, :c3534, :c3535, :c3536, :c3537, :c3538, :c3539, :c3540, :c3541, :c3542, :c3543, :c3544, :c3545, :c3546, :c3547, :c3548, :c3549, :c3550, :c3551, :c3552, :c3553, :c3554, :c3555, :c3556, :c3557, :c3558, :c3559, :c3560, :c3561, :c3562, :c3563, :c3564, :c3565, :c3566, :c3567, :c3568, :c3569, :c3570, :c3571, :c3572, :c3573, :c3574, :c3575, :c3576, :c3577, :c3578, :c3579, :c3580, :c3581, :c3582, :c3583, :c3584, :c3585, :c3586, :c3587, :c3588, :c3589, :c3590, :c3591, :c3592, :c3593, :c3594, :c3595, :c3596, :c3597, :c3598, :c3599, :c3600, :c3601, :c3602, :c3603, :c3604, :c3605, :c3606, :c3607, :c3608, :c3609, :c3610, :c3611, :c3612, :c3613, :c3614, :c3615, :c3616, :c3617, :c3618, :c3619, :c3620, :c3621, :c3622, :c3623, :c3624, :c3625, :c3626, :c3627, :c3628, :c3629, :c3630, :c3631, :c3632, :c3633, :c3634, :c3635, :c3636, :c3637, :c3638, :c3639, :c3640, :c3641, :c3642, :c3643, :c3644, :c3645, :c3646, :c3647, :c3648, :c3649, :c3650, :c3651, :c3652, :c3653, :c3654, :c3655, :c3656, :c3657, :c3658, :c3659, :c3660, :c3661, :c3662, :c3663, :c3664, :c3665, :c3666, :c3667, :c3668, :c3669, :c3670, :c3671, :c3672, :c3673, :c3674, :c3675, :c3676, :c3677, :c3678, :c3679, :c3680, :c3681, :c3682, :c3683, :c3684, :c3685, :c3686, :c3687, :c3688, :c3689, :c3690, :c3691, :c3692, :c3693, :c3694, :c3695, :c3696, :c3697, :c3698, :c3699, :c3700, :c3701, :c3702, :c3703, :c3704, :c3705, :c3706, :c3707, :c3708, :c3709, :c3710, :c3711, :c3712, :c3713, :c3714, :c3715, :c3716, :c3717, :c3718, :c3719, :c3720, :c3721, :c3722, :c3723, :c3724, :c3725, :c3726, :c3727, :c3728, :c3729, :c3730, :c3731, :c3732, :c3733, :c3734, :c3735, :c3736, :c3737, :c3738, :c3739, :c3740, :c3741, :c3742, :c3743, :c3744, :c3745, :c3746, :c3747, :c3748, :c3749, :c3750, :c3751, :c3752, :c3753, :c3754, :c3755, :c3756, :c3757, :c3758, :c3759, :c3760, :c3761, :c3762, :c3763, :c3764, :c3765, :c3766, :c3767, :c3768, :c3769, :c3770, :c3771, :c3772, :c3773, :c3774, :c3775, :c3776, :c3777, :c3778, :c3779, :c3780, :c3781, :c3782, :c3783, :c3784, :c3785, :c3786, :c3787, :c3788, :c3789, :c3790, :c3791, :c3792, :c3793, :c3794, :c3795, :c3796, :c3797, :c3798, :c3799, :c3800, :c3801, :c3802, :c3803, :c3804, :c3805, :c3806, :c3807, :c3808, :c3809, :c3810, :c3811, :c3812, :c3813, :c3814, :c3815, :c3816, :c3817, :c3818, :c3819, :c3820, :c3821, :c3822, :c3823, :c3824, :c3825, :c3826, :c3827, :c3828, :c3829, :c3830, :c3831, :c3832, :c3833, :c3834, :c3835, :c3836, :c3837, :c3838, :c3839, :c3840, :c3841, :c3842, :c3843, :c3844, :c3845, :c3846, :c3847, :c3848, :c3849, :c3850, :c3851, :c3852, :c3853, :c3854, :c3855, :c3856, :c3857, :c3858, :c3859, :c3860, :c3861, :c3862, :c3863, :c3864, :c3865, :c3866, :c3867, :c3868, :c3869, :c3870, :c3871, :c3872, :c3873, :c3874, :c3875, :c3876, :c3877, :c3878, :c3879, :c3880, :c3881, :c3882, :c3883, :c3884, :c3885, :c3886, :c3887, :c3888, :c3889, :c3890, :c3891, :c3892, :c3893, :c3894, :c3895, :c3896, :c3897, :c3898, :c3899, :c3900, :c3901, :c3902, :c3903, :c3904, :c3905, :c3906, :c3907, :c3908, :c3909, :c3910, :c3911, :c3912, :c3913, :c3914, :c3915, :c3916, :c3917, :c3918, :c3919, :c3920, :c3921, :c3922, :c3923, :c3924, :c3925, :c3926, :c3927, :c3928, :c3929, :c3930, :c3931, :c3932, :c3933, :c3934, :c3935, :c3936, :c3937, :c3938, :c3939, :c3940, :c3941, :c3942, :c3943, :c3944, :c3945, :c3946, :c3947, :c3948, :c3949, :c3950, :c3951, :c3952, :c3953, :c3954, :c3955, :c3956, :c3957, :c3958, :c3959, :c3960, :c3961, :c3962, :c3963, :c3964, :c3965, :c3966, :c3967, :c3968, :c3969, :c3970, :c3971, :c3972, :c3973, :c3974, :c3975, :c3976, :c3977, :c3978, :c3979, :c3980, :c3981, :c3982, :c3983, :c3984, :c3985, :c3986, :c3987, :c3988, :c3989, :c3990, :c3991, :c3992, :c3993, :c3994, :c3995, :c3996, :c3997, :c3998, :c3999, :c4000, :c4001, :c4002, :c4003, :c4004, :c4005, :c4006, :c4007, :c4008, :c4009, :c4010, :c4011, :c4012, :c4013, :c4014, :c4015, :c4016, :c4017, :c4018, :c4019, :c4020, :c4021, :c4022, :c4023, :c4024, :c4025, :c4026, :c4027, :c4028, :c4029, :c4030, :c4031, :c4032, :c4033, :c4034, :c4035, :c4036, :c4037, :c4038, :c4039, :c4040, :c4041, :c4042, :c4043, :c4044, :c4045, :c4046, :c4047, :c4048, :c4049, :c4050, :c4051, :c4052, :c4053, :c4054, :c4055, :c4056, :c4057, :c4058, :c4059, :c4060, :c4061, :c4062, :c4063, :c4064, :c4065, :c4066, :c4067, :c4068, :c4069, :c4070, :c4071, :c4072, :c4073, :c4074, :c4075, :c4076, :c4077, :c4078, :c4079, :c4080, :c4081, :c4082, :c4083, :c4084, :c4085, :c4086, :c4087, :c4088, :c4089, :c4090, :c4091, :c4092, :c4093, :c4094, :c4095, :c4096, :c4097, :c4098, :c4099, :c4100, :c4101, :c4102, :c4103, :c4104, :c4105, :c4106, :c4107, :c4108, :c4109, :c4110, :c4111, :c4112, :c4113, :c4114, :c4115, :c4116, :c4117, :c4118, :c4119, :c4120, :c4121, :c4122, :c4123, :c4124, :c4125, :c4126, :c4127, :c4128, :c4129, :c4130, :c4131, :c4132, :c4133, :c4134, :c4135, :c4136, :c4137, :c4138, :c4139, :c4140, :c4141, :c4142, :c4143, :c4144, :c4145, :c4146, :c4147, :c4148, :c4149, :c4150, :c4151, :c4152, :c4153, :c4154, :c4155, :c4156, :c4157, :c4158, :c4159, :c4160, :c4161, :c4162, :c4163, :c4164, :c4165, :c4166, :c4167, :c4168, :c4169, :c4170, :c4171, :c4172, :c4173, :c4174, :c4175, :c4176, :c4177, :c4178, :c4179, :c4180, :c4181, :c4182, :c4183, :c4184, :c4185, :c4186, :c4187, :c4188, :c4189, :c4190, :c4191, :c4192, :c4193, :c4194, :c4195, :c4196, :c4197, :c4198, :c4199, :c4200, :c4201, :c4202, :c4203, :c4204, :c4205, :c4206, :c4207, :c4208, :c4209, :c4210, :c4211, :c4212, :c4213, :c4214, :c4215, :c4216, :c4217, :c4218, :c4219, :c4220, :c4221, :c4222, :c4223, :c4224, :c4225, :c4226, :c4227, :c4228, :c4229, :c4230, :c4231, :c4232, :c4233, :c4234, :c4235, :c4236, :c4237, :c4238, :c4239, :c4240, :c4241, :c4242, :c4243, :c4244, :c4245, :c4246, :c4247, :c4248, :c4249, :c4250, :c4251, :c4252, :c4253, :c4254, :c4255, :c4256, :c4257, :c4258, :c4259, :c4260, :c4261, :c4262, :c4263, :c4264, :c4265, :c4266, :c4267, :c4268, :c4269, :c4270, :c4271, :c4272, :c4273, :c4274, :c4275, :c4276, :c4277, :c4278, :c4279, :c4280, :c4281, :c4282, :c4283, :c4284, :c4285, :c4286, :c4287, :c4288, :c4289, :c4290, :c4291, :c4292, :c4293, :c4294, :c4295, :c4296, :c4297, :c4298, :c4299, :c4300, :c4301, :c4302, :c4303, :c4304, :c4305, :c4306, :c4307, :c4308, :c4309, :c4310, :c4311, :c4312, :c4313, :c4314, :c4315, :c4316, :c4317, :c4318, :c4319, :c4320, :c4321, :c4322, :c4323, :c4324, :c4325, :c4326, :c4327, :c4328, :c4329, :c4330, :c4331, :c4332, :c4333, :c4334, :c4335, :c4336, :c4337, :c4338, :c4339, :c4340, :c4341, :c4342, :c4343, :c4344, :c4345, :c4346, :c4347, :c4348, :c4349, :c4350, :c4351, :c4352, :c4353, :c4354, :c4355, :c4356, :c4357, :c4358, :c4359, :c4360, :c4361, :c4362, :c4363, :c4364, :c4365, :c4366, :c4367, :c4368, :c4369, :c4370, :c4371, :c4372, :c4373, :c4374, :c4375, :c4376, :c4377, :c4378, :c4379, :c4380, :c4381, :c4382, :c4383, :c4384, :c4385, :c4386, :c4387, :c4388, :c4389, :c4390, :c4391, :c4392, :c4393, :c4394, :c4395, :c4396, :c4397, :c4398, :c4399, :c4400, :c4401, :c4402, :c4403, :c4404, :c4405, :c4406, :c4407, :c4408, :c4409, :c4410, :c4411, :c4412, :c4413, :c4414, :c4415, :c4416, :c4417, :c4418, :c4419, :c4420, :c4421, :c4422, :c4423, :c4424, :c4425, :c4426, :c4427, :c4428, :c4429, :c4430, :c4431, :c4432, :c4433, :c4434, :c4435, :c4436, :c4437, :c4438, :c4439, :c4440, :c4441, :c4442, :c4443, :c4444, :c4445, :c4446, :c4447, :c4448, :c4449, :c4450, :c4451, :c4452, :c4453, :c4454, :c4455, :c4456, :c4457, :c4458, :c4459, :c4460, :c4461, :c4462, :c4463, :c4464, :c4465, :c4466, :c4467, :c4468, :c4469, :c4470, :c4471, :c4472, :c4473, :c4474, :c4475, :c4476, :c4477, :c4478, :c4479, :c4480, :c4481, :c4482, :c4483, :c4484, :c4485, :c4486, :c4487, :c4488, :c4489, :c4490, :c4491, :c4492, :c4493, :c4494, :c4495, :c4496, :c4497, :c4498, :c4499, :c4500, :c4501, :c4502, :c4503, :c4504, :c4505, :c4506, :c4507, :c4508, :c4509, :c4510, :c4511, :c4512, :c4513, :c4514, :c4515, :c4516, :c4517, :c4518, :c4519, :c4520, :c4521, :c4522, :c4523, :c4524, :c4525, :c4526, :c4527, :c4528, :c4529, :c4530, :c4531, :c4532, :c4533, :c4534, :c4535, :c4536, :c4537, :c4538, :c4539, :c4540, :c4541, :c4542, :c4543, :c4544, :c4545, :c4546, :c4547, :c4548, :c4549, :c4550, :c4551, :c4552, :c4553, :c4554, :c4555, :c4556, :c4557, :c4558, :c4559, :c4560, :c4561, :c4562, :c4563, :c4564, :c4565, :c4566, :c4567, :c4568, :c4569, :c4570, :c4571, :c4572, :c4573, :c4574, :c4575, :c4576, :c4577, :c4578, :c4579, :c4580, :c4581, :c4582, :c4583, :c4584, :c4585, :c4586, :c4587, :c4588, :c4589, :c4590, :c4591, :c4592, :c4593, :c4594, :c4595, :c4596, :c4597, :c4598, :c4599, :c4600, :c4601, :c4602, :c4603, :c4604, :c4605, :c4606, :c4607, :c4608, :c4609, :c4610, :c4611, :c4612, :c4613, :c4614, :c4615, :c4616, :c4617, :c4618, :c4619, :c4620, :c4621, :c4622, :c4623, :c4624, :c4625, :c4626, :c4627, :c4628, :c4629, :c4630, :c4631, :c4632, :c4633, :c4634, :c4635, :c4636, :c4637, :c4638, :c4639, :c4640, :c4641, :c4642, :c4643, :c4644, :c4645, :c4646, :c4647, :c4648, :c4649, :c4650, :c4651, :c4652, :c4653, :c4654, :c4655, :c4656, :c4657, :c4658, :c4659, :c4660, :c4661, :c4662, :c4663, :c4664, :c4665, :c4666, :c4667, :c4668, :c4669, :c4670, :c4671, :c4672, :c4673, :c4674, :c4675, :c4676, :c4677, :c4678, :c4679, :c4680, :c4681, :c4682, :c4683, :c4684, :c4685, :c4686, :c4687, :c4688, :c4689, :c4690, :c4691, :c4692, :c4693, :c4694, :c4695, :c4696, :c4697, :c4698, :c4699, :c4700, :c4701, :c4702, :c4703, :c4704, :c4705, :c4706, :c4707, :c4708, :c4709, :c4710, :c4711, :c4712, :c4713, :c4714, :c4715, :c4716, :c4717, :c4718, :c4719, :c4720, :c4721, :c4722, :c4723, :c4724, :c4725, :c4726, :c4727, :c4728, :c4729, :c4730, :c4731, :c4732, :c4733, :c4734, :c4735, :c4736, :c4737, :c4738, :c4739, :c4740, :c4741, :c4742, :c4743, :c4744, :c4745, :c4746, :c4747, :c4748, :c4749, :c4750, :c4751, :c4752, :c4753, :c4754, :c4755, :c4756, :c4757, :c4758, :c4759, :c4760, :c4761, :c4762, :c4763, :c4764, :c4765, :c4766, :c4767, :c4768, :c4769, :c4770, :c4771, :c4772, :c4773, :c4774, :c4775, :c4776, :c4777, :c4778, :c4779, :c4780, :c4781, :c4782, :c4783, :c4784, :c4785, :c4786, :c4787, :c4788, :c4789, :c4790, :c4791, :c4792, :c4793, :c4794, :c4795, :c4796, :c4797, :c4798, :c4799, :c4800, :c4801, :c4802, :c4803, :c4804, :c4805, :c4806, :c4807, :c4808, :c4809, :c4810, :c4811, :c4812, :c4813, :c4814, :c4815, :c4816, :c4817, :c4818, :c4819, :c4820, :c4821, :c4822, :c4823, :c4824, :c4825, :c4826, :c4827, :c4828, :c4829, :c4830, :c4831, :c4832, :c4833, :c4834, :c4835, :c4836, :c4837, :c4838, :c4839, :c4840, :c4841, :c4842, :c4843, :c4844, :c4845, :c4846, :c4847, :c4848, :c4849, :c4850, :c4851, :c4852, :c4853, :c4854, :c4855, :c4856, :c4857, :c4858, :c4859, :c4860, :c4861, :c4862, :c4863, :c4864, :c4865, :c4866, :c4867, :c4868, :c4869, :c4870, :c4871, :c4872, :c4873, :c4874, :c4875, :c4876, :c4877, :c4878, :c4879, :c4880, :c4881, :c4882, :c4883, :c4884, :c4885, :c4886, :c4887, :c4888, :c4889, :c4890, :c4891, :c4892, :c4893, :c4894, :c4895, :c4896, :c4897, :c4898, :c4899, :c4900, :c4901, :c4902, :c4903, :c4904, :c4905, :c4906, :c4907, :c4908, :c4909, :c4910, :c4911, :c4912, :c4913, :c4914, :c4915, :c4916, :c4917, :c4918, :c4919, :c4920, :c4921, :c4922, :c4923, :c4924, :c4925, :c4926, :c4927, :c4928, :c4929, :c4930, :c4931, :c4932, :c4933, :c4934, :c4935, :c4936, :c4937, :c4938, :c4939, :c4940, :c4941, :c4942, :c4943, :c4944, :c4945, :c4946, :c4947, :c4948, :c4949, :c4950, :c4951, :c4952, :c4953, :c4954, :c4955, :c4956, :c4957, :c4958, :c4959, :c4960, :c4961, :c4962, :c4963, :c4964, :c4965, :c4966, :c4967, :c4968, :c4969, :c4970, :c4971, :c4972, :c4973, :c4974, :c4975, :c4976, :c4977, :c4978, :c4979, :c4980, :c4981, :c4982, :c4983, :c4984, :c4985, :c4986, :c4987, :c4988, :c4989, :c4990, :c4991, :c4992, :c4993, :c4994, :c4995, :c4996, :c4997, :c4998, :c4999, :c5000, :c5001, :c5002, :c5003, :c5004, :c5005, :c5006, :c5007, :c5008, :c5009, :c5010, :c5011, :c5012, :c5013, :c5014, :c5015, :c5016, :c5017, :c5018, :c5019, :c5020, :c5021, :c5022, :c5023, :c5024, :c5025, :c5026, :c5027, :c5028, :c5029, :c5030, :c5031, :c5032, :c5033, :c5034, :c5035, :c5036, :c5037, :c5038, :c5039, :c5040, :c5041, :c5042, :c5043, :c5044, :c5045, :c5046, :c5047, :c5048, :c5049, :c5050, :c5051, :c5052, :c5053, :c5054, :c5055, :c5056, :c5057, :c5058, :c5059, :c5060, :c5061, :c5062, :c5063, :c5064, :c5065, :c5066, :c5067, :c5068, :c5069, :c5070, :c5071, :c5072, :c5073, :c5074, :c5075, :c5076, :c5077, :c5078, :c5079, :c5080, :c5081, :c5082, :c5083, :c5084, :c5085, :c5086, :c5087, :c5088, :c5089, :c5090, :c5091, :c5092, :c5093, :c5094, :c5095, :c5096, :c5097, :c5098, :c5099, :c5100, :c5101, :c5102, :c5103, :c5104, :c5105, :c5106, :c5107, :c5108, :c5109, :c5110, :c5111, :c5112, :c5113, :c5114, :c5115, :c5116, :c5117, :c5118, :c5119, :c5120, :c5121, :c5122, :c5123, :c5124, :c5125, :c5126, :c5127, :c5128, :c5129, :c5130, :c5131, :c5132, :c5133, :c5134, :c5135, :c5136, :c5137, :c5138, :c5139, :c5140, :c5141, :c5142, :c5143, :c5144, :c5145, :c5146, :c5147, :c5148, :c5149, :c5150, :c5151, :c5152, :c5153, :c5154, :c5155, :c5156, :c5157, :c5158, :c5159, :c5160, :c5161, :c5162, :c5163, :c5164, :c5165, :c5166, :c5167, :c5168, :c5169, :c5170, :c5171, :c5172, :c5173, :c5174, :c5175, :c5176, :c5177, :c5178, :c5179, :c5180, :c5181, :c5182, :c5183, :c5184, :c5185, :c5186, :c5187, :c5188, :c5189, :c5190, :c5191, :c5192, :c5193, :c5194, :c5195, :c5196, :c5197, :c5198, :c5199, :c5200, :c5201, :c5202, :c5203, :c5204, :c5205, :c5206, :c5207, :c5208, :c5209, :c5210, :c5211, :c5212, :c5213, :c5214, :c5215, :c5216, :c5217, :c5218, :c5219, :c5220, :c5221, :c5222, :c5223, :c5224, :c5225, :c5226, :c5227, :c5228, :c5229, :c5230, :c5231, :c5232, :c5233, :c5234, :c5235, :c5236, :c5237, :c5238, :c5239, :c5240, :c5241, :c5242, :c5243, :c5244, :c5245, :c5246, :c5247, :c5248, :c5249, :c5250, :c5251, :c5252, :c5253, :c5254, :c5255, :c5256, :c5257, :c5258, :c5259, :c5260, :c5261, :c5262, :c5263, :c5264, :c5265, :c5266, :c5267, :c5268, :c5269, :c5270, :c5271, :c5272, :c5273, :c5274, :c5275, :c5276, :c5277, :c5278, :c5279, :c5280, :c5281, :c5282, :c5283, :c5284, :c5285, :c5286, :c5287, :c5288, :c5289, :c5290, :c5291, :c5292, :c5293, :c5294, :c5295, :c5296, :c5297, :c5298, :c5299, :c5300, :c5301, :c5302, :c5303, :c5304, :c5305, :c5306, :c5307, :c5308, :c5309, :c5310, :c5311, :c5312, :c5313, :c5314, :c5315, :c5316, :c5317, :c5318, :c5319, :c5320, :c5321, :c5322, :c5323, :c5324, :c5325, :c5326, :c5327, :c5328, :c5329, :c5330, :c5331, :c5332, :c5333, :c5334, :c5335, :c5336, :c5337, :c5338, :c5339, :c5340, :c5341, :c5342, :c5343, :c5344, :c5345, :c5346, :c5347, :c5348, :c5349, :c5350, :c5351, :c5352, :c5353, :c5354, :c5355, :c5356, :c5357, :c5358, :c5359, :c5360, :c5361, :c5362, :c5363, :c5364, :c5365, :c5366, :c5367, :c5368, :c5369, :c5370, :c5371, :c5372, :c5373, :c5374, :c5375, :c5376, :c5377, :c5378, :c5379, :c5380, :c5381, :c5382, :c5383, :c5384, :c5385, :c5386, :c5387, :c5388, :c5389, :c5390, :c5391, :c5392, :c5393, :c5394, :c5395, :c5396, :c5397, :c5398, :c5399, :c5400, :c5401, :c5402, :c5403, :c5404, :c5405, :c5406, :c5407, :c5408, :c5409, :c5410, :c5411, :c5412, :c5413, :c5414, :c5415, :c5416, :c5417, :c5418, :c5419, :c5420, :c5421, :c5422, :c5423, :c5424, :c5425, :c5426, :c5427, :c5428, :c5429, :c5430, :c5431, :c5432, :c5433, :c5434, :c5435, :c5436, :c5437, :c5438, :c5439, :c5440, :c5441, :c5442, :c5443, :c5444, :c5445, :c5446, :c5447, :c5448, :c5449, :c5450, :c5451, :c5452, :c5453, :c5454, :c5455, :c5456, :c5457, :c5458, :c5459, :c5460, :c5461, :c5462, :c5463, :c5464, :c5465, :c5466, :c5467, :c5468, :c5469, :c5470, :c5471, :c5472, :c5473, :c5474, :c5475, :c5476, :c5477, :c5478, :c5479, :c5480, :c5481, :c5482, :c5483, :c5484, :c5485, :c5486, :c5487, :c5488, :c5489, :c5490, :c5491, :c5492, :c5493, :c5494, :c5495, :c5496, :c5497, :c5498, :c5499, :c5500, :c5501, :c5502, :c5503, :c5504, :c5505, :c5506, :c5507, :c5508, :c5509, :c5510, :c5511, :c5512, :c5513, :c5514, :c5515, :c5516, :c5517, :c5518, :c5519, :c5520, :c5521, :c5522, :c5523, :c5524, :c5525, :c5526, :c5527, :c5528, :c5529, :c5530, :c5531, :c5532, :c5533, :c5534, :c5535, :c5536, :c5537, :c5538, :c5539, :c5540, :c5541, :c5542, :c5543, :c5544, :c5545, :c5546, :c5547, :c5548, :c5549, :c5550, :c5551, :c5552, :c5553, :c5554, :c5555, :c5556, :c5557, :c5558, :c5559, :c5560, :c5561, :c5562, :c5563, :c5564, :c5565, :c5566, :c5567, :c5568, :c5569, :c5570, :c5571, :c5572, :c5573, :c5574, :c5575, :c5576, :c5577, :c5578, :c5579, :c5580, :c5581, :c5582, :c5583, :c5584, :c5585, :c5586, :c5587, :c5588, :c5589, :c5590, :c5591, :c5592, :c5593, :c5594, :c5595, :c5596, :c5597, :c5598, :c5599, :c5600, :c5601, :c5602, :c5603, :c5604, :c5605, :c5606, :c5607, :c5608, :c5609, :c5610, :c5611, :c5612, :c5613, :c5614, :c5615, :c5616, :c5617, :c5618, :c5619, :c5620, :c5621, :c5622, :c5623, :c5624, :c5625, :c5626, :c5627, :c5628, :c5629, :c5630, :c5631, :c5632, :c5633, :c5634, :c5635, :c5636, :c5637, :c5638, :c5639, :c5640, :c5641, :c5642, :c5643, :c5644, :c5645, :c5646, :c5647, :c5648, :c5649, :c5650, :c5651, :c5652, :c5653, :c5654, :c5655, :c5656, :c5657, :c5658, :c5659, :c5660, :c5661, :c5662, :c5663, :c5664, :c5665, :c5666, :c5667, :c5668, :c5669, :c5670, :c5671, :c5672, :c5673, :c5674, :c5675, :c5676, :c5677, :c5678, :c5679, :c5680, :c5681, :c5682, :c5683, :c5684, :c5685, :c5686, :c5687, :c5688, :c5689, :c5690, :c5691, :c5692, :c5693, :c5694, :c5695, :c5696, :c5697, :c5698, :c5699, :c5700, :c5701, :c5702, :c5703, :c5704, :c5705, :c5706, :c5707, :c5708, :c5709, :c5710, :c5711, :c5712, :c5713, :c5714, :c5715, :c5716, :c5717, :c5718, :c5719, :c5720, :c5721, :c5722, :c5723, :c5724, :c5725, :c5726, :c5727, :c5728, :c5729, :c5730, :c5731, :c5732, :c5733, :c5734, :c5735, :c5736, :c5737, :c5738, :c5739, :c5740, :c5741, :c5742, :c5743, :c5744, :c5745, :c5746, :c5747, :c5748, :c5749, :c5750, :c5751, :c5752, :c5753, :c5754, :c5755, :c5756, :c5757, :c5758, :c5759, :c5760, :c5761, :c5762, :c5763, :c5764, :c5765, :c5766, :c5767, :c5768, :c5769, :c5770, :c5771, :c5772, :c5773, :c5774, :c5775, :c5776, :c5777, :c5778, :c5779, :c5780, :c5781, :c5782, :c5783, :c5784, :c5785, :c5786, :c5787, :c5788, :c5789, :c5790, :c5791, :c5792, :c5793, :c5794, :c5795, :c5796, :c5797, :c5798, :c5799, :c5800, :c5801, :c5802, :c5803, :c5804, :c5805, :c5806, :c5807, :c5808, :c5809, :c5810, :c5811, :c5812, :c5813, :c5814, :c5815, :c5816, :c5817, :c5818, :c5819, :c5820, :c5821, :c5822, :c5823, :c5824, :c5825, :c5826, :c5827, :c5828, :c5829, :c5830, :c5831, :c5832, :c5833, :c5834, :c5835, :c5836, :c5837, :c5838, :c5839, :c5840, :c5841, :c5842, :c5843, :c5844, :c5845, :c5846, :c5847, :c5848, :c5849, :c5850, :c5851, :c5852, :c5853, :c5854, :c5855, :c5856, :c5857, :c5858, :c5859, :c5860, :c5861, :c5862, :c5863, :c5864, :c5865, :c5866, :c5867, :c5868, :c5869, :c5870, :c5871, :c5872, :c5873, :c5874, :c5875, :c5876, :c5877, :c5878, :c5879, :c5880, :c5881, :c5882, :c5883, :c5884, :c5885, :c5886, :c5887, :c5888, :c5889, :c5890, :c5891, :c5892, :c5893, :c5894, :c5895, :c5896, :c5897, :c5898, :c5899, :c5900, :c5901, :c5902, :c5903, :c5904, :c5905, :c5906, :c5907, :c5908, :c5909, :c5910, :c5911, :c5912, :c5913, :c5914, :c5915, :c5916, :c5917, :c5918, :c5919, :c5920, :c5921, :c5922, :c5923, :c5924, :c5925, :c5926, :c5927, :c5928, :c5929, :c5930, :c5931, :c5932, :c5933, :c5934, :c5935, :c5936, :c5937, :c5938, :c5939, :c5940, :c5941, :c5942, :c5943, :c5944, :c5945, :c5946, :c5947, :c5948, :c5949, :c5950, :c5951, :c5952, :c5953, :c5954, :c5955, :c5956, :c5957, :c5958, :c5959, :c5960, :c5961, :c5962, :c5963, :c5964, :c5965, :c5966, :c5967, :c5968, :c5969, :c5970, :c5971, :c5972, :c5973, :c5974, :c5975, :c5976, :c5977, :c5978, :c5979, :c5980, :c5981, :c5982, :c5983, :c5984, :c5985, :c5986, :c5987, :c5988, :c5989, :c5990, :c5991, :c5992, :c5993, :c5994, :c5995, :c5996, :c5997, :c5998, :c5999, :c6000, :c6001, :c6002, :c6003, :c6004, :c6005, :c6006, :c6007, :c6008, :c6009, :c6010, :c6011, :c6012, :c6013, :c6014, :c6015, :c6016, :c6017, :c6018, :c6019, :c6020, :c6021, :c6022, :c6023, :c6024, :c6025, :c6026, :c6027, :c6028, :c6029, :c6030, :c6031, :c6032, :c6033, :c6034, :c6035, :c6036, :c6037, :c6038, :c6039, :c6040, :c6041, :c6042, :c6043, :c6044, :c6045, :c6046, :c6047, :c6048, :c6049, :c6050, :c6051, :c6052, :c6053, :c6054, :c6055, :c6056, :c6057, :c6058, :c6059, :c6060, :c6061, :c6062, :c6063, :c6064, :c6065, :c6066, :c6067, :c6068, :c6069, :c6070, :c6071, :c6072, :c6073, :c6074, :c6075, :c6076, :c6077, :c6078, :c6079, :c6080, :c6081, :c6082, :c6083, :c6084, :c6085, :c6086, :c6087, :c6088, :c6089, :c6090, :c6091, :c6092, :c6093, :c6094, :c6095, :c6096, :c6097, :c6098, :c6099, :c6100, :c6101, :c6102, :c6103, :c6104, :c6105, :c6106, :c6107, :c6108, :c6109, :c6110, :c6111, :c6112, :c6113, :c6114, :c6115, :c6116, :c6117, :c6118, :c6119, :c6120, :c6121, :c6122, :c6123, :c6124, :c6125, :c6126, :c6127, :c6128, :c6129, :c6130, :c6131, :c6132, :c6133, :c6134, :c6135, :c6136, :c6137, :c6138, :c6139, :c6140, :c6141, :c6142, :c6143, :c6144, :c6145, :c6146, :c6147, :c6148, :c6149, :c6150, :c6151, :c6152, :c6153, :c6154, :c6155, :c6156, :c6157, :c6158, :c6159, :c6160, :c6161, :c6162, :c6163, :c6164, :c6165, :c6166, :c6167, :c6168, :c6169, :c6170, :c6171, :c6172, :c6173, :c6174, :c6175, :c6176, :c6177, :c6178, :c6179, :c6180, :c6181, :c6182, :c6183, :c6184, :c6185, :c6186, :c6187, :c6188, :c6189, :c6190, :c6191, :c6192, :c6193, :c6194, :c6195, :c6196, :c6197, :c6198, :c6199, :c6200, :c6201, :c6202, :c6203, :c6204, :c6205, :c6206, :c6207, :c6208, :c6209, :c6210, :c6211, :c6212, :c6213, :c6214, :c6215, :c6216, :c6217, :c6218, :c6219, :c6220, :c6221, :c6222, :c6223, :c6224, :c6225, :c6226, :c6227, :c6228, :c6229, :c6230, :c6231, :c6232, :c6233, :c6234, :c6235, :c6236, :c6237, :c6238, :c6239, :c6240, :c6241, :c6242, :c6243, :c6244, :c6245, :c6246, :c6247, :c6248, :c6249, :c6250, :c6251, :c6252, :c6253, :c6254, :c6255, :c6256, :c6257, :c6258, :c6259, :c6260, :c6261, :c6262, :c6263, :c6264, :c6265, :c6266, :c6267, :c6268, :c6269, :c6270, :c6271, :c6272, :c6273, :c6274, :c6275, :c6276, :c6277, :c6278, :c6279, :c6280, :c6281, :c6282, :c6283, :c6284, :c6285, :c6286, :c6287, :c6288, :c6289, :c6290, :c6291, :c6292, :c6293, :c6294, :c6295, :c6296, :c6297, :c6298, :c6299, :c6300, :c6301, :c6302, :c6303, :c6304, :c6305, :c6306, :c6307, :c6308, :c6309, :c6310, :c6311, :c6312, :c6313, :c6314, :c6315, :c6316, :c6317, :c6318, :c6319, :c6320, :c6321, :c6322, :c6323, :c6324, :c6325, :c6326, :c6327, :c6328, :c6329, :c6330, :c6331, :c6332, :c6333, :c6334, :c6335, :c6336, :c6337, :c6338, :c6339, :c6340, :c6341, :c6342, :c6343, :c6344, :c6345, :c6346, :c6347, :c6348, :c6349, :c6350, :c6351, :c6352, :c6353, :c6354, :c6355, :c6356, :c6357, :c6358, :c6359, :c6360, :c6361, :c6362, :c6363, :c6364, :c6365, :c6366, :c6367, :c6368, :c6369, :c6370, :c6371, :c6372, :c6373, :c6374, :c6375, :c6376, :c6377, :c6378, :c6379, :c6380, :c6381, :c6382, :c6383, :c6384, :c6385, :c6386, :c6387, :c6388, :c6389, :c6390, :c6391, :c6392, :c6393, :c6394, :c6395, :c6396, :c6397, :c6398, :c6399, :c6400, :c6401, :c6402, :c6403, :c6404, :c6405, :c6406, :c6407, :c6408, :c6409, :c6410, :c6411, :c6412, :c6413, :c6414, :c6415, :c6416, :c6417, :c6418, :c6419, :c6420, :c6421, :c6422, :c6423, :c6424, :c6425, :c6426, :c6427, :c6428, :c6429, :c6430, :c6431, :c6432, :c6433, :c6434, :c6435, :c6436, :c6437, :c6438, :c6439, :c6440, :c6441, :c6442, :c6443, :c6444, :c6445, :c6446, :c6447, :c6448, :c6449, :c6450, :c6451, :c6452, :c6453, :c6454, :c6455, :c6456, :c6457, :c6458, :c6459, :c6460, :c6461, :c6462, :c6463, :c6464, :c6465, :c6466, :c6467, :c6468, :c6469, :c6470, :c6471, :c6472, :c6473, :c6474, :c6475, :c6476, :c6477, :c6478, :c6479, :c6480, :c6481, :c6482, :c6483, :c6484, :c6485, :c6486, :c6487, :c6488, :c6489, :c6490, :c6491, :c6492, :c6493, :c6494, :c6495, :c6496, :c6497, :c6498, :c6499, :c6500, :c6501, :c6502, :c6503, :c6504, :c6505, :c6506, :c6507, :c6508, :c6509, :c6510, :c6511, :c6512, :c6513, :c6514, :c6515, :c6516, :c6517, :c6518, :c6519, :c6520, :c6521, :c6522, :c6523, :c6524, :c6525, :c6526, :c6527, :c6528, :c6529, :c6530, :c6531, :c6532, :c6533, :c6534, :c6535, :c6536, :c6537, :c6538, :c6539, :c6540, :c6541, :c6542, :c6543, :c6544, :c6545, :c6546, :c6547, :c6548, :c6549, :c6550, :c6551, :c6552, :c6553, :c6554, :c6555, :c6556, :c6557, :c6558, :c6559, :c6560, :c6561, :c6562, :c6563, :c6564, :c6565, :c6566, :c6567, :c6568, :c6569, :c6570, :c6571, :c6572, :c6573, :c6574, :c6575, :c6576, :c6577, :c6578, :c6579, :c6580, :c6581, :c6582, :c6583, :c6584, :c6585, :c6586, :c6587, :c6588, :c6589, :c6590, :c6591, :c6592, :c6593, :c6594, :c6595, :c6596, :c6597, :c6598, :c6599, :c6600, :c6601, :c6602, :c6603, :c6604, :c6605, :c6606, :c6607, :c6608, :c6609, :c6610, :c6611, :c6612, :c6613, :c6614, :c6615, :c6616, :c6617, :c6618, :c6619, :c6620, :c6621, :c6622, :c6623, :c6624, :c6625, :c6626, :c6627, :c6628, :c6629, :c6630, :c6631, :c6632, :c6633, :c6634, :c6635, :c6636, :c6637, :c6638, :c6639, :c6640, :c6641, :c6642, :c6643, :c6644, :c6645, :c6646, :c6647, :c6648, :c6649, :c6650, :c6651, :c6652, :c6653, :c6654, :c6655, :c6656, :c6657, :c6658, :c6659, :c6660, :c6661, :c6662, :c6663, :c6664, :c6665, :c6666, :c6667, :c6668, :c6669, :c6670, :c6671, :c6672, :c6673, :c6674, :c6675, :c6676, :c6677, :c6678, :c6679, :c6680, :c6681, :c6682, :c6683, :c6684, :c6685, :c6686, :c6687, :c6688, :c6689, :c6690, :c6691, :c6692, :c6693, :c6694, :c6695, :c6696, :c6697, :c6698, :c6699, :c6700, :c6701, :c6702, :c6703, :c6704, :c6705, :c6706, :c6707, :c6708, :c6709, :c6710, :c6711, :c6712, :c6713, :c6714, :c6715, :c6716, :c6717, :c6718, :c6719, :c6720, :c6721, :c6722, :c6723, :c6724, :c6725, :c6726, :c6727, :c6728, :c6729, :c6730, :c6731, :c6732, :c6733, :c6734, :c6735, :c6736, :c6737, :c6738, :c6739, :c6740, :c6741, :c6742, :c6743, :c6744, :c6745, :c6746, :c6747, :c6748, :c6749, :c6750, :c6751, :c6752, :c6753, :c6754, :c6755, :c6756, :c6757, :c6758, :c6759, :c6760, :c6761, :c6762, :c6763, :c6764, :c6765, :c6766, :c6767, :c6768, :c6769, :c6770, :c6771, :c6772, :c6773, :c6774, :c6775, :c6776, :c6777, :c6778, :c6779, :c6780, :c6781, :c6782, :c6783, :c6784, :c6785, :c6786, :c6787, :c6788, :c6789, :c6790, :c6791, :c6792, :c6793, :c6794, :c6795, :c6796, :c6797, :c6798, :c6799, :c6800, :c6801, :c6802, :c6803, :c6804, :c6805, :c6806, :c6807, :c6808, :c6809, :c6810, :c6811, :c6812, :c6813, :c6814, :c6815, :c6816, :c6817, :c6818, :c6819, :c6820, :c6821, :c6822, :c6823, :c6824, :c6825, :c6826, :c6827, :c6828, :c6829, :c6830, :c6831, :c6832, :c6833, :c6834, :c6835, :c6836, :c6837, :c6838, :c6839, :c6840, :c6841, :c6842, :c6843, :c6844, :c6845, :c6846, :c6847, :c6848, :c6849, :c6850, :c6851, :c6852, :c6853, :c6854, :c6855, :c6856, :c6857, :c6858, :c6859, :c6860, :c6861, :c6862, :c6863, :c6864, :c6865, :c6866, :c6867, :c6868, :c6869, :c6870, :c6871, :c6872, :c6873, :c6874, :c6875, :c6876, :c6877, :c6878, :c6879, :c6880, :c6881, :c6882, :c6883, :c6884, :c6885, :c6886, :c6887, :c6888, :c6889, :c6890, :c6891, :c6892, :c6893, :c6894, :c6895, :c6896, :c6897, :c6898, :c6899, :c6900, :c6901, :c6902, :c6903, :c6904, :c6905, :c6906, :c6907, :c6908, :c6909, :c6910, :c6911, :c6912, :c6913, :c6914, :c6915, :c6916, :c6917, :c6918, :c6919, :c6920, :c6921, :c6922, :c6923, :c6924, :c6925, :c6926, :c6927, :c6928, :c6929, :c6930, :c6931, :c6932, :c6933, :c6934, :c6935, :c6936, :c6937, :c6938, :c6939, :c6940, :c6941, :c6942, :c6943, :c6944, :c6945, :c6946, :c6947, :c6948, :c6949, :c6950, :c6951, :c6952, :c6953, :c6954, :c6955, :c6956, :c6957, :c6958, :c6959, :c6960, :c6961, :c6962, :c6963, :c6964, :c6965, :c6966, :c6967, :c6968, :c6969, :c6970, :c6971, :c6972, :c6973, :c6974, :c6975, :c6976, :c6977, :c6978, :c6979, :c6980, :c6981, :c6982, :c6983, :c6984, :c6985, :c6986, :c6987, :c6988, :c6989, :c6990, :c6991, :c6992, :c6993, :c6994, :c6995, :c6996, :c6997, :c6998, :c6999, :c7000, :c7001, :c7002, :c7003, :c7004, :c7005, :c7006, :c7007, :c7008, :c7009, :c7010, :c7011, :c7012, :c7013, :c7014, :c7015, :c7016, :c7017, :c7018, :c7019, :c7020, :c7021, :c7022, :c7023, :c7024, :c7025, :c7026, :c7027, :c7028, :c7029, :c7030, :c7031, :c7032, :c7033, :c7034, :c7035, :c7036, :c7037, :c7038, :c7039, :c7040, :c7041, :c7042, :c7043, :c7044, :c7045, :c7046, :c7047, :c7048, :c7049, :c7050, :c7051, :c7052, :c7053, :c7054, :c7055, :c7056, :c7057, :c7058, :c7059, :c7060, :c7061, :c7062, :c7063, :c7064, :c7065, :c7066, :c7067, :c7068, :c7069, :c7070, :c7071, :c7072, :c7073, :c7074, :c7075, :c7076, :c7077, :c7078, :c7079, :c7080, :c7081, :c7082, :c7083, :c7084, :c7085, :c7086, :c7087, :c7088, :c7089, :c7090, :c7091, :c7092, :c7093, :c7094, :c7095, :c7096, :c7097, :c7098, :c7099, :c7100, :c7101, :c7102, :c7103, :c7104, :c7105, :c7106, :c7107, :c7108, :c7109, :c7110, :c7111, :c7112, :c7113, :c7114, :c7115, :c7116, :c7117, :c7118, :c7119, :c7120, :c7121, :c7122, :c7123, :c7124, :c7125, :c7126, :c7127, :c7128, :c7129, :c7130, :c7131, :c7132, :c7133, :c7134, :c7135, :c7136, :c7137, :c7138, :c7139, :c7140, :c7141, :c7142, :c7143, :c7144, :c7145, :c7146, :c7147, :c7148, :c7149, :c7150, :c7151, :c7152, :c7153, :c7154, :c7155, :c7156, :c7157, :c7158, :c7159, :c7160, :c7161, :c7162, :c7163, :c7164, :c7165, :c7166, :c7167, :c7168, :c7169, :c7170, :c7171, :c7172, :c7173, :c7174, :c7175, :c7176, :c7177, :c7178, :c7179, :c7180, :c7181, :c7182, :c7183, :c7184, :c7185, :c7186, :c7187, :c7188, :c7189, :c7190, :c7191, :c7192, :c7193, :c7194, :c7195, :c7196, :c7197, :c7198, :c7199, :c7200, :c7201, :c7202, :c7203, :c7204, :c7205, :c7206, :c7207, :c7208, :c7209, :c7210, :c7211, :c7212, :c7213, :c7214, :c7215, :c7216, :c7217, :c7218, :c7219, :c7220, :c7221, :c7222, :c7223, :c7224, :c7225, :c7226, :c7227, :c7228, :c7229, :c7230, :c7231, :c7232, :c7233, :c7234, :c7235, :c7236, :c7237, :c7238, :c7239, :c7240, :c7241, :c7242, :c7243, :c7244, :c7245, :c7246, :c7247, :c7248, :c7249, :c7250, :c7251, :c7252, :c7253, :c7254, :c7255, :c7256, :c7257, :c7258, :c7259, :c7260, :c7261, :c7262, :c7263, :c7264, :c7265, :c7266, :c7267, :c7268, :c7269, :c7270, :c7271, :c7272, :c7273, :c7274, :c7275, :c7276, :c7277, :c7278, :c7279, :c7280, :c7281, :c7282, :c7283, :c7284, :c7285, :c7286, :c7287, :c7288, :c7289, :c7290, :c7291, :c7292, :c7293, :c7294, :c7295, :c7296, :c7297, :c7298, :c7299, :c7300, :c7301, :c7302, :c7303, :c7304, :c7305, :c7306, :c7307, :c7308, :c7309, :c7310, :c7311, :c7312, :c7313, :c7314, :c7315, :c7316, :c7317, :c7318, :c7319, :c7320, :c7321, :c7322, :c7323, :c7324, :c7325, :c7326, :c7327, :c7328, :c7329, :c7330, :c7331, :c7332, :c7333, :c7334, :c7335, :c7336, :c7337, :c7338, :c7339, :c7340, :c7341, :c7342, :c7343, :c7344, :c7345, :c7346, :c7347, :c7348, :c7349, :c7350, :c7351, :c7352, :c7353, :c7354, :c7355, :c7356, :c7357, :c7358, :c7359, :c7360, :c7361, :c7362, :c7363, :c7364, :c7365, :c7366, :c7367, :c7368, :c7369, :c7370, :c7371, :c7372, :c7373, :c7374, :c7375, :c7376, :c7377, :c7378, :c7379, :c7380, :c7381, :c7382, :c7383, :c7384, :c7385, :c7386, :c7387, :c7388, :c7389, :c7390, :c7391, :c7392, :c7393, :c7394, :c7395, :c7396, :c7397, :c7398, :c7399, :c7400, :c7401, :c7402, :c7403, :c7404, :c7405, :c7406, :c7407, :c7408, :c7409, :c7410, :c7411, :c7412, :c7413, :c7414, :c7415, :c7416, :c7417, :c7418, :c7419, :c7420, :c7421, :c7422, :c7423, :c7424, :c7425, :c7426, :c7427, :c7428, :c7429, :c7430, :c7431, :c7432, :c7433, :c7434, :c7435, :c7436, :c7437, :c7438, :c7439, :c7440, :c7441, :c7442, :c7443, :c7444, :c7445, :c7446, :c7447, :c7448, :c7449, :c7450, :c7451, :c7452, :c7453, :c7454, :c7455, :c7456, :c7457, :c7458, :c7459, :c7460, :c7461, :c7462, :c7463, :c7464, :c7465, :c7466, :c7467, :c7468, :c7469, :c7470, :c7471, :c7472, :c7473, :c7474, :c7475, :c7476, :c7477, :c7478, :c7479, :c7480, :c7481, :c7482, :c7483, :c7484, :c7485, :c7486, :c7487, :c7488, :c7489, :c7490, :c7491, :c7492, :c7493, :c7494, :c7495, :c7496, :c7497, :c7498, :c7499, :c7500, :c7501, :c7502, :c7503, :c7504, :c7505, :c7506, :c7507, :c7508, :c7509, :c7510, :c7511, :c7512, :c7513, :c7514, :c7515, :c7516, :c7517, :c7518, :c7519, :c7520, :c7521, :c7522, :c7523, :c7524, :c7525, :c7526, :c7527, :c7528, :c7529, :c7530, :c7531, :c7532, :c7533, :c7534, :c7535, :c7536, :c7537, :c7538, :c7539, :c7540, :c7541, :c7542, :c7543, :c7544, :c7545, :c7546, :c7547, :c7548, :c7549, :c7550, :c7551, :c7552, :c7553, :c7554, :c7555, :c7556, :c7557, :c7558, :c7559, :c7560, :c7561, :c7562, :c7563, :c7564, :c7565, :c7566, :c7567, :c7568, :c7569, :c7570, :c7571, :c7572, :c7573, :c7574, :c7575, :c7576, :c7577, :c7578, :c7579, :c7580, :c7581, :c7582, :c7583, :c7584, :c7585, :c7586, :c7587, :c7588, :c7589, :c7590, :c7591, :c7592, :c7593, :c7594, :c7595, :c7596, :c7597, :c7598, :c7599, :c7600, :c7601, :c7602, :c7603, :c7604, :c7605, :c7606, :c7607, :c7608, :c7609, :c7610, :c7611, :c7612, :c7613, :c7614, :c7615, :c7616, :c7617, :c7618, :c7619, :c7620, :c7621, :c7622, :c7623, :c7624, :c7625, :c7626, :c7627, :c7628, :c7629, :c7630, :c7631, :c7632, :c7633, :c7634, :c7635, :c7636, :c7637, :c7638, :c7639, :c7640, :c7641, :c7642, :c7643, :c7644, :c7645, :c7646, :c7647, :c7648, :c7649, :c7650, :c7651, :c7652, :c7653, :c7654, :c7655, :c7656, :c7657, :c7658, :c7659, :c7660, :c7661, :c7662, :c7663, :c7664, :c7665, :c7666, :c7667, :c7668, :c7669, :c7670, :c7671, :c7672, :c7673, :c7674, :c7675, :c7676, :c7677, :c7678, :c7679, :c7680, :c7681, :c7682, :c7683, :c7684, :c7685, :c7686, :c7687, :c7688, :c7689, :c7690, :c7691, :c7692, :c7693, :c7694, :c7695, :c7696, :c7697, :c7698, :c7699, :c7700, :c7701, :c7702, :c7703, :c7704, :c7705, :c7706, :c7707, :c7708, :c7709, :c7710, :c7711, :c7712, :c7713, :c7714, :c7715, :c7716, :c7717, :c7718, :c7719, :c7720, :c7721, :c7722, :c7723, :c7724, :c7725, :c7726, :c7727, :c7728, :c7729, :c7730, :c7731, :c7732, :c7733, :c7734, :c7735, :c7736, :c7737, :c7738, :c7739, :c7740, :c7741, :c7742, :c7743, :c7744, :c7745, :c7746, :c7747, :c7748, :c7749, :c7750, :c7751, :c7752, :c7753, :c7754, :c7755, :c7756, :c7757, :c7758, :c7759, :c7760, :c7761, :c7762, :c7763, :c7764, :c7765, :c7766, :c7767, :c7768, :c7769, :c7770, :c7771, :c7772, :c7773, :c7774, :c7775, :c7776, :c7777, :c7778, :c7779, :c7780, :c7781, :c7782, :c7783, :c7784, :c7785, :c7786, :c7787, :c7788, :c7789, :c7790, :c7791, :c7792, :c7793, :c7794, :c7795, :c7796, :c7797, :c7798, :c7799, :c7800, :c7801, :c7802, :c7803, :c7804, :c7805, :c7806, :c7807, :c7808, :c7809, :c7810, :c7811, :c7812, :c7813, :c7814, :c7815, :c7816, :c7817, :c7818, :c7819, :c7820, :c7821, :c7822, :c7823, :c7824, :c7825, :c7826, :c7827, :c7828, :c7829, :c7830, :c7831, :c7832, :c7833, :c7834, :c7835, :c7836, :c7837, :c7838, :c7839, :c7840, :c7841, :c7842, :c7843, :c7844, :c7845, :c7846, :c7847, :c7848, :c7849, :c7850, :c7851, :c7852, :c7853, :c7854, :c7855, :c7856, :c7857, :c7858, :c7859, :c7860, :c7861, :c7862, :c7863, :c7864, :c7865, :c7866, :c7867, :c7868, :c7869, :c7870, :c7871, :c7872, :c7873, :c7874, :c7875, :c7876, :c7877, :c7878, :c7879, :c7880, :c7881, :c7882, :c7883, :c7884, :c7885, :c7886, :c7887, :c7888, :c7889, :c7890, :c7891, :c7892, :c7893, :c7894, :c7895, :c7896, :c7897, :c7898, :c7899, :c7900, :c7901, :c7902, :c7903, :c7904, :c7905, :c7906, :c7907, :c7908, :c7909, :c7910, :c7911, :c7912, :c7913, :c7914, :c7915, :c7916, :c7917, :c7918, :c7919, :c7920, :c7921, :c7922, :c7923, :c7924, :c7925, :c7926, :c7927, :c7928, :c7929, :c7930, :c7931, :c7932, :c7933, :c7934, :c7935, :c7936, :c7937, :c7938, :c7939, :c7940, :c7941, :c7942, :c7943, :c7944, :c7945, :c7946, :c7947, :c7948, :c7949, :c7950, :c7951, :c7952, :c7953, :c7954, :c7955, :c7956, :c7957, :c7958, :c7959, :c7960, :c7961, :c7962, :c7963, :c7964, :c7965, :c7966, :c7967, :c7968, :c7969, :c7970, :c7971, :c7972, :c7973, :c7974, :c7975, :c7976, :c7977, :c7978, :c7979, :c7980, :c7981, :c7982, :c7983, :c7984, :c7985, :c7986, :c7987, :c7988, :c7989, :c7990, :c7991, :c7992, :c7993, :c7994, :c7995, :c7996, :c7997, :c7998, :c7999, :c8000, :c8001, :c8002, :c8003, :c8004, :c8005, :c8006, :c8007, :c8008, :c8009, :c8010, :c8011, :c8012, :c8013, :c8014, :c8015, :c8016, :c8017, :c8018, :c8019, :c8020, :c8021, :c8022, :c8023, :c8024, :c8025, :c8026, :c8027, :c8028, :c8029, :c8030, :c8031, :c8032, :c8033, :c8034, :c8035, :c8036, :c8037, :c8038, :c8039, :c8040, :c8041, :c8042, :c8043, :c8044, :c8045, :c8046, :c8047, :c8048, :c8049, :c8050, :c8051, :c8052, :c8053, :c8054, :c8055, :c8056, :c8057, :c8058, :c8059, :c8060, :c8061, :c8062, :c8063, :c8064, :c8065, :c8066, :c8067, :c8068, :c8069, :c8070, :c8071, :c8072, :c8073, :c8074, :c8075, :c8076, :c8077, :c8078, :c8079, :c8080, :c8081, :c8082, :c8083, :c8084, :c8085, :c8086, :c8087, :c8088, :c8089, :c8090, :c8091, :c8092, :c8093, :c8094, :c8095, :c8096, :c8097, :c8098, :c8099, :c8100, :c8101, :c8102, :c8103, :c8104, :c8105, :c8106, :c8107, :c8108, :c8109, :c8110, :c8111, :c8112, :c8113, :c8114, :c8115, :c8116, :c8117, :c8118, :c8119, :c8120, :c8121, :c8122, :c8123, :c8124, :c8125, :c8126, :c8127, :c8128, :c8129, :c8130, :c8131, :c8132, :c8133, :c8134, :c8135, :c8136, :c8137, :c8138, :c8139, :c8140, :c8141, :c8142, :c8143, :c8144, :c8145, :c8146, :c8147, :c8148, :c8149, :c8150, :c8151, :c8152, :c8153, :c8154, :c8155, :c8156, :c8157, :c8158, :c8159, :c8160, :c8161, :c8162, :c8163, :c8164, :c8165, :c8166, :c8167, :c8168, :c8169, :c8170, :c8171, :c8172, :c8173, :c8174, :c8175, :c8176, :c8177, :c8178, :c8179, :c8180, :c8181, :c8182, :c8183, :c8184, :c8185, :c8186, :c8187, :c8188, :c8189, :c8190, :c8191, :c8192, :c8193, :c8194, :c8195, :c8196, :c8197, :c8198, :c8199, :c8200, :c8201, :c8202, :c8203, :c8204, :c8205, :c8206, :c8207, :c8208, :c8209, :c8210, :c8211, :c8212, :c8213, :c8214, :c8215, :c8216, :c8217, :c8218, :c8219, :c8220, :c8221, :c8222, :c8223, :c8224, :c8225, :c8226, :c8227, :c8228, :c8229, :c8230, :c8231, :c8232, :c8233, :c8234, :c8235, :c8236, :c8237, :c8238, :c8239, :c8240, :c8241, :c8242, :c8243, :c8244, :c8245, :c8246, :c8247, :c8248, :c8249, :c8250, :c8251, :c8252, :c8253, :c8254, :c8255, :c8256, :c8257, :c8258, :c8259, :c8260, :c8261, :c8262, :c8263, :c8264, :c8265, :c8266, :c8267, :c8268, :c8269, :c8270, :c8271, :c8272, :c8273, :c8274, :c8275, :c8276, :c8277, :c8278, :c8279, :c8280, :c8281, :c8282, :c8283, :c8284, :c8285, :c8286, :c8287, :c8288, :c8289, :c8290, :c8291, :c8292, :c8293, :c8294, :c8295, :c8296, :c8297, :c8298, :c8299, :c8300, :c8301, :c8302, :c8303, :c8304, :c8305, :c8306, :c8307, :c8308, :c8309, :c8310, :c8311, :c8312, :c8313, :c8314, :c8315, :c8316, :c8317, :c8318, :c8319, :c8320, :c8321, :c8322, :c8323, :c8324, :c8325, :c8326, :c8327, :c8328, :c8329, :c8330, :c8331, :c8332, :c8333, :c8334, :c8335, :c8336, :c8337, :c8338, :c8339, :c8340, :c8341, :c8342, :c8343, :c8344, :c8345, :c8346, :c8347, :c8348, :c8349, :c8350, :c8351, :c8352, :c8353, :c8354, :c8355, :c8356, :c8357, :c8358, :c8359, :c8360, :c8361, :c8362, :c8363, :c8364, :c8365, :c8366, :c8367, :c8368, :c8369, :c8370, :c8371, :c8372, :c8373, :c8374, :c8375, :c8376, :c8377, :c8378, :c8379, :c8380, :c8381, :c8382, :c8383, :c8384, :c8385, :c8386, :c8387, :c8388, :c8389, :c8390, :c8391, :c8392, :c8393, :c8394, :c8395, :c8396, :c8397, :c8398, :c8399, :c8400, :c8401, :c8402, :c8403, :c8404, :c8405, :c8406, :c8407, :c8408, :c8409, :c8410, :c8411, :c8412, :c8413, :c8414, :c8415, :c8416, :c8417, :c8418, :c8419, :c8420, :c8421, :c8422, :c8423, :c8424, :c8425, :c8426, :c8427, :c8428, :c8429, :c8430, :c8431, :c8432, :c8433, :c8434, :c8435, :c8436, :c8437, :c8438, :c8439, :c8440, :c8441, :c8442, :c8443, :c8444, :c8445, :c8446, :c8447, :c8448, :c8449, :c8450, :c8451, :c8452, :c8453, :c8454, :c8455, :c8456, :c8457, :c8458, :c8459, :c8460, :c8461, :c8462, :c8463, :c8464, :c8465, :c8466, :c8467, :c8468, :c8469, :c8470, :c8471, :c8472, :c8473, :c8474, :c8475, :c8476, :c8477, :c8478, :c8479, :c8480, :c8481, :c8482, :c8483, :c8484, :c8485, :c8486, :c8487, :c8488, :c8489, :c8490, :c8491, :c8492, :c8493, :c8494, :c8495, :c8496, :c8497, :c8498, :c8499, :c8500, :c8501, :c8502, :c8503, :c8504, :c8505, :c8506, :c8507, :c8508, :c8509, :c8510, :c8511, :c8512, :c8513, :c8514, :c8515, :c8516, :c8517, :c8518, :c8519, :c8520, :c8521, :c8522, :c8523, :c8524, :c8525, :c8526, :c8527, :c8528, :c8529, :c8530, :c8531, :c8532, :c8533, :c8534, :c8535, :c8536, :c8537, :c8538, :c8539, :c8540, :c8541, :c8542, :c8543, :c8544, :c8545, :c8546, :c8547, :c8548, :c8549, :c8550, :c8551, :c8552, :c8553, :c8554, :c8555, :c8556, :c8557, :c8558, :c8559, :c8560, :c8561, :c8562, :c8563, :c8564, :c8565, :c8566, :c8567, :c8568, :c8569, :c8570, :c8571, :c8572, :c8573, :c8574, :c8575, :c8576, :c8577, :c8578, :c8579, :c8580, :c8581, :c8582, :c8583, :c8584, :c8585, :c8586, :c8587, :c8588, :c8589, :c8590, :c8591, :c8592, :c8593, :c8594, :c8595, :c8596, :c8597, :c8598, :c8599, :c8600, :c8601, :c8602, :c8603, :c8604, :c8605, :c8606, :c8607, :c8608, :c8609, :c8610, :c8611, :c8612, :c8613, :c8614, :c8615, :c8616, :c8617, :c8618, :c8619, :c8620, :c8621, :c8622, :c8623, :c8624, :c8625, :c8626, :c8627, :c8628, :c8629, :c8630, :c8631, :c8632, :c8633, :c8634, :c8635, :c8636, :c8637, :c8638, :c8639, :c8640, :c8641, :c8642, :c8643, :c8644, :c8645, :c8646, :c8647, :c8648, :c8649, :c8650, :c8651, :c8652, :c8653, :c8654, :c8655, :c8656, :c8657, :c8658, :c8659, :c8660, :c8661, :c8662, :c8663, :c8664, :c8665, :c8666, :c8667, :c8668, :c8669, :c8670, :c8671, :c8672, :c8673, :c8674, :c8675, :c8676, :c8677, :c8678, :c8679, :c8680, :c8681, :c8682, :c8683, :c8684, :c8685, :c8686, :c8687, :c8688, :c8689, :c8690, :c8691, :c8692, :c8693, :c8694, :c8695, :c8696, :c8697, :c8698, :c8699, :c8700, :c8701, :c8702, :c8703, :c8704, :c8705, :c8706, :c8707, :c8708, :c8709, :c8710, :c8711, :c8712, :c8713, :c8714, :c8715, :c8716, :c8717, :c8718, :c8719, :c8720, :c8721, :c8722, :c8723, :c8724, :c8725, :c8726, :c8727, :c8728, :c8729, :c8730, :c8731, :c8732, :c8733, :c8734, :c8735, :c8736, :c8737, :c8738, :c8739, :c8740, :c8741, :c8742, :c8743, :c8744, :c8745, :c8746, :c8747, :c8748, :c8749, :c8750, :c8751, :c8752, :c8753, :c8754, :c8755, :c8756, :c8757, :c8758, :c8759, :c8760, :c8761, :c8762, :c8763, :c8764, :c8765, :c8766, :c8767, :c8768, :c8769, :c8770, :c8771, :c8772, :c8773, :c8774, :c8775, :c8776, :c8777, :c8778, :c8779, :c8780, :c8781, :c8782, :c8783, :c8784, :c8785, :c8786, :c8787, :c8788, :c8789, :c8790, :c8791, :c8792, :c8793, :c8794, :c8795, :c8796, :c8797, :c8798, :c8799, :c8800, :c8801, :c8802, :c8803, :c8804, :c8805, :c8806, :c8807, :c8808, :c8809, :c8810, :c8811, :c8812, :c8813, :c8814, :c8815, :c8816, :c8817, :c8818, :c8819, :c8820, :c8821, :c8822, :c8823, :c8824, :c8825, :c8826, :c8827, :c8828, :c8829, :c8830, :c8831, :c8832, :c8833, :c8834, :c8835, :c8836, :c8837, :c8838, :c8839, :c8840, :c8841, :c8842, :c8843, :c8844, :c8845, :c8846, :c8847, :c8848, :c8849, :c8850, :c8851, :c8852, :c8853, :c8854, :c8855, :c8856, :c8857, :c8858, :c8859, :c8860, :c8861, :c8862, :c8863, :c8864, :c8865, :c8866, :c8867, :c8868, :c8869, :c8870, :c8871, :c8872, :c8873, :c8874, :c8875, :c8876, :c8877, :c8878, :c8879, :c8880, :c8881, :c8882, :c8883, :c8884, :c8885, :c8886, :c8887, :c8888, :c8889, :c8890, :c8891, :c8892, :c8893, :c8894, :c8895, :c8896, :c8897, :c8898, :c8899, :c8900, :c8901, :c8902, :c8903, :c8904, :c8905, :c8906, :c8907, :c8908, :c8909, :c8910, :c8911, :c8912, :c8913, :c8914, :c8915, :c8916, :c8917, :c8918, :c8919, :c8920, :c8921, :c8922, :c8923, :c8924, :c8925, :c8926, :c8927, :c8928, :c8929, :c8930, :c8931, :c8932, :c8933, :c8934, :c8935, :c8936, :c8937, :c8938, :c8939, :c8940, :c8941, :c8942, :c8943, :c8944, :c8945, :c8946, :c8947, :c8948, :c8949, :c8950, :c8951, :c8952, :c8953, :c8954, :c8955, :c8956, :c8957, :c8958, :c8959, :c8960, :c8961, :c8962, :c8963, :c8964, :c8965, :c8966, :c8967, :c8968, :c8969, :c8970, :c8971, :c8972, :c8973, :c8974, :c8975, :c8976, :c8977, :c8978, :c8979, :c8980, :c8981, :c8982, :c8983, :c8984, :c8985, :c8986, :c8987, :c8988, :c8989, :c8990, :c8991, :c8992, :c8993, :c8994, :c8995, :c8996, :c8997, :c8998, :c8999, :c9000, :c9001, :c9002, :c9003, :c9004, :c9005, :c9006, :c9007, :c9008, :c9009, :c9010, :c9011, :c9012, :c9013, :c9014, :c9015, :c9016, :c9017, :c9018, :c9019, :c9020, :c9021, :c9022, :c9023, :c9024, :c9025, :c9026, :c9027, :c9028, :c9029, :c9030, :c9031, :c9032, :c9033, :c9034, :c9035, :c9036, :c9037, :c9038, :c9039, :c9040, :c9041, :c9042, :c9043, :c9044, :c9045, :c9046, :c9047, :c9048, :c9049, :c9050, :c9051, :c9052, :c9053, :c9054, :c9055, :c9056, :c9057, :c9058, :c9059, :c9060, :c9061, :c9062, :c9063, :c9064, :c9065, :c9066, :c9067, :c9068, :c9069, :c9070, :c9071, :c9072, :c9073, :c9074, :c9075, :c9076, :c9077, :c9078, :c9079, :c9080, :c9081, :c9082, :c9083, :c9084, :c9085, :c9086, :c9087, :c9088, :c9089, :c9090, :c9091, :c9092, :c9093, :c9094, :c9095, :c9096, :c9097, :c9098, :c9099, :c9100, :c9101, :c9102, :c9103, :c9104, :c9105, :c9106, :c9107, :c9108, :c9109, :c9110, :c9111, :c9112, :c9113, :c9114, :c9115, :c9116, :c9117, :c9118, :c9119, :c9120, :c9121, :c9122, :c9123, :c9124, :c9125, :c9126, :c9127, :c9128, :c9129, :c9130, :c9131, :c9132, :c9133, :c9134, :c9135, :c9136, :c9137, :c9138, :c9139, :c9140, :c9141, :c9142, :c9143, :c9144, :c9145, :c9146, :c9147, :c9148, :c9149, :c9150, :c9151, :c9152, :c9153, :c9154, :c9155, :c9156, :c9157, :c9158, :c9159, :c9160, :c9161, :c9162, :c9163, :c9164, :c9165, :c9166, :c9167, :c9168, :c9169, :c9170, :c9171, :c9172, :c9173, :c9174, :c9175, :c9176, :c9177, :c9178, :c9179, :c9180, :c9181, :c9182, :c9183, :c9184, :c9185, :c9186, :c9187, :c9188, :c9189, :c9190, :c9191, :c9192, :c9193, :c9194, :c9195, :c9196, :c9197, :c9198, :c9199, :c9200, :c9201, :c9202, :c9203, :c9204, :c9205, :c9206, :c9207, :c9208, :c9209, :c9210, :c9211, :c9212, :c9213, :c9214, :c9215, :c9216, :c9217, :c9218, :c9219, :c9220, :c9221, :c9222, :c9223, :c9224, :c9225, :c9226, :c9227, :c9228, :c9229, :c9230, :c9231, :c9232, :c9233, :c9234, :c9235, :c9236, :c9237, :c9238, :c9239, :c9240, :c9241, :c9242, :c9243, :c9244, :c9245, :c9246, :c9247, :c9248, :c9249, :c9250, :c9251, :c9252, :c9253, :c9254, :c9255, :c9256, :c9257, :c9258, :c9259, :c9260, :c9261, :c9262, :c9263, :c9264, :c9265, :c9266, :c9267, :c9268, :c9269, :c9270, :c9271, :c9272, :c9273, :c9274, :c9275, :c9276, :c9277, :c9278, :c9279, :c9280, :c9281, :c9282, :c9283, :c9284, :c9285, :c9286, :c9287, :c9288, :c9289, :c9290, :c9291, :c9292, :c9293, :c9294, :c9295, :c9296, :c9297, :c9298, :c9299, :c9300, :c9301, :c9302, :c9303, :c9304, :c9305, :c9306, :c9307, :c9308, :c9309, :c9310, :c9311, :c9312, :c9313, :c9314, :c9315, :c9316, :c9317, :c9318, :c9319, :c9320, :c9321, :c9322, :c9323, :c9324, :c9325, :c9326, :c9327, :c9328, :c9329, :c9330, :c9331, :c9332, :c9333, :c9334, :c9335, :c9336, :c9337, :c9338, :c9339, :c9340, :c9341, :c9342, :c9343, :c9344, :c9345, :c9346, :c9347, :c9348, :c9349, :c9350, :c9351, :c9352, :c9353, :c9354, :c9355, :c9356, :c9357, :c9358, :c9359, :c9360, :c9361, :c9362, :c9363, :c9364, :c9365, :c9366, :c9367, :c9368, :c9369, :c9370, :c9371, :c9372, :c9373, :c9374, :c9375, :c9376, :c9377, :c9378, :c9379, :c9380, :c9381, :c9382, :c9383, :c9384, :c9385, :c9386, :c9387, :c9388, :c9389, :c9390, :c9391, :c9392, :c9393, :c9394, :c9395, :c9396, :c9397, :c9398, :c9399, :c9400, :c9401, :c9402, :c9403, :c9404, :c9405, :c9406, :c9407, :c9408, :c9409, :c9410, :c9411, :c9412, :c9413, :c9414, :c9415, :c9416, :c9417, :c9418, :c9419, :c9420, :c9421, :c9422, :c9423, :c9424, :c9425, :c9426, :c9427, :c9428, :c9429, :c9430, :c9431, :c9432, :c9433, :c9434, :c9435, :c9436, :c9437, :c9438, :c9439, :c9440, :c9441, :c9442, :c9443, :c9444, :c9445, :c9446, :c9447, :c9448, :c9449, :c9450, :c9451, :c9452, :c9453, :c9454, :c9455, :c9456, :c9457, :c9458, :c9459, :c9460, :c9461, :c9462, :c9463, :c9464, :c9465, :c9466, :c9467, :c9468, :c9469, :c9470, :c9471, :c9472, :c9473, :c9474, :c9475, :c9476, :c9477, :c9478, :c9479, :c9480, :c9481, :c9482, :c9483, :c9484, :c9485, :c9486, :c9487, :c9488, :c9489, :c9490, :c9491, :c9492, :c9493, :c9494, :c9495, :c9496, :c9497, :c9498, :c9499, :c9500, :c9501, :c9502, :c9503, :c9504, :c9505, :c9506, :c9507, :c9508, :c9509, :c9510, :c9511, :c9512, :c9513, :c9514, :c9515, :c9516, :c9517, :c9518, :c9519, :c9520, :c9521, :c9522, :c9523, :c9524, :c9525, :c9526, :c9527, :c9528, :c9529, :c9530, :c9531, :c9532, :c9533, :c9534, :c9535, :c9536, :c9537, :c9538, :c9539, :c9540, :c9541, :c9542, :c9543, :c9544, :c9545, :c9546, :c9547, :c9548, :c9549, :c9550, :c9551, :c9552, :c9553, :c9554, :c9555, :c9556, :c9557, :c9558, :c9559, :c9560, :c9561, :c9562, :c9563, :c9564, :c9565, :c9566, :c9567, :c9568, :c9569, :c9570, :c9571, :c9572, :c9573, :c9574, :c9575, :c9576, :c9577, :c9578, :c9579, :c9580, :c9581, :c9582, :c9583, :c9584, :c9585, :c9586, :c9587, :c9588, :c9589, :c9590, :c9591, :c9592, :c9593, :c9594, :c9595, :c9596, :c9597, :c9598, :c9599, :c9600, :c9601, :c9602, :c9603, :c9604, :c9605, :c9606, :c9607, :c9608, :c9609, :c9610, :c9611, :c9612, :c9613, :c9614, :c9615, :c9616, :c9617, :c9618, :c9619, :c9620, :c9621, :c9622, :c9623, :c9624, :c9625, :c9626, :c9627, :c9628, :c9629, :c9630, :c9631, :c9632, :c9633, :c9634, :c9635, :c9636, :c9637, :c9638, :c9639, :c9640, :c9641, :c9642, :c9643, :c9644, :c9645, :c9646, :c9647, :c9648, :c9649, :c9650, :c9651, :c9652, :c9653, :c9654, :c9655, :c9656, :c9657, :c9658, :c9659, :c9660, :c9661, :c9662, :c9663, :c9664, :c9665, :c9666, :c9667, :c9668, :c9669, :c9670, :c9671, :c9672, :c9673, :c9674, :c9675, :c9676, :c9677, :c9678, :c9679, :c9680, :c9681, :c9682, :c9683, :c9684, :c9685, :c9686, :c9687, :c9688, :c9689, :c9690, :c9691, :c9692, :c9693, :c9694, :c9695, :c9696, :c9697, :c9698, :c9699, :c9700, :c9701, :c9702, :c9703, :c9704, :c9705, :c9706, :c9707, :c9708, :c9709, :c9710, :c9711, :c9712, :c9713, :c9714, :c9715, :c9716, :c9717, :c9718, :c9719, :c9720, :c9721, :c9722, :c9723, :c9724, :c9725, :c9726, :c9727, :c9728, :c9729, :c9730, :c9731, :c9732, :c9733, :c9734, :c9735, :c9736, :c9737, :c9738, :c9739, :c9740, :c9741, :c9742, :c9743, :c9744, :c9745, :c9746, :c9747, :c9748, :c9749, :c9750, :c9751, :c9752, :c9753, :c9754, :c9755, :c9756, :c9757, :c9758, :c9759, :c9760, :c9761, :c9762, :c9763, :c9764, :c9765, :c9766, :c9767, :c9768, :c9769, :c9770, :c9771, :c9772, :c9773, :c9774, :c9775, :c9776, :c9777, :c9778, :c9779, :c9780, :c9781, :c9782, :c9783, :c9784, :c9785, :c9786, :c9787, :c9788, :c9789, :c9790, :c9791, :c9792, :c9793, :c9794, :c9795, :c9796, :c9797, :c9798, :c9799, :c9800, :c9801, :c9802, :c9803, :c9804, :c9805, :c9806, :c9807, :c9808, :c9809, :c9810, :c9811, :c9812, :c9813, :c9814, :c9815, :c9816, :c9817, :c9818, :c9819, :c9820, :c9821, :c9822, :c9823, :c9824, :c9825, :c9826, :c9827, :c9828, :c9829, :c9830, :c9831, :c9832, :c9833, :c9834, :c9835, :c9836, :c9837, :c9838, :c9839, :c9840, :c9841, :c9842, :c9843, :c9844, :c9845, :c9846, :c9847, :c9848, :c9849, :c9850, :c9851, :c9852, :c9853, :c9854, :c9855, :c9856, :c9857, :c9858, :c9859, :c9860, :c9861, :c9862, :c9863, :c9864, :c9865, :c9866, :c9867, :c9868, :c9869, :c9870, :c9871, :c9872, :c9873, :c9874, :c9875, :c9876, :c9877, :c9878, :c9879, :c9880, :c9881, :c9882, :c9883, :c9884, :c9885, :c9886, :c9887, :c9888, :c9889, :c9890, :c9891, :c9892, :c9893, :c9894, :c9895, :c9896, :c9897, :c9898, :c9899, :c9900, :c9901, :c9902, :c9903, :c9904, :c9905, :c9906, :c9907, :c9908, :c9909, :c9910, :c9911, :c9912, :c9913, :c9914, :c9915, :c9916, :c9917, :c9918, :c9919, :c9920, :c9921, :c9922, :c9923, :c9924, :c9925, :c9926, :c9927, :c9928, :c9929, :c9930, :c9931, :c9932, :c9933, :c9934, :c9935, :c9936, :c9937, :c9938, :c9939, :c9940, :c9941, :c9942, :c9943, :c9944, :c9945, :c9946, :c9947, :c9948, :c9949, :c9950, :c9951, :c9952, :c9953, :c9954, :c9955, :c9956, :c9957, :c9958, :c9959, :c9960, :c9961, :c9962, :c9963, :c9964, :c9965, :c9966, :c9967, :c9968, :c9969, :c9970, :c9971, :c9972, :c9973, :c9974, :c9975, :c9976, :c9977, :c9978, :c9979, :c9980, :c9981, :c9982, :c9983, :c9984, :c9985, :c9986, :c9987, :c9988, :c9989, :c9990, :c9991, :c9992, :c9993, :c9994, :c9995, :c9996, :c9997, :c9998, :c9999, :c10000 . diff --git a/packages/semweb/Tests/Turtle/test-16.out b/packages/semweb/Tests/Turtle/test-16.out deleted file mode 100644 index c0604b3b6..000000000 --- a/packages/semweb/Tests/Turtle/test-16.out +++ /dev/null @@ -1,10000 +0,0 @@ - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . - . diff --git a/packages/semweb/Tests/Turtle/test-16.ttl b/packages/semweb/Tests/Turtle/test-16.ttl deleted file mode 100644 index a9ac37fb3..000000000 --- a/packages/semweb/Tests/Turtle/test-16.ttl +++ /dev/null @@ -1,10002 +0,0 @@ -# 10000 items (10000 triples) more than the default Bison stack size -@prefix : . -:a :b :c1; - :b :c2; - :b :c3; - :b :c4; - :b :c5; - :b :c6; - :b :c7; - :b :c8; - :b :c9; - :b :c10; - :b :c11; - :b :c12; - :b :c13; - :b :c14; - :b :c15; - :b :c16; - :b :c17; - :b :c18; - :b :c19; - :b :c20; - :b :c21; - :b :c22; - :b :c23; - :b :c24; - :b :c25; - :b :c26; - :b :c27; - :b :c28; - :b :c29; - :b :c30; - :b :c31; - :b :c32; - :b :c33; - :b :c34; - :b :c35; - :b :c36; - :b :c37; - :b :c38; - :b :c39; - :b :c40; - :b :c41; - :b :c42; - :b :c43; - :b :c44; - :b :c45; - :b :c46; - :b :c47; - :b :c48; - :b :c49; - :b :c50; - :b :c51; - :b :c52; - :b :c53; - :b :c54; - :b :c55; - :b :c56; - :b :c57; - :b :c58; - :b :c59; - :b :c60; - :b :c61; - :b :c62; - :b :c63; - :b :c64; - :b :c65; - :b :c66; - :b :c67; - :b :c68; - :b :c69; - :b :c70; - :b :c71; - :b :c72; - :b :c73; - :b :c74; - :b :c75; - :b :c76; - :b :c77; - :b :c78; - :b :c79; - :b :c80; - :b :c81; - :b :c82; - :b :c83; - :b :c84; - :b :c85; - :b :c86; - :b :c87; - :b :c88; - :b :c89; - :b :c90; - :b :c91; - :b :c92; - :b :c93; - :b :c94; - :b :c95; - :b :c96; - :b :c97; - :b :c98; - :b :c99; - :b :c100; - :b :c101; - :b :c102; - :b :c103; - :b :c104; - :b :c105; - :b :c106; - :b :c107; - :b :c108; - :b :c109; - :b :c110; - :b :c111; - :b :c112; - :b :c113; - :b :c114; - :b :c115; - :b :c116; - :b :c117; - :b :c118; - :b :c119; - :b :c120; - :b :c121; - :b :c122; - :b :c123; - :b :c124; - :b :c125; - :b :c126; - :b :c127; - :b :c128; - :b :c129; - :b :c130; - :b :c131; - :b :c132; - :b :c133; - :b :c134; - :b :c135; - :b :c136; - :b :c137; - :b :c138; - :b :c139; - :b :c140; - :b :c141; - :b :c142; - :b :c143; - :b :c144; - :b :c145; - :b :c146; - :b :c147; - :b :c148; - :b :c149; - :b :c150; - :b :c151; - :b :c152; - :b :c153; - :b :c154; - :b :c155; - :b :c156; - :b :c157; - :b :c158; - :b :c159; - :b :c160; - :b :c161; - :b :c162; - :b :c163; - :b :c164; - :b :c165; - :b :c166; - :b :c167; - :b :c168; - :b :c169; - :b :c170; - :b :c171; - :b :c172; - :b :c173; - :b :c174; - :b :c175; - :b :c176; - :b :c177; - :b :c178; - :b :c179; - :b :c180; - :b :c181; - :b :c182; - :b :c183; - :b :c184; - :b :c185; - :b :c186; - :b :c187; - :b :c188; - :b :c189; - :b :c190; - :b :c191; - :b :c192; - :b :c193; - :b :c194; - :b :c195; - :b :c196; - :b :c197; - :b :c198; - :b :c199; - :b :c200; - :b :c201; - :b :c202; - :b :c203; - :b :c204; - :b :c205; - :b :c206; - :b :c207; - :b :c208; - :b :c209; - :b :c210; - :b :c211; - :b :c212; - :b :c213; - :b :c214; - :b :c215; - :b :c216; - :b :c217; - :b :c218; - :b :c219; - :b :c220; - :b :c221; - :b :c222; - :b :c223; - :b :c224; - :b :c225; - :b :c226; - :b :c227; - :b :c228; - :b :c229; - :b :c230; - :b :c231; - :b :c232; - :b :c233; - :b :c234; - :b :c235; - :b :c236; - :b :c237; - :b :c238; - :b :c239; - :b :c240; - :b :c241; - :b :c242; - :b :c243; - :b :c244; - :b :c245; - :b :c246; - :b :c247; - :b :c248; - :b :c249; - :b :c250; - :b :c251; - :b :c252; - :b :c253; - :b :c254; - :b :c255; - :b :c256; - :b :c257; - :b :c258; - :b :c259; - :b :c260; - :b :c261; - :b :c262; - :b :c263; - :b :c264; - :b :c265; - :b :c266; - :b :c267; - :b :c268; - :b :c269; - :b :c270; - :b :c271; - :b :c272; - :b :c273; - :b :c274; - :b :c275; - :b :c276; - :b :c277; - :b :c278; - :b :c279; - :b :c280; - :b :c281; - :b :c282; - :b :c283; - :b :c284; - :b :c285; - :b :c286; - :b :c287; - :b :c288; - :b :c289; - :b :c290; - :b :c291; - :b :c292; - :b :c293; - :b :c294; - :b :c295; - :b :c296; - :b :c297; - :b :c298; - :b :c299; - :b :c300; - :b :c301; - :b :c302; - :b :c303; - :b :c304; - :b :c305; - :b :c306; - :b :c307; - :b :c308; - :b :c309; - :b :c310; - :b :c311; - :b :c312; - :b :c313; - :b :c314; - :b :c315; - :b :c316; - :b :c317; - :b :c318; - :b :c319; - :b :c320; - :b :c321; - :b :c322; - :b :c323; - :b :c324; - :b :c325; - :b :c326; - :b :c327; - :b :c328; - :b :c329; - :b :c330; - :b :c331; - :b :c332; - :b :c333; - :b :c334; - :b :c335; - :b :c336; - :b :c337; - :b :c338; - :b :c339; - :b :c340; - :b :c341; - :b :c342; - :b :c343; - :b :c344; - :b :c345; - :b :c346; - :b :c347; - :b :c348; - :b :c349; - :b :c350; - :b :c351; - :b :c352; - :b :c353; - :b :c354; - :b :c355; - :b :c356; - :b :c357; - :b :c358; - :b :c359; - :b :c360; - :b :c361; - :b :c362; - :b :c363; - :b :c364; - :b :c365; - :b :c366; - :b :c367; - :b :c368; - :b :c369; - :b :c370; - :b :c371; - :b :c372; - :b :c373; - :b :c374; - :b :c375; - :b :c376; - :b :c377; - :b :c378; - :b :c379; - :b :c380; - :b :c381; - :b :c382; - :b :c383; - :b :c384; - :b :c385; - :b :c386; - :b :c387; - :b :c388; - :b :c389; - :b :c390; - :b :c391; - :b :c392; - :b :c393; - :b :c394; - :b :c395; - :b :c396; - :b :c397; - :b :c398; - :b :c399; - :b :c400; - :b :c401; - :b :c402; - :b :c403; - :b :c404; - :b :c405; - :b :c406; - :b :c407; - :b :c408; - :b :c409; - :b :c410; - :b :c411; - :b :c412; - :b :c413; - :b :c414; - :b :c415; - :b :c416; - :b :c417; - :b :c418; - :b :c419; - :b :c420; - :b :c421; - :b :c422; - :b :c423; - :b :c424; - :b :c425; - :b :c426; - :b :c427; - :b :c428; - :b :c429; - :b :c430; - :b :c431; - :b :c432; - :b :c433; - :b :c434; - :b :c435; - :b :c436; - :b :c437; - :b :c438; - :b :c439; - :b :c440; - :b :c441; - :b :c442; - :b :c443; - :b :c444; - :b :c445; - :b :c446; - :b :c447; - :b :c448; - :b :c449; - :b :c450; - :b :c451; - :b :c452; - :b :c453; - :b :c454; - :b :c455; - :b :c456; - :b :c457; - :b :c458; - :b :c459; - :b :c460; - :b :c461; - :b :c462; - :b :c463; - :b :c464; - :b :c465; - :b :c466; - :b :c467; - :b :c468; - :b :c469; - :b :c470; - :b :c471; - :b :c472; - :b :c473; - :b :c474; - :b :c475; - :b :c476; - :b :c477; - :b :c478; - :b :c479; - :b :c480; - :b :c481; - :b :c482; - :b :c483; - :b :c484; - :b :c485; - :b :c486; - :b :c487; - :b :c488; - :b :c489; - :b :c490; - :b :c491; - :b :c492; - :b :c493; - :b :c494; - :b :c495; - :b :c496; - :b :c497; - :b :c498; - :b :c499; - :b :c500; - :b :c501; - :b :c502; - :b :c503; - :b :c504; - :b :c505; - :b :c506; - :b :c507; - :b :c508; - :b :c509; - :b :c510; - :b :c511; - :b :c512; - :b :c513; - :b :c514; - :b :c515; - :b :c516; - :b :c517; - :b :c518; - :b :c519; - :b :c520; - :b :c521; - :b :c522; - :b :c523; - :b :c524; - :b :c525; - :b :c526; - :b :c527; - :b :c528; - :b :c529; - :b :c530; - :b :c531; - :b :c532; - :b :c533; - :b :c534; - :b :c535; - :b :c536; - :b :c537; - :b :c538; - :b :c539; - :b :c540; - :b :c541; - :b :c542; - :b :c543; - :b :c544; - :b :c545; - :b :c546; - :b :c547; - :b :c548; - :b :c549; - :b :c550; - :b :c551; - :b :c552; - :b :c553; - :b :c554; - :b :c555; - :b :c556; - :b :c557; - :b :c558; - :b :c559; - :b :c560; - :b :c561; - :b :c562; - :b :c563; - :b :c564; - :b :c565; - :b :c566; - :b :c567; - :b :c568; - :b :c569; - :b :c570; - :b :c571; - :b :c572; - :b :c573; - :b :c574; - :b :c575; - :b :c576; - :b :c577; - :b :c578; - :b :c579; - :b :c580; - :b :c581; - :b :c582; - :b :c583; - :b :c584; - :b :c585; - :b :c586; - :b :c587; - :b :c588; - :b :c589; - :b :c590; - :b :c591; - :b :c592; - :b :c593; - :b :c594; - :b :c595; - :b :c596; - :b :c597; - :b :c598; - :b :c599; - :b :c600; - :b :c601; - :b :c602; - :b :c603; - :b :c604; - :b :c605; - :b :c606; - :b :c607; - :b :c608; - :b :c609; - :b :c610; - :b :c611; - :b :c612; - :b :c613; - :b :c614; - :b :c615; - :b :c616; - :b :c617; - :b :c618; - :b :c619; - :b :c620; - :b :c621; - :b :c622; - :b :c623; - :b :c624; - :b :c625; - :b :c626; - :b :c627; - :b :c628; - :b :c629; - :b :c630; - :b :c631; - :b :c632; - :b :c633; - :b :c634; - :b :c635; - :b :c636; - :b :c637; - :b :c638; - :b :c639; - :b :c640; - :b :c641; - :b :c642; - :b :c643; - :b :c644; - :b :c645; - :b :c646; - :b :c647; - :b :c648; - :b :c649; - :b :c650; - :b :c651; - :b :c652; - :b :c653; - :b :c654; - :b :c655; - :b :c656; - :b :c657; - :b :c658; - :b :c659; - :b :c660; - :b :c661; - :b :c662; - :b :c663; - :b :c664; - :b :c665; - :b :c666; - :b :c667; - :b :c668; - :b :c669; - :b :c670; - :b :c671; - :b :c672; - :b :c673; - :b :c674; - :b :c675; - :b :c676; - :b :c677; - :b :c678; - :b :c679; - :b :c680; - :b :c681; - :b :c682; - :b :c683; - :b :c684; - :b :c685; - :b :c686; - :b :c687; - :b :c688; - :b :c689; - :b :c690; - :b :c691; - :b :c692; - :b :c693; - :b :c694; - :b :c695; - :b :c696; - :b :c697; - :b :c698; - :b :c699; - :b :c700; - :b :c701; - :b :c702; - :b :c703; - :b :c704; - :b :c705; - :b :c706; - :b :c707; - :b :c708; - :b :c709; - :b :c710; - :b :c711; - :b :c712; - :b :c713; - :b :c714; - :b :c715; - :b :c716; - :b :c717; - :b :c718; - :b :c719; - :b :c720; - :b :c721; - :b :c722; - :b :c723; - :b :c724; - :b :c725; - :b :c726; - :b :c727; - :b :c728; - :b :c729; - :b :c730; - :b :c731; - :b :c732; - :b :c733; - :b :c734; - :b :c735; - :b :c736; - :b :c737; - :b :c738; - :b :c739; - :b :c740; - :b :c741; - :b :c742; - :b :c743; - :b :c744; - :b :c745; - :b :c746; - :b :c747; - :b :c748; - :b :c749; - :b :c750; - :b :c751; - :b :c752; - :b :c753; - :b :c754; - :b :c755; - :b :c756; - :b :c757; - :b :c758; - :b :c759; - :b :c760; - :b :c761; - :b :c762; - :b :c763; - :b :c764; - :b :c765; - :b :c766; - :b :c767; - :b :c768; - :b :c769; - :b :c770; - :b :c771; - :b :c772; - :b :c773; - :b :c774; - :b :c775; - :b :c776; - :b :c777; - :b :c778; - :b :c779; - :b :c780; - :b :c781; - :b :c782; - :b :c783; - :b :c784; - :b :c785; - :b :c786; - :b :c787; - :b :c788; - :b :c789; - :b :c790; - :b :c791; - :b :c792; - :b :c793; - :b :c794; - :b :c795; - :b :c796; - :b :c797; - :b :c798; - :b :c799; - :b :c800; - :b :c801; - :b :c802; - :b :c803; - :b :c804; - :b :c805; - :b :c806; - :b :c807; - :b :c808; - :b :c809; - :b :c810; - :b :c811; - :b :c812; - :b :c813; - :b :c814; - :b :c815; - :b :c816; - :b :c817; - :b :c818; - :b :c819; - :b :c820; - :b :c821; - :b :c822; - :b :c823; - :b :c824; - :b :c825; - :b :c826; - :b :c827; - :b :c828; - :b :c829; - :b :c830; - :b :c831; - :b :c832; - :b :c833; - :b :c834; - :b :c835; - :b :c836; - :b :c837; - :b :c838; - :b :c839; - :b :c840; - :b :c841; - :b :c842; - :b :c843; - :b :c844; - :b :c845; - :b :c846; - :b :c847; - :b :c848; - :b :c849; - :b :c850; - :b :c851; - :b :c852; - :b :c853; - :b :c854; - :b :c855; - :b :c856; - :b :c857; - :b :c858; - :b :c859; - :b :c860; - :b :c861; - :b :c862; - :b :c863; - :b :c864; - :b :c865; - :b :c866; - :b :c867; - :b :c868; - :b :c869; - :b :c870; - :b :c871; - :b :c872; - :b :c873; - :b :c874; - :b :c875; - :b :c876; - :b :c877; - :b :c878; - :b :c879; - :b :c880; - :b :c881; - :b :c882; - :b :c883; - :b :c884; - :b :c885; - :b :c886; - :b :c887; - :b :c888; - :b :c889; - :b :c890; - :b :c891; - :b :c892; - :b :c893; - :b :c894; - :b :c895; - :b :c896; - :b :c897; - :b :c898; - :b :c899; - :b :c900; - :b :c901; - :b :c902; - :b :c903; - :b :c904; - :b :c905; - :b :c906; - :b :c907; - :b :c908; - :b :c909; - :b :c910; - :b :c911; - :b :c912; - :b :c913; - :b :c914; - :b :c915; - :b :c916; - :b :c917; - :b :c918; - :b :c919; - :b :c920; - :b :c921; - :b :c922; - :b :c923; - :b :c924; - :b :c925; - :b :c926; - :b :c927; - :b :c928; - :b :c929; - :b :c930; - :b :c931; - :b :c932; - :b :c933; - :b :c934; - :b :c935; - :b :c936; - :b :c937; - :b :c938; - :b :c939; - :b :c940; - :b :c941; - :b :c942; - :b :c943; - :b :c944; - :b :c945; - :b :c946; - :b :c947; - :b :c948; - :b :c949; - :b :c950; - :b :c951; - :b :c952; - :b :c953; - :b :c954; - :b :c955; - :b :c956; - :b :c957; - :b :c958; - :b :c959; - :b :c960; - :b :c961; - :b :c962; - :b :c963; - :b :c964; - :b :c965; - :b :c966; - :b :c967; - :b :c968; - :b :c969; - :b :c970; - :b :c971; - :b :c972; - :b :c973; - :b :c974; - :b :c975; - :b :c976; - :b :c977; - :b :c978; - :b :c979; - :b :c980; - :b :c981; - :b :c982; - :b :c983; - :b :c984; - :b :c985; - :b :c986; - :b :c987; - :b :c988; - :b :c989; - :b :c990; - :b :c991; - :b :c992; - :b :c993; - :b :c994; - :b :c995; - :b :c996; - :b :c997; - :b :c998; - :b :c999; - :b :c1000; - :b :c1001; - :b :c1002; - :b :c1003; - :b :c1004; - :b :c1005; - :b :c1006; - :b :c1007; - :b :c1008; - :b :c1009; - :b :c1010; - :b :c1011; - :b :c1012; - :b :c1013; - :b :c1014; - :b :c1015; - :b :c1016; - :b :c1017; - :b :c1018; - :b :c1019; - :b :c1020; - :b :c1021; - :b :c1022; - :b :c1023; - :b :c1024; - :b :c1025; - :b :c1026; - :b :c1027; - :b :c1028; - :b :c1029; - :b :c1030; - :b :c1031; - :b :c1032; - :b :c1033; - :b :c1034; - :b :c1035; - :b :c1036; - :b :c1037; - :b :c1038; - :b :c1039; - :b :c1040; - :b :c1041; - :b :c1042; - :b :c1043; - :b :c1044; - :b :c1045; - :b :c1046; - :b :c1047; - :b :c1048; - :b :c1049; - :b :c1050; - :b :c1051; - :b :c1052; - :b :c1053; - :b :c1054; - :b :c1055; - :b :c1056; - :b :c1057; - :b :c1058; - :b :c1059; - :b :c1060; - :b :c1061; - :b :c1062; - :b :c1063; - :b :c1064; - :b :c1065; - :b :c1066; - :b :c1067; - :b :c1068; - :b :c1069; - :b :c1070; - :b :c1071; - :b :c1072; - :b :c1073; - :b :c1074; - :b :c1075; - :b :c1076; - :b :c1077; - :b :c1078; - :b :c1079; - :b :c1080; - :b :c1081; - :b :c1082; - :b :c1083; - :b :c1084; - :b :c1085; - :b :c1086; - :b :c1087; - :b :c1088; - :b :c1089; - :b :c1090; - :b :c1091; - :b :c1092; - :b :c1093; - :b :c1094; - :b :c1095; - :b :c1096; - :b :c1097; - :b :c1098; - :b :c1099; - :b :c1100; - :b :c1101; - :b :c1102; - :b :c1103; - :b :c1104; - :b :c1105; - :b :c1106; - :b :c1107; - :b :c1108; - :b :c1109; - :b :c1110; - :b :c1111; - :b :c1112; - :b :c1113; - :b :c1114; - :b :c1115; - :b :c1116; - :b :c1117; - :b :c1118; - :b :c1119; - :b :c1120; - :b :c1121; - :b :c1122; - :b :c1123; - :b :c1124; - :b :c1125; - :b :c1126; - :b :c1127; - :b :c1128; - :b :c1129; - :b :c1130; - :b :c1131; - :b :c1132; - :b :c1133; - :b :c1134; - :b :c1135; - :b :c1136; - :b :c1137; - :b :c1138; - :b :c1139; - :b :c1140; - :b :c1141; - :b :c1142; - :b :c1143; - :b :c1144; - :b :c1145; - :b :c1146; - :b :c1147; - :b :c1148; - :b :c1149; - :b :c1150; - :b :c1151; - :b :c1152; - :b :c1153; - :b :c1154; - :b :c1155; - :b :c1156; - :b :c1157; - :b :c1158; - :b :c1159; - :b :c1160; - :b :c1161; - :b :c1162; - :b :c1163; - :b :c1164; - :b :c1165; - :b :c1166; - :b :c1167; - :b :c1168; - :b :c1169; - :b :c1170; - :b :c1171; - :b :c1172; - :b :c1173; - :b :c1174; - :b :c1175; - :b :c1176; - :b :c1177; - :b :c1178; - :b :c1179; - :b :c1180; - :b :c1181; - :b :c1182; - :b :c1183; - :b :c1184; - :b :c1185; - :b :c1186; - :b :c1187; - :b :c1188; - :b :c1189; - :b :c1190; - :b :c1191; - :b :c1192; - :b :c1193; - :b :c1194; - :b :c1195; - :b :c1196; - :b :c1197; - :b :c1198; - :b :c1199; - :b :c1200; - :b :c1201; - :b :c1202; - :b :c1203; - :b :c1204; - :b :c1205; - :b :c1206; - :b :c1207; - :b :c1208; - :b :c1209; - :b :c1210; - :b :c1211; - :b :c1212; - :b :c1213; - :b :c1214; - :b :c1215; - :b :c1216; - :b :c1217; - :b :c1218; - :b :c1219; - :b :c1220; - :b :c1221; - :b :c1222; - :b :c1223; - :b :c1224; - :b :c1225; - :b :c1226; - :b :c1227; - :b :c1228; - :b :c1229; - :b :c1230; - :b :c1231; - :b :c1232; - :b :c1233; - :b :c1234; - :b :c1235; - :b :c1236; - :b :c1237; - :b :c1238; - :b :c1239; - :b :c1240; - :b :c1241; - :b :c1242; - :b :c1243; - :b :c1244; - :b :c1245; - :b :c1246; - :b :c1247; - :b :c1248; - :b :c1249; - :b :c1250; - :b :c1251; - :b :c1252; - :b :c1253; - :b :c1254; - :b :c1255; - :b :c1256; - :b :c1257; - :b :c1258; - :b :c1259; - :b :c1260; - :b :c1261; - :b :c1262; - :b :c1263; - :b :c1264; - :b :c1265; - :b :c1266; - :b :c1267; - :b :c1268; - :b :c1269; - :b :c1270; - :b :c1271; - :b :c1272; - :b :c1273; - :b :c1274; - :b :c1275; - :b :c1276; - :b :c1277; - :b :c1278; - :b :c1279; - :b :c1280; - :b :c1281; - :b :c1282; - :b :c1283; - :b :c1284; - :b :c1285; - :b :c1286; - :b :c1287; - :b :c1288; - :b :c1289; - :b :c1290; - :b :c1291; - :b :c1292; - :b :c1293; - :b :c1294; - :b :c1295; - :b :c1296; - :b :c1297; - :b :c1298; - :b :c1299; - :b :c1300; - :b :c1301; - :b :c1302; - :b :c1303; - :b :c1304; - :b :c1305; - :b :c1306; - :b :c1307; - :b :c1308; - :b :c1309; - :b :c1310; - :b :c1311; - :b :c1312; - :b :c1313; - :b :c1314; - :b :c1315; - :b :c1316; - :b :c1317; - :b :c1318; - :b :c1319; - :b :c1320; - :b :c1321; - :b :c1322; - :b :c1323; - :b :c1324; - :b :c1325; - :b :c1326; - :b :c1327; - :b :c1328; - :b :c1329; - :b :c1330; - :b :c1331; - :b :c1332; - :b :c1333; - :b :c1334; - :b :c1335; - :b :c1336; - :b :c1337; - :b :c1338; - :b :c1339; - :b :c1340; - :b :c1341; - :b :c1342; - :b :c1343; - :b :c1344; - :b :c1345; - :b :c1346; - :b :c1347; - :b :c1348; - :b :c1349; - :b :c1350; - :b :c1351; - :b :c1352; - :b :c1353; - :b :c1354; - :b :c1355; - :b :c1356; - :b :c1357; - :b :c1358; - :b :c1359; - :b :c1360; - :b :c1361; - :b :c1362; - :b :c1363; - :b :c1364; - :b :c1365; - :b :c1366; - :b :c1367; - :b :c1368; - :b :c1369; - :b :c1370; - :b :c1371; - :b :c1372; - :b :c1373; - :b :c1374; - :b :c1375; - :b :c1376; - :b :c1377; - :b :c1378; - :b :c1379; - :b :c1380; - :b :c1381; - :b :c1382; - :b :c1383; - :b :c1384; - :b :c1385; - :b :c1386; - :b :c1387; - :b :c1388; - :b :c1389; - :b :c1390; - :b :c1391; - :b :c1392; - :b :c1393; - :b :c1394; - :b :c1395; - :b :c1396; - :b :c1397; - :b :c1398; - :b :c1399; - :b :c1400; - :b :c1401; - :b :c1402; - :b :c1403; - :b :c1404; - :b :c1405; - :b :c1406; - :b :c1407; - :b :c1408; - :b :c1409; - :b :c1410; - :b :c1411; - :b :c1412; - :b :c1413; - :b :c1414; - :b :c1415; - :b :c1416; - :b :c1417; - :b :c1418; - :b :c1419; - :b :c1420; - :b :c1421; - :b :c1422; - :b :c1423; - :b :c1424; - :b :c1425; - :b :c1426; - :b :c1427; - :b :c1428; - :b :c1429; - :b :c1430; - :b :c1431; - :b :c1432; - :b :c1433; - :b :c1434; - :b :c1435; - :b :c1436; - :b :c1437; - :b :c1438; - :b :c1439; - :b :c1440; - :b :c1441; - :b :c1442; - :b :c1443; - :b :c1444; - :b :c1445; - :b :c1446; - :b :c1447; - :b :c1448; - :b :c1449; - :b :c1450; - :b :c1451; - :b :c1452; - :b :c1453; - :b :c1454; - :b :c1455; - :b :c1456; - :b :c1457; - :b :c1458; - :b :c1459; - :b :c1460; - :b :c1461; - :b :c1462; - :b :c1463; - :b :c1464; - :b :c1465; - :b :c1466; - :b :c1467; - :b :c1468; - :b :c1469; - :b :c1470; - :b :c1471; - :b :c1472; - :b :c1473; - :b :c1474; - :b :c1475; - :b :c1476; - :b :c1477; - :b :c1478; - :b :c1479; - :b :c1480; - :b :c1481; - :b :c1482; - :b :c1483; - :b :c1484; - :b :c1485; - :b :c1486; - :b :c1487; - :b :c1488; - :b :c1489; - :b :c1490; - :b :c1491; - :b :c1492; - :b :c1493; - :b :c1494; - :b :c1495; - :b :c1496; - :b :c1497; - :b :c1498; - :b :c1499; - :b :c1500; - :b :c1501; - :b :c1502; - :b :c1503; - :b :c1504; - :b :c1505; - :b :c1506; - :b :c1507; - :b :c1508; - :b :c1509; - :b :c1510; - :b :c1511; - :b :c1512; - :b :c1513; - :b :c1514; - :b :c1515; - :b :c1516; - :b :c1517; - :b :c1518; - :b :c1519; - :b :c1520; - :b :c1521; - :b :c1522; - :b :c1523; - :b :c1524; - :b :c1525; - :b :c1526; - :b :c1527; - :b :c1528; - :b :c1529; - :b :c1530; - :b :c1531; - :b :c1532; - :b :c1533; - :b :c1534; - :b :c1535; - :b :c1536; - :b :c1537; - :b :c1538; - :b :c1539; - :b :c1540; - :b :c1541; - :b :c1542; - :b :c1543; - :b :c1544; - :b :c1545; - :b :c1546; - :b :c1547; - :b :c1548; - :b :c1549; - :b :c1550; - :b :c1551; - :b :c1552; - :b :c1553; - :b :c1554; - :b :c1555; - :b :c1556; - :b :c1557; - :b :c1558; - :b :c1559; - :b :c1560; - :b :c1561; - :b :c1562; - :b :c1563; - :b :c1564; - :b :c1565; - :b :c1566; - :b :c1567; - :b :c1568; - :b :c1569; - :b :c1570; - :b :c1571; - :b :c1572; - :b :c1573; - :b :c1574; - :b :c1575; - :b :c1576; - :b :c1577; - :b :c1578; - :b :c1579; - :b :c1580; - :b :c1581; - :b :c1582; - :b :c1583; - :b :c1584; - :b :c1585; - :b :c1586; - :b :c1587; - :b :c1588; - :b :c1589; - :b :c1590; - :b :c1591; - :b :c1592; - :b :c1593; - :b :c1594; - :b :c1595; - :b :c1596; - :b :c1597; - :b :c1598; - :b :c1599; - :b :c1600; - :b :c1601; - :b :c1602; - :b :c1603; - :b :c1604; - :b :c1605; - :b :c1606; - :b :c1607; - :b :c1608; - :b :c1609; - :b :c1610; - :b :c1611; - :b :c1612; - :b :c1613; - :b :c1614; - :b :c1615; - :b :c1616; - :b :c1617; - :b :c1618; - :b :c1619; - :b :c1620; - :b :c1621; - :b :c1622; - :b :c1623; - :b :c1624; - :b :c1625; - :b :c1626; - :b :c1627; - :b :c1628; - :b :c1629; - :b :c1630; - :b :c1631; - :b :c1632; - :b :c1633; - :b :c1634; - :b :c1635; - :b :c1636; - :b :c1637; - :b :c1638; - :b :c1639; - :b :c1640; - :b :c1641; - :b :c1642; - :b :c1643; - :b :c1644; - :b :c1645; - :b :c1646; - :b :c1647; - :b :c1648; - :b :c1649; - :b :c1650; - :b :c1651; - :b :c1652; - :b :c1653; - :b :c1654; - :b :c1655; - :b :c1656; - :b :c1657; - :b :c1658; - :b :c1659; - :b :c1660; - :b :c1661; - :b :c1662; - :b :c1663; - :b :c1664; - :b :c1665; - :b :c1666; - :b :c1667; - :b :c1668; - :b :c1669; - :b :c1670; - :b :c1671; - :b :c1672; - :b :c1673; - :b :c1674; - :b :c1675; - :b :c1676; - :b :c1677; - :b :c1678; - :b :c1679; - :b :c1680; - :b :c1681; - :b :c1682; - :b :c1683; - :b :c1684; - :b :c1685; - :b :c1686; - :b :c1687; - :b :c1688; - :b :c1689; - :b :c1690; - :b :c1691; - :b :c1692; - :b :c1693; - :b :c1694; - :b :c1695; - :b :c1696; - :b :c1697; - :b :c1698; - :b :c1699; - :b :c1700; - :b :c1701; - :b :c1702; - :b :c1703; - :b :c1704; - :b :c1705; - :b :c1706; - :b :c1707; - :b :c1708; - :b :c1709; - :b :c1710; - :b :c1711; - :b :c1712; - :b :c1713; - :b :c1714; - :b :c1715; - :b :c1716; - :b :c1717; - :b :c1718; - :b :c1719; - :b :c1720; - :b :c1721; - :b :c1722; - :b :c1723; - :b :c1724; - :b :c1725; - :b :c1726; - :b :c1727; - :b :c1728; - :b :c1729; - :b :c1730; - :b :c1731; - :b :c1732; - :b :c1733; - :b :c1734; - :b :c1735; - :b :c1736; - :b :c1737; - :b :c1738; - :b :c1739; - :b :c1740; - :b :c1741; - :b :c1742; - :b :c1743; - :b :c1744; - :b :c1745; - :b :c1746; - :b :c1747; - :b :c1748; - :b :c1749; - :b :c1750; - :b :c1751; - :b :c1752; - :b :c1753; - :b :c1754; - :b :c1755; - :b :c1756; - :b :c1757; - :b :c1758; - :b :c1759; - :b :c1760; - :b :c1761; - :b :c1762; - :b :c1763; - :b :c1764; - :b :c1765; - :b :c1766; - :b :c1767; - :b :c1768; - :b :c1769; - :b :c1770; - :b :c1771; - :b :c1772; - :b :c1773; - :b :c1774; - :b :c1775; - :b :c1776; - :b :c1777; - :b :c1778; - :b :c1779; - :b :c1780; - :b :c1781; - :b :c1782; - :b :c1783; - :b :c1784; - :b :c1785; - :b :c1786; - :b :c1787; - :b :c1788; - :b :c1789; - :b :c1790; - :b :c1791; - :b :c1792; - :b :c1793; - :b :c1794; - :b :c1795; - :b :c1796; - :b :c1797; - :b :c1798; - :b :c1799; - :b :c1800; - :b :c1801; - :b :c1802; - :b :c1803; - :b :c1804; - :b :c1805; - :b :c1806; - :b :c1807; - :b :c1808; - :b :c1809; - :b :c1810; - :b :c1811; - :b :c1812; - :b :c1813; - :b :c1814; - :b :c1815; - :b :c1816; - :b :c1817; - :b :c1818; - :b :c1819; - :b :c1820; - :b :c1821; - :b :c1822; - :b :c1823; - :b :c1824; - :b :c1825; - :b :c1826; - :b :c1827; - :b :c1828; - :b :c1829; - :b :c1830; - :b :c1831; - :b :c1832; - :b :c1833; - :b :c1834; - :b :c1835; - :b :c1836; - :b :c1837; - :b :c1838; - :b :c1839; - :b :c1840; - :b :c1841; - :b :c1842; - :b :c1843; - :b :c1844; - :b :c1845; - :b :c1846; - :b :c1847; - :b :c1848; - :b :c1849; - :b :c1850; - :b :c1851; - :b :c1852; - :b :c1853; - :b :c1854; - :b :c1855; - :b :c1856; - :b :c1857; - :b :c1858; - :b :c1859; - :b :c1860; - :b :c1861; - :b :c1862; - :b :c1863; - :b :c1864; - :b :c1865; - :b :c1866; - :b :c1867; - :b :c1868; - :b :c1869; - :b :c1870; - :b :c1871; - :b :c1872; - :b :c1873; - :b :c1874; - :b :c1875; - :b :c1876; - :b :c1877; - :b :c1878; - :b :c1879; - :b :c1880; - :b :c1881; - :b :c1882; - :b :c1883; - :b :c1884; - :b :c1885; - :b :c1886; - :b :c1887; - :b :c1888; - :b :c1889; - :b :c1890; - :b :c1891; - :b :c1892; - :b :c1893; - :b :c1894; - :b :c1895; - :b :c1896; - :b :c1897; - :b :c1898; - :b :c1899; - :b :c1900; - :b :c1901; - :b :c1902; - :b :c1903; - :b :c1904; - :b :c1905; - :b :c1906; - :b :c1907; - :b :c1908; - :b :c1909; - :b :c1910; - :b :c1911; - :b :c1912; - :b :c1913; - :b :c1914; - :b :c1915; - :b :c1916; - :b :c1917; - :b :c1918; - :b :c1919; - :b :c1920; - :b :c1921; - :b :c1922; - :b :c1923; - :b :c1924; - :b :c1925; - :b :c1926; - :b :c1927; - :b :c1928; - :b :c1929; - :b :c1930; - :b :c1931; - :b :c1932; - :b :c1933; - :b :c1934; - :b :c1935; - :b :c1936; - :b :c1937; - :b :c1938; - :b :c1939; - :b :c1940; - :b :c1941; - :b :c1942; - :b :c1943; - :b :c1944; - :b :c1945; - :b :c1946; - :b :c1947; - :b :c1948; - :b :c1949; - :b :c1950; - :b :c1951; - :b :c1952; - :b :c1953; - :b :c1954; - :b :c1955; - :b :c1956; - :b :c1957; - :b :c1958; - :b :c1959; - :b :c1960; - :b :c1961; - :b :c1962; - :b :c1963; - :b :c1964; - :b :c1965; - :b :c1966; - :b :c1967; - :b :c1968; - :b :c1969; - :b :c1970; - :b :c1971; - :b :c1972; - :b :c1973; - :b :c1974; - :b :c1975; - :b :c1976; - :b :c1977; - :b :c1978; - :b :c1979; - :b :c1980; - :b :c1981; - :b :c1982; - :b :c1983; - :b :c1984; - :b :c1985; - :b :c1986; - :b :c1987; - :b :c1988; - :b :c1989; - :b :c1990; - :b :c1991; - :b :c1992; - :b :c1993; - :b :c1994; - :b :c1995; - :b :c1996; - :b :c1997; - :b :c1998; - :b :c1999; - :b :c2000; - :b :c2001; - :b :c2002; - :b :c2003; - :b :c2004; - :b :c2005; - :b :c2006; - :b :c2007; - :b :c2008; - :b :c2009; - :b :c2010; - :b :c2011; - :b :c2012; - :b :c2013; - :b :c2014; - :b :c2015; - :b :c2016; - :b :c2017; - :b :c2018; - :b :c2019; - :b :c2020; - :b :c2021; - :b :c2022; - :b :c2023; - :b :c2024; - :b :c2025; - :b :c2026; - :b :c2027; - :b :c2028; - :b :c2029; - :b :c2030; - :b :c2031; - :b :c2032; - :b :c2033; - :b :c2034; - :b :c2035; - :b :c2036; - :b :c2037; - :b :c2038; - :b :c2039; - :b :c2040; - :b :c2041; - :b :c2042; - :b :c2043; - :b :c2044; - :b :c2045; - :b :c2046; - :b :c2047; - :b :c2048; - :b :c2049; - :b :c2050; - :b :c2051; - :b :c2052; - :b :c2053; - :b :c2054; - :b :c2055; - :b :c2056; - :b :c2057; - :b :c2058; - :b :c2059; - :b :c2060; - :b :c2061; - :b :c2062; - :b :c2063; - :b :c2064; - :b :c2065; - :b :c2066; - :b :c2067; - :b :c2068; - :b :c2069; - :b :c2070; - :b :c2071; - :b :c2072; - :b :c2073; - :b :c2074; - :b :c2075; - :b :c2076; - :b :c2077; - :b :c2078; - :b :c2079; - :b :c2080; - :b :c2081; - :b :c2082; - :b :c2083; - :b :c2084; - :b :c2085; - :b :c2086; - :b :c2087; - :b :c2088; - :b :c2089; - :b :c2090; - :b :c2091; - :b :c2092; - :b :c2093; - :b :c2094; - :b :c2095; - :b :c2096; - :b :c2097; - :b :c2098; - :b :c2099; - :b :c2100; - :b :c2101; - :b :c2102; - :b :c2103; - :b :c2104; - :b :c2105; - :b :c2106; - :b :c2107; - :b :c2108; - :b :c2109; - :b :c2110; - :b :c2111; - :b :c2112; - :b :c2113; - :b :c2114; - :b :c2115; - :b :c2116; - :b :c2117; - :b :c2118; - :b :c2119; - :b :c2120; - :b :c2121; - :b :c2122; - :b :c2123; - :b :c2124; - :b :c2125; - :b :c2126; - :b :c2127; - :b :c2128; - :b :c2129; - :b :c2130; - :b :c2131; - :b :c2132; - :b :c2133; - :b :c2134; - :b :c2135; - :b :c2136; - :b :c2137; - :b :c2138; - :b :c2139; - :b :c2140; - :b :c2141; - :b :c2142; - :b :c2143; - :b :c2144; - :b :c2145; - :b :c2146; - :b :c2147; - :b :c2148; - :b :c2149; - :b :c2150; - :b :c2151; - :b :c2152; - :b :c2153; - :b :c2154; - :b :c2155; - :b :c2156; - :b :c2157; - :b :c2158; - :b :c2159; - :b :c2160; - :b :c2161; - :b :c2162; - :b :c2163; - :b :c2164; - :b :c2165; - :b :c2166; - :b :c2167; - :b :c2168; - :b :c2169; - :b :c2170; - :b :c2171; - :b :c2172; - :b :c2173; - :b :c2174; - :b :c2175; - :b :c2176; - :b :c2177; - :b :c2178; - :b :c2179; - :b :c2180; - :b :c2181; - :b :c2182; - :b :c2183; - :b :c2184; - :b :c2185; - :b :c2186; - :b :c2187; - :b :c2188; - :b :c2189; - :b :c2190; - :b :c2191; - :b :c2192; - :b :c2193; - :b :c2194; - :b :c2195; - :b :c2196; - :b :c2197; - :b :c2198; - :b :c2199; - :b :c2200; - :b :c2201; - :b :c2202; - :b :c2203; - :b :c2204; - :b :c2205; - :b :c2206; - :b :c2207; - :b :c2208; - :b :c2209; - :b :c2210; - :b :c2211; - :b :c2212; - :b :c2213; - :b :c2214; - :b :c2215; - :b :c2216; - :b :c2217; - :b :c2218; - :b :c2219; - :b :c2220; - :b :c2221; - :b :c2222; - :b :c2223; - :b :c2224; - :b :c2225; - :b :c2226; - :b :c2227; - :b :c2228; - :b :c2229; - :b :c2230; - :b :c2231; - :b :c2232; - :b :c2233; - :b :c2234; - :b :c2235; - :b :c2236; - :b :c2237; - :b :c2238; - :b :c2239; - :b :c2240; - :b :c2241; - :b :c2242; - :b :c2243; - :b :c2244; - :b :c2245; - :b :c2246; - :b :c2247; - :b :c2248; - :b :c2249; - :b :c2250; - :b :c2251; - :b :c2252; - :b :c2253; - :b :c2254; - :b :c2255; - :b :c2256; - :b :c2257; - :b :c2258; - :b :c2259; - :b :c2260; - :b :c2261; - :b :c2262; - :b :c2263; - :b :c2264; - :b :c2265; - :b :c2266; - :b :c2267; - :b :c2268; - :b :c2269; - :b :c2270; - :b :c2271; - :b :c2272; - :b :c2273; - :b :c2274; - :b :c2275; - :b :c2276; - :b :c2277; - :b :c2278; - :b :c2279; - :b :c2280; - :b :c2281; - :b :c2282; - :b :c2283; - :b :c2284; - :b :c2285; - :b :c2286; - :b :c2287; - :b :c2288; - :b :c2289; - :b :c2290; - :b :c2291; - :b :c2292; - :b :c2293; - :b :c2294; - :b :c2295; - :b :c2296; - :b :c2297; - :b :c2298; - :b :c2299; - :b :c2300; - :b :c2301; - :b :c2302; - :b :c2303; - :b :c2304; - :b :c2305; - :b :c2306; - :b :c2307; - :b :c2308; - :b :c2309; - :b :c2310; - :b :c2311; - :b :c2312; - :b :c2313; - :b :c2314; - :b :c2315; - :b :c2316; - :b :c2317; - :b :c2318; - :b :c2319; - :b :c2320; - :b :c2321; - :b :c2322; - :b :c2323; - :b :c2324; - :b :c2325; - :b :c2326; - :b :c2327; - :b :c2328; - :b :c2329; - :b :c2330; - :b :c2331; - :b :c2332; - :b :c2333; - :b :c2334; - :b :c2335; - :b :c2336; - :b :c2337; - :b :c2338; - :b :c2339; - :b :c2340; - :b :c2341; - :b :c2342; - :b :c2343; - :b :c2344; - :b :c2345; - :b :c2346; - :b :c2347; - :b :c2348; - :b :c2349; - :b :c2350; - :b :c2351; - :b :c2352; - :b :c2353; - :b :c2354; - :b :c2355; - :b :c2356; - :b :c2357; - :b :c2358; - :b :c2359; - :b :c2360; - :b :c2361; - :b :c2362; - :b :c2363; - :b :c2364; - :b :c2365; - :b :c2366; - :b :c2367; - :b :c2368; - :b :c2369; - :b :c2370; - :b :c2371; - :b :c2372; - :b :c2373; - :b :c2374; - :b :c2375; - :b :c2376; - :b :c2377; - :b :c2378; - :b :c2379; - :b :c2380; - :b :c2381; - :b :c2382; - :b :c2383; - :b :c2384; - :b :c2385; - :b :c2386; - :b :c2387; - :b :c2388; - :b :c2389; - :b :c2390; - :b :c2391; - :b :c2392; - :b :c2393; - :b :c2394; - :b :c2395; - :b :c2396; - :b :c2397; - :b :c2398; - :b :c2399; - :b :c2400; - :b :c2401; - :b :c2402; - :b :c2403; - :b :c2404; - :b :c2405; - :b :c2406; - :b :c2407; - :b :c2408; - :b :c2409; - :b :c2410; - :b :c2411; - :b :c2412; - :b :c2413; - :b :c2414; - :b :c2415; - :b :c2416; - :b :c2417; - :b :c2418; - :b :c2419; - :b :c2420; - :b :c2421; - :b :c2422; - :b :c2423; - :b :c2424; - :b :c2425; - :b :c2426; - :b :c2427; - :b :c2428; - :b :c2429; - :b :c2430; - :b :c2431; - :b :c2432; - :b :c2433; - :b :c2434; - :b :c2435; - :b :c2436; - :b :c2437; - :b :c2438; - :b :c2439; - :b :c2440; - :b :c2441; - :b :c2442; - :b :c2443; - :b :c2444; - :b :c2445; - :b :c2446; - :b :c2447; - :b :c2448; - :b :c2449; - :b :c2450; - :b :c2451; - :b :c2452; - :b :c2453; - :b :c2454; - :b :c2455; - :b :c2456; - :b :c2457; - :b :c2458; - :b :c2459; - :b :c2460; - :b :c2461; - :b :c2462; - :b :c2463; - :b :c2464; - :b :c2465; - :b :c2466; - :b :c2467; - :b :c2468; - :b :c2469; - :b :c2470; - :b :c2471; - :b :c2472; - :b :c2473; - :b :c2474; - :b :c2475; - :b :c2476; - :b :c2477; - :b :c2478; - :b :c2479; - :b :c2480; - :b :c2481; - :b :c2482; - :b :c2483; - :b :c2484; - :b :c2485; - :b :c2486; - :b :c2487; - :b :c2488; - :b :c2489; - :b :c2490; - :b :c2491; - :b :c2492; - :b :c2493; - :b :c2494; - :b :c2495; - :b :c2496; - :b :c2497; - :b :c2498; - :b :c2499; - :b :c2500; - :b :c2501; - :b :c2502; - :b :c2503; - :b :c2504; - :b :c2505; - :b :c2506; - :b :c2507; - :b :c2508; - :b :c2509; - :b :c2510; - :b :c2511; - :b :c2512; - :b :c2513; - :b :c2514; - :b :c2515; - :b :c2516; - :b :c2517; - :b :c2518; - :b :c2519; - :b :c2520; - :b :c2521; - :b :c2522; - :b :c2523; - :b :c2524; - :b :c2525; - :b :c2526; - :b :c2527; - :b :c2528; - :b :c2529; - :b :c2530; - :b :c2531; - :b :c2532; - :b :c2533; - :b :c2534; - :b :c2535; - :b :c2536; - :b :c2537; - :b :c2538; - :b :c2539; - :b :c2540; - :b :c2541; - :b :c2542; - :b :c2543; - :b :c2544; - :b :c2545; - :b :c2546; - :b :c2547; - :b :c2548; - :b :c2549; - :b :c2550; - :b :c2551; - :b :c2552; - :b :c2553; - :b :c2554; - :b :c2555; - :b :c2556; - :b :c2557; - :b :c2558; - :b :c2559; - :b :c2560; - :b :c2561; - :b :c2562; - :b :c2563; - :b :c2564; - :b :c2565; - :b :c2566; - :b :c2567; - :b :c2568; - :b :c2569; - :b :c2570; - :b :c2571; - :b :c2572; - :b :c2573; - :b :c2574; - :b :c2575; - :b :c2576; - :b :c2577; - :b :c2578; - :b :c2579; - :b :c2580; - :b :c2581; - :b :c2582; - :b :c2583; - :b :c2584; - :b :c2585; - :b :c2586; - :b :c2587; - :b :c2588; - :b :c2589; - :b :c2590; - :b :c2591; - :b :c2592; - :b :c2593; - :b :c2594; - :b :c2595; - :b :c2596; - :b :c2597; - :b :c2598; - :b :c2599; - :b :c2600; - :b :c2601; - :b :c2602; - :b :c2603; - :b :c2604; - :b :c2605; - :b :c2606; - :b :c2607; - :b :c2608; - :b :c2609; - :b :c2610; - :b :c2611; - :b :c2612; - :b :c2613; - :b :c2614; - :b :c2615; - :b :c2616; - :b :c2617; - :b :c2618; - :b :c2619; - :b :c2620; - :b :c2621; - :b :c2622; - :b :c2623; - :b :c2624; - :b :c2625; - :b :c2626; - :b :c2627; - :b :c2628; - :b :c2629; - :b :c2630; - :b :c2631; - :b :c2632; - :b :c2633; - :b :c2634; - :b :c2635; - :b :c2636; - :b :c2637; - :b :c2638; - :b :c2639; - :b :c2640; - :b :c2641; - :b :c2642; - :b :c2643; - :b :c2644; - :b :c2645; - :b :c2646; - :b :c2647; - :b :c2648; - :b :c2649; - :b :c2650; - :b :c2651; - :b :c2652; - :b :c2653; - :b :c2654; - :b :c2655; - :b :c2656; - :b :c2657; - :b :c2658; - :b :c2659; - :b :c2660; - :b :c2661; - :b :c2662; - :b :c2663; - :b :c2664; - :b :c2665; - :b :c2666; - :b :c2667; - :b :c2668; - :b :c2669; - :b :c2670; - :b :c2671; - :b :c2672; - :b :c2673; - :b :c2674; - :b :c2675; - :b :c2676; - :b :c2677; - :b :c2678; - :b :c2679; - :b :c2680; - :b :c2681; - :b :c2682; - :b :c2683; - :b :c2684; - :b :c2685; - :b :c2686; - :b :c2687; - :b :c2688; - :b :c2689; - :b :c2690; - :b :c2691; - :b :c2692; - :b :c2693; - :b :c2694; - :b :c2695; - :b :c2696; - :b :c2697; - :b :c2698; - :b :c2699; - :b :c2700; - :b :c2701; - :b :c2702; - :b :c2703; - :b :c2704; - :b :c2705; - :b :c2706; - :b :c2707; - :b :c2708; - :b :c2709; - :b :c2710; - :b :c2711; - :b :c2712; - :b :c2713; - :b :c2714; - :b :c2715; - :b :c2716; - :b :c2717; - :b :c2718; - :b :c2719; - :b :c2720; - :b :c2721; - :b :c2722; - :b :c2723; - :b :c2724; - :b :c2725; - :b :c2726; - :b :c2727; - :b :c2728; - :b :c2729; - :b :c2730; - :b :c2731; - :b :c2732; - :b :c2733; - :b :c2734; - :b :c2735; - :b :c2736; - :b :c2737; - :b :c2738; - :b :c2739; - :b :c2740; - :b :c2741; - :b :c2742; - :b :c2743; - :b :c2744; - :b :c2745; - :b :c2746; - :b :c2747; - :b :c2748; - :b :c2749; - :b :c2750; - :b :c2751; - :b :c2752; - :b :c2753; - :b :c2754; - :b :c2755; - :b :c2756; - :b :c2757; - :b :c2758; - :b :c2759; - :b :c2760; - :b :c2761; - :b :c2762; - :b :c2763; - :b :c2764; - :b :c2765; - :b :c2766; - :b :c2767; - :b :c2768; - :b :c2769; - :b :c2770; - :b :c2771; - :b :c2772; - :b :c2773; - :b :c2774; - :b :c2775; - :b :c2776; - :b :c2777; - :b :c2778; - :b :c2779; - :b :c2780; - :b :c2781; - :b :c2782; - :b :c2783; - :b :c2784; - :b :c2785; - :b :c2786; - :b :c2787; - :b :c2788; - :b :c2789; - :b :c2790; - :b :c2791; - :b :c2792; - :b :c2793; - :b :c2794; - :b :c2795; - :b :c2796; - :b :c2797; - :b :c2798; - :b :c2799; - :b :c2800; - :b :c2801; - :b :c2802; - :b :c2803; - :b :c2804; - :b :c2805; - :b :c2806; - :b :c2807; - :b :c2808; - :b :c2809; - :b :c2810; - :b :c2811; - :b :c2812; - :b :c2813; - :b :c2814; - :b :c2815; - :b :c2816; - :b :c2817; - :b :c2818; - :b :c2819; - :b :c2820; - :b :c2821; - :b :c2822; - :b :c2823; - :b :c2824; - :b :c2825; - :b :c2826; - :b :c2827; - :b :c2828; - :b :c2829; - :b :c2830; - :b :c2831; - :b :c2832; - :b :c2833; - :b :c2834; - :b :c2835; - :b :c2836; - :b :c2837; - :b :c2838; - :b :c2839; - :b :c2840; - :b :c2841; - :b :c2842; - :b :c2843; - :b :c2844; - :b :c2845; - :b :c2846; - :b :c2847; - :b :c2848; - :b :c2849; - :b :c2850; - :b :c2851; - :b :c2852; - :b :c2853; - :b :c2854; - :b :c2855; - :b :c2856; - :b :c2857; - :b :c2858; - :b :c2859; - :b :c2860; - :b :c2861; - :b :c2862; - :b :c2863; - :b :c2864; - :b :c2865; - :b :c2866; - :b :c2867; - :b :c2868; - :b :c2869; - :b :c2870; - :b :c2871; - :b :c2872; - :b :c2873; - :b :c2874; - :b :c2875; - :b :c2876; - :b :c2877; - :b :c2878; - :b :c2879; - :b :c2880; - :b :c2881; - :b :c2882; - :b :c2883; - :b :c2884; - :b :c2885; - :b :c2886; - :b :c2887; - :b :c2888; - :b :c2889; - :b :c2890; - :b :c2891; - :b :c2892; - :b :c2893; - :b :c2894; - :b :c2895; - :b :c2896; - :b :c2897; - :b :c2898; - :b :c2899; - :b :c2900; - :b :c2901; - :b :c2902; - :b :c2903; - :b :c2904; - :b :c2905; - :b :c2906; - :b :c2907; - :b :c2908; - :b :c2909; - :b :c2910; - :b :c2911; - :b :c2912; - :b :c2913; - :b :c2914; - :b :c2915; - :b :c2916; - :b :c2917; - :b :c2918; - :b :c2919; - :b :c2920; - :b :c2921; - :b :c2922; - :b :c2923; - :b :c2924; - :b :c2925; - :b :c2926; - :b :c2927; - :b :c2928; - :b :c2929; - :b :c2930; - :b :c2931; - :b :c2932; - :b :c2933; - :b :c2934; - :b :c2935; - :b :c2936; - :b :c2937; - :b :c2938; - :b :c2939; - :b :c2940; - :b :c2941; - :b :c2942; - :b :c2943; - :b :c2944; - :b :c2945; - :b :c2946; - :b :c2947; - :b :c2948; - :b :c2949; - :b :c2950; - :b :c2951; - :b :c2952; - :b :c2953; - :b :c2954; - :b :c2955; - :b :c2956; - :b :c2957; - :b :c2958; - :b :c2959; - :b :c2960; - :b :c2961; - :b :c2962; - :b :c2963; - :b :c2964; - :b :c2965; - :b :c2966; - :b :c2967; - :b :c2968; - :b :c2969; - :b :c2970; - :b :c2971; - :b :c2972; - :b :c2973; - :b :c2974; - :b :c2975; - :b :c2976; - :b :c2977; - :b :c2978; - :b :c2979; - :b :c2980; - :b :c2981; - :b :c2982; - :b :c2983; - :b :c2984; - :b :c2985; - :b :c2986; - :b :c2987; - :b :c2988; - :b :c2989; - :b :c2990; - :b :c2991; - :b :c2992; - :b :c2993; - :b :c2994; - :b :c2995; - :b :c2996; - :b :c2997; - :b :c2998; - :b :c2999; - :b :c3000; - :b :c3001; - :b :c3002; - :b :c3003; - :b :c3004; - :b :c3005; - :b :c3006; - :b :c3007; - :b :c3008; - :b :c3009; - :b :c3010; - :b :c3011; - :b :c3012; - :b :c3013; - :b :c3014; - :b :c3015; - :b :c3016; - :b :c3017; - :b :c3018; - :b :c3019; - :b :c3020; - :b :c3021; - :b :c3022; - :b :c3023; - :b :c3024; - :b :c3025; - :b :c3026; - :b :c3027; - :b :c3028; - :b :c3029; - :b :c3030; - :b :c3031; - :b :c3032; - :b :c3033; - :b :c3034; - :b :c3035; - :b :c3036; - :b :c3037; - :b :c3038; - :b :c3039; - :b :c3040; - :b :c3041; - :b :c3042; - :b :c3043; - :b :c3044; - :b :c3045; - :b :c3046; - :b :c3047; - :b :c3048; - :b :c3049; - :b :c3050; - :b :c3051; - :b :c3052; - :b :c3053; - :b :c3054; - :b :c3055; - :b :c3056; - :b :c3057; - :b :c3058; - :b :c3059; - :b :c3060; - :b :c3061; - :b :c3062; - :b :c3063; - :b :c3064; - :b :c3065; - :b :c3066; - :b :c3067; - :b :c3068; - :b :c3069; - :b :c3070; - :b :c3071; - :b :c3072; - :b :c3073; - :b :c3074; - :b :c3075; - :b :c3076; - :b :c3077; - :b :c3078; - :b :c3079; - :b :c3080; - :b :c3081; - :b :c3082; - :b :c3083; - :b :c3084; - :b :c3085; - :b :c3086; - :b :c3087; - :b :c3088; - :b :c3089; - :b :c3090; - :b :c3091; - :b :c3092; - :b :c3093; - :b :c3094; - :b :c3095; - :b :c3096; - :b :c3097; - :b :c3098; - :b :c3099; - :b :c3100; - :b :c3101; - :b :c3102; - :b :c3103; - :b :c3104; - :b :c3105; - :b :c3106; - :b :c3107; - :b :c3108; - :b :c3109; - :b :c3110; - :b :c3111; - :b :c3112; - :b :c3113; - :b :c3114; - :b :c3115; - :b :c3116; - :b :c3117; - :b :c3118; - :b :c3119; - :b :c3120; - :b :c3121; - :b :c3122; - :b :c3123; - :b :c3124; - :b :c3125; - :b :c3126; - :b :c3127; - :b :c3128; - :b :c3129; - :b :c3130; - :b :c3131; - :b :c3132; - :b :c3133; - :b :c3134; - :b :c3135; - :b :c3136; - :b :c3137; - :b :c3138; - :b :c3139; - :b :c3140; - :b :c3141; - :b :c3142; - :b :c3143; - :b :c3144; - :b :c3145; - :b :c3146; - :b :c3147; - :b :c3148; - :b :c3149; - :b :c3150; - :b :c3151; - :b :c3152; - :b :c3153; - :b :c3154; - :b :c3155; - :b :c3156; - :b :c3157; - :b :c3158; - :b :c3159; - :b :c3160; - :b :c3161; - :b :c3162; - :b :c3163; - :b :c3164; - :b :c3165; - :b :c3166; - :b :c3167; - :b :c3168; - :b :c3169; - :b :c3170; - :b :c3171; - :b :c3172; - :b :c3173; - :b :c3174; - :b :c3175; - :b :c3176; - :b :c3177; - :b :c3178; - :b :c3179; - :b :c3180; - :b :c3181; - :b :c3182; - :b :c3183; - :b :c3184; - :b :c3185; - :b :c3186; - :b :c3187; - :b :c3188; - :b :c3189; - :b :c3190; - :b :c3191; - :b :c3192; - :b :c3193; - :b :c3194; - :b :c3195; - :b :c3196; - :b :c3197; - :b :c3198; - :b :c3199; - :b :c3200; - :b :c3201; - :b :c3202; - :b :c3203; - :b :c3204; - :b :c3205; - :b :c3206; - :b :c3207; - :b :c3208; - :b :c3209; - :b :c3210; - :b :c3211; - :b :c3212; - :b :c3213; - :b :c3214; - :b :c3215; - :b :c3216; - :b :c3217; - :b :c3218; - :b :c3219; - :b :c3220; - :b :c3221; - :b :c3222; - :b :c3223; - :b :c3224; - :b :c3225; - :b :c3226; - :b :c3227; - :b :c3228; - :b :c3229; - :b :c3230; - :b :c3231; - :b :c3232; - :b :c3233; - :b :c3234; - :b :c3235; - :b :c3236; - :b :c3237; - :b :c3238; - :b :c3239; - :b :c3240; - :b :c3241; - :b :c3242; - :b :c3243; - :b :c3244; - :b :c3245; - :b :c3246; - :b :c3247; - :b :c3248; - :b :c3249; - :b :c3250; - :b :c3251; - :b :c3252; - :b :c3253; - :b :c3254; - :b :c3255; - :b :c3256; - :b :c3257; - :b :c3258; - :b :c3259; - :b :c3260; - :b :c3261; - :b :c3262; - :b :c3263; - :b :c3264; - :b :c3265; - :b :c3266; - :b :c3267; - :b :c3268; - :b :c3269; - :b :c3270; - :b :c3271; - :b :c3272; - :b :c3273; - :b :c3274; - :b :c3275; - :b :c3276; - :b :c3277; - :b :c3278; - :b :c3279; - :b :c3280; - :b :c3281; - :b :c3282; - :b :c3283; - :b :c3284; - :b :c3285; - :b :c3286; - :b :c3287; - :b :c3288; - :b :c3289; - :b :c3290; - :b :c3291; - :b :c3292; - :b :c3293; - :b :c3294; - :b :c3295; - :b :c3296; - :b :c3297; - :b :c3298; - :b :c3299; - :b :c3300; - :b :c3301; - :b :c3302; - :b :c3303; - :b :c3304; - :b :c3305; - :b :c3306; - :b :c3307; - :b :c3308; - :b :c3309; - :b :c3310; - :b :c3311; - :b :c3312; - :b :c3313; - :b :c3314; - :b :c3315; - :b :c3316; - :b :c3317; - :b :c3318; - :b :c3319; - :b :c3320; - :b :c3321; - :b :c3322; - :b :c3323; - :b :c3324; - :b :c3325; - :b :c3326; - :b :c3327; - :b :c3328; - :b :c3329; - :b :c3330; - :b :c3331; - :b :c3332; - :b :c3333; - :b :c3334; - :b :c3335; - :b :c3336; - :b :c3337; - :b :c3338; - :b :c3339; - :b :c3340; - :b :c3341; - :b :c3342; - :b :c3343; - :b :c3344; - :b :c3345; - :b :c3346; - :b :c3347; - :b :c3348; - :b :c3349; - :b :c3350; - :b :c3351; - :b :c3352; - :b :c3353; - :b :c3354; - :b :c3355; - :b :c3356; - :b :c3357; - :b :c3358; - :b :c3359; - :b :c3360; - :b :c3361; - :b :c3362; - :b :c3363; - :b :c3364; - :b :c3365; - :b :c3366; - :b :c3367; - :b :c3368; - :b :c3369; - :b :c3370; - :b :c3371; - :b :c3372; - :b :c3373; - :b :c3374; - :b :c3375; - :b :c3376; - :b :c3377; - :b :c3378; - :b :c3379; - :b :c3380; - :b :c3381; - :b :c3382; - :b :c3383; - :b :c3384; - :b :c3385; - :b :c3386; - :b :c3387; - :b :c3388; - :b :c3389; - :b :c3390; - :b :c3391; - :b :c3392; - :b :c3393; - :b :c3394; - :b :c3395; - :b :c3396; - :b :c3397; - :b :c3398; - :b :c3399; - :b :c3400; - :b :c3401; - :b :c3402; - :b :c3403; - :b :c3404; - :b :c3405; - :b :c3406; - :b :c3407; - :b :c3408; - :b :c3409; - :b :c3410; - :b :c3411; - :b :c3412; - :b :c3413; - :b :c3414; - :b :c3415; - :b :c3416; - :b :c3417; - :b :c3418; - :b :c3419; - :b :c3420; - :b :c3421; - :b :c3422; - :b :c3423; - :b :c3424; - :b :c3425; - :b :c3426; - :b :c3427; - :b :c3428; - :b :c3429; - :b :c3430; - :b :c3431; - :b :c3432; - :b :c3433; - :b :c3434; - :b :c3435; - :b :c3436; - :b :c3437; - :b :c3438; - :b :c3439; - :b :c3440; - :b :c3441; - :b :c3442; - :b :c3443; - :b :c3444; - :b :c3445; - :b :c3446; - :b :c3447; - :b :c3448; - :b :c3449; - :b :c3450; - :b :c3451; - :b :c3452; - :b :c3453; - :b :c3454; - :b :c3455; - :b :c3456; - :b :c3457; - :b :c3458; - :b :c3459; - :b :c3460; - :b :c3461; - :b :c3462; - :b :c3463; - :b :c3464; - :b :c3465; - :b :c3466; - :b :c3467; - :b :c3468; - :b :c3469; - :b :c3470; - :b :c3471; - :b :c3472; - :b :c3473; - :b :c3474; - :b :c3475; - :b :c3476; - :b :c3477; - :b :c3478; - :b :c3479; - :b :c3480; - :b :c3481; - :b :c3482; - :b :c3483; - :b :c3484; - :b :c3485; - :b :c3486; - :b :c3487; - :b :c3488; - :b :c3489; - :b :c3490; - :b :c3491; - :b :c3492; - :b :c3493; - :b :c3494; - :b :c3495; - :b :c3496; - :b :c3497; - :b :c3498; - :b :c3499; - :b :c3500; - :b :c3501; - :b :c3502; - :b :c3503; - :b :c3504; - :b :c3505; - :b :c3506; - :b :c3507; - :b :c3508; - :b :c3509; - :b :c3510; - :b :c3511; - :b :c3512; - :b :c3513; - :b :c3514; - :b :c3515; - :b :c3516; - :b :c3517; - :b :c3518; - :b :c3519; - :b :c3520; - :b :c3521; - :b :c3522; - :b :c3523; - :b :c3524; - :b :c3525; - :b :c3526; - :b :c3527; - :b :c3528; - :b :c3529; - :b :c3530; - :b :c3531; - :b :c3532; - :b :c3533; - :b :c3534; - :b :c3535; - :b :c3536; - :b :c3537; - :b :c3538; - :b :c3539; - :b :c3540; - :b :c3541; - :b :c3542; - :b :c3543; - :b :c3544; - :b :c3545; - :b :c3546; - :b :c3547; - :b :c3548; - :b :c3549; - :b :c3550; - :b :c3551; - :b :c3552; - :b :c3553; - :b :c3554; - :b :c3555; - :b :c3556; - :b :c3557; - :b :c3558; - :b :c3559; - :b :c3560; - :b :c3561; - :b :c3562; - :b :c3563; - :b :c3564; - :b :c3565; - :b :c3566; - :b :c3567; - :b :c3568; - :b :c3569; - :b :c3570; - :b :c3571; - :b :c3572; - :b :c3573; - :b :c3574; - :b :c3575; - :b :c3576; - :b :c3577; - :b :c3578; - :b :c3579; - :b :c3580; - :b :c3581; - :b :c3582; - :b :c3583; - :b :c3584; - :b :c3585; - :b :c3586; - :b :c3587; - :b :c3588; - :b :c3589; - :b :c3590; - :b :c3591; - :b :c3592; - :b :c3593; - :b :c3594; - :b :c3595; - :b :c3596; - :b :c3597; - :b :c3598; - :b :c3599; - :b :c3600; - :b :c3601; - :b :c3602; - :b :c3603; - :b :c3604; - :b :c3605; - :b :c3606; - :b :c3607; - :b :c3608; - :b :c3609; - :b :c3610; - :b :c3611; - :b :c3612; - :b :c3613; - :b :c3614; - :b :c3615; - :b :c3616; - :b :c3617; - :b :c3618; - :b :c3619; - :b :c3620; - :b :c3621; - :b :c3622; - :b :c3623; - :b :c3624; - :b :c3625; - :b :c3626; - :b :c3627; - :b :c3628; - :b :c3629; - :b :c3630; - :b :c3631; - :b :c3632; - :b :c3633; - :b :c3634; - :b :c3635; - :b :c3636; - :b :c3637; - :b :c3638; - :b :c3639; - :b :c3640; - :b :c3641; - :b :c3642; - :b :c3643; - :b :c3644; - :b :c3645; - :b :c3646; - :b :c3647; - :b :c3648; - :b :c3649; - :b :c3650; - :b :c3651; - :b :c3652; - :b :c3653; - :b :c3654; - :b :c3655; - :b :c3656; - :b :c3657; - :b :c3658; - :b :c3659; - :b :c3660; - :b :c3661; - :b :c3662; - :b :c3663; - :b :c3664; - :b :c3665; - :b :c3666; - :b :c3667; - :b :c3668; - :b :c3669; - :b :c3670; - :b :c3671; - :b :c3672; - :b :c3673; - :b :c3674; - :b :c3675; - :b :c3676; - :b :c3677; - :b :c3678; - :b :c3679; - :b :c3680; - :b :c3681; - :b :c3682; - :b :c3683; - :b :c3684; - :b :c3685; - :b :c3686; - :b :c3687; - :b :c3688; - :b :c3689; - :b :c3690; - :b :c3691; - :b :c3692; - :b :c3693; - :b :c3694; - :b :c3695; - :b :c3696; - :b :c3697; - :b :c3698; - :b :c3699; - :b :c3700; - :b :c3701; - :b :c3702; - :b :c3703; - :b :c3704; - :b :c3705; - :b :c3706; - :b :c3707; - :b :c3708; - :b :c3709; - :b :c3710; - :b :c3711; - :b :c3712; - :b :c3713; - :b :c3714; - :b :c3715; - :b :c3716; - :b :c3717; - :b :c3718; - :b :c3719; - :b :c3720; - :b :c3721; - :b :c3722; - :b :c3723; - :b :c3724; - :b :c3725; - :b :c3726; - :b :c3727; - :b :c3728; - :b :c3729; - :b :c3730; - :b :c3731; - :b :c3732; - :b :c3733; - :b :c3734; - :b :c3735; - :b :c3736; - :b :c3737; - :b :c3738; - :b :c3739; - :b :c3740; - :b :c3741; - :b :c3742; - :b :c3743; - :b :c3744; - :b :c3745; - :b :c3746; - :b :c3747; - :b :c3748; - :b :c3749; - :b :c3750; - :b :c3751; - :b :c3752; - :b :c3753; - :b :c3754; - :b :c3755; - :b :c3756; - :b :c3757; - :b :c3758; - :b :c3759; - :b :c3760; - :b :c3761; - :b :c3762; - :b :c3763; - :b :c3764; - :b :c3765; - :b :c3766; - :b :c3767; - :b :c3768; - :b :c3769; - :b :c3770; - :b :c3771; - :b :c3772; - :b :c3773; - :b :c3774; - :b :c3775; - :b :c3776; - :b :c3777; - :b :c3778; - :b :c3779; - :b :c3780; - :b :c3781; - :b :c3782; - :b :c3783; - :b :c3784; - :b :c3785; - :b :c3786; - :b :c3787; - :b :c3788; - :b :c3789; - :b :c3790; - :b :c3791; - :b :c3792; - :b :c3793; - :b :c3794; - :b :c3795; - :b :c3796; - :b :c3797; - :b :c3798; - :b :c3799; - :b :c3800; - :b :c3801; - :b :c3802; - :b :c3803; - :b :c3804; - :b :c3805; - :b :c3806; - :b :c3807; - :b :c3808; - :b :c3809; - :b :c3810; - :b :c3811; - :b :c3812; - :b :c3813; - :b :c3814; - :b :c3815; - :b :c3816; - :b :c3817; - :b :c3818; - :b :c3819; - :b :c3820; - :b :c3821; - :b :c3822; - :b :c3823; - :b :c3824; - :b :c3825; - :b :c3826; - :b :c3827; - :b :c3828; - :b :c3829; - :b :c3830; - :b :c3831; - :b :c3832; - :b :c3833; - :b :c3834; - :b :c3835; - :b :c3836; - :b :c3837; - :b :c3838; - :b :c3839; - :b :c3840; - :b :c3841; - :b :c3842; - :b :c3843; - :b :c3844; - :b :c3845; - :b :c3846; - :b :c3847; - :b :c3848; - :b :c3849; - :b :c3850; - :b :c3851; - :b :c3852; - :b :c3853; - :b :c3854; - :b :c3855; - :b :c3856; - :b :c3857; - :b :c3858; - :b :c3859; - :b :c3860; - :b :c3861; - :b :c3862; - :b :c3863; - :b :c3864; - :b :c3865; - :b :c3866; - :b :c3867; - :b :c3868; - :b :c3869; - :b :c3870; - :b :c3871; - :b :c3872; - :b :c3873; - :b :c3874; - :b :c3875; - :b :c3876; - :b :c3877; - :b :c3878; - :b :c3879; - :b :c3880; - :b :c3881; - :b :c3882; - :b :c3883; - :b :c3884; - :b :c3885; - :b :c3886; - :b :c3887; - :b :c3888; - :b :c3889; - :b :c3890; - :b :c3891; - :b :c3892; - :b :c3893; - :b :c3894; - :b :c3895; - :b :c3896; - :b :c3897; - :b :c3898; - :b :c3899; - :b :c3900; - :b :c3901; - :b :c3902; - :b :c3903; - :b :c3904; - :b :c3905; - :b :c3906; - :b :c3907; - :b :c3908; - :b :c3909; - :b :c3910; - :b :c3911; - :b :c3912; - :b :c3913; - :b :c3914; - :b :c3915; - :b :c3916; - :b :c3917; - :b :c3918; - :b :c3919; - :b :c3920; - :b :c3921; - :b :c3922; - :b :c3923; - :b :c3924; - :b :c3925; - :b :c3926; - :b :c3927; - :b :c3928; - :b :c3929; - :b :c3930; - :b :c3931; - :b :c3932; - :b :c3933; - :b :c3934; - :b :c3935; - :b :c3936; - :b :c3937; - :b :c3938; - :b :c3939; - :b :c3940; - :b :c3941; - :b :c3942; - :b :c3943; - :b :c3944; - :b :c3945; - :b :c3946; - :b :c3947; - :b :c3948; - :b :c3949; - :b :c3950; - :b :c3951; - :b :c3952; - :b :c3953; - :b :c3954; - :b :c3955; - :b :c3956; - :b :c3957; - :b :c3958; - :b :c3959; - :b :c3960; - :b :c3961; - :b :c3962; - :b :c3963; - :b :c3964; - :b :c3965; - :b :c3966; - :b :c3967; - :b :c3968; - :b :c3969; - :b :c3970; - :b :c3971; - :b :c3972; - :b :c3973; - :b :c3974; - :b :c3975; - :b :c3976; - :b :c3977; - :b :c3978; - :b :c3979; - :b :c3980; - :b :c3981; - :b :c3982; - :b :c3983; - :b :c3984; - :b :c3985; - :b :c3986; - :b :c3987; - :b :c3988; - :b :c3989; - :b :c3990; - :b :c3991; - :b :c3992; - :b :c3993; - :b :c3994; - :b :c3995; - :b :c3996; - :b :c3997; - :b :c3998; - :b :c3999; - :b :c4000; - :b :c4001; - :b :c4002; - :b :c4003; - :b :c4004; - :b :c4005; - :b :c4006; - :b :c4007; - :b :c4008; - :b :c4009; - :b :c4010; - :b :c4011; - :b :c4012; - :b :c4013; - :b :c4014; - :b :c4015; - :b :c4016; - :b :c4017; - :b :c4018; - :b :c4019; - :b :c4020; - :b :c4021; - :b :c4022; - :b :c4023; - :b :c4024; - :b :c4025; - :b :c4026; - :b :c4027; - :b :c4028; - :b :c4029; - :b :c4030; - :b :c4031; - :b :c4032; - :b :c4033; - :b :c4034; - :b :c4035; - :b :c4036; - :b :c4037; - :b :c4038; - :b :c4039; - :b :c4040; - :b :c4041; - :b :c4042; - :b :c4043; - :b :c4044; - :b :c4045; - :b :c4046; - :b :c4047; - :b :c4048; - :b :c4049; - :b :c4050; - :b :c4051; - :b :c4052; - :b :c4053; - :b :c4054; - :b :c4055; - :b :c4056; - :b :c4057; - :b :c4058; - :b :c4059; - :b :c4060; - :b :c4061; - :b :c4062; - :b :c4063; - :b :c4064; - :b :c4065; - :b :c4066; - :b :c4067; - :b :c4068; - :b :c4069; - :b :c4070; - :b :c4071; - :b :c4072; - :b :c4073; - :b :c4074; - :b :c4075; - :b :c4076; - :b :c4077; - :b :c4078; - :b :c4079; - :b :c4080; - :b :c4081; - :b :c4082; - :b :c4083; - :b :c4084; - :b :c4085; - :b :c4086; - :b :c4087; - :b :c4088; - :b :c4089; - :b :c4090; - :b :c4091; - :b :c4092; - :b :c4093; - :b :c4094; - :b :c4095; - :b :c4096; - :b :c4097; - :b :c4098; - :b :c4099; - :b :c4100; - :b :c4101; - :b :c4102; - :b :c4103; - :b :c4104; - :b :c4105; - :b :c4106; - :b :c4107; - :b :c4108; - :b :c4109; - :b :c4110; - :b :c4111; - :b :c4112; - :b :c4113; - :b :c4114; - :b :c4115; - :b :c4116; - :b :c4117; - :b :c4118; - :b :c4119; - :b :c4120; - :b :c4121; - :b :c4122; - :b :c4123; - :b :c4124; - :b :c4125; - :b :c4126; - :b :c4127; - :b :c4128; - :b :c4129; - :b :c4130; - :b :c4131; - :b :c4132; - :b :c4133; - :b :c4134; - :b :c4135; - :b :c4136; - :b :c4137; - :b :c4138; - :b :c4139; - :b :c4140; - :b :c4141; - :b :c4142; - :b :c4143; - :b :c4144; - :b :c4145; - :b :c4146; - :b :c4147; - :b :c4148; - :b :c4149; - :b :c4150; - :b :c4151; - :b :c4152; - :b :c4153; - :b :c4154; - :b :c4155; - :b :c4156; - :b :c4157; - :b :c4158; - :b :c4159; - :b :c4160; - :b :c4161; - :b :c4162; - :b :c4163; - :b :c4164; - :b :c4165; - :b :c4166; - :b :c4167; - :b :c4168; - :b :c4169; - :b :c4170; - :b :c4171; - :b :c4172; - :b :c4173; - :b :c4174; - :b :c4175; - :b :c4176; - :b :c4177; - :b :c4178; - :b :c4179; - :b :c4180; - :b :c4181; - :b :c4182; - :b :c4183; - :b :c4184; - :b :c4185; - :b :c4186; - :b :c4187; - :b :c4188; - :b :c4189; - :b :c4190; - :b :c4191; - :b :c4192; - :b :c4193; - :b :c4194; - :b :c4195; - :b :c4196; - :b :c4197; - :b :c4198; - :b :c4199; - :b :c4200; - :b :c4201; - :b :c4202; - :b :c4203; - :b :c4204; - :b :c4205; - :b :c4206; - :b :c4207; - :b :c4208; - :b :c4209; - :b :c4210; - :b :c4211; - :b :c4212; - :b :c4213; - :b :c4214; - :b :c4215; - :b :c4216; - :b :c4217; - :b :c4218; - :b :c4219; - :b :c4220; - :b :c4221; - :b :c4222; - :b :c4223; - :b :c4224; - :b :c4225; - :b :c4226; - :b :c4227; - :b :c4228; - :b :c4229; - :b :c4230; - :b :c4231; - :b :c4232; - :b :c4233; - :b :c4234; - :b :c4235; - :b :c4236; - :b :c4237; - :b :c4238; - :b :c4239; - :b :c4240; - :b :c4241; - :b :c4242; - :b :c4243; - :b :c4244; - :b :c4245; - :b :c4246; - :b :c4247; - :b :c4248; - :b :c4249; - :b :c4250; - :b :c4251; - :b :c4252; - :b :c4253; - :b :c4254; - :b :c4255; - :b :c4256; - :b :c4257; - :b :c4258; - :b :c4259; - :b :c4260; - :b :c4261; - :b :c4262; - :b :c4263; - :b :c4264; - :b :c4265; - :b :c4266; - :b :c4267; - :b :c4268; - :b :c4269; - :b :c4270; - :b :c4271; - :b :c4272; - :b :c4273; - :b :c4274; - :b :c4275; - :b :c4276; - :b :c4277; - :b :c4278; - :b :c4279; - :b :c4280; - :b :c4281; - :b :c4282; - :b :c4283; - :b :c4284; - :b :c4285; - :b :c4286; - :b :c4287; - :b :c4288; - :b :c4289; - :b :c4290; - :b :c4291; - :b :c4292; - :b :c4293; - :b :c4294; - :b :c4295; - :b :c4296; - :b :c4297; - :b :c4298; - :b :c4299; - :b :c4300; - :b :c4301; - :b :c4302; - :b :c4303; - :b :c4304; - :b :c4305; - :b :c4306; - :b :c4307; - :b :c4308; - :b :c4309; - :b :c4310; - :b :c4311; - :b :c4312; - :b :c4313; - :b :c4314; - :b :c4315; - :b :c4316; - :b :c4317; - :b :c4318; - :b :c4319; - :b :c4320; - :b :c4321; - :b :c4322; - :b :c4323; - :b :c4324; - :b :c4325; - :b :c4326; - :b :c4327; - :b :c4328; - :b :c4329; - :b :c4330; - :b :c4331; - :b :c4332; - :b :c4333; - :b :c4334; - :b :c4335; - :b :c4336; - :b :c4337; - :b :c4338; - :b :c4339; - :b :c4340; - :b :c4341; - :b :c4342; - :b :c4343; - :b :c4344; - :b :c4345; - :b :c4346; - :b :c4347; - :b :c4348; - :b :c4349; - :b :c4350; - :b :c4351; - :b :c4352; - :b :c4353; - :b :c4354; - :b :c4355; - :b :c4356; - :b :c4357; - :b :c4358; - :b :c4359; - :b :c4360; - :b :c4361; - :b :c4362; - :b :c4363; - :b :c4364; - :b :c4365; - :b :c4366; - :b :c4367; - :b :c4368; - :b :c4369; - :b :c4370; - :b :c4371; - :b :c4372; - :b :c4373; - :b :c4374; - :b :c4375; - :b :c4376; - :b :c4377; - :b :c4378; - :b :c4379; - :b :c4380; - :b :c4381; - :b :c4382; - :b :c4383; - :b :c4384; - :b :c4385; - :b :c4386; - :b :c4387; - :b :c4388; - :b :c4389; - :b :c4390; - :b :c4391; - :b :c4392; - :b :c4393; - :b :c4394; - :b :c4395; - :b :c4396; - :b :c4397; - :b :c4398; - :b :c4399; - :b :c4400; - :b :c4401; - :b :c4402; - :b :c4403; - :b :c4404; - :b :c4405; - :b :c4406; - :b :c4407; - :b :c4408; - :b :c4409; - :b :c4410; - :b :c4411; - :b :c4412; - :b :c4413; - :b :c4414; - :b :c4415; - :b :c4416; - :b :c4417; - :b :c4418; - :b :c4419; - :b :c4420; - :b :c4421; - :b :c4422; - :b :c4423; - :b :c4424; - :b :c4425; - :b :c4426; - :b :c4427; - :b :c4428; - :b :c4429; - :b :c4430; - :b :c4431; - :b :c4432; - :b :c4433; - :b :c4434; - :b :c4435; - :b :c4436; - :b :c4437; - :b :c4438; - :b :c4439; - :b :c4440; - :b :c4441; - :b :c4442; - :b :c4443; - :b :c4444; - :b :c4445; - :b :c4446; - :b :c4447; - :b :c4448; - :b :c4449; - :b :c4450; - :b :c4451; - :b :c4452; - :b :c4453; - :b :c4454; - :b :c4455; - :b :c4456; - :b :c4457; - :b :c4458; - :b :c4459; - :b :c4460; - :b :c4461; - :b :c4462; - :b :c4463; - :b :c4464; - :b :c4465; - :b :c4466; - :b :c4467; - :b :c4468; - :b :c4469; - :b :c4470; - :b :c4471; - :b :c4472; - :b :c4473; - :b :c4474; - :b :c4475; - :b :c4476; - :b :c4477; - :b :c4478; - :b :c4479; - :b :c4480; - :b :c4481; - :b :c4482; - :b :c4483; - :b :c4484; - :b :c4485; - :b :c4486; - :b :c4487; - :b :c4488; - :b :c4489; - :b :c4490; - :b :c4491; - :b :c4492; - :b :c4493; - :b :c4494; - :b :c4495; - :b :c4496; - :b :c4497; - :b :c4498; - :b :c4499; - :b :c4500; - :b :c4501; - :b :c4502; - :b :c4503; - :b :c4504; - :b :c4505; - :b :c4506; - :b :c4507; - :b :c4508; - :b :c4509; - :b :c4510; - :b :c4511; - :b :c4512; - :b :c4513; - :b :c4514; - :b :c4515; - :b :c4516; - :b :c4517; - :b :c4518; - :b :c4519; - :b :c4520; - :b :c4521; - :b :c4522; - :b :c4523; - :b :c4524; - :b :c4525; - :b :c4526; - :b :c4527; - :b :c4528; - :b :c4529; - :b :c4530; - :b :c4531; - :b :c4532; - :b :c4533; - :b :c4534; - :b :c4535; - :b :c4536; - :b :c4537; - :b :c4538; - :b :c4539; - :b :c4540; - :b :c4541; - :b :c4542; - :b :c4543; - :b :c4544; - :b :c4545; - :b :c4546; - :b :c4547; - :b :c4548; - :b :c4549; - :b :c4550; - :b :c4551; - :b :c4552; - :b :c4553; - :b :c4554; - :b :c4555; - :b :c4556; - :b :c4557; - :b :c4558; - :b :c4559; - :b :c4560; - :b :c4561; - :b :c4562; - :b :c4563; - :b :c4564; - :b :c4565; - :b :c4566; - :b :c4567; - :b :c4568; - :b :c4569; - :b :c4570; - :b :c4571; - :b :c4572; - :b :c4573; - :b :c4574; - :b :c4575; - :b :c4576; - :b :c4577; - :b :c4578; - :b :c4579; - :b :c4580; - :b :c4581; - :b :c4582; - :b :c4583; - :b :c4584; - :b :c4585; - :b :c4586; - :b :c4587; - :b :c4588; - :b :c4589; - :b :c4590; - :b :c4591; - :b :c4592; - :b :c4593; - :b :c4594; - :b :c4595; - :b :c4596; - :b :c4597; - :b :c4598; - :b :c4599; - :b :c4600; - :b :c4601; - :b :c4602; - :b :c4603; - :b :c4604; - :b :c4605; - :b :c4606; - :b :c4607; - :b :c4608; - :b :c4609; - :b :c4610; - :b :c4611; - :b :c4612; - :b :c4613; - :b :c4614; - :b :c4615; - :b :c4616; - :b :c4617; - :b :c4618; - :b :c4619; - :b :c4620; - :b :c4621; - :b :c4622; - :b :c4623; - :b :c4624; - :b :c4625; - :b :c4626; - :b :c4627; - :b :c4628; - :b :c4629; - :b :c4630; - :b :c4631; - :b :c4632; - :b :c4633; - :b :c4634; - :b :c4635; - :b :c4636; - :b :c4637; - :b :c4638; - :b :c4639; - :b :c4640; - :b :c4641; - :b :c4642; - :b :c4643; - :b :c4644; - :b :c4645; - :b :c4646; - :b :c4647; - :b :c4648; - :b :c4649; - :b :c4650; - :b :c4651; - :b :c4652; - :b :c4653; - :b :c4654; - :b :c4655; - :b :c4656; - :b :c4657; - :b :c4658; - :b :c4659; - :b :c4660; - :b :c4661; - :b :c4662; - :b :c4663; - :b :c4664; - :b :c4665; - :b :c4666; - :b :c4667; - :b :c4668; - :b :c4669; - :b :c4670; - :b :c4671; - :b :c4672; - :b :c4673; - :b :c4674; - :b :c4675; - :b :c4676; - :b :c4677; - :b :c4678; - :b :c4679; - :b :c4680; - :b :c4681; - :b :c4682; - :b :c4683; - :b :c4684; - :b :c4685; - :b :c4686; - :b :c4687; - :b :c4688; - :b :c4689; - :b :c4690; - :b :c4691; - :b :c4692; - :b :c4693; - :b :c4694; - :b :c4695; - :b :c4696; - :b :c4697; - :b :c4698; - :b :c4699; - :b :c4700; - :b :c4701; - :b :c4702; - :b :c4703; - :b :c4704; - :b :c4705; - :b :c4706; - :b :c4707; - :b :c4708; - :b :c4709; - :b :c4710; - :b :c4711; - :b :c4712; - :b :c4713; - :b :c4714; - :b :c4715; - :b :c4716; - :b :c4717; - :b :c4718; - :b :c4719; - :b :c4720; - :b :c4721; - :b :c4722; - :b :c4723; - :b :c4724; - :b :c4725; - :b :c4726; - :b :c4727; - :b :c4728; - :b :c4729; - :b :c4730; - :b :c4731; - :b :c4732; - :b :c4733; - :b :c4734; - :b :c4735; - :b :c4736; - :b :c4737; - :b :c4738; - :b :c4739; - :b :c4740; - :b :c4741; - :b :c4742; - :b :c4743; - :b :c4744; - :b :c4745; - :b :c4746; - :b :c4747; - :b :c4748; - :b :c4749; - :b :c4750; - :b :c4751; - :b :c4752; - :b :c4753; - :b :c4754; - :b :c4755; - :b :c4756; - :b :c4757; - :b :c4758; - :b :c4759; - :b :c4760; - :b :c4761; - :b :c4762; - :b :c4763; - :b :c4764; - :b :c4765; - :b :c4766; - :b :c4767; - :b :c4768; - :b :c4769; - :b :c4770; - :b :c4771; - :b :c4772; - :b :c4773; - :b :c4774; - :b :c4775; - :b :c4776; - :b :c4777; - :b :c4778; - :b :c4779; - :b :c4780; - :b :c4781; - :b :c4782; - :b :c4783; - :b :c4784; - :b :c4785; - :b :c4786; - :b :c4787; - :b :c4788; - :b :c4789; - :b :c4790; - :b :c4791; - :b :c4792; - :b :c4793; - :b :c4794; - :b :c4795; - :b :c4796; - :b :c4797; - :b :c4798; - :b :c4799; - :b :c4800; - :b :c4801; - :b :c4802; - :b :c4803; - :b :c4804; - :b :c4805; - :b :c4806; - :b :c4807; - :b :c4808; - :b :c4809; - :b :c4810; - :b :c4811; - :b :c4812; - :b :c4813; - :b :c4814; - :b :c4815; - :b :c4816; - :b :c4817; - :b :c4818; - :b :c4819; - :b :c4820; - :b :c4821; - :b :c4822; - :b :c4823; - :b :c4824; - :b :c4825; - :b :c4826; - :b :c4827; - :b :c4828; - :b :c4829; - :b :c4830; - :b :c4831; - :b :c4832; - :b :c4833; - :b :c4834; - :b :c4835; - :b :c4836; - :b :c4837; - :b :c4838; - :b :c4839; - :b :c4840; - :b :c4841; - :b :c4842; - :b :c4843; - :b :c4844; - :b :c4845; - :b :c4846; - :b :c4847; - :b :c4848; - :b :c4849; - :b :c4850; - :b :c4851; - :b :c4852; - :b :c4853; - :b :c4854; - :b :c4855; - :b :c4856; - :b :c4857; - :b :c4858; - :b :c4859; - :b :c4860; - :b :c4861; - :b :c4862; - :b :c4863; - :b :c4864; - :b :c4865; - :b :c4866; - :b :c4867; - :b :c4868; - :b :c4869; - :b :c4870; - :b :c4871; - :b :c4872; - :b :c4873; - :b :c4874; - :b :c4875; - :b :c4876; - :b :c4877; - :b :c4878; - :b :c4879; - :b :c4880; - :b :c4881; - :b :c4882; - :b :c4883; - :b :c4884; - :b :c4885; - :b :c4886; - :b :c4887; - :b :c4888; - :b :c4889; - :b :c4890; - :b :c4891; - :b :c4892; - :b :c4893; - :b :c4894; - :b :c4895; - :b :c4896; - :b :c4897; - :b :c4898; - :b :c4899; - :b :c4900; - :b :c4901; - :b :c4902; - :b :c4903; - :b :c4904; - :b :c4905; - :b :c4906; - :b :c4907; - :b :c4908; - :b :c4909; - :b :c4910; - :b :c4911; - :b :c4912; - :b :c4913; - :b :c4914; - :b :c4915; - :b :c4916; - :b :c4917; - :b :c4918; - :b :c4919; - :b :c4920; - :b :c4921; - :b :c4922; - :b :c4923; - :b :c4924; - :b :c4925; - :b :c4926; - :b :c4927; - :b :c4928; - :b :c4929; - :b :c4930; - :b :c4931; - :b :c4932; - :b :c4933; - :b :c4934; - :b :c4935; - :b :c4936; - :b :c4937; - :b :c4938; - :b :c4939; - :b :c4940; - :b :c4941; - :b :c4942; - :b :c4943; - :b :c4944; - :b :c4945; - :b :c4946; - :b :c4947; - :b :c4948; - :b :c4949; - :b :c4950; - :b :c4951; - :b :c4952; - :b :c4953; - :b :c4954; - :b :c4955; - :b :c4956; - :b :c4957; - :b :c4958; - :b :c4959; - :b :c4960; - :b :c4961; - :b :c4962; - :b :c4963; - :b :c4964; - :b :c4965; - :b :c4966; - :b :c4967; - :b :c4968; - :b :c4969; - :b :c4970; - :b :c4971; - :b :c4972; - :b :c4973; - :b :c4974; - :b :c4975; - :b :c4976; - :b :c4977; - :b :c4978; - :b :c4979; - :b :c4980; - :b :c4981; - :b :c4982; - :b :c4983; - :b :c4984; - :b :c4985; - :b :c4986; - :b :c4987; - :b :c4988; - :b :c4989; - :b :c4990; - :b :c4991; - :b :c4992; - :b :c4993; - :b :c4994; - :b :c4995; - :b :c4996; - :b :c4997; - :b :c4998; - :b :c4999; - :b :c5000; - :b :c5001; - :b :c5002; - :b :c5003; - :b :c5004; - :b :c5005; - :b :c5006; - :b :c5007; - :b :c5008; - :b :c5009; - :b :c5010; - :b :c5011; - :b :c5012; - :b :c5013; - :b :c5014; - :b :c5015; - :b :c5016; - :b :c5017; - :b :c5018; - :b :c5019; - :b :c5020; - :b :c5021; - :b :c5022; - :b :c5023; - :b :c5024; - :b :c5025; - :b :c5026; - :b :c5027; - :b :c5028; - :b :c5029; - :b :c5030; - :b :c5031; - :b :c5032; - :b :c5033; - :b :c5034; - :b :c5035; - :b :c5036; - :b :c5037; - :b :c5038; - :b :c5039; - :b :c5040; - :b :c5041; - :b :c5042; - :b :c5043; - :b :c5044; - :b :c5045; - :b :c5046; - :b :c5047; - :b :c5048; - :b :c5049; - :b :c5050; - :b :c5051; - :b :c5052; - :b :c5053; - :b :c5054; - :b :c5055; - :b :c5056; - :b :c5057; - :b :c5058; - :b :c5059; - :b :c5060; - :b :c5061; - :b :c5062; - :b :c5063; - :b :c5064; - :b :c5065; - :b :c5066; - :b :c5067; - :b :c5068; - :b :c5069; - :b :c5070; - :b :c5071; - :b :c5072; - :b :c5073; - :b :c5074; - :b :c5075; - :b :c5076; - :b :c5077; - :b :c5078; - :b :c5079; - :b :c5080; - :b :c5081; - :b :c5082; - :b :c5083; - :b :c5084; - :b :c5085; - :b :c5086; - :b :c5087; - :b :c5088; - :b :c5089; - :b :c5090; - :b :c5091; - :b :c5092; - :b :c5093; - :b :c5094; - :b :c5095; - :b :c5096; - :b :c5097; - :b :c5098; - :b :c5099; - :b :c5100; - :b :c5101; - :b :c5102; - :b :c5103; - :b :c5104; - :b :c5105; - :b :c5106; - :b :c5107; - :b :c5108; - :b :c5109; - :b :c5110; - :b :c5111; - :b :c5112; - :b :c5113; - :b :c5114; - :b :c5115; - :b :c5116; - :b :c5117; - :b :c5118; - :b :c5119; - :b :c5120; - :b :c5121; - :b :c5122; - :b :c5123; - :b :c5124; - :b :c5125; - :b :c5126; - :b :c5127; - :b :c5128; - :b :c5129; - :b :c5130; - :b :c5131; - :b :c5132; - :b :c5133; - :b :c5134; - :b :c5135; - :b :c5136; - :b :c5137; - :b :c5138; - :b :c5139; - :b :c5140; - :b :c5141; - :b :c5142; - :b :c5143; - :b :c5144; - :b :c5145; - :b :c5146; - :b :c5147; - :b :c5148; - :b :c5149; - :b :c5150; - :b :c5151; - :b :c5152; - :b :c5153; - :b :c5154; - :b :c5155; - :b :c5156; - :b :c5157; - :b :c5158; - :b :c5159; - :b :c5160; - :b :c5161; - :b :c5162; - :b :c5163; - :b :c5164; - :b :c5165; - :b :c5166; - :b :c5167; - :b :c5168; - :b :c5169; - :b :c5170; - :b :c5171; - :b :c5172; - :b :c5173; - :b :c5174; - :b :c5175; - :b :c5176; - :b :c5177; - :b :c5178; - :b :c5179; - :b :c5180; - :b :c5181; - :b :c5182; - :b :c5183; - :b :c5184; - :b :c5185; - :b :c5186; - :b :c5187; - :b :c5188; - :b :c5189; - :b :c5190; - :b :c5191; - :b :c5192; - :b :c5193; - :b :c5194; - :b :c5195; - :b :c5196; - :b :c5197; - :b :c5198; - :b :c5199; - :b :c5200; - :b :c5201; - :b :c5202; - :b :c5203; - :b :c5204; - :b :c5205; - :b :c5206; - :b :c5207; - :b :c5208; - :b :c5209; - :b :c5210; - :b :c5211; - :b :c5212; - :b :c5213; - :b :c5214; - :b :c5215; - :b :c5216; - :b :c5217; - :b :c5218; - :b :c5219; - :b :c5220; - :b :c5221; - :b :c5222; - :b :c5223; - :b :c5224; - :b :c5225; - :b :c5226; - :b :c5227; - :b :c5228; - :b :c5229; - :b :c5230; - :b :c5231; - :b :c5232; - :b :c5233; - :b :c5234; - :b :c5235; - :b :c5236; - :b :c5237; - :b :c5238; - :b :c5239; - :b :c5240; - :b :c5241; - :b :c5242; - :b :c5243; - :b :c5244; - :b :c5245; - :b :c5246; - :b :c5247; - :b :c5248; - :b :c5249; - :b :c5250; - :b :c5251; - :b :c5252; - :b :c5253; - :b :c5254; - :b :c5255; - :b :c5256; - :b :c5257; - :b :c5258; - :b :c5259; - :b :c5260; - :b :c5261; - :b :c5262; - :b :c5263; - :b :c5264; - :b :c5265; - :b :c5266; - :b :c5267; - :b :c5268; - :b :c5269; - :b :c5270; - :b :c5271; - :b :c5272; - :b :c5273; - :b :c5274; - :b :c5275; - :b :c5276; - :b :c5277; - :b :c5278; - :b :c5279; - :b :c5280; - :b :c5281; - :b :c5282; - :b :c5283; - :b :c5284; - :b :c5285; - :b :c5286; - :b :c5287; - :b :c5288; - :b :c5289; - :b :c5290; - :b :c5291; - :b :c5292; - :b :c5293; - :b :c5294; - :b :c5295; - :b :c5296; - :b :c5297; - :b :c5298; - :b :c5299; - :b :c5300; - :b :c5301; - :b :c5302; - :b :c5303; - :b :c5304; - :b :c5305; - :b :c5306; - :b :c5307; - :b :c5308; - :b :c5309; - :b :c5310; - :b :c5311; - :b :c5312; - :b :c5313; - :b :c5314; - :b :c5315; - :b :c5316; - :b :c5317; - :b :c5318; - :b :c5319; - :b :c5320; - :b :c5321; - :b :c5322; - :b :c5323; - :b :c5324; - :b :c5325; - :b :c5326; - :b :c5327; - :b :c5328; - :b :c5329; - :b :c5330; - :b :c5331; - :b :c5332; - :b :c5333; - :b :c5334; - :b :c5335; - :b :c5336; - :b :c5337; - :b :c5338; - :b :c5339; - :b :c5340; - :b :c5341; - :b :c5342; - :b :c5343; - :b :c5344; - :b :c5345; - :b :c5346; - :b :c5347; - :b :c5348; - :b :c5349; - :b :c5350; - :b :c5351; - :b :c5352; - :b :c5353; - :b :c5354; - :b :c5355; - :b :c5356; - :b :c5357; - :b :c5358; - :b :c5359; - :b :c5360; - :b :c5361; - :b :c5362; - :b :c5363; - :b :c5364; - :b :c5365; - :b :c5366; - :b :c5367; - :b :c5368; - :b :c5369; - :b :c5370; - :b :c5371; - :b :c5372; - :b :c5373; - :b :c5374; - :b :c5375; - :b :c5376; - :b :c5377; - :b :c5378; - :b :c5379; - :b :c5380; - :b :c5381; - :b :c5382; - :b :c5383; - :b :c5384; - :b :c5385; - :b :c5386; - :b :c5387; - :b :c5388; - :b :c5389; - :b :c5390; - :b :c5391; - :b :c5392; - :b :c5393; - :b :c5394; - :b :c5395; - :b :c5396; - :b :c5397; - :b :c5398; - :b :c5399; - :b :c5400; - :b :c5401; - :b :c5402; - :b :c5403; - :b :c5404; - :b :c5405; - :b :c5406; - :b :c5407; - :b :c5408; - :b :c5409; - :b :c5410; - :b :c5411; - :b :c5412; - :b :c5413; - :b :c5414; - :b :c5415; - :b :c5416; - :b :c5417; - :b :c5418; - :b :c5419; - :b :c5420; - :b :c5421; - :b :c5422; - :b :c5423; - :b :c5424; - :b :c5425; - :b :c5426; - :b :c5427; - :b :c5428; - :b :c5429; - :b :c5430; - :b :c5431; - :b :c5432; - :b :c5433; - :b :c5434; - :b :c5435; - :b :c5436; - :b :c5437; - :b :c5438; - :b :c5439; - :b :c5440; - :b :c5441; - :b :c5442; - :b :c5443; - :b :c5444; - :b :c5445; - :b :c5446; - :b :c5447; - :b :c5448; - :b :c5449; - :b :c5450; - :b :c5451; - :b :c5452; - :b :c5453; - :b :c5454; - :b :c5455; - :b :c5456; - :b :c5457; - :b :c5458; - :b :c5459; - :b :c5460; - :b :c5461; - :b :c5462; - :b :c5463; - :b :c5464; - :b :c5465; - :b :c5466; - :b :c5467; - :b :c5468; - :b :c5469; - :b :c5470; - :b :c5471; - :b :c5472; - :b :c5473; - :b :c5474; - :b :c5475; - :b :c5476; - :b :c5477; - :b :c5478; - :b :c5479; - :b :c5480; - :b :c5481; - :b :c5482; - :b :c5483; - :b :c5484; - :b :c5485; - :b :c5486; - :b :c5487; - :b :c5488; - :b :c5489; - :b :c5490; - :b :c5491; - :b :c5492; - :b :c5493; - :b :c5494; - :b :c5495; - :b :c5496; - :b :c5497; - :b :c5498; - :b :c5499; - :b :c5500; - :b :c5501; - :b :c5502; - :b :c5503; - :b :c5504; - :b :c5505; - :b :c5506; - :b :c5507; - :b :c5508; - :b :c5509; - :b :c5510; - :b :c5511; - :b :c5512; - :b :c5513; - :b :c5514; - :b :c5515; - :b :c5516; - :b :c5517; - :b :c5518; - :b :c5519; - :b :c5520; - :b :c5521; - :b :c5522; - :b :c5523; - :b :c5524; - :b :c5525; - :b :c5526; - :b :c5527; - :b :c5528; - :b :c5529; - :b :c5530; - :b :c5531; - :b :c5532; - :b :c5533; - :b :c5534; - :b :c5535; - :b :c5536; - :b :c5537; - :b :c5538; - :b :c5539; - :b :c5540; - :b :c5541; - :b :c5542; - :b :c5543; - :b :c5544; - :b :c5545; - :b :c5546; - :b :c5547; - :b :c5548; - :b :c5549; - :b :c5550; - :b :c5551; - :b :c5552; - :b :c5553; - :b :c5554; - :b :c5555; - :b :c5556; - :b :c5557; - :b :c5558; - :b :c5559; - :b :c5560; - :b :c5561; - :b :c5562; - :b :c5563; - :b :c5564; - :b :c5565; - :b :c5566; - :b :c5567; - :b :c5568; - :b :c5569; - :b :c5570; - :b :c5571; - :b :c5572; - :b :c5573; - :b :c5574; - :b :c5575; - :b :c5576; - :b :c5577; - :b :c5578; - :b :c5579; - :b :c5580; - :b :c5581; - :b :c5582; - :b :c5583; - :b :c5584; - :b :c5585; - :b :c5586; - :b :c5587; - :b :c5588; - :b :c5589; - :b :c5590; - :b :c5591; - :b :c5592; - :b :c5593; - :b :c5594; - :b :c5595; - :b :c5596; - :b :c5597; - :b :c5598; - :b :c5599; - :b :c5600; - :b :c5601; - :b :c5602; - :b :c5603; - :b :c5604; - :b :c5605; - :b :c5606; - :b :c5607; - :b :c5608; - :b :c5609; - :b :c5610; - :b :c5611; - :b :c5612; - :b :c5613; - :b :c5614; - :b :c5615; - :b :c5616; - :b :c5617; - :b :c5618; - :b :c5619; - :b :c5620; - :b :c5621; - :b :c5622; - :b :c5623; - :b :c5624; - :b :c5625; - :b :c5626; - :b :c5627; - :b :c5628; - :b :c5629; - :b :c5630; - :b :c5631; - :b :c5632; - :b :c5633; - :b :c5634; - :b :c5635; - :b :c5636; - :b :c5637; - :b :c5638; - :b :c5639; - :b :c5640; - :b :c5641; - :b :c5642; - :b :c5643; - :b :c5644; - :b :c5645; - :b :c5646; - :b :c5647; - :b :c5648; - :b :c5649; - :b :c5650; - :b :c5651; - :b :c5652; - :b :c5653; - :b :c5654; - :b :c5655; - :b :c5656; - :b :c5657; - :b :c5658; - :b :c5659; - :b :c5660; - :b :c5661; - :b :c5662; - :b :c5663; - :b :c5664; - :b :c5665; - :b :c5666; - :b :c5667; - :b :c5668; - :b :c5669; - :b :c5670; - :b :c5671; - :b :c5672; - :b :c5673; - :b :c5674; - :b :c5675; - :b :c5676; - :b :c5677; - :b :c5678; - :b :c5679; - :b :c5680; - :b :c5681; - :b :c5682; - :b :c5683; - :b :c5684; - :b :c5685; - :b :c5686; - :b :c5687; - :b :c5688; - :b :c5689; - :b :c5690; - :b :c5691; - :b :c5692; - :b :c5693; - :b :c5694; - :b :c5695; - :b :c5696; - :b :c5697; - :b :c5698; - :b :c5699; - :b :c5700; - :b :c5701; - :b :c5702; - :b :c5703; - :b :c5704; - :b :c5705; - :b :c5706; - :b :c5707; - :b :c5708; - :b :c5709; - :b :c5710; - :b :c5711; - :b :c5712; - :b :c5713; - :b :c5714; - :b :c5715; - :b :c5716; - :b :c5717; - :b :c5718; - :b :c5719; - :b :c5720; - :b :c5721; - :b :c5722; - :b :c5723; - :b :c5724; - :b :c5725; - :b :c5726; - :b :c5727; - :b :c5728; - :b :c5729; - :b :c5730; - :b :c5731; - :b :c5732; - :b :c5733; - :b :c5734; - :b :c5735; - :b :c5736; - :b :c5737; - :b :c5738; - :b :c5739; - :b :c5740; - :b :c5741; - :b :c5742; - :b :c5743; - :b :c5744; - :b :c5745; - :b :c5746; - :b :c5747; - :b :c5748; - :b :c5749; - :b :c5750; - :b :c5751; - :b :c5752; - :b :c5753; - :b :c5754; - :b :c5755; - :b :c5756; - :b :c5757; - :b :c5758; - :b :c5759; - :b :c5760; - :b :c5761; - :b :c5762; - :b :c5763; - :b :c5764; - :b :c5765; - :b :c5766; - :b :c5767; - :b :c5768; - :b :c5769; - :b :c5770; - :b :c5771; - :b :c5772; - :b :c5773; - :b :c5774; - :b :c5775; - :b :c5776; - :b :c5777; - :b :c5778; - :b :c5779; - :b :c5780; - :b :c5781; - :b :c5782; - :b :c5783; - :b :c5784; - :b :c5785; - :b :c5786; - :b :c5787; - :b :c5788; - :b :c5789; - :b :c5790; - :b :c5791; - :b :c5792; - :b :c5793; - :b :c5794; - :b :c5795; - :b :c5796; - :b :c5797; - :b :c5798; - :b :c5799; - :b :c5800; - :b :c5801; - :b :c5802; - :b :c5803; - :b :c5804; - :b :c5805; - :b :c5806; - :b :c5807; - :b :c5808; - :b :c5809; - :b :c5810; - :b :c5811; - :b :c5812; - :b :c5813; - :b :c5814; - :b :c5815; - :b :c5816; - :b :c5817; - :b :c5818; - :b :c5819; - :b :c5820; - :b :c5821; - :b :c5822; - :b :c5823; - :b :c5824; - :b :c5825; - :b :c5826; - :b :c5827; - :b :c5828; - :b :c5829; - :b :c5830; - :b :c5831; - :b :c5832; - :b :c5833; - :b :c5834; - :b :c5835; - :b :c5836; - :b :c5837; - :b :c5838; - :b :c5839; - :b :c5840; - :b :c5841; - :b :c5842; - :b :c5843; - :b :c5844; - :b :c5845; - :b :c5846; - :b :c5847; - :b :c5848; - :b :c5849; - :b :c5850; - :b :c5851; - :b :c5852; - :b :c5853; - :b :c5854; - :b :c5855; - :b :c5856; - :b :c5857; - :b :c5858; - :b :c5859; - :b :c5860; - :b :c5861; - :b :c5862; - :b :c5863; - :b :c5864; - :b :c5865; - :b :c5866; - :b :c5867; - :b :c5868; - :b :c5869; - :b :c5870; - :b :c5871; - :b :c5872; - :b :c5873; - :b :c5874; - :b :c5875; - :b :c5876; - :b :c5877; - :b :c5878; - :b :c5879; - :b :c5880; - :b :c5881; - :b :c5882; - :b :c5883; - :b :c5884; - :b :c5885; - :b :c5886; - :b :c5887; - :b :c5888; - :b :c5889; - :b :c5890; - :b :c5891; - :b :c5892; - :b :c5893; - :b :c5894; - :b :c5895; - :b :c5896; - :b :c5897; - :b :c5898; - :b :c5899; - :b :c5900; - :b :c5901; - :b :c5902; - :b :c5903; - :b :c5904; - :b :c5905; - :b :c5906; - :b :c5907; - :b :c5908; - :b :c5909; - :b :c5910; - :b :c5911; - :b :c5912; - :b :c5913; - :b :c5914; - :b :c5915; - :b :c5916; - :b :c5917; - :b :c5918; - :b :c5919; - :b :c5920; - :b :c5921; - :b :c5922; - :b :c5923; - :b :c5924; - :b :c5925; - :b :c5926; - :b :c5927; - :b :c5928; - :b :c5929; - :b :c5930; - :b :c5931; - :b :c5932; - :b :c5933; - :b :c5934; - :b :c5935; - :b :c5936; - :b :c5937; - :b :c5938; - :b :c5939; - :b :c5940; - :b :c5941; - :b :c5942; - :b :c5943; - :b :c5944; - :b :c5945; - :b :c5946; - :b :c5947; - :b :c5948; - :b :c5949; - :b :c5950; - :b :c5951; - :b :c5952; - :b :c5953; - :b :c5954; - :b :c5955; - :b :c5956; - :b :c5957; - :b :c5958; - :b :c5959; - :b :c5960; - :b :c5961; - :b :c5962; - :b :c5963; - :b :c5964; - :b :c5965; - :b :c5966; - :b :c5967; - :b :c5968; - :b :c5969; - :b :c5970; - :b :c5971; - :b :c5972; - :b :c5973; - :b :c5974; - :b :c5975; - :b :c5976; - :b :c5977; - :b :c5978; - :b :c5979; - :b :c5980; - :b :c5981; - :b :c5982; - :b :c5983; - :b :c5984; - :b :c5985; - :b :c5986; - :b :c5987; - :b :c5988; - :b :c5989; - :b :c5990; - :b :c5991; - :b :c5992; - :b :c5993; - :b :c5994; - :b :c5995; - :b :c5996; - :b :c5997; - :b :c5998; - :b :c5999; - :b :c6000; - :b :c6001; - :b :c6002; - :b :c6003; - :b :c6004; - :b :c6005; - :b :c6006; - :b :c6007; - :b :c6008; - :b :c6009; - :b :c6010; - :b :c6011; - :b :c6012; - :b :c6013; - :b :c6014; - :b :c6015; - :b :c6016; - :b :c6017; - :b :c6018; - :b :c6019; - :b :c6020; - :b :c6021; - :b :c6022; - :b :c6023; - :b :c6024; - :b :c6025; - :b :c6026; - :b :c6027; - :b :c6028; - :b :c6029; - :b :c6030; - :b :c6031; - :b :c6032; - :b :c6033; - :b :c6034; - :b :c6035; - :b :c6036; - :b :c6037; - :b :c6038; - :b :c6039; - :b :c6040; - :b :c6041; - :b :c6042; - :b :c6043; - :b :c6044; - :b :c6045; - :b :c6046; - :b :c6047; - :b :c6048; - :b :c6049; - :b :c6050; - :b :c6051; - :b :c6052; - :b :c6053; - :b :c6054; - :b :c6055; - :b :c6056; - :b :c6057; - :b :c6058; - :b :c6059; - :b :c6060; - :b :c6061; - :b :c6062; - :b :c6063; - :b :c6064; - :b :c6065; - :b :c6066; - :b :c6067; - :b :c6068; - :b :c6069; - :b :c6070; - :b :c6071; - :b :c6072; - :b :c6073; - :b :c6074; - :b :c6075; - :b :c6076; - :b :c6077; - :b :c6078; - :b :c6079; - :b :c6080; - :b :c6081; - :b :c6082; - :b :c6083; - :b :c6084; - :b :c6085; - :b :c6086; - :b :c6087; - :b :c6088; - :b :c6089; - :b :c6090; - :b :c6091; - :b :c6092; - :b :c6093; - :b :c6094; - :b :c6095; - :b :c6096; - :b :c6097; - :b :c6098; - :b :c6099; - :b :c6100; - :b :c6101; - :b :c6102; - :b :c6103; - :b :c6104; - :b :c6105; - :b :c6106; - :b :c6107; - :b :c6108; - :b :c6109; - :b :c6110; - :b :c6111; - :b :c6112; - :b :c6113; - :b :c6114; - :b :c6115; - :b :c6116; - :b :c6117; - :b :c6118; - :b :c6119; - :b :c6120; - :b :c6121; - :b :c6122; - :b :c6123; - :b :c6124; - :b :c6125; - :b :c6126; - :b :c6127; - :b :c6128; - :b :c6129; - :b :c6130; - :b :c6131; - :b :c6132; - :b :c6133; - :b :c6134; - :b :c6135; - :b :c6136; - :b :c6137; - :b :c6138; - :b :c6139; - :b :c6140; - :b :c6141; - :b :c6142; - :b :c6143; - :b :c6144; - :b :c6145; - :b :c6146; - :b :c6147; - :b :c6148; - :b :c6149; - :b :c6150; - :b :c6151; - :b :c6152; - :b :c6153; - :b :c6154; - :b :c6155; - :b :c6156; - :b :c6157; - :b :c6158; - :b :c6159; - :b :c6160; - :b :c6161; - :b :c6162; - :b :c6163; - :b :c6164; - :b :c6165; - :b :c6166; - :b :c6167; - :b :c6168; - :b :c6169; - :b :c6170; - :b :c6171; - :b :c6172; - :b :c6173; - :b :c6174; - :b :c6175; - :b :c6176; - :b :c6177; - :b :c6178; - :b :c6179; - :b :c6180; - :b :c6181; - :b :c6182; - :b :c6183; - :b :c6184; - :b :c6185; - :b :c6186; - :b :c6187; - :b :c6188; - :b :c6189; - :b :c6190; - :b :c6191; - :b :c6192; - :b :c6193; - :b :c6194; - :b :c6195; - :b :c6196; - :b :c6197; - :b :c6198; - :b :c6199; - :b :c6200; - :b :c6201; - :b :c6202; - :b :c6203; - :b :c6204; - :b :c6205; - :b :c6206; - :b :c6207; - :b :c6208; - :b :c6209; - :b :c6210; - :b :c6211; - :b :c6212; - :b :c6213; - :b :c6214; - :b :c6215; - :b :c6216; - :b :c6217; - :b :c6218; - :b :c6219; - :b :c6220; - :b :c6221; - :b :c6222; - :b :c6223; - :b :c6224; - :b :c6225; - :b :c6226; - :b :c6227; - :b :c6228; - :b :c6229; - :b :c6230; - :b :c6231; - :b :c6232; - :b :c6233; - :b :c6234; - :b :c6235; - :b :c6236; - :b :c6237; - :b :c6238; - :b :c6239; - :b :c6240; - :b :c6241; - :b :c6242; - :b :c6243; - :b :c6244; - :b :c6245; - :b :c6246; - :b :c6247; - :b :c6248; - :b :c6249; - :b :c6250; - :b :c6251; - :b :c6252; - :b :c6253; - :b :c6254; - :b :c6255; - :b :c6256; - :b :c6257; - :b :c6258; - :b :c6259; - :b :c6260; - :b :c6261; - :b :c6262; - :b :c6263; - :b :c6264; - :b :c6265; - :b :c6266; - :b :c6267; - :b :c6268; - :b :c6269; - :b :c6270; - :b :c6271; - :b :c6272; - :b :c6273; - :b :c6274; - :b :c6275; - :b :c6276; - :b :c6277; - :b :c6278; - :b :c6279; - :b :c6280; - :b :c6281; - :b :c6282; - :b :c6283; - :b :c6284; - :b :c6285; - :b :c6286; - :b :c6287; - :b :c6288; - :b :c6289; - :b :c6290; - :b :c6291; - :b :c6292; - :b :c6293; - :b :c6294; - :b :c6295; - :b :c6296; - :b :c6297; - :b :c6298; - :b :c6299; - :b :c6300; - :b :c6301; - :b :c6302; - :b :c6303; - :b :c6304; - :b :c6305; - :b :c6306; - :b :c6307; - :b :c6308; - :b :c6309; - :b :c6310; - :b :c6311; - :b :c6312; - :b :c6313; - :b :c6314; - :b :c6315; - :b :c6316; - :b :c6317; - :b :c6318; - :b :c6319; - :b :c6320; - :b :c6321; - :b :c6322; - :b :c6323; - :b :c6324; - :b :c6325; - :b :c6326; - :b :c6327; - :b :c6328; - :b :c6329; - :b :c6330; - :b :c6331; - :b :c6332; - :b :c6333; - :b :c6334; - :b :c6335; - :b :c6336; - :b :c6337; - :b :c6338; - :b :c6339; - :b :c6340; - :b :c6341; - :b :c6342; - :b :c6343; - :b :c6344; - :b :c6345; - :b :c6346; - :b :c6347; - :b :c6348; - :b :c6349; - :b :c6350; - :b :c6351; - :b :c6352; - :b :c6353; - :b :c6354; - :b :c6355; - :b :c6356; - :b :c6357; - :b :c6358; - :b :c6359; - :b :c6360; - :b :c6361; - :b :c6362; - :b :c6363; - :b :c6364; - :b :c6365; - :b :c6366; - :b :c6367; - :b :c6368; - :b :c6369; - :b :c6370; - :b :c6371; - :b :c6372; - :b :c6373; - :b :c6374; - :b :c6375; - :b :c6376; - :b :c6377; - :b :c6378; - :b :c6379; - :b :c6380; - :b :c6381; - :b :c6382; - :b :c6383; - :b :c6384; - :b :c6385; - :b :c6386; - :b :c6387; - :b :c6388; - :b :c6389; - :b :c6390; - :b :c6391; - :b :c6392; - :b :c6393; - :b :c6394; - :b :c6395; - :b :c6396; - :b :c6397; - :b :c6398; - :b :c6399; - :b :c6400; - :b :c6401; - :b :c6402; - :b :c6403; - :b :c6404; - :b :c6405; - :b :c6406; - :b :c6407; - :b :c6408; - :b :c6409; - :b :c6410; - :b :c6411; - :b :c6412; - :b :c6413; - :b :c6414; - :b :c6415; - :b :c6416; - :b :c6417; - :b :c6418; - :b :c6419; - :b :c6420; - :b :c6421; - :b :c6422; - :b :c6423; - :b :c6424; - :b :c6425; - :b :c6426; - :b :c6427; - :b :c6428; - :b :c6429; - :b :c6430; - :b :c6431; - :b :c6432; - :b :c6433; - :b :c6434; - :b :c6435; - :b :c6436; - :b :c6437; - :b :c6438; - :b :c6439; - :b :c6440; - :b :c6441; - :b :c6442; - :b :c6443; - :b :c6444; - :b :c6445; - :b :c6446; - :b :c6447; - :b :c6448; - :b :c6449; - :b :c6450; - :b :c6451; - :b :c6452; - :b :c6453; - :b :c6454; - :b :c6455; - :b :c6456; - :b :c6457; - :b :c6458; - :b :c6459; - :b :c6460; - :b :c6461; - :b :c6462; - :b :c6463; - :b :c6464; - :b :c6465; - :b :c6466; - :b :c6467; - :b :c6468; - :b :c6469; - :b :c6470; - :b :c6471; - :b :c6472; - :b :c6473; - :b :c6474; - :b :c6475; - :b :c6476; - :b :c6477; - :b :c6478; - :b :c6479; - :b :c6480; - :b :c6481; - :b :c6482; - :b :c6483; - :b :c6484; - :b :c6485; - :b :c6486; - :b :c6487; - :b :c6488; - :b :c6489; - :b :c6490; - :b :c6491; - :b :c6492; - :b :c6493; - :b :c6494; - :b :c6495; - :b :c6496; - :b :c6497; - :b :c6498; - :b :c6499; - :b :c6500; - :b :c6501; - :b :c6502; - :b :c6503; - :b :c6504; - :b :c6505; - :b :c6506; - :b :c6507; - :b :c6508; - :b :c6509; - :b :c6510; - :b :c6511; - :b :c6512; - :b :c6513; - :b :c6514; - :b :c6515; - :b :c6516; - :b :c6517; - :b :c6518; - :b :c6519; - :b :c6520; - :b :c6521; - :b :c6522; - :b :c6523; - :b :c6524; - :b :c6525; - :b :c6526; - :b :c6527; - :b :c6528; - :b :c6529; - :b :c6530; - :b :c6531; - :b :c6532; - :b :c6533; - :b :c6534; - :b :c6535; - :b :c6536; - :b :c6537; - :b :c6538; - :b :c6539; - :b :c6540; - :b :c6541; - :b :c6542; - :b :c6543; - :b :c6544; - :b :c6545; - :b :c6546; - :b :c6547; - :b :c6548; - :b :c6549; - :b :c6550; - :b :c6551; - :b :c6552; - :b :c6553; - :b :c6554; - :b :c6555; - :b :c6556; - :b :c6557; - :b :c6558; - :b :c6559; - :b :c6560; - :b :c6561; - :b :c6562; - :b :c6563; - :b :c6564; - :b :c6565; - :b :c6566; - :b :c6567; - :b :c6568; - :b :c6569; - :b :c6570; - :b :c6571; - :b :c6572; - :b :c6573; - :b :c6574; - :b :c6575; - :b :c6576; - :b :c6577; - :b :c6578; - :b :c6579; - :b :c6580; - :b :c6581; - :b :c6582; - :b :c6583; - :b :c6584; - :b :c6585; - :b :c6586; - :b :c6587; - :b :c6588; - :b :c6589; - :b :c6590; - :b :c6591; - :b :c6592; - :b :c6593; - :b :c6594; - :b :c6595; - :b :c6596; - :b :c6597; - :b :c6598; - :b :c6599; - :b :c6600; - :b :c6601; - :b :c6602; - :b :c6603; - :b :c6604; - :b :c6605; - :b :c6606; - :b :c6607; - :b :c6608; - :b :c6609; - :b :c6610; - :b :c6611; - :b :c6612; - :b :c6613; - :b :c6614; - :b :c6615; - :b :c6616; - :b :c6617; - :b :c6618; - :b :c6619; - :b :c6620; - :b :c6621; - :b :c6622; - :b :c6623; - :b :c6624; - :b :c6625; - :b :c6626; - :b :c6627; - :b :c6628; - :b :c6629; - :b :c6630; - :b :c6631; - :b :c6632; - :b :c6633; - :b :c6634; - :b :c6635; - :b :c6636; - :b :c6637; - :b :c6638; - :b :c6639; - :b :c6640; - :b :c6641; - :b :c6642; - :b :c6643; - :b :c6644; - :b :c6645; - :b :c6646; - :b :c6647; - :b :c6648; - :b :c6649; - :b :c6650; - :b :c6651; - :b :c6652; - :b :c6653; - :b :c6654; - :b :c6655; - :b :c6656; - :b :c6657; - :b :c6658; - :b :c6659; - :b :c6660; - :b :c6661; - :b :c6662; - :b :c6663; - :b :c6664; - :b :c6665; - :b :c6666; - :b :c6667; - :b :c6668; - :b :c6669; - :b :c6670; - :b :c6671; - :b :c6672; - :b :c6673; - :b :c6674; - :b :c6675; - :b :c6676; - :b :c6677; - :b :c6678; - :b :c6679; - :b :c6680; - :b :c6681; - :b :c6682; - :b :c6683; - :b :c6684; - :b :c6685; - :b :c6686; - :b :c6687; - :b :c6688; - :b :c6689; - :b :c6690; - :b :c6691; - :b :c6692; - :b :c6693; - :b :c6694; - :b :c6695; - :b :c6696; - :b :c6697; - :b :c6698; - :b :c6699; - :b :c6700; - :b :c6701; - :b :c6702; - :b :c6703; - :b :c6704; - :b :c6705; - :b :c6706; - :b :c6707; - :b :c6708; - :b :c6709; - :b :c6710; - :b :c6711; - :b :c6712; - :b :c6713; - :b :c6714; - :b :c6715; - :b :c6716; - :b :c6717; - :b :c6718; - :b :c6719; - :b :c6720; - :b :c6721; - :b :c6722; - :b :c6723; - :b :c6724; - :b :c6725; - :b :c6726; - :b :c6727; - :b :c6728; - :b :c6729; - :b :c6730; - :b :c6731; - :b :c6732; - :b :c6733; - :b :c6734; - :b :c6735; - :b :c6736; - :b :c6737; - :b :c6738; - :b :c6739; - :b :c6740; - :b :c6741; - :b :c6742; - :b :c6743; - :b :c6744; - :b :c6745; - :b :c6746; - :b :c6747; - :b :c6748; - :b :c6749; - :b :c6750; - :b :c6751; - :b :c6752; - :b :c6753; - :b :c6754; - :b :c6755; - :b :c6756; - :b :c6757; - :b :c6758; - :b :c6759; - :b :c6760; - :b :c6761; - :b :c6762; - :b :c6763; - :b :c6764; - :b :c6765; - :b :c6766; - :b :c6767; - :b :c6768; - :b :c6769; - :b :c6770; - :b :c6771; - :b :c6772; - :b :c6773; - :b :c6774; - :b :c6775; - :b :c6776; - :b :c6777; - :b :c6778; - :b :c6779; - :b :c6780; - :b :c6781; - :b :c6782; - :b :c6783; - :b :c6784; - :b :c6785; - :b :c6786; - :b :c6787; - :b :c6788; - :b :c6789; - :b :c6790; - :b :c6791; - :b :c6792; - :b :c6793; - :b :c6794; - :b :c6795; - :b :c6796; - :b :c6797; - :b :c6798; - :b :c6799; - :b :c6800; - :b :c6801; - :b :c6802; - :b :c6803; - :b :c6804; - :b :c6805; - :b :c6806; - :b :c6807; - :b :c6808; - :b :c6809; - :b :c6810; - :b :c6811; - :b :c6812; - :b :c6813; - :b :c6814; - :b :c6815; - :b :c6816; - :b :c6817; - :b :c6818; - :b :c6819; - :b :c6820; - :b :c6821; - :b :c6822; - :b :c6823; - :b :c6824; - :b :c6825; - :b :c6826; - :b :c6827; - :b :c6828; - :b :c6829; - :b :c6830; - :b :c6831; - :b :c6832; - :b :c6833; - :b :c6834; - :b :c6835; - :b :c6836; - :b :c6837; - :b :c6838; - :b :c6839; - :b :c6840; - :b :c6841; - :b :c6842; - :b :c6843; - :b :c6844; - :b :c6845; - :b :c6846; - :b :c6847; - :b :c6848; - :b :c6849; - :b :c6850; - :b :c6851; - :b :c6852; - :b :c6853; - :b :c6854; - :b :c6855; - :b :c6856; - :b :c6857; - :b :c6858; - :b :c6859; - :b :c6860; - :b :c6861; - :b :c6862; - :b :c6863; - :b :c6864; - :b :c6865; - :b :c6866; - :b :c6867; - :b :c6868; - :b :c6869; - :b :c6870; - :b :c6871; - :b :c6872; - :b :c6873; - :b :c6874; - :b :c6875; - :b :c6876; - :b :c6877; - :b :c6878; - :b :c6879; - :b :c6880; - :b :c6881; - :b :c6882; - :b :c6883; - :b :c6884; - :b :c6885; - :b :c6886; - :b :c6887; - :b :c6888; - :b :c6889; - :b :c6890; - :b :c6891; - :b :c6892; - :b :c6893; - :b :c6894; - :b :c6895; - :b :c6896; - :b :c6897; - :b :c6898; - :b :c6899; - :b :c6900; - :b :c6901; - :b :c6902; - :b :c6903; - :b :c6904; - :b :c6905; - :b :c6906; - :b :c6907; - :b :c6908; - :b :c6909; - :b :c6910; - :b :c6911; - :b :c6912; - :b :c6913; - :b :c6914; - :b :c6915; - :b :c6916; - :b :c6917; - :b :c6918; - :b :c6919; - :b :c6920; - :b :c6921; - :b :c6922; - :b :c6923; - :b :c6924; - :b :c6925; - :b :c6926; - :b :c6927; - :b :c6928; - :b :c6929; - :b :c6930; - :b :c6931; - :b :c6932; - :b :c6933; - :b :c6934; - :b :c6935; - :b :c6936; - :b :c6937; - :b :c6938; - :b :c6939; - :b :c6940; - :b :c6941; - :b :c6942; - :b :c6943; - :b :c6944; - :b :c6945; - :b :c6946; - :b :c6947; - :b :c6948; - :b :c6949; - :b :c6950; - :b :c6951; - :b :c6952; - :b :c6953; - :b :c6954; - :b :c6955; - :b :c6956; - :b :c6957; - :b :c6958; - :b :c6959; - :b :c6960; - :b :c6961; - :b :c6962; - :b :c6963; - :b :c6964; - :b :c6965; - :b :c6966; - :b :c6967; - :b :c6968; - :b :c6969; - :b :c6970; - :b :c6971; - :b :c6972; - :b :c6973; - :b :c6974; - :b :c6975; - :b :c6976; - :b :c6977; - :b :c6978; - :b :c6979; - :b :c6980; - :b :c6981; - :b :c6982; - :b :c6983; - :b :c6984; - :b :c6985; - :b :c6986; - :b :c6987; - :b :c6988; - :b :c6989; - :b :c6990; - :b :c6991; - :b :c6992; - :b :c6993; - :b :c6994; - :b :c6995; - :b :c6996; - :b :c6997; - :b :c6998; - :b :c6999; - :b :c7000; - :b :c7001; - :b :c7002; - :b :c7003; - :b :c7004; - :b :c7005; - :b :c7006; - :b :c7007; - :b :c7008; - :b :c7009; - :b :c7010; - :b :c7011; - :b :c7012; - :b :c7013; - :b :c7014; - :b :c7015; - :b :c7016; - :b :c7017; - :b :c7018; - :b :c7019; - :b :c7020; - :b :c7021; - :b :c7022; - :b :c7023; - :b :c7024; - :b :c7025; - :b :c7026; - :b :c7027; - :b :c7028; - :b :c7029; - :b :c7030; - :b :c7031; - :b :c7032; - :b :c7033; - :b :c7034; - :b :c7035; - :b :c7036; - :b :c7037; - :b :c7038; - :b :c7039; - :b :c7040; - :b :c7041; - :b :c7042; - :b :c7043; - :b :c7044; - :b :c7045; - :b :c7046; - :b :c7047; - :b :c7048; - :b :c7049; - :b :c7050; - :b :c7051; - :b :c7052; - :b :c7053; - :b :c7054; - :b :c7055; - :b :c7056; - :b :c7057; - :b :c7058; - :b :c7059; - :b :c7060; - :b :c7061; - :b :c7062; - :b :c7063; - :b :c7064; - :b :c7065; - :b :c7066; - :b :c7067; - :b :c7068; - :b :c7069; - :b :c7070; - :b :c7071; - :b :c7072; - :b :c7073; - :b :c7074; - :b :c7075; - :b :c7076; - :b :c7077; - :b :c7078; - :b :c7079; - :b :c7080; - :b :c7081; - :b :c7082; - :b :c7083; - :b :c7084; - :b :c7085; - :b :c7086; - :b :c7087; - :b :c7088; - :b :c7089; - :b :c7090; - :b :c7091; - :b :c7092; - :b :c7093; - :b :c7094; - :b :c7095; - :b :c7096; - :b :c7097; - :b :c7098; - :b :c7099; - :b :c7100; - :b :c7101; - :b :c7102; - :b :c7103; - :b :c7104; - :b :c7105; - :b :c7106; - :b :c7107; - :b :c7108; - :b :c7109; - :b :c7110; - :b :c7111; - :b :c7112; - :b :c7113; - :b :c7114; - :b :c7115; - :b :c7116; - :b :c7117; - :b :c7118; - :b :c7119; - :b :c7120; - :b :c7121; - :b :c7122; - :b :c7123; - :b :c7124; - :b :c7125; - :b :c7126; - :b :c7127; - :b :c7128; - :b :c7129; - :b :c7130; - :b :c7131; - :b :c7132; - :b :c7133; - :b :c7134; - :b :c7135; - :b :c7136; - :b :c7137; - :b :c7138; - :b :c7139; - :b :c7140; - :b :c7141; - :b :c7142; - :b :c7143; - :b :c7144; - :b :c7145; - :b :c7146; - :b :c7147; - :b :c7148; - :b :c7149; - :b :c7150; - :b :c7151; - :b :c7152; - :b :c7153; - :b :c7154; - :b :c7155; - :b :c7156; - :b :c7157; - :b :c7158; - :b :c7159; - :b :c7160; - :b :c7161; - :b :c7162; - :b :c7163; - :b :c7164; - :b :c7165; - :b :c7166; - :b :c7167; - :b :c7168; - :b :c7169; - :b :c7170; - :b :c7171; - :b :c7172; - :b :c7173; - :b :c7174; - :b :c7175; - :b :c7176; - :b :c7177; - :b :c7178; - :b :c7179; - :b :c7180; - :b :c7181; - :b :c7182; - :b :c7183; - :b :c7184; - :b :c7185; - :b :c7186; - :b :c7187; - :b :c7188; - :b :c7189; - :b :c7190; - :b :c7191; - :b :c7192; - :b :c7193; - :b :c7194; - :b :c7195; - :b :c7196; - :b :c7197; - :b :c7198; - :b :c7199; - :b :c7200; - :b :c7201; - :b :c7202; - :b :c7203; - :b :c7204; - :b :c7205; - :b :c7206; - :b :c7207; - :b :c7208; - :b :c7209; - :b :c7210; - :b :c7211; - :b :c7212; - :b :c7213; - :b :c7214; - :b :c7215; - :b :c7216; - :b :c7217; - :b :c7218; - :b :c7219; - :b :c7220; - :b :c7221; - :b :c7222; - :b :c7223; - :b :c7224; - :b :c7225; - :b :c7226; - :b :c7227; - :b :c7228; - :b :c7229; - :b :c7230; - :b :c7231; - :b :c7232; - :b :c7233; - :b :c7234; - :b :c7235; - :b :c7236; - :b :c7237; - :b :c7238; - :b :c7239; - :b :c7240; - :b :c7241; - :b :c7242; - :b :c7243; - :b :c7244; - :b :c7245; - :b :c7246; - :b :c7247; - :b :c7248; - :b :c7249; - :b :c7250; - :b :c7251; - :b :c7252; - :b :c7253; - :b :c7254; - :b :c7255; - :b :c7256; - :b :c7257; - :b :c7258; - :b :c7259; - :b :c7260; - :b :c7261; - :b :c7262; - :b :c7263; - :b :c7264; - :b :c7265; - :b :c7266; - :b :c7267; - :b :c7268; - :b :c7269; - :b :c7270; - :b :c7271; - :b :c7272; - :b :c7273; - :b :c7274; - :b :c7275; - :b :c7276; - :b :c7277; - :b :c7278; - :b :c7279; - :b :c7280; - :b :c7281; - :b :c7282; - :b :c7283; - :b :c7284; - :b :c7285; - :b :c7286; - :b :c7287; - :b :c7288; - :b :c7289; - :b :c7290; - :b :c7291; - :b :c7292; - :b :c7293; - :b :c7294; - :b :c7295; - :b :c7296; - :b :c7297; - :b :c7298; - :b :c7299; - :b :c7300; - :b :c7301; - :b :c7302; - :b :c7303; - :b :c7304; - :b :c7305; - :b :c7306; - :b :c7307; - :b :c7308; - :b :c7309; - :b :c7310; - :b :c7311; - :b :c7312; - :b :c7313; - :b :c7314; - :b :c7315; - :b :c7316; - :b :c7317; - :b :c7318; - :b :c7319; - :b :c7320; - :b :c7321; - :b :c7322; - :b :c7323; - :b :c7324; - :b :c7325; - :b :c7326; - :b :c7327; - :b :c7328; - :b :c7329; - :b :c7330; - :b :c7331; - :b :c7332; - :b :c7333; - :b :c7334; - :b :c7335; - :b :c7336; - :b :c7337; - :b :c7338; - :b :c7339; - :b :c7340; - :b :c7341; - :b :c7342; - :b :c7343; - :b :c7344; - :b :c7345; - :b :c7346; - :b :c7347; - :b :c7348; - :b :c7349; - :b :c7350; - :b :c7351; - :b :c7352; - :b :c7353; - :b :c7354; - :b :c7355; - :b :c7356; - :b :c7357; - :b :c7358; - :b :c7359; - :b :c7360; - :b :c7361; - :b :c7362; - :b :c7363; - :b :c7364; - :b :c7365; - :b :c7366; - :b :c7367; - :b :c7368; - :b :c7369; - :b :c7370; - :b :c7371; - :b :c7372; - :b :c7373; - :b :c7374; - :b :c7375; - :b :c7376; - :b :c7377; - :b :c7378; - :b :c7379; - :b :c7380; - :b :c7381; - :b :c7382; - :b :c7383; - :b :c7384; - :b :c7385; - :b :c7386; - :b :c7387; - :b :c7388; - :b :c7389; - :b :c7390; - :b :c7391; - :b :c7392; - :b :c7393; - :b :c7394; - :b :c7395; - :b :c7396; - :b :c7397; - :b :c7398; - :b :c7399; - :b :c7400; - :b :c7401; - :b :c7402; - :b :c7403; - :b :c7404; - :b :c7405; - :b :c7406; - :b :c7407; - :b :c7408; - :b :c7409; - :b :c7410; - :b :c7411; - :b :c7412; - :b :c7413; - :b :c7414; - :b :c7415; - :b :c7416; - :b :c7417; - :b :c7418; - :b :c7419; - :b :c7420; - :b :c7421; - :b :c7422; - :b :c7423; - :b :c7424; - :b :c7425; - :b :c7426; - :b :c7427; - :b :c7428; - :b :c7429; - :b :c7430; - :b :c7431; - :b :c7432; - :b :c7433; - :b :c7434; - :b :c7435; - :b :c7436; - :b :c7437; - :b :c7438; - :b :c7439; - :b :c7440; - :b :c7441; - :b :c7442; - :b :c7443; - :b :c7444; - :b :c7445; - :b :c7446; - :b :c7447; - :b :c7448; - :b :c7449; - :b :c7450; - :b :c7451; - :b :c7452; - :b :c7453; - :b :c7454; - :b :c7455; - :b :c7456; - :b :c7457; - :b :c7458; - :b :c7459; - :b :c7460; - :b :c7461; - :b :c7462; - :b :c7463; - :b :c7464; - :b :c7465; - :b :c7466; - :b :c7467; - :b :c7468; - :b :c7469; - :b :c7470; - :b :c7471; - :b :c7472; - :b :c7473; - :b :c7474; - :b :c7475; - :b :c7476; - :b :c7477; - :b :c7478; - :b :c7479; - :b :c7480; - :b :c7481; - :b :c7482; - :b :c7483; - :b :c7484; - :b :c7485; - :b :c7486; - :b :c7487; - :b :c7488; - :b :c7489; - :b :c7490; - :b :c7491; - :b :c7492; - :b :c7493; - :b :c7494; - :b :c7495; - :b :c7496; - :b :c7497; - :b :c7498; - :b :c7499; - :b :c7500; - :b :c7501; - :b :c7502; - :b :c7503; - :b :c7504; - :b :c7505; - :b :c7506; - :b :c7507; - :b :c7508; - :b :c7509; - :b :c7510; - :b :c7511; - :b :c7512; - :b :c7513; - :b :c7514; - :b :c7515; - :b :c7516; - :b :c7517; - :b :c7518; - :b :c7519; - :b :c7520; - :b :c7521; - :b :c7522; - :b :c7523; - :b :c7524; - :b :c7525; - :b :c7526; - :b :c7527; - :b :c7528; - :b :c7529; - :b :c7530; - :b :c7531; - :b :c7532; - :b :c7533; - :b :c7534; - :b :c7535; - :b :c7536; - :b :c7537; - :b :c7538; - :b :c7539; - :b :c7540; - :b :c7541; - :b :c7542; - :b :c7543; - :b :c7544; - :b :c7545; - :b :c7546; - :b :c7547; - :b :c7548; - :b :c7549; - :b :c7550; - :b :c7551; - :b :c7552; - :b :c7553; - :b :c7554; - :b :c7555; - :b :c7556; - :b :c7557; - :b :c7558; - :b :c7559; - :b :c7560; - :b :c7561; - :b :c7562; - :b :c7563; - :b :c7564; - :b :c7565; - :b :c7566; - :b :c7567; - :b :c7568; - :b :c7569; - :b :c7570; - :b :c7571; - :b :c7572; - :b :c7573; - :b :c7574; - :b :c7575; - :b :c7576; - :b :c7577; - :b :c7578; - :b :c7579; - :b :c7580; - :b :c7581; - :b :c7582; - :b :c7583; - :b :c7584; - :b :c7585; - :b :c7586; - :b :c7587; - :b :c7588; - :b :c7589; - :b :c7590; - :b :c7591; - :b :c7592; - :b :c7593; - :b :c7594; - :b :c7595; - :b :c7596; - :b :c7597; - :b :c7598; - :b :c7599; - :b :c7600; - :b :c7601; - :b :c7602; - :b :c7603; - :b :c7604; - :b :c7605; - :b :c7606; - :b :c7607; - :b :c7608; - :b :c7609; - :b :c7610; - :b :c7611; - :b :c7612; - :b :c7613; - :b :c7614; - :b :c7615; - :b :c7616; - :b :c7617; - :b :c7618; - :b :c7619; - :b :c7620; - :b :c7621; - :b :c7622; - :b :c7623; - :b :c7624; - :b :c7625; - :b :c7626; - :b :c7627; - :b :c7628; - :b :c7629; - :b :c7630; - :b :c7631; - :b :c7632; - :b :c7633; - :b :c7634; - :b :c7635; - :b :c7636; - :b :c7637; - :b :c7638; - :b :c7639; - :b :c7640; - :b :c7641; - :b :c7642; - :b :c7643; - :b :c7644; - :b :c7645; - :b :c7646; - :b :c7647; - :b :c7648; - :b :c7649; - :b :c7650; - :b :c7651; - :b :c7652; - :b :c7653; - :b :c7654; - :b :c7655; - :b :c7656; - :b :c7657; - :b :c7658; - :b :c7659; - :b :c7660; - :b :c7661; - :b :c7662; - :b :c7663; - :b :c7664; - :b :c7665; - :b :c7666; - :b :c7667; - :b :c7668; - :b :c7669; - :b :c7670; - :b :c7671; - :b :c7672; - :b :c7673; - :b :c7674; - :b :c7675; - :b :c7676; - :b :c7677; - :b :c7678; - :b :c7679; - :b :c7680; - :b :c7681; - :b :c7682; - :b :c7683; - :b :c7684; - :b :c7685; - :b :c7686; - :b :c7687; - :b :c7688; - :b :c7689; - :b :c7690; - :b :c7691; - :b :c7692; - :b :c7693; - :b :c7694; - :b :c7695; - :b :c7696; - :b :c7697; - :b :c7698; - :b :c7699; - :b :c7700; - :b :c7701; - :b :c7702; - :b :c7703; - :b :c7704; - :b :c7705; - :b :c7706; - :b :c7707; - :b :c7708; - :b :c7709; - :b :c7710; - :b :c7711; - :b :c7712; - :b :c7713; - :b :c7714; - :b :c7715; - :b :c7716; - :b :c7717; - :b :c7718; - :b :c7719; - :b :c7720; - :b :c7721; - :b :c7722; - :b :c7723; - :b :c7724; - :b :c7725; - :b :c7726; - :b :c7727; - :b :c7728; - :b :c7729; - :b :c7730; - :b :c7731; - :b :c7732; - :b :c7733; - :b :c7734; - :b :c7735; - :b :c7736; - :b :c7737; - :b :c7738; - :b :c7739; - :b :c7740; - :b :c7741; - :b :c7742; - :b :c7743; - :b :c7744; - :b :c7745; - :b :c7746; - :b :c7747; - :b :c7748; - :b :c7749; - :b :c7750; - :b :c7751; - :b :c7752; - :b :c7753; - :b :c7754; - :b :c7755; - :b :c7756; - :b :c7757; - :b :c7758; - :b :c7759; - :b :c7760; - :b :c7761; - :b :c7762; - :b :c7763; - :b :c7764; - :b :c7765; - :b :c7766; - :b :c7767; - :b :c7768; - :b :c7769; - :b :c7770; - :b :c7771; - :b :c7772; - :b :c7773; - :b :c7774; - :b :c7775; - :b :c7776; - :b :c7777; - :b :c7778; - :b :c7779; - :b :c7780; - :b :c7781; - :b :c7782; - :b :c7783; - :b :c7784; - :b :c7785; - :b :c7786; - :b :c7787; - :b :c7788; - :b :c7789; - :b :c7790; - :b :c7791; - :b :c7792; - :b :c7793; - :b :c7794; - :b :c7795; - :b :c7796; - :b :c7797; - :b :c7798; - :b :c7799; - :b :c7800; - :b :c7801; - :b :c7802; - :b :c7803; - :b :c7804; - :b :c7805; - :b :c7806; - :b :c7807; - :b :c7808; - :b :c7809; - :b :c7810; - :b :c7811; - :b :c7812; - :b :c7813; - :b :c7814; - :b :c7815; - :b :c7816; - :b :c7817; - :b :c7818; - :b :c7819; - :b :c7820; - :b :c7821; - :b :c7822; - :b :c7823; - :b :c7824; - :b :c7825; - :b :c7826; - :b :c7827; - :b :c7828; - :b :c7829; - :b :c7830; - :b :c7831; - :b :c7832; - :b :c7833; - :b :c7834; - :b :c7835; - :b :c7836; - :b :c7837; - :b :c7838; - :b :c7839; - :b :c7840; - :b :c7841; - :b :c7842; - :b :c7843; - :b :c7844; - :b :c7845; - :b :c7846; - :b :c7847; - :b :c7848; - :b :c7849; - :b :c7850; - :b :c7851; - :b :c7852; - :b :c7853; - :b :c7854; - :b :c7855; - :b :c7856; - :b :c7857; - :b :c7858; - :b :c7859; - :b :c7860; - :b :c7861; - :b :c7862; - :b :c7863; - :b :c7864; - :b :c7865; - :b :c7866; - :b :c7867; - :b :c7868; - :b :c7869; - :b :c7870; - :b :c7871; - :b :c7872; - :b :c7873; - :b :c7874; - :b :c7875; - :b :c7876; - :b :c7877; - :b :c7878; - :b :c7879; - :b :c7880; - :b :c7881; - :b :c7882; - :b :c7883; - :b :c7884; - :b :c7885; - :b :c7886; - :b :c7887; - :b :c7888; - :b :c7889; - :b :c7890; - :b :c7891; - :b :c7892; - :b :c7893; - :b :c7894; - :b :c7895; - :b :c7896; - :b :c7897; - :b :c7898; - :b :c7899; - :b :c7900; - :b :c7901; - :b :c7902; - :b :c7903; - :b :c7904; - :b :c7905; - :b :c7906; - :b :c7907; - :b :c7908; - :b :c7909; - :b :c7910; - :b :c7911; - :b :c7912; - :b :c7913; - :b :c7914; - :b :c7915; - :b :c7916; - :b :c7917; - :b :c7918; - :b :c7919; - :b :c7920; - :b :c7921; - :b :c7922; - :b :c7923; - :b :c7924; - :b :c7925; - :b :c7926; - :b :c7927; - :b :c7928; - :b :c7929; - :b :c7930; - :b :c7931; - :b :c7932; - :b :c7933; - :b :c7934; - :b :c7935; - :b :c7936; - :b :c7937; - :b :c7938; - :b :c7939; - :b :c7940; - :b :c7941; - :b :c7942; - :b :c7943; - :b :c7944; - :b :c7945; - :b :c7946; - :b :c7947; - :b :c7948; - :b :c7949; - :b :c7950; - :b :c7951; - :b :c7952; - :b :c7953; - :b :c7954; - :b :c7955; - :b :c7956; - :b :c7957; - :b :c7958; - :b :c7959; - :b :c7960; - :b :c7961; - :b :c7962; - :b :c7963; - :b :c7964; - :b :c7965; - :b :c7966; - :b :c7967; - :b :c7968; - :b :c7969; - :b :c7970; - :b :c7971; - :b :c7972; - :b :c7973; - :b :c7974; - :b :c7975; - :b :c7976; - :b :c7977; - :b :c7978; - :b :c7979; - :b :c7980; - :b :c7981; - :b :c7982; - :b :c7983; - :b :c7984; - :b :c7985; - :b :c7986; - :b :c7987; - :b :c7988; - :b :c7989; - :b :c7990; - :b :c7991; - :b :c7992; - :b :c7993; - :b :c7994; - :b :c7995; - :b :c7996; - :b :c7997; - :b :c7998; - :b :c7999; - :b :c8000; - :b :c8001; - :b :c8002; - :b :c8003; - :b :c8004; - :b :c8005; - :b :c8006; - :b :c8007; - :b :c8008; - :b :c8009; - :b :c8010; - :b :c8011; - :b :c8012; - :b :c8013; - :b :c8014; - :b :c8015; - :b :c8016; - :b :c8017; - :b :c8018; - :b :c8019; - :b :c8020; - :b :c8021; - :b :c8022; - :b :c8023; - :b :c8024; - :b :c8025; - :b :c8026; - :b :c8027; - :b :c8028; - :b :c8029; - :b :c8030; - :b :c8031; - :b :c8032; - :b :c8033; - :b :c8034; - :b :c8035; - :b :c8036; - :b :c8037; - :b :c8038; - :b :c8039; - :b :c8040; - :b :c8041; - :b :c8042; - :b :c8043; - :b :c8044; - :b :c8045; - :b :c8046; - :b :c8047; - :b :c8048; - :b :c8049; - :b :c8050; - :b :c8051; - :b :c8052; - :b :c8053; - :b :c8054; - :b :c8055; - :b :c8056; - :b :c8057; - :b :c8058; - :b :c8059; - :b :c8060; - :b :c8061; - :b :c8062; - :b :c8063; - :b :c8064; - :b :c8065; - :b :c8066; - :b :c8067; - :b :c8068; - :b :c8069; - :b :c8070; - :b :c8071; - :b :c8072; - :b :c8073; - :b :c8074; - :b :c8075; - :b :c8076; - :b :c8077; - :b :c8078; - :b :c8079; - :b :c8080; - :b :c8081; - :b :c8082; - :b :c8083; - :b :c8084; - :b :c8085; - :b :c8086; - :b :c8087; - :b :c8088; - :b :c8089; - :b :c8090; - :b :c8091; - :b :c8092; - :b :c8093; - :b :c8094; - :b :c8095; - :b :c8096; - :b :c8097; - :b :c8098; - :b :c8099; - :b :c8100; - :b :c8101; - :b :c8102; - :b :c8103; - :b :c8104; - :b :c8105; - :b :c8106; - :b :c8107; - :b :c8108; - :b :c8109; - :b :c8110; - :b :c8111; - :b :c8112; - :b :c8113; - :b :c8114; - :b :c8115; - :b :c8116; - :b :c8117; - :b :c8118; - :b :c8119; - :b :c8120; - :b :c8121; - :b :c8122; - :b :c8123; - :b :c8124; - :b :c8125; - :b :c8126; - :b :c8127; - :b :c8128; - :b :c8129; - :b :c8130; - :b :c8131; - :b :c8132; - :b :c8133; - :b :c8134; - :b :c8135; - :b :c8136; - :b :c8137; - :b :c8138; - :b :c8139; - :b :c8140; - :b :c8141; - :b :c8142; - :b :c8143; - :b :c8144; - :b :c8145; - :b :c8146; - :b :c8147; - :b :c8148; - :b :c8149; - :b :c8150; - :b :c8151; - :b :c8152; - :b :c8153; - :b :c8154; - :b :c8155; - :b :c8156; - :b :c8157; - :b :c8158; - :b :c8159; - :b :c8160; - :b :c8161; - :b :c8162; - :b :c8163; - :b :c8164; - :b :c8165; - :b :c8166; - :b :c8167; - :b :c8168; - :b :c8169; - :b :c8170; - :b :c8171; - :b :c8172; - :b :c8173; - :b :c8174; - :b :c8175; - :b :c8176; - :b :c8177; - :b :c8178; - :b :c8179; - :b :c8180; - :b :c8181; - :b :c8182; - :b :c8183; - :b :c8184; - :b :c8185; - :b :c8186; - :b :c8187; - :b :c8188; - :b :c8189; - :b :c8190; - :b :c8191; - :b :c8192; - :b :c8193; - :b :c8194; - :b :c8195; - :b :c8196; - :b :c8197; - :b :c8198; - :b :c8199; - :b :c8200; - :b :c8201; - :b :c8202; - :b :c8203; - :b :c8204; - :b :c8205; - :b :c8206; - :b :c8207; - :b :c8208; - :b :c8209; - :b :c8210; - :b :c8211; - :b :c8212; - :b :c8213; - :b :c8214; - :b :c8215; - :b :c8216; - :b :c8217; - :b :c8218; - :b :c8219; - :b :c8220; - :b :c8221; - :b :c8222; - :b :c8223; - :b :c8224; - :b :c8225; - :b :c8226; - :b :c8227; - :b :c8228; - :b :c8229; - :b :c8230; - :b :c8231; - :b :c8232; - :b :c8233; - :b :c8234; - :b :c8235; - :b :c8236; - :b :c8237; - :b :c8238; - :b :c8239; - :b :c8240; - :b :c8241; - :b :c8242; - :b :c8243; - :b :c8244; - :b :c8245; - :b :c8246; - :b :c8247; - :b :c8248; - :b :c8249; - :b :c8250; - :b :c8251; - :b :c8252; - :b :c8253; - :b :c8254; - :b :c8255; - :b :c8256; - :b :c8257; - :b :c8258; - :b :c8259; - :b :c8260; - :b :c8261; - :b :c8262; - :b :c8263; - :b :c8264; - :b :c8265; - :b :c8266; - :b :c8267; - :b :c8268; - :b :c8269; - :b :c8270; - :b :c8271; - :b :c8272; - :b :c8273; - :b :c8274; - :b :c8275; - :b :c8276; - :b :c8277; - :b :c8278; - :b :c8279; - :b :c8280; - :b :c8281; - :b :c8282; - :b :c8283; - :b :c8284; - :b :c8285; - :b :c8286; - :b :c8287; - :b :c8288; - :b :c8289; - :b :c8290; - :b :c8291; - :b :c8292; - :b :c8293; - :b :c8294; - :b :c8295; - :b :c8296; - :b :c8297; - :b :c8298; - :b :c8299; - :b :c8300; - :b :c8301; - :b :c8302; - :b :c8303; - :b :c8304; - :b :c8305; - :b :c8306; - :b :c8307; - :b :c8308; - :b :c8309; - :b :c8310; - :b :c8311; - :b :c8312; - :b :c8313; - :b :c8314; - :b :c8315; - :b :c8316; - :b :c8317; - :b :c8318; - :b :c8319; - :b :c8320; - :b :c8321; - :b :c8322; - :b :c8323; - :b :c8324; - :b :c8325; - :b :c8326; - :b :c8327; - :b :c8328; - :b :c8329; - :b :c8330; - :b :c8331; - :b :c8332; - :b :c8333; - :b :c8334; - :b :c8335; - :b :c8336; - :b :c8337; - :b :c8338; - :b :c8339; - :b :c8340; - :b :c8341; - :b :c8342; - :b :c8343; - :b :c8344; - :b :c8345; - :b :c8346; - :b :c8347; - :b :c8348; - :b :c8349; - :b :c8350; - :b :c8351; - :b :c8352; - :b :c8353; - :b :c8354; - :b :c8355; - :b :c8356; - :b :c8357; - :b :c8358; - :b :c8359; - :b :c8360; - :b :c8361; - :b :c8362; - :b :c8363; - :b :c8364; - :b :c8365; - :b :c8366; - :b :c8367; - :b :c8368; - :b :c8369; - :b :c8370; - :b :c8371; - :b :c8372; - :b :c8373; - :b :c8374; - :b :c8375; - :b :c8376; - :b :c8377; - :b :c8378; - :b :c8379; - :b :c8380; - :b :c8381; - :b :c8382; - :b :c8383; - :b :c8384; - :b :c8385; - :b :c8386; - :b :c8387; - :b :c8388; - :b :c8389; - :b :c8390; - :b :c8391; - :b :c8392; - :b :c8393; - :b :c8394; - :b :c8395; - :b :c8396; - :b :c8397; - :b :c8398; - :b :c8399; - :b :c8400; - :b :c8401; - :b :c8402; - :b :c8403; - :b :c8404; - :b :c8405; - :b :c8406; - :b :c8407; - :b :c8408; - :b :c8409; - :b :c8410; - :b :c8411; - :b :c8412; - :b :c8413; - :b :c8414; - :b :c8415; - :b :c8416; - :b :c8417; - :b :c8418; - :b :c8419; - :b :c8420; - :b :c8421; - :b :c8422; - :b :c8423; - :b :c8424; - :b :c8425; - :b :c8426; - :b :c8427; - :b :c8428; - :b :c8429; - :b :c8430; - :b :c8431; - :b :c8432; - :b :c8433; - :b :c8434; - :b :c8435; - :b :c8436; - :b :c8437; - :b :c8438; - :b :c8439; - :b :c8440; - :b :c8441; - :b :c8442; - :b :c8443; - :b :c8444; - :b :c8445; - :b :c8446; - :b :c8447; - :b :c8448; - :b :c8449; - :b :c8450; - :b :c8451; - :b :c8452; - :b :c8453; - :b :c8454; - :b :c8455; - :b :c8456; - :b :c8457; - :b :c8458; - :b :c8459; - :b :c8460; - :b :c8461; - :b :c8462; - :b :c8463; - :b :c8464; - :b :c8465; - :b :c8466; - :b :c8467; - :b :c8468; - :b :c8469; - :b :c8470; - :b :c8471; - :b :c8472; - :b :c8473; - :b :c8474; - :b :c8475; - :b :c8476; - :b :c8477; - :b :c8478; - :b :c8479; - :b :c8480; - :b :c8481; - :b :c8482; - :b :c8483; - :b :c8484; - :b :c8485; - :b :c8486; - :b :c8487; - :b :c8488; - :b :c8489; - :b :c8490; - :b :c8491; - :b :c8492; - :b :c8493; - :b :c8494; - :b :c8495; - :b :c8496; - :b :c8497; - :b :c8498; - :b :c8499; - :b :c8500; - :b :c8501; - :b :c8502; - :b :c8503; - :b :c8504; - :b :c8505; - :b :c8506; - :b :c8507; - :b :c8508; - :b :c8509; - :b :c8510; - :b :c8511; - :b :c8512; - :b :c8513; - :b :c8514; - :b :c8515; - :b :c8516; - :b :c8517; - :b :c8518; - :b :c8519; - :b :c8520; - :b :c8521; - :b :c8522; - :b :c8523; - :b :c8524; - :b :c8525; - :b :c8526; - :b :c8527; - :b :c8528; - :b :c8529; - :b :c8530; - :b :c8531; - :b :c8532; - :b :c8533; - :b :c8534; - :b :c8535; - :b :c8536; - :b :c8537; - :b :c8538; - :b :c8539; - :b :c8540; - :b :c8541; - :b :c8542; - :b :c8543; - :b :c8544; - :b :c8545; - :b :c8546; - :b :c8547; - :b :c8548; - :b :c8549; - :b :c8550; - :b :c8551; - :b :c8552; - :b :c8553; - :b :c8554; - :b :c8555; - :b :c8556; - :b :c8557; - :b :c8558; - :b :c8559; - :b :c8560; - :b :c8561; - :b :c8562; - :b :c8563; - :b :c8564; - :b :c8565; - :b :c8566; - :b :c8567; - :b :c8568; - :b :c8569; - :b :c8570; - :b :c8571; - :b :c8572; - :b :c8573; - :b :c8574; - :b :c8575; - :b :c8576; - :b :c8577; - :b :c8578; - :b :c8579; - :b :c8580; - :b :c8581; - :b :c8582; - :b :c8583; - :b :c8584; - :b :c8585; - :b :c8586; - :b :c8587; - :b :c8588; - :b :c8589; - :b :c8590; - :b :c8591; - :b :c8592; - :b :c8593; - :b :c8594; - :b :c8595; - :b :c8596; - :b :c8597; - :b :c8598; - :b :c8599; - :b :c8600; - :b :c8601; - :b :c8602; - :b :c8603; - :b :c8604; - :b :c8605; - :b :c8606; - :b :c8607; - :b :c8608; - :b :c8609; - :b :c8610; - :b :c8611; - :b :c8612; - :b :c8613; - :b :c8614; - :b :c8615; - :b :c8616; - :b :c8617; - :b :c8618; - :b :c8619; - :b :c8620; - :b :c8621; - :b :c8622; - :b :c8623; - :b :c8624; - :b :c8625; - :b :c8626; - :b :c8627; - :b :c8628; - :b :c8629; - :b :c8630; - :b :c8631; - :b :c8632; - :b :c8633; - :b :c8634; - :b :c8635; - :b :c8636; - :b :c8637; - :b :c8638; - :b :c8639; - :b :c8640; - :b :c8641; - :b :c8642; - :b :c8643; - :b :c8644; - :b :c8645; - :b :c8646; - :b :c8647; - :b :c8648; - :b :c8649; - :b :c8650; - :b :c8651; - :b :c8652; - :b :c8653; - :b :c8654; - :b :c8655; - :b :c8656; - :b :c8657; - :b :c8658; - :b :c8659; - :b :c8660; - :b :c8661; - :b :c8662; - :b :c8663; - :b :c8664; - :b :c8665; - :b :c8666; - :b :c8667; - :b :c8668; - :b :c8669; - :b :c8670; - :b :c8671; - :b :c8672; - :b :c8673; - :b :c8674; - :b :c8675; - :b :c8676; - :b :c8677; - :b :c8678; - :b :c8679; - :b :c8680; - :b :c8681; - :b :c8682; - :b :c8683; - :b :c8684; - :b :c8685; - :b :c8686; - :b :c8687; - :b :c8688; - :b :c8689; - :b :c8690; - :b :c8691; - :b :c8692; - :b :c8693; - :b :c8694; - :b :c8695; - :b :c8696; - :b :c8697; - :b :c8698; - :b :c8699; - :b :c8700; - :b :c8701; - :b :c8702; - :b :c8703; - :b :c8704; - :b :c8705; - :b :c8706; - :b :c8707; - :b :c8708; - :b :c8709; - :b :c8710; - :b :c8711; - :b :c8712; - :b :c8713; - :b :c8714; - :b :c8715; - :b :c8716; - :b :c8717; - :b :c8718; - :b :c8719; - :b :c8720; - :b :c8721; - :b :c8722; - :b :c8723; - :b :c8724; - :b :c8725; - :b :c8726; - :b :c8727; - :b :c8728; - :b :c8729; - :b :c8730; - :b :c8731; - :b :c8732; - :b :c8733; - :b :c8734; - :b :c8735; - :b :c8736; - :b :c8737; - :b :c8738; - :b :c8739; - :b :c8740; - :b :c8741; - :b :c8742; - :b :c8743; - :b :c8744; - :b :c8745; - :b :c8746; - :b :c8747; - :b :c8748; - :b :c8749; - :b :c8750; - :b :c8751; - :b :c8752; - :b :c8753; - :b :c8754; - :b :c8755; - :b :c8756; - :b :c8757; - :b :c8758; - :b :c8759; - :b :c8760; - :b :c8761; - :b :c8762; - :b :c8763; - :b :c8764; - :b :c8765; - :b :c8766; - :b :c8767; - :b :c8768; - :b :c8769; - :b :c8770; - :b :c8771; - :b :c8772; - :b :c8773; - :b :c8774; - :b :c8775; - :b :c8776; - :b :c8777; - :b :c8778; - :b :c8779; - :b :c8780; - :b :c8781; - :b :c8782; - :b :c8783; - :b :c8784; - :b :c8785; - :b :c8786; - :b :c8787; - :b :c8788; - :b :c8789; - :b :c8790; - :b :c8791; - :b :c8792; - :b :c8793; - :b :c8794; - :b :c8795; - :b :c8796; - :b :c8797; - :b :c8798; - :b :c8799; - :b :c8800; - :b :c8801; - :b :c8802; - :b :c8803; - :b :c8804; - :b :c8805; - :b :c8806; - :b :c8807; - :b :c8808; - :b :c8809; - :b :c8810; - :b :c8811; - :b :c8812; - :b :c8813; - :b :c8814; - :b :c8815; - :b :c8816; - :b :c8817; - :b :c8818; - :b :c8819; - :b :c8820; - :b :c8821; - :b :c8822; - :b :c8823; - :b :c8824; - :b :c8825; - :b :c8826; - :b :c8827; - :b :c8828; - :b :c8829; - :b :c8830; - :b :c8831; - :b :c8832; - :b :c8833; - :b :c8834; - :b :c8835; - :b :c8836; - :b :c8837; - :b :c8838; - :b :c8839; - :b :c8840; - :b :c8841; - :b :c8842; - :b :c8843; - :b :c8844; - :b :c8845; - :b :c8846; - :b :c8847; - :b :c8848; - :b :c8849; - :b :c8850; - :b :c8851; - :b :c8852; - :b :c8853; - :b :c8854; - :b :c8855; - :b :c8856; - :b :c8857; - :b :c8858; - :b :c8859; - :b :c8860; - :b :c8861; - :b :c8862; - :b :c8863; - :b :c8864; - :b :c8865; - :b :c8866; - :b :c8867; - :b :c8868; - :b :c8869; - :b :c8870; - :b :c8871; - :b :c8872; - :b :c8873; - :b :c8874; - :b :c8875; - :b :c8876; - :b :c8877; - :b :c8878; - :b :c8879; - :b :c8880; - :b :c8881; - :b :c8882; - :b :c8883; - :b :c8884; - :b :c8885; - :b :c8886; - :b :c8887; - :b :c8888; - :b :c8889; - :b :c8890; - :b :c8891; - :b :c8892; - :b :c8893; - :b :c8894; - :b :c8895; - :b :c8896; - :b :c8897; - :b :c8898; - :b :c8899; - :b :c8900; - :b :c8901; - :b :c8902; - :b :c8903; - :b :c8904; - :b :c8905; - :b :c8906; - :b :c8907; - :b :c8908; - :b :c8909; - :b :c8910; - :b :c8911; - :b :c8912; - :b :c8913; - :b :c8914; - :b :c8915; - :b :c8916; - :b :c8917; - :b :c8918; - :b :c8919; - :b :c8920; - :b :c8921; - :b :c8922; - :b :c8923; - :b :c8924; - :b :c8925; - :b :c8926; - :b :c8927; - :b :c8928; - :b :c8929; - :b :c8930; - :b :c8931; - :b :c8932; - :b :c8933; - :b :c8934; - :b :c8935; - :b :c8936; - :b :c8937; - :b :c8938; - :b :c8939; - :b :c8940; - :b :c8941; - :b :c8942; - :b :c8943; - :b :c8944; - :b :c8945; - :b :c8946; - :b :c8947; - :b :c8948; - :b :c8949; - :b :c8950; - :b :c8951; - :b :c8952; - :b :c8953; - :b :c8954; - :b :c8955; - :b :c8956; - :b :c8957; - :b :c8958; - :b :c8959; - :b :c8960; - :b :c8961; - :b :c8962; - :b :c8963; - :b :c8964; - :b :c8965; - :b :c8966; - :b :c8967; - :b :c8968; - :b :c8969; - :b :c8970; - :b :c8971; - :b :c8972; - :b :c8973; - :b :c8974; - :b :c8975; - :b :c8976; - :b :c8977; - :b :c8978; - :b :c8979; - :b :c8980; - :b :c8981; - :b :c8982; - :b :c8983; - :b :c8984; - :b :c8985; - :b :c8986; - :b :c8987; - :b :c8988; - :b :c8989; - :b :c8990; - :b :c8991; - :b :c8992; - :b :c8993; - :b :c8994; - :b :c8995; - :b :c8996; - :b :c8997; - :b :c8998; - :b :c8999; - :b :c9000; - :b :c9001; - :b :c9002; - :b :c9003; - :b :c9004; - :b :c9005; - :b :c9006; - :b :c9007; - :b :c9008; - :b :c9009; - :b :c9010; - :b :c9011; - :b :c9012; - :b :c9013; - :b :c9014; - :b :c9015; - :b :c9016; - :b :c9017; - :b :c9018; - :b :c9019; - :b :c9020; - :b :c9021; - :b :c9022; - :b :c9023; - :b :c9024; - :b :c9025; - :b :c9026; - :b :c9027; - :b :c9028; - :b :c9029; - :b :c9030; - :b :c9031; - :b :c9032; - :b :c9033; - :b :c9034; - :b :c9035; - :b :c9036; - :b :c9037; - :b :c9038; - :b :c9039; - :b :c9040; - :b :c9041; - :b :c9042; - :b :c9043; - :b :c9044; - :b :c9045; - :b :c9046; - :b :c9047; - :b :c9048; - :b :c9049; - :b :c9050; - :b :c9051; - :b :c9052; - :b :c9053; - :b :c9054; - :b :c9055; - :b :c9056; - :b :c9057; - :b :c9058; - :b :c9059; - :b :c9060; - :b :c9061; - :b :c9062; - :b :c9063; - :b :c9064; - :b :c9065; - :b :c9066; - :b :c9067; - :b :c9068; - :b :c9069; - :b :c9070; - :b :c9071; - :b :c9072; - :b :c9073; - :b :c9074; - :b :c9075; - :b :c9076; - :b :c9077; - :b :c9078; - :b :c9079; - :b :c9080; - :b :c9081; - :b :c9082; - :b :c9083; - :b :c9084; - :b :c9085; - :b :c9086; - :b :c9087; - :b :c9088; - :b :c9089; - :b :c9090; - :b :c9091; - :b :c9092; - :b :c9093; - :b :c9094; - :b :c9095; - :b :c9096; - :b :c9097; - :b :c9098; - :b :c9099; - :b :c9100; - :b :c9101; - :b :c9102; - :b :c9103; - :b :c9104; - :b :c9105; - :b :c9106; - :b :c9107; - :b :c9108; - :b :c9109; - :b :c9110; - :b :c9111; - :b :c9112; - :b :c9113; - :b :c9114; - :b :c9115; - :b :c9116; - :b :c9117; - :b :c9118; - :b :c9119; - :b :c9120; - :b :c9121; - :b :c9122; - :b :c9123; - :b :c9124; - :b :c9125; - :b :c9126; - :b :c9127; - :b :c9128; - :b :c9129; - :b :c9130; - :b :c9131; - :b :c9132; - :b :c9133; - :b :c9134; - :b :c9135; - :b :c9136; - :b :c9137; - :b :c9138; - :b :c9139; - :b :c9140; - :b :c9141; - :b :c9142; - :b :c9143; - :b :c9144; - :b :c9145; - :b :c9146; - :b :c9147; - :b :c9148; - :b :c9149; - :b :c9150; - :b :c9151; - :b :c9152; - :b :c9153; - :b :c9154; - :b :c9155; - :b :c9156; - :b :c9157; - :b :c9158; - :b :c9159; - :b :c9160; - :b :c9161; - :b :c9162; - :b :c9163; - :b :c9164; - :b :c9165; - :b :c9166; - :b :c9167; - :b :c9168; - :b :c9169; - :b :c9170; - :b :c9171; - :b :c9172; - :b :c9173; - :b :c9174; - :b :c9175; - :b :c9176; - :b :c9177; - :b :c9178; - :b :c9179; - :b :c9180; - :b :c9181; - :b :c9182; - :b :c9183; - :b :c9184; - :b :c9185; - :b :c9186; - :b :c9187; - :b :c9188; - :b :c9189; - :b :c9190; - :b :c9191; - :b :c9192; - :b :c9193; - :b :c9194; - :b :c9195; - :b :c9196; - :b :c9197; - :b :c9198; - :b :c9199; - :b :c9200; - :b :c9201; - :b :c9202; - :b :c9203; - :b :c9204; - :b :c9205; - :b :c9206; - :b :c9207; - :b :c9208; - :b :c9209; - :b :c9210; - :b :c9211; - :b :c9212; - :b :c9213; - :b :c9214; - :b :c9215; - :b :c9216; - :b :c9217; - :b :c9218; - :b :c9219; - :b :c9220; - :b :c9221; - :b :c9222; - :b :c9223; - :b :c9224; - :b :c9225; - :b :c9226; - :b :c9227; - :b :c9228; - :b :c9229; - :b :c9230; - :b :c9231; - :b :c9232; - :b :c9233; - :b :c9234; - :b :c9235; - :b :c9236; - :b :c9237; - :b :c9238; - :b :c9239; - :b :c9240; - :b :c9241; - :b :c9242; - :b :c9243; - :b :c9244; - :b :c9245; - :b :c9246; - :b :c9247; - :b :c9248; - :b :c9249; - :b :c9250; - :b :c9251; - :b :c9252; - :b :c9253; - :b :c9254; - :b :c9255; - :b :c9256; - :b :c9257; - :b :c9258; - :b :c9259; - :b :c9260; - :b :c9261; - :b :c9262; - :b :c9263; - :b :c9264; - :b :c9265; - :b :c9266; - :b :c9267; - :b :c9268; - :b :c9269; - :b :c9270; - :b :c9271; - :b :c9272; - :b :c9273; - :b :c9274; - :b :c9275; - :b :c9276; - :b :c9277; - :b :c9278; - :b :c9279; - :b :c9280; - :b :c9281; - :b :c9282; - :b :c9283; - :b :c9284; - :b :c9285; - :b :c9286; - :b :c9287; - :b :c9288; - :b :c9289; - :b :c9290; - :b :c9291; - :b :c9292; - :b :c9293; - :b :c9294; - :b :c9295; - :b :c9296; - :b :c9297; - :b :c9298; - :b :c9299; - :b :c9300; - :b :c9301; - :b :c9302; - :b :c9303; - :b :c9304; - :b :c9305; - :b :c9306; - :b :c9307; - :b :c9308; - :b :c9309; - :b :c9310; - :b :c9311; - :b :c9312; - :b :c9313; - :b :c9314; - :b :c9315; - :b :c9316; - :b :c9317; - :b :c9318; - :b :c9319; - :b :c9320; - :b :c9321; - :b :c9322; - :b :c9323; - :b :c9324; - :b :c9325; - :b :c9326; - :b :c9327; - :b :c9328; - :b :c9329; - :b :c9330; - :b :c9331; - :b :c9332; - :b :c9333; - :b :c9334; - :b :c9335; - :b :c9336; - :b :c9337; - :b :c9338; - :b :c9339; - :b :c9340; - :b :c9341; - :b :c9342; - :b :c9343; - :b :c9344; - :b :c9345; - :b :c9346; - :b :c9347; - :b :c9348; - :b :c9349; - :b :c9350; - :b :c9351; - :b :c9352; - :b :c9353; - :b :c9354; - :b :c9355; - :b :c9356; - :b :c9357; - :b :c9358; - :b :c9359; - :b :c9360; - :b :c9361; - :b :c9362; - :b :c9363; - :b :c9364; - :b :c9365; - :b :c9366; - :b :c9367; - :b :c9368; - :b :c9369; - :b :c9370; - :b :c9371; - :b :c9372; - :b :c9373; - :b :c9374; - :b :c9375; - :b :c9376; - :b :c9377; - :b :c9378; - :b :c9379; - :b :c9380; - :b :c9381; - :b :c9382; - :b :c9383; - :b :c9384; - :b :c9385; - :b :c9386; - :b :c9387; - :b :c9388; - :b :c9389; - :b :c9390; - :b :c9391; - :b :c9392; - :b :c9393; - :b :c9394; - :b :c9395; - :b :c9396; - :b :c9397; - :b :c9398; - :b :c9399; - :b :c9400; - :b :c9401; - :b :c9402; - :b :c9403; - :b :c9404; - :b :c9405; - :b :c9406; - :b :c9407; - :b :c9408; - :b :c9409; - :b :c9410; - :b :c9411; - :b :c9412; - :b :c9413; - :b :c9414; - :b :c9415; - :b :c9416; - :b :c9417; - :b :c9418; - :b :c9419; - :b :c9420; - :b :c9421; - :b :c9422; - :b :c9423; - :b :c9424; - :b :c9425; - :b :c9426; - :b :c9427; - :b :c9428; - :b :c9429; - :b :c9430; - :b :c9431; - :b :c9432; - :b :c9433; - :b :c9434; - :b :c9435; - :b :c9436; - :b :c9437; - :b :c9438; - :b :c9439; - :b :c9440; - :b :c9441; - :b :c9442; - :b :c9443; - :b :c9444; - :b :c9445; - :b :c9446; - :b :c9447; - :b :c9448; - :b :c9449; - :b :c9450; - :b :c9451; - :b :c9452; - :b :c9453; - :b :c9454; - :b :c9455; - :b :c9456; - :b :c9457; - :b :c9458; - :b :c9459; - :b :c9460; - :b :c9461; - :b :c9462; - :b :c9463; - :b :c9464; - :b :c9465; - :b :c9466; - :b :c9467; - :b :c9468; - :b :c9469; - :b :c9470; - :b :c9471; - :b :c9472; - :b :c9473; - :b :c9474; - :b :c9475; - :b :c9476; - :b :c9477; - :b :c9478; - :b :c9479; - :b :c9480; - :b :c9481; - :b :c9482; - :b :c9483; - :b :c9484; - :b :c9485; - :b :c9486; - :b :c9487; - :b :c9488; - :b :c9489; - :b :c9490; - :b :c9491; - :b :c9492; - :b :c9493; - :b :c9494; - :b :c9495; - :b :c9496; - :b :c9497; - :b :c9498; - :b :c9499; - :b :c9500; - :b :c9501; - :b :c9502; - :b :c9503; - :b :c9504; - :b :c9505; - :b :c9506; - :b :c9507; - :b :c9508; - :b :c9509; - :b :c9510; - :b :c9511; - :b :c9512; - :b :c9513; - :b :c9514; - :b :c9515; - :b :c9516; - :b :c9517; - :b :c9518; - :b :c9519; - :b :c9520; - :b :c9521; - :b :c9522; - :b :c9523; - :b :c9524; - :b :c9525; - :b :c9526; - :b :c9527; - :b :c9528; - :b :c9529; - :b :c9530; - :b :c9531; - :b :c9532; - :b :c9533; - :b :c9534; - :b :c9535; - :b :c9536; - :b :c9537; - :b :c9538; - :b :c9539; - :b :c9540; - :b :c9541; - :b :c9542; - :b :c9543; - :b :c9544; - :b :c9545; - :b :c9546; - :b :c9547; - :b :c9548; - :b :c9549; - :b :c9550; - :b :c9551; - :b :c9552; - :b :c9553; - :b :c9554; - :b :c9555; - :b :c9556; - :b :c9557; - :b :c9558; - :b :c9559; - :b :c9560; - :b :c9561; - :b :c9562; - :b :c9563; - :b :c9564; - :b :c9565; - :b :c9566; - :b :c9567; - :b :c9568; - :b :c9569; - :b :c9570; - :b :c9571; - :b :c9572; - :b :c9573; - :b :c9574; - :b :c9575; - :b :c9576; - :b :c9577; - :b :c9578; - :b :c9579; - :b :c9580; - :b :c9581; - :b :c9582; - :b :c9583; - :b :c9584; - :b :c9585; - :b :c9586; - :b :c9587; - :b :c9588; - :b :c9589; - :b :c9590; - :b :c9591; - :b :c9592; - :b :c9593; - :b :c9594; - :b :c9595; - :b :c9596; - :b :c9597; - :b :c9598; - :b :c9599; - :b :c9600; - :b :c9601; - :b :c9602; - :b :c9603; - :b :c9604; - :b :c9605; - :b :c9606; - :b :c9607; - :b :c9608; - :b :c9609; - :b :c9610; - :b :c9611; - :b :c9612; - :b :c9613; - :b :c9614; - :b :c9615; - :b :c9616; - :b :c9617; - :b :c9618; - :b :c9619; - :b :c9620; - :b :c9621; - :b :c9622; - :b :c9623; - :b :c9624; - :b :c9625; - :b :c9626; - :b :c9627; - :b :c9628; - :b :c9629; - :b :c9630; - :b :c9631; - :b :c9632; - :b :c9633; - :b :c9634; - :b :c9635; - :b :c9636; - :b :c9637; - :b :c9638; - :b :c9639; - :b :c9640; - :b :c9641; - :b :c9642; - :b :c9643; - :b :c9644; - :b :c9645; - :b :c9646; - :b :c9647; - :b :c9648; - :b :c9649; - :b :c9650; - :b :c9651; - :b :c9652; - :b :c9653; - :b :c9654; - :b :c9655; - :b :c9656; - :b :c9657; - :b :c9658; - :b :c9659; - :b :c9660; - :b :c9661; - :b :c9662; - :b :c9663; - :b :c9664; - :b :c9665; - :b :c9666; - :b :c9667; - :b :c9668; - :b :c9669; - :b :c9670; - :b :c9671; - :b :c9672; - :b :c9673; - :b :c9674; - :b :c9675; - :b :c9676; - :b :c9677; - :b :c9678; - :b :c9679; - :b :c9680; - :b :c9681; - :b :c9682; - :b :c9683; - :b :c9684; - :b :c9685; - :b :c9686; - :b :c9687; - :b :c9688; - :b :c9689; - :b :c9690; - :b :c9691; - :b :c9692; - :b :c9693; - :b :c9694; - :b :c9695; - :b :c9696; - :b :c9697; - :b :c9698; - :b :c9699; - :b :c9700; - :b :c9701; - :b :c9702; - :b :c9703; - :b :c9704; - :b :c9705; - :b :c9706; - :b :c9707; - :b :c9708; - :b :c9709; - :b :c9710; - :b :c9711; - :b :c9712; - :b :c9713; - :b :c9714; - :b :c9715; - :b :c9716; - :b :c9717; - :b :c9718; - :b :c9719; - :b :c9720; - :b :c9721; - :b :c9722; - :b :c9723; - :b :c9724; - :b :c9725; - :b :c9726; - :b :c9727; - :b :c9728; - :b :c9729; - :b :c9730; - :b :c9731; - :b :c9732; - :b :c9733; - :b :c9734; - :b :c9735; - :b :c9736; - :b :c9737; - :b :c9738; - :b :c9739; - :b :c9740; - :b :c9741; - :b :c9742; - :b :c9743; - :b :c9744; - :b :c9745; - :b :c9746; - :b :c9747; - :b :c9748; - :b :c9749; - :b :c9750; - :b :c9751; - :b :c9752; - :b :c9753; - :b :c9754; - :b :c9755; - :b :c9756; - :b :c9757; - :b :c9758; - :b :c9759; - :b :c9760; - :b :c9761; - :b :c9762; - :b :c9763; - :b :c9764; - :b :c9765; - :b :c9766; - :b :c9767; - :b :c9768; - :b :c9769; - :b :c9770; - :b :c9771; - :b :c9772; - :b :c9773; - :b :c9774; - :b :c9775; - :b :c9776; - :b :c9777; - :b :c9778; - :b :c9779; - :b :c9780; - :b :c9781; - :b :c9782; - :b :c9783; - :b :c9784; - :b :c9785; - :b :c9786; - :b :c9787; - :b :c9788; - :b :c9789; - :b :c9790; - :b :c9791; - :b :c9792; - :b :c9793; - :b :c9794; - :b :c9795; - :b :c9796; - :b :c9797; - :b :c9798; - :b :c9799; - :b :c9800; - :b :c9801; - :b :c9802; - :b :c9803; - :b :c9804; - :b :c9805; - :b :c9806; - :b :c9807; - :b :c9808; - :b :c9809; - :b :c9810; - :b :c9811; - :b :c9812; - :b :c9813; - :b :c9814; - :b :c9815; - :b :c9816; - :b :c9817; - :b :c9818; - :b :c9819; - :b :c9820; - :b :c9821; - :b :c9822; - :b :c9823; - :b :c9824; - :b :c9825; - :b :c9826; - :b :c9827; - :b :c9828; - :b :c9829; - :b :c9830; - :b :c9831; - :b :c9832; - :b :c9833; - :b :c9834; - :b :c9835; - :b :c9836; - :b :c9837; - :b :c9838; - :b :c9839; - :b :c9840; - :b :c9841; - :b :c9842; - :b :c9843; - :b :c9844; - :b :c9845; - :b :c9846; - :b :c9847; - :b :c9848; - :b :c9849; - :b :c9850; - :b :c9851; - :b :c9852; - :b :c9853; - :b :c9854; - :b :c9855; - :b :c9856; - :b :c9857; - :b :c9858; - :b :c9859; - :b :c9860; - :b :c9861; - :b :c9862; - :b :c9863; - :b :c9864; - :b :c9865; - :b :c9866; - :b :c9867; - :b :c9868; - :b :c9869; - :b :c9870; - :b :c9871; - :b :c9872; - :b :c9873; - :b :c9874; - :b :c9875; - :b :c9876; - :b :c9877; - :b :c9878; - :b :c9879; - :b :c9880; - :b :c9881; - :b :c9882; - :b :c9883; - :b :c9884; - :b :c9885; - :b :c9886; - :b :c9887; - :b :c9888; - :b :c9889; - :b :c9890; - :b :c9891; - :b :c9892; - :b :c9893; - :b :c9894; - :b :c9895; - :b :c9896; - :b :c9897; - :b :c9898; - :b :c9899; - :b :c9900; - :b :c9901; - :b :c9902; - :b :c9903; - :b :c9904; - :b :c9905; - :b :c9906; - :b :c9907; - :b :c9908; - :b :c9909; - :b :c9910; - :b :c9911; - :b :c9912; - :b :c9913; - :b :c9914; - :b :c9915; - :b :c9916; - :b :c9917; - :b :c9918; - :b :c9919; - :b :c9920; - :b :c9921; - :b :c9922; - :b :c9923; - :b :c9924; - :b :c9925; - :b :c9926; - :b :c9927; - :b :c9928; - :b :c9929; - :b :c9930; - :b :c9931; - :b :c9932; - :b :c9933; - :b :c9934; - :b :c9935; - :b :c9936; - :b :c9937; - :b :c9938; - :b :c9939; - :b :c9940; - :b :c9941; - :b :c9942; - :b :c9943; - :b :c9944; - :b :c9945; - :b :c9946; - :b :c9947; - :b :c9948; - :b :c9949; - :b :c9950; - :b :c9951; - :b :c9952; - :b :c9953; - :b :c9954; - :b :c9955; - :b :c9956; - :b :c9957; - :b :c9958; - :b :c9959; - :b :c9960; - :b :c9961; - :b :c9962; - :b :c9963; - :b :c9964; - :b :c9965; - :b :c9966; - :b :c9967; - :b :c9968; - :b :c9969; - :b :c9970; - :b :c9971; - :b :c9972; - :b :c9973; - :b :c9974; - :b :c9975; - :b :c9976; - :b :c9977; - :b :c9978; - :b :c9979; - :b :c9980; - :b :c9981; - :b :c9982; - :b :c9983; - :b :c9984; - :b :c9985; - :b :c9986; - :b :c9987; - :b :c9988; - :b :c9989; - :b :c9990; - :b :c9991; - :b :c9992; - :b :c9993; - :b :c9994; - :b :c9995; - :b :c9996; - :b :c9997; - :b :c9998; - :b :c9999; - :b :c10000 . diff --git a/packages/semweb/Tests/Turtle/test-17.out b/packages/semweb/Tests/Turtle/test-17.out deleted file mode 100644 index 466edbb2d..000000000 --- a/packages/semweb/Tests/Turtle/test-17.out +++ /dev/null @@ -1 +0,0 @@ - "a long\n\tliteral\nwith\nnewlines" . diff --git a/packages/semweb/Tests/Turtle/test-17.ttl b/packages/semweb/Tests/Turtle/test-17.ttl deleted file mode 100644 index 86c453bd8..000000000 --- a/packages/semweb/Tests/Turtle/test-17.ttl +++ /dev/null @@ -1,6 +0,0 @@ -# Test long literal -@prefix : . -:a :b """a long - literal -with -newlines""" . diff --git a/packages/semweb/Tests/Turtle/test-18.out b/packages/semweb/Tests/Turtle/test-18.out deleted file mode 100644 index 4ff4b95b3..000000000 --- a/packages/semweb/Tests/Turtle/test-18.out +++ /dev/null @@ -1,2 +0,0 @@ - "\nthis \ris a \U00015678long\t\nliteral\uABCD\n" . - "\tThis \uABCDis\r \U00015678another\n\none\n" . diff --git a/packages/semweb/Tests/Turtle/test-18.ttl b/packages/semweb/Tests/Turtle/test-18.ttl deleted file mode 100644 index 1adfa4516..000000000 --- a/packages/semweb/Tests/Turtle/test-18.ttl +++ /dev/null @@ -1,9 +0,0 @@ -@prefix : . - -:a :b """\nthis \ris a \U00015678long\t -literal\uABCD -""" . - -:d :e """\tThis \uABCDis\r \U00015678another\n -one -""" . diff --git a/packages/semweb/Tests/Turtle/test-19.out b/packages/semweb/Tests/Turtle/test-19.out deleted file mode 100644 index 2e2dbe404..000000000 --- a/packages/semweb/Tests/Turtle/test-19.out +++ /dev/null @@ -1 +0,0 @@ - "1.0"^^ . diff --git a/packages/semweb/Tests/Turtle/test-19.ttl b/packages/semweb/Tests/Turtle/test-19.ttl deleted file mode 100644 index 9de0c07b2..000000000 --- a/packages/semweb/Tests/Turtle/test-19.ttl +++ /dev/null @@ -1,4 +0,0 @@ -@prefix : . - -:a :b 1.0 . - diff --git a/packages/semweb/Tests/Turtle/test-20.out b/packages/semweb/Tests/Turtle/test-20.out deleted file mode 100644 index fff2da56b..000000000 --- a/packages/semweb/Tests/Turtle/test-20.out +++ /dev/null @@ -1,2 +0,0 @@ - "" . - "" . diff --git a/packages/semweb/Tests/Turtle/test-20.ttl b/packages/semweb/Tests/Turtle/test-20.ttl deleted file mode 100644 index 37a9a4f33..000000000 --- a/packages/semweb/Tests/Turtle/test-20.ttl +++ /dev/null @@ -1,6 +0,0 @@ -@prefix : . - -:a :b "" . - -:c :d """""" . - diff --git a/packages/semweb/Tests/Turtle/test-21.out b/packages/semweb/Tests/Turtle/test-21.out deleted file mode 100644 index d5dca6907..000000000 --- a/packages/semweb/Tests/Turtle/test-21.out +++ /dev/null @@ -1,3 +0,0 @@ - "1.0"^^ . - "1"^^ . - "1.0e0"^^ . diff --git a/packages/semweb/Tests/Turtle/test-21.ttl b/packages/semweb/Tests/Turtle/test-21.ttl deleted file mode 100644 index a8e8dc15a..000000000 --- a/packages/semweb/Tests/Turtle/test-21.ttl +++ /dev/null @@ -1,4 +0,0 @@ -@prefix : . -:a :b 1.0 . -:c :d 1 . -:e :f 1.0e0 . diff --git a/packages/semweb/Tests/Turtle/test-22.out b/packages/semweb/Tests/Turtle/test-22.out deleted file mode 100644 index 3d0f970e8..000000000 --- a/packages/semweb/Tests/Turtle/test-22.out +++ /dev/null @@ -1,3 +0,0 @@ - "-1.0"^^ . - "-1"^^ . - "-1.0e0"^^ . diff --git a/packages/semweb/Tests/Turtle/test-22.ttl b/packages/semweb/Tests/Turtle/test-22.ttl deleted file mode 100644 index 9b1a725aa..000000000 --- a/packages/semweb/Tests/Turtle/test-22.ttl +++ /dev/null @@ -1,4 +0,0 @@ -@prefix : . -:a :b -1.0 . -:c :d -1 . -:e :f -1.0e0 . diff --git a/packages/semweb/Tests/Turtle/test-23.out b/packages/semweb/Tests/Turtle/test-23.out deleted file mode 100644 index fde31312e..000000000 --- a/packages/semweb/Tests/Turtle/test-23.out +++ /dev/null @@ -1 +0,0 @@ - "John said: \"Hello World!\"" . diff --git a/packages/semweb/Tests/Turtle/test-23.ttl b/packages/semweb/Tests/Turtle/test-23.ttl deleted file mode 100644 index 9f5360af8..000000000 --- a/packages/semweb/Tests/Turtle/test-23.ttl +++ /dev/null @@ -1,3 +0,0 @@ -# Test long literal -@prefix : . -:a :b """John said: "Hello World!\"""" . diff --git a/packages/semweb/Tests/Turtle/test-24.out b/packages/semweb/Tests/Turtle/test-24.out deleted file mode 100644 index 5a70bff19..000000000 --- a/packages/semweb/Tests/Turtle/test-24.out +++ /dev/null @@ -1,2 +0,0 @@ - "true"^^ . - "false"^^ . diff --git a/packages/semweb/Tests/Turtle/test-24.ttl b/packages/semweb/Tests/Turtle/test-24.ttl deleted file mode 100644 index 25f3b7579..000000000 --- a/packages/semweb/Tests/Turtle/test-24.ttl +++ /dev/null @@ -1,3 +0,0 @@ -@prefix : . -:a :b true . -:c :d false . diff --git a/packages/semweb/Tests/Turtle/test-25.out b/packages/semweb/Tests/Turtle/test-25.out deleted file mode 100644 index 1a38415fe..000000000 --- a/packages/semweb/Tests/Turtle/test-25.out +++ /dev/null @@ -1,7 +0,0 @@ - . - . - . - . - . - . - . diff --git a/packages/semweb/Tests/Turtle/test-25.ttl b/packages/semweb/Tests/Turtle/test-25.ttl deleted file mode 100644 index 310349da1..000000000 --- a/packages/semweb/Tests/Turtle/test-25.ttl +++ /dev/null @@ -1,14 +0,0 @@ -# comment test -@prefix : . -:a :b :c . # end of line comment -:d # ignore me - :e # and me - :f # and me - . -:g :h #ignore me - :i, # and me - :j . # and me - -:k :l :m ; #ignore me - :n :o ; # and me - :p :q . # and me diff --git a/packages/semweb/Tests/Turtle/test-26.out b/packages/semweb/Tests/Turtle/test-26.out deleted file mode 100644 index ad105cf48..000000000 --- a/packages/semweb/Tests/Turtle/test-26.out +++ /dev/null @@ -1 +0,0 @@ - . diff --git a/packages/semweb/Tests/Turtle/test-26.ttl b/packages/semweb/Tests/Turtle/test-26.ttl deleted file mode 100644 index 0667c6b4a..000000000 --- a/packages/semweb/Tests/Turtle/test-26.ttl +++ /dev/null @@ -1,4 +0,0 @@ -# comment line with no final newline test -@prefix : . -:a :b :c . -#foo diff --git a/packages/semweb/Tests/Turtle/test-27.out b/packages/semweb/Tests/Turtle/test-27.out deleted file mode 100644 index 7da0635ba..000000000 --- a/packages/semweb/Tests/Turtle/test-27.out +++ /dev/null @@ -1 +0,0 @@ - . diff --git a/packages/semweb/Tests/Turtle/test-27.ttl b/packages/semweb/Tests/Turtle/test-27.ttl deleted file mode 100644 index 569023c8a..000000000 --- a/packages/semweb/Tests/Turtle/test-27.ttl +++ /dev/null @@ -1,5 +0,0 @@ -@prefix foo: . -@prefix foo: . - -foo:blah foo:blah foo:blah . - diff --git a/packages/semweb/Tests/Turtle/test-28-out.ttl b/packages/semweb/Tests/Turtle/test-28-out.ttl deleted file mode 100644 index f3831dab6..000000000 --- a/packages/semweb/Tests/Turtle/test-28-out.ttl +++ /dev/null @@ -1,6 +0,0 @@ -@base . -@prefix rdf: <../../../../../1999/02/22-rdf-syntax-ns#> . - - - 2.345, 1, 1.0, 1., 1.000000000, 2.3, 2.234000005, 2.2340000005, 2.23400000005, 2.234000000005, 2.2340000000005, 2.23400000000005, 2.234000000000005, 2.2340000000000005, 2.23400000000000005, 2.234000000000000005, 2.2340000000000000005, 2.23400000000000000005, 2.234000000000000000005, 2.2340000000000000000005, 2.23400000000000000000005, 1.2345678901234567890123457890 . - diff --git a/packages/semweb/Tests/Turtle/test-28.out b/packages/semweb/Tests/Turtle/test-28.out deleted file mode 100644 index 0c15476ad..000000000 --- a/packages/semweb/Tests/Turtle/test-28.out +++ /dev/null @@ -1,22 +0,0 @@ - "2.345"^^ . - "1.0"^^ . - "1.0"^^ . - "1.0"^^ . - "1.0"^^ . - "2.30"^^ . - "2.234000005"^^ . - "2.2340000005"^^ . - "2.23400000005"^^ . - "2.234000000005"^^ . - "2.2340000000005"^^ . - "2.23400000000005"^^ . - "2.234000000000005"^^ . - "2.2340000000000005"^^ . - "2.234"^^ . - "2.234"^^ . - "2.234"^^ . - "2.234"^^ . - "2.234"^^ . - "2.234"^^ . - "2.234"^^ . - "1.2345678901234567"^^ . diff --git a/packages/semweb/Tests/Turtle/test-28.ttl b/packages/semweb/Tests/Turtle/test-28.ttl deleted file mode 100644 index 7357dd40c..000000000 --- a/packages/semweb/Tests/Turtle/test-28.ttl +++ /dev/null @@ -1,22 +0,0 @@ - "2.345"^^ . - "1"^^ . - "1.0"^^ . - "1."^^ . - "1.000000000"^^ . - "2.3"^^ . - "2.234000005"^^ . - "2.2340000005"^^ . - "2.23400000005"^^ . - "2.234000000005"^^ . - "2.2340000000005"^^ . - "2.23400000000005"^^ . - "2.234000000000005"^^ . - "2.2340000000000005"^^ . - "2.23400000000000005"^^ . - "2.234000000000000005"^^ . - "2.2340000000000000005"^^ . - "2.23400000000000000005"^^ . - "2.234000000000000000005"^^ . - "2.2340000000000000000005"^^ . - "2.23400000000000000000005"^^ . - "1.2345678901234567890123457890"^^ . diff --git a/packages/semweb/Tests/Turtle/test-29.out b/packages/semweb/Tests/Turtle/test-29.out deleted file mode 100644 index 612052d3b..000000000 --- a/packages/semweb/Tests/Turtle/test-29.out +++ /dev/null @@ -1 +0,0 @@ - . diff --git a/packages/semweb/Tests/Turtle/test-29.ttl b/packages/semweb/Tests/Turtle/test-29.ttl deleted file mode 100644 index 612052d3b..000000000 --- a/packages/semweb/Tests/Turtle/test-29.ttl +++ /dev/null @@ -1 +0,0 @@ - . diff --git a/packages/semweb/Tests/Turtle/test-30.out b/packages/semweb/Tests/Turtle/test-30.out deleted file mode 100644 index ce5c67d04..000000000 --- a/packages/semweb/Tests/Turtle/test-30.out +++ /dev/null @@ -1,5 +0,0 @@ - . - . - . - . - . diff --git a/packages/semweb/Tests/Turtle/test-30.ttl b/packages/semweb/Tests/Turtle/test-30.ttl deleted file mode 100644 index 6721ec243..000000000 --- a/packages/semweb/Tests/Turtle/test-30.ttl +++ /dev/null @@ -1,12 +0,0 @@ -# In-scope base URI is http://www.w3.org/2001/sw/DataAccess/df1/tests/ at this point - . -@base . -# In-scope base URI is http://example.org/ns/ at this point - . -@base . -# In-scope base URI is http://example.org/ns/foo/ at this point - . -@prefix : . -:a4 :b4 :c4 . -@prefix : . -:a5 :b5 :c5 . diff --git a/packages/semweb/Tests/lit.pl b/packages/semweb/Tests/lit.pl deleted file mode 100644 index 6776b4654..000000000 --- a/packages/semweb/Tests/lit.pl +++ /dev/null @@ -1,41 +0,0 @@ -:- module(lit, - [ lit/0 - ]). -:- use_module('../rdf_db'). - -data(string, ''). -data(string, 'This is a nice string'). - -data(int, 0). -data(int, -67). -data(int, 327848). - -data(float, 0.0). -data(float, 48.25). - -data(term, [let, us, test, a, list]). -data(term, [let, us, test, another, list]). - -create :- - ( data(Type, Value), - rdf_assert(subject, Type, literal(Value)), - fail - ; true - ). - -lookup :- - findall(T-V, (rdf(subject, T, X), X = literal(V)), Pairs), - findall(T-V, data(T, V), Data), - Data == Pairs. - - - /******************************* - * MAIN * - *******************************/ - -lit :- - rdf_reset_db, - create, - lookup. - - diff --git a/packages/semweb/Tests/subprop.pl b/packages/semweb/Tests/subprop.pl deleted file mode 100644 index b8526a621..000000000 --- a/packages/semweb/Tests/subprop.pl +++ /dev/null @@ -1,32 +0,0 @@ -:- module(subprop, - [ subprop/0 - ]). -:- use_module('../rdf_db'). - -rdf_db:ns(test, 'http://www.test.org/'). - -% :- rdf_debug(10). - -t1 :- - rdf_assert(test:a, rdfs:subPropertyOf, test:r1), - rdf_assert(test:jan, test:a, literal(jan)). - -t2 :- - rdf_assert(test:a, rdfs:subPropertyOf, test:r1), - rdf_assert(test:a, rdfs:subPropertyOf, test:r2), - rdf_assert(test:jan, test:a, literal(jan)). - -t3 :- - rdf_assert(test:a, rdfs:subPropertyOf, test:r1), - rdf_assert(test:a, rdfs:subPropertyOf, test:r2), - rdf_assert(test:b, rdfs:subPropertyOf, test:r3), - rdf_assert(test:b, rdfs:subPropertyOf, test:r4), - rdf_assert(test:c, rdfs:subPropertyOf, test:a), - rdf_assert(test:c, rdfs:subPropertyOf, test:b), - rdf_assert(test:jan, test:a, literal(jan)). - -subprop :- - rdf_reset_db, - t3, - rdf_has(test:jan, test:r1, Name), - Name == literal(jan). diff --git a/packages/semweb/Tests/test-001.rdf b/packages/semweb/Tests/test-001.rdf deleted file mode 100644 index 32d9ba8ba..000000000 --- a/packages/semweb/Tests/test-001.rdf +++ /dev/null @@ -1,17 +0,0 @@ - - - - - ]> - - - - - - - - - diff --git a/packages/semweb/Tests/test-002.rdf.gz b/packages/semweb/Tests/test-002.rdf.gz deleted file mode 100644 index e9ffb613cc490c97a770d98962b87f462ed28bc4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 229 zcmVDyi&vDTr1|S?I+htztQYcPm znk6fE0C0$Kly35MURVlFFG_Wk5UsVNXAT!N@q!>Au1|a)n+Yr*OqF-cu_L6{9$%+n4EN2oYpY&;Dpd&}#+G|uYo20~8Wf?4$#eACJWy6? fI9uk(Ds4wI&Q%OT@&ybUOk?l_J#sBkEdc-kY;Rm% diff --git a/packages/semweb/atom.c b/packages/semweb/atom.c deleted file mode 100644 index 60a169dd9..000000000 --- a/packages/semweb/atom.c +++ /dev/null @@ -1,731 +0,0 @@ -/* $Id$ - - Part of the SWI-Prolog Semweb package - - Author: Jan Wielemaker - E-mail: wielemak@science.uva.nl - WWW: http://www.swi-prolog.org - Copyright (C): 2006, University of Amsterdam - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include -#include "atom.h" -#include "murmur.h" -#include -#include -#include - -#ifdef __WINDOWS__ -#define inline __inline -#endif - -#include "unicode_map.c" - - - /******************************* - * TEXT HANDLING * - *******************************/ - -static inline int -get_atom_text(atom_t atom, text *txt) -{ if ( (txt->a = (const charA*)PL_atom_nchars(atom, &txt->length)) ) - { txt->w = NULL; - return TRUE; - } - if ( (txt->w = (const charW*)PL_atom_wchars(atom, &txt->length)) ) - { txt->a = NULL; - return TRUE; - } - - return FALSE; -} - - -inline wint_t -fetch(const text *txt, int i) -{ return txt->a ? (wint_t)txt->a[i] : (wint_t)txt->w[i]; -} - - -static int -fill_atom_info(atom_info *info) -{ if ( !info->resolved ) - { info->resolved = TRUE; - - if ( !(info->rc=get_atom_text(info->handle, &info->text)) ) - { info->text.a = NULL; - info->text.w = NULL; - } - } - - return info->rc; -} - - - /******************************* - * COMPARE * - *******************************/ - -static inline int -cmpA(int c1, int c2, int *dl2) -{ if ( c1 == c2 ) - { return 0; - } else - { int k1 = sort_pointA(c1); - int k2 = sort_pointA(c2); - int d; - - if ( (d=((k1>>8)-(k2>>8))) == 0 ) - { if ( *dl2 == 0 ) - *dl2 = (k1&0xff) - (k2&0xff); - } - - return d; - } -} - - -static inline int -cmpW(int c1, int c2, int *dl2) -{ if ( c1 == c2 ) - { return 0; - } else - { int k1 = sort_point(c1); - int k2 = sort_point(c2); - int d; - - if ( (d=((k1>>8)-(k2>>8))) == 0 ) - { if ( *dl2 == 0 ) - *dl2 = (k1&0xff) - (k2&0xff); - } - - return d; - } -} - - -int -cmp_atom_info(atom_info *info, atom_t a2) -{ text t2; - int i; - int dl2 = 0; - size_t n; - - if ( info->handle == a2 ) - return 0; - - if ( !fill_atom_info(info) || - !get_atom_text(a2, &t2) ) - { goto cmphandles; /* non-text atoms? */ - } - - if ( info->text.a && t2.a ) - { const charA *s1 = info->text.a; - const charA *s2 = t2.a; - int d; - - while((d=cmpA(*s1, *s2, &dl2)) == 0) - { if ( *s1 == 0 ) - goto eq; - s1++, s2++; - } - return d; - } - - n = (info->text.length < t2.length ? info->text.length : t2.length); - - if ( info->text.w && t2.w ) - { const charW *s1 = info->text.w; - const charW *s2 = t2.w; - - for(;;s1++, s2++) - { if ( n-- == 0 ) - { if ( info->text.length == t2.length ) - goto eq; - - return info->text.length < t2.length ? -1 : 1; - } else - { int d; - - if ( (d=cmpW(*s1, *s2, &dl2)) != 0 ) - return d; - } - } - } - - for(i=0; ; i++) - { if ( n-- == 0 ) - { if ( info->text.length == t2.length ) - goto eq; - - return info->text.length < t2.length ? -1 : 1; - } else - { wint_t c1 = fetch(&info->text, i); - wint_t c2 = fetch(&t2, i); - int d; - - if ( (d=cmpW(c1, c2, &dl2)) != 0 ) - return d; - } - } - -eq: - if ( dl2 ) - return dl2; - -cmphandles: - return info->handle < a2 ? -1 : 1; /* == already covered */ -} - - -int -cmp_atoms(atom_t a1, atom_t a2) -{ atom_info info = {0}; - - if ( a1 == a2 ) - return 0; - - info.handle = a1; - - return cmp_atom_info(&info, a2); -} - - - /******************************* - * HASH * - *******************************/ - -static unsigned int -string_hashA(const char *s, size_t len) -{ const unsigned char *t = (const unsigned char *)s; - unsigned int hash = 0; - - while( len>0 ) - { unsigned char buf[256]; - unsigned char *o = buf-1; - int cp = len > 256 ? 256 : (int)len; - const unsigned char *e = t+cp; - - t--; - while(++t>8; - hash ^= rdf_murmer_hash(buf, cp, MURMUR_SEED); - - len -= cp; - } - - return hash; -} - - -static unsigned int -string_hashW(const wchar_t *t, size_t len) -{ unsigned int hash = 0; - - while( len>0 ) - { unsigned short buf[256]; - unsigned short *o = buf; - int cp = len > 256 ? 256 : (int)len; - const wchar_t *e = t+cp; - - while(t>8); - hash ^= rdf_murmer_hash(buf, cp*sizeof(short), MURMUR_SEED); - - len -= cp; - } - - return hash; -} - - -unsigned int -atom_hash_case(atom_t a) -{ const char *s; - const wchar_t *w; - size_t len; - - if ( (s = PL_atom_nchars(a, &len)) ) - return string_hashA(s, len); - else if ( (w = PL_atom_wchars(a, &len)) ) - return string_hashW(w, len); - else - { assert(0); - return 0; - } -} - - - /******************************* - * FIND FIRST * - *******************************/ - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Given an atom, return a new one that has all its characters modified -such that it appears first in the set of atoms considered equal after -case canonisation and diacritics removal. This is required for prefix -search to find the first atom of the set. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -atom_t -first_atom(atom_t a, int match) -{ text t; - - if ( !get_atom_text(a, &t) ) - { return (atom_t)0; /* not a textual atom */ - } else - { size_t len = t.length; - wchar_t buf[256]; - wchar_t *out, *s; - int i; - wint_t c; - atom_t rc; - - if ( len <= 256 ) - out = buf; - else - out = PL_malloc(len*sizeof(wchar_t)); - - for(s=out,i=0; (c=fetch(&t,i)); s++,i++) - { if ( c == '*' && match == STR_MATCH_LIKE ) - { if ( i == 0 ) /* like '*...' */ - return (atom_t)0; - len = i; /* only up to the first * */ - } - *s = sort_point(c)>>8; - } - - rc = PL_new_atom_wchars(len, out); - - if ( out != buf ) - PL_free(out); - - return rc; - } -} - - /******************************* - * MATCH * - *******************************/ - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -With the introduction of wide characters there are two versions of the -match() function, one using char* and one using a structure and index to -fetch characters. Overall performance of the first function is about -twice as good as the general one and as most data will be handled by -this function in practice I think it is worthwhile to have two -implementations. Both implementations are very similar in design and -likely to have the same bugs. If you find one, please fix it in both -branches! -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -static const charA * -nextwordA(const charA *s) -{ while(*s && iswalnum(*s)) - s++; - while(*s && !iswalnum(*s)) - s++; - - return s; -} - - -#define cmp_pointA(i) (sort_pointA(i)>>8) - - -static int -matchA(int how, const charA *f, const charA *l) -{ switch(how) - { case STR_MATCH_EXACT: - { for( ; *l && *f; l++, f++ ) - { if ( cmp_pointA(*l) != cmp_pointA(*f) ) - return FALSE; - } - if ( *l == '\0' && *f == '\0' ) - return TRUE; - - return FALSE; - } - case STR_MATCH_PREFIX: - { for( ; *l && *f; l++, f++ ) - { if ( cmp_pointA(*l) != cmp_pointA(*f) ) - return FALSE; - } - if ( *f == '\0' ) - return TRUE; - - return FALSE; - } - case STR_MATCH_SUBSTRING: /* use Boyle-More! */ - { const charA *h; - const charA *f0 = f; - - for(h=l; *h; h++) - { for( l=h,f=f0; *l && *f; l++, f++ ) - { if ( cmp_pointA(*l) != cmp_pointA(*f) ) - break; - } - if ( *f == '\0' ) - return TRUE; - if ( *h == '\0' ) - return FALSE; - } - - return FALSE; - } - case STR_MATCH_WORD: - { const charA *h; - const charA *f0 = f; - - for(h=l; *h; h = nextwordA(h)) - { for( l=h,f=f0; *l && *f; l++, f++ ) - { if ( cmp_pointA(*l) != cmp_pointA(*f) ) - break; - } - if ( *f == '\0' ) - { if ( *l == '\0' || !iswalnum(*l) ) - return TRUE; - } - if ( *l == '\0' ) - return FALSE; - } - - return FALSE; - } - case STR_MATCH_LIKE: /* SeRQL like: * --> wildcart */ - { typedef struct chp { const charA *pattern; - const charA *label; } chp; - chp chps[MAX_LIKE_CHOICES]; - int chn=0; - - for( ; *l && *f; l++, f++ ) - { if ( *f == '*' ) - { f++; - - if ( *f == '\0' ) /* foo* */ - return TRUE; - - search_like: - while ( *l && cmp_pointA(*l) != cmp_pointA(*f) ) - l++; - - if ( *l ) - { if ( chn >= MAX_LIKE_CHOICES ) - { Sdprintf("rdf_db: too many * in `like' expression (>%d)", - MAX_LIKE_CHOICES); - return FALSE; - } - chps[chn].pattern = f; - chps[chn].label = l+1; - chn++; - - continue; - } else - goto retry_like; - } - - if ( cmp_pointA(*l) != cmp_pointA(*f) ) - goto retry_like; - } - if ( *l == '\0' && (*f == '\0' || - (*f == '*' && f[1] == '\0')) ) - return TRUE; - -retry_like: - if ( chn > 0 ) - { chn--; - f = chps[chn].pattern; - l = chps[chn].label; - goto search_like; - } - - return FALSE; - } - default: - assert(0); - return FALSE; - } -} - - -static unsigned int -nextword(text *txt, unsigned int i) -{ while(ilength && iswalnum(fetch(txt, i))) - i++; - while(ilength && !iswalnum(fetch(txt, i))) - i++; - - return i; -} - - -#define cmp_point(i) (sort_point(i)>>8) - - -int -match_atoms(int how, atom_t search, atom_t label) -{ text l, f; - - if ( !get_atom_text(label, &l) || - !get_atom_text(search, &f) ) - return FALSE; /* error? */ - - if ( f.length == 0 ) - return TRUE; - - if ( f.a && l.a ) - return matchA(how, f.a, l.a); - - switch(how) - { case STR_MATCH_EXACT: - { if ( l.length == f.length ) - { unsigned int i; - - for(i=0; i wildcart */ - { unsigned int ip, il; - typedef struct chp { unsigned int ip; - unsigned int il; - } chp; - chp chps[MAX_LIKE_CHOICES]; - int chn=0; - - for(ip=il=0; il < l.length && ip < f.length; ip++, il++ ) - { if ( fetch(&f, ip) == '*' ) - { ip++; - - if ( ip == f.length ) /* foo* */ - return TRUE; - - search_like: - while ( il < l.length && - cmp_point(fetch(&l, il)) != cmp_point(fetch(&f, ip)) ) - il++; - - if ( il < l.length ) - { if ( chn >= MAX_LIKE_CHOICES ) - { Sdprintf("rdf_db: too many * in `like' expression (>%d)", - MAX_LIKE_CHOICES); - return FALSE; - } - chps[chn].ip = ip; - chps[chn].il = il+1; - chn++; - - continue; - } else - goto retry_like; - } - - if ( cmp_point(fetch(&l, il)) != cmp_point(fetch(&f, ip)) ) - goto retry_like; - } - if ( il == l.length && (ip == f.length || - (fetch(&f,ip) == '*' && ip+1 == f.length)) ) - return TRUE; - -retry_like: - if ( chn > 0 ) - { chn--; - ip = chps[chn].ip; - il = chps[chn].il; - goto search_like; - } - - return FALSE; - } - default: - assert(0); - return FALSE; - } -} - - - /******************************* - * LANGUAGE MATCH * - *******************************/ - -typedef struct lang_choice -{ int langp; /* points after - */ - int patp; /* points after *- */ -} lang_choice; - -#define MAX_CHOICES 10 /* Max number of stars */ - -typedef struct -{ int il, ip; - text l, p; - lang_choice choicepoints[MAX_CHOICES]; - int choice_count; -} lang_state; - - -static int -create_chp(lang_state *s) -{ if ( s->choice_count < MAX_CHOICES ) - { lang_choice *cp = &s->choicepoints[s->choice_count]; - - cp->langp = s->il; - cp->patp = s->ip+2; - s->choice_count++; - - return TRUE; - } - - return FALSE; -} - - -static int -next_choice(lang_state *s) -{ for ( ; s->choice_count > 0; s->choice_count-- ) - { lang_choice *cp = &s->choicepoints[s->choice_count-1]; - int il = cp->langp; - - for(; ill.length; il++) - { if ( fetch(&s->l, il) == '-' ) - { cp->langp = s->il = il+1; - s->ip = cp->patp; - return TRUE; - } - } - } - - return FALSE; -} - - -static atom_t ATOM_; -static atom_t ATOM_star; - -int -atom_lang_matches(atom_t lang, atom_t pattern) -{ lang_state s = {0}; - int cl, cp; - - if ( lang == pattern ) /* exact match */ - return TRUE; - - if ( !ATOM_ ) - { ATOM_ = PL_new_atom(""); - ATOM_star = PL_new_atom("*"); - } - - if ( lang == ATOM_ ) /* no language */ - return FALSE; - if ( pattern == ATOM_star ) /* Everything matches "*" */ - return TRUE; - - if ( !get_atom_text(lang, &s.l) || - !get_atom_text(pattern, &s.p) ) - return FALSE; /* exception? */ - - s.il=0; s.ip=0; - for(;; s.ip++, s.il++) - { if ( s.ip == s.p.length ) - return TRUE; - if ( s.il == s.l.length ) - { if ( fetch(&s.p, s.ip) == '*' ) - return TRUE; - if ( !next_choice(&s) ) - return FALSE; - } - - cl = fetch(&s.l, s.il); - cp = fetch(&s.p, s.ip); - if ( cl == cp ) - continue; - if ( sort_point(cl)>>8 == sort_point(cp)>>8 ) - continue; - - if ( cp == '*' ) - { if ( s.ip+1 == s.p.length ) - return TRUE; - if ( (s.ip == 0 || fetch(&s.p, s.ip-1) == '-') && - fetch(&s.p, s.ip+1) == '-' ) - { if ( !create_chp(&s) ) - return FALSE; - } - } - - if ( !next_choice(&s) ) - return FALSE; - } -} diff --git a/packages/semweb/atom.h b/packages/semweb/atom.h deleted file mode 100644 index bd60af398..000000000 --- a/packages/semweb/atom.h +++ /dev/null @@ -1,64 +0,0 @@ -/* $Id$ - - Part of the SWI-Prolog Semweb package - - Author: Jan Wielemaker - E-mail: wielemak@science.uva.nl - WWW: http://www.swi-prolog.org - Copyright (C): 2006, University of Amsterdam - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef ATOM_H_INCLUDED -#define ATOM_H_INCLUDED - -#define MAX_LIKE_CHOICES 100 /* max *'s in like pattern */ - -#define STR_MATCH_CASE 0x0 /* Default: perfect match */ -#define STR_MATCH_PLAIN 0x1 /* Same, also match qualifier */ -#define STR_MATCH_EXACT 0x2 /* case-insensitive */ -#define STR_MATCH_SUBSTRING 0x3 /* substring */ -#define STR_MATCH_WORD 0x4 /* whole word */ -#define STR_MATCH_PREFIX 0x5 /* prefix */ -#define STR_MATCH_LIKE 0x6 /* SeRQL *like* match */ - /* MAX: 0x7 (3 bits in triple) */ - -typedef unsigned char charA; -typedef wchar_t charW; - -typedef struct text -{ const charA *a; - const charW *w; - size_t length; -} text; - - -typedef struct atom_info -{ atom_t handle; - text text; - int resolved; - int rc; /* TRUE if text atom */ -} atom_info; - - -int cmp_atoms(atom_t a1, atom_t a2); -int cmp_atom_info(atom_info *a1, atom_t a2); -atom_t first_atom(atom_t a, int match); -int match_atoms(int how, atom_t search, atom_t label); -unsigned int atom_hash_case(atom_t a); -int atom_lang_matches(atom_t lang, atom_t pattern); - -#endif /*ATOM_H_INCLUDED*/ diff --git a/packages/semweb/atom_map.c b/packages/semweb/atom_map.c deleted file mode 100644 index 20433c016..000000000 --- a/packages/semweb/atom_map.c +++ /dev/null @@ -1,1161 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog - - Author: Jan Wielemaker - E-mail: wielemak@science.uva.nl - WWW: http://www.swi-prolog.org - Copyright (C): 2006, University of Amsterdam - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include -#include "avl.h" -#include "lock.h" -#include "atom.h" -#include "debug.h" -#include -#include -#ifdef __WINDOWS__ -#define inline __inline -#endif - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -This file realises the low-level support for indexing literals in the -semantic web library. The idea is to make a map from abstracted tokens -from each literal to the exact literals. Abstraction introduces a -certain amount of ambiguity that makes fuzzy matching possible. Good -abstraction candidates are the Porter Stem or Snowbal algorithm and the -Double Metaphone algorithm. Both are provide by the SWI-Prolog NLP -package. - -Basic query provides a set of abstracted terms and requests those -literals containing all of them. We maintain ordered sets of literals -and do set-intersection on them to achieve good linear performance. - -Some current E-culture project statistics (porter stem) - - # stems: 0.4 million - # literals: 0.9 million - # stem->literal relations: 3.1 million - -Av. literals/stem: about 8. - -Searching is done using - - rdf_find_literal_map(Map, SetOfAbstract, -Literals) -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -#define AM_MAGIC 0x6ab19e8e - -typedef struct atom_map -{ long magic; /* AM_MAGIC */ - size_t value_count; /* total # values */ - rwlock lock; /* Multi-threaded access */ - avl_tree tree; /* AVL tree */ -} atom_map; - -typedef void *datum; - -#define S_MAGIC 0x8734abcd - -typedef struct atom_set -{ size_t size; /* # cells in use */ - size_t allocated; /* # cells allocated */ - datum *atoms; /* allocated cells */ -#ifdef O_SECURE - long magic; -#endif -} atom_set; - - -#define ND_MAGIC 0x67b49a23 -#define ND_MAGIC_EX 0x753ab3c - -typedef struct node_data -{ datum key; - atom_set *values; -#ifdef O_SECURE - long magic; -#endif -} node_data; - -typedef struct node_data_ex -{ node_data data; - atom_info atom; -#ifdef O_SECURE - long magic; -#endif -} node_data_ex; - - -#define RDLOCK(map) rdlock(&map->lock) -#define WRLOCK(map, allowreaders) wrlock(&map->lock, allowreaders) -#define LOCKOUT_READERS(map) lockout_readers(&map->lock) -#define REALLOW_READERS(map) reallow_readers(&map->lock) -#define WRUNLOCK(map) unlock(&map->lock, FALSE) -#define RDUNLOCK(map) unlock(&map->lock, TRUE) - - /******************************* - * BASIC STUFF * - *******************************/ - -static functor_t FUNCTOR_error2; -static functor_t FUNCTOR_type_error2; -static functor_t FUNCTOR_domain_error2; -static functor_t FUNCTOR_resource_error1; -static functor_t FUNCTOR_atom_map1; -static functor_t FUNCTOR_size2; -static functor_t FUNCTOR_not1; -static atom_t ATOM_all; -static atom_t ATOM_case; -static atom_t ATOM_prefix; -static atom_t ATOM_le; -static atom_t ATOM_ge; -static atom_t ATOM_between; -static atom_t ATOM_key; - -#define MKFUNCTOR(n,a) \ - FUNCTOR_ ## n ## a = PL_new_functor(PL_new_atom(#n), a) -#define MKATOM(n) \ - ATOM_ ## n = PL_new_atom(#n) - -static void -init_functors() -{ FUNCTOR_atom_map1 = PL_new_functor(PL_new_atom("$literal_map"), 1); - - MKFUNCTOR(error, 2); - MKFUNCTOR(type_error, 2); - MKFUNCTOR(domain_error, 2); - MKFUNCTOR(resource_error, 1); - MKFUNCTOR(size, 2); - MKFUNCTOR(not, 1); - - MKATOM(all); - MKATOM(case); - MKATOM(prefix); - MKATOM(le); - MKATOM(ge); - MKATOM(between); - MKATOM(key); -} - - -static int -type_error(term_t actual, const char *expected) -{ term_t ex; - - if ( (ex = PL_new_term_ref()) && - PL_unify_term(ex, - PL_FUNCTOR, FUNCTOR_error2, - PL_FUNCTOR, FUNCTOR_type_error2, - PL_CHARS, expected, - PL_TERM, actual, - PL_VARIABLE) ) - return PL_raise_exception(ex); - - return FALSE; -} - - -static int -domain_error(term_t actual, const char *expected) -{ term_t ex; - - if ( (ex = PL_new_term_ref()) && - PL_unify_term(ex, - PL_FUNCTOR, FUNCTOR_error2, - PL_FUNCTOR, FUNCTOR_domain_error2, - PL_CHARS, expected, - PL_TERM, actual, - PL_VARIABLE) ) - return PL_raise_exception(ex); - - return FALSE; -} - - -static int -resource_error(const char *what) -{ term_t ex; - - if ( (ex = PL_new_term_ref()) && - PL_unify_term(ex, - PL_FUNCTOR, FUNCTOR_error2, - PL_FUNCTOR, FUNCTOR_resource_error1, - PL_CHARS, what, - PL_VARIABLE) ) - return PL_raise_exception(ex); - - return FALSE; -} - - -static int -representation_error(const char *what) -{ term_t ex = PL_new_term_ref(); - - if ( (ex = PL_new_term_ref()) && - PL_unify_term(ex, - PL_FUNCTOR, FUNCTOR_error2, - PL_FUNCTOR_CHARS, "representation_error", 1, - PL_CHARS, what, - PL_VARIABLE) ) - return PL_raise_exception(ex); - - return FALSE; -} - - - -static int -get_atom_ex(term_t t, atom_t *a) -{ if ( PL_get_atom(t, a) ) - return TRUE; - - return type_error(t, "atom"); -} - - -static int -get_long_ex(term_t t, long *v) -{ if ( PL_get_long(t, v) ) - return TRUE; - - return type_error(t, "integer"); -} - - -static int -get_atom_map(term_t t, atom_map **map) -{ if ( PL_is_functor(t, FUNCTOR_atom_map1) ) - { term_t a = PL_new_term_ref(); - void *ptr; - - _PL_get_arg(1, t, a); - if ( PL_get_pointer(a, &ptr) ) - { atom_map *am = ptr; - - if ( am->magic == AM_MAGIC ) - { *map = am; - return TRUE; - } - } - } - - return type_error(t, "atom_map"); -} - - -static int -unify_atom_map(term_t t, atom_map *map) -{ return PL_unify_term(t, PL_FUNCTOR, FUNCTOR_atom_map1, - PL_POINTER, map); -} - - - /******************************* - * DATUM * - *******************************/ - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Datum is either an atom or a 31-bit signed integer. Atoms are shifted 7 -bits -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -#define ATOM_TAG_BITS 7 -#define ATOM_TAG 0x1 - -#define tag(d) ((long)(d)&0x1) -#define isAtomDatum(d) ((long)(d)&ATOM_TAG) -#define isIntDatum(d) !isAtomDatum(d) - -#define MAP_MIN_INT (-(long)(1L<<(sizeof(long)*8 - 1 - 1))) -#define MAP_MAX_INT (-MAP_MIN_INT - 1) - -static intptr_t atom_mask; - -static void -init_datum_store() -{ atom_t a = PL_new_atom("[]"); - - atom_mask = a & ((1<<(ATOM_TAG_BITS-1))-1); -} - - -static inline atom_t -atom_from_datum(datum d) -{ unsigned long v = (unsigned long)d; - atom_t a; - - a = ((v&~0x1)<<(ATOM_TAG_BITS-1))|atom_mask; - DEBUG(9, Sdprintf("0x%lx --> %s\n", v, PL_atom_chars(a))); - return a; -} - - -static inline long -long_from_datum(datum d) -{ long v = (long)d; - - return (v>>1); -} - - -static inline datum -atom_to_datum(atom_t a) -{ uintptr_t v = (a>>(ATOM_TAG_BITS-1))|ATOM_TAG; - - SECURE(assert(atom_from_datum((datum)v) == a)); - DEBUG(9, Sdprintf("Atom %s --> 0x%lx\n", PL_atom_chars(a), v)); - - return (datum)v; -} - - -static inline datum -long_to_datum(long v) -{ return (datum)(v<<1); -} - - -static int -get_datum(term_t t, datum* d) -{ atom_t a; - long l; - - if ( PL_get_atom(t, &a) ) - { *d = atom_to_datum(a); - return TRUE; - } else if ( PL_get_long(t, &l) ) - { if ( l < MAP_MIN_INT || l > MAP_MAX_INT ) - return representation_error("integer_range"); - - *d = long_to_datum(l); - return TRUE; - } - - return type_error(t, "atom or integer"); -} - - -static int -get_search_datum(term_t t, node_data_ex *search) -{ atom_t a; - long l; - - SECURE(search->magic = ND_MAGIC_EX); - - if ( PL_get_atom(t, &a) ) - { search->data.key = atom_to_datum(a); - search->atom.handle = a; - search->atom.resolved = FALSE; - return TRUE; - } else if ( PL_get_long(t, &l) ) - { if ( l < MAP_MIN_INT || l > MAP_MAX_INT ) - return representation_error("integer_range"); - - search->data.key = long_to_datum(l); - return TRUE; - } - - return type_error(t, "atom or integer"); -} - - -static int -unify_datum(term_t t, datum d) -{ unsigned long v = (unsigned long)d; - - if ( isAtomDatum(v) ) - return PL_unify_atom(t, atom_from_datum(d)); - else - return PL_unify_integer(t, long_from_datum(d)); -} - - -static void -lock_datum(datum d) -{ unsigned long v = (unsigned long)d; - - if ( isAtomDatum(v) ) - PL_register_atom(atom_from_datum(d)); -} - - -static void -unlock_datum(datum d) -{ unsigned long v = (unsigned long)d; - - if ( isAtomDatum(v) ) - PL_unregister_atom(atom_from_datum(d)); -} - - -static const char * -format_datum(datum d, char *buf) -{ static char tmp[20]; - - if ( isAtomDatum(d) ) - return PL_atom_chars(atom_from_datum(d)); - - if ( !buf ) - buf = tmp; - Ssprintf(buf, "%ld", long_from_datum(d)); - - return buf; -} - - - - /******************************* - * ATOM SETS * - *******************************/ - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -A set of atoms (literals) is a sorted array of atom-handles. They are -sorted simply by handle as we are not interested in the value in the -actual atom. Search is implemeted as binary search. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -#define AS_INITIAL_SIZE 4 - -static atom_set * -new_atom_set(datum a0) -{ atom_set *as; - - if ( (as = malloc(sizeof(*as))) && - (as->atoms = malloc(sizeof(datum)*AS_INITIAL_SIZE)) ) - { lock_datum(a0); - as->size = 1; - as->allocated = AS_INITIAL_SIZE; - as->atoms[0] = a0; - SECURE(as->magic = S_MAGIC); - } - - return as; -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -find_in_atom_set(atom_set *as, datum a) returns a pointer to the -location of the atom or, if the atom isn't there, to the first location -*after* the atom -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -static datum * -find_in_atom_set(atom_set *as, datum a, int *found) -{ const datum *ap = (const datum *)as->atoms; - const datum *ep = &ap[as->size]; - - SECURE(assert(as->magic == S_MAGIC)); - - for(;;) - { const datum *cp = ap+(ep-ap)/2; - - if ( a < *cp ) - { if ( ep == cp ) - { *found = FALSE; - return (datum*)cp; - } - ep = cp; - } else if ( a > *cp ) - { if ( ap == cp ) - { cp++; - *found = FALSE; - return (datum*)cp; - } - ap = cp; - } else - { *found = TRUE; - return (datum*)cp; - } - } -} - - -static int -in_atom_set(atom_set *as, datum a) -{ int found; - - find_in_atom_set(as, a, &found); - - return found; -} - - -#define ptr_diff(p1, p2) ((char *)(p1) - (char *)(p2)) - -static int -insert_atom_set(atom_set *as, datum a) -{ int found; - datum *ap = find_in_atom_set(as, a, &found); - - if ( !found ) - { lock_datum(a); - - if ( as->size == as->allocated ) - { datum *na; - size_t newsize = as->allocated*2; - - if ( !(na = realloc(as->atoms, sizeof(datum)*newsize)) ) - return -1; - ap += na-as->atoms; - as->atoms = na; - as->allocated = newsize; - } - assert(as->size < as->allocated); - - memmove(ap+1, ap, ptr_diff(&as->atoms[as->size], ap)); - as->size++; - *ap = a; - - return 1; - } - - return 0; -} - - -static int -delete_atom_set(atom_set *as, datum a) -{ int found; - datum *ap = find_in_atom_set(as, a, &found); - - if ( found ) - { unlock_datum(a); - as->size--; - memmove(ap, ap+1, ptr_diff(&as->atoms[as->size], ap)); - } - - return found; -} - - -static void -destroy_atom_set(atom_set *as) -{ size_t i; - - for(i=0; isize; i++) - unlock_datum(as->atoms[i]); - - free(as->atoms); - free(as); -} - - -static void -free_node_data(void *ptr) -{ node_data *data = ptr; - - DEBUG(2, - char b[20]; - Sdprintf("Destroying node with key = %s\n", - format_datum(data->key, b))); - - unlock_datum(data->key); - destroy_atom_set(data->values); -} - - - /******************************* - * TREE INTERFACE * - *******************************/ - -static int -cmp_node_data(void *l, void *r, NODE type) -{ node_data_ex *e1 = l; - node_data *n2 = r; - datum *d1 = e1->data.key; - datum *d2 = n2->key; - int d; - - SECURE(assert(e1->magic == ND_MAGIC_EX)); - - if ( (d=(tag(d1)-tag(d2))) == 0 ) - { if ( isAtomDatum(d1) ) - { return cmp_atom_info(&e1->atom, atom_from_datum(d2)); - } else - { long l1 = long_from_datum(d1); - long l2 = long_from_datum(d2); - - return l1 > l2 ? 1 : l1 < l2 ? -1 : 0; - } - } - - return d; -} - - -static void -init_tree_map(atom_map *m) -{ avlinit(&m->tree, - NULL, sizeof(node_data), - cmp_node_data, - free_node_data, /* destroy */ - NULL, /* alloc */ - NULL); /* free */ -} - - -static foreign_t -new_atom_map(term_t handle) -{ atom_map *m; - - if ( !(m=malloc(sizeof(*m))) ) - return resource_error("memory"); - - memset(m, 0, sizeof(*m)); - init_lock(&m->lock); - init_tree_map(m); - m->magic = AM_MAGIC; - - return unify_atom_map(handle, m); -} - - -static foreign_t -destroy_atom_map(term_t handle) -{ atom_map *m; - - if ( !get_atom_map(handle, &m) ) - return FALSE; - - WRLOCK(m, FALSE); - avlfree(&m->tree); - m->magic = 0; - WRUNLOCK(m); - destroy_lock(&m->lock); - free(m); - - return TRUE; -} - - - /******************************* - * INSERT * - *******************************/ - - -static foreign_t -insert_atom_map4(term_t handle, term_t from, term_t to, term_t keys) -{ atom_map *map; - datum a2; - node_data_ex search; - node_data *data; - - if ( !get_atom_map(handle, &map) || - !get_search_datum(from, &search) || - !get_datum(to, &a2) ) - return FALSE; - - if ( !WRLOCK(map, FALSE) ) - return FALSE; - - if ( (data=avlfind(&map->tree, &search)) ) - { int rc; - - SECURE(assert(data->magic == ND_MAGIC)); - - if ( (rc=insert_atom_set(data->values, a2)) < 0 ) - return resource_error("memory"); - - if ( rc ) - map->value_count++; - } else - { if ( keys && !PL_unify_integer(keys, map->tree.count+1) ) - { WRUNLOCK(map); - return FALSE; - } - if ( !(search.data.values = new_atom_set(a2)) ) - return resource_error("memory"); - lock_datum(search.data.key); - SECURE(search.magic = ND_MAGIC); - - data = avlins(&map->tree, &search); - assert(!data); - map->value_count++; - } - - WRUNLOCK(map); - - return TRUE; -} - - -static foreign_t -insert_atom_map3(term_t handle, term_t from, term_t to) -{ return insert_atom_map4(handle, from, to, 0); -} - - - /******************************* - * DELETE * - *******************************/ - -static foreign_t -delete_atom_map2(term_t handle, term_t from) -{ atom_map *map; - node_data_ex search; - node_data *data; - - if ( !get_atom_map(handle, &map) || - !get_search_datum(from, &search) ) - return FALSE; - - if ( !WRLOCK(map, TRUE) ) - return FALSE; - - /* TBD: Single pass? */ - if ( (data = avlfind(&map->tree, &search)) ) - { LOCKOUT_READERS(map); - map->value_count -= data->values->size; - search.data = *data; - avldel(&map->tree, &search); - REALLOW_READERS(map); - } - - WRUNLOCK(map); - - return TRUE; -} - - -static foreign_t -delete_atom_map3(term_t handle, term_t from, term_t to) -{ atom_map *map; - node_data_ex search; - node_data *data; - datum a2; - - if ( !get_atom_map(handle, &map) || - !get_search_datum(from, &search) || - !get_datum(to, &a2) ) - return FALSE; - - if ( !WRLOCK(map, TRUE) ) - return FALSE; - - if ( (data = avlfind(&map->tree, &search)) && - in_atom_set(data->values, a2) ) - { atom_set *as = data->values; - - LOCKOUT_READERS(map); - if ( delete_atom_set(as, a2) ) - { map->value_count--; - if ( as->size == 0 ) - { search.data = *data; - avldel(&map->tree, &search); - } - } - REALLOW_READERS(map); - } - - WRUNLOCK(map); - - return TRUE; -} - - - /******************************* - * SEARCH * - *******************************/ - -typedef struct -{ atom_set *set; - int neg; /* not(Lit) */ -} pn_set; - - -static int -cmp_atom_set_size(const void *p1, const void *p2) -{ const pn_set *ap1 = p1; - const pn_set *ap2 = p2; - - if ( ap1->neg != ap2->neg ) - return ap1->neg ? 1 : -1; /* all negatives at the end */ - - return ap1->set->size == ap2->set->size ? 0 : - ap1->set->size < ap2->set->size ? -1 : 1; -} - - -#define MAX_SETS 100 - -static foreign_t -find_atom_map(term_t handle, term_t keys, term_t literals) -{ atom_map *map; - pn_set as[MAX_SETS]; /* TBD */ - int ns = 0; - term_t tmp = PL_new_term_ref(); - term_t tail = PL_copy_term_ref(keys); - term_t head = PL_new_term_ref(); - atom_set *s0; - size_t ca; - - if ( !get_atom_map(handle, &map) ) - return FALSE; - - if ( !RDLOCK(map) ) - return FALSE; - - while(PL_get_list(tail, head, tail)) - { node_data *data; - node_data_ex search; - int neg = FALSE; - - if ( PL_is_functor(head, FUNCTOR_not1) ) - { _PL_get_arg(1, head, tmp); - if ( !get_search_datum(tmp, &search) ) - goto failure; - neg = TRUE; - } else - { if ( !get_search_datum(head, &search) ) - goto failure; - } - - if ( (data = avlfind(&map->tree, &search)) ) - { if ( ns+1 >= MAX_SETS ) - return resource_error("max_search_atoms"); - - as[ns].set = data->values; - as[ns].neg = neg; - DEBUG(2, Sdprintf("Found atom-set of size %d\n", as[ns].set->size)); - ns++; - } else if ( !neg ) - { RDUNLOCK(map); /* failure on positive literal: empty */ - - return PL_unify_nil(literals); - } - } - if ( !PL_get_nil(tail) ) - { type_error(tail, "list"); - goto failure; - } - - qsort(as, ns, sizeof(*as), cmp_atom_set_size); - if ( ns==0 || as[0].neg ) - { domain_error(keys, "keywords"); - goto failure; - } - - s0 = as[0].set; - - PL_put_term(tail, literals); - - for(ca=0; casize; ca++) - { datum a = s0->atoms[ca]; - int i; - - for(i=1; i as[i].set->atoms[as[i].set->size-1] ) - goto empty; - goto next; - } - } else - { if ( in_atom_set(as[i].set, a) ) - goto next; - } - } - - if ( !PL_unify_list(tail, head, tail) || - !unify_datum(head, a) ) - goto failure; -next:; - } - -empty: - RDUNLOCK(map); - return PL_unify_nil(tail); - -failure: - RDUNLOCK(map); - return FALSE; -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -rdf_keys_in_literal_map(+Map, +Spec, -Keys) - -Spec is one of - - * all - * prefix(Text) atoms only - * ge(Low) integers only - * le(High) - * between(Low, High) -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -/* TBD: should use avlwalk(), but this isn't fine as it does not allow a - failure return and does not allow passing our term-handles -*/ - -static int -unify_keys(term_t head, term_t tail, AVLnode *node) -{ node_data *data; - - if ( node ) - { if ( node->subtree[LEFT] ) - { if ( !unify_keys(head, tail, node->subtree[LEFT]) ) - return FALSE; - } - - data = (node_data*)node->data; - if ( !PL_unify_list(tail, head, tail) || - !unify_datum(head, data->key) ) - return FALSE; - - if ( node->subtree[RIGHT] ) - return unify_keys(head, tail, node->subtree[RIGHT]); - } - - return TRUE; -} - - -static int -between_keys(atom_map *map, long min, long max, term_t head, term_t tail) -{ avl_enum state; - node_data *data; - node_data_ex search; - - DEBUG(2, Sdprintf("between %ld .. %ld\n", min, max)); - - search.data.key = long_to_datum(min); - SECURE(search.magic = ND_MAGIC_EX); - - if ( (data = avlfindfirst(&map->tree, &search, &state)) && - isIntDatum(data->key) ) - { for(;;) - { if ( long_from_datum(data->key) > max ) - break; - - if ( !PL_unify_list(tail, head, tail) || - !unify_datum(head, data->key) ) - { avlfinddestroy(&state); - return FALSE; - } - - if ( !(data = avlfindnext(&state)) || - !isIntDatum(data->key) ) - break; - } - - avlfinddestroy(&state); - } - - return TRUE; -} - - -static foreign_t -rdf_keys_in_literal_map(term_t handle, term_t spec, term_t keys) -{ atom_map *map; - term_t tail = PL_copy_term_ref(keys); - term_t head = PL_new_term_ref(); - atom_t name; - int arity; - - if ( !get_atom_map(handle, &map) ) - return FALSE; - - if ( !RDLOCK(map) ) - return FALSE; - - if ( !PL_get_name_arity(spec, &name, &arity) ) - type_error(spec, "key-specifier"); - - if ( name == ATOM_all ) - { AVLnode *node = map->tree.root; - - if ( !unify_keys(head, tail, node) ) - goto failure; - } else if ( name == ATOM_key && arity == 1 ) - { term_t a = PL_new_term_ref(); - node_data *data; - node_data_ex search; - - _PL_get_arg(1, spec, a); - if ( !get_search_datum(a, &search) ) - goto failure; - - if ( (data = avlfind(&map->tree, &search)) ) - { long size = (long)data->values->size; - - RDUNLOCK(map); - assert(size > 0); - - return PL_unify_integer(keys, size); - } - goto failure; - } else if ( (name == ATOM_prefix || name == ATOM_case) && arity == 1 ) - { term_t a = PL_new_term_ref(); - atom_t prefix, first_a; - avl_enum state; - node_data *data; - node_data_ex search; - int match = (name == ATOM_prefix ? STR_MATCH_PREFIX : STR_MATCH_EXACT); - - _PL_get_arg(1, spec, a); - if ( !get_atom_ex(a, &prefix) ) - goto failure; - first_a = first_atom(prefix, STR_MATCH_PREFIX); - - search.data.key = atom_to_datum(first_a); - search.atom.handle = first_a; - search.atom.resolved = FALSE; - SECURE(search.magic = ND_MAGIC_EX); - - for(data = avlfindfirst(&map->tree, &search, &state); - data; - data=avlfindnext(&state)) - { assert(isAtomDatum(data->key)); - - if ( !match_atoms(match, - first_a, atom_from_datum(data->key)) ) - break; - - if ( !PL_unify_list(tail, head, tail) || - !unify_datum(head, data->key) ) - { avlfinddestroy(&state); - goto failure; - } - } - avlfinddestroy(&state); - } else if ( (name == ATOM_ge || name == ATOM_le) && arity == 1 ) - { term_t a = PL_new_term_ref(); - long val, min, max; - - _PL_get_arg(1, spec, a); - if ( !get_long_ex(a, &val) ) - goto failure; - - if ( name == ATOM_ge ) - min = val, max = MAP_MAX_INT; - else - max = val, min = MAP_MIN_INT; - - if ( !between_keys(map, min, max, head, tail) ) - goto failure; - } else if ( name == ATOM_between && arity == 2 ) - { term_t a = PL_new_term_ref(); - long min, max; - - _PL_get_arg(1, spec, a); - if ( !get_long_ex(a, &min) ) - goto failure; - _PL_get_arg(2, spec, a); - if ( !get_long_ex(a, &max) ) - goto failure; - - if ( !between_keys(map, min, max, head, tail) ) - goto failure; - } else - { type_error(spec, "key-specifier"); - goto failure; - } - - RDUNLOCK(map); - - return PL_unify_nil(tail); - -failure: - RDUNLOCK(map); - return FALSE; -} - - - /******************************* - * RESET * - *******************************/ - -static foreign_t -rdf_reset_literal_map(term_t handle) -{ atom_map *map; - - if ( !get_atom_map(handle, &map) ) - return FALSE; - - if ( !WRLOCK(map, FALSE) ) - return FALSE; - avlfree(&map->tree); - init_tree_map(map); - map->value_count = 0; - WRUNLOCK(map); - - return TRUE; -} - - - - /******************************* - * STATISTICS * - *******************************/ - - -term_t -rdf_statistics_literal_map(term_t map, term_t key) -{ atom_map *m; - - if ( !get_atom_map(map, &m) ) - return FALSE; - - if ( PL_is_functor(key, FUNCTOR_size2) ) - { term_t a = PL_new_term_ref(); - - _PL_get_arg(1, key, a); - if ( !PL_unify_integer(a, m->tree.count) ) - return FALSE; - _PL_get_arg(2, key, a); - - return PL_unify_integer(a, m->value_count); - } - - return type_error(key, "statistics_key"); -} - - - - - /******************************* - * REGISTER * - *******************************/ - -#define PRED(n,a,f,o) PL_register_foreign(n,a,f,o) - -install_t -install_atom_map() -{ init_functors(); - init_datum_store(); - - PRED("rdf_new_literal_map", 1, new_atom_map, 0); - PRED("rdf_destroy_literal_map", 1, destroy_atom_map, 0); - PRED("rdf_reset_literal_map", 1, rdf_reset_literal_map, 0); - PRED("rdf_insert_literal_map", 3, insert_atom_map3, 0); - PRED("rdf_insert_literal_map", 4, insert_atom_map4, 0); - PRED("rdf_delete_literal_map", 3, delete_atom_map3, 0); - PRED("rdf_delete_literal_map", 2, delete_atom_map2, 0); - PRED("rdf_find_literal_map", 3, find_atom_map, 0); - PRED("rdf_keys_in_literal_map", 3, rdf_keys_in_literal_map, 0); - PRED("rdf_statistics_literal_map", 2, rdf_statistics_literal_map, 0); -} diff --git a/packages/semweb/avl.c b/packages/semweb/avl.c deleted file mode 100644 index 30b38d81b..000000000 --- a/packages/semweb/avl.c +++ /dev/null @@ -1,941 +0,0 @@ -/** -* -* avl.c -- C source file for avl trees. Contains the auxillary routines -* and defines for the avl tree functions and user interface and -* includes all the necessary public and private routines -* -* Created 03/01/89 by Brad Appleton -* -* ^{Mods:* } -* -* Fri Jul 14 13:53:42 1989, Rev 1.0, brad(0165) -* -_______________________________________________________________________________ - - LICENSE - ======= - -This software is not subject to any license of the American Telephone and -Telegraph Company or of the Regents of the University of California. - -Permission is granted to anyone to use this software for any purpose on any -computer system, and to alter it and redistribute it freely, subject to the -following restrictions: - - 1. Neither the authors of the software nor their employers - (including any of the employers' subsidiaries and subdivisions) - are responsible for maintaining & supporting this software or - for any consequences resulting from the use of this software, no - matter how awful, even if they arise from flaws in the software - (see LIABILITY). - - 2. The origin of this software must not be misrepresented, either - by explicit claim or by omission. Since few users ever read - sources, credits must appear in the documentation. - - 3. Altered versions must be plainly marked as such, and must not be - misrepresented as being the original software. Since few users - ever read sources, credits must appear in the documentation. - - 4. This notice may not be removed or altered. -_______________________________________________________________________________ - - NO WARRANTY - =========== - -Because this software is licensed free of charge, we (the authors and/or -distributors of this software) provide absolutely no warranty, to the extent -permitted by applicable state law. Except when otherwise stated in writing, -the authors and distributors of this software and/or other parties provide -this program "as is" without warranty of any kind, either expressed or -implied, including, but not limited to, the implied warranties of -merchantability and fitness for a particular purpose. The entire risk as to -the quality and performance of this software lies with the recipients and/or -users of this software and not with any of the authors and/or distributors of -this software, nor with any of their employers, including any of the -employers' subsidiaries and subdivisions. Should the program prove defective, -the recipients/users of this software assume the cost of all necessary -servicing, repair, or correction. -_______________________________________________________________________________ - - LIABILITY - ========= - -In no event unless required by applicable law will the authors and/or -distributors of this software, their employers, and any subsidiaries and/or -subdivisions of their employers, and/or any other party who may redistribute -this software as permitted in the LICENSE section of this notice, be liable to -the recipients/users of this software for damages including any lost profits, -lost monies, or other special, incidental, or consequential damages arising -out of the use or inabilty to use (including but not limited to loss of data -or data being rendered inaccurate or lossed sustained by third parties or a -failure of the software to operate with any other software or hardware) this -software, even if you have been advised of the possibility of such damages, or -for any claim by any other party. -_______________________________________________________________________________ - -Heavily modified by Jan Wielemaker, wielemak@science.uva.nl. Brief -summary: - - - Added prototypes and reformatted the sources. - - Added includes - - Swapped various arguments - - Changes some of the interfaces - - Added enumeration interface -**/ - - /* some common #defines used throughout most of my files */ -#define PUBLIC /* default */ -#define FALSE 0 -#define TRUE !FALSE - - /* some defines for debugging purposes */ -#ifdef NDEBUG -#define DBG(x) /* x */ -#else -#define DBG(x) x -#endif - -#define NEXTERN /* dont include "extern" declarations from header files */ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <assert.h> -#include "avl.h" /* public types for avl trees */ -#ifdef __WINDOWS__ -#define inline __inline -#endif - - /* MIN and MAX macros (used for rebalancing) */ -#undef MIN -#undef MAX -#define MIN(a,b) ((a) < (b) ? (a) : (b)) -#define MAX(a,b) ((a) > (b) ? (a) : (b)) - -/************************************************************************ -* Auxillary functions -* -* routines to allocate/de-allocate an AVL node, -* and determine the type of an AVL node. -************************************************************************/ - -/* ckalloc(size) -- allocate space; check for success */ -static void * -ckalloc(size_t size) -{ void *ptr; - - if ( !(ptr = malloc(size)) ) - { fprintf(stderr, "Unable to allocate storage."); - exit(1); - } - - return ptr; -} /* ckalloc */ - - -#define sizeofnode(size) ((size_t)&((AVLtree)0)->data[0] + size) - -/* -* new_node() -- get space for a new node and its data; -* return the address of the new node -*/ -static AVLtree -new_node(AVL_TREE tree, void *data) -{ AVLtree root; - - if ( tree->alloc ) - root = (*tree->alloc)(tree->client_data, sizeofnode(tree->isize)); - else - root = ckalloc(sizeofnode(tree->isize)); - - memcpy(root->data, data, tree->isize); - root->bal = BALANCED; - root->subtree[LEFT] = root->subtree[RIGHT] = NULL_TREE; - - return root; -} /* new_node */ - - -/* -* free_node() -- free space for a node and its data! -* reset the node pointer to NULL -*/ -static void -free_node(AVL_TREE tree, AVLtree *rootp) -{ AVLtree root = *rootp; - - if ( tree->destroy ) - (*tree->destroy)(root->data); - - if ( tree->free ) - (*tree->free)(tree->client_data, root, sizeofnode(tree->isize)); - else - free(root); - - *rootp = NULL_TREE; -} /* free_node */ - - -/* -* node_type() -- determine the number of null pointers for a given -* node in an AVL tree, Returns a value of type NODE -* which is an enumeration type with the following values: -* -* IS_TREE -- both subtrees are non-empty -* IS_LBRANCH -- left subtree is non-empty; right is empty -* IS_RBRANCH -- right subtree is non-empty; left is empty -* IS_LEAF -- both subtrees are empty -* IS_NULL -- given tree is empty -*/ -static NODE -node_type(AVLtree tree) -{ if (tree == NULL_TREE) - { return IS_NULL; - } else if ((tree->subtree[LEFT] != NULL_TREE) && - (tree->subtree[RIGHT] != NULL_TREE)) - { return IS_TREE; - } else if (tree->subtree[LEFT] != NULL_TREE) - { return IS_LBRANCH; - } else if (tree->subtree[RIGHT] != NULL_TREE) - { return IS_RBRANCH; - } else - { return IS_LEAF; - } -} /* node_type */ - - - -/************************************************************************ -* static functions for manipulating AVL trees -* -* This following defines a set of routines for creating, maintaining, and -* manipulating AVL Trees as an Abtract Data Type. The routines in this -* file that are accessible (through the avl tree user-interface) to other -* files to allow other programmers to: -* -* Insert, Delete, and Find a given data item from a Tree. -* -* Delete and Find the minimal and Maximal items in a Tree. -* -* Walk through every node in a tree performing a giving operation. -* -* Walk through and free up space for every node in a tree while performing -* a given operation on the data items as they are encountered. -************************************************************************/ - - - -/************************************************************************ -* routines used to find the minimal and maximal elements -* (nodes) of an AVL tree. -************************************************************************/ - -/* -* avl_min() -- compare function used to find the minimal element in a tree -*/ -static int -avl_min(void *elt1, void *elt2, NODE nd_typ) -{ return (nd_typ == IS_RBRANCH || nd_typ == IS_LEAF) - ? 0 /* left subtree is empty -- this is the minimum */ - : -1; /* keep going left */ -} /* avl_min */ - - -/* -* avl_max() -- compare function used to find the maximal element in a tree -*/ -static int -avl_max(void *elt1, void *elt2, NODE nd_typ) -{ return (nd_typ == IS_LBRANCH || nd_typ == IS_LEAF) - ? 0 /* right subtree is empty -- this is the maximum */ - : 1; /* keep going right */ -} /* avl_max */ - - - -/************************************************************************ -* Routines to perform rotations on AVL trees -************************************************************************/ - -/* -* rotate_once() -- rotate a given node in the given direction -* to restore the balance of a tree -*/ -static short -rotate_once(AVLtree * rootp, DIRECTION dir) -{ DIRECTION other_dir = OPPOSITE(dir); /* opposite direction to "dir" */ - AVLtree old_root = *rootp; /* copy of original root of tree */ - short ht_unchanged; /* true if height unchanged */ - - ht_unchanged = ((*rootp)->subtree[other_dir]->bal) ? FALSE : TRUE; - - /* assign new root */ - *rootp = old_root->subtree[other_dir]; - - /* new-root exchanges it's "dir" subtree for it's parent */ - old_root->subtree[other_dir] = (*rootp)->subtree[dir]; - (*rootp)->subtree[dir] = old_root; - - /* update balances */ - old_root->bal = -(dir == LEFT ? --((*rootp)->bal) : ++((*rootp)->bal)); - - return ht_unchanged; -} /* rotate_once */ - - -/* -* rotate_twice() -- rotate a given node in the given direction -* and then in the opposite direction -* to restore the balance of a tree -*/ -static void -rotate_twice(AVLtree * rootp, DIRECTION dir) -{ DIRECTION other_dir = OPPOSITE(dir); - AVLtree old_root = *rootp; - AVLtree old_other_dir_subtree = (*rootp)->subtree[other_dir]; - - /* assign new root */ - *rootp = old_root->subtree[other_dir]->subtree[dir]; - - /* new-root exchanges it's "dir" subtree for it's grandparent */ - old_root->subtree[other_dir] = (*rootp)->subtree[dir]; - (*rootp)->subtree[dir] = old_root; - - /* new-root exchanges it's "other-dir" subtree for it's parent */ - old_other_dir_subtree->subtree[dir] = (*rootp)->subtree[other_dir]; - (*rootp)->subtree[other_dir] = old_other_dir_subtree; - - /* update balances */ - (*rootp)->subtree[LEFT]->bal = -MAX((*rootp)->bal, 0); - (*rootp)->subtree[RIGHT]->bal = -MIN((*rootp)->bal, 0); - (*rootp)->bal = 0; - -} /* rotate_twice */ - - -/************************************************************************ -* Rebalance an AVL tree -************************************************************************/ - -/* -* balance() -- determines and performs the sequence of rotations needed -* (if any) to restore the balance of a given tree. -* -* Returns 1 if tree height changed due to rotation; 0 otherwise -*/ -static short -balance(AVLtree * rootp) -{ short special_case = FALSE; - - if (LEFT_IMBALANCE(*rootp)) - { /* need a right rotation */ - if ((*rootp)->subtree[LEFT]->bal == RIGHT_HEAVY) - { rotate_twice(rootp, RIGHT); /* double RL rotation needed */ - } else - { /* single RR rotation needed */ - special_case = rotate_once(rootp, RIGHT); - } - } else if (RIGHT_IMBALANCE(*rootp)) - { /* need a left rotation */ - if ((*rootp)->subtree[RIGHT]->bal == LEFT_HEAVY) - { rotate_twice(rootp, LEFT); /* double LR rotation needed */ - } else - { /* single LL rotation needed */ - special_case = rotate_once(rootp, LEFT); - } - } else - { return HEIGHT_UNCHANGED; /* no rotation occurred */ - } - - return (special_case) ? HEIGHT_UNCHANGED : HEIGHT_CHANGED; -} /* balance */ - - -/************************************************************************ -* Routines to: Find an item in an AVL tree -* Insert an item into an AVL tree -* Delete an item from an AVL tree -************************************************************************/ - -/* -* avl_find() -- find an item in the given tree -* -* PARAMETERS: -* data -- a pointer to the key to find -* rootp -- a pointer to an AVL tree -* compar -- name of a function to compare 2 data items -*/ -static void * -avl_find(void *data, AVLtree tree, int (*compar) (void *l, void *r, NODE)) -{ NODE nd_typ = node_type(tree); - int cmp; - - while ((tree != NULL_TREE) && - (cmp = (*compar)(data, tree->data, nd_typ))) - { tree = tree->subtree[(cmp < 0) ? LEFT : RIGHT]; - } - - return (tree == NULL_TREE) ? NULL : tree->data; -} /* avl_find */ - - -/* -* avl_insert() -- insert an item into the given tree -* -* PARAMETERS: -* data -- a pointer to a pointer to the data to add; -* On exit, *data is NULL if insertion succeeded, -* otherwise address of the duplicate key -* rootp -- a pointer to an AVL tree -* compar -- name of the function to compare 2 data items -*/ -static short -avl_insert(AVL_TREE tree, AVLtree *rootp, void **data) -{ short increase; - int cmp; - - if (*rootp == NULL_TREE) - { /* insert new node here */ - *rootp = new_node(tree, *data); - *data = NULL; /* set return value in data */ - return HEIGHT_CHANGED; - } - - cmp = (*tree->compar)(*data, (*rootp)->data, IS_NULL); - - if (cmp < 0) - { /* insert into the left subtree */ - increase = -avl_insert(tree, &((*rootp)->subtree[LEFT]), data); - if (*data != NULL) - return HEIGHT_UNCHANGED; - } else if (cmp > 0) - { /* insert into the right subtree */ - increase = avl_insert(tree, &((*rootp)->subtree[RIGHT]), data); - if (*data != NULL) - return HEIGHT_UNCHANGED; - } else - { /* data already exists */ - *data = (*rootp)->data; /* set return value in data */ - return HEIGHT_UNCHANGED; - } - - (*rootp)->bal += increase; /* update balance factor */ - - /************************************************************************ - * re-balance if needed -- height of current tree increases only if its - * subtree height increases and the current tree needs no rotation. - ************************************************************************/ - return (increase && (*rootp)->bal) - ? (1 - balance(rootp)) - : HEIGHT_UNCHANGED; -} /* avl_insert */ - - -static void -memswap(void *p1, void *p2, size_t size) -{ char *s1 = p1; - char *s2 = p2; - char buf[256]; - - while(size > 0) - { size_t bytes = (size > sizeof(buf) ? sizeof(buf) : size); - - memcpy(buf, s1, bytes); - memcpy(s1, s2, bytes); - memcpy(s2, buf, bytes); - - s1 += bytes; - s2 += bytes; - size -= bytes; - } -} - - -/* -* avl_delete() -- delete an item from the given tree -* -* PARAMETERS: -* data -- a pointer to a pointer to the key to delete -* On exit, *data points to the deleted data item -* (or NULL if deletion failed). -* rootp -- a pointer to an AVL tree -* compar -- name of function to compare 2 data items -*/ -static short -avl_delete(AVL_TREE tree, AVLtree *rootp, void *data, int *found, - int (*compar)(void*, void*, NODE)) -{ short decrease; - int cmp; - AVLtree old_root = *rootp; - NODE nd_typ = node_type(*rootp); - DIRECTION dir = (nd_typ == IS_LBRANCH) ? LEFT : RIGHT; - - if (*rootp == NULL_TREE) - { /* data not found */ - if ( found ) - *found = FALSE; - return HEIGHT_UNCHANGED; - } - - cmp = (*compar)(data, (*rootp)->data, nd_typ); - - if (cmp < 0) - { /* delete from left subtree */ - decrease = -avl_delete(tree, &((*rootp)->subtree[LEFT]), data, found, compar); - if ( found && *found == FALSE ) - return HEIGHT_UNCHANGED; - } else if (cmp > 0) - { /* delete from right subtree */ - decrease = avl_delete(tree, &((*rootp)->subtree[RIGHT]), data, found, compar); - if ( found && *found == FALSE ) - return HEIGHT_UNCHANGED; - } else - { /* cmp == 0 */ - decrease = 0; /* JW: Silence compiler */ - if ( found ) - *found = TRUE; - if ( data && data != (*rootp)->data ) - { if ( found ) - memcpy(data, (*rootp)->data, tree->isize); - else - memswap(data, (*rootp)->data, tree->isize); - } - - /*********************************************************************** - * At this point we know "cmp" is zero and "*rootp" points to - * the node that we need to delete. There are three cases: - * - * 1) The node is a leaf. Remove it and return. - * - * 2) The node is a branch (has only 1 child). Make "*rootp" - * (the pointer to this node) point to the child. - * - * 3) The node has two children. We swap data with the successor of - * "*rootp" (the smallest item in its right subtree) and delete - * the successor from the right subtree of "*rootp". The - * identifier "decrease" should be reset if the subtree height - * decreased due to the deletion of the successor of "rootp". - ***********************************************************************/ - - switch (nd_typ) - { /* what kind of node are we removing? */ - case IS_LEAF: - free_node(tree, rootp); /* free the leaf, its height */ - return HEIGHT_CHANGED; /* changes from 1 to 0, return 1 */ - - case IS_RBRANCH: /* only child becomes new root */ - case IS_LBRANCH: - *rootp = (*rootp)->subtree[dir]; - free_node(tree, &old_root); /* free the deleted node */ - return HEIGHT_CHANGED; /* we just shortened the "dir" subtree */ - - case IS_TREE: - decrease = avl_delete(tree, - &((*rootp)->subtree[RIGHT]), - (*rootp)->data, NULL, - avl_min); - break; - case IS_NULL: /* JW: Silence compiler. Cannot happen */ - assert(0); - break; - } /* switch */ - } /* else */ - - (*rootp)->bal -= decrease; /* update balance factor */ - - /********************************************************************** - * Rebalance if necessary -- the height of current tree changes if one - * of two things happens: (1) a rotation was performed which changed - * the height of the subtree (2) the subtree height decreased and now - * matches the height of its other subtree (so the current tree now - * has a zero balance when it previously did not). - **********************************************************************/ - if (decrease && (*rootp)->bal) - { return balance(rootp); /* rebalance and see if height changed */ - } else if (decrease && !(*rootp)->bal) - { return HEIGHT_CHANGED; /* balanced because subtree decreased */ - } else - { return HEIGHT_UNCHANGED; - } -} /* avl_delete */ - - - -/** -* Routines which Recursively Traverse an AVL TREE -* -* These routines may perform a particular action function upon each node -* encountered. In these cases, "action" has the following definition: -* -* void action(data, order, node, level, bal) -* void *data -* VISIT order; -* NODE node; -* short bal; -* int level; -* -* "data" is a pointer to the data field of an AVL node -* "order" corresponds to whether this is the 1st, 2nd or 3rd time -* that this node has been visited. -* "node" indicates which children (if any) of the current node -* are null. -* "level" is the current level (or depth) in the tree of the -* curent node. -* "bal" is the balance factor of the current node. -**/ - - -/************************************************************************ -* Walk an AVL tree, performing a given function at each node -************************************************************************/ - - -/* -* avl_walk -- traverse the given tree performing "action" -* upon each data item encountered. -* -*/ -static void -avl_walk(AVLtree tree, void (*action)(void *data, - SIBLING_ORDER order, - NODE type, - int level, - int balance), - SIBLING_ORDER sibling_order, int level) -{ DIRECTION dir1 = (sibling_order == LEFT_TO_RIGHT) ? LEFT : RIGHT; - DIRECTION dir2 = OPPOSITE(dir1); - NODE node = node_type(tree); - - if ( tree && action ) - { (*action) (tree->data, PREORDER, node, level, (int)tree->bal); - - if (tree->subtree[dir1] != NULL_TREE) - { avl_walk(tree->subtree[dir1], action, sibling_order, level + 1); - } - - (*action) (tree->data, INORDER, node, level, (int)tree->bal); - - if (tree->subtree[dir2] != NULL_TREE) - { avl_walk(tree->subtree[dir2], action, sibling_order, level + 1); - } - - (*action) (tree->data, POSTORDER, node, level, (int)tree->bal); - } - /* if non-empty tree */ -} /* avl_walk */ - - -/* -* avl_free() -- free up space for all nodes in a given tree -*/ -static void -avl_free(AVL_TREE tree, AVLtree *rootp) -{ if ( *rootp ) - { if ( (*rootp)->subtree[LEFT] != NULL_TREE ) - avl_free(tree, &(*rootp)->subtree[LEFT]); - - if ( (*rootp)->subtree[RIGHT] != NULL_TREE ) - avl_free(tree, &(*rootp)->subtree[RIGHT]); - - free_node(tree, rootp); - } -} - - - /******************************* - * ENUMERATION INTERFACE * - *******************************/ - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -avlfindfirst() -avlfindnext() -avlfinddestroy() - -This interface allows for enumerating all elements in a key-range. -avl_find_ge() finds the first node whose key is larger or equal to a -given key. avlfindnext() returns the next node. avlfinddestroy() -destroyes memory allocated for the enum (if any). -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - - -static inline AVLtree -push_node(avl_enum *e, AVLtree node) -{ e->parents[e->current++] = node; - - return node; -} - - -static inline AVLtree -pop_node(avl_enum *e) -{ if ( --e->current >= 0 ) - return e->parents[e->current]; - - return NULL; -} - - -static inline AVLtree -current_node(avl_enum *e) -{ if ( e->current >= 1 ) - return e->parents[e->current-1]; - - return NULL; -} - - -void * -avlfindfirst(AVL_TREE tree, void *data, avl_enum *e) -{ AVLtree node = tree->root; - - if ( !node ) - return NULL; - - e->tree = tree; - e->current = 0; - - for(;;) - { int diff; - - if ( data ) - diff = (*tree->compar)(data, node->data, IS_NULL); - else - diff = -1; /* search first node */ - - if ( diff < 0 ) - { push_node(e, node); - - if ( node->subtree[LEFT] ) - { node = node->subtree[LEFT]; - } else - { return node->data; /* key > target */ - } - } else if ( diff > 0 ) - { if ( node->subtree[RIGHT] ) - { node = node->subtree[RIGHT]; - } else - { if ( (node = current_node(e)) ) - return node->data; - - return NULL; - } - } else - { return push_node(e, node)->data; /* equal hit */ - } - } -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Last pushed node is the node returned. All nodes to the left are -considered `done'. We must return all nodes to the right, followed by -the parent. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -void * -avlfindnext(avl_enum *e) -{ AVLtree n = pop_node(e); - - if ( n->subtree[RIGHT] ) - { n = push_node(e, n->subtree[RIGHT]); - while(n->subtree[LEFT]) - n = push_node(e, n->subtree[LEFT]); - return n->data; - } - - n = current_node(e); - - return n ? n->data : NULL; -} - - -void -avlfinddestroy(avl_enum *e) -{ -} - - -/********************************************************************** -* -* C-interface (public functions) for avl trees -* -* These are the functions that are visible to the user of the -* AVL Tree Library. Mostly they just return or modify a -* particular attribute, or Call a private functions with the -* given parameters. -* -* Note that public routine names begin with "avl" whereas -* private routine names that are called by public routines -* begin with "avl_" (the underscore character is added). -* -* Each public routine must convert (cast) any argument of the -* public type "AVL_TREE" to a pointer to on object of the -* private type "AVLdescriptor" before passing the actual -* AVL tree to any of the private routines. In this way, the -* type "AVL_TREE" is implemented as an opaque type. -* -* An "AVLdescriptor" is merely a container for AVL-tree -* objects which contains the pointer to the root of the -* tree and the various attributes of the tree. -* -* The function types prototypes for the routines which follow -* are declared in the include file "avl.h" -* -***********************************************************************/ - - - -/* -* avlinit() -- get space for an AVL descriptor for the given tree -* structure and initialize its fields. -*/ -PUBLIC AVL_TREE -avlinit(AVL_TREE tree, - void *cdata, size_t isize, - int (*compare)(void *l, void*r, NODE type), - void (*destroy)(void *data), - void* (*alloc)(void *cdata, size_t bytes), - void (*free)(void *cdata, void *data, size_t bytes)) -{ tree->root = NULL_TREE; - tree->compar = compare; - tree->destroy = destroy; - tree->alloc = alloc; - tree->free = free; - tree->isize = (int)isize; - tree->client_data = cdata; - tree->count = 0; - - return (AVL_TREE) tree; -} /* avlinit */ - - - -/* -* avldispose() -- free up all space associated with the given tree structure. -*/ -PUBLIC void -avlfree(AVL_TREE tree) -{ avl_free(tree, &(tree->root)); -} /* avldispose */ - - - -/* -* avlwalk() -- traverse the given tree structure and perform the -* given action on each data item in the tree. -*/ -PUBLIC void -avlwalk(AVL_TREE tree, - void (*action)(void *data, - SIBLING_ORDER order, - NODE type, - int level, - int balance), - SIBLING_ORDER sibling_order) -{ avl_walk(tree->root, action, sibling_order, 1); -} /* avlwalk */ - - - -/* -* avlcount() -- return the number of nodes in the given tree -*/ -PUBLIC int -avlcount(AVL_TREE tree) -{ return tree->count; -} /* avlcount */ - - - -/* -* avlins() -- insert the given item into the tree structure -*/ -PUBLIC void * -avlins(AVL_TREE tree, void *data) -{ avl_insert(tree, &tree->root, &data); - if ( data == NULL ) - tree->count++; - - return data; -} /* avlins */ - - - -/* -* avldel() -- delete the given item from the given tree structure -*/ -PUBLIC int -avldel(AVL_TREE tree, void *data) -{ int found; - - avl_delete(tree, &tree->root, data, &found, tree->compar); - if ( found ) - tree->count--; - - return found; -} - - -/* -* avlfind() -- find the given item in the given tree structure -* and return its address (NULL if not found). -*/ -PUBLIC void * -avlfind(AVL_TREE tree, void *data) -{ return avl_find(data, tree->root, tree->compar); -} /* avlfind */ - - - -/* -* avldelmin() -- delete the minimal item from the given tree structure -*/ -PUBLIC int -avldelmin(AVL_TREE tree, void *data) -{ int found; - - avl_delete(tree, &tree->root, data, &found, avl_min); - if ( found ) - tree->count--; - - return found; -} /* avldelmin */ - - - -/* -* avlfindmin() -- find the minimal item in the given tree structure -* and return its address (NULL if not found). -*/ -PUBLIC void * -avlfindmin(AVL_TREE tree) -{ return avl_find(NULL, tree->root, avl_min); -} /* avlfindmin */ - - - -/* -* avldelmax() -- delete the maximal item from the given tree structure -*/ -PUBLIC int -avldelmax(AVL_TREE tree, void *data) -{ int found; - - avl_delete(tree, &tree->root, data, &found, avl_max); - if ( found ) - tree->count--; - - return found; -} /* avldelmax */ - - - -/* -* avlfindmax() -- find the maximal item in the given tree structure -* and return its address (NULL if not found). -*/ -PUBLIC void * -avlfindmax(AVL_TREE tree) -{ return avl_find(NULL, tree->root, avl_max); -} /* avlfindmax */ diff --git a/packages/semweb/avl.h b/packages/semweb/avl.h deleted file mode 100644 index 4811397ae..000000000 --- a/packages/semweb/avl.h +++ /dev/null @@ -1,131 +0,0 @@ -/** <plaintext> -* -* avl.h -- public types and external declarations for avl trees -* -* Created 03/01/89 by Brad Appleton -* -* ^{Mods:* } -* -* Fri Jul 14 13:54:12 1989, Rev 1.0, brad(0165) -* -**/ - -#ifndef AVL_H_INCLUDED -#define AVL_H_INCLUDED - - /* definition of traversal type */ -typedef enum { PREORDER, INORDER, POSTORDER } VISIT; - - - /* definition of sibling order type */ -typedef enum { LEFT_TO_RIGHT, RIGHT_TO_LEFT } SIBLING_ORDER; - - - /* definition of node type */ -typedef enum { IS_TREE, IS_LBRANCH, IS_RBRANCH, IS_LEAF, IS_NULL } NODE; - - /* definition of a NULL action and a NULL tree */ -#define NULL_ACTION ((void(*)()) NULL) -#define NULL_TREE ((AVLtree) NULL) - - -/* BEGIN Internal definitions */ - /* Directional Definitions */ -typedef short DIRECTION; -#define LEFT 0 -#define RIGHT 1 -#define OPPOSITE(x) (1 - (x)) - - - /* return codes used by avl_insert(), avl_delete(), and balance() */ -#define HEIGHT_UNCHANGED 0 -#define HEIGHT_CHANGED 1 - - - /* Balance Definitions */ -#define LEFT_HEAVY -1 -#define BALANCED 0 -#define RIGHT_HEAVY 1 -#define LEFT_IMBALANCE(nd) ((nd)->bal < LEFT_HEAVY) -#define RIGHT_IMBALANCE(nd) ((nd)->bal > RIGHT_HEAVY) - - - /* structure for a node in an AVL tree */ -typedef struct avl_node -{ struct avl_node *subtree[2]; /* LEFT and RIGHT subtrees */ - short bal; /* balance factor */ - void * data[1]; /* data on my back */ -} AVLnode, *AVLtree; - -/* End Internal definitions */ - - /* structure which holds information about an AVL tree */ -typedef struct avl_tree -{ AVLtree root; /* pointer to the root node of the tree */ - long count; /* number of nodes in the tree */ - /* function used to compare keys */ - void *client_data; /* arbitrary client data */ - int (*compar)(void *l, void*r, NODE type); - void (*destroy)(void *data); - void* (*alloc)(void *cdata, size_t size); - void (*free)(void *cdata, void* data, size_t size); - int isize; /* item data size */ -} avl_tree, *AVL_TREE; - -#define AVL_ENUM_MAX 32 /* balanced tree, allows for 2**32 */ - /* nodes */ - -typedef struct avl_enum -{ AVL_TREE tree; - int current; - AVLtree parents[AVL_ENUM_MAX]; -} avl_enum; - -void *avlfindfirst(AVL_TREE tree, void *key, avl_enum *e); -void *avlfindnext(avl_enum *e); -void avlfinddestroy(avl_enum *e); - - /* Constructor and Destructor functions for AVL trees: - * avlfree is a macro for avldispose in the fashion - * of free(). It assumes certain default values - * (shown below) for the deallocation function and - * for the order in which children are traversed. - */ -extern AVL_TREE avlinit(AVL_TREE tree, - void *cdata, size_t isize, - int (*compare)(void *l, void*r, NODE type), - void (*destroy)(void *d), - void* (*alloc)(void *cdata, size_t bytes), - void (*free)(void *cdata, void *ptr, size_t size)); -extern void avlfree(AVL_TREE tree); - - /* Routine for manipulating/accessing each data item in a tree */ -extern void avlwalk(AVL_TREE, - void (*action)(void *data, - SIBLING_ORDER order, - NODE type, - int level, - int balance), - SIBLING_ORDER); - - - /* Routine for obtaining the size of an AVL tree */ -extern int avlcount(AVL_TREE); - - - /* Routines to search for a given item */ -extern void *avlins(AVL_TREE tree, void *data); -extern int avldel(AVL_TREE tree, void *data); -extern void *avlfind(AVL_TREE tree, void *data); - - - /* Routines to search for the minimal item of a tree */ -extern int avldelmin(AVL_TREE tree, void *data); -extern void *avlfindmin(AVL_TREE tree); - - - /* Routines to search for the maximal item of a tree */ -extern int avldelmax(AVL_TREE tree, void *data); -extern void *avlfindmax(AVL_TREE tree); - -#endif /* AVL_H_INCLUDED */ diff --git a/packages/semweb/common.mk b/packages/semweb/common.mk deleted file mode 100644 index b5bf0197e..000000000 --- a/packages/semweb/common.mk +++ /dev/null @@ -1,13 +0,0 @@ -# Common declarations for Unix and Windows build -LIBPL= $(srcdir)/rdf_db.pl $(srcdir)/rdfs.pl \ - $(srcdir)/rdf_edit.pl $(srcdir)/rdf_litindex.pl \ - $(srcdir)/rdf_persistency.pl $(srcdir)/rdf_turtle.pl \ - $(srcdir)/rdf_cache.pl \ - $(srcdir)/rdf_http_plugin.pl $(srcdir)/rdf_zlib_plugin.pl \ - $(srcdir)/rdf_portray.pl \ - $(srcdir)/rdf_compare.pl $(srcdir)/turtle_base.pl \ - $(srcdir)/rdf_turtle_write.pl \ - $(srcdir)/rdf_library.pl $(srcdir)/sparql_client.pl - -DATA= $(srcdir)/rdfs.rdfs $(srcdir)/dc.rdfs $(srcdir)/eor.rdfs \ - $(srcdir)/owl.owl $(srcdir)/rdf_library.ttl diff --git a/packages/semweb/config.h.in b/packages/semweb/config.h.in deleted file mode 100644 index a341375d5..000000000 --- a/packages/semweb/config.h.in +++ /dev/null @@ -1,93 +0,0 @@ -/* config.h.in. Generated from configure.in by autoheader. */ - -/* Define if building universal (internal helper macro) */ -#undef AC_APPLE_UNIVERSAL_BUILD - -/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP - systems. This function is required for `alloca.c' support on those systems. - */ -#undef CRAY_STACKSEG_END - -/* Define to 1 if using `alloca.c'. */ -#undef C_ALLOCA - -/* Define to 1 if you have `alloca', as a function or macro. */ -#undef HAVE_ALLOCA - -/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix). - */ -#undef HAVE_ALLOCA_H - -/* Define to 1 if you have the <inttypes.h> header file. */ -#undef HAVE_INTTYPES_H - -/* Define to 1 if you have the <memory.h> header file. */ -#undef HAVE_MEMORY_H - -/* Define to 1 if you have the <stdint.h> header file. */ -#undef HAVE_STDINT_H - -/* Define to 1 if you have the <stdlib.h> header file. */ -#undef HAVE_STDLIB_H - -/* Define to 1 if you have the <strings.h> header file. */ -#undef HAVE_STRINGS_H - -/* Define to 1 if you have the <string.h> header file. */ -#undef HAVE_STRING_H - -/* Define to 1 if you have the <sys/stat.h> header file. */ -#undef HAVE_SYS_STAT_H - -/* Define to 1 if you have the <sys/types.h> header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define to 1 if you have the <unistd.h> header file. */ -#undef HAVE_UNISTD_H - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the home page for this package. */ -#undef PACKAGE_URL - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION - -/* The size of `long', as computed by sizeof. */ -#undef SIZEOF_LONG - -/* If using the C implementation of alloca, define if you know the - direction of stack growth for your system; otherwise it will be - automatically deduced at runtime. - STACK_DIRECTION > 0 => grows toward higher addresses - STACK_DIRECTION < 0 => grows toward lower addresses - STACK_DIRECTION = 0 => direction of growth unknown */ -#undef STACK_DIRECTION - -/* Define to 1 if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most - significant byte first (like Motorola and SPARC, unlike Intel). */ -#if defined AC_APPLE_UNIVERSAL_BUILD -# if defined __BIG_ENDIAN__ -# define WORDS_BIGENDIAN 1 -# endif -#else -# ifndef WORDS_BIGENDIAN -# undef WORDS_BIGENDIAN -# endif -#endif - -/* Define for multi-thread support */ -#undef _REENTRANT diff --git a/packages/semweb/configure.in b/packages/semweb/configure.in deleted file mode 100644 index 89de9594e..000000000 --- a/packages/semweb/configure.in +++ /dev/null @@ -1,15 +0,0 @@ -dnl Process this file with autoconf to produce a configure script. - -AC_INIT(install-sh) -AC_PREREQ([2.50]) -AC_CONFIG_HEADER(config.h) - -m4_include([../ac_swi_c.m4]) - -AC_CHECK_SIZEOF(long) - -AC_OUTPUT(Makefile) - - - - diff --git a/packages/semweb/dc.rdfs b/packages/semweb/dc.rdfs deleted file mode 100644 index 17faa860f..000000000 --- a/packages/semweb/dc.rdfs +++ /dev/null @@ -1,198 +0,0 @@ -<?xml version="1.0"?> - -<!-- - RDF Schema declaration for the Dublin Core Element Set 1.1 - 2001/08/14 - comments, etc. to webteam <dcmi-feedback@dublincore.org> ---> - -<!DOCTYPE rdf:RDF [ - <!ENTITY rdfns 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'> - <!ENTITY rdfsns 'http://www.w3.org/2000/01/rdf-schema#'> - <!ENTITY dcns 'http://purl.org/dc/elements/1.1/'> - <!ENTITY eorns 'http://dublincore.org/2000/03/13/eor#'> - ]> - -<rdf:RDF xmlns:rdf="&rdfns;" - xmlns:rdfs="&rdfsns;" - xmlns:dc="&dcns;" - xmlns:eor="&eorns;"> - -<!-- Description of Schema --> - -<eor:Schema rdf:about="&dcns;"> - <rdf:value>The Dublin Core Element Set v1.1</rdf:value> - <dc:title>The Dublin Core Element Set v1.1</dc:title> - <dc:publisher>The Dublin Core Metadata Initiative</dc:publisher> - <dc:description>The Dublin Core metadata vocabulary is a simple vocabulary - intended to facilitate discovery of resources. </dc:description> - <dc:language>English</dc:language> - <dc:relation rdf:resource="http://dublincore.org/documents/dces/"/> - <dc:date>2000-07-02</dc:date> -</eor:Schema> - -<!-- Begin: Title Declaration --> - -<rdf:Property rdf:about = "&dcns;title"> - <rdfs:label>Title</rdfs:label> - <rdfs:comment>A name given to the resource.</rdfs:comment> - <eor:comment>Typically, a Title will be a name by which the resource - is formally known.</eor:comment> - <rdfs:isDefinedBy rdf:resource = "&dcns;" /> -</rdf:Property> - -<rdf:Property rdf:about = "&dcns;contributor"> - <rdfs:label>Contributor</rdfs:label> - <rdfs:comment>An entity responsible for making contributions to the - content of the resource.</rdfs:comment> - <eor:comment>Examples of a Contributor include a person, an - organisation, or a service. Typically, the name of a Contributor - should be used to indicate the entity.</eor:comment> - <rdfs:isDefinedBy rdf:resource = "&dcns;" /> -</rdf:Property> - -<rdf:Property rdf:about = "&dcns;creator"> - <rdfs:label>Author/Creator</rdfs:label> - <rdfs:comment>An entity primarily responsible for making the content - of the resource.</rdfs:comment> - <eor:comment> Examples of a Creator include a person, an - organisation, or a service. Typically, the name of a Creator should - be used to indicate the entity.</eor:comment> - <rdfs:isDefinedBy rdf:resource = "&dcns;" /> -</rdf:Property> - -<rdf:Property rdf:about = "&dcns;publisher"> - <rdfs:label>Publisher</rdfs:label> - <rdfs:comment>An entity responsible for making the resource - available.</rdfs:comment> - <eor:comment> Examples of a Publisher include a person, an - organisation, or a service. Typically, the name of a Publisher - should be used to indicate the entity.</eor:comment> - <rdfs:isDefinedBy rdf:resource = "&dcns;" /> -</rdf:Property> - -<rdf:Property rdf:about = "&dcns;subject"> - <rdfs:label>Subject</rdfs:label> - <rdfs:comment>The topic of the content of the resource.</rdfs:comment> - <eor:comment> Typically, a Subject will be expressed as keywords, - key phrases or classification codes that describe a topic of the - resource. Recommended best practice is to select a value from a - controlled vocabulary or formal classification scheme.</eor:comment> - <rdfs:isDefinedBy rdf:resource = "&dcns;" /> -</rdf:Property> - -<rdf:Property rdf:about = "&dcns;description"> - <rdfs:label>Description</rdfs:label> - <rdfs:comment>An account of the content of the resource.</rdfs:comment> - <rdfs:isDefinedBy rdf:resource = "&dcns;" /> -</rdf:Property> - -<rdf:Property rdf:about = "&dcns;date"> - <rdfs:label>Date</rdfs:label> - <rdfs:comment>A date associated with an event in the life cycle of - the resource.</rdfs:comment> - <eor:comment>Typically, Date will be associated with the creation or - availability of the resource. Recommended best practice for - encoding the date value is defined in a profile of ISO 8601 [W3CDTF] - and follows the YYYY-MM-DD format.</eor:comment> - <rdfs:isDefinedBy rdf:resource = "&dcns;" /> -</rdf:Property> - -<rdf:Property rdf:about = "&dcns;type"> - <rdfs:label>Resource Type</rdfs:label> - <rdfs:comment>The nature or genre of the content of the - resource.</rdfs:comment> - <rdfs:isDefinedBy rdf:resource = "&dcns;" /> -</rdf:Property> - -<rdf:Property rdf:about = "&dcns;format"> - <rdfs:label>Format</rdfs:label> - <rdfs:comment>The physical or digital manifestation of the - resource.</rdfs:comment> - <eor:comment> Typically, Format may include the media-type or - dimensions of the resource. Format may be used to determine the - software, hardware or other equipment needed to display or operate - the resource. Examples of dimensions include size and duration. - Recommended best practice is to select a value from a controlled - vocabulary (for example, the list of Internet Media Types [MIME] - defining computer media formats).</eor:comment> - <rdfs:isDefinedBy rdf:resource = "&dcns;" /> -</rdf:Property> - -<rdf:Property rdf:about = "&dcns;identifier"> - <rdfs:label>Resource Identifier</rdfs:label> - <rdfs:comment>An unambiguous reference to the resource within a - given context.</rdfs:comment> - <eor:comment>Recommended best practice is to identify the resource - by means of a string or number conforming to a formal identification - system. Example formal identification systems include the Uniform - Resource Identifier (URI) (including the Uniform Resource Locator - (URL)), the Digital Object Identifier (DOI) and the International - Standard Book Number (ISBN).</eor:comment> - <rdfs:isDefinedBy rdf:resource = "&dcns;" /> -</rdf:Property> - -<rdf:Property rdf:about = "&dcns;language"> - <rdfs:label>Language</rdfs:label> - <rdfs:comment> A language of the intellectual content of the - resource.</rdfs:comment> - <eor:comment> Recommended best practice for the values of the - Language element is defined by RFC 1766 [RFC1766] which includes a - two-letter Language Code (taken from the ISO 639 standard [ISO639]), - followed optionally, by a two-letter Country Code (taken from the - ISO 3166 standard [ISO3166]). For example, 'en' for English, 'fr' - for French, or 'en-uk' for English used in the United - Kingdom.</eor:comment> - <rdfs:isDefinedBy rdf:resource = "&dcns;" /> -</rdf:Property> - -<rdf:Property rdf:about = "&dcns;relation"> - <rdfs:label>Relation</rdfs:label> - <rdfs:comment> A reference to a related resource.</rdfs:comment> - <eor:comment> Recommended best practice is to reference the resource - by means of a string or number conforming to a formal identification - system.</eor:comment> - <rdfs:isDefinedBy rdf:resource = "&dcns;" /> -</rdf:Property> - -<rdf:Property rdf:about = "&dcns;source"> - <rdfs:label>Source</rdfs:label> - <rdfs:comment>A Reference to a resource from which the present - resource is derived.</rdfs:comment> - <eor:comment> The present resource may be derived from the Source - resource in whole or in part. Recommended best practice is to - reference the resource by means of a string or number conforming to - a formal identification system.</eor:comment> - <rdfs:isDefinedBy rdf:resource = "&dcns;" /> -</rdf:Property> - -<rdf:Property rdf:about = "&dcns;coverage"> - <rdfs:label>Coverage</rdfs:label> - <rdfs:comment> The extent or scope of the content of the - resource.</rdfs:comment> - <eor:comment>Coverage will typically include spatial location (a - place name or geographic coordinates), temporal period (a period - label, date, or date range) or jurisdiction (such as a named - administrative entity). Recommended best practice is to select a - value from a controlled vocabulary (for example, the Thesaurus of - Geographic Names [TGN]) and that, where appropriate, named places or - time periods be used in preference to numeric identifiers such as - sets of coordinates or date ranges.</eor:comment> - <rdfs:isDefinedBy rdf:resource = "&dcns;" /> -</rdf:Property> - -<rdf:Property rdf:about = "&dcns;rights"> - <rdfs:label>Rights</rdfs:label> - <rdfs:comment> Information about rights held in and over the - resource.</rdfs:comment> - <eor:comment> Typically, a Rights element will contain a rights - management statement for the resource, or reference a service - providing such information. Rights information often encompasses - Intellectual Property Rights (IPR), Copyright, and various Property - Rights. If the Rights element is absent, no assumptions can be made - about the status of these and other rights with respect to the - resource.</eor:comment> - <rdfs:isDefinedBy rdf:resource = "&dcns;" /> -</rdf:Property> - -</rdf:RDF> diff --git a/packages/semweb/debug.c b/packages/semweb/debug.c deleted file mode 100644 index c9ed0a452..000000000 --- a/packages/semweb/debug.c +++ /dev/null @@ -1,46 +0,0 @@ -/* $Id$ - - Part of the SWI-Prolog Semweb package - - Author: Jan Wielemaker - E-mail: wielemak@science.uva.nl - WWW: http://www.swi-prolog.org - Copyright (C): 2006, University of Amsterdam - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include "SWI-Prolog.h" -#include "debug.h" - -#ifdef O_DEBUG - -static int dbg_level; - -int -rdf_debuglevel() -{ return dbg_level; -} - - -foreign_t -rdf_debug(term_t level) -{ if ( !PL_get_integer(level, &dbg_level) ) - return FALSE; - - return TRUE; -} - -#endif diff --git a/packages/semweb/debug.h b/packages/semweb/debug.h deleted file mode 100644 index 982f3f82b..000000000 --- a/packages/semweb/debug.h +++ /dev/null @@ -1,45 +0,0 @@ -/* $Id$ - - Part of the SWI-Prolog Semweb package - - Author: Jan Wielemaker - E-mail: wielemak@science.uva.nl - WWW: http://www.swi-prolog.org - Copyright (C): 2006, University of Amsterdam - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef DEBUG_H_INCLUDED -#define DEBUG_H_INCLUDED - -#define O_DEBUG 1 - -#ifdef O_DEBUG -int rdf_debuglevel(); -foreign_t rdf_debug(term_t level); - -#define DEBUG(n, g) if ( rdf_debuglevel() >= (n) ) { g; } -#else -#define DEBUG(n, g) ((void)0); -#endif - -#ifdef O_SECURE -#define SECURE(g) g -#else -#define SECURE(g) (void)0 -#endif - -#endif /*DEBUG_H_INCLUDED*/ diff --git a/packages/semweb/eor.rdfs b/packages/semweb/eor.rdfs deleted file mode 100644 index bedabf91f..000000000 --- a/packages/semweb/eor.rdfs +++ /dev/null @@ -1,95 +0,0 @@ -<?xml version="1.0"?> - -<!-- - RDF Schema declaration for the EOR Toolkit Vocabulary - 2001/03/28 - comments, etc. to webteam <dcmi-feedback@dublincore.org> ---> - -<!DOCTYPE rdf:RDF [ - <!ENTITY rdfns 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'> - <!ENTITY rdfsns 'http://www.w3.org/2000/01/rdf-schema#'> - <!ENTITY dcns 'http://purl.org/dc/elements/1.1/'> - <!ENTITY eorns 'http://dublincore.org/2000/03/13/eor#'> - ]> - -<rdf:RDF xmlns:rdf="&rdfns;" - xmlns:rdfs="&rdfsns;" - xmlns:dc="&dcns;" - xmlns:eor="&eorns;"> - -<eor:Schema rdf:about="&eorns;"> - <!-- dumb down rule... use rdf:value for a simple default name --> - <rdf:value>The EOR Vocabulary v1.0</rdf:value> - <dc:title>The EOR Vocabulary v1.0</dc:title> - <dc:creator>Eric Miller, emiller@oclc.org</dc:creator> - <dc:contributor>Tod Matola, matola@oclc.org</dc:contributor> - <dc:contributor>Harry Wagner, wagnerh@oclc.org</dc:contributor> - <dc:description>The EOR vocabulary is a simple vocabulary intended - to support the EOR Toolkit and provides an additional level of - conformance, validation and general description beyond the - base-level RDF specifications specifically defined for RDF-based, - Dublin Core metadata applications.</dc:description> - <dc:date>2000-03-13</dc:date> -</eor:Schema> - -<!-- Data Type declaration --> - -<rdfs:Class rdf:about = "&eorns;DataType"> - <rdfs:label>Data Type</rdfs:label> - <rdfs:comment>A data type.</rdfs:comment> - <rdfs:subClassOf rdf:resource = - "http://www.w3.org/2000/01/rdf-schema#Literal" /> - <rdfs:isDefinedBy rdf:resource = "&eorns;" /> -</rdfs:Class> - -<!-- Class declarations --> - -<rdfs:Class rdf:about = "&eorns;Schema"> - <rdfs:label>RDF Schema</rdfs:label> - <rdfs:comment>A RDF schema</rdfs:comment> - <rdfs:subClassOf rdf:resource = - "http://purl.org/dc/dcmitype/Text" /> - <rdfs:isDefinedBy rdf:resource = "&eorns;" /> -</rdfs:Class> - -<rdfs:Class rdf:about = "&eorns;Profile"> - <rdfs:label>Profile</rdfs:label> - <rdfs:comment>An application profile</rdfs:comment> - <rdfs:subClassOf rdf:resource = "Schema" /> - <rdfs:isDefinedBy rdf:resource = "&eorns;" /> -</rdfs:Class> - -<rdfs:Class rdf:about = "&eorns;WebPage"> - <rdfs:label>Web Page</rdfs:label> - <rdfs:comment>A web page</rdfs:comment> - <rdfs:subClassOf rdf:resource = - "http://purl.org/dc/dcmitype/Text" /> - <rdfs:isDefinedBy rdf:resource = "&eorns;" /> -</rdfs:Class> - -<!-- Additional Class relations --> - -<rdf:Property rdf:about = "&eorns;alias"> - <rdfs:label>alias</rdfs:label> - <rdfs:comment>An alias.</rdfs:comment> - <rdfs:isDefinedBy rdf:resource = "&eorns;" /> -</rdf:Property> - - -<!-- Additional Property declarations --> - -<rdf:Property rdf:about = "&eorns;label"> - <rdfs:label>label</rdfs:label> - <rdfs:comment>A application-specific label.</rdfs:comment> - <rdfs:isDefinedBy rdf:resource = "&eorns;" /> -</rdf:Property> - -<rdf:Property rdf:about = "&eorns;comment"> - <rdfs:label>Comment</rdfs:label> - <rdfs:comment>A comment or note providing additional - application-specific information.</rdfs:comment> - <rdfs:isDefinedBy rdf:resource = "&eorns;" /> -</rdf:Property> - -</rdf:RDF> diff --git a/packages/semweb/figs/modules.pd b/packages/semweb/figs/modules.pd deleted file mode 100644 index 0b9f8e4faa6e3f84b660e612ee461dfe94299bfb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 23242 zcmd^Hd7K<oo$oi(-E${lNI1t3Aw-f$AVU%Yq9!DS1UYjtki@p8yJn_IPxqv{dk$Cy zS6vWAP)_CYKokY>j7mHa4-`}s7FgU}cURFxmR<KyR95$WzrUJ#uWP2y41eUa^ZCr{ zs#ouKAMaPMUR5L#={kSi84E^TFQ3k37p#axA_uM0O)Nj;x&?ip{Qs6=cer1VIuGZY z(2R3ja>z+%^=XqoE}BnY>S9n61~rYNZFVuV%_$VTbbqnnqRan}rv@_4U|yd^v(7NC z#73P=kr<i@OAKqy)mPdFJ!fPnopdtff&`+xe6kQo4rdZ6FP8zDsQ#a?|KlllG@WFR z<GGIRX-lQ^BN=DHP3e>75f|LI6x{Jb(ZjHKGMC8}J#-E^*;K{_a~;WCHtQw}T1Pgo zt$8=2dx@zvoz+^D<G7=TjtaJ-m(Ky)98EG;EF{v|g6j=9WNEhN?kT$YLL!+P9udXF zGVZ9G0Ux=6fjmvnmdvC_5<d5q62Rg}4)`F+EFb@{lXV7NP>c`cykQ4MZ0~nciQsGw z&iZr3Y$}}{)Cc2wM4RUt9^(0eQz$}E4Vc_L=wU1n_UF8mp!S?pnj_k@21Xqy21bv< zWU=uq>>c$vj^SAUE6`CBx`~aYQ-vXY5Fc{WgF^*C#sC?IHPta_*5f>drq@9mfd@ph zxvZNaC0f6Q){oQrb5ou(me68Ao0G=UFme5VAUZ<FK-$xu;dowdOpDN&*9OX_g7X$_ zBd?HvPW?k_*40DM7sCO1qM3AdH+~1a+_3&_D&%zAfwP48w?1tv<jhI?KziKO?jqw` z<&03Xg=Q)ZEo+Nw$S%+cI$+2+tkpVBBhjdBH0n0ptww1{G;5|9HA@3)Zrx(h$>I+X z0hk=^rDORbwP-wWEQrVeFA;H$@q$D$<K&q$T0pzq0iSfB4myxB>86t%OgHoBP+=_K za#~mGV?LbZrBx4`r~ePM^fMD)2ko{((Os4o%%Wl==(d_7&XpC~Aun*4Nn(>h(56Qp zs{ao(tu`0ZBbsfUWCvW&%`*4LGj4W}Sui@L^RT|$Igrj|5+iz=bUnmYEMJ(Axh&%j zAdSbo$!ysMm37lWQ|^FM%=n4IQurJy{1&ZX2|K!e$Mj(*3YNG-gvB_m=!16s&zW6v zH!Rx@lO06lw-R~K*=;)aVh~5Rtkp*y{TV%vB+|orW&-E&WG0t)Qvu|`guDajt_V8k zvhx;p0-fbHJf+tl6$A&V&A1SQ1Z}7V@_sGQp*s%5Dd51a1v+4id6q{W0)xuzPXDMj zyB|siP%f?7+6OZmvx>8VgbF<7FpGdG5)LOCzXoN<pxD!Zo%;VkbPHXcd6F@r1Gy|D zF_m6?*zpEgkhkfY&Gr1Lv2`SuPy17LEU61KR)zVY+*l$wD^u!4$8^=LX|#?ff{L_d zJOFE%2oBp5QV#pIU?+@o#5k=t4>n>oa3rn4I<XrAcA=RyeOijLDrYr-m^N~E>9Yt> zb^*Ev$!X5!^&1v!_0l65_xLS^oaZ9%bPu_iQMaIP84|jhak7c!y^?-h6ybnP6$9^i z1v%?Q@8M{oMN}YCc*eEI=t_s@XnJ^*W#QQ@74$6KeX#yN(B`IiP|C;iLrzMH&CpDw zs{%bUiTR<gSrC7I*tADcfhJ8;T}?FYlqo(2$6RiLSfIjlMV5sbsVxXod!?avBG{=) zt+y(*KFG$p@MuBam(4nK5OyBpcfy6*9jy?#%M&jVhrp#+Uf<>o@hF?~3PVnDx?W1g zT6v+BB9A4BM>R6Vz}QZ-WugNr6q#5nM*=X(vAY;~?U0G#w#cIMD$+@V&U%ob@+#bD z9mnxahUvu?vL(DI#Q^z5Q)7W2AsD9vL138X{IS%c^J>F%P4ma`KGQ_G*zms0!g&J6 zP;-00HWhwWZ3-7P6O0J<3GZxUY?s3F(J_68&jZ)V7mD<T(!Ls|wi7Mc&D6G>z0DMj z>9$v*WGRf!bbAs<(9gOdUmu$4=@#%^7`g(vwF|j5l}i?fb>7U^omf|rhhCs#V(qGs zSjk_+iu+YziB2ZAmnqAv4pTeDP@DNIbE+UO%`&g?JK-^9vJ8D|5wi+243C&~9A~;- zsh}1bH{&9iNr$F_I*r67FBms_Eqf*UnT%g2YFZSy+3SUAn3$Ha^2wCc-=fo_NnHU* zM6cNZAN_bun7~>RI2NPn$4B6(4nIB}ejN8w1ItD-bvy7n5;qPUui(IBERr=-$$C*u zsgcj{JF6Kvh5=FJ4IUtqh>1)4Om5p?<+d|HL|utyC)9NYnn;bg?U6|^9|3*NOePyG zI-5v`0P8@)GQPEH2itNQJ&Uq8v380FOHi}*Wh~~jk0-2JwSB@qi|$Ty9g<7Mz&9J@ z-oS+ywL~Az(f`f*-&$3ka_c+?FlUp8HK;1p3A#B*|5pP%2!Q7ZAP$$HNx_+7V~J76 z14Bf9u8hGsVa_u!431vH3;_mK)!vlWtH3yHN-n1<DcAYq0mchL7&jY?%gS-FB?Pn8 zz$m~};-c5M?>2%(jfZWwEPo*`s+Z7kC5Pgzt<l2*FhQ_aJdEu|NY44c&!Tn_sXYv8 zHO>DQlXd_8al6TWTo#xv`|Yp@nC!QcXsk(gmn0|Zh?DFaIbuGv+Kpy0nmUq`tm2-f zpE_in`m@uUNWB*{IlZ=2$WG+Uo?e}>Ed9jxGEJ|^FtwDSHuKY~E67VT?||Qla4R#t z;?k5NUMAL1X)hD&1``~Emb(stQWL~dJ7Am@XlhKq2CNC$RP6`{M-<4?7PU)Aje}3e zwJJ$?H`O2u-^?}{lWm51ZB3BBvT_crClK{CIWHH288I-`bDqgIdkEGfdL85xF*~#j zues>f|2_KuK)cnRiN$p-_KZE!frXi{Jj;>tFhSFGF!Y^hxNdwGbNZB0j!!%MThPr2 zn`xG$f$e(TD7Yn$B6or?@fPTHd{|Jlco?M{m?R`e)gKmEx8h)3z`&O^$NGn|R-8r! z&_)mQSIV%2^Z)t5&B0LIm}QG`+TwC_-v$dZ6GiC{QK(j)$-<(n?j|_A-IOtxn#6J$ zubIU1S8@*2=MeQYiRH~9n70@h(u>wsOkHlcxFUq{tp?*0<+%9k5X{>Q44teJ7rjOo zZ#P`LBZTp90*oxyn>J6Qiz`DgR|PP#C8H7-CmAl@X}GvLgz;SgM)g8DUA#L4b4>tK zor@KQi}x5Vt_@+lF2L9{w;UJm4Z*xGfQfM5NF`mYG+bP7xVRyN@kWF3uyS176oR?g zz*Oa8mEqzR!^QhU7(ZYz{-hiiw}xPDGcZ-TIN5M<yW!%F5XL(V#>dNX@xc(xhYU<r zE>;^ZK5V%7NC@Ly0Y)`ej*E|mVD1iJWEHfMUz}pN_?Y41;~|Xq1Q^w2<+%7n2<DRk zOf~OpPA)&OFUY3%60Vheai+e{%FLhQMcfZXTr`|fPpvvrmz$`|^#e6-?u7`C?%*WA zeLE~f@3*-6G`YfJu2j5L3enGSxK)UL)@c57yk_Q$&&xSbFGrJ_CP#iD1hY2;Q|Y#M zxl#NV3FhBB-e>L|%dVV#i2x$Dxp(|Bd##nT2jmXueps0Ij{7*mlscBWrj%Q?tekx% zOyH{|z{Om8&{@!29XF?6!^&Cb#<c4>$)Sk_XKvdBt=IKr?dxQr7le6-+F9WamF(H; zXWt;OZ;1y=Z|1%!%A<M8+|1Ea$55!~#TEa@aZErxXu0mUfKFWiJ_pb+piX`{0!nS2 zBqB$*g#zj!i>q&wtAzmIEu`fk(=D%k$JZA;jCXe5H39WKUNZspu$%+6+<s3JP~Q*1 z{J_A_qBRE8BLwr!_+SkI^(X+8h;0JuheTrq)Q`m99|{8M#~d+p0rgmzz)whE9+cLN z=2SFw1k_IvQ0-f|bF`swdYlYU`3$G_3gJZN>~MNQ)KeNqf9rQ5K5CDnUOSGSv^@4H zpi@slFD8ywzbtX|%p?)TquWDq^t8p*-;t|(0Z>aEJwu&X6VuO39Q{47nK=3fIS1;p zD<uCIg88|DsV9#9iC}&lJy}B>{WAcRh;8ENUx>zvqhE-dKOMx;FF9i7;^^5hfnSjT zSI8MhT(+tsj(&|e>e%Y^7c-96P$2y)IWU3LQ6Z4XogGNe`5L6hJu53#zbFl>--rt9 zoSsgy!|Hj<f&UHYnl6EtnR@S(mm{p2h9`;0Q8=t#u(<kna>a;ZgUWpBo^7}l@7Mo> zI<dm)w<fIqlh;gG{g<2r;VEdwrkS4pI|TDT28K0ajnmWb2<C^?^EHIk?*Y&xVw<pf zk!Y;2`h$4=3qe@@kt0l4S?X%2-uqLSz)K{+hbIiHerT?au=-zw)oeWRU!QjL8yCY3 zh1Q?R#c80;Icj!=&?1L+X#GWWR1!=o;&;|JN3GDo#0d3*l20k)y{d^=ZvdZWwe#$T zV~PuqHv`*qXn1rd=?6DUs@WnRCHZs!P`S2KF%CDuqvApEs1{xef=9K=IZ&5-MyT3C zFzp709$H)Qs1Ab36EbWyQJt2EUA*`xy15L%9X2&S29YgI0F%8o%~WMOTGfn@isERN zMQt{yaj;mRibCg*If+*k%jzJb&~9Ec3O!iP^{BFwyqX(=nP*_CD>PVrP=^>U4h>;E z%wQ~6va7>GFh>{|1@<eM)jaxDM-t33YmcSqSKy+&l+gp66z@0&j&)a(4ejT*-|7IE zAXsmibrz4g?_tU_xal|2(HlBVc+a=EJc?YN4+c$mpR-@#t+oK$Z@@f{{O~3h!n}XC z*(-OOs~xBMbfOlJ(PM!6xnMd`ucQUcbfS)CwpX(zrxSGyN0{lv^7lrj6SXi*;8+qk z8jN+LS%9YY=|nBUbkd?X-sBtDd81xM>b;=JX{6G#ZE|K!BkDK;%bc!`E}cyli{2`g zW-wprHXGT=S=vXxW71n<`Q1{YXVN<q%rogt-CsFvbV$+zm?XVTaIJ`+^mttBt{@Cn zss`_SHQAME$avrJ?6tganK%bCFBY%V38F>tM;F{*?>jL}U^xjeEV@DEC^U6=UoX5b zo*T<F;(RBOcrQrO`6_MuB4f7mtst=Pe9KCmZ>6ZMlJn8drOQ^U{8C2EH@R+=<#Q(k ztNK0IHM#EY{mXTK1j_Yja1^m}U1X!pB6A&<t|yaS@JQ9(pnN%S;4Pn~$9N<O(qENZ zISCrP#XHRw9km)l%ASbRji;VMg<76^Djg}34)Ww{MCBkmBc6I%n80gEz}(HQ1F1SZ z^>y&n&VDcFq>_5OUnBndda_{rwbC*x*|Yt14S{`sJ+;(d*NXBg`Rg>v(wW-FQe3U7 zAtRj*k_rzS)H-A5b!5b{^LjA@_lq$jogu8wn4LF-37km+hk-yhnw4nku=7UPxkJx~ z2{)B)$jqC_fiZKXRSR-woB1pP`(|EWYUVfaTBMSh8S^szl<aEvH>H;JiLra+XNlZ} zEvv!wXM+uy`qmrMpF`#>)1NDri3K5kp0E#l%t(lzA0}`C2^<LmG(DI4>M;Fgn7$3B zPxUtv-&;uE7+$~OMPU(V;TM$1n{D{5qMcHUZ}U5Wq0G9km~WQ+G>a7%$<I>x*(g8r z<fl)57IW`bRKLuM_x$JT|0BTV0roM5DjT-UCmJSqCYzV3+W4IZ{VfZ8Mj_7kX>k;O z$2Y3q*Td`i{u{CSsEdFjxlHg;g}I0aYul~5kY>9D-J|dTKBtmxw^NFKeAuCYmx_m~ z?9)OVwF70JI0X>Pot)-nf@f&B1sp4R>LQMlh$P^}?7$;XwU;Fddv}=LQSE)jtT>1~ z)23)Uts-U@Mk}P5`b8`E0J~g&An_Z?B9lf%i4z=WN&F^qyN%o$i5=6s*OGWUM^NH^ zOX4I){{c9Px)EcZK7H91HfA}=%Jl~lTl;P+O6-Ou=Jr{C$G4GqkTSdk8ElCc8i|K2 ziPJ>No1=>%@r4w-Hi@%UMZ1L9s~dB7ShS2`YnKsi7`-wZ?Xrw1dwyxmtR-5Gqpt+W zMUZMk9io+!tXzL!%n>qPUE)0)XSuIOZdqjQG!o~H3_Fd)s>c|!U`br$Xa+3TftZUH z&y+Do$#Qkk#yHLrZJcZ|GKF#Gq6yQB+Q-jDN*0f3%u6lNE+bO<DLI%~Kb6go)kS-A zShTkowq$LNqFqkWaHp)AEzy=3t6gD<_Ev)f3k?#2t7gh-vRkscXm2AI@@@%*c)P`x zamaVD_eF?ysOgmrlkDAOdauM-f8E5WAu=YD&i(T9ko-I?KQGA7ee(05{5&Z?&&y9* zeg=&)ud<Z+PSBJc`+ZO*i|&@0Qs&jbE){LXRQ)cFvqIqAhOHe&LD#Ss3pHwor67+I zD*wh{zMRPp#ZHWUk0tN5M3Dho&!It-mAeI!z18MDek83fAiNI6aMwEh{@0+p;Ed5m zUMyAbB_lV1{BO~86}bRKHH8aeGU>nhLW$mINpw9Bsb2%f&(JJFvxF8Doy&KpxLj9O zq8lL5ytVnf{t8(8X1AdCOBLFSBPpj)_qPbtjb!LgV1ts)s~{Pf?J+M;s+%myZU&;r z)oAvi;X-bidzP}2-2%yC7ZhD@qTan<>iuK@MPcMYG_eYjkU85%AFw33l`6qn)P6{E z+kQxLI~kxK)i22%mLzvlCBK9uD480w$p`mCk`IxA-)Y+NNUkoMeAtrYBSiEoAUdvL zN$%PYNj^#jUIYWY<E=}QyDdpRMnum75!dP)ij$8+lDK4mx&!4Na)9Mq`Se4)o<RA8 zCCVp(NMV6bF*P(K%Dwwxl>5lQRxoh9Zt4s9Pg#=OPegdHQe6u~IW+YquTMjg?hA_P z<n9GqoKg3L&H5$k2EGrYK0|I0|B6#icLf8HQ#+G=))MP;MD%kY!kt3oG&DVR&NiQ? zSZnzmz6EFJ2K9{7m{?yRH-82<H-eE$Vx5Emv#hCRuO-$Oi3qAuXJTAKljxTq)(lOe zUnWEMfT5jWsFq0-H!_iBrp|l75^x{z$<w(#IO6@lxieMgeTCSo7tLSgIIC#>8pUMg zzsJ;hU+1tFHJ{4r{f6n?XU2Y$y}Z%cCp96;G*(I0_GtAj4tpLb8IDIn3H65KLrg3e zdg%tLqHmJ{E|o9>D`k5!XGh?7EK7cuh^`4F>1jlg??IC2X4m0s2=#1;R}YguiXurR z(F&=Ayy=x(nyVQg-zW4MEZVmCAMV9#j8Xl0TYNYcZ!bn*z<C(_gYh+U9>L$E2Eii+ zLHmf8E943jBX00zU-c+=pELp5-fm6WKQf?)k0f0_<_l0Hd~P&kL^dfAMs{SA-#Etx zpYK(V5nZIOuP+Y~Vndn{e7g1!oale+Lk=Y$_w3XkvmJB1RKovga2Gya7IZ-PL%_al z)n3D(Zsi)qPH3&U;0)roHD4SV(Vu9NZ-Wxzry?IA77~JAa;gCFxCOD85ZkNJc*25M zMu-QhK*;`Vkz)fPcq>wYt0yfQ+X>NMg~n4B#2_KAssiz}fl!@<xU>ocw_ryohw32& UziU!Kj%O?yO9*krv^2*556UG$X#fBK diff --git a/packages/semweb/figs/modules.pdf b/packages/semweb/figs/modules.pdf deleted file mode 100644 index 2846e3c7c53b36a4ca94fdb7de05904f118d138e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6980 zcmb_>2{_c<+kYiu>=jvS$i97NhG9r#8<Cx?Sq6g<hM6H`DMj|IsR+rQowD;-3dxdE zmQuE?k+K)w?}(nB-}C=p@AbadJJ)sQobP=;_j2xY=6j#}9)3Mlv^ZQs62jj$e>(#r z4TVARw$2cFc|Z&6=16ja%77FD0F84YVF^$G?Sdg;Rk3z>d#r*2gh(P_F|H8rltR-B zL{1sHhQ;CmyQ@MfL5p@nnYXoo(l;}ukJ>ra3+)BVQna@H6=N<*m;~^bwZ)$|wOL|@ zt{;4pV+HBIuq~Q4XStSl)x%*kVy>GS_XFTw!OQjI<*<pzyH{iDU{4th!UpE1zwQJ~ zvwq02;@2H-^L@8dcM}NJ_nu8!Jj0(!lHgo<5nsabR^MqDxblJV$M?0Jl*VJHDitMm zzE}Z2Dp?F==X59&c{g+W4|5(~5s66;_x)hY>vF6m9?F~(*Kok#(>ljrkAdMcUsGd@ zqkB;~>VHvh2o+PtoN!1K4nZI0v{TjmiZV;B-+ZFjX#R0Nq_bsZ3F66Dr)SJ|Gm`n} z+x2bujb~1OvG7l-NGv=tB^~!W&bpE#9++Yt$hu8fHy^W9y?s>0Gm;XOf@d&%+Fk== zjqV>qnRIS_9`{<uc~lKCR)()``<-<t&1Ge@pVyDaYlrE#H{XpDqC+Y*RM!kz7iHUK z*@(Ye+A948YF*9k$cRtpr(oF`&cer5z_#vm(yO0aYhs$H);S{V_sT^!Oka33+*c<2 zC)E%AOP5RK?z7|1umlyuI?MuWg3fqd<SGrJN6J#Dl*D~{cEUro|M;O1I^(B9E|Jvj z?HQd#P>0rg$z%4abOVH}&=c3Q%#0d1Cy(bgnFR3qbXAJypR7vY8j~7h8w>mVl4%_| z<2iER+bcft*^cst(h(hVTIZJ|q~$?HMcGx8Cmj~$uAim{yM<IOHPh#V5tm+FF-_nW z-n^e-(<P>6=4N=jA|=bIBG<R%xHbcKv=ZU2is-keFWR;4MAYi19_W~1xAA{8{Uqa1 zXbLlj*Mj?myyMYK4oqUEtHW4n9&wtfqAyHchtKGn4$Eo@lV`EVdW!D+(hrA$;<u+7 zRvWig)GyptTF)8H7=JeHlI3tqn_m2z?Eu4E3tbYI#zLrW<cZ^|c8}EblUY5heXo>T zesL@rI_54gK<z-AbCdH!XtG8@)1>jTb9v1`v6rOF=k}ulItFrKW(AW>p_kDYmY-@^ zL{>gn^IHhNBPynN?)~S1i(Uy*8`m_&QBH(v?{Y1PiPuf<!>=C+i+TQ(b&}rU9VsSU z;q_%-<q=7m536SKto|8^p-Q<$JQ^j&cRi2wXwFBb8uyytAn|@S{5X~*DC8Y<%P#Pl z#jCP<{nXo5+WxW0ENpS|hHsX8J`O0OOQ*dkUc}dg*rh$QD-S32`8;omjX*0-W?INb z-wla`2}J3@lRnjM_0Rg%*C<px5`UNG#bemWZbHZL{ZUHUfu5PLu`ji*`YYWm`O;Ke z)ZVUIL)E<T#M2g>v^8xD1L?=MPFk>07+-v(fHZKCI4WGIyOj|dukL!cSYxJlwp`Xr zk-yxDSc(=n(rlD0HzcIXpx<5R*jm?XJ|R<;!ctkA0n{seit20edh}i*4wif~Z?5a( zr@X(2EiN^wvp`j-_ftJ)i&>a-CYs)#;~5`aL!m-N@+^f#-oT?{N;#YBlP$B~Y^SXQ zQ$L8YS&C}Bry<()BT9otPyal-9>(j>{TBK3R6MW7%{1EO$(5B7MHoVh!Yu#Yf#dKQ zuR_O`gRXOWMF$Xi@(4Ax<hxpUh16n(7O|5|yeA+AY3)I4%b6tG=*Ll1Q`arONlVTS zCu4Rzsq*V|r?zGFM-8XfVFd{xv3_*-w$dn!U$lz94&IQsG-j*+Jhyed=f(x)GTpC@ zH78EAu+Ey-tl#v$?VNbat?Wy%e}2EijR)F-!wMF4BQ%{SDc&ugUE**rn&oETA3{gI z<j-j`*xKTsN}7>5{-$fQF`#r)z7EA%G$n(}K9a}&-u6=W387{j^~c%+oK7hQqcK-` zym}`sb~;xuM9;w;A5Z;(reV`S30vOS>?zCxi0pf-)9hVRoR$lpdzx)-R=0emyq>qA zbcmvcI)96M-0F~MHmdOY!bGuOTl@7l7cQ{QJy1InFOlZg$lhod7b$-?<V}->wy)ds zFtJm-InMgb)>JxYRJz$X0`13Rm7ZK&SqmV(?2HAjQ6l?$HFED3jIC2}2)Nt(9XiWt zJjD{fvwbAvgyTJ|oBdvV07vAQLXITl9*#t!AbT|A-|@!C#~lmkVH~l5Hr5`8QO0{i zEnwiZl&maN5-Dj30SxdYF#14YAc}x>BS9s}p$Q~oiFi+f9hL|NEj<F>&Jato0Kl*Y z1&pxXB#=+do1|{I%L<48VnO3Ub~s}90gPjS3iu34BtpsY&j13F_Ut38_!SR9X`q47 zT?>g&-~!H`2(^Ha?Kgl}LO}_hWRZWcl2z@6(qEh^7!t+>@3=4Gm-T<ElKLn9Z>s?v zj4Ku}kOGVh01bQ4OdQDv(ACq1!U02VC`<x|_*=;C0{65UNI}Rl4gQ!VuXukJ4uinS z{{3TK_V4N4-5|S36-%@u;M_@g0ziJ;wMEUq6m4!SdLHZIg(czaFuOC#;Eq{{!)2tP z;s_KH3WveqP+4%_$ae-uB2*Fq0hEY#<b4CFpvy7t=dn0PClXXf3Jw9tYRGeBUI?H8 zdJ1Q!<mTuCZZ`xlBw<~RL5WfjKpRIS;@lifaQ5Kc1R;Zh0H%9lkdm^XR3{7p+<zf} z=#H_&0!}{ePFOd<9ZSIB?E#_-hUf$+0V;qhpa!4;b>KXp0cZkRfIeUV7y?GXMZg5` zbhF12h<11a7Qg_ufE{2DU;zif5pV)<z-7P%a0T1|Jm3xx03tvFJOMA@3g9CQ*>wVV zPr^z<QU7!+`Ek$dhMu-0@;N8F7p}5*t@`s;wSVn`?;Z~Yh2K}K2gW!f!*{F=@QD$N za8xF9-u+7lS?mjJ`{j6U96YSb#3C5U1ijzE7s>M2<_SU7;;}emp^}m6>@`m_i)Yp5 zD-S=JX3#?!C|90T3{>KMn|&Ag-mGq{iJOW}r4m=y{jV;bPQSFNcj&s!IitRx?6jXZ z)kXWOHRDArM+cUtZc(p4^k2s)b4B0Y)?Zeyb7Etu{EoA>nnhov|1vDs`_%hd)IyuZ z=32h+F(aC2>VPF}jr&tmi>H_#zCOWbWHu<U@F47%AfXddrKnqVK1)9_YZ4u&R%B54 z`f`G~AyZO;5h2@!KPk^Zv^vx*EDugY=r&1>Y3@ig&r*8$`6%&D-o=?qDI%76NRh27 ztq0c)*8<#U<Xl5uWcJ~rl-`q0=X{Fv#nyyV3x9u|=-Z}rAjgD5O5{;&fox)ICqk$~ z088cA=ON-+BPZB`Nu76`tq{<`_r?<GWqI<CdZOduAJY4hQMPb60bP7M+a<UI^DdXS zEkz>!{mb60DOASB+{;WoTvUq2Jv?E+EPDcBgswN&KR18$qVJ6tGs@BWSzVjMz6Tuj z9E9oEowHu$y^Bq393S5nbPl#EmT-SDn^L)5R*YazoPC*oIMKl@I`)DwQz=S9<6hz; zV>YYdpPX4cj56UFKgY9AIKB2{XZFR~J0$R2UZu11ihG}_8Qp#FSbQxnzqD>)uUK*$ zB~=!sp%HXaO+4K}Kh}tsMQuZ`JdgbiwWdx~W?Y_=GaWMgzREK_J7H^);P5PEVMS*N zWHg6%*Q2rAE5d=!3M{(8hBQWpk=KvvEf^_^M9%6`G95CINJyYwOg~ADrg;-o?vGv; zUU<#RC6Xd~Nxa}n7(sTPa6wAVh|gC`u#a=*h8C<mVX(=sQwq^oI^rT{(J|t1=A-ux zeZ=F&%ORKVT#lV{c&GU;UT>~DO~shgjy0WuN2?OYr*xJ>p+EdfMXfm7J<P*kMmVjv z_%z>IiOw7CaaZXm>e^RTb?T=#@3~PupjLQt{;LSb`*iJz?!cQ*jE5~$9bneNO{eD% zuDdFnlL`qDy4oL3^H}nGL|N?Ak=)z@8(Pli^I{{_7@2%Da@cEepz^WpTJ*S{J@M4M zd*@5R4;|8ss$GT_7-Gb&^-tOvy;g&eHg=DeMqtFxd&}E5<@ioc@YLPafr!&tV==-) z7t2v8{;f<hT3vqU$`3rD-C*hEA9Q!<YO1?muvvBAy>)D~X&^XZJ3)}kyXo4GwNHg# z%9cp4*0aLTw^H>~AK7XeubZ6dI@Z}-*%=BHlbWi%c;+W>pZ}T*w?Z9NSNL{Fk!@vy z|E7|blgw(8>wS@#Iur|I^Ol1y4TGjL6`by8ci*Uy?WnqiP5$7+DVK;CfM+oE+FI}6 zRNR_6b52Nf(;;~p^(S@*=^FiOYDPH+BWvj-CRpMGKWaBqxPKgse@-R%lX~G(z+_tv z;)+Ff$BV`ix%Bd=&#|hs51UxI!hiPKd%h^R8!CpsY02#M_&YAV4)x>dHhU2JbkbBU zPw-041%r3_#yDj8*hRz8FU(DUDT}@IJxoW}==bp4m2<|fxq5+jnvb@XzNKSkn7Ueu zdcD9C;BoRYe__dOg;)c;i>er%58a`=hhxXn8SiwoTE+_D)X?%*)0i9YYN}vTCUO=( zp602$_tmO>V30BW)N<|eCw;s#PYttjGUZP%Q*k9m1^FklqWvuzj$5H7rzvQ(FsS(% zcQ#5l@u+hqNAGG$vSQU9RXcT@{18@0F~^XQitXg!x3Ip{@HX6Z4!Kbk<zzR5R`-ob zY@9vMs92%0?#;xN!NZ^m4VG_zCINl6gzyVpm}ci4EmmfuP*99~PJ?p0e`+<hT1A`( zy5!Q%-PFa(<A<&~;he>o+=#02loa{E?`r$4vS83CbRaL{b+f%)#)Qn52=jHdFOiSj z3Q7hcYC85d0u>tTqsBkng~n70RuKl)4v){Kc-^|ys@&k?4?H{DYI1*jV$F)`!|=tx z0*8-9^=X%eTA#wlV#+c+li$*5D0Lc(r8I{hOM~l}x;0-jX)VCBe&bOM;CNIe*C=qG zujf1W%dx!i{EP;jME^uDk4Z`rw}0)<gr{*&diz*b^$^!eU(m++Fr#5@>j{&DpLYJ@ zKP2kADrK2Bd1z}&*Ls)iazu(wPq%$5rR%<(BrhvNfA!Nr;n&YYUV0q;kueF^_+Dfp zHX%yQY;s5QP;znr>P^_SB|e|kAZUulcAYy@ciYCf0G{uwYiAg&?=;Y{U?}Gk#B>@s z8>R3*8XVtRn-nsmR8>ea8#E!G+~z|juZMh1INZzv-O3$(Qm356awWEoV0=~ocJ__! z$Mc=T5APZUh%HJ8Z)pe6tnt%$q;bjkjxEtm7sr}?16VFj@@7p1QFgW@33XnX(ljyg zGc9e1=DvV$^5=AHfi=%G71CSYsVJ^rdm->8Zn1X(?U|a>P~=+Yp?W4qYcpR(mbNBX zN@!Hupy%v;*1lA(uDqHW??khj9QWFT*s^-<S^f9H%&(K~I!MGcAAGK)E16Q!%<4FM z$%>lipxb#H?hgh@+tCG5tl}F|g_p)@GDPIA_SE=uS|<cqY{z!oDrjR!RT3AYOL>2@ zK5M=7v|B3ix_C@WirNv){BNtD?*Qt!`Kk&!>%3zp*V`feI+BkIl`TYo*iVZBK|Hsg z-}p&UI<-7K8-F2-w#Rw+)iKtI#vswd*S{(mq?>I<TG2ENWYOy?+v(jD#=Tn44K}@5 zawI|<MtAGnY|q-<!pAt{C{{~>$Rgy2QFR%JTWrvvW;=?(PrxSa{D$}$^`5gCI9PJ0 z!U#~`QLy3UIrAg5%e=N;hiaW?oPjE?vnYu|f9`PKbh3>UbE-|T%fn~jo4C`v*tkuK zS8A?|+Uv^KAO@a~O@R`^l=wzg`FrO$XU{M*o+KhRs+FkVw1J3|J*pb1LZ_4J{40DS z-tlF02w_cDJ+_igag8j~H+dV9e9W~saXyz>srAp)U=@5aw;vBtk?7BAG%Q#|Ilg5) zS?l;LfD~IlthWQ$aDJw8iCg7GQ+tOSxv1+2E)I?I1azeF%D1|5OKUT^RW#B>Wsb+P z57D?*JgWULdLm|6yd;Z%KJ`{rL=ShXiOyd+>=LpfQfQC)`w5N$1OE4VLnf@V#zebv z8)_QD=p9q+E8)fm3r-vDRJw*9)+|`f4l5~gJb&bii_TLa<vJanm;4p9d{o>MSEP?0 z<l;UYv7xCCjq?9u2y4^jxe!`z5}sm`5_I_CX!OQ7blzaI?FduwoND7MZ&`UkA{5>F zYTz0@?^I-|26qp|(W01QLBy(Sr1gZ@Pqe1_#)u2<?RK*q>H1_PWvu`FkE<}PTe#kw zV`$9{*KS#tQXl3G$C5bJZ@oN?50uIkFIhPW_2xk&nK=_Z%Cx-@HUc*+#WAo0t!s-d z=Y#_@Dpk1-E;&*u#YjT&SFbVpXh){24^p7YsIz&lwf1XVS!!w=zM-ZgAWPxGqI>`@ z-Jt$@Q;><L8*Qc|u$Z(GHx|X&>)Y!5v3Nl6hN#x9pHg?UB04+T?{KVKMsiM-7B0UH zJXu%@T^;eT%on?*G+6!ER<mR-KZst`Sdi^aL`({OmBQTG+*E$I^_>93m9!=Kp|BU7 z`IT|ilmwc-#N!-VA}eKUC!o^CW>*)KKWw*6mZ_%&mSO{C=iF+44E;bauCFnj3Rr0^ zMT~JOUaIQzUMWGChhOF5jP4OtN7!<u{e)#pP8L`v@XB~xH}cmnRgX6HIDg!{j-bJH zHOc2o>8nGI!@*Mz>SspiKbtnoe&OyL&eUz^qq~(iZe@#W_4Bt4p>t+q3lrt%uD>C- zy`r?GZjZNeeN3e!?{m=i^}6d1yPqd_Or^q~FUC#6%9gV+tUj#Unl0YjvRY3S1+Tq{ zQ#vx|M$2@Z_8|iYUlr<5_yev5)^s->zAG2%>T9{7qwTK`ZJ#_TRN8oc(i&AXanCjH zW-n!{f8A5Z!s$cwmt8NbEo6%{^wBMSt`Zp<8(Phtw3DfP>gwh%Jlpt8u2P+xZvHb_ z-o5{mlLko`nAhxOqr3Uq|0|OKlrcmsIXwgZm74ud<o41?IBYjj`8%zHlCwT?g_l4i zk<%wIQv<Xxdt(F=4(#SyL<<O*ZILrBFd0Wekx1#?hC<0grKM${2m~A|DJl7@fixsa z>K7KI?eRhOdH%b8Uk_Qv?}n5HvsE~9R~cEM3<9y+$YW_R>y-fwBh$#tNEmDvM^=Oa z4cNtksp2l*9_}|E$U`2>N=f~eO_sNB1i6=z1{VYxfB><-jR$q?k9T$MIfRVa#ewtW zo~(Zl_uBzvN0Dv(%?FOjHj-)kO;Qqcpfn70=r1RL*xwsK=KEi?{}cXQ+xONA2mQA1 zgZ&;Z`|BW(pZ5>M-kNsx@8ih*{u+>yGT@>5<*(m7;5=ADfc^R+Bf(wSm9UTa|Mg_- z{@kBqkOm&1J-6?x{vY<c2K*KxDf4R&{}e)A7x^sif+VGpzZba&+Lb{5)%?lyk1==< z$OmxuK*Hgce^iwIsNR5eE_+WqEI~-kP!Fo^geQ`IRcW9y5-_B&g2LVl!<&G0fPg-f zf`AL(`#`0UNJ%8r0lG(nqfnq=@(1d+Pm@N<{EG%hA;6l%KXGtbNw9?UA2ey{f8oGd z5LhYuPn^`ha0n?FShD&j4gr$}OKJb4A(2wxTkD@RxGY#G{0|xehWHl^i9~<}nSEXo z0Rxt72;d)HP{0u9iv@iJ1q+RMu$D)DEkXeeHwQeF?D^fYAd!S2kaoQ)Esa1x`1#dz H(UAWFun#wI diff --git a/packages/semweb/hash.c b/packages/semweb/hash.c deleted file mode 100644 index c31ec989e..000000000 --- a/packages/semweb/hash.c +++ /dev/null @@ -1,108 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog - - Author: Jan Wielemaker - E-mail: wielemak@science.uva.nl - WWW: http://www.swi-prolog.org - Copyright (C): 1985-2007, University of Amsterdam - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - As a special exception, if you link this library with other files, - compiled with a Free Software compiler, to produce an executable, this - library does not by itself cause the resulting executable to be covered - by the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#include "hash.h" -#include <SWI-Prolog.h> -#include <string.h> - -#define HASHKEY(hash, ptr) ((((intptr_t)ptr)>>(hash->shift)) % (hash)->entries) - -ptr_hash * -new_ptr_hash(int entries, int shift) -{ ptr_hash *hash = PL_malloc(sizeof(*hash)); - size_t size = sizeof(*hash->chains)*entries; - - memset(hash, 0, sizeof(*hash)); - hash->entries = entries; - hash->shift = shift; - hash->chains = PL_malloc(size); - memset(hash->chains, 0, size); - - return hash; -} - - -static int -destroy_node(ptr_hash_node *node, void *closure) -{ PL_free(node); - - return TRUE; -} - - -void -destroy_ptr_hash(ptr_hash *hash) -{ for_ptr_hash(hash, destroy_node, NULL); - - PL_free(hash->chains); - PL_free(hash); -} - - -int -add_ptr_hash(ptr_hash *hash, void *value) -{ int key = HASHKEY(hash, value); - ptr_hash_node *node; - - for(node = hash->chains[key]; node; node = node->next) - { if ( node->value == value ) - return FALSE; /* already in hash */ - } - - node = PL_malloc(sizeof(*node)); - node->value = value; - node->next = hash->chains[key]; - hash->chains[key] = node; - - return TRUE; -} - - -int -for_ptr_hash(ptr_hash *hash, - int (*func)(ptr_hash_node *node, void *closure), - void *closure) -{ int key; - - for(key=0; key < hash->entries; key++) - { ptr_hash_node *node; - ptr_hash_node *next; - - for(node=hash->chains[key]; node; node = next) - { next = node->next; - - if ( !func(node, closure) ) - return FALSE; - } - } - - return TRUE; -} diff --git a/packages/semweb/hash.h b/packages/semweb/hash.h deleted file mode 100644 index a2aa850a6..000000000 --- a/packages/semweb/hash.h +++ /dev/null @@ -1,73 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog - - Author: Jan Wielemaker - E-mail: wielemak@science.uva.nl - WWW: http://www.swi-prolog.org - Copyright (C): 1985-2007, University of Amsterdam - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - As a special exception, if you link this library with other files, - compiled with a Free Software compiler, to produce an executable, this - library does not by itself cause the resulting executable to be covered - by the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#ifndef HASH_H_INCLUDED -#define HASH_H_INCLUDED - -typedef struct ptr_hash_node -{ struct ptr_hash_node *next; /* next in chain */ - void *value; /* hashed value */ -} ptr_hash_node; - - -typedef struct ptr_hash -{ int entries; /* # chains */ - int shift; /* shift for pointers */ - ptr_hash_node **chains; /* hash chains */ -} ptr_hash; - -ptr_hash *new_ptr_hash(int entries, int shift); -void destroy_ptr_hash(ptr_hash *hash); -int add_ptr_hash(ptr_hash *hash, void *value); -int for_ptr_hash(ptr_hash *hash, - int (*func)(ptr_hash_node *node, void *closure), - void *closure); - - /******************************* - * ATOMS * - *******************************/ - -typedef ptr_hash atom_hash; -#define new_atom_hash(entries) new_ptr_hash(entries, ATOM_HASH_SHIFT) -#define destroy_atom_hash(hash) destroy_ptr_hash(hash) -#define add_atom_hash(hash, atom) add_ptr_hash(hash, (void*)(atom)) -#define for_atom_hash for_ptr_hash - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -SWI-Prolog note: Atoms are integers shifted by LMASK_BITS (7) -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -#define POINTER_HASH_SHIFT 3 -#define ATOM_HASH_SHIFT 7 -#define atom_hash(a) (((unsigned long)a)>>ATOM_HASH_SHIFT) - -#endif /*HASH_H_INCLUDED*/ diff --git a/packages/semweb/litmap_test.pl b/packages/semweb/litmap_test.pl deleted file mode 100644 index 76e936590..000000000 --- a/packages/semweb/litmap_test.pl +++ /dev/null @@ -1,176 +0,0 @@ -:- module(test, - [ test/0, - test/1, - test/2 - ]). -:- use_module(library(debug)). -:- use_module(library(debug)). -:- asserta(user:file_search_path(foreign, '../sgml')). -:- asserta(user:file_search_path(library, '../sgml')). -:- asserta(user:file_search_path(foreign, '../clib')). -:- asserta(user:file_search_path(library, '../clib')). -:- asserta(user:file_search_path(library, '../RDF')). -:- asserta(user:file_search_path(foreign, '.')). -:- use_module(rdf_db). - -:- dynamic - map/1, % the literal map - map/2, % Prolog shadow admin - in/1, % Read generated random - out/1. % Write generated random - -test :- - test(10000), - format('~NLiteral map tests passed~n'). - -test(N, log(File)) :- - open(File, write, Out), - assert(out(Out)), - call_cleanup(test(N), - ( close(Out), - retractall(out(_)))). -test(N, from(File)) :- - open(File, read, In), - assert(in(In)), - call_cleanup(test(N), - ( close(In), - retractall(in(_)))). - -test(N) :- - mk(N), - ( v(continue), - vk(all), - vk(prefix('1')), - vk(ge(500)), - vk(le(500)), - vk(between(100, 500)) - -> clear - ). - -clear :- - ( retract(map(Map)) - -> rdf_destroy_literal_map(Map) - ; true - ), - retractall(map(_,_)). - -mk(N) :- - clear, - rdf_new_literal_map(Map), - assert(map(Map)), - forall(between(1, N, _), m1(Map)). - -m1(Map) :- - rnd_value(1000, Key), - rnd_value(100, Value), - ( random(3, 0) - -> ( retract(map(Key, Value)) - -> debug(delete, 'Deleted ~q --> ~q', [Key, Value]), - rdf_delete_literal_map(Map, Key, Value) - ; true - ) - ; ( map(Key, Value) - -> true - ; assert(map(Key, Value)) - ), - rdf_insert_literal_map(Map, Key, Value) - ). - -rnd_value(Max, Value) :- - random(Max, ValueI), - ( random(2, 0) - -> atom_number(Value, ValueI) - ; Value = ValueI - ). - -v(Stop) :- - setof(X, Y^map(X, Y), Xs), - forall(member(X, Xs), - v(X, Stop)). - -v(Key, Stop) :- - map(Map), - findall(V, map(Key, V), Vs), - sort(Vs, VsS), - rdf_find_literal_map(Map, [Key], Vs2), - sort(Vs2, Vs2S), - ( Vs2S == VsS - -> true - ; format('~q: ~q (must be ~q)~n', [Key, Vs2S, VsS]), - Stop == continue - ). - -vk(all) :- - map(Map), - rdf_keys_in_literal_map(Map, all, Keys), - setof(X, Y^map(X, Y), Xs), - ( Xs == Keys - -> true - ). -vk(prefix(Prefix)) :- - map(Map), - rdf_keys_in_literal_map(Map, prefix(Prefix), Keys), - prefix_keys(Prefix, KeysOK), - ( KeysOK == Keys - -> true - ; format('prefix(~w): ~p (must be ~p)~n', [Prefix, Keys, KeysOK]) - ). -vk(ge(Min)) :- - map(Map), - rdf_keys_in_literal_map(Map, ge(Min), Keys), - between_keys(Min, 0x5fffffff, KeysOK), - ( KeysOK == Keys - -> true - ; format('ge(~w): ~p (must be ~p)~n', [Min, Keys, KeysOK]) - ). -vk(le(Max)) :- - map(Map), - rdf_keys_in_literal_map(Map, le(Max), Keys), - between_keys(-0x60000000, Max, KeysOK), - ( KeysOK == Keys - -> true - ; format('le(~w): ~p (must be ~p)~n', [Max, Keys, KeysOK]) - ). -vk(between(Min, Max)) :- - map(Map), - rdf_keys_in_literal_map(Map, between(Min, Max), Keys), - between_keys(Min, Max, KeysOK), - ( KeysOK == Keys - -> true - ; format('between(~w, ~w): ~p (must be ~p)~n', - [Min, Max, Keys, KeysOK]) - ). - -prefix_keys(Prefix, Keys) :- - findall(K, prefix_key(Prefix, K), Keys0), - sort(Keys0, Keys). - -prefix_key(Prefix, Key) :- - map(Key,_), - atom(Key), - sub_atom(Key, 0, _, _, Prefix). - -between_keys(Min, Max, Keys) :- - findall(K, between_key(Min, Max, K), Keys0), - sort(Keys0, Keys). - -between_key(Min, Max, Key) :- - map(Key,_), - integer(Key), - between(Min, Max, Key). - - -random(Max, Value) :- - in(Stream), !, - read(Stream, Term), - assertion(Term \== end_of_file), - Term = xx(Max0, Value), - assertion(Max == Max0). -random(Max, Value) :- - out(Stream), !, - Value0 is random(Max), - format(Stream, 'xx(~q, ~q).~n', [Max, Value0]), - Value = Value0. -random(Max, Value) :- - Value is random(Max). - diff --git a/packages/semweb/lock.c b/packages/semweb/lock.c deleted file mode 100644 index 87b3d8cb0..000000000 --- a/packages/semweb/lock.c +++ /dev/null @@ -1,744 +0,0 @@ -/* $Id$ - - Part of the SWI-Prolog Semweb package - - Author: Jan Wielemaker - E-mail: wielemak@science.uva.nl - WWW: http://www.swi-prolog.org - Copyright (C): 2006, University of Amsterdam - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include <SWI-Stream.h> -#include <SWI-Prolog.h> -#include "lock.h" -#include "debug.h" -#include <assert.h> -#include <string.h> - -static int -permission_error(const char *op, const char *type, const char *obj, - const char *msg) -{ term_t ex, ctx; - - if ( !(ex = PL_new_term_ref()) || - !(ctx = PL_new_term_ref()) ) - return FALSE; - - if ( msg ) - { if ( !PL_unify_term(ctx, PL_FUNCTOR_CHARS, "context", 2, - PL_VARIABLE, - PL_CHARS, msg) ) - return FALSE; - } - - if ( !PL_unify_term(ex, PL_FUNCTOR_CHARS, "error", 2, - PL_FUNCTOR_CHARS, "permission_error", 3, - PL_CHARS, op, - PL_CHARS, type, - PL_CHARS, obj, - PL_TERM, ctx) ) - return FALSE; - - return PL_raise_exception(ex); -} - - -#ifdef _REENTRANT - - - /******************************* - * COMMON STUFF * - *******************************/ - -static void -register_reader(rwlock *lock, int tid) -{ while ( tid >= lock->thread_max ) - { size_t osize = lock->thread_max*sizeof(lock->read_by_thread[0]); - - lock->read_by_thread = realloc(lock->read_by_thread, osize*2); - memset((char*)lock->read_by_thread+osize, 0, osize); - lock->thread_max *= 2; - } - - lock->read_by_thread[tid]++; -} - - - - /******************************* - * WINDOWS VERSION * - *******************************/ - -#ifdef __WINDOWS__ - -#include <windows.h> - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -This is a slightly simplified version of the condition variable -emulation used in SWI-Prolog. We have deleted the broadcast facilities -of the CVs as this is not used in this code. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -static int -win32_cond_init(win32_cond_t *cv) -{ cv->events[SIGNAL] = CreateEvent(NULL, FALSE, FALSE, NULL); - cv->waiters = 0; - - return 0; -} - - -static int -win32_cond_destroy(win32_cond_t *cv) -{ CloseHandle(cv->events[SIGNAL]); - - return 0; -} - -#define WAIT_INTR (-1) - -static int -win32_cond_wait(win32_cond_t *cv, - CRITICAL_SECTION *external_mutex) -{ int rc; - - cv->waiters++; - - LeaveCriticalSection(external_mutex); - rc = MsgWaitForMultipleObjects(1, - cv->events, - FALSE, /* wait for either event */ - INFINITE, - QS_ALLINPUT); - if ( rc == WAIT_OBJECT_0+1 ) - { MSG msg; - - while( PeekMessage(&msg, NULL, 0, 0, PM_REMOVE) ) - { TranslateMessage(&msg); - DispatchMessage(&msg); - } - - if ( PL_handle_signals() < 0 ) - { EnterCriticalSection(external_mutex); - return WAIT_INTR; - } - } - - EnterCriticalSection(external_mutex); - - cv->waiters--; - - return 0; -} - - -static int -win32_cond_signal(win32_cond_t *cv) /* must be holding associated mutex */ -{ if ( cv->waiters > 0 ) - SetEvent(cv->events[SIGNAL]); - - return 0; -} - - -int -rdlock(rwlock *lock) -{ int self = PL_thread_self(); - - if ( lock->writer == self ) - { lock->lock_level++; /* read nested in write */ - - return TRUE; - } - - EnterCriticalSection(&lock->mutex); - - if ( lock->allow_readers == TRUE ) - { ok: - - lock->readers++; - register_reader(lock, self); - LeaveCriticalSection(&lock->mutex); - - return TRUE; - } - - lock->waiting_readers++; - - for(;;) - { int rc = win32_cond_wait(&lock->rdcondvar, &lock->mutex); - - if ( rc == WAIT_INTR ) - { lock->waiting_readers--; - LeaveCriticalSection(&lock->mutex); - return FALSE; - } else if ( rc == 0 ) - { if ( lock->allow_readers == TRUE ) - { lock->waiting_readers--; - goto ok; - } - } else - { assert(0); /* TBD: OS errors */ - } - } -} - - -int -wrlock(rwlock *lock, int allow_readers) -{ int self = PL_thread_self(); - - if ( lock->writer == self ) /* recursive write lock, used for */ - { lock->lock_level++; /* nested transactions */ - - return TRUE; - } - - EnterCriticalSection(&lock->mutex); - - if ( lock->writer == -1 && lock->readers == 0 ) - { ok: - - lock->writer = self; - lock->lock_level = 1; - lock->allow_readers = allow_readers; - LeaveCriticalSection(&lock->mutex); - DEBUG(3, Sdprintf("WRLOCK(%d): OK\n", self)); - - return TRUE; - } - - if ( self < lock->thread_max && lock->read_by_thread[self] > 0 ) - { LeaveCriticalSection(&lock->mutex); - return permission_error("write", "rdf_db", "default", - "Operation would deadlock"); - } - - lock->waiting_writers++; - DEBUG(3, Sdprintf("WRLOCK(%d): waiting ...\n", self)); - - for(;;) - { int rc = win32_cond_wait(&lock->wrcondvar, &lock->mutex); - - if ( rc == WAIT_INTR ) - { lock->waiting_writers--; - LeaveCriticalSection(&lock->mutex); - return FALSE; - } else if ( rc == 0 ) - { if ( lock->writer == -1 && lock->readers == 0 ) - { lock->waiting_writers--; - goto ok; - } - } else - { assert(0); /* TBD: OS errors */ - } - } -} - - -int -lockout_readers(rwlock *lock) -{ EnterCriticalSection(&lock->mutex); - - if ( lock->readers == 0 ) - { ok: - - lock->allow_readers = FALSE; - LeaveCriticalSection(&lock->mutex); - - return TRUE; - } - - lock->waiting_upgrade++; - - for(;;) - { int rc = win32_cond_wait(&lock->upcondvar, &lock->mutex); - - if ( rc == WAIT_INTR ) - { lock->waiting_upgrade--; - LeaveCriticalSection(&lock->mutex); - return FALSE; - } else if ( rc == 0 ) - { if ( lock->readers == 0 ) - { lock->waiting_upgrade--; - goto ok; - } - } else - { assert(0); /* TBD: OS errors */ - } - } -} - - -void -reallow_readers(rwlock *lock) -{ EnterCriticalSection(&lock->mutex); - lock->allow_readers = TRUE; - LeaveCriticalSection(&lock->mutex); -} - - -int -unlock(rwlock *lock, int rd) -{ int self = PL_thread_self(); - int signal; - - if ( lock->writer == self && lock->lock_level > 1 ) - { lock->lock_level--; - return TRUE; - } - - EnterCriticalSection(&lock->mutex); - if ( rd ) /* must be a read lock */ - { lock->readers--; - lock->read_by_thread[self]--; - signal = (lock->readers == 0); - } else - { lock->writer = -1; - lock->allow_readers = TRUE; - signal = TRUE; - } - - if ( signal ) - { enum { NONE, READ, WRITE, UPGRADE } waiting; - - waiting = (lock->waiting_upgrade ? UPGRADE : - lock->waiting_writers ? WRITE : - lock->waiting_readers ? READ : NONE); - - switch(waiting) - { case UPGRADE: - win32_cond_signal(&lock->upcondvar); - break; - case WRITE: - win32_cond_signal(&lock->wrcondvar); - break; - case READ: - win32_cond_signal(&lock->rdcondvar); - break; - default: - ; - } - } - - LeaveCriticalSection(&lock->mutex); /* In our __WINDOWS__ emulation we */ - /* must hold the associated mutex */ - return TRUE; -} - - -int -lock_misc(rwlock *lock) -{ EnterCriticalSection(&lock->misc_mutex); - - return TRUE; -} - - -int -unlock_misc(rwlock *lock) -{ LeaveCriticalSection(&lock->misc_mutex); - - return TRUE; -} - - -int -init_lock(rwlock *lock) -{ InitializeCriticalSection(&lock->mutex); - InitializeCriticalSection(&lock->misc_mutex); - - if ( !win32_cond_init(&lock->wrcondvar) == 0 || - !win32_cond_init(&lock->rdcondvar) == 0 || - !win32_cond_init(&lock->upcondvar) == 0 ) - { /* TBD: System error */ - return FALSE; - } - - lock->writer = -1; - lock->allow_readers = TRUE; - lock->readers = 0; - lock->waiting_readers = 0; - lock->waiting_writers = 0; - lock->waiting_upgrade = 0; - lock->lock_level = 0; - - lock->thread_max = 4; - if ( !(lock->read_by_thread = malloc(lock->thread_max*sizeof(int))) ) - return FALSE; - memset(lock->read_by_thread, 0, lock->thread_max*sizeof(int)); - - return TRUE; -} - - -int -destroy_lock(rwlock *lock) -{ DeleteCriticalSection(&lock->mutex); - DeleteCriticalSection(&lock->misc_mutex); - win32_cond_destroy(&lock->wrcondvar); - win32_cond_destroy(&lock->rdcondvar); - win32_cond_destroy(&lock->upcondvar); - - free(lock->read_by_thread); - - return TRUE; -} - -#else /*__WINDOWS__*/ - - /******************************* - * POSIX VERSION * - *******************************/ - -#include <errno.h> - -int -rdlock(rwlock *lock) -{ int self = PL_thread_self(); - - if ( lock->writer == self ) - { lock->lock_level++; /* read nested in write */ - - return TRUE; - } - - pthread_mutex_lock(&lock->mutex); - - if ( lock->allow_readers == TRUE ) - { ok: - - lock->readers++; - register_reader(lock, self); - pthread_mutex_unlock(&lock->mutex); - - return TRUE; - } - - lock->waiting_readers++; - - for(;;) - { int rc = pthread_cond_wait(&lock->rdcondvar, &lock->mutex); - - if ( rc == EINTR ) - { if ( PL_handle_signals() < 0 ) - { lock->waiting_readers--; - pthread_mutex_unlock(&lock->mutex); - return FALSE; - } - continue; - } else if ( rc == 0 ) - { if ( lock->allow_readers == TRUE ) - { lock->waiting_readers--; - goto ok; - } - } else - { assert(0); /* TBD: OS errors */ - } - } -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -WRLOCK() and LOCKOUT_READERS() can be used in two ways. Conventional -write locks are established using WRLOCK(db, FALSE) ... WRUNLOCK(db). -For transactions, we allow concurrent readers until we are ready to -commit, in which case we use WRLOCK(db, TRUE) ... LOCKOUT_READERS() ... -WRUNLOCK(db) -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -int -wrlock(rwlock *lock, int allow_readers) -{ int self = PL_thread_self(); - - if ( lock->writer == self ) /* recursive write lock, used for */ - { lock->lock_level++; /* nested transactions */ - - return TRUE; - } - - pthread_mutex_lock(&lock->mutex); - - if ( lock->writer == -1 && lock->readers == 0 ) - { ok: - - lock->writer = self; - lock->lock_level = 1; - lock->allow_readers = allow_readers; - pthread_mutex_unlock(&lock->mutex); - DEBUG(3, Sdprintf("WRLOCK(%d): OK\n", self)); - - return TRUE; - } - - if ( self < lock->thread_max && lock->read_by_thread[self] > 0 ) - { DEBUG(1, Sdprintf("SELF(%d) has %d readers\n", - self, lock->read_by_thread[self])); - pthread_mutex_unlock(&lock->mutex); - return permission_error("write", "rdf_db", "default", - "Operation would deadlock"); - } - - lock->waiting_writers++; - DEBUG(3, Sdprintf("WRLOCK(%d): waiting ...\n", self)); - - for(;;) - { int rc = pthread_cond_wait(&lock->wrcondvar, &lock->mutex); - - if ( rc == EINTR ) - { if ( PL_handle_signals() < 0 ) - { lock->waiting_writers--; - pthread_mutex_unlock(&lock->mutex); - return FALSE; - } - continue; - } else if ( rc == 0 ) - { if ( lock->writer == -1 && lock->readers == 0 ) - { lock->waiting_writers--; - goto ok; - } - } else - { assert(0); /* TBD: OS errors */ - } - } -} - - -int -lockout_readers(rwlock *lock) -{ pthread_mutex_lock(&lock->mutex); - - if ( lock->readers == 0 ) - { ok: - - lock->allow_readers = FALSE; - pthread_mutex_unlock(&lock->mutex); - - return TRUE; - } - - lock->waiting_upgrade++; - - for(;;) - { int rc = pthread_cond_wait(&lock->upcondvar, &lock->mutex); - - if ( rc == EINTR ) - { if ( PL_handle_signals() < 0 ) - { lock->waiting_upgrade--; - pthread_mutex_unlock(&lock->mutex); - return FALSE; - } - continue; - } else if ( rc == 0 ) - { if ( lock->readers == 0 ) - { lock->waiting_upgrade--; - goto ok; - } - } else - { assert(0); /* TBD: OS errors */ - } - } -} - - -void -reallow_readers(rwlock *lock) -{ pthread_mutex_lock(&lock->mutex); - lock->allow_readers = TRUE; - pthread_mutex_unlock(&lock->mutex); -} - - -int -unlock(rwlock *lock, int rd) /* TRUE: read lock */ -{ int self = PL_thread_self(); - int signal; - - if ( lock->writer == self && lock->lock_level > 1 ) - { lock->lock_level--; - return TRUE; - } - - pthread_mutex_lock(&lock->mutex); - if ( rd ) /* read lock */ - { lock->readers--; - lock->read_by_thread[self]--; - signal = (lock->readers == 0); - } else - { lock->writer = -1; - lock->allow_readers = TRUE; - signal = TRUE; - } - - if ( signal ) - { enum { NONE, READ, WRITE, UPGRADE } waiting; - - waiting = (lock->waiting_upgrade ? UPGRADE : - lock->waiting_writers ? WRITE : - lock->waiting_readers ? READ : NONE); - pthread_mutex_unlock(&lock->mutex); - - switch(waiting) - { case UPGRADE: - pthread_cond_signal(&lock->upcondvar); - break; - case WRITE: - pthread_cond_signal(&lock->wrcondvar); - break; - case READ: - pthread_cond_signal(&lock->rdcondvar); - break; - default: - ; - } - } else - { pthread_mutex_unlock(&lock->mutex); - } - - return TRUE; -} - - -int -lock_misc(rwlock *lock) -{ return pthread_mutex_lock(&lock->misc_mutex) == 0; -} - - -int -unlock_misc(rwlock *lock) -{ return pthread_mutex_unlock(&lock->misc_mutex) == 0; -} - - -int -init_lock(rwlock *lock) -{ if ( !pthread_mutex_init(&lock->mutex, NULL) == 0 || - !pthread_mutex_init(&lock->misc_mutex, NULL) == 0 || - !pthread_cond_init(&lock->wrcondvar, NULL) == 0 || - !pthread_cond_init(&lock->rdcondvar, NULL) == 0 || - !pthread_cond_init(&lock->upcondvar, NULL) == 0 ) - { /* TBD: System error */ - return FALSE; - } - - lock->writer = -1; - lock->readers = 0; - lock->allow_readers = TRUE; - lock->waiting_readers = 0; - lock->waiting_writers = 0; - lock->waiting_upgrade = 0; - lock->lock_level = 0; - - lock->thread_max = 4; - if ( !(lock->read_by_thread = malloc(lock->thread_max*sizeof(int))) ) - return FALSE; - memset(lock->read_by_thread, 0, lock->thread_max*sizeof(int)); - - return TRUE; -} - - -int -destroy_lock(rwlock *lock) -{ if ( !pthread_mutex_destroy(&lock->mutex) || - !pthread_mutex_destroy(&lock->misc_mutex) || - !pthread_cond_destroy(&lock->wrcondvar) || - !pthread_cond_destroy(&lock->rdcondvar) || - !pthread_cond_destroy(&lock->upcondvar) ) - return FALSE; - - free(lock->read_by_thread); - - return TRUE; -} - -#endif /*__WINDOWS__*/ - - -#else /*_REENTRANT*/ - -int -rdlock(rwlock *lock) -{ lock->readers++; - - return TRUE; -} - -int -wrlock(rwlock *lock, int allow_readers) -{ if ( lock->readers ) - return permission_error("write", "rdf_db", "default", - "Operation would deadlock"); - - lock->writer = 0; - - return TRUE; -} - -int -unlock(rwlock *lock, int rd) -{ if ( rd ) - { lock->readers--; - } else - { lock->writer = -1; - } - - return TRUE; -} - - -int -lock_misc(rwlock *lock) -{ return TRUE; -} - - -int -unlock_misc(rwlock *lock) -{ return TRUE; -} - - -int -init_lock(rwlock *lock) -{ lock->writer = -1; - lock->readers = 0; - - return TRUE; -} - - -int -lockout_readers(rwlock *lock) -{ return TRUE; -} - - -void -reallow_readers(rwlock *lock) -{ -} - - -int -destroy_lock(rwlock *lock) -{ return TRUE; -} - -#endif /*_REENTRANT*/ - diff --git a/packages/semweb/lock.h b/packages/semweb/lock.h deleted file mode 100755 index 571c7d9d5..000000000 --- a/packages/semweb/lock.h +++ /dev/null @@ -1,87 +0,0 @@ -/* $Id$ - - Part of the SWI-Prolog Semweb package - - Author: Jan Wielemaker - E-mail: wielemak@science.uva.nl - WWW: http://www.swi-prolog.org - Copyright (C): 2006, University of Amsterdam - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef LOCK_H_INCLUDED -#define LOCK_H_INCLUDED - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#if defined(__WINDOWS__) || defined(__MINGW32__) -#include <windows.h> -#if defined(_REENTRANT) && defined(__WINDOWS__) -enum -{ SIGNAL = 0, - MAX_EVENTS = 1 -} win32_event_t; - -typedef struct -{ HANDLE events[MAX_EVENTS]; /* events to be signalled */ - int waiters; /* # waiters */ -} win32_cond_t; -#endif -#else -#include <pthread.h> -#endif - -typedef struct rwlock -{ -#ifdef _REENTRANT -#ifdef __WINDOWS__ - CRITICAL_SECTION mutex; - CRITICAL_SECTION misc_mutex; - win32_cond_t rdcondvar; - win32_cond_t wrcondvar; - win32_cond_t upcondvar; -#else - pthread_mutex_t mutex; - pthread_mutex_t misc_mutex; - pthread_cond_t rdcondvar; - pthread_cond_t wrcondvar; - pthread_cond_t upcondvar; -#endif - int waiting_readers; - int waiting_writers; - int waiting_upgrade; - size_t thread_max; - int *read_by_thread; - int allow_readers; - int lock_level; /* recursive locks */ -#endif - int writer; - int readers; -} rwlock; - -int rdlock(rwlock *lock); -int wrlock(rwlock *lock, int allow_readers); -int lockout_readers(rwlock *lock); -void reallow_readers(rwlock *lock); -int unlock(rwlock *lock, int rd); -int lock_misc(rwlock *lock); -int unlock_misc(rwlock *lock); -int init_lock(rwlock *lock); -int destroy_lock(rwlock *lock); - -#endif /*LOCK_H_INCLUDED*/ diff --git a/packages/semweb/md5.c b/packages/semweb/md5.c deleted file mode 100644 index 2c9c2fcde..000000000 --- a/packages/semweb/md5.c +++ /dev/null @@ -1,381 +0,0 @@ -/* - Copyright (C) 1999, 2000, 2002 Aladdin Enterprises. All rights reserved. - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - - L. Peter Deutsch - ghost@aladdin.com - - */ -/* $Id$ */ -/* - Independent implementation of MD5 (RFC 1321). - - This code implements the MD5 Algorithm defined in RFC 1321, whose - text is available at - http://www.ietf.org/rfc/rfc1321.txt - The code is derived from the text of the RFC, including the test suite - (section A.5) but excluding the rest of Appendix A. It does not include - any code or documentation that is identified in the RFC as being - copyrighted. - - The original and principal author of md5.c is L. Peter Deutsch - <ghost@aladdin.com>. Other authors are noted in the change history - that follows (in reverse chronological order): - - 2002-04-13 lpd Clarified derivation from RFC 1321; now handles byte order - either statically or dynamically; added missing #include <string.h> - in library. - 2002-03-11 lpd Corrected argument list for main(), and added int return - type, in test program and T value program. - 2002-02-21 lpd Added missing #include <stdio.h> in test program. - 2000-07-03 lpd Patched to eliminate warnings about "constant is - unsigned in ANSI C, signed in traditional"; made test program - self-checking. - 1999-11-04 lpd Edited comments slightly for automatic TOC extraction. - 1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5). - 1999-05-03 lpd Original version. - */ - -#include "md5.h" -#include <string.h> - -#undef BYTE_ORDER /* 1 = big-endian, -1 = little-endian, 0 = unknown */ -#ifdef ARCH_IS_BIG_ENDIAN -# define BYTE_ORDER (ARCH_IS_BIG_ENDIAN ? 1 : -1) -#else -# define BYTE_ORDER 0 -#endif - -#define T_MASK ((md5_word_t)~0) -#define T1 /* 0xd76aa478 */ (T_MASK ^ 0x28955b87) -#define T2 /* 0xe8c7b756 */ (T_MASK ^ 0x173848a9) -#define T3 0x242070db -#define T4 /* 0xc1bdceee */ (T_MASK ^ 0x3e423111) -#define T5 /* 0xf57c0faf */ (T_MASK ^ 0x0a83f050) -#define T6 0x4787c62a -#define T7 /* 0xa8304613 */ (T_MASK ^ 0x57cfb9ec) -#define T8 /* 0xfd469501 */ (T_MASK ^ 0x02b96afe) -#define T9 0x698098d8 -#define T10 /* 0x8b44f7af */ (T_MASK ^ 0x74bb0850) -#define T11 /* 0xffff5bb1 */ (T_MASK ^ 0x0000a44e) -#define T12 /* 0x895cd7be */ (T_MASK ^ 0x76a32841) -#define T13 0x6b901122 -#define T14 /* 0xfd987193 */ (T_MASK ^ 0x02678e6c) -#define T15 /* 0xa679438e */ (T_MASK ^ 0x5986bc71) -#define T16 0x49b40821 -#define T17 /* 0xf61e2562 */ (T_MASK ^ 0x09e1da9d) -#define T18 /* 0xc040b340 */ (T_MASK ^ 0x3fbf4cbf) -#define T19 0x265e5a51 -#define T20 /* 0xe9b6c7aa */ (T_MASK ^ 0x16493855) -#define T21 /* 0xd62f105d */ (T_MASK ^ 0x29d0efa2) -#define T22 0x02441453 -#define T23 /* 0xd8a1e681 */ (T_MASK ^ 0x275e197e) -#define T24 /* 0xe7d3fbc8 */ (T_MASK ^ 0x182c0437) -#define T25 0x21e1cde6 -#define T26 /* 0xc33707d6 */ (T_MASK ^ 0x3cc8f829) -#define T27 /* 0xf4d50d87 */ (T_MASK ^ 0x0b2af278) -#define T28 0x455a14ed -#define T29 /* 0xa9e3e905 */ (T_MASK ^ 0x561c16fa) -#define T30 /* 0xfcefa3f8 */ (T_MASK ^ 0x03105c07) -#define T31 0x676f02d9 -#define T32 /* 0x8d2a4c8a */ (T_MASK ^ 0x72d5b375) -#define T33 /* 0xfffa3942 */ (T_MASK ^ 0x0005c6bd) -#define T34 /* 0x8771f681 */ (T_MASK ^ 0x788e097e) -#define T35 0x6d9d6122 -#define T36 /* 0xfde5380c */ (T_MASK ^ 0x021ac7f3) -#define T37 /* 0xa4beea44 */ (T_MASK ^ 0x5b4115bb) -#define T38 0x4bdecfa9 -#define T39 /* 0xf6bb4b60 */ (T_MASK ^ 0x0944b49f) -#define T40 /* 0xbebfbc70 */ (T_MASK ^ 0x4140438f) -#define T41 0x289b7ec6 -#define T42 /* 0xeaa127fa */ (T_MASK ^ 0x155ed805) -#define T43 /* 0xd4ef3085 */ (T_MASK ^ 0x2b10cf7a) -#define T44 0x04881d05 -#define T45 /* 0xd9d4d039 */ (T_MASK ^ 0x262b2fc6) -#define T46 /* 0xe6db99e5 */ (T_MASK ^ 0x1924661a) -#define T47 0x1fa27cf8 -#define T48 /* 0xc4ac5665 */ (T_MASK ^ 0x3b53a99a) -#define T49 /* 0xf4292244 */ (T_MASK ^ 0x0bd6ddbb) -#define T50 0x432aff97 -#define T51 /* 0xab9423a7 */ (T_MASK ^ 0x546bdc58) -#define T52 /* 0xfc93a039 */ (T_MASK ^ 0x036c5fc6) -#define T53 0x655b59c3 -#define T54 /* 0x8f0ccc92 */ (T_MASK ^ 0x70f3336d) -#define T55 /* 0xffeff47d */ (T_MASK ^ 0x00100b82) -#define T56 /* 0x85845dd1 */ (T_MASK ^ 0x7a7ba22e) -#define T57 0x6fa87e4f -#define T58 /* 0xfe2ce6e0 */ (T_MASK ^ 0x01d3191f) -#define T59 /* 0xa3014314 */ (T_MASK ^ 0x5cfebceb) -#define T60 0x4e0811a1 -#define T61 /* 0xf7537e82 */ (T_MASK ^ 0x08ac817d) -#define T62 /* 0xbd3af235 */ (T_MASK ^ 0x42c50dca) -#define T63 0x2ad7d2bb -#define T64 /* 0xeb86d391 */ (T_MASK ^ 0x14792c6e) - - -static void -md5_process(md5_state_t *pms, const md5_byte_t *data /*[64]*/) -{ - md5_word_t - a = pms->abcd[0], b = pms->abcd[1], - c = pms->abcd[2], d = pms->abcd[3]; - md5_word_t t; -#if BYTE_ORDER > 0 - /* Define storage only for big-endian CPUs. */ - md5_word_t X[16]; -#else - /* Define storage for little-endian or both types of CPUs. */ - md5_word_t xbuf[16]; - const md5_word_t *X; -#endif - - { -#if BYTE_ORDER == 0 - /* - * Determine dynamically whether this is a big-endian or - * little-endian machine, since we can use a more efficient - * algorithm on the latter. - */ - static const int w = 1; - - if (*((const md5_byte_t *)&w)) /* dynamic little-endian */ -#endif -#if BYTE_ORDER <= 0 /* little-endian */ - { - /* - * On little-endian machines, we can process properly aligned - * data without copying it. - */ - if (!((data - (const md5_byte_t *)0) & 3)) { - /* data are properly aligned */ - X = (const md5_word_t *)data; - } else { - /* not aligned */ - memcpy(xbuf, data, 64); - X = xbuf; - } - } -#endif -#if BYTE_ORDER == 0 - else /* dynamic big-endian */ -#endif -#if BYTE_ORDER >= 0 /* big-endian */ - { - /* - * On big-endian machines, we must arrange the bytes in the - * right order. - */ - const md5_byte_t *xp = data; - int i; - -# if BYTE_ORDER == 0 - X = xbuf; /* (dynamic only) */ -# else -# define xbuf X /* (static only) */ -# endif - for (i = 0; i < 16; ++i, xp += 4) - xbuf[i] = xp[0] + (xp[1] << 8) + (xp[2] << 16) + (xp[3] << 24); - } -#endif - } - -#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32 - (n)))) - - /* Round 1. */ - /* Let [abcd k s i] denote the operation - a = b + ((a + F(b,c,d) + X[k] + T[i]) <<< s). */ -#define F(x, y, z) (((x) & (y)) | (~(x) & (z))) -#define SET(a, b, c, d, k, s, Ti)\ - t = a + F(b,c,d) + X[k] + Ti;\ - a = ROTATE_LEFT(t, s) + b - /* Do the following 16 operations. */ - SET(a, b, c, d, 0, 7, T1); - SET(d, a, b, c, 1, 12, T2); - SET(c, d, a, b, 2, 17, T3); - SET(b, c, d, a, 3, 22, T4); - SET(a, b, c, d, 4, 7, T5); - SET(d, a, b, c, 5, 12, T6); - SET(c, d, a, b, 6, 17, T7); - SET(b, c, d, a, 7, 22, T8); - SET(a, b, c, d, 8, 7, T9); - SET(d, a, b, c, 9, 12, T10); - SET(c, d, a, b, 10, 17, T11); - SET(b, c, d, a, 11, 22, T12); - SET(a, b, c, d, 12, 7, T13); - SET(d, a, b, c, 13, 12, T14); - SET(c, d, a, b, 14, 17, T15); - SET(b, c, d, a, 15, 22, T16); -#undef SET - - /* Round 2. */ - /* Let [abcd k s i] denote the operation - a = b + ((a + G(b,c,d) + X[k] + T[i]) <<< s). */ -#define G(x, y, z) (((x) & (z)) | ((y) & ~(z))) -#define SET(a, b, c, d, k, s, Ti)\ - t = a + G(b,c,d) + X[k] + Ti;\ - a = ROTATE_LEFT(t, s) + b - /* Do the following 16 operations. */ - SET(a, b, c, d, 1, 5, T17); - SET(d, a, b, c, 6, 9, T18); - SET(c, d, a, b, 11, 14, T19); - SET(b, c, d, a, 0, 20, T20); - SET(a, b, c, d, 5, 5, T21); - SET(d, a, b, c, 10, 9, T22); - SET(c, d, a, b, 15, 14, T23); - SET(b, c, d, a, 4, 20, T24); - SET(a, b, c, d, 9, 5, T25); - SET(d, a, b, c, 14, 9, T26); - SET(c, d, a, b, 3, 14, T27); - SET(b, c, d, a, 8, 20, T28); - SET(a, b, c, d, 13, 5, T29); - SET(d, a, b, c, 2, 9, T30); - SET(c, d, a, b, 7, 14, T31); - SET(b, c, d, a, 12, 20, T32); -#undef SET - - /* Round 3. */ - /* Let [abcd k s t] denote the operation - a = b + ((a + H(b,c,d) + X[k] + T[i]) <<< s). */ -#define H(x, y, z) ((x) ^ (y) ^ (z)) -#define SET(a, b, c, d, k, s, Ti)\ - t = a + H(b,c,d) + X[k] + Ti;\ - a = ROTATE_LEFT(t, s) + b - /* Do the following 16 operations. */ - SET(a, b, c, d, 5, 4, T33); - SET(d, a, b, c, 8, 11, T34); - SET(c, d, a, b, 11, 16, T35); - SET(b, c, d, a, 14, 23, T36); - SET(a, b, c, d, 1, 4, T37); - SET(d, a, b, c, 4, 11, T38); - SET(c, d, a, b, 7, 16, T39); - SET(b, c, d, a, 10, 23, T40); - SET(a, b, c, d, 13, 4, T41); - SET(d, a, b, c, 0, 11, T42); - SET(c, d, a, b, 3, 16, T43); - SET(b, c, d, a, 6, 23, T44); - SET(a, b, c, d, 9, 4, T45); - SET(d, a, b, c, 12, 11, T46); - SET(c, d, a, b, 15, 16, T47); - SET(b, c, d, a, 2, 23, T48); -#undef SET - - /* Round 4. */ - /* Let [abcd k s t] denote the operation - a = b + ((a + I(b,c,d) + X[k] + T[i]) <<< s). */ -#define I(x, y, z) ((y) ^ ((x) | ~(z))) -#define SET(a, b, c, d, k, s, Ti)\ - t = a + I(b,c,d) + X[k] + Ti;\ - a = ROTATE_LEFT(t, s) + b - /* Do the following 16 operations. */ - SET(a, b, c, d, 0, 6, T49); - SET(d, a, b, c, 7, 10, T50); - SET(c, d, a, b, 14, 15, T51); - SET(b, c, d, a, 5, 21, T52); - SET(a, b, c, d, 12, 6, T53); - SET(d, a, b, c, 3, 10, T54); - SET(c, d, a, b, 10, 15, T55); - SET(b, c, d, a, 1, 21, T56); - SET(a, b, c, d, 8, 6, T57); - SET(d, a, b, c, 15, 10, T58); - SET(c, d, a, b, 6, 15, T59); - SET(b, c, d, a, 13, 21, T60); - SET(a, b, c, d, 4, 6, T61); - SET(d, a, b, c, 11, 10, T62); - SET(c, d, a, b, 2, 15, T63); - SET(b, c, d, a, 9, 21, T64); -#undef SET - - /* Then perform the following additions. (That is increment each - of the four registers by the value it had before this block - was started.) */ - pms->abcd[0] += a; - pms->abcd[1] += b; - pms->abcd[2] += c; - pms->abcd[3] += d; -} - -void -md5_init(md5_state_t *pms) -{ - pms->count[0] = pms->count[1] = 0; - pms->abcd[0] = 0x67452301; - pms->abcd[1] = /*0xefcdab89*/ T_MASK ^ 0x10325476; - pms->abcd[2] = /*0x98badcfe*/ T_MASK ^ 0x67452301; - pms->abcd[3] = 0x10325476; -} - -void -md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes) -{ - const md5_byte_t *p = data; - int left = nbytes; - int offset = (pms->count[0] >> 3) & 63; - md5_word_t nbits = (md5_word_t)(nbytes << 3); - - if (nbytes <= 0) - return; - - /* Update the message length. */ - pms->count[1] += nbytes >> 29; - pms->count[0] += nbits; - if (pms->count[0] < nbits) - pms->count[1]++; - - /* Process an initial partial block. */ - if (offset) { - int copy = (offset + nbytes > 64 ? 64 - offset : nbytes); - - memcpy(pms->buf + offset, p, copy); - if (offset + copy < 64) - return; - p += copy; - left -= copy; - md5_process(pms, pms->buf); - } - - /* Process full blocks. */ - for (; left >= 64; p += 64, left -= 64) - md5_process(pms, p); - - /* Process a final partial block. */ - if (left) - memcpy(pms->buf, p, left); -} - -void -md5_finish(md5_state_t *pms, md5_byte_t digest[16]) -{ - static const md5_byte_t pad[64] = { - 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }; - md5_byte_t data[8]; - int i; - - /* Save the length before padding. */ - for (i = 0; i < 8; ++i) - data[i] = (md5_byte_t)(pms->count[i >> 2] >> ((i & 3) << 3)); - /* Pad to 56 bytes mod 64. */ - md5_append(pms, pad, ((55 - (pms->count[0] >> 3)) & 63) + 1); - /* Append the length. */ - md5_append(pms, data, 8); - for (i = 0; i < 16; ++i) - digest[i] = (md5_byte_t)(pms->abcd[i >> 2] >> ((i & 3) << 3)); -} diff --git a/packages/semweb/md5.h b/packages/semweb/md5.h deleted file mode 100644 index 8b0b2973a..000000000 --- a/packages/semweb/md5.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - Copyright (C) 1999, 2002 Aladdin Enterprises. All rights reserved. - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - - L. Peter Deutsch - ghost@aladdin.com - - */ -/* $Id$ */ -/* - Independent implementation of MD5 (RFC 1321). - - This code implements the MD5 Algorithm defined in RFC 1321, whose - text is available at - http://www.ietf.org/rfc/rfc1321.txt - The code is derived from the text of the RFC, including the test suite - (section A.5) but excluding the rest of Appendix A. It does not include - any code or documentation that is identified in the RFC as being - copyrighted. - - The original and principal author of md5.h is L. Peter Deutsch - <ghost@aladdin.com>. Other authors are noted in the change history - that follows (in reverse chronological order): - - 2002-04-13 lpd Removed support for non-ANSI compilers; removed - references to Ghostscript; clarified derivation from RFC 1321; - now handles byte order either statically or dynamically. - 1999-11-04 lpd Edited comments slightly for automatic TOC extraction. - 1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5); - added conditionalization for C++ compilation from Martin - Purschke <purschke@bnl.gov>. - 1999-05-03 lpd Original version. - */ - -#ifndef md5_INCLUDED -# define md5_INCLUDED - -/* - * This package supports both compile-time and run-time determination of CPU - * byte order. If ARCH_IS_BIG_ENDIAN is defined as 0, the code will be - * compiled to run only on little-endian CPUs; if ARCH_IS_BIG_ENDIAN is - * defined as non-zero, the code will be compiled to run only on big-endian - * CPUs; if ARCH_IS_BIG_ENDIAN is not defined, the code will be compiled to - * run on either big- or little-endian CPUs, but will run slightly less - * efficiently on either one than if ARCH_IS_BIG_ENDIAN is defined. - */ - -typedef unsigned char md5_byte_t; /* 8-bit byte */ -typedef unsigned int md5_word_t; /* 32-bit word */ - -/* Define the state of the MD5 Algorithm. */ -typedef struct md5_state_s { - md5_word_t count[2]; /* message length in bits, lsw first */ - md5_word_t abcd[4]; /* digest buffer */ - md5_byte_t buf[64]; /* accumulate block */ -} md5_state_t; - -#ifdef __cplusplus -extern "C" -{ -#endif - -/* Initialize the algorithm. */ -void md5_init(md5_state_t *pms); - -/* Append a string to the message. */ -void md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes); - -/* Finish the message and return the digest. */ -void md5_finish(md5_state_t *pms, md5_byte_t digest[16]); - -#ifdef __cplusplus -} /* end extern "C" */ -#endif - -#endif /* md5_INCLUDED */ diff --git a/packages/semweb/modules.gif b/packages/semweb/modules.gif deleted file mode 100644 index 2f5b34ebdcdd50f5ca048f4593b8d92f4b726044..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4985 zcmV-<6Nc<ZNk%v~VgCVb0e}Di00030|Nkri000300c`;Q0{(=LsmtvTqnxzbi?iOm z`wxcVNCoDJrs~SJ?hD8AOxN~}=lag~{tpZahcN^3h)gP%%%<}RjY?<6sr8D@YPa03 zw+Q%($K<m4jDA+r?6&(2k5AW7lD!hV>m&KSf6@0Rh?hjCCg&0cq=>k}==0ck63Ig; zNu^}yWGTs+<B14*BML`aV|wYBi8{pE=311R0t-WXW}7H$gG-~?#9Ices%s*wV*G`S zqFlN<M_il-9l#t-TunVKgYC$T361TY6%H<~UF$3*jzwO+=>D^Qn;s=^)qZWRi+|o? zPyNr|G=8!OUNYEk7QH$H_3d+*3Sq)Y3lG7A)bL$C{*4odA@Ri|U_FQtNp>>XF<T*# z9v^aa8Si2bmdPq^${15-C7nBHdie)(iO*js8%YdRbRy896mwbQWeP!4m7<RN14$~9 zRBKdEB`ucV*o&wKrYb^pG%UcfYuBh<x0TUZ7E7NwRjDKEq`6PWeih4g89K9kyY~7! zRpDKMV7V6d`%<xCfOrKrJ|Z`a+`yJUGUW`oD_hEO%c{l8X>;Y4Gri8Lau&7`wyB%K zvMO0>+`hV1hkm@cHC@|+Ej`i<cDCu*%C~|>{d{$+&(dGhh8=CQ_Ux527X}_0<0;wP z$&)7hJv!r@v7m3K`ra}2zU|o`+fC7V_iUN|8>gRp++N7h7akEoWda#|`01t?asgVV zT2+V*7nWwHIo2R?hedW5gWQQ`T4w};Hynp%1va2${3YiWY9X$e7>tvtXdrbGJ~dy8 z7Jg{qas5G8oruD1qaA>ht@YuNM@HzHeUKH&<7F}`Ip2)I?Ns7qvw5_ocTq;^<6c14 zwvt`z0Z3b0%+Y6@bEDnpWG!#L*xO?Y2pHpFaWYonb+UOV;GDiCC?1zAlK7UIZ7I0r zlxnUSU0v$jgV}^`;MR<ZA?3MgnUmHd52l&!X_TeY*=Q3{JmrN`p#_<`k!NPY<m#)M zB6X`$sdgG`ttI6ehp5^}I?}42v^xHzt)zBDEJMcPKwTlQq9H7@)6J@^uLn&#53v0- zYf-PsW;^b--kt;QP0x;EZBOg&k`imzekv}O^}2g6tMSq}Z?X9v`)-ru+PklM@t_*; zhW|pF@HYh;3<<&uv)k}C71#H0x~fhL@5Oo!jPJuiE+R3l<(j*!9MyWfi;aW49LURm z#4NKOG}nx?el_YUvcf%o{PQT${xY;sMRyxCp-GRY)X|<UeHGM+IDIMAvVMEu(xXYe zOx9d?Z8c_L3!(GZNSci&+GA}!(AY7n%_7{3%H56EM!8Kg+gxAxb=h>!jV|5?>n%0k zh5Ie{oq_WVx8YDb{<q+LF#eu+<bSV+HRX+4e!0ADYp%BBT8K^t=@EmDw&_=>UQ^Sk zo6S15okJW^>;ThkyT7w@3Qq16<Ief+ykFyc$G{&iJnaV+FYxBbC(k_72}QrL^U06A z5A_xYZ$0$PYL9XEp<l0jC*T7;{`110FX!uhbHD!g?(Yr%?(DBUf8q7de*e_@Kfb@t z^)G7EyW9ZDMn3En<bVZAU**Wh!2A49YXLN%{0dk>{Xy`8-?E_k?8iZLdGLYPi{NV} zm^2e=OMoF9)(FK1Lf2vNgRo1W3dJ--62g#wEo|4`5C^~w%5YdfOkoj!2D!#1ad}uH z+~b_6wIikuinVLv{tbI#x1LE6c2s0y;IgPiFlJ1Qha=+~%viN6=0%O4Kw}h#NW>S0 zj*XL>-VNQjFFG;|f>*>N8}ztG9mWriLd%&U4~fV`DsqvGY~;+khDAq8a*~v+q$Mwj z$qSq?TnTJNCw=xwxA`%UpX62vONm1+jPiG=Oj#?-XTY(o(s-{tSuKaRzFF2$UAH7y zFNI{oF4kcvfJE9afyqZ*9?V(Cyj?S4nYb-(f|$>A<}-^)Hfa)#nbmAwGqLH(pHQ=# zw7ljkMLAA#g7TZ^Oh!7@xxH?J6M^F7COpx1%z2vfY1O-@(%9KbblTIOm@{WU-8oQ# zdhVC{Jl8P(6RJ>t<+Gjj<YYt_+RKKzQXTKSXagsD(2DZXqaS4`MZ2I(hmlmGCJiY{ zJGxS6c2c7&Tpdkg%B+*B@}@Y=VJHzQwv^6Pm;gnkKn;XUe?EwyJPp}Sk*W|h{Rx+Y zEDnyQD$^Re^r_*r>e={`BBP20O>9!29A^qtdU{oHM$##m7G%~8R+X#S#37`>D%7C4 z1*}WDYAKtlua|npPd!RcMoaT2!~S%uTgYooFA7*zE>^IV?Wtok=GM_gwx=v}AYJ>3 z)6J^&uW1EsOhvm-tyb2wD@CnC&pHm6o>rZ%U1w||O48ascCL+;ZEI<p+1pw)w7_Mo zW^w-OQQg||lp<wqZi_3{=JJZO%Jn5$r7IN9QZ=|jT<vr%3tiG;7eU&MYjn^1+3ymU zoYloAJAC_G_Hx&z$c1cq<;v0eMzp=_^=@{{%U}Fi)3d#uCQ<Jh;Hg0cw(m9YWlN|{ z;1%{x*EyRYk4v-%L-@eBbC8IzGpHRl*udJ2uo9QErV4GBg5w=*i8UOrA5jU!D^6i) zjRs&C=QL1-ja!HbjNxs*IKj!i@qbHvUmA{>$C;FX%9>1wBoCFPxEj?*hAZV<QdwnO z=GYni#)<>tCvRpnh9Sh<Ws{-II4WIpSa<u+mTfs$X$D!T{JNaEDGp^|V~(Hoy#6(< z<cF{fkaJS2e8$cOqc>p6Pm=gd941kzuRJafUsnW-Gb?%=n;t`v=;Y%=TNy@whR>h_ zJyu1DCOJZz^Qd3ZX)!>F)b2^;ug)VQypnZ4)}geKe%wA$(|OoxK8at?^A_b0FGr68 zQDXb-8@TSd7lQV(r(>Pvu1ZeR)|NH4vz<-Ral6=QKr^@@?CL}l+s@~1?2XO+YGb$C z+tP)%y2*{Y03Wr+uwM7A3&v*N205$7ywtZ*njOL(syPg%udqj(?s&FL#|71h-I!r+ z9mU5%Bzj-Hu}ttR3CtdPgG>1^?hcLHCPYgNqIav2rd7wyyy27hmk?Xy{yk&7$I~9O zb&b8FuhzOsB6c{x^)%r|)jDFDjB3Kmnsf`qBtijqRA3j_oIm#oa7DjIwTI+q#lHFK zZKiditbP?YO+C_dh|kaQZCv3VUBI!SbYD?!XkY8y!g8Vn%5!9=wl4SIEq!_3#6)AC zJ9Rt?*Yn&(jxWT5IOc<gbjVZpZrN=Vs*4|KYU@1N^p@=Nt*-o)IiJV*dOhM@g?PVp zNBVeoSM&#mz2$d|-U2`T-n=J#N{Ecn)$iWm{=Pj58!r6E7yR|??qJ-PeEHIW-uOPf zuHn1gI=GAQ`9_cawTmzB)N?=i-lw<h5glXI&*AIMH-o*?KmPUpv;L1ZJH7T@82|hZ zpZTtj{ZB*&d?nR=H1|jLhkCw;d*XF{_eXa9cV_^ne)`8`Q1$=@cq$ag2bh(AprU{e zSX3RTd)DWHAeDOqH+$$;cpzwk%oTnlsDg55LkM_F0XTm`CW0uKQ4z?2p@)MrsDls1 zgVUFT8wi9qIB)dwg3xz_OSpgdwS!CuEgUw4B?yBj7ClR)R6nQ&wS|QRxJjk<CP~PG z>7`nZ#wfT(fUS2KLC04#SbiGhUmmwscV~u_@`b7<ct#k5Ee3~XIAKede2v0}#}<Tp z7>7S(S5KE~6bA+<28POqc|^E{vDA2gl7{A2h$py$Q&|2AZU~8yc!&WNJDwP4nplNU z_*#Z2hU908=ck2EScIzBgSAA8mxyDT*n266i>x??!D3?k^NXNJhTd~Gj5tP8*md%^ zi{*xlxnzvn7m7SojI~%dp15za=!?{NAEbDVtynek#EnKqjCTW$O@o0M=s(Nog<*7# z=;&NRxJeV(j??CVgENl}kbRY+U-bx&kko|bW`X<&e(c~w0oj7xP=nNBkcGs4GPpVg zsgL(JZtd53QFwL?xR1F=UJ}`m)Hf4*P<xxFk<!936X}pUg=*dAM_~q$2k4Pf@`nHC zepN@2X(L%z@{($plO~yy(x;M)LSc!87A>ih2mUER|EQ1yIg2M`C;m7fEE$qDXO!_6 zlL)7j{b(In<%myNc0K8TR+)~U=##E^m7Sq-tVU}#caknSmHsG}-$#~lxgT|+b+E)h z@P(ByX^ZZcmvWhr#OHZC*^zCze1xfahFO#&h>%EGm;i}=@7R|D8J9eXm}6O!f60GG zR&m}`iprA}gQ=M7Sd)$em7VDtS(JwYxS6M;n%;LCIN6#?Qk4P`6f1L-q;!+4Qk!wL zU{nbttfv)}Nin5~J+uH9`tg~2WnpybV-+}aQ4wr!84I9bo4tmcX&0M^L7lt_F!V@u zJwh5N#&>KLg^N;h&jx5M!gw%~AcA+6{)=d9yoPqMDV%HcDBjU=1E!q|2MCAKh>FKF z{n=++2cT2{0g6In@ab$0z%Y{LluQzBS#_Kjc_v8`c6HdCP5Ef6>6Wu;q4GI)ktB73 zXqJ~2btP~tZigWex}h85ou@{ksum-FfD1YT8anr(1k#mE2bxZ)h#I$R%K2ysYMOe< z4K}(|A=-cj>L>hpX?+)lDT<*hdLk{_W^6NSTq$F3hNTVqq;|z@Ka!su8j)%Do&Je) z_=s$j2b&$bm$^WsbeM{{;UbA>CD@se#gUqK_Z@q>qjdUJ94DT#33=a8pp_V&QEFQx z373oNrbilT{K2NCCvrUJh&r17n}+%#S?PEMs+ODvmP^X0nE0ph$rL0Pnd+sV1bH*% zbe$VXs-Nncr#h;D*{bf9sSg>dtGbX&X{5IImB5OG70IfPNvXC<7d@J)v09m*Y72LX znT{Ej9y&V9Dw-AftVAi9Bl)ON8JLxMp&6QVrE0Bk#;vC6t&k~~b!VYxYF^L^a=uEa z@0Xe2DkVrtXhWH<ZQ7UhS+2X<lXtZw?y9fG`gZc_uVonw0aIvB8g>PXk#m}q)B2{C ziL72Jol@DX65E*FYOwD1m;nK=-x`{;y07;s0v98)+8V4NOR@CIv5xw$nt7QqyRZV5 zu`<b)Hfyofda}uSk81w<vL}nGAG;DkE41YZZAcr8<XQ<#E1(*PiZ~msjViB_$b`?B zr}_9~?4`Bv^tEVtwYQ*+Ks&WmOJXIPM&MYsn`kuP1GmlSjBR_0ZyUBP%Tagxdrg~d zVcT*YOMh|;jDp*@r^>f3n~j7kjb}?h!g{d^i?vIrx97t?beo;1IJp?hm-5B9ja#+M z>X)m?xS6}Ln=4P9>$&k-uc3>&`80ZvJF%^+P^7E2k6S@wy0w<|x~zM%_Jb9!D!IFR zuB%%)Ucz#F)ppj&b<`!iwmZCBgoaNkX;`>%Nk+S43%FCXsW_q`)LVy^i$$_KyMx9f z%qE|FO0A+OzW!N=c;o?|I@%}rX}u&DVX{=ER%(%Cl2n5Ghq!8p;A@}u=L)hkh?n~@ z5PQG-xm|6mxYYz>1lxEB=V6KZzOEXkEXOZ^!gDBMo;0eQhr7P!bF}Q*BEUwF6Z~tq zTd06XzT1c)nATQX=O{KRsp%WS%*d#JsKM^^z9}rXeur1e3mCi6zw(i6?wN26e8XKU zzysUDM-_7%M{pl}Y!iI1W1?)6_MAi4hAJGmUIV~S$ayIydFBV970i%5CaGT<zv?NY z{lT1xx^jA}ZT^e7VZ6i@iX?RssC;*BbezXXRAKYV#Ww7^hv~eD%tA@baJja|fUIT1 z3cJ}m{z7cn#g=Bs4As2EtH_niYNa7`ehhBcJF}o0$cKf<oUF>HtiF=WyFKfI>r2X$ zY`PAd$Fuy(R{Mdnyvf&E%HtTqxct1*YRgM3%$-ck26e;7yvoVE%i_z-zMMu%98J`m zW2r37(+s|U3x(0_%wGn{R)oi~sJhww3f5fB#@x%_49;w;&e+V(-{{WEyw0)9#Haht zt~|{4{LHd@W>8Cyc$<{~9nMP&&`cGa1dYzY_mK)+(DKN%2n~SBFwU&(Mc)I$Icw1t z{m>&k0vip|;k&mP9nvKoz<JcsCVk5lt<ox;(k%_sy%W<jeaJLz)91v}H+{-4t<ydJ zO@BTO)X<aDLCwoVZPbx7)JKiFS#!if$<W6d3X&JD%?3<W;l_H!v-<@neX2k}K{+b7 zof`YXGzD{6yVV?=8iN|jQMa7VNh@Kcr1IgP3PK};idEYerFB=vNiEW5+LXwdO42KH z0=sG|M4@U7sFPN}Hi@Kb*g?|^byNDsXFZo(qM|XpaJ(V5Frjqw`NE2gpw-scGTIQ3 zZ5VYKyzMF1ZGx7Ah}mmh9vZDmh)3IcEOd*lp04fKDYthf3W)Q@)N@R911czyDpg%f z(%F}FV;XG>5@?`IdC4tKcMVsM9M@9D)8nhu0>sxkyWJgj)7@Rv-%Z|cRNian9Y*M_ z-T)`w>pjZt?cQ0I-SJJ|tXbdpy+HV_-xs~#{rzSB4dC(|-~&FB1a9D^lh6+RWDXrR z3_jm+WYAE%;0lhC6pmo<ec%$E;Ts-;9PZ)D_~9W=&LU3Y9_`>Kj^Zh<;wugT1poj$ D$W!{v diff --git a/packages/semweb/murmur.c b/packages/semweb/murmur.c deleted file mode 100644 index ae70a63df..000000000 --- a/packages/semweb/murmur.c +++ /dev/null @@ -1,171 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog - - Author: Austin Appleby - License: Public domain - See: http://murmurhash.googlepages.com/ -*/ - -#include <SWI-Prolog.h> /* het uintptr_t */ - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -The first one is actually MurmurHashNeutral2(). It produces the same -hash as MurmurHashAligned2() on little endian machines, but is -significantly slower. MurmurHashAligned2() however is broken on -big-endian machines, as it produces different hashes, depending on the -alignment. - -NOTE: This file is a copy of src/pl-hash.c from SWI-Prolog. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -#if WORDS_BIGENDIAN - -unsigned int -rdf_murmer_hash(const void * key, int len, unsigned int seed) -{ const unsigned int m = 0x5bd1e995; - const int r = 24; - unsigned int h = seed ^ len; - const unsigned char * data = (const unsigned char *)key; - - while( len >= 4 ) - { unsigned int k; - - k = data[0]; - k |= data[1] << 8; - k |= data[2] << 16; - k |= data[3] << 24; - - k *= m; - k ^= k >> r; - k *= m; - - h *= m; - h ^= k; - - data += 4; - len -= 4; - } - - switch( len ) - { case 3: h ^= data[2] << 16; - case 2: h ^= data[1] << 8; - case 1: h ^= data[0]; - h *= m; - }; - - h ^= h >> 13; - h *= m; - h ^= h >> 15; - - return h; -} - -#else /*WORDS_BIGENDIAN*/ - -#define MIX(h,k,m) { k *= m; k ^= k >> r; k *= m; h *= m; h ^= k; } - -unsigned int -rdf_murmer_hash(const void *key, int len, unsigned int seed) -{ const unsigned int m = 0x5bd1e995; - const int r = 24; - const unsigned char * data = (const unsigned char *)key; - unsigned int h = seed ^ len; - int align = (int)(uintptr_t)data & 3; - - if ( align && (len >= 4) ) - { unsigned int t = 0, d = 0; - int sl, sr; - - switch( align ) - { case 1: t |= data[2] << 16; - case 2: t |= data[1] << 8; - case 3: t |= data[0]; - } - - t <<= (8 * align); - - data += 4-align; - len -= 4-align; - - sl = 8 * (4-align); - sr = 8 * align; - - while ( len >= 4 ) - { unsigned int k; - - d = *(unsigned int *)data; - t = (t >> sr) | (d << sl); - - k = t; - MIX(h,k,m); - t = d; - - data += 4; - len -= 4; - } - - d = 0; - - if ( len >= align ) - { unsigned int k; - - switch( align ) - { case 3: d |= data[2] << 16; - case 2: d |= data[1] << 8; - case 1: d |= data[0]; - } - - k = (t >> sr) | (d << sl); - MIX(h,k,m); - - data += align; - len -= align; - - switch(len) - { case 3: h ^= data[2] << 16; - case 2: h ^= data[1] << 8; - case 1: h ^= data[0]; - h *= m; - }; - } else - { switch(len) - { case 3: d |= data[2] << 16; - case 2: d |= data[1] << 8; - case 1: d |= data[0]; - case 0: h ^= (t >> sr) | (d << sl); - h *= m; - } - } - - h ^= h >> 13; - h *= m; - h ^= h >> 15; - - return h; - } else - { while( len >= 4 ) - { unsigned int k = *(unsigned int *)data; - - MIX(h,k,m); - - data += 4; - len -= 4; - } - - switch(len) - { case 3: h ^= data[2] << 16; - case 2: h ^= data[1] << 8; - case 1: h ^= data[0]; - h *= m; - }; - - h ^= h >> 13; - h *= m; - h ^= h >> 15; - - return h; - } -} - -#endif /*WORDS_BIGENDIAN*/ diff --git a/packages/semweb/murmur.h b/packages/semweb/murmur.h deleted file mode 100644 index cdf19f7f9..000000000 --- a/packages/semweb/murmur.h +++ /dev/null @@ -1,18 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog - - Author: Austin Appleby - License: Public domain - See: http://murmurhash.googlepages.com/ -*/ - -#ifndef PL_HASH_H_INCLUDED -#define PL_HASH_H_INCLUDED - -#define MURMUR_SEED (0x1a3be34a) - -unsigned int - rdf_murmer_hash(const void *key, int len, unsigned int seed); - -#endif /*PL_HASH_H_INCLUDED*/ diff --git a/packages/semweb/owl.owl b/packages/semweb/owl.owl deleted file mode 100644 index c0f342017..000000000 --- a/packages/semweb/owl.owl +++ /dev/null @@ -1,287 +0,0 @@ -<?xml version="1.0"?> -<!DOCTYPE owl [ - <!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#" > - <!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#" > - <!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" > - <!ENTITY owl "http://www.w3.org/2002/07/owl#" > - ]> - -<rdf:RDF - xmlns ="&owl;" - xmlns:owl ="&owl;" - xml:base ="http://www.w3.org/2002/07/owl" - xmlns:rdf ="&rdf;" - xmlns:rdfs="&rdfs;" - xmlns:dc ="http://purl.org/dc/elements/1.1/" -> - -<Ontology rdf:about=""> - <versionInfo>March 18. 2003, GS</versionInfo> - <imports rdf:resource="http://www.w3.org/2000/01/rdf-schema"/> - <dc:title>Classes and properties for the Web Ontology Language OWL</dc:title> - <dc:creator>W3C Web Ontology (WebOnt) Working Group</dc:creator> - <dc:subject>OWL; Web Ontology Language; Semantic Web</dc:subject> - <dc:description>This file specifies in RDF Schema format the - built-in classes and properties that together form the basis of - the RDF/XML syntax of OWL Full, OWL DL and OWL Lite with the help - of RDF Schema. We do not expect people to import this file - explicitly into their ontology. People that do import this file - should expect their ontology to be an OWL Full ontology. - </dc:description> - <dc:publisher>W3C</dc:publisher> - <dc:date>2003-02-10</dc:date> - <dc:format>text/xml</dc:format> - <dc:language>en</dc:language> - <dc:identifier>http://www.w3.org/2002/07/owl</dc:identifier> -</Ontology> - -<rdfs:Class rdf:ID="Class"> - <rdfs:label>Class</rdfs:label> - <rdfs:subClassOf rdf:resource="&rdfs;Class"/> -</rdfs:Class> - -<Class rdf:ID="Thing"> - <rdfs:label>Thing</rdfs:label> - <unionOf rdf:parseType="Collection"> - <Class rdf:about="#Nothing"/> - <Class> - <complementOf rdf:resource="#Nothing"/> - </Class> - </unionOf> -</Class> - -<Class rdf:ID="Nothing"> - <rdfs:label>Nothing</rdfs:label> - <complementOf rdf:resource="#Thing"/> -</Class> - -<rdf:Property rdf:ID="equivalentClass"> - <rdfs:label>equivalentClass</rdfs:label> - <rdfs:subPropertyOf rdf:resource="&rdfs;subClassOf"/> - <rdfs:domain rdf:resource="#Class"/> - <rdfs:range rdf:resource="#Class"/> -</rdf:Property> - -<rdf:Property rdf:ID="disjointWith"> - <rdfs:label>disjointWith</rdfs:label> - <rdfs:domain rdf:resource="#Class"/> - <rdfs:range rdf:resource="#Class"/> -</rdf:Property> - -<rdf:Property rdf:ID="equivalentProperty"> - <rdfs:label>equivalentProperty</rdfs:label> - <rdfs:subPropertyOf rdf:resource="&rdfs;subPropertyOf"/> -</rdf:Property> - -<rdf:Property rdf:ID="sameIndividualAs"> - <rdfs:label>sameIndividualAs</rdfs:label> - <rdfs:domain rdf:resource="#Thing"/> - <rdfs:range rdf:resource="#Thing"/> - <rdfs:subPropertyOf rdf:resource="#sameAs"/> -</rdf:Property> - -<rdf:Property rdf:ID="sameAs"> - <rdfs:label>sameAs</rdfs:label> - <rdfs:subPropertyOf rdf:resource="#sameIndividualAs"/> -</rdf:Property> - -<rdf:Property rdf:ID="differentFrom"> - <rdfs:label>differentFrom</rdfs:label> - <rdfs:domain rdf:resource="#Thing"/> - <rdfs:range rdf:resource="#Thing"/> -</rdf:Property> - -<rdfs:Class rdf:ID="AllDifferent"> - <rdfs:label>AllDifferent</rdfs:label> -</rdfs:Class> - -<rdf:Property rdf:ID="distinctMembers"> - <rdfs:label>distinctMembers</rdfs:label> - <rdfs:domain rdf:resource="#AllDifferent"/> - <rdfs:range rdf:resource="&rdf;List"/> -</rdf:Property> - -<rdf:Property rdf:ID="unionOf"> - <rdfs:label>unionOf</rdfs:label> - <rdfs:domain rdf:resource="#Class"/> - <rdfs:range rdf:resource="&rdf;List"/> -</rdf:Property> - -<rdf:Property rdf:ID="intersectionOf"> - <rdfs:label>intersectionOf</rdfs:label> - <rdfs:domain rdf:resource="#Class"/> - <rdfs:range rdf:resource="&rdf;List"/> -</rdf:Property> - -<rdf:Property rdf:ID="complementOf"> - <rdfs:label>complementOf</rdfs:label> - <rdfs:domain rdf:resource="#Class"/> - <rdfs:range rdf:resource="#Class"/> -</rdf:Property> - -<rdf:Property rdf:ID="oneOf"> - <rdfs:label>oneOf</rdfs:label> - <rdfs:domain rdf:resource="&rdfs;Class"/> - <rdfs:range rdf:resource="&rdf;List"/> -</rdf:Property> - -<rdfs:Class rdf:ID="Restriction"> - <rdfs:label>Restriction</rdfs:label> - <rdfs:subClassOf rdf:resource="#Class"/> -</rdfs:Class> - -<rdf:Property rdf:ID="onProperty"> - <rdfs:label>onProperty</rdfs:label> - <rdfs:domain rdf:resource="#Restriction"/> - <rdfs:range rdf:resource="&rdf;Property"/> -</rdf:Property> - -<rdf:Property rdf:ID="allValuesFrom"> - <rdfs:label>allValuesFrom</rdfs:label> - <rdfs:domain rdf:resource="#Restriction"/> - <rdfs:range rdf:resource="&rdfs;Class"/> -</rdf:Property> - -<rdf:Property rdf:ID="hasValue"> - <rdfs:label>hasValue</rdfs:label> - <rdfs:domain rdf:resource="#Restriction"/> -</rdf:Property> - -<rdf:Property rdf:ID="someValuesFrom"> - <rdfs:label>someValuesFrom</rdfs:label> - <rdfs:domain rdf:resource="#Restriction"/> - <rdfs:range rdf:resource="&rdfs;Class"/> -</rdf:Property> - -<rdf:Property rdf:ID="minCardinality"> - <rdfs:label>minCardinality</rdfs:label> - <rdfs:domain rdf:resource="#Restriction"/> - <rdfs:range rdf:resource="&xsd;nonNegativeInteger"/> -</rdf:Property> - -<rdf:Property rdf:ID="maxCardinality"> - <rdfs:label>maxCardinality</rdfs:label> - <rdfs:domain rdf:resource="#Restriction"/> - <rdfs:range rdf:resource="&xsd;nonNegativeInteger"/> -</rdf:Property> - -<rdf:Property rdf:ID="cardinality"> - <rdfs:label>cardinality</rdfs:label> - <rdfs:domain rdf:resource="#Restriction"/> - <rdfs:range rdf:resource="&xsd;nonNegativeInteger"/> -</rdf:Property> - -<rdfs:Class rdf:ID="ObjectProperty"> - <rdfs:label>ObjectProperty</rdfs:label> - <rdfs:subClassOf rdf:resource="&rdf;Property"/> -</rdfs:Class> - -<rdfs:Class rdf:ID="DatatypeProperty"> - <rdfs:label>DatatypeProperty</rdfs:label> - <rdfs:subClassOf rdf:resource="&rdf;Property"/> -</rdfs:Class> - -<rdf:Property rdf:ID="inverseOf"> - <rdfs:label>inverseOf</rdfs:label> - <rdfs:domain rdf:resource="#ObjectProperty"/> - <rdfs:range rdf:resource="#ObjectProperty"/> -</rdf:Property> - -<rdfs:Class rdf:ID="TransitiveProperty"> - <rdfs:label>TransitiveProperty</rdfs:label> - <rdfs:subClassOf rdf:resource="#ObjectProperty"/> -</rdfs:Class> - -<rdfs:Class rdf:ID="SymmetricProperty"> - <rdfs:label>SymmetricProperty</rdfs:label> - <rdfs:subClassOf rdf:resource="#ObjectProperty"/> -</rdfs:Class> - -<rdfs:Class rdf:ID="FunctionalProperty"> - <rdfs:label>FunctionalProperty</rdfs:label> - <rdfs:subClassOf rdf:resource="&rdf;Property"/> -</rdfs:Class> - -<rdfs:Class rdf:ID="InverseFunctionalProperty"> - <rdfs:label>InverseFunctionalProperty</rdfs:label> - <rdfs:subClassOf rdf:resource="&owl;ObjectProperty"/> -</rdfs:Class> - -<rdfs:Class rdf:ID="AnnotationProperty"> - <rdfs:subClassOf rdf:resource="&rdf;Property"/> -</rdfs:Class> - -<rdf:Description rdf:about="&rdfs;label"> - <rdf:type rdf:resource="#AnnotationProperty"/> -</rdf:Description> - -<rdf:Description rdf:about="&rdfs;comment"> - <rdf:type rdf:resource="#AnnotationProperty"/> -</rdf:Description> - -<rdf:Description rdf:about="&rdfs;seeAlso"> - <rdf:type rdf:resource="#AnnotationProperty"/> -</rdf:Description> - -<rdf:Description rdf:about="&rdfs;isDefinedBy"> - <rdf:type rdf:resource="#AnnotationProperty"/> -</rdf:Description> - -<rdfs:Class rdf:ID="Ontology"> - <rdfs:label>Ontology</rdfs:label> -</rdfs:Class> - -<rdfs:Class rdf:ID="OntologyProperty"> - <rdfs:subClassOf rdf:resource="&rdf;Property"/> -</rdfs:Class> - -<rdf:Property rdf:ID="imports"> - <rdfs:label>imports</rdfs:label> - <rdf:type rdf:resource="#OntologyProperty"/> - <rdfs:domain rdf:resource="#Ontology"/> - <rdfs:range rdf:resource="#Ontology"/> -</rdf:Property> - -<rdf:Property rdf:ID="versionInfo"> - <rdfs:label>versionInfo</rdfs:label> - <rdf:type rdf:resource="#AnnotationProperty"/> -</rdf:Property> - -<rdf:Property rdf:ID="priorVersion"> - <rdfs:label>priorVersion</rdfs:label> - <rdf:type rdf:resource="#OntologyProperty"/> - <rdfs:domain rdf:resource="#Ontology"/> - <rdfs:range rdf:resource="#Ontology"/> -</rdf:Property> - -<rdf:Property rdf:ID="backwardCompatibleWith"> - <rdfs:label>backwardCompatibleWitesh</rdfs:label> - <rdf:type rdf:resource="#OntologyProperty"/> - <rdfs:domain rdf:resource="#Ontology"/> - <rdfs:range rdf:resource="#Ontology"/> -</rdf:Property> - -<rdf:Property rdf:ID="incompatibleWith"> - <rdfs:label>incompatibleWith</rdfs:label> - <rdf:type rdf:resource="#OntologyProperty"/> - <rdfs:domain rdf:resource="#Ontology"/> - <rdfs:range rdf:resource="#Ontology"/> -</rdf:Property> - -<rdfs:Class rdf:ID="DeprecatedClass"> - <rdfs:label>DeprecatedClass</rdfs:label> - <rdfs:subClassOf rdf:resource="&rdfs;Class"/> -</rdfs:Class> - -<rdfs:Class rdf:ID="DeprecatedProperty"> - <rdfs:label>DeprecatedProperty</rdfs:label> - <rdfs:subClassOf rdf:resource="&rdf;Property"/> -</rdfs:Class> - -<rdfs:Class rdf:ID="DataRange"> - <rdfs:label>DataRange</rdfs:label> -</rdfs:Class> - - -</rdf:RDF> - diff --git a/packages/semweb/pltotex.pl b/packages/semweb/pltotex.pl deleted file mode 100644 index 491271d84..000000000 --- a/packages/semweb/pltotex.pl +++ /dev/null @@ -1,60 +0,0 @@ -:- module(pltotex, - [ pltotex/2, - pltotex/0 - ]). -:- use_module(library(doc_latex)). -:- use_module(library(main)). -:- use_module(library(error)). -:- use_module(library(apply)). -:- use_module(library(lists)). - -pltotex(Lib, Options) :- - ( file_name_extension(_, pl, Lib) - -> Spec = Lib - ; atom_to_term(Lib, Spec, _) - ), - absolute_file_name(Spec, File, - [ access(read), - file_type(prolog) - ]), - tex_file(File, Out), - user:use_module(File), % we want the operators in user - doc_latex(File, Out, - [ stand_alone(false) - | Options - ]). - -tex_file(File, TeXFile) :- - file_base_name(File, Local), - file_name_extension(Base0, _, Local), - strip(Base0, 0'_, Base), - file_name_extension(Base, tex, TeXFile). - -strip(In, Code, Out) :- - atom_codes(In, Codes0), - delete(Codes0, Code, Codes), - atom_codes(Out, Codes). - - -%% pltotex -% -% Usage: pl -q -s pltotex.pl -g pltotex -- file ... - -pltotex :- - main. - -main(Argv) :- - partition(is_option, Argv, OptArgs, Files), - maplist(to_option, OptArgs, Options), - maplist(process_file(Options), Files). - -is_option(Arg) :- - sub_atom(Arg, 0, _, _, --). - -to_option('--section', section_level(section)). -to_option('--subsection', section_level(subsection)). -to_option('--subsubsection', section_level(subsubsection)). - -process_file(Options, File) :- - pltotex(File, Options). - diff --git a/packages/semweb/quote.c b/packages/semweb/quote.c deleted file mode 100644 index b278109cb..000000000 --- a/packages/semweb/quote.c +++ /dev/null @@ -1,116 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog - - Author: Jan Wielemaker - E-mail: jan@science.uva.nl - WWW: http://www.swi-prolog.org - Copyright (C): 1985-2005, University of Amsterdam - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - As a special exception, if you link this library with other files, - compiled with a Free Software compiler, to produce an executable, this - library does not by itself cause the resulting executable to be covered - by the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#ifndef PLVERSION -#include <SWI-Prolog.h> -#endif - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Ideally we should have various of these tables and distinguish the host, -path, query and fragment parts. See RFC3986 for details. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -static char * -uri_ok() -{ static char ok[128]; - int done = FALSE; - const char *s; - - if ( !done ) - { int i; - - for(i='a'; i<='z'; i++) - ok[i] = TRUE; - for(i='A'; i<='Z'; i++) - ok[i] = TRUE; - for(i='0'; i<='9'; i++) - ok[i] = TRUE; - for(s="-_.!~*'()"; *s; s++) /* used to have [], but these general delimiters */ - ok[(int)*s] = TRUE; /* cannot be in a fragment or path */ - for(s=";/&?:@=#"; *s; s++) - ok[(int)*s] = TRUE; - - done = TRUE; - } - - return ok; -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -RDF (Unicode) URIs are first mapped to UTF-8 and then unsafe and -characters outside the printable US-ASCII range are represented as %XX -where XX is the hexadecimal version of the octed. We moved this to C to -exploit much faster character operations. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -static foreign_t -rdf_quote_uri(term_t uri, term_t quoted) -{ char *in; - const char *s; - const char *ok = uri_ok(); - size_t len; - int nok; - - if ( !PL_get_nchars(uri, &len, &in, CVT_ATOM|REP_UTF8|CVT_EXCEPTION) ) - return FALSE; - - for(s=in, nok=0; *s; s++) - { int c = *s&0xff; - - if ( c >= 128 || !ok[c] ) - { nok++; - } - } - - if ( nok ) - { char *buf = alloca(len+nok*2+1); - char *o = buf; - static char xdigit[] = "0123456789ABCDEF"; - - for(s=in; *s; s++) - { int c = *s&0xff; - - if ( c >= 128 || !ok[c] ) - { *o++ = '%'; - *o++ = xdigit[(c>>4)&0xf]; - *o++ = xdigit[c&0xf]; - } else - { *o++ = c; - } - } - *o = '\0'; - - return PL_unify_atom_nchars(quoted, len+nok*2, buf); - } - - return PL_unify(uri, quoted); -} diff --git a/packages/semweb/rdf_cache.pl b/packages/semweb/rdf_cache.pl deleted file mode 100644 index 727f3352b..000000000 --- a/packages/semweb/rdf_cache.pl +++ /dev/null @@ -1,217 +0,0 @@ -:- module(rdf_cache, - [ rdf_set_cache_options/1, % +Options - rdf_cache_file/3 % +URL, +RW, -File - ]). -:- use_module(library(error)). - -/** <module> Cache RDF triples - -Triples may be cached to reduce load time as well as access to network -resources (e.g. HTTP). We use two caching locations: typically files may -be cached locally (i.e. in a .cache sub-directory of the file). All -objects can be cached in a global cache directory. The policy is -determined by rdf_cache_options/1. -*/ - -:- dynamic - cache_option/1. - -set_setfault_options :- - assert(cache_option(enabled(true))), - ( current_prolog_flag(windows, true) - -> assert(cache_option(local_directory('_cache'))) - ; assert(cache_option(local_directory('.cache'))) - ). - -:- set_setfault_options. % _only_ when loading! - -%% rdf_set_cache_options(+Options) -% -% Change the cache policy. Provided options are: -% -% * enabled(Boolean) -% If =true=, caching is enabled. -% -% * local_directory(Name). -% Plain name of local directory. Default =|.cache|= -% (=|_cache|= on Windows). -% -% * create_local_directory(Bool) -% If =true=, try to create local cache directories -% -% * global_directory(Dir) -% Writeable directory for storing cached parsed files. -% -% * create_global_directory(Bool) -% If =true=, try to create the global cache directory. - -rdf_set_cache_options([]) :- !. -rdf_set_cache_options([H|T]) :- !, - rdf_set_cache_options(H), - rdf_set_cache_options(T). -rdf_set_cache_options(Opt) :- - functor(Opt, Name, Arity), - arg(1, Opt, Value), - ( cache_option(Name, Type) - -> must_be(Type, Value) - ; domain_error(cache_option, Opt) - ), - functor(Gen, Name, Arity), - retractall(cache_option(Gen)), - expand_option(Opt, EOpt), - assert(cache_option(EOpt)). - -cache_option(enabled, boolean). -cache_option(local_directory, atom). -cache_option(create_local_directory, boolean). -cache_option(global_directory, atom). -cache_option(create_global_directory, boolean). - -expand_option(global_directory(Local), global_directory(Global)) :- !, - absolute_file_name(Local, Global). -expand_option(Opt, Opt). - - -%% rdf_cache_location(+URL, +ReadWrite, -File) is semidet. -% -% File is the cache file for URL. If ReadWrite is =read=, it -% returns the name of an existing file. If =write= it returns the -% where a new cache file can be overwritten or created. - -rdf_cache_file(_URL, _, _File) :- - cache_option(enabled(false)), !, - fail. -rdf_cache_file(URL, read, File) :- !, - ( atom_concat('file://', Path, URL), - cache_option(local_directory(Local)), - file_directory_name(Path, Dir), - local_cache_file(URL, LocalFile), - atomic_list_concat([Dir, Local, LocalFile], /, File) - ; cache_option(global_directory(Dir)), - url_cache_file(URL, Dir, trp, read, File) - ), - access_file(File, read), !. -rdf_cache_file(URL, write, File) :- !, - ( atom_concat('file://', Path, URL), - cache_option(local_directory(Local)), - file_directory_name(Path, Dir), - ( cache_option(create_local_directory(true)) - -> RWDir = write - ; RWDir = read - ), - ensure_dir(Dir, Local, RWDir, CacheDir), - local_cache_file(URL, LocalFile), - atomic_list_concat([CacheDir, LocalFile], /, File) - ; cache_option(global_directory(Dir)), - ensure_global_cache(Dir), - url_cache_file(URL, Dir, trp, write, File) - ), - access_file(File, write), !. - - -ensure_global_cache(Dir) :- - exists_directory(Dir), !. -ensure_global_cache(Dir) :- - cache_option(create_global_directory(true)), - make_directory(Dir), - print_message(informational, rdf(cache_created(Dir))). - - - /******************************* - * LOCAL CACHE * - *******************************/ - -%% local_cache_file(+FileURL, -File) is det. -% -% Return the name of the cache file for FileURL. The name is the -% plain filename with the .trp extension. As the URL is a file -% URL, it is guaranteed to be a valid filename. Assumes the -% hosting OS can handle multiple exensions (=|.x.y|=) though. -% These days thats even true on Windows. - -local_cache_file(URL, File) :- - file_base_name(URL, Name), - file_name_extension(Name, trp, File). - - - /******************************* - * GLOBAL CACHE * - *******************************/ - -%% url_cache_file(+URL, +Dir, +Ext, +RW, -Path) is semidet. -% -% Determine location of cache-file for the given URL in Dir. If -% Ext is provided, the returned Path is ensured to have the -% specified extension. -% -% @param RW If =read=, no directories are created and the call -% fails if URL is not in the cache. - -url_cache_file(URL, Dir, Ext, RW, Path) :- - term_hash(URL, Hash0), - Hash is Hash0 + 100000, % make sure > 4 characters - format(string(Hex), '~16r', [Hash]), - sub_atom(Hex, _, 2, 0, L1), - ensure_dir(Dir, L1, RW, Dir1), - sub_atom(Hex, _, 2, 2, L2), - ensure_dir(Dir1, L2, RW, Dir2), - url_to_file(URL, File), - ensure_ext(File, Ext, FileExt), - atomic_list_concat([Dir2, /, FileExt], Path). - -ensure_dir(D0, Sub, RW, Dir) :- - atomic_list_concat([D0, /, Sub], Dir), - ( exists_directory(Dir) - -> true - ; RW == write - -> catch(make_directory(Dir), _, fail) - ). - -ensure_ext(File, '', File) :- !. -ensure_ext(File, Ext, File) :- - file_name_extension(_, Ext, File), !. -ensure_ext(File, Ext, FileExt) :- - file_name_extension(File, Ext, FileExt). - -%% url_to_file(+URL, -File) -% -% Convert a URL in something that fits in a file, i.e. avoiding / -% and :. We simply replace these by -. We could also use -% www_form_encode/2, but confusion when to replace as well as the -% fact that we loose the '.' (extension) makes this a less ideal -% choice. We could also consider base64 encoding of the name. - -url_to_file(URL, File) :- - atom_codes(URL, Codes), - phrase(safe_file_name(Codes), FileCodes), - atom_codes(File, FileCodes). - -safe_file_name([]) --> - []. -safe_file_name([H|T]) --> - replace(H), !, - safe_file_name(T). -safe_file_name([H|T]) --> - [H], - safe_file_name(T). - -%% replace(+Code)// -% -% Replace a character code that cannot safely be put in a -% filename. Should we use %XX? - -replace(0'/) --> "-". % directory separator -replace(0'\\) --> "-". % not allowed in Windows filename -replace(0':) --> "-". % idem -replace(0'?) --> "-". % idem -replace(0'*) --> "-". % idem - - - /******************************* - * MESSAGES * - *******************************/ - -:- multifile prolog:message/3. - -prolog:message(rdf(cache_created(Dir))) --> - [ 'Created RDF cache directory ~w'-[Dir] ]. diff --git a/packages/semweb/rdf_compare.pl b/packages/semweb/rdf_compare.pl deleted file mode 100644 index 9ee542bd4..000000000 --- a/packages/semweb/rdf_compare.pl +++ /dev/null @@ -1,101 +0,0 @@ -/* Part of SWI-Prolog - - Author: Jan Wielemaker - E-mail: J.Wielemaker@uva.nl - WWW: http://www.swi-prolog.org - Copyright (C): 2009, University of Amsterdam - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - As a special exception, if you link this library with other files, - compiled with a Free Software compiler, to produce an executable, this - library does not by itself cause the resulting executable to be covered - by the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -:- module(rdf_compare, - [ rdf_equal_graphs/3 % +Graph1, +Graph2, -Substitutions - ]). -:- use_module(library(semweb/rdf_db)). -:- use_module(library(apply)). -:- use_module(library(debug)). - - -/** <module> Compare RDF graphs - -This library provides predicates that compare RDF graphs. The current -version only provides one predicate: rdf_equal_graphs/3 verifies that -two graphs are identical after proper labeling of the blank nodes. - -Future versions of this library may contain more advanced operations, -such as diffing two graphs. -*/ - - -%% rdf_equal_graphs(+GraphA, +GraphB, -Substition) is semidet. -% -% True if GraphA and GraphB are the same under Substition. -% Substition is a list of BNodeA = BNodeB, where BNodeA is a blank -% node that appears in GraphA and BNodeB is a blank node that -% appears in GraphB. -% -% @param GraphA is a list of rdf(S,P,O) terms -% @param GraphB is a list of rdf(S,P,O) terms -% @param Substition is a list if NodeA = NodeB terms. -% @tbd The current implementation is rather naive. After -% dealing with the subgraphs that contain no bnodes, -% it performs a fully non-deterministic substitution. - -rdf_equal_graphs(A, B, Substitutions) :- - sort(A, SA), - sort(B, SB), - partition(contains_bnodes, SA, VA, GA), - partition(contains_bnodes, SB, VB, GB), - GA == GB, - compare_list(VA, VB, [], Substitutions), !. - -contains_bnodes(rdf(S,P,O)) :- - ( node_id(S) - ; node_id(P) - ; node_id(O) - ), !. - -compare_list([], [], S, S). -compare_list([H1|T1], In2, S0, S) :- - select(H2, In2, T2), - compare_triple(H1, H2, S0, S1), - compare_list(T1, T2, S1, S). - -compare_triple(rdf(Subj1,P1,O1), rdf(Subj2, P2, O2), S0, S) :- - compare_field(Subj1, Subj2, S0, S1), - compare_field(P1, P2, S1, S2), - compare_field(O1, O2, S2, S). - -compare_field(X, X, S, S) :- !. -compare_field(literal(X), xml(X), S, S) :- !. % TBD -compare_field(X, Id, S, S) :- - memberchk(X=Id, S), !. -compare_field(X, Y, S, [X=Y|S]) :- - \+ memberchk(X=_, S), - node_id(X), - node_id(Y), - debug(rdf_compare, 'Assume ~w = ~w~n', [X, Y]). - -node_id(node(_)) :- !. -node_id(X) :- - rdf_is_bnode(X). - diff --git a/packages/semweb/rdf_db.c b/packages/semweb/rdf_db.c deleted file mode 100644 index 7055501a8..000000000 --- a/packages/semweb/rdf_db.c +++ /dev/null @@ -1,6708 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog - - Author: Jan Wielemaker - E-mail: J.Wielemaker@uva.nl - WWW: http://www.swi-prolog.org - Copyright (C): 1985-2009, University of Amsterdam - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#define WITH_MD5 1 -#define WITH_PL_MUTEX 1 -#define _GNU_SOURCE 1 /* get rwlocks from glibc */ - -#ifdef _REENTRANT -#ifdef __WINDOWS__ -#include <malloc.h> /* alloca() */ -#define inline __inline -#ifndef SIZEOF_LONG -#define SIZEOF_LONG 4 -#endif -#else -#if (!defined(__GNUC__) || defined(__hpux)) && defined(HAVE_ALLOCA_H) -#include <alloca.h> -#endif -#include <errno.h> -#endif -#endif - -#include <SWI-Stream.h> -#include <SWI-Prolog.h> -#include "rdf_db.h" -#include <assert.h> -#include <string.h> -#include <wchar.h> -#include <wctype.h> -#include <ctype.h> -#include "avl.h" -#ifdef WITH_MD5 -#include "md5.h" -#include "atom.h" -#include "debug.h" -#include "hash.h" -#include "murmur.h" - -#undef UNLOCK - -static void md5_triple(triple *t, md5_byte_t *digest); -static void sum_digest(md5_byte_t *digest, md5_byte_t *add); -static void dec_digest(md5_byte_t *digest, md5_byte_t *add); -#endif - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -The ids form a mask. This must be kept consistent with monitor_mask/2 in -rdf_db.pl! -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -typedef enum -{ EV_ASSERT = 0x0001, /* triple */ - EV_ASSERT_LOAD = 0x0002, /* triple */ - EV_RETRACT = 0x0004, /* triple */ - EV_UPDATE = 0x0008, /* old, new */ - EV_NEW_LITERAL = 0x0010, /* literal */ - EV_OLD_LITERAL = 0x0020, /* literal */ - EV_TRANSACTION = 0x0040, /* id, begin/end */ - EV_LOAD = 0x0080, /* id, begin/end */ - EV_REHASH = 0x0100 /* begin/end */ -} broadcast_id; - -static int broadcast(broadcast_id id, void *a1, void *a2); - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -We now use malloc/free/realloc calls with explicit sizes to allow -maintaining statistics as well as to prepare for dealing with special -memory pools associated with databases. Using -DDIRECT_MALLOC the -library uses plain malloc to facilitate malloc debuggers. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -#ifdef DIRECT_MALLOC - -#define rdf_malloc(db, size) malloc(size) -#define rdf_free(db, ptr, size) free(ptr) -#define rdf_realloc(db, ptr, old, new) realloc(ptr, new) - -#else /*DIRECT_MALLOC*/ - -#if CHECK_MALLOC_SIZES -static void * -rdf_malloc(rdf_db *db, size_t size) -{ size_t bytes = size + sizeof(size_t); - size_t *ptr = PL_malloc(bytes); - - *ptr++ = size; - if ( db ) - db->core += size; - - return ptr; -} - -static void -rdf_free(rdf_db *db, void *ptr, size_t size) -{ size_t *p = ptr; - - assert(p[-1] == size); - - db->core -= size; - PL_free(&p[-1]); -} - - -static void * -rdf_realloc(rdf_db *db, void *ptr, size_t old, size_t new) -{ size_t *p = ptr; - size_t bytes = new + sizeof(size_t); - - assert(p[-1] == old); - p = PL_realloc(&p[-1], bytes); - *p++ = new; - db->core< += new-old; - - return p; -} - -#else /*CHECK_MALLOC_SIZES*/ - -static void * -rdf_malloc(rdf_db *db, size_t size) -{ if ( db ) - db->core += size; - - return PL_malloc(size); -} - -static void -rdf_free(rdf_db *db, void *ptr, size_t size) -{ db->core -= size; - - PL_free(ptr); -} - - -static void * -rdf_realloc(rdf_db *db, void *ptr, size_t old, size_t new) -{ db->core += new-old; - - return PL_realloc(ptr, new); -} - -#endif /*CHECK_MALLOC_SIZES*/ -#endif /*DIRECT_MALLOC*/ - -static functor_t FUNCTOR_literal1; -static functor_t FUNCTOR_literal2; -static functor_t FUNCTOR_error2; -static functor_t FUNCTOR_type_error2; -static functor_t FUNCTOR_domain_error2; -static functor_t FUNCTOR_colon2; - -static functor_t FUNCTOR_triples1; -static functor_t FUNCTOR_triples2; -static functor_t FUNCTOR_subjects1; -static functor_t FUNCTOR_predicates1; -static functor_t FUNCTOR_duplicates1; -static functor_t FUNCTOR_literals1; -static functor_t FUNCTOR_subject1; -static functor_t FUNCTOR_predicate1; -static functor_t FUNCTOR_object1; -static functor_t FUNCTOR_graph1; -static functor_t FUNCTOR_indexed8; - -static functor_t FUNCTOR_exact1; -static functor_t FUNCTOR_plain1; -static functor_t FUNCTOR_substring1; -static functor_t FUNCTOR_word1; -static functor_t FUNCTOR_prefix1; -static functor_t FUNCTOR_like1; - -static functor_t FUNCTOR_symmetric1; -static functor_t FUNCTOR_inverse_of1; -static functor_t FUNCTOR_transitive1; -static functor_t FUNCTOR_rdf_subject_branch_factor1; /* S --> BF*O */ -static functor_t FUNCTOR_rdf_object_branch_factor1; /* O --> BF*S */ -static functor_t FUNCTOR_rdfs_subject_branch_factor1; /* S --> BF*O */ -static functor_t FUNCTOR_rdfs_object_branch_factor1; /* O --> BF*S */ - -static functor_t FUNCTOR_searched_nodes1; -static functor_t FUNCTOR_lang2; -static functor_t FUNCTOR_type2; - -static functor_t FUNCTOR_gc2; -static functor_t FUNCTOR_rehash2; -static functor_t FUNCTOR_core1; - -static functor_t FUNCTOR_assert4; -static functor_t FUNCTOR_retract4; -static functor_t FUNCTOR_update5; -static functor_t FUNCTOR_new_literal1; -static functor_t FUNCTOR_old_literal1; -static functor_t FUNCTOR_transaction2; -static functor_t FUNCTOR_load2; -static functor_t FUNCTOR_rehash1; -static functor_t FUNCTOR_begin1; -static functor_t FUNCTOR_end1; - -static atom_t ATOM_user; -static atom_t ATOM_exact; -static atom_t ATOM_plain; -static atom_t ATOM_prefix; -static atom_t ATOM_substring; -static atom_t ATOM_word; -static atom_t ATOM_like; -static atom_t ATOM_error; -static atom_t ATOM_begin; -static atom_t ATOM_end; -static atom_t ATOM_infinite; - -static atom_t ATOM_subPropertyOf; - -static predicate_t PRED_call1; - -#define MATCH_EXACT 0x01 /* exact triple match */ -#define MATCH_SUBPROPERTY 0x02 /* Use subPropertyOf relations */ -#define MATCH_SRC 0x04 /* Match graph location */ -#define MATCH_INVERSE 0x08 /* use symmetric match too */ -#define MATCH_QUAL 0x10 /* Match qualifiers too */ -#define MATCH_DUPLICATE (MATCH_EXACT|MATCH_QUAL) - -static int WANT_GC(rdf_db *db); -static int match_triples(triple *t, triple *p, unsigned flags); -static int update_duplicates_add(rdf_db *db, triple *t); -static void update_duplicates_del(rdf_db *db, triple *t); -static void unlock_atoms(triple *t); -static void lock_atoms(triple *t); -static void unlock_atoms_literal(literal *lit); -static int update_hash(rdf_db *db); -static int triple_hash(rdf_db *db, triple *t, int which); -static unsigned long object_hash(triple *t); -static void reset_db(rdf_db *db); - -static void record_transaction(rdf_db *db, - tr_type type, triple *t); -static void record_md5_transaction(rdf_db *db, - graph *src, md5_byte_t *digest); -static void create_reachability_matrix(rdf_db *db, predicate_cloud *cloud); -static int get_predicate(rdf_db *db, term_t t, predicate **p); -static predicate_cloud *new_predicate_cloud(rdf_db *db, predicate **p, size_t count); -static int unify_literal(term_t lit, literal *l); -static int check_predicate_cloud(predicate_cloud *c); - - - /******************************* - * LOCKING * - *******************************/ - -#define RDLOCK(db) rdlock(&db->lock) -#define WRLOCK(db, allowreaders) wrlock(&db->lock, allowreaders) -#define LOCKOUT_READERS(db) lockout_readers(&db->lock) -#define REALLOW_READERS(db) reallow_readers(&db->lock) -#define WRUNLOCK(db) unlock(&db->lock, FALSE) -#define RDUNLOCK(db) unlock(&db->lock, TRUE) -#define LOCK_MISC(db) lock_misc(&db->lock) -#define UNLOCK_MISC(db) unlock_misc(&db->lock) -#define INIT_LOCK(db) init_lock(&db->lock) - - - /******************************* - * ERRORS * - *******************************/ - -static int -instantiation_error(term_t actual) -{ term_t ex; - - if ( (ex = PL_new_term_ref()) && - PL_unify_term(ex, - PL_FUNCTOR, FUNCTOR_error2, - PL_CHARS, "instantiation_error", - PL_VARIABLE) ) - return PL_raise_exception(ex); - - return FALSE; -} - - -static int -type_error(term_t actual, const char *expected) -{ term_t ex; - - if ( (ex = PL_new_term_ref()) && - PL_unify_term(ex, - PL_FUNCTOR, FUNCTOR_error2, - PL_FUNCTOR, FUNCTOR_type_error2, - PL_CHARS, expected, - PL_TERM, actual, - PL_VARIABLE) ) - return PL_raise_exception(ex); - - return FALSE; -} - - -static int -domain_error(term_t actual, const char *expected) -{ term_t ex; - - if ( (ex = PL_new_term_ref()) && - PL_unify_term(ex, - PL_FUNCTOR, FUNCTOR_error2, - PL_FUNCTOR, FUNCTOR_domain_error2, - PL_CHARS, expected, - PL_TERM, actual, - PL_VARIABLE) ) - return PL_raise_exception(ex); - - return FALSE; -} - - -static int -permission_error(const char *op, const char *type, const char *obj, - const char *msg) -{ term_t ex, ctx; - - if ( !(ex = PL_new_term_ref()) || - !(ctx = PL_new_term_ref()) ) - return FALSE; - - if ( msg ) - { if ( !PL_unify_term(ctx, PL_FUNCTOR_CHARS, "context", 2, - PL_VARIABLE, - PL_CHARS, msg) ) - return FALSE; - } - - if ( !PL_unify_term(ex, PL_FUNCTOR_CHARS, "error", 2, - PL_FUNCTOR_CHARS, "permission_error", 3, - PL_CHARS, op, - PL_CHARS, type, - PL_CHARS, obj, - PL_TERM, ctx) ) - return FALSE; - - return PL_raise_exception(ex); -} - - -static int -get_atom_ex(term_t t, atom_t *a) -{ if ( PL_get_atom(t, a) ) - return TRUE; - - return type_error(t, "atom"); -} - - -static int -get_long_ex(term_t t, long *v) -{ if ( PL_get_long(t, v) ) - return TRUE; - - return type_error(t, "integer"); -} - - -static int -get_double_ex(term_t t, double *v) -{ if ( PL_get_float(t, v) ) - return TRUE; - - return type_error(t, "float"); -} - - -static int -get_atom_or_var_ex(term_t t, atom_t *a) -{ if ( PL_get_atom(t, a) ) - return TRUE; - if ( PL_is_variable(t) ) - { *a = 0L; - return TRUE; - } - - return type_error(t, "atom"); -} - - -static int -get_resource_or_var_ex(term_t t, atom_t *a) -{ if ( PL_get_atom(t, a) ) - return TRUE; - if ( PL_is_variable(t) ) - { *a = 0L; - return TRUE; - } - if ( PL_is_functor(t, FUNCTOR_literal1) ) - return FALSE; /* fail on rdf(literal(_), ...) */ - - return type_error(t, "atom"); -} - - -static int -get_bool_arg_ex(int a, term_t t, int *val) -{ term_t arg = PL_new_term_ref(); - - if ( !PL_get_arg(a, t, arg) ) - return type_error(t, "compound"); - if ( !PL_get_bool(arg, val) ) - return type_error(arg, "bool"); - - return TRUE; -} - - - - /******************************* - * DEBUG SUPPORT * - *******************************/ - -#ifdef O_DEBUG - -#define PRT_SRC 0x1 - -static void -print_literal(literal *lit) -{ switch(lit->objtype) - { case OBJ_STRING: - switch(lit->qualifier) - { case Q_TYPE: - Sdprintf("%s^^\"%s\"", - PL_atom_chars(lit->value.string), - PL_atom_chars(lit->type_or_lang)); - break; - case Q_LANG: - Sdprintf("%s@\"%s\"", - PL_atom_chars(lit->value.string), - PL_atom_chars(lit->type_or_lang)); - break; - default: - { size_t len; - const char *s; - const wchar_t *w; - - if ( (s = PL_atom_nchars(lit->value.string, &len)) ) - { if ( strlen(s) == len ) - Sdprintf("\"%s\"", s); - else - Sdprintf("\"%s\" (len=%d)", s, len); - } else if ( (w = PL_atom_wchars(lit->value.string, &len)) ) - { unsigned int i; - Sputc('L', Serror); - Sputc('"', Serror); - for(i=0; i<len; i++) - { if ( w[i] < 0x7f ) - Sputc(w[i], Serror); - else - Sfprintf(Serror, "\\\\u%04x", w[i]); - } - Sputc('"', Serror); - } - break; - } - } - break; - case OBJ_INTEGER: - Sdprintf("%ld", lit->value.integer); - break; - case OBJ_DOUBLE: - Sdprintf("%f", lit->value.real); - break; - case OBJ_TERM: - { fid_t fid = PL_open_foreign_frame(); - term_t term = PL_new_term_ref(); - - PL_recorded_external(lit->value.term.record, term); - PL_write_term(Serror, term, 1200, - PL_WRT_QUOTED|PL_WRT_NUMBERVARS|PL_WRT_PORTRAY); - PL_discard_foreign_frame(fid); - break; - } - default: - assert(0); - } -} - - -static void -print_object(triple *t) -{ if ( t->object_is_literal ) - { print_literal(t->object.literal); - } else - { Sdprintf("%s", PL_atom_chars(t->object.resource)); - } -} - - -static void -print_src(triple *t) -{ if ( t->line == NO_LINE ) - Sdprintf(" [%s]", PL_atom_chars(t->graph)); - else - Sdprintf(" [%s:%ld]", PL_atom_chars(t->graph), t->line); -} - - -static void -print_triple(triple *t, int flags) -{ Sdprintf("<%s %s ", - PL_atom_chars(t->subject), - PL_atom_chars(t->predicate.r->name)); - print_object(t); - if ( (flags & PRT_SRC) ) - print_src(t); - Sdprintf(">"); -} - -#endif - - /******************************* - * STORAGE * - *******************************/ - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Our one and only database (for the time being). -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -static rdf_db *DB; - - - /******************************* - * LISTS * - *******************************/ - -static int -add_list(rdf_db *db, list *list, void *value) -{ cell *c; - - for(c=list->head; c; c=c->next) - { if ( c->value == value ) - return FALSE; /* already a member */ - } - - c = rdf_malloc(db, sizeof(*c)); - c->value = value; - c->next = NULL; - - if ( list->tail ) - list->tail->next = c; - else - list->head = c; - - list->tail = c; - - return TRUE; -} - - -static int -del_list(rdf_db *db, list *list, void *value) -{ cell *c, *p = NULL; - - for(c=list->head; c; p=c, c=c->next) - { if ( c->value == value ) - { if ( p ) - p->next = c->next; - else - list->head = c->next; - - if ( !c->next ) - list->tail = p; - - rdf_free(db, c, sizeof(*c)); - - return TRUE; - } - } - - return FALSE; /* not a member */ -} - - -static void -free_list(rdf_db *db, list *list) -{ cell *c, *n; - - for(c=list->head; c; c=n) - { n = c->next; - rdf_free(db, c, sizeof(*c)); - } - - list->head = list->tail = NULL; -} - - - /******************************* - * ATOM SETS * - *******************************/ - - -#define CHUNKSIZE 1024 - -typedef struct mchunk -{ struct mchunk *next; - size_t used; - char buf[CHUNKSIZE]; -} mchunk; - -typedef struct -{ avl_tree tree; - mchunk *node_store; - mchunk store0; -} atomset; - - -static void * -alloc_node_atomset(void *ptr, size_t size) -{ void *p; - atomset *as = ptr; - - assert(size < CHUNKSIZE); - - if ( as->node_store->used + size > CHUNKSIZE ) - { mchunk *ch = malloc(sizeof(mchunk)); - - ch->used = 0; - ch->next = as->node_store; - as->node_store = ch; - } - - p = &as->node_store->buf[as->node_store->used]; - as->node_store->used += size; - - return p; -} - - -static void -free_node_atomset(void *ptr, void *data, size_t size) -{ assert(0); -} - - -static int -cmp_long_ptr(void *p1, void *p2, NODE type) -{ long *l1 = p1; - long *l2 = p2; - - return *l1 < *l2 ? -1 : *l1 > *l2 ? 1 : 0; -} - - -static void -init_atomset(atomset *as) -{ avlinit(&as->tree, as, sizeof(atom_t), - cmp_long_ptr, - NULL, - alloc_node_atomset, - free_node_atomset); - - as->node_store = &as->store0; - as->node_store->next = NULL; - as->node_store->used = 0; -} - - -static void -destroy_atomset(atomset *as) -{ mchunk *ch, *next; - - for(ch=as->node_store; ch != &as->store0; ch = next) - { next = ch->next; - free(ch); - } -} - - -static int -add_atomset(atomset *as, atom_t atom) -{ return avlins(&as->tree, &atom) ? FALSE : TRUE; -} - - - /******************************* - * PREDICATES * - *******************************/ - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Predicates are represented as first class citizens for three reasons: -quickly answer on the transitive rdfs:subPropertyOf relation for -rdf_hash/3, keep track of statistics that are useful for query -optimization (#triples, branching factor) and keep properties -(inverse/transitive). - -To answer the rdfs:subPropertyOf quickly, predicates are organised in -`clouds', where a cloud defines a set of predicates connected through -rdfs:subPropertyOf triples. The cloud numbers its members and maintains -a bit-matrix that contains the closure of the reachability. Initially a -predicate has a simple cloud of size 1. merge_clouds() and split_cloud() -deals with adding and deleting rdfs:subPropertyOf relations. These -operations try to modify the clouds that have no triples, so it can be -done without a rehash. If this fails, the predicates keep their own hash -to make search without rdfs:subPropertyOf still possible (so we can -avoid frequent updates while loading triples), sets the cloud `dirty' -flag and the DB's need_update flag. Queries that need rdfs:subPropertyOf -find the need_update flag, which calls organise_predicates(), which -cause a rehash if some predicates have changed hash-code to the new -cloud they have become part of. - -TBD: We can do a partial re-hash in that case! -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - - -static void -init_pred_table(rdf_db *db) -{ int bytes = sizeof(predicate*)*INITIAL_PREDICATE_TABLE_SIZE; - - db->pred_table = rdf_malloc(db, bytes); - memset(db->pred_table, 0, bytes); - db->pred_table_size = INITIAL_PREDICATE_TABLE_SIZE; -} - - -static predicate * -existing_predicate(rdf_db *db, atom_t name) -{ int hash = atom_hash(name) % db->pred_table_size; - predicate *p; - - LOCK_MISC(db); - for(p=db->pred_table[hash]; p; p = p->next) - { if ( p->name == name ) - { UNLOCK_MISC(db); - return p; - } - } - - UNLOCK_MISC(db); - return NULL; -} - - -static predicate * -lookup_predicate(rdf_db *db, atom_t name) -{ int hash = atom_hash(name) % db->pred_table_size; - predicate *p; - predicate_cloud *cp; - - LOCK_MISC(db); - for(p=db->pred_table[hash]; p; p = p->next) - { if ( p->name == name ) - { UNLOCK_MISC(db); - return p; - } - } - p = rdf_malloc(db, sizeof(*p)); - memset(p, 0, sizeof(*p)); - p->name = name; - cp = new_predicate_cloud(db, &p, 1); - p->hash = cp->hash; - PL_register_atom(name); - p->next = db->pred_table[hash]; - db->pred_table[hash] = p; - db->pred_count++; - DEBUG(5, Sdprintf("Pred %s (count = %d)\n", - PL_atom_chars(name), db->pred_count)); - UNLOCK_MISC(db); - - return p; -} - - -static const char * -pname(predicate *p) -{ if ( p->name ) - return PL_atom_chars(p->name); - else - { static char *ring[10]; - static int ri = 0; - char buf[25]; - char *r; - - Ssprintf(buf, "__D%p", p); - ring[ri++] = r = strdup(buf); - if ( ri == 10 ) - { ri = 0; - free(ring[ri]); - } - - return (const char*)r; - } -} - - -static int -organise_predicates(rdf_db *db) /* TBD: rename&move */ -{ predicate **ht; - int i; - int changed = 0; - - DEBUG(2, Sdprintf("rdf_db: fixing predicate clouds\n")); - - for(i=0,ht = db->pred_table; i<db->pred_table_size; i++, ht++) - { predicate *p; - - for( p = *ht; p; p = p->next ) - { predicate_cloud *cloud = p->cloud; - - if ( cloud->dirty ) - { predicate **cp; - int i2; - - for(i2=0, cp = cloud->members; i2 < cloud->size; i2++, cp++) - { if ( (*cp)->hash != cloud->hash ) - { (*cp)->hash = cloud->hash; - if ( (*cp)->triple_count > 0 ) - changed++; - } - } - cloud->dirty = FALSE; - } - } - } - - return changed; -} - - - /******************************* - * PREDICATE CLOUDS * - *******************************/ - -static predicate_cloud * -new_predicate_cloud(rdf_db *db, predicate **p, size_t count) -{ predicate_cloud *cloud = rdf_malloc(db, sizeof(*cloud)); - - memset(cloud, 0, sizeof(*cloud)); - cloud->hash = db->next_hash++; - if ( count ) - { int i; - predicate **p2; - - cloud->size = count; - cloud->members = rdf_malloc(db, sizeof(predicate*)*count); - memcpy(cloud->members, p, sizeof(predicate*)*count); - - for(i=0, p2=cloud->members; i<cloud->size; i++, p2++) - (*p2)->cloud = cloud; - } - create_reachability_matrix(db, cloud); - - return cloud; -} - - -static void -free_predicate_cloud(rdf_db *db, predicate_cloud *cloud) -{ if ( cloud->members ) - { rdf_free(db, cloud->members, sizeof(predicate*)*cloud->size); - } - - rdf_free(db, cloud, sizeof(*cloud)); -} - - -static long -triples_in_predicate_cloud(predicate_cloud *cloud) -{ long triples = 0; - predicate **p; - int i; - - for(i=0, p=cloud->members; i<cloud->size; i++, p++) - triples += (*p)->triple_count; - - return triples; -} - - -/* Add the predicates of c2 to c1 and destroy c2. Returns c1 */ - -static predicate_cloud * -append_clouds(rdf_db *db, predicate_cloud *c1, predicate_cloud *c2, int update_hash) -{ predicate **p; - int i; - - for(i=0, p=c2->members; i<c2->size; i++, p++) - { (*p)->cloud = c1; - if ( update_hash ) - (*p)->hash = c1->hash; - } - - if ( c1->size > 0 && c2->size > 0 ) - { c1->members = rdf_realloc(db, c1->members, - c1->size*sizeof(predicate*), - (c1->size+c2->size)*sizeof(predicate*)); - memcpy(&c1->members[c1->size], c2->members, c2->size*sizeof(predicate*)); - c1->size += c2->size; - free_predicate_cloud(db, c2); - } else if ( c2->size > 0 ) - { c1->members = c2->members; - c1->size = c2->size; - c2->members = NULL; - free_predicate_cloud(db, c2); - } else - { free_predicate_cloud(db, c2); - } - - return c1; -} - - -/* merge two predicate clouds. If either of them has no triples we - can do the merge without rehashing the database. Note that this - code is only called from addSubPropertyOf(). If c1==c2, we added - an rdfs:subPropertyOf between two predicates in the same cloud. - we must still update the matrix, though we could do it a bit more - efficient. I doubt this is worth the trouble though. -*/ - -static predicate_cloud * -merge_clouds(rdf_db *db, predicate_cloud *c1, predicate_cloud *c2) -{ predicate_cloud *cloud; - - if ( c1 != c2 ) - { if ( triples_in_predicate_cloud(c1) == 0 ) - { cloud = append_clouds(db, c2, c1, TRUE); - } else if ( triples_in_predicate_cloud(c2) == 0 ) - { cloud = append_clouds(db, c1, c2, TRUE); - } else - { cloud = append_clouds(db, c1, c2, FALSE); - cloud->dirty = TRUE; - db->need_update++; - } - } else - { cloud = c1; - } - - DEBUG(1, if ( !db->need_update ) - { check_predicate_cloud(cloud); - }); - - create_reachability_matrix(db, cloud); - - return cloud; -} - - -/* split a cloud into multiple disjoint clouds. The first cloud is - given the hash of the original, so we only need to update if new - clouds are created. Ideally we should se whether it is possible - to give the orginal hash to the one and only non-empty cloud to - avoid re-hashing alltogether. -*/ - -static void -pred_reachable(predicate *start, char *visited, predicate **nodes, int *size) -{ if ( !visited[start->label] ) - { cell *c; - - visited[start->label] = TRUE; - nodes[(*size)++] = start; - for(c=start->subPropertyOf.head; c; c=c->next) - pred_reachable(c->value, visited, nodes, size); - for(c=start->siblings.head; c; c=c->next) - pred_reachable(c->value, visited, nodes, size); - } -} - - -static int -split_cloud(rdf_db *db, predicate_cloud *cloud, - predicate_cloud **parts, int size) -{ char *done = alloca(cloud->size*sizeof(char)); - predicate **graph = alloca(cloud->size*sizeof(predicate*)); - int found = 0; - int i; - - memset(done, 0, cloud->size*sizeof(char)); - for(i=0; i<cloud->size; i++) - { if ( !done[i] ) - { predicate *start = cloud->members[i]; - predicate_cloud *new_cloud; - int gsize = 0; - - pred_reachable(start, done, graph, &gsize); - new_cloud = new_predicate_cloud(db, graph, gsize); - if ( found == 0 ) - { new_cloud->hash = cloud->hash; - } else - { new_cloud->dirty = TRUE; /* preds come from another cloud */ - db->need_update++; - } - parts[found++] = new_cloud; - } - } - - free_predicate_cloud(db, cloud); - - return found; -} - - -static unsigned long -predicate_hash(predicate *p) -{ return p->hash; -} - - -static void -addSubPropertyOf(rdf_db *db, predicate *sub, predicate *super) -{ /*DEBUG(2, Sdprintf("addSubPropertyOf(%s, %s)\n", pname(sub), pname(super)));*/ - - if ( add_list(db, &sub->subPropertyOf, super) ) - { add_list(db, &super->siblings, sub); - merge_clouds(db, sub->cloud, super->cloud); - } -} - - -/* deleting an rdfs:subPropertyOf. This is a bit naughty. If the - cloud is still connected we only need to refresh the reachability - matrix. Otherwise the cloud breaks in maximum two clusters. We - can decide to leave it as is, which saves a re-hash of the triples - but harms indexing. Alternative we can create a new cloud for one - of the clusters and re-hash. -*/ - -static void -delSubPropertyOf(rdf_db *db, predicate *sub, predicate *super) -{ if ( del_list(db, &sub->subPropertyOf, super) ) - { del_list(db, &super->siblings, sub); - /* if ( not worth the trouble ) - create_reachability_matrix(db, sub->cloud); - else */ - { predicate_cloud *parts[2]; - split_cloud(db, sub->cloud, parts, 2); - } - } -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Reachability matrix. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -#define WBITSIZE (sizeof(int)*8) - -static size_t -byte_size_bitmatrix(size_t w, size_t h) -{ size_t wsize = ((w*h)+WBITSIZE-1)/WBITSIZE; - - return (size_t)(intptr_t)&((bitmatrix*)NULL)->bits[wsize]; -} - - -static bitmatrix * -alloc_bitmatrix(rdf_db *db, size_t w, size_t h) -{ size_t size = byte_size_bitmatrix(w, h); - bitmatrix *m = rdf_malloc(db, size); - - memset(m, 0, size); - m->width = w; - m->heigth = h; - - return m; -} - - -static void -free_bitmatrix(rdf_db *db, bitmatrix *bm) -{ size_t size = byte_size_bitmatrix(bm->width, bm->heigth); - - rdf_free(db, bm, size); -} - - -#undef setbit /* conflict in HPUX 11.23 */ - -static void -setbit(bitmatrix *m, int i, int j) -{ size_t ij = m->width*i+j; - size_t word = ij/WBITSIZE; - int bit = ij%WBITSIZE; - - m->bits[word] |= 1<<bit; -} - - -static int -testbit(bitmatrix *m, int i, int j) -{ size_t ij = m->width*i+j; - size_t word = ij/WBITSIZE; - int bit = ij%WBITSIZE; - - return ((m->bits[word] & (1<<bit)) != 0); -} - - -static int -label_predicate_cloud(predicate_cloud *cloud) -{ predicate **p; - int i; - - for(i=0, p=cloud->members; i<cloud->size; i++, p++) - (*p)->label = i; - - return i; -} - - -static void -fill_reachable(bitmatrix *bm, predicate *p0, predicate *p) -{ if ( !testbit(bm, p0->label, p->label) ) - { cell *c; - - DEBUG(1, Sdprintf(" Reachable [%s (%d)]\n", pname(p), p->label)); - setbit(bm, p0->label, p->label); - for(c = p->subPropertyOf.head; c; c=c->next) - fill_reachable(bm, p0, c->value); - } -} - - -static void -create_reachability_matrix(rdf_db *db, predicate_cloud *cloud) -{ bitmatrix *m = alloc_bitmatrix(db, cloud->size, cloud->size); - predicate **p; - int i; - - label_predicate_cloud(cloud); - for(i=0, p=cloud->members; i<cloud->size; i++, p++) - { DEBUG(1, Sdprintf("Reachability for %s (%d)\n", pname(*p), (*p)->label)); - - fill_reachable(m, *p, *p); - } - - if ( cloud->reachable ) - free_bitmatrix(db, cloud->reachable); - - cloud->reachable = m; -} - - -static int -isSubPropertyOf(predicate *sub, predicate *p) -{ if ( sub->cloud == p->cloud ) - return testbit(sub->cloud->reachable, sub->label, p->label); - - return FALSE; -} - - /******************************* - * PRINT PREDICATE HIERARCHY * - *******************************/ - -static int -check_predicate_cloud(predicate_cloud *c) -{ predicate **p; - int errors = 0; - int i; - - DEBUG(1, if ( c->dirty ) Sdprintf("Cloud is dirty\n")); - - for(i=0, p=c->members; i<c->size; i++, p++) - { if ( !c->dirty ) - { if ( (*p)->hash != c->hash ) - { Sdprintf("Hash of %s doesn't match cloud hash\n", pname(*p)); - errors++; - } - } - if ( (*p)->cloud != c ) - { Sdprintf("Wrong cloud of %s\n", pname(*p)); - errors++; - } - } - - return errors; -} - - -static void -print_reachability_cloud(predicate *p) -{ int x, y; - predicate_cloud *cloud = p->cloud; - - check_predicate_cloud(cloud); - - Sdprintf("Reachability matrix:\n"); - for(x=0; x<cloud->reachable->width; x++) - Sdprintf("%d", x%10); - Sdprintf("\n"); - for(y=0; y<cloud->reachable->heigth; y++) - { for(x=0; x<cloud->reachable->width; x++) - { if ( testbit(cloud->reachable, x, y) ) - Sdprintf("X"); - else - Sdprintf("."); - } - - Sdprintf(" %2d %s\n", y, PL_atom_chars(cloud->members[y]->name)); - assert(cloud->members[y]->label == y); - } -} - - -static foreign_t -rdf_print_predicate_cloud(term_t t) -{ predicate *p; - rdf_db *db = DB; - - if ( !get_predicate(db, t, &p) ) - return FALSE; - - print_reachability_cloud(p); - - return TRUE; -} - - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Branching factors are crucial in ordering the statements of a -conjunction. These functions compute the average branching factor in -both directions ("subject --> P --> object" and "object --> P --> -subject") by determining the number of unique values at either side of -the predicate. This number is only recomputed if it is considered -`dirty'. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -static int -update_predicate_counts(rdf_db *db, predicate *p, int which) -{ long total = 0; - - if ( which == DISTINCT_DIRECT ) - { long changed = abs(p->triple_count - p->distinct_updated[DISTINCT_DIRECT]); - - if ( changed < p->distinct_updated[DISTINCT_DIRECT] ) - return TRUE; - - if ( p->triple_count == 0 ) - { p->distinct_count[which] = 0; - p->distinct_subjects[which] = 0; - p->distinct_objects[which] = 0; - - return TRUE; - } - } else - { long changed = db->generation - p->distinct_updated[DISTINCT_SUB]; - - if ( changed < p->distinct_count[DISTINCT_SUB] ) - return TRUE; - } - - if ( !update_hash(db) ) - return FALSE; - - { atomset subject_set; - atomset object_set; - triple t; - triple *byp; - - memset(&t, 0, sizeof(t)); - t.predicate.r = p; - t.indexed |= BY_P; - - init_atomset(&subject_set); - init_atomset(&object_set); - for(byp = db->table[t.indexed][triple_hash(db, &t, t.indexed)]; - byp; - byp = byp->next[t.indexed]) - { if ( !byp->erased && !byp->is_duplicate ) - { if ( (which == DISTINCT_DIRECT && byp->predicate.r == p) || - (which != DISTINCT_DIRECT && isSubPropertyOf(byp->predicate.r, p)) ) - { total++; - add_atomset(&subject_set, byp->subject); - add_atomset(&object_set, object_hash(byp)); /* NOTE: not exact! */ - } - } - } - - p->distinct_count[which] = total; - p->distinct_subjects[which] = subject_set.tree.count; - p->distinct_objects[which] = object_set.tree.count; - - destroy_atomset(&subject_set); - destroy_atomset(&object_set); - - if ( which == DISTINCT_DIRECT ) - p->distinct_updated[DISTINCT_DIRECT] = total; - else - p->distinct_updated[DISTINCT_SUB] = db->generation; - - DEBUG(1, Sdprintf("%s: distinct subjects (%s): %ld, objects: %ld\n", - PL_atom_chars(p->name), - (which == DISTINCT_DIRECT ? "rdf" : "rdfs"), - p->distinct_subjects[which], - p->distinct_objects[which])); - } - - return TRUE; -} - - -static void -invalidate_distinct_counts(rdf_db *db) -{ predicate **ht; - int i; - - for(i=0,ht = db->pred_table; i<db->pred_table_size; i++, ht++) - { predicate *p; - - for( p = *ht; p; p = p->next ) - { p->distinct_updated[DISTINCT_SUB] = 0; - p->distinct_count[DISTINCT_SUB] = 0; - p->distinct_subjects[DISTINCT_SUB] = 0; - p->distinct_objects[DISTINCT_SUB] = 0; - } - } -} - - -static double -subject_branch_factor(rdf_db *db, predicate *p, int which) -{ if ( !update_predicate_counts(db, p, which) ) - return FALSE; - - if ( p->distinct_subjects[which] == 0 ) - return 0.0; /* 0 --> 0 */ - - return (double)p->distinct_count[which] / - (double)p->distinct_subjects[which]; -} - - -static double -object_branch_factor(rdf_db *db, predicate *p, int which) -{ if ( !update_predicate_counts(db, p, which) ) - return FALSE; - - if ( p->distinct_objects[which] == 0 ) - return 0.0; /* 0 --> 0 */ - - return (double)p->distinct_count[which] / - (double)p->distinct_objects[which]; -} - - - - - /******************************* - * NAMED GRAPHS * - *******************************/ - -/* MT: all calls must be locked -*/ - -static void -init_graph_table(rdf_db *db) -{ int bytes = sizeof(predicate*)*INITIAL_GRAPH_TABLE_SIZE; - - db->graph_table = rdf_malloc(db, bytes); - memset(db->graph_table, 0, bytes); - db->graph_table_size = INITIAL_GRAPH_TABLE_SIZE; -} - - -static graph * -lookup_graph(rdf_db *db, atom_t name, int create) -{ int hash = atom_hash(name) % db->graph_table_size; - graph *src; - - LOCK_MISC(db); - for(src=db->graph_table[hash]; src; src = src->next) - { if ( src->name == name ) - { UNLOCK_MISC(db); - return src; - } - } - - if ( !create ) - { UNLOCK_MISC(db); - return NULL; - } - - src = rdf_malloc(db, sizeof(*src)); - memset(src, 0, sizeof(*src)); - src->name = name; - src->md5 = TRUE; - PL_register_atom(name); - src->next = db->graph_table[hash]; - db->graph_table[hash] = src; - UNLOCK_MISC(db); - - return src; -} - - -static void -erase_graphs(rdf_db *db) -{ graph **ht; - int i; - - for(i=0,ht = db->graph_table; i<db->graph_table_size; i++, ht++) - { graph *src, *n; - - for( src = *ht; src; src = n ) - { n = src->next; - - PL_unregister_atom(src->name); - if ( src->source ) - PL_unregister_atom(src->source); - rdf_free(db, src, sizeof(*src)); - } - - *ht = NULL; - } - - db->last_graph = NULL; -} - - -static void -register_graph(rdf_db *db, triple *t) -{ graph *src; - - if ( !t->graph ) - return; - - if ( db->last_graph && db->last_graph->name == t->graph ) - { src = db->last_graph; - } else - { src = lookup_graph(db, t->graph, TRUE); - db->last_graph = src; - } - - src->triple_count++; -#ifdef WITH_MD5 - if ( src->md5 ) - { md5_byte_t digest[16]; - md5_triple(t, digest); - sum_digest(src->digest, digest); - } -#endif -} - - -static void -unregister_graph(rdf_db *db, triple *t) -{ graph *src; - - if ( !t->graph ) - return; - - if ( db->last_graph && db->last_graph->name == t->graph ) - { src = db->last_graph; - } else - { src = lookup_graph(db, t->graph, TRUE); - db->last_graph = src; - } - - src->triple_count--; -#ifdef WITH_MD5 - if ( src->md5 ) - { md5_byte_t digest[16]; - md5_triple(t, digest); - dec_digest(src->digest, digest); - } -#endif -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -rdf_graphs_(-ListOfGraphs) - -Return a list holding the names of all currently defined graphs. We -return a list to avoid the need for complicated long locks. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -static foreign_t -rdf_graphs(term_t list) -{ int i; - term_t tail = PL_copy_term_ref(list); - term_t head = PL_new_term_ref(); - rdf_db *db = DB; - - if ( !RDLOCK(db) ) - return FALSE; - for(i=0; i<db->graph_table_size; i++) - { graph *src; - - for(src=db->graph_table[i]; src; src = src->next) - { if ( !PL_unify_list(tail, head, tail) || - !PL_unify_atom(head, src->name) ) - { RDUNLOCK(db); - return FALSE; - } - } - } - RDUNLOCK(db); - - return PL_unify_nil(tail); -} - - -static foreign_t -rdf_graph_source(term_t graph_name, term_t source, term_t modified) -{ atom_t gn; - int rc = FALSE; - rdf_db *db = DB; - - if ( !get_atom_or_var_ex(graph_name, &gn) ) - return FALSE; - - if ( gn ) - { graph *s; - - if ( !RDLOCK(db) ) - return FALSE; - if ( (s = lookup_graph(db, gn, FALSE)) && s->source) - { rc = ( PL_unify_atom(source, s->source) && - PL_unify_float(modified, s->modified) ); - } - RDUNLOCK(db); - } else - { atom_t src; - - if ( get_atom_ex(source, &src) ) - { int i; - graph **ht; - - if ( !RDLOCK(db) ) - return FALSE; - - for(i=0,ht = db->graph_table; i<db->graph_table_size; i++, ht++) - { graph *s; - - for( s = *ht; s; s = s->next ) - { if ( s->source == src ) - { rc = ( PL_unify_atom(graph_name, s->name) && - PL_unify_float(modified, s->modified) ); - } - } - } - - RDUNLOCK(db); - } - } - - return rc; -} - - -static foreign_t -rdf_set_graph_source(term_t graph_name, term_t source, term_t modified) -{ atom_t gn, src; - int rc = FALSE; - rdf_db *db = DB; - graph *s; - double mtime; - - if ( !get_atom_ex(graph_name, &gn) || - !get_atom_ex(source, &src) || - !get_double_ex(modified, &mtime) ) - return FALSE; - - if ( !RDLOCK(db) ) - return FALSE; - if ( (s = lookup_graph(db, gn, TRUE)) ) - { if ( s->source != src ) - { if ( s->source ) - PL_unregister_atom(s->source); - s->source = src; - PL_register_atom(s->source); - } - s->modified = mtime; - rc = TRUE; - } - RDUNLOCK(db); - - return rc; -} - - -static foreign_t -rdf_unset_graph_source(term_t graph_name) -{ atom_t gn; - rdf_db *db = DB; - graph *s; - - if ( !get_atom_ex(graph_name, &gn) ) - return FALSE; - if ( (s = lookup_graph(db, gn, TRUE)) ) - { if ( s->source ) - { PL_unregister_atom(s->source); - s->source = 0; - } - s->modified = 0.0; - } - if ( !RDLOCK(db) ) - return FALSE; - - RDUNLOCK(db); - - return TRUE; -} - - - - /******************************* - * LITERALS * - *******************************/ - -#define LITERAL_EX_MAGIC 0x2b97e881 - -typedef struct literal_ex -{ literal *literal; - atom_info atom; -#ifdef O_SECURE - long magic; -#endif -} literal_ex; - - -static inline void -prepare_literal_ex(literal_ex *lex) -{ SECURE(lex->magic = 0x2b97e881); - - if ( lex->literal->objtype == OBJ_STRING ) - { lex->atom.handle = lex->literal->value.string; - lex->atom.resolved = FALSE; - } -} - - -static literal * -new_literal(rdf_db *db) -{ literal *lit = rdf_malloc(db, sizeof(*lit)); - memset(lit, 0, sizeof(*lit)); - lit->references = 1; - - return lit; -} - - -static void -free_literal(rdf_db *db, literal *lit) -{ if ( --lit->references == 0 ) - { unlock_atoms_literal(lit); - - if ( lit->shared && !db->resetting ) - { literal_ex lex; - - lit->shared = FALSE; - broadcast(EV_OLD_LITERAL, lit, NULL); - DEBUG(2, - Sdprintf("Delete %p from literal table: ", lit); - print_literal(lit); - Sdprintf("\n")); - - lex.literal = lit; - prepare_literal_ex(&lex); - - if ( !avldel(&db->literals, &lex) ) - { Sdprintf("Failed to delete %p (size=%ld): ", lit, db->literals.count); - print_literal(lit); - Sdprintf("\n"); - assert(0); - } - } - - if ( lit->objtype == OBJ_TERM && - lit->value.term.record ) - { if ( lit->term_loaded ) - rdf_free(db, lit->value.term.record, lit->value.term.len); - else - PL_erase_external(lit->value.term.record); - } - rdf_free(db, lit, sizeof(*lit)); - } -} - - -static literal * -copy_literal(rdf_db *db, literal *lit) -{ lit->references++; - return lit; -} - - -static void -alloc_literal_triple(rdf_db *db, triple *t) -{ if ( !t->object_is_literal ) - { t->object.literal = new_literal(db); - t->object_is_literal = TRUE; - } -} - - -static void -lock_atoms_literal(literal *lit) -{ if ( !lit->atoms_locked ) - { lit->atoms_locked = TRUE; - - switch(lit->objtype) - { case OBJ_STRING: - PL_register_atom(lit->value.string); - if ( lit->qualifier ) - PL_register_atom(lit->type_or_lang); - break; - } - } -} - - -static void -unlock_atoms_literal(literal *lit) -{ if ( lit->atoms_locked ) - { lit->atoms_locked = FALSE; - - switch(lit->objtype) - { case OBJ_STRING: - PL_unregister_atom(lit->value.string); - if ( lit->qualifier ) - PL_unregister_atom(lit->type_or_lang); - break; - } - } -} - - - /******************************* - * LITERAL DB * - *******************************/ - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -compare_literals() sorts literals. Ordering is defined as: - - * Numeric literals < string literals < term literals - * Numeric literals (int and float) are sorted by value - * String literals are sorted alhabetically - - case independent, but uppercase before lowercase - - locale (strcoll) sorting? - - delete dyadrics - - first on string, then on type, then on language - * Terms are sorted on Prolog standard order of terms -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -static int -compare_literals(void *p1, void *p2, NODE type) -{ literal_ex *lex = p1; - literal *l1 = lex->literal; - literal *l2 = *(literal**)p2; - - SECURE(assert(lex->magic == LITERAL_EX_MAGIC)); - - if ( l1->objtype == l2->objtype ) - { switch(l1->objtype) - { case OBJ_INTEGER: - { int64_t v1 = l1->value.integer; - int64_t v2 = l2->value.integer; - return v1 < v2 ? -1 : v1 > v2 ? 1 : 0; - } - case OBJ_DOUBLE: - { double v1 = l1->value.real; - double v2 = l2->value.real; - return v1 < v2 ? -1 : v1 > v2 ? 1 : 0; - } - case OBJ_STRING: - { int rc = cmp_atom_info(&lex->atom, l2->value.string); - - if ( rc == 0 ) - { if ( l1->qualifier == l2->qualifier ) - return cmp_atoms(l1->type_or_lang, l2->type_or_lang); - return l1->qualifier - l2->qualifier; - } - return rc; - } - case OBJ_TERM: - { fid_t fid = PL_open_foreign_frame(); - term_t t1 = PL_new_term_ref(); - term_t t2 = PL_new_term_ref(); - int rc; - - PL_recorded_external(l1->value.term.record, t1); /* can also be handled in literal_ex */ - PL_recorded_external(l2->value.term.record, t2); - rc = PL_compare(t1, t2); - - PL_discard_foreign_frame(fid); - return rc; - } - default: - assert(0); - return 0; - } - } else if ( l1->objtype == OBJ_INTEGER && l2->objtype == OBJ_DOUBLE ) - { double v1 = (double)l1->value.integer; - double v2 = l2->value.real; - return v1 < v2 ? -1 : v1 > v2 ? 1 : -1; - } else if ( l1->objtype == OBJ_DOUBLE && l2->objtype == OBJ_INTEGER ) - { double v1 = l1->value.real; - double v2 = (double)l2->value.integer; - return v1 < v2 ? -1 : v1 > v2 ? 1 : 1; - } else - { return l1->objtype - l2->objtype; - } -} - - -static void* -avl_malloc(void *ptr, size_t size) -{ return rdf_malloc(ptr, size); -} - - -static void -avl_free(void *ptr, void *data, size_t size) -{ rdf_free(ptr, data, size); -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Create the sorted literal tree. Note that we do not register a free -handler for the tree as nodes are either already destroyed by -free_literal() or by rdf_reset_db(). -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -static void -init_literal_table(rdf_db *db) -{ avlinit(&db->literals, - db, sizeof(literal*), - compare_literals, - NULL, - avl_malloc, - avl_free); -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -share_literal() takes a literal and replaces it with one from the -literal database if there is a match. On a match, the argument literal -is destroyed. Without a match it adds the literal to the database and -returns it. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -static literal * -share_literal(rdf_db *db, literal *from) -{ literal **data; - literal_ex lex; - - lex.literal = from; - prepare_literal_ex(&lex); - - if ( (data = avlins(&db->literals, &lex)) ) - { literal *l2 = *data; - - DEBUG(2, - Sdprintf("Replace %p by %p:\n", from, l2); - Sdprintf("\tfrom: "); print_literal(from); - Sdprintf("\n\tto: "); print_literal(l2); - Sdprintf("\n")); - - l2->references++; - free_literal(db, from); - - return l2; - } else - { DEBUG(2, - Sdprintf("Insert %p into literal table: ", from); - print_literal(from); - Sdprintf("\n")); - - from->shared = TRUE; - broadcast(EV_NEW_LITERAL, from, NULL); - return from; - } -} - - -#ifdef O_SECURE -static literal ** -add_literals(AVLtree node, literal **p) -{ literal **litp; - - if ( node->subtree[LEFT] ) - p = add_literals(node->subtree[LEFT], p); - litp = (literal**)node->data; - *p++ = *litp; - if ( node->subtree[RIGHT] ) - p = add_literals(node->subtree[RIGHT], p); - - return p; -} - - -static foreign_t -check_transitivity() -{ rdf_db *db = DB; - literal **array = malloc(sizeof(literal*)*db->literals.count); - literal **p = array; - int i,j; - - add_literals(db->literals.root, p); - Sdprintf("Checking %ld literals ...\n", db->literals.count); - - for(i=0; i<db->literals.count; i++) - { int end; - - Sdprintf("\r%6ld", i); - end = i+100; - if ( end > db->literals.count ) - end = db->literals.count; - - for(j=i+1; j<end; j++) - { literal_ex lex; - - lex.literal = &array[i]; - prepare_literal_ex(&lex); - - if ( compare_literals(&lex, &array[j], IS_NULL) >= 0 ) - { Sdprintf("\nERROR: i,j=%d,%d: ", i, j); - print_literal(array[i]); - Sdprintf(" >= "); - print_literal(array[j]); - Sdprintf("\n"); - } - } - } - - free(array); - - return TRUE; -} - - -static void -dump_lnode(AVLtree node) -{ literal **litp; - - if ( node->subtree[LEFT] ) - dump_lnode(node->subtree[LEFT]); - litp = (literal**)node->data; - print_literal(*litp); - Sdprintf("\n"); - if ( node->subtree[RIGHT] ) - dump_lnode(node->subtree[RIGHT]); -} - -static foreign_t -dump_literals() -{ rdf_db *db = DB; - - dump_lnode(db->literals.root); - return TRUE; -} -#endif - - - - /******************************* - * TRIPLES * - *******************************/ - -static void -init_tables(rdf_db *db) -{ int i; - int bytes = sizeof(triple*)*INITIAL_TABLE_SIZE; - int cbytes = sizeof(int)*INITIAL_TABLE_SIZE; - - db->table[0] = &db->by_none; - db->tail[0] = &db->by_none_tail; - - for(i=BY_S; i<=BY_OP; i++) - { if ( i == BY_SO ) - continue; - - db->table[i] = rdf_malloc(db, bytes); - memset(db->table[i], 0, bytes); - db->tail[i] = rdf_malloc(db, bytes); - memset(db->tail[i], 0, bytes); - db->counts[i] = rdf_malloc(db, cbytes); - memset(db->counts[i], 0, cbytes); - db->table_size[i] = INITIAL_TABLE_SIZE; - } - - init_pred_table(db); - init_graph_table(db); - init_literal_table(db); -} - - -static rdf_db * -new_db() -{ rdf_db *db = rdf_malloc(NULL, sizeof(*db)); - - memset(db, 0, sizeof(*db)); - INIT_LOCK(db); - init_tables(db); - - return db; -} - - -static triple * -new_triple(rdf_db *db) -{ triple *t = rdf_malloc(db, sizeof(*t)); - memset(t, 0, sizeof(*t)); - t->allocated = TRUE; - - return t; -} - - -static void -free_triple(rdf_db *db, triple *t) -{ unlock_atoms(t); - - if ( t->object_is_literal && t->object.literal ) - free_literal(db, t->object.literal); - - if ( t->allocated ) - rdf_free(db, t, sizeof(*t)); -} - - -#define HASHED 0x80000000 - -static unsigned int -literal_hash(literal *lit) -{ if ( lit->hash & HASHED ) - { return lit->hash; - } else - { unsigned int hash; - - switch(lit->objtype) - { case OBJ_STRING: - hash = atom_hash_case(lit->value.string); - break; - case OBJ_INTEGER: - case OBJ_DOUBLE: - hash = rdf_murmer_hash(&lit->value.integer, - sizeof(lit->value.integer), - MURMUR_SEED); - break; - case OBJ_TERM: - hash = rdf_murmer_hash(lit->value.term.record, - (int)lit->value.term.len, - MURMUR_SEED); - break; - default: - assert(0); - return 0; - } - - lit->hash = (hash | HASHED); - return lit->hash; - } -} - - -static unsigned long -object_hash(triple *t) -{ if ( t->object_is_literal ) - { return literal_hash(t->object.literal); - } else - { return atom_hash(t->object.resource); - } -} - - -static int -triple_hash(rdf_db *db, triple *t, int which) -{ unsigned long v; - - switch(which) - { case BY_NONE: - return 0; - case BY_S: - v = atom_hash(t->subject); - break; - case BY_P: - v = predicate_hash(t->predicate.r); - break; - case BY_O: - v = object_hash(t); - break; - case BY_SP: - v = atom_hash(t->subject) ^ predicate_hash(t->predicate.r); - break; - case BY_OP: - v = predicate_hash(t->predicate.r) ^ object_hash(t); - break; - default: - v = 0; /* make compiler silent */ - assert(0); - } - - return (int)(v % (long)db->table_size[which]); -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -by_inverse[] returns the index key to use for inverse search as needed -to realise symmetric and inverse predicates. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -static int by_inverse[8] = -{ BY_NONE, /* BY_NONE = 0 */ - BY_O, /* BY_S = 1 */ - BY_P, /* BY_P = 2 */ - BY_OP, /* BY_SP = 3 */ - BY_S, /* BY_O = 4 */ - BY_SO, /* BY_SO = 5 */ - BY_SP, /* BY_OP = 6 */ - BY_SPO, /* BY_SPO = 7 */ -}; - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -triple *first(atom_t subject) - Find the first triple on subject. The first is marked to generate a - unique subjects quickly; -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -static triple * -first(rdf_db *db, atom_t subject) -{ triple *t, tmp; - int hash; - - tmp.subject = subject; - hash = triple_hash(db, &tmp, BY_S); - - for(t=db->table[BY_S][hash]; t; t = t->next[BY_S]) - { if ( t->subject == subject && !t->erased ) - return t; - } - - return NULL; -} - - -static void -link_triple_hash(rdf_db *db, triple *t) -{ int i; - - for(i=1; i<=BY_OP; i++) - { if ( db->table[i] ) - { int hash = triple_hash(db, t, i); - - if ( db->tail[i][hash] ) - { db->tail[i][hash]->next[i] = t; - } else - { db->table[i][hash] = t; - } - db->tail[i][hash] = t; - db->counts[i][hash]++; - } - } -} - - -typedef enum -{ DUP_NONE, - DUP_DUPLICATE, - DUP_DISCARDED -} dub_state; - - -static dub_state -discard_duplicate(rdf_db *db, triple *t) -{ triple *d; - const int indexed = BY_SP; - dub_state rc = DUP_NONE; - - assert(t->is_duplicate == FALSE); - assert(t->duplicates == 0); - - if ( WANT_GC(db) ) /* (*) See above */ - update_hash(db); - d = db->table[indexed][triple_hash(db, t, indexed)]; - for( ; d && d != t; d = d->next[indexed] ) - { if ( match_triples(d, t, MATCH_DUPLICATE) ) - { if ( d->graph == t->graph && - (d->line == NO_LINE || d->line == t->line) ) - { free_triple(db, t); - - return DUP_DISCARDED; - } - - rc = DUP_DUPLICATE; - } - } - - return rc; -} - - -/* MT: must be locked by caller */ - -static int -link_triple_silent(rdf_db *db, triple *t) -{ triple *one; - dub_state dup; - - if ( t->resolve_pred ) - { t->predicate.r = lookup_predicate(db, t->predicate.u); - t->resolve_pred = FALSE; - } - - if ( (dup=discard_duplicate(db, t)) == DUP_DISCARDED ) - return FALSE; - - if ( db->by_none_tail ) - db->by_none_tail->next[BY_NONE] = t; - else - db->by_none = t; - db->by_none_tail = t; - - link_triple_hash(db, t); - if ( t->object_is_literal ) - t->object.literal = share_literal(db, t->object.literal); - - if ( dup == DUP_DUPLICATE && update_duplicates_add(db, t) ) - goto ok; /* is a duplicate */ - - /* keep track of subjects */ - one = first(db, t->subject); - if ( !one->first ) - { one->first = TRUE; - db->subjects++; - } - - /* keep track of subPropertyOf */ - if ( t->predicate.r->name == ATOM_subPropertyOf && - t->object_is_literal == FALSE ) - { predicate *me = lookup_predicate(db, t->subject); - predicate *super = lookup_predicate(db, t->object.resource); - - addSubPropertyOf(db, me, super); - } - -ok: - db->created++; - t->predicate.r->triple_count++; - register_graph(db, t); - - return TRUE; -} - - -static inline void -link_triple(rdf_db *db, triple *t) -{ if ( link_triple_silent(db, t) ) - broadcast(EV_ASSERT, t, NULL); -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -rehash_triples() - -Relink the triples in the hash-chains after the hash-keys for properties -have changed or the tables have been resized. The caller must ensure -there are no active queries and the tables are of the proper size. - -At the same time, this predicate actually removes erased triples. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -static long -tbl_size(long triples) -{ long s0 = 1024; - - triples /= MIN_HASH_FACTOR; - - while(s0 < triples) - s0 *= 2; - - return s0; -} - - -static void -rehash_triples(rdf_db *db) -{ int i; - triple *t, *t2; - long count = db->created - db->freed; - long tsize = tbl_size(count); - - DEBUG(1, Sdprintf("(%ld triples; %ld entries) ...", count, tsize)); - broadcast(EV_REHASH, (void*)ATOM_begin, NULL); - - for(i=1; i<INDEX_TABLES; i++) - { if ( db->table[i] ) - { long bytes = sizeof(triple*) * tsize; - long cbytes = sizeof(int) * tsize; - long obytes = sizeof(triple*) * db->table_size[i]; - long ocbytes = sizeof(int) * db->table_size[i]; - - db->table[i] = rdf_realloc(db, db->table[i], obytes, bytes); - db->tail[i] = rdf_realloc(db, db->tail[i], obytes, bytes); - db->counts[i] = rdf_realloc(db, db->counts[i], ocbytes, cbytes); - db->table_size[i] = tsize; - - memset(db->table[i], 0, bytes); - memset(db->tail[i], 0, bytes); - memset(db->counts[i], 0, cbytes); - } - } - - /* delete leading erased triples */ - for(t=db->by_none; t && t->erased; t=t2) - { t2 = t->next[BY_NONE]; - - free_triple(db, t); - db->freed++; - - db->by_none = t2; - } - - for(t=db->by_none; t; t = t2) - { triple *t3; - - t2 = t->next[BY_NONE]; - - for(i=1; i<INDEX_TABLES; i++) - t->next[i] = NULL; - - assert(t->erased == FALSE); - link_triple_hash(db, t); - - for( ; t2 && t2->erased; t2=t3 ) - { t3 = t2->next[BY_NONE]; - - free_triple(db, t2); - db->freed++; - } - - t->next[BY_NONE] = t2; - if ( !t2 ) - db->by_none_tail = t; - } - - if ( db->by_none == NULL ) - db->by_none_tail = NULL; - - broadcast(EV_REHASH, (void*)ATOM_end, NULL); -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -update_hash(). Note this may be called by readers and writers, but must -be done only onces and certainly not concurrently by multiple readers. -Hence we need a seperate lock. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -static int -WANT_GC(rdf_db *db) -{ if ( db->gc_blocked ) - { return FALSE; - } else - { long dirty = db->erased - db->freed; - long count = db->created - db->erased; - - if ( dirty > 1000 && dirty > count ) - return TRUE; - if ( count > db->table_size[1]*MAX_HASH_FACTOR ) - return TRUE; - - return FALSE; - } -} - - -static int -update_hash(rdf_db *db) -{ int want_gc = WANT_GC(db); - - if ( want_gc ) - DEBUG(1, Sdprintf("rdf_db: want GC\n")); - - if ( db->need_update || want_gc ) - { LOCK_MISC(db); - - if ( db->need_update ) /* check again */ - { if ( organise_predicates(db) ) - { long t0 = (long)PL_query(PL_QUERY_USER_CPU); - - DEBUG(1, Sdprintf("Re-hash ...")); - invalidate_distinct_counts(db); - rehash_triples(db); - db->generation += (db->created-db->erased); - db->rehash_count++; - db->rehash_time += ((double)(PL_query(PL_QUERY_USER_CPU)-t0))/1000.0; - DEBUG(1, Sdprintf("ok\n")); - } - db->need_update = 0; - } else if ( WANT_GC(db) ) - { long t0 = (long)PL_query(PL_QUERY_USER_CPU); - - DEBUG(1, Sdprintf("rdf_db: GC ...")); - rehash_triples(db); - db->gc_count++; - db->gc_time += ((double)(PL_query(PL_QUERY_USER_CPU)-t0))/1000.0; - DEBUG(1, Sdprintf("ok\n")); - } - - UNLOCK_MISC(db); - } - - return TRUE; -} - - -/* MT: Must be locked */ - -static void -erase_triple_silent(rdf_db *db, triple *t) -{ if ( !t->erased ) - { t->erased = TRUE; - - update_duplicates_del(db, t); - - if ( t->predicate.r->name == ATOM_subPropertyOf && - t->object_is_literal == FALSE ) - { predicate *me = lookup_predicate(db, t->subject); - predicate *super = lookup_predicate(db, t->object.resource); - - delSubPropertyOf(db, me, super); - } - - if ( t->first ) - { triple *one = first(db, t->subject); - - if ( one ) - one->first = TRUE; - else - db->subjects--; - } - db->erased++; - t->predicate.r->triple_count--; - unregister_graph(db, t); - - if ( t->object_is_literal ) - { literal *lit = t->object.literal; - - t->object.literal = NULL; - free_literal(db, lit); /* TBD: thread-safe? */ - } - } -} - - -static inline void -erase_triple(rdf_db *db, triple *t) -{ broadcast(EV_RETRACT, t, NULL); - erase_triple_silent(db, t); -} - - -static int -match_object(triple *t, triple *p, unsigned flags) -{ if ( p->object_is_literal ) - { if ( t->object_is_literal ) - { literal *plit = p->object.literal; - literal *tlit = t->object.literal; - - if ( !plit->objtype && !plit->qualifier ) - return TRUE; - - if ( plit->objtype && plit->objtype != tlit->objtype ) - return FALSE; - - switch( plit->objtype ) - { case 0: - if ( plit->qualifier && - tlit->qualifier != plit->qualifier ) - return FALSE; - return TRUE; - case OBJ_STRING: - if ( (flags & MATCH_QUAL) || - p->match == STR_MATCH_PLAIN ) - { if ( tlit->qualifier != plit->qualifier ) - return FALSE; - } else - { if ( plit->qualifier && tlit->qualifier && - tlit->qualifier != plit->qualifier ) - return FALSE; - } - if ( plit->type_or_lang && - tlit->type_or_lang != plit->type_or_lang ) - return FALSE; - if ( plit->value.string ) - { if ( tlit->value.string != plit->value.string ) - { if ( p->match >= STR_MATCH_EXACT ) - { return match_atoms(p->match, - plit->value.string, tlit->value.string); - } else - { return FALSE; - } - } - } - return TRUE; - case OBJ_INTEGER: - return tlit->value.integer == plit->value.integer; - case OBJ_DOUBLE: - return tlit->value.real == plit->value.real; - case OBJ_TERM: - if ( plit->value.term.record && - plit->value.term.len != tlit->value.term.len ) - return FALSE; - return memcmp(tlit->value.term.record, plit->value.term.record, - plit->value.term.len) == 0; - default: - assert(0); - } - } - return FALSE; - } else - { if ( p->object.resource ) - { if ( t->object_is_literal || - (p->object.resource != t->object.resource) ) - return FALSE; - } - } - - return TRUE; -} - - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Match triple t to pattern p. Erased triples are always skipped. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -static int -match_triples(triple *t, triple *p, unsigned flags) -{ /* DEBUG(3, Sdprintf("match_triple("); - print_triple(t, 0); - Sdprintf(")\n")); - */ - - if ( t->erased ) - return FALSE; - if ( p->subject && t->subject != p->subject ) - return FALSE; - if ( !match_object(t, p, flags) ) - return FALSE; - if ( flags & MATCH_SRC ) - { if ( p->graph && t->graph != p->graph ) - return FALSE; - if ( p->line && t->line != p->line ) - return FALSE; - } - /* last; may be expensive */ - if ( p->predicate.r && t->predicate.r != p->predicate.r ) - { if ( (flags & MATCH_SUBPROPERTY) ) - return isSubPropertyOf(t->predicate.r, p->predicate.r); - else - return FALSE; - } - return TRUE; -} - - - /******************************* - * SAVE/LOAD * - *******************************/ - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -The RDF triple format. This format is intended for quick save and load -and not for readability or exchange. Parts are based on the SWI-Prolog -Quick Load Format (implemented in pl-wic.c). - - <file> ::= <magic> - <version> - ['S' <graph-name>] - ['F' <graph-source>] - ['t' <modified>] - ['M' <md5>] - {<triple>} - 'E' - - <magic> ::= "RDF-dump\n" - <version> ::= <integer> - - <md5> ::= <byte>* (16 bytes digest) - - <triple> ::= 'T' - <subject> - <predicate> - <object> - <graph> - - <subject> ::= <resource> - <predicate> ::= <resource> - - <object> ::= "R" <resource> - | "L" <atom> - - <resource> ::= <atom> - - <atom> ::= "X" <integer> - "A" <string> - "W" <utf-8 string> - - <string> ::= <integer><bytes> - - <graph-name> ::= <atom> - <graph-source> ::= <atom> - - <graph> ::= <graph-file> - <line> -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -#define SAVE_MAGIC "RDF-dump\n" -#define SAVE_VERSION 2 - -typedef struct saved -{ atom_t name; - long as; - struct saved *next; -} saved; - - -typedef struct save_context -{ saved ** saved_table; - long saved_size; - long saved_id; -} save_context; - - -long -next_table_size(long s0) -{ long size = 2; - - while(size < s0) - size *= 2; - - return size; -} - -static void -init_saved(rdf_db *db, save_context *ctx) -{ long size = next_table_size((db->created - db->erased)/8); - long bytes = size * sizeof(*ctx->saved_table); - - ctx->saved_table = rdf_malloc(db, bytes); - memset(ctx->saved_table, 0, bytes); - ctx->saved_size = size; - ctx->saved_id = 0; -} - -static void -destroy_saved(rdf_db *db, save_context *ctx) -{ if ( ctx->saved_table ) - { saved **s = ctx->saved_table; - int i; - - for(i=0; i<ctx->saved_size; i++, s++) - { saved *c, *n; - - for(c=*s; c; c = n) - { n = c->next; - free(c); - } - } - - rdf_free(db, ctx->saved_table, ctx->saved_size*sizeof(*ctx->saved_table)); - } -} - -#define INT64BITSIZE (sizeof(int64_t)*8) -#define PLMINLONG ((int64_t)((uint64_t)1<<(INT64BITSIZE-1))) - -static void -save_int(IOSTREAM *fd, int64_t n) -{ int m; - int64_t absn = (n >= 0 ? n : -n); - - if ( n != PLMINLONG ) - { if ( absn < ((intptr_t)1 << 5) ) - { Sputc((int)(n & 0x3f), fd); - return; - } else if ( absn < ((intptr_t)1 << 13) ) - { Sputc((int)(((n >> 8) & 0x3f) | (1 << 6)), fd); - Sputc((int)(n & 0xff), fd); - return; - } else if ( absn < ((intptr_t)1 << 21) ) - { Sputc((int)(((n >> 16) & 0x3f) | (2 << 6)), fd); - Sputc((int)((n >> 8) & 0xff), fd); - Sputc((int)(n & 0xff), fd); - return; - } - } - - for(m = sizeof(n); ; m--) - { int b = (int)((absn >> (((m-1)*8)-1)) & 0x1ff); - - if ( b == 0 ) - continue; - break; - } - - Sputc(m | (3 << 6), fd); - - for( ; m > 0; m--) - { int b = (int)((n >> ((m-1)*8)) & 0xff); - - Sputc(b, fd); - } -} - - -#define BYTES_PER_DOUBLE sizeof(double) -#ifdef WORDS_BIGENDIAN -static const int double_byte_order[] = { 7,6,5,4,3,2,1,0 }; -#else -static const int double_byte_order[] = { 0,1,2,3,4,5,6,7 }; -#endif - -static int -save_double(IOSTREAM *fd, double f) -{ unsigned char *cl = (unsigned char *)&f; - unsigned int i; - - for(i=0; i<BYTES_PER_DOUBLE; i++) - Sputc(cl[double_byte_order[i]], fd); - - return TRUE; -} - - -static int -save_atom(rdf_db *db, IOSTREAM *out, atom_t a, save_context *ctx) -{ int hash = atom_hash(a) % ctx->saved_size; - saved *s; - size_t len; - const char *chars; - unsigned int i; - const wchar_t *wchars; - - for(s=ctx->saved_table[hash]; s; s= s->next) - { if ( s->name == a ) - { Sputc('X', out); - save_int(out, s->as); - - return TRUE; - } - } - - s = rdf_malloc(db, sizeof(*s)); - s->name = a; - s->as = ctx->saved_id++; - s->next = ctx->saved_table[hash]; - ctx->saved_table[hash] = s; - - if ( (chars = PL_atom_nchars(a, &len)) ) - { Sputc('A', out); - save_int(out, len); - for(i=0; i<len; i++, chars++) - Sputc(*chars&0xff, out); - } else if ( (wchars = PL_atom_wchars(a, &len)) ) - { IOENC enc = out->encoding; - - Sputc('W', out); - save_int(out, len); - out->encoding = ENC_UTF8; - for(i=0; i<len; i++, wchars++) - { wint_t c = *wchars; - - SECURE(assert(c>=0 && c <= 0x10ffff)); - Sputcode(c, out); - } - out->encoding = enc; - } else - return FALSE; - - return TRUE; -} - - -static void -write_triple(rdf_db *db, IOSTREAM *out, triple *t, save_context *ctx) -{ Sputc('T', out); - - save_atom(db, out, t->subject, ctx); - save_atom(db, out, t->predicate.r->name, ctx); - - if ( t->object_is_literal ) - { literal *lit = t->object.literal; - - if ( lit->qualifier ) - { assert(lit->type_or_lang); - Sputc(lit->qualifier == Q_LANG ? 'l' : 't', out); - save_atom(db, out, lit->type_or_lang, ctx); - } - - switch(lit->objtype) - { case OBJ_STRING: - Sputc('L', out); - save_atom(db, out, lit->value.string, ctx); - break; - case OBJ_INTEGER: - Sputc('I', out); - save_int(out, lit->value.integer); - break; - case OBJ_DOUBLE: - { Sputc('F', out); - save_double(out, lit->value.real); - break; - } - case OBJ_TERM: - { const char *s = lit->value.term.record; - size_t len = lit->value.term.len; - - Sputc('T', out); - save_int(out, len); - while(len-- > 0) - Sputc(*s++, out); - - break; - } - default: - assert(0); - } - } else - { Sputc('R', out); - save_atom(db, out, t->object.resource, ctx); - } - - save_atom(db, out, t->graph, ctx); - save_int(out, t->line); -} - - -static void -write_source(rdf_db *db, IOSTREAM *out, atom_t src, save_context *ctx) -{ graph *s = lookup_graph(db, src, FALSE); - - if ( s && s->source ) - { Sputc('F', out); - save_atom(db, out, s->source, ctx); - Sputc('t', out); - save_double(out, s->modified); - } -} - - -static void -write_md5(rdf_db *db, IOSTREAM *out, atom_t src) -{ graph *s = lookup_graph(db, src, FALSE); - - if ( s ) - { md5_byte_t *p = s->digest; - int i; - - Sputc('M', out); - for(i=0; i<16; i++) - Sputc(*p++, out); - } -} - - -static int -save_db(rdf_db *db, IOSTREAM *out, atom_t src) -{ triple *t; - save_context ctx; - - if ( !RDLOCK(db) ) - return FALSE; - init_saved(db, &ctx); - - Sfprintf(out, "%s", SAVE_MAGIC); - save_int(out, SAVE_VERSION); - if ( src ) - { Sputc('S', out); /* start of graph header */ - save_atom(db, out, src, &ctx); - write_source(db, out, src, &ctx); - write_md5(db, out, src); - } - if ( Sferror(out) ) - { RDUNLOCK(db); - return FALSE; - } - - for(t = db->by_none; t; t = t->next[BY_NONE]) - { if ( !t->erased && - (!src || t->graph == src) ) - { write_triple(db, out, t, &ctx); - if ( Sferror(out) ) - return FALSE; - } - } - Sputc('E', out); - if ( Sferror(out) ) - { RDUNLOCK(db); - return FALSE; - } - - destroy_saved(db, &ctx); - RDUNLOCK(db); - - return TRUE; -} - - -static foreign_t -rdf_save_db(term_t stream, term_t graph) -{ IOSTREAM *out; - atom_t src; - - if ( !PL_get_stream_handle(stream, &out) ) - return type_error(stream, "stream"); - if ( !get_atom_or_var_ex(graph, &src) ) - return FALSE; - - return save_db(DB, out, src); -} - - -static int64_t -load_int(IOSTREAM *fd) -{ int64_t first = Sgetc(fd); - int bytes, shift, b; - - if ( !(first & 0xc0) ) /* 99% of them: speed up a bit */ - { first <<= (INT64BITSIZE-6); - first >>= (INT64BITSIZE-6); - - return first; - } - - bytes = (int) ((first >> 6) & 0x3); - first &= 0x3f; - - if ( bytes <= 2 ) - { for( b = 0; b < bytes; b++ ) - { first <<= 8; - first |= Sgetc(fd) & 0xff; - } - - shift = (sizeof(first)-1-bytes)*8 + 2; - } else - { int m; - - bytes = (int)first; - first = 0L; - - for(m=0; m<bytes; m++) - { first <<= 8; - first |= Sgetc(fd) & 0xff; - } - shift = (sizeof(first)-bytes)*8; - } - - first <<= shift; - first >>= shift; - - return first; -} - - -static int -load_double(IOSTREAM *fd, double *fp) -{ double f; - unsigned char *cl = (unsigned char *)&f; - unsigned int i; - - for(i=0; i<BYTES_PER_DOUBLE; i++) - { int c = Sgetc(fd); - - if ( c == -1 ) - { *fp = 0.0; - return FALSE; - } - cl[double_byte_order[i]] = c; - } - - *fp = f; - return TRUE; -} - - -typedef struct ld_context -{ long loaded_id; /* keep track of atoms */ - atom_t *loaded_atoms; - long atoms_size; - atom_t graph; /* for single-graph files */ - atom_t graph_source; - double modified; - int has_digest; - md5_byte_t digest[16]; - atom_hash *graph_table; /* multi-graph file */ -} ld_context; - - -static void -add_atom(rdf_db *db, atom_t a, ld_context *ctx) -{ if ( ctx->loaded_id >= ctx->atoms_size ) - { if ( ctx->atoms_size == 0 ) - { ctx->atoms_size = 1024; - ctx->loaded_atoms = rdf_malloc(db, sizeof(atom_t)*ctx->atoms_size); - } else - { long obytes = sizeof(atom_t)*ctx->atoms_size; - long bytes; - - ctx->atoms_size *= 2; - bytes = sizeof(atom_t)*ctx->atoms_size; - ctx->loaded_atoms = rdf_realloc(db, ctx->loaded_atoms, obytes, bytes); - } - } - - ctx->loaded_atoms[ctx->loaded_id++] = a; -} - - -static atom_t -load_atom(rdf_db *db, IOSTREAM *in, ld_context *ctx) -{ switch(Sgetc(in)) - { case 'X': - { intptr_t idx = (intptr_t)load_int(in); - return ctx->loaded_atoms[idx]; - } - case 'A': - { size_t len = (size_t)load_int(in); - atom_t a; - - if ( len < 1024 ) - { char buf[1024]; - Sfread(buf, 1, len, in); - a = PL_new_atom_nchars(len, buf); - } else - { char *buf = rdf_malloc(db, len); - Sfread(buf, 1, len, in); - a = PL_new_atom_nchars(len, buf); - rdf_free(db, buf, len); - } - - add_atom(db, a, ctx); - return a; - } - case 'W': - { int len = (int)load_int(in); - atom_t a; - wchar_t buf[1024]; - wchar_t *w; - IOENC enc = in->encoding; - int i; - - if ( len < 1024 ) - w = buf; - else - w = rdf_malloc(db, len*sizeof(wchar_t)); - - in->encoding = ENC_UTF8; - for(i=0; i<len; i++) - { w[i] = Sgetcode(in); - SECURE(assert(w[i]>=0 && w[i] <= 0x10ffff)); - } - in->encoding = enc; - - a = PL_new_atom_wchars(len, w); - if ( w != buf ) - rdf_free(db, w, len*sizeof(wchar_t)); - - add_atom(db, a, ctx); - return a; - } - default: - { assert(0); - return 0; - } - } -} - - -static triple * -load_triple(rdf_db *db, IOSTREAM *in, ld_context *ctx) -{ triple *t = new_triple(db); - int c; - - t->subject = load_atom(db, in, ctx); - t->predicate.u = load_atom(db, in, ctx); - t->resolve_pred = TRUE; - if ( (c=Sgetc(in)) == 'R' ) - { t->object.resource = load_atom(db, in, ctx); - } else - { literal *lit = new_literal(db); - - t->object_is_literal = TRUE; - t->object.literal = lit; - - value: - switch(c) - { case 'L': - lit->objtype = OBJ_STRING; - lit->value.string = load_atom(db, in, ctx); - break; - case 'I': - lit->objtype = OBJ_INTEGER; - lit->value.integer = load_int(in); - break; - case 'F': - lit->objtype = OBJ_DOUBLE; - load_double(in, &lit->value.real); - break; - case 'T': - { unsigned int i; - char *s; - - lit->objtype = OBJ_TERM; - lit->value.term.len = (size_t)load_int(in); - lit->value.term.record = rdf_malloc(db, lit->value.term.len); - lit->term_loaded = TRUE; /* see free_literal() */ - s = (char *)lit->value.term.record; - - for(i=0; i<lit->value.term.len; i++) - s[i] = Sgetc(in); - - break; - } - case 'l': - lit->qualifier = Q_LANG; - lit->type_or_lang = load_atom(db, in, ctx); - c = Sgetc(in); - goto value; - case 't': - lit->qualifier = Q_TYPE; - lit->type_or_lang = load_atom(db, in, ctx); - c = Sgetc(in); - goto value; - default: - assert(0); - return NULL; - } - } - t->graph = load_atom(db, in, ctx); - t->line = (unsigned long)load_int(in); - if ( !ctx->graph ) - { if ( !ctx->graph_table ) - ctx->graph_table = new_atom_hash(64); - add_atom_hash(ctx->graph_table, t->graph); - } - - return t; -} - - -static int -load_magic(IOSTREAM *in) -{ char *s = SAVE_MAGIC; - - for( ; *s; s++) - { if ( Sgetc(in) != *s ) - return FALSE; - } - - return TRUE; -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Note that we have two types of saved states. One holding many named -graphs and one holding the content of exactly one named graph. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -#define LOAD_ERROR ((triple*)(intptr_t)-1) - -static triple * -load_db(rdf_db *db, IOSTREAM *in, ld_context *ctx) -{ int version; - int c; - triple *list = NULL, *tail = NULL; - - if ( !load_magic(in) ) - return LOAD_ERROR; - version = (int)load_int(in); - - while((c=Sgetc(in)) != EOF) - { switch(c) - { case 'T': - { triple *t; - - if ( !(t=load_triple(db, in, ctx)) ) - return FALSE; - - if ( tail ) - { tail->next[BY_NONE] = t; - tail = t; - } else - { list = tail = t; - } - - break; - } - /* file holding exactly one graph */ - case 'S': /* name of the graph */ - { ctx->graph = load_atom(db, in, ctx); - break; - } - case 'M': /* MD5 of the graph */ - { int i; - - for(i=0; i<16; i++) - ctx->digest[i] = Sgetc(in); - ctx->has_digest = TRUE; - - break; - } - case 'F': /* file of the graph */ - ctx->graph_source = load_atom(db, in, ctx); - break; /* end of one-graph handling */ - case 't': - load_double(in, &ctx->modified); - break; - case 'E': /* end of file */ - return list; - default: - break; - } - } - - PL_warning("Illegal RDF triple file"); - - return LOAD_ERROR; -} - - -static int -link_loaded_triples(rdf_db *db, triple *t, ld_context *ctx) -{ long created0 = db->created; - graph *graph; - - if ( ctx->graph ) /* lookup named graph */ - { graph = lookup_graph(db, ctx->graph, TRUE); - if ( ctx->graph_source && graph->source != ctx->graph_source ) - { if ( graph->source ) - PL_unregister_atom(graph->source); - graph->source = ctx->graph_source; - PL_register_atom(graph->source); - graph->modified = ctx->modified; - } - - if ( ctx->has_digest ) - { if ( graph->md5 ) - { if ( db->tr_first ) - { record_md5_transaction(db, graph, NULL); - } else - { graph->md5 = FALSE; /* kill repetitive MD5 update */ - } - } else - { ctx->has_digest = FALSE; - } - } - } else - { graph = NULL; - } - - - if ( db->tr_first ) /* loading in a transaction */ - { triple *next; - - for( ; t; t = next ) - { next = t->next[BY_NONE]; - - t->next[BY_NONE] = NULL; - lock_atoms(t); - record_transaction(db, TR_ASSERT, t); - } - } else - { triple *next; - - for( ; t; t = next ) - { next = t->next[BY_NONE]; - - t->next[BY_NONE] = NULL; - lock_atoms(t); - if ( link_triple_silent(db, t) ) - broadcast(EV_ASSERT_LOAD, t, NULL); - } - } - - /* update the graph info */ - if ( ctx->has_digest ) - { if ( db->tr_first ) - { md5_byte_t *d = rdf_malloc(db, sizeof(ctx->digest)); - memcpy(d, ctx->digest, sizeof(ctx->digest)); - record_md5_transaction(db, graph, d); - } else - { sum_digest(graph->digest, ctx->digest); - } - graph->md5 = TRUE; - } - - db->generation += (db->created-created0); - - return TRUE; -} - - -static int -append_graph_to_list(ptr_hash_node *node, void *closure) -{ atom_t graph = (atom_t)node->value; - term_t tail = (term_t)closure; - term_t head = PL_new_term_ref(); - int rc; - - rc = (PL_unify_list(tail, head, tail) && - PL_unify_atom(head, graph)); - PL_reset_term_refs(head); - - return rc; -} - - -static foreign_t -rdf_load_db(term_t stream, term_t id, term_t graphs) -{ ld_context ctx; - rdf_db *db = DB; - IOSTREAM *in; - triple *list; - int rc; - - if ( !PL_get_stream_handle(stream, &in) ) - return type_error(stream, "stream"); - - memset(&ctx, 0, sizeof(ctx)); - if ( (list=load_db(db, in, &ctx)) == LOAD_ERROR ) - return FALSE; - - if ( !WRLOCK(db, FALSE) ) - return FALSE; - broadcast(EV_LOAD, (void*)id, (void*)ATOM_begin); - - if ( (rc=link_loaded_triples(db, list, &ctx)) ) - { if ( ctx.graph_table ) - { term_t tail = PL_copy_term_ref(graphs); - - rc = ( for_atom_hash(ctx.graph_table, append_graph_to_list, (void*)tail) && - PL_unify_nil(tail) ); - - destroy_atom_hash(ctx.graph_table); - } else - { rc = PL_unify_atom(graphs, ctx.graph); - } - } - broadcast(EV_LOAD, (void*)id, (void*)ATOM_end); - WRUNLOCK(db); - - PL_release_stream(in); - if ( ctx.loaded_atoms ) - { atom_t *ap, *ep; - - for(ap=ctx.loaded_atoms, ep=ap+ctx.loaded_id; ap<ep; ap++) - PL_unregister_atom(*ap); - - rdf_free(db, ctx.loaded_atoms, sizeof(atom_t)*ctx.atoms_size); - } - - return rc; -} - - -#ifdef WITH_MD5 - /******************************* - * MD5 SUPPORT * - *******************************/ - -/* md5_type is used to keep the MD5 independent from the internal - numbers -*/ -static const char md5_type[] = -{ 0x0, /* OBJ_UNKNOWN */ - 0x3, /* OBJ_INTEGER */ - 0x4, /* OBJ_DOUBLE */ - 0x2, /* OBJ_STRING */ - 0x5 /* OBJ_TERM */ -}; - -static void -md5_triple(triple *t, md5_byte_t *digest) -{ md5_state_t state; - size_t len; - md5_byte_t tmp[2]; - const char *s; - literal *lit; - - md5_init(&state); - s = PL_blob_data(t->subject, &len, NULL); - md5_append(&state, (const md5_byte_t *)s, (int)len); - md5_append(&state, (const md5_byte_t *)"P", 1); - s = PL_blob_data(t->predicate.r->name, &len, NULL); - md5_append(&state, (const md5_byte_t *)s, (int)len); - tmp[0] = 'O'; - if ( t->object_is_literal ) - { lit = t->object.literal; - tmp[1] = md5_type[lit->objtype]; - - switch(lit->objtype) - { case OBJ_STRING: - s = PL_blob_data(lit->value.string, &len, NULL); - break; - case OBJ_INTEGER: /* TBD: byte order issues */ - s = (const char *)&lit->value.integer; - len = sizeof(lit->value.integer); - break; - case OBJ_DOUBLE: - s = (const char *)&lit->value.real; - len = sizeof(lit->value.real); - break; - case OBJ_TERM: - s = (const char *)lit->value.term.record; - len = lit->value.term.len; - break; - default: - assert(0); - } - } else - { s = PL_blob_data(t->object.resource, &len, NULL); - tmp[1] = 0x1; /* old OBJ_RESOURCE */ - lit = NULL; - } - md5_append(&state, tmp, 2); - md5_append(&state, (const md5_byte_t *)s, (int)len); - if ( lit && lit->qualifier ) - { assert(lit->type_or_lang); - md5_append(&state, - (const md5_byte_t *)(lit->qualifier == Q_LANG ? "l" : "t"), - 1); - s = PL_blob_data(lit->type_or_lang, &len, NULL); - md5_append(&state, (const md5_byte_t *)s, (int)len); - } - if ( t->graph ) - { md5_append(&state, (const md5_byte_t *)"S", 1); - s = PL_blob_data(t->graph, &len, NULL); - md5_append(&state, (const md5_byte_t *)s, (int)len); - } - - md5_finish(&state, digest); -} - - -static void -sum_digest(md5_byte_t *digest, md5_byte_t *add) -{ md5_byte_t *p, *q; - int n; - - for(p=digest, q=add, n=16; --n>=0; ) - *p++ += *q++; -} - - -static void -dec_digest(md5_byte_t *digest, md5_byte_t *add) -{ md5_byte_t *p, *q; - int n; - - for(p=digest, q=add, n=16; --n>=0; ) - *p++ -= *q++; -} - - -static int -md5_unify_digest(term_t t, md5_byte_t digest[16]) -{ char hex_output[16*2]; - int di; - char *pi; - static char hexd[] = "0123456789abcdef"; - - for(pi=hex_output, di = 0; di < 16; ++di) - { *pi++ = hexd[(digest[di] >> 4) & 0x0f]; - *pi++ = hexd[digest[di] & 0x0f]; - } - - return PL_unify_atom_nchars(t, 16*2, hex_output); -} - - -static foreign_t -rdf_md5(term_t graph_name, term_t md5) -{ atom_t src; - int rc; - rdf_db *db = DB; - - if ( !get_atom_or_var_ex(graph_name, &src) ) - return FALSE; - - if ( src ) - { graph *s; - - if ( !RDLOCK(db) ) - return FALSE; - if ( (s = lookup_graph(db, src, FALSE)) ) - { rc = md5_unify_digest(md5, s->digest); - } else - { md5_byte_t digest[16]; - - memset(digest, 0, sizeof(digest)); - rc = md5_unify_digest(md5, digest); - } - RDUNLOCK(db); - } else - { md5_byte_t digest[16]; - graph **ht; - int i; - - memset(&digest, 0, sizeof(digest)); - - if ( !RDLOCK(db) ) - return FALSE; - - for(i=0,ht = db->graph_table; i<db->graph_table_size; i++, ht++) - { graph *s; - - for( s = *ht; s; s = s->next ) - sum_digest(digest, s->digest); - } - - rc = md5_unify_digest(md5, digest); - RDUNLOCK(db); - } - - return rc; -} - - -static foreign_t -rdf_atom_md5(term_t text, term_t times, term_t md5) -{ char *s; - int n, i; - size_t len; - md5_byte_t digest[16]; - - if ( !PL_get_nchars(text, &len, &s, CVT_ALL) ) - return type_error(text, "text"); - if ( !PL_get_integer(times, &n) ) - return type_error(times, "integer"); - if ( n < 1 ) - return domain_error(times, "positive_integer"); - - for(i=0; i<n; i++) - { md5_state_t state; - md5_init(&state); - md5_append(&state, (const md5_byte_t *)s, (int)len); - md5_finish(&state, digest); - s = (char *)digest; - len = sizeof(digest); - } - - return md5_unify_digest(md5, digest); -} - - - -#endif /*WITH_MD5*/ - - - /******************************* - * ATOMS * - *******************************/ - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Lock atoms in triple against AGC. Note that the predicate name is locked -in the predicate structure. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -static void -lock_atoms(triple *t) -{ if ( !t->atoms_locked ) - { t->atoms_locked = TRUE; - - PL_register_atom(t->subject); - if ( t->object_is_literal ) - { lock_atoms_literal(t->object.literal); - } else - { PL_register_atom(t->object.resource); - } - } -} - - -static void -unlock_atoms(triple *t) -{ if ( t->atoms_locked ) - { t->atoms_locked = FALSE; - - PL_unregister_atom(t->subject); - if ( !t->object_is_literal ) - { PL_unregister_atom(t->object.resource); - } - } -} - - - /******************************* - * PROLOG CONVERSION * - *******************************/ - -#define LIT_TYPED 0x1 -#define LIT_NOERROR 0x2 -#define LIT_PARTIAL 0x4 - -static int -get_lit_atom_ex(term_t t, atom_t *a, int flags) -{ if ( PL_get_atom(t, a) ) - return TRUE; - if ( (flags & LIT_PARTIAL) && PL_is_variable(t) ) - { *a = 0L; - return TRUE; - } - - return type_error(t, "atom"); -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -get_literal() processes the argument of a literal/1 term passes as -object. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -static int -get_literal(rdf_db *db, term_t litt, triple *t, int flags) -{ literal *lit; - - alloc_literal_triple(db, t); - lit = t->object.literal; - - if ( PL_get_atom(litt, &lit->value.string) ) - { lit->objtype = OBJ_STRING; - } else if ( PL_is_integer(litt) && PL_get_int64(litt, &lit->value.integer) ) - { lit->objtype = OBJ_INTEGER; - } else if ( PL_get_float(litt, &lit->value.real) ) - { lit->objtype = OBJ_DOUBLE; - } else if ( PL_is_functor(litt, FUNCTOR_lang2) ) - { term_t a = PL_new_term_ref(); - - _PL_get_arg(1, litt, a); - if ( !get_lit_atom_ex(a, &lit->type_or_lang, flags) ) - return FALSE; - _PL_get_arg(2, litt, a); - if ( !get_lit_atom_ex(a, &lit->value.string, flags) ) - return FALSE; - - lit->qualifier = Q_LANG; - lit->objtype = OBJ_STRING; - } else if ( PL_is_functor(litt, FUNCTOR_type2) && - !(flags & LIT_TYPED) ) /* avoid recursion */ - { term_t a = PL_new_term_ref(); - - _PL_get_arg(1, litt, a); - if ( !get_lit_atom_ex(a, &lit->type_or_lang, flags) ) - return FALSE; - lit->qualifier = Q_TYPE; - _PL_get_arg(2, litt, a); - - return get_literal(db, a, t, LIT_TYPED|flags); - } else if ( !PL_is_ground(litt) ) - { if ( !(flags & LIT_PARTIAL) ) - return type_error(litt, "rdf_object"); - if ( !PL_is_variable(litt) ) - lit->objtype = OBJ_TERM; - } else - { lit->value.term.record = PL_record_external(litt, &lit->value.term.len); - lit->objtype = OBJ_TERM; - } - - return TRUE; -} - - -static int -get_object(rdf_db *db, term_t object, triple *t) -{ if ( PL_get_atom(object, &t->object.resource) ) - { assert(!t->object_is_literal); - } else if ( PL_is_functor(object, FUNCTOR_literal1) ) - { term_t a = PL_new_term_ref(); - - _PL_get_arg(1, object, a); - return get_literal(db, a, t, 0); - } else - return type_error(object, "rdf_object"); - - return TRUE; -} - - -static int -get_src(term_t src, triple *t) -{ if ( src && !PL_is_variable(src) ) - { if ( PL_get_atom(src, &t->graph) ) - { t->line = NO_LINE; - } else if ( PL_is_functor(src, FUNCTOR_colon2) ) - { term_t a = PL_new_term_ref(); - long line; - - _PL_get_arg(1, src, a); - if ( !get_atom_or_var_ex(a, &t->graph) ) - return FALSE; - _PL_get_arg(2, src, a); - if ( PL_get_long(a, &line) ) - t->line = line; - else if ( !PL_is_variable(a) ) - return type_error(a, "integer"); - } else - return type_error(src, "rdf_graph"); - } - - return TRUE; -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Return values: - -1: exception - 0: no predicate - 1: the predicate -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -static int -get_existing_predicate(rdf_db *db, term_t t, predicate **p) -{ atom_t name; - - if ( !PL_get_atom(t, &name ) ) - { if ( PL_is_functor(t, FUNCTOR_literal1) ) - return 0; /* rdf(_, literal(_), _) */ - return type_error(t, "atom"); - } - - if ( (*p = existing_predicate(db, name)) ) - return 1; - - DEBUG(5, Sdprintf("No predicate %s\n", PL_atom_chars(name))); - return 0; /* no predicate */ -} - - -static int -get_predicate(rdf_db *db, term_t t, predicate **p) -{ atom_t name; - - if ( !get_atom_ex(t, &name ) ) - return FALSE; - - *p = lookup_predicate(db, name); - return TRUE; -} - - -static int -get_triple(rdf_db *db, - term_t subject, term_t predicate, term_t object, - triple *t) -{ if ( !get_atom_ex(subject, &t->subject) || - !get_predicate(db, predicate, &t->predicate.r) || - !get_object(db, object, t) ) - return FALSE; - - return TRUE; -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -get_partial_triple() creates a triple for matching purposes. It can -return FALSE for two reasons. Mostly (type) errors, but also if -resources are accessed that do not exist and therefore the subsequent -matching will always fail. This is notably the case for predicates, -which are first class citizens to this library. - -Return values: - 1: ok - 0: no predicate - -1: error -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -static int -get_partial_triple(rdf_db *db, - term_t subject, term_t predicate, term_t object, - term_t src, triple *t) -{ int rc; - - if ( subject && !get_resource_or_var_ex(subject, &t->subject) ) - return FALSE; - if ( !PL_is_variable(predicate) && - (rc=get_existing_predicate(db, predicate, &t->predicate.r)) != 1 ) - return rc; - /* the object */ - if ( object && !PL_is_variable(object) ) - { if ( PL_get_atom(object, &t->object.resource) ) - { assert(!t->object_is_literal); - } else if ( PL_is_functor(object, FUNCTOR_literal1) ) - { term_t a = PL_new_term_ref(); - - _PL_get_arg(1, object, a); - if ( !get_literal(db, a, t, LIT_PARTIAL) ) - return FALSE; - } else if ( PL_is_functor(object, FUNCTOR_literal2) ) - { term_t a = PL_new_term_ref(); - literal *lit; - - alloc_literal_triple(db, t); - lit = t->object.literal; - - _PL_get_arg(1, object, a); - if ( PL_is_functor(a, FUNCTOR_exact1) ) - t->match = STR_MATCH_EXACT; - else if ( PL_is_functor(a, FUNCTOR_plain1) ) - t->match = STR_MATCH_PLAIN; - else if ( PL_is_functor(a, FUNCTOR_substring1) ) - t->match = STR_MATCH_SUBSTRING; - else if ( PL_is_functor(a, FUNCTOR_word1) ) - t->match = STR_MATCH_WORD; - else if ( PL_is_functor(a, FUNCTOR_prefix1) ) - t->match = STR_MATCH_PREFIX; - else if ( PL_is_functor(a, FUNCTOR_like1) ) - t->match = STR_MATCH_LIKE; - else - return domain_error(a, "match_type"); - - _PL_get_arg(1, a, a); - if ( !get_atom_or_var_ex(a, &lit->value.string) ) - return FALSE; - lit->objtype = OBJ_STRING; - } else - return type_error(object, "rdf_object"); - } - /* the graph */ - if ( !get_src(src, t) ) - return FALSE; - - if ( t->subject ) - t->indexed |= BY_S; - if ( t->predicate.r ) - t->indexed |= BY_P; - if ( t->object_is_literal ) - { literal *lit = t->object.literal; - - if ( lit->objtype == OBJ_STRING && - lit->value.string && - t->match <= STR_MATCH_EXACT ) - t->indexed |= BY_O; - } else if ( t->object.resource ) - t->indexed |= BY_O; - - db->indexed[t->indexed]++; /* statistics */ - - switch(t->indexed) - { case BY_SPO: - t->indexed = BY_SP; - break; - case BY_SO: - t->indexed = BY_S; - break; - } - - return TRUE; -} - - -static int -inverse_partial_triple(triple *t) -{ predicate *i = 0; - - if ( !t->inversed && - (!t->predicate.r || (i=t->predicate.r->inverse_of)) && - !t->object_is_literal ) - { atom_t o = t->object.resource; - - t->object.resource = t->subject; - t->subject = o; - - if ( t->predicate.r ) - t->predicate.r = i; - - t->indexed = by_inverse[t->indexed]; - t->inversed = TRUE; - - return TRUE; - } - - return FALSE; -} - - -static int -get_graph(term_t src, triple *t) -{ if ( PL_get_atom(src, &t->graph) ) - { t->line = NO_LINE; - return TRUE; - } - - if ( PL_is_functor(src, FUNCTOR_colon2) ) - { term_t a = PL_new_term_ref(); - long line; - - _PL_get_arg(1, src, a); - if ( !get_atom_ex(a, &t->graph) ) - return FALSE; - _PL_get_arg(2, src, a); - if ( !get_long_ex(a, &line) ) - return FALSE; - t->line = line; - - return TRUE; - } - - return type_error(src, "rdf_graph"); -} - - -static int -unify_graph(term_t src, triple *t) -{ switch( PL_term_type(src) ) - { case PL_VARIABLE: - { if ( t->line == NO_LINE ) - return PL_unify_atom(src, t->graph); - else - goto full_term; - } - case PL_ATOM: - { atom_t a; - return (PL_get_atom(src, &a) && - a == t->graph); - } - case PL_TERM: - { if ( t->line == NO_LINE ) - { return PL_unify_term(src, - PL_FUNCTOR, FUNCTOR_colon2, - PL_ATOM, t->graph, - PL_VARIABLE); - } else - { full_term: - return PL_unify_term(src, - PL_FUNCTOR, FUNCTOR_colon2, - PL_ATOM, t->graph, - PL_LONG, t->line); - } - } - default: - return type_error(src, "rdf_graph"); - } -} - - -static int -same_graph(triple *t1, triple *t2) -{ return t1->line == t2->line && - t1->graph == t2->graph; -} - - - -static int -put_literal_value(term_t v, literal *lit) -{ switch(lit->objtype) - { case OBJ_STRING: - PL_put_atom(v, lit->value.string); - break; - case OBJ_INTEGER: - PL_put_variable(v); - return PL_unify_int64(v, lit->value.integer); - case OBJ_DOUBLE: - return PL_put_float(v, lit->value.real); - case OBJ_TERM: - return PL_recorded_external(lit->value.term.record, v); - default: - assert(0); - return FALSE; - } - - return TRUE; -} - - -static int -unify_literal(term_t lit, literal *l) -{ term_t v = PL_new_term_ref(); - - if ( !put_literal_value(v, l) ) - return FALSE; - - if ( l->qualifier ) - { functor_t qf; - - assert(l->type_or_lang); - - if ( l->qualifier == Q_LANG ) - qf = FUNCTOR_lang2; - else - qf = FUNCTOR_type2; - - if ( PL_unify_term(lit, PL_FUNCTOR, qf, - PL_ATOM, l->type_or_lang, - PL_TERM, v) ) - return TRUE; - - return PL_unify(lit, v); /* allow rdf(X, Y, literal(foo)) */ - } else if ( PL_unify(lit, v) ) - { return TRUE; - } else if ( PL_is_functor(lit, FUNCTOR_lang2) && - l->objtype == OBJ_STRING ) - { term_t a = PL_new_term_ref(); - _PL_get_arg(2, lit, a); - return PL_unify(a, v); - } else if ( PL_is_functor(lit, FUNCTOR_type2) ) - { term_t a = PL_new_term_ref(); - _PL_get_arg(2, lit, a); - return PL_unify(a, v); - } else - return FALSE; -} - - - -static int -unify_object(term_t object, triple *t) -{ if ( t->object_is_literal ) - { term_t lit = PL_new_term_ref(); - - if ( PL_unify_functor(object, FUNCTOR_literal1) ) - _PL_get_arg(1, object, lit); - else if ( PL_is_functor(object, FUNCTOR_literal2) ) - _PL_get_arg(2, object, lit); - else - return FALSE; - - return unify_literal(lit, t->object.literal); - } else - { return PL_unify_atom(object, t->object.resource); - } -} - - -static int -unify_triple(term_t subject, term_t pred, term_t object, - term_t src, triple *t, int inversed) -{ predicate *p = t->predicate.r; - fid_t fid; - - if ( inversed ) - { term_t tmp = object; - object = subject; - subject = tmp; - - if ( !(p = p->inverse_of) ) - return FALSE; - } - - fid = PL_open_foreign_frame(); - - if ( !PL_unify_atom(subject, t->subject) || - !PL_unify_atom(pred, p->name) || - !unify_object(object, t) || - (src && !unify_graph(src, t)) ) - { PL_discard_foreign_frame(fid); - return FALSE; - } else - { PL_close_foreign_frame(fid); - return TRUE; - } -} - - - /******************************* - * DUBLICATE HANDLING * - *******************************/ - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -According to the RDF specs, duplicate triples have no meaning, but they -slow down search and often produce duplicate results in search. Worse, -some coding styles proposed in the OWL documents introduce huge amounts -of duplicate triples. We cannot simply ignore a triple if it is a -duplicate as a subsequent retract would delete the final triple. For -example, after loading two files that contain the same triple and -unloading one of these files the database would be left without triples. - -In our solution, if a triple is added as a duplicate, it is flagged such -using the flag is_duplicate. The `principal' triple has a count -`duplicates', indicating the number of duplicate triples in the -database. - -It might make sense to introduce the BY_SPO table as fully indexed -lookups are frequent with the introduction of duplicate detection. - -(*) Iff too many triples are added, it may be time to enlarge the -hashtable. Note that we do not call update_hash() blindly as this would -cause each triple that modifies the predicate hierarchy to force a -rehash. As we are not searching using subPropertyOf semantics during the -duplicate update, there is no point updating. If it is incorrect it will -be updated on the first real query. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - - -static int -update_duplicates_add(rdf_db *db, triple *t) -{ triple *d; - const int indexed = BY_SP; - - assert(t->is_duplicate == FALSE); - assert(t->duplicates == 0); - - if ( WANT_GC(db) ) /* (*) See above */ - update_hash(db); - d = db->table[indexed][triple_hash(db, t, indexed)]; - for( ; d && d != t; d = d->next[indexed] ) - { if ( match_triples(d, t, MATCH_DUPLICATE) ) - { t->is_duplicate = TRUE; - assert( !d->is_duplicate ); - - d->duplicates++; - - DEBUG(2, - print_triple(t, PRT_SRC); - Sdprintf(" %p: %d-th duplicate: ", t, d->duplicates); - Sdprintf("Principal: %p at", d); - print_src(d); - Sdprintf("\n")); - - assert(d->duplicates); /* check overflow */ - db->duplicates++; - return TRUE; - } - } - - return FALSE; -} - - -static void /* t is about to be deleted */ -update_duplicates_del(rdf_db *db, triple *t) -{ const int indexed = BY_SP; - - if ( t->duplicates ) /* I am the principal one */ - { triple *d; - - DEBUG(2, - print_triple(t, PRT_SRC); - Sdprintf(": DEL principal %p, %d duplicates: ", t, t->duplicates)); - - db->duplicates--; - d = db->table[indexed][triple_hash(db, t, indexed)]; - for( ; d; d = d->next[indexed] ) - { if ( d != t && match_triples(d, t, MATCH_DUPLICATE) ) - { assert(d->is_duplicate); - d->is_duplicate = FALSE; - d->duplicates = t->duplicates-1; - DEBUG(2, - Sdprintf("New principal: %p at", d); - print_src(d); - Sdprintf("\n")); - - return; - } - } - assert(0); - } else if ( t->is_duplicate ) /* I am a duplicate */ - { triple *d; - - DEBUG(2, - print_triple(t, PRT_SRC); - Sdprintf(": DEL: is a duplicate: ")); - - db->duplicates--; - d = db->table[indexed][triple_hash(db, t, indexed)]; - for( ; d; d = d->next[indexed] ) - { if ( d != t && match_triples(d, t, MATCH_DUPLICATE) ) - { if ( d->duplicates ) - { d->duplicates--; - DEBUG(2, - Sdprintf("Principal %p at ", d); - print_src(d); - Sdprintf(" has %d duplicates\n", d->duplicates)); - return; - } - } - } - Sdprintf("FATAL\n"); - PL_halt(1); - assert(0); - } -} - - - /******************************* - * TRANSACTIONS * - *******************************/ - -static void -append_transaction(rdf_db *db, transaction_record *tr) -{ if ( db->tr_last ) - { tr->next = NULL; - tr->previous = db->tr_last; - db->tr_last->next = tr; - db->tr_last = tr; - } else - { tr->next = tr->previous = NULL; - db->tr_first = db->tr_last = tr; - } -} - - -static void -open_transaction(rdf_db *db) -{ transaction_record *tr = rdf_malloc(db, sizeof(*tr)); - - memset(tr, 0, sizeof(*tr)); - tr->type = TR_MARK; - - if ( db->tr_first ) - db->tr_nesting++; - else - db->tr_nesting = 0; - - append_transaction(db, tr); -} - - -static void -record_transaction(rdf_db *db, tr_type type, triple *t) -{ transaction_record *tr = rdf_malloc(db, sizeof(*tr)); - - memset(tr, 0, sizeof(*tr)); - tr->type = type; - tr->triple = t; - - append_transaction(db, tr); -} - - -static void -record_md5_transaction(rdf_db *db, graph *src, md5_byte_t *digest) -{ transaction_record *tr = rdf_malloc(db, sizeof(*tr)); - - memset(tr, 0, sizeof(*tr)); - tr->type = TR_UPDATE_MD5, - tr->update.md5.graph = src; - tr->update.md5.digest = digest; - - append_transaction(db, tr); -} - - -static void -record_update_transaction(rdf_db *db, triple *t, triple *new) -{ transaction_record *tr = rdf_malloc(db, sizeof(*tr)); - - memset(tr, 0, sizeof(*tr)); - tr->type = TR_UPDATE, - tr->triple = t; - tr->update.triple = new; - - append_transaction(db, tr); -} - - -static void -record_update_src_transaction(rdf_db *db, triple *t, - atom_t src, unsigned long line) -{ transaction_record *tr = rdf_malloc(db, sizeof(*tr)); - - memset(tr, 0, sizeof(*tr)); - tr->type = TR_UPDATE_SRC, - tr->triple = t; - tr->update.src.atom = src; - tr->update.src.line = line; - - append_transaction(db, tr); -} - - -static void -void_transaction(rdf_db *db, transaction_record *tr) -{ switch(tr->type) - { case TR_ASSERT: - free_triple(db, tr->triple); - break; - case TR_UPDATE: - free_triple(db, tr->update.triple); - break; - case TR_UPDATE_MD5: - if ( tr->update.md5.digest ) - rdf_free(db, tr->update.md5.digest, sizeof(*tr->update.md5.digest)); - break; - default: - break; - } - - tr->type = TR_VOID; -} - - -static void -free_transaction(rdf_db *db, transaction_record *tr) -{ void_transaction(db, tr); - - rdf_free(db, tr, sizeof(*tr)); -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -This must deal with multiple operations on the same triple. Most -probably the most important thing is to merge update records. We must -also make-up our mind with regard to updated records that are erased or -records that are erased after updating, etc. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -static void -clean_transaction(rdf_db *db, transaction_record *tr0) -{ -#if 0 - transaction_record *tr; - - for(tr=tr0; tr; tr=tr->next) - { if ( TR_RETRACT ) - { transaction_record *tr2; - - for(tr2=tr->next; tr2; tr2=tr2->next) - { if ( tr2->triple == tr->triple ) - { switch(tr2->type) - { case TR_RETRACT: - case TR_UPDATE: - case TR_UPDATE_SRC: - void_transaction(db, tr2); - default: - ; - } - } - } - } - } -#endif -} - - -static void -truncate_transaction(rdf_db *db, transaction_record *last) -{ db->tr_last = last; - if ( last ) - { db->tr_last->next = NULL; - } else - { db->tr_first = NULL; - } -} - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -discard_transaction() simply destroys all actions in the last -transaction. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -static void -discard_transaction(rdf_db *db) -{ transaction_record *tr, *prev; - - for(tr=db->tr_last; tr; tr = prev) - { prev = tr->previous; - - if ( tr->type == TR_SUB_END ) - { if ( tr->update.transaction_id ) - PL_erase(tr->update.transaction_id); - } - - if ( tr->type == TR_MARK ) - { rdf_free(db, tr, sizeof(*tr)); - truncate_transaction(db, prev); - db->tr_nesting--; - return; - } - - free_transaction(db, tr); - } -} - - -int -put_begin_end(term_t t, functor_t be, int level) -{ term_t av; - - return ( (av = PL_new_term_ref()) && - PL_put_integer(av, level) && - PL_cons_functor_v(t, be, av) ); -} - - - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Note (*) rdf-monitors can modify the database by opening new -transactions. Therefore we first close the transaction to allow opening -new ones. TBD: get this clear. Monitors have only restricted read -access? -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -static int -commit_transaction_int(rdf_db *db, term_t id) -{ transaction_record *tr, *next; - int tr_level = 0; /* nesting level */ - - if ( db->tr_nesting > 0 ) /* commit nested transaction */ - { tr=db->tr_last; - - if ( tr->type == TR_MARK ) /* empty nested transaction */ - { truncate_transaction(db, tr->previous); - rdf_free(db, tr, sizeof(*tr)); - db->tr_nesting--; - - return TRUE; - } - - for(; tr; tr = tr->previous) /* not the last (tested above) */ - { /* not the first (we are nested) */ - if ( tr->type == TR_MARK ) - { transaction_record *end = rdf_malloc(db, sizeof(*end)); - - memset(end, 0, sizeof(*end)); - end->type = TR_SUB_END; - end->update.transaction_id = PL_record(id); - append_transaction(db, end); - - tr->type = TR_SUB_START; - tr->update.transaction_id = end->update.transaction_id; - db->tr_nesting--; - - return TRUE; - } - } - - assert(0); - return FALSE; - } - - while( (tr=db->tr_first) ) /* See above (*) */ - { db->tr_first = db->tr_last = NULL; - - clean_transaction(db, tr); - /* real commit */ - for(; tr; tr = next) - { next = tr->next; - - switch(tr->type) - { case TR_MARK: - break; - case TR_SUB_START: - { term_t id = PL_new_term_ref(); - term_t be = PL_new_term_ref(); - if ( !PL_recorded(tr->update.transaction_id, id) || - !put_begin_end(be, FUNCTOR_begin1, ++tr_level) || - !broadcast(EV_TRANSACTION, (void*)id, (void*)be) ) - return FALSE; - break; - } - case TR_SUB_END: - { term_t id = PL_new_term_ref(); - term_t be = PL_new_term_ref(); - if ( !PL_recorded(tr->update.transaction_id, id) ) - return FALSE; - PL_erase(tr->update.transaction_id); - if ( !put_begin_end(be, FUNCTOR_end1, tr_level--) || - !broadcast(EV_TRANSACTION, (void*)id, (void*)be) ) - return FALSE; - break; - } - case TR_ASSERT: - link_triple(db, tr->triple); - db->generation++; - break; - case TR_RETRACT: - if ( !tr->triple->erased ) /* already erased */ - { erase_triple(db, tr->triple); - db->generation++; - } - break; - case TR_UPDATE: - if ( !tr->triple->erased ) - { if ( !broadcast(EV_UPDATE, tr->triple, tr->update.triple) ) - return FALSE; /* TBD: how to handle? */ - if ( !tr->triple->erased ) - { erase_triple_silent(db, tr->triple); - link_triple_silent(db, tr->update.triple); - db->generation++; - } - } - break; - case TR_UPDATE_SRC: - if ( !tr->triple->erased ) - { if ( tr->triple->graph != tr->update.src.atom ) - { if ( tr->triple->graph ) - unregister_graph(db, tr->triple); - tr->triple->graph = tr->update.src.atom; - if ( tr->triple->graph ) - register_graph(db, tr->triple); - } - tr->triple->line = tr->update.src.line; - db->generation++; - } - break; - case TR_UPDATE_MD5: - { graph *src = tr->update.md5.graph; - md5_byte_t *digest = tr->update.md5.digest; - if ( digest ) - { sum_digest(digest, src->digest); - src->md5 = TRUE; - rdf_free(db, digest, sizeof(md5_byte_t)*16); - } else - { src->md5 = FALSE; - } - break; - } - case TR_RESET: - db->tr_reset = FALSE; - reset_db(db); - break; - case TR_VOID: - break; - default: - assert(0); - } - - rdf_free(db, tr, sizeof(*tr)); - } - } - - return TRUE; -} - - -static int -commit_transaction(rdf_db *db, term_t id) -{ int rc; - - db->gc_blocked++; - rc = commit_transaction_int(db, id); - db->gc_blocked--; - - return rc; -} - - -static foreign_t -rdf_transaction(term_t goal, term_t id) -{ int rc; - rdf_db *db = DB; - active_transaction me; - - if ( !WRLOCK(db, TRUE) ) - return FALSE; - - open_transaction(db); - me.parent = db->tr_active; - me.id = id; - db->tr_active = &me; - - rc = PL_call_predicate(NULL, PL_Q_PASS_EXCEPTION, PRED_call1, goal); - - if ( rc ) - { int empty = (db->tr_last == NULL || db->tr_last->type == TR_MARK); - - if ( empty || db->tr_nesting > 0 ) - { commit_transaction(db, id); - } else - { term_t be; - - if ( !(be=PL_new_term_ref()) || - !put_begin_end(be, FUNCTOR_begin1, 0) || - !broadcast(EV_TRANSACTION, (void*)id, (void*)be) || - !put_begin_end(be, FUNCTOR_end1, 0) ) - return FALSE; - - if ( !LOCKOUT_READERS(db) ) /* interrupt, timeout */ - { broadcast(EV_TRANSACTION, (void*)id, (void*)be); - rc = FALSE; - goto discard; - } - commit_transaction(db, id); - REALLOW_READERS(db); - if ( !broadcast(EV_TRANSACTION, (void*)id, (void*)be) ) - return FALSE; - } - } else - { discard: - discard_transaction(db); - } - db->tr_active = me.parent; - WRUNLOCK(db); - - return rc; -} - - -static foreign_t -rdf_active_transactions(term_t list) -{ rdf_db *db = DB; - term_t tail = PL_copy_term_ref(list); - term_t head = PL_new_term_ref(); - active_transaction *ot; - - for(ot = db->tr_active; ot; ot=ot->parent) - { if ( !PL_unify_list(tail, head, tail) || - !PL_unify(head, ot->id) ) - return FALSE; - } - - return PL_unify_nil(tail); -} - - - /******************************* - * PREDICATES * - *******************************/ - -static foreign_t -rdf_assert4(term_t subject, term_t predicate, term_t object, term_t src) -{ rdf_db *db = DB; - triple *t = new_triple(db); - - if ( !get_triple(db, subject, predicate, object, t) ) - { free_triple(db, t); - return FALSE; - } - if ( src ) - { if ( !get_graph(src, t) ) - { free_triple(db, t); - return FALSE; - } - } else - { t->graph = ATOM_user; - t->line = NO_LINE; - } - - lock_atoms(t); - if ( !WRLOCK(db, FALSE) ) - { free_triple(db, t); - return FALSE; - } - - if ( db->tr_first ) - { record_transaction(db, TR_ASSERT, t); - } else - { link_triple(db, t); - db->generation++; - } - WRUNLOCK(db); - - return TRUE; -} - - -static foreign_t -rdf_assert3(term_t subject, term_t predicate, term_t object) -{ return rdf_assert4(subject, predicate, object, 0); -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -inc_active_queries(rdf_db *db); -dec_active_queries(rdf_db *db); - -TBD: Either delete this or use atomic inc/dec. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -static void -inc_active_queries(rdf_db *db) -{ LOCK_MISC(db); - db->active_queries++; - UNLOCK_MISC(db); -} - - -static void -dec_active_queries(rdf_db *db) -{ LOCK_MISC(db); - db->active_queries--; - assert(db->active_queries>=0); - UNLOCK_MISC(db); -} - - -typedef struct search_state -{ rdf_db *db; /* our database */ - term_t subject; /* Prolog term references */ - term_t object; - term_t predicate; - term_t src; - term_t realpred; - unsigned locked : 1; /* State has been locked */ - unsigned allocated : 1; /* State has been allocated */ - unsigned flags; /* Misc flags controlling search */ - atom_t prefix; /* prefix and like search */ - avl_enum *literal_state; /* Literal search state */ - literal *literal_cursor; /* pointer in current literal */ - literal_ex lit_ex; /* extended literal for fast compare */ - triple *cursor; /* Pointer in triple DB */ - triple pattern; /* Pattern triple */ -} search_state; - - -static void free_search_state(search_state *state); - -static void -init_cursor_from_literal(search_state *state, literal *cursor) -{ triple *p = &state->pattern; - unsigned long iv; - int i; - - DEBUG(3, - Sdprintf("Trying literal search for "); - print_literal(cursor); - Sdprintf("\n")); - - p->indexed |= BY_O; - p->indexed &= ~BY_S; /* we do not have index BY_SO */ - switch(p->indexed) - { case BY_O: - iv = literal_hash(cursor); - break; - case BY_OP: - iv = predicate_hash(p->predicate.r) ^ literal_hash(cursor); - break; - default: - iv = 0; /* make compiler silent */ - assert(0); - } - - i = (int)(iv % (long)state->db->table_size[p->indexed]); - state->cursor = state->db->table[p->indexed][i]; - state->literal_cursor = cursor; -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -(*) update_hash() is there to update the hash after a change to the -predicate organization. If we do not have a predicate or we do not -search using rdf_has/3, this is not needed. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -static int -init_search_state(search_state *state) -{ triple *p = &state->pattern; - - if ( get_partial_triple(state->db, - state->subject, state->predicate, state->object, - state->src, p) != TRUE ) - { free_triple(state->db, p); - return FALSE; - } - - if ( !RDLOCK(state->db) ) - { free_triple(state->db, p); - return FALSE; - } - state->locked = TRUE; - if ( p->predicate.r && (state->flags & MATCH_SUBPROPERTY) ) /* See (*) */ - { if ( !update_hash(state->db) ) - { free_search_state(state); - return FALSE; - } - } - - if ( (p->match == STR_MATCH_PREFIX || p->match == STR_MATCH_LIKE) && - p->indexed != BY_SP && - (state->prefix = first_atom(p->object.literal->value.string, p->match))) - { literal lit; - literal **rlitp; - - lit = *p->object.literal; - lit.value.string = state->prefix; - state->literal_state = rdf_malloc(state->db, - sizeof(*state->literal_state)); - state->lit_ex.literal = &lit; - prepare_literal_ex(&state->lit_ex); - rlitp = avlfindfirst(&state->db->literals, &state->lit_ex, state->literal_state); - if ( rlitp ) - { init_cursor_from_literal(state, *rlitp); - } else - { free_search_state(state); - return FALSE; - } - } else - { state->cursor = state->db->table[p->indexed] - [triple_hash(state->db, p, p->indexed)]; - } - - return TRUE; -} - - -static void -free_search_state(search_state *state) -{ if ( state->locked ) - { RDUNLOCK(state->db); - } - - free_triple(state->db, &state->pattern); - if ( state->prefix ) - PL_unregister_atom(state->prefix); - if ( state->literal_state ) - rdf_free(state->db, state->literal_state, sizeof(*state->literal_state)); - if ( state->allocated ) /* also means redo! */ - { dec_active_queries(state->db); - rdf_free(state->db, state, sizeof(*state)); - } -} - - -static foreign_t -allow_retry_state(search_state *state) -{ if ( !state->allocated ) - { search_state *copy = rdf_malloc(state->db, sizeof(*copy)); - *copy = *state; - copy->allocated = TRUE; - inc_active_queries(state->db); - - state = copy; - } - - PL_retry_address(state); -} - - -/* TBD: simplify. Maybe split for resource and literal search, as - both involve mutual exclusive complications to this routine, -*/ - -static int -next_search_state(search_state *state) -{ triple *t = state->cursor; - triple *p = &state->pattern; - -retry: - for( ; t; t = t->next[p->indexed]) - { if ( t->is_duplicate && !state->src ) - continue; - - /* hash-collision, skip */ - if ( state->literal_state ) - { if ( !(t->object_is_literal && - t->object.literal == state->literal_cursor) ) - continue; - } - - if ( match_triples(t, p, state->flags) ) - { term_t retpred = state->realpred ? state->realpred : state->predicate; - if ( !unify_triple(state->subject, retpred, state->object, - state->src, t, p->inversed) ) - continue; - if ( state->realpred && PL_is_variable(state->predicate) ) - { if ( !PL_unify(state->predicate, retpred) ) - return FALSE; - } - - t=t->next[p->indexed]; - inv_alt: - for(; t; t = t->next[p->indexed]) - { if ( state->literal_state ) - { if ( !(t->object_is_literal && - t->object.literal == state->literal_cursor) ) - continue; - } - - if ( match_triples(t, p, state->flags) ) - { state->cursor = t; - - return TRUE; /* non-deterministic */ - } - } - - if ( (state->flags & MATCH_INVERSE) && inverse_partial_triple(p) ) - { t = state->db->table[p->indexed][triple_hash(state->db, p, p->indexed)]; - goto inv_alt; - } - - state->cursor = NULL; /* deterministic */ - return TRUE; - } - } - - if ( (state->flags & MATCH_INVERSE) && inverse_partial_triple(p) ) - { t = state->db->table[p->indexed][triple_hash(state->db, p, p->indexed)]; - goto retry; - } - - if ( state->literal_state ) - { literal **litp; - - if ( (litp = avlfindnext(state->literal_state)) ) - { if ( state->prefix ) - { literal *lit = *litp; - - if ( !match_atoms(STR_MATCH_PREFIX, state->prefix, lit->value.string) ) - { DEBUG(1, - Sdprintf("Terminated literal iteration from "); - print_literal(lit); - Sdprintf("\n")); - return FALSE; /* no longer a prefix */ - } - } - - init_cursor_from_literal(state, *litp); - t = state->cursor; - - goto retry; - } - } - - return FALSE; -} - - - -static foreign_t -rdf(term_t subject, term_t predicate, term_t object, - term_t src, term_t realpred, control_t h, unsigned flags) -{ rdf_db *db = DB; - search_state *state; - - switch(PL_foreign_control(h)) - { case PL_FIRST_CALL: - { search_state buf; - - state = &buf; - memset(state, 0, sizeof(*state)); - state->db = db; - state->subject = subject; - state->object = object; - state->predicate = predicate; - state->src = src; - state->realpred = realpred; - state->flags = flags; - - if ( !init_search_state(state) ) - return FALSE; - - goto search; - } - case PL_REDO: - { int rc; - - state = PL_foreign_context_address(h); - assert(state->subject == subject); - - search: - if ( (rc=next_search_state(state)) ) - { if ( state->cursor || state->literal_state ) - return allow_retry_state(state); - } - - free_search_state(state); - return rc; - } - case PL_CUTTED: - { search_state *state = PL_foreign_context_address(h); - - free_search_state(state); - return TRUE; - } - default: - assert(0); - return FALSE; - } -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -rdf(Subject, Predicate, Object) - -Search specifications: - - Predicate: - - subPropertyOf(X) = P - - Object: - - literal(substring(X), L) - literal(word(X), L) - literal(exact(X), L) - literal(prefix(X), L) -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - - -static foreign_t -rdf3(term_t subject, term_t predicate, term_t object, control_t h) -{ return rdf(subject, predicate, object, 0, 0, h, - MATCH_EXACT); -} - - -static foreign_t -rdf4(term_t subject, term_t predicate, term_t object, - term_t src, control_t h) -{ return rdf(subject, predicate, object, src, 0, h, - MATCH_EXACT|MATCH_SRC); -} - - -static foreign_t -rdf_has(term_t subject, term_t predicate, term_t object, - term_t realpred, control_t h) -{ return rdf(subject, predicate, object, 0, realpred, h, - MATCH_SUBPROPERTY|MATCH_INVERSE); -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -rdf_estimate_complexity(+S,+P,+O,-C) - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -static foreign_t -rdf_estimate_complexity(term_t subject, term_t predicate, term_t object, - term_t complexity) -{ triple t; - long c; - rdf_db *db = DB; - int rc; - - memset(&t, 0, sizeof(t)); - if ( (rc=get_partial_triple(db, subject, predicate, object, 0, &t)) != TRUE ) - { if ( rc == -1 ) - { return FALSE; /* error */ - } else - { return PL_unify_integer(complexity, 0); /* no predicate */ - } - } - - if ( !RDLOCK(db) ) - return FALSE; - if ( !update_hash(db) ) /* or ignore this problem? */ - { RDUNLOCK(db); - free_triple(db, &t); - return FALSE; - } - - if ( t.indexed == BY_NONE ) - { c = db->created - db->erased; /* = totale triple count */ -#if 0 - } else if ( t.indexed == BY_P ) - { c = t.predicate.r->triple_count; /* must sum over children */ -#endif - } else - { c = db->counts[t.indexed][triple_hash(db, &t, t.indexed)]; - } - - rc = PL_unify_integer(complexity, c); - RDUNLOCK(db); - free_triple(db, &t); - - return rc; -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -current_literal(?Literals) -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -static foreign_t -rdf_current_literal(term_t t, control_t h) -{ rdf_db *db = DB; - literal **data; - avl_enum *state; - int rc; - - switch(PL_foreign_control(h)) - { case PL_FIRST_CALL: - if ( PL_is_variable(t) ) - { state = rdf_malloc(db, sizeof(*state)); - - RDLOCK(db); - inc_active_queries(db); - data = avlfindfirst(&db->literals, NULL, state); - goto next; - } else - { return FALSE; /* TBD */ - } - case PL_REDO: - state = PL_foreign_context_address(h); - data = avlfindnext(state); - next: - for(; data; data=avlfindnext(state)) - { literal *lit = *data; - - if ( unify_literal(t, lit) ) - { PL_retry_address(state); - } - } - - rc = FALSE; - goto cleanup; - case PL_CUTTED: - rc = TRUE; - - cleanup: - state = PL_foreign_context_address(h); - avlfinddestroy(state); - rdf_free(db, state, sizeof(*state)); - RDUNLOCK(db); - dec_active_queries(db); - - return rc; - default: - assert(0); - return FALSE; - } -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -rdf_update(+Subject, +Predicate, +Object, +Action) - -Update a triple. Please note this is actually erase+assert as the triple -needs to be updated in the linked lists while erase simply flags a -triple as `erases' without deleting it to support queries which active -choicepoints. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -static int -update_triple(rdf_db *db, term_t action, triple *t) -{ term_t a = PL_new_term_ref(); - triple tmp, *new; - int i; - /* Create copy in local memory */ - tmp = *t; - tmp.allocated = FALSE; - tmp.atoms_locked = FALSE; - if ( t->object_is_literal ) - tmp.object.literal = copy_literal(db, t->object.literal); - - if ( !PL_get_arg(1, action, a) ) - return type_error(action, "rdf_action"); - - if ( PL_is_functor(action, FUNCTOR_subject1) ) - { atom_t s; - - if ( !get_atom_ex(a, &s) ) - return FALSE; - if ( tmp.subject == s ) - return TRUE; /* no change */ - - tmp.subject = s; - } else if ( PL_is_functor(action, FUNCTOR_predicate1) ) - { predicate *p; - - if ( !get_predicate(db, a, &p) ) - return FALSE; - if ( tmp.predicate.r == p ) - return TRUE; /* no change */ - - tmp.predicate.r = p; - } else if ( PL_is_functor(action, FUNCTOR_object1) ) - { triple t2; - - memset(&t2, 0, sizeof(t2)); - - if ( !get_object(db, a, &t2) ) - { free_triple(db, &t2); - return FALSE; - } - if ( match_object(&t2, &tmp, MATCH_QUAL) ) - { free_triple(db, &t2); - return TRUE; - } - - if ( tmp.object_is_literal ) - free_literal(db, tmp.object.literal); - if ( (tmp.object_is_literal = t2.object_is_literal) ) - { tmp.object.literal = t2.object.literal; - } else - { tmp.object.resource = t2.object.resource; - } - } else if ( PL_is_functor(action, FUNCTOR_graph1) ) - { triple t2; - - if ( !get_graph(a, &t2) ) - return FALSE; - if ( t2.graph == t->graph && t2.line == t->line ) - return TRUE; - if ( db->tr_first ) - { record_update_src_transaction(db, t, t2.graph, t2.line); - } else - { if ( t->graph ) - unregister_graph(db, t); - t->graph = t2.graph; - t->line = t2.line; - if ( t->graph ) - register_graph(db, t); - } - - return TRUE; /* considered no change */ - } else - return domain_error(action, "rdf_action"); - - for(i=0; i<INDEX_TABLES; i++) - tmp.next[i] = NULL; - - new = new_triple(db); - new->subject = tmp.subject; - new->predicate.r = tmp.predicate.r; - if ( (new->object_is_literal = tmp.object_is_literal) ) - { new->object.literal = copy_literal(db, tmp.object.literal); - } else - { new->object.resource = tmp.object.resource; - } - new->graph = tmp.graph; - new->line = tmp.line; - - free_triple(db, &tmp); - lock_atoms(new); - - if ( db->tr_first ) - { record_update_transaction(db, t, new); - } else - { broadcast(EV_UPDATE, t, new); - erase_triple_silent(db, t); - link_triple_silent(db, new); - db->generation++; - } - - return TRUE; -} - - - -static foreign_t -rdf_update5(term_t subject, term_t predicate, term_t object, term_t src, - term_t action) -{ triple t, *p; - int indexed = BY_SP; - int done = 0; - rdf_db *db = DB; - - memset(&t, 0, sizeof(t)); - - if ( !get_src(src, &t) || - !get_triple(db, subject, predicate, object, &t) ) - return FALSE; - - if ( !WRLOCK(db, FALSE) ) - { free_triple(db, &t); - return FALSE; - } - if ( !update_hash(db) ) - { WRUNLOCK(db); - free_triple(db, &t); - return FALSE; - } - p = db->table[indexed][triple_hash(db, &t, indexed)]; - for( ; p; p = p->next[indexed]) - { if ( match_triples(p, &t, MATCH_EXACT) ) - { if ( !update_triple(db, action, p) ) - { WRUNLOCK(db); - free_triple(db, &t); - return FALSE; /* type errors */ - } - done++; - } - } - free_triple(db, &t); - WRUNLOCK(db); - - return done ? TRUE : FALSE; -} - - -static foreign_t -rdf_update(term_t subject, term_t predicate, term_t object, term_t action) -{ return rdf_update5(subject, predicate, object, 0, action); -} - - -static foreign_t -rdf_retractall4(term_t subject, term_t predicate, term_t object, term_t src) -{ triple t, *p; - rdf_db *db = DB; - - memset(&t, 0, sizeof(t)); - switch( get_partial_triple(db, subject, predicate, object, src, &t) ) - { case 0: /* no such predicate */ - return TRUE; - case -1: /* error */ - return FALSE; - } - - if ( t.graph ) /* speedup for rdf_retractall(_,_,_,DB) */ - { graph *gr = lookup_graph(db, t.graph, FALSE); - - if ( !gr || gr->triple_count == 0 ) - return TRUE; - } - - if ( !WRLOCK(db, FALSE) ) - return FALSE; -/* No need, as we do not search with subPropertyOf - if ( !update_hash(db) ) - { WRUNLOCK(db); - return FALSE; - } -*/ - p = db->table[t.indexed][triple_hash(db, &t, t.indexed)]; - for( ; p; p = p->next[t.indexed]) - { if ( match_triples(p, &t, MATCH_EXACT|MATCH_SRC) ) - { if ( t.object_is_literal && t.object.literal->objtype == OBJ_TERM ) - { fid_t fid = PL_open_foreign_frame(); - int rc = unify_object(object, p); - PL_discard_foreign_frame(fid); - if ( !rc ) - continue; - } - - if ( db->tr_first ) - { if ( db->tr_reset ) - { WRUNLOCK(db); - return permission_error("retract", "triple", "", - "rdf_retractall cannot follow " - "rdf_reset_db in one transaction"); - } - record_transaction(db, TR_RETRACT, p); - } else - { erase_triple(db, p); - db->generation++; - } - } - } - - WRUNLOCK(db); - free_triple(db, &t); - - return TRUE; -} - - -static foreign_t -rdf_retractall3(term_t subject, term_t predicate, term_t object) -{ return rdf_retractall4(subject, predicate, object, 0); -} - - - /******************************* - * MONITOR * - *******************************/ - -typedef struct broadcast_callback -{ struct broadcast_callback *next; - predicate_t pred; - long mask; -} broadcast_callback; - -static long joined_mask = 0L; -static broadcast_callback *callback_list; -static broadcast_callback *callback_tail; - -static void -do_broadcast(term_t term, long mask) -{ if ( callback_list ) - { broadcast_callback *cb; - - for(cb = callback_list; cb; cb = cb->next) - { qid_t qid; - term_t ex; - - if ( !(cb->mask & mask) ) - continue; - - qid = PL_open_query(NULL, PL_Q_CATCH_EXCEPTION, cb->pred, term); - if ( !PL_next_solution(qid) && (ex = PL_exception(qid)) ) - { term_t av = PL_new_term_refs(2); - - PL_cut_query(qid); - - PL_put_atom(av+0, ATOM_error); - PL_put_term(av+1, ex); - - PL_call_predicate(NULL, PL_Q_NORMAL, - PL_predicate("print_message", 2, "user"), - av); - } else - { PL_close_query(qid); - } - } - } -} - - -/* No longer used, but we keep it for if we need it again -static foreign_t -rdf_broadcast(term_t term, term_t mask) -{ long msk; - - if ( !get_long_ex(mask, &msk) ) - return FALSE; - - do_broadcast(term, msk); - return TRUE; -} -*/ - -static int -broadcast(broadcast_id id, void *a1, void *a2) -{ if ( (joined_mask & id) ) - { fid_t fid; - term_t term; - functor_t funct; - - if ( !(fid = PL_open_foreign_frame()) || - !(term = PL_new_term_ref()) ) - return FALSE; - - switch(id) - { case EV_ASSERT: - case EV_ASSERT_LOAD: - funct = FUNCTOR_assert4; - goto assert_retract; - case EV_RETRACT: - funct = FUNCTOR_retract4; - assert_retract: - { triple *t = a1; - term_t tmp; - - if ( !(tmp = PL_new_term_refs(4)) || - !PL_put_atom(tmp+0, t->subject) || - !PL_put_atom(tmp+1, t->predicate.r->name) || - !unify_object(tmp+2, t) || - !unify_graph(tmp+3, t) || - !PL_cons_functor_v(term, funct, tmp) ) - return FALSE; - break; - } - case EV_UPDATE: - { triple *t = a1; - triple *new = a2; - term_t tmp, a; - functor_t action; - int rc; - - if ( !(tmp = PL_new_term_refs(5)) || - !(a = PL_new_term_ref()) || - !PL_put_atom(tmp+0, t->subject) || - !PL_put_atom(tmp+1, t->predicate.r->name) || - !unify_object(tmp+2, t) || - !unify_graph(tmp+3, t) ) - return FALSE; - - if ( t->subject != new->subject ) - { action = FUNCTOR_subject1; - rc = PL_put_atom(a, new->subject); - } else if ( t->predicate.r != new->predicate.r ) - { action = FUNCTOR_predicate1; - rc = PL_put_atom(a, new->predicate.r->name); - } else if ( !match_object(t, new, MATCH_QUAL) ) - { action = FUNCTOR_object1; - rc = unify_object(a, new); - } else if ( !same_graph(t, new) ) - { action = FUNCTOR_graph1; - rc = unify_graph(a, new); - } else - { return TRUE; /* no change */ - } - - if ( !rc || - !PL_cons_functor_v(tmp+4, action, a) || - !PL_cons_functor_v(term, FUNCTOR_update5, tmp) ) - return FALSE; - break; - } - case EV_NEW_LITERAL: - { literal *lit = a1; - term_t tmp; - - if ( !(tmp = PL_new_term_refs(1)) || - !unify_literal(tmp, lit) || - !PL_cons_functor_v(term, FUNCTOR_new_literal1, tmp) ) - return FALSE; - break; - } - case EV_OLD_LITERAL: - { literal *lit = a1; - term_t tmp; - - if ( !(tmp = PL_new_term_refs(1)) || - !unify_literal(tmp, lit) || - !PL_cons_functor_v(term, FUNCTOR_old_literal1, tmp) ) - return FALSE; - break; - } - case EV_LOAD: - { term_t ctx = (term_t)a1; - atom_t be = (atom_t)a2; - term_t tmp; - - if ( !(tmp = PL_new_term_refs(2)) || - !PL_put_atom(tmp+0, be) || /* begin/end */ - !PL_put_term(tmp+1, ctx) || - !PL_cons_functor_v(term, FUNCTOR_load2, tmp) ) - return FALSE; - break; - } - case EV_TRANSACTION: - { term_t ctx = (term_t)a1; - term_t be = (term_t)a2; - term_t tmp; - - if ( !(tmp = PL_new_term_refs(2)) || - !PL_put_term(tmp+0, be) || /* begin/end */ - !PL_put_term(tmp+1, ctx) || - !PL_cons_functor_v(term, FUNCTOR_transaction2, tmp) ) - return FALSE; - break; - } - case EV_REHASH: - { atom_t be = (atom_t)a1; - term_t tmp = PL_new_term_refs(1); - - if ( !(tmp = PL_new_term_refs(1)) || - !PL_put_atom(tmp+0, be) || - !PL_cons_functor_v(term, FUNCTOR_rehash1, tmp) ) - return FALSE; - break; - } - default: - assert(0); - } - - do_broadcast(term, id); - - PL_discard_foreign_frame(fid); - } - - return TRUE; -} - - -static foreign_t -rdf_monitor(term_t goal, term_t mask) -{ atom_t name; - broadcast_callback *cb; - predicate_t p; - long msk; - module_t m = NULL; - - PL_strip_module(goal, &m, goal); - - if ( !get_atom_ex(goal, &name) || - !get_long_ex(mask, &msk) ) - return FALSE; - - p = PL_pred(PL_new_functor(name, 1), m); - - for(cb=callback_list; cb; cb = cb->next) - { if ( cb->pred == p ) - { broadcast_callback *cb2; - cb->mask = msk; - - joined_mask = 0L; - for(cb2=callback_list; cb2; cb2 = cb2->next) - joined_mask |= cb2->mask; - DEBUG(2, Sdprintf("Set mask to 0x%x\n", joined_mask)); - - return TRUE; - } - } - - cb = PL_malloc(sizeof(*cb)); - cb->next = NULL; - cb->mask = msk; - cb->pred = p; - if ( callback_list ) - { callback_tail->next = cb; - callback_tail = cb; - } else - { callback_list = callback_tail = cb; - } - joined_mask |= msk; - - return TRUE; -} - - - - /******************************* - * QUERY * - *******************************/ - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Enumerate the known subjects. This uses the `first' flag on triples to -avoid returning the same resource multiple times. As the `by_none' is -never re-hashed, we don't mark this query in the `active_queries'. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -static foreign_t -rdf_subject(term_t subject, control_t h) -{ triple *t; - rdf_db *db = DB; - - switch(PL_foreign_control(h)) - { case PL_FIRST_CALL: - { if ( PL_is_variable(subject) ) - { t = db->table[BY_NONE][0]; - goto next; - } else - { atom_t a; - - if ( get_atom_ex(subject, &a) ) - { if ( first(db, a) ) - return TRUE; - return FALSE; - } - - return FALSE; - } - } - case PL_REDO: - t = PL_foreign_context_address(h); - next: - for(; t; t = t->next[BY_NONE]) - { if ( t->first && !t->erased ) - { if ( !PL_unify_atom(subject, t->subject) ) - return FALSE; - - t = t->next[BY_NONE]; - if ( t ) - PL_retry_address(t); - return TRUE; - } - } - return FALSE; - case PL_CUTTED: - return TRUE; - default: - assert(0); - return FALSE; - } -} - - -static foreign_t -rdf_set_predicate(term_t pred, term_t option) -{ predicate *p; - rdf_db *db = DB; - - if ( !get_predicate(db, pred, &p) ) - return FALSE; - - if ( PL_is_functor(option, FUNCTOR_symmetric1) ) - { int val; - - if ( !get_bool_arg_ex(1, option, &val) ) - return FALSE; - - p->inverse_of = p; - return TRUE; - } else if ( PL_is_functor(option, FUNCTOR_inverse_of1) ) - { term_t a = PL_new_term_ref(); - predicate *i; - - _PL_get_arg(1, option, a); - if ( PL_get_nil(a) ) - { if ( p->inverse_of ) - { p->inverse_of->inverse_of = NULL; - p->inverse_of = NULL; - } - } else - { if ( !get_predicate(db, a, &i) ) - return FALSE; - - p->inverse_of = i; - i->inverse_of = p; - } - return TRUE; - } else if ( PL_is_functor(option, FUNCTOR_transitive1) ) - { int val; - - if ( !get_bool_arg_ex(1, option, &val) ) - return FALSE; - - p->transitive = val; - - return TRUE; - } else - return type_error(option, "predicate_option"); -} - - -#define PRED_PROPERTY_COUNT 9 -static functor_t predicate_key[PRED_PROPERTY_COUNT]; - -static int -unify_predicate_property(rdf_db *db, predicate *p, term_t option, functor_t f) -{ if ( f == FUNCTOR_symmetric1 ) - return PL_unify_term(option, PL_FUNCTOR, f, - PL_BOOL, p->inverse_of == p ? TRUE : FALSE); - else if ( f == FUNCTOR_inverse_of1 ) - { if ( p->inverse_of ) - return PL_unify_term(option, PL_FUNCTOR, f, - PL_ATOM, p->inverse_of->name); - else - return FALSE; - } else if ( f == FUNCTOR_transitive1 ) - { return PL_unify_term(option, PL_FUNCTOR, f, - PL_BOOL, p->transitive); - } else if ( f == FUNCTOR_triples1 ) - { return PL_unify_term(option, PL_FUNCTOR, f, - PL_LONG, p->triple_count); - } else if ( f == FUNCTOR_rdf_subject_branch_factor1 ) - { return PL_unify_term(option, PL_FUNCTOR, f, - PL_FLOAT, subject_branch_factor(db, p, DISTINCT_DIRECT)); - } else if ( f == FUNCTOR_rdf_object_branch_factor1 ) - { return PL_unify_term(option, PL_FUNCTOR, f, - PL_FLOAT, object_branch_factor(db, p, DISTINCT_DIRECT)); - } else if ( f == FUNCTOR_rdfs_subject_branch_factor1 ) - { return PL_unify_term(option, PL_FUNCTOR, f, - PL_FLOAT, subject_branch_factor(db, p, DISTINCT_SUB)); - } else if ( f == FUNCTOR_rdfs_object_branch_factor1 ) - { return PL_unify_term(option, PL_FUNCTOR, f, - PL_FLOAT, object_branch_factor(db, p, DISTINCT_SUB)); - } else - { assert(0); - return FALSE; - } -} - - -static foreign_t -rdf_current_predicates(term_t preds) -{ rdf_db *db = DB; - int i; - term_t head = PL_new_term_ref(); - term_t tail = PL_copy_term_ref(preds); - - LOCK_MISC(db); - for(i=0; i<db->pred_table_size; i++) - { predicate *p; - - for(p=db->pred_table[i]; p; p = p->next) - { if ( !PL_unify_list(tail, head, tail) || - !PL_unify_atom(head, p->name) ) - { UNLOCK_MISC(db); - return FALSE; - } - } - } - UNLOCK_MISC(db); - - return PL_unify_nil(tail); -} - - -static foreign_t -rdf_predicate_property(term_t pred, term_t option, control_t h) -{ int n; - predicate *p; - rdf_db *db = DB; - - if ( !predicate_key[0] ) - { int i = 0; - - predicate_key[i++] = FUNCTOR_symmetric1; - predicate_key[i++] = FUNCTOR_inverse_of1; - predicate_key[i++] = FUNCTOR_transitive1; - predicate_key[i++] = FUNCTOR_triples1; - predicate_key[i++] = FUNCTOR_rdf_subject_branch_factor1; - predicate_key[i++] = FUNCTOR_rdf_object_branch_factor1; - predicate_key[i++] = FUNCTOR_rdfs_subject_branch_factor1; - predicate_key[i++] = FUNCTOR_rdfs_object_branch_factor1; - assert(i < PRED_PROPERTY_COUNT); - } - - switch(PL_foreign_control(h)) - { case PL_FIRST_CALL: - { functor_t f; - - if ( PL_is_variable(option) ) - { n = 0; - goto redo; - } else if ( PL_get_functor(option, &f) ) - { for(n=0; predicate_key[n]; n++) - { if ( predicate_key[n] == f ) - { if ( !get_predicate(db, pred, &p) ) - return FALSE; - return unify_predicate_property(db, p, option, f); - } - } - return domain_error(option, "rdf_predicate_property"); - } else - return type_error(option, "rdf_predicate_property"); - } - case PL_REDO: - n = (int)PL_foreign_context(h); - redo: - if ( !get_predicate(db, pred, &p) ) - return FALSE; - for( ; predicate_key[n]; n++ ) - { if ( unify_predicate_property(db, p, option, predicate_key[n]) ) - { n++; - if ( predicate_key[n] ) - PL_retry(n); - return TRUE; - } - } - return FALSE; - case PL_CUTTED: - return TRUE; - default: - assert(0); - return TRUE; - } -} - - - /******************************* - * TRANSITIVE RELATIONS * - *******************************/ - -typedef struct visited -{ struct visited *next; /* next in list */ - struct visited *hash_link; /* next in hashed link */ - atom_t resource; /* visited resource */ - uintptr_t distance; /* Distance */ -} visited; - - -#define AGENDA_LOCAL_MAGIC 742736360 -#define AGENDA_SAVED_MAGIC 742736362 - -typedef struct agenda -{ visited *head; /* visited list */ - visited *tail; /* tail of visited list */ - visited *to_expand; /* next to expand */ - visited *to_return; /* next to return */ - visited **hash; /* hash-table for cycle detection */ - int magic; /* AGENDA_*_MAGIC */ - int hash_size; - int size; /* size of the agenda */ - uintptr_t max_d; /* max distance */ - triple pattern; /* partial triple used as pattern */ - atom_t target; /* resource we are seaching for */ - struct chunk *chunk; /* node-allocation chunks */ -} agenda; - -#ifndef offsetof -#define offsetof(structure, field) ((size_t) &(((structure *)NULL)->field)) -#endif -#define CHUNK_SIZE(n) offsetof(chunk, nodes[n]) - -typedef struct chunk -{ struct chunk *next; - int used; /* # used elements */ - int size; /* size of the chunk */ - struct visited nodes[1]; /* nodes in the chunk */ -} chunk; - - -static visited * -alloc_node_agenda(rdf_db *db, agenda *a) -{ chunk *c; - int size; - - if ( (c=a->chunk) ) - { if ( c->used < c->size ) - { visited *v = &c->nodes[c->used++]; - - return v; - } - } - - size = (a->size == 0 ? 8 : 1024); - c = rdf_malloc(db, CHUNK_SIZE(size)); - c->size = size; - c->used = 1; - c->next = a->chunk; - a->chunk = c; - - return &c->nodes[0]; -} - - -static void -empty_agenda(rdf_db *db, agenda *a) -{ chunk *c, *n; - - for(c=a->chunk; c; c = n) - { n = c->next; - rdf_free(db, c, CHUNK_SIZE(c->size)); - } - if ( a->hash ) - rdf_free(db, a->hash, sizeof(visited*)*a->hash_size); - - if ( a->magic == AGENDA_SAVED_MAGIC ) - { a->magic = 0; - rdf_free(db, a, sizeof(*a)); - } else - { a->magic = 0; - } -} - - -static void -unlock_and_empty_agenda(rdf_db *db, agenda *a) -{ RDUNLOCK(db); - empty_agenda(db, a); -} - - -static agenda * -save_agenda(rdf_db *db, agenda *a) -{ agenda *r = rdf_malloc(db, sizeof(*r)); - - assert(a->magic == AGENDA_LOCAL_MAGIC); - *r = *a; - r->magic = AGENDA_SAVED_MAGIC; - - return r; -} - - -static void -hash_agenda(rdf_db *db, agenda *a, int size) -{ if ( a->hash ) - rdf_free(db, a->hash, sizeof(*a->hash)); - if ( size > 0 ) - { visited *v; - - a->hash = rdf_malloc(db, sizeof(visited*)*size); - memset(a->hash, 0, sizeof(visited*)*size); - a->hash_size = size; - - for(v=a->head; v; v = v->next) - { int key = atom_hash(v->resource)&(size-1); - - v->hash_link = a->hash[key]; - a->hash[key] = v; - } - } -} - - -static int -in_aganda(agenda *a, atom_t resource) -{ visited *v; - - if ( a->hash ) - { int key = atom_hash(resource)&(a->hash_size-1); - v = a->hash[key]; - - for( ; v; v = v->hash_link ) - { if ( v->resource == resource ) - return TRUE; - } - } else - { v = a->head; - - for( ; v; v = v->next ) - { if ( v->resource == resource ) - return TRUE; - } - } - - return FALSE; -} - - -static visited * -append_agenda(rdf_db *db, agenda *a, atom_t res, uintptr_t d) -{ visited *v = a->head; - - if ( in_aganda(a, res) ) - return NULL; - - db->agenda_created++; /* statistics */ - - a->size++; - if ( !a->hash_size && a->size > 32 ) - hash_agenda(db, a, 64); - else if ( a->size > a->hash_size * 4 ) - hash_agenda(db, a, a->hash_size * 4); - - v = alloc_node_agenda(db, a); - v->resource = res; - v->distance = d; - v->next = NULL; - if ( a->tail ) - { a->tail->next = v; - a->tail = v; - } else - { a->head = a->tail = v; - } - - if ( a->hash_size ) - { int key = atom_hash(res)&(a->hash_size-1); - - v->hash_link = a->hash[key]; - a->hash[key] = v; - } - - return v; -} - - -static int -can_reach_target(rdf_db *db, agenda *a) -{ int indexed = a->pattern.indexed; - int rc = FALSE; - triple *p; - - if ( indexed & BY_S ) /* subj ---> */ - { a->pattern.object.resource = a->target; - indexed |= BY_O; - } else - { a->pattern.subject = a->target; - indexed |= BY_S; - } - - p = db->table[indexed][triple_hash(db, &a->pattern, indexed)]; - for( ; p; p = p->next[indexed]) - { if ( match_triples(p, &a->pattern, MATCH_SUBPROPERTY) ) - { rc = TRUE; - break; - } - } - - if ( a->pattern.indexed & BY_S ) - { a->pattern.object.resource = 0; - } else - { a->pattern.subject = 0; - } - - return rc; -} - - - -static visited * -bf_expand(rdf_db *db, agenda *a, atom_t resource, uintptr_t d) -{ triple *p; - int indexed = a->pattern.indexed; - visited *rc = NULL; - - if ( indexed & BY_S ) /* subj ---> */ - { a->pattern.subject = resource; - } else - { a->pattern.object.resource = resource; - } - - if ( a->target && can_reach_target(db, a) ) - { return append_agenda(db, a, a->target, d); - } - - p = db->table[indexed][triple_hash(db, &a->pattern, indexed)]; - for( ; p; p = p->next[indexed]) - { if ( match_triples(p, &a->pattern, MATCH_SUBPROPERTY) ) - { atom_t found; - visited *v; - - if ( indexed & BY_S ) - { if ( p->object_is_literal ) - continue; - found = p->object.resource; - } else - { found = p->subject; - } - - v = append_agenda(db, a, found, d); - if ( !rc ) - rc = v; - if ( found == a->target ) - break; - } - } - /* TBD: handle owl:inverseOf */ - /* TBD: handle owl:sameAs */ - return rc; -} - - -static visited * -next_agenda(rdf_db *db, agenda *a) -{ visited *v; - - if ( (v=a->to_return) ) - { ok: - - a->to_return = a->to_return->next; - - return v; - } - - while( a->to_expand ) - { uintptr_t next_d = a->to_expand->distance+1; - - if ( next_d >= a->max_d ) - return NULL; - - a->to_return = bf_expand(db, a, - a->to_expand->resource, - next_d); - a->to_expand = a->to_expand->next; - - if ( (v=a->to_return) ) - goto ok; - } - - return NULL; -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -rdf_reachable(+Subject, +Predicate, -Object) -rdf_reachable(-Subject, +Predicate, ?Object) - Examine transitive relations, reporting all `Object' that can be - reached from `Subject' using Predicate without going into a loop - if the relation is cyclic. - -directly_attached() deals with the posibility that the predicate is not -defined and Subject and Object are the same. Should use clean error -handling, but that means a lot of changes. For now this will do. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -static int -directly_attached(term_t pred, term_t from, term_t to) -{ if ( PL_is_atom(pred) && PL_is_atom(from) ) - return PL_unify(to, from); - - return FALSE; -} - - -static int -unify_distance(term_t d, uintptr_t dist) -{ if ( d ) - return PL_unify_integer(d, dist); - - return TRUE; -} - - -static foreign_t -rdf_reachable(term_t subj, term_t pred, term_t obj, - term_t max_d, term_t d, - control_t h) -{ rdf_db *db = DB; - - switch(PL_foreign_control(h)) - { case PL_FIRST_CALL: - { agenda a; - visited *v; - term_t target_term; - int is_det = FALSE; - - if ( PL_is_variable(pred) ) - return instantiation_error(pred); - - memset(&a, 0, sizeof(a)); - a.magic = AGENDA_LOCAL_MAGIC; - if ( max_d ) - { long md; - atom_t inf; - - if ( PL_get_atom(max_d, &inf) && inf == ATOM_infinite ) - a.max_d = (uintptr_t)-1; - if ( !get_long_ex(max_d, &md) || md < 0 ) - return FALSE; - a.max_d = md; - } else - { a.max_d = (uintptr_t)-1; - } - - if ( !PL_is_variable(subj) ) /* subj .... obj */ - { switch(get_partial_triple(db, subj, pred, 0, 0, &a.pattern)) - { case 0: - return directly_attached(pred, subj, obj) && - unify_distance(d, 0); - case -1: - return FALSE; - } - is_det = PL_is_ground(obj); - target_term = obj; - } else if ( !PL_is_variable(obj) ) /* obj .... subj */ - { switch(get_partial_triple(db, 0, pred, obj, 0, &a.pattern)) - { case 0: - return directly_attached(pred, obj, subj); - case -1: - return FALSE; - } - if ( a.pattern.object_is_literal ) - return FALSE; /* rdf_reachable(-,+,literal(...)) */ - target_term = subj; - } else - return instantiation_error(subj); - - if ( !RDLOCK(db) ) - return FALSE; - if ( !update_hash(db) ) - return FALSE; - if ( (a.pattern.indexed & BY_S) ) /* subj ... */ - append_agenda(db, &a, a.pattern.subject, 0); - else - append_agenda(db, &a, a.pattern.object.resource, 0); - a.to_return = a.head; - a.to_expand = a.head; - - while( (v=next_agenda(db, &a)) ) - { if ( PL_unify_atom(target_term, v->resource) ) - { if ( is_det ) /* mode(+, +, +) */ - { int rc = unify_distance(d, v->distance); - unlock_and_empty_agenda(db, &a); - return rc; - } else if ( unify_distance(d, v->distance) ) - { /* mode(+, +, -) or mode(-, +, +) */ - agenda *ra = save_agenda(db, &a); - inc_active_queries(db); - DEBUG(9, Sdprintf("Saved agenta to %p\n", ra)); - PL_retry_address(ra); - } - } - } - unlock_and_empty_agenda(db, &a); - return FALSE; - } - case PL_REDO: - { agenda *a = PL_foreign_context_address(h); - term_t target_term; - visited *v; - - assert(a->magic == AGENDA_SAVED_MAGIC); - - if ( !PL_is_variable(subj) ) /* +, +, - */ - target_term = obj; - else - target_term = subj; /* -, +, + */ - - while( (v=next_agenda(db, a)) ) - { if ( PL_unify_atom(target_term, v->resource) && - unify_distance(d, v->distance) ) - { assert(a->magic == AGENDA_SAVED_MAGIC); - PL_retry_address(a); - } - } - - dec_active_queries(db); - unlock_and_empty_agenda(db, a); - return FALSE; - } - case PL_CUTTED: - { agenda *a = PL_foreign_context_address(h); - - DEBUG(9, Sdprintf("Cutted; agenda = %p\n", a)); - - assert(a->magic == AGENDA_SAVED_MAGIC); - - dec_active_queries(db); - unlock_and_empty_agenda(db, a); - return TRUE; - } - default: - assert(0); - return FALSE; - } -} - -static foreign_t -rdf_reachable3(term_t subj, term_t pred, term_t obj, control_t h) -{ return rdf_reachable(subj, pred, obj, 0, 0, h); -} - -static foreign_t -rdf_reachable5(term_t subj, term_t pred, term_t obj, term_t max_d, term_t d, - control_t h) -{ return rdf_reachable(subj, pred, obj, max_d, d, h); -} - - - /******************************* - * STATISTICS * - *******************************/ - -static functor_t keys[16]; /* initialised in install_rdf_db() */ - -static int -unify_statistics(rdf_db *db, term_t key, functor_t f) -{ int64_t v; - - if ( f == FUNCTOR_triples1 ) - { v = db->created - db->erased; - } else if ( f == FUNCTOR_subjects1 ) - { v = db->subjects; - } else if ( f == FUNCTOR_predicates1 ) - { v = db->pred_count; - } else if ( f == FUNCTOR_core1 ) - { v = db->core; - } else if ( f == FUNCTOR_indexed8 ) - { int i; - term_t a = PL_new_term_ref(); - - if ( !PL_unify_functor(key, FUNCTOR_indexed8) ) - return FALSE; - for(i=0; i<8; i++) - { if ( !PL_get_arg(i+1, key, a) || - !PL_unify_integer(a, db->indexed[i]) ) - return FALSE; - } - - return TRUE; - } else if ( f == FUNCTOR_searched_nodes1 ) - { v = db->agenda_created; - } else if ( f == FUNCTOR_duplicates1 ) - { v = db->duplicates; - } else if ( f == FUNCTOR_literals1 ) - { v = db->literals.count; - } else if ( f == FUNCTOR_triples2 && PL_is_functor(key, f) ) - { graph *src; - term_t a = PL_new_term_ref(); - atom_t name; - - _PL_get_arg(1, key, a); - if ( !PL_get_atom(a, &name) ) - return type_error(a, "atom"); - if ( (src = lookup_graph(db, name, FALSE)) ) - v = src->triple_count; - else - v = 0; - - _PL_get_arg(2, key, a); - return PL_unify_int64(a, v); - } else if ( f == FUNCTOR_gc2 ) - { return PL_unify_term(key, - PL_FUNCTOR, f, - PL_INT, db->gc_count, - PL_FLOAT, db->gc_time); /* time spent */ - } else if ( f == FUNCTOR_rehash2 ) - { return PL_unify_term(key, - PL_FUNCTOR, f, - PL_INT, db->rehash_count, - PL_FLOAT, db->rehash_time); - } else - assert(0); - - return PL_unify_term(key, PL_FUNCTOR, f, PL_INT64, v); -} - -static foreign_t -rdf_statistics(term_t key, control_t h) -{ int n; - rdf_db *db = DB; - - switch(PL_foreign_control(h)) - { case PL_FIRST_CALL: - { functor_t f; - - if ( PL_is_variable(key) ) - { n = 0; - goto redo; - } else if ( PL_get_functor(key, &f) ) - { for(n=0; keys[n]; n++) - { if ( keys[n] == f ) - return unify_statistics(db, key, f); - } - return domain_error(key, "rdf_statistics"); - } else - return type_error(key, "rdf_statistics"); - } - case PL_REDO: - n = (int)PL_foreign_context(h); - redo: - unify_statistics(db, key, keys[n]); - n++; - if ( keys[n] ) - PL_retry(n); - case PL_CUTTED: - return TRUE; - default: - assert(0); - return TRUE; - } -} - - -static foreign_t -rdf_generation(term_t t) -{ rdf_db *db = DB; - - return PL_unify_integer(t, db->generation); -} - - - /******************************* - * RESET * - *******************************/ - -static void -erase_triples(rdf_db *db) -{ triple *t, *n; - int i; - - for(t=db->by_none; t; t=n) - { n = t->next[BY_NONE]; - - free_triple(db, t); - db->freed++; - } - db->by_none = db->by_none_tail = NULL; - - for(i=BY_S; i<=BY_OP; i++) - { if ( db->table[i] ) - { int bytes = sizeof(triple*) * db->table_size[i]; - - memset(db->table[i], 0, bytes); - memset(db->tail[i], 0, bytes); - } - } - - db->created = 0; - db->erased = 0; - db->freed = 0; - db->erased = 0; - db->subjects = 0; - db->rehash_count = 0; - memset(db->indexed, 0, sizeof(db->indexed)); - db->duplicates = 0; - db->generation = 0; -} - - -static void -erase_predicates(rdf_db *db) -{ predicate **ht; - int i; - - for(i=0,ht = db->pred_table; i<db->pred_table_size; i++, ht++) - { predicate *p, *n; - - for( p = *ht; p; p = n ) - { n = p->next; - - free_list(db, &p->subPropertyOf); - free_list(db, &p->siblings); - if ( ++p->cloud->deleted == p->cloud->size ) - free_predicate_cloud(db, p->cloud); - - rdf_free(db, p, sizeof(*p)); - } - - *ht = NULL; - } - - db->pred_count = 0; - db->next_hash = 0; -} - - -static void -reset_db(rdf_db *db) -{ db->resetting = TRUE; - - erase_triples(db); - erase_predicates(db); - erase_graphs(db); - db->need_update = FALSE; - db->agenda_created = 0; - avlfree(&db->literals); - init_literal_table(db); - - db->resetting = FALSE; -} - - -static foreign_t -rdf_reset_db() -{ rdf_db *db = DB; - - if ( !WRLOCK(db, FALSE) ) - return FALSE; - - if ( db->tr_first ) - { record_transaction(db, TR_RESET, NULL); - db->tr_reset = TRUE; - } else - reset_db(db); - - WRUNLOCK(db); - - return TRUE; -} - - - /******************************* - * MATCH * - *******************************/ - - -static foreign_t -match_label(term_t how, term_t search, term_t label) -{ atom_t h, f, l; - int type; - - if ( !get_atom_ex(how, &h) || - !get_atom_ex(search, &f) || - !get_atom_ex(label, &l) ) - return FALSE; - - if ( h == ATOM_exact ) - type = STR_MATCH_EXACT; - else if ( h == ATOM_substring ) - type = STR_MATCH_SUBSTRING; - else if ( h == ATOM_word ) - type = STR_MATCH_WORD; - else if ( h == ATOM_prefix ) - type = STR_MATCH_PREFIX; - else if ( h == ATOM_like ) - type = STR_MATCH_LIKE; - else - return domain_error(how, "search_method"); - - return match_atoms(type, f, l); -} - - -static foreign_t -lang_matches(term_t lang, term_t pattern) -{ atom_t l, p; - - if ( !get_atom_ex(lang, &l) || - !get_atom_ex(pattern, &p) ) - return FALSE; - - return atom_lang_matches(l, p); -} - - - - - /******************************* - * VERSION * - *******************************/ - -static foreign_t -rdf_version(term_t v) -{ return PL_unify_integer(v, RDF_VERSION); -} - - - /******************************* - * MORE STUFF * - *******************************/ - -#include "quote.c" - - /******************************* - * REGISTER * - *******************************/ - -#define MKFUNCTOR(n, a) \ - FUNCTOR_ ## n ## a = PL_new_functor(PL_new_atom(#n), a) -#define NDET PL_FA_NONDETERMINISTIC -#define META PL_FA_TRANSPARENT - -install_t -install_rdf_db() -{ int i=0; - extern install_t install_atom_map(void); - - MKFUNCTOR(literal, 1); - MKFUNCTOR(error, 2); - MKFUNCTOR(type_error, 2); - MKFUNCTOR(domain_error, 2); - MKFUNCTOR(triples, 1); - MKFUNCTOR(triples, 2); - MKFUNCTOR(subjects, 1); - MKFUNCTOR(predicates, 1); - MKFUNCTOR(subject, 1); - MKFUNCTOR(predicate, 1); - MKFUNCTOR(object, 1); - MKFUNCTOR(graph, 1); - MKFUNCTOR(indexed, 8); - MKFUNCTOR(exact, 1); - MKFUNCTOR(plain, 1); - MKFUNCTOR(substring, 1); - MKFUNCTOR(word, 1); - MKFUNCTOR(prefix, 1); - MKFUNCTOR(like, 1); - MKFUNCTOR(literal, 2); - MKFUNCTOR(searched_nodes, 1); - MKFUNCTOR(duplicates, 1); - MKFUNCTOR(literals, 1); - MKFUNCTOR(symmetric, 1); - MKFUNCTOR(transitive, 1); - MKFUNCTOR(inverse_of, 1); - MKFUNCTOR(lang, 2); - MKFUNCTOR(type, 2); - MKFUNCTOR(rdf_subject_branch_factor, 1); - MKFUNCTOR(rdf_object_branch_factor, 1); - MKFUNCTOR(rdfs_subject_branch_factor, 1); - MKFUNCTOR(rdfs_object_branch_factor, 1); - MKFUNCTOR(gc, 2); - MKFUNCTOR(rehash, 2); - MKFUNCTOR(core, 1); - MKFUNCTOR(assert, 4); - MKFUNCTOR(retract, 4); - MKFUNCTOR(update, 5); - MKFUNCTOR(new_literal, 1); - MKFUNCTOR(old_literal, 1); - MKFUNCTOR(transaction, 2); - MKFUNCTOR(load, 2); - MKFUNCTOR(rehash, 1); - MKFUNCTOR(begin, 1); - MKFUNCTOR(end, 1); - - FUNCTOR_colon2 = PL_new_functor(PL_new_atom(":"), 2); - - ATOM_user = PL_new_atom("user"); - ATOM_exact = PL_new_atom("exact"); - ATOM_plain = PL_new_atom("plain"); - ATOM_prefix = PL_new_atom("prefix"); - ATOM_like = PL_new_atom("like"); - ATOM_substring = PL_new_atom("substring"); - ATOM_word = PL_new_atom("word"); - ATOM_subPropertyOf = PL_new_atom(URL_subPropertyOf); - ATOM_error = PL_new_atom("error"); - ATOM_begin = PL_new_atom("begin"); - ATOM_end = PL_new_atom("end"); - ATOM_infinite = PL_new_atom("infinite"); - - PRED_call1 = PL_predicate("call", 1, "user"); - - /* statistics */ - keys[i++] = FUNCTOR_triples1; - keys[i++] = FUNCTOR_subjects1; - keys[i++] = FUNCTOR_indexed8; - keys[i++] = FUNCTOR_predicates1; - keys[i++] = FUNCTOR_searched_nodes1; - keys[i++] = FUNCTOR_duplicates1; - keys[i++] = FUNCTOR_literals1; - keys[i++] = FUNCTOR_triples2; - keys[i++] = FUNCTOR_gc2; - keys[i++] = FUNCTOR_rehash2; - keys[i++] = FUNCTOR_core1; - keys[i++] = 0; - - /* setup the database */ - DB = new_db(); - - PL_register_foreign("rdf_version", 1, rdf_version, 0); - PL_register_foreign("rdf_assert", 3, rdf_assert3, 0); - PL_register_foreign("rdf_assert", 4, rdf_assert4, 0); - PL_register_foreign("rdf_update", 4, rdf_update, 0); - PL_register_foreign("rdf_update", 5, rdf_update5, 0); - PL_register_foreign("rdf_retractall", 3, rdf_retractall3, 0); - PL_register_foreign("rdf_retractall", 4, rdf_retractall4, 0); - PL_register_foreign("rdf_subject", 1, rdf_subject, NDET); - PL_register_foreign("rdf", 3, rdf3, NDET); - PL_register_foreign("rdf", 4, rdf4, NDET); - PL_register_foreign("rdf_has", 4, rdf_has, NDET); - PL_register_foreign("rdf_statistics_",1, rdf_statistics, NDET); - PL_register_foreign("rdf_generation", 1, rdf_generation, 0); - PL_register_foreign("rdf_match_label",3, match_label, 0); - PL_register_foreign("rdf_save_db_", 2, rdf_save_db, 0); - PL_register_foreign("rdf_load_db_", 3, rdf_load_db, 0); - PL_register_foreign("rdf_reachable", 3, rdf_reachable3, NDET); - PL_register_foreign("rdf_reachable", 5, rdf_reachable5, NDET); - PL_register_foreign("rdf_reset_db_", 0, rdf_reset_db, 0); - PL_register_foreign("rdf_set_predicate", - 2, rdf_set_predicate, 0); - PL_register_foreign("rdf_predicate_property_", - 2, rdf_predicate_property, NDET); - PL_register_foreign("rdf_current_predicates", - 1, rdf_current_predicates, 0); - PL_register_foreign("rdf_current_literal", - 1, rdf_current_literal, NDET); - PL_register_foreign("rdf_graphs_", 1, rdf_graphs, 0); - PL_register_foreign("rdf_set_graph_source", 3, rdf_set_graph_source, 0); - PL_register_foreign("rdf_unset_graph_source", 1, rdf_unset_graph_source, 0); - PL_register_foreign("rdf_graph_source_", 3, rdf_graph_source, 0); - PL_register_foreign("rdf_estimate_complexity", - 4, rdf_estimate_complexity, 0); - PL_register_foreign("rdf_transaction_",2, rdf_transaction, META); - PL_register_foreign("rdf_active_transactions_", - 1, rdf_active_transactions, 0); - PL_register_foreign("rdf_monitor_", 2, rdf_monitor, META); -/*PL_register_foreign("rdf_broadcast_", 2, rdf_broadcast, 0);*/ -#ifdef WITH_MD5 - PL_register_foreign("rdf_md5", 2, rdf_md5, 0); - PL_register_foreign("rdf_atom_md5", 3, rdf_atom_md5, 0); -#endif - PL_register_foreign("rdf_quote_uri", 2, rdf_quote_uri, 0); - -#ifdef O_DEBUG - PL_register_foreign("rdf_debug", 1, rdf_debug, 0); - PL_register_foreign("rdf_print_predicate_cloud", 1, rdf_print_predicate_cloud, 0); -#endif -#ifdef O_SECURE - PL_register_foreign("rdf_dump_literals", 0, dump_literals, 0); - PL_register_foreign("rdf_check_literals", 0, check_transitivity, 0); -#endif - PL_register_foreign("lang_matches", 2, lang_matches, 0); - - install_atom_map(); -} diff --git a/packages/semweb/rdf_db.h b/packages/semweb/rdf_db.h deleted file mode 100644 index 5d5f8b038..000000000 --- a/packages/semweb/rdf_db.h +++ /dev/null @@ -1,275 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog - - Author: Jan Wielemaker - E-mail: wielemak@science.uva.nl - WWW: http://www.swi-prolog.org - Copyright (C): 1985-2007, University of Amsterdam - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef RDFDB_H_INCLUDED -#define RDFDB_H_INCLUDED -#include "avl.h" -#ifdef WITH_MD5 -#include "md5.h" -#endif -#include "lock.h" - -#define RDF_VERSION 20800 /* 2.8.0 */ - -#define URL_subPropertyOf \ - "http://www.w3.org/2000/01/rdf-schema#subPropertyOf" - - - /******************************* - * C * - *******************************/ - -/* Keep consistent with md5_type[] in rdf_db.c! */ -#define OBJ_UNTYPED 0x0 /* partial: don't know */ -#define OBJ_INTEGER 0x1 -#define OBJ_DOUBLE 0x2 -#define OBJ_STRING 0x3 -#define OBJ_TERM 0x4 - -#define Q_NONE 0x0 -#define Q_TYPE 0x1 -#define Q_LANG 0x2 - -#define BY_NONE 0x00 /* 0 */ -#define BY_S 0x01 /* 1 */ -#define BY_P 0x02 /* 2 */ -#define BY_O 0x04 /* 4 */ -#define BY_SP (BY_S|BY_P) /* 3 */ -#define BY_SO (BY_S|BY_O) /* 5 */ -#define BY_OP (BY_P|BY_O) /* 6 */ -#define BY_SPO (BY_S|BY_P|BY_O) /* 7 */ - -#define INDEX_TABLES 7 -#define INITIAL_TABLE_SIZE 8*1024 -#define INITIAL_PREDICATE_TABLE_SIZE 1024 -#define INITIAL_GRAPH_TABLE_SIZE 64 - -#define MAX_HASH_FACTOR 8 /* factor to trigger re-hash */ -#define MIN_HASH_FACTOR 4 /* factor after re-hash */ - -#define NO_LINE (0) - -typedef struct cell -{ void * value; /* represented resource */ - struct cell *next; /* next in chain */ -} cell; - - -typedef struct list -{ cell *head; /* first in list */ - cell *tail; /* tail of list */ -} list; - - -typedef struct bitmatrix -{ size_t width; - size_t heigth; - int bits[1]; -} bitmatrix; - - -#define DISTINCT_DIRECT 0 /* for ->distinct_subjects, etc */ -#define DISTINCT_SUB 1 - -typedef struct predicate -{ atom_t name; /* name of the predicate */ - struct predicate *next; /* next in hash-table */ - /* hierarchy */ - list subPropertyOf; /* the one I'm subPropertyOf */ - list siblings; /* reverse of subPropertyOf */ - int label; /* Numeric label in cloud */ - struct predicate_cloud *cloud; /* cloud I belong to */ - unsigned int hash; /* key used for hashing - (=hash if ->cloud is up-to-date) */ - /* properties */ - struct predicate *inverse_of; /* my inverse predicate */ - unsigned transitive : 1; /* P(a,b)&P(b,c) --> P(a,c) */ - /* statistics */ - long triple_count; /* # triples on this predicate */ - long distinct_updated[2];/* Is count still valid? */ - long distinct_count[2]; /* Triple count at last update */ - long distinct_subjects[2];/* # distinct subject values */ - long distinct_objects[2];/* # distinct object values */ -} predicate; - - -typedef struct predicate_cloud -{ predicate **members; /* member predicates */ - unsigned int hash; /* hash-code */ - size_t size; /* size of the cloud */ - size_t deleted; /* See erase_predicates() */ - bitmatrix *reachable; /* cloud reachability matrix */ - unsigned dirty : 1; /* predicate hash not synchronised */ -} predicate_cloud; - - -typedef struct graph -{ struct graph *next; /* next in table */ - atom_t name; /* name of the graph */ - atom_t source; /* URL graph was loaded from */ - double modified; /* Modified time of source URL */ - int triple_count; /* # triples associated to it */ -#ifdef WITH_MD5 - unsigned md5 : 1; /* do/don't record MD5 */ - md5_byte_t digest[16]; /* MD5 digest */ -#endif -} graph; - - -typedef struct literal -{ union - { atom_t string; - int64_t integer; - double real; - struct - { record_t record; - size_t len; - } term; /* external record */ - } value; - atom_t type_or_lang; /* Type or language for literals */ - unsigned int hash; /* saved hash */ - unsigned objtype : 3; - unsigned qualifier : 2; /* Lang/Type qualifier */ - unsigned shared : 1; /* member of shared table */ - unsigned term_loaded : 1; /* OBJ_TERM from quick save file */ - unsigned atoms_locked : 1; /* Atoms have been locked */ - unsigned references : 24; /* # references to me */ -} literal; - - -#define t_match next[0] - -typedef struct triple -{ atom_t subject; - union - { predicate* r; /* resolved: normal DB */ - atom_t u; /* used by rdf_load_db_/3 */ - } predicate; - union - { literal * literal; - atom_t resource; - } object; - atom_t graph; /* where it comes from */ - unsigned long line; /* graph-line number */ - /* indexing */ - struct triple*next[INDEX_TABLES]; /* hash-table next links */ - /* flags */ - unsigned object_is_literal : 1; /* Object is a literal */ - unsigned resolve_pred : 1; /* predicates needs to be resolved */ - unsigned indexed : 3; /* Partials: BY_* */ - unsigned erased : 1; /* If TRUE, triple is erased */ - unsigned first : 1; /* I'm the first on subject */ - unsigned match : 3; /* How to match literals */ - unsigned inversed : 1; /* Partials: using inverse match */ - unsigned is_duplicate : 1; /* I'm a duplicate */ - unsigned allocated : 1; /* Triple is allocated */ - unsigned atoms_locked : 1; /* Atoms have been locked */ - unsigned duplicates : 16; /* Duplicate count */ - /* Total: 32 */ -} triple; - - -typedef enum -{ TR_MARK, /* mark start for nesting */ - TR_SUB_START, /* start nested transaction */ - TR_SUB_END, /* end nested transaction */ - TR_ASSERT, /* rdf_assert */ - TR_RETRACT, /* rdf_retractall */ - TR_UPDATE, /* rdf_update */ - TR_UPDATE_SRC, /* rdf_update */ - TR_UPDATE_MD5, /* update md5 src */ - TR_RESET, /* rdf_reset_db */ - TR_VOID /* no-op */ -} tr_type; - - -typedef struct transaction_record -{ struct transaction_record *previous; - struct transaction_record *next; - tr_type type; - triple *triple; /* new/deleted triple */ - union - { triple *triple; /* used for update */ - struct - { atom_t atom; - unsigned long line; - } src; - struct - { graph *graph; - md5_byte_t *digest; - } md5; - record_t transaction_id; - } update; -} transaction_record; - - -typedef struct active_transaction -{ struct active_transaction *parent; - term_t id; -} active_transaction; - - -typedef struct rdf_db -{ triple *by_none, *by_none_tail; - triple **table[INDEX_TABLES]; - triple **tail[INDEX_TABLES]; - int *counts[INDEX_TABLES]; - int table_size[INDEX_TABLES]; - long created; /* #triples created */ - long erased; /* #triples erased */ - long freed; /* #triples actually erased */ - long subjects; /* subjects (unique first) */ - long indexed[8]; /* Count calls */ - int rehash_count; /* # rehashes */ - int gc_count; /* # garbage collections */ - int gc_blocked; /* GC is blocked; */ - double rehash_time; /* time spent in rehash */ - double gc_time; /* time spent in GC */ - size_t core; /* core in use */ - predicate **pred_table; /* Hash-table of predicates */ - int pred_table_size; /* #entries in the table */ - int pred_count; /* #predicates */ - unsigned long next_hash; /* cloud hash keys */ - int active_queries; /* Calls with choicepoints */ - int need_update; /* We need to update */ - long agenda_created; /* #visited nodes in agenda */ - long duplicates; /* #duplicate triples */ - long generation; /* generation-id of the database */ - graph **graph_table; /* Hash table of sources */ - int graph_table_size; /* Entries in table */ - - graph *last_graph; /* last accessed graph */ - active_transaction *tr_active; /* open transactions */ - transaction_record *tr_first; /* first transaction record */ - transaction_record *tr_last; /* last transaction record */ - int tr_nesting; /* nesting depth of transactions */ - int tr_reset; /* transaction contains reset */ - int resetting; /* We are in rdf_reset_db() */ - - rwlock lock; /* threaded access */ - - avl_tree literals; -} rdf_db; - -#endif /*RDFDB_H_INCLUDED*/ diff --git a/packages/semweb/rdf_db.pl b/packages/semweb/rdf_db.pl deleted file mode 100644 index b715e4342..000000000 --- a/packages/semweb/rdf_db.pl +++ /dev/null @@ -1,2193 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog - - Author: Jan Wielemaker - E-mail: wielemak@science.uva.nl - WWW: http://www.swi-prolog.org - Copyright (C): 1985-2007, University of Amsterdam - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - As a special exception, if you link this library with other files, - compiled with a Free Software compiler, to produce an executable, this - library does not by itself cause the resulting executable to be covered - by the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -:- module(rdf_db, - [ rdf_version/1, % -Version - - rdf/3, % ?Subject, ?Predicate, ?Object - rdf/4, % ?Subject, ?Predicate, ?Object, ?DB - rdf_has/3, % ?Subject, +Pred, ?Obj - rdf_has/4, % ?Subject, +Pred, ?Obj, -RealPred - rdf_reachable/3, % ?Subject, +Pred, ?Object - rdf_reachable/5, % ?Subject, +Pred, ?Object, +MaxD, ?D - rdf_subject/1, % ?Subject - - rdf_member_property/2, % ?Property, ?Index - - rdf_assert/3, % +Subject, +Predicate, +Object - rdf_assert/4, % +Subject, +Predicate, +Object, +DB - rdf_retractall/3, % ?Subject, ?Predicate, ?Object - rdf_retractall/4, % ?Subject, ?Predicate, ?Object, +DB - rdf_update/4, % +Subject, +Predicate, +Object, +Act - rdf_update/5, % +Subject, +Predicate, +Object, +Src, +Act - rdf_set_predicate/2, % +Predicate, +Property - rdf_predicate_property/2, % +Predicate, ?Property - rdf_current_predicate/1, % -Predicate - rdf_current_literal/1, % -Literal - rdf_transaction/1, % :Goal - rdf_transaction/2, % :Goal, +Id - rdf_active_transaction/1, % ?Id - - rdf_monitor/2, % :Goal, +Options - - rdf_save_db/1, % +File - rdf_save_db/2, % +File, +DB - rdf_load_db/1, % +File - rdf_reset_db/0, - - rdf_node/1, % -Id - rdf_bnode/1, % -Id - rdf_is_bnode/1, % +Id - - rdf_is_resource/1, % +Term - rdf_is_literal/1, % +Term - - rdf_load/1, % +File - rdf_load/2, % +File, +Options - rdf_save/1, % +File - rdf_save/2, % +File, +Options - rdf_unload/1, % +File - - rdf_md5/2, % +DB, -MD5 - rdf_atom_md5/3, % +Text, +Times, -MD5 - - rdf_graph/1, % ?DB - rdf_source/1, % ?File - rdf_source/2, % ?DB, ?SourceURL - rdf_make/0, % Reload modified databases - - rdf_source_location/2, % +Subject, -Source - rdf_statistics/1, % -Key - rdf_generation/1, % -Generation - rdf_estimate_complexity/4, % +S,+P,+O,-Count - - rdf_save_subject/3, % +Stream, +Subject, +DB - rdf_save_header/2, % +Out, +Options - rdf_save_footer/1, % +Out - - rdf_equal/2, % ?Resource, ?Resource - - rdf_current_ns/2, % ?Alias, ?URI - rdf_register_ns/2, % +Alias, +URI - rdf_register_ns/3, % +Alias, +URI, +Options - rdf_global_id/2, % ?NS:Name, ?Global - rdf_global_object/2, % ?Object, ?NSExpandedObject - rdf_global_term/2, % Term, WithExpandedNS - - rdf_match_label/3, % +How, +String, +Label - rdf_split_url/3, % ?Base, ?Local, ?URL - rdf_url_namespace/2, % +URL, ?Base - rdf_quote_uri/2, % +URI, -Quoted - lang_matches/2, % +Lang, +Pattern - - rdf_debug/1, % Set verbosity - - rdf_new_literal_map/1, % -Handle - rdf_destroy_literal_map/1, % +Handle - rdf_reset_literal_map/1, % +Handle - rdf_insert_literal_map/3, % +Handle, +Key, +Literal - rdf_insert_literal_map/4, % +Handle, +Key, +Literal, -NewKeys - rdf_delete_literal_map/3, % +Handle, +Key, +Literal - rdf_delete_literal_map/2, % +Handle, +Key - rdf_find_literal_map/3, % +Handle, +KeyList, -Literals - rdf_keys_in_literal_map/3, % +Handle, +Spec, -Keys - rdf_statistics_literal_map/2, % +Handle, +Name(-Arg...) - - rdf_graph_prefixes/2, % ?Graph, -Prefixes - rdf_graph_prefixes/3, % ?Graph, -Prefixes, :Filter - - (rdf_meta)/1, % +Heads - op(1150, fx, (rdf_meta)) - ]). - -:- expects_dialect(swi). -:- assert(system:swi_io). - -:- use_module(library(rdf)). -:- use_module(library(lists)). -:- use_module(library(shlib)). -:- use_module(library(gensym)). -:- use_module(library(sgml)). -:- use_module(library(sgml_write)). -:- use_module(library(option)). -:- use_module(library(nb_set)). -:- use_module(library(error)). -:- use_module(library(uri)). -:- use_module(library(debug)). -:- use_module(rdf_cache). - -:- use_foreign_library(foreign(rdf_db)). - -:- multifile - ns/2, - rdf_meta_specification/3. % UnboundHead, Module, Head -:- dynamic - ns/2, % ID, URL - rdf_source/5. % DB, SourceURL, ModTimeAtLoad, Triples, MD5 -:- volatile - rdf_source/5. -:- discontiguous - term_expansion/2. - -:- meta_predicate - rdf_transaction(0), - rdf_transaction(0, +), - rdf_monitor(1, +), - rdf_save(+, :), - rdf_load(+, :). - -:- thread_local - named_anon/2. % +Resource, -Id - -/** <module> Core RDF database - -@see Documentation for semweb package -*/ - - /******************************* - * NAMESPACES * - *******************************/ - -%% rdf_current_ns(?Alias, ?URI) is nondet. -% -% Query predefined namespaces and namespaces defined with -% rdf_register_ns/2. - -rdf_current_ns(Alias, URI) :- - ns(Alias, URI). - -%% ns(?Alias, ?URI) is nondet. -% -% Dynamic predicate that maintains the registered namespace -% aliases. - -ns(rdf, 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'). -ns(rdfs, 'http://www.w3.org/2000/01/rdf-schema#'). -ns(owl, 'http://www.w3.org/2002/07/owl#'). -ns(xsd, 'http://www.w3.org/2001/XMLSchema#'). -ns(dc, 'http://purl.org/dc/elements/1.1/'). -ns(dcterms, 'http://purl.org/dc/terms/'). -ns(eor, 'http://dublincore.org/2000/03/13/eor#'). -ns(skos, 'http://www.w3.org/2004/02/skos/core#'). -ns(serql, 'http://www.openrdf.org/schema/serql#'). - -%% rdf_register_ns(+Alias, +URI) is det. -%% rdf_register_ns(+Alias, +URI, +Options) is det. -% -% Register Alias as an abbreviateion for URI. Options: -% -% * force(Boolean) -% If =true=, Replace existing namespace alias. Please note -% that replacing a namespace is dangerous as namespaces -% affect preprocessing. Make sure all code that depends on -% a namespace is compiled after changing the registration. -% -% * keep(Boolean) -% If =true= and Alias is already defined, keep the -% original message and succeed silently. -% -% Without options, an attempt to redefine an alias raises a -% permission error. - -rdf_register_ns(Alias, URI) :- - rdf_register_ns(Alias, URI, []). - -rdf_register_ns(Alias, URI, _) :- - ns(Alias, URI), !. -rdf_register_ns(Alias, URI, Options) :- - ns(Alias, _), - ( option(force(Force), Options, false), - Force == true - -> retractall(ns(Alias, _)), - assert(ns(Alias, URI)) - ; option(keep(Keep), Options, false), - Keep == true - -> true - ; throw(error(permission_error(register, namespace, Alias), - context(_, 'Already defined'))) - ). -rdf_register_ns(Alias, URI, _) :- - assert(ns(Alias, URI)). - -%% register_file_ns(+Map:list(pair)) is det. -% -% Register a namespace as encounted in the namespace list of an -% RDF document. We only register if both the abbreviation and URL -% are not already known. Is there a better way? This code could -% also do checks on the consistency of RDF and other well-known -% namespaces. -% -% @tbd Better error handling - -register_file_ns([]) :- !. -register_file_ns([Decl|T]) :- !, - register_file_ns(Decl), - register_file_ns(T). -register_file_ns([]=_) :- !. % xmlns= (overall default) -register_file_ns(NS=URL) :- !, % compatibility - register_file_ns(NS-URL). -register_file_ns(NS-URL) :- - ( ns(NS, URL) - -> true - ; ns(NS, _) - -> true % redefined abbreviation - ; ns(_, URL) - -> true % redefined URL - ; rdf_register_ns(NS, URL) - ). - - -%% rdf_global_id(?Id, ?GlobalId) is det. -% -% Convert between NS:Local and global atomic identifier. -% To be completed. - -rdf_global_id(NS:Local, Global) :- - global(NS, Local, Global), !. -rdf_global_id(Global, Global). - - -%% rdf_global_object(+Object, -GlobalObject) is semidet. -%% rdf_global_object(-Object, +GlobalObject) is semidet. -% -% Same as rdf_global_id/2, but intended for dealing with the -% object part of a triple, in particular the type for typed -% literals. -% -% @error existence_error(rdf_namespace, NS) - -rdf_global_object(NS:Local, Global) :- - global(NS, Local, Global), !. -rdf_global_object(literal(type(NS:Local, Value)), - literal(type(Global, Value))) :- - global(NS, Local, Global), !. -rdf_global_object(Global, Global). - -global(NS, Local, Global) :- - ( atom(Global) - -> ns(NS, Full), - atom_concat(Full, Local, Global) - ; atom(NS), atom(Local) - -> ( ns(NS, Full) - *-> atom_concat(Full, Local, Global) - ; existence_error(rdf_namespace, NS) - ) - ). - - -%% rdf_global_term(+TermIn, -GlobalTerm) is det. -% -% Does rdf_global_id/2 on all terms NS:Local by recursively analysing -% the term. - -rdf_global_term(Var, Var) :- - var(Var), !. -rdf_global_term(NS:Local, Global) :- - atom(NS), atom(Local), ns(NS, Full), !, - atom_concat(Full, Local, Global). -rdf_global_term([H0|T0], [H|T]) :- !, - rdf_global_term(H0, H), - rdf_global_term(T0, T). -rdf_global_term(Term0, Term) :- - compound(Term0), !, - Term0 =.. [H|L0], - rdf_global_term(L0, L), - Term =.. [H|L]. -rdf_global_term(Term, Term). - - - /******************************* - * EXPANSION * - *******************************/ - -:- multifile - system:term_expansion/2, - system:goal_expansion/2. - -system:term_expansion((:- rdf_meta(Heads)), Clauses) :- - prolog_load_context(module, M), - mk_clauses(Heads, M, Clauses). - -mk_clauses((A,B), M, [H|T]) :- !, - mk_clause(A, M, H), - mk_clauses(B, M, T). -mk_clauses(A, M, [C]) :- - mk_clause(A, M, C). - -mk_clause(Head0, M0, rdf_db:rdf_meta_specification(Unbound, Module, Head)) :- - strip_module(M0:Head0, Module, Head), - valid_rdf_meta_head(Head), - functor(Head, Name, Arity), - functor(Unbound, Name, Arity). - -valid_rdf_meta_head(Head) :- - callable(Head), !, - Head =.. [_|Args], - valid_args(Args). -valid_rdf_meta_head(Head) :- - throw(error(type_error(callable, Head), _)). - -valid_args([]). -valid_args([H|T]) :- - valid_arg(H), !, - valid_args(T). - -valid_arg(:). % meta argument -valid_arg(+). % non-var -valid_arg(-). % var -valid_arg(?). % either var or non-var -valid_arg(@). % not modified -valid_arg(r). % RDF resource -valid_arg(o). % RDF object -valid_arg(t). % term with RDF resources -valid_arg(A) :- - throw(error(type_error(rdf_meta_argument, A), _)). - -%% rdf_meta(+Heads) -% -% This directive is expanded using term-expansion. The -% implementation just throws an error in case it is called with -% the wrong context. - -rdf_meta(Heads) :- - throw(error(context_error(nodirective, rdf_meta(Heads)), _)). - - -system:goal_expansion(G, Expanded) :- - rdf_meta_specification(G, _, _), !, - prolog_load_context(module, LM), - ( rdf_meta_specification(G, Module, Spec), - right_module(LM, G, Module) - -> rdf_expand(G, Spec, Expanded) - ; debugging(rdf_meta), - sub_term(G, NS:Local), - atom(NS), atom(Local) - -> print_message(warning, rdf_meta(not_expanded(LM:G))), - fail - ), - rdf_expand(G, Spec, Expanded). - -system:term_expansion(Fact, Expanded) :- - rdf_meta_specification(Fact, Module, Spec), - prolog_load_context(module, Module), !, - rdf_expand(Fact, Spec, Expanded). -system:term_expansion((Head :- Body), (Expanded :- Body)) :- - rdf_meta_specification(Head, Module, Spec), - prolog_load_context(module, Module), !, - rdf_expand(Head, Spec, Expanded). - - -right_module(M, _, M) :- !. -right_module(LM, G, M) :- - predicate_property(LM:G, imported_from(M)). - -rdf_expand(G, Spec, Expanded) :- - functor(G, Name, Arity), - functor(Expanded, Name, Arity), - rdf_expand_args(0, Arity, G, Spec, Expanded). - -rdf_expand_args(Arity, Arity, _, _, _) :- !. -rdf_expand_args(I0, Arity, Goal, Spec, Expanded) :- - I is I0 + 1, - arg(I, Goal, GA), - arg(I, Spec, SA), - arg(I, Expanded, EA), - rdf_expand_arg(SA, GA, EA), - rdf_expand_args(I, Arity, Goal, Spec, Expanded). - -rdf_expand_arg(r, A, E) :- !, - mk_global(A, E). -rdf_expand_arg(o, A, E) :- !, - rdf_global_object(A, E). -rdf_expand_arg(t, A, E) :- !, - rdf_global_term(A, E). -rdf_expand_arg(:, A, E) :- !, - expand_goal(A, E). -rdf_expand_arg(_, A, A). - -%% mk_global(+Src, -Resource) -% -% Realised rdf_global_id(+, -), but adds compiletime checking, -% notably to see whether a namespace is not yet defined. - -mk_global(X, X) :- - var(X), !. -mk_global(X, X) :- - atom(X), !. -mk_global(NS:Local, Global) :- - must_be(atom, NS), - must_be(atom, Local), - ( ns(NS, Full) - -> atom_concat(Full, Local, Global) - ; existence_error(namespace, NS) - ). - -:- rdf_meta - rdf(r,r,o), - rdf_has(r,r,o,r), - rdf_has(r,r,o), - rdf_assert(r,r,o), - rdf_retractall(r,r,o), - rdf(r,r,o,?), - rdf_assert(r,r,o,+), - rdf_retractall(r,r,o,?), - rdf_reachable(r,r,r), - rdf_reachable(r,r,r,+,?), - rdf_update(r,r,o,t), - rdf_update(r,r,o,+,t), - rdf_equal(r,r), - rdf_source_location(r,-), - rdf_subject(r), - rdf_set_predicate(r, +), - rdf_predicate_property(r, -), - rdf_estimate_complexity(r,r,r,-). - -%% rdf_equal(?Resource1, ?Resource2) -% -% Simple equality test to exploit goal-expansion - -rdf_equal(Resource, Resource). - - -%% rdf_has(?Subject, +Predicate, ?Object) -% -% Succeeds if the triple rdf(Subject, Predicate, Object) is true -% exploiting the rdfs:subPropertyOf predicate. - -rdf_has(Subject, Predicate, Object) :- - rdf_has(Subject, Predicate, Object, _). - - - /******************************* - * COLLECTIONS * - *******************************/ - -%% rdf_member_property(?Prop, ?Index) -% -% Deal with the rdf:_1, ... properties. - -term_expansion(member_prefix(x), - member_prefix(Prefix)) :- - rdf_db:ns(rdf, NS), - atom_concat(NS, '_', Prefix). -member_prefix(x). - -rdf_member_property(P, N) :- - integer(N), !, - member_prefix(Prefix), - atom_concat(Prefix, N, P). -rdf_member_property(P, N) :- - member_prefix(Prefix), - atom_concat(Prefix, Sub, P), - atom_number(Sub, N). - - - /******************************* - * ANONYMOUS SUBJECTS * - *******************************/ - -%% rdf_node(-Id) -% -% Generate a unique blank node identifier for a subject. -% -% @deprecated New code should use rdf_bnode/1. - -rdf_node(Resource) :- - rdf_bnode(Resource). - -%% rdf_bnode(-Id) -% -% Generate a unique anonymous identifier for a subject. - -rdf_bnode(Value) :- - repeat, - gensym('__bnode', Value), - \+ rdf_subject(Value), - \+ rdf(_, _, Value), - \+ rdf(_, Value, _), !. - - - - /******************************* - * TYPES * - *******************************/ - -%% rdf_is_bnode(+Id) -% -% Tests if a resource is a blank node (i.e. is an anonymous -% resource). -% -% @see rdf_bnode/1. - -rdf_is_bnode(Id) :- - atom(Id), - sub_atom(Id, 0, _, _, '__'). - -%% rdf_is_resource(@Term) is semidet. -% -% True if Term is an RDF resource. Note that this is merely a -% type-test; it does not mean this resource is involved in any -% triple. Blank nodes are also considered resources. -% -% @see rdf_is_bnode/1 - -rdf_is_resource(Term) :- - atom(Term). - -%% rdf_is_literal(@Term) is semidet. -% -% True if Term is an RDF literal object. Currently only checks for -% groundness and the literal functor. - -rdf_is_literal(literal(Value)) :- - ground(Value). - - - /******************************* - * SOURCE * - *******************************/ - -%% rdf_source_location(+Subject, -File:Line) -% -% Return the source-locations for triples for this subject. - -rdf_source_location(Subject, Source) :- - findall(Source, rdf(Subject, _, _, Source), Sources), - sort(Sources, Unique), - member(Source, Unique). - - - /******************************* - * STATISTICS * - *******************************/ - -%% rdf_statistics(?KeyValue) is nondet. -% -% Obtain statistics on the RDF database. -% -% @param KeyValue Term of the form Key(Value). - -rdf_statistics(sources(Count)) :- - predicate_property(rdf_source(_,_,_,_,_), number_of_clauses(Count)). -rdf_statistics(subjects(Count)) :- - rdf_statistics_(subjects(Count)). -rdf_statistics(properties(Count)) :- - rdf_statistics_(predicates(Count)). -rdf_statistics(triples(Count)) :- - rdf_statistics_(triples(Count)). -rdf_statistics(gc(Count, Time)) :- - rdf_statistics_(gc(Count, Time)). -rdf_statistics(rehash(Count, Time)) :- - rdf_statistics_(rehash(Count, Time)). -rdf_statistics(core(Bytes)) :- - rdf_statistics_(core(Bytes)). -rdf_statistics(lookup(Index, Count)) :- - functor(Indexed, indexed, 8), - rdf_statistics_(Indexed), - index(Index, I), - Arg is I + 1, - arg(Arg, Indexed, Count), - Count \== 0. -rdf_statistics(searched_nodes(Count)) :- - rdf_statistics_(searched_nodes(Count)). -rdf_statistics(literals(Count)) :- - rdf_statistics_(literals(Count)). -rdf_statistics(triples_by_file(File, Count)) :- - ( var(File) - -> rdf_graph(File), - rdf_statistics_(triples(File, Count)) - ; rdf_statistics_(triples(File, Count)) - ). -rdf_statistics(duplicates(Count)) :- - rdf_statistics_(duplicates(Count)). - -index(rdf(-,-,-), 0). -index(rdf(+,-,-), 1). -index(rdf(-,+,-), 2). -index(rdf(+,+,-), 3). -index(rdf(-,-,+), 4). -index(rdf(+,-,+), 5). -index(rdf(-,+,+), 6). -index(rdf(+,+,+), 7). - - - /******************************* - * PREDICATES * - *******************************/ - -%% rdf_current_predicate(?Predicate) -% -% True if Predicate is a currently defined predicate. - -rdf_current_predicate(P) :- - var(P), !, - rdf_current_predicates(All), - member(P, All), - rdf_predicate_property_(P, triples(N)), - N > 0. -rdf_current_predicate(P) :- - rdf_predicate_property_(P, triples(N)), - N > 0. - -rdf_current_predicate(P, DB) :- - rdf_current_predicates(All), - member(P, All), - once(rdf(_,P,_,DB:_)). - -%% rdf_predicate_property(?Predicate, ?Property) -% -% Enumerate predicates and their properties - - -rdf_predicate_property(P, Prop) :- - var(P), !, - rdf_current_predicates(All), - member(P, All), - rdf_predicate_property_(P, Prop). -rdf_predicate_property(P, Prop) :- - rdf_predicate_property_(P, Prop). - - - /******************************* - * TRANSACTION * - *******************************/ - -%% rdf_transaction(:Goal) is semidet. -%% rdf_transaction(:Goal, +Id) is semidet. -% -% Backward compatibility - -rdf_transaction(Goal) :- - rdf_transaction_(Goal, user). -rdf_transaction(Goal, Id) :- - ( nonvar(Id), - Id = log(_, DB) - -> must_be(atom, DB) - ; true - ), - rdf_transaction_(Goal, Id). - -%% rdf_active_transaction(?Id) is nondet. -% -% True if Id is the identifier of a currently open transaction. If -% Id is not instantiated, backtracking yields transaction -% identifiers starting with the innermost nested transaction. -% Transaction identifier terms are not copied, need not be ground -% and can be instantiated during the transaction. - -rdf_active_transaction(Id) :- - rdf_active_transactions_(List), - member(Id, List). - -%% rdf_monitor(:Goal, +Options) -% -% Call Goal if specified actions occur on the database. - -rdf_monitor(Goal, Options) :- - monitor_mask(Options, 0xffff, Mask), - rdf_monitor_(Goal, Mask). - -monitor_mask([], Mask, Mask). -monitor_mask([H|T], Mask0, Mask) :- - update_mask(H, Mask0, Mask1), - monitor_mask(T, Mask1, Mask). - -update_mask(-X, Mask0, Mask) :- !, - monitor_mask(X, M), - Mask is Mask0 /\ \M. -update_mask(+X, Mask0, Mask) :- !, - monitor_mask(X, M), - Mask is Mask0 \/ M. -update_mask(X, Mask0, Mask) :- - monitor_mask(X, M), - Mask is Mask0 \/ M. - -%% monitor_mask(Name, Mask) -% -% Mask bit for the monitor events. Note that this must be kept -% consistent with the enum broadcast_id defined in rdf_db.c - - % C-defined broadcasts -monitor_mask(assert, 0x0001). -monitor_mask(assert(load), 0x0002). -monitor_mask(retract, 0x0004). -monitor_mask(update, 0x0008). -monitor_mask(new_literal, 0x0010). -monitor_mask(old_literal, 0x0020). -monitor_mask(transaction, 0x0040). -monitor_mask(load, 0x0080). -monitor_mask(rehash, 0x0100). - % prolog defined broadcasts -monitor_mask(parse, 0x1000). -monitor_mask(reset, 0x2000). -monitor_mask(unload, 0x1000). - % mask for all -monitor_mask(all, 0xffff). - -%rdf_broadcast(Term, MaskName) :- -%% monitor_mask(MaskName, Mask), -%% rdf_broadcast_(Term, Mask). - - - /******************************* - * QUICK BINARY LOAD/SAVE * - *******************************/ - -%% rdf_save_db(+File) is det. -%% rdf_save_db(+File, +DB) is det. -% -% Save triples into File in a quick-to-load binary format. If DB -% is supplied only triples flagged to originate from that database -% are added. Files created this way can be loaded using -% rdf_load_db/1. - -rdf_save_db(File) :- - open(File, write, Out, [type(binary)]), - set_stream(Out, record_position(false)), - call_cleanup(rdf_save_db_(Out, _), close(Out)). - - -rdf_save_db(File, DB) :- - open(File, write, Out, [type(binary)]), - set_stream(Out, record_position(false)), - call_cleanup(rdf_save_db_(Out, DB), close(Out)). - - -%% rdf_load_db_no_admin(+File, +Id, -Graphs) is det. -% -% Load triples from a .trp file without updating the source -% administration. Id is handled to monitor action. Graphs is -% either an atom, indicating a single loaded graph or a list of -% graph-names encountered in File. - -rdf_load_db_no_admin(File, Id, Graphs) :- - open(File, read, In, [type(binary)]), - set_stream(In, record_position(false)), - call_cleanup(rdf_load_db_(In, Id, Graphs), close(In)). - - -%% check_loaded_cache(+DB, +Graphs, +Modified) is det. -% -% Verify the loaded cache file and optionally fix the modification -% time (new versions save this along with the snapshot). -% -% @tbd What to do if there is a cache mismatch? Delete the loaded -% graphs and fail? - -check_loaded_cache(DB, DB, _Modified) :- !. -check_loaded_cache(DB, Graphs, _) :- - print_message(warning, rdf(inconsistent_cache(DB, Graphs))). - - -%% rdf_load_db(+File) is det. -% -% Load triples from a file created using rdf_save_db/2 and update -% the file administration. - -rdf_load_db(File) :- - uri_file_name(URL, File), - rdf_load_db_no_admin(File, URL, Graphs), - ( ( is_list(Graphs) - -> member(DB, Graphs) - ; DB = Graphs - ), - rdf_md5(DB, MD5), - rdf_statistics_(triples(DB, Triples)), - rdf_graph_source_(DB, SourceURL, Modified), - retractall(rdf_source(DB, _, _, _, _)), - assert(rdf_source(DB, SourceURL, Modified, Triples, MD5)), - fail - ; true - ). - - - /******************************* - * LOADING RDF * - *******************************/ - -:- multifile - rdf_open_hook/8, - rdf_open_decode/4, % +Encoding, +File, -Stream, -Cleanup - rdf_load_stream/3, % +Format, +Stream, +Options - rdf_file_type/2, % ?Extension, ?Format - rdf_storage_encoding/2, % ?Extension, ?Encoding - url_protocol/1. % ?Protocol - -%% rdf_load(+FileOrList) is det. -%% rdf_load(+FileOrList, +Options) is det. -% -% Load RDF file. Options provides additional processing options. -% Currently defined options are: -% -% * blank_nodes(+ShareMode) -% How to handle equivalent blank nodes. If =share= (default), -% equivalent blank nodes are shared in the same resource. -% -% * base_uri(+URI) -% URI that is used for rdf:about="" and other RDF constructs -% that are relative to the base uri. Default is the source -% URL. -% -% * graph(?Graph) -% Named graph in which to load the data. It is *not* allowed -% to load two sources into the same named graph. If Graph is -% unbound, it is unified to the graph into which the data is -% loaded. -% -% * db(?Graph) -% Deprecated. New code must use graph(Graph). -% -% * if(Condition) -% When to load the file. One of =true=, =changed= (default) or -% =not_loaded=. -% -% * modified(-Modified) -% Unify Modified with one of =not_modified=, cached(File), -% last_modified(Stamp) or =unknown=. -% -% * cache(Bool) -% If =false=, do not use or create a cache file. -% -% * register_namespaces(Bool) -% If =true= (default =false=), register xmlns= namespace -% declarations as ns/2 namespaces if there is no conflict. -% -% Other options are forwarded to process_rdf/3. - -rdf_load(Spec) :- - rdf_load(Spec, []). - -rdf_load([], _) :- !. -rdf_load([H|T], Options) :- !, - rdf_load(H, Options), - rdf_load(T, Options). -rdf_load(Spec, M:Options) :- - must_be(list, Options), - statistics(cputime, T0), - rdf_open_input(Spec, In, Cleanup, SourceURL, Graph, Modified, - Format, Options), - return_modified(Modified, Options), - ( Modified == not_modified - -> Action = none - ; Modified = cached(CacheFile) - -> do_unload(Graph), - catch(rdf_load_db_no_admin(CacheFile, cache(Graph), Graphs), _, fail), - check_loaded_cache(Graph, Graphs, Modified), - rdf_statistics_(triples(Graph, Triples)), - Action = load - ; option(base_uri(BaseURI), Options, Graph), - ( var(BaseURI) - -> BaseURI = SourceURL - ; true - ), - once(phrase(derived_options(Options, NSList), Extra)), - merge_options([ base_uri(BaseURI), - graph(Graph), - format(Format) - | Extra - ], Options, RDFOptions), - do_unload(Graph), - graph_modified(Modified, ModifiedStamp), - rdf_set_graph_source(Graph, SourceURL, ModifiedStamp), - call_cleanup(rdf_load_stream(Format, In, M:RDFOptions), - Cleanup), - save_cache(Graph, SourceURL, Options), - register_file_ns(NSList), - rdf_statistics_(triples(Graph, Triples)), - rdf_md5(Graph, MD5), - assert(rdf_source(Graph, SourceURL, Modified, Triples, MD5)), - format_action(Format, Action) - ), - report_loaded(Action, SourceURL, Graph, Triples, T0, Options). - -format_action(triples, load) :- !. -format_action(_, parsed). - -save_cache(Graph, SourceURL, Options) :- - option(cache(true), Options, true), - rdf_cache_file(SourceURL, write, CacheFile), !, - catch(save_cache(Graph, CacheFile), E, - print_message(warning, E)). -save_cache(_, _, _). - -derived_options([], _) --> - []. -derived_options([H|T], NSList) --> - ( { H == register_namespaces(true) - ; H == (register_namespaces = true) - } - -> [ namespaces(NSList) ] - ; [] - ), - derived_options(T, NSList). - -graph_modified(last_modified(Stamp), Stamp). -graph_modified(unknown, Stamp) :- - get_time(Stamp). - -return_modified(Modified, Options) :- - option(modified(M0), Options), !, - M0 = Modified. -return_modified(_, _). - - - /******************************* - * INPUT HANDLING * - *******************************/ - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -This section deals with pluggable input sources. The task of the input -layer is - - * Decide on the graph-name - * Decide on the source-location - * Decide whether loading is needed (if-modified) - * Decide on the serialization in the input - -The protocol must ensure minimal overhead, in particular for network -protocols. E.g. for HTTP we want to make a single call on the server and -use If-modified-since to verify that we need not reloading this file. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -%% rdf_open_input(+Spec, -Stream, -Cleanup, -%% -Source, -Graph, -Modified, -Format, -%% +Options) -% -% Open an input source. -% -% Options processed: -% -% * graph(Graph) -% * db(Graph) -% * if(Condition) -% * cache(Cache) -% * format(Format) -% -% @param Modified is one of =not_modified=, last_modified(Time), -% cached(CacheFile) or =unknown= - -rdf_open_input(Spec, Stream, Cleanup, - SourceURL, Graph, Modified, Format, - Options) :- - source_url(Spec, Protocol, SourceURL), - load_graph(SourceURL, Graph, Options), - option(if(If), Options, changed), - ( If == true - -> true - ; rdf_graph_source_(Graph, SourceURL, HaveModified) - -> true - ; option(cache(true), Options, true), - rdf_cache_file(SourceURL, read, CacheFile) - -> time_file(CacheFile, HaveModified) - ; true - ), - option(format(Format), Options, _), - open_input_if_modified(Protocol, SourceURL, HaveModified, - Stream, Cleanup, Modified0, Format, Options), - ( Modified0 == not_modified - -> ( nonvar(CacheFile) - -> Modified = cached(CacheFile) - ; Modified = not_modified - ) - ; Modified = Modified0 - ). - - -%% source_url(+Spec, -Class, -SourceURL) is det. -% -% Determine class and url of the source. Class is one of -% -% * stream(Stream) -% * file -% * a url-protocol (e.g., =http=) - -source_url(stream(In), stream(In), SourceURL) :- !, - ( stream_property(In, file_name(File)) - -> to_url(File, SourceURL) - ; gensym('stream://', SourceURL) - ). -source_url(Stream, Class, SourceURL) :- - is_stream(Stream), !, - source_url(stream(Stream), Class, SourceURL). -source_url(Spec, Protocol, SourceURL) :- - compound(Spec), !, - source_file(Spec, Protocol, SourceURL). -source_url(FileURL, Protocol, SourceURL) :- % or return FileURL? - uri_file_name(FileURL, File), !, - source_file(File, Protocol, SourceURL). -source_url(SourceURL, Protocol, SourceURL) :- - is_url(SourceURL, Protocol), !. -source_url(File, Protocol, SourceURL) :- - source_file(File, Protocol, SourceURL). - -source_file(Spec, file(SExt), SourceURL) :- - findall(Ext, valid_extension(Ext), Exts), - absolute_file_name(Spec, File, [access(read), extensions(Exts)]), - storage_extension(Plain, SExt, File), - uri_file_name(SourceURL, Plain). - -to_url(URL, URL) :- - is_url(URL, _Protocol), !. -to_url(File, URL) :- - absolute_file_name(File, Path), - uri_file_name(URL, Path). - -storage_extension(Plain, SExt, File) :- - file_name_extension(Plain, SExt, File), - SExt \== '', - rdf_storage_encoding(SExt, _), !. -storage_extension(File, '', File). - -%% rdf_input(URL, Source, _BaseURI) is semidet. -% -% @deprecated Only exists to make old ClioPatria rdf_library.pl -% work - -rdf_input(Spec, Source, _BaseURI) :- - source_url(Spec, Class, SourceURL), - compat_input(Class, SourceURL, Source). - -compat_input(file(Ext), SourceURL, file(Path)) :- - uri_file_name(SourceURL, File), - file_name_extension(File, Ext, Path). -compat_input(http, SourceURL, url(http, SourceURL)). - -%% load_graph(+SourceURL, -Graph, +Options) is det. -% -% Graph is the graph into which we load the data. Processes -% the graph(?Graph) option. - -load_graph(Source, Graph, Options) :- - ( option(graph(Graph), Options) - -> true - ; option(db(Graph), Options) - ), !, - ( ground(Graph) - -> true - ; load_graph(Source, Graph) - ). -load_graph(Source, Graph, _) :- - load_graph(Source, Graph). - -load_graph(SourceURL, BaseURI) :- - file_name_extension(BaseURI, Ext, SourceURL), - rdf_storage_encoding(Ext, _), !. -load_graph(SourceURL, SourceURL). - - -open_input_if_modified(stream(In), SourceURL, _, In, true, - unknown, Format, _) :- !, - ( var(Format) - -> guess_format(SourceURL, Format) - ; true - ). -open_input_if_modified(file(SExt), SourceURL, HaveModified, Stream, Cleanup, - Modified, Format, _) :- !, - uri_file_name(SourceURL, File0), - file_name_extension(File0, SExt, File), - time_file(File, LastModified), - ( nonvar(HaveModified), - HaveModified >= LastModified - -> Modified = not_modified, - Cleanup = true - ; storage_open(SExt, File, Stream, Cleanup), - Modified = last_modified(LastModified), - ( var(Format) - -> guess_format(File0, Format) - ; true - ) - ). -open_input_if_modified(file, SourceURL, HaveModified, Stream, Cleanup, - Modified, Format, Options) :- !, - open_input_if_modified(file(''), SourceURL, HaveModified, - Stream, Cleanup, - Modified, Format, Options). -open_input_if_modified(Protocol, SourceURL, HaveModified, Stream, Cleanup, - Modified, Format, Options) :- - rdf_open_hook(Protocol, SourceURL, HaveModified, Stream, Cleanup, - Modified, Format, Options). - -guess_format(File, Format) :- - file_name_extension(_, Ext, File), - ( rdf_file_type(Ext, Format) - -> true - ; Format = xml, - print_message(warning, rdf(guess_format(Ext))) - ). - -storage_open('', File, Stream, close(Stream)) :- !, - open(File, read, Stream). -storage_open(Ext, File, Stream, Cleanup) :- - rdf_storage_encoding(Ext, Encoding), - rdf_open_decode(Encoding, File, Stream, Cleanup). - -valid_extension(Ext) :- - rdf_file_type(Ext, _). -valid_extension(Ext) :- - rdf_storage_encoding(Ext, _). - -%% is_url(+Term, -Protocol) is semidet. -% -% True if Term is an atom denoting a URL of the given Protocol. -% We only support a limited set of protocols as defined by the -% extensible predicate url_protocol/1. - -is_url(URL, Protocol) :- - atom(URL), - sub_atom(URL, B, _, _, :), !, - sub_atom(URL, 0, B, _, RawProtocol), - downcase_atom(RawProtocol, Protocol), - url_protocol(Protocol). - -url_protocol(file). % built-in - -%% rdf_file_type(+Extension, -Format) is semidet. -% -% True if Format is the format belonging to the given file -% extension. This predicate is multifile and can thus be extended -% by plugins. - -rdf_file_type(xml, xml). -rdf_file_type(rdf, xml). -rdf_file_type(rdfs, xml). -rdf_file_type(owl, xml). -rdf_file_type(htm, xhtml). -rdf_file_type(html, xhtml). -rdf_file_type(xhtml, xhtml). -rdf_file_type(trp, triples). - - -%% rdf_file_encoding(+Extension, -Format) is semidet. -% -% True if Format describes the storage encoding of file. - -rdf_storage_encoding('', plain). - - -%% rdf_load_stream(+Format, +Stream, :Options) -% -% Load RDF data from Stream. -% -% @tbd Handle mime-types? - -rdf_load_stream(xml, Stream, Options) :- !, - graph(Options, Graph), - rdf_transaction(process_rdf(Stream, assert_triples, Options), - parse(Graph)). -rdf_load_stream(xhtml, Stream, M:Options) :- !, - graph(Options, Graph), - rdf_transaction(process_rdf(Stream, assert_triples, - M:[embedded(true)|Options]), - parse(Graph)). -rdf_load_stream(triples, Stream, Options) :- !, - graph(Options, Graph), - rdf_load_db_(Stream, Graph, _Graphs). - - -%% report_loaded(+Action, +Source, +DB, +Triples, +StartCPU, +Options) - -report_loaded(none, _, _, _, _, _) :- !. -report_loaded(Action, Source, DB, Triples, T0._, Options) :- - statistics(cputime, T1._), - Time is T1 - T0, - ( option(silent(true), Options) - -> Level = silent - ; Level = informational - ), - print_message(Level, - rdf(loaded(Action, Source, DB, Triples, Time))). - - -%% rdf_unload(+Spec) is det. -% -% Remove the triples loaded from the specified source and remove -% the source from the database. - -rdf_unload(Graph) :- - atom(Graph), - rdf_statistics_(triples(Graph, Triples)), - Triples > 0, !, - do_unload(Graph). -rdf_unload(Spec) :- - source_url(Spec, _Protocol, SourceURL), - rdf_graph_source_(Graph, SourceURL, _), !, - do_unload(Graph). -rdf_unload(_). - -do_unload(DB) :- - rdf_transaction(rdf_retractall(_,_,_,DB), - unload(DB)), - retractall(rdf_source(DB, _, _, _, _)), - rdf_unset_graph_source(DB). - - -%% rdf_graph(+DB) is semidet. -%% rdf_graph(-DB) is nondet. -% -% True if DB is a current named graph with at least one triple. - -rdf_graph(DB) :- - atom(DB), !, - rdf_statistics_(triples(DB, Triples)), - Triples > 0. -rdf_graph(DB) :- - rdf_graphs_(Sources), - member(DB, Sources), - rdf_statistics_(triples(DB, Triples)), - Triples > 0. - -%% rdf_source(?Graph, ?SourceURL) is nondet. -% -% True if named Graph is loaded from SourceURL. - -rdf_source(Graph, SourceURL) :- - rdf_graph(Graph), - rdf_graph_source_(Graph, SourceURL, _Modified). - -%% rdf_source(?Source) -% -% True if Source is a loaded source. -% -% @deprecated Use rdf_graph/1 or rdf_source/2. - -rdf_source(SourceURL) :- - rdf_source(_Graph, SourceURL). - -%% rdf_make -% -% Reload all loaded files that have been modified since the last -% time they were loaded. - -rdf_make :- - findall(Source-Graph, modified_graph(Source, Graph), Modified), - forall(member(Source-Graph, Modified), - catch(rdf_load(Source, [graph(Graph), if(changed)]), E, - print_message(error, E))). - -modified_graph(SourceURL, Graph) :- - rdf_graph(Graph), - rdf_graph_source_(Graph, SourceURL, Modified), - Modified > 0. - -%% save_cache(+DB, +Cache) is det. -% -% Save triples belonging to DB in the file Cache. - -save_cache(DB, Cache) :- - catch(system:swi_open(Cache, write, CacheStream, [type(binary)]), _, fail), !, - call_cleanup(rdf_save_db_(CacheStream, DB), - close(CacheStream)). - -%% assert_triples(+Triples, +Source) -% -% Assert a list of triples into the database. Foir security -% reasons we check we aren't inserting anything but nice RDF -% triples. - -assert_triples([], _). -assert_triples([rdf(S,P,O)|T], DB) :- !, - rdf_assert(S, P, O, DB), - assert_triples(T, DB). -assert_triples([H|_], _) :- - throw(error(type_error(rdf_triple, H), _)). - - - /******************************* - * RESET * - *******************************/ - -%% rdf_reset_db -% -% Remove all triples from the RDF database and reset all its -% statistics. - -rdf_reset_db :- - retractall(rdf_source(_,_,_,_,_)), - rdf_transaction(rdf_reset_db_, reset). - - - /******************************* - * SAVE RDF * - *******************************/ - -%% rdf_save(+Out) is det. -%% rdf_save(+Out, :Options) is det. -% -% Write RDF data as RDF/XML. Options is a list of one or more of -% the following options: -% -% * graph(+Graph) -% Save only triples associated to the given named Graph. -% -% * db(+DB) -% Deprecated synonym for graph(DB). -% -% * anon(Bool) -% If false (default true) do not save blank nodes that do -% not appear (indirectly) as object of a named resource. -% -% * base_uri(URI) -% BaseURI used. If present, all URIs that can be -% represented relative to this base are written using -% their shorthand. See also =write_xml_base= option -% -% * write_xml_base(Bool) -% If =false=, do _not_ include the =|xml:base|= -% declaration that is written normally when using the -% =base_uri= option. -% -% * convert_typed_literal(:Convertor) -% Call Convertor(-Type, -Content, +RDFObject), providing -% the opposite for the convert_typed_literal option of -% the RDF parser. -% -% * encoding(Encoding) -% Encoding for the output. Either utf8 or iso_latin_1 -% -% * document_language(+Lang) -% Initial xml:lang saved with rdf:RDF element -% -% * sorted(+Boolean) -% If =true= (default =false=), emit subjects sorted on -% the full URI. Useful to make file comparison easier. -% -% @param Out Location to save the data. This can also be a -% file-url (=|file://path|=) or a stream wrapped -% in a term stream(Out). - -rdf_save(File) :- - rdf_save2(File, []). - -rdf_save(Spec, M:Options0) :- - is_list(Options0), !, - meta_options(save_meta_option, M:Options0, Options), - to_file(Spec, File), - rdf_save2(File, Options). -rdf_save(Spec, _:DB) :- - atom(DB), !, % backward compatibility - to_file(Spec, File), - rdf_save2(File, [graph(DB)]). - -save_meta_option(convert_typed_literal). - -to_file(URL, File) :- - atom(URL), - uri_file_name(URL, File), !. -to_file(File, File). - -rdf_save2(File, Options) :- - option(encoding(Encoding), Options, utf8), - valid_encoding(Encoding), - open_output(File, Encoding, Out, Close), - flag(rdf_db_saved_subjects, OSavedSubjects, 0), - flag(rdf_db_saved_triples, OSavedTriples, 0), - call_cleanup(rdf_do_save(Out, Options), - Reason, - cleanup_save(Reason, - File, - OSavedSubjects, - OSavedTriples, - Close)). - -open_output(stream(Out), Encoding, Out, - set_stream(Out, encoding(Old))) :- !, - stream_property(Out, encoding(Old)), - set_stream(Out, encoding(Encoding)). -open_output(File, Encoding, Out, - close(Out)) :- - open(File, write, Out, [encoding(Encoding)]). - -valid_encoding(Enc) :- - ( xml_encoding_name(Enc, _) - -> true - ; throw(error(domain_error(encoding, Enc), _)) - ). - - -cleanup_save(Reason, - File, - OSavedSubjects, - OSavedTriples, - Close) :- - call(Close), - flag(rdf_db_saved_subjects, SavedSubjects, OSavedSubjects), - flag(rdf_db_saved_triples, SavedTriples, OSavedTriples), - retractall(named_anon(_, _)), - ( Reason == exit - -> print_message(informational, - rdf(saved(File, SavedSubjects, SavedTriples))) - ; format(user_error, 'Reason = ~w~n', [Reason]) - ). - -rdf_do_save(Out, Options0) :- - rdf_save_header(Out, Options0, Options), - ( option(sorted(true), Options, false) - -> setof(Subject, rdf_subject(Subject, Options), Subjects), - forall(member(Subject, Subjects), - rdf_save_non_anon_subject(Out, Subject, Options)) - ; forall(rdf_subject(Subject, Options), - rdf_save_non_anon_subject(Out, Subject, Options)) - ), - rdf_save_footer(Out), !. % dubious cut; without the - % cleanup handlers isn't called!? - -rdf_subject(Subject, Options) :- - graph(Options, DB), - var(DB), !, - rdf_subject(Subject). -rdf_subject(Subject, Options) :- - graph(Options, DB), - rdf_subject(Subject), - ( rdf(Subject, _, _, DB:_) - -> true - ). - -graph(Options0, DB) :- - strip_module(Options0, _, Options), - ( memberchk(graph(DB0), Options) - -> DB = DB0 - ; memberchk(db(DB0), Options) - -> DB = DB0 - ; true % leave unbound - ). - - -%% rdf_save_header(+Fd, +Options) -% -% Save XML document header, doctype and open the RDF environment. -% This predicate also sets up the namespace notation. - -rdf_save_header(Out, Options) :- - rdf_save_header(Out, Options, _). - -rdf_save_header(Out, Options, OptionsOut) :- - is_list(Options), !, - stream_property(Out, encoding(Enc)), - xml_encoding(Enc, Encoding), - format(Out, '<?xml version=\'1.0\' encoding=\'~w\'?>~n', [Encoding]), - format(Out, '<!DOCTYPE rdf:RDF [', []), - header_namespaces(Options, NSIdList), - nsmap(NSIdList, NsMap), - append(Options, [nsmap(NsMap)], OptionsOut), - forall(member(Id=URI, NsMap), - ( rdf_quote_uri(URI, QURI), - xml_quote_attribute(QURI, NSText0, Enc), - xml_escape_parameter_entity(NSText0, NSText), - format(Out, '~N <!ENTITY ~w \'~w\'>', [Id, NSText]) - )), - format(Out, '~N]>~n~n', []), - format(Out, '<rdf:RDF', []), - ( member(Id, NSIdList), - format(Out, '~N xmlns:~w="&~w;"~n', [Id, Id]), - fail - ; true - ), - ( option(base_uri(Base), Options), - option(write_xml_base(true), Options, true) - -> rdf_quote_uri(Base, QBase), - xml_quote_attribute(QBase, BaseText, Enc), - format(Out, '~N xml:base="~w"~n', [BaseText]) - ; true - ), - ( memberchk(document_language(Lang), Options) - -> format(Out, '~N xml:lang="~w"', [Lang]) - ; true - ), - format(Out, '>~n', []). -rdf_save_header(Out, FileRef, OptionsOut) :- % compatibility - atom(FileRef), - rdf_save_header(Out, [graph(FileRef)], OptionsOut). - -xml_encoding(Enc, Encoding) :- - ( xml_encoding_name(Enc, Encoding) - -> true - ; throw(error(domain_error(rdf_encoding, Enc), _)) - ). - -xml_encoding_name(ascii, 'US-ASCII'). -xml_encoding_name(iso_latin_1, 'ISO-8859-1'). -xml_encoding_name(utf8, 'UTF-8'). - -%% nsmap(+NSIds, -Map:list(id=uri)) is det. -% -% Create a namespace-map that is compatible to xml_write/2 -% for dealing with XML-Literals - -nsmap([], []). -nsmap([Id|T0], [Id=URI|T]) :- - ns(Id, URI), - nsmap(T0, T). - -%% xml_escape_parameter_entity(+In, -Out) is det. -% -% Escape % as &#37; for entity declarations. - -xml_escape_parameter_entity(In, Out) :- - sub_atom(In, _, _, _, '%'), !, - atom_codes(In, Codes), - phrase(escape_parent(Codes), OutCodes), - atom_codes(Out, OutCodes). -xml_escape_parameter_entity(In, In). - -escape_parent([]) --> []. -escape_parent([H|T]) --> - ( { H == 37 } - -> "&#37;" - ; [H] - ), - escape_parent(T). - - -%% header_namespaces(Options, -List) -% -% Get namespaces we will define as entities - -header_namespaces(Options, List) :- - memberchk(namespaces(NSL0), Options), !, - sort([rdf,rdfs|NSL0], List). -header_namespaces(Options, List) :- - graph(Options, DB), - used_namespace_entities(List, DB). - -%% rdf_graph_prefixes(?Graph, -List:ord_set) is det. -%% rdf_graph_prefixes(?Graph, -List:ord_set, :Filter) is det. -% -% List is a sorted list of prefixes (namepaces) in Graph. The -% optional Filter argument is used to filter the results. It is -% called with 3 additional arguments: -% -% == -% call(Filter, Where, Prefix, URI) -% == -% -% The Where argument gives the location of the prefix ans is one -% of =subject=, =predicate=, =object= or =type=. The Prefix -% argument is the potentionally new prefix and URI is the full URI -% that is being processed. - - -:- thread_local - graph_prefix/1. -:- meta_predicate - rdf_graph_prefixes(?, -, 3). - -rdf_graph_prefixes(Graph, List) :- - rdf_graph_prefixes(Graph, List, true). - -rdf_graph_prefixes(Graph, List, Filter) :- - call_cleanup(prefixes(Graph, Prefixes, Filter), - retractall(graph_prefix(_))), - sort(Prefixes, List). - -prefixes(Graph, Prefixes, Filter) :- - ( rdf_db(S, P, O, Graph), - add_ns(subject, Filter, S), - add_ns(predicate, Filter, P), - add_ns_obj(Filter, O), - fail - ; true - ), - findall(Prefix, graph_prefix(Prefix), Prefixes). - -add_ns(Where, Filter, S) :- - \+ rdf_is_bnode(S), - iri_xml_namespace(S, Full), - Full \== '', !, - ( graph_prefix(Full) - -> true - ; Filter = _:true - -> assert(graph_prefix(Full)) - ; call(Filter, Where, Full, S) - -> assert(graph_prefix(Full)) - ; true - ). -add_ns(_, _, _). - -add_ns_obj(Filter, O) :- - atom(O), !, - add_ns(object, Filter, O). -add_ns_obj(Filter, literal(type(Type, _))) :- - atom(Type), !, - add_ns(type, Filter, Type). -add_ns_obj(_, _). - - -%% used_namespace_entities(-List, ?Graph) is det. -% -% Return the namespace aliases that are actually used in Graph. In -% addition, this predicate creates ns<N> aliases for namespaces -% used in predicates because RDF/XML cannot write predicates other -% than as an XML name. - -used_namespace_entities(List, Graph) :- - decl_used_predicate_ns(Graph), - used_namespaces(List, Graph). - -used_namespaces(List, DB) :- - rdf_graph_prefixes(DB, FullList), - ns_abbreviations(FullList, List0), - sort([rdf|List0], List). - -ns_abbreviations([], []). -ns_abbreviations([H0|T0], [H|T]) :- - ns(H, H0), !, - ns_abbreviations(T0, T). -ns_abbreviations([_|T0], T) :- - ns_abbreviations(T0, T). - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -For every URL used as a predicate we *MUST* define a namespace as we -cannot use names holding /, :, etc. as XML identifiers. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -:- thread_local - predicate_ns/2. - -decl_used_predicate_ns(DB) :- - retractall(predicate_ns(_,_)), - ( rdf_current_predicate(P, DB), - decl_predicate_ns(P), - fail - ; true - ). - -decl_predicate_ns(Pred) :- - predicate_ns(Pred, _), !. -decl_predicate_ns(Pred) :- - rdf_global_id(NS:Local, Pred), - xml_name(Local), !, - assert(predicate_ns(Pred, NS)). -decl_predicate_ns(Pred) :- - atom_codes(Pred, Codes), - append(NSCodes, LocalCodes, Codes), - xml_codes(LocalCodes), !, - ( NSCodes \== [] - -> atom_codes(NS, NSCodes), - ( ns(Id, NS) - -> assert(predicate_ns(Pred, Id)) - ; between(1, infinite, N), - atom_concat(ns, N, Id), - \+ ns(Id, _) - -> rdf_register_ns(Id, NS), - print_message(informational, - rdf(using_namespace(Id, NS))) - ), - assert(predicate_ns(Pred, Id)) - ; assert(predicate_ns(Pred, -)) % no namespace used - ). - -xml_codes([]). -xml_codes([H|T]) :- - xml_code(H), - xml_codes(T). - -xml_code(X) :- - code_type(X, csym), !. -xml_code(0'-). % Match 0'- - - -%% rdf_save_footer(Out:stream) is det. -% -% Finish XML generation and write the document footer. - -rdf_save_footer(Out) :- - retractall(named_anon(_, _)), - format(Out, '</rdf:RDF>~n', []). - -%% rdf_save_non_anon_subject(+Out, +Subject, +Options) -% -% Save an object. Anonymous objects not saved if anon(false) -% is present in the Options list. - -rdf_save_non_anon_subject(_Out, Subject, Options) :- - rdf_is_bnode(Subject), - ( memberchk(anon(false), Options) - ; graph(Options, DB), - rdf_db(_, _, Subject, DB) - ), !. -rdf_save_non_anon_subject(Out, Subject, Options) :- - rdf_save_subject(Out, Subject, Options), - flag(rdf_db_saved_subjects, X, X+1). - - -%% rdf_save_subject(+Out, +Subject:resource, +Options) is det. -% -% Save the triples associated to Subject to Out. - -rdf_save_subject(Out, Subject, Options) :- - is_list(Options), !, - option(base_uri(BaseURI), Options, '-'), - ( rdf_save_subject(Out, Subject, BaseURI, 0, Options) - -> format(Out, '~n', []) - ; throw(error(rdf_save_failed(Subject), 'Internal error')) - ). -rdf_save_subject(Out, Subject, DB) :- - ( var(DB) - -> rdf_save_subject(Out, Subject, []) - ; rdf_save_subject(Out, Subject, [graph(DB)]) - ). - - -%% rdf_save_subject(+Out:stream, +Subject:resource, +BaseURI, -%% +Indent:int, +Options) is det. -% -% Save properties of Subject. -% -% @param Indent Current indentation - -rdf_save_subject(Out, Subject, BaseURI, Indent, Options) :- - graph(Options, DB), - findall(Pred=Object, rdf_db(Subject, Pred, Object, DB), Atts0), - sort(Atts0, Atts), % remove duplicates - length(Atts, L), - ( length(Atts0, L0), - Del is L0-L, - Del > 0 - -> print_message(informational, - rdf(save_removed_duplicates(Del, Subject))) - ; true - ), - rdf_save_subject(Out, Subject, BaseURI, Atts, Indent, Options), - flag(rdf_db_saved_triples, X, X+L). - -rdf_db(Subject, Pred, Object, DB) :- - var(DB), !, - rdf(Subject, Pred, Object). -rdf_db(Subject, Pred, Object, DB) :- - rdf(Subject, Pred, Object, DB:_). - -%% rdf_save_subject(+Out:stream, +Subject:resource, +BaseURI, -%% +Atts:list(Pred=Obj), +Indent:int, +Options) is det. -% -% Save triples defined by Atts on Subject. - -rdf_save_subject(Out, Subject, BaseURI, Atts, Indent, Options) :- - rdf_equal(rdf:type, RdfType), - select(RdfType=Type, Atts, Atts1), - \+ rdf_is_bnode(Type), - rdf_id(Type, BaseURI, TypeId), - xml_is_name(TypeId), !, - format(Out, '~*|<', [Indent]), - rdf_write_id(Out, TypeId), - save_about(Out, BaseURI, Subject), - save_attributes(Atts1, BaseURI, Out, TypeId, Indent, Options). -rdf_save_subject(Out, Subject, BaseURI, Atts, Indent, Options) :- - format(Out, '~*|<rdf:Description', [Indent]), - save_about(Out, BaseURI, Subject), - save_attributes(Atts, BaseURI, Out, rdf:'Description', Indent, Options). - -xml_is_name(_NS:Atom) :- !, - xml_name(Atom). -xml_is_name(Atom) :- - xml_name(Atom). - -%% save_about(+Out, +BaseURI, +Subject) is det. -% -% Save the rdf:about. If Subject is a blank node, save the nodeID -% if any. - -save_about(Out, _, Subject) :- - rdf_is_bnode(Subject), !, - ( named_anon(Subject, NodeID) - -> format(Out, ' rdf:nodeID="~w"', [NodeID]) - ; true - ). -save_about(Out, BaseURI, Subject) :- - stream_property(Out, encoding(Encoding)), - rdf_value(Subject, BaseURI, QSubject, Encoding), - format(Out, ' rdf:about="~w"', [QSubject]). - -%% save_attributes(+List, +BaseURI, +Stream, Element) -% -% Save the attributes. Short literal attributes are saved in the -% tag. Others as the content of the description element. The -% begin tag has already been filled. - -save_attributes(Atts, BaseURI, Out, Element, Indent, Options) :- - split_attributes(Atts, InTag, InBody), - SubIndent is Indent + 2, - save_attributes2(InTag, BaseURI, tag, Out, SubIndent, Options), - ( InBody == [] - -> format(Out, '/>~n', []) - ; format(Out, '>~n', []), - save_attributes2(InBody, BaseURI, body, Out, SubIndent, Options), - format(Out, '~N~*|</', [Indent]), - rdf_write_id(Out, Element), - format(Out, '>~n', []) - ). - -%% split_attributes(+Attributes, -HeadAttrs, -BodyAttr) -% -% Split attribute (Name=Value) list into attributes for the head -% and body. Attributes can only be in the head if they are literal -% and appear only one time in the attribute list. - -split_attributes(Atts, HeadAttr, BodyAttr) :- - duplicate_attributes(Atts, Dupls, Singles), - simple_literal_attributes(Singles, HeadAttr, Rest), - append(Dupls, Rest, BodyAttr). - -%% duplicate_attributes(+Attrs, -Duplicates, -Singles) -% -% Extract attributes that appear more than onces as we cannot -% dublicate an attribute in the head according to the XML rules. - -duplicate_attributes([], [], []). -duplicate_attributes([H|T], Dupls, Singles) :- - H = (Name=_), - named_attributes(Name, T, D, R), - D \== [], - append([H|D], Dupls2, Dupls), !, - duplicate_attributes(R, Dupls2, Singles). -duplicate_attributes([H|T], Dupls2, [H|Singles]) :- - duplicate_attributes(T, Dupls2, Singles). - -named_attributes(_, [], [], []) :- !. -named_attributes(Name, [H|T], D, R) :- - ( H = (Name=_) - -> D = [H|DT], - named_attributes(Name, T, DT, R) - ; R = [H|RT], - named_attributes(Name, T, D, RT) - ). - -%% simple_literal_attributes(+Attributes, -Inline, -Body) -% -% Split attributes for (literal) attributes to be used in the -% begin-tag and ones that have to go into the body of the description. - -simple_literal_attributes([], [], []). -simple_literal_attributes([H|TA], [H|TI], B) :- - in_tag_attribute(H), !, - simple_literal_attributes(TA, TI, B). -simple_literal_attributes([H|TA], I, [H|TB]) :- - simple_literal_attributes(TA, I, TB). - -in_tag_attribute(_=literal(Text)) :- - atom(Text), % may not have lang qualifier - atom_length(Text, Len), - Len < 60. - -%% save_attributes(+List, +BaseURI, +TagOrBody, +Stream) -% -% Save a list of attributes. - -save_attributes2([], _, _, _, _, _). -save_attributes2([H|T], BaseURI, Where, Out, Indent, Options) :- - save_attribute(Where, H, BaseURI, Out, Indent, Options), - save_attributes2(T, BaseURI, Where, Out, Indent, Options). - -save_attribute(tag, Name=literal(Value), BaseURI, Out, Indent, _DB) :- - AttIndent is Indent + 2, - rdf_id(Name, BaseURI, NameText), - stream_property(Out, encoding(Encoding)), - xml_quote_attribute(Value, QVal, Encoding), - format(Out, '~N~*|', [AttIndent]), - rdf_write_id(Out, NameText), - format(Out, '="~w"', [QVal]). -save_attribute(body, Name=literal(Literal0), BaseURI, Out, Indent, Options) :- !, - rdf_id(Name, BaseURI, NameText), - ( memberchk(convert_typed_literal(Converter), Options), - call(Converter, Type, Content, Literal0) - -> Literal = type(Type, Content) - ; Literal = Literal0 - ), - save_body_literal(Literal, NameText, BaseURI, Out, Indent, Options). -save_attribute(body, Name=Value, BaseURI, Out, Indent, Options) :- - rdf_is_bnode(Value), !, - rdf_id(Name, BaseURI, NameText), - format(Out, '~N~*|<', [Indent]), - rdf_write_id(Out, NameText), - ( named_anon(Value, NodeID) - -> format(Out, ' rdf:nodeID="~w"/>', [NodeID]) - ; ( rdf(S1, Name, Value), - rdf(S2, P2, Value), - (S1 \== S2 ; Name \== P2) - -> predicate_property(named_anon(_,_), number_of_clauses(N)), - atom_concat('bn', N, NodeID), - assert(named_anon(Value, NodeID)) - ; true - ), - SubIndent is Indent + 2, - ( rdf(Value, rdf:type, rdf:'List') - -> save_about(Out, BaseURI, Value), - format(Out, ' rdf:parseType="Collection">~n', []), - rdf_save_list(Out, Value, BaseURI, SubIndent, Options) - ; format(Out, '>~n', []), - rdf_save_subject(Out, Value, BaseURI, SubIndent, Options) - ), - format(Out, '~N~*|</', [Indent]), - rdf_write_id(Out, NameText), - format(Out, '>~n', []) - ). -save_attribute(body, Name=Value, BaseURI, Out, Indent, _DB) :- - stream_property(Out, encoding(Encoding)), - rdf_value(Value, BaseURI, QVal, Encoding), - rdf_id(Name, BaseURI, NameText), - format(Out, '~N~*|<', [Indent]), - rdf_write_id(Out, NameText), - format(Out, ' rdf:resource="~w"/>', [QVal]). - -%% save_body_literal(+Literal, +NameText, +BaseURI, -%% +Out, +Indent, +Options). - -save_body_literal(lang(Lang, Value), - NameText, BaseURI, Out, Indent, Options) :- !, - format(Out, '~N~*|<', [Indent]), - rdf_write_id(Out, NameText), - ( memberchk(document_language(Lang), Options) - -> write(Out, '>') - ; rdf_id(Lang, BaseURI, LangText), - format(Out, ' xml:lang="~w">', [LangText]) - ), - save_attribute_value(Value, Out, Indent), - write(Out, '</'), rdf_write_id(Out, NameText), write(Out, '>'). -save_body_literal(type(Type, DOM), - NameText, _BaseURI, Out, Indent, Options) :- - rdf_equal(Type, rdf:'XMLLiteral'), !, - save_xml_literal(DOM, NameText, Out, Indent, Options). -save_body_literal(type(Type, Value), - NameText, BaseURI, Out, Indent, _) :- !, - format(Out, '~N~*|<', [Indent]), - rdf_write_id(Out, NameText), - stream_property(Out, encoding(Encoding)), - rdf_value(Type, BaseURI, QVal, Encoding), - format(Out, ' rdf:datatype="~w">', [QVal]), - save_attribute_value(Value, Out, Indent), - write(Out, '</'), rdf_write_id(Out, NameText), write(Out, '>'). -save_body_literal(Literal, - NameText, _, Out, Indent, _) :- - atomic(Literal), !, - format(Out, '~N~*|<', [Indent]), - rdf_write_id(Out, NameText), - write(Out, '>'), - save_attribute_value(Literal, Out, Indent), - write(Out, '</'), rdf_write_id(Out, NameText), write(Out, '>'). -save_body_literal(DOM, - NameText, BaseURI, Out, Indent, Options) :- - rdf_equal(Type, rdf:'XMLLiteral'), - save_body_literal(type(Type, DOM), - NameText, BaseURI, Out, Indent, Options). - -save_attribute_value(Value, Out, _) :- % strings - atom(Value), !, - stream_property(Out, encoding(Encoding)), - xml_quote_cdata(Value, QVal, Encoding), - write(Out, QVal). -save_attribute_value(Value, Out, _) :- % numbers - number(Value), !, - writeq(Out, Value). % quoted: preserve floats -save_attribute_value(Value, _Out, _) :- - throw(error(save_attribute_value(Value), _)). - -%% save_xml_literal(+DOM, +Attr, +Out, +Indent, +Options) is det. -% -% Save an XMLLiteral value. We already emitted -% -% == -% <prop parseType="literal" -% == -% -% but not the terminating =|>|=. We need to establish the -% namespaces used in the DOM. The namespaces in the rdf document -% are in the nsmap-option of Options. - -save_xml_literal(DOM, Attr, Out, Indent, Options) :- - xml_is_dom(DOM), !, - memberchk(nsmap(NsMap), Options), - id_to_atom(Attr, Atom), - xml_write(Out, - element(Atom, ['rdf:parseType'='Literal'], DOM), - [ header(false), - indent(Indent), - nsmap(NsMap) - ]). -save_xml_literal(NoDOM, _, _, _, _) :- - must_be(xml_dom, NoDOM). - -id_to_atom(NS:Local, Atom) :- !, - atomic_list_concat([NS,Local], :, Atom). -id_to_atom(ID, ID). - - -%% rdf_save_list(+Out, +List, +BaseURI, +Indent, +Options) - -rdf_save_list(_, List, _, _, _) :- - rdf_equal(List, rdf:nil), !. -rdf_save_list(Out, List, BaseURI, Indent, Options) :- - rdf_has(List, rdf:first, First), - ( rdf_is_bnode(First) - -> nl(Out), - rdf_save_subject(Out, First, BaseURI, Indent, Options) - ; stream_property(Out, encoding(Encoding)), - rdf_value(First, BaseURI, QVal, Encoding), - format(Out, '~N~*|<rdf:Description rdf:about="~w"/>', - [Indent, QVal]) - ), - flag(rdf_db_saved_triples, X, X+3), - ( rdf_has(List, rdf:rest, List2), - \+ rdf_equal(List2, rdf:nil) - -> rdf_save_list(Out, List2, BaseURI, Indent, Options) - ; true - ). - - -%% rdf_id(+Resource, +BaseURI, -NSLocal) -% -% Generate a NS:Local name for Resource given the indicated -% default namespace. This call is used for elements. - -rdf_id(Id, BaseURI, Local) :- - assertion(atom(BaseURI)), - atom_concat(BaseURI, Local, Id), - sub_atom(Local, 0, 1, _, #), !. -rdf_id(Id, _, NS:Local) :- - iri_xml_namespace(Id, Full, Local), - ns(NS, Full), !. -rdf_id(Id, _, NS:Local) :- - ns(NS, Full), - Full \== '', - atom_concat(Full, Local, Id), !. -rdf_id(Id, _, Id). - - -%% rdf_write_id(+Out, +NSLocal) is det. -% -% Write an identifier. We cannot use native write on it as both NS -% and Local can be operators. - -rdf_write_id(Out, NS:Local) :- !, - format(Out, '~w:~w', [NS, Local]). -rdf_write_id(Out, Atom) :- - write(Out, Atom). - -%% rdf_value(+Resource, +BaseURI, -Text, +Encoding) -% -% According to "6.4 RDF URI References" of the RDF Syntax -% specification, a URI reference is UNICODE string not containing -% control sequences, represented as UTF-8 and then as escaped -% US-ASCII. - -rdf_value(Base, Base, '', _) :- !. -rdf_value(V, Base, Text, Encoding) :- - atom_concat(Base, Local, V), - sub_atom(Local, 0, _, _, #), !, - rdf_quote_uri(Local, Q0), - xml_quote_attribute(Q0, Text, Encoding). -rdf_value(V, _, Text, Encoding) :- - ns(NS, Full), - atom_concat(Full, Local, V), !, - rdf_quote_uri(Local, QLocal0), - xml_quote_attribute(QLocal0, QLocal, Encoding), - atomic_list_concat(['&', NS, (';'), QLocal], Text). -rdf_value(V, _, Q, Encoding) :- - rdf_quote_uri(V, Q0), - xml_quote_attribute(Q0, Q, Encoding). - - - /******************************* - * DEPRECATED MATERIAL * - *******************************/ - -%% rdf_split_url(+Prefix, +Local, -URL) is det. -%% rdf_split_url(-Prefix, -Local, +URL) is det. -% -% Split/join a URL. This functionality is moved to library(sgml). -% -% @deprecated Use iri_xml_namespace/3. Note that the argument -% order is iri_xml_namespace(+IRI, -Namespace, -Localname). - -rdf_split_url(Prefix, Local, URL) :- - atomic(URL), !, - iri_xml_namespace(URL, Prefix, Local). -rdf_split_url(Prefix, Local, URL) :- - atom_concat(Prefix, Local, URL). - -%% rdf_url_namespace(+URL, -Namespace) -% -% Namespace is the namespace of URL. -% -% @deprecated Use iri_xml_namespace/2 - -rdf_url_namespace(URL, Prefix) :- - iri_xml_namespace(URL, Prefix). - - - /******************************* - * MESSAGES * - *******************************/ - -:- multifile - prolog:message/3. - -prolog:message(rdf(loaded(How, What, BaseURI, Triples, Time))) --> - how(How), - source(What), - into(What, BaseURI), - in_time(Triples, Time). -prolog:message(rdf(save_removed_duplicates(N, Subject))) --> - [ 'Removed ~d duplicate triples about "~p"'-[N,Subject] ]. -prolog:message(rdf(saved(File, SavedSubjects, SavedTriples))) --> - [ 'Saved ~D triples about ~D subjects into ~p'- - [SavedTriples, SavedSubjects, File] - ]. -prolog:message(rdf(using_namespace(Id, NS))) --> - [ 'Using namespace id ~w for ~w'-[Id, NS] ]. -prolog:message(rdf(inconsistent_cache(DB, Graphs))) --> - [ 'RDF cache file for ~w contains the following graphs'-[DB], nl, - '~t~8|~p'-[Graphs] - ]. -prolog:message(rdf(guess_format(Ext))) --> - [ 'Unknown file-extension: ~w. Assuming RDF/XML'-[Ext] ]. -prolog:message(rdf_meta(not_expanded(G))) --> - [ 'rdf_meta: ~p is not expanded'-[G] ]. - -how(load) --> [ 'Loaded' ]. -how(parsed) --> [ 'Parsed' ]. - -source(SourceURL) --> - { uri_file_name(SourceURL, File), !, - file_base_name(File, Base) % TBD: relative file? - }, - [ ' "~p"'-[Base] ]. -source(SourceURL) --> - [ ' "~p"'-[SourceURL] ]. - -into(_, _) --> []. % TBD - -in_time(Triples, ParseTime) --> - [ ' in ~2f sec; ~D triples'-[ParseTime, Triples] - ]. - -:- retract(system:swi_io). - - diff --git a/packages/semweb/rdf_edit.pl b/packages/semweb/rdf_edit.pl deleted file mode 100644 index da935ddba..000000000 --- a/packages/semweb/rdf_edit.pl +++ /dev/null @@ -1,1101 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog - - Author: Jan Wielemaker - E-mail: wielemak@science.uva.nl - WWW: http://www.swi-prolog.org - Copyright (C): 1985-2007, University of Amsterdam - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - As a special exception, if you link this library with other files, - compiled with a Free Software compiler, to produce an executable, this - library does not by itself cause the resulting executable to be covered - by the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - - -:- module(rdf_edit, - [ rdfe_assert/3, % Sub, Pred, Obj - rdfe_assert/4, % Sub, Pred, Obj, PayLoad - rdfe_retractall/3, % Sub, Pred, Obj - rdfe_retractall/4, % Sub, Pred, Obj, PayLoad - rdfe_update/4, % Sub, Pred, Obj, +Action - rdfe_update/5, % Sub, Pred, Obj, +PayLoad, +Action - rdfe_load/1, % +File - rdfe_load/2, % +File, +Options - rdfe_delete/1, % +Resource - - rdfe_register_ns/2, % +Id, +URI - rdfe_unregister_ns/2, % +Id, +URI - - rdfe_reset/0, % clear everything - - rdfe_transaction/1, % :Goal - rdfe_transaction/2, % :Goal, +Name - rdfe_transaction_member/2, % +Transactions, -Action - rdfe_transaction_name/2, % +Transactions, -Name - rdfe_set_transaction_name/1,% +Name - - rdfe_set_watermark/1, % +Name - - rdfe_undo/0, % - rdfe_redo/0, - rdfe_can_undo/1, % -TID - rdfe_can_redo/1, % -TID - - rdfe_set_file_property/2, % +File, +Property - rdfe_get_file_property/2, % ?File, ?Property - - rdfe_is_modified/1, % ?File - rdfe_clear_modified/1, % +File - - rdfe_open_journal/2, % +File, +Mode - rdfe_close_journal/0, - rdfe_replay_journal/1, % +File - rdfe_current_journal/1, % -Path - - rdfe_snapshot_file/1 % -File - ]). -:- use_module(rdf_db). -:- use_module(library(broadcast)). -:- use_module(library(lists)). -:- use_module(library(debug)). -:- use_module(library(url)). - -:- meta_predicate - rdfe_transaction(:), - rdfe_transaction(:, +). - -:- dynamic - undo_log/5, % TID, Action, Subj, Pred, Obj - current_transaction/1, % TID - transaction_name/2, % TID, Name - undo_marker/2, % Mode, TID - journal/3, % Path, Mode, Stream - unmodified_md5/2, % Path, MD5 - snapshot_file/1. % File - -/** <module> RDF edit layer -This library provides a number of functions on top of the rdf_db module: - - * Broadcast modifications - * Provide undo/redo - -@tbd This library must be rewritten using rdf_monitor/3. This allows - using edit layer without having to choose between rdf_ and rdfe_ - predicates. - -@see rdf_persistency.pl provides reliable persistency, but without - changes boardcasting and undo/redo. -*/ - -:- rdf_meta - rdfe_assert(r,r,o), - rdfe_assert(r,r,o,+), - rdfe_retractall(r,r,o), - rdfe_update(r,r,o,t), - rdfe_delete(r), - rdfe_transaction(:), - rdfe_transaction(:, +). - - - /******************************* - * BASIC EDIT OPERATIONS * - *******************************/ - -rdfe_assert(Subject, Predicate, Object) :- - rdfe_assert(Subject, Predicate, Object, user). - -rdfe_assert(Subject, Predicate, Object, PayLoad) :- - rdf_assert(Subject, Predicate, Object, PayLoad), - rdfe_current_transaction(TID), - assert_action(TID, assert(PayLoad), Subject, Predicate, Object), - journal(assert(TID, Subject, Predicate, Object, PayLoad)). - -rdfe_retractall(Subject, Predicate, Object) :- - rdfe_retractall(Subject, Predicate, Object, _). - -rdfe_retractall(Subject, Predicate, Object, PayLoad) :- - rdfe_current_transaction(TID), - ( rdf(Subject, Predicate, Object, PayLoad), - assert_action(TID, retract(PayLoad), Subject, Predicate, Object), - journal(retract(TID, Subject, Predicate, Object, PayLoad)), - fail - ; true - ), - rdf_retractall(Subject, Predicate, Object, PayLoad). - -%% rdfe_update(+Subject, +Predicate, +Object, +Action) -% -% Update an existing triple. Possible actions are: -% -%% subject(+Subject) -%% predicate(+Predicate) -%% object(+Object) -%% source(+Source) - -rdfe_update(Subject, Predicate, Object, Action) :- - rdfe_current_transaction(TID), - rdf_update(Subject, Predicate, Object, Action), - ( Action = object(New) - -> assert_action(TID, object(Object), Subject, Predicate, New) - ; Action = predicate(New) - -> assert_action(TID, predicate(Predicate), Subject, New, Object) - ; Action = subject(New) - -> assert_action(TID, subject(Subject), New, Predicate, Object) - ; Action = source(New) - -> forall(rdf(Subject, Predicate, Object, PayLoad), - assert_action(TID, source(PayLoad, New), - Subject, Predicate, Object)) - ), - journal(update(TID, Subject, Predicate, Object, Action)). - -rdfe_update(Subject, Predicate, Object, PayLoad, Action) :- - rdfe_current_transaction(TID), - rdf_update(Subject, Predicate, Object, PayLoad, Action), - ( Action = source(New) - -> assert_action(TID, source(PayLoad, New), - Subject, Predicate, Object) - ; throw(tbd) % source is used internally - ), - journal(update(TID, Subject, Predicate, Object, PayLoad, Action)). - -%% rdfe_delete(+Subject) -% -% Delete a subject and all we know about it. This is a bit tricky. -% If we are involved in transitive relations, should we re-joint -% these in this module? - -rdfe_delete(Subject) :- - rdfe_transaction(delete(Subject)). - -delete(Subject) :- - rdfe_retractall(Subject, _, _), - rdfe_retractall(_, Subject, _), - rdfe_retractall(_, _, Subject). - - - /******************************* - * FILE HANDLING * - *******************************/ - -%% rdfe_load(+File) is det. -%% rdfe_load(+File, +Options) is det. -% -% Load an RDF file and record this action including version information -% to facilitate reliable reload. - -rdfe_load(File) :- - rdfe_load(File, []). - - -rdfe_load(File, Options) :- - rdfe_current_transaction(TID), - absolute_file_name(File, - [ access(read), - extensions([rdf,rdfs,owl,'']) - ], Path), - rdf_load(Path, - [ graph(Graph), - modified(Modified) - | Options - ]), - ( Modified == not_modified - -> true - ; absolute_file_name('.', PWD), - size_file(Path, Size), - ( Modified = last_modified(Stamp) - -> true - ; time_file(Path, Stamp) - ), - SecTime is round(Stamp), - rdf_statistics(triples_by_file(Graph, Triples)), - rdf_md5(Graph, MD5), - assert_action(TID, load_file(Path), -, -, -), - journal(rdf_load(TID, - Path, - [ pwd(PWD), - size(Size), - modified(SecTime), - triples(Triples), - md5(MD5), - from(File) - ])), - ensure_snapshot(Path) - ). - - -rdfe_unload(Path) :- - rdfe_current_transaction(TID), - rdf_unload(Path), - assert_action(TID, unload_file(Path), -, -, -), - journal(rdf_unload(TID, Path)). - - -%% ensure_snapshot(+Path) -% -% Ensure we have a snapshot of Path if we are making a journal, so -% we can always reload the snapshot to ensure exactly the same -% state. - -ensure_snapshot(Path) :- - rdfe_current_journal(_), - rdf_md5(Path, MD5), - ( snapshot_file(Path, MD5, - [ access(read), - file_errors(fail) - ], - File) - -> debug(snapshot, 'Existing snapshot for ~w on ~w', [Path, File]) - ; snapshot_file(Path, MD5, - [ access(write) - ], - File), - debug(snapshot, 'Saving snapshot for ~w to ~w', [Path, File]), - rdf_save_db(File, Path) - ), - assert(snapshot_file(File)). -ensure_snapshot(_). - - -%% load_snapshot(+Source, +Path) -% -% Load triples from the given snapshot file. One of the troubles -% is the time-stamp to avoid rdf_make/0 from reloading the file. -% for the time being we use 1e12, which is a lot further in the -% future than this system is going to live. - -load_snapshot(Source, Path) :- - statistics(cputime, T0), - rdf_load_db(Path), - statistics(cputime, T1), - Time is T1 - T0, - rdf_statistics(triples_by_file(Source, Triples)), - rdf_md5(Source, MD5), - % 1e10: modified far in the future - assert(rdf_db:rdf_source(Source, 1e12, Triples, MD5)), - print_message(informational, - rdf(loaded(Source, Triples, snapshot(Time)))), - assert(snapshot_file(Path)). - - -%% snapshot_file(+Path, +MD5, +Access, -File) -% -% Find existing snapsnot file or location to save a new one. - -snapshot_file(Path, MD5, Options, SnapShot) :- - file_base_name(Path, Base), - atomic_list_concat([Base, @, MD5], File), - absolute_file_name(snapshot(File), - [ extensions([trp]) - | Options - ], - SnapShot). - - -%% rdfe_snapshot_file(-File) -% -% Enumerate the MD5 snapshot files required to restore the current -% journal file. Using this call we can write a routine that -% packages the journal file with all required snapshots to restore -% the journal on another computer. - -rdfe_snapshot_file(File) :- - snapshot_file(File). - - - /******************************* - * NAMESPACE HANDLING * - *******************************/ - -:- dynamic - system_ns/2. -:- volatile - system_ns/2. - -%% rdfe_register_ns(Id, URI) -% -% Encapsulation of rdf_register_ns(Id, URI) - -rdfe_register_ns(Id, URI) :- - rdf_db:ns(Id, URI), !. -rdfe_register_ns(Id, URI) :- - save_system_ns, - rdfe_current_transaction(TID), - rdf_register_ns(Id, URI), - broadcast(rdf_ns(register(Id, URI))), - assert_action(TID, ns(register(Id, URI)), -, -, -), - journal(ns(TID, register(Id, URI))). - -rdfe_unregister_ns(Id, URI) :- - save_system_ns, - rdfe_current_transaction(TID), - retractall(rdf_db:ns(Id, URI)), - broadcast(rdf_ns(unregister(Id, URI))), - assert_action(TID, ns(unregister(Id, URI)), -, -, -), - journal(ns(TID, unregister(Id, URI))). - -% rdfe_register_ns/0 -% -% Reset namespaces to the state they where before usage of the -% rdf_edit layer. - -rdfe_reset_ns :- - ( system_ns(_, _) - -> retractall(rdf_db:ns(Id, URI)), - forall(system_ns(Id, URI), assert(rdb_db:ns(Id, URI))) - ; true - ). - -save_system_ns :- - system_ns(_, _), !. % already done -save_system_ns :- - forall(rdf_db:ns(Id, URI), assert(system_ns(Id, URI))). - - - /******************************* - * TRANSACTIONS * - *******************************/ - -%% rdfe_transaction(:Goal) -% -% Run Goal, recording all modifications as a single transaction. -% If Goal raises an exception or fails, all changes are -% rolled-back. - -rdfe_transaction(Goal) :- - rdfe_transaction(Goal, []). -rdfe_transaction(Goal, Name) :- - rdfe_begin_transaction(Name), - ( catch(Goal, E, true) - -> ( var(E) - -> check_file_protection(Error), - ( var(Error) - -> rdfe_commit - ; rdfe_rollback, - throw(Error) - ) - ; rdfe_rollback, - throw(E) - ) - ; rdfe_rollback, - fail - ). - -%% rdfe_begin_transaction -% -% Start a transaction. This is followed by either rdfe_end_transaction -% or rdfe_rollback. Transactions may be nested. - -rdfe_begin_transaction(Name) :- - current_transaction(TID), !, % nested transaction - append(TID, [1], TID2), - asserta(current_transaction(TID2)), - assert(transaction_name(TID2, Name)). -rdfe_begin_transaction(Name) :- % toplevel transaction - flag(rdf_edit_tid, TID, TID+1), - asserta(current_transaction([TID])), - assert(transaction_name(TID, Name)). - -rdfe_current_transaction(TID) :- - current_transaction(TID), !. -rdfe_current_transaction(_) :- - throw(error(existence_error(rdf_transaction, _), _)). - -rdfe_commit :- - retract(current_transaction(TID)), !, - retractall(undo_marker(_, _)), - ( rdfe_transaction_member(TID, _) - -> get_time(Time), % transaction is not empty - journal(commit(TID, Time)), - ( TID = [Id] - -> broadcast(rdf_transaction(Id)) - ; true - ) - ; true - ). - -rdfe_rollback :- - retract(current_transaction(TID)), !, - journal(rollback(TID)), - rollback(TID). - -%% rollback(+TID) -% -% This is the same as undo/1, but it must not record the undone -% actions as rollbacks cannot be `redone'. Somehow there should -% be a cleaner way to distinguish between transactional operations -% and plain operations. - -rollback(TID) :- - append(TID, _, Id), - ( retract(undo_log(Id, Action, Subject, Predicate, Object)), - ( rollback(Action, Subject, Predicate, Object) - -> fail - ; print_message(error, - rdf_undo_failed(undo(Action, Subject, - Predicate, Object))), - fail - ) - ; true - ). - -rollback(assert(PayLoad), Subject, Predicate, Object) :- !, - rdf_retractall(Subject, Predicate, Object, PayLoad). -rollback(retract(PayLoad), Subject, Predicate, Object) :- !, - rdf_assert(Subject, Predicate, Object, PayLoad). -rollback(Action, Subject, Predicate, Object) :- - action(Action), !, - rdf_update(Subject, Predicate, Object, Action). - - -assert_action(TID, Action, Subject, Predicate, Object) :- - asserta(undo_log(TID, Action, Subject, Predicate, Object)). - -%% undo(+TID) -% -% Undo a transaction as well as possible transactions nested into -% it. - -undo(TID) :- - append(TID, _, Id), - ( retract(undo_log(Id, Action, Subject, Predicate, Object)), - ( undo(Action, Subject, Predicate, Object) - -> fail - ; print_message(warning, - rdf_undo_failed(undo(Action, Subject, - Predicate, Object))), - fail - ) - ; true - ). - -undo(assert(PayLoad), Subject, Predicate, Object) :- !, - rdfe_retractall(Subject, Predicate, Object, PayLoad). -undo(retract(PayLoad), Subject, Predicate, Object) :- !, - rdfe_assert(Subject, Predicate, Object, PayLoad). -undo(source(Old, New), Subject, Predicate, Object) :- !, - rdfe_update(Subject, Predicate, Object, Old, source(New)). -undo(ns(Action), -, -, -) :- !, - ( Action = register(Id, URI) - -> rdfe_unregister_ns(Id, URI) - ; Action = unregister(Id, URI) - -> rdfe_register_ns(Id, URI) - ). -undo(load_file(Path), -, -, -) :- !, - rdfe_unload(Path). -undo(unload_file(Path), -, -, -) :- !, - rdfe_load(Path). -undo(Action, Subject, Predicate, Object) :- - action(Action), !, - rdfe_update(Subject, Predicate, Object, Action). - -action(subject(_)). -action(predicate(_)). -action(object(_)). - -%% rdfe_undo -% -% Undo a (toplevel) transaction. More calls do further undo. The -% `Undone' actions are re-added to the undo log, so the user can -% redo them. Fails if there are no more undo/redo transactions. - -rdfe_undo :- - undo_marker(undo, TID), !, - ( undo_previous(TID, UnDone) - -> retractall(undo_marker(_, _)), - assert(undo_marker(undo, UnDone)), - broadcast(rdf_undo(undo, UnDone)) - ; fail % start of undo log - ). -rdfe_undo :- - retract(undo_marker(redo, _)), !, - last_transaction(TID), - undo_previous(TID, UnDone), - assert(undo_marker(undo, UnDone)), - broadcast(rdf_undo(undo, UnDone)). -rdfe_undo :- - last_transaction(TID), - undo_previous(TID, UnDone), - assert(undo_marker(undo, UnDone)), - broadcast(rdf_undo(undo, UnDone)). - -find_previous_undo(-1, _) :- !, - fail. -find_previous_undo(TID, TID) :- - undo_log([TID|_], _, _, _, _), !. -find_previous_undo(TID0, TID) :- - TID1 is TID0 - 1, - find_previous_undo(TID1, TID). - -undo_previous(TID, Undone) :- - find_previous_undo(TID, Undone), - rdfe_transaction(undo([Undone])). - -last_transaction(TID) :- - undo_log([TID|_], _, _, _, _), !. - -%% rdfe_redo -% -% Start a redo-session - -rdfe_redo :- - ( retract(undo_marker(undo, _)) - -> last_transaction(TID), - undo_previous(TID, UnDone), - assert(undo_marker(redo, UnDone)) - ; retract(undo_marker(redo, TID)) - -> undo_previous(TID, UnDone), - assert(undo_marker(redo, UnDone)) - ; true - ), - broadcast(rdf_undo(redo, UnDone)). - - -%% rdfe_can_redo(-TID) is semidet. -%% rdfe_can_undo(-TID) is semidet. -% -% Check if we can undo and if so return the id of the transaction -% that will be un/re-done. A subsequent call to rdfe_transaction_name -% can be used to give a hint in the UI. - -rdfe_can_redo(Redo) :- - undo_marker(undo, _), !, - last_transaction(TID), - find_previous_undo(TID, Redo). -rdfe_can_redo(Redo) :- - undo_marker(redo, TID), - find_previous_undo(TID, Redo). - -rdfe_can_undo(Undo) :- % continue undo - undo_marker(undo, TID), !, - find_previous_undo(TID, Undo). -rdfe_can_undo(Undo) :- % start undo - last_transaction(TID), - find_previous_undo(TID, Undo). - -%% rdfe_transaction_name(+TID, -Name) -% -% Return name if the transaction is named. - -rdfe_transaction_name(TID, Name) :- - transaction_name(TID, Name), - Name \== []. - -%% rdfe_set_transaction_name(+Name) -% -% Set name of the current transaction - -rdfe_set_transaction_name(Name) :- - current_transaction(TID), !, - assert(transaction_name(TID, Name)). - -%% rdfe_transaction_member(+TID, -Action) -% -% Query actions inside a transaction to allow for quick update -% of visualisers. - -rdfe_transaction_member(TID, Member) :- - ( integer(TID) - -> Id = [TID|_] - ; append(TID, _, Id) - ), - undo_log(Id, Action, Subject, Predicate, Object), - user_transaction_member(Action, Subject, Predicate, Object, Member). - -user_transaction_member(assert(_), Subject, Predicate, Object, - assert(Subject, Predicate, Object)) :- !. -user_transaction_member(retract(_), Subject, Predicate, Object, - retract(Subject, Predicate, Object)) :- !. -user_transaction_member(load_file(Path), -, -, -, - file(load(Path))) :- !. -user_transaction_member(unload_file(Path), -, -, -, - file(unload(Path))) :- !. -user_transaction_member(Update, Subject, Predicate, Object, - update(Subject, Predicate, Object, Update)). - - - /******************************* - * PROTECTION * - *******************************/ - -:- dynamic - rdf_source_permission/2, % file, ro/rw - rdf_current_default_file/2. % file, all/fallback - -%% rdfe_set_file_property(+File, +Options) -% -% Set properties on the file. Options is one of -% -% * access(ro/rw) -% * default(all/fallback) - -rdfe_set_file_property(File, access(Access)) :- !, - to_url(File, URL), - retractall(rdf_source_permission(URL, _)), - assert(rdf_source_permission(URL, Access)), - broadcast(rdf_file_property(URL, access(Access))). -rdfe_set_file_property(File, default(Type)) :- - to_url(File, URL), - rdfe_set_file_property(URL, access(rw)), % must be writeable - retractall(rdf_current_default_file(_,_)), - assert(rdf_current_default_file(URL, Type)), - broadcast(rdf_file_property(URL, default(Type))). - - -%% rdfe_get_file_property(+FileOrURL, ?Option). -%% rdfe_get_file_property(-URL, ?Option). -% -% Fetch file properties set with rdfe_set_file_property/2. - -rdfe_get_file_property(FileOrURL, access(Access)) :- - ( ground(FileOrURL) - -> to_url(FileOrURL, URL) - ; rdf_source(_DB, URL), - FileOrURL = URL - ), - ( rdf_source_permission(URL, Access0) - -> Access0 = Access - ; access_file(URL, write) - -> assert(rdf_source_permission(URL, rw)), - Access = rw - ; assert(rdf_source_permission(URL, ro)), - Access = ro - ). -rdfe_get_file_property(FileOrURL, default(Default)) :- - ground(FileOrURL), - to_url(FileOrURL, URL), - ( rdf_current_default_file(URL, Default) - -> true - ; FileOrURL = user, - Default = fallback - ). -rdfe_get_file_property(URL, default(Default)) :- - ( rdf_current_default_file(URL, Default) - -> true - ; URL = user, - Default = fallback - ). - - -%% check_file_protection(-Error) -% -% Check modification of all protected files - -check_file_protection(Error) :- - ( rdfe_get_file_property(File, access(ro)), - rdfe_is_modified(File) - -> Error = error(permission_error(modify, source, File), triple20) - ; true - ). - - -%% to_url(+Spec, -URL) is det. -% -% Convert a specification into a URL. - -to_url(URL, URL) :- - atom(URL), - sub_atom(URL, B, _, _, '://'), - sub_atom(URL, 0, B, _, Protocol), - url_protocol(Protocol), !. -to_url(File, URL) :- - file_name_to_url(File, URL). - - -url_protocol(file). -url_protocol(http). -url_protocol(https). -url_protocol(ftp). -url_protocol(ftps). - - - /******************************* - * MODIFIED * - *******************************/ - -%% rdfe_is_modified(?Source) -% -% True if facts have been added, deleted or updated that have -% Source as `payload'. - -rdfe_is_modified(Source) :- - rdf_source(DB, Source), - rdf_md5(DB, MD5), - ( unmodified_md5(Source, UnmodifiedMD5) - -> true - ; rdf_db:rdf_source(DB, Source, _Time, _Triples, UnmodifiedMD5) - ), - UnmodifiedMD5 \== MD5. - - -rdfe_clear_modified :- - forall(rdf_graph(File), - rdfe_clear_modified(File)). - -%% rdfe_clear_modified(+DB) is det. -% -% Consider the current state of DB as _unmodified_. - -rdfe_clear_modified(DB) :- - atom(DB), - retractall(unmodified_md5(DB, _)), - rdf_md5(DB, MD5), - ( rdf_db:rdf_source(DB, _File, _Time, _Triples, UnmodifiedMD5), - MD5 == UnmodifiedMD5 - -> true - ; assert(unmodified_md5(DB, MD5)) - ). - - - /******************************* - * WATERMARKS * - *******************************/ - -%% rdfe_set_watermark(Name) -% -% Create a watermark for undo and replay journal upto this point. -% The rest of the logic needs to be written later. - -rdfe_set_watermark(Name) :- - rdfe_current_transaction(TID), - assert_action(TID, watermark(Name), -, -, -), - journal(watermark(TID, Name)). - - - /******************************* - * RESET * - *******************************/ - -%% rdfe_reset -% -% Clear database, undo, namespaces and journalling info. - -rdfe_reset :- - rdfe_reset_journal, - rdfe_reset_ns, - rdfe_reset_undo, - rdf_reset_db, - broadcast(rdf_reset). - -%% rdfe_reset_journal -% -% If a journal is open, close it using rdfe_close_journal/0 - -rdfe_reset_journal :- - ( rdfe_current_journal(_) - -> rdfe_close_journal - ; true - ). - -rdfe_reset_undo :- - retractall(undo_log(_,_,_,_,_)), - retractall(current_transaction(_)), - retractall(transaction_name(_,_)), - retractall(undo_marker(_,_)), - retractall(unmodified_md5(_, _)), - retractall(snapshot_file(_)). - -% close possible open journal at exit. Using a Prolog hook -% guarantees closure, even for most crashes. - -:- at_halt(rdfe_reset_journal). - - - /******************************* - * JOURNALLING * - *******************************/ - -journal_version(1). - -%% rdfe_open_journal(+File, +Mode) is det. -% -% Open a journal writing to File in Mode. Mode is one of -% -% * read -% Open and replay the journal -% -% * write -% Delete current journal and create a fresh one -% -% * append -% Read and replay the existing journal and append new -% modifications to the File. - -rdfe_open_journal(_, _) :- % already open - journal(_, _, _), !. -rdfe_open_journal(File, read) :- !, - absolute_file_name(File, - [ extensions([rdfj, '']), - access(read) - ], - Path), - rdfe_replay_journal(Path), - rdfe_clear_modified. -rdfe_open_journal(File, write) :- !, - absolute_file_name(File, - [ extensions([rdfj, '']), - access(write) - ], - Path), - open(Path, write, Stream, [close_on_abort(false)]), - assert(journal(Path, write, Stream)), - get_time(T), - journal_open(start, T). -rdfe_open_journal(File, append) :- - working_directory(CWD, CWD), - absolute_file_name(File, - [ extensions([rdfj, '']), - relative_to(CWD), - access(write) - ], - Path), - ( exists_file(Path) - -> rdfe_replay_journal(Path), - rdfe_clear_modified, - get_time(T), - assert(journal(Path, append(T), [])) - ; rdfe_open_journal(Path, write) - ). - - -journal_open(Type, Time) :- - journal_comment(Type, Time), - SecTime is round(Time), - journal_version(Version), - Start =.. [ Type, [ time(SecTime), - version(Version) - ] - ], - journal(Start), - broadcast(rdf_journal(Start)). - -journal_comment(start, Time) :- - journal(_, _, Stream), - format_time(string(String), '%+', Time), - format(Stream, - '/* Triple20 Journal File\n\n \ - Created: ~w\n \ - Triple20 by Jan Wielemaker <wielemak@science.uva.nl>\n\n \ - EDIT WITH CARE!\n\ - */~n~n', [String]). -journal_comment(resume, Time) :- - journal(_, _, Stream), - format_time(string(String), '%+', Time), - format(Stream, - '\n\ - /* Resumed: ~w\n\ - */~n~n', [String]). - -%% rdfe_close_journal -% -% Close the journal. Automatically called from at program -% termination from at_halt/1. - -rdfe_close_journal :- - get_time(T), - SecTime is round(T), - journal(end([ time(SecTime) - ])), - retract(journal(_, Mode, Stream)), - ( Mode = append(_) - -> true - ; close(Stream) - ). - -%% rdfe_current_journal(-Path) -% -% Query the currently open journal - -rdfe_current_journal(Path) :- - journal(Path, _Mode, _Stream). - -journal(Term) :- - journal(Path, append(T), _), !, - ( Term = end(_) - -> true - ; open(Path, append, Stream, [close_on_abort(false)]), - retractall(journal(Path, _, _)), - assert(journal(Path, append, Stream)), - journal_open(resume, T), - journal(Term) - ). -journal(Term) :- - ( journal(_, _, Stream) - -> write_journal(Term, Stream), - flush_output(Stream) - ; broadcast(rdf_no_journal(Term)) - ). - -write_journal(commit(TID, Time), Stream) :- !, - format(Stream, 'commit(~q, ~2f).~n~n', [TID, Time]). -write_journal(Term, Stream) :- - format(Stream, '~q.~n', [Term]). - - -%% rdfe_replay_journal(+File) -% -% Replay a journal file. For now this is our cheap way to deal -% with save/load. Future versions may be more clever when dealing -% with the version information stored in the journal. - -rdfe_replay_journal(File) :- - absolute_file_name(File, - [ extensions([rdfj, '']), - access(read) - ], - Path), - open(Path, read, Stream), - replay(Stream), - close(Stream). - -replay(Stream) :- - read(Stream, Term), - replay(Term, Stream). - -replay(end_of_file, _) :- !. -replay(start(_Attributes), Stream) :- !, - read(Stream, Term), - replay(Term, Stream). -replay(resume(_Attributes), Stream) :- !, - read(Stream, Term), - replay(Term, Stream). -replay(end(_Attributes), Stream) :- !, - read(Stream, Term), - replay(Term, Stream). -replay(Term0, Stream) :- - replay_transaction(Term0, Stream), - read(Stream, Term), - replay(Term, Stream). - -replay_transaction(Term0, Stream) :- - collect_transaction(Term0, Stream, Transaction, Last), - ( committed_transaction(Last) - -> replay_actions(Transaction) - ; true - ). - -collect_transaction(End, _, [], End) :- - ends_transaction(End), !. -collect_transaction(A, Stream, [A|T], End) :- - read(Stream, Term), - collect_transaction(Term, Stream, T, End). - -committed_transaction(commit(_)). -committed_transaction(commit(_, _)). - -ends_transaction(end_of_file). -ends_transaction(commit(_)). -ends_transaction(commit(_, _)). -ends_transaction(rollback(_)). -ends_transaction(end(_)). -ends_transaction(start(_)). - -replay_actions([]). -replay_actions([H|T]) :- - ( replay_action(H) - -> replay_actions(T) - ; print_message(warning, - rdf_replay_failed(H)), - ( debugging(journal) - -> gtrace, - replay_actions([H|T]) - ; replay_actions(T) - ) - ). - - -%% replay_action(+Action) -% -% Replay actions from the journal. Tricky is rdf_load/3. It should -% reload the file in the state it was in at the moment it was -% created. For now this has been hacked for files that were empry -% at the moment they where loaded (e.g. created from `new_file' in -% our GUI prototype). How to solve this? We could warn if the file -% appears changed, but this isn't really easy as copying and OS -% differences makes it hard to decide on changes by length as well -% as modification time. Alternatively we could save the state in -% seperate quick-load states. - -replay_action(retract(_, Subject, Predicate, Object, PayLoad)) :- - rdf_retractall(Subject, Predicate, Object, PayLoad). -replay_action(assert(_, Subject, Predicate, Object, PayLoad)) :- - rdf_assert(Subject, Predicate, Object, PayLoad). -replay_action(update(_, Subject, Predicate, Object, Action)) :- - rdf_update(Subject, Predicate, Object, Action). -replay_action(update(_, Subject, Predicate, Object, Payload, Action)) :- - rdf_update(Subject, Predicate, Object, Payload, Action). -replay_action(rdf_load(_, File, Options)) :- - memberchk(md5(MD5), Options), - snapshot_file(File, MD5, - [ access(read), - file_errors(fail) - ], - Path), !, - debug(snapshot, 'Reloading snapshot ~w~n', [Path]), - load_snapshot(File, Path). -replay_action(rdf_load(_, File, Options)) :- - find_file(File, Options, Path), - ( memberchk(triples(0), Options), - memberchk(modified(Modified), Options) - -> rdf_retractall(_,_,_,Path:_), - retractall(rdf_db:rdf_source(Path, _, _, _)), % TBD: move - rdf_md5(Path, MD5), - assert(rdf_db:rdf_source(Path, Modified, 0, MD5)) - ; rdf_load(Path) - ). -replay_action(rdf_unload(_, Source)) :- - rdf_unload(Source). -replay_action(ns(_, register(ID, URI))) :- !, - rdf_register_ns(ID, URI). -replay_action(ns(_, unregister(ID, URI))) :- - retractall(rdf_db:ns(ID, URI)). -replay_action(watermark(_, _Name)) :- - true. - -find_file(File, _, File) :- - exists_file(File), !. -find_file(File, Options, Path) :- - memberchk(pwd(PWD), Options), - make_path(File, PWD, Path), - exists_file(Path), !. - -%% make_path(+File, +PWD, -Path) -% -% Return location of File relative to PWD, Parent of PWD, etc. (TBD) - -make_path(File, PWD, Path) :- - atom_concat(PWD, /, PWD2), - atom_concat(PWD2, Path, File). - - - /******************************* - * MESSAGES * - *******************************/ - -:- multifile - prolog:message/3, - user:message_hook/3. - -% Catch messages. - -prolog:message(rdf_replay_failed(Term)) --> - [ 'RDFDB: Replay of ~p failed'-[Term] ]. -prolog:message(rdf_undo_failed(Term)) --> - [ 'RDFDB: Undo of ~p failed'-[Term] ]. diff --git a/packages/semweb/rdf_http_plugin.pl b/packages/semweb/rdf_http_plugin.pl deleted file mode 100644 index 5f6388f45..000000000 --- a/packages/semweb/rdf_http_plugin.pl +++ /dev/null @@ -1,166 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog - - Author: Jan Wielemaker - E-mail: J.Wielemaker@cs.vu.nl - WWW: http://www.swi-prolog.org - Copyright (C): 1985-2010, University of Amsterdam - VU University Amsterdam - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - As a special exception, if you link this library with other files, - compiled with a Free Software compiler, to produce an executable, this - library does not by itself cause the resulting executable to be covered - by the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - - -:- module(rdf_http_plugin, []). -:- use_module(library(http/http_open)). -:- use_module(library(http/http_header)). -:- use_module(library(semweb/rdf_db)). -:- use_module(library(date)). -:- use_module(library(error)). - - -/** <module> RDF HTTP Plugin - -This module allows loading data into the semantic web library directly -from an HTTP server. The following example loads the RDF core data into -the RDF database. - - == - :- use_module(library(semweb/rdf_db)). - :- use_module(library(semweb/rdf_http_plugin)). - - ..., - rdf_load('http://www.w3.org/1999/02/22-rdf-syntax-ns') - == -*/ - -:- multifile - rdf_db:rdf_open_hook/8, - rdf_db:url_protocol/1. - -rdf_db:url_protocol(http). - - -%% rdf_extra_headers(-List) -% -% Send extra headers with the request. Note that, although we also -% process RDF embedded in HTML, we do not explicitely ask for it. -% Doing so causes some (e.g., http://w3.org/2004/02/skos/core to -% reply with the HTML description rather than the RDF). - -rdf_extra_headers( - [ request_header('Accept' = 'application/rdf+xml, \ - text/rdf+xml; q=0.9, \ - text/turtle, \ - application/x-turtle; q=0.8, \ - */*; q=0.1') - ]). - - -rdf_db:rdf_open_hook(http, SourceURL, HaveModified, Stream, Cleanup, - Modified, Format, Options) :- - modified_since_header(HaveModified, Header), - TypeHdr = [ header(content_type, ContentType), - header(last_modified, ModifiedText) - ], - rdf_extra_headers(Extra), - append([Extra, TypeHdr, Header, Options], OpenOptions), - catch(http_open(SourceURL, Stream0, OpenOptions), E, true), - ( var(E) - -> ( open_envelope(ContentType, SourceURL, - Stream0, Stream, Format) - -> Cleanup = close(Stream), - ( nonvar(ModifiedText), - parse_time(ModifiedText, ModifiedStamp) - -> Modified = last_modified(ModifiedStamp) - ; Modified = unknown - ) - ; close(Stream0), - domain_error(content_type, ContentType) - ) - ; subsumes_chk(error(_, context(_, status(304, _))), E) - -> Modified = not_modified, - Cleanup = true - ; throw(E) - ). - - -%% modified_since_header(+LastModified, -ExtraHeaders) is det. -% -% Add an =|If-modified-since|= if we have a version with the given -% time-stamp. - -modified_since_header(HaveModified, []) :- - var(HaveModified), !. -modified_since_header(HaveModified, - [ request_header('If-modified-since' = - Modified) - ]) :- - http_timestamp(HaveModified, Modified). - -%% open_envelope(+ContentType, +SourceURL, +Stream0, -Stream, -%% ?Format) is semidet. -% -% Open possible envelope formats. - -open_envelope('application/x-gzip', SourceURL, Stream0, Stream, Format) :- - rdf_db:rdf_storage_encoding(_, gzip), !, - ( var(Format) - -> file_name_extension(BaseURL, _GzExt, SourceURL), - file_name_extension(_, Ext, BaseURL), - rdf_db:rdf_file_type(Ext, Format) - ; true - ), - rdf_zlib_plugin:zopen(Stream0, Stream, []). -open_envelope(_, _, Stream, Stream, Format) :- - nonvar(Format), !. -open_envelope(ContentType, SourceURL, Stream, Stream, Format) :- - major_content_type(ContentType, Major), - ( content_type_format(Major, Format) - -> true - ; Major == 'text/plain' % server is not properly configured - -> file_name_extension(_, Ext, SourceURL), - rdf_db:rdf_file_type(Ext, Format) - ). - -major_content_type(ContentType, Major) :- - sub_atom(ContentType, Pre, _, _, (;)), !, - sub_atom(ContentType, 0, Pre, _, Major). -major_content_type(Major, Major). - -%% content_type_format(+ContentType, +URL) -% -% Deduce the RDF encoding from the mime-type. -% -% @bug The turtle parser only parses a subset of n3. - -content_type_format('text/rdf', xml). -content_type_format('text/rdf+xml', xml). -content_type_format('application/rdf+xml', xml). -content_type_format('application/x-turtle', turtle). -content_type_format('application/turtle', turtle). -content_type_format('text/turtle', turtle). -content_type_format('text/rdf+n3', turtle). % Bit dubious -content_type_format('text/html', xhtml). -content_type_format('application/xhtml+xml', xhtml). -content_type_format('application/x-gzip', gzip). diff --git a/packages/semweb/rdf_library.pl b/packages/semweb/rdf_library.pl deleted file mode 100644 index 6f5e4ab2f..000000000 --- a/packages/semweb/rdf_library.pl +++ /dev/null @@ -1,789 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog - - Author: Jan Wielemaker - E-mail: wielemak@science.uva.nl - WWW: http://www.swi-prolog.org - Copyright (C): 2007, University of Amsterdam - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - As a special exception, if you link this library with other files, - compiled with a Free Software compiler, to produce an executable, this - library does not by itself cause the resulting executable to be covered - by the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -:- module(rdf_library, - [ rdf_attach_library/1, % +Dir - rdf_load_library/1, % +Ontology - rdf_load_library/2, % +Ontology, +Options - rdf_list_library/0, - rdf_list_library/1, % +Ontology - rdf_list_library/2, % +Ontology, +Options - rdf_library_index/2 % ?Id, ?Facet - ]). -:- use_module(library('semweb/rdf_db')). -:- use_module(library('semweb/rdf_turtle')). -:- use_module(library(rdf)). -:- use_module(library(lists)). -:- use_module(library(option)). -:- use_module(library(debug)). -:- use_module(library(error)). -:- use_module(library(pairs)). -:- use_module(library(date)). -:- use_module(library(uri)). -:- use_module(library(http/http_open)). -:- use_module(library(thread)). - -/** <module> RDF Library Manager - -This module manages an ontology library. Such a library consists of a -directory with manifest files named =manifest.rdf= or =manifest.ttl= -(Turtle). The manifest files define ontologies appearing in the library -as well as namespace mnemonics and dependencies. - -The typical usage scenario is - -== -?- rdf_attach_library('/some/directory'). -?- rdf_load_library(my_ontology). -== - -@tbd Add caching info -@author Jan Wielemaker -*/ - -:- rdf_register_ns(lib, 'http://www.swi-prolog.org/rdf/library/'). - -:- dynamic - manifest/2, % Path, Time - library_db/3. % Name, URL, Facets - -% Force compile-time namespace expansion - -:- rdf_meta - edge(+, r,r,o). - - /******************************* - * LOADING * - *******************************/ - -%% rdf_load_library(+Id) is det. -%% rdf_load_library(+Id, +Options) is det. -% -% Load ontologies from the library. A library must first be -% attached using rdf_attach_library/1. Defined Options are: -% -% * import(Bool) -% If =true= (default), also load ontologies that are -% explicitely imported. -% -% * base_uri(URI) -% BaseURI used for loading RDF. Local definitions in -% ontologies overrule this option. -% -% * claimed_source(URL) -% URL from which we claim to have loaded the data. -% -% * not_found(+Level) -% The system does a pre-check for the existence of -% all references RDF databases. If Level is =error= -% it reports missing databases as an error and fails. -% If =warning= it prints them, but continues. If -% =silent=, no checks are preformed. Default is =error=. -% -% * concurrent(Threads) -% Perform the load concurrently using N threads. If not -% specified, the number is determined by -% guess_concurrency/2. -% -% * load(+Bool) -% If =false=, to all the preparation, but do not execute -% the actual loading. See also rdf_list_library/2. - -rdf_load_library(Id) :- - rdf_load_library(Id, []). - -rdf_load_library(Id, Options) :- - load_commands(Id, Options, Pairs), - pairs_values(Pairs, Commands), - list_to_set(Commands, Cmds2), - delete_virtual(Cmds2, Cmds3), - find_conflicts(Cmds3), - check_existence(Cmds3, Cmds, Options), - ( option(concurrent(Threads), Options) - -> true - ; guess_concurrency(Cmds, Threads) - ), - length(Cmds, NSources), - print_message(informational, rdf(loading(NSources, Threads))), - ( option(load(true), Options, true) - -> concurrent(Threads, Cmds, []) - ; true - ). - -delete_virtual([], []). -delete_virtual([virtual(_)|T0], T) :- !, - delete_virtual(T0, T). -delete_virtual([H|T0], [H|T]) :- - delete_virtual(T0, T). - - -%% find_conflicts(+LoadCommands) is semidet. -% -% Find possibly conflicting options for loading the same source - -find_conflicts(Commands) :- - sort(Commands, Cmds), - conflicts(Cmds, Conflicts), - report_conflics(Conflicts), - Conflicts == []. - -conflicts([], []). -conflicts([C1, C2|T0], [C1-C2|T]) :- - conflict(C1, C2), !, - conflicts([C2|T0], T). -conflicts([_|T0], T) :- - conflicts(T0, T). - -conflict(rdf_load(Src, Options1), rdf_load(Src, Options2)) :- - sort(Options1, S1), - sort(Options2, S2), - S1 \== S2. - -report_conflics([]). -report_conflics([C1-C2|T]) :- - print_message(warning, rdf(load_conflict(C1,C2))), - report_conflics(T). - - -%% check_existence(+CommandsIn, -Commands, +Options) is det. -% -% Report existence errors. Fail if at least one source does not -% exist. and the not_found level is not =silent=. -% -% @error existence_error(urls, ListOfUrls) - -check_existence(CommandsIn, Commands, Options) :- - option(not_found(Level), Options, error), - must_be(oneof([error,warning,silent]), Level), - ( Level == silent - -> true - ; missing_urls(CommandsIn, Commands, Missing), - ( Missing == [] - -> true - ; Level == warning - -> report_missing(Missing, Level) - ; existence_error(urls, Missing) - ) - ). - - -missing_urls([], [], []). -missing_urls([H|T0], Cmds, Missing) :- - H = rdf_load(URL, _), - ( catch(exists_url(URL), error(existence_error(_,_), _), fail) - -> Cmds = [H|T], - missing_urls(T0, T, Missing) - ; Missing = [URL|T], - missing_urls(T0, Cmds, T) - ). - -report_missing([], _). -report_missing([H|T], Level) :- - print_message(Level, error(existence_error(url, H), _)), - report_missing(T, Level). - -%% guess_concurrency(+Commands, -Threads) is det. -% -% How much concurrency to use? Set to the number of CPUs if all -% input comes from files or 5 if network based loading is -% demanded. - -guess_concurrency(Commands, Threads) :- - count_uris(Commands, FileURLs, OtherURLs), - ( FileURLs > 0 - -> ( current_prolog_flag(cpu_count, CPUs) - -> true - ; CPUs = 1 - ), - FileThreads is min(FileURLs, CPUs) - ; FileThreads = 0 - ), - ( OtherURLs > 0 - -> OtherThreads is min(5, OtherURLs) - ; OtherThreads = 0 - ), - Threads is FileThreads + OtherThreads. - -count_uris([], 0, 0). -count_uris([rdf_load(URL, _)|T], F, NF) :- - count_uris(T, F0, NF0), - ( sub_atom(URL, 0, _, _, 'file://') - -> F is F0 + 1, - NF = NF0 - ; NF is NF0 + 1, - F = F0 - ). - - -%% load_commands(+Id, +Options, -Pairs:list(Level-Command)) is det. -% -% Commands are the RDF commands to execute for rdf_load_library/2. -% Splitting in command collection and execution allows for -% concurrent execution as well as forward checking of possible -% problems. -% -% @tbd Fix poor style; avoid assert/retract. - -:- thread_local - command/2. - -load_commands(Id, Options, Commands) :- - retractall(command(_,_)), - rdf_update_library_index, - dry_load(Id, 1, Options), - findall(Level-Cmd, retract(command(Level, Cmd)), Commands). - -dry_load(Id, Level, Options) :- - ( library(Id, File, Facets) - -> merge_base_uri(Facets, Options, Options1), - merge_source(Facets, Options1, Options2), - merge_blanks(Facets, Options2, Options3), - ( \+ memberchk(virtual, Facets) - -> load_options(Options3, File, RdfOptions), - assert(command(Level, rdf_load(File, RdfOptions))) - ; assert(command(Level, virtual(File))) - ), - ( option(import(true), Options, true) - -> Level1 is Level + 1, - forall(member(imports(_, Import), Facets), - import(Import, Level1, Options3)) - ; true - ) - ; existence_error(ontology, Id) - ). - -merge_base_uri(Facets, Options0, Options) :- - ( option(base_uri(Base), Facets) - -> delete(Options0, base_uri(_), Options1), - Options = [base_uri(Base)|Options1] - ; Options = Options0 - ). - -merge_source(Facets, Options0, Options) :- - ( option(claimed_source(Base), Facets) - -> delete(Options0, claimed_source(_), Options1), - Options = [claimed_source(Base)|Options1] - ; Options = Options0 - ). - -merge_blanks(Facets, Options0, Options) :- - ( option(blank_nodes(Share), Facets) - -> delete(Options0, blank_nodes(_), Options1), - Options = [blank_nodes(Share)|Options1] - ; Options = Options0 - ). - -load_options(Options, File, RDFOptions) :- - findall(O, load_option(Options, File, O), RDFOptions). - -load_option(Options, File, db(Source)) :- - option(claimed_source(Source0), Options), - ( sub_atom(Source0, _, _, 0, /) - -> file_base_name(File, Base), - atom_concat(Source0, Base, Source) - ; atom_concat(Source, #, Source0) - -> true - ). -load_option(Options, File, base_uri(BaseURI)) :- - option(base_uri(Base0), Options), - sub_atom(/, _, _, 0, Base0), - atom_concat(Base0, File, BaseURI). -load_option(Options, _File, blank_nodes(Share)) :- - option(blank_nodes(Share), Options). - -%% import(+URL, +Level, +Options) is det. - -import(Path, Level, Options) :- - ( ( library(Id, Path, _) - -> true - ; manifest_for_path(Path, Manifest), - catch(exists_url(Manifest), _, fail) - -> process_manifest(Manifest), - library(Id, Path, _) - ) - -> dry_load(Id, Level, Options) - ; load_options(Options, Path, RdfOptions), - assert(command(Level, rdf_load(Path, RdfOptions))) - ). - -manifest_for_path(URL, Manifest) :- - file_directory_name(URL, Parent), - manifest_file(Base), - rdf_extension(Ext), - concat_atom([Parent, /, Base, '.', Ext], Manifest). - -%% rdf_list_library(+Id) is det. -%% rdf_list_library(+Id, +Options) is det. -% -% Print library dependency tree to the terminal. Options include -% options for rdf_load_library/2 and -% -% * show_source(+Boolean) -% If =true= (default), show location we are loading -% -% * show_graph(+Boolean) -% If =true= (default =false=), show name of graph -% -% * show_virtual(+Boolean) -% If =false= (default =true=), do not show virtual -% repositories. -% -% * indent(Atom) -% Atom repeated for indentation levels - -rdf_list_library(Id) :- - rdf_list_library(Id, []). -rdf_list_library(Id, Options) :- - load_commands(Id, Options, Commands), - maplist(print_load(Options), Commands). - -print_load(Options, _Level-virtual(_)) :- - option(show_virtual(false), Options), !. -print_load(Options, Level-Command) :- - option(indent(Indent), Options, '. '), - forall(between(2, Level, _), format(Indent)), - print_command(Command, Options), - format('~N'). - -print_command(virtual(URL), _Options) :- - format('<~w>', [URL]). -print_command(rdf_load(URL), Options) :- - print_command(rdf_load(URL, []), Options). -print_command(rdf_load(URL, RDFOptions), Options) :- - ( option(show_source(true), Options, true) - -> format('~w', [URL]), - ( option(blank_nodes(noshare), RDFOptions) - -> format(' <not shared>') - ; true - ), - ( exists_url(URL) - -> true - ; format(' [NOT FOUND]') - ) - ; true - ), - ( option(show_graph(true), Options, false), - option(db(Base), RDFOptions) - -> format('~N\tSource: ~w', [Base]) - ; true - ). - -exists_url(URL) :- - rdf_db:rdf_input(URL, Source, _BaseURI), - existing_url_source(Source). - -existing_url_source(file(Path)) :- !, - access_file(Path, read). -existing_url_source(url(http, URL)) :- !, - catch(http_open(URL, Stream, [ method(head) ]), _, fail), - close(Stream). - - -%% rdf_list_library -% -% Prints known RDF library identifiers to current output. - -rdf_list_library :- - rdf_update_library_index, - ( rdf_library_index(Id, title(Title)), - format('~w ~t~20|~w', [Id, Title]), - ( rdf_library_index(Id, version(Version)) - -> format(' (version ~w)', [Version]) - ; true - ), - nl, - fail - ; true - ). - - -%% rdf_library_index(?Id, ?Facet) is nondet. -% -% Query the content of the library. Defined facets are: -% -% * source(URL) -% Location from which to load the ontology -% -% * title(Atom) -% Title used for the ontology -% -% * comment(Atom) -% Additional comments for the ontology -% -% * version(Atom) -% Version information on the ontology -% -% * imports(Type, URL) -% URLs needed by this ontology. May succeed multiple -% times. Type is one of =ontology=, =schema= or =instances=. -% -% * base_uri(BaseURI) -% Base URI to use when loading documents. If BaseURI -% ends in =|/|=, the actual filename is attached. -% -% * claimed_source(Source) -% URL from which we claim to have loaded the RDF. If -% Source ends in =|/|=, the actual filename is -% attached. -% -% * blank_nodes(Share) -% Defines how equivalent blank nodes are handled, where -% Share is one of =share= or =noshare=. Default is to -% share. -% -% * provides_ns(URL) -% Ontology provides definitions in the namespace URL. -% The formal definition of this is troublesome, but in -% practice it means the ontology has triples whose -% subjects are in the given namespace. -% -% * uses_ns(URL) -% The ontology depends on the given namespace. Normally -% means it contains triples that have predicates or -% objects in the given namespace. -% -% * manifest(Path) -% Manifest file this ontology is defined in -% -% * virtual -% Entry is virtual (cannot be loaded) - -rdf_library_index(Id, Facet) :- - library(Id, Path, Facets), - ( Facet = source(Path) - ; member(Facet, Facets) - ). - - - /******************************* - * MANIFEST PROCESSING * - *******************************/ - -%% rdf_attach_library(+Source) -% -% Attach manifest from Source. Source is one of -% -% * URL -% Load single manifest from this URL -% * File -% Load single manifest from this file -% * Directory -% Scan all subdirectories and load all =|Manifest.ttl|= or -% =|Manifest.rdf|= found. -% -% Encountered namespaces are registered using rdf_register_ns/2. -% Encountered ontologies are added to the index. If a manifest was -% already loaded it will be reloaded if the modification time has -% changed. - -rdf_attach_library(URL) :- - atom(URL), - uri_is_global(URL), - \+ is_absolute_file_name(URL), !, % avoid interpreting C: as a schema - process_manifest(URL). -rdf_attach_library(File) :- - absolute_file_name(File, Path, - [ extensions([rdf,ttl]), - access(read), - file_errors(fail) - ]), !, - process_manifest(Path). -rdf_attach_library(Dir) :- - absolute_file_name(Dir, Path, - [ file_type(directory), - access(read) - ]), - attach_dir(Path, []). - - -%% rdf_update_library_index -% -% Reload all Manifest files. - -rdf_update_library_index :- - forall(manifest(Location, _Time), - process_manifest(Location)). - -attach_dir(Path, Visited) :- - memberchk(Path, Visited), !. -attach_dir(Path, Visited) :- - atom_concat(Path, '/*', Pattern), - expand_file_name(Pattern, Members), - ( member(Manifest, Members), - is_manifest_file(Manifest) - -> process_manifest(Manifest) - ; print_message(silent, rdf(no_manifest(Path))) - ), - ( member(Dir, Members), - exists_directory(Dir), - file_base_name(Dir, Base), - \+ hidden_base(Base), - attach_dir(Dir, [Path|Visited]), - fail ; true - ). - -hidden_base('CVS'). -hidden_base('cvs'). % Windows - -%% process_manifest(+Location) is det. -% -% Process a manifest file, registering encountered namespaces and -% creating clauses for library/3. No op if manifest was loaded and -% not changed. Removes old data if the manifest was changed. -% -% @param Location is either a path name or a URL. - -process_manifest(Source) :- - ( uri_file_name(Source, Manifest0) - -> absolute_file_name(Manifest0, Manifest) - ; absolute_file_name(Source, Manifest) - ), % Manifest is a canonical filename - source_time(Manifest, MT), - ( manifest(Manifest, Time), - ( MT =< Time - -> ! - ; retractall(manifest(Manifest, Time)), - library_db(Id, URL, Facets), - memberchk(manifest(Manifest), Facets), - retractall(library_db(Id, URL, Facets)), - fail - ) - ; read_triples(Manifest, Triples), - process_triples(Manifest, Triples), - print_message(informational, rdf(manifest(loaded, Manifest))), - assert(manifest(Manifest, MT)) - ). - -process_triples(Manifest, Triples) :- - findall(ns(Mnemonic, NameSpace), - extract_namespace(Triples, Mnemonic, NameSpace), - NameSpaces), - findall(Ontology, - extract_ontology(Triples, Ontology), - Ontologies), - maplist(define_namespace, NameSpaces), - maplist(assert_ontology(Manifest), Ontologies). - -%% extract_namespace(+Triples, -Mnemonic, -NameSpace) -% -% True if Mnemonic is an abbreviation of NameSpace. - -extract_namespace(Triples, Mnemonic, Namespace) :- - edge(Triples, Decl, lib:mnemonic, literal(Mnemonic)), - edge(Triples, Decl, lib:namespace, Namespace). - -%% extract_ontology(+Triples, -Ontology) is nondet. -% -% Extract definition of an ontology - -extract_ontology(Triples, library(Name, URL, Options)) :- - edge(Triples, URL, rdf:type, Type), - ( ontology_type(Type) - -> file_base_name(URL, BaseName), - file_name_extension(Name, _, BaseName), - findall(Facet, facet(Triples, URL, Facet), Options) - ). - -ontology_type(X) :- - ( rdf_equal(X, lib:'Ontology') - ; rdf_equal(X, lib:'Schema') - ; rdf_equal(X, lib:'Instances') - ). - -%% facet(+Triples, +File, -Facet) is nondet. -% -% Enumerate facets about File from Triples. Facets are described -% with rdf_library_index/2. - -facet(Triples, File, title(Title)) :- - edge(Triples, File, dc:title, literal(Title)). -:- if(rdf_current_ns(dcterms, _)). -facet(Triples, File, title(Title)) :- - edge(Triples, File, dcterms:title, literal(Title)). -:- endif. -facet(Triples, File, version(Version)) :- - edge(Triples, File, owl:versionInfo, literal(Version)). -facet(Triples, File, comment(Comment)) :- - edge(Triples, File, rdfs:comment, literal(Comment)). -facet(Triples, File, base_uri(BaseURI)) :- - edge(Triples, File, lib:baseURI, BaseURI). -facet(Triples, File, claimed_source(Source)) :- - edge(Triples, File, lib:source, Source). -facet(Triples, File, blank_nodes(Mode)) :- - edge(Triples, File, lib:blankNodes, literal(Mode)), - must_be(oneof([share,noshare]), Mode). -facet(Triples, File, imports(ontology, Path)) :- - edge(Triples, File, owl:imports, Path). -facet(Triples, File, imports(schema, Path)) :- - edge(Triples, File, lib:schema, Path). -facet(Triples, File, imports(instances, Path)) :- - edge(Triples, File, lib:instances, Path). -facet(Triples, File, provides_ns(NS)) :- - edge(Triples, File, lib:providesNamespace, NSDecl), - edge(Triples, NSDecl, lib:namespace, NS). -facet(Triples, File, uses_ns(NS)) :- - edge(Triples, File, lib:usesNamespace, NSDecl), - edge(Triples, NSDecl, lib:namespace, NS). -facet(Triples, File, virtual) :- - edge(Triples, File, rdf:type, lib:'Virtual'). - -%% edge(+Triples, ?S, ?P, ?O) is nondet. -% -% Like rdf/3 over a list of Triples. - -edge(Triples, S, P, O) :- - member(rdf(S,P,O), Triples). - -%% source_time(+Source, -Modified) is semidet. -% -% Modified is the last modification time of Source. -% -% @error existence_error(Type, Source). - -source_time(URL, Modified) :- - sub_atom(URL, 0, _, _, 'http://'), !, - http_open(URL, Stream, - [ header(last_modified, Date), - method(head) - ]), - close(Stream), - Date \== '', - parse_time(Date, Modified). -source_time(URL, Modified) :- - uri_file_name(URL, File), !, - time_file(File, Modified). -source_time(File, Modified) :- - time_file(File, Modified). - - -%% read_triples(+File, -Triples) is det. -% -% Read RDF/XML or Turtle file into a list of triples. - -read_triples(File, Triples) :- - file_name_extension(_, rdf, File), !, - load_rdf(File, Triples). -read_triples(File, Triples) :- - file_name_extension(_, ttl, File), !, - rdf_load_turtle(File, Triples, []). - -%% is_manifest_file(+Path) -% -% True if Path is the name of a manifest file. - -is_manifest_file(Path) :- - file_base_name(Path, File), - downcase_atom(File, Lwr), - file_name_extension(Base, Ext, Lwr), - manifest_file(Base), - rdf_extension(Ext), !. - -manifest_file('Manifest'). -manifest_file('manifest'). - -rdf_extension(ttl). -rdf_extension(rdf). - - -%% assert_ontology(+Manifest, +Term:library(Name, File, Facets)) is det. -% -% Add ontology to our library. -% -% @tbd Proper behaviour of re-definition? - -assert_ontology(Manifest, Term) :- - Term = library(Name, URL, Facets), - ( library(Name, _URL2, Facets2) - -> memberchk(manifest(Manifest2), Facets2), - print_message(warning, rdf(redefined(Manifest, Name, Manifest2))) - ; true - ), - assert(library_db(Name, URL, - [ manifest(Manifest) - | Facets - ])). - - -%% library(?Id, ?URL, ?Facets) -% -% Access DB for library information. - -library(Id, URL, Facets) :- - nonvar(URL), - normalize_url(URL, CanonicalURL), - library_db(Id, CanonicalURL, Facets). -library(Id, URL, Facets) :- - library_db(Id, URL, Facets). - -%% normalize_url(+URL, -Normalized) -% -% Like uri_normalized/2, but we also need (platform dependent) -% filename canonization. - -normalize_url(URL, CanonicalURL) :- - uri_file_name(URL, File), !, - absolute_file_name(File, CanFile), - uri_file_name(CanonicalURL, CanFile). -normalize_url(URL, CanonicalURL) :- - uri_normalized(URL, CanonicalURL). - -%% define_namespace(NS:ns(Mnemonic, Namespace)) is det. -% -% Add namespace declaration for Mnemonic. - -define_namespace(ns(Mnemonic, Namespace)) :- - debug(rdf_library, 'Adding NS ~w = ~q', [Mnemonic, Namespace]), - rdf_register_ns(Mnemonic, Namespace, - [ - ]). - - - /******************************* - * MESSAGES * - *******************************/ - -:- multifile - prolog:message/3. - -prolog:message(rdf(no_manifest(Path))) --> - [ 'Directory ~w has no Manifest.{ttl,rdf} file'-[Path] ]. -prolog:message(rdf(redefined(Manifest, Name, Manifest2))) --> - [ '~w: Ontology ~w already defined in ~w'- - [Manifest, Name, Manifest2] - ]. -prolog:message(rdf(manifest(loaded, Manifest))) --> - [ 'Loaded RDF manifest ~w'-[Manifest] - ]. -prolog:message(rdf(load_conflict(C1, C2))) --> - [ 'Conflicting loads: ~p <-> ~p'-[C1, C2] ]. -prolog:message(rdf(loading(Files, Threads))) --> - [ 'Loading ~D files using ~D threads ...'-[Files, Threads] ]. - diff --git a/packages/semweb/rdf_library.ttl b/packages/semweb/rdf_library.ttl deleted file mode 100644 index 35ded4d2e..000000000 --- a/packages/semweb/rdf_library.ttl +++ /dev/null @@ -1,77 +0,0 @@ -@prefix lib: <http://www.swi-prolog.org/rdf/library/> . -@prefix owl: <http://www.w3.org/2002/07/owl#> . -@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . -@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . - -# Class lib:Ontology - -lib:Ontology - a owl:Class ; - rdfs:comment "Ontology in library" ; - rdfs:subClassOf owl:Ontology . -lib:Schema - a owl:Class ; - rdfs:comment "Collection of classes and properties" ; - rdfs:subClassOf lib:Ontology . -lib:Instances - a owl:Class ; - rdfs:comment "Collection of instances" ; - rdfs:subClassOf lib:Ontology . -lib:Virtual - a owl:Class ; - rdfs:comment "Entry itself is not loadable" . - -lib:schema - a owl:OntologyProperty ; - rdfs:subPropertyOf owl:imports ; - rdfs:domain lib:Ontology ; - rdfs:range lib:Schema ; - rdfs:comment "URL for file holding schemas" . - -lib:instances - a owl:OntologyProperty ; - rdfs:subPropertyOf owl:imports ; - rdfs:domain lib:Ontology ; - rdfs:range lib:Instances ; - rdfs:comment "URL for file holding instances" . - -lib:baseURI - a owl:OntologyProperty ; - rdfs:domain lib:Ontology ; - rdfs:comment "URI based as initial Base URI" . - -lib:blankNodes - a owl:OntologyProperty ; - rdfs:domain lib:Ontology ; - rdfs:range rdfs:Literal ; - rdfs:comment "How to handle identical blank notes. - One of 'share' or 'noshare'" . - -lib:source - a owl:OntologyProperty ; - rdfs:domain lib:Ontology ; - rdfs:comment "URL from which we claim to have loaded the data" . - -lib:providesNamespace - a owl:OntologyProperty ; - rdfs:domain lib:Ontology ; - rdfs:range lib:Namespace . - -lib:usesNamespace - a owl:OntologyProperty ; - rdfs:domain lib:Ontology ; - rdfs:range lib:Namespace . - -# Class lib:Namespace - -lib:Namespace - a owl:Class ; - rdfs:subClassOf rdfs:Resource . -lib:mnemonic - a rdfs:Property ; - rdfs:domain lib:Namespace ; - rdfs:range rdf:Literal . -lib:namespace - a rdfs:Property ; - rdfs:domain lib:Namespace ; - rdfs:range rdf:Resource . diff --git a/packages/semweb/rdf_litindex.pl b/packages/semweb/rdf_litindex.pl deleted file mode 100644 index 41ce116b2..000000000 --- a/packages/semweb/rdf_litindex.pl +++ /dev/null @@ -1,702 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog - - Author: Jan Wielemaker - E-mail: wielemak@science.uva.nl - WWW: http://www.swi-prolog.org - Copyright (C): 2006, University of Amsterdam - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - As a special exception, if you link this library with other files, - compiled with a Free Software compiler, to produce an executable, this - library does not by itself cause the resulting executable to be covered - by the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - - -:- module(rdf_litindex, - [ rdf_set_literal_index_option/1, % +Options - rdf_tokenize_literal/2, % +Literal, -Tokens - rdf_find_literals/2, % +Spec, -ListOfLiterals - rdf_token_expansions/2 % +Spec, -Expansions - ]). -:- use_module(rdf_db). -:- use_module(library(debug)). -:- use_module(library(lists)). -:- use_module(library(error)). -:- use_module(library(porter_stem)). -:- use_module(library(double_metaphone)). - -/** <module> Search literals -This module finds literals of the RDF database based on stemming and -being flexible to ordering of tokens. -*/ - -:- dynamic - literal_map/2, % Type, -Map - new_token/1, % Hook - setting/1. -:- volatile - literal_map/2. -:- multifile - tokenization/2, % +Literal, -Tokens - exclude_from_index/2. % +Which, +Token - - -setting(verbose(true)). % print progress messages -setting(index_threads(1)). % # threads for creating the index -setting(index(default)). % Use a thread for incremental updates - -%% rdf_set_literal_index_option(+Options:list) -% -% Set options for the literal package. Currently defined options -% -% * verbose(Bool) -% If =true=, print progress messages while building the -% index tables. -% -% * index_threads(+Count) -% Number of threads to use for initial indexing of -% literals -% -% * index(+How) -% How to deal with indexing new literals. How is one of -% =self= (execute in the same thread), thread(N) (execute -% in N concurrent threads) or =default= (depends on number -% of cores). - -rdf_set_literal_index_option([]) :- !. -rdf_set_literal_index_option([H|T]) :- !, - set_option(H), - rdf_set_literal_index_option(T). -rdf_set_literal_index_option(Option) :- - set_option(Option). - -set_option(Term) :- - check_option(Term), - functor(Term, Name, Arity), - functor(General, Name, Arity), - retractall(setting(General)), - assert(setting(Term)). - -check_option(X) :- - var(X), !, - instantiation_error(X). -check_option(verbose(X)) :- !, - must_be(boolean, X). -check_option(index_threads(Count)) :- !, - must_be(nonneg, Count). -check_option(index(How)) :- !, - must_be(oneof([default,thread(_),self]), How). -check_option(Option) :- - domain_error(literal_option, Option). - - - /******************************* - * QUERY * - *******************************/ - -%% rdf_find_literals(+Spec, -Literals) -% -% Find literals in the RDF database matching Spec. Spec is defined -% as: -% -% == -% Spec ::= and(Spec,Spec) -% Spec ::= or(Spec,Spec) -% Spec ::= not(Spec) -% Spec ::= sounds(Like) -% Spec ::= stem(Like) -% Spec ::= prefix(Prefix) -% Spec ::= between(Low, High) % Numerical between -% Spec ::= ge(High) % Numerical greater-equal -% Spec ::= le(Low) % Numerical less-equal -% Spec ::= Token -% == -% -% sounds(Like) and stem(Like) both map to a disjunction. First we -% compile the spec to normal form: a disjunction of conjunctions -% on elementary tokens. Then we execute all the conjunctions and -% generate the union using ordered-set algorithms. -% -% @tbd Exploit ordering of numbers and allow for > N, < N, etc. - -rdf_find_literals(Spec, Literals) :- - compile_spec(Spec, DNF), - token_index(Map), - lookup(DNF, Map, _, SuperSet), - flatten(SuperSet, Set0), - sort(Set0, Literals). - -%% rdf_token_expansions(+Spec, -Extensions) -% -% Determine which extensions of a token contribute to finding -% literals. - -rdf_token_expansions(prefix(Prefix), [prefix(Prefix, Tokens)]) :- - token_index(Map), - rdf_keys_in_literal_map(Map, prefix(Prefix), Tokens). -rdf_token_expansions(sounds(Like), [sounds(Like, Tokens)]) :- - metaphone_index(Map), - rdf_find_literal_map(Map, [Like], Tokens). -rdf_token_expansions(stem(Like), [stem(Like, Tokens)]) :- - porter_index(Map), - rdf_find_literal_map(Map, [Like], Tokens). -rdf_token_expansions(Spec, Expansions) :- - compile_spec(Spec, DNF), - token_index(Map), - lookup(DNF, Map, SCS, _), - flatten(SCS, CS), - sort(CS, Expansions0), - join_expansions(Expansions0, Expansions). - -join_expansions([], []). -join_expansions([H0|T0], [H|T]) :- - untag(H0, Tag, V0), - Tag =.. L0, - append(L0, [[V0|Values]], L1), - H =.. L1, - join_expansions_by_tag(T0, Tag, T1, Values), - join_expansions(T1, T). - -join_expansions_by_tag([H|T0], Tag, T, [V0|VT]) :- - untag(H, Tag, V0), !, - join_expansions_by_tag(T0, Tag, T, VT). -join_expansions_by_tag(L, _, L, []). - -lookup(@(false), _, [], []) :- !. -lookup(or(H0,T0), Map, [CH|CT], [H|T]) :- !, - lookup(H0, Map, CH, H), - lookup(T0, Map, CT, T). -lookup(H0, Map, [C], [H]) :- - lookup1(H0, Map, C, H). - -lookup1(Conj, Map, Cond, Literals) :- - phrase(conj_to_list(Conj), List), !, - rdf_find_literal_map(Map, List, Literals), - ( Literals \== [] - -> phrase(conj_to_cond(Conj), Cond) - ; Cond = [] - ). -lookup1(_, _, _, []). - -conj_to_list(and(A,B)) --> !, - conj_to_list(A), - conj_to_list(B). -conj_to_list(@(false)) --> !, - {fail}. -conj_to_list(Tagged) --> - { untag(Tagged, L) }, !, - [L]. -conj_to_list(L) --> - [L]. - - -conj_to_cond(and(A,B)) --> !, - conj_to_cond(A), - conj_to_cond(B). -conj_to_cond(Tagged) --> - { untag(Tagged, _) }, !, - [ Tagged ]. -conj_to_cond(_) --> - []. - - -%% compile_spec(+Spec, -Compiled) -% -% Compile a specification as above into disjunctive normal form - -compile_spec(Spec, DNF) :- - expand_fuzzy(Spec, Spec2), - nnf(Spec2, NNF), - dnf(NNF, DNF). - - -expand_fuzzy(Var, _) :- - var(Var), !, - throw(error(instantiation_error, _)). -expand_fuzzy(sounds(Like), Or) :- !, - metaphone_index(Map), - double_metaphone(Like, Key), - rdf_find_literal_map(Map, [Key], Tokens), - list_to_or(Tokens, sounds(Like), Or). -expand_fuzzy(stem(Like), Or) :- !, - porter_index(Map), - porter_stem(Like, Key), - rdf_find_literal_map(Map, [Key], Tokens), - list_to_or(Tokens, stem(Like), Or). -expand_fuzzy(prefix(Prefix), Or) :- !, - token_index(Map), - rdf_keys_in_literal_map(Map, prefix(Prefix), Tokens), - list_to_or(Tokens, prefix(Prefix), Or). -expand_fuzzy(case(String), Or) :- !, - token_index(Map), - rdf_keys_in_literal_map(Map, case(String), Tokens), - list_to_or(Tokens, case(String), Or). -expand_fuzzy(or(A0, B0), E) :- !, - expand_fuzzy(A0, A), - expand_fuzzy(B0, B), - simplify(or(A,B), E). -expand_fuzzy(and(A0, B0), E) :- !, - expand_fuzzy(A0, A), - expand_fuzzy(B0, B), - simplify(and(A,B), E). -expand_fuzzy(not(A0), not(A)) :- !, - expand_fuzzy(A0, A). -expand_fuzzy(between(Low, High), Or) :- !, - token_index(Map), - rdf_keys_in_literal_map(Map, between(Low, High), Tokens), - list_to_or(Tokens, between(Low, High), Or). -expand_fuzzy(le(High), Or) :- !, - token_index(Map), - rdf_keys_in_literal_map(Map, le(High), Tokens), - list_to_or(Tokens, le(High), Or). -expand_fuzzy(ge(Low), Or) :- !, - token_index(Map), - rdf_keys_in_literal_map(Map, ge(Low), Tokens), - list_to_or(Tokens, ge(Low), Or). -expand_fuzzy(Token, Token) :- - atomic(Token), !. -expand_fuzzy(Token, _) :- - throw(error(type_error(Token, boolean_expression), _)). - -simplify(Expr0, Expr) :- - simple(Expr0, Expr), !. -simplify(Expr, Expr). - -simple(and(@(false), _), @(false)). -simple(and(_, @(false)), @(false)). -simple(or(@(false), X), X). -simple(or(X, @(false)), X). - - -list_to_or([], _, @(false)) :- !. -list_to_or([X], How, One) :- !, - tag(How, X, One). -list_to_or([H0|T0], How, or(H, T)) :- - tag(How, H0, H), - list_to_or(T0, How, T). - -tag(sounds(X), Y, sounds(X,Y)). -tag(stem(X), Y, stem(X,Y)). -tag(prefix(X), Y, prefix(X,Y)). -tag(case(X), Y, case(X,Y)). -tag(between(L,H), Y, between(L,H,Y)). -tag(ge(L), Y, ge(L,Y)). -tag(le(H), Y, le(H,Y)). - -untag(sounds(_,Y), Y). -untag(stem(_,Y), Y). -untag(prefix(_,Y), Y). -untag(case(_,Y), Y). -untag(between(_,_,Y), Y). -untag(le(_,Y), Y). -untag(ge(_,Y), Y). - -untag(sounds(X,Y), sounds(X), Y). -untag(stem(X,Y), stem(X), Y). -untag(prefix(X,Y), prefix(X), Y). -untag(case(X,Y), case(X), Y). -untag(between(L,H,Y), between(L,H), Y). -untag(ge(L,Y), ge(L), Y). -untag(le(H,Y), le(H), Y). - - -%% nnf(+Formula, -NNF) -% -% Rewrite to Negative Normal Form, meaning negations only appear -% around literals. - -nnf(not(not(A0)), A) :- !, - nnf(A0, A). -nnf(not(and(A0,B0)), or(A,B)) :- !, - nnf(not(A0), A), - nnf(not(B0), B). -nnf(not(or(A0,B0)), and(A,B)) :- !, - nnf(not(A0), A), - nnf(not(B0), B). -nnf(A, A). - - -%% dnf(+NNF, -DNF) -% -% Convert a formula in NNF to Disjunctive Normal Form (DNF) - -dnf(or(A0,B0), or(A, B)) :- !, - dnf(A0, A), - dnf(B0, B). -dnf(and(A0,B0), DNF):- !, - dnf(A0, A1), - dnf(B0, B1), - dnf1(and(A1,B1), DNF). -dnf(DNF, DNF). - -dnf1(and(A0, or(B,C)), or(P,Q)) :- !, - dnf1(and(A0,B), P), - dnf1(and(A0,C), Q). -dnf1(and(or(B,C), A0), or(P,Q)) :- !, - dnf1(and(A0,B), P), - dnf1(and(A0,C), Q). -dnf1(DNF, DNF). - - - /******************************* - * TOKEN INDEX * - *******************************/ - -%% token_index(-Map) -% -% Get the index of tokens. If not present, create one from the -% current database. Once created, the map is kept up-to-date using -% a monitor hook. - -token_index(Map) :- - literal_map(tokens, Map), !. -token_index(Map) :- - rdf_new_literal_map(Map), - assert(literal_map(tokens, Map)), - make_literal_index, - verbose('~N', []), - Monitor = [ reset, - new_literal, - old_literal - ], - ( setting(index(default)) - -> ( current_prolog_flag(cpu_count, N), N > 1 - -> create_update_literal_thread(1), - rdf_monitor(thread_monitor_literal, Monitor) - ; rdf_monitor(monitor_literal, Monitor) - ) - ; setting(index(thread(N))) - -> create_update_literal_thread(N), - rdf_monitor(thread_monitor_literal, Monitor) - ; rdf_monitor(monitor_literal, Monitor) - ). - - -%% make_literal_index -% -% Create the initial literal index. - -make_literal_index :- - setting(index_threads(N)), !, - threaded_literal_index(N). -make_literal_index :- - current_prolog_flag(cpu_count, X), - threaded_literal_index(X). - -threaded_literal_index(N) :- - N > 1, !, - message_queue_create(Q, [max_size(1000)]), - create_index_threads(N, Q, Ids), - forall(rdf_current_literal(Literal), - thread_send_message(Q, Literal)), - forall(between(1, N, _), - thread_send_message(Q, done(true))), - maplist(thread_join, Ids, _). -threaded_literal_index(_) :- - forall(rdf_current_literal(Literal), - register_literal(Literal)). - -create_index_threads(N, Q, [Id|T]) :- - N > 0, !, - thread_create(index_worker(Q), Id, - [ local(1000), - global(1000), - trail(1000) - ]), - N2 is N - 1, - create_index_threads(N2, Q, T). -create_index_threads(_, _, []) :- !. - -index_worker(Queue) :- - repeat, - thread_get_message(Queue, Msg), - work(Msg). - -work(done(true)) :- !. -work(Literal) :- - register_literal(Literal), - fail. - - -% clean_token_index -% -% Clean after a reset. - -clean_token_index :- - forall(literal_map(_, Map), - rdf_reset_literal_map(Map)). - - /******************************* - * THREADED UPDATE * - *******************************/ - -% create_update_literal_thread(+Threads) -% -% Setup literal monitoring using threads. While loading databases -% through rdf_attach_db/2 from rdf_persistency.pl, most of the -% time is spent updating the literal token database. While loading -% the RDF triples, most of the time is spend in updating the AVL -% tree holding the literals. Updating the token index hangs on -% updating the AVL trees holding the tokens. Both tasks however -% can run concurrently. - -create_update_literal_thread(Threads) :- - message_queue_create(_, - [ alias(rdf_literal_monitor_queue), - max_size(10000) - ]), - forall(between(1, Threads, N), - ( atom_concat(rdf_literal_monitor_, N, Alias), - thread_create(monitor_literals, _, - [ alias(Alias), - local(1000), - global(1000), - trail(1000) - ]) - )). - -monitor_literals :- - set_prolog_flag(agc_margin, 0), % we don't create garbage - repeat, - thread_get_message(rdf_literal_monitor_queue, Literal), - register_literal(Literal), - fail. - -thread_monitor_literal(new_literal(Literal)) :- !, - thread_send_message(rdf_literal_monitor_queue, Literal). -thread_monitor_literal(Action) :- !, - monitor_literal(Action). - - - /******************************* - * MONITORED UPDATE * - *******************************/ - -monitor_literal(new_literal(Literal)) :- - register_literal(Literal). -monitor_literal(old_literal(Literal)) :- - unregister_literal(Literal). -monitor_literal(transaction(begin, reset)) :- - rdf_monitor(monitor_literal, [-old_literal]), - clean_token_index. -monitor_literal(transaction(end, reset)) :- - rdf_monitor(monitor_literal, [+old_literal]). - -%% register_literal(+Literal) -% -% Associate the tokens of a literal with the literal itself. - -register_literal(Literal) :- - ( rdf_tokenize_literal(Literal, Tokens) - -> text_of(Literal, Text), - literal_map(tokens, Map), - add_tokens(Tokens, Text, Map) - ; true - ). - -add_tokens([], _, _). -add_tokens([H|T], Literal, Map) :- - rdf_insert_literal_map(Map, H, Literal, Keys), - ( var(Keys) - -> true - ; forall(new_token(H), true), - ( Keys mod 1000 =:= 0 - -> progress(Map, 'Tokens') - ; true - ) - ), - add_tokens(T, Literal, Map). - - -%% unregister_literal(+Literal) -% -% Literal is removed from the database. As we abstract from lang -% and type qualifiers we first have to check this is the last one -% that is destroyed. - -unregister_literal(Literal) :- - text_of(Literal, Text), - ( rdf(_,_,literal(Text)) - -> true % still something left - ; rdf_tokenize_literal(Literal, Tokens), - literal_map(tokens, Map), - del_tokens(Tokens, Text, Map) - ). - -del_tokens([], _, _). -del_tokens([H|T], Literal, Map) :- - rdf_delete_literal_map(Map, H, Literal), - del_tokens(T, Literal, Map). - - -%% rdf_tokenize_literal(+Literal, -Tokens) is semidet. -% -% Tokenize a literal. We make this hookable as tokenization is -% generally domain dependent. - -rdf_tokenize_literal(Literal, Tokens) :- - tokenization(Literal, Tokens), !. % Hook -rdf_tokenize_literal(Literal, Tokens) :- - text_of(Literal, Text), - atom(Text), - tokenize_atom(Text, Tokens0), - select_tokens(Tokens0, Tokens). - -select_tokens([], []). -select_tokens([H|T0], T) :- - ( exclude_from_index(token, H) - -> select_tokens(T0, T) - ; number(H) - -> ( integer(H), - between(-1073741824, 1073741823, H) - -> T = [H|T1], - select_tokens(T0, T1) - ; select_tokens(T0, T) - ) - ; atom_length(H, 1) - -> select_tokens(T0, T) - ; no_index_token(H) - -> select_tokens(T0, T) - ; T = [H|T1], - select_tokens(T0, T1) - ). - - -% no_index_token/1 -% -% Tokens we do not wish to index, as they creat huge amounts of -% data with little or no value. Is there a more general way to -% describe this? Experience shows that simply word count is not a -% good criterium as it often rules out popular domain terms. - -no_index_token(and). -no_index_token(an). -no_index_token(or). -no_index_token(of). -no_index_token(on). -no_index_token(in). -no_index_token(this). -no_index_token(the). - - -%% text_of(+LiteralArg, -Text) -% -% Get the textual or (integer) numerical information from a -% literal value. - -text_of(type(_, Text), Text) :- !. -text_of(lang(_, Text), Text) :- !. -text_of(Text, Text) :- atom(Text), !. -text_of(Text, Text) :- integer(Text). - - - /******************************* - * PORTER INDEX * - *******************************/ - - -porter_index(Map) :- - literal_map(porter, Map), !. -porter_index(Map) :- - rdf_new_literal_map(Map), - assert(literal_map(porter, Map)), - fill_porter_index(Map), - assert((new_token(Token) :- add_stem(Token, Map))). - -fill_porter_index(PorterMap) :- - token_index(TokenMap), - rdf_keys_in_literal_map(TokenMap, all, Tokens), - stem(Tokens, PorterMap). - -stem([], _). -stem([Token|T], Map) :- - ( atom(Token) - -> porter_stem(Token, Stem), - rdf_insert_literal_map(Map, Stem, Token, Keys), - ( integer(Keys), - Keys mod 1000 =:= 0 - -> progress(Map, 'Porter') - ; true - ) - ; true - ), - stem(T, Map). - - -add_stem(Token, Map) :- - porter_stem(Token, Stem), - rdf_insert_literal_map(Map, Stem, Token, _). - - - /******************************* - * METAPHONE INDEX * - *******************************/ - - -metaphone_index(Map) :- - literal_map(metaphone, Map), !. -metaphone_index(Map) :- - rdf_new_literal_map(Map), - assert(literal_map(metaphone, Map)), - fill_metaphone_index(Map), - assert((new_token(Token) :- add_metaphone(Token, Map))). - -fill_metaphone_index(PorterMap) :- - token_index(TokenMap), - rdf_keys_in_literal_map(TokenMap, all, Tokens), - metaphone(Tokens, PorterMap). - -metaphone([], _). -metaphone([Token|T], Map) :- - ( atom(Token) - -> double_metaphone(Token, SoundEx), - rdf_insert_literal_map(Map, SoundEx, Token, Keys), - ( integer(Keys), - Keys mod 1000 =:= 0 - -> progress(Map, 'Metaphone') - ; true - ) - ; true - ), - metaphone(T, Map). - - -add_metaphone(Token, Map) :- - double_metaphone(Token, SoundEx), - rdf_insert_literal_map(Map, SoundEx, Token). - - - /******************************* - * UTIL * - *******************************/ - -verbose(Fmt, Args) :- - setting(verbose(true)), !, - format(user_error, Fmt, Args). -verbose(_, _). - -progress(Map, Which) :- - setting(verbose(true)), !, - rdf_statistics_literal_map(Map, size(Keys, Values)), - format(user_error, - '\r~t~w: ~12|Keys: ~t~D~15+; Values: ~t~D~20+', - [Which, Keys, Values]). -progress(_,_). diff --git a/packages/semweb/rdf_persistency.pl b/packages/semweb/rdf_persistency.pl deleted file mode 100644 index 8784e937e..000000000 --- a/packages/semweb/rdf_persistency.pl +++ /dev/null @@ -1,1108 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog - - Author: Jan Wielemaker - E-mail: wielemak@science.uva.nl - WWW: http://www.swi-prolog.org - Copyright (C): 1985-2007, University of Amsterdam - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - As a special exception, if you link this library with other files, - compiled with a Free Software compiler, to produce an executable, this - library does not by itself cause the resulting executable to be covered - by the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -:- module(rdf_persistency, - [ rdf_attach_db/2, % +Directory, +Options - rdf_detach_db/0, % +Detach current DB - rdf_current_db/1, % -Directory - rdf_persistency/2, % +DB, +Bool - rdf_flush_journals/1, % +Options - rdf_journal_file/2, % ?DB, ?JournalFile - rdf_db_to_file/2 % ?DB, ?FileBase - ]). -:- use_module(library('semweb/rdf_db')). -:- use_module(library(lists)). -:- use_module(library(url)). -:- use_module(library(debug)). -:- use_module(library(error)). -:- use_module(library(thread)). -:- use_module(library(pairs)). - - -/** <module> RDF persistency plugin - -This module provides persistency for rdf_db.pl based on the -rdf_monitor/2 predicate to track changes to the repository. Where -previous versions used autosafe of the whole database using the -quick-load format of rdf_db, this version is based on a quick-load file -per source (4th argument of rdf/4), and journalling for edit operations. - -The result is safe, avoids frequent small changes to large files which -makes synchronisation and backup expensive and avoids long disruption of -the server doing the autosafe. Only loading large files disrupts service -for some time. - -The persistent backup of the database is realised in a directory, using -a lock file to avoid corruption due to concurrent access. Each source is -represented by two files, the latest snapshot and a journal. The state -is restored by loading the snapshot and replaying the journal. The -predicate rdf_flush_journals/1 can be used to create fresh snapshots and -delete the journals. - -@tbd if there is a complete `.new' snapshot and no journal, we should -move the .new to the plain snapshot name as a means of recovery. - -@see rdf_edit.pl -*/ - -:- volatile - rdf_directory/1, - rdf_option/1, - source_journal_fd/2, - db_file_base/2, - file_base_db/2. -:- dynamic - rdf_directory/1, % Absolute path - rdf_option/1, % Defined options - source_journal_fd/2, % DB, JournalFD - db_file_base/2, % DB, FileBase - file_base_db/2. % FileBase, DB - -:- meta_predicate - no_agc(0). - -%% rdf_attach_db(+Directory, +Options) -% -% Start persistent operations using Directory as place to store -% files. There are several cases: -% -% * Empty DB, existing directory -% Load the DB from the existing directory -% -% * Full DB, empty directory -% Create snapshots for all sources in directory -% -% Options: -% -% * concurrency(+Jobs) -% Number of threads to use for loading the initial -% database. If not provided it is the number of CPUs -% as optained from the flag =cpu_count=. -% -% * max_open_journals(+Count) -% Maximum number of journals kept open. If not provided, -% the default is 10. See limit_fd_pool/0. -% -% * silent(+BoolOrBrief) -% If =true= (default =false=), do not print informational -% messages. Finally, if =brief= it will show minimal -% feedback. -% -% * log_nested_transactions(+Boolean) -% If =true=, nested _log_ transactions are added to the -% journal information. By default (=false=), no log-term -% is added for nested transactions. - -rdf_attach_db(DirSpec, Options) :- - absolute_file_name(DirSpec, - Directory, - [ access(write), - file_type(directory), - file_errors(fail) - ]), !, - ( rdf_directory(Directory) - -> true % update settings? - ; rdf_detach_db, - mkdir(Directory), - lock_db(Directory), - assert(rdf_directory(Directory)), - assert_options(Options), - stop_monitor, % make sure not to register load - no_agc(load_db), - at_halt(rdf_detach_db), - start_monitor - ). -rdf_attach_db(DirSpec, Options) :- - absolute_file_name(DirSpec, - Directory, - [ solutions(all) - ]), - ( exists_directory(Directory) - -> access_file(Directory, write) - ; catch(make_directory(Directory), _, fail) - ), !, - rdf_attach_db(Directory, Options). - - -assert_options([]). -assert_options([H|T]) :- - ( option_type(H, Check) - -> Check, - assert(rdf_option(H)) - ; true % ignore options we do not understand - ), - assert_options(T). - -option_type(concurrency(X), must_be(positive_integer, X)). -option_type(max_open_journals(X), must_be(positive_integer, X)). -option_type(silent(X), must_be(oneof([true,false,brief]), X)). -option_type(log_nested_transactions(X), must_be(boolean, X)). - - -%% no_agc(:Goal) -% -% Run Goal with atom garbage collection disabled. Loading an RDF -% database creates large amounts of atoms we *know* are not -% garbage. - -no_agc(Goal) :- - current_prolog_flag(agc_margin, Old), - set_prolog_flag(agc_margin, 0), - call_cleanup(Goal, set_prolog_flag(agc_margin, Old)). - - -%% rdf_detach_db is det. -% -% Detach from the current database. Succeeds silently if no -% database is attached. Normally called at the end of the program -% through at_halt/1. - -rdf_detach_db :- - debug(halt, 'Detaching database', []), - stop_monitor, - close_journals, - ( retract(rdf_directory(Dir)) - -> debug(halt, 'DB Directory: ~w', [Dir]), - retractall(rdf_option(_)), - retractall(source_journal_fd(_,_)), - retractall(db_file_base(_,_)), - unlock_db(Dir) - ; true - ). - - -%% rdf_current_db(?Dir) -% -% True if Dir is the current RDF persistent database. - -rdf_current_db(Directory) :- - rdf_directory(Dir), !, - Dir = Directory. - - -%% rdf_flush_journals(+Options) -% -% Flush dirty journals. Options: -% -% * min_size(+KB) -% Only flush if journal is over KB in size. -% TBD: sensible default size - -rdf_flush_journals(Options) :- - forall(rdf_source(DB), - rdf_flush_journal(DB, Options)). - -rdf_flush_journal(DB, Options) :- - db_files(DB, _SnapshotFile, JournalFile), - db_file(JournalFile, File), - ( \+ exists_file(File) - -> true - ; memberchk(min_size(KB), Options), - size_file(JournalFile, Size), - Size / 1024 < KB - -> true - ; create_db(DB) - ). - - /******************************* - * LOAD * - *******************************/ - -%% load_db is det. -% -% Reload database from the directory specified by rdf_directory/1. -% First we find all names graphs using find_dbs/1 and then we load -% them. - -load_db :- - rdf_directory(Dir), - working_directory(Old, Dir), - get_time(Wall0), - statistics(cputime, T0), - call_cleanup(find_dbs(DBs), working_directory(_, Old)), - length(DBs, DBCount), - verbosity(DBCount, Silent), - make_goals(DBs, Silent, 1, DBCount, Goals), - concurrency(Jobs), - concurrent(Jobs, Goals, []), - statistics(cputime, T1), - get_time(Wall1), - T is T1 - T0, - Wall is Wall1 - Wall0, - message_level(Silent, Level), - print_message(Level, rdf(restore(attached(DBCount, T/Wall)))). - - -make_goals([], _, _, _, []). -make_goals([DB|T0], Silent, I, Total, - [load_source(DB, Silent, I, Total)|T]) :- - I2 is I + 1, - make_goals(T0, Silent, I2, Total, T). - -verbosity(_DBCount, Silent) :- - rdf_option(silent(Silent)), !. -verbosity(DBCount, Silent) :- - DBCount > 25, !, - Silent = brief. -verbosity(_DBCount, false). - - -%% concurrency(-Jobs) -% -% Number of jobs to run concurrently. - -concurrency(Jobs) :- - rdf_option(concurrency(Jobs)), !. -concurrency(Jobs) :- - current_prolog_flag(cpu_count, Jobs), - Jobs > 0, !. -concurrency(1). - - -%% find_dbs(-DBs:list(atom)) is det. -% -% DBs is a list of database (named graph) names, sorted in -% increasing file-size. Small files are loaded first as these -% typically contain the schemas and we want to avoid re-hashing -% large databases due to added rdfs:subPropertyOf triples. - -find_dbs(DBs) :- - expand_file_name(*, Files), - phrase(scan_db_files(Files), Scanned), - sort(Scanned, ByDB), - join_snapshot_and_journals(ByDB, BySize), - keysort(BySize, SortedBySize), - pairs_values(SortedBySize, DBs). - - -%% scan_db_files(+Files)// is det. -% -% Produces a list of db(DB, Size, File) for all recognised RDF -% database files. - -scan_db_files([]) --> - []. -scan_db_files([File|T]) --> - { file_name_extension(Base, Ext, File), - db_extension(Ext), !, - rdf_db_to_file(DB, Base), - size_file(File, Size) - }, - [ db(DB, Size, File) ], - scan_db_files(T). -scan_db_files([_|T]) --> - scan_db_files(T). - - -db_extension(trp). -db_extension(jrn). - -join_snapshot_and_journals([], []). -join_snapshot_and_journals([db(DB,S0,_)|T0], [S-DB|T]) :- !, - same_db(DB, T0, T1, S0, S), - join_snapshot_and_journals(T1, T). - -same_db(DB, [db(DB,S1,_)|T0], T, S0, S) :- !, - S2 is S0+S1, - same_db(DB, T0, T, S2, S). -same_db(_, L, L, S, S). - - -%% load_source(+DB, +Silent, +Nth, +Total) is det. -% -% Load triples and reload journal from the indicated snapshot -% file. -% -% @param Silent One of =false=, =true= or =brief= - -load_source(DB, Silent, Nth, Total) :- - message_level(Silent, Level), - db_files(DB, SnapshotFile, JournalFile), - rdf_retractall(_,_,_,DB), - statistics(cputime, T0), - print_message(Level, rdf(restore(Silent, source(DB, Nth, Total)))), - db_file(SnapshotFile, AbsSnapShot), - ( exists_file(AbsSnapShot) - -> print_message(Level, rdf(restore(Silent, snapshot(SnapshotFile)))), - rdf_load_db(AbsSnapShot) - ; true - ), - ( exists_db(JournalFile) - -> print_message(Level, rdf(restore(Silent, journal(JournalFile)))), - load_journal(JournalFile, DB) - ; true - ), - statistics(cputime, T1), - T is T1 - T0, - ( rdf_statistics(triples_by_file(DB, Count)) - -> true - ; Count = 0 - ), - print_message(Level, rdf(restore(Silent, - done(DB, T, Count, Nth, Total)))). - -message_level(true, silent) :- !. -message_level(_, informational). - - - /******************************* - * LOAD JOURNAL * - *******************************/ - -%% load_journal(+File:atom, +DB:atom) is det. -% -% Process transactions from the RDF journal File, adding the given -% named graph. - -load_journal(File, DB) :- - open_db(File, read, In, []), - call_cleanup(( read(In, T0), - process_journal(T0, In, DB) - ), - close(In)). - -process_journal(end_of_file, _, _) :- !. -process_journal(Term, In, DB) :- - ( process_journal_term(Term, DB) - -> true - ; throw(error(type_error(journal_term, Term), _)) - ), - read(In, T2), - process_journal(T2, In, DB). - -process_journal_term(assert(S,P,O), DB) :- - rdf_assert(S,P,O,DB). -process_journal_term(assert(S,P,O,Line), DB) :- - rdf_assert(S,P,O,DB:Line). -process_journal_term(retract(S,P,O), DB) :- - rdf_retractall(S,P,O,DB). -process_journal_term(retract(S,P,O,Line), DB) :- - rdf_retractall(S,P,O,DB:Line). -process_journal_term(update(S,P,O,Action), DB) :- - ( rdf_update(S,P,O,DB, Action) - -> true - ; print_message(warning, rdf(update_failed(S,P,O,Action))) - ). -process_journal_term(start(_), _). % journal open/close -process_journal_term(end(_), _). -process_journal_term(begin(_), _). % logged transaction (compatibility) -process_journal_term(end, _). -process_journal_term(begin(_,_,_,_), _). % logged transaction (current) -process_journal_term(end(_,_,_), _). - - - /******************************* - * CREATE JOURNAL * - *******************************/ - -:- dynamic - blocked_db/2, % DB, Reason - transaction_message/3, % Nesting, Time, Message - transaction_db/3. % Nesting, DB, Id - -%% rdf_persistency(+DB, Bool) -% -% Specify whether a database is persistent. Switching to =false= -% kills the persistent state. Switching to =true= creates it. - -rdf_persistency(DB, Bool) :- - must_be(atom, DB), - must_be(boolean, Bool), - fail. -rdf_persistency(DB, false) :- !, - ( blocked_db(DB, persistency) - -> true - ; assert(blocked_db(DB, persistency)), - delete_db(DB) - ). -rdf_persistency(DB, true) :- - ( retract(blocked_db(DB, persistency)) - -> create_db(DB) - ; true - ). - - -%% start_monitor is det. -%% stop_monitor is det. -% -% Start/stop monitoring the RDF database for changes and update -% the journal. - -start_monitor :- - rdf_monitor(monitor, - [ -assert(load) - ]). -stop_monitor :- - rdf_monitor(monitor, - [ -all - ]). - -%% monitor(+Term) is semidet. -% -% Handle an rdf_monitor/2 callback to deal with persistency. Note -% that the monitor calls that come from rdf_db.pl that deal with -% database changes are serialized. They do come from different -% threads though. - -monitor(Msg) :- - debug(monitor, 'Monitor: ~p~n', [Msg]), - fail. -monitor(assert(S,P,O,DB:Line)) :- !, - \+ blocked_db(DB, _), - journal_fd(DB, Fd), - open_transaction(DB, Fd), - format(Fd, '~q.~n', [assert(S,P,O,Line)]), - sync_journal(DB, Fd). -monitor(assert(S,P,O,DB)) :- - \+ blocked_db(DB, _), - journal_fd(DB, Fd), - open_transaction(DB, Fd), - format(Fd, '~q.~n', [assert(S,P,O)]), - sync_journal(DB, Fd). -monitor(retract(S,P,O,DB:Line)) :- !, - \+ blocked_db(DB, _), - journal_fd(DB, Fd), - open_transaction(DB, Fd), - format(Fd, '~q.~n', [retract(S,P,O,Line)]), - sync_journal(DB, Fd). -monitor(retract(S,P,O,DB)) :- - \+ blocked_db(DB, _), - journal_fd(DB, Fd), - open_transaction(DB, Fd), - format(Fd, '~q.~n', [retract(S,P,O)]), - sync_journal(DB, Fd). -monitor(update(S,P,O,DB:Line,Action)) :- !, - \+ blocked_db(DB, _), - ( Action = source(NewDB) - -> monitor(assert(S,P,O,NewDB)), - monitor(retract(S,P,O,DB:Line)) - ; journal_fd(DB, Fd), - format(Fd, '~q.~n', [update(S,P,O,Action)]), - sync_journal(DB, Fd) - ). -monitor(update(S,P,O,DB,Action)) :- - \+ blocked_db(DB, _), - ( Action = source(NewDB) - -> monitor(assert(S,P,O,NewDB)), - monitor(retract(S,P,O,DB)) - ; journal_fd(DB, Fd), - open_transaction(DB, Fd), - format(Fd, '~q.~n', [update(S,P,O,Action)]), - sync_journal(DB, Fd) - ). -monitor(load(BE, Id)) :- - ( BE == begin - -> push_state(Id) - ; sync_state(Id) - ). -monitor(transaction(BE, Id)) :- - monitor_transaction(Id, BE). - -monitor_transaction(load_journal(DB), begin(_)) :- !, - assert(blocked_db(DB, journal)). -monitor_transaction(load_journal(DB), end(_)) :- !, - retractall(blocked_db(DB, journal)). - -monitor_transaction(parse(URI), begin(_)) :- !, - ( blocked_db(URI, persistency) - -> true - ; assert(blocked_db(URI, parse)) - ). -monitor_transaction(parse(URI), end(_)) :- !, - ( retract(blocked_db(URI, parse)) - -> create_db(URI) - ; true - ). -monitor_transaction(unload(DB), begin(_)) :- !, - ( blocked_db(DB, persistency) - -> true - ; assert(blocked_db(DB, unload)) - ). -monitor_transaction(unload(DB), end(_)) :- !, - ( retract(blocked_db(DB, unload)) - -> delete_db(DB) - ; true - ). -monitor_transaction(log(Msg), begin(N)) :- !, - check_nested(N), - get_time(Time), - asserta(transaction_message(N, Time, Msg)). -monitor_transaction(log(_), end(N)) :- - check_nested(N), - retract(transaction_message(N, _, _)), !, - findall(DB:Id, retract(transaction_db(N, DB, Id)), DBs), - end_transactions(DBs, N). -monitor_transaction(log(Msg, DB), begin(N)) :- !, - check_nested(N), - get_time(Time), - asserta(transaction_message(N, Time, Msg)), - journal_fd(DB, Fd), - open_transaction(DB, Fd). -monitor_transaction(log(Msg, _DB), end(N)) :- - monitor_transaction(log(Msg), end(N)). -monitor_transaction(reset, begin(L)) :- - forall(rdf_graph(DB), - monitor_transaction(unload(DB), begin(L))). -monitor_transaction(reset, end(L)) :- - forall(blocked_db(DB, unload), - monitor_transaction(unload(DB), end(L))), - retractall(current_transaction_id(_,_)). - - -%% check_nested(+Level) is semidet. -% -% True if we must log this transaction. This is always the case -% for toplevel transactions. Nested transactions are only logged -% if log_nested_transactions(true) is defined. - -check_nested(0) :- !. -check_nested(_) :- - rdf_option(log_nested_transactions(true)). - - -%% open_transaction(+DB, +Fd) is det. -% -% Add a begin(Id, Level, Time, Message) term if a transaction -% involves DB. Id is an incremental integer, where each database -% has its own counter. Level is the nesting level, Time a floating -% point timestamp and Message te message provided as argument to -% the log message. - -open_transaction(DB, Fd) :- - transaction_message(N, Time, Msg), !, - ( transaction_db(N, DB, _) - -> true - ; next_transaction_id(DB, Id), - assert(transaction_db(N, DB, Id)), - format(Fd, 'begin(~q, ~q, ~2f, ~q).~n', [Id, N, Time, Msg]) - ). -open_transaction(_,_). - - -%% next_transaction_id(+DB, -Id) is det. -% -% Id is the number to user for the next logged transaction on DB. -% Transactions in each named graph are numbered in sequence. -% Searching the Id of the last transaction is performed by the 2nd -% clause starting 1Kb from the end and doubling this offset each -% failure. - -:- dynamic - current_transaction_id/2. - -next_transaction_id(DB, Id) :- - retract(current_transaction_id(DB, Last)), !, - Id is Last + 1, - assert(current_transaction_id(DB, Id)). -next_transaction_id(DB, Id) :- - db_files(DB, _, Journal), - exists_file(Journal), !, - size_file(Journal, Size), - open_db(Journal, read, In, []), - call_cleanup(iterative_expand(In, Size, Last), close(In)), - Id is Last + 1, - assert(current_transaction_id(DB, Id)). -next_transaction_id(DB, 1) :- - assert(current_transaction_id(DB, 1)). - -iterative_expand(_, 0, 0) :- !. -iterative_expand(In, Size, Last) :- % Scan growing sections from the end - Max is floor(log(Size)/log(2)), - between(10, Max, Step), - Offset is -(1<<Step), - seek(In, Offset, eof, _), - skip(In, 10), % records are line-based - read(In, T0), - last_transaction_id(T0, In, 0, Last), - Last > 0, !. -iterative_expand(In, _, Last) :- % Scan the whole file - seek(In, 0, bof, _), - read(In, T0), - last_transaction_id(T0, In, 0, Last). - -last_transaction_id(end_of_file, _, Last, Last) :- !. -last_transaction_id(end(Id, _, _), In, _, Last) :- - read(In, T1), - last_transaction_id(T1, In, Id, Last). -last_transaction_id(_, In, Id, Last) :- - read(In, T1), - last_transaction_id(T1, In, Id, Last). - - -%% end_transactions(+DBs:list(atom:id)) is det. -% -% End a transaction that affected the given list of databases. We -% write the list of other affected databases as an argument to the -% end-term to facilitate fast finding of the related transactions. -% -% In each database, the transaction is ended with a term end(Id, -% Nesting, Others), where Id and Nesting are the transaction -% identifier and nesting (see open_transaction/2) and Others is a -% list of DB:Id, indicating other databases affected by the -% transaction. - -end_transactions(DBs, N) :- - end_transactions(DBs, DBs, N). - -end_transactions([], _, _). -end_transactions([DB:Id|T], DBs, N) :- - journal_fd(DB, Fd), - once(select(DB:Id, DBs, Others)), - format(Fd, 'end(~q, ~q, ~q).~n', [Id, N, Others]), - sync_journal(DB, Fd), - end_transactions(T, DBs, N). - - -% State handling. We use this for trapping changes by -% rdf_load_db/1. In theory, loading such files can add triples to -% multiple sources. In practice this rarely happens. We save the -% current state and sync all files that have changed. The only -% drawback of this approach is that loaded files spreading triples -% over multiple databases cause all these databases to be fully -% synchronised. This shouldn't happen very often. - -:- dynamic - pre_load_state/2. - -push_state(Id) :- - get_state(State), - asserta(pre_load_state(Id, State)). - -get_state(State) :- - findall(DB-MD5, (rdf_graph(DB), rdf_md5(DB, MD5)), State0), - keysort(State0, State). - -sync_state(Id) :- - retract(pre_load_state(Id, PreState)), - get_state(AfterState), - sync_state(AfterState, PreState). - -sync_state([], _). -sync_state([DB-MD5|TA], Pre) :- - ( memberchk(DB-MD5P, Pre), - MD5P == MD5 - -> true - ; create_db(DB) - ), - sync_state(TA, Pre). - - - /******************************* - * JOURNAL FILES * - *******************************/ - -%% journal_fd(+DB, -Stream) is det. -% -% Get an open stream to a journal. If the journal is not open, old -% journals are closed to satisfy the =max_open_journals= option. -% Then the journal is opened in =append= mode. Journal files are -% always encoded as UTF-8 for portability as well as to ensure -% full coverage of Unicode. - -journal_fd(DB, Fd) :- - source_journal_fd(DB, Fd), !. -journal_fd(DB, Fd) :- - with_mutex(rdf_journal_file, - journal_fd_(DB, Out)), - Fd = Out. - -journal_fd_(DB, Fd) :- - source_journal_fd(DB, Fd), !. -journal_fd_(DB, Fd) :- - limit_fd_pool, - db_files(DB, _Snapshot, Journal), - open_db(Journal, append, Fd, - [ close_on_abort(false) - ]), - time_stamp(Now), - format(Fd, '~q.~n', [start([time(Now)])]), - assert(source_journal_fd(DB, Fd)). % new one at the end - -%% limit_fd_pool is det. -% -% Limit the number of open journals to max_open_journals (10). -% Note that calls from rdf_monitor/2 are issued in different -% threads, but as they are part of write operations they are fully -% synchronised. - -limit_fd_pool :- - predicate_property(source_journal_fd(_, _), number_of_clauses(N)), !, - ( rdf_option(max_open_journals(Max)) - -> true - ; Max = 10 - ), - Close is N - Max, - forall(between(1, Close, _), - close_oldest_journal). -limit_fd_pool. - -close_oldest_journal :- - source_journal_fd(DB, _Fd), !, - debug(rdf_persistency, 'Closing old journal for ~q', [DB]), - close_journal(DB). -close_oldest_journal. - - -%% sync_journal(+DB, +Fd) -% -% Sync journal represented by database and stream. If the DB is -% involved in a transaction there is no point flushing until the -% end of the transaction. - -sync_journal(DB, _) :- - transaction_db(_, DB, _), !. -sync_journal(_, Fd) :- - flush_output(Fd). - -%% close_journal(+DB) is det. -% -% Close the journal associated with DB if it is open. - -close_journal(DB) :- - with_mutex(rdf_journal_file, - close_journal_(DB)). - -close_journal_(DB) :- - ( retract(source_journal_fd(DB, Fd)) - -> time_stamp(Now), - format(Fd, '~q.~n', [end([time(Now)])]), - close(Fd, [force(true)]) - ; true - ). - -% close_journals -% -% Close all open journals. - -close_journals :- - forall(source_journal_fd(DB, _), - catch(close_journal(DB), E, - print_message(error, E))). - -%% create_db(+DB) -% -% Create a saved version of DB in corresponding file, close and -% delete journals. - -create_db(DB) :- - debug(rdf_persistency, 'Saving DB ~w', [DB]), - db_abs_files(DB, Snapshot, Journal), - atom_concat(Snapshot, '.new', NewSnapshot), - ( catch(rdf_save_db(NewSnapshot, DB), _, fail) - -> ( exists_file(Journal) - -> delete_file(Journal) - ; true - ), - rename_file(NewSnapshot, Snapshot), - debug(rdf_persistency, 'Saved DB ~w', [DB]) - ; catch(delete_file(NewSnapshot), _, true) - ). - - -%% delete_db(+DB) -% -% Remove snapshot and journal file for DB. - -delete_db(DB) :- - db_abs_files(DB, Snapshot, Journal), - ( exists_file(Journal) - -> delete_file(Journal) - ; true - ), - ( exists_file(Snapshot) - -> delete_file(Snapshot) - ; true - ). - - - /******************************* - * LOCKING * - *******************************/ - -%% lock_db(+Dir) -% -% Lock the database directory. This isn't safe as the file -% operations are not atomic. Needs re-thinking, but with the -% normal server setting it should be ok. - -lock_db(Dir) :- - lockfile(Dir, File), - exists_file(File), !, - ( catch(read_file_to_terms(File, Terms, []), _, fail), - Terms = [locked(Args)] - -> Context = rdf_locked(Args) - ; Context = context(_, 'Database is in use') - ), - throw(error(permission_error(lock, rdf_db, Dir), Context)). -lock_db(Dir) :- - lockfile(Dir, File), - open(File, write, Out), - ( current_prolog_flag(pid, PID) - -> true - ; PID = 0 % TBD: Fix in Prolog - ), - time_stamp(Now), - format(Out, '/* RDF Database is in use */~n~n', []), - format(Out, '~q.~n', [ locked([ time(Now), - pid(PID) - ]) - ]), - close(Out), - at_halt(unlock_db(Dir)). - -unlock_db(Dir) :- - lockfile(Dir, File), - ( exists_file(File) - -> delete_file(File) - ; true - ). - - /******************************* - * FILENAMES * - *******************************/ - -lockfile(Dir, LockFile) :- - atomic_list_concat([Dir, /, lock], LockFile). - -db_file(Base, File) :- - rdf_directory(Dir), - atomic_list_concat([Dir, /, Base], File). - -open_db(Base, Mode, Stream, Options) :- - db_file(Base, File), - open(File, Mode, Stream, [encoding(utf8)|Options]). - -exists_db(Base) :- - db_file(Base, File), - exists_file(File). - -%% db_files(+DB, -Snapshot, -Journal). -%% db_files(-DB, +Snapshot, -Journal). -%% db_files(-DB, -Snapshot, +Journal). -% -% True if named graph DB is represented by the files Snapshot and -% Journal. The filenames are local to the directory representing -% the store. - -db_files(DB, Snapshot, Journal) :- - nonvar(DB), !, - rdf_db_to_file(DB, Base), - atom_concat(Base, '.trp', Snapshot), - atom_concat(Base, '.jrn', Journal). -db_files(DB, Snapshot, Journal) :- - nonvar(Snapshot), !, - atom_concat(Base, '.trp', Snapshot), - atom_concat(Base, '.jrn', Journal), - rdf_db_to_file(DB, Base). -db_files(DB, Snapshot, Journal) :- - nonvar(Journal), !, - atom_concat(Base, '.jrn', Journal), - atom_concat(Base, '.trp', Snapshot), - rdf_db_to_file(DB, Base). - -db_abs_files(DB, Snapshot, Journal) :- - db_files(DB, Snapshot0, Journal0), - db_file(Snapshot0, Snapshot), - db_file(Journal0, Journal). - - -%% rdf_journal_file(+DB, -File) is semidet. -%% rdf_journal_file(-DB, -File) is nondet. -% -% True if File is the absolute file name of an existing named -% graph DB. -% -% @tbd Avoid using private rdf_db:rdf_graphs_/1. - -rdf_journal_file(DB, Journal) :- - ( var(DB) - -> rdf_db:rdf_graphs_(All), % also pick the empty graphs - member(DB, All) - ; true - ), - db_abs_files(DB, _Snapshot, Journal), - exists_file(Journal). - - -%% rdf_db_to_file(+DB, -File) is det. -%% rdf_db_to_file(-DB, +File) is det. -% -% Translate between database encoding (often an file or URL) and -% the name we store in the directory. We keep a cache for two -% reasons. Speed, but much more important is that the mapping of -% raw --> encoded provided by www_form_encode/2 is not guaranteed -% to be unique by the W3C standards. -% -% @tbd We keep two predicates for exploiting Prolog indexing. -% Once multi-argument indexed is hashed we should clean -% this up. - -rdf_db_to_file(DB, File) :- - nonvar(File), - file_base_db(File, DB), !. -rdf_db_to_file(DB, File) :- - nonvar(DB), - db_file_base(DB, File), !. -rdf_db_to_file(DB, File) :- - url_to_filename(DB, File), - assert(db_file_base(DB, File)), - assert(file_base_db(File, DB)). - -%% url_to_filename(+URL, -FileName) is det. -%% url_to_filename(-URL, +FileName) is det. -% -% Turn a valid URL into a filename. Earlier versions used -% www_form_encode/2, but this can produce characters that are not -% valid in filenames. We will use the same encoding as -% www_form_encode/2, but using our own rules for allowed -% characters. The only requirement is that we avoid any filename -% special character in use. The current encoding use US-ASCII -% alnum characters, _ and % - -url_to_filename(URL, FileName) :- - atomic(URL), !, - atom_codes(URL, Codes), - phrase(url_encode(EncCodes), Codes), - atom_codes(FileName, EncCodes). -url_to_filename(URL, FileName) :- - www_form_encode(URL, FileName). - -url_encode([0'+|T]) --> - " ", !, - url_encode(T). -url_encode([C|T]) --> - alphanum(C), !, - url_encode(T). -url_encode([C|T]) --> - no_enc_extra(C), !, - url_encode(T). -url_encode(Enc) --> - ( "\r\n" - ; "\n" - ), !, - { append("%0D%0A", T, Enc) - }, - url_encode(T). -url_encode([]) --> - eos, !. -url_encode([0'%,D1,D2|T]) --> - [C], - { Dv1 is (C>>4 /\ 0xf), - Dv2 is (C /\ 0xf), - code_type(D1, xdigit(Dv1)), - code_type(D2, xdigit(Dv2)) - }, - url_encode(T). - -eos([], []). - -alphanum(C) --> - [C], - { C < 128, % US-ASCII - code_type(C, alnum) - }. - -no_enc_extra(0'_) --> "_". %' - - - /******************************* - * UTIL * - *******************************/ - -%% mkdir(+Directory) -% -% Create a directory if it does not already exist. - -mkdir(Directory) :- - exists_directory(Directory), !. -mkdir(Directory) :- - make_directory(Directory). - -%% time_stamp(-Integer) -% -% Return time-stamp rounded to integer. - -time_stamp(Int) :- - get_time(Now), - Int is round(Now). - - - /******************************* - * MESSAGES * - *******************************/ - -:- multifile - prolog:message/3, - prolog:message_context/3. - -prolog:message(rdf(Term)) --> - message(Term). - -message(restore(attached(Graphs, Time/Wall))) --> - { catch(Percent is round(100*Time/Wall), _, Percent = 0) }, - [ 'Attached ~D graphs in ~2f seconds (~d% CPU = ~2f sec.)'- - [Graphs, Wall, Percent, Time] ]. -message(restore(true, Action)) --> !, - silent_message(Action). -message(restore(brief, Action)) --> !, - brief_message(Action). -message(restore(_, source(DB, Nth, Total))) --> - { file_base_name(DB, Base) }, - [ 'Restoring ~w ... (~D of ~D graphs) '-[Base, Nth, Total], flush ]. -message(restore(_, snapshot(_))) --> - [ at_same_line, '(snapshot) '-[], flush ]. -message(restore(_, journal(_))) --> - [ at_same_line, '(journal) '-[], flush ]. -message(restore(_, done(_, Time, Count, _Nth, _Total))) --> - [ at_same_line, '~D triples in ~2f sec.'-[Count, Time] ]. -message(update_failed(S,P,O,Action)) --> - [ 'Failed to update <~p ~p ~p> with ~p'-[S,P,O,Action] ]. - -silent_message(_Action) --> []. - -brief_message(source(DB, Nth, Total)) --> - { file_base_name(DB, Base) }, - [ at_same_line, - '\r~w~`.t ~D of ~D graphs~72|'-[Base, Nth, Total], - flush - ]. -brief_message(snapshot(_File)) --> []. -brief_message(journal(_File)) --> []. -brief_message(done(_DB, _Time, _Count, _Nth, _Total)) --> []. - -prolog:message_context(rdf_locked(Args)) --> - { memberchk(time(Time), Args), - memberchk(pid(Pid), Args), - format_time(string(S), '%+', Time) - }, - [ nl, - 'locked at ~s by process id ~w'-[S,Pid] - ]. diff --git a/packages/semweb/rdf_portray.pl b/packages/semweb/rdf_portray.pl deleted file mode 100644 index 8d8c8f255..000000000 --- a/packages/semweb/rdf_portray.pl +++ /dev/null @@ -1,172 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog - - Author: Jan Wielemaker - E-mail: J.Wielemaker@cs.vu.nl - WWW: http://www.swi-prolog.org - Copyright (C): 2007-2009, University of Amsterdam - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - As a special exception, if you link this library with other files, - compiled with a Free Software compiler, to produce an executable, this - library does not by itself cause the resulting executable to be covered - by the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - - -:- module(rdf_portray, - [ rdf_portray_as/1, % +Style - rdf_portray_lang/1 % +Lang - ]). -:- use_module(library(semweb/rdf_db)). -:- use_module(library(semweb/rdfs)). -:- use_module(library(error)). - -/** <module> Portray RDF resources - -This module defines rules for user:portray/1 to help tracing and -debugging RDF resources by printing them in a more concise -representation and optionally adding comment from the label field to -help the user interpreting the URL. The main predicates are: - - * rdf_portray_as/1 defines the overall style - * rdf_portray_lang/1 selects languages for extracting label comments - -@tbd Define alternate predicate to use for providing a comment -@tbd Use rdf:type if there is no meaningful label? -@tbd Smarter guess whether or not the local identifier might be - meaningful to the user without a comment. I.e. does it look - `word-like'? -*/ - -:- dynamic - style/1, - lang/1. - -%% rdf_portray_as(+Style) is det. -% -% Set the style used to portray resources. Style is one of: -% -% * ns:id -% Write as NS:ID, compatible with what can be handed to -% the rdf predicates. This is the default. -% -% * writeq -% Use quoted write of the full resource. -% -% * ns:label -% Write namespace followed by the label. This format -% cannot be handed to rdf/3 and friends, but can be -% useful if resource-names are meaningless identifiers. -% -% * ns:id=label -% This combines ns:id with ns:label, providing both human -% readable output and output that can be pasted into the -% commandline. - -rdf_portray_as(Style) :- - must_be(oneof([writeq, ns:id, ns:label, ns:id=label]), Style), - retractall(style(_)), - assert(style(Style)). - -%% rdf_portray_lang(+Lang) is det. -% -% If Lang is a list, set the list or preferred languages. If it is -% a single atom, push this language as the most preferred -% language. - -rdf_portray_lang(Lang) :- - ( is_list(Lang) - -> must_be(list(atom), Lang), - retractall(lang(_)), - forall(member(L,Lang), assert(lang(L))) - ; must_be(atom, Lang), - asserta(lang(Lang)) - ). - -try_lang(L) :- lang(L). -try_lang(_). - - -:- multifile - user:portray/1. - -user:portray(URL) :- - atom(URL), - sub_atom(URL, 0, _, _, 'http://'), !, - ( style(Style) - -> true - ; Style = ns:id - ), - portray_url(Style, URL). -user:portray(URL) :- - atom(URL), - atom_concat('__file://', URL2, URL), - sub_atom(URL2, S, _, A, #), - sub_atom(URL2, _, A, 0, Local), - sub_atom(URL2, 0, S, _, Path), - file_base_name(Path, Base), - format('__~w#~w', [Base, Local]). - -portray_url(writeq, URL) :- - writeq(URL). -portray_url(ns:id, URL) :- - ( rdf_global_id(NS:Id, URL) - -> writeq(NS:Id) - ; writeq(URL) - ). -portray_url(ns:id=label, URL) :- - ( rdf_global_id(NS:Id, URL) - -> Value = NS:Id - ; Value = URL - ), - ( Id \== '', - ( ( try_lang(Lang), - rdf_has(URL, rdfs:label, literal(lang(Lang, Label))) - -> nonvar(Lang), - \+ label_is_id(Label, Id) - ) - -> format('~q/*"~w"@~w*/', [Value, Label, Lang]) - ; rdf_has(URL, rdfs:label, literal(type(Type, Label))), - nonvar(Type), - \+ label_is_id(Label, Id) - -> ( rdf_global_id(TNS:TId, Type) - -> TVal = TNS:TId - ; TVal = Type - ), - format('~q/*"~w"^^~w*/', [Value, Label, TVal]) - ; rdf_has(URL, rdfs:label, literal(Label)), - atom(Label), - Label \== Id - -> format('~q/*"~w"*/', [Value, Label]) - ) - -> true - ; writeq(Value) - ). -portray_url(ns:label, URL) :- - rdfs_ns_label(URL, Label), - write(Label). - -label_is_id(_, Var) :- - var(Var), !, fail. -label_is_id(Label, Label) :- !. -label_is_id(L0, L1) :- - downcase_atom(L0, Lwr), - downcase_atom(L1, Lwr). - diff --git a/packages/semweb/rdf_turtle.pl b/packages/semweb/rdf_turtle.pl deleted file mode 100644 index ba52ba071..000000000 --- a/packages/semweb/rdf_turtle.pl +++ /dev/null @@ -1,910 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog - - Author: Jan Wielemaker - E-mail: J.Wielemaker@cs.vu.nl - WWW: http://www.swi-prolog.org - Copyright (C): 2004-2009, University of Amsterdam - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - As a special exception, if you link this library with other files, - compiled with a Free Software compiler, to produce an executable, this - library does not by itself cause the resulting executable to be covered - by the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -:- module(rdf_turtle, - [ rdf_load_turtle/3, % +Input, -Triples, +Options - rdf_read_turtle/3, % +Input, -Triples, +Options - rdf_process_turtle/3 % +Input, :OnObject, +Options - ]). -:- use_module(library(assoc)). -:- use_module(library(option)). -:- use_module(library('semweb/rdf_db')). -:- use_module(library(debug)). -:- use_module(library(uri)). -:- use_module(library(record)). -:- use_module(library(http/http_open)). -:- use_module(turtle_base). - -:- meta_predicate - rdf_process_turtle(+,2,+). - -/** <module> Turtle: Terse RDF Triple Language - -This module implements the Turtle language for representing the RDF -triple model as defined by Dave Beckett from the Institute for Learning -and Research Technology University of Bristol in the document: - - * http://www.w3.org/TeamSubmission/turtle/ - * http://www.w3.org/TeamSubmission/2008/SUBM-turtle-20080114/#sec-conformance - -This parser passes all tests, except for test-28.ttl (decial number -serialization) and test-29.ttl (uri containing ...%&...). It is unclear -to me whether these tests are correct. Notably, it is unclear whether we -must do %-decoding. Certainly, this is expected by various real-life -datasets that we came accross with. - -This module acts as a plugin to rdf_load/2, for processing files with -one of the extensions =|.ttl|=, =|.n3|= or =|.nt|=. - -@tbd Better error handling -*/ - -:- record ttl_state(base_uri, - resources:oneof([uri,iri])=uri, - prefix_map, - nodeid_map, - anon_prefix, - anon_count=0, - graph, - input, - line_no=0, - on_error:oneof([warning,error])=warning, - error_count=0). - -%% rdf_read_turtle(+Input, -Triples, +Options) -% -% Read a stream or file into a set of triples of the format -% -% rdf(Subject, Predicate, Object) -% -% The representation is consistent with the SWI-Prolog RDF/XML -% and ntriples parsers. Provided options are: -% -% * base_uri(+BaseURI) -% Initial base URI. Defaults to file://<file> for loading -% files. -% -% * anon_prefix(+Prefix) -% Blank nodes are generated as <Prefix>1, <Prefix>2, etc. -% If Prefix is not an atom blank nodes are generated as -% node(1), node(2), ... -% -% * resources(URIorIRI) -% Officially, Turtle resources are IRIs. Quite a -% few applications however send URIs. By default we -% do URI->IRI mapping because this rarely causes errors. -% To force strictly conforming mode, pass =iri=. -% -% * prefixes(-Pairs) -% Return encountered prefix declarations as a -% list of Alias-URI -% -% * namespaces(-Pairs) -% Same as prefixes(Pairs). Compatibility to rdf_load/2. -% -% * base_used(-Base) -% Base URI used for processing the data. Unified to -% [] if there is no base-uri. -% -% * on_error(+ErrorMode) -% In =warning= (default), print the error and continue -% parsing the remainder of the file. If =error=, abort -% with an exception on the first error encountered. -% -% * error_count(-Count) -% If on_error(warning) is active, this option cane be -% used to retrieve the number of generated errors. - -rdf_read_turtle(In, Triples, Options) :- - open_input(In, Stream, Close), - init_state(In, Stream, Options, State), - call_cleanup(phrase(turtle_file(State, Stream), Triples), - Close), - post_options(State, Options). - - -%% rdf_load_turtle(+Input, -Triples, +Options) -% -% @deprecated Use rdf_read_turtle/3 - -rdf_load_turtle(Input, Triples, Options) :- - rdf_read_turtle(Input, Triples, Options). - - -%% rdf_process_turtle(+Input, :OnObject, +Options) is det. -% -% Process Turtle input from Input, calling OnObject with a list of -% triples. Options is the same as for rdf_load_turtle/3. -% -% Errors encountered are sent to print_message/2, after which the -% parser tries to recover and parse the remainder of the data. - -rdf_process_turtle(In, OnObject, Options) :- - open_input(In, Stream, Close), - init_state(In, Stream, Options, State), - call_cleanup(process_stream(State, Stream, OnObject), - Close), - post_options(State, Options). - -post_options(State, Options) :- - prefix_option(State, Options), - namespace_option(State, Options), - base_option(State, Options), - error_option(State, Options). - -prefix_option(State, Options) :- - ( option(prefixes(Pairs), Options) - -> ttl_state_prefix_map(State, Map), - assoc_to_list(Map, Pairs) - ; true - ). -namespace_option(State, Options) :- - ( option(namespaces(Pairs), Options) - -> ttl_state_prefix_map(State, Map), - assoc_to_list(Map, Pairs) - ; true - ). -base_option(State, Options) :- - ( option(base_used(Base), Options) - -> ttl_state_base_uri(State, Base) - ; true - ). -error_option(State, Options) :- - ( option(error_count(Count), Options) - -> ttl_state_error_count(State, Count) - ; true - ). - - -process_stream(State, In, OnObject) :- - read_turtle_tokens(In, Tokens, State), - debug(turtle, 'Tokens: ~w~n', [Tokens]), - ttl_state_line_no(State, LineNo), - ( Tokens == end_of_file - -> true - ; catch(phrase(triples(State, Triples), Tokens), E, true) - -> ( var(E) - -> ( Triples == [] - -> true - ; ttl_state_graph(State, DB), - call(OnObject, Triples, DB:LineNo) - ) - ; print_message(error, E) - ), - process_stream(State, In, OnObject) - ; syntax_error_term(In, LineNo, cannot_parse, Error), - step_error(State, Error), - process_stream(State, In, OnObject) - ). - - -%% step_error(+State, +Error) is det. -% -% Throw Error of =on_error= is =error=. Otherwise print the error -% and increment =error_count=. -% -% @error syntax_error(Culprit). - -step_error(State, Error) :- - ttl_state_on_error(State, error), !, - throw(Error). -step_error(State, Error) :- - ttl_state_error_count(State, E0), - succ(E0, E), - nb_set_error_count_of_ttl_state(E, State), - print_message(error, Error). - - -%% open_input(+Input, -Stream, -Close) is det. -% -% Open given input. -% -% @param Close goal to undo the open action -% @tbd Synchronize with input handling of rdf_db.pl. -% @error existence_error, permission_error - -open_input(stream(Stream), Stream, true) :- !, - stream_property(Stream, encoding(Old)), - ( Old == utf8 - -> Close = true - ; set_stream(Stream, encoding(utf8)), - Close = set_stream(Stream, encoding(Old)) - ). -open_input(Stream, Stream, Close) :- - is_stream(Stream), !, - open_input(stream(Stream), Stream, Close). -open_input(URL, Stream, close(Stream)) :- - sub_atom(URL, 0, _, _, 'http://'), !, - http_open(URL, Stream, []), - set_stream(Stream, encoding(utf8)). -open_input(File, Stream, close(Stream)) :- - absolute_file_name(File, Path, - [ access(read), - extensions([ttl, '']) - ]), - open(Path, read, Stream, [encoding(utf8)]). - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -The parser is a two-stage processor. The first reads the raw file input -and generates a list of tokens, stripping comments and white space. It -is defined to read a single statement upto its terminating '.'. The -second stage is a traditional DCG parser generating the triples for the -statement. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -init_state(In, Stream, Options, State) :- - ( option(base_uri(BaseURI), Options) - -> true - ; In = stream(_) - -> BaseURI = [] - ; uri_is_global(In), - \+ is_absolute_file_name(In) % Avoid C:Path in Windows - -> uri_normalized(In, BaseURI) - ; uri_file_name(BaseURI, In) - ), - ( option(anon_prefix(Prefix), Options) - -> true - ; BaseURI == [] - -> Prefix = '__bnode' - ; atom_concat('__', BaseURI, Prefix) - ), - option(db(DB), Options, BaseURI), - option(on_error(OnError), Options, warning), - option(resources(URIIRI), Options, uri), - empty_assoc(Map), - empty_assoc(NodeMap), - make_ttl_state([ base_uri(BaseURI), - resources(URIIRI), - prefix_map(Map), - nodeid_map(NodeMap), - anon_prefix(Prefix), - graph(DB), - input(Stream), - on_error(OnError) - ], State). - - -turtle_file(State, In) --> - { read_turtle_tokens(In, Tokens, State), - debug(turtle, 'Tokens: ~w~n', [Tokens]) - }, - ( { Tokens == end_of_file } - -> [] - ; { catch(phrase(triples(State, Triples), Tokens), E, true) } - -> ( { var(E) } - -> list(Triples), - turtle_file(State, In) - ; { step_error(State, E) }, - turtle_file(State, In) - ) - ; { ttl_state_line_no(State, LineNo), - syntax_error_term(In, LineNo, cannot_parse, Error), - step_error(State, Error) - }, - turtle_file(State, In) - ). - -list([]) --> []. -list([H|T]) --> [H], list(T). - -triples(State, []) --> - [ '@', name(prefix), name(Prefix), : ], !, - iri(State, URI), - { ttl_state_prefix_map(State, Map0), - put_assoc(Prefix, Map0, URI, Map), - set_prefix_map_of_ttl_state(Map, State) - }. -triples(State, []) --> - [ '@', name(prefix), ':' ], !, - iri(State, URI), - { set_base_uri_of_ttl_state(URI, State) - }. -triples(State, []) --> - [ '@', name(base) ], !, - iri(State,URI), - { set_base_uri_of_ttl_state(URI, State) - }. -triples(State, Triples) --> - subject(State, Subject, Triples, T), - ( predicate_object_list(State, Subject, T, []) - -> ( eos - -> [] - ; syntax_rule(State, expected(predicate_object_list)) - ) - ; { Triples \== T } % [ p o ; ... ] . - -> { T = [] } - ). - -eos([], []). - -subject(State, Subject, T, T) --> - resource(State, Subject), !. -subject(State, Subject, T0, T) --> - blank(State, Subject, T0, T), !. -subject(State, _, _, _) --> - syntax_rule(State, subject_expected). - -predicate_object_list(State, Subject, Triples, Tail) --> - verb(State, Predicate), - object_list(State, Subject, Predicate, Triples, Tail0), - ( [';'] - -> opt_predicate_object_list(State, Subject, Tail0, Tail) - ; {Tail0 = Tail} - ). - -opt_predicate_object_list(State, Subject, Triples, Tail) --> - predicate_object_list(State, Subject, Triples, Tail), !. -opt_predicate_object_list(_, _, Tail, Tail) --> - []. - -object_list(State, Subject, Predicate, - [rdf(Subject, Predicate, Object)|T0], T) --> - object(State, Object, T0, T1), - ( [','] - -> object_list(State, Subject, Predicate, T1, T) - ; {T1 = T} - ). - -verb(_, P) --> - [name(a)], !, - { rdf_equal(rdf:type, P) - }. -verb(State, P) --> - resource(State, P). - -object(State, Object, T, T) --> - [ literal(Value) ], !, - { mk_object(Value, State, Object) - }. -object(_, literal(type(Type, N)), T, T) --> - [ numeric(Tp, Codes) ], !, - { numeric_url(Tp, Type), - normalise_number(Tp, Codes, N) - }. -object(State, Object, T, T) --> - resource(State, Object), !. -object(State, Object, T0, T) --> - blank(State, Object, T0, T), !. -object(_, Object, T, T) --> - [ name(Bool) ], - { boolean(Bool), - Object = literal(type(BoolType, Bool)), - rdf_equal(BoolType, xsd:boolean) - }. -object(State, _, _, _) --> - syntax_rule(State, expected_object). - -%% normalise_number(+Type, +Codes:list, -Literal:atom) is det. -% -% Turtle normalisation of numbers. Currently only implemented for -% integers. This ensures that 0001 is parsed as "1"^^xsd:integer. -% -% Hmmm. Acording to test-10.ttl, this must *not* be done, so for -% now we disable all normalization. - -%normalise_number(integer, Codes, N) :- -% number_codes(I, Codes), -% atom_number(N, I). -normalise_number(_, Codes, N) :- - atom_codes(N, Codes). - -term_expansion(numeric_url(I, Local), - numeric_url(I, URI)) :- - rdf_global_id(Local, URI). - -numeric_url(integer, xsd:integer). -numeric_url(decimal, xsd:decimal). -numeric_url(double, xsd:double). - -boolean(true). -boolean(false). - -resource(State, IRI) --> - iri(State, IRI), !. -resource(State, IRI) --> - [ :(Name) ], !, - { ttl_state_base_uri(State, Base), - atom_concat(Base, Name, URI), - uri_iri(State, URI, IRI) - }. -resource(State, IRI) --> - [ name(Prefix), : ], !, - { ttl_state_prefix_map(State, Map), - get_assoc(Prefix, Map, IRI) - }. -resource(State, IRI) --> - [ Prefix:Name ], !, - { ttl_state_prefix_map(State, Map), - ( get_assoc(Prefix, Map, Base) - -> atom_concat(Base, Name, URI), - uri_iri(State, URI, IRI) - ; throw(error(existence_error(prefix, Prefix), _)) - ) - }. -resource(State, BaseIRI) --> - [ : ], !, - { ttl_state_base_uri(State, BaseIRI) - }. - -uri_iri(State, URI, IRI) :- - ( ttl_state_resources(State, uri) - -> uri_iri(URI, IRI) - ; IRI = URI - ). - -iri(State, IRI) --> - [ relative_uri(Rel) - ], - { ttl_state_base_uri(State, Base), - ( Rel == '' % must be in global_url? - -> IRI = Base - ; uri_normalized_iri(Rel, Base, IRI) - ) - }. - -blank(State, Resource, T, T) --> - [ nodeId(NodeId) ], !, - { ttl_state_nodeid_map(State, IdMap), - ( get_assoc(NodeId, IdMap, Resource) - -> true - ; anonid(State, NodeId, Resource), - put_assoc(NodeId, IdMap, Resource, NewIdMap), - set_nodeid_map_of_ttl_state(NewIdMap, State) - ) - }. -blank(State, Resource, T, T) --> - [ '[', ']' ], !, - { anonid(State, Resource) - }. -blank(State, Resource, T0, T) --> - [ '[' ], !, - { anonid(State, Resource) - }, - predicate_object_list(State, Resource, T0, T), - [ ']' ]. -blank(State, Resource, T0, T) --> - [ '(' ], - item_list(State, Resource, T0, T). - -item_list(_State, Resource, T, T) --> - [ ')' ], !, - { rdf_equal(rdf:nil, Resource) - }. -item_list(State, Resource, T0, T) --> - { anonid(State, Resource) }, - object(State, Object, T0, T1), - { rdf_equal(rdf:first, First), - rdf_equal(rdf:rest, Rest), - T1 = [ rdf(Resource, First, Object), - rdf(Resource, Rest, Tail) - | T2 - ] - }, - item_list(State, Tail, T2, T). - - -anonid(State, Node) :- - ttl_state_anon_prefix(State, AnonPrefix), - ttl_state_anon_count(State, C0), - Count is C0 + 1, - set_anon_count_of_ttl_state(Count, State), - ( atom(AnonPrefix) - -> atom_concat(AnonPrefix, Count, Node) - ; Node = node(Count) - ). - -anonid(State, _NodeId, Node) :- - ttl_state_anon_prefix(State, AnonPrefix), - atom(AnonPrefix), !, - anonid(State, Node). -anonid(_State, NodeId, node(NodeId)). - -mk_object(type(Prefix:Name, Value), State, literal(type(Type, Value))) :- !, - ttl_state_prefix_map(State, Map), - get_assoc(Prefix, Map, Base), - atom_concat(Base, Name, Type). -mk_object(type(relative_uri(Rel), Value), State, literal(type(Type, Value))) :- !, - ttl_state_base_uri(State, Base), - ( Rel == '' % must be in global_url? - -> Type = Base - ; uri_normalized_iri(Rel, Base, Type) - ). -mk_object(type(:(Name), Value), State, literal(type(Type, Value))) :- !, - ttl_state_base_uri(State, Base), - atom_concat(Base, Name, Type). -mk_object(Value, _State, literal(Value)). - -syntax_rule(State, Error) --> - error_tokens(7, Tokens), - { ttl_state_input(State, Stream), - stream_property(Stream, file_name(File)), - ttl_state_line_no(State, LineNo), - atomic_list_concat(Tokens, ' ', Before), - format(string(Msg), '~w:~d (before "~w ...")', - [File, LineNo, Before]), - throw(error(syntax_error(Error), - context(_, Msg))) - }. - -%% error_tokens(+Count, -Tokens) is det. -% -% Return maximum Count tokens, converted back to turtle input -% syntax. - -error_tokens(N, [H|T]) --> - { succ(N2, N) }, - error_token(H), !, - error_tokens(N2, T). -error_tokens(_, []) --> []. - -error_token(Name) --> - [ name(Name) ], !. -error_token(Text) --> - [ numeric(_, Codes) ], !, - { atom_codes(Text, Codes) }. -error_token(Text) --> - [ literal(Literal) ], !, - { literal_text(Literal, Text) }. -error_token(Text) --> - [ URIToken ], - { uri_text(URIToken, Text) }, !. -error_token(Punct) --> - [ Punct ], - { atom(Punct) }, !. -error_token(Rest) --> - [ H ], - { term_to_atom(H, Rest) }. - -literal_text(type(Type, Value), Text) :- !, - uri_text(Type, TypeText), - format(atom(Text), '"~w"^^~w', [Value, TypeText]). - -uri_text(relative_uri(URI), Text) :- - format(atom(Text), '<~w>', [URI]). -uri_text(:(Name), Text) :- - format(atom(Text), ':~w', [Name]). - - - /******************************* - * TOKENISER * - *******************************/ - -%% read_turtle_tokens(+In, -List, +State) is det. -% -% Read the next Turtle statement as a list of tokens. If -% on_error(warning) is active, failure prints a message and -% continues reading the next statements. -% -% The line_no property of the state is set to the start-line -% -% @error syntax_error(Culprit) - -read_turtle_tokens(In, List, State) :- - ttl_state_on_error(State, error), !, - line_count(In, LineNo), - nb_set_line_no_of_ttl_state(LineNo, State), - ( turtle_tokens(In, List) - -> true - ; syntax_error_term(In, LineNo, illegal_token, Error), - throw(Error) - ). -read_turtle_tokens(In, List, State) :- - line_count(In, LineNo), - nb_set_line_no_of_ttl_state(LineNo, State), - ( catch(turtle_tokens(In, List), Error, true) - -> ( var(Error) - -> true - ; print_message(error, Error), - skip_statement(In), - read_turtle_tokens(In, List, State) - ) - ; syntax_error_term(In, LineNo, illegal_token, Error), - print_message(error, Error), - skip_statement(In), - read_turtle_tokens(In, List, State) - ). - -%% skip_statement(+In) -% -% Skip to the end of the statement - -skip_statement(In) :- - get_code(In, C0), - skip_statement(C0, In). - -skip_statement(-1, _) :- !. -skip_statement(0'., In) :- - get_code(In, C), - ( turtle_ws(C) - -> ! - ; skip_statement(C, In) - ). -skip_statement(_, In) :- - get_code(In, C), - skip_statement(C, In). - -%% turtle_tokens(+In, -List) -% -% Read a statement from a turtle file, returning the contents as a -% list of tokens. - -turtle_tokens(In, List) :- - get_code(In, C0), - turtle_token(C0, In, C1, Tok1), - ( Tok1 == end_of_file - -> List = end_of_file - ; List = [Tok1|Tokens], - turtle_tokens(C1, In, Tokens) - ). - -turtle_tokens(C0, In, List) :- - ( turtle_token(C0, In, C1, H) - -> debug(turtle(token), 'Token: ~q', [H]) - ; syntax_error(In, -1, illegal_token) - ), - ( H == '.' - -> List = [] - ; H == end_of_file - -> syntax_error(In, -1, unexpected_end_of_input) - ; List = [H|T], - turtle_tokens(C1, In, T) - ). - -turtle_token(-1, _, -1, end_of_file) :- !. -turtle_token(0'., _, end, '.') :- !. % Turtle does not demand a space here! -turtle_token(0'#, In, C, Token) :- !, - get_code(In, C1), - skip_line(C1, In, C2), - turtle_token(C2, In, C, Token). -turtle_token(WS, In, C, Token) :- - turtle_ws(WS), !, - get_code(In, C1), - turtle_token(C1, In, C, Token). -turtle_token(C0, In, C, Number) :- - between(0'0, 0'9, C0), !, - turtle_number(C0, In, C, Number). -turtle_token(0'-, In, C, Number) :- !, - turtle_number(0'-, In, C, Number). -turtle_token(0'+, In, C, Number) :- !, - turtle_number(0'+, In, C, Number). -turtle_token(0'", In, C, Literal) :- !, - turtle_read_string(0'", In, C1, Atom), - ( C1 == 0'@ - -> get_code(In, C2), - language(C2, In, C, LangCodes), - atom_codes(LangId, LangCodes), - Literal = literal(lang(LangId, Atom)) - ; C1 == 0'^, - peek_code(In, 0'^) - -> get_code(In, 0'^), - get_code(In, C2), - resource_token(C2, In, C, Type), - Literal = literal(type(Type, Atom)) - ; C = C1, - Literal = literal(Atom) - ). -turtle_token(0'_, In, C, nodeId(NodeID)) :- - peek_code(In, 0':), !, - get_code(In, _), - get_code(In, C1), - turtle_read_name(C1, In, C, NodeID). -turtle_token(0'<, In, C, URI) :- !, - resource_token(0'<, In, C, URI). -turtle_token(0':, In, C, URI) :- !, - resource_token(0':, In, C, URI). -turtle_token(C0, In, C, Token) :- - turtle_read_name(C0, In, C1, Name), !, - ( C1 == 0':, - \+ sub_atom(Name, 0, _, _, '_'), - peek_code(In, C2), - turtle_name_start_char(C2) - -> get_code(In, C2), - turtle_read_name(C2, In, C, Name2), - Token = (Name:Name2) - ; Token = name(Name), - C = C1 - ). -turtle_token(Punct, In, C, P) :- - punctuation(Punct, P), !, - get_code(In, C). - -%% turtle_number(+Char0, +In, -CharNext, -Value) -% -% Value is Type:CodeList - -turtle_number(0'-, In, CN, numeric(T, [0'-|Codes])) :- !, - get_code(In, C0), - turtle_number_nn(C0, In, CN, numeric(T, Codes)). -turtle_number(0'+, In, CN, numeric(T, [0'+|Codes])) :- !, - get_code(In, C0), - turtle_number_nn(C0, In, CN, numeric(T, Codes)). -turtle_number(C0, In, CN, Value) :- - turtle_number_nn(C0, In, CN, Value). - -turtle_number_nn(C, In, CN, numeric(Type, Codes)) :- - turtle_integer_codes(C, In, CN0, Codes, T0), % [0-9]+ - ( CN0 == 0'. - -> T0 = [CN0|T1], - get_code(In, C1), - turtle_integer_codes(C1, In, CN1, T1, T2), % [0-9]+.[0-9]+ - ( exponent(CN1, In, CN, T2) - -> Type = double - ; CN = CN1, - T2 = [], - Type = decimal - ) - ; exponent(CN0, In, CN, T0) - -> Type = double - ; T0 = [], - CN = CN0, - Type = integer - ). - -turtle_integer_codes(C0, In, CN, [C0|T0], T) :- - between(0'0, 0'9, C0), !, - get_code(In, C1), - turtle_integer_codes(C1, In, CN, T0, T). -turtle_integer_codes(CN, _, CN, T, T). - -exponent(C0, In, CN, [C0|T0]) :- - e(C0), !, - get_code(In, C1), - optional_sign(C1, In, CN0, T0, T1), - turtle_integer_codes(CN0, In, CN, T1, []). - -optional_sign(C0, In, CN, [C0|T], T) :- - sign(C0), !, - get_code(In, CN). -optional_sign(CN, _, CN, T, T). - -e(0'e). -e(0'E). - -sign(0'-). -sign(0'+). %' - - - % language: [a-z]+ ('-' [a-z0-9]+ )* -language(C0, In, C, [C0|Codes]) :- - code_type(C0, lower), - get_code(In, C1), - lwr_word(C1, In, C2, Codes, Tail), - sub_langs(C2, In, C, Tail, []), !. -language(_, In, _, _) :- - line_count(In, LineNo), - syntax_error(In, LineNo, language_specifier). - -lwr_word(C0, In, C, [C0|T0], T) :- - code_type(C0, lower), !, - get_code(In, C1), - lwr_word(C1, In, C, T0, T). -lwr_word(C, _, C, T, T). - -sub_langs(0'-, In, C, [0'-, C1|Codes], T) :- !, - get_code(In, C1), - lwrdig(C1), !, - get_code(In, C2), - lwrdigs(C2, In, C3, Codes, Tail), - sub_langs(C3, In, C, Tail, T). -sub_langs(C, _, C, T, T). - -lwrdig(C) :- - code_type(C, lower), !. -lwrdig(C) :- - code_type(C, digit). - -lwrdigs(C0, In, C, [C0|T0], T) :- - lwrdig(C0), !, - get_code(In, C1), - lwr_word(C1, In, C, T0, T). -lwrdigs(C, _, C, T, T). - - % resource_token -resource_token(0'<, In, C, relative_uri(URI)) :- !, - turtle_read_relative_uri(0'<, In, C, URI). -resource_token(0':, In, C, Token) :- !, - get_code(In, C0), - ( turtle_read_name(C0, In, C, Name) - -> Token = :(Name) - ; Token = :, - C = C0 - ). -resource_token(C0, In, C, Prefix:Name) :- - turtle_read_name(C0, In, C1, Prefix), - \+ sub_atom(Prefix, 0, _, _, '_'), !, - C1 == 0':, - get_code(In, C2), - turtle_read_name(C2, In, C, Name). - - -punctuation(0'(, '('). -punctuation(0'), ')'). -punctuation(0'[, '['). -punctuation(0'], ']'). -punctuation(0',, ','). -punctuation(0'@, '@'). -punctuation(0':, ':'). -punctuation(0';, ';'). - - % comment -skip_line(0xA, In, C) :- !, - get_code(In, C). -skip_line(0xD, In, C) :- !, - get_code(In, C). -skip_line(-1, _, -1) :- !. -skip_line(_, In, C) :- - get_code(In, C1), - skip_line(C1, In, C). - - % ws -turtle_ws(0x9). -turtle_ws(0xA). -turtle_ws(0xD). -turtle_ws(0x20). - -syntax_error(Stream, Line, Which) :- - syntax_error_term(Stream, Line, Which, Error), - throw(Error). - -syntax_error_term(Stream, -1, Which, Error) :- !, - stream_property(Stream, file_name(File)), - line_count(Stream, LineNo), - line_position(Stream, LinePos), - character_count(Stream, CharIndex), - Error = error(syntax_error(Which), - file(File, LineNo, LinePos, CharIndex)). -syntax_error_term(Stream, LineNo, Which, Error) :- - stream_property(Stream, file_name(File)), - Error = error(syntax_error(Which), - file(File, LineNo, -1, -1)). - - - /******************************* - * RDF-DB HOOK * - *******************************/ - -:- multifile - rdf_db:rdf_load_stream/3, - rdf_db:rdf_file_type/2. - -rdf_db:rdf_load_stream(turtle, Stream, _Module:Options) :- - rdf_db:graph(Options, Id), - rdf_transaction(rdf_process_turtle(Stream, assert_triples, Options), - parse(Id)). - -assert_triples([], _). -assert_triples([rdf(S,P,O)|T], Location) :- - rdf_assert(S,P,O,Location), - assert_triples(T, Location). - -rdf_db:rdf_file_type(ttl, turtle). -rdf_db:rdf_file_type(n3, turtle). % not really, but good enough -rdf_db:rdf_file_type(nt, turtle). % not really, but good enough diff --git a/packages/semweb/rdf_turtle_write.pl b/packages/semweb/rdf_turtle_write.pl deleted file mode 100644 index da13abfcb..000000000 --- a/packages/semweb/rdf_turtle_write.pl +++ /dev/null @@ -1,1165 +0,0 @@ -/* Part of SWI-Prolog - - Author: Jan Wielemaker - E-mail: J.Wielemaker@uva.nl - WWW: http://www.swi-prolog.org - Copyright (C): 2009, University of Amsterdam - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - As a special exception, if you link this library with other files, - compiled with a Free Software compiler, to produce an executable, this - library does not by itself cause the resulting executable to be covered - by the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -:- module(rdf_turtle_write, - [ rdf_save_turtle/2, % +File, +Options - rdf_save_canonical_turtle/2 % +File, +Options - ]). -:- use_module(library(semweb/rdf_db)). -:- use_module(library(semweb/turtle_base)). -:- use_module(library(option)). -:- use_module(library(record)). -:- use_module(library(error)). -:- use_module(library(lists)). -:- use_module(library(rbtrees)). -:- use_module(library(apply)). -:- use_module(library(url)). -:- use_module(library(pairs)). -:- use_module(library(debug)). -:- use_module(library(sgml_write)). - - -/** <module> Turtle - Terse RDF Triple Language writer - -This module implements the Turtle language for representing the RDF -triple model as defined by Dave Beckett from the Institute for Learning -and Research Technology University of Bristol in the document: - - * http://www.w3.org/TeamSubmission/turtle/ - * http://www.w3.org/TeamSubmission/2008/SUBM-turtle-20080114/#sec-conformance - -The Turtle format is designed as an RDF serialization that is easy to -read and write by both machines and humans. Due to the latter property, -this library goes a long way in trying to produce human-readable output. - -In addition to the human-readable format, this library can write a -_canonical_ representation of RDF graphs. The canonical representation -has the following properties: - - * Equivalent graphs result in the same document. Graphs are - considered equivalent iff they contain the same _set_ of - triples, regardless of the labeling of blank nodes in the - graph. - - * Changes to the graph are diff-friendly. This means - - - Prefixes are combined in the header and thus changes - to the namespaces only result in changes in the header. - - Blank nodes that are used only once (including collections) - are written in-line with the object they belong to. - - For other blank nodes we to realise stable labeling that - is based on property-values. - -@tbd Low-level string output takes 28% of the time. Move to C? -*/ - -:- record - tw_state(graph, % graph being saved - base, % The base-URI - encoding=utf8, % Desired encoding - indent:nonneg=8, % Indent for ; and ,-lists - tab_distance:nonneg=8, % Tab distance - subject_white_lines:nonneg=1,%Extra lines between subjects - align_prefixes:boolean=true,%Align prefix declarations - user_prefixes:boolean=true,% Use rdf_current_ns/2? - comment:boolean=true, % write some comments into the file - group:boolean=true, % Group using ; and , - single_line_bnodes:boolean=false, % No newline after ; - canonize_numbers:boolean=false, % How to write numbers - canonical:boolean=false, - % Private fields - bnode_id=0, % Incrementing bnode-id - nodeid_map, % RBTree mapping NodeIDs to Refs - bnode_hash, % RBTree holding reuse-count of hashes - subject_count, % # subjects saved - triple_count=0, % # triples saved - base_root, % Root URL of base - base_dir, % Directory - base_path, % Path of base - prefix_map). % List of Prefix-Map - - -%% rdf_save_turtle(+Out, +Options) is det. -% -% Save an RDF graph as N3. Options processed are: -% -% * align_prefixes(+Boolean) -% Nicely align the @prefix declarations -% * base(+Base) -% Save relative to the given Base -% * canonize_numbers(+Boolean) -% If =true= (default =false=), emit numeric datatypes using -% Prolog's write to achieve canonical output. -% * comment(+Boolean) -% It =true= (default), write some informative comments -% between the output segments -% * encoding(+Encoding) -% Encoding used for the output stream. Default is UTF-8. -% * indent(+Column) -% Indentation for ; -lists. `0' does not indent, but -% writes on the same line. Default is 8. -% * graph(+Graph) -% Save only the named graph -% * group(+Boolean) -% If =true= (default), using P-O and O-grouping. -% * single_line_bnodes(+Bool) -% If =true= (default =false=), write [...] and (...) on a -% single line. -% * subject_white_lines(+Count) -% Extra white lines to insert between statements about a -% different subject. Default is 1. -% * tab_distance(+Tab) -% Distance between tab-stops. `0' forces the library to -% use only spaces for layout. Default is 8. -% * user_prefixes(+Boolean) -% If =true= (default), use prefixes from rdf_current_ns/2. -% -% @param Out is one of stream(Stream), a stream handle, a file-URL -% or an atom that denotes a filename. - -rdf_save_turtle(Spec, Options) :- - thread_self(Me), - thread_statistics(Me, cputime, T0), - must_be(list, Options), - make_tw_state(Options, State0, _Rest), - init_base(State0, State1), - init_prefix_map(State1, State), - tw_state_encoding(State, Enc), - open_output(Spec, Enc, Stream, Cleanup), - call_cleanup(tw_graph(State, Stream), - Cleanup), - thread_statistics(Me, cputime, T1), - Time is T1-T0, - tw_state_triple_count(State, SavedTriples), - tw_state_subject_count(State, SavedSubjects), - print_message(informational, - rdf(saved(Spec, Time, SavedSubjects, SavedTriples))). - - -%% rdf_save_canonical_turtle(+Spec, +Options) is det. -% -% Save triples in a canonical format. This is the same as -% rdf_save_turtle/3, but using different defaults. In particular: -% -% * encoding(utf8), -% * indent(0), -% * tab_distance(0), -% * subject_white_lines(1), -% * align_prefixes(false), -% * user_prefixes(false) -% * comment(false), -% * group(false), -% * single_line_bnodes(true) -% -% @tbd Work in progress. Notably blank-node handling is -% incomplete. - -rdf_save_canonical_turtle(Spec, Options) :- - rdf_save_turtle(Spec, - [ encoding(utf8), - indent(0), - tab_distance(0), - subject_white_lines(1), - align_prefixes(false), - user_prefixes(false), - comment(false), - group(false), - single_line_bnodes(true), - canonical(true) - | Options - ]). - -%% open_output(+Spec, +Encoding, -Stream, -Cleanup) is det. -% -% Open output Spec, returning a stream using Encoding. -% -% @param Cleanup is a goal that must be used to revert the side -% effects of open_output/4. - -open_output(stream(Out), Encoding, Out, - set_stream(Out, encoding(Old))) :- !, - stream_property(Out, encoding(Old)), - set_stream(Out, encoding(Encoding)). -open_output(Stream, Encoding, Out, Cleanup) :- - \+ atom(Stream), - is_stream(Stream), !, - open_output(stream(Stream), Encoding, Out, Cleanup). -open_output(Spec, Encoding, Out, - close(Out)) :- - out_to_file(Spec, File), - open(File, write, Out, [encoding(Encoding)]). - -out_to_file(URL, File) :- - atom(URL), - file_name_to_url(File, URL), !. -out_to_file(File, File). - - - /******************************* - * PREFIXES * - *******************************/ - -%% init_prefix_map(+State, -State) is det. -% -% Set the prefix_map of State. The prefix map is list of -% Prefix-URI of prefixes to use for emitting the graph requested -% in State. If multiple prefixes are present where the one is a -% prefix of the other, the longer one appears first in the list. - -init_prefix_map(State0, State) :- - tw_state_graph(State0, Graph), - rdf_graph_prefixes(Graph, Prefixes, turtle_prefix), - remove_base(State0, Prefixes, Prefixes2), - prefix_names(Prefixes2, State0, Pairs), - transpose_pairs(Pairs, URI_Abrevs), - reverse(URI_Abrevs, RURI_Abrevs), - flip_pairs(RURI_Abrevs, PrefixMap), - set_prefix_map_of_tw_state(PrefixMap, State0, State). - -%% turtle_prefix(+Where, +Prefix, +URI) is semidet. -% -% Test whether we want to include the proposed prefix in the -% @prefix declaration. - -turtle_prefix(_, Prefix, URI) :- - sub_atom(Prefix, _, 1, 0, Last), - turtle_prefix_char(Last), - atom_concat(Prefix, Local, URI), - \+ sub_atom(Local, _, _, _, '.'). - -turtle_prefix_char('#'). -turtle_prefix_char('/'). - - -remove_base(State, Prefixes, PrefixesNoBase) :- - tw_state_base_dir(State, BaseDir), - atom(BaseDir), !, - delete(Prefixes, BaseDir, PrefixesNoBase). -remove_base(_State, Prefixes, Prefixes). - -flip_pairs([], []). -flip_pairs([Key-Val|Pairs], [Val-Key|Flipped]) :- - flip_pairs(Pairs, Flipped). - -prefix_names(URIs, State, Prefixes) :- - prefix_names(URIs, State, 1, Prefixes, []). - -prefix_names([], _, _, List, List) :- !. -prefix_names(URIs, State, Len, Prefixes, Tail) :- - prefix_names(URIs, State, Len, Prefixes, PTail, Rest), - Len1 is Len + 1, - prefix_names(Rest, State, Len1, PTail, Tail). - -prefix_names(URIs, State, Len, Prefixes, PTail, Rest) :- - map_list_to_pairs(propose_abbrev(State, Len), URIs, Pairs), !, - keysort(Pairs, Sorted), - unique(Sorted, Prefixes, PTail, Rest). -prefix_names(URIs, _, _, Prefixes, PTail, []) :- - number_prefixes(URIs, 1, Prefixes, PTail). - -number_prefixes([], _, PL, PL). -number_prefixes([H|T0], N, [P-H|PL], T) :- - atomic_concat(ns, N, P), - succ(N, N1), - number_prefixes(T0, N1, PL, T). - -unique([], L, L, []). -unique([A-U|T0], [A-U|T], L, Rest) :- - T0 \= [A-_|_], !, - unique(T0, T, L, Rest). -unique([A-U|T0], Prefixes, L, [U|Rest0]) :- - strip_keys(T0, A, T1, Rest0, Rest), - unique(T1, Prefixes, L, Rest). - -strip_keys([A-U|T0], A, T, [U|R0], R) :- !, - strip_keys(T0, A, T, R0, R). -strip_keys(L, _, L, R, R). - - -%% propose_abbrev(+State, +Len, +URI, -Abbrev) is multi. -% -% Propose an abbreviation for URI. Backtracking yields longer -% ones. - -propose_abbrev(_, _, URI, Abbrev) :- - well_known_ns(Abbrev, URI), !. -propose_abbrev(State, _, URI, Abbrev) :- - tw_state_user_prefixes(State, true), - rdf_current_ns(Abbrev, URI), !. -propose_abbrev(_, Len, URI, Abbrev) :- - namespace_parts(URI, Parts), - include(abbrev_part, Parts, Names), - reverse(Names, RevNames), - length(Use, Len), - append(Use, _, RevNames), - atomic_list_concat(Use, -, Abbrev). - -abbrev_part(X) :- - turtle_name(X), - \+ well_known_ns(X, _), - \+ well_known_extension(X). - -well_known_ns(rdf, 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'). -well_known_ns(rdfs, 'http://www.w3.org/2000/01/rdf-schema#'). -well_known_ns(owl, 'http://www.w3.org/2002/07/owl#'). -well_known_ns(xsd, 'http://www.w3.org/2001/XMLSchema#'). -well_known_ns(dc, 'http://purl.org/dc/elements/1.1/'). - -well_known_extension(ttl). -well_known_extension(nt). -well_known_extension(n3). -well_known_extension(xml). -well_known_extension(rdf). -well_known_extension(owl). - -%% namespace_parts(+URL, -Parts) - -namespace_parts(URL, Parts) :- - atom_codes(URL, Codes), - phrase(parts(Parts), Codes), !. -namespace_parts(URL, _) :- - format(user_error, 'Couldn\'t split ~q~n', [URL]), - fail. - -parts(List) --> sep2, parts2(List). - -parts2([H|T]) --> - string(Codes), {Codes \== []}, - sep, !, - {atom_codes(H, Codes)}, - parts2(T). -parts2([]) --> []. - -string([]) --> []. -string([H|T]) --> [H], string(T). - -sep --> sep_char, sep2. -sep([], []). - -sep2 --> sep_char, !, sep2. -sep2 --> []. - -sep_char --> "/". -sep_char --> ":". -sep_char --> ".". -sep_char --> "?". -sep_char --> "#". - - -%% init_base(+State0, -State) is det. -% -% Initialise dealing with the base URI. It sets two attributes of -% the state: base_root and base_path. - -init_base(State0, State) :- - tw_state_base(State0, BaseURI), - atom(BaseURI), !, - parse_url(BaseURI, Attributes), - include(root_part, Attributes, RootAttrs), - parse_url(BaseRoot, RootAttrs), - memberchk(path(BasePath), Attributes), - file_directory_name(BasePath, BaseDir), - atomic_list_concat([BaseRoot, BaseDir, /], BaseDirURI), - set_base_root_of_tw_state(BaseRoot, State0, State1), - set_base_path_of_tw_state(BasePath, State1, State2), - set_base_dir_of_tw_state(BaseDirURI, State2, State). -init_base(State, State). - -root_part(protocol(_)). -root_part(host(_)). -root_part(port(_)). - - - /******************************* - * SAVE * - *******************************/ - -%% tw_graph(+State, +Out) is det. -% -% Write an RDF graph as Turtle data. -% -% @tbd Write unconnected and multi-connected blank-nodes. - -tw_graph(State, Out) :- - tw_state_prefix_map(State, PrefixMap), - tw_prefix_map(PrefixMap, State, Out), - subjects(State, Subjects), - length(Subjects, SubjectCount), - tw_state_subject_count(State, SubjectCount), - partition(rdf_is_bnode, Subjects, BNodes, ProperSubjects), - maplist(pair_var, BNodes, Pairs), - ord_list_to_rbtree(Pairs, BNTree), - tw_state_nodeid_map(State, BNTree), - ( ProperSubjects == [] - -> true - ; length(ProperSubjects, PSCount), - comment(State, 'Named toplevel resources (~D)', [PSCount], Out), - tw_proper_subjects(ProperSubjects, State, Out) - ), - tw_bnodes(Pairs, State, Out). - -pair_var(BNode, BNode-_). - - -%% tw_prefix_map(+PrefixMap, +State, +Out) is det. -% -% Write the @base and @prefix declarations - -tw_prefix_map(PrefixMap, State, Out) :- - tw_state_align_prefixes(State, true), !, - longest_prefix(PrefixMap, 0, Length), - PrefixCol is Length+10, - tw_base(PrefixCol, State, Out), - tw_prefix_map(PrefixMap, PrefixCol, State, Out). -tw_prefix_map(PrefixMap, State, Out) :- - tw_base(0, State, Out), - tw_prefix_map(PrefixMap, 0, State, Out). - -longest_prefix([], L, L). -longest_prefix([Prefix-_|T], L0, L) :- - atom_length(Prefix, L1), - L2 is max(L0, L1), - longest_prefix(T, L2, L). - - -tw_base(Col, State, Out) :- - tw_state_base(State, Base), - atom(Base), !, - format(Out, '@base ~t~*|', [Col]), - turtle_write_uri(Out, Base), - format(Out, ' .~n', []). -tw_base(_, _, _). - - -tw_prefix_map([], _, _, _). -tw_prefix_map([Prefix-URI|T], Col, State, Out) :- - format(Out, '@prefix ~t~w: ~*|', [Prefix, Col]), - tw_relative_uri(URI, State, Out), - format(Out, ' .~n', []), - ( T == [] - -> true - ; tw_prefix_map(T, Col, State, Out) - ). - - -%% tw_proper_subjects(+Subjects, +State, +Out) is det. -% -% Write the subjects that are not Bnodes. - -tw_proper_subjects([], _, _). -tw_proper_subjects([H|T], State, Out) :- - separate_subjects(State, Out), - tw_subject(H, H, State, Out), - tw_proper_subjects(T, State, Out). - - -separate_subjects(State, Out) :- - tw_state_subject_white_lines(State, ExtraLines), - put_n(ExtraLines, '\n', Out). - -%% tw_subject(+URI, +State, +Out) is det. -% -% Write a toplevel non-bnode subject. - -tw_subject(URI, Ref, State, Out) :- - subject_triples(URI, State, Pairs), - length(Pairs, Count), - inc_triple_count(State, Count), - group_po(Pairs, Grouped), - tw_subject_triples(Grouped, Ref, State, Out). - -group_po(Pairs, Grouped) :- - group_pairs_by_key(Pairs, Grouped0), - rdf_equal(rdf:type, RDFType), - ( select(RDFType-Types, Grouped0, Grouped1) - -> Grouped = [RDFType-Types|Grouped1] - ; Grouped = Grouped0 - ). - -%% tw_bnodes(+Pairs, +State, +Out) is det. -% -% Write the Bnodes. Pairs is a list URI-Ref, where Ref is one of -% =written= if the Bnode is already written; an integer if it is -% used multiple times or a variable if it has not been written. -% The order in which we deal with bnodes is defined as follows: -% -% * First, write the bnodes that are not referenced at all -% as toplevel bnodes using [ ... ] notation. -% -% * Next, write the bnodes that need written as toplevel -% nodes using the _:XX notation because they are referenced -% multiple times in the graph. Continue this process until it -% is exhausted. - -tw_bnodes(Pairs, State, Out) :- - tw_top_bnodes(Pairs, State, Out, Rest1), - tw_numbered_bnodes(Rest1, State, Out, 1, Rest2), - tw_cyclic_bnodes(Rest2, State, Out, 0). - - -tw_numbered_bnodes([], _, _, _, []) :- !. -tw_numbered_bnodes(Pairs, State, Out, Level, Rest) :- - multi_referenced(Pairs, RefPairs, Rest0), - ( RefPairs == [] - -> Rest = Rest0 - ; length(RefPairs, Count), - comment(State, 'Level ~D multi-referenced blank-nodes (~D)', - [ Level, Count ], Out), - tw_ref_bnodes(RefPairs, State, Out), - Level1 is Level + 1, - tw_numbered_bnodes(Rest0, State, Out, Level1, Rest) - ). - -multi_referenced([], [], []). -multi_referenced([H|T], RefPairs, Rest) :- - H = _-Ref, - ( Ref == written - -> multi_referenced(T, RefPairs, Rest) - ; var(Ref) - -> Rest = [H|TR], - multi_referenced(T, RefPairs, TR) - ; assertion(Ref = bnode(_)), - RefPairs = [H|TRP], % assigned reference - multi_referenced(T, TRP, Rest) - ). - -tw_ref_bnodes([], _, _). -tw_ref_bnodes([BNode-Ref|T], State, Out) :- - separate_subjects(State, Out), - tw_subject(BNode, Ref, State, Out), - tw_ref_bnodes(T, State, Out). - - -%% tw_top_bnodes(+Pairs, +State, +Out, -Rest) -% -% Write the top bnodes: those that do not appear as an object -% anywhere. - -tw_top_bnodes(Pairs, State, Out, Rest) :- - unreferenced(Pairs, State, TopBNodes, Rest), - ( TopBNodes == [] - -> true - ; length(TopBNodes, Count), - comment(State, 'Toplevel blank-nodes (~D)', [Count], Out), - sort_bnodes(TopBNodes, SortedTopBNodes, State), - tw_top_bnodes(SortedTopBNodes, State, Out) - ). - -unreferenced([], _, [], []). -unreferenced([H|T], State, UnrefPairs, Rest) :- - H = BNode-Ref, - ( Ref == written - -> unreferenced(T, State, UnrefPairs, Rest) - ; var(Ref), - object_link_count(BNode, State, 0) - -> UnrefPairs = [H|URT], - unreferenced(T, State, URT, Rest) - ; Rest = [H|TR], - unreferenced(T, State, UnrefPairs, TR) - ). - -tw_top_bnodes([], _, _). -tw_top_bnodes([BNode-_|T], State, Out) :- - tw_bnode(BNode, State, Out), - tw_top_bnodes(T, State, Out). - - -tw_bnode(BNode, State, Out) :- - subject_triples(BNode, State, Pairs), - tw_bnode_triples(Pairs, State, Out), - format(Out, ' .~n', []). - -tw_bnode_triples(Pairs, State, Out) :- - length(Pairs, Count), - inc_triple_count(State, Count), - group_po(Pairs, Grouped), - ( tw_state_single_line_bnodes(State, true) - -> format(Out, '[ ', []), - tw_triples(Grouped, -1, State, Out), - format(Out, ' ]', []) - ; line_position(Out, Indent), - format(Out, '[ ', []), - line_position(Out, AIndent), - tw_triples(Grouped, AIndent, State, Out), - nl_indent(Out, State, Indent), - format(Out, ']', []) - ). - -%% tw_cyclic_bnodes(+Pairs, +BNode, +State, +Out, +Cycle) -% -% The rest. These are groups of bnodes that are reachable, but we -% cannot find a starting point, neither from a named resource, nor -% from an unlinked bnode. As long as we are not considering stable -% canonical output, we can break the cycle at any point. - -tw_cyclic_bnodes([], _State, _Out, _) :- !. -tw_cyclic_bnodes(Pairs, State, Out, Cycle0) :- - ( tw_state_canonical(State, true) - -> sort_bnode_pairs(Pairs, BNodes, State) - ; BNodes = Pairs - ), - succ(Cycle0, Cycle), - BNodes = [BNode-Ref|_], - next_bnode_id(State, BNode, Ref), - comment(State, 'Breaking cycle ~D', [Cycle], Out), - tw_numbered_bnodes(Pairs, State, Out, 1, Rest), - tw_cyclic_bnodes(Rest, State, Out, Cycle). - - -%% tw_subject_triples(+Grouped, +Subject, +State, +Out) -% -% Save triples on Subject. Combine groups of triples with the -% same subject (;) and same subject+predicate (,). -% -% @param Subject is either a URI or an integer. The latter is -% used for writing a named bnode. - -tw_subject_triples([], _, _, _) :- !. -tw_subject_triples(Grouped, URI, State, Out) :- - tw_state_group(State, false), !, - tw_ungrouped_triples(Grouped, URI, State, Out). -tw_subject_triples(Grouped, URI, State, Out) :- - tw_resource(URI, State, Out), - ( tw_state_indent(State, Indent), - Indent > 0 - -> nl_indent(Out, State, Indent) - ; put_char(Out, ' '), - line_position(Out, Indent) - ), - tw_triples(Grouped, Indent, State, Out), - format(Out, ' .~n', []). - -%% tw_ungrouped_triples(+Grouped, +URI, +State, +Out) -% -% Write triples for subject URI as one line per triple. Used -% for canonical output. - -tw_ungrouped_triples([], _, _, _). -tw_ungrouped_triples([P-Vs|Groups], URI, State, Out) :- - partition(rdf_is_bnode, Vs, BNVs, ProperVs), - tw_ungrouped_values(ProperVs, P, URI, State, Out), - sort_bnodes(BNVs, SortedBNVs, State), - tw_ungrouped_values(SortedBNVs, P, URI, State, Out), - tw_ungrouped_triples(Groups, URI, State, Out). - -tw_ungrouped_values([], _, _, _, _). -tw_ungrouped_values([V|T], P, URI, State, Out) :- - tw_resource(URI, State, Out), - put_char(Out, ' '), - tw_predicate(P, State, Out), - put_char(Out, ' '), - tw_object(V, State, Out), - format(Out, ' .~n', []), - tw_ungrouped_values(T, P, URI, State, Out). - - -%% tw_triples(+Groups, +Indent, +State, +Out) is det. -% -% Triple writer that uses ; and ,- grouping - -tw_triples([P-Vs|MoreGroups], Indent, State, Out) :- - tw_write_pvs(Vs, P, State, Out), - ( MoreGroups == [] - -> true - ; format(Out, ' ;', []), - nl_indent(Out, State, Indent), - tw_triples(MoreGroups, Indent, State, Out) - ). - -tw_write_pvs(Values, P, State, Out) :- - tw_predicate(P, State, Out), - put_char(Out, ' '), - line_position(Out, Indent), - tw_write_vs(Values, Indent, State, Out). - -tw_predicate(P, State, Out) :- - ( rdf_equal(P, rdf:type) - -> format(Out, 'a', []) - ; tw_resource(P, State, Out) - ). - -tw_write_vs([H|T], Indent, State, Out) :- - tw_object(H, State, Out), - ( T == [] - -> true - ; format(Out, ' ,', []), - nl_indent(Out, State, Indent), - tw_write_vs(T, Indent, State, Out) - ). - -%% tw_object(+Value, +State, +Out) is det. -% -% Write the object of a triple. - -tw_object(Value, State, Out) :- - rdf_is_bnode(Value), !, - tw_bnode_object(Value, State, Out). -tw_object(Value, State, Out) :- - atom(Value), !, - tw_resource(Value, State, Out). -tw_object(Literal, State, Out) :- - tw_literal(Literal, State, Out). - -%% tw_bnode_object(+Value, +State, +Out) is det. -% -% Write a Bnode value. There are a number of cases: -% -% * The BNode was already written. Write the same ref. -% * The BNode is not shared. Inline and set =written= -% * The BNode is shared. Generate a NodeID and store it -% * The BNode is once as object: Generate a NodeID -% * The BNode is more than once object: Generate a NodeID -% and put in table. - -tw_bnode_object(BNode, State, Out) :- - tw_state_nodeid_map(State, BNTree), - rb_lookup(BNode, Ref, BNTree), !, - ( var(Ref) - -> ( tw_unshared_bnode(BNode, State, Out) - -> Ref = written - ; next_bnode_id(State, BNode, Ref), - tw_bnode_ref(Ref, Out) - ) - ; tw_bnode_ref(Ref, Out) - ). -tw_bnode_object(BNode, State, Out) :- - object_link_count(BNode, State, N), - N > 1, !, - tw_state_nodeid_map(State, BNTree0), - rb_insert(BNTree0, BNode, Ref, BNTree), - set_nodeid_map_of_tw_state(BNTree, State), - next_bnode_id(State, BNode, Ref), - tw_bnode_ref(Ref, Out). -tw_bnode_object(BNode, State, Out) :- - next_bnode_id(State, BNode, Ref), - tw_bnode_ref(Ref, Out). - -tw_bnode_ref(bnode(Ref), Out) :- - ( integer(Ref) - -> format(Out, '_:bn~w', [Ref]) - ; format(Out, '_:~w', [Ref]) - ). - -%% tw_unshared_bnode(+BNode, +State, +Out) is semidet. -% -% Write a bnode if this is the only place it is used. - -tw_unshared_bnode(BNode, State, Out) :- - object_link_count(BNode, State, 1), - subject_triples(BNode, State, Pairs), - ( Pairs == [] - -> format(Out, '[]', []) - ; pairs_unshared_collection(Pairs, State, Collection) - -> ( Collection == [] - -> format(Out, '()', []) - ; tw_state_nodeid_map(State, BNTree), - rb_lookup(BNode, written, BNTree), - length(Collection, NMembers), - Triples is 2*NMembers, - inc_triple_count(State, Triples), - ( tw_state_single_line_bnodes(State, true) - -> format(Out, '( ', []), - tw_collection(Collection, -1, State, Out), - format(Out, ' )', []) - ; line_position(Out, Indent), - format(Out, '( ', []), - line_position(Out, AIndent), - tw_collection(Collection, AIndent, State, Out), - nl_indent(Out, State, Indent), - format(Out, ')', []) - ) - ) - ; tw_bnode_triples(Pairs, State, Out) - ). - -tw_collection([H|T], Indent, State, Out) :- - tw_object(H, State, Out), - ( T \== [] - -> nl_indent(Out, State, Indent), - tw_collection(T, Indent, State, Out) - ; true - ). - -%% unshared_collection(+URI, +State, -Members) is semidet. -% -% True if URI denodes an RDF list that is made up from bnodes, is -% linked exactly once to its context and contains no extra -% triples. - -unshared_collection(C, _, []) :- - rdf_equal(C, rdf:nil), !. -unshared_collection(C, State, List) :- - rdf_is_bnode(C), - object_link_count(C, State, 1), - tw_state_nodeid_map(State, BNTree), - rb_lookup(C, written, BNTree), - subject_triples(C, State, Pairs), - pairs_unshared_collection(Pairs, State, List). - -pairs_unshared_collection(Pairs, State, [H|T]) :- - rdf_equal(rdf:first, RDFFirst), - rdf_equal(rdf:rest, RDFRest), - Pairs = [ RDFFirst-H, - RDFRest-Rest - | More - ], - ( More == [] - ; rdf_equal(rdf:type, RDFType), - rdf_equal(rdf:'List', RDFList), - More == [RDFType-RDFList] - ), - unshared_collection(Rest, State, T). - - -%% object_link_count(+BNode, +STate, -Count) is det. -% -% Number of times BNode is used as an object in the graph - -object_link_count(BNode, State, Count) :- - tw_state_graph(State, Graph), - ( var(Graph) - -> findall(S-P, rdf(S,P,BNode), Pairs0) - ; findall(S-P, rdf(S,P,BNode,Graph), Pairs0) - ), - sort(Pairs0, Pairs), % remove duplicates - length(Pairs, Count). - -%% nl_indent(+Out, +State, +Indent) is det. -% -% Write a newline and indent to column Indent. - -nl_indent(Out, _, -1) :- !, - put_char(Out, ' '). -nl_indent(Out, State, Indent) :- - nl(Out), - tw_state_tab_distance(State, TD), - ( TD == 0 - -> tab(Out, Indent) - ; Tabs is Indent//TD, - Spaces is Indent mod TD, - put_n(Tabs, '\t', Out), - put_n(Spaces, ' ', Out) - ). - -put_n(N, Char, Out) :- - N > 0, !, - put_char(Out, Char), - N2 is N - 1, - put_n(N2, Char, Out). -put_n(_, _, _). - - -%% subject_triples(+URI, +State, -Pairs) is det. -% -% Pairs is a sorted list of P-O pairs representing all triples on -% the subject URI. - -subject_triples(URI, State, Pairs) :- - tw_state_graph(State, Graph), - ( var(Graph) - -> findall(P-O, rdf(URI, P, O), Pairs0) - ; findall(P-O, rdf(URI, P, O, Graph), Pairs0) - ), - sort(Pairs0, Pairs). - - - /******************************* - * GRAPH-LOGIC * - *******************************/ - -%% subjects(+State, -Subjects:ord_set) is det. -% -% Subjects is a list of all subjects in the graph requested in -% State. - -subjects(State, Subjects) :- - findall(Subject, subject(State, Subject), AllSubjects), - sort(AllSubjects, Subjects). - -subject(State, Subject) :- - tw_state_graph(State, Graph), - ( atom(Graph) - -> rdf_subject(Subject), - ( rdf(Subject, _, _, Graph) - -> true - ) - ; rdf_subject(Subject) - ). - - - /******************************* - * CANONICAL ORDERING * - *******************************/ - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -This section deals with the two problems of canonical graphs: - - * Keep blank nodes in the same order - * Assign stable names to blank nodes that we need to - give a name. There are two cases: (1) a blank nodes is - used in more than one place and (2) a blank node series - is cyclic. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -%% sort_bnodes(+BNodes, -Sorted, +State) is det. -% -% Sort a list of blank nodes. - -sort_bnodes(BNodes, Sorted, _State) :- - sort(BNodes, Sorted). - -%% sort_bnode_pairs(+Pairs, -Sorted, +State) is det. -% -% Sort a list of Pairs BNode-Ref - -sort_bnode_pairs(Pairs, Sorted, _State) :- - sort(Pairs, Sorted). - -%% bnode_to_term(+BNode, -Term, +State) -% -% Term is a canonical representation of the graph formed by BNode. -% The transformation of a bnode is -% -% bnode(p-[o1,o2,..], ..) -% -% The arguments are alphabetically sorted on predicate (can't we -% leave the preds out them?) and the objects are alphabetically -% sorted. Sorting multiple bnode values? - - -%% next_bnode_id(+State, +BNode, -Ref) is det. -% -% Generate a node-id for BNode. When writing non-canonically, we -% simply number the bnodes. Otherwise we want a more stable -% numbering. Our numbering is a hash of the content of the bnode. -% It is not unlikely that we find muliple copies, and therefore we -% number the full id is bn_<hash>_<n>, <n> counting 0... - -next_bnode_id(State, _BNode, bnode(Ref)) :- - tw_state_canonical(State, false), !, - tw_state_bnode_id(State, Ref0), - Ref is Ref0+1, - nb_set_bnode_id_of_tw_state(Ref, State). -next_bnode_id(State, BNode, bnode(Ref)) :- - bnode_hash(BNode, Hash), - tw_state_bnode_hash(State, BNHash), - ( var(BNHash) - -> rb_empty(BNHash) - ; true - ), - ( rb_update(BNHash, Hash, C0, C, BNHash1) - -> C is C0+1 - ; C = 0, - rb_insert(BNHash, Hash, C, BNHash1) - ), - set_bnode_hash_of_tw_state(BNHash1, State), - format(atom(Ref), 'bn_~w_~d', [Hash, C]). - -%% bnode_hash(+BNode, -Hash) is det. -% -% Hash is the hash-value for a bnode. -% -% @tbd: Hash on content. - -bnode_hash(BNode, Hash) :- - term_hash(BNode, Hash). - - - /******************************* - * PRIMITIVES * - *******************************/ - -%% tw_resource(+Resource, +State, +Out) is det. -% -% Write a resource - -tw_resource(BNodeID, _, Out) :- - BNodeID = bnode(_), !, - tw_bnode_ref(BNodeID, Out). -tw_resource(Resource, State, Out) :- - tw_state_prefix_map(State, PrefixMap), - member(Prefix-Full, PrefixMap), - atom_concat(Full, Name, Resource), - turtle_name(Name), !, - format(Out, '~w:~w', [Prefix, Name]). -tw_resource(Resource, State, Out) :- - tw_relative_uri(Resource, State, Out). - - -tw_relative_uri(Resource, State, Out) :- - tw_state_base_root(State, Root), - atom(Root), - atom_concat(Root, ResPath, Resource), - sub_atom(ResPath, 0, _, _, /), - tw_state_base_path(State, BasePath), - relative_path(ResPath, BasePath, RelPath), !, - turtle_write_uri(Out, RelPath). -tw_relative_uri(Resource, _, Out) :- - turtle_write_uri(Out, Resource). - -relative_path(Path, RelTo, RelPath) :- - atomic_list_concat(PL, /, Path), - atomic_list_concat(RL, /, RelTo), - delete_common_prefix(PL, RL, PL1, PL2), - to_dot_dot(PL2, DotDot, PL1), - atomic_list_concat(DotDot, /, RelPath). - -delete_common_prefix([H|T01], [H|T02], T1, T2) :- !, - delete_common_prefix(T01, T02, T1, T2). -delete_common_prefix(T1, T2, T1, T2). - -to_dot_dot([], Tail, Tail). -to_dot_dot([_], Tail, Tail) :- !. -to_dot_dot([_|T0], ['..'|T], Tail) :- - to_dot_dot(T0, T, Tail). - - -%% tw_literal(+Literal, +State, +Out) is det. -% -% Write a literal value to the stream Out. - -tw_literal(literal(type(Type, Value)), State, Out) :- !, - tw_typed_literal(Type, Value, State, Out). -tw_literal(literal(lang(Lang, Value)), State, Out) :- !, - tw_quoted_string(Value, State, Out), - downcase_atom(Lang, TurtleLang), % Turtle lang = [a-z]+('-'[a-z0-9]+)* - format(Out, '@~w', [TurtleLang]). -tw_literal(literal(Value), State, Out) :- - atom(Value), !, - tw_quoted_string(Value, State, Out). -tw_literal(literal(Value), State, Out) :- - atom(Value), !, - tw_quoted_string(Value, State, Out). - % Add types automatically -tw_literal(literal(Value), State, Out) :- - integer(Value), !, - rdf_equal(Type, xsd:integer), - tw_typed_literal(Type, Value, State, Out). -tw_literal(literal(Value), State, Out) :- - float(Value), !, - rdf_equal(Type, xsd:double), - tw_typed_literal(Type, Value, State, Out). -tw_literal(literal(Value), State, Out) :- - xml_is_dom(Value), !, - rdf_equal(Type, rdf:'XMLLiteral'), - tw_typed_literal(Type, Value, State, Out). -tw_literal(Literal, _State, _Out) :- - type_error(rdf_literal, Literal). - - -tw_typed_literal(Type, Value, State, Out) :- - tw_abbreviated_literal(Type, Value, State, Out), !. -tw_typed_literal(Type, Value, State, Out) :- - (atom(Value) ; string(Value)), !, - tw_quoted_string(Value, State, Out), - write(Out, '^^'), - tw_resource(Type, State, Out). -tw_typed_literal(Type, Value, State, Out) :- - rdf_equal(Type, rdf:'XMLLiteral'), !, - with_output_to(string(Tmp), - xml_write(Value, [header(false)])), - tw_quoted_string(Tmp, State, Out), - write(Out, '^^'), - tw_resource(Type, State, Out). -tw_typed_literal(Type, Value, State, Out) :- - format(string(Tmp), '~q', [Value]), - tw_quoted_string(Tmp, State, Out), - write(Out, '^^'), - tw_resource(Type, State, Out). - - -%% tw_abbreviated_literal(+Type, +Value, +State, +Out) is semidet. -% -% Turtle abbreviated typed literals. -% -% @tbd: Deal with canonical forms (or is this a task of the -% RDF parser? -% @tbd: What if the value is not in the lexical space of the type? - -term_expansion((tw_abbreviated_literal(NS:Local, Value, State, Out) :- Body), - (tw_abbreviated_literal(Type, Value, State, Out) :- Body)) :- - atom(NS), - rdf_global_id(NS:Local, Type). - -tw_abbreviated_literal(xsd:integer, Value, State, Out) :- - ( tw_state_canonize_numbers(State, false) - -> write(Out, Value) - ; atom_number(Value, Int), - format(Out, '~d', [Int]) - ). -tw_abbreviated_literal(xsd:double, Value, State, Out) :- - ( tw_state_canonize_numbers(State, false) - -> write(Out, Value) - ; atom_number(Value, Float), - format(Out, '~f', [Float]) - ). -tw_abbreviated_literal(xsd:decimal, Value, _, Out) :- - format(Out, '~w', [Value]). -tw_abbreviated_literal(xsd:boolean, Value, _, Out) :- - format(Out, '~w', [Value]). - - -%% tw_quoted_string(+Atom, +State, +Out) is det. -% -% Write Atom to Out as a quoted string. We only use the -% single-"..." representation. - -tw_quoted_string(Atom, _, Out) :- - turtle_write_quoted_string(Out, Atom). - - - /******************************* - * COMMENT * - *******************************/ - -comment(State, Format, Args, Out) :- - tw_state_comment(State, true), !, - format(Out, '~n# ', []), - format(Out, Format, Args), - format(Out, '~n', []). -comment(_, _, _, _). - - - - /******************************* - * STATISTICS * - *******************************/ - -inc_triple_count(State, Count) :- - tw_state_triple_count(State, C0), - C1 is C0+Count, - nb_set_triple_count_of_tw_state(C1, State). - -:- multifile - prolog:message//1. - -prolog:message(rdf(saved(File, Time, SavedSubjects, SavedTriples))) --> - [ 'Saved ~D triples about ~D subjects into ~p (~3f sec)'- - [SavedTriples, SavedSubjects, File, Time] - ]. diff --git a/packages/semweb/rdf_zlib_plugin.pl b/packages/semweb/rdf_zlib_plugin.pl deleted file mode 100644 index 9d920441c..000000000 --- a/packages/semweb/rdf_zlib_plugin.pl +++ /dev/null @@ -1,50 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog - - Author: Jan Wielemaker - E-mail: wielemak@science.uva.nl - WWW: http://www.swi-prolog.org - Copyright (C): 1985-2006, University of Amsterdam - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - As a special exception, if you link this library with other files, - compiled with a Free Software compiler, to produce an executable, this - library does not by itself cause the resulting executable to be covered - by the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - - -:- module(rdf_zlib_plugin, []). -:- use_module(library(zlib)). -:- use_module(library(semweb/rdf_db)). - -/** <module> RDF compressed-data plugin - -This module connects library(zlib) to library(rdf_db), causing -rdf_load/2 to seemlessly load .gz files. -*/ - -:- multifile - rdf_db:rdf_open_decode/4, - rdf_db:rdf_storage_encoding/2. - -rdf_db:rdf_open_decode(gzip, File, Stream, close(Stream)) :- - gzopen(File, read, Stream). - -rdf_db:rdf_storage_encoding(gz, gzip). diff --git a/packages/semweb/rdflib.doc b/packages/semweb/rdflib.doc deleted file mode 100644 index 52b391f38..000000000 --- a/packages/semweb/rdflib.doc +++ /dev/null @@ -1,429 +0,0 @@ -\section{Managing RDF input files} -\label{sec:rdflib} - -Complex projects require RDF resources from many locations and typically -wish to load these in different combinations. For example loading a -small subset of the data for debugging purposes or load a different set -of files for experimentation. The library \pllib{semweb/rdf_library.pl} -manages sets of RDF files spread over different locations, including -file and network locations. RDF files are annotated using a -\jargon{Manifest} file in RDF format. - -Currently (September 2007), the E-culture server loads more than 120 RDF -files, containing many different schemas, instance repositories and -ontology mappings. Some resources, such as the W3C version of Wordnet -come in many files. The server is initialised by loading (a subset of) -these files. The subset is defined by predicates called -\predref{load_medium}{0}, \predref{load_tgn}{1}, etc. This has become -unmanageable. There is no way to find out exactly what will be loaded or -whether all RDF files are in place except for actually executing the -load. There is also no easy way to exploit concurrency to speedup the -process. - -For this reason we introduce RDF \jargon{Manifest} files that describe -one or more RDF resources and their dependencies. The manifest file can -be distributed along with a set of RDF files, providing a machine -readable portable and declarative description of how the RDF files are -intended to be combined. Software allows for listing the content of the -library or loading an entry with all dependencies. - - -\subsection{The Manifest file} - -A manifest file is an RDF file, often in Turtle \cite{turtle} format, -that provides meta-data about RDF resources. Often a manifest will -describe RDF files in the current directory, but it can also describe -RDF resources at arbitrary URL locations. The RDF schema for RDF library -meta-data can be found in \file{rdf_library.ttl}. The namespace for the -RDF library format is defined as -\url{http://www.swi-prolog.org/rdf/library/} and abbreviated as -\const{lib}. - -The schema defines three root classes: lib:Namespace, lib:Ontology and -lib:Virtual, which we describe below. - -\begin{description} - \resitem{lib:Ontology} -This is a subclass of owl:Ontology. It has two subclasses, lib:Schema -and lib:Instances. These three classes are currently processed equally. -The following properties are recognised on lib:Ontology: - - \begin{description} - \resitem {dc:title} -Title of the ontology. Displayed by rdf_list_library/0. - \resitem {owl:versionInfo} -Version of the ontology. Displayed by rdf_list_library/0. - \resitem {owl:imports} -Ontologies imported. If rdf_load_library/2 is used to load this -ontology, the ontologies referenced here are loaded as well. There -are two subProperties: lib:schema and lib:instances with the obvious -meaning. - \resitem {owl:providesNamespace} -Informally, providing a namespace is defined as providing subjects that -resides in the namespace. - \resitem {owl:usesNamespace} -Informally, using a namespace is defined as providing objects that -reside in the namespace. - \resitem {owl:source} -Defines the named graph into which the resource is loaded. If this -ends in a \const{/}, the basename of each loaded file is appended to -the given source. Defaults to the URL the RDF is loaded from. - \resitem {owl:baseURI} -Defines the base for processing the RDF data. If not provided this -defaults to the named graph, which in turn defaults to the URL the -RDF is loaded from. - \resitem {owl:blankNodes} -One of \const{share} or \const{noshare}. A SWI-Prolog RDF library -extension that allows for sharing equivalent blank nodes. Sharing -is the default. - \end{description} - - \resitem{lib:Virtual} -Virtual ontologies do not refer to an RDF resource themselves. They -only import other resources. For example the W3C WordNet manifest -defines \const{wn-basic} and \const{wn-full} as virtual resources. -The lib:Virtual resource is used as a second rdf:type: - -\begin{code} -<wn-basic> - a lib:Ontology ; - a lib:Virtual ; - ... -\end{code} - - \resitem{lib:Namespace} -Defines a URL to be a namespace. The definition provides the preferred -mnemonic and can be referenced in the lib:providesNamespace and -lib:usesNamespace properties. The rdf_load_library/2 predicates -registers encountered namespace mnemonics with rdf-db using -rdf_register_ns/2. Typically namespace declarations use @{prefix} -declarations. E.g.\ - -\begin{code} -@prefix lib: <http://www.swi-prolog.org/rdf/library/> . -@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . - -:rdfs - a lib:Namespace ; - lib:mnemonic "rdfs" ; - lib:namespace rdfs: . -\end{code} -\end{description} - - -\subsubsection{Finding manifest files} - -The initial manifest file(s) are loaded into the system using -rdf_attach_library/1. - -\begin{description} - \predicate{rdf_attach_library}{1}{+FileOrDirectory} -Load meta-data on RDF repositories from \arg{FileOrDirectory}. If the -argument is a directory, this directory is processed recursively and -each file named \file{Manifest.ttl} or \file{Manifest.rdf} is loaded. - -Declared namespaces are added to the rdf-db namespace list. Encountered -ontologies are added to a private database of -\file{rdf_list_library.pl}.% - \footnote{We could have used the global RDF store, but - decided against that to avoid poluting the triple - space.} -Each ontology is given an \jargon{identifier}, derived from the -basename of the URL without the extension. This, using the -declaration below, the identifier of the declared ontology is -\const{wn-basic}. - -\begin{code} -<wn-basic> - a lib:Ontology ; - a lib:Virtual ; - dc:title "Basic WordNet" ; - ... -\end{code} - - \predicate{rdf_list_library}{0}{} -List the available resources in the library. Currently only lists -resources that have a dc:title property. See \secref{usage} for -an example. -\end{description} - -It is possible for the initial set of manifests to refer to RDF files -that are not covered by a manifest. If such a reference is encountered -while loading or listing a library, the library manager will look for a -manifest file in the directory holding the referenced RDF file and load -this manifest. If a manifest is found that covers the referenced file, -the directives found in the manifest will be followed. Otherwise the RDF -resource is simply loaded using the current defaults. - -Further exploration of the library is achieved using rdf_list_library/1 -or rdf_list_library/2: - -\begin{description} - \predicate{rdf_list_library}{1}{+Id} -Same as \term{rdf_list_library}{Id, []}. - - \predicate{rdf_list_library}{2}{+Id, +Options} -Lists the resources that will be loaded if \arg{Id} is handed to -rdf_load_library/2. See rdf_attach_library/2 for how ontology -identifiers are generated. In addition it checks the existence of each -resource to help debugging library dependencies. Before doing its work, -rdf_list_library/2 reloads manifests that have changed since they were -loaded the last time. For HTTP resources it uses the HEAD method to -verify existence and last modification time of resources. - - \predicate{rdf_load_library}{2}{+Id, +Options} -Load the given library. First rdf_load_library/2 will establish what -resources need to be loaded and whether all resources exist. Than it -will load the resources. -\end{description} - - -\subsection{Usage scenarios} -\label{sec:usage} - -Typically, a project will use a single file using the same format as a -manifest file that defines alternative configurations that can be -loaded. This file is loaded at program startup using -rdf_attach_library/1. Users can now list the available libraries -using rdf_list_libraries/0 and rdf_list_libraries/1: - -\begin{code} -1 ?- rdf_list_library. -ec-core-vocabularies E-Culture core vocabularies -ec-all-vocabularies All E-Culture vocabularies -ec-hacks Specific hacks -ec-mappings E-Culture ontology mappings -ec-core-collections E-Culture core collections -ec-all-collections E-Culture all collections -ec-medium E-Culture medium sized data (artchive+aria) -ec-all E-Culture all data -\end{code} - -Now we can list a specific category using rdf_list_library/1. Note this -loads two additional manifests referenced by resources encountered in -\const{ec-mappings}. If a resource does not exist is is flagged using -\const{[NOT FOUND]}. - -\begin{code} -2 ?- rdf_list_library('ec-mappings'). -% Loaded RDF manifest /home/jan/src/eculture/vocabularies/mappings/Manifest.ttl -% Loaded RDF manifest /home/jan/src/eculture/collections/aul/Manifest.ttl -<file:///home/jan/src/eculture/src/server/ec-mappings> -. <file:///home/jan/src/eculture/vocabularies/mappings/mappings> -. . <file:///home/jan/src/eculture/vocabularies/mappings/interface> -. . . file:///home/jan/src/eculture/vocabularies/mappings/interface_class_mapping.ttl -. . . file:///home/jan/src/eculture/vocabularies/mappings/interface_property_mapping.ttl -. . <file:///home/jan/src/eculture/vocabularies/mappings/properties> -. . . file:///home/jan/src/eculture/vocabularies/mappings/ethnographic_property_mapping.ttl -. . . file:///home/jan/src/eculture/vocabularies/mappings/eculture_properties.ttl -. . . file:///home/jan/src/eculture/vocabularies/mappings/eculture_property_semantics.ttl -. . <file:///home/jan/src/eculture/vocabularies/mappings/situations> -. . . file:///home/jan/src/eculture/vocabularies/mappings/eculture_situations.ttl -. <file:///home/jan/src/eculture/collections/aul/aul> -. . file:///home/jan/src/eculture/collections/aul/aul.rdfs -. . file:///home/jan/src/eculture/collections/aul/aul.rdf -. . file:///home/jan/src/eculture/collections/aul/aul9styles.rdf -. . file:///home/jan/src/eculture/collections/aul/extractedperiods.rdf -. . file:///home/jan/src/eculture/collections/aul/manual-periods.rdf -\end{code} - - -\subsubsection{Referencing resources} - -Resources and manifests are located either on the local filesystem or on -a network resource. The initial manifest can also be loaded from a file -or a URL. This defines the initial \jargon{base URL} of the document. -The base URL can be overruled using the Turtle @{base} directive. Other -documents can be referenced relative to this base URL by exploiting -Turtle's URI expansion rules. Turtle resources can be specified in three -ways, as absolute URLs (e.g.\ -\verb$<http://www.example.com/rdf/ontology.rdf$>), as relative URL to -the base (e.g.\ \verb$<../rdf/ontology.rdf$>) or following a -\jargon{prefix} (e.g.\ prefix:ontology). - -The prefix notation is powerful as we can define multiple of them and -define resources relative to them. Unfortunately, prefixes can only be -defined as absolute URLs or URLs relative to the base URL. Notably, they -cannot be defined relative to other prefixes. In addition, a prefix can -only be followed by a Qname, which excludes \verb$.$ and \verb$/$. - -Easily relocatable manifests must define all resources relative to the -base URL. Relocation is automatical if the manifest remains in the same -hierarchy as the resources it references. If the manifest is copied -elsewhere (i.e.\ for creating a local version) it can use @{base} to -refer to the resource hierarchy. We can point to directories holding -manifest files using @{prefix} declarations. There, we can reference -\jargon{Virtual} resources using prefix:name. Here is an example, were -we first give some line from the initial manifest followed by the -definition of the virtual RDFS resource. - -\begin{code} -@base <http://gollem.science.uva.nl/e-culture/rdf/> . - -@prefix base: <base_ontologies/> . - -<ec-core-vocabularies> - a lib:Ontology ; - a lib:Virtual ; - dc:title "E-Culture core vocabularies" ; - owl:imports - base:rdfs , - base:owl , - base:dc , - base:vra , - ... -\end{code} - -\begin{code} -<rdfs> - a lib:Schema ; - a lib:Virtual ; - rdfs:comment "RDF Schema" ; - lib:source rdfs: ; - lib:providesNamespace :rdfs ; - lib:schema <rdfs.rdfs> . -\end{code} - -\subsection{Putting it all together} - -In this section we provide skeleton code for filling the RDF database -from a password protected HTTP repository. The first line loads the -application. Next we include modules that enable us to manage the RDF -library, RDF database caching and HTTP connections. Then we setup the -HTTP authetication, enable caching of processed RDF files and load the -initial manifest. Finally load_data/0 loads all our RDF data. - -\begin{code} -:- use_module(server). - -:- use_module(library(http/http_open)). -:- use_module(library(semweb/rdf_library)). -:- use_module(library(semweb/rdf_cache)). - -:- http_set_authorization('http://www.example.org/rdf', - basic(john, secret)). - -:- rdf_set_cache_options([ global_directory('RDF-Cache'), - create_global_directory(true) - ]). - - -:- rdf_attach_library('http://www.example.org/rdf/Manifest.ttl'). - -%% load_data -% -% Load our RDF data - -load_data :- - rdf_load_library('all'). -\end{code} - -\subsection{Example: A Manifest for W3C WordNet} -\label{sec:w3cmanifest} - -The manifest below allows for loading WordNet in the two predefined -versions using one of - -\begin{code} -?- rdf_load_library('wn-basic', []). -?- rdf_load_library('wn-full', []). -\end{code} - - - -\begin{code} -@prefix lib: <http://www.swi-prolog.org/rdf/library/> . -@prefix owl: <http://www.w3.org/2002/07/owl#> . -@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . -@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . -@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . -@prefix dc: <http://purl.org/dc/elements/1.1/> . -@prefix wn20schema: <http://www.w3.org/2006/03/wn/wn20/schema/> . -@prefix wn20instances: <http://www.w3.org/2006/03/wn/wn20/instances/> . - -# Source from http://www.cs.vu.nl/~mark/pub/wntestrdf.zip - -:wn20instances - a lib:Namespace ; - lib:mnemonic "wn20instances" ; - lib:namespace wn20instances: . - -:wn20schema - a lib:Namespace ; - lib:mnemonic "wn20schema" ; - lib:namespace wn20schema: . - -:dc - a lib:Namespace ; - lib:mnemonic "dc" ; - lib:namespace dc: . - -:owl - a lib:Namespace ; - lib:mnemonic "owl" ; - lib:namespace owl: . - -# WordNet - -<wn-common> - a lib:Instances ; - a lib:Virtual ; - rdfs:comment "Common files between full and basic version of WordNet" ; - lib:source wn20instances: ; - lib:instances <wordnet-attribute.rdf> ; - lib:instances <wordnet-causes.rdf> ; - lib:instances <wordnet-classifiedby.rdf> ; - lib:instances <wordnet-entailment.rdf> ; - lib:instances <wordnet-frame.rdf> ; - lib:instances <wordnet-glossary.rdf> ; - lib:instances <wordnet-hyponym.rdf> ; - lib:instances <wordnet-membermeronym.rdf> ; - lib:instances <wordnet-partmeronym.rdf> ; - lib:instances <wordnet-sameverbgroupas.rdf> ; - lib:instances <wordnet-similarity.rdf> ; - lib:instances <wordnet-synset.rdf> ; - lib:instances <wordnet-substancemeronym.rdf> . - -<wnbasic.rdfs> - a lib:Schema ; - lib:source wn20schema: ; - lib:usesNamespace :owl . - -<wn-basic> - a lib:Ontology ; - a lib:Virtual ; - dc:title "Basic WordNet" ; - owl:versionInfo "2.0" ; - rdfs:comment "Light version of W3C WordNet" ; - lib:schema <wnbasic.rdfs> ; - lib:source wn20instances: ; - lib:instances <wn-common> ; - lib:instances <wordnet-senselabels.rdf> ; - lib:providesNamespace :wn20schema ; - lib:providesNamespace :wn20instances . - -<wnfull.rdfs> - a lib:Schema ; - lib:source wn20schema: ; - lib:usesNamespace :owl . - -<wn-full> - a lib:Ontology ; - a lib:Virtual ; - dc:title "Full WordNet" ; - owl:versionInfo "2.0" ; - rdfs:comment "Full version of W3C WordNet" ; - lib:schema <full/wnfull.rdfs> ; - lib:source wn20instances: ; - lib:instances <wn-common> ; - lib:instances <wordnet-antonym.rdf> ; - lib:instances <wordnet-derivationallyrelated.rdf> ; - lib:instances <wordnet-participleof.rdf> ; - lib:instances <wordnet-pertainsto.rdf> ; - lib:instances <wordnet-seealso.rdf> ; - lib:instances <wordnet-wordsensesandwords.rdf> ; - lib:providesNamespace :wn20schema ; - lib:providesNamespace :wn20instances . -\end{code} - -%% diff --git a/packages/semweb/rdfs.pl b/packages/semweb/rdfs.pl deleted file mode 100644 index 9afa58e63..000000000 --- a/packages/semweb/rdfs.pl +++ /dev/null @@ -1,469 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog - - Author: Jan Wielemaker - E-mail: wielemak@science.uva.nl - WWW: http://www.swi-prolog.org - Copyright (C): 1985-2005, University of Amsterdam - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - As a special exception, if you link this library with other files, - compiled with a Free Software compiler, to produce an executable, this - library does not by itself cause the resulting executable to be covered - by the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -:- module(rdfs, - [ rdfs_subproperty_of/2, % ?SubProperties, ?Property - rdfs_subclass_of/2, % ?SubClass, ?Class - rdfs_class_property/2, % +Class, ?Property - rdfs_individual_of/2, % ?Resource, ?Class - - rdfs_label/2, % ?Resource, ?Label - rdfs_label/3, % ?Resource, ?Language, ?Label - rdfs_ns_label/2, % +Resource, -Label - rdfs_ns_label/3, % +Resource, ?Label, -Label - - rdfs_member/2, % ?Object, +Set - rdfs_list_to_prolog_list/2, % +Set, -List - rdfs_assert_list/3, % +List, -Resource, +DB - rdfs_assert_list/2, % +List, -Resource - - rdfs_find/5 % +String, +Dom, +Props, +Method, -Subj - ]). -:- use_module(library(debug)). -:- use_module(library(rdf)). -:- use_module(library(lists)). -:- use_module(rdf_db). - - -/** <module> RDFS handling - -This module provides various primitives for more high-level handling of -RDF models from an RDFS viewpoint. Note that there exist two approaches -for languages on top of RDF: - - * Provide new predicates according to the concept of the high - level language (used in this module) - - * Extend rdf/3 relation with triples _implied_ by the high-level - semantics. This approach is taken by the SeRQL system. -*/ - - /******************************* - * EXPANSION * - *******************************/ - -:- rdf_meta - rdfs_subproperty_of(r,r), - rdfs_subclass_of(r,r), - rdfs_class_property(r,r), - rdfs_individual_of(r,r), - rdfs_label(r,-). - - - /******************************* - * PROPERTY HIERARCHY * - *******************************/ - -%% rdfs_subproperty_of(+SubProperty, ?Property) is nondet. -%% rdfs_subproperty_of(?SubProperty, +Property) is nondet. -% -% Query the property hierarchy. - -rdfs_subproperty_of(SubProperty, Property) :- - rdf_reachable(SubProperty, rdfs:subPropertyOf, Property). - - - /******************************* - * CLASS HIERARCHY * - *******************************/ - -%% rdfs_subclass_of(+Class, ?Super) is nondet. -%% rdfs_subclass_of(?Class, +Super) is nondet. -% -% Generate sub/super classes. rdf_reachable/3 considers the -% rdfs:subPropertyOf relation as well as cycles. Note that by -% definition all classes are subclass of rdfs:Resource, a case -% which is dealt with by the 1st and 3th clauses :-( -% -% According to production 2.4 "rdfs:Datatype", Each instance of -% rdfs:Datatype is a subclass of rdfs:Literal. - -rdfs_subclass_of(Class, Super) :- - rdf_equal(rdfs:'Resource', Resource), - Super == Resource, !, - ( nonvar(Class) - -> true % must check for being a class? - ; rdfs_individual_of(Class, rdfs:'Class') - ). -rdfs_subclass_of(Class, Super) :- - rdf_reachable(Class, rdfs:subClassOf, Super). -rdfs_subclass_of(Class, Super) :- - nonvar(Class), - var(Super), - \+ rdf_reachable(Class, rdfs:subClassOf, rdfs:'Resource'), - rdfs_individual_of(Class, rdfs:'Class'), - rdf_equal(Super, rdfs:'Resource'). -rdfs_subclass_of(Class, Super) :- % production 2.4 - ( nonvar(Class) - -> rdf_has(Class, rdf:type, CType), - rdf_reachable(CType, rdfs:subClassOf, rdfs:'Datatype'), - \+ rdf_reachable(Class, rdfs:subClassOf, rdfs:'Literal'), - rdf_equal(Super, rdfs:'Literal') - ; nonvar(Super) - -> rdf_reachable(Super, rdfs:subClassOf, rdfs:'Literal'), - rdfs_individual_of(Class, rdfs:'Datatype') - ). - - - /******************************* - * INDIVIDUALS * - *******************************/ - -%% rdfs_individual_of(+Resource, +Class) is semidet. -%% rdfs_individual_of(+Resource, -Class) is nondet. -%% rdfs_individual_of(-Resource, +Class) is nondet. -% -% Generate resources belonging to a class or classes a resource -% belongs to. We assume everything at the `object' end of a triple -% is a class. A validator should confirm this property. -% -% rdfs_individual_of(+, -) does not exploit domain and range -% properties, deriving that if rdf(R, P, _) is present R must -% satisfy the domain of P (and similar for range). -% -% There are a few hacks: -% -% * Any resource is an individual of rdfs:Resource -% * literal(_) is an individual of rdfs:Literal - -rdfs_individual_of(Resource, Class) :- - nonvar(Resource), !, - ( nonvar(Class) - -> ( rdfs_individual_of_r_c(Resource, Class) - -> true - ) - ; rdfs_individual_of_r_c(Resource, Class) - ). -rdfs_individual_of(Resource, Class) :- - nonvar(Class), !, - ( rdf_equal(Class, rdfs:'Resource') - -> rdf_subject(Resource) - ; rdfs_subclass_of(SubClass, Class), - rdf_has(Resource, rdf:type, SubClass) - ). -rdfs_individual_of(_Resource, _Class) :- - throw(error(instantiation_error, _)). - -rdfs_individual_of_r_c(literal(_), Class) :- !, - rdfs_subclass_of(Class, rdfs:'Literal'). -rdfs_individual_of_r_c(Resource, Class) :- - rdf_has(Resource, rdf:type, MyClass), - rdfs_subclass_of(MyClass, Class). -rdfs_individual_of_r_c(_, Class) :- - rdf_equal(Class, rdfs:'Resource'). - - -%% rdfs_label(+Resource, -Label). -%% rdfs_label(-Resource, +Label). -% -% Convert between class and label. If the label is generated from -% the resource the it uses both rdf:label and its sub-properties, -% but labels registered with rdf:label are returned first. - -rdfs_label(Resource, Label) :- - rdfs_label(Resource, _, Label). - -%% rdfs_label(+Resource, ?Lang, -Label) is multi. -%% rdfs_label(+Resource, ?Lang, +Label) is semidet. -%% rdfs_label(-Resource, ?Lang, ?Label) is nondet. -% -% Resource has Label in Lang. If Resource is nonvar calls -% take_label/3 which is guaranteed to succeed label. - -rdfs_label(Resource, Lang, Label) :- - nonvar(Resource), !, - take_label(Resource, Lang, Label). -rdfs_label(Resource, Lang, Label) :- - rdf_has(Resource, rdfs:label, literal(lang(Lang, Label))). - -%% rdfs_ns_label(+Resource, -Label) is multi. -%% rdfs_ns_label(+Resource, ?Lang, -Label) is multi. -% -% Present label with namespace indication. This predicate is -% indented to provide meaningful short names applicable to -% ontology maintainers. Note that this predicate is non-deterministic -% if the resource has multiple rdfs:label properties - -rdfs_ns_label(Resource, Label) :- - rdfs_ns_label(Resource, _, Label). - -rdfs_ns_label(Resource, Lang, Label) :- - rdfs_label(Resource, Lang, Label0), - ( rdf_global_id(NS:_, Resource), - Label0 \== '' - -> atomic_list_concat([NS, Label0], :, Label) - ; \+ rdf_has(Resource, rdfs:label, _) - -> Label = Resource - ; member(Sep, [#,/]), - sub_atom(Resource, B, L, A, Sep), - sub_atom(Resource, _, A, 0, Frag), - \+ sub_atom(Frag, _, _, _, Sep) - -> Len is B+L, - sub_atom(Resource, 0, Len, _, NS), - atomic_list_concat([NS, Label0], :, Label) - ; Label = Label0 - ). - - -%% take_label(+Resource, ?Lang, -Label) is multi. -% -% Get the label to use for a resource in the give Language. First -% tries label_of/3. If this fails, break the Resource over # or / -% and if all fails, unify Label with Resource. - -take_label(Resource, Lang, Label) :- - ( label_of(Resource, Lang, Label) - *-> true - ; after_char(Resource, '#', Local) - -> Label = Local - ; after_char(Resource, '/', Local) - -> Label = Local - ; Label = Resource - ). - -after_char(Atom, Char, Rest) :- - State = last(-), - ( sub_atom(Atom, _, _, L, Char), - nb_setarg(1, State, L), - fail - ; arg(1, State, L), - L \== (-) - ), - sub_atom(Atom, _, L, 0, Rest). - - -%% label_of(+Resource, ?Lang, ?Label) is nondet. -% -% True if rdf_has(Resource, rdfs:label, literal(Lang, Label)) is -% true, but guaranteed to generate rdfs:label before any -% subproperty thereof. - -label_of(Resource, Lang, Label) :- - rdf(Resource, rdfs:label, literal(lang(Lang, Label))). -label_of(Resource, Lang, Label) :- - rdf_equal(rdfs:label, LabelP), - rdf_has(Resource, LabelP, literal(lang(Lang, Label)), P), - P \== LabelP. - -%% rdfs_class_property(+Class, ?Property) -% -% Enumerate the properties in the domain of Class. - -rdfs_class_property(Class, Property) :- - rdfs_individual_of(Property, rdf:'Property'), - rdf_has(Property, rdfs:domain, Domain), - rdfs_subclass_of(Class, Domain). - - - /******************************* - * COLLECTIONS * - *******************************/ - -%% rdfs_member(?Element, +Set) -% -% As Prolog member on sets. Operates both on attributes parsed as -% parseType="Collection" as well as on Bag, Set and Alt. - -rdfs_member(Element, Set) :- - rdf_has(Set, rdf:first, _), - rdfs_collection_member(Element, Set). -rdfs_member(Element, Set) :- - rdfs_individual_of(Set, rdfs:'Container'), !, - ( nonvar(Element) - -> rdf(Set, Predicate, Element), - rdf_member_property(Predicate, _N) - ; between(1, infinite, N), - rdf_member_property(Prop, N), - ( rdf(Set, Prop, Member) - -> Member = Element - ; !, fail - ) - ). - -rdfs_collection_member(Element, Set) :- - rdf_has(Set, rdf:first, Element). -rdfs_collection_member(Element, Set) :- - rdf_has(Set, rdf:rest, Tail), !, - rdfs_collection_member(Element, Tail). - - -%% rdfs_list_to_prolog_list(+RDFSList, -PrologList) -% -% Convert ann RDFS list (result from parseType=Collection) into a -% Prolog list of elements. - -rdfs_list_to_prolog_list(Set, []) :- - rdf_equal(Set, rdf:nil), !. -rdfs_list_to_prolog_list(Set, [H|T]) :- - rdf_has(Set, rdf:first, H), - rdf_has(Set, rdf:rest, Tail), !, - rdfs_list_to_prolog_list(Tail, T). - - -%% rdfs_assert_list(+Resources, -List) is det. -%% rdfs_assert_list(+Resources, -List, +DB) is det. -% -% Create an RDF list from the given Resources. - -rdfs_assert_list(Resources, List) :- - rdfs_assert_list(Resources, List, user). - -rdfs_assert_list([], Nil, _) :- - rdf_equal(rdf:nil, Nil). -rdfs_assert_list([H|T], List, DB) :- - rdfs_assert_list(T, Tail, DB), - rdf_bnode(List), - rdf_assert(List, rdf:rest, Tail, DB), - rdf_assert(List, rdf:first, H, DB), - rdf_assert(List, rdf:type, rdf:'List', DB). - - - /******************************* - * SEARCH IN HIERARCHY * - *******************************/ - -%% rdfs_find(+String, +Domain, ?Properties, +Method, -Subject) -% -% Search all classes below Domain for a literal property with -% that matches String. Method is one of -% -% * substring -% * word -% * prefix -% * exact -% -% domain is defined by owl_satisfy from owl.pl -% -% Note that the rdfs:label field is handled by rdfs_label/2, -% making the URI-ref fragment name the last resort to determine -% the label. - -rdfs_find(String, Domain, Fields, Method, Subject) :- - var(Fields), !, - For =.. [Method,String], - rdf_has(Subject, Field, literal(For, _)), - owl_satisfies(Domain, Subject), - Fields = [Field]. % report where we found it. -rdfs_find(String, Domain, Fields, Method, Subject) :- - globalise_list(Fields, GlobalFields), - For =.. [Method,String], - member(Field, GlobalFields), - ( Field == resource - -> rdf_subject(Subject), - rdf_match_label(Method, String, Subject) - ; rdf_has(Subject, Field, literal(For, _)) - ), - owl_satisfies(Domain, Subject). - -owl_satisfies(Domain, _) :- - rdf_equal(rdfs:'Resource', Domain), !. - % Descriptions -owl_satisfies(class(Domain), Resource) :- !, - ( rdf_equal(Domain, rdfs:'Resource') - -> true - ; rdfs_subclass_of(Resource, Domain) - ). -owl_satisfies(union_of(Domains), Resource) :- !, - member(Domain, Domains), - owl_satisfies(Domain, Resource), !. -owl_satisfies(intersection_of(Domains), Resource) :- !, - in_all_domains(Domains, Resource). -owl_satisfies(complement_of(Domain), Resource) :- !, - \+ owl_satisfies(Domain, Resource). -owl_satisfies(one_of(List), Resource) :- !, - memberchk(Resource, List). - % Restrictions -owl_satisfies(all_values_from(Domain), Resource) :- - ( rdf_equal(Domain, rdfs:'Resource') - -> true - ; rdfs_individual_of(Resource, Domain) - ), !. -owl_satisfies(some_values_from(_Domain), _Resource) :- !. -owl_satisfies(has_value(Value), Resource) :- - rdf_equal(Value, Resource). - - -in_all_domains([], _). -in_all_domains([H|T], Resource) :- - owl_satisfies(H, Resource), - in_all_domains(T, Resource). - -globalise_list([], []) :- !. -globalise_list([H0|T0], [H|T]) :- !, - globalise_list(H0, H), - globalise_list(T0, T). -globalise_list(X, G) :- - rdf_global_id(X, G). - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -TOP-DOWN - - -rdfs_find(String, Domain, Fields, Method, Subject) :- - globalise_list(Fields, GlobalFields), - generate_domain(Domain, Subject), - member(Field, GlobalFields), - ( rdf_equal(Field, rdfs:label) - -> rdfs_label(Subject, Arg) - ; rdf_has(Subject, Field, literal(Arg)) - ), - rdf_match_label(Method, String, Arg). - -%% generate_domain(+Domain, -Resource) -% -% Generate all resources that satisfy some a domain specification. - -generate_domain(All, Subject) :- - rdf_equal(All, rdfs:'Resource'), !, - rdf_subject(Subject). -generate_domain(class(Class), Subject) :- !, - rdfs_subclass_of(Subject, Class). -generate_domain(all_values_from(Class), Individual) :- - ( rdf_equal(Class, rdfs:'Resource') - -> rdf_subject(Individual) % this is OWL-full - ; rdfs_individual_of(Individual, Class) - ). -generate_domain(some_values_from(Class), Individual) :- % Actually this is - rdfs_individual_of(Individual, Class). % anything -generate_domain(union_of(Domains), Individual) :- - member(Domain, Domains), - generate_domain(Domain, Individual). -generate_domain(intersection_of(Domains), Individual) :- - in_all_domains(Domains, Individual). -generate_domain(one_of(Individuals), Individual) :- - member(Individual, Individuals). - -in_all_domains([], _). -in_all_domains([H|T], Resource) :- - generate_domain(H, Resource), - in_all_domains(T, Resource). -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - diff --git a/packages/semweb/rdfs.rdfs b/packages/semweb/rdfs.rdfs deleted file mode 100644 index bd3f77e9d..000000000 --- a/packages/semweb/rdfs.rdfs +++ /dev/null @@ -1,263 +0,0 @@ -<?xml version='1.0' encoding='UTF-8'?> -<!DOCTYPE rdf:RDF [ - <!ENTITY rdf 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'> - <!ENTITY rdfs 'http://www.w3.org/2000/01/rdf-schema#'> -]> - -<rdf:RDF - xmlns:rdf="&rdf;" - xmlns:rdfs="&rdfs;" -> - -<rdfs:Class rdf:about="&rdfs;Resource" - rdfs:comment="The class resource, everything."> - <rdfs:label>Resource</rdfs:label> - <rdfs:label xml:lang="en">Resource</rdfs:label> - <rdfs:isDefinedBy rdf:resource="&rdfs;"/> -</rdfs:Class> - -<rdfs:Class rdf:about="&rdfs;Class"> - <rdfs:comment>The class of classes.</rdfs:comment> - <rdfs:comment>The concept of Class</rdfs:comment> - <rdfs:label>Class</rdfs:label> - <rdfs:label xml:lang="en">Class</rdfs:label> - <rdfs:isDefinedBy rdf:resource="&rdfs;"/> - <rdfs:subClassOf rdf:resource="&rdfs;Resource"/> -</rdfs:Class> - -<rdf:Property rdf:about="&rdfs;subClassOf"> - <rdfs:comment>Indicates membership of a class</rdfs:comment> - <rdfs:comment>The subject is a subclass of a class.</rdfs:comment> - <rdfs:label>subClassOf</rdfs:label> - <rdfs:label xml:lang="en">subClassOf</rdfs:label> - <rdfs:domain rdf:resource="&rdfs;Class"/> - <rdfs:isDefinedBy rdf:resource="&rdfs;"/> - <rdfs:range rdf:resource="&rdfs;Class"/> -</rdf:Property> - -<rdf:Property rdf:about="&rdfs;subPropertyOf"> - <rdfs:comment>Indicates specialization of properties</rdfs:comment> - <rdfs:comment>The subject is a subproperty of a property.</rdfs:comment> - <rdfs:label>subPropertyOf</rdfs:label> - <rdfs:label xml:lang="en">subPropertyOf</rdfs:label> - <rdfs:domain rdf:resource="&rdf;Property"/> - <rdfs:isDefinedBy rdf:resource="&rdfs;"/> - <rdfs:range rdf:resource="&rdf;Property"/> -</rdf:Property> - -<rdf:Property rdf:about="&rdfs;comment"> - <rdfs:comment>A description of the subject resource.</rdfs:comment> - <rdfs:comment>Use this for descriptions</rdfs:comment> - <rdfs:label>comment</rdfs:label> - <rdfs:label xml:lang="en">comment</rdfs:label> - <rdfs:domain rdf:resource="&rdfs;Resource"/> - <rdfs:isDefinedBy rdf:resource="&rdfs;"/> - <rdfs:range rdf:resource="&rdfs;Literal"/> -</rdf:Property> - -<rdf:Property rdf:about="&rdfs;label"> - <rdfs:comment>A human-readable name for the subject.</rdfs:comment> - <rdfs:comment>Provides a human-readable version of a resource name.</rdfs:comment> - <rdfs:label>label</rdfs:label> - <rdfs:label xml:lang="en">label</rdfs:label> - <rdfs:domain rdf:resource="&rdfs;Resource"/> - <rdfs:isDefinedBy rdf:resource="&rdfs;"/> - <rdfs:range rdf:resource="&rdfs;Literal"/> -</rdf:Property> - -<rdf:Property rdf:about="&rdfs;domain"> - <rdfs:comment>A domain class for a property type</rdfs:comment> - <rdfs:comment>A domain of the subject property.</rdfs:comment> - <rdfs:label>domain</rdfs:label> - <rdfs:label xml:lang="en">domain</rdfs:label> - <rdfs:domain rdf:resource="&rdf;Property"/> - <rdfs:isDefinedBy rdf:resource="&rdfs;"/> - <rdfs:range rdf:resource="&rdfs;Class"/> -</rdf:Property> - -<rdf:Property rdf:about="&rdfs;range"> - <rdfs:comment>A range class for a property type</rdfs:comment> - <rdfs:comment>A range of the subject property.</rdfs:comment> - <rdfs:label>range</rdfs:label> - <rdfs:label xml:lang="en">range</rdfs:label> - <rdfs:domain rdf:resource="&rdf;Property"/> - <rdfs:isDefinedBy rdf:resource="&rdfs;"/> - <rdfs:range rdf:resource="&rdfs;Class"/> -</rdf:Property> - -<rdf:Property rdf:about="&rdfs;seeAlso"> - <rdfs:comment>A resource that provides information about the subject resource</rdfs:comment> - <rdfs:comment>Further information about the subject resource.</rdfs:comment> - <rdfs:label>seeAlso</rdfs:label> - <rdfs:label xml:lang="en">seeAlso</rdfs:label> - <rdfs:domain rdf:resource="&rdfs;Resource"/> - <rdfs:isDefinedBy rdf:resource="&rdfs;"/> - <rdfs:range rdf:resource="&rdfs;Resource"/> -</rdf:Property> - -<rdf:Property rdf:about="&rdfs;isDefinedBy"> - <rdfs:comment>Indicates the namespace of a resource</rdfs:comment> - <rdfs:comment>The defininition of the subject resource.</rdfs:comment> - <rdfs:label>isDefinedBy</rdfs:label> - <rdfs:label xml:lang="en">isDefinedBy</rdfs:label> - <rdfs:domain rdf:resource="&rdfs;Resource"/> - <rdfs:isDefinedBy rdf:resource="&rdfs;"/> - <rdfs:range rdf:resource="&rdfs;Resource"/> - <rdfs:subPropertyOf rdf:resource="&rdfs;seeAlso"/> -</rdf:Property> - -<rdfs:Class rdf:about="&rdfs;Literal"> - <rdfs:comment>The class of literal values, eg. textual strings and integers.</rdfs:comment> - <rdfs:comment>This represents the set of atomic values, eg. textual strings.</rdfs:comment> - <rdfs:label>Literal</rdfs:label> - <rdfs:label xml:lang="en">Literal</rdfs:label> - <rdfs:isDefinedBy rdf:resource="&rdfs;"/> - <rdfs:subClassOf rdf:resource="&rdfs;Resource"/> -</rdfs:Class> - -<rdfs:Class rdf:about="&rdfs;Container"> - <rdfs:comment>The class of RDF containers.</rdfs:comment> - <rdfs:comment>This represents the set Containers.</rdfs:comment> - <rdfs:label>Container</rdfs:label> - <rdfs:label xml:lang="en">Container</rdfs:label> - <rdfs:isDefinedBy rdf:resource="&rdfs;"/> - <rdfs:subClassOf rdf:resource="&rdfs;Resource"/> -</rdfs:Class> - -<rdfs:Class rdf:about="&rdfs;ContainerMembershipProperty"> - <rdfs:comment>The class of container membership properties, rdf:_1, rdf:_2, ..., - all of which are sub-properties of 'member'.</rdfs:comment> - <rdfs:comment>The container membership properties, rdf:1, rdf:2, ..., all of which are sub-properties of 'member'.</rdfs:comment> - <rdfs:label>ContainerMembershipProperty</rdfs:label> - <rdfs:label xml:lang="en">ContainerMembershipProperty</rdfs:label> - <rdfs:isDefinedBy rdf:resource="&rdfs;"/> - <rdfs:subClassOf rdf:resource="&rdf;Property"/> -</rdfs:Class> - -<rdf:Property rdf:about="&rdfs;member"> - <rdfs:comment>A member of the subject resource.</rdfs:comment> - <rdfs:comment>a member of a container</rdfs:comment> - <rdfs:domain rdf:resource="&rdfs;Container"/> - <rdfs:domain rdf:resource="&rdfs;Resource"/> - <rdfs:label>member</rdfs:label> - <rdfs:label xml:lang="en">member</rdfs:label> - <rdfs:isDefinedBy rdf:resource="&rdfs;"/> - <rdfs:range rdf:resource="&rdfs;Resource"/> -</rdf:Property> - -<rdfs:Class rdf:about="&rdfs;Datatype"> - <rdfs:comment>The class of RDF datatypes.</rdfs:comment> - <rdfs:comment xml:lang="en">The class of datatypes.</rdfs:comment> - <rdfs:label>Datatype</rdfs:label> - <rdfs:label xml:lang="en">Datatype</rdfs:label> - <rdfs:isDefinedBy rdf:resource="&rdfs;"/> - <rdfs:subClassOf rdf:resource="&rdfs;Class"/> -</rdfs:Class> - -<rdf:Property rdf:about="&rdf;type" - rdfs:comment="Indicates membership of a class"> - <rdfs:domain rdf:resource="&rdfs;Resource"/> - <rdfs:isDefinedBy rdf:resource="&rdf;"/> - <rdfs:label xml:lang="en">type</rdfs:label> - <rdfs:range rdf:resource="&rdfs;Class"/> -</rdf:Property> - -<rdfs:Class rdf:about="&rdf;Property" - rdfs:comment="The concept of a property."> - <rdfs:isDefinedBy rdf:resource="&rdf;"/> - <rdfs:label xml:lang="en">Property</rdfs:label> - <rdfs:subClassOf rdf:resource="&rdfs;Resource"/> -</rdfs:Class> - -<rdfs:Class rdf:about="&rdf;Statement" - rdfs:comment="The class of RDF statements."> - <rdfs:isDefinedBy rdf:resource="&rdf;"/> - <rdfs:label xml:lang="en">Statement</rdfs:label> - <rdfs:subClassOf rdf:resource="&rdfs;Resource"/> -</rdfs:Class> - -<rdf:Property rdf:about="&rdf;subject" - rdfs:comment="The subject of an RDF statement."> - <rdfs:domain rdf:resource="&rdf;Statement"/> - <rdfs:isDefinedBy rdf:resource="&rdf;"/> - <rdfs:label xml:lang="en">subject</rdfs:label> - <rdfs:range rdf:resource="&rdfs;Resource"/> -</rdf:Property> - -<rdf:Property rdf:about="&rdf;predicate" - rdfs:comment="the predicate of an RDF statement."> - <rdfs:domain rdf:resource="&rdf;Statement"/> - <rdfs:isDefinedBy rdf:resource="&rdf;"/> - <rdfs:label xml:lang="en">predicate</rdfs:label> - <rdfs:range rdf:resource="&rdf;Property"/> -</rdf:Property> - -<rdf:Property rdf:about="&rdf;object" - rdfs:comment="The object of an RDF statement."> - <rdfs:domain rdf:resource="&rdf;Statement"/> - <rdfs:isDefinedBy rdf:resource="&rdf;"/> - <rdfs:label xml:lang="en">object</rdfs:label> -</rdf:Property> - -<rdfs:Class rdf:about="&rdf;Bag"> - <rdfs:comment xml:lang="en">An unordered collection.</rdfs:comment> - <rdfs:isDefinedBy rdf:resource="&rdf;"/> - <rdfs:label xml:lang="en">Bag</rdfs:label> - <rdfs:subClassOf rdf:resource="&rdfs;Container"/> -</rdfs:Class> - -<rdfs:Class rdf:about="&rdf;Seq"> - <rdfs:comment xml:lang="en">An ordered collection.</rdfs:comment> - <rdfs:isDefinedBy rdf:resource="&rdf;"/> - <rdfs:label xml:lang="en">Seq</rdfs:label> - <rdfs:subClassOf rdf:resource="&rdfs;Container"/> -</rdfs:Class> - -<rdfs:Class rdf:about="&rdf;Alt"> - <rdfs:comment xml:lang="en">A collection of alternatives.</rdfs:comment> - <rdfs:isDefinedBy rdf:resource="&rdf;"/> - <rdfs:label xml:lang="en">Alt</rdfs:label> - <rdfs:subClassOf rdf:resource="&rdfs;Container"/> -</rdfs:Class> - -<rdf:Property rdf:about="&rdf;value"> - <rdfs:comment>Identifies the principal value (usually a string) of a property when the property value is a structured resource</rdfs:comment> - <rdfs:domain rdf:resource="&rdfs;Resource"/> - <rdfs:isDefinedBy rdf:resource="&rdf;"/> - <rdfs:label xml:lang="en">value</rdfs:label> -</rdf:Property> - -<rdfs:Class rdf:about="&rdf;List"> - <rdfs:comment xml:lang="en">The class of RDF Lists</rdfs:comment> - <rdfs:isDefinedBy rdf:resource="&rdf;"/> - <rdfs:label xml:lang="en">List</rdfs:label> -</rdfs:Class> - -<rdf:List rdf:about="&rdf;nil"> - <rdfs:comment xml:lang="en">The empty list, with no items in it. If the rest of a list is nil then the list has no more items in it.</rdfs:comment> - <rdfs:isDefinedBy rdf:resource="&rdf;"/> - <rdfs:label xml:lang="en">nil</rdfs:label> -</rdf:List> - -<rdf:Property rdf:about="&rdf;first"> - <rdfs:comment xml:lang="en">The first item in an RDF list. Also often called the head.</rdfs:comment> - <rdfs:domain rdf:resource="&rdf;List"/> - <rdfs:isDefinedBy rdf:resource="&rdf;"/> - <rdfs:label xml:lang="en">first</rdfs:label> -</rdf:Property> - -<rdf:Property rdf:about="&rdf;rest"> - <rdfs:comment xml:lang="en">The rest of an RDF list after the first item. Also often called the tail.</rdfs:comment> - <rdfs:domain rdf:resource="&rdf;List"/> - <rdfs:isDefinedBy rdf:resource="&rdf;"/> - <rdfs:label xml:lang="en">rest</rdfs:label> - <rdfs:range rdf:resource="&rdf;List"/> -</rdf:Property> - -<rdfs:Class rdf:about="&rdfs;XMLLiteral" - rdfs:comment="The class of XML literals."> - <rdfs:isDefinedBy rdf:resource="&rdfs;"/> - <rdfs:label xml:lang="en">XMLLiteral</rdfs:label> -</rdfs:Class> - -</rdf:RDF> diff --git a/packages/semweb/rnd_test.pl b/packages/semweb/rnd_test.pl deleted file mode 100644 index cc0a7ef50..000000000 --- a/packages/semweb/rnd_test.pl +++ /dev/null @@ -1,288 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog - - Author: Jan Wielemaker - E-mail: wielemak@science.uva.nl - WWW: http://www.swi-prolog.org - Copyright (C): 1985-2006, University of Amsterdam - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - As a special exception, if you link this library with other files, - compiled with a Free Software compiler, to produce an executable, this - library does not by itself cause the resulting executable to be covered - by the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -:- module(rdf_random_test, - [ concur/2, % +Threads, +Actions - go/0, - go/1, % +Actions - record/1, % +Actions - replay/1 % +Actions - ]). -:- asserta(user:file_search_path(foreign, '.')). -:- use_module(rdf_db). -:- use_module(library(thread)). -:- use_module(library(debug)). - -replay_file('rnd.reply'). - -%% concur(+Threads:int, +Actions:int) is det. -% -% Create _N_ Threads, each performing Actions using go/1. - -concur(1, Actions) :- !, - go(Actions). -concur(Threads, Actions) :- - create_threads(Threads, go(Actions), Ids), - wait(Ids). - -create_threads(0, _, []) :- !. -create_threads(N, G, [Id|T]) :- - thread_create(G, Id, []), - N2 is N - 1, - create_threads(N2, G, T). - -wait([]). -wait([H|T]) :- - thread_join(H, Result), - ( Result == true - -> true - ; format('ERROR from ~w: ~w~n', [H, Result]) - ), - wait(T). - -%% go is det. -%% go(+N) is det. -% -% Perform N random operations on the database. - -go :- - go(20000). -go(N) :- - nb_setval(rnd_file, none), - do_random(N), - rdf_statistics(triples(T)), - rdf_predicate_property(rdfs:subPropertyOf, triples(SP)), - format('~D triples; property hierarchy complexity: ~D~n', [T, SP]). - -%% record(+N) -% -% As go/1, but record generated random numbers in the file -% specified with replay_file/1. - -record(N) :- - replay_file(File), - open(File, write, Out), - nb_setval(rnd_file, out(Out)), - do_random(N). - -%% replay(+N) -% -% Replay first N actions recorded using record/1. N is normally -% the same as used for record/1. - -replay(N) :- - replay_file(File), - open(File, read, In), - nb_setval(rnd_file, in(In)), - do_random(N). - -%% next(-N, +Max) -% -% Produce a random number 1 =< N <= Max. During record/1, write -% to file. Using replay/1, read from file. - -next(N, Max) :- - nb_getval(rnd_file, X), - ( X == none - -> N is random(Max)+1 - ; X = in(Fd) - -> read(Fd, N) - ; X = out(Fd), - N is random(Max)+1, - format(Fd, '~q.~n', [N]), - flush_output(Fd) - ). - - -%% do_random(N) is det. -% -% Take a random action on the database. - -do_random(N) :- - nb_setval(line, 1), - random_actions(N). - -random_actions(N) :- - MM is N mod 100, - ( MM = 0 - -> rdf_statistics(triples(Triples)), - debug(count, 'Count ~w, Triples ~w', [N, Triples]) - ; true - ), - next(Op, 10), - rans(Subject), - ranp(Predicate), - rano(Object), - rang(Graph), - do(Op, Subject, Predicate, Object, Graph), - N1 is N - 1, - ( N > 1 - -> random_actions(N1) - ; true - ). - -%% do(+Operation, +Subject, +Predicate, +Object, +Graph) is det. -% -% Execute an operation on Graph. -% -% @tbd Test update - -do(1, S, P, O, G) :- - debug(bug(S,P,O), 'ASSERT(~q,~q,~q,~q)', [S,P,O,G]), - rdf_assert(S,P,O,G). -do(2, S, P, O, G) :- - debug(bug(S,P,O), 'RETRACTALL(~q,~q,~q,~q)', [S,P,O,G]), - rdf_retractall(S,P,O,G). -do(3, S, _P, _O, _G) :- rdf_s(S). % allow profiling -do(4, S, P, _O, _G) :- rdf_sp(S, P). -do(5, S, _P, _O, _G) :- has_s(S). -do(6, S, P, _O, _G) :- has_sp(S, P). -do(7, S, P, _O, _G) :- reach_sp(S, P). -do(8, _S, P, O, _G) :- reach_po(P, O). -do(9, _, P, _, G) :- % add a random subproperty below me - repeat, - ranp(P2), - P2 \== P, !, - rdf_assert(P2, rdfs:subPropertyOf, P, G), - debug(subPropertyOf, 'Added ~p rdfs:subPropertyOf ~p~n', [P2, P]). -do(10, _, P, _, G) :- % randomly delete a subproperty - ( rdf(_, rdfs:subPropertyOf, P) - -> repeat, - ranp(P2), - P2 \== P, - rdf(P2, rdfs:subPropertyOf, P), !, - debug(subPropertyOf, 'Delete ~p rdfs:subPropertyOf ~p~n', [P2, P]), - rdf_retractall(P2, rdfs:subPropertyOf, P, G) - ; true - ). - -rdf_s(S) :- - forall(rdf(S, _, _), true). -rdf_sp(S, P) :- - forall(rdf(S, P, _), true). -has_s(S) :- - forall(rdf_has(S, _, _), true). -has_sp(S, P) :- - forall(rdf_has(S, P, _), true). -reach_sp(S, P) :- - forall(rdf_reachable(S, P, _), true). -reach_po(P, O) :- - ( atom(O) - -> forall(rdf_reachable(_, P, O), true) - ; true - ). - - -%% rans(-Subject) is det. -% -% Generate a random subject. - -rans(X) :- - next(I, 4), - rs(I, X). - -rs(1, a). -rs(2, b). -rs(3, c). -rs(4, d). - -%% ranp(-Predicate) is det. -% -% Generate a random predicate. - -ranp(X) :- - next(I, 4), - rp(I, X). -rp(1, a). -rp(2, p1). -rp(3, p2). -rp(4, p3). - -%% rano(-Object) is det. -% -% Generate a random object. - -rano(X) :- - next(I, 13), - ro(I, X). -ro(1, a). -ro(2, b). -ro(3, c). -ro(4, p1). -ro(5, literal(1)). -ro(6, literal(hello_world)). -ro(7, literal(bye)). -ro(8, literal(lang(en, bye))). -ro(9, literal(lang(nl, bye))). -ro(10, d). -ro(11, R) :- - next(I, 1000), - atom_concat(r, I, R). -ro(12, literal(L)) :- - next(I, 1000), - atom_concat(l, I, L). -ro(13, literal(lang(Lang, L))) :- - next(I, 1000), - atom_concat(l, I, L), - ranl(Lang). - -ranl(Lang) :- - next(I, 2), - rl(I, Lang). - -rl(1, en). -rl(2, nl). - - -%% rang(-Graph) is det. -% -% Generate a random graph. - -graph_count(200). - -rang(X:Line) :- - graph_count(Count), - next(I, Count), - rg(I, X), - Line = 1. -% line(Line). - -term_expansion(rg(x,x), Clauses) :- - graph_count(Count), - findall(rg(I,N), (between(1, Count, I), atom_concat(g,I,N)), Clauses). - -rg(x,x). - -line(Line) :- - nb_getval(line, Line), - NL is Line+1, - nb_setval(line, NL). - diff --git a/packages/semweb/semweb.doc b/packages/semweb/semweb.doc deleted file mode 100644 index e4e441114..000000000 --- a/packages/semweb/semweb.doc +++ /dev/null @@ -1,2276 +0,0 @@ -\documentclass[11pt]{article} -\usepackage{times} -\usepackage{pl} -\usepackage{plpage} -\usepackage{alltt} -\usepackage{html} -\usepackage{verbatim} -\sloppy -\makeindex - -\onefile -\htmloutput{.} % Output directory -\htmlmainfile{semweb} % Main document file -\bodycolor{white} % Page colour - -\renewcommand{\runningtitle}{SWI-Prolog Semantic Web Library} - -\newcommand{\elem}[1]{{\tt\string<#1\string>}} - -\begin{document} - -\title{SWI-Prolog Semantic Web Library} -\author{Jan Wielemaker \\ - University of Amsterdam/VU University Amsterdam \\ - The Netherlands \\ - E-mail: \email{J.Wielemaker@cs.vu.nl}} - -\maketitle - -\begin{abstract} -This document describes a library for dealing with standards from the -\url[W3C]{http://www.w3c.org/} standard for the \emph{Semantic Web}. -Like the standards themselves (RDF, RDFS and OWL) this infrastructure -is modular. It consists of Prolog packages for reading, querying and -storing semantic web documents as well as XPCE libraries that provide -visualisation and editing. The Prolog libraries can be used without -the XPCE GUI modules. The library has been actively used with upto 10 -million triples, using approximately 1GB of memory. Its scalability -is limited by memory only. The library can be used both on 32-bit -and 64-bit platforms. -\end{abstract} - -\vfill -\pagebreak -\tableofcontents - -\newpage - - -\section{Introduction} - -SWI-Prolog has started support for web-documents with the development of -a small and fast SGML/XML parser, followed by an RDF parser (early -2000). With the \file{semweb} library we provide more high level support -for manipulating semantic web documents. The semantic web is the likely -point of orientation for knowledge representation in the future, making -a library designed in its spirit promising. - - -\section{Provided libraries} - -Central to this library is the module \pllib{semweb/rdf_db.pl}, -providing storage and basic querying for RDF triples. This triple store -is filled using the RDF parser realised by \pllib{rdf.pl}. The storage -module can quickly save and load (partial) databases. The modules -\pllib{semweb/rdfs.pl} and \pllib{semweb/owl.pl} add querying in terms -of the more powerful RDFS and OWL languages. Module -\pllib{semweb/rdf_edit.pl} adds editing, undo, journaling and -change-forwarding. Finally, a variety of XPCE modules visualise and edit -the database. Figure \figref{modules} summarised the modular design. - -\postscriptfig[width=0.8\linewidth]{modules} - {Modules for the Semantic Web library} - - - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - % RDF_DB % - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - - -\section{Library semweb/rdf_db} - -The central module is called \file{rdf_db}. It provides storage and -indexed querying of RDF triples. Triples are stored as a quintuple. -The first three elements denote the RDF triple. \arg{File} and -\arg{Line} provide information about the origin of the triple. - -\begin{quote} -\{\arg{Subject} \arg{Predicate} \arg{Object} \arg{File} \arg{Line}\} -\end{quote} - -The actual storage is provided by the \jargon{foreign language (C)} -module \file{rdf_db.c}. Using a dedicated C-based implementation we -can reduced memory usage and improve indexing capabilities.% - \footnote{The orginal implementation was in Prolog. This - version was implemented in 3 hours, where the C-based - implementation costed a full week. The C-based - implementation requires about half the memory and - provides about twice the performance.} -Currently the following indexing is provided. - -\begin{itemize} - \item Any of the 3 fields of the triple - \item \arg{Subject} + \arg{Predicate} and \arg{Predicate} + \arg{Object} - \item \arg{Predicates} are indexed on the \jargon{highest property}. In - other words, if predicates are related through - \const{subPropertyOf} predicates indexing happens on the most - abstract predicate. This makes calls to rdf_has/4 very - efficient. - \item String literal \arg{Objects} are indexed case-insensitive to make - case-insensitive queries fully indexed. See rdf/3. -\end{itemize} - -\subsection{Query the RDF database} -\label{sec:rdfquery} - -\begin{description} - \predicate{rdf}{3}{?Subject, ?Predicate, ?Object} -Elementary query for triples. \arg{Subject} and \arg{Predicate} are -atoms representing the fully qualified URL of the resource. \arg{Object} -is either an atom representing a resource or \term{literal}{Value} if -the object is a literal value. If a value of the form -\infixterm{:}{NameSpaceID}{LocalName} is provided it is expanded to a -ground atom using expand_goal/2. This implies you can use this construct -in compiled code without paying a performance penalty. See also -\secref{rdfns}. Literal values take one of the following forms: - -\begin{description} - \termitem{Atom}{} -If the value is a simple atom it is the textual representation of -a string literal without explicit type or language (\const{xml:lang}) -qualifier. - - \termitem{lang}{LangID, Atom} -\arg{Atom} represents the text of a string literal qualified with -the given language. - - \termitem{type}{TypeID, Value} -Used for attributes qualified using the \const{rdf:datatype} -\arg{TypeID}. The \arg{Value} is either the textual representation or a -natural Prolog representation. See the option -\term{convert_typed_literal}{:Convertor} of the parser. The storage -layer provides efficient handling of atoms, integers (64-bit) and floats -(native C-doubles). All other data is represented as a Prolog -record. -\end{description} - -For string querying purposes, \arg{Object} can be of the form -\term{literal}{+Query, -Value}, where \arg{Query} is one of the -terms below. Details of literal matching and indexing are described -in \secref{litindex}. - - \begin{description} - \termitem{plain}{+Text} - Perform exact match \textbf{and} demand the language or - type qualifiers to match. This query is fully indexed.% - \footnote{This should have been the default when using - literal with one argument because it is logically - consisent (i.e., (rdf(S,P,literal(X)), X == hello) - would have been the same as - rdf(S,P,literal(hello). In addition, this is - consistent with SPARQL literal identity - definition.} - \termitem{exact}{+Text} - Perform exact, but case-insensitive match. This query is - fully indexed. - \termitem{substring}{+Text} - Match any literal that contains \arg{Text} as a case-insensitive - substring. The query is not indexed on \arg{Object}. - \termitem{word}{+Text} - Match any literal that contains \arg{Text} delimited by - a non alpha-numeric character, the start or end of the - string. The query is not indexed on \arg{Object}. - \termitem{prefix}{+Text} - Match any literal that starts with \arg{Text}. This call - is intended for \jargon{completion}. The query is indexed - using the binary tree of literals. See \secref{litindex} - for details. - \termitem{like}{+Pattern} - Match any literal that matches \arg{Pattern} case - insensitively, where the `*' character in \arg{Pattern} - matches zero or more characters. - \end{description} - -Backtracking never returns duplicate triples. Duplicates can be -retrieved using rdf/4. The predicate rdf/3 raises a type-error if called -with improper arguments. If rdf/3 is called with a term -\term{literal}{_} as \arg{Subject} or \arg{Predicate} object it fails -silently. This allows for graph matching goals like -\verb$rdf(S,P,O),rdf(O,P2,O2)$ to proceed without errors.% - \footnote{Discussion in the SPARQL community votes for allowing - literal values as subject. Although we have no - principal objections, we fear such an extension will - promote poor modelling practice.} - - \predicate{rdf}{4}{?Subject, ?Predicate, ?Object, ?Source} -As rdf/3 but in addition return the source-location of the triple. The -source is either a plain atom or a term of the format -\infixterm{:}{Atom}{Integer} where \arg{Atom} is intended to be used as -filename or URL and \arg{Integer} for representing the line-number. -Unlike rdf/3, this predicate does not remove duplicates from the result -set. - - \predicate{rdf_has}{4}{?Subject, ?Predicate, ?Object, -TriplePred} -This query exploits the RDFS \const{subPropertyOf} relation. It -returns any triple whose stored predicate equals \arg{Predicate} or -can reach this by following the recursive \arg{subPropertyOf} relation. -The actual stored predicate is returned in \arg{TriplePred}. The example -below gets all subclasses of an RDFS (or OWL) class, even if the -relation used is not \const{rdfs:subClassOf}, but a user-defined -sub-property thereof.% - \footnote{This predicate realises semantics defined in - RDF-Schema rather than RDF. It is part of the - \pllib{rdf_db} module because the indexing of - this module incorporates the \const{rdfs:subClassOf} - predicate.} - -\begin{code} -subclasses(Class, SubClasses) :- - findall(S, rdf_has(S, rdfs:subClassOf, Class), SubClasses). -\end{code} - -Note that rdf_has/4 and rdf_has/3 can return duplicate answers if -they use a different \arg{TriplePred}. - - \predicate{rdf_has}{3}{?Subject, ?Predicate, ?Object} -Same as \term{rdf_has}{Subject, Predicate, Object, _}. - - \predicate{rdf_reachable}{3}{?Subject, +Predicate, ?Object} -Is true if \arg{Object} can be reached from \arg{Subject} following -the transitive predicate \arg{Predicate} or a sub-property thereof. -When used with either \arg{Subject} or \arg{Object} unbound, it first -returns the origin, followed by the reachable nodes in breath-first -search-order. It never generates the same node twice and is robust -against cycles in the transitive relation. With all arguments -instantiated it succeeds deterministically of the relation if a -path can be found from \arg{Subject} to \arg{Object}. Searching -starts at \arg{Subject}, assuming the branching factor is normally -lower. A call with both \arg{Subject} and \arg{Object} unbound -raises an instantiation error. The following example generates -all subclasses of \const{rdfs:Resource}: - -\begin{code} -?- rdf_reachable(X, rdfs:subClassOf, rdfs:'Resource'). - -X = 'http://www.w3.org/2000/01/rdf-schema#Resource' ; - -X = 'http://www.w3.org/2000/01/rdf-schema#Class' ; - -X = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Property' ; - -... -\end{code} - - \predicate{rdf_reachable}{5}{?Subject, +Predicate, ?Object, +MaxD, -D} -Same as rdf_reachable/3, but in addition, \arg{MaxD} limits the number -of relations expanded and \arg{D} is unified with the `distance' between -\arg{Subject} and \arg{Object}. Distance 0 means \arg{Subject} and -\arg{Object} are the same resource. \arg{MaxD} can be the constant -\const{infinite} to impose no distance-limit. - - \predicate{rdf_subject}{1}{?Subject} -Enumerate resources appearing as a subject in a triple. The main reason -for this predicate is to generate the known subjects \emph{without -duplicates} as one gets using \term{rdf}{Subject, _, _}. - - \predicate{rdf_current_literal}{1}{-Literal} -Enumerate all known literals. Like rdf_subject/1, the motivation is -to provide access to literals without generation duplicates. Otherwise -the call is the same as \term{rdf}{_,_,literal(Literal)}. -\end{description} - - -\subsubsection{Literal matching and indexing} \label{sec:litindex} - -Starting with version 2.5.0 of this library, literal values are ordered -and indexed using a balanced binary tree (AVL tree). The aim of this -index is threefold. - -\begin{itemize} - \item Unlike hash-tables, binary trees allow for efficient - \jargon{prefix} matching. Prefix matching is very useful in - interactive applications to provide feedback while typing such - as auto-completion. - - \item Having a table of unique literals we generate creation and - destruction events (see rdf_monitor/2). These events can - be used to maintain additional indexing on literals, such - as `by word'. - - \item A binary table allow for fast interval matching on typed - numeric literals.\footnote{Not yet implemented} -\end{itemize} - -As string literal matching is most frequently used for searching -purposes, the match is executed case-insensitive and after removal of -diacritics. Case matching and diacritics removal is based on Unicode -character properties and independent from the current locale. Case -conversion is based on the `simple uppercase mapping' defined by Unicode -and diacritic removal on the `decomposition type'. The approach is -lightweight, but somewhat simpleminded for some languages. The -tables are generated for Unicode characters upto 0x7fff. For more -information, please check the source-code of the mapping-table generator -\file{unicode_map.pl} available in the sources of this package. - -Currently the total order of literals is first based on the type of -literal using the ordering $$numeric < string < term$$ Numeric values -(integer and float) are ordered by value, integers preceed floats if -they represent the same value. strings are sorted alphabetically after -case-mapping and diacritic removal as described above. If they match -equal, uppercase preceeds lowercase and diacritics are ordered on their -unicode value. If they still compare equal literals without any -qualifier preceeds literals with a type qualifier which preceeds -literals with a language qualifier. Same qualifiers (both type or -both language) are sorted alphabetically.% - \footnote{The ordering defined above may change in future versions - to deal with new queries for literals.} - -The ordered tree is used for indexed execution of -\term{literal}{\term{prefix}{Prefix}, Literal} as well as -\term{literal}{\term{like}{Like}, Literal} if \arg{Like} does not start -with a `*'. Note that results of queries that use the tree index -are returned in alphabetical order. - - -\subsection{Predicate properties} \label{sec:predproperty} - -The predicates below form an experimental interface to provide more -reasoning inside the kernel of the rdb_db engine. Note that -\const{symetric}, \const{inverse_of} and \const{transitive} are not yet -supported by the rest of the engine. - -\begin{description} - \predicate{rdf_current_predicate}{1}{?Predicate} -Enumerate all predicates that are used in at least one triple. Behaves -as the code below, but much more efficient. - -\begin{code} -rdf_current_predicate(Predicate) :- - findall(P, rdf(_,P,_), Ps), - sort(Ps, S), - member(Predicate, S). -\end{code} - -Note that there is no relation to defined RDF properties. Properties -that have no triples are not reported by this predicate, while -predicates that are involved in triples do not need to be defined -as an instance of rdf:Property. - - \predicate{rdf_set_predicate}{2}{+Predicate, +Property} -Define a property of the predicate. This predicate currently supports -the properties \const{symmetric}, \const{inverse_of} and -\const{transitive} as defined with rdf_predicate_property/2. Adding -an $A$ inverse_of $B$ also adds $B$ inverse_of $A$. An inverse relation -is deleted using \term{inverse_of}{[]}. -` - \predicate{rdf_predicate_property}{2}{?Predicate, -Property} -Query properties of a defined predicate. Currently defined properties -are given below. - - \begin{description} - \termitem{symmetric}{Bool} -True if the predicate is defined to be symetric. I.e.\ -\mbox{\{A\} P \{B\}} implies \mbox{\{B\} P \{A\}}. - - \termitem{inverse_of}{Inverse} -True if this predicate is the inverse of \arg{Inverse}. - - \termitem{transitive}{Bool} -True if this predicate is transitive. - - \termitem{triples}{Triples} -Unify \arg{Triples} with the number of existing triples using -this predicate as second argument. Reporting the number of -triples is intended to support query optimization. - - \termitem{rdf_subject_branch_factor}{-Float} -Unify \arg{Float} with the average number of triples associated with -each unique value for the subject-side of this relation. If there -are no triples the value 0.0 is returned. This value is cached with -the predicate and recomputed only after substantial changes to the -triple set associated to this relation. This property is indented -for path optimalisation when solving conjunctions of rdf/3 goals. - - \termitem{rdf_object_branch_factor}{-Float} -Unify \arg{Float} with the average number of triples associated with -each unique value for the object-side of this relation. In addition -to the comments with the subject_branch_factor property, uniqueness -of the object value is computed from the hash key rather than the -actual values. - - \termitem{rdfs_subject_branch_factor}{-Float} -Same as \functor{rdf_subject_branch_factor}{1}, but also considering -triples of `subPropertyOf' this relation. See also rdf_has/3. - - \termitem{rdfs_object_branch_factor}{-Float} -Same as \functor{rdf_object_branch_factor}{1}, but also considering -triples of `subPropertyOf' this relation. See also rdf_has/3. - \end{description} -\end{description} - - -\subsection{Modifying the database} \label{sec:rdfmodify} - -As depicted in \figref{modules}, there are two levels of modification. -The \file{rdf_db} module simply modifies, where the \file{rdf_edit} -library provides transactions and undo on top of this. Applications -that wish to use the \file{rdf_edit} layer must \emph{never} use the -predicates from this section directly. - -\subsubsection{Modifying predicates} \label{sec:modpreds} - -\begin{description} - \predicate{rdf_assert}{3}{+Subject, +Predicate, +Object} -Assert a new triple into the database. This is equivalent to -rdf_assert/4 using \arg{SourceRef} \const{user}. \arg{Subject} and -\arg{Predicate} are resources. \arg{Object} is either a resource or a -term \term{literal}{Value}. See rdf/3 for an explanation of \arg{Value} -for typed and language qualified literals. All arguments are subject to -name-space expansion (see \secref{rdfns}). - - \predicate{rdf_assert}{4}{+Subject, +Predicate, +Object, +SourceRef} -As rdf_assert/3, adding \arg{SourceRef} to specify the orgin of the -triple. \arg{SourceRef} is either an atom or a term of the format -\arg{Atom}:\arg{Int} where \arg{Atom} normally refers to a filename -and \arg{Int} to the line-number where the description starts. - - \predicate{rdf_retractall}{3}{?Subject, ?Predicate, ?Object} -Removes all matching triples from the database. Previous Prolog -implementations also provided a backtracking \predref{rdf_retract}{3}, -but this proved to be rarely used and could always be replaced with -rdf_retractall/3. As rdf_retractall/4 using an unbound \arg{SourceRef}. - - \predicate{rdf_retractall}{4}{?Subject, ?Predicate, ?Object, ?SourceRef} -As rdf_retractall/4, also matching on the \arg{SourceRef}. This is -particulary useful to update all triples coming from a loaded file. - - \predicate{rdf_update}{4}{+Subject, +Predicate, +Object, +Action} -Replaces one of the three fields on the matching triples depending -on \arg{Action}: - -\begin{description} - \termitem{subject}{Resource} -Changes the first field of the triple. - \termitem{predicate}{Resource} -Changes the second field of the triple. - \termitem{object}{Object} -Changes the last field of the triple to the given resource or -\term{literal}{Value}. - \termitem{source}{Source} -Changes the source location (\jargon{payload}). Note that updating the -source has no consequences for the semantics and therefore the -\jargon{generation} (see rdf_generation/1) is \emph{not} updated. -\end{description} - - \predicate{rdf_update}{5}{+Subject, +Predicate, +Object, - +Source,+Action} -As rdf_update/4 but allows for specifying the source. - -\end{description} - - -\subsubsection{Transactions} \label{transactions} - -\index{transaction}% -The predicates from \secref{modpreds} perform immediate and atomic -modifications to the database. There are two cases where this is not -desirable: - -\begin{enumerate} - \item -If the database is modified using information based on reading the same -database. A typical case is a forward reasoner examining the database -and asserting new triples that can be deduced from the already existing -ones. For example, \emph{if $length(X) > 2$ then size(X) is large}: - -\begin{code} - ( rdf(X, length, literal(L)), - atom_number(L, IL), - IL > 2, - rdf_assert(X, size, large), - fail - ; true - ). -\end{code} - -Running this code without precautions causes an error because -rdf_assert/3 tries to get a write lock on the database which has -an a read operation (rdf/3 has choicepoints) in progress. - - \item -Multi-threaded access making multiple changes to the database that -must be handled as a unit. -\end{enumerate} - -Where the second case is probably obvious, the first case is less so. -The storage layer may require reindexing after adding or deleting -triples. Such reindexing operatations however are not possible while -there are active read operations in other threads or from choicepoints -that can be in the same thread. For this reason we added -rdf_transaction/2. Note that, like the predicates from -\secref{modpreds}, rdf_transaction/2 raises a permission error exception -if the calling thread has active choicepoints on the database. The -problem is illustrated below. The rdf/3 call leaves a choicepoint and -as the read lock originates from the calling thread itself the system -will deadlock if it would not generate an exception. - -\begin{code} -1 ?- rdf_assert(a,b,c). - -Yes -2 ?- rdf_assert(a,b,d). - -Yes -3 ?- rdf(a,b,X), rdf_transaction(rdf_assert(a,b,e)). -ERROR: No permission to write rdf_db `default' (Operation would deadlock) -^ Exception: (8) rdf_db:rdf_transaction(rdf_assert(a, b, e)) ? no debug -4 ?- -\end{code} - - -\begin{description} - \predicate{rdf_transaction}{1}{:Goal} -Same as \term{rdf_transaction}{Goal, \const{user}}. - - \predicate{rdf_transaction}{2}{:Goal, +Id} -After starting a transaction, all predicates from \secref{modpreds} -append their operation to the \emph{transaction} instead of modifying -the database. If \arg{Goal} succeeds rdf_transaction cuts all -choicepoints in \arg{Goal} and executes all recorded operations. If -\arg{Goal} fails or throws an exception, all recorded operations are -discarded and rdf_transaction/1 fails or re-throws the exception. - -On entry, rdf_transaction/1 gains exclusive access to the database, but -does allow readers to come in from all threads. After the successful -completion of \arg{Goal} rdf_transaction/1 gains completely exclusive -access while performing the database updates. - -Transactions may be nested. Committing a nested transactions merges -its change records into the outer transaction, while discarding a -nested transaction simply destroys the change records belonging to -the nested transaction. - -The \arg{Id} argument may be used to identify the transaction. It is -passed to the begin/end events posted to hooks registered with -rdf_monitor/2. The \arg{Id} \term{log}{Term} can be used to enrich the -journal files with additional history context. See \secref{enrich}. - - \predicate{rdf_active_transaction}{1}{?Id} -True if \arg{Id} is the identifier of a currently active transaction -(i.e.\ rdf_active_transaction/1 is called from rdf_transaction/2 with -matching \arg{Id}). Note that transaction identifier is not copied and -therefore need not be ground and can be further instantiated during the -transaction. \arg{Id} is first unified with the innermost transaction -and backtracking with the identifier of other active transaction. Fails -if there is no matching transaction active, which includes the case -where there is no transaction in progress. -\end{description} - - -\subsection{Loading and saving to file} \label{sec:rdffile} - -The \file{rdf_db} module can read and write RDF-XML for import and -export as well as a binary format built for quick load and save -described in \secref{rdffastfile}. Here are the predicates -for portable RDF load and save. - -\begin{description} - \predicate{rdf_load}{1}{+InOrList} -Load triples from \arg{In}, which is either a stream opened for reading, -an atom specifying a filename, a URL or a list of valid inputs. This -predicate calls process_rdf/3 to read the source one description at a -time, avoiding limits to the size of the input. By default, this -predicate provides for caching the results for quick-load using -rdf_load_db/1 described below. Caching strategy and options are -description in \secref{rdfcache}. - - \predicate{rdf_load}{2}{+FileOrList, +Options} -As rdf_load/1, providing additional options. The options are handed -to the RDF parser and implemented by process_rdf/3. In addition, the -following options are provided: - -\begin{description} - \termitem{cache}{+Bool} -If \const{true} (default), try to use cached data or create a cache -file. Otherwise load the source. - - \termitem{db}{+Graph} -Deprecated. New code should use the \term{graph}{+Graph} option. - - \termitem{format}{+Format} -Specify the source format explicitly. Normally this is deduced from -the filename extension or the mime-type. The core library understands -the formats \const{xml} (RDF/XML) and \const{triples} (internal quick -load and cache format). - - \termitem{graph}{+Graph} -Load the data in the given named graph. The default is the URL of the -source. - - \termitem{if}{+Condition} -Condition under which to load the source. \arg{Condition} is the same as -for the Prolog load_files/2 predicate: \const{changed} (default) load -the source if it was not loaded before or has changed; \const{true} -(re-)loads the source unconditionally and \const{not_loaded} loads the -source if it was not loaded, but does not check for modifications. - - \termitem{silent}{+Bool} -If \arg{Bool} is \const{true}, the message reporting completion is -printed using level \const{silent}. Otherwise the level is -\const{informational}. See also print_message/2. - - \termitem{register_namespaces}{+Bool} -If \const{true} (default \const{false}), register \verb$xmlns:ns=url$ -namespace declarations as rdf_db:ns(ns,url) namespaces if there is no -conflict. -\end{description} - - \predicate{rdf_unload}{1}{+Spec} -Remove all triples loaded from \arg{Spec}. \arg{Spec} is either a graph -name or a source specificatipn. If \arg{Spec} does not refer to a loaded -database the predicate succeeds silently. - - \predicate{rdf_save}{1}{+File} -Save all known triples to the given \arg{File}. Same as -\term{rdf_save}{File, []}. - - \predicate{rdf_save}{2}{+File, +Options} -Save with options. Provided options are: - - \begin{description} - \termitem{graph}{+URI} -Save all triples that belong to the named-graph \arg{URI}. Saving -arbitrary selections is possible using predicates from -\secref{partsave}. - - \termitem{db}{+FileRef} -Deprecated synonym for \term{graph}{URI}. - - \termitem{anon}{+Bool} -if \term{anon}{false} is provided anonymous resources are only saved -if the resource appears in the object field of another triple that is -saved. - - \termitem{base_uri}{+BaseURI} -If provided, emit \const{xml:base}="\arg{BaseURI}" in the header and -emit all URIs that are relative to the base-uri. The \const{xml:base} -declaration can be suppressed using the option -\term{write_xml_base}{false} - - \termitem{write_xml_base}{+Bool} -If \const{false} (default \const{true}), do \emph{not} emit the -\const{xml:base} declaration from the given \const{base_uri} option. -The idea behind this option is to be able to create documents with -URIs relative to the document itself: - -\begin{code} - ..., - rdf_save(File, - [ base_uri(BaseURI), - write_xml_base(false) - ]), - ... -\end{code} - - \termitem{convert_typed_literal}{:Converter} -If present, raw literal values are first passed to \arg{Converter} to -apply the reverse of the \const{convert_typed_literal} option of the -RDF parser. The \arg{Converter} is called with the same arguments -as in the RDF parser, but now with the last argument instantiated -and the first two unbound. A proper convertor that can be used for -both loading and saving must be a logical predicate. - - \termitem{encoding}{+Encoding} -Define the XML encoding used for the file. Defined values are -\const{utf8} (default), \const{iso_latin_1} and \const{ascii}. -Using \const{iso_latin_1} or \const{ascii}, characters not covered by -the encoding are emitted as XML character entities (\verb$&#...;$). - - \termitem{document_language}{+XMLLang} -The value \arg{XMLLang} is used for the \const{xml:lang} attribute -in the outermost \const{rdf:RDF} element. This language acts as -a default, which implies that the \const{xml:lang} tag is only used -for literals with a \emph{different} language identifier. Please note -that this option will cause all literals without language tag to be -interpreted using \arg{XMLLang}. - - \termitem{namespaces}{+List} -Explicitely specify saved namespace declarations. See rdf_save_header/2 -option namespaces for details. - \end{description} - - \predicate{rdf_graph}{1}{?DB} -True if \arg{DB} is the name of a graph with at least one triple. - - \predicate{rdf_source}{1}{?DB} -Deprecated. Use rdf_graph/1 or rdf_source/2 in new code. - - \predicate{rdf_source}{2}{?DB, ?SourceURL} -True if the named graph \arg{DB} was loaded from the source -\arg{SourceURL}. A named graph is associated with a \arg{SourceURL} by -rdf_load/2. The association is stored in the internal binary format, -which ensures proper maintenance of the original source through caching -and the persistency layer. - - \predicate{rdf_make}{0}{} -Re-load all RDF sourcefiles (see rdf_source/1) that have changed since -they were loaded the last time. This implies all triples that originate -from the file are removed and the file is re-loaded. If the file is -cached a new cache-file is written. Please note that the new triples -are added at the end of the database, possibly changing the order of -(conflicting) triples. -\end{description} - -\subsubsection{Caching triples} -\label{sec:rdfcache} - -The library \pllib{semweb/rdf_cache} defines the caching strategy for -triples sources. When using large RDF sources, caching triples greatly -speedup loading RDF documents. The cache library implements two caching -strategies that are controlled by rdf_set_cache_options/1. - -\paragraph{Local caching} This approach applies to files only. Triples -are cached in a sub-directory of the directory holding the source. This -directory is called \file{.cache} (\file{_cache} on Windows). If the -cache option \const{create_local_directory} is \const{true}, a cache -directory is created if posible. - -\paragraph{Global caching} This approach applies to all sources, except -for unnamed streams. Triples are cached in directory defined by the -cache option \const{global_directory}. - -When loading an RDF file, the system scans the configured cache files -unless \term{cache}{false} is specified as option to rdf_load/2 or -caching is disabled. If caching is enabled but no cache exists, the -system will try to create a cache file. First it will try to do this -locally. On failure it will try to configured global cache. - -\begin{description} - \predicate{rdf_set_cache_options}{1}{+Options} -Set cache options. Defined options are: - - \begin{description} - \termitem{enabled}{Bool} -If \const{true} (default), caching is enabled. - - \termitem{local_directory}{Atom} -Local directory to use for caching. Default \const{.cache} -(Windows: \const{_cache}). - - \termitem{create_local_directory}{Bool} -If \const{true} (default \const{false}), create a local cache -directory if none exists and the directory can be created. - - \termitem{global_directory}{Atom} -Global directory to use for caching. The directory is created if the -option \const{create_global_directory} is also given and set to -\const{true}. Sub-directories are created to speedup indexing on -filesystems that perform poorly on directories with large numbers of -files. Initially not defined. - - \termitem{create_global_directory}{Bool} -If \const{true} (default \const{false}), create a global cache -directory if none exists. - - \end{description} -\end{description} - - -\subsubsection{Partial save} \label{sec:partsave} - -Sometimes it is necessary to make more arbitrary selections of material -to be saved or exchange RDF descriptions over an open network link. The -predicates in this section provide for this. Character encoding issues -are derived from the encoding of the \arg{Stream}, providing support for -\const{utf8}, \const{iso_latin_1} and \const{ascii}. - -\begin{description} - \predicate{rdf_save_header}{2}{+Stream, +Options} -Save an RDF header, with the XML header, \const{DOCTYPE}, -\const{ENTITY} and opening the \const{rdf:RDF} element with appropriate -namespace declarations. It uses the primitives from \secref{rdfns} to -generate the required namespaces and desired short-name. \arg{Options} -is one of: - - \begin{description} - \termitem{graph}{+URI} - Only search for namespaces used in triples that belong to the - given named graph. - - \termitem{db}{+FileRef} - Deprecated synonym for \term{graph}{FileRef}. - - \termitem{namespaces}{+List} - Where \arg{List} is a list of namespace abbreviations (see - \secref{rdfns}). With this option, the expensive search for - all namespaces that may be used by your data is omitted. The - namespaces \const{rdf} and \const{rdfs} are added to the provided - \arg{List}. If a namespace is not declared, the resource is - emitted in non-abreviated form. - \end{description} - - \predicate{rdf_save_footer}{1}{+Stream} -Close the work opened with rdf_save_header/2. - - \predicate{rdf_save_subject}{3}{+Stream, +Subject, +FileRef} -Save everything known about \arg{Subject} that matches \arg{FileRef}. -Using an variable for \arg{FileRef} saves all triples with -\arg{Subject}. - - \predicate{rdf_quote_uri}{2}{+URI, -Quoted} -Quote a UNICODE \arg{URI}. First the Unicode is represented as UTF-8 -and then the unsafe characters are mapped to %XX. Quotes can always -be represented as US-ASCII. -\end{description} - - -\subsubsection{Fast loading and saving} \label{sec:rdffastfile} - -Loading and saving RDF format is relatively slow. For this reason we -designed a binary format that is more compact, avoids the complications -of the RDF parser and avoids repetitive lookup of (URL) identifiers. -Especially the speed improvement of about 25 times is worth-while when -loading large databases. These predicates are used for caching by -rdf_load/[1,2] under certain conditions. - -\begin{description} - \predicate{rdf_save_db}{1}{+File} -Save all known triples into \arg{File}. The saved version includes the -\arg{SourceRef} information. - - \predicate{rdf_save_db}{1}{+File, +FileRef} -Save all triples with \arg{SourceRef} \arg{FileRef}, regardless of the -line-number. For example, using \const{user} all information added -using rdf_assert/3 is stored in the database. - - \predicate{rdf_load_db}{1}{+File} -Load triples from \arg{File}. -\end{description} - - -\subsubsection{MD5 digests} - -The \file{rdf_db} library provides for \jargon{MD5 digests}. An MD5 -digest is a 128 bit long hash key computed from the triples based on the -RFC-1321 standard. MD5 keys are computed for each individual triple -and added together to compute the final key, resulting in a key that -describes the triple-set but is independant from the order in which -the triples appear. It is claimed that it is practically impossible -for two different datasets to generate the same MD5 key. The -Triple20 editor uses the MD5 key for detecting whether the triples -associated to a file have changed as well as to maintain a directory -with snapshots of versioned ontology files. - -\begin{description} - \predicate{rdf_md5}{2}{+Source, -MD5} -Return the MD5 digest for all triples in the database associated to -\arg{Source}. The \arg{MD5} digest itself is represented as an atom -holding a 32-character hexadecimal string. The library maintains the -digest incrementally on rdf_load/[1,2], rdf_load_db/1, rdf_assert/[3,4] -and rdf_retractall/[3,4]. Checking whether the digest has changed since -the last rdf_load/[1,2] call provides a practical means for checking -whether the file needs to be saved. - - \predicate{rdf_atom_md5}{3}{+Text, +Times, -MD5} -Computes the MD5 hash from \arg{Text}, which is an atom, string or -list of character codes. \arg{Times} is an integer $\geq 1$. When -$> 0$, the MD5 algorithm is repeated \arg{Times} times on the -generated hash. This can be used for password encryption algorithms -to make generate-and-test loops slow. - -This predicate bears little relation to RDF handling. It is provided -because the RDF library already contains the MD5 algorithm and semantic -web services may involve security and consistency checking. This -predicate provides a platform independant alternative to the -\pllib{crypt} library provided with the \texttt{clib} package. -\end{description} - - -\subsection{Namespace Handling} \label{sec:rdfns} - -Prolog code often contains references to constant resources in a known -XML namespace. For example, -\const{http://www.w3.org/2000/01/rdf-schema\#Class} refers to the most -general notion of a class. Readability and maintability concerns require -for abstraction here. The dynamic and multifile predicate rdf_db:ns/2 -maintains a mapping between short meaningful names and namespace -locations very much like the XML \const{xmlns} construct. The initial -mapping contains the namespaces required for the semantic web languages -themselves: - -\begin{code} -ns(rdf, 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'). -ns(rdfs, 'http://www.w3.org/2000/01/rdf-schema#'). -ns(owl, 'http://www.w3.org/2002/7/owl#'). -ns(xsd, 'http://www.w3.org/2000/10/XMLSchema#'). -ns(dc, 'http://purl.org/dc/elements/1.1/'). -ns(dcterms, 'http://purl.org/dc/terms/'). -ns(skos, 'http://www.w3.org/2004/02/skos/core#'). -ns(eor, 'http://dublincore.org/2000/03/13/eor#'). - -\end{code} - -All predicates for the semweb libraries use goal_expansion/2 rules to -make the SWI-Prolog compiler rewrite terms of the form -\infixterm{:}{Id}{Local} into the fully qualified URL. In addition, -the following predicates are supplied: - -\begin{description} - \predicate{rdf_equal}{2}{Resource1, Resource2} -Defined as \infixterm{=}{Resource1}{Resource2}. As this predicate is -subject to goal-expansion it can be used to obtain or test global URL -values to readable values. The following goal unifies \arg{X} with -\const{http://www.w3.org/2000/01/rdf-schema\#Class} without more -runtime overhead than normal Prolog unification. - -\begin{code} - rdf_equal(rdfs:'Class', X) -\end{code} - - \predicate[nondet]{rdf_current_ns}{2}{?Alias, ?URI} -Query defined namespace aliases (prefixes).\footnote{Older versions -of this library did not export the table rdf_db:ns/2. Please use -this new public interface.} - - \predicate{rdf_register_ns}{2}{+Alias, +URL} -Same as \term{rdf_register_ns}{Alias, URL, []}. - - \predicate{rdf_register_ns}{2}{+Alias, +URL, +Options} -Register \arg{Alias} as a shorthand for \arg{URL}. Note that the -registration must be done before loading any files using them as -namespace aliases are handled at compiletime through goal_expansion/2. -If \arg{Alias} already exists the default is to raise a permission -error. If the option \term{force}{true} is provided, the alias is -silently modified. Rebinding an alias must be done \emph{before} any -code is compiled that relies on the alias. If the option -\term{keep}{true} is provided the new registration is silently ignored. - - \predicate{rdf_global_id}{2}{?Alias:Local, ?Global} -Runtime translation between \arg{Alias} and \arg{Local} and a -\arg{Global} URL. Expansion is normally done at compiletime. This -predicate is often used to turn a global URL into a more readable -term. - - \predicate{rdf_global_object}{2}{?Object, ?NameExpandedObject} -As rdf_global_id/2, but also expands the type field if the object -is of the form \term{literal}{\term{type}{Type, Value}}. This predicate -is used for goal expansion of the object fields in rdf/3 and similar -goals. - - \predicate{rdf_global_term}{2}{+Term0, -Term} -Expands all \arg{Alias}:\arg{Local} in \arg{Term0} and return the -result in \arg{Term}. Use infrequently for runtime expansion of -namespace identifiers. -\end{description} - - -\subsubsection{Namespace handling for custom predicates} - -If we implement a new predicate based on one of the predicates of -the semweb libraries that expands namespaces, namespace expansion -is not automatically available to it. Consider the following code -computing the number of distinct objects for a certain property -on a certain object. - -\begin{code} -cardinality(S, P, C) :- - ( setof(O, rdf_has(S, P, O), Os) - -> length(Os, C) - ; C = 0 - ). -\end{code} - -Now assume we want to write labels/2 that returns the number of -distict labels of a resource: - -\begin{code} -labels(S, C) :- - cardinality(S, rdfs:label, C). -\end{code} - -This code will \emph{not work} as \verb$rdfs:label$ is not expanded -at compile time. To make this work, we need to add an rdf_meta/1 -declaration. - -\begin{code} -:- rdf_meta - cardinality(r,r,-). -\end{code} - -\begin{description} - \predicate{rdf_meta}{1}{:Heads} -This predicate defines the argument types of the named predicates, -which will force compile time namespace expansion for these predicates. -\arg{Heads} is a coma-separated list of callable terms. Defined -argument properties are: - - \begin{description} - \termitem{:}{} -Argument is a goal. The goal is processed using expand_goal/2, -recursively applying goal transformation on the argument. - \termitem{+}{} -The argument is instantiated at entry. Nothing is changed. - \termitem{-}{} -The argument is not instantiated at entry. Nothing is changed. - \termitem{?}{} -The argument is unbound or instantiated at entry. Nothing is changed. - \termitem{@}{} -The argument is not changed. - \termitem{r}{} -The argument must be a resource. If it is a term <namespace>:<local> -it is translated. - \termitem{o}{} -The argument is an object or resource. - \termitem{t}{} -The argument is a term that must be translated. Expansion will translate -all occurences of <namespace>:<local> appearing anywhere in the term. - \end{description} - -As it is subject to term_expansion/2, the rdf_meta/1 declaration can -only be used as a \emph{directive}. The directive must be processed -before the definition of the predicates as well as before compiling code -that uses the rdf meta-predicates. The atom \verb$rdf_meta$ is declared -as an operator exported from library \file{rdf_db.pl}. Files using -rdf_meta/1 \emph{must} explicitely load \file{rdf_db.pl}. The example -below defines the rule concept/1. - -\begin{code} -:- use_module(library(semweb/rdf_db)). % for rdf_meta -:- use_module(library(semweb/rdfs)). % for rdfs_individual_of - -:- rdf_meta - concept(r). - -%% concept(?C) is nondet. -% -% True if C is a concept. - -concept(C) :- - rdfs_individual_of(C, skos:'Concept'). -\end{code} -\end{description} - -In addition to expanding \emph{calls}, rdf_meta/1 also causes expansion -of clause-heads for predicates that match a declaration. This is -typically used write Prolog statements about resources. The following -example produces three clauses with expanded (single-atom) arguments: - -\begin{code} -:- use_module(library(semweb/rdf_db)). - -:- rdf_meta - label_predicate(r). - -label_predicate(rdfs:label). -label_predicate(skos:prefLabel). -label_predicate(skos:altLabel). -\end{code} - - -\subsection{Monitoring the database} \label{sec:rdfmonitor} - -Considering performance and modularity, we are working on a replacement -of the \file{rdf_edit} (see \secref{rdfedit}) layered design to deal -with updates, journalling, transactions, etc. Where the rdf_edit -approach creates a single layer on top of rdf_db and code using the -RDF database must select whether to use rdf_db.pl or rdf_edit.pl, the -new approach allows to register \jargon{monitors}. This allows multiple -modules to provide additional services, while these services will be -used regardless of how the database is modified. - -Monitors are used by the persistency library (\secref{persistency}) -and the literal indexing library (\secref{rdflitindex}). - - -\begin{description} - \predicate{rdf_monitor}{2}{:Goal, +Mask} -\arg{Goal} is called for modifications of the database. It is called -with a single argument that describes the modification. Defined -events are: - -\begin{description} - \termitem{assert}{+S, +P, +O, +DB} -A triple has been asserted. - \termitem{retract}{+S, +P, +O, +DB} -A triple has been deleted. - \termitem{update}{+S, +P, +O, +DB, +Action} -A triple has been updated. - \termitem{new_literal}{+Literal} -A new literal has been created. \arg{Literal} is the argument of -\term{literal}{Arg} of the triple's object. This event is introduced -in version 2.5.0 of this library. - \termitem{old_literal}{+Literal} -The literal \arg{Literal} is no longer used by any triple. - \termitem{transaction}{+BeginOrEnd, +Id} -Mark begin or end of the \emph{commit} of a transaction started by -rdf_transaction/2. \arg{BeginOrEnd} is \term{begin}{Nesting} or -\term{end}{Nesting}. \arg{Nesting} expresses the nesting level of -transactions, starting at `0' for a toplevel transaction. \arg{Id} is -the second argument of rdf_transaction/2. The following transaction Ids -are pre-defined by the library: - - \begin{description} - \termitem{parse}{Id} -A file is loaded using rdf_load/2. \arg{Id} is one of \term{file}{Path} -or \term{stream}{Stream}. - \termitem{unload}{DB} -All triples with source \arg{DB} are being unloaded using rdf_unload/1. - \termitem{reset}{} -Issued by rdf_reset_db/0. - \end{description} - - \termitem{load}{+BeginOrEnd, +Spec} -Mark begin or end of rdf_load_db/1 or load through rdf_load/2 from -a cached file. \arg{Spec} is currently defined as \term{file}{Path}. - \termitem{rehash}{+BeginOrEnd} -Marks begin/end of a re-hash due to required re-indexing or garbage -collection. -\end{description} - -\arg{Mask} is a list of events this monitor is interested in. Default -(empty list) is to report all events. Otherwise each element is of the -form +Event or -Event to include or exclude monitoring for certain -events. The event-names are the functor names of the events described -above. The special name \const{all} refers to all events and -\term{assert}{load} to assert events originating from rdf_load_db/1. As -loading triples using rdf_load_db/1 is very fast, monitoring this at the -triple level may seriously harm performance. - -This predicate is intended to maintain derived data, such as a journal, -information for \emph{undo}, additional indexing in literals, etc. There -is no way to remove registered monitors. If this is required one should -register a monitor that maintains a dynamic list of subscribers like the -XPCE broadcast library. A second subscription of the same hook predicate -only re-assignes the mask. - -The monitor hooks are called in the order of registration and in the -same thread that issued the database manipulation. To process all -changes in one thread they should be send to a thread message queue. For -all updating events, the monitor is called while the calling thread has -a write lock on the RDF store. This implies that these events are -processed strickly synchronous, even if modifications originate from -multiple threads. In particular, the \const{transaction} \emph{begin}, -\ldots{} \emph{updates} \ldots{} \emph{end} sequence is never -interleaved with other events. Same for \const{load} and \const{parse}. -\end{description} - - -\subsection{Miscellaneous predicates} - -This section describes the remaining predicates of the \file{rdf_db} -module. - -\begin{description} - \predicate{rdf_node}{1}{-Id} -Generate a unique reference. The returned atom is guaranteed not to -occur in the current database in any field of any triple. - - \predicate{rdf_bnode}{1}{-Id} -Generate a unique blank node reference. The returned atom is guaranteed -not to occur in the current database in any field of any triple and -starts with '__bnode'. - - \predicate{rdf_is_bnode}{1}{+Id} -Succeeds if \arg{Id} is a blank node identifier (also called -\jargon{anonymous resource}). In the current implementation this -implies it is an atom starting with a double underscore. - - \predicate{rdf_is_resource}{1}{+Id} -Succeeds if \arg{Id} is a resource. Note that this resource need -not to appear in any triple. - - \predicate{rdf_is_literal}{1}{+Id} -Succeeds if \arg{Id} is an RDF literal term. Note that this -literal need not to appear in any triple. - - \predicate{rdf_source_location}{2}{+Subject, -SourceRef} -Return the source-location as \arg{File}:\arg{Line} of the first triple -that is about \arg{Subject}. - - \predicate{rdf_generation}{1}{-Generation} -Returns the \arg{Generation} of the database. Each modification to the -database increments the generation. It can be used to check the validity -of cached results deduced from the database. Modifications changing -multiple triples increment \arg{Generation} with the number of triples -modified, providing a heuristic for `how dirty' cached results may be. - - \predicate{rdf_estimate_complexity}{4}{?Subject, ?Predicate, ?Object, - -Complexity} -Return the number of alternatives as indicated by the database -internal hashed indexing. This is a rough measure for the number -of alternatives we can expect for an rdf_has/3 call using the -given three arguments. When called with three variables, the total -number of triples is returned. This estimate is used in query -optimisation. See also rdf_predicate_property/2 and rdf_statistics/1 for -additional information to help optimisers. - - \predicate{rdf_statistics}{1}{?Statistics} -Report statistics collected by the \file{rdf_db} module. Defined -values for \arg{Statistics} are: - - \begin{description} - \termitem{lookup}{?Index, -Count} -Number of lookups using a pattern of instantiated fields. \arg{Index} -is a term \term{rdf}{S,P,O}, where \arg{S}, \arg{P} and \arg{O} are -either \const{+} or \const{-}. For example \term{rdf}{+,+,-} returns -the lookups with subject and predicate specified and object unbound. - - \termitem{properties}{-Count} -Number of unique values for the second field of the triple set. - - \termitem{sources}{-Count} -Number of files loaded through rdf_load/1. - - \termitem{subjects}{-Count} -Number of unique values for the first field of the triple set. - - \termitem{literals}{-Count} -Total number of unique literal values in the database. See also -\secref{litindex}. - - \termitem{triples}{-Count} -Total number of triples in the database. - - \termitem{triples_by_file}{?File, -Count} -Enumerate the number of triples associated to each file. - - \termitem{searched_nodes}{-Count} -Number of nodes explored in rdf_reachable/3. - - \termitem{gc}{-Count, -Time} -Number of garbage collections and time spent in seconds represented as -a float. - - \termitem{rehash}{-Count, -Time} -Number of times the hash-tables were enlarged and time spent in seconds -represented as a float. - - \termitem{core}{-Bytes} -Core used by the triple store. This includes all memory allocated on -behalf of the library, but \emph{not} the memory allocated in -Prolog atoms referenced (only) by the triple store. - \end{description} - - \predicate{rdf_match_label}{3}{+Method, +Search, +Atom} -True if \arg{Search} matches \arg{Atom} as defined by \arg{Method}. -All matching is performed case-insensitive. Defines methods are: - \begin{description} - \termitem{exact}{} - Perform exact, but case-insensitive match. - \termitem{substring}{} - \arg{Search} is a sub-string of \arg{Text}. - \termitem{word}{} - \arg{Search} appears as a whole-word in \arg{Text}. - \termitem{prefix}{} - \arg{Text} start with \arg{Search}. - \termitem{like}{} - \arg{Text} matches \arg{Search}, case insensitively, where - the `*' character in \arg{Search} matches zero or more - characters. - \end{description} - - \predicate{lang_matches}{2}{+Lang, +Pattern} -True if \arg{Lang} matches \arg{Pattern}. This implements XML language -matching conform RFC 4647. Both \arg{Lang} and \arg{Pattern} are -dash-separated strings of identifiers or (for \arg{Pattern}) the -wildcart \texttt{*}. Identifiers are matched case-insensitive and a -\texttt{*} matches any number of identifiers. A short pattern is the -same as \texttt{*}. - - \predicate{rdf_reset_db}{0}{} -Erase all triples from the database and reset all counts and statistics -information. - - \predicate{rdf_version}{1}{-Version} -Unify \arg{Version} with the library version number. This number is, -like to the SWI-Prolog version flag, defined as $10,000 \times -Major + 100 \times Minor + Patch$. -\end{description} - - -\subsection{Issues with rdf_db} \label{sec:rdfissues} - -This RDF low-level module has been created after two year experimenting -with a plain Prolog based module and a brief evaluation of a second -generation pure Prolog implementation. The aim was to be able to handle -upto about 5 million triples on standard (notebook) hardware and deal -efficiently with \const{subPropertyOf} which was identified as a crucial -feature of RDFS to realise fusion of different data-sets. - -The following issues are identified and not solved in suitable manner. - -\begin{description} - \item [\const{subPropertyOf} of \const{subPropertyOf}] is not -supported. - - \item [Equivalence] -Similar to \const{subPropertyOf}, it is likely to be profitable to -handle resource identity efficient. The current system has no support -for it. -\end{description} - - - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - % PLUGIN % - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -\section{Plugin modules for rdf_db} -\label{sec:plugin} - -The \pllib{rdf_db} module provides several hooks for extending its -functionality. Database updates can be monitored and acted upon through -the features described in \secref{rdfmonitor}. The predicate rdf_load/2 -can be hooked to deal with different formats such as \jargon{rdfturtle}, -different input sources (e.g.\ http) and different strategies for -caching results. - -\subsection{Hooks into the RDF library} -\label{sec:hooks} - -The hooks below are used to add new RDF file formats and sources from -which to load data to the library. They are used by the modules -described below and distributed with the package. Please examine the -source-code if you want to add new formats or locations. - -\begin{description} - \item[\file{rdf_turtle.pl}] -Load files in the Turtle format. See \secref{rdfturtle}. - \item[\file{rdf_zlib_plugin.pl}] -Load \program{gzip} compressed files transparently. See \secref{zlib}. - \item[\file{rdf_http_plugin.pl}] -Load RDF documents from HTTP servers. See \secref{http}. -\end{description} - -\begin{description} - \predicate{rdf_db:rdf_open_hook}{3}{+Input, -Stream, -Format} -Open an input. \arg{Input} is one of \term{file}{+Name}, -\term{stream}{+Stream} or \term{url}{Protocol, URL}. If this hook -succeeds, the RDF will be read from Stream using rdf_load_stream/3. -Otherwise the default open functionality for file and stream are -used. - - \predicate{rdf_db:rdf_load_stream}{3}{+Format, +Stream, +Options} -Actually load the RDF from \arg{Stream} into the RDF database. -\arg{Format} describes the format and is produced either by -rdf_input_info/3 or rdf_file_type/2. - - \predicate{rdf_db:rdf_input_info}{3}{+Input, -Modified, -Format} -Gather information on \arg{Input}. \arg{Modified} is the last -modification time of the source as a POSIX time-stamp (see time_file/2). -\arg{Format} is the RDF format of the file. See rdf_file_type/2 for -details. It is allowed to leave the output variables unbound. Ultimately -the default modified time is `0' and the format is assumed to be -\const{xml}. - - \predicate{rdf_db:rdf_file_type}{2}{?Extension, ?Format} -True if \arg{Format} is the default RDF file format for files -with the given extension. \arg{Extension} is lowercase and -without a '.'. E.g.\ \const{owl}. \arg{Format} is either a -built-in format (\const{xml} or \const{triples}) or a format -understood by the rdf_load_stream/3 hook. - - \predicate{rdf_db:url_protocol}{1}{?Protocol} -True if \arg{Protocol} is a URL protocol recognised by rdf_load/2. -\end{description} - - -\subsection{Library semweb/rdf_zlib_plugin} -\label{sec:zlib} - -\index{gz, format}\index{gzip}\index{compressed data}% -This module uses the \pllib{zlib} library to load compressed files -on the fly. The extension of the file must be \fileext{gz}. The -file format is deduced by the extension after stripping the \fileext{gz} -extension. E.g.\ \exam{rdf_load('file.rdf.gz')}. - - -\subsection{Library semweb/rdf_http_plugin} -\label{sec:http} - -\index{xhtml}% -This module allows for \exam{rdf_load('http://...')}. It exploits the -library \pllib{http/http_open.pl}. The format of the URL is determined -from the mime-type returned by the server if this is one of -\const{text/rdf+xml}, \const{application/x-turtle} or -\const{application/turtle}. As RDF mime-types are not yet widely -supported, the plugin uses the extension of the URL if the claimed -mime-type is not one of the above. In addition, it recognises -\const{text/html} and \const{application/xhtml+xml}, scanning -the XML content for embedded RDF. - - - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - % LITINDEX % - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -\subsection{Library semweb/rdf_litindex: Indexing words in literals} -\label{sec:rdflitindex} - -The library \pllib{semweb/rdf_litindex.pl} exploits the primitives -of \secref{rdflitmap} and the NLP package to provide indexing on words -inside literal constants. It also allows for fuzzy matching using -stemming and `sounds-like' based on the \jargon{double metaphone} -algorithm of the NLP package. - -\begin{description} - \predicate{rdf_find_literals}{2}{+Spec, -ListOfLiterals} -Find literals (without type or language specification) that satisfy -\arg{Spec}. The required indices are created as needed and kept -up-to-date using hooks registered with rdf_monitor/2. Numerical -indexing is currently limited to integers in the range $\pm 2^30$ -($\pm 2^62 on 64-bit platforms$). \arg{Spec} is defined as: - - \begin{description} - \termitem{and}{Spec1, Spec2} -Intersection of both specifications. - - \termitem{or}{Spec1, Spec2} -Union of both specifications. - - \termitem{not}{Spec} -Negation of \arg{Spec}. After translation of the full specification to -\jargon{Disjunctive Normal Form} (DNF), negations are only allowed -inside a conjunction with at least one positive literal. - - \termitem{case}{Word} -Matches all literals containing the word \arg{Word}, doing the match -case insensitive and after removing diacritics. - - \termitem{stem}{Like} -Matches all literals containing at least one word that has the same stem -as \arg{Like} using the Porter stem algorithm. See NLP package for -details. - - \termitem{sounds}{Like} -Matches all literals containing at least one word that `sounds like' -\arg{Like} using the double metaphone algorithm. See NLP package for -details. - - \termitem{prefix}{Prefix} -Matches all literals containing at least one word that starts with -Prefix, discarding diacritics and case. - - \termitem{between}{Low, High} -Matches all literals containing an integer token in the range -\arg{Low}..\arg{High}, including the boundaries. - - \termitem{ge}{Low} -Matches all literals containing an integer token with value -\arg{Low} or higher. - - \termitem{le}{High} -Matches all literals containing an integer token with value -\arg{High} or lower. - - \termitem{Token}{} -Matches all literals containing the given token. See tokenize_atom/2 -of the NLP package for details. - \end{description} - - \predicate{rdf_token_expansions}{2}{+Spec, -Expansions} -Uses the same database as rdf_find_literals/2 to find possible -expansions of \arg{Spec}, i.e.\ which words `sound like', `have prefix', -etc. \arg{Spec} is a compound expression as in rdf_find_literals/2. -\arg{Expansions} is unified to a list of terms \term{sounds}{Like, -Words}, \term{stem}{Like, Words} or \term{prefix}{Prefix, Words}. On -compound expressions, only combinations that provide literals are -returned. Below is an example after loading the ULAN% - \footnote{Unified List of Artist Names from the Getty - Foundation.} -database and showing all words that sounds like `rembrandt' and -appear together in a literal with the word `Rijn'. Finding this -result from the 228,710 literals contained in ULAN requires 0.54 -milliseconds (AMD 1600+). - -\begin{code} -?- rdf_token_expansions(and('Rijn', sounds(rembrandt)), L). - -L = [sounds(rembrandt, ['Rambrandt', 'Reimbrant', 'Rembradt', - 'Rembrand', 'Rembrandt', 'Rembrandtsz', - 'Rembrant', 'Rembrants', 'Rijmbrand'])] -\end{code} - -Here is another example, illustrating handling of diacritics: - -\begin{quote}\begin{alltt} -?- rdf_token_expansions(case(cafe), L). - -L = [case(cafe, [cafe, caf\'e])] -\end{alltt}\end{quote} - - \predicate{rdf_tokenize_literal}{2}{+Literal, -Tokens} -Tokenize a literal, returning a list of atoms and integers in the range -$-1073741824 \ldots 1073741823$. As tokenization is in general domain -and task-dependent this predicate first calls the hook -\term{rdf_litindex:tokenization}{Literal, -Tokens}. On failure it -calls tokenize_atom/2 from the NLP package and deletes the following: -atoms of length 1, floats, integers that are out of range and the -english words \const{and}, \const{an}, \const{or}, \const{of}, -\const{on}, \const{in}, \const{this} and \const{the}. Deletion first -calls the hook \term{rdf_litindex:exclude_from_index}{token, X}. This -hook is called as follows: - -\begin{code} -no_index_token(X) :- - exclude_from_index(token, X), !. -no_index_token(X) :- - ... -\end{code} -\end{description} - -\subsection{Literal maps: Creating additional indices on literals} -\label{sec:rdflitmap} - -`Literal maps' provide a relation between literal values, intended to -create additional indexes on literals. The current implementation can -only deal with integers and atoms (string literals). A literal map -maintains an ordered set of \jargon{keys}. The ordering uses the same -rules as described in \secref{litindex}. Each key is associated with an -ordered set of \jargon{values}. Literal map objects can be shared -between threads, using a locking strategy that allows for multiple -concurrent readers. - -Typically, this module is used together with rdf_monitor/2 on the -channals \const{new_literal} and \const{old_literal} to maintain an -index of words that appear in a literal. Further abstraction using -Porter stemming or Metaphone can be used to create additional search -indices. These can map either directly to the literal values, or -indirectly to the plain word-map. The SWI-Prolog NLP package provides -complimentary building blocks, such as a tokenizer, Porter stem and -Double Metaphone. - - -\begin{description} - \predicate{rdf_new_literal_map}{1}{-Map} -Create a new literal map, returning an opaque handle. - - \predicate{rdf_destroy_literal_map}{1}{+Map} -Destroy a literal map. After this call, further use of the \arg{Map} -handle is illegal. Additional synchronisation is needed if maps that -are shared between threads are destroyed to guarantee the handle is -no longer used. In some scenarios rdf_reset_literal_map/1 -provides a safe alternative. - - \predicate{rdf_reset_literal_map}{1}{+Map} -Delete all content from the literal map. - - \predicate{rdf_insert_literal_map}{3}{+Map, +Key, +Value} -Add a relation between \arg{Key} and \arg{Value} to the map. If -this relation already exists no action is performed. - - \predicate{rdf_insert_literal_map}{4}{+Map, +Key, +Value, -KeyCount} -As rdf_insert_literal_map/3. In addition, if \arg{Key} is a new key in -\arg{Map}, unify \arg{KeyCount} with the number of keys in \arg{Map}. -This serves two purposes. Derived maps, such as the stem and metaphone -maps need to know about new keys and it avoids additional foreign calls -for doing the progress in \file{rdf_litindex.pl}. - - \predicate{rdf_delete_literal_map}{2}{+Map, +Key} -Delete \arg{Key} and all associated values from the map. Succeeds -always. - - \predicate{rdf_delete_literal_map}{2}{+Map, +Key, +Value} -Delete the association between \arg{Key} and \arg{Value} from the map. -Succeeds always. - - \predicate[det]{rdf_find_literal_map}{3}{+Map, +KeyList, -ValueList} -Unify \arg{ValueList} with an ordered set of values associated to -all keys from \arg{KeyList}. Each key in \arg{KeyList} is either an -atom, an integer or a term \term{not}{Key}. If not-terms are provided, -there must be at least one positive keywords. The negations are tested -after establishing the positive matches. - - \predicate{rdf_keys_in_literal_map}{3}{+Map, +Spec, -Answer} -Realises various queries on the key-set: - - \begin{description} - \termitem{all}{} -Unify \arg{Answer} with an ordered list of all keys. - - \termitem{key}{+Key} -Succeeds if \arg{Key} is a key in the map and unify \arg{Answer} -with the number of values associated with the key. This provides -a fast test of existence without fetching the possibly large associated -value set as with rdf_find_literal_map/3. - - \termitem{prefix}{+Prefix} -Unify \arg{Answer} with an ordered set of all keys that have the -given prefix. See \secref{rdfquery} for details on prefix matching. -\arg{Prefix} must be an atom. This call is intended for auto-completion -in user interfaces. - - \termitem{ge}{+Min} -Unify \arg{Answer} with all keys that are larger or equal to the -integer \arg{Min}. - - \termitem{le}{+Max} -Unify \arg{Answer} with all keys that are smaller or equal to the -integer \arg{Max}. - - - \termitem{between}{+Min, +Max} -Unify \arg{Answer} with all keys between \arg{Min} and \arg{Max} -(including). - \end{description} - - \predicate{rdf_statistics_literal_map}{2}{+Map, +Key(-Arg...)} -Query some statistics of the map. Provides keys are: - \begin{description} - \termitem{size}{-Keys, -Relations} -Unify \arg{Keys} with the total key-count of the index and -\arg{Relation} with the total \arg{Key}-\arg{Value} count. - \end{description} -\end{description} - - - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - % PERSISTENCY % - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -\subsection{Library semweb/rdf_persistency} -\label{sec:persistency} - -\index{Persistent store}% -The \pllib{semweb/rdf_persistency} provides reliable persistent storage -for the RDF data. The store uses a directory with files for each source -(see rdf_source/1) present in the database. Each source is represented -by two files, one in binary format (see rdf_save_db/2) representing the -base state and one represented as Prolog terms representing the changes -made since the base state. The latter is called the \jargon{journal}. - - -\begin{description} - \predicate{rdf_attach_db}{2}{+Directory, +Options} -Attach \arg{Directory} as the persistent database. If \arg{Directory} -does not exist it is created. Otherwise all sources defined in the -directory are loaded into the RDF database. Loading a source means -loading the base state (if any) and replaying the journal (if any). The -current implementation does not synchronise triples that are in the -store before attaching a database. They are not removed from the -database, nor added to the presistent store. Different merging options -may be supported through the \arg{Options} argument later. Currently -defined options are: - - \begin{description} - \termitem{concurrency}{+PosInt} -Number of threads used to reload databased and journals from the -files in \arg{Directory}. Default is the number of physical CPUs -determined by the Prolog flag \const{cpu_count} or 1 (one) on -systems where this number is unknown. See also concurrent/3. - - \termitem{max_open_journals}{+PosInt} -The library maintains a pool of open journal files. This option -specifies the size of this pool. The default is 10. Raising the -option can make sense if many writes occur on many different named -graphs. The value can be lowered for scenarios where write operations -are very infrequent. - - \termitem{silent}{Boolean} -If \const{true}, supress loading messages from rdf_attach_db/2. - - \termitem{log_nested_transactions}{Boolean} -If \const{true}, nested \emph{log} transactions are added to the journal -information. By default (\const{false}), no log-term is added for nested -transactions. - \end{description} - -The database is locked against concurrent access using a file -\file{lock} in \arg{Directory}. An attempt to attach to a locked -database raises a \const{permission_error} exception. The error -context contains a term \term{rdf_locked}{Args}, where args is -a list containing \term{time}{Stamp} and \term{pid}{PID}. The -error can be caught by the application. Otherwise it prints: - -\begin{code} -ERROR: No permission to lock rdf_db `/home/jan/src/pl/packages/semweb/DB' -ERROR: locked at Wed Jun 27 15:37:35 2007 by process id 1748 -\end{code} - - \predicate{rdf_detach_db}{0}{} -Detaches the persistent store. No triples are removed from the RDF -triple store. - - \predicate{rdf_current_db}{1}{-Directory} -Unify \arg{Directory} with the current database directory. Fails if no -persistent database is attached. - - \predicate{rdf_persistency}{2}{+DB, +Bool} -Change presistency of named database (4th argument of rdf/4). By default -all databases are presistent. Using \const{false}, the journal and -snapshot for the database are deleted and further changes to triples -associated with \arg{DB} are not recorded. If \arg{Bool} is \const{true} -a snapshot is created for the current state and further modifications -are monitored. Switching persistency does not affect the triples in the -in-memory RDF database. - - \predicate{rdf_flush_journals}{1}{+Options} -Flush dirty journals. With the option \term{min_size}{KB} only journals -larger than \arg{KB} Kbytes are merged with the base state. Flushing a -journal takes the following steps, ensuring a stable state can be -recovered at any moment. - \begin{enumerate} - \item Save the current database in a new file using the - extension \fileext{new}. - \item On success, delete the journal - \item On success, atomically move the \fileext{new} file - over the base state. - \end{enumerate} - -Note that journals are \emph{not} merged automatically for two reasons. -First of all, some applications may decide never to merge as the journal -contains a complete \jargon{changelog} of the database. Second, merging -large databases can be slow and the application may wish to schedule -such actions at quiet times or scheduled maintenance periods. -\end{description} - -\subsubsection{Enriching the journals} -\label{sec:enrich} - -The above predicates suffice for most applications. The predicates in -this section provide access to the journal files and the base state -files and are intented to provide additional services, such as reasoning -about the journals, loaded files, etc.% - \footnote{A library \pllib{rdf_history} is under development - exploiting these features supporting wiki style editing - of RDF.} - -Using \term{rdf_transaction}{Goal, log(Message)}, we can add additional -records to enrich the journal of affected databases with \arg{Term} and -some additional bookkeeping information. Such a transaction adds a term -\term{begin}{Id, Nest, Time, Message} before the change operations on -each affected database and \term{end}{Id, Nest, Affected} after the -change operations. Here is an example call and content of the journal -file \file{mydb.jrn}. A full explanation of the terms that appear in -the journal is in the description of rdf_journal_file/2. - -\begin{code} -?- rdf_transaction(rdf_assert(s,p,o,mydb), log(by(jan))). -\end{code} - -\begin{code} -start([time(1183540570)]). -begin(1, 0, 1183540570.36, by(jan)). -assert(s, p, o). -end(1, 0, []). -end([time(1183540578)]). -\end{code} - -Using \term{rdf_transaction}{Goal, log(Message, DB)}, where \arg{DB} is -an atom denoting a (possibly empty) named graph, the system guarantees -that a non-empty transaction will leave a possibly empty transaction -record in DB. This feature assumes named graphs are named after the user -making the changes. If a user action does not affect the user's graph, -such as deleting a triple from another graph, we still find record of -all actions performed by some user in the journal of that user. - -\begin{description} - \predicate{rdf_journal_file}{2}{?DB, ?JournalFile} True if -\arg{File} is the absolute file name of an existing named graph -\arg{DB}. A journal file contains a sequence of Prolog terms of the -following format.% - \footnote{Future versions of this library may use an XML - based language neutral format.} - -\begin{description} - \termitem{start}{Attributes} -Journal has been opened. Currently \arg{Attributes} contains a -term \term{time}{Stamp}. - - \termitem{end}{Attributes} -Journal was closed. Currently \arg{Attributes} contains a -term \term{time}{Stamp}. - - \termitem{assert}{Subject, Predicate, Object} -A triple \{Subject, Predicate, Object\} was added to the database. - - \termitem{assert}{Subject, Predicate, Object, Line} -A triple \{Subject, Predicate, Object\} was added to the database -with given \arg{Line} context. - - \termitem{retract}{Subject, Predicate, Object} -A triple \{Subject, Predicate, Object\} was deleted from the database. -Note that an rdf_retractall/3 call can retract multiple triples. Each -of them have a record in the journal. This allows for `undo'. - - \termitem{retract}{Subject, Predicate, Object, Line} -Same as above, for a triple with associated line info. - - \termitem{update}{Subject, Predicate, Object, Action} -See rdf_update/4. - - \termitem{begin}{Id, Nest, Time, Message} -Added before the changes in each database affected by a transaction -with transaction identifier \term{log}{Message}. \arg{Id} is an -integer counting the logged transactions to this database. Numbers -are increasing and designed for binary search within the journal file. -\arg{Nest} is the nesting level, where `0' is a toplevel transaction. -\arg{Time} is a time-stamp, currently using float notation with two -fractional digits. \arg{Message} is the term provided by the user -as argument of the \term{log}{Message} transaction. - - \termitem{end}{Id, Nest, Others} -Added after the changes in each database affected by a transaction with -transaction identifier \term{log}{Message}. \arg{Id} and \arg{Nest} -match the begin-term. \arg{Others} gives a list of other databases -affected by this transaction and the \arg{Id} of these records. The -terms in this list have the format \arg{DB}:\arg{Id}. -\end{description} - - \predicate{rdf_db_to_file}{2}{?DB, ?FileBase} -Convert between \arg{DB} (see rdf_source/1) and file base-file used -for storing information on this database. The full file is located -in the directory described by rdf_current_db/1 and has the extension -\fileext{trp} for the base state and \fileext{jrn} for the journal. -\end{description} - - - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - % TURTLE % - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -\input{rdfturtle.tex} -\input{rdfturtlewrite.tex} - - - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - % RDFS % - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -\section{Library semweb/rdfs} -\label{sec:rdfs} - -\index{RDF-Schema}% -The \pllib{semweb/rdfs} library adds interpretation of the triple store -in terms of concepts from RDF-Schema (RDFS). There are two ways to -provide support for more high level languages in RDF. One is to view -such languages as a set of \jargon{entailment rules}. In this model the -rdfs library would provide a predicate \predref{rdfs}{3} providing the -same functionality as rdf/3 on union of the raw graph and triples that -can be derived by applying the RDFS entailment rules. - -Alternatively, RDFS provides a view on the RDF store in terms of -individuals, classes, properties, etc., and we can provide predicates -that query the database with this view in mind. This is the approach -taken in the \pllib{semweb/rdfs.p}l library, providing calls like -\term{rdfs_individual_of}{?Resource, ?Class}.% - \footnote{The SeRQL language is based on querying the deductive - closure of the triple set. The SWI-Prolog SeRQL - library provides \jargon{entailment modules} that - take the approach outlined above.} - - -\subsection{Hierarchy and class-individual relations} - -The predicates in this section explore the \const{rdfs:subPropertyOf}, -\const{rdfs:subClassOf} and \const{rdf:type} relations. Note that the -most fundamental of these, \const{rdfs:subPropertyOf}, is also used -by rdf_has/[3,4]. - -\begin{description} - \predicate{rdfs_subproperty_of}{2}{?SubProperty, ?Property} -True if \arg{SubProperty} is equal to \arg{Property} or \arg{Property} -can be reached from \arg{SubProperty} following the -\const{rdfs:subPropertyOf} relation. It can be used to test as well as -generate sub-properties or super-properties. Note that the commonly used -semantics of this predicate is wired into rdf_has/[3,4].% - \bug{The current implementation cannot deal with - cycles}.% - \bug{The current implementation cannot deal with predicates - that are an \const{rdfs:subPropertyOf} of - \const{rdfs:subPropertyOf}, such as - \const{owl:samePropertyAs}.} - - \predicate{rdfs_subclass_of}{2}{?SubClass, ?Class} -True if \arg{SubClass} is equal to \arg{Class} or \arg{Class} -can be reached from \arg{SubClass} following the -\const{rdfs:subClassOf} relation. It can be used to test as -well as generate sub-classes or super-classes.% - \bug{The current implementation cannot deal with - cycles}. - - \predicate{rdfs_class_property}{2}{+Class, ?Property} -True if the domain of \arg{Property} includes \arg{Class}. Used to -generate all properties that apply to a class. - - \predicate{rdfs_individual_of}{2}{?Resource, ?Class} -True if \arg{Resource} is an indivisual of \arg{Class}. This implies -\arg{Resource} has an \const{rdf:type} property that refers to -\arg{Class} or a sub-class thereof. Can be used to test, generate -classes \arg{Resource} belongs to or generate individuals described -by \arg{Class}. -\end{description} - -\subsection{Collections and Containers} - -\index{parseType,Collection}% -\index{Collection,parseType}% -The RDF construct \const{rdf:parseType}=\const{Collection} constructs -a list using the \const{rdf:first} and \const{rdf:next} relations. - -\begin{description} - \predicate{rdfs_member}{2}{?Resource, +Set} -Test or generate the members of \arg{Set}. \arg{Set} is either an -individual of \const{rdf:List} or \const{rdf:Container}. - - \predicate{rdfs_list_to_prolog_list}{2}{+Set, -List} -Convert \arg{Set}, which must be an individual of \const{rdf:List} into -a Prolog list of objects. - - \predicate{rdfs_assert_list}{2}{+List, -Resource} -Equivalent to rdfs_assert_list/3 using \arg{DB} = \const{user}. - - \predicate{rdfs_assert_list}{3}{+List, -Resource, +DB} -If \arg{List} is a list of resources, create an RDF list \arg{Resource} -that reflects these resources. \arg{Resource} and the sublist resources -are generated with rdf_bnode/1. The new triples are associated with the -database \arg{DB}. -\end{description} - -\subsection{Labels and textual search} - -Textual search is partly handled by the predicates from the -\pllib{rdf_db} module and its underlying C-library. For example, -literal objects are hashed case-insensitive to speed up the commonly -used case-insensitive search. - -\begin{description} - \predicate[multi]{rdfs_label}{3}{?Resource, ?Language, ?Label} -Extract the label from \arg{Resource} or generate all resources with the -given \arg{Label}. The label is either associated using a sub-property -of \const{rdfs:label} or it is extracted from \arg{Resource} by taking -the part after the last \chr{\#} or \chr{/}. If this too fails, -\arg{Label} is unified with \arg{Resource}. \arg{Language} is unified -to the value of the \const{xml:lang} attribute of the label or a -variable if the label has no language specified. - - \predicate{rdfs_label}{2}{?Resource, ?Label} -Defined as \term{rdfs_label}{Resource, _, Label}. - - \predicate{rdfs_ns_label}{3}{?Resource, ?Language, ?Label} -Similar to rdfs_label/2, but prefixes the result using the declared -namespace alias (see \secref{rdfns}) to facilitate user-friendly labels -in applications using multiple namespaces that may lead to confusion. - - \predicate{rdfs_ns_label}{2}{?Resource, ?Label} -Defined as \term{rdfs_ns_label}{Resource, _, Label}. - - \predicate{rdfs_find}{5}{+String, +Description, ?Properties, +Method, -Subject} -\index{search}% -Find (on backtracking) \arg{Subject}s that satisfy a search -specification for textual attributes. \arg{String} is the string -searched for. \arg{Description} is an OWL description (see \secref{owl}) -specifying candidate resources. \arg{Properties} is a list of properties -to search for literal objects, \arg{Method} defines the textual -matching algorithm. All textual mapping is performed case-insensitive. -The matching-methods are described with rdf_match_label/3. If -\arg{Properties} is unbound, the search is performed in any property and -\arg{Properties} is unified with a list holding the property on which -the match was found. -\end{description} - - - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - % LIBRARY % - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -\input{rdflib.tex} - - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - % PLDOC LIBRARIES % - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -\input{sparqlclient.tex} -\input{rdfcompare.tex} -\input{rdfportray.tex} - - - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - % RDF-EDIT % - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -\section{Library semweb/rdf_edit} \label{sec:rdfedit} - -\begin{quote}\em -It is anticipated that this library will eventually be superseeded by -facilities running on top of the native rdf_transaction/2 and -rdf_monitor/2 facilities. See \secref{rdfmonitor}. -\end{quote} - -\index{undo}\index{journal}\index{transactions} -The module \file{rdf_edit.pl} is a layer than encasulates the -modification predicates from \secref{rdfmodify} for use from -a (graphical) editor of the triple store. It adds the -following features: - -\begin{itemlist} - \item [Transaction management] -Modifications are grouped into \emph{transactions} to safeguard -the system from failing operations as well as provide meaningfull -chunks for undo and journalling. - - \item [Undo] -Undo and redo-transactions using a single mechanism to support -user-friendly editing. - - \item [Journalling] -Record all actions to support analysis, versioning, crash-recovery -and an alternative to saving. -\end{itemlist} - -\subsection{Transaction management} - -Transactions group low-level modification actions together. - -\begin{description} - \predicate{rdfe_transaction}{1}{:Goal} -Run \arg{Goal}, recording all modifications to the triple store made -through \secref{rdfeencap}. Execution is performed as in once/1. If -\arg{Goal} succeeds the changes are committed. If \arg{Goal} fails -or throws an exception the changes are reverted. - -Transactions may be nested. A failing nested transaction only reverts -the actions performed inside the nested transaction. If the outer -transaction succeeds it is committed normally. Contrary, if the -outer transaction fails, comitted nested transactions are reverted -as well. If any of the modifications inside the transaction modifies -a protected file (see rdfe_set_file_property/2) the transaction is -reverted and rdfe_transaction/1 throws a permission error. - -A successful outer transaction (`level-0') may be undone using -rdfe_undo/0. - - \predicate{rdfe_transaction}{2}{:Goal, +Name} -As rdfe_transaction/1, naming the transaction \arg{Name}. Transaction -naming is intended for the GUI to give the user an idea of the next undo -action. See also rdfe_set_transaction_name/1 and -rdfe_transaction_name/2. - - \predicate{rdfe_set_transaction_name}{1}{+Name} -Set the `name' of the current transaction to \arg{Name}. - - \predicate{rdfe_transaction_name}{2}{?TID, ?Name} -Query assigned transaction names. - - \predicate{rdfe_transaction_member}{2}{+TID, -Action} -Enumerate the actions that took place inside a transaction. This can -be used by a GUI to optimise the MVC (Model-View-Controller) feedback -loop. \arg{Action} is one of: - -\begin{description} - \termitem{assert}{Subject, Predicate, Object} - \termitem{retract}{Subject, Predicate, Object} - \termitem{update}{Subject, Predicate, Object, Action} - \termitem{file}{load(Path)} - \termitem{file}{unload(Path)} -\end{description} -\end{description} - -\subsection{File management} \label{sec:file} - -\begin{description} - \predicate{rdfe_is_modified}{1}{?File} -Enumerate/test whether \arg{File} is modified sinds it was loaded or -sinds the last call to rdfe_clear_modified/1. Whether or not a file -is modified is determined by the MD5 checksum of all triples belonging -to the file. - - \predicate{rdfe_clear_modified}{1}{+File} -Set the \emph{unmodified-MD5} to the current MD5 checksum. See also -rdfe_is_modified/1. - - \predicate{rdfe_set_file_property}{2}{+File, +Property} -Control access right and default destination of new triples. -\arg{Property} is one of - - \begin{description} - \termitem{access}{+Access} - Where access is one of \const{ro} or \const{rw}. Access \const{ro} - is default when a file is loaded for which the user has no write - access. If a transaction (see rdfe_transaction/1) modifies a file - with access \const{ro} the transaction is reversed. - - \termitem{default}{+Default} - Set this file to be the default destination of triples. If - \arg{Default} is \const{fallback} it is only the default for - triples that have no clear default destination. If it is \const{all} - all new triples are added to this file. - \end{description} - - \predicate{rdfe_get_file_property}{2}{?File, ?Property} -Query properties set with rdfe_set_file_property/2. -\end{description} - - -\subsection{Encapsulated predicates} \label{sec:rdfeencap} - -The following predicates encapsulate predicates from the \file{rdf_db} -module that modify the triple store. These predicates can only be called -when inside a \emph{transaction}. See rdfe_transaction/1. - -\begin{description} - \predicate{rdfe_assert}{3}{+Subject, +Predicate, +Object} -Encapsulates rdf_assert/3. - \predicate{rdfe_retractall}{3}{?Subject, ?Predicate, ?Object} -Encapsulates rdf_retractall/3. - \predicate{rdfe_update}{4}{+Subject, +Predicate, +Object, +Action} -Encapsulates rdf_update/4. - \predicate{rdfe_load}{1}{+In} -Encapsulates rdf_load/1. - \predicate{rdfe_unload}{1}{+In} -Encapsulates rdf_unload/1. -\end{description} - -\subsection{High-level modification predicates} \label{sec:rdfeedit} - -This section describes a (yet very incomplete) set of more high-level -operations one would like to be able to perform. Eventually this set -may include operations based on RDFS and OWL. - -\begin{description} - \predicate{rdfe_delete}{1}{+Resource} -Delete all traces of \arg{resource}. This implies all triples where -\arg{Resource} appears as \emph{subject}, \emph{predicate} or -\emph{object}. This predicate starts a transation. -\end{description} - -\subsection{Undo} - -\index{undo}% -Undo aims at user-level undo operations from a (graphical) editor. - -\begin{description} - \predicate{rdfe_undo}{0}{} -Revert the last outermost (`level 0') transaction (see -rdfe_transaction/1). Successive calls go further back in history. Fails -if there is no more undo information. - - \predicate{rdfe_redo}{0}{} -Revert the last rdfe_undo/0. Successive calls revert more rdfe_undo/0 -operations. Fails if there is no more redo information. - - \predicate{rdfe_can_undo}{1}{-TID} -Test if there is another transaction that can be reverted. Used for -activating menus in a graphical environment. \arg{TID} is unified to -the transaction id of the action that will be reverted. - - \predicate{rdfe_can_redo}{1}{-TID} -Test if there is another undo that can be reverted. Used for -activating menus in a graphical environment. \arg{TID} is unified to -the transaction id of the action that will be reverted. -\end{description} - -\subsection{Journalling} - -\index{journal}% -Optionally, every action through this module is immediately send to a -\jargon{journal-file}. The journal provides a full log of all actions -with a time-stamp that may be used for inspection of behaviour, version -management, crash-recovery or an alternative to regular save operations. - -\begin{description} - \predicate{rdfe_open_journal}{2}{+File, +Mode} -Open a existing or new journal. If \arg{Mode} equala \const{append} -and \arg{File} exists, the journal is first replayed. See -rdfe_replay_journal/1. If \arg{Mode} is \const{write} the journal is -truncated if it exists. - - \predicate{rdfe_close_journal}{0}{} -Close the currently open journal. - - \predicate{rdfe_current_journal}{1}{-Path} -Test whether there is a journal and to which file the actions are -journalled. - - \predicate{rdfe_replay_journal}{1}{+File} -Read a journal, replaying all actions in it. To do so, the system -reads the journal a transaction at a time. If the transaction is -closed with a \emph{commit} it executes the actions inside the journal. -If it is closed with a \emph{rollback} or not closed at all due to a -crash the actions inside the journal are discarded. Using this -predicate only makes sense to inspect the state at the end of a journal -without modifying the journal. Normally a journal is replayed using the -\const{append} mode of rdfe_open_journal/2. -\end{description} - - -\subsection{Broadcasting change events} - -\index{event}\index{broadcast}% -To realise a modular graphical interface for editing the triple store, -the system must use some sort of \emph{event} mechanism. This is -implemented by the XPCE library \pllib{broadcast} which is described -in the \url[XPCE User -Guide]{http://hcs.science.uva.nl/projects/xpce/UserGuide/libbroadcast.html}. -In this section we describe the terms brodcasted by the library. - -\begin{description} - \termitem{rdf_transaction}{+Id} -A `level-0' transaction has been committed. The system passes the -identifier of the transaction in \arg{Id}. In the current implementation -there is no way to find out what happened inside the transaction. This -is likely to change in time. - -If a transaction is reverted due to failure or exception \emph{no} event -is broadcasted. The initiating GUI element is supposed to handle this -possibility itself and other components are not affected as the triple -store is not changed. - - \termitem{rdf_undo}{+Type, +Id} -This event is broadcasted after an rdfe_undo/0 or rdfe_redo/0. -\arg{Type} is one of \const{undo} or \const{redo} and \arg{Id} -identifies the transaction as above. -\end{description} - -\section{Related packages and issues} - -\index{Sesame}\index{SeRQL}% -The SWI-Prolog SemWeb package is designed to provide access to the -Semantic Web languages from Prolog. It consists of the low level -\file{rdf_db.pl} store with layers such as \pllib{semweb/rdfs.pl} to provide -more high level querying of a triple set with relations such as -rdfs_individual_of/2, rdfs_subclass_of/2, etc. -\url[SeRQL]{http://www.openrdf.org} is a semantic web query language -taking another route. Instead of providing alternative relations -SeRQL defines a graph query on de \jargon{deductive closure} of the -triple set. For example, under assumption of RDFS entailment rules -this makes the query \term{rdf}{S, rdf:type, Class} equivalent to -\term{rdfs_individual_of}{S, Class}. - -\index{optimising,query}% -We developed a parser for SeRQL which compiles SeRQL path expressions -into Prolog conjunctions of \term{rdf}{Subject, Predicate, Object} -calls. \jargon{Entailment modules} realise a fully logical -implementation of rdf/3 including the entailment reasoning required to -deal with a Semantic Web language or application specific reasoning. The -infra structure is completed with a query optimiser and an HTTP server -compliant to the \url[Sesame]{http://www.openrdf.org} implementation of -the SeRQL language. The Sesame Java client can be used to access Prolog -servers from Java, while the Prolog client can be used to access the -Sesame SeRQL server. For further details, see the -\url[project -home]{http://gollem.science.uva.nl/twiki/pl/bin/view/Library/SeRQL}. - - - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - % OWL % - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -\section{OWL} \label{sec:owl} - -\index{OWL}% -The SWI-Prolog Semantic Web library provides no direct support for OWL. -OWL(-2) support is provided through Thea, an OWL library for SWI-Prolog -See \url{http://www.semanticweb.gr/TheaOWLLib/}. - - -\section*{Acknowledgements} - -This research was supported by the following projects: MIA and -MultimediaN project (www.multimedian.nl) funded through the BSIK -programme of the Dutch Government, the FP-6 project HOPS of the -European Commision. - -The implementation of AVL trees is based on libavl by Brad Appleton. -See the source file \file{avl.c} for details. - - - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - % FOOTER % - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -\printindex - -\end{document} - - diff --git a/packages/semweb/sparql_client.pl b/packages/semweb/sparql_client.pl deleted file mode 100644 index 3600036b9..000000000 --- a/packages/semweb/sparql_client.pl +++ /dev/null @@ -1,319 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog - - Author: Jan Wielemaker - E-mail: J.Wielemaker@cs.vu.nl - WWW: http://www.swi-prolog.org - Copyright (C): 2004-2010, University of Amsterdam - VU University Amsterdam - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - As a special exception, if you link this library with other files, - compiled with a Free Software compiler, to produce an executable, this - library does not by itself cause the resulting executable to be covered - by the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -:- module(sparql_client, - [ sparql_query/3, % +Query, -Row, +Options - sparql_set_server/1, % +Options - sparql_read_xml_result/2 % +Stream, -Result - ]). -:- use_module(library(http/http_open)). -:- use_module(library(lists)). -:- use_module(library(rdf)). -:- use_module(library(option)). - -/** <module> SPARQL client library - -This module provides a SPARQL client. For example: - - == - ?- sparql_query('select * where { ?x rdfs:label "Amsterdam" }', Row, - [ host('dbpedia.org'), path('/sparql')]). - - Row = row('http://www.ontologyportal.org/WordNet#WN30-108949737') ; - false. - == - -Or, querying a local server using an =ASK= query: - - == - ?- sparql_query('ask { owl:Class rdfs:label "Class" }', Row, - [ host('localhost'), port(3020), path('/sparql/')]). - Row = true. - == -*/ - - -%% sparql_query(+Query, -Result, +Options) is nondet. -% -% Execute a SPARQL query on an HTTP SPARQL endpoint. Query is an -% atom that denotes the query. Result is unified to a term -% rdf(S,P,O) for =CONSTRUCT= and =DESCRIBE= queries, row(...) for -% =SELECT= queries and =true= or =false= for =ASK= queries. -% Options are -% -% * host(+Host) -% * port(+Port) -% * path(+Path) -% The above three options set the location of the server. -% * search(+ListOfParams) -% Provide additional query parameters, such as the graph. -% * variable_names(-ListOfNames) -% Unifies ListOfNames with a list of atoms that describe the -% names of the variables in a =SELECT= query. -% -% Remaining options are passed to http_open/3. The defaults for -% Host, Port and Path can be set using sparql_set_server/1. The -% initial default for port is 80 and path is =|/sparql/|=. - -sparql_query(Query, Row, Options) :- - sparql_param(host(Host), Options, Options1), - sparql_param(port(Port), Options1, Options2), - sparql_param(path(Path), Options2, Options3), - select_option(search(Extra), Options3, Options4, []), - select_option(variable_names(VarNames), Options4, Options5, _), - http_open([ protocol(http), - host(Host), - port(Port), - path(Path), - search([ query = Query - | Extra - ]) - | Options5 - ], In, - [ header(content_type, ContentType) - ]), - plain_content_type(ContentType, CleanType), - read_reply(CleanType, In, VarNames, Row). - -read_reply('application/rdf+xml', In, _, Row) :- !, - call_cleanup(load_rdf(stream(In), RDF), close(In)), - member(Row, RDF). -read_reply(MIME, In, VarNames, Row) :- - sparql_result_mime(MIME), !, - call_cleanup(sparql_read_xml_result(stream(In), Result), - close(In)), - varnames(Result, VarNames), - xml_result(Result, Row). -read_reply(Type, In, _, _) :- - read_stream_to_codes(In, Codes), - string_to_list(Reply, Codes), - close(In), - throw(error(domain_error(sparql_result_document, Type), - context(_, Reply))). - -sparql_result_mime('application/sparql-results+xml'). -sparql_result_mime('application/sparql-result+xml'). - - -plain_content_type(Type, Plain) :- - sub_atom(Type, B, _, _, (;)), !, - sub_string(Type, 0, B, _, Main), - normalize_space(atom(Plain), Main). -plain_content_type(Type, Type). - -xml_result(ask(Bool), Result) :- !, - Result = Bool. -xml_result(select(_VarNames, Rows), Result) :- - member(Result, Rows). - -varnames(ask(_), _). -varnames(select(VarTerm, _Rows), VarNames) :- - VarTerm =.. [_|VarNames]. - - - /******************************* - * SETTINGS * - *******************************/ - -:- dynamic - sparql_setting/1. - -sparql_setting(port(80)). -sparql_setting(path('/sparql/')). - -sparql_param(Param, Options0, Options) :- - select_option(Param, Options0, Options), !. -sparql_param(Param, Options, Options) :- - sparql_setting(Param), !. -sparql_param(Param, Options, Options) :- - functor(Param, Name, _), - throw(error(existence_error(option, Name), _)). - -%% sparql_set_server(+OptionOrList) -% -% Set sparql server default options. Provided defaults are: -% host, port and repository. For example: -% -% == -% set_sparql_default([ host(localhost), -% port(8080) -% repository(world) -% ]) -% == - -sparql_set_server([]) :- !. -sparql_set_server([H|T]) :- !, - sparql_set_server(H), - sparql_set_server(T). -sparql_set_server(Term) :- - functor(Term, Name, Arity), - functor(Unbound, Name, Arity), - retractall(sparql_setting(Unbound)), - assert(sparql_setting(Term)). - - - /******************************* - * RESULT * - *******************************/ - -ns(sparql, 'http://www.w3.org/2005/sparql-results#'). - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Read the SPARQL XML result format as defined in -http://www.w3.org/TR/rdf-sparql-XMLres/, version 6 April 2006. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - - /******************************* - * MACRO HANDLING * - *******************************/ - -% substitute 'sparql' by the namespace defined above for better -% readability of the remainder of the code. - -term_subst(V, _, _, V) :- - var(V), !. -term_subst(F, F, T, T) :- !. -term_subst(C, F, T, C2) :- - compound(C), !, - functor(C, Name, Arity), - functor(C2, Name, Arity), - term_subst(0, Arity, C, F, T, C2). -term_subst(T, _, _, T). - -term_subst(A, A, _, _, _, _) :- !. -term_subst(I0, Arity, C0, F, T, C) :- - I is I0 + 1, - arg(I, C0, A0), - term_subst(A0, F, T, A), - arg(I, C, A), - term_subst(I, Arity, C0, F, T, C). - -term_expansion(T0, T) :- - ns(sparql, NS), - term_subst(T0, sparql, NS, T). - - - /******************************* - * READING * - *******************************/ - -%% sparql_read_xml_result(+Input, -Result) -% -% Specs from http://www.w3.org/TR/rdf-sparql-XMLres/. The returned -% Result term is of the format: -% -% * select(VarNames, Rows) -% Where VarNames is a term v(Name, ...) and Rows is a -% list of row(....) containing the column values in the -% same order as the variable names. -% -% * ask(Bool) -% Where Bool is either =true= or =false= - -sparql_read_xml_result(Input, Result) :- - load_structure(Input, DOM, - [ dialect(xmlns), - space(remove) - ]), - dom_to_result(DOM, Result). - -dom_to_result(DOM, Result) :- - ( sub_element(DOM, sparql:head, _HAtt, Content) - -> variables(Content, Vars) - ; Vars = [] - ), - ( Vars == [], - sub_element(DOM, sparql:boolean, _, [TrueFalse]) - -> Result = ask(TrueFalse) - ; VarTerm =.. [v|Vars], - Result = select(VarTerm, Rows), - sub_element(DOM, sparql:results, _RAtt, RContent) - -> rows(RContent, Vars, Rows) - ). - -%% variables(+DOM, -Varnames) -% -% Deals with <variable name=Name>. Head also may contain <link -% href="..."/>. This points to additional meta-data. Not really -% clear what we can do with that. - -variables([], []). -variables([element(sparql:variable, Att, [])|T0], [Name|T]) :- !, - memberchk(name=Name, Att), - variables(T0, T). -variables([element(sparql:link, _, _)|T0], T) :- - variables(T0, T). - - -rows([], _, []). -rows([R|T0], Vars, [Row|T]) :- - row_values(Vars, R, Values), - Row =.. [row|Values], - rows(T0, Vars, T). - -row_values([], _, []). -row_values([Var|VarT], DOM, [Value|ValueT]) :- - ( sub_element(DOM, sparql:binding, Att, Content), - memberchk(name=Var, Att) - -> value(Content, Value) - ; Value = '$null$' - ), - row_values(VarT, DOM, ValueT). - -value([element(sparql:literal, Att, Content)], literal(Lit)) :- !, - lit_value(Content, Value), - ( memberchk(datatype=Type, Att) - -> Lit = type(Type, Value) - ; memberchk(xml:lang=Lang, Att) - -> Lit = lang(Lang, Value) - ; Lit = Value - ). -value([element(sparql:uri, [], [URI])], URI) :- !. -value([element(sparql:bnode, [], [NodeID])], URI) :- !, - atom_concat('__', NodeID, URI). % DUBIOUS -value([element(sparql:unbound, [], [])], '$null$'). - - -lit_value([], ''). -lit_value([Value], Value). - - -%% sub_element(+DOM, +Name, -Atttribs, -Content) - -sub_element(element(Name, Att, Content), Name, Att, Content). -sub_element(element(_, _, List), Name, Att, Content) :- - sub_element(List, Name, Att, Content). -sub_element([H|T], Name, Att, Content) :- - ( sub_element(H, Name, Att, Content) - ; sub_element(T, Name, Att, Content) - ). - diff --git a/packages/semweb/test.pl b/packages/semweb/test.pl deleted file mode 100644 index 31deb7717..000000000 --- a/packages/semweb/test.pl +++ /dev/null @@ -1,96 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog - - Author: Jan Wielemaker - E-mail: wielemak@science.uva.nl - WWW: http://www.swi-prolog.org - Copyright (C): 1985-2007, University of Amsterdam - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - As a special exception, if you link this library with other files, - compiled with a Free Software compiler, to produce an executable, this - library does not by itself cause the resulting executable to be covered - by the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -:- asserta(file_search_path(foreign, '../sgml')). -:- asserta(file_search_path(foreign, '../clib')). -:- asserta(file_search_path(foreign, '../zlib')). -:- asserta(file_search_path(library, '../sgml')). -:- asserta(file_search_path(library, '../clib')). -:- asserta(file_search_path(library, '../zlib')). -:- asserta(file_search_path(library, '../RDF')). -:- asserta(user:file_search_path(library, '../plunit')). -:- asserta(user:file_search_path(library, '..')). -:- asserta(user:file_search_path(foreign, '.')). - -:- use_module(library(plunit)). -:- use_module(library(uri)). -:- use_module(library(semweb/rdf_db)). -:- use_module(library(semweb/rdf_zlib_plugin)). -:- use_module(library(semweb/rdf_http_plugin)). - - -:- begin_tests(load, - [ setup(rdf_reset_db), - cleanup(rdf_reset_db) - ]). - -test(file, [true(N == 1), cleanup(rdf_reset_db)]) :- - rdf_load('Tests/test-001.rdf', [silent(true)]), - rdf_statistics(triples(N)). - -test(file, [true(N == 1), cleanup(rdf_reset_db)]) :- - uri_file_name(URI, 'Tests/test-001.rdf'), - rdf_load(URI, [silent(true)]), - rdf_statistics(triples(N)). - -test(gzip_file, [true(N == 1), cleanup(rdf_reset_db)]) :- - rdf_load('Tests/test-002.rdf', [silent(true)]), - rdf_statistics(triples(N)). - -test(gzip_file, [true(N == 1), cleanup(rdf_reset_db)]) :- - uri_file_name(URI, 'Tests/test-002.rdf'), - rdf_load(URI, [silent(true)]), - rdf_statistics(triples(N)). - -test(http, [true(N == 1), cleanup(rdf_reset_db)]) :- - rdf_load('http://gollem.science.uva.nl/SWI-Prolog/Tests/semweb/test-001.rdf', [silent(true)]), - rdf_statistics(triples(N)). - -test(gzip_http, [true(N == 1), cleanup(rdf_reset_db)]) :- - rdf_load('http://gollem.science.uva.nl/SWI-Prolog/Tests/semweb/test-002.rdf.gz', [silent(true)]), - rdf_statistics(triples(N)). - -:- end_tests(load). - -:- begin_tests(inverse). - -test(set, [cleanup(rdf_reset_db)]) :- - rdf_assert(r1, p1, r2), - rdf_set_predicate(p2, inverse_of(p1)), - rdf_has(r2, p2, r1). -test(clear, [cleanup(rdf_reset_db)]) :- - rdf_assert(r1, p1, r2), - rdf_set_predicate(p2, inverse_of(p1)), - rdf_has(r2, p2, r1), - rdf_set_predicate(p2, inverse_of([])), - \+ rdf_has(r2, p2, r1). - -:- end_tests(inverse). diff --git a/packages/semweb/test_rdf_db.pl b/packages/semweb/test_rdf_db.pl deleted file mode 100644 index 56815371f..000000000 --- a/packages/semweb/test_rdf_db.pl +++ /dev/null @@ -1,989 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog - - Author: Jan Wielemaker - E-mail: wielemak@science.uva.nl - WWW: http://www.swi-prolog.org - Copyright (C): 1985-2007, University of Amsterdam - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - As a special exception, if you link this library with other files, - compiled with a Free Software compiler, to produce an executable, this - library does not by itself cause the resulting executable to be covered - by the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -:- module(test_rdf_db, - [ test_rdf_db/0 - ]). - -:- asserta(user:file_search_path(foreign, '../sgml')). -:- asserta(user:file_search_path(library, '../sgml')). -:- asserta(user:file_search_path(library, '../plunit')). -:- asserta(user:file_search_path(foreign, '../clib')). -:- asserta(user:file_search_path(library, '../clib')). -:- asserta(user:file_search_path(library, '../RDF')). -:- asserta(user:file_search_path(foreign, '.')). -:- use_module(rdf_db). -:- use_module(rdfs). -:- use_module(library(xsdp_types)). -:- use_module(library(lists)). -:- use_module(library(plunit)). - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -RDF-DB test file. A test is a clause of the form: - - <TestSet>(<Name>-<Number>) :- Body. - -If the body fails, an appropriate error message is printed. So, all -goals are supposed to succeed. The predicate testset/1 defines the -available test sets. The public goals are: - - ?- runtest(+TestSet). - ?- test. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -test_rdf_db :- - test, - run_tests([ lang_matches - ]). - - - /******************************* - * TEST DATA * - *******************************/ - -data(string, ''). -data(string, 'This is a nice string'). -data(string, '\u0411\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u0430\u044f'). - -data(int, 0). -data(int, -67). -data(int, 327848). - -data(float, 0.0). -data(float, 48.25). - -data(term, [let, us, test, a, list]). -data(term, [let, us, test, another, list]). - - - /******************************* - * LOAD/SAVE * - *******************************/ - -save_reload_db :- - tmp_file(rdf, File), - rdf_save_db(File), - rdf_reset_db, - rdf_load_db(File), - delete_file(File). - - -save_reload :- - tmp_file(rdf, File), - rdf_save(File), - rdf_reset_db, - rdf_load(File, - [ base_uri([]), % do not qualify - convert_typed_literal(convert_typed), - format(xml) - ]), - delete_file(File). - -save_reload(Encoding) :- - tmp_file(rdf, File), - rdf_save(File, [encoding(Encoding)]), - rdf_reset_db, - rdf_load(File, - [ base_uri([]), % do not qualify - convert_typed_literal(convert_typed), - format(xml) - ]), - delete_file(File). - -% convert_typed(+Type, +Content, -Object) -% -% Convert to type(Type, PrologValue), providing the inverse of -% the default RDF as produced by rdf_db.pl - -convert_typed(Type, Content, type(Type, Value)) :- - xsdp_convert(Type, Content, Value). - - - /******************************* - * RESOURCE * - *******************************/ - -resource(1) :- - rdf_assert(x, a, aap), - rdf_assert(x, a, noot), - findall(X, rdf(x, a, X), L), - L == [aap, noot]. - - - /******************************* - * SIMPLE LITERAL * - *******************************/ - -literal(1) :- - findall(V, data(_, V), Vs), - forall(member(Value, Vs), - rdf_assert(x, a, literal(Value))), - findall(V, (rdf(x, a, X), X = literal(V)), V2), - V2 == Vs. - - - /******************************* - * UNIFYING ARGS * - *******************************/ - -same(1) :- - rdf_assert(a,b,c), - rdf_assert(x,x,x), - rdf(X,X,X), - X == x. - - /******************************* - * TYPED LITERALS * - *******************************/ - -typed(1) :- - findall(type(T,V), data(T, V), TVs), - forall(member(Value, TVs), - rdf_assert(x, a, literal(Value))), - findall(V, (rdf(x, a, X), X = literal(V)), V2), - V2 == TVs. -typed(2) :- - findall(type(T,V), data(T, V), TVs), - forall(member(Value, TVs), - rdf_assert(x, a, literal(Value))), - findall(V, rdf(x, a, literal(V)), V2), - V2 == TVs. -typed(3) :- - findall(type(T,V), data(T, V), TVs), - forall(member(Value, TVs), - rdf_assert(x, a, literal(Value))), - X = type(T,V), - findall(X, rdf(x, a, literal(X)), TV2), - TV2 == TVs. -typed(save_db) :- - findall(type(T,V), data(T, V), TVs), - forall(member(Value, TVs), - rdf_assert(x, a, literal(Value))), - save_reload_db, - X = type(T,V), - findall(X, rdf(x, a, literal(X)), TV2), - TV2 == TVs. -typed(save) :- - findall(type(T,V), - ( data(T, V), - T \== term, - V \== '' - ), TVs), - forall(member(Value, TVs), - rdf_assert(x, a, literal(Value))), - save_reload, - findall(X, rdf(x, a, literal(X)), TV2), - ( same_set(TV2, TVs) - -> true - ; format('TV2 = ~q~n', [TV2]), - fail - ). -typed(match) :- - rdf_assert(x, a, literal(c)), - \+ rdf(x, a, literal(type(t, c))), - \+ rdf(x, a, literal(type(t, _))). - - - /******************************* - * XML:LANG HANDLING * - *******************************/ - -lang_data :- - lang_data(x, a). - -lang_data(S, A) :- - rdf_assert(S, A, literal(lang(nl, 'Jan'))), - rdf_assert(S, A, literal(lang(en, 'John'))), - rdf_assert(S, A, literal(lang(en, ''))), - rdf_assert(S, A, literal('Johannes')). - -same_set(S1, S2) :- - sort(S1, Sorted1), - sort(S2, Sorted2), - Sorted1 =@= Sorted2. - -lang(1) :- - lang_data, - findall(X, rdf(x, a, literal(X)), Xs), - Xs == [ lang(nl, 'Jan'), - lang(en, 'John'), - lang(en, ''), - 'Johannes' - ]. -lang(2) :- - lang_data, - findall(X, rdf(x, a, literal(lang(nl, X))), Xs), - Xs == [ 'Jan' ]. -lang(3) :- - lang_data, - X = lang(_,_), - findall(X, rdf(x, a, literal(X)), Xs), - Xs =@= [ lang(nl, 'Jan'), - lang(en, 'John'), - lang(en, ''), - lang(_, 'Johannes') - ]. -lang(4) :- - lang_data, - rdf(S, P, literal('Jan')), S == x, P == a, - rdf(S, P, literal('Johannes')), S == x, P == a. -lang(save_db) :- - lang_data, - save_reload_db, - X = lang(_,_), - findall(X, rdf(x, a, literal(X)), Xs), - ( Xs =@= [ lang(nl, 'Jan'), - lang(en, 'John'), - lang(en, ''), - lang(_, 'Johannes') - ] - -> true - ; format(user_error, 'Xs = ~w~n', [Xs]), - fail - ). -lang(save) :- - lang_data, - save_reload, - findall(X, rdf(x, a, literal(X)), Xs), - ( same_set(Xs, - [ lang(nl, 'Jan'), - lang(en, 'John'), - lang(en, ''), - 'Johannes' - ]) - -> true - ; format(user_error, 'Xs = ~q~n', [Xs]), - fail - ). - - - /******************************* - * NAMESPACES * - *******************************/ - -term_expansion(ns_data(S0,P0,O0), - ns_data(S,P,O)) :- - rdf_global_id(S0, S), - rdf_global_id(P0, P), - rdf_global_id(O0, O). - -:- rdf_register_ns(dynamic, 'http://www.dynamic.org/'). - -ns_data(x, rdf:type, rdf:is). -ns_data(y, rdf:type, rdf:(dynamic)). -ns_data(z, rdf:type, (dynamic):rdf). -ns_data(z, (dynamic):attr1, literal(dynamic)). -ns_data(z, (dynamic):attr2, (dynamic):rdf). - -namespace(save) :- - findall(rdf(S,P,O), ns_data(S,P,O), Triples), - forall(member(rdf(S,P,O), Triples), rdf_assert(S,P,O)), - save_reload, - findall(rdf(S,P,O), rdf(S,P,O), NewTriples), - ( same_set(Triples, NewTriples) - -> true - ; format(user_error, 'NewTriples = ~q~n', [NewTriples]), - fail - ). - - - - - /******************************* - * LITERAL SHARING * - *******************************/ - -lshare(1) :- - rdf_assert(a,b,literal(aap)), - rdf_statistics(literals(1)). -lshare(2) :- - rdf_assert(a,b,literal(aap)), - rdf_retractall(a,b,literal(aap)), - rdf_statistics(literals(X)), - X == 0. -lshare(3) :- - rdf_assert(a,b,literal(aap)), - rdf_assert(a,c,literal(aap)), % shared - rdf_statistics(literals(1)). -lshare(4) :- - rdf_assert(a,b,literal(aap)), - rdf_assert(a,c,literal(aap)), - rdf_retractall(a,b,literal(aap)), - rdf_retractall(a,c,literal(aap)), - rdf_statistics(literals(X)), - X == 0. -lshare(5) :- - rdf_assert(a,b,literal(aap)), - rdf_assert(a,b,literal(aap)), - rdf_retractall(a,b,literal(aap)), - rdf_statistics(literals(X)), - X == 0. - - - /******************************* - * WIDE CHARACTERS * - *******************************/ - -wide_atom(A) :- - atom_codes(A, [97, 1080, 1081]). - -wide(iso-object-resource) :- - wide_atom(A), - rdf_assert(aap, noot, A), - save_reload(iso_latin_1). -wide(utf8-object-resource) :- - wide_atom(A), - rdf_assert(aap, noot, A), - save_reload(utf8). -wide(iso-object-literal) :- - wide_atom(A), - rdf_assert(aap, noot, literal(A)), - save_reload(iso_latin_1). -wide(utf8-object-literal) :- - wide_atom(A), - rdf_assert(aap, noot, literal(A)), - save_reload(utf8). -%wide(iso-predicate) :- Requires XML UTF-8 names. -% wide_atom(A), -% rdf_assert(aap, A, noot), -% save_reload(iso_latin_1). -%wide(utf8-predicate) :- -% wide_atom(A), -% rdf_assert(aap, A, noot), -% save_reload(utf8). -wide(iso-subject) :- - wide_atom(A), - rdf_assert(A, aap, noot), - save_reload(iso_latin_1). -wide(utf8-subject) :- - wide_atom(A), - rdf_assert(A, aap, noot), - save_reload(utf8). -wide(db-object-literal) :- - wide_atom(A), - rdf_assert(aap, noot, literal(A)), - save_reload_db. - - - - - /******************************* - * UPDATE * - *******************************/ - -update(subject) :- - rdf_assert(x, a, v), - rdf_update(x, a, v, subject(y)), - rdf(y, a, v). -update(predicate) :- - rdf_assert(x, a, v), - rdf_update(x, a, v, predicate(b)), - rdf(x, b, v). -update(object-1) :- - rdf_assert(x, a, v), - rdf_update(x, a, v, object(w)), - rdf(x, a, w). -update(object-2) :- - rdf_assert(x, a, v), - rdf_update(x, a, v, object(literal(hello))), - rdf(x, a, literal(hello)). -update(object-3) :- - rdf_assert(x, a, v), - rdf_update(x, a, v, object(literal(lang(nl, hallo)))), - rdf(x, a, literal(lang(nl, hallo))). -update(object-4) :- % add lang - rdf_assert(x, a, literal(hallo)), - rdf_update(x, a, literal(hallo), - object(literal(lang(nl, hallo)))), - rdf(x, a, literal(lang(nl, hallo))). -update(object-5) :- % only change lang - rdf_assert(x, a, literal(lang(en, hallo))), - rdf_update(x, a, literal(lang(en, hallo)), - object(literal(lang(nl, hallo)))), - rdf(x, a, literal(lang(nl, hallo))). -update(object-6) :- % drop lang - rdf_assert(x, a, literal(lang(en, hallo))), - rdf_update(x, a, literal(lang(en, hallo)), - object(literal(hallo))), - rdf(x, a, literal(hallo)). -update(object-7) :- % transaction update - rdf_assert(x, a, literal(lang(en, hallo))), - rdf_transaction(rdf_update(x, a, literal(lang(en, hallo)), - object(literal(hallo)))), - rdf(x, a, literal(hallo)). - - - /******************************* - * TRANSACTIONS * - *******************************/ - -transaction(empty-1) :- - rdf_transaction(true), - findall(rdf(S,P,O), rdf(S,P,O), L), - L == []. -transaction(assert-1) :- - rdf_transaction(rdf_assert(x, a, v)), - findall(rdf(S,P,O), rdf(S,P,O), L), - L == [ rdf(x, a, v) - ]. -transaction(assert-2) :- - \+ rdf_transaction((rdf_assert(x, a, v), fail)), - findall(rdf(S,P,O), rdf(S,P,O), L), - L == []. -transaction(nest-1) :- - rdf_transaction( ( rdf_assert(x, a, v), - rdf_transaction(rdf_assert(x, a, v2)))), - findall(rdf(S,P,O), rdf(S,P,O), L), - L == [ rdf(x, a, v), - rdf(x, a, v2) - ]. -transaction(nest-2) :- - rdf_transaction( ( rdf_assert(x, a, v), - \+ rdf_transaction((rdf_assert(x, a, v2),fail)))), - findall(rdf(S,P,O), rdf(S,P,O), L), - L == [ rdf(x, a, v) - ]. -transaction(deadlock-1) :- - rdf_assert(x,y,z,g), - rdf_assert(x,y,z,g), - rdf_transaction(rdf(_S, _P, _O, _G)). -transaction(deadlock-2) :- - tmp_file(rdf, F1), - tmp_file(rdf, F2), - rdf_assert(a, b, c, f1), - rdf_assert(x, y, z, f2), - rdf_save_db(F1, f1), - rdf_save_db(F2, f2), - rdf_reset_db, - - rdf_assert(l, f, F1), - rdf_assert(l, f, F2), - rdf_transaction(forall(rdf(l, f, F), - rdf_load_db(F))), - findall(rdf(S,P,O), rdf(S,P,O), L), - L == [ rdf(l,f,F1), - rdf(l,f,F2), - rdf(a,b,c), - rdf(x,y,z) - ], - delete_file(F1), - delete_file(F2). -transaction(active-1) :- - \+ rdf_active_transaction(_). -transaction(active-2) :- - rdf_transaction(rdf_active_transaction(x), x). -transaction(active-3) :- - rdf_transaction(findall(X, rdf_active_transaction(X), Xs), x), - Xs == [x]. -transaction(active-4) :- - rdf_transaction(rdf_active_transaction(Y), X), - X == Y. -transaction(active-5) :- - rdf_transaction(rdf_active_transaction(x), X), - X == x. - - - /******************************* - * LABELS * - *******************************/ - -label(1) :- - rdf_global_id(rdfs:label, Label), - lang_data(x, Label), - findall(L, rdfs_label(x, L), Ls), Ls = ['Jan', 'John', '', 'Johannes']. -label(2) :- - rdf_global_id(rdfs:label, Label), - lang_data(x, Label), - findall(L, rdfs_label(x, en, L), Ls), Ls = ['John', '']. - - - /******************************* - * MATCH * - *******************************/ - -match(1) :- - rdf_assert(a,b,literal('hello there world!')), - rdf(a,b,literal(substring('llo'), _)). -match(2) :- - rdf_assert(a,b,literal('hello there world!')), - rdf(a,b,literal(word('there'), _)). -match(3) :- - rdf_assert(a,b,literal('hello there world!')), - rdf(a,b,literal(word('hello'), _)). -match(4) :- - rdf_assert(a,b,literal('hello there world!')), - rdf(a,b,literal(word('world'), _)). -match(5) :- - rdf_assert(a,b,literal('hello there world!')), - rdf(a,b,literal(like('*there*'), _)). -match(6) :- - rdf_assert(a,b,literal('hello there world!')), - rdf(a,b,literal(like('*world!*'), _)). -match(7) :- % test backtracking - rdf_assert(a,b,literal('hello there world there universe!')), - rdf(a,b,literal(like('*th*uni*'), _)). - - - /******************************* - * PREFIX * - *******************************/ - -prefix_data(s, p1, aaaaa). -prefix_data(s, p1, aaaab). -prefix_data(s, p1, aaabb). -prefix_data(s, p1, aaacc). -prefix_data(s, p1, aaccc). -prefix_data(s, p1, adddd). - -prefix_data(s, p2, 'BBBBB'). -prefix_data(s, p2, 'bbbbb'). -prefix_data(s, p2, 'bbbcc'). -prefix_data(s, p2, 'BBBcc'). - -mkprefix_db(P) :- - forall(prefix_data(S,P,O), - rdf_assert(S, P, literal(O))). - -tprefix(P, Prefix) :- - mkprefix_db(P), - findall(rdf(A,P,L), rdf(A,P,literal(prefix(Prefix), L)), List), - findall(rdf(A,P,L), - ( prefix_data(A,P,L), - case_prefix(Prefix, L) - ), L2), -% writeln(List), - L2 == List. - -case_prefix(Prefix, Atom) :- - atom_codes(Prefix, PC), - atom_codes(Atom, AC), - prefix_codes(PC, AC). - -prefix_codes([], _). -prefix_codes([H0|T0], [H|T]) :- - code_type(L, to_lower(H0)), - code_type(L, to_lower(H)), - prefix_codes(T0, T). - -prefix(1) :- tprefix(p1, ''). -prefix(2) :- tprefix(p1, a). -prefix(3) :- tprefix(p1, aa). -prefix(4) :- tprefix(p1, aaa). -prefix(5) :- tprefix(p1, aaaa). -prefix(6) :- tprefix(p1, aaaaa). -prefix(7) :- tprefix(p2, bbbb). -prefix(8) :- tprefix(p2, bbbbb). -prefix(9) :- tprefix(p2, 'Bbbbb'). -prefix(10) :- tprefix(p2, 'BBBBB'). - -prefix(like-1) :- - mkprefix_db(_), - findall(L, rdf(_,_,literal(like('a*b'), L)), Ls), - Ls = [aaaab, aaabb]. - - - /******************************* - * RETRACTALL * - *******************************/ - -rdf_retractall(nopred-1) :- - rdf_retractall(aap, noot, mies). -rdf_retractall(term) :- - rdf_assert(a, b, literal(x)), - rdf_assert(a, b, literal(x(1))), - rdf_retractall(a, b, literal(x(_))), - findall(V, rdf(a,b,V), [literal(x)]). - - - /******************************* - * MONITOR * - *******************************/ - -do_monitor(assert(S, P, O, DB)) :- - atom(O), - ip(P, IP), - rdf_transaction(rdf_assert(O, IP, S, DB)). -do_monitor(retract(S, P, O, DB)) :- - atom(O), - ip(P, IP), - rdf_transaction(rdf_retractall(O, IP, S, DB)). - -ip(a, ia). -ip(b, ib). - -monitor(transaction-1) :- - rdf_reset_db, - rdf_monitor(do_monitor, []), - rdf_transaction(rdf_assert(x, a, y, db)), - rdf_monitor(do_monitor, [-all]), - findall(rdf(S,P,O), rdf(S,P,O), DB), - DB == [ rdf(x, a, y), - rdf(y, ia, x) - ]. - - - /******************************* - * SUB-PROPERTY * - *******************************/ - - -subproperty(1) :- - rdf_assert(a, p, b), - \+ rdf_has(_, p2, b, _). - - - /******************************* - * PROPERTY HIERACHY * - *******************************/ - -%% ptree/1 -% -% Property hierarchy handling for rdf_has/3. The routines maintain -% clouds of connected properties and for each cloud a bitmatrix -% filled with the closure of the rdfs:subPropertyOf relation. - -ptree(1) :- - rdf_assert(a, rdfs:subPropertyOf, b), - rdf_assert(x, a, y), - rdf_has(x, b, y). -ptree(2) :- % simple cycle - rdf_assert(a, rdfs:subPropertyOf, b), - rdf_assert(b, rdfs:subPropertyOf, a), - rdf_assert(x, a, y), - rdf_has(x, b, y). -ptree(3) :- % self-cycle - rdf_assert(a, rdfs:subPropertyOf, a), - rdf_assert(x, a, y), - rdf_has(x, a, y). -ptree(4) :- % two roots - rdf_assert(c, rdfs:subPropertyOf, b), - rdf_assert(c, rdfs:subPropertyOf, d), - rdf_assert(x, c, y), - rdf_has(x, b, y), - rdf_has(x, d, y). -ptree(5) :- % two roots, 2nd leg - rdf_assert(c, rdfs:subPropertyOf, b), - rdf_assert(c, rdfs:subPropertyOf, d), - rdf_assert(a, rdfs:subPropertyOf, b), - rdf_assert(x, c, y), - rdf_assert(x, a, z), - rdf_has(x, b, y), - rdf_has(x, d, y), - rdf_has(x, b, z), - \+ rdf_has(x, d, z). -ptree(6) :- % two root cycles - rdf_assert(c, rdfs:subPropertyOf, b), - rdf_assert(c, rdfs:subPropertyOf, d), - rdf_assert(b, rdfs:subPropertyOf, bc), - rdf_assert(bc, rdfs:subPropertyOf, b), - rdf_assert(d, rdfs:subPropertyOf, dc), - rdf_assert(dc, rdfs:subPropertyOf, d), - rdf_assert(x, c, y), - rdf_has(x, b, y), - rdf_has(x, d, y), - rdf_has(x, dc, y), - rdf_has(x, bc, y). -ptree(7) :- % create and break the cycles - rdf_assert(x, a, y), - rdf_assert(a, rdfs:subPropertyOf, b), - rdf_retractall(a, rdfs:subPropertyOf, b), - \+ rdf_has(x, b, y). - - - - /******************************* - * REACHABLE * - *******************************/ - -graph(a, p, b). -graph(b, p, c). -graph(c, p, d). -graph(b, p, d). - -graph :- - forall(graph(S,P,O), - rdf_assert(S,P,O)). - -reachable(1) :- - rdf_reachable(a, x, a). -reachable(2) :- - graph, - rdf_reachable(a, p, d). -reachable(3) :- - graph, - rdf_reachable(a, p, X), - X == c, !. -reachable(4) :- - graph, - findall(O, rdf_reachable(a, p, O), Os), - Os = [a,b,c,d]. - - - /******************************* - * DUPLICATES * - *******************************/ - - -duplicates(1) :- - rdf_assert(a, b, literal(lang(en, l))), - rdf_assert(a, b, literal(l)), - rdf_retractall(a, b, literal(lang(en, l))). - - - /******************************* - * SOURCE * - *******************************/ - -source(1) :- - rdf_assert(a,b,c,test), - get_time(Now), - rdf_db:rdf_set_graph_source(test, 'test.rdf', Now), - rdf_source(test, X), - X == 'test.rdf'. - - /******************************* - * UNLOAD * - *******************************/ - -unload(1) :- - rdf_load(dc), - rdf_statistics(triples(T0)), - rdf_unload(dc), - rdf_statistics(triples(T1)), - rdf_load(dc), - rdf_statistics(triples(T2)), - T0 == T2, - T1 == 0. - - /******************************* - * SCRIPTS * - *******************************/ - -:- dynamic - script_dir/1. - -set_script_dir :- - script_dir(_), !. -set_script_dir :- - find_script_dir(Dir), - assert(script_dir(Dir)). - -find_script_dir(Dir) :- - prolog_load_context(file, File), - follow_links(File, RealFile), - file_directory_name(RealFile, Dir). - -follow_links(File, RealFile) :- - read_link(File, _, RealFile), !. -follow_links(File, File). - - -:- set_script_dir. - -run_test_script(Script) :- - file_base_name(Script, Base), - file_name_extension(Pred, _, Base), - load_files(Script, [silent(true)]), - Pred. - -run_test_scripts(Directory) :- - ( script_dir(ScriptDir), - atomic_list_concat([ScriptDir, /, Directory], Dir), - exists_directory(Dir) - -> true - ; Dir = Directory - ), - atom_concat(Dir, '/*.pl', Pattern), - expand_file_name(Pattern, Files), - file_base_name(Dir, BaseDir), - format('Running scripts from ~w ', [BaseDir]), flush, - run_scripts(Files), - format(' done~n'). - -run_scripts([]). -run_scripts([H|T]) :- - ( catch(run_test_script(H), Except, true) - -> ( var(Except) - -> put(.), flush - ; Except = blocked(Reason) - -> assert(blocked(H, Reason)), - put(!), flush - ; script_failed(H, Except) - ) - ; script_failed(H, fail) - ), - run_scripts(T). - -script_failed(File, fail) :- - format('~NScript ~w failed~n', [File]), - assert(failed(script(File))). -script_failed(File, Except) :- - message_to_string(Except, Error), - format('~NScript ~w failed: ~w~n', [File, Error]), - assert(failed(script(File))). - - - /******************************* - * TEST MAIN-LOOP * - *******************************/ - -testset(resource). -testset(literal). -testset(lshare). -testset(same). -testset(typed). -testset(lang). -testset(wide). -testset(namespace). -testset(update). -testset(transaction). -testset(label). -testset(match). -testset(prefix). -testset(rdf_retractall). -testset(monitor). -testset(subproperty). -testset(ptree). -testset(reachable). -testset(duplicates). -testset(source). -testset(unload). - -% testdir(Dir) -% -% Enumerate directories holding tests. - -testdir('Tests'). - -:- dynamic - failed/1, - blocked/2. - -watch(_). - -test :- - retractall(failed(_)), - retractall(blocked(_,_)), - rdf_monitor(watch, []), % check consistency - forall(testset(Set), runtest(Set)), - scripts, -% statistics, - report_blocked, - report_failed. - -scripts :- - forall(testdir(Dir), run_test_scripts(Dir)). - - -report_blocked :- - findall(Head-Reason, blocked(Head, Reason), L), - ( L \== [] - -> format('~nThe following tests are blocked:~n', []), - ( member(Head-Reason, L), - format(' ~p~t~40|~w~n', [Head, Reason]), - fail - ; true - ) - ; true - ). -report_failed :- - findall(X, failed(X), L), - length(L, Len), - ( Len > 0 - -> format('~n*** ~w tests failed ***~n', [Len]), - fail - ; format('~nAll tests passed~n', []) - ). - -runtest(Name) :- - format('Running test set "~w" ', [Name]), - flush, - functor(Head, Name, 1), - nth_clause(Head, _N, R), - clause(Head, _, R), - rdf_reset_db, % reset before each script - ( catch(Head, Except, true) - -> ( var(Except) - -> put(.), flush - ; Except = blocked(Reason) - -> assert(blocked(Head, Reason)), - put(!), flush - ; test_failed(R, Except) - ) - ; test_failed(R, fail) - ), - fail. -runtest(_) :- - format(' done.~n'). - -test_failed(R, Except) :- - clause(Head, _, R), - functor(Head, Name, 1), - arg(1, Head, TestName), - clause_property(R, line_count(Line)), - clause_property(R, file(File)), - ( Except == fail - -> format('~N~w:~d: Test ~w(~w) failed~n', - [File, Line, Name, TestName]) - ; message_to_string(Except, Error), - format('~N~w:~d: Test ~w(~w):~n~t~8|ERROR: ~w~n', - [File, Line, Name, TestName, Error]) - ), - assert(failed(Head)). - -blocked(Reason) :- - throw(blocked(Reason)). - - - /******************************* - * UNIT TESTS * - *******************************/ - -:- begin_tests(lang_matches). - -test(lang_matches, true) :- - lang_matches('EN', en). -test(lang_matches, true) :- - lang_matches(en, 'EN'). -test(lang_matches, fail) :- - lang_matches(nl, 'EN'). -test(lang_matches, true) :- - lang_matches('en-GB', en). -test(lang_matches, fail) :- - lang_matches('en-GB', 'en-*-x'). -test(lang_matches, true) :- - lang_matches('en-GB-x', 'en-*-x'). -test(lang_matches, true) :- - lang_matches('en-GB-x-y', 'en-*-x-*'). -test(lang_matches, true) :- - lang_matches('en-GB-x-y', 'en-*-y'). - -:- end_tests(lang_matches). diff --git a/packages/semweb/test_turtle.pl b/packages/semweb/test_turtle.pl deleted file mode 100644 index 5ee33f9bc..000000000 --- a/packages/semweb/test_turtle.pl +++ /dev/null @@ -1,246 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog - - Author: Jan Wielemaker - E-mail: J.Wielemaker@cs.vu.nl - WWW: http://www.swi-prolog.org - Copyright (C): 1985-2009, University of Amsterdam - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - As a special exception, if you link this library with other files, - compiled with a Free Software compiler, to produce an executable, this - library does not by itself cause the resulting executable to be covered - by the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -:- module(test_turtle, - [ test_turtle/0, - test_turtle/1 % +Test - ]). -:- asserta(user:file_search_path(library, '..')). -:- asserta(user:file_search_path(library, '../clib')). -:- asserta(user:file_search_path(library, '../sgml')). -:- asserta(user:file_search_path(library, '../RDF')). -:- asserta(user:file_search_path(foreign, '.')). -:- asserta(user:file_search_path(foreign, '../sgml')). -:- asserta(user:file_search_path(foreign, '../clib')). - -:- use_module(library(semweb/rdf_turtle)). -:- use_module(library(semweb/rdf_db)). -:- use_module(library(semweb/rdf_compare)). -:- use_module(library(rdf_ntriples)). -:- use_module(library(apply)). -:- use_module(library(debug)). -:- use_module(library(aggregate)). - -:- dynamic - error/1, - passed/1, - this_dir/1. - -:- retractall(this_dir(_)), - prolog_load_context(directory, Dir), - asserta(this_dir(Dir)). - - -test_turtle :- - retractall(error(_)), - retractall(passed(_)), - this_dir(Dir), - atom_concat(Dir, '/Tests/Turtle', TestDir), - test_dir(TestDir), - ( error(_) - -> fail - ; aggregate_all(count, passed(_), Passed), - aggregate_all(count, blocked(_), Blocked), - format('~NAll ~D Turtle tests passed (~D blocked)~n', - [Passed, Blocked]) - ). - -test_turtle(File) :- - this_dir(Here), - atomic_list_concat([Here, '/Tests/Turtle/', File], FullFile), - test_file(FullFile). - -%% blocked(?Test) -% -% True if Test is blocked. Currently blocked: -% -% $ test-29.ttl : -% URI test. Contains ...%&... Should or shouldn't we -% do %-decoding!? Surely there are datasets our there -% that expect us to do so. -% -% $ test-28.ttl : -% Test numbers. I don't understand this test and I don't -% understand the *three* files: test-28.ttl, test-28.out -% and test-28.out.ttl. - -blocked('test-28.ttl'). -blocked('test-29.ttl'). - - -%:- debug(test_turtle). - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Handle the test-cases provided with the Turtle language definition. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -test_dir(Dir) :- - atom_concat(Dir, '/*.ttl', Pattern), - expand_file_name(Pattern, Files), - maplist(test_file, Files). - -test_file(File) :- - file_base_name(File, BaseName), - blocked(BaseName), !, - print_message(informational, test_turtle(blocked, BaseName)). -test_file(File) :- - file_base_name(File, Base), - atom_concat(bad, _, Base), !, - file_base_name(File, BaseName), - debug(test_turtle, 'Negative test ~w ...', [BaseName]), - catch(load_turtle(File, _Triples), E, true), - ( nonvar(E) - -> test_passed(BaseName) - ; print_message(error, test_turtle(false, BaseName)) - ). -test_file(File) :- - file_base_name(File, BaseName), - file_name_extension(Base, ttl, File), - file_name_extension(Base, out, OkFile), - exists_file(OkFile), !, - debug(test_turtle, 'Test ~w ...', [BaseName]), - load_turtle(File, Triples), - load_rdf_ntriples(OkFile, OkTriples0), - maplist(canonical_triple, OkTriples0, OkTriples), - sort(Triples, Turtle), - sort(OkTriples, OK), - ( rdf_equal_graphs(OK, Turtle, _) - -> test_passed(BaseName) - ; print_message(error, test_turtle(false, BaseName)), - ( debugging(test_turtle) - -> report_diff(OK, Turtle) - ; true - ) - ). -test_file(_). % not a test - -load_turtle(File, Triples) :- - file_base_name(File, Base), - atom_concat('http://www.w3.org/2001/sw/DataAccess/df1/tests/', - Base, - BaseURI), - rdf_read_turtle(File, Triples, - [ base_uri(BaseURI), - anon_prefix(node(_)), - on_error(error) - ]). - -canonical_triple(rdf(S0, P0, O0), - rdf(S, P, O)) :- - canonical_node(S0, S), - canonical_node(P0, P), - canonical_node(O0, O). - -canonical_node(node(GenId), node(N)) :- - atom_concat(genid, AN, GenId), !, - atom_number(AN, N). -canonical_node(Node, Node). - -report_diff(OK, Result) :- - rdf_equal_graphs(OK, Result, _), !. -report_diff(OK, Result) :- - subtract(OK, Result, Missing), - subtract(Result, OK, TooMany), - ( Missing \== [] - -> length(Missing, NM), - format('**************** ~D Omitted results:~n', [NM]), - write_list(Missing) - ; true - ), - ( TooMany \== [] - -> length(TooMany, TM), - format('**************** ~D Overcomplete results:~n', [TM]), - write_list(TooMany) - ; true - ). - -write_list([]). -write_list([H|T]) :- - ( H =.. [row|Cols] - -> write_cols(Cols), - format(' .~n') - ; H = rdf(S,P,O) - -> write_cell(S), put(' '), - write_cell(P), put(' '), - write_cell(O), write(' .\n') - ; format('~p~n', [H]) - ), - write_list(T). - - -write_cols([]). -write_cols([H|T]) :- - write_cell(H), - ( T == [] - -> true - ; put(' '), - write_cols(T) - ). - -write_cell(literal(X)) :- !, - format('"~w"', [X]). -write_cell(R) :- - atom(R), - rdf_global_id(NS:Id, R), !, - format('<~w:~w>', [NS, Id]). -write_cell('$null$') :- !, - write('NULL'). -write_cell(R) :- - atom(R), !, - format('<!~w>', [R]). -write_cell(X) :- - format('~p', [X]). - - - /******************************* - * MESSAGES * - *******************************/ - -test_passed(Test) :- - print_message(informational, test_turtle(true, Test)), - ( current_prolog_flag(verbose, silent) - -> put_char(user_error, '.') - ; true - ). - -:- multifile - prolog:message//1. - -prolog:message(test_turtle(true, Test)) --> - { assert(passed(Test)) }, - [ 'Turtle test ~q: ~tpassed~42|'-[Test] ]. -prolog:message(test_turtle(false, Test)) --> - { assert(error(Test)) }, - [ 'Turtle test ~q: ~tFAILED~42|'-[Test], nl, - 'Re-run with "?- debug(test_turtle)." to see more details'-[] - ]. -prolog:message(test_turtle(blocked, Test)) --> - [ 'Turtle test ~q: ~t(blocked)~42|'-[Test] ]. diff --git a/packages/semweb/turtle.c b/packages/semweb/turtle.c deleted file mode 100644 index 703f8a419..000000000 --- a/packages/semweb/turtle.c +++ /dev/null @@ -1,608 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog - - Author: Jan Wielemaker - E-mail: J.Wielemaker@cs.vu.nl - WWW: http://www.swi-prolog.org - Copyright (C): 1985-2009, VU University Amsterdam - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include <SWI-Stream.h> -#include <SWI-Prolog.h> -#include <string.h> -#ifdef __WINDOWS__ -#define inline __inline -#endif - -#include "turtle_chars.c" - - /******************************* - * ERRORS * - *******************************/ - -static atom_t ATOM_; -static functor_t FUNCTOR_error2; -static functor_t FUNCTOR_type_error2; -static functor_t FUNCTOR_syntax_error1; -static functor_t FUNCTOR_representation_error1; - -static int -type_error(term_t actual, const char *expected) -{ term_t ex; - - if ( (ex = PL_new_term_ref()) && - PL_unify_term(ex, - PL_FUNCTOR, FUNCTOR_error2, - PL_FUNCTOR, FUNCTOR_type_error2, - PL_CHARS, expected, - PL_TERM, actual, - PL_VARIABLE) ) - return PL_raise_exception(ex); - - return FALSE; -} - - -static int -syntax_error(const char *culprit) -{ term_t ex; - - if ( (ex = PL_new_term_ref()) && - PL_unify_term(ex, - PL_FUNCTOR, FUNCTOR_error2, - PL_FUNCTOR, FUNCTOR_syntax_error1, - PL_CHARS, culprit, - PL_VARIABLE) ) - return PL_raise_exception(ex); - - return FALSE; -} - - -static int -representation_error(const char *culprit) -{ term_t ex; - - if ( (ex = PL_new_term_ref()) && - PL_unify_term(ex, - PL_FUNCTOR, FUNCTOR_error2, - PL_FUNCTOR, FUNCTOR_representation_error1, - PL_CHARS, culprit, - PL_VARIABLE) ) - return PL_raise_exception(ex); - - return FALSE; -} - - - /******************************* - * PROLOG * - *******************************/ - -/** turtle_name(+Atom) is semidet. - -True if Atom is a valid Turtle identifier -*/ - -static inline int -wcis_name_char(int c) -{ return wcis_name_start_char(c) || - wcis_name_extender_char(c); -} - -/** turtle_name_start_char(+Int) is semidet. -*/ - -static foreign_t -turtle_name_start_char(term_t Code) -{ int c; - - if ( !PL_get_integer(Code, &c) ) - return type_error(Code, "code"); - if ( !wcis_name_start_char(c) ) - return FALSE; - - return TRUE; -} - - -/** turtle_name(+Atom) is semidet. -*/ - -static foreign_t -turtle_name(term_t name) -{ char *s; - pl_wchar_t *w; - size_t len; - - if ( PL_get_nchars(name, &len, &s, CVT_ATOM) ) - { const char *e = &s[len]; - - if ( !wcis_name_start_char(s[0]&0xff) ) - return FALSE; - for(s++; s<e; s++) - { if ( !wcis_name_char(s[0]&0xff) ) - return FALSE; - } - return TRUE; - } else if ( PL_get_wchars(name, &len, &w, CVT_ATOM|CVT_EXCEPTION) ) - { const pl_wchar_t *e = &w[len]; - - if ( !wcis_name_start_char(w[0]) ) - return FALSE; - for(w++; w<e; w++) - { if ( !wcis_name_char(w[0]) ) - return FALSE; - } - return TRUE; - } else - return FALSE; -} - - -typedef struct charbuf -{ pl_wchar_t *base; - pl_wchar_t *here; - pl_wchar_t *end; - pl_wchar_t tmp[256]; -} charbuf; - - -static void -init_charbuf(charbuf *cb) -{ cb->base = cb->here = cb->tmp; - cb->end = &cb->tmp[sizeof(cb->tmp)/sizeof(pl_wchar_t)]; -} - - -static int -add_charbuf(charbuf *cb, int c) -{ if ( cb->here < cb->end ) - { *cb->here++ = c; - } else - { size_t len = (cb->end-cb->base); - - if ( cb->base == cb->tmp ) - { pl_wchar_t *n = PL_malloc(len*2*sizeof(pl_wchar_t)); - memcpy(n, cb->base, sizeof(cb->tmp)); - cb->base = n; - } else - { cb->base = PL_realloc(cb->base, len*2*sizeof(pl_wchar_t)); - } - cb->here = &cb->base[len]; - cb->end = &cb->base[len*2]; - *cb->here++ = c; - } - - return TRUE; -} - - -static void -free_charbuf(charbuf *cb) -{ if ( cb->base != cb->tmp ) - PL_free(cb->base); -} - - -/** turtle_read_name(+C0, +Stream, -C, -Name) is semidet. -*/ - -static foreign_t -turtle_read_name(term_t C0, term_t Stream, term_t C, term_t Name) -{ int c; - charbuf b; - IOSTREAM *in; - - if ( !PL_get_integer(C0, &c) ) - return type_error(C0, "code"); - if ( !wcis_name_start_char(c) ) - return FALSE; - - if ( !PL_get_stream_handle(Stream, &in) ) - return FALSE; - - init_charbuf(&b); - add_charbuf(&b, c); - - for(;;) - { int c = Sgetcode(in); - - if ( wcis_name_char(c) ) - { add_charbuf(&b, c); - } else - { int rc = ( PL_unify_integer(C, c) && - PL_unify_wchars(Name, PL_ATOM, b.here-b.base, b.base) ); - - free_charbuf(&b); - PL_release_stream(in); - - return rc; - } - } -} - - -static int -read_hN(IOSTREAM *in, int digits, int *value) -{ int d = digits; - int v = 0; - - while ( d-- > 0 ) - { int c = Sgetcode(in); - - if ( c >= '0' && c <= '9' ) - v = (v<<4) + c - '0'; - else if ( c >= 'A' && c <= 'F' ) - v = (v<<4) + c + 10 - 'A'; - else if ( c >= 'a' && c <= 'f' ) - v = (v<<4) + c + 10 - 'a'; - else - { if ( digits == 4 ) - return syntax_error("Illegal \\uNNNN in string"); - else - return syntax_error("Illegal \\UNNNNNNNN in string"); - } - } - - *value = v; - return TRUE; -} - - -static int -string_escape(IOSTREAM *in, int c, int *value) -{ int esc; - - switch(c) - { case 'n': esc = '\n'; break; - case '"': esc = '"'; break; - case '\\':esc = '\\'; break; - case 't': esc = '\t'; break; - case 'r': esc = '\r'; break; - case 'u': - if ( !read_hN(in, 4, &esc) ) - return FALSE; - break; - case 'U': - if ( !read_hN(in, 8, &esc) ) - return FALSE; - break; - default: - return syntax_error("illegal escape in string"); - } - - *value = esc; - return TRUE; -} - - -/** turtle_read_string(+C0, +Stream, -C, -Value:atom) is semidet. -*/ - -static foreign_t -turtle_read_string(term_t C0, term_t Stream, term_t C, term_t Value) -{ int c; - charbuf b; - IOSTREAM *in; - int endlen = 1; - - if ( !PL_get_integer(C0, &c) ) - return type_error(C0, "code"); - if ( c != '"' ) - return FALSE; - - if ( !PL_get_stream_handle(Stream, &in) ) - return FALSE; - - init_charbuf(&b); - - c = Sgetcode(in); - if ( c == '"' ) - { c = Sgetcode(in); - if ( c == '"' ) /* """...""" */ - { endlen = 3; - c = Sgetcode(in); - } else - { PL_release_stream(in); - return (PL_unify_integer(C, c) && - PL_unify_atom(Value, ATOM_)); - } - } - - for(;;c = Sgetcode(in)) - { if ( c == -1 ) - { free_charbuf(&b); - PL_release_stream(in); - return syntax_error("eof_in_string"); - } else if ( c == '"' ) - { int count = 1; - - for(count=1; count<endlen; ) - { if ( (c=Sgetcode(in)) == '"' ) - count++; - else - break; - } - - if ( count == endlen ) - { int rc; - - c = Sgetcode(in); - rc = (PL_unify_integer(C, c) && - PL_unify_wchars(Value, PL_ATOM, b.here-b.base, b.base)); - free_charbuf(&b); - PL_release_stream(in); - return rc; - } - - while(count-- > 0) - add_charbuf(&b, '"'); - add_charbuf(&b, c); - } else if ( c == '\\' ) - { int esc; - - c = Sgetcode(in); - if ( !string_escape(in, c, &esc) ) - { free_charbuf(&b); - PL_release_stream(in); - return FALSE; - } - add_charbuf(&b, esc); - } else - { add_charbuf(&b, c); - } - } -} - - -/** turtle_read_relative_uri(+C0, +Stream, -C, -Value:atom) is semidet. -*/ - -static foreign_t -turtle_read_relative_uri(term_t C0, term_t Stream, term_t C, term_t Value) -{ int c; - charbuf b; - IOSTREAM *in; - - if ( !PL_get_integer(C0, &c) ) - return type_error(C0, "code"); - if ( c != '<' ) - return FALSE; - - if ( !PL_get_stream_handle(Stream, &in) ) - return FALSE; - - init_charbuf(&b); - c = Sgetcode(in); - for(; ; c = Sgetcode(in)) - { if ( c == '>' ) - { int rc; - - c = Sgetcode(in); - rc = (PL_unify_integer(C, c) && - PL_unify_wchars(Value, PL_ATOM, b.here-b.base, b.base)); - PL_release_stream(in); - free_charbuf(&b); - return rc; - } else if ( c == '\\' ) - { int esc; - - c = Sgetcode(in); - if ( c == '>' ) - { add_charbuf(&b, c); - } else if ( string_escape(in, c, &esc) ) - { add_charbuf(&b, esc); - } else - { free_charbuf(&b); - PL_release_stream(in); - return FALSE; - } - } else if ( c == -1 ) - { free_charbuf(&b); - PL_release_stream(in); - return syntax_error("eof_in_uri"); - } else - { add_charbuf(&b, c); - } - } -} - - /******************************* - * WRITING * - *******************************/ - -static int -ttl_put_uesc(IOSTREAM *s, int c) -{ if ( c <= 0xffff ) - return Sfprintf(s, "\\u%04x", (unsigned)c); - else - return Sfprintf(s, "\\U%08x", (unsigned)c); -} - - -static int -ttl_put_character(IOSTREAM *s, int c) -{ if ( c >= 32 && c <= 126 ) - return Sputcode(c, s); - if ( c <= 31 ) - return ttl_put_uesc(s, c); - if ( c >= 127 && c < 0x10ffff ) - { if ( s->encoding == ENC_ASCII ) - return ttl_put_uesc(s, c); - if ( s->encoding == ENC_ISO_LATIN_1 && c > 255 ) - return ttl_put_uesc(s, c); - return Sputcode(c, s); - } - - representation_error("turtle_character"); - return -1; -} - - -static int -ttl_put_echaracter(IOSTREAM *s, int c) -{ int c2; - - switch(c) - { case '\t': c2 = 't'; break; - case '\n': c2 = 'n'; break; - case '\r': c2 = 'r'; break; - default: - return ttl_put_character(s, c); - } - - Sputcode('\\', s); - - return Sputcode(c2, s); -} - - -static int -ttl_put_scharacter(IOSTREAM *s, int c) -{ switch(c) - { case '"': - Sputcode('\\', s); - return Sputcode('"', s); - case '\\': - Sputcode('\\', s); - return Sputcode('\\', s); - default: - return ttl_put_echaracter(s, c); - } -} - - -static foreign_t -turtle_write_quoted_string(term_t Stream, term_t Value) -{ size_t len; - char *s; - pl_wchar_t *w; - IOSTREAM *out; - - if ( !PL_get_stream_handle(Stream, &out) ) - return FALSE; - - if ( PL_get_nchars(Value, &len, &s, CVT_ATOM|CVT_STRING) ) - { const char *e = &s[len]; - - Sputcode('"', out); - for(; s<e; s++) - { if ( ttl_put_scharacter(out, s[0]&0xff) < 0 ) - break; - } - Sputcode('"', out); - return PL_release_stream(out); - } else if ( PL_get_wchars(Value, &len, &w, CVT_ATOM|CVT_EXCEPTION) ) - { const pl_wchar_t *e = &w[len]; - - Sputcode('"', out); - for(; w<e; w++) - { if ( ttl_put_scharacter(out, w[0]) < 0 ) - break; - } - Sputcode('"', out); - return PL_release_stream(out); - } else - { PL_release_stream(out); - return FALSE; - } -} - - -static int -ttl_put_ucharacter(IOSTREAM *s, int c) -{ switch(c) - { case '>': - Sputcode('\\', s); - return Sputcode('>', s); - default: - return ttl_put_character(s, c); - } -} - - -/** turtle_write_uri(+Stream, +URI) is det. -*/ - -static foreign_t -turtle_write_uri(term_t Stream, term_t Value) -{ size_t len; - char *s; - pl_wchar_t *w; - IOSTREAM *out; - - if ( !PL_get_stream_handle(Stream, &out) ) - return FALSE; - - if ( PL_get_nchars(Value, &len, &s, CVT_ATOM|CVT_STRING) ) - { const char *e = &s[len]; - - Sputcode('<', out); - for(; s<e; s++) - { if ( ttl_put_ucharacter(out, s[0]&0xff) < 0 ) - break; - } - Sputcode('>', out); - return PL_release_stream(out); - } else if ( PL_get_wchars(Value, &len, &w, CVT_ATOM|CVT_EXCEPTION) ) - { const pl_wchar_t *e = &w[len]; - - Sputcode('<', out); - for(; w<e; w++) - { if ( ttl_put_ucharacter(out, w[0]) < 0 ) - break; - } - Sputcode('>', out); - return PL_release_stream(out); - } else - { PL_release_stream(out); - return FALSE; - } -} - - - - /******************************* - * REGISTRATION * - *******************************/ - -#define MKFUNCTOR(n,a) \ - FUNCTOR_ ## n ## a = PL_new_functor(PL_new_atom(#n), a) -#define MKATOM(n) \ - ATOM_ ## n = PL_new_atom(#n) - -install_t -install_turtle() -{ MKFUNCTOR(error, 2); - MKFUNCTOR(type_error, 2); - MKFUNCTOR(syntax_error, 1); - MKFUNCTOR(representation_error, 1); - ATOM_ = PL_new_atom(""); - - PL_register_foreign("turtle_name_start_char", - 1, turtle_name_start_char, 0); - PL_register_foreign("turtle_name", 1, turtle_name, 0); - PL_register_foreign("turtle_read_name", 4, turtle_read_name, 0); - PL_register_foreign("turtle_read_string", 4, turtle_read_string, 0); - PL_register_foreign("turtle_read_relative_uri", - 4, turtle_read_relative_uri, 0); - PL_register_foreign("turtle_write_quoted_string", - 2, turtle_write_quoted_string, 0); - PL_register_foreign("turtle_write_uri", 2, turtle_write_uri, 0); -} diff --git a/packages/semweb/turtle_base.pl b/packages/semweb/turtle_base.pl deleted file mode 100644 index b6d1e229d..000000000 --- a/packages/semweb/turtle_base.pl +++ /dev/null @@ -1,99 +0,0 @@ -/* Part of SWI-Prolog - - Author: Jan Wielemaker - E-mail: J.Wielemaker@uva.nl - WWW: http://www.swi-prolog.org - Copyright (C): 2009, University of Amsterdam - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - As a special exception, if you link this library with other files, - compiled with a Free Software compiler, to produce an executable, this - library does not by itself cause the resulting executable to be covered - by the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -:- module(turtle_base, - [ % Tests - turtle_name_start_char/1, % +Integer - turtle_name/1, % +Atom - % Input - turtle_read_name/4, % +C0, +Stream, -C, -Atom - turtle_read_string/4, % +C0, +Stream, -C, -Atom - turtle_read_relative_uri/4, % +C0, +Stream, -C, -Atom - % Output - turtle_write_quoted_string/2, % +Stream, +Atom - turtle_write_uri/2 % +Stream, +Atom - ]). - -/** <module> Basic RDF/Turtle helper predicates - -This module provides a couple of time-critical primitives to speedup -reading a writing the RDF/Turtle serialization. The definitions are -based on: - - http://www.w3.org/TeamSubmission/2008/SUBM-turtle-20080114/ -*/ - -:- use_foreign_library(foreign(turtle)). - -%% turtle_name_start_char(+Code) is semidet. -% -% True if Code is a valid character code to start a Turtle name. - -%% turtle_name(+Atom:atom) is semidet. -% -% True if Atom is a valid Turtle name. -% -% @see xml_name/2. - -%% turtle_read_name(+C0, +Stream, -C, -Atom) is semidet. -% -% Read a Turtle name starting with C0 from Stream. If successfull, -% C is unified with the first character after the name and Atom is -% an atom representing the name read. - -%% turtle_read_string(+C0, +Stream, -C, -Atom) is semidet. -% -% Read a Turtle quotes string starting with C0 from Stream. If -% successfull, C is unified with the first character after the -% string and Atom is an atom representing the text of the string. -% -% @error syntax_error(Culprit) - -%% turtle_read_relative_uri(+C0, +Stream, -C, -Atom) is semidet. -% -% Read a Turtle relative URI (<...>) into an atom and unify C with -% the next character. -% -% @error syntax_error(Culprit) - - - /******************************* - * WRITING * - *******************************/ - -%% turtle_write_quoted_string(+Out, +Value) is det. -% -% Write a string as =|"..."|= - - -%% turtle_write_uri(+Out, +Value) is det. -% -% Write a URI as =|<...>|= - - diff --git a/packages/semweb/turtle_chars.c b/packages/semweb/turtle_chars.c deleted file mode 100644 index 23074487e..000000000 --- a/packages/semweb/turtle_chars.c +++ /dev/null @@ -1,79 +0,0 @@ -static int -wcis_name_start_char(int c) -{ if ( c <= 0x037d ) - { if ( c <= 0x007a ) - { if ( c <= 0x005a ) - { return (c >= 0x0041 && c <= 0x005a); - } else - { if ( c <= 0x005f ) - { return (c == 0x005f);} else - { return (c >= 0x0061 && c <= 0x007a); - } - } - } else - { if ( c <= 0x00f6 ) - { if ( c <= 0x00d6 ) - { return (c >= 0x00c0 && c <= 0x00d6); - } else - { return (c >= 0x00d8 && c <= 0x00f6); - } - } else - { if ( c <= 0x02ff ) - { return (c >= 0x00f8 && c <= 0x02ff); - } else - { return (c >= 0x0370 && c <= 0x037d); - } - } - } - } else - { if ( c <= 0x2fef ) - { if ( c <= 0x200d ) - { if ( c <= 0x1fff ) - { return (c >= 0x037f && c <= 0x1fff); - } else - { return (c >= 0x200c && c <= 0x200d); - } - } else - { if ( c <= 0x218f ) - { return (c >= 0x2070 && c <= 0x218f); - } else - { return (c >= 0x2c00 && c <= 0x2fef); - } - } - } else - { if ( c <= 0xfdcf ) - { if ( c <= 0xd7ff ) - { return (c >= 0x3001 && c <= 0xd7ff); - } else - { return (c >= 0xf900 && c <= 0xfdcf); - } - } else - { if ( c <= 0xfffd ) - { return (c >= 0xfdf0 && c <= 0xfffd); - } else - { return (c >= 0x10000 && c <= 0xeffff); - } - } - } - } -} - -static int -wcis_name_extender_char(int c) -{ if ( c <= 0x0039 ) - { if ( c <= 0x002d ) - { return (c == 0x002d);} else - { return (c >= 0x0030 && c <= 0x0039); - } - } else - { if ( c <= 0x00b7 ) - { return (c == 0x00b7);} else - { if ( c <= 0x036f ) - { return (c >= 0x0300 && c <= 0x036f); - } else - { return (c >= 0x203f && c <= 0x2040); - } - } - } -} - diff --git a/packages/semweb/turtle_chars.pl b/packages/semweb/turtle_chars.pl deleted file mode 100644 index d0bce643a..000000000 --- a/packages/semweb/turtle_chars.pl +++ /dev/null @@ -1,131 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog - - Author: Jan Wielemaker - E-mail: wielemak@science.uva.nl - WWW: http://www.swi-prolog.org - Copyright (C): 1985-2006, University of Amsterdam - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - As a special exception, if you link this library with other files, - compiled with a Free Software compiler, to produce an executable, this - library does not by itself cause the resulting executable to be covered - by the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -:- module(turtle_unicode, - [ mkclassify/1, - run/0 - ]). - -run :- - mkclassify('turtle_chars.c', 'static '). - -%% mkclassify(+File) -% -% Generate the core of xml_unicode.c. - -mkclassify(File) :- - mkclassify(File, ''). - -mkclassify(File, Decl) :- - tell(File), - call_cleanup(forall(list(List, _), - mkfunc(List, Decl)), - told). - -mkfunc(Name, Decl) :- - format('~wint~n', [Decl]), - format('wcis_~w(int c)~n', [Name]), - format('{ '), - list(Name, List), - mkswitch(List), - format('}~n~n'). - -mkswitch(List) :- - mkswitch(List, 2). - -mkswitch([Low-High], Indent) :- !, - indent(Indent), - format('return (c >= 0x~|~`0t~16r~4+ && c <= 0x~|~`0t~16r~4+);~n', [Low, High]). -mkswitch([Value], Indent) :- !, - indent(Indent), - format('return (c == 0x~|~`0t~16r~4+);', [Value]). -mkswitch(List, Indent) :- - split(List, Low, High), - end(Low, MaxLow), - indent(Indent), - NextIndent is Indent + 2, - format('if ( c <= 0x~|~`0t~16r~4+ )~n', [MaxLow]), - indent(Indent), - format('{ '), - mkswitch(Low, NextIndent), - indent(Indent), - format('} else~n'), - indent(Indent), - format('{ '), - mkswitch(High, NextIndent), - indent(Indent), - format('}~n'). - -end(List, Max) :- - last(List, Last), - ( Last = _-Max - -> true - ; Max = Last - ). - -split(List, Low, High) :- - length(List, Len), - Mid is Len//2, - length(Low, Mid), - append(Low, High, List). - -indent(N) :- - line_position(current_output, Pos), - Spaces is N - Pos, - format('~*c', [Spaces, 32]). - - - -list(name_start_char, - [ 0'A-0'Z, - 0'_, - 0'a-0'z, - 0x00C0-0x00D6, - 0x00D8-0x00F6, - 0x00F8-0x02FF, - 0x0370-0x037D, - 0x037F-0x1FFF, - 0x200C-0x200D, - 0x2070-0x218F, - 0x2C00-0x2FEF, - 0x3001-0xD7FF, - 0xF900-0xFDCF, - 0xFDF0-0xFFFD, - 0x10000-0xEFFFF - ]). - -list(name_extender_char, - [ 0'-, - 0'0-0'9, - 0x00B7, - 0x0300-0x036F, - 0x203F-0x2040 - ]). diff --git a/packages/semweb/unicode_map.c b/packages/semweb/unicode_map.c deleted file mode 100644 index 6374e545b..000000000 --- a/packages/semweb/unicode_map.c +++ /dev/null @@ -1,1026 +0,0 @@ -#ifdef __WINDOWS__ -typedef int int32_t; -#else -#include <inttypes.h> -#endif - -#ifndef NULL -#define NULL ((void*)0) -#endif - -#define UNICODE_MAP_SIZE 128 - -static const int32_t ucp0x00[256] = -{ 0x000000, 0x000100, 0x000200, 0x000300, 0x000400, 0x000500, 0x000600, 0x000700, - 0x000800, 0x000900, 0x000a00, 0x000b00, 0x000c00, 0x000d00, 0x000e00, 0x000f00, - 0x001000, 0x001100, 0x001200, 0x001300, 0x001400, 0x001500, 0x001600, 0x001700, - 0x001800, 0x001900, 0x001a00, 0x001b00, 0x001c00, 0x001d00, 0x001e00, 0x001f00, - 0x002000, 0x002100, 0x002200, 0x002300, 0x002400, 0x002500, 0x002600, 0x002700, - 0x002800, 0x002900, 0x002a00, 0x002b00, 0x002c00, 0x002d00, 0x002e00, 0x002f00, - 0x003000, 0x003100, 0x003200, 0x003300, 0x003400, 0x003500, 0x003600, 0x003700, - 0x003800, 0x003900, 0x003a00, 0x003b00, 0x003c00, 0x003d00, 0x003e00, 0x003f00, - 0x004000, 0x004100, 0x004200, 0x004300, 0x004400, 0x004500, 0x004600, 0x004700, - 0x004800, 0x004900, 0x004a00, 0x004b00, 0x004c00, 0x004d00, 0x004e00, 0x004f00, - 0x005000, 0x005100, 0x005200, 0x005300, 0x005400, 0x005500, 0x005600, 0x005700, - 0x005800, 0x005900, 0x005a00, 0x005b00, 0x005c00, 0x005d00, 0x005e00, 0x005f00, - 0x006000, 0x004180, 0x004280, 0x004380, 0x004480, 0x004580, 0x004680, 0x004780, - 0x004880, 0x004980, 0x004a80, 0x004b80, 0x004c80, 0x004d80, 0x004e80, 0x004f80, - 0x005080, 0x005180, 0x005280, 0x005380, 0x005480, 0x005580, 0x005680, 0x005780, - 0x005880, 0x005980, 0x005a80, 0x007b00, 0x007c00, 0x007d00, 0x007e00, 0x007f00, - 0x008000, 0x008100, 0x008200, 0x008300, 0x008400, 0x008500, 0x008600, 0x008700, - 0x008800, 0x008900, 0x008a00, 0x008b00, 0x008c00, 0x008d00, 0x008e00, 0x008f00, - 0x009000, 0x009100, 0x009200, 0x009300, 0x009400, 0x009500, 0x009600, 0x009700, - 0x009800, 0x009900, 0x009a00, 0x009b00, 0x009c00, 0x009d00, 0x009e00, 0x009f00, - 0x002001, 0x00a100, 0x00a200, 0x00a300, 0x00a400, 0x00a500, 0x00a600, 0x00a700, - 0x00a800, 0x00a900, 0x006101, 0x00ab00, 0x00ac00, 0x00ad00, 0x00ae00, 0x00af00, - 0x00b000, 0x00b100, 0x003201, 0x003301, 0x00b400, 0x039c80, 0x00b600, 0x00b700, - 0x00b800, 0x003101, 0x006f01, 0x00bb00, 0x00bc00, 0x00bd00, 0x00be00, 0x00bf00, - 0x004103, 0x004104, 0x004105, 0x004106, 0x00410a, 0x00410c, 0x00c600, 0x004318, - 0x004503, 0x004504, 0x004505, 0x00450a, 0x004903, 0x004904, 0x004905, 0x00490a, - 0x00d000, 0x004e06, 0x004f03, 0x004f04, 0x004f05, 0x004f06, 0x004f0a, 0x00d700, - 0x00d800, 0x005503, 0x005504, 0x005505, 0x00550a, 0x005904, 0x00de00, 0x00df00, - 0x004183, 0x004184, 0x004185, 0x004186, 0x00418a, 0x00418c, 0x00c680, 0x004398, - 0x004583, 0x004584, 0x004585, 0x00458a, 0x004983, 0x004984, 0x004985, 0x00498a, - 0x00d080, 0x004e86, 0x004f83, 0x004f84, 0x004f85, 0x004f86, 0x004f8a, 0x00f700, - 0x00d880, 0x005583, 0x005584, 0x005585, 0x00558a, 0x005984, 0x00de80, 0x00598a -}; - -static const int32_t ucp0x01[256] = -{ 0x004107, 0x004187, 0x004108, 0x004188, 0x004119, 0x004199, 0x004304, 0x004384, - 0x004305, 0x004385, 0x004309, 0x004389, 0x00430e, 0x00438e, 0x00440e, 0x00448e, - 0x011000, 0x011080, 0x004507, 0x004587, 0x004508, 0x004588, 0x004509, 0x004589, - 0x004519, 0x004599, 0x00450e, 0x00458e, 0x004705, 0x004785, 0x004708, 0x004788, - 0x004709, 0x004789, 0x004718, 0x004798, 0x004805, 0x004885, 0x012600, 0x012680, - 0x004906, 0x004986, 0x004907, 0x004987, 0x004908, 0x004988, 0x004919, 0x004999, - 0x004909, 0x004980, 0x013200, 0x013280, 0x004a05, 0x004a85, 0x004b18, 0x004b98, - 0x013800, 0x004c04, 0x004c84, 0x004c18, 0x004c98, 0x004c0e, 0x004c8e, 0x013f00, - 0x013f80, 0x014100, 0x014180, 0x004e04, 0x004e84, 0x004e18, 0x004e98, 0x004e0e, - 0x004e8e, 0x014900, 0x014a00, 0x014a80, 0x004f07, 0x004f87, 0x004f08, 0x004f88, - 0x004f0d, 0x004f8d, 0x015200, 0x015280, 0x005204, 0x005284, 0x005218, 0x005298, - 0x00520e, 0x00528e, 0x005304, 0x005384, 0x005305, 0x005385, 0x005318, 0x005398, - 0x00530e, 0x00538e, 0x005418, 0x005498, 0x00540e, 0x00548e, 0x016600, 0x016680, - 0x005506, 0x005586, 0x005507, 0x005587, 0x005508, 0x005588, 0x00550c, 0x00558c, - 0x00550d, 0x00558d, 0x005519, 0x005599, 0x005705, 0x005785, 0x005905, 0x005985, - 0x00590a, 0x005a04, 0x005a84, 0x005a09, 0x005a89, 0x005a0e, 0x005a8e, 0x005380, - 0x018000, 0x018100, 0x018200, 0x018280, 0x018400, 0x018480, 0x018600, 0x018700, - 0x018780, 0x018900, 0x018a00, 0x018b00, 0x018b80, 0x018d00, 0x018e00, 0x018f00, - 0x019000, 0x019100, 0x019180, 0x019300, 0x019400, 0x01f680, 0x019600, 0x019700, - 0x019800, 0x019880, 0x023d80, 0x019b00, 0x019c00, 0x019d00, 0x022080, 0x019f00, - 0x004f13, 0x004f93, 0x01a200, 0x01a280, 0x01a400, 0x01a480, 0x01a600, 0x01a700, - 0x01a780, 0x01a900, 0x01aa00, 0x01ab00, 0x01ac00, 0x01ac80, 0x01ae00, 0x005513, - 0x005593, 0x01b100, 0x01b200, 0x01b300, 0x01b380, 0x01b500, 0x01b580, 0x01b700, - 0x01b800, 0x01b880, 0x01ba00, 0x01bb00, 0x01bc00, 0x01bc80, 0x01be00, 0x01f780, - 0x01c000, 0x01c100, 0x01c200, 0x01c300, 0x01c400, 0x01c480, 0x01c480, 0x01c700, - 0x01c780, 0x01c780, 0x01ca00, 0x01ca80, 0x01ca80, 0x00410e, 0x00418e, 0x00490e, - 0x00498e, 0x004f0e, 0x004f8e, 0x00550e, 0x00558e, 0x00dc07, 0x00dc87, 0x00dc04, - 0x00dc84, 0x00dc0e, 0x00dc8e, 0x00dc03, 0x00dc83, 0x018e80, 0x00c407, 0x00c487, - 0x022607, 0x022687, 0x00c607, 0x00c687, 0x01e400, 0x01e480, 0x00470e, 0x00478e, - 0x004b0e, 0x004b8e, 0x004f19, 0x004f99, 0x01ea07, 0x01ea87, 0x01b70e, 0x01b78e, - 0x006a0e, 0x01f100, 0x01f180, 0x01f180, 0x004704, 0x004784, 0x01f600, 0x01f700, - 0x004e03, 0x004e83, 0x00c504, 0x00c584, 0x00c604, 0x00c684, 0x00d804, 0x00d884 -}; - -static const int32_t ucp0x02[256] = -{ 0x00410f, 0x00418f, 0x004110, 0x004190, 0x00450f, 0x00458f, 0x004510, 0x004590, - 0x00490f, 0x00498f, 0x004910, 0x004990, 0x004f0f, 0x004f8f, 0x004f10, 0x004f90, - 0x00520f, 0x00528f, 0x005210, 0x005290, 0x00550f, 0x00558f, 0x005510, 0x005590, - 0x005317, 0x005397, 0x005417, 0x005497, 0x021c00, 0x021c80, 0x00480e, 0x00488e, - 0x022000, 0x022100, 0x022200, 0x022280, 0x022400, 0x022480, 0x004109, 0x004189, - 0x004518, 0x004598, 0x00d607, 0x00d687, 0x00d507, 0x00d587, 0x004f09, 0x004f89, - 0x022e07, 0x022e87, 0x005907, 0x005987, 0x023400, 0x023500, 0x023600, 0x023700, - 0x023800, 0x023900, 0x023a00, 0x023b00, 0x023b80, 0x023d00, 0x023e00, 0x023f00, - 0x024000, 0x024100, 0x024200, 0x024300, 0x024400, 0x024500, 0x024600, 0x024700, - 0x024800, 0x024900, 0x024a00, 0x024b00, 0x024c00, 0x024d00, 0x024e00, 0x024f00, - 0x025000, 0x025100, 0x025200, 0x018180, 0x018680, 0x025500, 0x018980, 0x018a80, - 0x025800, 0x018f80, 0x025a00, 0x019080, 0x025c00, 0x025d00, 0x025e00, 0x025f00, - 0x019380, 0x026100, 0x026200, 0x019480, 0x026400, 0x026500, 0x026600, 0x026700, - 0x019780, 0x019680, 0x026a00, 0x026b00, 0x026c00, 0x026d00, 0x026e00, 0x019c80, - 0x027000, 0x027100, 0x019d80, 0x027300, 0x027400, 0x019f80, 0x027600, 0x027700, - 0x027800, 0x027900, 0x027a00, 0x027b00, 0x027c00, 0x027d00, 0x027e00, 0x027f00, - 0x01a680, 0x028100, 0x028200, 0x01a980, 0x028400, 0x028500, 0x028600, 0x028700, - 0x01ae80, 0x028900, 0x01b180, 0x01b280, 0x028c00, 0x028d00, 0x028e00, 0x028f00, - 0x029000, 0x029100, 0x01b780, 0x029300, 0x024180, 0x029500, 0x029600, 0x029700, - 0x029800, 0x029900, 0x029a00, 0x029b00, 0x029c00, 0x029d00, 0x029e00, 0x029f00, - 0x02a000, 0x02a100, 0x02a200, 0x02a300, 0x02a400, 0x02a500, 0x02a600, 0x02a700, - 0x02a800, 0x02a900, 0x02aa00, 0x02ab00, 0x02ac00, 0x02ad00, 0x02ae00, 0x02af00, - 0x006801, 0x026601, 0x006a01, 0x007201, 0x027901, 0x027b01, 0x028101, 0x007701, - 0x007901, 0x02b900, 0x02ba00, 0x02bb00, 0x02bc00, 0x02bd00, 0x02be00, 0x02bf00, - 0x02c000, 0x02c100, 0x02c200, 0x02c300, 0x02c400, 0x02c500, 0x02c600, 0x02c700, - 0x02c800, 0x02c900, 0x02ca00, 0x02cb00, 0x02cc00, 0x02cd00, 0x02ce00, 0x02cf00, - 0x02d000, 0x02d100, 0x02d200, 0x02d300, 0x02d400, 0x02d500, 0x02d600, 0x02d700, - 0x02d800, 0x02d900, 0x02da00, 0x02db00, 0x02dc00, 0x02dd00, 0x02de00, 0x02df00, - 0x026301, 0x006c01, 0x007301, 0x007801, 0x029501, 0x02e500, 0x02e600, 0x02e700, - 0x02e800, 0x02e900, 0x02ea00, 0x02eb00, 0x02ec00, 0x02ed00, 0x02ee00, 0x02ef00, - 0x02f000, 0x02f100, 0x02f200, 0x02f300, 0x02f400, 0x02f500, 0x02f600, 0x02f700, - 0x02f800, 0x02f900, 0x02fa00, 0x02fb00, 0x02fc00, 0x02fd00, 0x02fe00, 0x02ff00 -}; - -static const int32_t ucp0x03[256] = -{ 0x030000, 0x030100, 0x030200, 0x030300, 0x030400, 0x030500, 0x030600, 0x030700, - 0x030800, 0x030900, 0x030a00, 0x030b00, 0x030c00, 0x030d00, 0x030e00, 0x030f00, - 0x031000, 0x031100, 0x031200, 0x031300, 0x031400, 0x031500, 0x031600, 0x031700, - 0x031800, 0x031900, 0x031a00, 0x031b00, 0x031c00, 0x031d00, 0x031e00, 0x031f00, - 0x032000, 0x032100, 0x032200, 0x032300, 0x032400, 0x032500, 0x032600, 0x032700, - 0x032800, 0x032900, 0x032a00, 0x032b00, 0x032c00, 0x032d00, 0x032e00, 0x032f00, - 0x033000, 0x033100, 0x033200, 0x033300, 0x033400, 0x033500, 0x033600, 0x033700, - 0x033800, 0x033900, 0x033a00, 0x033b00, 0x033c00, 0x033d00, 0x033e00, 0x033f00, - 0x030002, 0x030102, 0x034200, 0x031302, 0x030804, 0x039980, 0x034600, 0x034700, - 0x034800, 0x034900, 0x034a00, 0x034b00, 0x034c00, 0x034d00, 0x034e00, 0x034f00, - 0x035000, 0x035100, 0x035200, 0x035300, 0x035400, 0x035500, 0x035600, 0x035700, - 0x035800, 0x035900, 0x035a00, 0x035b00, 0x035c00, 0x035d00, 0x035e00, 0x035f00, - 0x036000, 0x036100, 0x036200, 0x036300, 0x036400, 0x036500, 0x036600, 0x036700, - 0x036800, 0x036900, 0x036a00, 0x036b00, 0x036c00, 0x036d00, 0x036e00, 0x036f00, - 0x037000, 0x037100, 0x037200, 0x037300, 0x02b902, 0x037500, 0x037600, 0x037700, - 0x037800, 0x037900, 0x037a00, 0x037b00, 0x037c00, 0x037d00, 0x003b02, 0x037f00, - 0x038000, 0x038100, 0x038200, 0x038300, 0x038400, 0x00a804, 0x039104, 0x00b702, - 0x039504, 0x039704, 0x039904, 0x038b00, 0x039f04, 0x038d00, 0x03a504, 0x03a904, - 0x03ca04, 0x039100, 0x039200, 0x039300, 0x039400, 0x039500, 0x039600, 0x039700, - 0x039800, 0x039900, 0x039a00, 0x039b00, 0x039c00, 0x039d00, 0x039e00, 0x039f00, - 0x03a000, 0x03a100, 0x03a200, 0x03a300, 0x03a400, 0x03a500, 0x03a600, 0x03a700, - 0x03a800, 0x03a900, 0x03990a, 0x03a50a, 0x039184, 0x039584, 0x039784, 0x039984, - 0x03cb04, 0x039180, 0x039280, 0x039380, 0x039480, 0x039580, 0x039680, 0x039780, - 0x039880, 0x039980, 0x039a80, 0x039b80, 0x039c80, 0x039d80, 0x039e80, 0x039f80, - 0x03a080, 0x03a180, 0x03a380, 0x03a380, 0x03a480, 0x03a580, 0x03a680, 0x03a780, - 0x03a880, 0x03a980, 0x03998a, 0x03a58a, 0x039f84, 0x03a584, 0x03a984, 0x03cf00, - 0x039280, 0x039880, 0x03d200, 0x03d204, 0x03d20a, 0x03a680, 0x03a080, 0x03d700, - 0x03d800, 0x03d880, 0x03da00, 0x03da80, 0x03dc00, 0x03dc80, 0x03de00, 0x03de80, - 0x03e000, 0x03e080, 0x03e200, 0x03e280, 0x03e400, 0x03e480, 0x03e600, 0x03e680, - 0x03e800, 0x03e880, 0x03ea00, 0x03ea80, 0x03ec00, 0x03ec80, 0x03ee00, 0x03ee80, - 0x039a80, 0x03a180, 0x03f980, 0x03f300, 0x03f400, 0x039580, 0x03f600, 0x03f700, - 0x03f780, 0x03f900, 0x03fa00, 0x03fa80, 0x03fc00, 0x03fd00, 0x03fe00, 0x03ff00 -}; - -static const int32_t ucp0x04[256] = -{ 0x041503, 0x04150a, 0x040200, 0x041304, 0x040400, 0x040500, 0x040600, 0x04060a, - 0x040800, 0x040900, 0x040a00, 0x040b00, 0x041a04, 0x041803, 0x042308, 0x040f00, - 0x041000, 0x041100, 0x041200, 0x041300, 0x041400, 0x041500, 0x041600, 0x041700, - 0x041800, 0x041808, 0x041a00, 0x041b00, 0x041c00, 0x041d00, 0x041e00, 0x041f00, - 0x042000, 0x042100, 0x042200, 0x042300, 0x042400, 0x042500, 0x042600, 0x042700, - 0x042800, 0x042900, 0x042a00, 0x042b00, 0x042c00, 0x042d00, 0x042e00, 0x042f00, - 0x041080, 0x041180, 0x041280, 0x041380, 0x041480, 0x041580, 0x041680, 0x041780, - 0x041880, 0x041888, 0x041a80, 0x041b80, 0x041c80, 0x041d80, 0x041e80, 0x041f80, - 0x042080, 0x042180, 0x042280, 0x042380, 0x042480, 0x042580, 0x042680, 0x042780, - 0x042880, 0x042980, 0x042a80, 0x042b80, 0x042c80, 0x042d80, 0x042e80, 0x042f80, - 0x041583, 0x04158a, 0x040280, 0x041384, 0x040480, 0x040580, 0x040680, 0x04068a, - 0x040880, 0x040980, 0x040a80, 0x040b80, 0x041a84, 0x041883, 0x042388, 0x040f80, - 0x046000, 0x046080, 0x046200, 0x046280, 0x046400, 0x046480, 0x046600, 0x046680, - 0x046800, 0x046880, 0x046a00, 0x046a80, 0x046c00, 0x046c80, 0x046e00, 0x046e80, - 0x047000, 0x047080, 0x047200, 0x047280, 0x047400, 0x047480, 0x04740f, 0x04748f, - 0x047800, 0x047880, 0x047a00, 0x047a80, 0x047c00, 0x047c80, 0x047e00, 0x047e80, - 0x048000, 0x048080, 0x048200, 0x048300, 0x048400, 0x048500, 0x048600, 0x048700, - 0x048800, 0x048900, 0x048a00, 0x048a80, 0x048c00, 0x048c80, 0x048e00, 0x048e80, - 0x049000, 0x049080, 0x049200, 0x049280, 0x049400, 0x049480, 0x049600, 0x049680, - 0x049800, 0x049880, 0x049a00, 0x049a80, 0x049c00, 0x049c80, 0x049e00, 0x049e80, - 0x04a000, 0x04a080, 0x04a200, 0x04a280, 0x04a400, 0x04a480, 0x04a600, 0x04a680, - 0x04a800, 0x04a880, 0x04aa00, 0x04aa80, 0x04ac00, 0x04ac80, 0x04ae00, 0x04ae80, - 0x04b000, 0x04b080, 0x04b200, 0x04b280, 0x04b400, 0x04b480, 0x04b600, 0x04b680, - 0x04b800, 0x04b880, 0x04ba00, 0x04ba80, 0x04bc00, 0x04bc80, 0x04be00, 0x04be80, - 0x04c000, 0x041608, 0x041688, 0x04c300, 0x04c380, 0x04c500, 0x04c580, 0x04c700, - 0x04c780, 0x04c900, 0x04c980, 0x04cb00, 0x04cb80, 0x04cd00, 0x04cd80, 0x04cf00, - 0x041008, 0x041088, 0x04100a, 0x04108a, 0x04d400, 0x04d480, 0x041508, 0x041588, - 0x04d800, 0x04d880, 0x04d80a, 0x04d88a, 0x04160a, 0x04168a, 0x04170a, 0x04178a, - 0x04e000, 0x04e080, 0x041807, 0x041887, 0x04180a, 0x04188a, 0x041e0a, 0x041e8a, - 0x04e800, 0x04e880, 0x04e80a, 0x04e88a, 0x042d0a, 0x042d8a, 0x042307, 0x042387, - 0x04230a, 0x04238a, 0x04230d, 0x04238d, 0x04270a, 0x04278a, 0x04f600, 0x04f680, - 0x042b0a, 0x042b8a, 0x04fa00, 0x04fb00, 0x04fc00, 0x04fd00, 0x04fe00, 0x04ff00 -}; - -static const int32_t ucp0x05[256] = -{ 0x050000, 0x050080, 0x050200, 0x050280, 0x050400, 0x050480, 0x050600, 0x050680, - 0x050800, 0x050880, 0x050a00, 0x050a80, 0x050c00, 0x050c80, 0x050e00, 0x050e80, - 0x051000, 0x051100, 0x051200, 0x051300, 0x051400, 0x051500, 0x051600, 0x051700, - 0x051800, 0x051900, 0x051a00, 0x051b00, 0x051c00, 0x051d00, 0x051e00, 0x051f00, - 0x052000, 0x052100, 0x052200, 0x052300, 0x052400, 0x052500, 0x052600, 0x052700, - 0x052800, 0x052900, 0x052a00, 0x052b00, 0x052c00, 0x052d00, 0x052e00, 0x052f00, - 0x053000, 0x053100, 0x053200, 0x053300, 0x053400, 0x053500, 0x053600, 0x053700, - 0x053800, 0x053900, 0x053a00, 0x053b00, 0x053c00, 0x053d00, 0x053e00, 0x053f00, - 0x054000, 0x054100, 0x054200, 0x054300, 0x054400, 0x054500, 0x054600, 0x054700, - 0x054800, 0x054900, 0x054a00, 0x054b00, 0x054c00, 0x054d00, 0x054e00, 0x054f00, - 0x055000, 0x055100, 0x055200, 0x055300, 0x055400, 0x055500, 0x055600, 0x055700, - 0x055800, 0x055900, 0x055a00, 0x055b00, 0x055c00, 0x055d00, 0x055e00, 0x055f00, - 0x056000, 0x053180, 0x053280, 0x053380, 0x053480, 0x053580, 0x053680, 0x053780, - 0x053880, 0x053980, 0x053a80, 0x053b80, 0x053c80, 0x053d80, 0x053e80, 0x053f80, - 0x054080, 0x054180, 0x054280, 0x054380, 0x054480, 0x054580, 0x054680, 0x054780, - 0x054880, 0x054980, 0x054a80, 0x054b80, 0x054c80, 0x054d80, 0x054e80, 0x054f80, - 0x055080, 0x055180, 0x055280, 0x055380, 0x055480, 0x055580, 0x055680, 0x058700, - 0x058800, 0x058900, 0x058a00, 0x058b00, 0x058c00, 0x058d00, 0x058e00, 0x058f00, - 0x059000, 0x059100, 0x059200, 0x059300, 0x059400, 0x059500, 0x059600, 0x059700, - 0x059800, 0x059900, 0x059a00, 0x059b00, 0x059c00, 0x059d00, 0x059e00, 0x059f00, - 0x05a000, 0x05a100, 0x05a200, 0x05a300, 0x05a400, 0x05a500, 0x05a600, 0x05a700, - 0x05a800, 0x05a900, 0x05aa00, 0x05ab00, 0x05ac00, 0x05ad00, 0x05ae00, 0x05af00, - 0x05b000, 0x05b100, 0x05b200, 0x05b300, 0x05b400, 0x05b500, 0x05b600, 0x05b700, - 0x05b800, 0x05b900, 0x05ba00, 0x05bb00, 0x05bc00, 0x05bd00, 0x05be00, 0x05bf00, - 0x05c000, 0x05c100, 0x05c200, 0x05c300, 0x05c400, 0x05c500, 0x05c600, 0x05c700, - 0x05c800, 0x05c900, 0x05ca00, 0x05cb00, 0x05cc00, 0x05cd00, 0x05ce00, 0x05cf00, - 0x05d000, 0x05d100, 0x05d200, 0x05d300, 0x05d400, 0x05d500, 0x05d600, 0x05d700, - 0x05d800, 0x05d900, 0x05da00, 0x05db00, 0x05dc00, 0x05dd00, 0x05de00, 0x05df00, - 0x05e000, 0x05e100, 0x05e200, 0x05e300, 0x05e400, 0x05e500, 0x05e600, 0x05e700, - 0x05e800, 0x05e900, 0x05ea00, 0x05eb00, 0x05ec00, 0x05ed00, 0x05ee00, 0x05ef00, - 0x05f000, 0x05f100, 0x05f200, 0x05f300, 0x05f400, 0x05f500, 0x05f600, 0x05f700, - 0x05f800, 0x05f900, 0x05fa00, 0x05fb00, 0x05fc00, 0x05fd00, 0x05fe00, 0x05ff00 -}; - -static const int32_t ucp0x06[256] = -{ 0x060000, 0x060100, 0x060200, 0x060300, 0x060400, 0x060500, 0x060600, 0x060700, - 0x060800, 0x060900, 0x060a00, 0x060b00, 0x060c00, 0x060d00, 0x060e00, 0x060f00, - 0x061000, 0x061100, 0x061200, 0x061300, 0x061400, 0x061500, 0x061600, 0x061700, - 0x061800, 0x061900, 0x061a00, 0x061b00, 0x061c00, 0x061d00, 0x061e00, 0x061f00, - 0x062000, 0x062100, 0x062729, 0x06272a, 0x06482a, 0x06272b, 0x064a2a, 0x062700, - 0x062800, 0x062900, 0x062a00, 0x062b00, 0x062c00, 0x062d00, 0x062e00, 0x062f00, - 0x063000, 0x063100, 0x063200, 0x063300, 0x063400, 0x063500, 0x063600, 0x063700, - 0x063800, 0x063900, 0x063a00, 0x063b00, 0x063c00, 0x063d00, 0x063e00, 0x063f00, - 0x064000, 0x064100, 0x064200, 0x064300, 0x064400, 0x064500, 0x064600, 0x064700, - 0x064800, 0x064900, 0x064a00, 0x064b00, 0x064c00, 0x064d00, 0x064e00, 0x064f00, - 0x065000, 0x065100, 0x065200, 0x065300, 0x065400, 0x065500, 0x065600, 0x065700, - 0x065800, 0x065900, 0x065a00, 0x065b00, 0x065c00, 0x065d00, 0x065e00, 0x065f00, - 0x066000, 0x066100, 0x066200, 0x066300, 0x066400, 0x066500, 0x066600, 0x066700, - 0x066800, 0x066900, 0x066a00, 0x066b00, 0x066c00, 0x066d00, 0x066e00, 0x066f00, - 0x067000, 0x067100, 0x067200, 0x067300, 0x067400, 0x067500, 0x067600, 0x067700, - 0x067800, 0x067900, 0x067a00, 0x067b00, 0x067c00, 0x067d00, 0x067e00, 0x067f00, - 0x068000, 0x068100, 0x068200, 0x068300, 0x068400, 0x068500, 0x068600, 0x068700, - 0x068800, 0x068900, 0x068a00, 0x068b00, 0x068c00, 0x068d00, 0x068e00, 0x068f00, - 0x069000, 0x069100, 0x069200, 0x069300, 0x069400, 0x069500, 0x069600, 0x069700, - 0x069800, 0x069900, 0x069a00, 0x069b00, 0x069c00, 0x069d00, 0x069e00, 0x069f00, - 0x06a000, 0x06a100, 0x06a200, 0x06a300, 0x06a400, 0x06a500, 0x06a600, 0x06a700, - 0x06a800, 0x06a900, 0x06aa00, 0x06ab00, 0x06ac00, 0x06ad00, 0x06ae00, 0x06af00, - 0x06b000, 0x06b100, 0x06b200, 0x06b300, 0x06b400, 0x06b500, 0x06b600, 0x06b700, - 0x06b800, 0x06b900, 0x06ba00, 0x06bb00, 0x06bc00, 0x06bd00, 0x06be00, 0x06bf00, - 0x06d52a, 0x06c100, 0x06c12a, 0x06c300, 0x06c400, 0x06c500, 0x06c600, 0x06c700, - 0x06c800, 0x06c900, 0x06ca00, 0x06cb00, 0x06cc00, 0x06cd00, 0x06ce00, 0x06cf00, - 0x06d000, 0x06d100, 0x06d200, 0x06d22a, 0x06d400, 0x06d500, 0x06d600, 0x06d700, - 0x06d800, 0x06d900, 0x06da00, 0x06db00, 0x06dc00, 0x06dd00, 0x06de00, 0x06df00, - 0x06e000, 0x06e100, 0x06e200, 0x06e300, 0x06e400, 0x06e500, 0x06e600, 0x06e700, - 0x06e800, 0x06e900, 0x06ea00, 0x06eb00, 0x06ec00, 0x06ed00, 0x06ee00, 0x06ef00, - 0x06f000, 0x06f100, 0x06f200, 0x06f300, 0x06f400, 0x06f500, 0x06f600, 0x06f700, - 0x06f800, 0x06f900, 0x06fa00, 0x06fb00, 0x06fc00, 0x06fd00, 0x06fe00, 0x06ff00 -}; - -static const int32_t ucp0x09[256] = -{ 0x090000, 0x090100, 0x090200, 0x090300, 0x090400, 0x090500, 0x090600, 0x090700, - 0x090800, 0x090900, 0x090a00, 0x090b00, 0x090c00, 0x090d00, 0x090e00, 0x090f00, - 0x091000, 0x091100, 0x091200, 0x091300, 0x091400, 0x091500, 0x091600, 0x091700, - 0x091800, 0x091900, 0x091a00, 0x091b00, 0x091c00, 0x091d00, 0x091e00, 0x091f00, - 0x092000, 0x092100, 0x092200, 0x092300, 0x092400, 0x092500, 0x092600, 0x092700, - 0x092800, 0x09282c, 0x092a00, 0x092b00, 0x092c00, 0x092d00, 0x092e00, 0x092f00, - 0x093000, 0x09302c, 0x093200, 0x093300, 0x09332c, 0x093500, 0x093600, 0x093700, - 0x093800, 0x093900, 0x093a00, 0x093b00, 0x093c00, 0x093d00, 0x093e00, 0x093f00, - 0x094000, 0x094100, 0x094200, 0x094300, 0x094400, 0x094500, 0x094600, 0x094700, - 0x094800, 0x094900, 0x094a00, 0x094b00, 0x094c00, 0x094d00, 0x094e00, 0x094f00, - 0x095000, 0x095100, 0x095200, 0x095300, 0x095400, 0x095500, 0x095600, 0x095700, - 0x09152c, 0x09162c, 0x09172c, 0x091c2c, 0x09212c, 0x09222c, 0x092b2c, 0x092f2c, - 0x096000, 0x096100, 0x096200, 0x096300, 0x096400, 0x096500, 0x096600, 0x096700, - 0x096800, 0x096900, 0x096a00, 0x096b00, 0x096c00, 0x096d00, 0x096e00, 0x096f00, - 0x097000, 0x097100, 0x097200, 0x097300, 0x097400, 0x097500, 0x097600, 0x097700, - 0x097800, 0x097900, 0x097a00, 0x097b00, 0x097c00, 0x097d00, 0x097e00, 0x097f00, - 0x098000, 0x098100, 0x098200, 0x098300, 0x098400, 0x098500, 0x098600, 0x098700, - 0x098800, 0x098900, 0x098a00, 0x098b00, 0x098c00, 0x098d00, 0x098e00, 0x098f00, - 0x099000, 0x099100, 0x099200, 0x099300, 0x099400, 0x099500, 0x099600, 0x099700, - 0x099800, 0x099900, 0x099a00, 0x099b00, 0x099c00, 0x099d00, 0x099e00, 0x099f00, - 0x09a000, 0x09a100, 0x09a200, 0x09a300, 0x09a400, 0x09a500, 0x09a600, 0x09a700, - 0x09a800, 0x09a900, 0x09aa00, 0x09ab00, 0x09ac00, 0x09ad00, 0x09ae00, 0x09af00, - 0x09b000, 0x09b100, 0x09b200, 0x09b300, 0x09b400, 0x09b500, 0x09b600, 0x09b700, - 0x09b800, 0x09b900, 0x09ba00, 0x09bb00, 0x09bc00, 0x09bd00, 0x09be00, 0x09bf00, - 0x09c000, 0x09c100, 0x09c200, 0x09c300, 0x09c400, 0x09c500, 0x09c600, 0x09c700, - 0x09c800, 0x09c900, 0x09ca00, 0x09cb00, 0x09cc00, 0x09cd00, 0x09ce00, 0x09cf00, - 0x09d000, 0x09d100, 0x09d200, 0x09d300, 0x09d400, 0x09d500, 0x09d600, 0x09d700, - 0x09d800, 0x09d900, 0x09da00, 0x09db00, 0x09a12d, 0x09a22d, 0x09de00, 0x09af2d, - 0x09e000, 0x09e100, 0x09e200, 0x09e300, 0x09e400, 0x09e500, 0x09e600, 0x09e700, - 0x09e800, 0x09e900, 0x09ea00, 0x09eb00, 0x09ec00, 0x09ed00, 0x09ee00, 0x09ef00, - 0x09f000, 0x09f100, 0x09f200, 0x09f300, 0x09f400, 0x09f500, 0x09f600, 0x09f700, - 0x09f800, 0x09f900, 0x09fa00, 0x09fb00, 0x09fc00, 0x09fd00, 0x09fe00, 0x09ff00 -}; - -static const int32_t ucp0x0a[256] = -{ 0x0a0000, 0x0a0100, 0x0a0200, 0x0a0300, 0x0a0400, 0x0a0500, 0x0a0600, 0x0a0700, - 0x0a0800, 0x0a0900, 0x0a0a00, 0x0a0b00, 0x0a0c00, 0x0a0d00, 0x0a0e00, 0x0a0f00, - 0x0a1000, 0x0a1100, 0x0a1200, 0x0a1300, 0x0a1400, 0x0a1500, 0x0a1600, 0x0a1700, - 0x0a1800, 0x0a1900, 0x0a1a00, 0x0a1b00, 0x0a1c00, 0x0a1d00, 0x0a1e00, 0x0a1f00, - 0x0a2000, 0x0a2100, 0x0a2200, 0x0a2300, 0x0a2400, 0x0a2500, 0x0a2600, 0x0a2700, - 0x0a2800, 0x0a2900, 0x0a2a00, 0x0a2b00, 0x0a2c00, 0x0a2d00, 0x0a2e00, 0x0a2f00, - 0x0a3000, 0x0a3100, 0x0a3200, 0x0a322e, 0x0a3400, 0x0a3500, 0x0a382e, 0x0a3700, - 0x0a3800, 0x0a3900, 0x0a3a00, 0x0a3b00, 0x0a3c00, 0x0a3d00, 0x0a3e00, 0x0a3f00, - 0x0a4000, 0x0a4100, 0x0a4200, 0x0a4300, 0x0a4400, 0x0a4500, 0x0a4600, 0x0a4700, - 0x0a4800, 0x0a4900, 0x0a4a00, 0x0a4b00, 0x0a4c00, 0x0a4d00, 0x0a4e00, 0x0a4f00, - 0x0a5000, 0x0a5100, 0x0a5200, 0x0a5300, 0x0a5400, 0x0a5500, 0x0a5600, 0x0a5700, - 0x0a5800, 0x0a162e, 0x0a172e, 0x0a1c2e, 0x0a5c00, 0x0a5d00, 0x0a2b2e, 0x0a5f00, - 0x0a6000, 0x0a6100, 0x0a6200, 0x0a6300, 0x0a6400, 0x0a6500, 0x0a6600, 0x0a6700, - 0x0a6800, 0x0a6900, 0x0a6a00, 0x0a6b00, 0x0a6c00, 0x0a6d00, 0x0a6e00, 0x0a6f00, - 0x0a7000, 0x0a7100, 0x0a7200, 0x0a7300, 0x0a7400, 0x0a7500, 0x0a7600, 0x0a7700, - 0x0a7800, 0x0a7900, 0x0a7a00, 0x0a7b00, 0x0a7c00, 0x0a7d00, 0x0a7e00, 0x0a7f00, - 0x0a8000, 0x0a8100, 0x0a8200, 0x0a8300, 0x0a8400, 0x0a8500, 0x0a8600, 0x0a8700, - 0x0a8800, 0x0a8900, 0x0a8a00, 0x0a8b00, 0x0a8c00, 0x0a8d00, 0x0a8e00, 0x0a8f00, - 0x0a9000, 0x0a9100, 0x0a9200, 0x0a9300, 0x0a9400, 0x0a9500, 0x0a9600, 0x0a9700, - 0x0a9800, 0x0a9900, 0x0a9a00, 0x0a9b00, 0x0a9c00, 0x0a9d00, 0x0a9e00, 0x0a9f00, - 0x0aa000, 0x0aa100, 0x0aa200, 0x0aa300, 0x0aa400, 0x0aa500, 0x0aa600, 0x0aa700, - 0x0aa800, 0x0aa900, 0x0aaa00, 0x0aab00, 0x0aac00, 0x0aad00, 0x0aae00, 0x0aaf00, - 0x0ab000, 0x0ab100, 0x0ab200, 0x0ab300, 0x0ab400, 0x0ab500, 0x0ab600, 0x0ab700, - 0x0ab800, 0x0ab900, 0x0aba00, 0x0abb00, 0x0abc00, 0x0abd00, 0x0abe00, 0x0abf00, - 0x0ac000, 0x0ac100, 0x0ac200, 0x0ac300, 0x0ac400, 0x0ac500, 0x0ac600, 0x0ac700, - 0x0ac800, 0x0ac900, 0x0aca00, 0x0acb00, 0x0acc00, 0x0acd00, 0x0ace00, 0x0acf00, - 0x0ad000, 0x0ad100, 0x0ad200, 0x0ad300, 0x0ad400, 0x0ad500, 0x0ad600, 0x0ad700, - 0x0ad800, 0x0ad900, 0x0ada00, 0x0adb00, 0x0adc00, 0x0add00, 0x0ade00, 0x0adf00, - 0x0ae000, 0x0ae100, 0x0ae200, 0x0ae300, 0x0ae400, 0x0ae500, 0x0ae600, 0x0ae700, - 0x0ae800, 0x0ae900, 0x0aea00, 0x0aeb00, 0x0aec00, 0x0aed00, 0x0aee00, 0x0aef00, - 0x0af000, 0x0af100, 0x0af200, 0x0af300, 0x0af400, 0x0af500, 0x0af600, 0x0af700, - 0x0af800, 0x0af900, 0x0afa00, 0x0afb00, 0x0afc00, 0x0afd00, 0x0afe00, 0x0aff00 -}; - -static const int32_t ucp0x0b[256] = -{ 0x0b0000, 0x0b0100, 0x0b0200, 0x0b0300, 0x0b0400, 0x0b0500, 0x0b0600, 0x0b0700, - 0x0b0800, 0x0b0900, 0x0b0a00, 0x0b0b00, 0x0b0c00, 0x0b0d00, 0x0b0e00, 0x0b0f00, - 0x0b1000, 0x0b1100, 0x0b1200, 0x0b1300, 0x0b1400, 0x0b1500, 0x0b1600, 0x0b1700, - 0x0b1800, 0x0b1900, 0x0b1a00, 0x0b1b00, 0x0b1c00, 0x0b1d00, 0x0b1e00, 0x0b1f00, - 0x0b2000, 0x0b2100, 0x0b2200, 0x0b2300, 0x0b2400, 0x0b2500, 0x0b2600, 0x0b2700, - 0x0b2800, 0x0b2900, 0x0b2a00, 0x0b2b00, 0x0b2c00, 0x0b2d00, 0x0b2e00, 0x0b2f00, - 0x0b3000, 0x0b3100, 0x0b3200, 0x0b3300, 0x0b3400, 0x0b3500, 0x0b3600, 0x0b3700, - 0x0b3800, 0x0b3900, 0x0b3a00, 0x0b3b00, 0x0b3c00, 0x0b3d00, 0x0b3e00, 0x0b3f00, - 0x0b4000, 0x0b4100, 0x0b4200, 0x0b4300, 0x0b4400, 0x0b4500, 0x0b4600, 0x0b4700, - 0x0b4800, 0x0b4900, 0x0b4a00, 0x0b4b00, 0x0b4c00, 0x0b4d00, 0x0b4e00, 0x0b4f00, - 0x0b5000, 0x0b5100, 0x0b5200, 0x0b5300, 0x0b5400, 0x0b5500, 0x0b5600, 0x0b5700, - 0x0b5800, 0x0b5900, 0x0b5a00, 0x0b5b00, 0x0b212f, 0x0b222f, 0x0b5e00, 0x0b5f00, - 0x0b6000, 0x0b6100, 0x0b6200, 0x0b6300, 0x0b6400, 0x0b6500, 0x0b6600, 0x0b6700, - 0x0b6800, 0x0b6900, 0x0b6a00, 0x0b6b00, 0x0b6c00, 0x0b6d00, 0x0b6e00, 0x0b6f00, - 0x0b7000, 0x0b7100, 0x0b7200, 0x0b7300, 0x0b7400, 0x0b7500, 0x0b7600, 0x0b7700, - 0x0b7800, 0x0b7900, 0x0b7a00, 0x0b7b00, 0x0b7c00, 0x0b7d00, 0x0b7e00, 0x0b7f00, - 0x0b8000, 0x0b8100, 0x0b8200, 0x0b8300, 0x0b8400, 0x0b8500, 0x0b8600, 0x0b8700, - 0x0b8800, 0x0b8900, 0x0b8a00, 0x0b8b00, 0x0b8c00, 0x0b8d00, 0x0b8e00, 0x0b8f00, - 0x0b9000, 0x0b9100, 0x0b9200, 0x0b9300, 0x0b9400, 0x0b9500, 0x0b9600, 0x0b9700, - 0x0b9800, 0x0b9900, 0x0b9a00, 0x0b9b00, 0x0b9c00, 0x0b9d00, 0x0b9e00, 0x0b9f00, - 0x0ba000, 0x0ba100, 0x0ba200, 0x0ba300, 0x0ba400, 0x0ba500, 0x0ba600, 0x0ba700, - 0x0ba800, 0x0ba900, 0x0baa00, 0x0bab00, 0x0bac00, 0x0bad00, 0x0bae00, 0x0baf00, - 0x0bb000, 0x0bb100, 0x0bb200, 0x0bb300, 0x0bb400, 0x0bb500, 0x0bb600, 0x0bb700, - 0x0bb800, 0x0bb900, 0x0bba00, 0x0bbb00, 0x0bbc00, 0x0bbd00, 0x0bbe00, 0x0bbf00, - 0x0bc000, 0x0bc100, 0x0bc200, 0x0bc300, 0x0bc400, 0x0bc500, 0x0bc600, 0x0bc700, - 0x0bc800, 0x0bc900, 0x0bca00, 0x0bcb00, 0x0bcc00, 0x0bcd00, 0x0bce00, 0x0bcf00, - 0x0bd000, 0x0bd100, 0x0bd200, 0x0bd300, 0x0bd400, 0x0bd500, 0x0bd600, 0x0bd700, - 0x0bd800, 0x0bd900, 0x0bda00, 0x0bdb00, 0x0bdc00, 0x0bdd00, 0x0bde00, 0x0bdf00, - 0x0be000, 0x0be100, 0x0be200, 0x0be300, 0x0be400, 0x0be500, 0x0be600, 0x0be700, - 0x0be800, 0x0be900, 0x0bea00, 0x0beb00, 0x0bec00, 0x0bed00, 0x0bee00, 0x0bef00, - 0x0bf000, 0x0bf100, 0x0bf200, 0x0bf300, 0x0bf400, 0x0bf500, 0x0bf600, 0x0bf700, - 0x0bf800, 0x0bf900, 0x0bfa00, 0x0bfb00, 0x0bfc00, 0x0bfd00, 0x0bfe00, 0x0bff00 -}; - -static const int32_t ucp0x0c[256] = -{ 0x0c0000, 0x0c0100, 0x0c0200, 0x0c0300, 0x0c0400, 0x0c0500, 0x0c0600, 0x0c0700, - 0x0c0800, 0x0c0900, 0x0c0a00, 0x0c0b00, 0x0c0c00, 0x0c0d00, 0x0c0e00, 0x0c0f00, - 0x0c1000, 0x0c1100, 0x0c1200, 0x0c1300, 0x0c1400, 0x0c1500, 0x0c1600, 0x0c1700, - 0x0c1800, 0x0c1900, 0x0c1a00, 0x0c1b00, 0x0c1c00, 0x0c1d00, 0x0c1e00, 0x0c1f00, - 0x0c2000, 0x0c2100, 0x0c2200, 0x0c2300, 0x0c2400, 0x0c2500, 0x0c2600, 0x0c2700, - 0x0c2800, 0x0c2900, 0x0c2a00, 0x0c2b00, 0x0c2c00, 0x0c2d00, 0x0c2e00, 0x0c2f00, - 0x0c3000, 0x0c3100, 0x0c3200, 0x0c3300, 0x0c3400, 0x0c3500, 0x0c3600, 0x0c3700, - 0x0c3800, 0x0c3900, 0x0c3a00, 0x0c3b00, 0x0c3c00, 0x0c3d00, 0x0c3e00, 0x0c3f00, - 0x0c4000, 0x0c4100, 0x0c4200, 0x0c4300, 0x0c4400, 0x0c4500, 0x0c4600, 0x0c4700, - 0x0c4630, 0x0c4900, 0x0c4a00, 0x0c4b00, 0x0c4c00, 0x0c4d00, 0x0c4e00, 0x0c4f00, - 0x0c5000, 0x0c5100, 0x0c5200, 0x0c5300, 0x0c5400, 0x0c5500, 0x0c5600, 0x0c5700, - 0x0c5800, 0x0c5900, 0x0c5a00, 0x0c5b00, 0x0c5c00, 0x0c5d00, 0x0c5e00, 0x0c5f00, - 0x0c6000, 0x0c6100, 0x0c6200, 0x0c6300, 0x0c6400, 0x0c6500, 0x0c6600, 0x0c6700, - 0x0c6800, 0x0c6900, 0x0c6a00, 0x0c6b00, 0x0c6c00, 0x0c6d00, 0x0c6e00, 0x0c6f00, - 0x0c7000, 0x0c7100, 0x0c7200, 0x0c7300, 0x0c7400, 0x0c7500, 0x0c7600, 0x0c7700, - 0x0c7800, 0x0c7900, 0x0c7a00, 0x0c7b00, 0x0c7c00, 0x0c7d00, 0x0c7e00, 0x0c7f00, - 0x0c8000, 0x0c8100, 0x0c8200, 0x0c8300, 0x0c8400, 0x0c8500, 0x0c8600, 0x0c8700, - 0x0c8800, 0x0c8900, 0x0c8a00, 0x0c8b00, 0x0c8c00, 0x0c8d00, 0x0c8e00, 0x0c8f00, - 0x0c9000, 0x0c9100, 0x0c9200, 0x0c9300, 0x0c9400, 0x0c9500, 0x0c9600, 0x0c9700, - 0x0c9800, 0x0c9900, 0x0c9a00, 0x0c9b00, 0x0c9c00, 0x0c9d00, 0x0c9e00, 0x0c9f00, - 0x0ca000, 0x0ca100, 0x0ca200, 0x0ca300, 0x0ca400, 0x0ca500, 0x0ca600, 0x0ca700, - 0x0ca800, 0x0ca900, 0x0caa00, 0x0cab00, 0x0cac00, 0x0cad00, 0x0cae00, 0x0caf00, - 0x0cb000, 0x0cb100, 0x0cb200, 0x0cb300, 0x0cb400, 0x0cb500, 0x0cb600, 0x0cb700, - 0x0cb800, 0x0cb900, 0x0cba00, 0x0cbb00, 0x0cbc00, 0x0cbd00, 0x0cbe00, 0x0cbf00, - 0x0cc000, 0x0cc100, 0x0cc200, 0x0cc300, 0x0cc400, 0x0cc500, 0x0cc600, 0x0cc700, - 0x0cc800, 0x0cc900, 0x0cca00, 0x0ccb00, 0x0ccc00, 0x0ccd00, 0x0cce00, 0x0ccf00, - 0x0cd000, 0x0cd100, 0x0cd200, 0x0cd300, 0x0cd400, 0x0cd500, 0x0cd600, 0x0cd700, - 0x0cd800, 0x0cd900, 0x0cda00, 0x0cdb00, 0x0cdc00, 0x0cdd00, 0x0cde00, 0x0cdf00, - 0x0ce000, 0x0ce100, 0x0ce200, 0x0ce300, 0x0ce400, 0x0ce500, 0x0ce600, 0x0ce700, - 0x0ce800, 0x0ce900, 0x0cea00, 0x0ceb00, 0x0cec00, 0x0ced00, 0x0cee00, 0x0cef00, - 0x0cf000, 0x0cf100, 0x0cf200, 0x0cf300, 0x0cf400, 0x0cf500, 0x0cf600, 0x0cf700, - 0x0cf800, 0x0cf900, 0x0cfa00, 0x0cfb00, 0x0cfc00, 0x0cfd00, 0x0cfe00, 0x0cff00 -}; - -static const int32_t ucp0x0d[256] = -{ 0x0d0000, 0x0d0100, 0x0d0200, 0x0d0300, 0x0d0400, 0x0d0500, 0x0d0600, 0x0d0700, - 0x0d0800, 0x0d0900, 0x0d0a00, 0x0d0b00, 0x0d0c00, 0x0d0d00, 0x0d0e00, 0x0d0f00, - 0x0d1000, 0x0d1100, 0x0d1200, 0x0d1300, 0x0d1400, 0x0d1500, 0x0d1600, 0x0d1700, - 0x0d1800, 0x0d1900, 0x0d1a00, 0x0d1b00, 0x0d1c00, 0x0d1d00, 0x0d1e00, 0x0d1f00, - 0x0d2000, 0x0d2100, 0x0d2200, 0x0d2300, 0x0d2400, 0x0d2500, 0x0d2600, 0x0d2700, - 0x0d2800, 0x0d2900, 0x0d2a00, 0x0d2b00, 0x0d2c00, 0x0d2d00, 0x0d2e00, 0x0d2f00, - 0x0d3000, 0x0d3100, 0x0d3200, 0x0d3300, 0x0d3400, 0x0d3500, 0x0d3600, 0x0d3700, - 0x0d3800, 0x0d3900, 0x0d3a00, 0x0d3b00, 0x0d3c00, 0x0d3d00, 0x0d3e00, 0x0d3f00, - 0x0d4000, 0x0d4100, 0x0d4200, 0x0d4300, 0x0d4400, 0x0d4500, 0x0d4600, 0x0d4700, - 0x0d4800, 0x0d4900, 0x0d4a00, 0x0d4b00, 0x0d4c00, 0x0d4d00, 0x0d4e00, 0x0d4f00, - 0x0d5000, 0x0d5100, 0x0d5200, 0x0d5300, 0x0d5400, 0x0d5500, 0x0d5600, 0x0d5700, - 0x0d5800, 0x0d5900, 0x0d5a00, 0x0d5b00, 0x0d5c00, 0x0d5d00, 0x0d5e00, 0x0d5f00, - 0x0d6000, 0x0d6100, 0x0d6200, 0x0d6300, 0x0d6400, 0x0d6500, 0x0d6600, 0x0d6700, - 0x0d6800, 0x0d6900, 0x0d6a00, 0x0d6b00, 0x0d6c00, 0x0d6d00, 0x0d6e00, 0x0d6f00, - 0x0d7000, 0x0d7100, 0x0d7200, 0x0d7300, 0x0d7400, 0x0d7500, 0x0d7600, 0x0d7700, - 0x0d7800, 0x0d7900, 0x0d7a00, 0x0d7b00, 0x0d7c00, 0x0d7d00, 0x0d7e00, 0x0d7f00, - 0x0d8000, 0x0d8100, 0x0d8200, 0x0d8300, 0x0d8400, 0x0d8500, 0x0d8600, 0x0d8700, - 0x0d8800, 0x0d8900, 0x0d8a00, 0x0d8b00, 0x0d8c00, 0x0d8d00, 0x0d8e00, 0x0d8f00, - 0x0d9000, 0x0d9100, 0x0d9200, 0x0d9300, 0x0d9400, 0x0d9500, 0x0d9600, 0x0d9700, - 0x0d9800, 0x0d9900, 0x0d9a00, 0x0d9b00, 0x0d9c00, 0x0d9d00, 0x0d9e00, 0x0d9f00, - 0x0da000, 0x0da100, 0x0da200, 0x0da300, 0x0da400, 0x0da500, 0x0da600, 0x0da700, - 0x0da800, 0x0da900, 0x0daa00, 0x0dab00, 0x0dac00, 0x0dad00, 0x0dae00, 0x0daf00, - 0x0db000, 0x0db100, 0x0db200, 0x0db300, 0x0db400, 0x0db500, 0x0db600, 0x0db700, - 0x0db800, 0x0db900, 0x0dba00, 0x0dbb00, 0x0dbc00, 0x0dbd00, 0x0dbe00, 0x0dbf00, - 0x0dc000, 0x0dc100, 0x0dc200, 0x0dc300, 0x0dc400, 0x0dc500, 0x0dc600, 0x0dc700, - 0x0dc800, 0x0dc900, 0x0dca00, 0x0dcb00, 0x0dcc00, 0x0dcd00, 0x0dce00, 0x0dcf00, - 0x0dd000, 0x0dd100, 0x0dd200, 0x0dd300, 0x0dd400, 0x0dd500, 0x0dd600, 0x0dd700, - 0x0dd800, 0x0dd900, 0x0dd931, 0x0ddb00, 0x0ddc00, 0x0ddc31, 0x0dde00, 0x0ddf00, - 0x0de000, 0x0de100, 0x0de200, 0x0de300, 0x0de400, 0x0de500, 0x0de600, 0x0de700, - 0x0de800, 0x0de900, 0x0dea00, 0x0deb00, 0x0dec00, 0x0ded00, 0x0dee00, 0x0def00, - 0x0df000, 0x0df100, 0x0df200, 0x0df300, 0x0df400, 0x0df500, 0x0df600, 0x0df700, - 0x0df800, 0x0df900, 0x0dfa00, 0x0dfb00, 0x0dfc00, 0x0dfd00, 0x0dfe00, 0x0dff00 -}; - -static const int32_t ucp0x0f[256] = -{ 0x0f0000, 0x0f0100, 0x0f0200, 0x0f0300, 0x0f0400, 0x0f0500, 0x0f0600, 0x0f0700, - 0x0f0800, 0x0f0900, 0x0f0a00, 0x0f0b00, 0x0f0b01, 0x0f0d00, 0x0f0e00, 0x0f0f00, - 0x0f1000, 0x0f1100, 0x0f1200, 0x0f1300, 0x0f1400, 0x0f1500, 0x0f1600, 0x0f1700, - 0x0f1800, 0x0f1900, 0x0f1a00, 0x0f1b00, 0x0f1c00, 0x0f1d00, 0x0f1e00, 0x0f1f00, - 0x0f2000, 0x0f2100, 0x0f2200, 0x0f2300, 0x0f2400, 0x0f2500, 0x0f2600, 0x0f2700, - 0x0f2800, 0x0f2900, 0x0f2a00, 0x0f2b00, 0x0f2c00, 0x0f2d00, 0x0f2e00, 0x0f2f00, - 0x0f3000, 0x0f3100, 0x0f3200, 0x0f3300, 0x0f3400, 0x0f3500, 0x0f3600, 0x0f3700, - 0x0f3800, 0x0f3900, 0x0f3a00, 0x0f3b00, 0x0f3c00, 0x0f3d00, 0x0f3e00, 0x0f3f00, - 0x0f4000, 0x0f4100, 0x0f4200, 0x0f4300, 0x0f4400, 0x0f4500, 0x0f4600, 0x0f4700, - 0x0f4800, 0x0f4900, 0x0f4a00, 0x0f4b00, 0x0f4c00, 0x0f4d00, 0x0f4e00, 0x0f4f00, - 0x0f5000, 0x0f5100, 0x0f5200, 0x0f5300, 0x0f5400, 0x0f5500, 0x0f5600, 0x0f5700, - 0x0f5800, 0x0f5900, 0x0f5a00, 0x0f5b00, 0x0f5c00, 0x0f5d00, 0x0f5e00, 0x0f5f00, - 0x0f6000, 0x0f6100, 0x0f6200, 0x0f6300, 0x0f6400, 0x0f6500, 0x0f6600, 0x0f6700, - 0x0f6800, 0x0f6900, 0x0f6a00, 0x0f6b00, 0x0f6c00, 0x0f6d00, 0x0f6e00, 0x0f6f00, - 0x0f7000, 0x0f7100, 0x0f7200, 0x0f7132, 0x0f7400, 0x0f7133, 0x0fb234, 0x0f7700, - 0x0fb334, 0x0f7900, 0x0f7a00, 0x0f7b00, 0x0f7c00, 0x0f7d00, 0x0f7e00, 0x0f7f00, - 0x0f8000, 0x0f7134, 0x0f8200, 0x0f8300, 0x0f8400, 0x0f8500, 0x0f8600, 0x0f8700, - 0x0f8800, 0x0f8900, 0x0f8a00, 0x0f8b00, 0x0f8c00, 0x0f8d00, 0x0f8e00, 0x0f8f00, - 0x0f9000, 0x0f9100, 0x0f9200, 0x0f9300, 0x0f9400, 0x0f9500, 0x0f9600, 0x0f9700, - 0x0f9800, 0x0f9900, 0x0f9a00, 0x0f9b00, 0x0f9c00, 0x0f9d00, 0x0f9e00, 0x0f9f00, - 0x0fa000, 0x0fa100, 0x0fa200, 0x0fa300, 0x0fa400, 0x0fa500, 0x0fa600, 0x0fa700, - 0x0fa800, 0x0fa900, 0x0faa00, 0x0fab00, 0x0fac00, 0x0fad00, 0x0fae00, 0x0faf00, - 0x0fb000, 0x0fb100, 0x0fb200, 0x0fb300, 0x0fb400, 0x0fb500, 0x0fb600, 0x0fb700, - 0x0fb800, 0x0fb900, 0x0fba00, 0x0fbb00, 0x0fbc00, 0x0fbd00, 0x0fbe00, 0x0fbf00, - 0x0fc000, 0x0fc100, 0x0fc200, 0x0fc300, 0x0fc400, 0x0fc500, 0x0fc600, 0x0fc700, - 0x0fc800, 0x0fc900, 0x0fca00, 0x0fcb00, 0x0fcc00, 0x0fcd00, 0x0fce00, 0x0fcf00, - 0x0fd000, 0x0fd100, 0x0fd200, 0x0fd300, 0x0fd400, 0x0fd500, 0x0fd600, 0x0fd700, - 0x0fd800, 0x0fd900, 0x0fda00, 0x0fdb00, 0x0fdc00, 0x0fdd00, 0x0fde00, 0x0fdf00, - 0x0fe000, 0x0fe100, 0x0fe200, 0x0fe300, 0x0fe400, 0x0fe500, 0x0fe600, 0x0fe700, - 0x0fe800, 0x0fe900, 0x0fea00, 0x0feb00, 0x0fec00, 0x0fed00, 0x0fee00, 0x0fef00, - 0x0ff000, 0x0ff100, 0x0ff200, 0x0ff300, 0x0ff400, 0x0ff500, 0x0ff600, 0x0ff700, - 0x0ff800, 0x0ff900, 0x0ffa00, 0x0ffb00, 0x0ffc00, 0x0ffd00, 0x0ffe00, 0x0fff00 -}; - -static const int32_t ucp0x10[256] = -{ 0x100000, 0x100100, 0x100200, 0x100300, 0x100400, 0x100500, 0x100600, 0x100700, - 0x100800, 0x100900, 0x100a00, 0x100b00, 0x100c00, 0x100d00, 0x100e00, 0x100f00, - 0x101000, 0x101100, 0x101200, 0x101300, 0x101400, 0x101500, 0x101600, 0x101700, - 0x101800, 0x101900, 0x101a00, 0x101b00, 0x101c00, 0x101d00, 0x101e00, 0x101f00, - 0x102000, 0x102100, 0x102200, 0x102300, 0x102400, 0x102500, 0x102600, 0x102700, - 0x102800, 0x102900, 0x102a00, 0x102b00, 0x102c00, 0x102d00, 0x102e00, 0x102f00, - 0x103000, 0x103100, 0x103200, 0x103300, 0x103400, 0x103500, 0x103600, 0x103700, - 0x103800, 0x103900, 0x103a00, 0x103b00, 0x103c00, 0x103d00, 0x103e00, 0x103f00, - 0x104000, 0x104100, 0x104200, 0x104300, 0x104400, 0x104500, 0x104600, 0x104700, - 0x104800, 0x104900, 0x104a00, 0x104b00, 0x104c00, 0x104d00, 0x104e00, 0x104f00, - 0x105000, 0x105100, 0x105200, 0x105300, 0x105400, 0x105500, 0x105600, 0x105700, - 0x105800, 0x105900, 0x105a00, 0x105b00, 0x105c00, 0x105d00, 0x105e00, 0x105f00, - 0x106000, 0x106100, 0x106200, 0x106300, 0x106400, 0x106500, 0x106600, 0x106700, - 0x106800, 0x106900, 0x106a00, 0x106b00, 0x106c00, 0x106d00, 0x106e00, 0x106f00, - 0x107000, 0x107100, 0x107200, 0x107300, 0x107400, 0x107500, 0x107600, 0x107700, - 0x107800, 0x107900, 0x107a00, 0x107b00, 0x107c00, 0x107d00, 0x107e00, 0x107f00, - 0x108000, 0x108100, 0x108200, 0x108300, 0x108400, 0x108500, 0x108600, 0x108700, - 0x108800, 0x108900, 0x108a00, 0x108b00, 0x108c00, 0x108d00, 0x108e00, 0x108f00, - 0x109000, 0x109100, 0x109200, 0x109300, 0x109400, 0x109500, 0x109600, 0x109700, - 0x109800, 0x109900, 0x109a00, 0x109b00, 0x109c00, 0x109d00, 0x109e00, 0x109f00, - 0x10a000, 0x10a100, 0x10a200, 0x10a300, 0x10a400, 0x10a500, 0x10a600, 0x10a700, - 0x10a800, 0x10a900, 0x10aa00, 0x10ab00, 0x10ac00, 0x10ad00, 0x10ae00, 0x10af00, - 0x10b000, 0x10b100, 0x10b200, 0x10b300, 0x10b400, 0x10b500, 0x10b600, 0x10b700, - 0x10b800, 0x10b900, 0x10ba00, 0x10bb00, 0x10bc00, 0x10bd00, 0x10be00, 0x10bf00, - 0x10c000, 0x10c100, 0x10c200, 0x10c300, 0x10c400, 0x10c500, 0x10c600, 0x10c700, - 0x10c800, 0x10c900, 0x10ca00, 0x10cb00, 0x10cc00, 0x10cd00, 0x10ce00, 0x10cf00, - 0x10d000, 0x10d100, 0x10d200, 0x10d300, 0x10d400, 0x10d500, 0x10d600, 0x10d700, - 0x10d800, 0x10d900, 0x10da00, 0x10db00, 0x10dc00, 0x10dd00, 0x10de00, 0x10df00, - 0x10e000, 0x10e100, 0x10e200, 0x10e300, 0x10e400, 0x10e500, 0x10e600, 0x10e700, - 0x10e800, 0x10e900, 0x10ea00, 0x10eb00, 0x10ec00, 0x10ed00, 0x10ee00, 0x10ef00, - 0x10f000, 0x10f100, 0x10f200, 0x10f300, 0x10f400, 0x10f500, 0x10f600, 0x10f700, - 0x10f800, 0x10f900, 0x10fa00, 0x10fb00, 0x10dc01, 0x10fd00, 0x10fe00, 0x10ff00 -}; - -static const int32_t ucp0x1d[256] = -{ 0x1d0000, 0x1d0100, 0x1d0200, 0x1d0300, 0x1d0400, 0x1d0500, 0x1d0600, 0x1d0700, - 0x1d0800, 0x1d0900, 0x1d0a00, 0x1d0b00, 0x1d0c00, 0x1d0d00, 0x1d0e00, 0x1d0f00, - 0x1d1000, 0x1d1100, 0x1d1200, 0x1d1300, 0x1d1400, 0x1d1500, 0x1d1600, 0x1d1700, - 0x1d1800, 0x1d1900, 0x1d1a00, 0x1d1b00, 0x1d1c00, 0x1d1d00, 0x1d1e00, 0x1d1f00, - 0x1d2000, 0x1d2100, 0x1d2200, 0x1d2300, 0x1d2400, 0x1d2500, 0x1d2600, 0x1d2700, - 0x1d2800, 0x1d2900, 0x1d2a00, 0x1d2b00, 0x004101, 0x00c601, 0x004201, 0x1d2f00, - 0x004401, 0x004501, 0x018e01, 0x004701, 0x004801, 0x004901, 0x004a01, 0x004b01, - 0x004c01, 0x004d01, 0x004e01, 0x1d3b00, 0x004f01, 0x022201, 0x005001, 0x005201, - 0x005401, 0x005501, 0x005701, 0x006101, 0x025001, 0x025101, 0x1d0201, 0x006201, - 0x006401, 0x006501, 0x025901, 0x025b01, 0x025c01, 0x006701, 0x1d4e00, 0x006b01, - 0x006d01, 0x014b01, 0x006f01, 0x025401, 0x1d1601, 0x1d1701, 0x007001, 0x007401, - 0x007501, 0x1d1d01, 0x026f01, 0x007601, 0x1d2501, 0x03b201, 0x03b301, 0x03b401, - 0x03c601, 0x03c701, 0x006901, 0x007201, 0x007501, 0x007601, 0x03b201, 0x03b301, - 0x03c101, 0x03c601, 0x03c701, 0x1d6b00, 0x1d6c00, 0x1d6d00, 0x1d6e00, 0x1d6f00, - 0x1d7000, 0x1d7100, 0x1d7200, 0x1d7300, 0x1d7400, 0x1d7500, 0x1d7600, 0x1d7700, - 0x043d01, 0x1d7900, 0x1d7a00, 0x1d7b00, 0x1d7c00, 0x1d7d00, 0x1d7e00, 0x1d7f00, - 0x1d8000, 0x1d8100, 0x1d8200, 0x1d8300, 0x1d8400, 0x1d8500, 0x1d8600, 0x1d8700, - 0x1d8800, 0x1d8900, 0x1d8a00, 0x1d8b00, 0x1d8c00, 0x1d8d00, 0x1d8e00, 0x1d8f00, - 0x1d9000, 0x1d9100, 0x1d9200, 0x1d9300, 0x1d9400, 0x1d9500, 0x1d9600, 0x1d9700, - 0x1d9800, 0x1d9900, 0x1d9a00, 0x025201, 0x006301, 0x025501, 0x00f001, 0x025c01, - 0x006601, 0x025f01, 0x026101, 0x026501, 0x026801, 0x026901, 0x026a01, 0x1d7b01, - 0x029d01, 0x026d01, 0x1d8501, 0x029f01, 0x027101, 0x027001, 0x027201, 0x027301, - 0x027401, 0x027501, 0x027801, 0x028201, 0x028301, 0x01ab01, 0x028901, 0x028a01, - 0x1d1c01, 0x028b01, 0x028c01, 0x007a01, 0x029001, 0x029101, 0x029201, 0x03b801, - 0x1dc000, 0x1dc100, 0x1dc200, 0x1dc300, 0x1dc400, 0x1dc500, 0x1dc600, 0x1dc700, - 0x1dc800, 0x1dc900, 0x1dca00, 0x1dcb00, 0x1dcc00, 0x1dcd00, 0x1dce00, 0x1dcf00, - 0x1dd000, 0x1dd100, 0x1dd200, 0x1dd300, 0x1dd400, 0x1dd500, 0x1dd600, 0x1dd700, - 0x1dd800, 0x1dd900, 0x1dda00, 0x1ddb00, 0x1ddc00, 0x1ddd00, 0x1dde00, 0x1ddf00, - 0x1de000, 0x1de100, 0x1de200, 0x1de300, 0x1de400, 0x1de500, 0x1de600, 0x1de700, - 0x1de800, 0x1de900, 0x1dea00, 0x1deb00, 0x1dec00, 0x1ded00, 0x1dee00, 0x1def00, - 0x1df000, 0x1df100, 0x1df200, 0x1df300, 0x1df400, 0x1df500, 0x1df600, 0x1df700, - 0x1df800, 0x1df900, 0x1dfa00, 0x1dfb00, 0x1dfc00, 0x1dfd00, 0x1dfe00, 0x1dff00 -}; - -static const int32_t ucp0x1e[256] = -{ 0x004116, 0x004196, 0x004209, 0x004289, 0x004214, 0x004294, 0x00421d, 0x00429d, - 0x00c704, 0x00c784, 0x004409, 0x004489, 0x004414, 0x004494, 0x00441d, 0x00449d, - 0x004418, 0x004498, 0x00441a, 0x00449a, 0x011203, 0x011283, 0x011204, 0x011284, - 0x00451a, 0x00459a, 0x00451c, 0x00459c, 0x022808, 0x022888, 0x004609, 0x004689, - 0x004707, 0x004787, 0x004809, 0x004889, 0x004814, 0x004894, 0x00480a, 0x00488a, - 0x004818, 0x004898, 0x00481b, 0x00489b, 0x00491c, 0x00499c, 0x00cf04, 0x00cf84, - 0x004b04, 0x004b84, 0x004b14, 0x004b94, 0x004b1d, 0x004b9d, 0x004c14, 0x004c94, - 0x1e3607, 0x1e3687, 0x004c1d, 0x004c9d, 0x004c1a, 0x004c9a, 0x004d04, 0x004d84, - 0x004d09, 0x004d89, 0x004d14, 0x004d94, 0x004e09, 0x004e89, 0x004e14, 0x004e94, - 0x004e1d, 0x004e9d, 0x004e1a, 0x004e9a, 0x00d504, 0x00d584, 0x00d50a, 0x00d58a, - 0x014c03, 0x014c83, 0x014c04, 0x014c84, 0x005004, 0x005084, 0x005009, 0x005089, - 0x005209, 0x005289, 0x005214, 0x005294, 0x1e5a07, 0x1e5a87, 0x00521d, 0x00529d, - 0x005309, 0x005389, 0x005314, 0x005394, 0x015a09, 0x015a89, 0x016009, 0x016089, - 0x1e6209, 0x1e6289, 0x005409, 0x005489, 0x005414, 0x005494, 0x00541d, 0x00549d, - 0x00541a, 0x00549a, 0x005515, 0x005595, 0x00551c, 0x00559c, 0x00551a, 0x00559a, - 0x016804, 0x016884, 0x016a0a, 0x016a8a, 0x005606, 0x005686, 0x005614, 0x005694, - 0x005703, 0x005783, 0x005704, 0x005784, 0x00570a, 0x00578a, 0x005709, 0x005789, - 0x005714, 0x005794, 0x005809, 0x005889, 0x00580a, 0x00588a, 0x005909, 0x005989, - 0x005a05, 0x005a85, 0x005a14, 0x005a94, 0x005a1d, 0x005a9d, 0x00681d, 0x00740a, - 0x00770c, 0x00790c, 0x1e9a00, 0x005389, 0x1e9c00, 0x1e9d00, 0x1e9e00, 0x1e9f00, - 0x004114, 0x004194, 0x00410b, 0x00418b, 0x00c204, 0x00c284, 0x00c203, 0x00c283, - 0x00c20b, 0x00c28b, 0x00c206, 0x00c286, 0x1ea005, 0x1ea085, 0x010204, 0x010284, - 0x010203, 0x010283, 0x01020b, 0x01028b, 0x010206, 0x010286, 0x1ea008, 0x1ea088, - 0x004514, 0x004594, 0x00450b, 0x00458b, 0x004506, 0x004586, 0x00ca04, 0x00ca84, - 0x00ca03, 0x00ca83, 0x00ca0b, 0x00ca8b, 0x00ca06, 0x00ca86, 0x1eb805, 0x1eb885, - 0x00490b, 0x00498b, 0x004914, 0x004994, 0x004f14, 0x004f94, 0x004f0b, 0x004f8b, - 0x00d404, 0x00d484, 0x00d403, 0x00d483, 0x00d40b, 0x00d48b, 0x00d406, 0x00d486, - 0x1ecc05, 0x1ecc85, 0x01a004, 0x01a084, 0x01a003, 0x01a083, 0x01a00b, 0x01a08b, - 0x01a006, 0x01a086, 0x01a014, 0x01a094, 0x005514, 0x005594, 0x00550b, 0x00558b, - 0x01af04, 0x01af84, 0x01af03, 0x01af83, 0x01af0b, 0x01af8b, 0x01af06, 0x01af86, - 0x01af14, 0x01af94, 0x005903, 0x005983, 0x005914, 0x005994, 0x00590b, 0x00598b, - 0x005906, 0x005986, 0x1efa00, 0x1efb00, 0x1efc00, 0x1efd00, 0x1efe00, 0x1eff00 -}; - -static const int32_t ucp0x1f[256] = -{ 0x039191, 0x039192, 0x1f0883, 0x1f0983, 0x1f0884, 0x1f0984, 0x1f089f, 0x1f099f, - 0x039111, 0x039112, 0x1f0803, 0x1f0903, 0x1f0804, 0x1f0904, 0x1f081f, 0x1f091f, - 0x039591, 0x039592, 0x1f1883, 0x1f1983, 0x1f1884, 0x1f1984, 0x1f1600, 0x1f1700, - 0x039511, 0x039512, 0x1f1803, 0x1f1903, 0x1f1804, 0x1f1904, 0x1f1e00, 0x1f1f00, - 0x039791, 0x039792, 0x1f2883, 0x1f2983, 0x1f2884, 0x1f2984, 0x1f289f, 0x1f299f, - 0x039711, 0x039712, 0x1f2803, 0x1f2903, 0x1f2804, 0x1f2904, 0x1f281f, 0x1f291f, - 0x039991, 0x039992, 0x1f3883, 0x1f3983, 0x1f3884, 0x1f3984, 0x1f389f, 0x1f399f, - 0x039911, 0x039912, 0x1f3803, 0x1f3903, 0x1f3804, 0x1f3904, 0x1f381f, 0x1f391f, - 0x039f91, 0x039f92, 0x1f4883, 0x1f4983, 0x1f4884, 0x1f4984, 0x1f4600, 0x1f4700, - 0x039f11, 0x039f12, 0x1f4803, 0x1f4903, 0x1f4804, 0x1f4904, 0x1f4e00, 0x1f4f00, - 0x03c511, 0x03a592, 0x1f5003, 0x1f5983, 0x1f5004, 0x1f5984, 0x1f501f, 0x1f599f, - 0x1f5800, 0x03a512, 0x1f5a00, 0x1f5903, 0x1f5c00, 0x1f5904, 0x1f5e00, 0x1f591f, - 0x03a991, 0x03a992, 0x1f6883, 0x1f6983, 0x1f6884, 0x1f6984, 0x1f689f, 0x1f699f, - 0x03a911, 0x03a912, 0x1f6803, 0x1f6903, 0x1f6804, 0x1f6904, 0x1f681f, 0x1f691f, - 0x039183, 0x038682, 0x039583, 0x038882, 0x039783, 0x038982, 0x039983, 0x038a82, - 0x039f83, 0x038c82, 0x03a583, 0x038e82, 0x03a983, 0x038f82, 0x1f7e00, 0x1f7f00, - 0x1f08a0, 0x1f09a0, 0x1f0aa0, 0x1f0ba0, 0x1f0ca0, 0x1f0da0, 0x1f0ea0, 0x1f0fa0, - 0x1f0820, 0x1f0920, 0x1f0a20, 0x1f0b20, 0x1f0c20, 0x1f0d20, 0x1f0e20, 0x1f0f20, - 0x1f28a0, 0x1f29a0, 0x1f2aa0, 0x1f2ba0, 0x1f2ca0, 0x1f2da0, 0x1f2ea0, 0x1f2fa0, - 0x1f2820, 0x1f2920, 0x1f2a20, 0x1f2b20, 0x1f2c20, 0x1f2d20, 0x1f2e20, 0x1f2f20, - 0x1f68a0, 0x1f69a0, 0x1f6aa0, 0x1f6ba0, 0x1f6ca0, 0x1f6da0, 0x1f6ea0, 0x1f6fa0, - 0x1f6820, 0x1f6920, 0x1f6a20, 0x1f6b20, 0x1f6c20, 0x1f6d20, 0x1f6e20, 0x1f6f20, - 0x039188, 0x039187, 0x1f7020, 0x0391a0, 0x03ac20, 0x1fb500, 0x03b11f, 0x1fb620, - 0x039108, 0x039107, 0x039103, 0x038602, 0x039120, 0x1fbd00, 0x039980, 0x1fbf00, - 0x1fc000, 0x00a81f, 0x1f7420, 0x0397a0, 0x03ae20, 0x1fc500, 0x03b71f, 0x1fc620, - 0x039503, 0x038802, 0x039703, 0x038902, 0x039720, 0x1fbf03, 0x1fbf04, 0x1fbf1f, - 0x039988, 0x039987, 0x03ca03, 0x039002, 0x1fd400, 0x1fd500, 0x03b91f, 0x03ca1f, - 0x039908, 0x039907, 0x039903, 0x038a02, 0x1fdc00, 0x1ffe03, 0x1ffe04, 0x1ffe1f, - 0x03a588, 0x03a587, 0x03cb03, 0x03b002, 0x03c111, 0x03a192, 0x03c51f, 0x03cb1f, - 0x03a508, 0x03a507, 0x03a503, 0x038e02, 0x03a112, 0x00a803, 0x038502, 0x006002, - 0x1ff000, 0x1ff100, 0x1f7c20, 0x03a9a0, 0x03ce20, 0x1ff500, 0x03c91f, 0x1ff620, - 0x039f03, 0x038c02, 0x03a903, 0x038f02, 0x03a920, 0x00b402, 0x1ffe00, 0x1fff00 -}; - -static const int32_t ucp0x20[256] = -{ 0x200202, 0x200302, 0x200200, 0x200300, 0x200400, 0x200500, 0x200600, 0x002001, - 0x200800, 0x200900, 0x200a00, 0x200b00, 0x200c00, 0x200d00, 0x200e00, 0x200f00, - 0x201000, 0x201001, 0x201200, 0x201300, 0x201400, 0x201500, 0x201600, 0x201700, - 0x201800, 0x201900, 0x201a00, 0x201b00, 0x201c00, 0x201d00, 0x201e00, 0x201f00, - 0x202000, 0x202100, 0x202200, 0x202300, 0x202400, 0x202500, 0x202600, 0x202700, - 0x202800, 0x202900, 0x202a00, 0x202b00, 0x202c00, 0x202d00, 0x202e00, 0x002001, - 0x203000, 0x203100, 0x203200, 0x203300, 0x203400, 0x203500, 0x203600, 0x203700, - 0x203800, 0x203900, 0x203a00, 0x203b00, 0x203c00, 0x203d00, 0x203e00, 0x203f00, - 0x204000, 0x204100, 0x204200, 0x204300, 0x204400, 0x204500, 0x204600, 0x204700, - 0x204800, 0x204900, 0x204a00, 0x204b00, 0x204c00, 0x204d00, 0x204e00, 0x204f00, - 0x205000, 0x205100, 0x205200, 0x205300, 0x205400, 0x205500, 0x205600, 0x205700, - 0x205800, 0x205900, 0x205a00, 0x205b00, 0x205c00, 0x205d00, 0x205e00, 0x205f00, - 0x206000, 0x206100, 0x206200, 0x206300, 0x206400, 0x206500, 0x206600, 0x206700, - 0x206800, 0x206900, 0x206a00, 0x206b00, 0x206c00, 0x206d00, 0x206e00, 0x206f00, - 0x003001, 0x006901, 0x207200, 0x207300, 0x003401, 0x003501, 0x003601, 0x003701, - 0x003801, 0x003901, 0x002b01, 0x221201, 0x003d01, 0x002801, 0x002901, 0x006e01, - 0x003001, 0x003101, 0x003201, 0x003301, 0x003401, 0x003501, 0x003601, 0x003701, - 0x003801, 0x003901, 0x002b01, 0x221201, 0x003d01, 0x002801, 0x002901, 0x208f00, - 0x006101, 0x006501, 0x006f01, 0x007801, 0x025901, 0x209500, 0x209600, 0x209700, - 0x209800, 0x209900, 0x209a00, 0x209b00, 0x209c00, 0x209d00, 0x209e00, 0x209f00, - 0x20a000, 0x20a100, 0x20a200, 0x20a300, 0x20a400, 0x20a500, 0x20a600, 0x20a700, - 0x20a800, 0x20a900, 0x20aa00, 0x20ab00, 0x20ac00, 0x20ad00, 0x20ae00, 0x20af00, - 0x20b000, 0x20b100, 0x20b200, 0x20b300, 0x20b400, 0x20b500, 0x20b600, 0x20b700, - 0x20b800, 0x20b900, 0x20ba00, 0x20bb00, 0x20bc00, 0x20bd00, 0x20be00, 0x20bf00, - 0x20c000, 0x20c100, 0x20c200, 0x20c300, 0x20c400, 0x20c500, 0x20c600, 0x20c700, - 0x20c800, 0x20c900, 0x20ca00, 0x20cb00, 0x20cc00, 0x20cd00, 0x20ce00, 0x20cf00, - 0x20d000, 0x20d100, 0x20d200, 0x20d300, 0x20d400, 0x20d500, 0x20d600, 0x20d700, - 0x20d800, 0x20d900, 0x20da00, 0x20db00, 0x20dc00, 0x20dd00, 0x20de00, 0x20df00, - 0x20e000, 0x20e100, 0x20e200, 0x20e300, 0x20e400, 0x20e500, 0x20e600, 0x20e700, - 0x20e800, 0x20e900, 0x20ea00, 0x20eb00, 0x20ec00, 0x20ed00, 0x20ee00, 0x20ef00, - 0x20f000, 0x20f100, 0x20f200, 0x20f300, 0x20f400, 0x20f500, 0x20f600, 0x20f700, - 0x20f800, 0x20f900, 0x20fa00, 0x20fb00, 0x20fc00, 0x20fd00, 0x20fe00, 0x20ff00 -}; - -static const int32_t ucp0x21[256] = -{ 0x210000, 0x210100, 0x004301, 0x210300, 0x210400, 0x210500, 0x210600, 0x210700, - 0x210800, 0x210900, 0x006701, 0x004801, 0x004801, 0x004801, 0x006801, 0x012701, - 0x004901, 0x004901, 0x004c01, 0x006c01, 0x211400, 0x004e01, 0x211600, 0x211700, - 0x211800, 0x005001, 0x005101, 0x005201, 0x005201, 0x005201, 0x211e00, 0x211f00, - 0x212000, 0x212100, 0x212200, 0x212300, 0x005a01, 0x212500, 0x03a902, 0x212700, - 0x005a01, 0x212900, 0x004b02, 0x00c502, 0x004201, 0x004301, 0x212e00, 0x006501, - 0x004501, 0x004601, 0x213200, 0x004d01, 0x006f01, 0x213500, 0x213600, 0x213700, - 0x213800, 0x006901, 0x213a00, 0x213b00, 0x03c001, 0x03b301, 0x039301, 0x03a001, - 0x221101, 0x214100, 0x214200, 0x214300, 0x214400, 0x004401, 0x006401, 0x006501, - 0x006901, 0x006a01, 0x214a00, 0x214b00, 0x214c00, 0x214d00, 0x214e00, 0x214f00, - 0x215000, 0x215100, 0x215200, 0x215300, 0x215400, 0x215500, 0x215600, 0x215700, - 0x215800, 0x215900, 0x215a00, 0x215b00, 0x215c00, 0x215d00, 0x215e00, 0x215f00, - 0x216000, 0x216100, 0x216200, 0x216300, 0x216400, 0x216500, 0x216600, 0x216700, - 0x216800, 0x216900, 0x216a00, 0x216b00, 0x216c00, 0x216d00, 0x216e00, 0x216f00, - 0x216080, 0x216180, 0x216280, 0x216380, 0x216480, 0x216580, 0x216680, 0x216780, - 0x216880, 0x216980, 0x216a80, 0x216b80, 0x216c80, 0x216d80, 0x216e80, 0x216f80, - 0x218000, 0x218100, 0x218200, 0x218300, 0x218400, 0x218500, 0x218600, 0x218700, - 0x218800, 0x218900, 0x218a00, 0x218b00, 0x218c00, 0x218d00, 0x218e00, 0x218f00, - 0x219000, 0x219100, 0x219200, 0x219300, 0x219400, 0x219500, 0x219600, 0x219700, - 0x219800, 0x219900, 0x21901e, 0x21921e, 0x219c00, 0x219d00, 0x219e00, 0x219f00, - 0x21a000, 0x21a100, 0x21a200, 0x21a300, 0x21a400, 0x21a500, 0x21a600, 0x21a700, - 0x21a800, 0x21a900, 0x21aa00, 0x21ab00, 0x21ac00, 0x21ad00, 0x21941e, 0x21af00, - 0x21b000, 0x21b100, 0x21b200, 0x21b300, 0x21b400, 0x21b500, 0x21b600, 0x21b700, - 0x21b800, 0x21b900, 0x21ba00, 0x21bb00, 0x21bc00, 0x21bd00, 0x21be00, 0x21bf00, - 0x21c000, 0x21c100, 0x21c200, 0x21c300, 0x21c400, 0x21c500, 0x21c600, 0x21c700, - 0x21c800, 0x21c900, 0x21ca00, 0x21cb00, 0x21cc00, 0x21d01e, 0x21d41e, 0x21d21e, - 0x21d000, 0x21d100, 0x21d200, 0x21d300, 0x21d400, 0x21d500, 0x21d600, 0x21d700, - 0x21d800, 0x21d900, 0x21da00, 0x21db00, 0x21dc00, 0x21dd00, 0x21de00, 0x21df00, - 0x21e000, 0x21e100, 0x21e200, 0x21e300, 0x21e400, 0x21e500, 0x21e600, 0x21e700, - 0x21e800, 0x21e900, 0x21ea00, 0x21eb00, 0x21ec00, 0x21ed00, 0x21ee00, 0x21ef00, - 0x21f000, 0x21f100, 0x21f200, 0x21f300, 0x21f400, 0x21f500, 0x21f600, 0x21f700, - 0x21f800, 0x21f900, 0x21fa00, 0x21fb00, 0x21fc00, 0x21fd00, 0x21fe00, 0x21ff00 -}; - -static const int32_t ucp0x22[256] = -{ 0x220000, 0x220100, 0x220200, 0x220300, 0x22031e, 0x220500, 0x220600, 0x220700, - 0x220800, 0x22081e, 0x220a00, 0x220b00, 0x220b1e, 0x220d00, 0x220e00, 0x220f00, - 0x221000, 0x221100, 0x221200, 0x221300, 0x221400, 0x221500, 0x221600, 0x221700, - 0x221800, 0x221900, 0x221a00, 0x221b00, 0x221c00, 0x221d00, 0x221e00, 0x221f00, - 0x222000, 0x222100, 0x222200, 0x222300, 0x22231e, 0x222500, 0x22251e, 0x222700, - 0x222800, 0x222900, 0x222a00, 0x222b00, 0x222c00, 0x222d00, 0x222e00, 0x222f00, - 0x223000, 0x223100, 0x223200, 0x223300, 0x223400, 0x223500, 0x223600, 0x223700, - 0x223800, 0x223900, 0x223a00, 0x223b00, 0x223c00, 0x223d00, 0x223e00, 0x223f00, - 0x224000, 0x223c1e, 0x224200, 0x224300, 0x22431e, 0x224500, 0x224600, 0x22451e, - 0x224800, 0x22481e, 0x224a00, 0x224b00, 0x224c00, 0x224d00, 0x224e00, 0x224f00, - 0x225000, 0x225100, 0x225200, 0x225300, 0x225400, 0x225500, 0x225600, 0x225700, - 0x225800, 0x225900, 0x225a00, 0x225b00, 0x225c00, 0x225d00, 0x225e00, 0x225f00, - 0x003d1e, 0x226100, 0x22611e, 0x226300, 0x226400, 0x226500, 0x226600, 0x226700, - 0x226800, 0x226900, 0x226a00, 0x226b00, 0x226c00, 0x224d1e, 0x003c1e, 0x003e1e, - 0x22641e, 0x22651e, 0x227200, 0x227300, 0x22721e, 0x22731e, 0x227600, 0x227700, - 0x22761e, 0x22771e, 0x227a00, 0x227b00, 0x227c00, 0x227d00, 0x227e00, 0x227f00, - 0x227a1e, 0x227b1e, 0x228200, 0x228300, 0x22821e, 0x22831e, 0x228600, 0x228700, - 0x22861e, 0x22871e, 0x228a00, 0x228b00, 0x228c00, 0x228d00, 0x228e00, 0x228f00, - 0x229000, 0x229100, 0x229200, 0x229300, 0x229400, 0x229500, 0x229600, 0x229700, - 0x229800, 0x229900, 0x229a00, 0x229b00, 0x229c00, 0x229d00, 0x229e00, 0x229f00, - 0x22a000, 0x22a100, 0x22a200, 0x22a300, 0x22a400, 0x22a500, 0x22a600, 0x22a700, - 0x22a800, 0x22a900, 0x22aa00, 0x22ab00, 0x22a21e, 0x22a81e, 0x22a91e, 0x22ab1e, - 0x22b000, 0x22b100, 0x22b200, 0x22b300, 0x22b400, 0x22b500, 0x22b600, 0x22b700, - 0x22b800, 0x22b900, 0x22ba00, 0x22bb00, 0x22bc00, 0x22bd00, 0x22be00, 0x22bf00, - 0x22c000, 0x22c100, 0x22c200, 0x22c300, 0x22c400, 0x22c500, 0x22c600, 0x22c700, - 0x22c800, 0x22c900, 0x22ca00, 0x22cb00, 0x22cc00, 0x22cd00, 0x22ce00, 0x22cf00, - 0x22d000, 0x22d100, 0x22d200, 0x22d300, 0x22d400, 0x22d500, 0x22d600, 0x22d700, - 0x22d800, 0x22d900, 0x22da00, 0x22db00, 0x22dc00, 0x22dd00, 0x22de00, 0x22df00, - 0x227c1e, 0x227d1e, 0x22911e, 0x22921e, 0x22e400, 0x22e500, 0x22e600, 0x22e700, - 0x22e800, 0x22e900, 0x22b21e, 0x22b31e, 0x22b41e, 0x22b51e, 0x22ee00, 0x22ef00, - 0x22f000, 0x22f100, 0x22f200, 0x22f300, 0x22f400, 0x22f500, 0x22f600, 0x22f700, - 0x22f800, 0x22f900, 0x22fa00, 0x22fb00, 0x22fc00, 0x22fd00, 0x22fe00, 0x22ff00 -}; - -static const int32_t ucp0x23[256] = -{ 0x230000, 0x230100, 0x230200, 0x230300, 0x230400, 0x230500, 0x230600, 0x230700, - 0x230800, 0x230900, 0x230a00, 0x230b00, 0x230c00, 0x230d00, 0x230e00, 0x230f00, - 0x231000, 0x231100, 0x231200, 0x231300, 0x231400, 0x231500, 0x231600, 0x231700, - 0x231800, 0x231900, 0x231a00, 0x231b00, 0x231c00, 0x231d00, 0x231e00, 0x231f00, - 0x232000, 0x232100, 0x232200, 0x232300, 0x232400, 0x232500, 0x232600, 0x232700, - 0x232800, 0x300802, 0x300902, 0x232b00, 0x232c00, 0x232d00, 0x232e00, 0x232f00, - 0x233000, 0x233100, 0x233200, 0x233300, 0x233400, 0x233500, 0x233600, 0x233700, - 0x233800, 0x233900, 0x233a00, 0x233b00, 0x233c00, 0x233d00, 0x233e00, 0x233f00, - 0x234000, 0x234100, 0x234200, 0x234300, 0x234400, 0x234500, 0x234600, 0x234700, - 0x234800, 0x234900, 0x234a00, 0x234b00, 0x234c00, 0x234d00, 0x234e00, 0x234f00, - 0x235000, 0x235100, 0x235200, 0x235300, 0x235400, 0x235500, 0x235600, 0x235700, - 0x235800, 0x235900, 0x235a00, 0x235b00, 0x235c00, 0x235d00, 0x235e00, 0x235f00, - 0x236000, 0x236100, 0x236200, 0x236300, 0x236400, 0x236500, 0x236600, 0x236700, - 0x236800, 0x236900, 0x236a00, 0x236b00, 0x236c00, 0x236d00, 0x236e00, 0x236f00, - 0x237000, 0x237100, 0x237200, 0x237300, 0x237400, 0x237500, 0x237600, 0x237700, - 0x237800, 0x237900, 0x237a00, 0x237b00, 0x237c00, 0x237d00, 0x237e00, 0x237f00, - 0x238000, 0x238100, 0x238200, 0x238300, 0x238400, 0x238500, 0x238600, 0x238700, - 0x238800, 0x238900, 0x238a00, 0x238b00, 0x238c00, 0x238d00, 0x238e00, 0x238f00, - 0x239000, 0x239100, 0x239200, 0x239300, 0x239400, 0x239500, 0x239600, 0x239700, - 0x239800, 0x239900, 0x239a00, 0x239b00, 0x239c00, 0x239d00, 0x239e00, 0x239f00, - 0x23a000, 0x23a100, 0x23a200, 0x23a300, 0x23a400, 0x23a500, 0x23a600, 0x23a700, - 0x23a800, 0x23a900, 0x23aa00, 0x23ab00, 0x23ac00, 0x23ad00, 0x23ae00, 0x23af00, - 0x23b000, 0x23b100, 0x23b200, 0x23b300, 0x23b400, 0x23b500, 0x23b600, 0x23b700, - 0x23b800, 0x23b900, 0x23ba00, 0x23bb00, 0x23bc00, 0x23bd00, 0x23be00, 0x23bf00, - 0x23c000, 0x23c100, 0x23c200, 0x23c300, 0x23c400, 0x23c500, 0x23c600, 0x23c700, - 0x23c800, 0x23c900, 0x23ca00, 0x23cb00, 0x23cc00, 0x23cd00, 0x23ce00, 0x23cf00, - 0x23d000, 0x23d100, 0x23d200, 0x23d300, 0x23d400, 0x23d500, 0x23d600, 0x23d700, - 0x23d800, 0x23d900, 0x23da00, 0x23db00, 0x23dc00, 0x23dd00, 0x23de00, 0x23df00, - 0x23e000, 0x23e100, 0x23e200, 0x23e300, 0x23e400, 0x23e500, 0x23e600, 0x23e700, - 0x23e800, 0x23e900, 0x23ea00, 0x23eb00, 0x23ec00, 0x23ed00, 0x23ee00, 0x23ef00, - 0x23f000, 0x23f100, 0x23f200, 0x23f300, 0x23f400, 0x23f500, 0x23f600, 0x23f700, - 0x23f800, 0x23f900, 0x23fa00, 0x23fb00, 0x23fc00, 0x23fd00, 0x23fe00, 0x23ff00 -}; - -static const int32_t ucp0x24[256] = -{ 0x240000, 0x240100, 0x240200, 0x240300, 0x240400, 0x240500, 0x240600, 0x240700, - 0x240800, 0x240900, 0x240a00, 0x240b00, 0x240c00, 0x240d00, 0x240e00, 0x240f00, - 0x241000, 0x241100, 0x241200, 0x241300, 0x241400, 0x241500, 0x241600, 0x241700, - 0x241800, 0x241900, 0x241a00, 0x241b00, 0x241c00, 0x241d00, 0x241e00, 0x241f00, - 0x242000, 0x242100, 0x242200, 0x242300, 0x242400, 0x242500, 0x242600, 0x242700, - 0x242800, 0x242900, 0x242a00, 0x242b00, 0x242c00, 0x242d00, 0x242e00, 0x242f00, - 0x243000, 0x243100, 0x243200, 0x243300, 0x243400, 0x243500, 0x243600, 0x243700, - 0x243800, 0x243900, 0x243a00, 0x243b00, 0x243c00, 0x243d00, 0x243e00, 0x243f00, - 0x244000, 0x244100, 0x244200, 0x244300, 0x244400, 0x244500, 0x244600, 0x244700, - 0x244800, 0x244900, 0x244a00, 0x244b00, 0x244c00, 0x244d00, 0x244e00, 0x244f00, - 0x245000, 0x245100, 0x245200, 0x245300, 0x245400, 0x245500, 0x245600, 0x245700, - 0x245800, 0x245900, 0x245a00, 0x245b00, 0x245c00, 0x245d00, 0x245e00, 0x245f00, - 0x003101, 0x003201, 0x003301, 0x003401, 0x003501, 0x003601, 0x003701, 0x003801, - 0x003901, 0x246900, 0x246a00, 0x246b00, 0x246c00, 0x246d00, 0x246e00, 0x246f00, - 0x247000, 0x247100, 0x247200, 0x247300, 0x247400, 0x247500, 0x247600, 0x247700, - 0x247800, 0x247900, 0x247a00, 0x247b00, 0x247c00, 0x247d00, 0x247e00, 0x247f00, - 0x248000, 0x248100, 0x248200, 0x248300, 0x248400, 0x248500, 0x248600, 0x248700, - 0x248800, 0x248900, 0x248a00, 0x248b00, 0x248c00, 0x248d00, 0x248e00, 0x248f00, - 0x249000, 0x249100, 0x249200, 0x249300, 0x249400, 0x249500, 0x249600, 0x249700, - 0x249800, 0x249900, 0x249a00, 0x249b00, 0x249c00, 0x249d00, 0x249e00, 0x249f00, - 0x24a000, 0x24a100, 0x24a200, 0x24a300, 0x24a400, 0x24a500, 0x24a600, 0x24a700, - 0x24a800, 0x24a900, 0x24aa00, 0x24ab00, 0x24ac00, 0x24ad00, 0x24ae00, 0x24af00, - 0x24b000, 0x24b100, 0x24b200, 0x24b300, 0x24b400, 0x24b500, 0x004101, 0x004201, - 0x004301, 0x004401, 0x004501, 0x004601, 0x004701, 0x004801, 0x004901, 0x004a01, - 0x004b01, 0x004c01, 0x004d01, 0x004e01, 0x004f01, 0x005001, 0x005101, 0x005201, - 0x005301, 0x005401, 0x005501, 0x005601, 0x005701, 0x005801, 0x005901, 0x005a01, - 0x004181, 0x004281, 0x004381, 0x004481, 0x004581, 0x004681, 0x004781, 0x004881, - 0x004981, 0x004a81, 0x004b81, 0x004c81, 0x004d81, 0x004e81, 0x004f81, 0x005081, - 0x005181, 0x005281, 0x005381, 0x005481, 0x005581, 0x005681, 0x005781, 0x005881, - 0x005981, 0x005a81, 0x003001, 0x24eb00, 0x24ec00, 0x24ed00, 0x24ee00, 0x24ef00, - 0x24f000, 0x24f100, 0x24f200, 0x24f300, 0x24f400, 0x24f500, 0x24f600, 0x24f700, - 0x24f800, 0x24f900, 0x24fa00, 0x24fb00, 0x24fc00, 0x24fd00, 0x24fe00, 0x24ff00 -}; - -static const int32_t ucp0x2a[256] = -{ 0x2a0000, 0x2a0100, 0x2a0200, 0x2a0300, 0x2a0400, 0x2a0500, 0x2a0600, 0x2a0700, - 0x2a0800, 0x2a0900, 0x2a0a00, 0x2a0b00, 0x2a0c00, 0x2a0d00, 0x2a0e00, 0x2a0f00, - 0x2a1000, 0x2a1100, 0x2a1200, 0x2a1300, 0x2a1400, 0x2a1500, 0x2a1600, 0x2a1700, - 0x2a1800, 0x2a1900, 0x2a1a00, 0x2a1b00, 0x2a1c00, 0x2a1d00, 0x2a1e00, 0x2a1f00, - 0x2a2000, 0x2a2100, 0x2a2200, 0x2a2300, 0x2a2400, 0x2a2500, 0x2a2600, 0x2a2700, - 0x2a2800, 0x2a2900, 0x2a2a00, 0x2a2b00, 0x2a2c00, 0x2a2d00, 0x2a2e00, 0x2a2f00, - 0x2a3000, 0x2a3100, 0x2a3200, 0x2a3300, 0x2a3400, 0x2a3500, 0x2a3600, 0x2a3700, - 0x2a3800, 0x2a3900, 0x2a3a00, 0x2a3b00, 0x2a3c00, 0x2a3d00, 0x2a3e00, 0x2a3f00, - 0x2a4000, 0x2a4100, 0x2a4200, 0x2a4300, 0x2a4400, 0x2a4500, 0x2a4600, 0x2a4700, - 0x2a4800, 0x2a4900, 0x2a4a00, 0x2a4b00, 0x2a4c00, 0x2a4d00, 0x2a4e00, 0x2a4f00, - 0x2a5000, 0x2a5100, 0x2a5200, 0x2a5300, 0x2a5400, 0x2a5500, 0x2a5600, 0x2a5700, - 0x2a5800, 0x2a5900, 0x2a5a00, 0x2a5b00, 0x2a5c00, 0x2a5d00, 0x2a5e00, 0x2a5f00, - 0x2a6000, 0x2a6100, 0x2a6200, 0x2a6300, 0x2a6400, 0x2a6500, 0x2a6600, 0x2a6700, - 0x2a6800, 0x2a6900, 0x2a6a00, 0x2a6b00, 0x2a6c00, 0x2a6d00, 0x2a6e00, 0x2a6f00, - 0x2a7000, 0x2a7100, 0x2a7200, 0x2a7300, 0x2a7400, 0x2a7500, 0x2a7600, 0x2a7700, - 0x2a7800, 0x2a7900, 0x2a7a00, 0x2a7b00, 0x2a7c00, 0x2a7d00, 0x2a7e00, 0x2a7f00, - 0x2a8000, 0x2a8100, 0x2a8200, 0x2a8300, 0x2a8400, 0x2a8500, 0x2a8600, 0x2a8700, - 0x2a8800, 0x2a8900, 0x2a8a00, 0x2a8b00, 0x2a8c00, 0x2a8d00, 0x2a8e00, 0x2a8f00, - 0x2a9000, 0x2a9100, 0x2a9200, 0x2a9300, 0x2a9400, 0x2a9500, 0x2a9600, 0x2a9700, - 0x2a9800, 0x2a9900, 0x2a9a00, 0x2a9b00, 0x2a9c00, 0x2a9d00, 0x2a9e00, 0x2a9f00, - 0x2aa000, 0x2aa100, 0x2aa200, 0x2aa300, 0x2aa400, 0x2aa500, 0x2aa600, 0x2aa700, - 0x2aa800, 0x2aa900, 0x2aaa00, 0x2aab00, 0x2aac00, 0x2aad00, 0x2aae00, 0x2aaf00, - 0x2ab000, 0x2ab100, 0x2ab200, 0x2ab300, 0x2ab400, 0x2ab500, 0x2ab600, 0x2ab700, - 0x2ab800, 0x2ab900, 0x2aba00, 0x2abb00, 0x2abc00, 0x2abd00, 0x2abe00, 0x2abf00, - 0x2ac000, 0x2ac100, 0x2ac200, 0x2ac300, 0x2ac400, 0x2ac500, 0x2ac600, 0x2ac700, - 0x2ac800, 0x2ac900, 0x2aca00, 0x2acb00, 0x2acc00, 0x2acd00, 0x2ace00, 0x2acf00, - 0x2ad000, 0x2ad100, 0x2ad200, 0x2ad300, 0x2ad400, 0x2ad500, 0x2ad600, 0x2ad700, - 0x2ad800, 0x2ad900, 0x2ada00, 0x2adb00, 0x2add1e, 0x2add00, 0x2ade00, 0x2adf00, - 0x2ae000, 0x2ae100, 0x2ae200, 0x2ae300, 0x2ae400, 0x2ae500, 0x2ae600, 0x2ae700, - 0x2ae800, 0x2ae900, 0x2aea00, 0x2aeb00, 0x2aec00, 0x2aed00, 0x2aee00, 0x2aef00, - 0x2af000, 0x2af100, 0x2af200, 0x2af300, 0x2af400, 0x2af500, 0x2af600, 0x2af700, - 0x2af800, 0x2af900, 0x2afa00, 0x2afb00, 0x2afc00, 0x2afd00, 0x2afe00, 0x2aff00 -}; - -static const int32_t ucp0x2c[256] = -{ 0x2c0000, 0x2c0100, 0x2c0200, 0x2c0300, 0x2c0400, 0x2c0500, 0x2c0600, 0x2c0700, - 0x2c0800, 0x2c0900, 0x2c0a00, 0x2c0b00, 0x2c0c00, 0x2c0d00, 0x2c0e00, 0x2c0f00, - 0x2c1000, 0x2c1100, 0x2c1200, 0x2c1300, 0x2c1400, 0x2c1500, 0x2c1600, 0x2c1700, - 0x2c1800, 0x2c1900, 0x2c1a00, 0x2c1b00, 0x2c1c00, 0x2c1d00, 0x2c1e00, 0x2c1f00, - 0x2c2000, 0x2c2100, 0x2c2200, 0x2c2300, 0x2c2400, 0x2c2500, 0x2c2600, 0x2c2700, - 0x2c2800, 0x2c2900, 0x2c2a00, 0x2c2b00, 0x2c2c00, 0x2c2d00, 0x2c2e00, 0x2c2f00, - 0x2c0080, 0x2c0180, 0x2c0280, 0x2c0380, 0x2c0480, 0x2c0580, 0x2c0680, 0x2c0780, - 0x2c0880, 0x2c0980, 0x2c0a80, 0x2c0b80, 0x2c0c80, 0x2c0d80, 0x2c0e80, 0x2c0f80, - 0x2c1080, 0x2c1180, 0x2c1280, 0x2c1380, 0x2c1480, 0x2c1580, 0x2c1680, 0x2c1780, - 0x2c1880, 0x2c1980, 0x2c1a80, 0x2c1b80, 0x2c1c80, 0x2c1d80, 0x2c1e80, 0x2c1f80, - 0x2c2080, 0x2c2180, 0x2c2280, 0x2c2380, 0x2c2480, 0x2c2580, 0x2c2680, 0x2c2780, - 0x2c2880, 0x2c2980, 0x2c2a80, 0x2c2b80, 0x2c2c80, 0x2c2d80, 0x2c2e80, 0x2c5f00, - 0x2c6000, 0x2c6100, 0x2c6200, 0x2c6300, 0x2c6400, 0x2c6500, 0x2c6600, 0x2c6700, - 0x2c6800, 0x2c6900, 0x2c6a00, 0x2c6b00, 0x2c6c00, 0x2c6d00, 0x2c6e00, 0x2c6f00, - 0x2c7000, 0x2c7100, 0x2c7200, 0x2c7300, 0x2c7400, 0x2c7500, 0x2c7600, 0x2c7700, - 0x2c7800, 0x2c7900, 0x2c7a00, 0x2c7b00, 0x2c7c00, 0x2c7d00, 0x2c7e00, 0x2c7f00, - 0x2c8000, 0x2c8080, 0x2c8200, 0x2c8280, 0x2c8400, 0x2c8480, 0x2c8600, 0x2c8680, - 0x2c8800, 0x2c8880, 0x2c8a00, 0x2c8a80, 0x2c8c00, 0x2c8c80, 0x2c8e00, 0x2c8e80, - 0x2c9000, 0x2c9080, 0x2c9200, 0x2c9280, 0x2c9400, 0x2c9480, 0x2c9600, 0x2c9680, - 0x2c9800, 0x2c9880, 0x2c9a00, 0x2c9a80, 0x2c9c00, 0x2c9c80, 0x2c9e00, 0x2c9e80, - 0x2ca000, 0x2ca080, 0x2ca200, 0x2ca280, 0x2ca400, 0x2ca480, 0x2ca600, 0x2ca680, - 0x2ca800, 0x2ca880, 0x2caa00, 0x2caa80, 0x2cac00, 0x2cac80, 0x2cae00, 0x2cae80, - 0x2cb000, 0x2cb080, 0x2cb200, 0x2cb280, 0x2cb400, 0x2cb480, 0x2cb600, 0x2cb680, - 0x2cb800, 0x2cb880, 0x2cba00, 0x2cba80, 0x2cbc00, 0x2cbc80, 0x2cbe00, 0x2cbe80, - 0x2cc000, 0x2cc080, 0x2cc200, 0x2cc280, 0x2cc400, 0x2cc480, 0x2cc600, 0x2cc680, - 0x2cc800, 0x2cc880, 0x2cca00, 0x2cca80, 0x2ccc00, 0x2ccc80, 0x2cce00, 0x2cce80, - 0x2cd000, 0x2cd080, 0x2cd200, 0x2cd280, 0x2cd400, 0x2cd480, 0x2cd600, 0x2cd680, - 0x2cd800, 0x2cd880, 0x2cda00, 0x2cda80, 0x2cdc00, 0x2cdc80, 0x2cde00, 0x2cde80, - 0x2ce000, 0x2ce080, 0x2ce200, 0x2ce280, 0x2ce400, 0x2ce500, 0x2ce600, 0x2ce700, - 0x2ce800, 0x2ce900, 0x2cea00, 0x2ceb00, 0x2cec00, 0x2ced00, 0x2cee00, 0x2cef00, - 0x2cf000, 0x2cf100, 0x2cf200, 0x2cf300, 0x2cf400, 0x2cf500, 0x2cf600, 0x2cf700, - 0x2cf800, 0x2cf900, 0x2cfa00, 0x2cfb00, 0x2cfc00, 0x2cfd00, 0x2cfe00, 0x2cff00 -}; - -static const int32_t ucp0x2d[256] = -{ 0x10a080, 0x10a180, 0x10a280, 0x10a380, 0x10a480, 0x10a580, 0x10a680, 0x10a780, - 0x10a880, 0x10a980, 0x10aa80, 0x10ab80, 0x10ac80, 0x10ad80, 0x10ae80, 0x10af80, - 0x10b080, 0x10b180, 0x10b280, 0x10b380, 0x10b480, 0x10b580, 0x10b680, 0x10b780, - 0x10b880, 0x10b980, 0x10ba80, 0x10bb80, 0x10bc80, 0x10bd80, 0x10be80, 0x10bf80, - 0x10c080, 0x10c180, 0x10c280, 0x10c380, 0x10c480, 0x10c580, 0x2d2600, 0x2d2700, - 0x2d2800, 0x2d2900, 0x2d2a00, 0x2d2b00, 0x2d2c00, 0x2d2d00, 0x2d2e00, 0x2d2f00, - 0x2d3000, 0x2d3100, 0x2d3200, 0x2d3300, 0x2d3400, 0x2d3500, 0x2d3600, 0x2d3700, - 0x2d3800, 0x2d3900, 0x2d3a00, 0x2d3b00, 0x2d3c00, 0x2d3d00, 0x2d3e00, 0x2d3f00, - 0x2d4000, 0x2d4100, 0x2d4200, 0x2d4300, 0x2d4400, 0x2d4500, 0x2d4600, 0x2d4700, - 0x2d4800, 0x2d4900, 0x2d4a00, 0x2d4b00, 0x2d4c00, 0x2d4d00, 0x2d4e00, 0x2d4f00, - 0x2d5000, 0x2d5100, 0x2d5200, 0x2d5300, 0x2d5400, 0x2d5500, 0x2d5600, 0x2d5700, - 0x2d5800, 0x2d5900, 0x2d5a00, 0x2d5b00, 0x2d5c00, 0x2d5d00, 0x2d5e00, 0x2d5f00, - 0x2d6000, 0x2d6100, 0x2d6200, 0x2d6300, 0x2d6400, 0x2d6500, 0x2d6600, 0x2d6700, - 0x2d6800, 0x2d6900, 0x2d6a00, 0x2d6b00, 0x2d6c00, 0x2d6d00, 0x2d6e00, 0x2d6101, - 0x2d7000, 0x2d7100, 0x2d7200, 0x2d7300, 0x2d7400, 0x2d7500, 0x2d7600, 0x2d7700, - 0x2d7800, 0x2d7900, 0x2d7a00, 0x2d7b00, 0x2d7c00, 0x2d7d00, 0x2d7e00, 0x2d7f00, - 0x2d8000, 0x2d8100, 0x2d8200, 0x2d8300, 0x2d8400, 0x2d8500, 0x2d8600, 0x2d8700, - 0x2d8800, 0x2d8900, 0x2d8a00, 0x2d8b00, 0x2d8c00, 0x2d8d00, 0x2d8e00, 0x2d8f00, - 0x2d9000, 0x2d9100, 0x2d9200, 0x2d9300, 0x2d9400, 0x2d9500, 0x2d9600, 0x2d9700, - 0x2d9800, 0x2d9900, 0x2d9a00, 0x2d9b00, 0x2d9c00, 0x2d9d00, 0x2d9e00, 0x2d9f00, - 0x2da000, 0x2da100, 0x2da200, 0x2da300, 0x2da400, 0x2da500, 0x2da600, 0x2da700, - 0x2da800, 0x2da900, 0x2daa00, 0x2dab00, 0x2dac00, 0x2dad00, 0x2dae00, 0x2daf00, - 0x2db000, 0x2db100, 0x2db200, 0x2db300, 0x2db400, 0x2db500, 0x2db600, 0x2db700, - 0x2db800, 0x2db900, 0x2dba00, 0x2dbb00, 0x2dbc00, 0x2dbd00, 0x2dbe00, 0x2dbf00, - 0x2dc000, 0x2dc100, 0x2dc200, 0x2dc300, 0x2dc400, 0x2dc500, 0x2dc600, 0x2dc700, - 0x2dc800, 0x2dc900, 0x2dca00, 0x2dcb00, 0x2dcc00, 0x2dcd00, 0x2dce00, 0x2dcf00, - 0x2dd000, 0x2dd100, 0x2dd200, 0x2dd300, 0x2dd400, 0x2dd500, 0x2dd600, 0x2dd700, - 0x2dd800, 0x2dd900, 0x2dda00, 0x2ddb00, 0x2ddc00, 0x2ddd00, 0x2dde00, 0x2ddf00, - 0x2de000, 0x2de100, 0x2de200, 0x2de300, 0x2de400, 0x2de500, 0x2de600, 0x2de700, - 0x2de800, 0x2de900, 0x2dea00, 0x2deb00, 0x2dec00, 0x2ded00, 0x2dee00, 0x2def00, - 0x2df000, 0x2df100, 0x2df200, 0x2df300, 0x2df400, 0x2df500, 0x2df600, 0x2df700, - 0x2df800, 0x2df900, 0x2dfa00, 0x2dfb00, 0x2dfc00, 0x2dfd00, 0x2dfe00, 0x2dff00 -}; - -static const int32_t ucp0x30[256] = -{ 0x002001, 0x300100, 0x300200, 0x300300, 0x300400, 0x300500, 0x300600, 0x300700, - 0x300800, 0x300900, 0x300a00, 0x300b00, 0x300c00, 0x300d00, 0x300e00, 0x300f00, - 0x301000, 0x301100, 0x301200, 0x301300, 0x301400, 0x301500, 0x301600, 0x301700, - 0x301800, 0x301900, 0x301a00, 0x301b00, 0x301c00, 0x301d00, 0x301e00, 0x301f00, - 0x302000, 0x302100, 0x302200, 0x302300, 0x302400, 0x302500, 0x302600, 0x302700, - 0x302800, 0x302900, 0x302a00, 0x302b00, 0x302c00, 0x302d00, 0x302e00, 0x302f00, - 0x303000, 0x303100, 0x303200, 0x303300, 0x303400, 0x303500, 0x303600, 0x303700, - 0x303800, 0x303900, 0x303a00, 0x303b00, 0x303c00, 0x303d00, 0x303e00, 0x303f00, - 0x304000, 0x304100, 0x304200, 0x304300, 0x304400, 0x304500, 0x304600, 0x304700, - 0x304800, 0x304900, 0x304a00, 0x304b00, 0x304b35, 0x304d00, 0x304d35, 0x304f00, - 0x304f35, 0x305100, 0x305135, 0x305300, 0x305335, 0x305500, 0x305535, 0x305700, - 0x305735, 0x305900, 0x305935, 0x305b00, 0x305b35, 0x305d00, 0x305d35, 0x305f00, - 0x305f35, 0x306100, 0x306135, 0x306300, 0x306400, 0x306435, 0x306600, 0x306635, - 0x306800, 0x306835, 0x306a00, 0x306b00, 0x306c00, 0x306d00, 0x306e00, 0x306f00, - 0x306f35, 0x306f36, 0x307200, 0x307235, 0x307236, 0x307500, 0x307535, 0x307536, - 0x307800, 0x307835, 0x307836, 0x307b00, 0x307b35, 0x307b36, 0x307e00, 0x307f00, - 0x308000, 0x308100, 0x308200, 0x308300, 0x308400, 0x308500, 0x308600, 0x308700, - 0x308800, 0x308900, 0x308a00, 0x308b00, 0x308c00, 0x308d00, 0x308e00, 0x308f00, - 0x309000, 0x309100, 0x309200, 0x309300, 0x304635, 0x309500, 0x309600, 0x309700, - 0x309800, 0x309900, 0x309a00, 0x309b00, 0x309c00, 0x309d00, 0x309d35, 0x309f00, - 0x30a000, 0x30a100, 0x30a200, 0x30a300, 0x30a400, 0x30a500, 0x30a600, 0x30a700, - 0x30a800, 0x30a900, 0x30aa00, 0x30ab00, 0x30ab35, 0x30ad00, 0x30ad35, 0x30af00, - 0x30af35, 0x30b100, 0x30b135, 0x30b300, 0x30b335, 0x30b500, 0x30b535, 0x30b700, - 0x30b735, 0x30b900, 0x30b935, 0x30bb00, 0x30bb35, 0x30bd00, 0x30bd35, 0x30bf00, - 0x30bf35, 0x30c100, 0x30c135, 0x30c300, 0x30c400, 0x30c435, 0x30c600, 0x30c635, - 0x30c800, 0x30c835, 0x30ca00, 0x30cb00, 0x30cc00, 0x30cd00, 0x30ce00, 0x30cf00, - 0x30cf35, 0x30cf36, 0x30d200, 0x30d235, 0x30d236, 0x30d500, 0x30d535, 0x30d536, - 0x30d800, 0x30d835, 0x30d836, 0x30db00, 0x30db35, 0x30db36, 0x30de00, 0x30df00, - 0x30e000, 0x30e100, 0x30e200, 0x30e300, 0x30e400, 0x30e500, 0x30e600, 0x30e700, - 0x30e800, 0x30e900, 0x30ea00, 0x30eb00, 0x30ec00, 0x30ed00, 0x30ee00, 0x30ef00, - 0x30f000, 0x30f100, 0x30f200, 0x30f300, 0x30a635, 0x30f500, 0x30f600, 0x30ef35, - 0x30f035, 0x30f135, 0x30f235, 0x30fb00, 0x30fc00, 0x30fd00, 0x30fd35, 0x30ff00 -}; - -static const int32_t ucp0x31[256] = -{ 0x310000, 0x310100, 0x310200, 0x310300, 0x310400, 0x310500, 0x310600, 0x310700, - 0x310800, 0x310900, 0x310a00, 0x310b00, 0x310c00, 0x310d00, 0x310e00, 0x310f00, - 0x311000, 0x311100, 0x311200, 0x311300, 0x311400, 0x311500, 0x311600, 0x311700, - 0x311800, 0x311900, 0x311a00, 0x311b00, 0x311c00, 0x311d00, 0x311e00, 0x311f00, - 0x312000, 0x312100, 0x312200, 0x312300, 0x312400, 0x312500, 0x312600, 0x312700, - 0x312800, 0x312900, 0x312a00, 0x312b00, 0x312c00, 0x312d00, 0x312e00, 0x312f00, - 0x313000, 0x313100, 0x313200, 0x313300, 0x313400, 0x313500, 0x313600, 0x313700, - 0x313800, 0x313900, 0x313a00, 0x313b00, 0x313c00, 0x313d00, 0x313e00, 0x313f00, - 0x314000, 0x314100, 0x314200, 0x314300, 0x314400, 0x314500, 0x314600, 0x314700, - 0x314800, 0x314900, 0x314a00, 0x314b00, 0x314c00, 0x314d00, 0x314e00, 0x314f00, - 0x315000, 0x315100, 0x315200, 0x315300, 0x315400, 0x315500, 0x315600, 0x315700, - 0x315800, 0x315900, 0x315a00, 0x315b00, 0x315c00, 0x315d00, 0x315e00, 0x315f00, - 0x316000, 0x316100, 0x316200, 0x316300, 0x316400, 0x316500, 0x316600, 0x316700, - 0x316800, 0x316900, 0x316a00, 0x316b00, 0x316c00, 0x316d00, 0x316e00, 0x316f00, - 0x317000, 0x317100, 0x317200, 0x317300, 0x317400, 0x317500, 0x317600, 0x317700, - 0x317800, 0x317900, 0x317a00, 0x317b00, 0x317c00, 0x317d00, 0x317e00, 0x317f00, - 0x318000, 0x318100, 0x318200, 0x318300, 0x318400, 0x318500, 0x318600, 0x318700, - 0x318800, 0x318900, 0x318a00, 0x318b00, 0x318c00, 0x318d00, 0x318e00, 0x318f00, - 0x319000, 0x319100, 0x4e0001, 0x4e8c01, 0x4e0901, 0x56db01, 0x4e0a01, 0x4e2d01, - 0x4e0b01, 0x753201, 0x4e5901, 0x4e1901, 0x4e0101, 0x592901, 0x573001, 0x4eba01, - 0x31a000, 0x31a100, 0x31a200, 0x31a300, 0x31a400, 0x31a500, 0x31a600, 0x31a700, - 0x31a800, 0x31a900, 0x31aa00, 0x31ab00, 0x31ac00, 0x31ad00, 0x31ae00, 0x31af00, - 0x31b000, 0x31b100, 0x31b200, 0x31b300, 0x31b400, 0x31b500, 0x31b600, 0x31b700, - 0x31b800, 0x31b900, 0x31ba00, 0x31bb00, 0x31bc00, 0x31bd00, 0x31be00, 0x31bf00, - 0x31c000, 0x31c100, 0x31c200, 0x31c300, 0x31c400, 0x31c500, 0x31c600, 0x31c700, - 0x31c800, 0x31c900, 0x31ca00, 0x31cb00, 0x31cc00, 0x31cd00, 0x31ce00, 0x31cf00, - 0x31d000, 0x31d100, 0x31d200, 0x31d300, 0x31d400, 0x31d500, 0x31d600, 0x31d700, - 0x31d800, 0x31d900, 0x31da00, 0x31db00, 0x31dc00, 0x31dd00, 0x31de00, 0x31df00, - 0x31e000, 0x31e100, 0x31e200, 0x31e300, 0x31e400, 0x31e500, 0x31e600, 0x31e700, - 0x31e800, 0x31e900, 0x31ea00, 0x31eb00, 0x31ec00, 0x31ed00, 0x31ee00, 0x31ef00, - 0x31f000, 0x31f100, 0x31f200, 0x31f300, 0x31f400, 0x31f500, 0x31f600, 0x31f700, - 0x31f800, 0x31f900, 0x31fa00, 0x31fb00, 0x31fc00, 0x31fd00, 0x31fe00, 0x31ff00 -}; - -static const int32_t ucp0x32[256] = -{ 0x320000, 0x320100, 0x320200, 0x320300, 0x320400, 0x320500, 0x320600, 0x320700, - 0x320800, 0x320900, 0x320a00, 0x320b00, 0x320c00, 0x320d00, 0x320e00, 0x320f00, - 0x321000, 0x321100, 0x321200, 0x321300, 0x321400, 0x321500, 0x321600, 0x321700, - 0x321800, 0x321900, 0x321a00, 0x321b00, 0x321c00, 0x321d00, 0x321e00, 0x321f00, - 0x322000, 0x322100, 0x322200, 0x322300, 0x322400, 0x322500, 0x322600, 0x322700, - 0x322800, 0x322900, 0x322a00, 0x322b00, 0x322c00, 0x322d00, 0x322e00, 0x322f00, - 0x323000, 0x323100, 0x323200, 0x323300, 0x323400, 0x323500, 0x323600, 0x323700, - 0x323800, 0x323900, 0x323a00, 0x323b00, 0x323c00, 0x323d00, 0x323e00, 0x323f00, - 0x324000, 0x324100, 0x324200, 0x324300, 0x324400, 0x324500, 0x324600, 0x324700, - 0x324800, 0x324900, 0x324a00, 0x324b00, 0x324c00, 0x324d00, 0x324e00, 0x324f00, - 0x325000, 0x325100, 0x325200, 0x325300, 0x325400, 0x325500, 0x325600, 0x325700, - 0x325800, 0x325900, 0x325a00, 0x325b00, 0x325c00, 0x325d00, 0x325e00, 0x325f00, - 0x110001, 0x110201, 0x110301, 0x110501, 0x110601, 0x110701, 0x110901, 0x110b01, - 0x110c01, 0x110e01, 0x110f01, 0x111001, 0x111101, 0x111201, 0x326e00, 0x326f00, - 0x327000, 0x327100, 0x327200, 0x327300, 0x327400, 0x327500, 0x327600, 0x327700, - 0x327800, 0x327900, 0x327a00, 0x327b00, 0x327c00, 0x327d00, 0x327e00, 0x327f00, - 0x4e0001, 0x4e8c01, 0x4e0901, 0x56db01, 0x4e9401, 0x516d01, 0x4e0301, 0x516b01, - 0x4e5d01, 0x534101, 0x670801, 0x706b01, 0x6c3401, 0x672801, 0x91d101, 0x571f01, - 0x65e501, 0x682a01, 0x670901, 0x793e01, 0x540d01, 0x727901, 0x8ca101, 0x795d01, - 0x52b401, 0x79d801, 0x753701, 0x597301, 0x906901, 0x512a01, 0x537001, 0x6ce801, - 0x980501, 0x4f1101, 0x519901, 0x6b6301, 0x4e0a01, 0x4e2d01, 0x4e0b01, 0x5de601, - 0x53f301, 0x533b01, 0x5b9701, 0x5b6601, 0x76e301, 0x4f0101, 0x8cc701, 0x535401, - 0x591c01, 0x32b100, 0x32b200, 0x32b300, 0x32b400, 0x32b500, 0x32b600, 0x32b700, - 0x32b800, 0x32b900, 0x32ba00, 0x32bb00, 0x32bc00, 0x32bd00, 0x32be00, 0x32bf00, - 0x32c000, 0x32c100, 0x32c200, 0x32c300, 0x32c400, 0x32c500, 0x32c600, 0x32c700, - 0x32c800, 0x32c900, 0x32ca00, 0x32cb00, 0x32cc00, 0x32cd00, 0x32ce00, 0x32cf00, - 0x30a201, 0x30a401, 0x30a601, 0x30a801, 0x30aa01, 0x30ab01, 0x30ad01, 0x30af01, - 0x30b101, 0x30b301, 0x30b501, 0x30b701, 0x30b901, 0x30bb01, 0x30bd01, 0x30bf01, - 0x30c101, 0x30c401, 0x30c601, 0x30c801, 0x30ca01, 0x30cb01, 0x30cc01, 0x30cd01, - 0x30ce01, 0x30cf01, 0x30d201, 0x30d501, 0x30d801, 0x30db01, 0x30de01, 0x30df01, - 0x30e001, 0x30e101, 0x30e201, 0x30e401, 0x30e601, 0x30e801, 0x30e901, 0x30ea01, - 0x30eb01, 0x30ec01, 0x30ed01, 0x30ef01, 0x30f001, 0x30f101, 0x30f201, 0x32ff00 -}; - -static const int32_t* const ucoll_map[UNICODE_MAP_SIZE] = -{ ucp0x00, ucp0x01, ucp0x02, ucp0x03, ucp0x04, ucp0x05, ucp0x06, NULL, - NULL, ucp0x09, ucp0x0a, ucp0x0b, ucp0x0c, ucp0x0d, NULL, ucp0x0f, - ucp0x10, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, ucp0x1d, ucp0x1e, ucp0x1f, - ucp0x20, ucp0x21, ucp0x22, ucp0x23, ucp0x24, NULL, NULL, NULL, - NULL, NULL, ucp0x2a, NULL, ucp0x2c, ucp0x2d, NULL, NULL, - ucp0x30, ucp0x31, ucp0x32, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL -}; - -static unsigned int -sort_point(unsigned int code) -{ unsigned int cp = code / 256; - - if ( cp < UNICODE_MAP_SIZE && ucoll_map[cp] ) - return ucoll_map[cp][code&0xff]; - - return (code<<8); -} - -static inline unsigned int -sort_pointA(unsigned int code) -{ return ucp0x00[code]; -} - diff --git a/packages/semweb/unicode_map.pl b/packages/semweb/unicode_map.pl deleted file mode 100644 index 90ee9e100..000000000 --- a/packages/semweb/unicode_map.pl +++ /dev/null @@ -1,322 +0,0 @@ -:- module(unicode_collate_info, - [ write_unicode_collate_map/2 % +File, +Options - ]). -:- use_module(library('unicode/unicode_data')). -:- use_module(library('http/dcg_basics')). -:- use_module(library(debug)). -:- use_module(library(option)). - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -This module creates a simple map for removing diacritics from Unicode -characters and mapping them to lowercase. It defines tables and a -function "int sort_point(int code)". The sort points are defined as -follows: - - * The high 24-bit contains the character code after mapping to - lowercase and removing possible diacritics. - * Bit 8 is 0 for characters that are mapped from upper to - lowercase and 1 for all other characters - * The low 7 bits encode the removed diacritics. All removed - diacritics are ordered by their Unicode codepoint - and numbered.sequentially. - -As a result, text will be ordered by its basic character, upper case -before lowercase and text with diacritics after text without. - - -RUNNING - -To run thhis module, first check the instructions in -library('unicode/unicode_data') for installing the Unicode datafiles -that are not included in this package. - - -MOTIVATION - -This module is a simple-minded replacement for true Unicode support such -as provided by UCI (http://uci.sourceforge.net/). The advantage of the -do-it-yourself approach adopted here however is that it greatly reduces -the footprint and eliminates installation and maintenance problems -involved in adopting large `can-do-everything' external libraries. - -We believe it deals correctly with the Western languages, Greek, -Cyrillic and other languages with similar handling of diacritics. - - -UPPERCASE - -For Prolog it makes more sense to map to lowercase as the cannonical -case. However, we wish to order first on uppercase and to be able to do -prefix matches we need to search on the lowest value. Hence, we use the -uppercase version for sorting. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -:- dynamic - diacritic/1, % known diacritics - diacritic_code/2. % +Diacritic, -Code (1..N) - - /******************************* - * C TABLES * - *******************************/ - -% write_unicode_collate_map(+File, +Options) -% -% Options supported are: -% -% # first_codepage [0] -% Code page to start -% -% # last_codepage [127] -% Code page to end. -% -% # case(UpperOrLower) -% Canonise to upper (default) or lower case. - -write_unicode_collate_map(File, Options) :- - open(File, write, Out), - call_cleanup(write_sort_map(Out, Options), - close(Out)). - -write_sort_map(Out, Options) :- - gen_tables(Tables, Options), - write_header(Out, Options), - forall(member(table(CP, Map), Tables), - write_codepage(Out, CP, Map)), - write_map(Out, Tables, Options), - write_footer(Out, Options). - -write_codepage(Out, CP, Map) :- - assertion(length(Map, 256)), - cp_name(CP, CPN), - format(Out, 'static const int32_t ~w[256] =~n', [CPN]), - format(Out, '{ ', []), - map_entries(Map, 0, Out), - format(Out, '~N};~n~n', []). - -cp_name(CP, CPN) :- - sformat(CPN, 'ucp0x~|~`0t~16r~2+', [CP]). - -map_entries([], _, _). -map_entries([H|T], I, Out) :- - ( I == 0 - -> true - ; 0 =:= I mod 8 - -> format(Out, ',~n ', []) - ; format(Out, ', ', []) - ), - format(Out, '~|0x~`0t~16r~8+', [H]), - I2 is I + 1, - map_entries(T, I2, Out). - -write_map(Out, Tables, Options) :- - option(last_codepage(Last), Options, 127), - format(Out, - 'static const int32_t* const ucoll_map[UNICODE_MAP_SIZE] =~n', - []), - format(Out, '{ ', []), - map_tables(0, Last, Tables, Out), - format(Out, '~N};~n~n', []). - -map_tables(CP, Last, _, _) :- - CP > Last, !. -map_tables(CP, Last, Tables, Out) :- - ( CP == 0 - -> true - ; 0 =:= CP mod 8 - -> format(Out, ',~n ', []) - ; format(Out, ', ', []) - ), - ( memberchk(table(CP, _), Tables) - -> cp_name(CP, CPN), - format(Out, '~w', [CPN]) - ; format(Out, '~|~tNULL~7+', []) - ), - CP2 is CP + 1, - map_tables(CP2, Last, Tables, Out). - - -write_header(Out, Options) :- - option(last_codepage(Last), Options, 127), - Size is Last+1, - format(Out, - '#ifdef WIN32\n\ - typedef int int32_t;\n\ - #else\n\ - #include <inttypes.h>\n\ - #endif\n\n', []), - format(Out, - '#ifndef NULL\n\ - #define NULL ((void*)0)\n\ - #endif\n\n', []), - format(Out, - '#define UNICODE_MAP_SIZE ~d~n~n', [Size]). - -write_footer(Out, Options) :- - ( memberchk(case(lower), Options) - -> Add = '+0x80' - ; Add = '' - ), - format(Out, - 'static int\n\ - sort_point(int code)\n\ - { int cp = code / 256;\n\ - \n \ - if ( cp < UNICODE_MAP_SIZE && ucoll_map[cp] )\n \ - return ucoll_map[cp][code&0xff];\n\ - \n \ - return (code<<8)~w;\n\ - }\n\n', [Add]), - format(Out, - 'static int\n\ - sort_pointA(int code)\n\ - { return ucp0x00[code&0xff];\n\ - }\n\n', []). - - - /******************************* - * TABLES * - *******************************/ - -gen_tables(Tables, Options) :- - forall(rm_diacritics(_, _, _), true), - assign_diacritic_codes, - findall(table(CP,Map), table(CP, Map, Options), Tables). - -table(CP, Map, Options) :- - option(first_codepage(First), Options, 0), - option(last_codepage(Last), Options, 127), - between(First, Last, CP), - findall(M, char(CP, M, Options), Map), % now - non_empty_map(CP, Map, Options). - -char(CP, Value, Options) :- - between(0, 255, I), - Code is 256*CP+I, - ( char_to_code(Code, Value, Options) - -> true - ; format('Failed on ~d~n', [Code]), - Value is Code<<8 - ). - -char_to_code(Code, Value, Options) :- - memberchk(case(lower), Options), !, - ( utolower(Code, Lower), - Lower \== Code - -> Cc = Lower, - CFlags = 0x00 - ; Cc = Code, - CFlags = 0x80 - ), - assertion(integer(Cc)), - ( rm_diacritics(Cc, Base, Dia), - assertion(integer(Base)) - -> diacritic_code(Dia, DiaV), - Value is Base << 8 \/ CFlags \/ DiaV - ; Value is Cc << 8 \/ CFlags - ). -char_to_code(Code, Value, _Options) :- - ( utoupper(Code, Upper), - Upper \== Code - -> Cc = Upper, - CFlags = 0x80 - ; Cc = Code, - CFlags = 0x00 - ), - assertion(integer(Cc)), - ( rm_diacritics(Cc, Base, Dia), - assertion(integer(Base)) - -> diacritic_code(Dia, DiaV), - Value is Base << 8 \/ CFlags \/ DiaV - ; Value is Cc << 8 \/ CFlags - ). - -non_empty_map(CP, Map, Options) :- - ( memberchk(case(lower), Options) - -> Add is 0x80 - ; Add = 0 - ), - \+ empty_map(Map, 0, CP, Add). - -empty_map([], _, _, _). -empty_map([H|T], I, CP, Add) :- - H =:= ((CP*256+I)<<8) + Add, - I2 is I + 1, - empty_map(T, I2, CP, Add). - - - /******************************* - * CASE CONVERSION * - *******************************/ - -utolower(Code, Lower) :- - unicode_property(Code, simple_lowercase_mapping(Lower)). - -utoupper(Code, Upper) :- - unicode_property(Code, simple_uppercase_mapping(Upper)). - - - /******************************* - * DIACRITICS * - *******************************/ - -rm_diacritics(Code, Plain, Dia) :- - unicode_property(Code, decomposition_type(List)), - List \== '', - atomic_list_concat(AtomList, ' ', List), - to_plain(AtomList, Code, Plain, Dia). - -to_plain([Special, PlainA], _, Plain, 0) :- - special(Special), !, - atom_hex(PlainA, Plain). -to_plain([PlainA], _Code, Plain, 1) :- !, - atom_hex(PlainA, Plain). -to_plain(List, Code, Plain, Dia) :- - maplist(atom_hex, List, Numbers), - Numbers = [Plain, Dia], - diacritic(Dia, Code), !. - -diacritic(Code, For) :- !, - unicode_property(Code, canonical_combining_class(Cc)), - ( Cc > 0 - -> assert_diacritic(Code) - ; debug(diacritic, '~16r: ~16r: Cc = ~d~n', [For, Code, Cc]), - fail - ). - -assign_diacritic_codes :- - retractall(diacritic_code(_,_)), - findall(D, diacritic(D), Ds), - sort([0,1|Ds], Sorted), % 0 and 1 are specials - assign_codes(Sorted, 1). - -assign_codes([], _). -assign_codes([H|T], I) :- - assert(diacritic_code(H, I)), - I2 is I + 1, - assign_codes(T, I2). - -assert_diacritic(Code) :- - diacritic(Code), !. -assert_diacritic(Code) :- - assert(diacritic(Code)). - -atom_hex(Atom, Hex) :- - atom_codes(Atom, Codes), - phrase(xinteger(Hex), Codes). - -special('<font>'). -special('<noBreak>'). -special('<initial>'). -special('<medial>'). -special('<final>'). -special('<isolated>'). -special('<circle>'). -special('<super>'). -special('<sub>'). -special('<vertical>'). -special('<wide>'). -special('<narrow>'). -special('<small>'). -special('<square>'). -special('<fraction>'). -special('<compat> '). diff --git a/packages/sgml b/packages/sgml new file mode 160000 index 000000000..3a23a5129 --- /dev/null +++ b/packages/sgml @@ -0,0 +1 @@ +Subproject commit 3a23a5129738fa08327922bda35bb5458191aaa5 diff --git a/packages/sgml/COPYING b/packages/sgml/COPYING deleted file mode 100644 index bfdcd7e58..000000000 --- a/packages/sgml/COPYING +++ /dev/null @@ -1,6 +0,0 @@ -This library is distributed under the LGPL licence terms. For details -visit http://www.gnu.org/copyleft/lesser.html. - -Holders of the SWI-Prolog commercial license (see -http://www.swi.psy.uva.nl/projects/SWI-Prolog/) may use this software -under the same conditions as SWI-Prolog. diff --git a/packages/sgml/ChangeLog b/packages/sgml/ChangeLog deleted file mode 100644 index 9b756031c..000000000 --- a/packages/sgml/ChangeLog +++ /dev/null @@ -1,716 +0,0 @@ -[Feb 16 2009] - - * FIXED: Release HTML DTDs when using load_html_file/2 in a thread. - -[Feb 15 2009] - - * FIXED: Memory leak in SGML parser. - -[Jan 21 2009] - - * FIXED: RDF writer: write valid XML if the namespace entity contains characters - that must be %-escaped. Jacopo Urbani. - -[Jan 13 2009] - - * FIXED: RDF/XML could save illegal XML if multiple namespaces are used - for predicates where one namespace is a prefix of another one. Jacopo Urbani. -[Dec 19 2008] - - * FIXED: Correct usage of content_length option in sgml_parse/3 when using callbacks. Needed to deal with streaming input for parsing RDF. - - * ADDED: Pass content_length through process_rdf/3 -[Oct 13 2008] - - * CLEANUP: Avoid repetition and warnings on option processing predicates. Matt Lilley. -[Sep 11 2008] - - * PORT: Add AC_PREREQ to configure.h for systems that auto-select autoconf - versions. After tip by Ulrich Neumerkel. - -[Aug 11 2008] - - * INSTALL: Remove all configure files from the git repository -[May 20 2008] - - * MODIFIED: Streams in socket.pl and ssl.pl appeared unbuffered. They - are now fully buffered. - -[Apr 18 2008] - - * MODIFIED: Renamed hash_term/2 to term_hash/2. Added hash_term/2 to - library(backcomp), so most code should not notice this. -[Mar 1 2008] - - * ENHANCED: Allow for GC from PL_handle_signals(), providing GC for foreign - code building large structures. This is now used by the SGML/XML parser - to avoid running unnecessarily out of stack. - -[Feb 28 2008] - - * FIXED: rdf_write_xml/2 loops if it encounters an rdf:Bag. - -[Feb 18 2008] - - * FIXED: More fixes for proper handling of rdf:Bag - -[Feb 13 2008] - - * FIXED: Emit rdf:Bag attributes (etc.) as rdf:li - - * FIXED: possible failure in rdf_write_xml with http://t-d-b.org? - -[Jan 23 2008] - - * PORT: Bug#346: Allow overriding COFLAGS and CWFLAGS in package - configuration. Keri Harris. -[Jan 14 2008] - - * FIXED: Bug#343: Handling bnodes in rdf_write_xml. Yver Raimond. - - * FIXED: Added support for rdf:NodeID to rdf_write_xml/2. Yves Raimond. - -[Dec 13 2007] - - * FIXED: library(rdf_write) to deal with operators. Related to Bug#332 - -[Nov 12 2007] - - * FIXED: Bug#320: Memory leak when parsing SGML NOTATIONs. Keri Harris. - -Oct 30, 2007 - - * FIXED: xml_write/3 quoting of < in attributes. Dmitry Kuzmin. - -Sep 11, 2007 - - * FIXED: xml_write/3 for multi-valued attributes such as IDREFS, NAMES, - etc. Victor de Boer and Anjo Anjewierden. - -Jun 6, 2007 - - * MODIFIED: Avoid recursive expansion of entities, unless marked as - SGML content. - * FIXED: Strict XML comment syntax. Jacco van Ossenbruggen. - * FIXED: give error on bad entities in XML mode. Jacco van Ossenbruggen. - -Feb 6, 2007 - - * MODIFIED: xml_quote_attribute no longer maps ' to &apos; See note in - quote.c - -Nov 15, 2006 - - * FIXED: properly pass <?pi> instructions. - -Oct 27, 2006 - - * ENHANCEMENT: Started branch XML_UNICODE to provide support for Unicode - filenames, tags and elements. - -Aug 28, 2006 - - * DOCUMENTATION: Moved to sgml.doc, using the same system as the - remainder of the system. - -Jul 25, 2006 - - * FIXED: space(default) handling. Juho Östman. - -Jun 20, 2006 - - * FIXED: illegal read. Can cause wrong data and/or crashes. - -Feb 16, 2006 - - * ENHANCED: various improvements of the sgml_write.pl library by Richard - O'Keefe. - -Feb 12, 2006 - - * ENHANCED: xml_write/3: if encoding is `text', write the data as UTF-8 - -Feb 9, 2006 - - * FIXED: valgrind detected memory error. Not sure whether or not it was - a real error. - -Feb 1, 2006 - - * PORT: Detect inline behaviour of compiler in configure - -Jan 19, 2006 - - * FIXED: Allow for different deparators in in/excluded namegroup. - Anjo Anjewierden. - -Jul 7, 2005 - - * ADDED: entiry(+Name, +Value) to (re-)define CDATA entity values. - -Mar 31, 2005 - - * ADDED: make exceptions in call-backs from sgml_parse/3 return the - parser immediately with the given exception. - -Mar 29, 2005 - - * ADDED: layout(Bool) option to the xml_write/3 and friends predciates. - -Mar 21, 2005 - - * ADDED: specify dialect for loading DTDs. After mail from Sebastien Cabot. - - * FIXED: Avoid error on thread_at_exit when using in single-threaded - Prolog. Anjo Anjewierden. - -Mar 6, 2005 - - * ADDED: improved namespace and indentation support for xml_write/3. - -Mar 5, 2005 - - * ADDED: xml_is_dom/1. Option header(Bool) to xml_write to suppress - writing the header. - -Mar 4, 2005 - - * ADDED: xmlns support to xml_write/3. - - * ENHANCED: library(sgml_write): Indent attributes if there are too many. - -Mar 01, 2005 - - * ADDED: encoding argument to xml_quote_* and xml_name/2 predicates. - -Feb 24, 2005 - - * ADDED: handle encoding="US-ASCII" for XML documents. - -Feb 22, 2005 - - * MODIFIED: Use Sgetcode() rather than Sgetc() to get data from a Prolog - stream. Extended parser to accept characters outside 0..255 range. - -Feb 7, 2005 - - * ADDED: when converting attributes to integers on 32-bit machines, - exploit 64-bit Prolog integers. - -Jan 6, 2005 - - * FIXED: Documentation - -Dec 21, 2004 - - * ADDED: library(sgml_write), providing conversion of parsed data to - a file. - -Dec 20, 2004 - - * Working wide-character version. Consequences: - - CDATA attributes and content never contain entities anymore - as all text can now be represented. - - Limit on quoted CDATA attribute values (was 2048 characters) - has been removed. - -Dec 19, 2004 - - * Start working on wide-character support: introducing wide-character - output buffers. - -Dec 15, 2004 - - * FIXED: Bug#212: Disallow &#0; character entities. - -Nov 25, 2004 - - * FIXED: utf-8 tests, avoid conflict with UTF-8 support in Prolog - -Sep 13, 2004 - - * ENHANCED: load_html_file/2: add shorttag(false) to the load_structure/3 - options for better parsing of common errornous HTML pages. - -Aug 26, 2004 - - * FIXED: Bug#177: catalog files from $SGML_CATALOG_FILES were not - honoured. Simon Ambler. Also made catalog management thread-safe. - -Jul 22, 2004 - - * MODIFIED: Updated XML-Schema (XSD) namespace in xsdp_types.pl - -Apr 28, 2004 - - * ADDED: iso_639.pl: ISO-639 language identifiers. - -Apr 27, 2004 - - * ADDED: first version of xsdp_types.pl, a module to do type checking - and type conversion for XSD (XML Schema DataTypes). - -Apr 26, 2004 - - * FIXED: Bug#149: Buffer overflow reading too long NAME, NMTOKEN, etc. - Fabien Todescato. - -Jan 17, 2004 - - * FIXED: handling <?xml ...?> switching from SGML to XML mode. - Fabien Todescato. - -Jan 9, 2004 - - * FIXED: avoid sharing DTD objects between threads. Fabien Todescato. - -Nov 20, 2003 - - * ADDED: xml_name/1 to test an atom to refer to a valid XML name. - -Nov 3, 2003 - - * FIXED: Error parsing SHORTREF declaration that has whitespace at the - end. Richard O'Keefe. - -Sep 12, 2003 - - * FIXED: Memory leak in load_structure/3 (not freeing the parser data). - Petter Egesund. - -Jul 8, 2003 - - * ADDED: handle UTF-8 sequences producing characters that cannot be - represented as character entities. Suggested by C. M. Sperberg-McQueen. - - * FIXED: handling &#X, where 128<=X<256 with UTF-8 decoding enabled. - C. M. Sperberg-McQueen. - -Jun 9, 2003 - - * FIXED: SGML SHORTREF declaration performed case-insensitive entity - lookup. Richard O'Keefe. - -Jun 4, 2003 - - * ENHANCED: type the conflicting CDATA in #PCDATA that violates the DTD - -May 23, 2003 - - * FIXED: More catalog trouble. Richard O'Keefe. - -May 22, 2003 - - * FIXED: Lookup of system identifiers through the catalogue (avoid early - tagging with file:) Richard O'Keefe. - -May 21, 2003 - - * FIXED: Handle -- in element-names (Bijan Parsia). - -May 8, 2003 - - * Fix registering catalog files - -May 5, 2003 - - * Incorporated better CATALOG parsing by Richard O'Keefe. May be incomplete - or incorrect. - -* FIXED: call(end, Goal) passing the element-name incorrectly (breaks - process_rdf/3). - -* FIXED: delay unification of value in load_structure/3. - -* FIXED: Properly expand UTF-8 values in CDATA attributes - -* FIXED: Properly handle unquoted attributes at the end of an empty element - in XML mode <foo bar=10/> - -* FIXED: #CONREF attribute handling in elements with declared content - (CDATA/RCDATA). Richard O'Keefe. - -SWI-Prolog VERSION 5.0.10 -========================= - -* FIXED: properly handle elements that have only an <!ATTLIST declaration - but no <!ELEMENT declaration. (C. M. Sperberg-McQueen). - -* FIXED: handle CDATA inside elements with content-type ANY - (C. M. Sperberg-McQueen). - -* MODIFIED: silently ignore attempts to redefine entity declarations. - Richard O'Keefe. - -* FIXED: skip [] for detection of nesting inside literal values and fix - handling of [] in the <!DOCTYPE xxx [...]> declaration. Richard O'Keefe. - -* MODIFIED/ADDED: qualify_attributes option for xmlns mode. Default is - now *not* to qualify attributes. - -* FIXED: Handle elements inside shorttag values. Thanks Richard O'Keefe - for providing a clear description how to handle this. - -SWI-Prolog VERSION 5.0.9 -======================== - -* FIXED: correct handling of content_length(Len) option (was reading one - character too many). Oops, normal reading was broken. Fixed. - -* FIXED: Correctly handle marked sections ending in ]]]> rather than ]]> - Spotted by Adrian Boyko. - -* ADDED: xml_quote_attribute/2 and xml_quote_cdata/2, providing simple - quote-support. - -* FIXED: parse(content) option to the parser (multiple bugs) required for - process_rdf/3 (Girish Padmalayam). - -* FIXED: dtd2pl: printing of NAMEOF and NMTOKEN attributes - (Joseph Wayne Norton). - -* FIXED: load_structure/3 to pass doctype(_) to the correct place. - -* ADDED: space(sgml) option. Was documented but omitted. - - -SWI-Prolog VERSION 4.0.11 -========================= - -* MODIFIED: When processing non-validated data in space-preserve mode, emit - ALL blank data (Richard O'Keefe). - -* FIXED: close file after reading DTD from a file. (Anjo Anjewierden) - -* FIXED: handling of (a) +(b) element declaraction (Richard O'Keefe) - -* ADDED: Warning when redefining (parameter) entities. - -* ENHANCED/FIXED: Process entities refering to files directly. This - reduces memory needs and fixes path-problems in recursive includes. - This applies for both normal and parameter entities. - -* ADDED: Test for legal value in attributes with type NAMEOF (a|b) - -* FIXED: Handle (a,b), (a&b) and (a|b) as equivalent in ATTLIST type - declaration. - -* FIXED: option shorttag was spelled shortag. - -* FIXED: Ensure the output is properly closed, even if the parser encounters - an unexpected end-of-file. - - -SWI-Prolog VERSION 4.0.6 -======================== - -* FIXED: Data overwriting in <DOCTYPE ... [local stuff]> if local stuff - is too long (Andrew Dadakov). - -* FIXED: Report elements not in the DTD allowed by the ANY model - as error (Andrew Dadakov). - -* FIXED: Call sgml_nomem() after strdup in case of out-of-memory - (Richard O'Keefe). - -* PORT: Removed alloca() usage (Richard O'Keefe). - -* LIMIT: Make maximum string length 2048 to allow parsing HTML4 DTD. - Maybe we should remove comments while fetching parameter-entity - values? - -* FIXED: Include #FIXED and defaulted arguments for omitted tags - (reported by Richard O'Keefe). - -* ADDED: handle plain <!DOCTYPE doc> silently if the catalog contains - a DOCTYPE doc file.dtd entry. - -* FIXED: Various issues in attribute handling with new routines supplied - by Richard O'Keefe. Added shorttag(Bool) to options you can set. - -* ADDED: `make check' to run the test-suite. - -* FIXED: Handling of &<tag> (Richard O'Keefe). - -* FIXED: dtd2pl to use model(Model) to avoid amibiguity between CDATA and - (CDATA) model. Richard O'Keefe. - -* FIXED: Various output aspects of the sgml driver program, notably case and - character escaping problems. By Richard O'Keefe. - -* ADDED: Ignore SGML declaration in <!SGML ...> - -* FIXED: Do not require ; after character-entity - -* ADDED: Expand character and parameter entities while parsing literals - in a DTD (Richard O'Keefe). - - -VERSION 1.0.13 -============== - -* FIXED: Interpret <!ENTITY e STARTTAG "x"> as <!ENTITY e "<x>"> (well, - dependent on the delimiters). (Richard O'Keefe). - -* FIXED: Allow omitted end-tag for RCDATA and CDATA elements (only effective - when hitting the end of the file). - -* FIXED: Proper parsing of <!NOTATION ...> declaration. Also fixed - dtd_property(DTD, notations(Notations)) and modified - dtd_property(DTD, notation(N, Decl)). - -* ADDED: <!ENTITY #DEFAULT ...> (Richard O'Keefe). - -* FIXED: Ignore newline after entity - -* FIXED: Allow omitted ; expanding entities in CDATA attributes - -* FIXED: Possible crash with SHORTREF endding in &#RE. - -* FIXED: avoid crash on illegal syntax in DTD omited-tag declaration - -VERSION 1.0.12 -============== - -* FIXED: More white-space issues in handling quoted attribute values. - -* ADDED: XML NAMECHARS to the default set. This seems to match HTML-4 - better and will only in exceptional cases harm normal SGML processing. - -* ADDED/MODIFIED: Attributes not in the source, but with a default or - fixed value declared in the DTD are now included in the output. The - old behaviour can be used using the defaults(false) option to - load_structure/3. - -* FIXED: expand parameter-entities in <!USEMAP declaration. - -* FIXED: sgml utility to canonise space in output of `list' attributes. - -* FIXED: proper entity-expansion and blank-canonisation in attribute-vaues - (Richard O'Keefe). - -* FIXED: false warning at start of NUTOKEN attribute (Richard O'Keefe). - -VERSION 1.0.11 -============== - -* ADDED: handling of #CONREF attribute default (Richard O'Keefe). - -* FIXED: sgml utility not to print "C" at the end when there where errors - (Richard O'Keefe) - -* FIXED: handle value-shorthand for nmtoken (Richard O'Keefe) - -* FIXED: &RE; SHORTREF handling if the newline appears as the first - character of a (new) #PCDATA block. - -* CONFIG: Added -with-prolog=<Prolog> by Milan Zamazal for integration - as Debian (linux) package. - - -VERSION 1.0.10 -============== - -* UPDATE: calls to select/3 for compatibility to SWI-Prolog 3.4 - -* FIXED: Allow <!USEMAP before <!SHORTREF - -* FIXED: handling the #empty map (SGML SHORTREF). - -* MODIFIED: state-engine for <>, using a new state S_DECL0 after seeing < - to decide whether this is a non-escaped < in CDATA or a real tag. Also - changed comment-handling to avoid the need for parser->previous_char. - -* ADDED: sgml utility allow for parsing stdin. - -* PERFORMANCE: Improved expand_[p]entities(), providing about 10% - overall improvement. - -* FIXED: crash in sgml (demo-)driver app causing a crash if the input - file has no extension (Richard O'Keefe). - -* ADDED: support for RCDATA declared-content elements - -* FIXED: SGML-mode: immediately close EMPTY elements (i.e. do not allow - for a closing </img>). - -* IMPROVED: Error reporting on elements not in the DTD. - -* ADDED: get_sgml_parser(Parser, dtd(-DTD)). - -VERSION 1.0.8 -============= - -* FIXED: Problem in windows version regarding text/binary file and \ <-> / - difference. - -* FIXED: Problem finding HTML4 .soc file - -* FIXED: entity_file() to avoid a crash if the entity is not in the catalog. - -* ADDED: Parse not-quoted attribute values that require quotes by parsing - upto the next layout character. Give a warning. For example: - <hr width=50%> is parsed as <hr width="50%">, but a warning is displayed. - -* FIXED: Crash if start of file is not a declaration but ordinary non-blank - text. - -* ADDED: Improved source-location handling and some additional call-backs - to the call-back interface, preparing the parser for supporting SGML - syntax highlighting and checking editors. See get_sgml_parser/2 and - sgml_parse/2 predicates. - -VERSION 1.0.7 -============= - -* IMPROVED: Redirect all memory management to print a fatal error message - instead of crashing. - -* IMPROVED: Handle the (illegal) comment <!-- some text -- more text --> - more elegantly: assume <!-- will be terminated by --> and generate a - warning if text was found outside --comment--. - -* FIXED: Some issues in marked-section handling - -* ADDED: Direct error reporting of sgml application through callback for - demo purposes. Message now includes the current dialect. - -* FIXED: sgml application: do not convert case in XML mode. - -* FIXED: Do not report error on not-declared xmlns attribute in XML mode. - -* Cleaned Makefiles - -VERSION 1.0.6 -============= - -* ADDED: SGML based documentation of the package with converters to LaTeX - and HTML in Prolog. - -* ADDED/MODIFIED: number(NumberMode) option to the load_structure/3. - By default NUMBER and NUMBERS tokens are now parsed as tokens of digits. - Using number(integer) they are converted to Prolog integers, provided - they fit (Richard O'Keefe). - -* ADDED: If a document is parsed without DTD and a catalog is provided, - try finding a matching DTD file from the catalog. If successful - print a warning and load this DTD. - -* FIXED: Ensure the -xml flag to the sgml utility works again. - -* INSTALL: Check for existence of runtex - -* INSTALL: Do not cache Prolog related variables. - -* FIXED: signed/unsigned character handling in catalog.c (Richard O'Keefe) - -* MODIFIED: Representation for source-locations. - - -VERSION 1.0.5 -============= - -* MODIFIED: Get SYSTEM entities relative to the file in which the - entity is declared. Get PUBLIC entities from the second argument - if the catalog (entry) is not found. - -* FIXED: Deal with elements only containing shortref references - -* MODIFIED: Only insert missing close-tags that should not be on closing - outer environments, not because an element is encountered that fits in - an outer environment. Improves error behaviour. - -* ADDED: Print default list values in dtd2pl - -* ADDED: Support for the content-model ANY. - -* ADDED: option -xml to pl2dtd to force it loading a DTD in XML mode. - -* FIXED: Do not expand SHORTREF inside CDATA marked sections and elements. - -* ADDED: Properly deal with NUTOKEN: handling DTD default and validate type. - -* FIXED: Expand parameter entities in SHORTREF declaraction (Richard O'Keefe). - -* FIXED: Handling of < as last character of a CDATA element - -* FIXED: proper handling of &#RE; in SHORTREF - -* FIXED: Open CDATA element when encountering a CDATA entity. - -* FIXED: SHORTTAG with attributes: <foo a=b/value/ - - -VERSION 1.0.4 -============= - -* FIXED: file_to_dtd() not to free the created DTD. This makes dtd2pl work - again. (Richard O'Keefe) - -* FIXED: Allow for layout before sub-models: ( (a,b)|c). (Andrew Dadakov) - -* FIXED: Allow for quoted nmtoken, etc. in ATTLIST declaration. - (Andrew Dadakov) - - -VERSION 1.0.3 -============= - -* FIXED: Allow for (a,b), etc. instead of just (a|b) where an element-list - is expected. - - -VERSION 1.0.2 -============= - -* ADDED: Partial SHORTTAG support (<tag/content/ and </>) - -* ADDED: Prolog interface: map multi-valued attributes to a list. - -* FIXED: ESIS output of the sgml utility to provide better compliant output - for attributes (before the open-tag, including the type and in UPPERCASE). - -* ADDED: Handling <!SHORTREF ...> and friends. - -* FIXED: Added &#RS;, &#RE;, &#TAB; and &#SPACE; (Richard O'Keefe) - -* FIXED: Processing instruction is now <?....[?]> (i.e. optional closing ?) - Q: Is this XML or SGML? Check docs! - -* FIXED: Line-number info for DOCTYPE declarations holding [declaractions]. - -* FIXED: NUMBER attribute declaration with default (skip layout afterwards) - -* ADDED: Support for NOTATION attribute - -* FIXED: memory allocation/free bug in model-reduction ((a|b)*) - -* ADDED: Passing processing instructions to the user - -* FIXED: Independent case-sensitivity switch for entities (SGML entities are - case sensitive). - -* ADDED: SGML Blank-space handling - -* FIXED: Completeness test for A&B? - -* ADDED: Dummy make check (Richard O'Keefe) - - -VERSION 1.0.1 -============= - -* ADDED: Programmable XML namespace canonisation. - -* ADDED: White space handling using the xlm:space attribute as well as - allow for setting the initial default as option to load_structure. - -* FIXED: Allow for <!ENTITY name 'value'> (i.e. without CDATA type decl). - -* FIXED: Allow for <!DOCTYPE name [DTD]> (i.e. no public nor system) - -* FIXED: Avoid crash on bad attribute-list - -* ADDED: Reporting errors and warnings through print_message/2. - -* FIXED: Handling of end-of-file in CDATA diff --git a/packages/sgml/DTD/HTML4.dcl b/packages/sgml/DTD/HTML4.dcl deleted file mode 100644 index db46db0f9..000000000 --- a/packages/sgml/DTD/HTML4.dcl +++ /dev/null @@ -1,88 +0,0 @@ -<!SGML "ISO 8879:1986 (WWW)" - -- - SGML Declaration for HyperText Markup Language version 4.0 - - With support for the first 17 planes of ISO 10646 and - increased limits for tag and literal lengths etc. - - Modified by jjc to work around SP's 16-bit character limit. - Modified by jjc to support hex character references. - -- - - CHARSET - BASESET "ISO Registration Number 177//CHARSET - ISO/IEC 10646-1:1993 UCS-4 with - implementation level 3//ESC 2/5 2/15 4/6" - DESCSET 0 9 UNUSED - 9 2 9 - 11 2 UNUSED - 13 1 13 - 14 18 UNUSED - 32 95 32 - 127 1 UNUSED - 128 32 UNUSED - -- jjc: changed the rest of the DESCSET. - Note that surrogates are not declared UNUSED; - this allows non-BMP characters to be parsed. -- - 160 65376 160 - -- 160 55136 160 - 55296 2048 UNUSED - 57344 1056768 57344 -- - -CAPACITY SGMLREF - TOTALCAP 150000 - GRPCAP 150000 - ENTCAP 150000 - -SCOPE DOCUMENT -SYNTAX - SHUNCHAR CONTROLS 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 127 - BASESET "ISO 646IRV:1991//CHARSET - International Reference Version - (IRV)//ESC 2/8 4/2" - DESCSET 0 128 0 - - FUNCTION - RE 13 - RS 10 - SPACE 32 - TAB SEPCHAR 9 - - NAMING LCNMSTRT "" - UCNMSTRT "" - LCNMCHAR ".-_:" - UCNMCHAR ".-_:" - NAMECASE GENERAL YES - ENTITY NO - DELIM GENERAL SGMLREF - HCRO "&#38;#X" -- added by jjc -- - SHORTREF SGMLREF - NAMES SGMLREF - QUANTITY SGMLREF - ATTCNT 60 -- increased -- - ATTSPLEN 65536 -- These are the largest values -- - LITLEN 65536 -- permitted in the declaration -- - NAMELEN 65536 -- Avoid fixed limits in actual -- - PILEN 65536 -- implementations of HTML UA's -- - TAGLVL 100 - TAGLEN 65536 - GRPGTCNT 150 - GRPCNT 64 - -FEATURES - MINIMIZE - DATATAG NO - OMITTAG YES - RANK NO - SHORTTAG YES - LINK - SIMPLE NO - IMPLICIT NO - EXPLICIT NO - OTHER - CONCUR NO - SUBDOC NO - FORMAL YES - APPINFO NONE -> \ No newline at end of file diff --git a/packages/sgml/DTD/HTML4.dtd b/packages/sgml/DTD/HTML4.dtd deleted file mode 100644 index 557f2372c..000000000 --- a/packages/sgml/DTD/HTML4.dtd +++ /dev/null @@ -1,1092 +0,0 @@ -<!-- - This is the HTML 4.0 Transitional DTD, which includes - presentation attributes and elements that W3C expects to phase out - as support for style sheets matures. Authors should use the Strict - DTD when possible, but may use the Transitional DTD when support - for presentation attribute and elements is required. - - HTML 4.0 includes mechanisms for style sheets, scripting, - embedding objects, improved support for right to left and mixed - direction text, and enhancements to forms for improved - accessibility for people with disabilities. - - Draft: $Date$ - - Authors: - Dave Raggett <dsr@w3.org> - Arnaud Le Hors <lehors@w3.org> - Ian Jacobs <ij@w3.org> - - Further information about HTML 4.0 is available at: - - http://www.w3.org/TR/REC-html40 ---> -<!ENTITY % HTML.Version "-//W3C//DTD HTML 4.0 Transitional//EN" - -- Typical usage: - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" - "http://www.w3.org/TR/REC-html40/loose.dtd"> - <html> - <head> - ... - </head> - <body> - ... - </body> - </html> - - The URI used as a system identifier with the public identifier allows - the user agent to download the DTD and entity sets as needed. - - The FPI for the Strict HTML 4.0 DTD is: - - "-//W3C//DTD HTML 4.0//EN" - - and its URI is: - - http://www.w3.org/TR/REC-html40/strict.dtd - - Authors should use the Strict DTD unless they need the - presentation control for user agents that don't (adequately) - support style sheets. - - If you are writing a document that includes frames, use - the following FPI: - - "-//W3C//DTD HTML 4.0 Frameset//EN" - - with the URI: - - http://www.w3.org/TR/REC-html40/frameset.dtd - - The following URIs are supported in relation to HTML 4.0 - - "http://www.w3.org/TR/REC-html40/strict.dtd" (Strict DTD) - "http://www.w3.org/TR/REC-html40/loose.dtd" (Loose DTD) - "http://www.w3.org/TR/REC-html40/frameset.dtd" (Frameset DTD) - "http://www.w3.org/TR/REC-html40/HTMLlat1.ent" (Latin-1 entities) - "http://www.w3.org/TR/REC-html40/HTMLsymbol.ent" (Symbol entities) - "http://www.w3.org/TR/REC-html40/HTMLspecial.ent" (Special entities) - - These URIs point to the latest version of each file. To reference - this specific revision use the following URIs: - - "http://www.w3.org/TR/REC-html40-971218/strict.dtd" - "http://www.w3.org/TR/REC-html40-971218/loose.dtd" - "http://www.w3.org/TR/REC-html40-971218/frameset.dtd" - "http://www.w3.org/TR/REC-html40-971218/HTMLlat1.ent" - "http://www.w3.org/TR/REC-html40-971218/HTMLsymbol.ent" - "http://www.w3.org/TR/REC-html40-971218/HTMLspecial.ent" - ---> - -<!--================== Imported Names ====================================--> - -<!ENTITY % ContentType "CDATA" - -- media type, as per [RFC2045] - --> - -<!ENTITY % ContentTypes "CDATA" - -- comma-separated list of media types, as per [RFC2045] - --> - -<!ENTITY % Charset "CDATA" - -- a character encoding, as per [RFC2045] - --> - -<!ENTITY % Charsets "CDATA" - -- a space separated list of character encodings, as per [RFC2045] - --> - -<!ENTITY % LanguageCode "NAME" - -- a language code, as per [RFC1766] - --> - -<!ENTITY % Character "CDATA" - -- a single character from [ISO10646] - --> - -<!ENTITY % LinkTypes "CDATA" - -- space-separated list of link types - --> - -<!ENTITY % MediaDesc "CDATA" - -- single or comma-separated list of media descriptors - --> - -<!ENTITY % URI "CDATA" - -- a Uniform Resource Identifier, - see [URI] - --> - -<!ENTITY % Datetime "CDATA" -- date and time information. ISO date format --> - - -<!ENTITY % Script "CDATA" -- script expression --> - -<!ENTITY % StyleSheet "CDATA" -- style sheet data --> - -<!ENTITY % FrameTarget "CDATA" -- render in this frame --> - - -<!ENTITY % Text "CDATA"> - - -<!-- Parameter Entities --> - -<!ENTITY % head.misc "SCRIPT|STYLE|META|LINK|OBJECT" -- repeatable head elements --> - -<!ENTITY % heading "H1|H2|H3|H4|H5|H6"> - -<!ENTITY % list "UL | OL | DIR | MENU"> - -<!ENTITY % preformatted "PRE"> - -<!ENTITY % Color "CDATA" -- a color using sRGB: #RRGGBB as Hex values --> - -<!-- There are also 16 widely known color names with their sRGB values: - - Black = #000000 Green = #008000 - Silver = #C0C0C0 Lime = #00FF00 - Gray = #808080 Olive = #808000 - White = #FFFFFF Yellow = #FFFF00 - Maroon = #800000 Navy = #000080 - Red = #FF0000 Blue = #0000FF - Purple = #800080 Teal = #008080 - Fuchsia= #FF00FF Aqua = #00FFFF - --> - -<!ENTITY % bodycolors " - bgcolor %Color; #IMPLIED -- document background color -- - text %Color; #IMPLIED -- document text color -- - link %Color; #IMPLIED -- color of links -- - vlink %Color; #IMPLIED -- color of visited links -- - alink %Color; #IMPLIED -- color of selected links -- - "> - -<!--================ Character mnemonic entities =========================--> - -<!ENTITY % HTMLlat1 PUBLIC - "-//W3C//ENTITIES Latin1//EN//HTML" - "http://www.w3.org/TR/REC-html40-971218/HTMLlat1.ent"> -%HTMLlat1; - -<!ENTITY % HTMLsymbol PUBLIC - "-//W3C//ENTITIES Symbols//EN//HTML" - "http://www.w3.org/TR/REC-html40-971218/HTMLsymbol.ent"> -%HTMLsymbol; - -<!ENTITY % HTMLspecial PUBLIC - "-//W3C//ENTITIES Special//EN//HTML" - "http://www.w3.org/TR/REC-html40-971218/HTMLspecial.ent"> -%HTMLspecial; -<!--=================== Generic Attributes ===============================--> - -<!ENTITY % coreattrs - "id ID #IMPLIED -- document-wide unique id -- - class CDATA #IMPLIED -- space separated list of classes -- - style %StyleSheet; #IMPLIED -- associated style info -- - title %Text; #IMPLIED -- advisory title/amplification --" - > - -<!ENTITY % i18n - "lang %LanguageCode; #IMPLIED -- language code -- - dir (ltr|rtl) #IMPLIED -- direction for weak/neutral text --" - > - -<!ENTITY % events - "onclick %Script; #IMPLIED -- a pointer button was clicked -- - ondblclick %Script; #IMPLIED -- a pointer button was double clicked-- - onmousedown %Script; #IMPLIED -- a pointer button was pressed down -- - onmouseup %Script; #IMPLIED -- a pointer button was released -- - onmouseover %Script; #IMPLIED -- a pointer was moved onto -- - onmousemove %Script; #IMPLIED -- a pointer was moved within -- - onmouseout %Script; #IMPLIED -- a pointer was moved away -- - onkeypress %Script; #IMPLIED -- a key was pressed and released -- - onkeydown %Script; #IMPLIED -- a key was pressed down -- - onkeyup %Script; #IMPLIED -- a key was released --" - > - -<!-- Reserved Feature Switch --> -<!ENTITY % HTML.Reserved "IGNORE"> - -<!-- The following attributes are reserved for possible future use --> -<![ %HTML.Reserved; [ -<!ENTITY % reserved - "datasrc %URI; #IMPLIED -- a single or tabular Data Source -- - datafld CDATA #IMPLIED -- the property or column name -- - dataformatas (plaintext|html) plaintext -- text or html --" - > -]]> - -<!ENTITY % reserved ""> - -<!ENTITY % attrs "%coreattrs; %i18n; %events;"> - -<!ENTITY % align "align (left|center|right|justify) #IMPLIED" - -- default is left for ltr paragraphs, right for rtl -- - > - -<!--=================== Text Markup ======================================--> - -<!ENTITY % fontstyle - "TT | I | B | U | S | STRIKE | BIG | SMALL"> - -<!ENTITY % phrase "EM | STRONG | DFN | CODE | - SAMP | KBD | VAR | CITE | ABBR | ACRONYM" > - -<!ENTITY % special - "A | IMG | APPLET | OBJECT | FONT | BASEFONT | BR | SCRIPT | - MAP | Q | SUB | SUP | SPAN | BDO | IFRAME"> - -<!ENTITY % formctrl "INPUT | SELECT | TEXTAREA | LABEL | BUTTON"> - -<!-- %inline; covers inline or "text-level" elements --> -<!ENTITY % inline "#PCDATA | %fontstyle; | %phrase; | %special; | %formctrl;"> - -<!ELEMENT (%fontstyle;|%phrase;) - - (%inline;)*> -<!ATTLIST (%fontstyle;|%phrase;) - %attrs; -- %coreattrs, %i18n, %events -- - > - -<!ELEMENT (SUB|SUP) - - (%inline;)* -- subscript, superscript --> -<!ATTLIST (SUB|SUP) - %attrs; -- %coreattrs, %i18n, %events -- - > - -<!ELEMENT SPAN - - (%inline;)* -- generic language/style container --> -<!ATTLIST SPAN - %attrs; -- %coreattrs, %i18n, %events -- - %reserved; -- reserved for possible future use -- - > - -<!ELEMENT BDO - - (%inline;)* -- I18N BiDi over-ride --> -<!ATTLIST BDO - %coreattrs; -- id, class, style, title -- - lang %LanguageCode; #IMPLIED -- language code -- - dir (ltr|rtl) #REQUIRED -- directionality -- - > - -<!ELEMENT BASEFONT - O EMPTY -- base font size --> -<!ATTLIST BASEFONT - id ID #IMPLIED -- document-wide unique id -- - size CDATA #REQUIRED -- base font size for FONT elements -- - color %Color; #IMPLIED -- text color -- - face CDATA #IMPLIED -- comma separated list of font names -- - > - -<!ELEMENT FONT - - (%inline;)* -- local change to font --> -<!ATTLIST FONT - %coreattrs; -- id, class, style, title -- - %i18n; -- lang, dir -- - size CDATA #IMPLIED -- [+|-]nn e.g. size="+1", size="4" -- - color %Color; #IMPLIED -- text color -- - face CDATA #IMPLIED -- comma separated list of font names -- - > - -<!ELEMENT BR - O EMPTY -- forced line break --> -<!ATTLIST BR - %coreattrs; -- id, class, style, title -- - clear (left|all|right|none) none -- control of text flow -- - > - -<!--================== HTML content models ===============================--> - -<!-- - HTML has two basic content models: - - %inline; character level elements and text strings - %block; block-like elements e.g. paragraphs and lists ---> - -<!ENTITY % block - "P | %heading; | %list; | %preformatted; | DL | DIV | CENTER | - NOSCRIPT | NOFRAMES | BLOCKQUOTE | FORM | ISINDEX | HR | - TABLE | FIELDSET | ADDRESS"> - -<!ENTITY % flow "%block; | %inline;"> - -<!--=================== Document Body ====================================--> - -<!ELEMENT BODY O O (%flow;)* +(INS|DEL) -- document body --> -<!ATTLIST BODY - %attrs; -- %coreattrs, %i18n, %events -- - onload %Script; #IMPLIED -- the document has been loaded -- - onunload %Script; #IMPLIED -- the document has been removed -- - background %URI; #IMPLIED -- texture tile for document - background -- - %bodycolors; -- bgcolor, text, link, vlink, alink -- - > - -<!ELEMENT ADDRESS - - ((%inline;)|P)* -- information on author --> -<!ATTLIST ADDRESS - %attrs; -- %coreattrs, %i18n, %events -- - > - -<!ELEMENT DIV - - (%flow;)* -- generic language/style container --> -<!ATTLIST DIV - %attrs; -- %coreattrs, %i18n, %events -- - %align; -- align, text alignment -- - %reserved; -- reserved for possible future use -- - > - -<!ELEMENT CENTER - - (%flow;)* -- shorthand for DIV align=center --> -<!ATTLIST CENTER - %attrs; -- %coreattrs, %i18n, %events -- - > - -<!--================== The Anchor Element ================================--> - -<!ENTITY % Shape "(rect|circle|poly|default)"> -<!ENTITY % Coords "CDATA" -- comma separated list of lengths --> - -<!ELEMENT A - - (%inline;)* -(A) -- anchor --> -<!ATTLIST A - %attrs; -- %coreattrs, %i18n, %events -- - charset %Charset; #IMPLIED -- char encoding of linked resource -- - type %ContentType; #IMPLIED -- advisory content type -- - name CDATA #IMPLIED -- named link end -- - href %URI; #IMPLIED -- URI for linked resource -- - hreflang %LanguageCode; #IMPLIED -- language code -- - target %FrameTarget; #IMPLIED -- render in this frame -- - rel %LinkTypes; #IMPLIED -- forward link types -- - rev %LinkTypes; #IMPLIED -- reverse link types -- - accesskey %Character; #IMPLIED -- accessibility key character -- - shape %Shape; rect -- for use with client-side image maps -- - coords %Coords; #IMPLIED -- for use with client-side image maps -- - tabindex NUMBER #IMPLIED -- position in tabbing order -- - onfocus %Script; #IMPLIED -- the element got the focus -- - onblur %Script; #IMPLIED -- the element lost the focus -- - > - -<!--================== Client-side image maps ============================--> - -<!-- These can be placed in the same document or grouped in a - separate document although this isn't yet widely supported --> - -<!ELEMENT MAP - - ((%block;)+ | AREA+) -- client-side image map --> -<!ATTLIST MAP - %attrs; -- %coreattrs, %i18n, %events -- - name CDATA #REQUIRED -- for reference by usemap -- - > - -<!ELEMENT AREA - O EMPTY -- client-side image map area --> -<!ATTLIST AREA - %attrs; -- %coreattrs, %i18n, %events -- - shape %Shape; rect -- controls interpretation of coords -- - coords %Coords; #IMPLIED -- comma separated list of lengths -- - href %URI; #IMPLIED -- URI for linked resource -- - target %FrameTarget; #IMPLIED -- render in this frame -- - nohref (nohref) #IMPLIED -- this region has no action -- - alt %Text; #REQUIRED -- short description -- - tabindex NUMBER #IMPLIED -- position in tabbing order -- - accesskey %Character; #IMPLIED -- accessibility key character -- - onfocus %Script; #IMPLIED -- the element got the focus -- - onblur %Script; #IMPLIED -- the element lost the focus -- - > - -<!--================== The LINK Element ==================================--> - -<!-- - Relationship values can be used in principle: - - a) for document specific toolbars/menus when used - with the LINK element in document head e.g. - start, contents, previous, next, index, end, help - b) to link to a separate style sheet (rel=stylesheet) - c) to make a link to a script (rel=script) - d) by stylesheets to control how collections of - html nodes are rendered into printed documents - e) to make a link to a printable version of this document - e.g. a postscript or pdf version (rel=alternate media=print) ---> - -<!ELEMENT LINK - O EMPTY -- a media-independent link --> -<!ATTLIST LINK - %attrs; -- %coreattrs, %i18n, %events -- - charset %Charset; #IMPLIED -- char encoding of linked resource -- - href %URI; #IMPLIED -- URI for linked resource -- - hreflang %LanguageCode; #IMPLIED -- language code -- - type %ContentType; #IMPLIED -- advisory content type -- - rel %LinkTypes; #IMPLIED -- forward link types -- - rev %LinkTypes; #IMPLIED -- reverse link types -- - media %MediaDesc; #IMPLIED -- for rendering on these media -- - target %FrameTarget; #IMPLIED -- render in this frame -- - > - -<!--=================== Images ===========================================--> - -<!-- Length defined in strict DTD for cellpadding/cellspacing --> -<!ENTITY % Length "CDATA" -- nn for pixels or nn% for percentage length --> -<!ENTITY % MultiLength "CDATA" -- pixel, percentage, or relative --> - -<!ENTITY % MultiLengths "CDATA" -- comma-separated list of MultiLength --> - -<!ENTITY % Pixels "CDATA" -- integer representing length in pixels --> - -<!ENTITY % IAlign "(top|middle|bottom|left|right)" -- center? --> - -<!-- To avoid problems with text-only UAs as well as - to make image content understandable and navigable - to users of non-visual UAs, you need to provide - a description with ALT, and avoid server-side image maps --> -<!ELEMENT IMG - O EMPTY -- Embedded image --> -<!ATTLIST IMG - %attrs; -- %coreattrs, %i18n, %events -- - src %URI; #REQUIRED -- URI of image to embed -- - alt %Text; #REQUIRED -- short description -- - longdesc %URI; #IMPLIED -- link to long description - (complements alt) -- - height %Length; #IMPLIED -- override height -- - width %Length; #IMPLIED -- override width -- - usemap %URI; #IMPLIED -- use client-side image map -- - ismap (ismap) #IMPLIED -- use server-side image map -- - align %IAlign; #IMPLIED -- vertical or horizontal alignment -- - border %Length; #IMPLIED -- link border width -- - hspace %Pixels; #IMPLIED -- horizontal gutter -- - vspace %Pixels; #IMPLIED -- vertical gutter -- - > - -<!-- USEMAP points to a MAP element which may be in this document - or an external document, although the latter is not widely supported --> - -<!--==================== OBJECT ======================================--> -<!-- - OBJECT is used to embed objects as part of HTML pages - PARAM elements should precede other content. SGML mixed content - model technicality precludes specifying this formally ... ---> - -<!ELEMENT OBJECT - - (PARAM | %flow;)* - -- generic embedded object --> -<!ATTLIST OBJECT - %attrs; -- %coreattrs, %i18n, %events -- - declare (declare) #IMPLIED -- declare but don't instantiate flag -- - classid %URI; #IMPLIED -- identifies an implementation -- - codebase %URI; #IMPLIED -- base URI for classid, data, archive-- - data %URI; #IMPLIED -- reference to object's data -- - type %ContentType; #IMPLIED -- content type for data -- - codetype %ContentType; #IMPLIED -- content type for code -- - archive %URI; #IMPLIED -- space separated archive list -- - standby %Text; #IMPLIED -- message to show while loading -- - height %Length; #IMPLIED -- override height -- - width %Length; #IMPLIED -- override width -- - usemap %URI; #IMPLIED -- use client-side image map -- - name CDATA #IMPLIED -- submit as part of form -- - tabindex NUMBER #IMPLIED -- position in tabbing order -- - align %IAlign; #IMPLIED -- vertical or horizontal alignment -- - border %Length; #IMPLIED -- link border width -- - hspace %Pixels; #IMPLIED -- horizontal gutter -- - vspace %Pixels; #IMPLIED -- vertical gutter -- - %reserved; -- reserved for possible future use -- - > - -<!ELEMENT PARAM - O EMPTY -- named property value --> -<!ATTLIST PARAM - id ID #IMPLIED -- document-wide unique id -- - name CDATA #REQUIRED -- property name -- - value CDATA #IMPLIED -- property value -- - valuetype (DATA|REF|OBJECT) DATA -- How to interpret value -- - type %ContentType; #IMPLIED -- content type for value - when valuetype=ref -- - > - -<!--=================== Java APPLET ==================================--> -<!-- - One of code or object attributes must be present. - Place PARAM elements before other content. ---> -<!ELEMENT APPLET - - (PARAM | %flow;)* -- Java applet --> -<!ATTLIST APPLET - %coreattrs; -- id, class, style, title -- - codebase %URI; #IMPLIED -- optional base URI for applet -- - archive CDATA #IMPLIED -- comma separated archive list -- - code CDATA #IMPLIED -- applet class file -- - object CDATA #IMPLIED -- serialized applet file -- - alt %Text; #IMPLIED -- short description -- - name CDATA #IMPLIED -- allows applets to find each other -- - width %Length; #REQUIRED -- initial width -- - height %Length; #REQUIRED -- initial height -- - align %IAlign; #IMPLIED -- vertical or horizontal alignment -- - hspace %Pixels; #IMPLIED -- horizontal gutter -- - vspace %Pixels; #IMPLIED -- vertical gutter -- - > - -<!--=================== Horizontal Rule ==================================--> - -<!ELEMENT HR - O EMPTY -- horizontal rule --> -<!ATTLIST HR - %coreattrs; -- id, class, style, title -- - %events; - align (left|center|right) #IMPLIED - noshade (noshade) #IMPLIED - size %Pixels; #IMPLIED - width %Length; #IMPLIED - > - -<!--=================== Paragraphs =======================================--> - -<!ELEMENT P - O (%inline;)* -- paragraph --> -<!ATTLIST P - %attrs; -- %coreattrs, %i18n, %events -- - %align; -- align, text alignment -- - > - -<!--=================== Headings =========================================--> - -<!-- - There are six levels of headings from H1 (the most important) - to H6 (the least important). ---> - -<!ELEMENT (%heading;) - - (%inline;)* -- heading --> -<!ATTLIST (%heading;) - %attrs; -- %coreattrs, %i18n, %events -- - %align; -- align, text alignment -- - > - -<!--=================== Preformatted Text ================================--> - -<!-- excludes markup for images and changes in font size --> -<!ENTITY % pre.exclusion "IMG|OBJECT|APPLET|BIG|SMALL|SUB|SUP|FONT|BASEFONT"> - -<!ELEMENT PRE - - (%inline;)* -(%pre.exclusion;) -- preformatted text --> -<!ATTLIST PRE - %attrs; -- %coreattrs, %i18n, %events -- - width NUMBER #IMPLIED - > - -<!--===================== Inline Quotes ==================================--> - -<!ELEMENT Q - - (%inline;)* -- short inline quotation --> -<!ATTLIST Q - %attrs; -- %coreattrs, %i18n, %events -- - cite %URI; #IMPLIED -- URI for source document or msg -- - > - -<!--=================== Block-like Quotes ================================--> - -<!ELEMENT BLOCKQUOTE - - (%flow;)* -- long quotation --> -<!ATTLIST BLOCKQUOTE - %attrs; -- %coreattrs, %i18n, %events -- - cite %URI; #IMPLIED -- URI for source document or msg -- - > - -<!--=================== Inserted/Deleted Text ============================--> - - -<!-- INS/DEL are handled by inclusion on BODY --> -<!ELEMENT (INS|DEL) - - (%flow;)* -- inserted text, deleted text --> -<!ATTLIST (INS|DEL) - %attrs; -- %coreattrs, %i18n, %events -- - cite %URI; #IMPLIED -- info on reason for change -- - datetime %Datetime; #IMPLIED -- date and time of change -- - > - -<!--=================== Lists ============================================--> - -<!-- definition lists - DT for term, DD for its definition --> - -<!ELEMENT DL - - (DT|DD)+ -- definition list --> -<!ATTLIST DL - %attrs; -- %coreattrs, %i18n, %events -- - compact (compact) #IMPLIED -- reduced interitem spacing -- - > - -<!ELEMENT DT - O (%inline;)* -- definition term --> -<!ELEMENT DD - O (%flow;)* -- definition description --> -<!ATTLIST (DT|DD) - %attrs; -- %coreattrs, %i18n, %events -- - > - -<!-- Ordered lists (OL) Numbering style - - 1 arablic numbers 1, 2, 3, ... - a lower alpha a, b, c, ... - A upper alpha A, B, C, ... - i lower roman i, ii, iii, ... - I upper roman I, II, III, ... - - The style is applied to the sequence number which by default - is reset to 1 for the first list item in an ordered list. - - This can't be expressed directly in SGML due to case folding. ---> - -<!ENTITY % OLStyle "CDATA" -- constrained to: "(1|a|A|i|I)" --> - -<!ELEMENT OL - - (LI)+ -- ordered list --> -<!ATTLIST OL - %attrs; -- %coreattrs, %i18n, %events -- - type %OLStyle; #IMPLIED -- numbering style -- - compact (compact) #IMPLIED -- reduced interitem spacing -- - start NUMBER #IMPLIED -- starting sequence number -- - > - -<!-- Unordered Lists (UL) bullet styles --> -<!ENTITY % ULStyle "(disc|square|circle)"> - -<!ELEMENT UL - - (LI)+ -- unordered list --> -<!ATTLIST UL - %attrs; -- %coreattrs, %i18n, %events -- - type %ULStyle; #IMPLIED -- bullet style -- - compact (compact) #IMPLIED -- reduced interitem spacing -- - > - -<!ELEMENT (DIR|MENU) - - (LI)+ -(%block;) -- directory list, menu list --> -<!ATTLIST DIR - %attrs; -- %coreattrs, %i18n, %events -- - compact (compact) #IMPLIED - > -<!ATTLIST MENU - %attrs; -- %coreattrs, %i18n, %events -- - compact (compact) #IMPLIED - > - -<!ENTITY % LIStyle "CDATA" -- constrained to: "(%ULStyle;|%OLStyle;)" --> - -<!ELEMENT LI - O (%flow;)* -- list item --> -<!ATTLIST LI - %attrs; -- %coreattrs, %i18n, %events -- - type %LIStyle; #IMPLIED -- list item style -- - value NUMBER #IMPLIED -- reset sequence number -- - > - -<!--================ Forms ===============================================--> -<!ELEMENT FORM - - (%flow;)* -(FORM) -- interactive form --> -<!ATTLIST FORM - %attrs; -- %coreattrs, %i18n, %events -- - action %URI; #REQUIRED -- server-side form handler -- - method (GET|POST) GET -- HTTP method used to submit the form-- - enctype %ContentType; "application/x-www-form-urlencoded" - onsubmit %Script; #IMPLIED -- the form was submitted -- - onreset %Script; #IMPLIED -- the form was reset -- - target %FrameTarget; #IMPLIED -- render in this frame -- - accept-charset %Charsets; #IMPLIED -- list of supported charsets -- - > - -<!-- Each label must not contain more than ONE field --> -<!ELEMENT LABEL - - (%inline;)* -(LABEL) -- form field label text --> -<!ATTLIST LABEL - %attrs; -- %coreattrs, %i18n, %events -- - for IDREF #IMPLIED -- matches field ID value -- - accesskey %Character; #IMPLIED -- accessibility key character -- - onfocus %Script; #IMPLIED -- the element got the focus -- - onblur %Script; #IMPLIED -- the element lost the focus -- - > - -<!ENTITY % InputType - "(TEXT | PASSWORD | CHECKBOX | - RADIO | SUBMIT | RESET | - FILE | HIDDEN | IMAGE | BUTTON)" - > - -<!-- attribute name required for all but submit & reset --> -<!ELEMENT INPUT - O EMPTY -- form control --> -<!ATTLIST INPUT - %attrs; -- %coreattrs, %i18n, %events -- - type %InputType; TEXT -- what kind of widget is needed -- - name CDATA #IMPLIED -- submit as part of form -- - value CDATA #IMPLIED -- required for radio and checkboxes -- - checked (checked) #IMPLIED -- for radio buttons and check boxes -- - disabled (disabled) #IMPLIED -- unavailable in this context -- - readonly (readonly) #IMPLIED -- for text and passwd -- - size CDATA #IMPLIED -- specific to each type of field -- - maxlength NUMBER #IMPLIED -- max chars for text fields -- - src %URI; #IMPLIED -- for fields with images -- - alt CDATA #IMPLIED -- short description -- - usemap %URI; #IMPLIED -- use client-side image map -- - tabindex NUMBER #IMPLIED -- position in tabbing order -- - accesskey %Character; #IMPLIED -- accessibility key character -- - onfocus %Script; #IMPLIED -- the element got the focus -- - onblur %Script; #IMPLIED -- the element lost the focus -- - onselect %Script; #IMPLIED -- some text was selected -- - onchange %Script; #IMPLIED -- the element value was changed -- - accept %ContentTypes; #IMPLIED -- list of MIME types for file upload -- - align %IAlign; #IMPLIED -- vertical or horizontal alignment -- - %reserved; -- reserved for possible future use -- - > - -<!ELEMENT SELECT - - (OPTGROUP|OPTION)+ -- option selector --> -<!ATTLIST SELECT - %attrs; -- %coreattrs, %i18n, %events -- - name CDATA #IMPLIED -- field name -- - size NUMBER #IMPLIED -- rows visible -- - multiple (multiple) #IMPLIED -- default is single selection -- - disabled (disabled) #IMPLIED -- unavailable in this context -- - tabindex NUMBER #IMPLIED -- position in tabbing order -- - onfocus %Script; #IMPLIED -- the element got the focus -- - onblur %Script; #IMPLIED -- the element lost the focus -- - onchange %Script; #IMPLIED -- the element value was changed -- - %reserved; -- reserved for possible future use -- - > - -<!ELEMENT OPTGROUP - - (OPTION)+ -- option group --> -<!ATTLIST OPTGROUP - %attrs; -- %coreattrs, %i18n, %events -- - disabled (disabled) #IMPLIED -- unavailable in this context -- - label %Text; #REQUIRED -- for use in hierarchical menus -- - > - -<!ELEMENT OPTION - O (#PCDATA) -- selectable choice --> -<!ATTLIST OPTION - %attrs; -- %coreattrs, %i18n, %events -- - selected (selected) #IMPLIED - disabled (disabled) #IMPLIED -- unavailable in this context -- - label %Text; #IMPLIED -- for use in hierarchical menus -- - value CDATA #IMPLIED -- defaults to element content -- - > - -<!ELEMENT TEXTAREA - - (#PCDATA) -- multi-line text field --> -<!ATTLIST TEXTAREA - %attrs; -- %coreattrs, %i18n, %events -- - name CDATA #IMPLIED - rows NUMBER #REQUIRED - cols NUMBER #REQUIRED - disabled (disabled) #IMPLIED -- unavailable in this context -- - readonly (readonly) #IMPLIED - tabindex NUMBER #IMPLIED -- position in tabbing order -- - accesskey %Character; #IMPLIED -- accessibility key character -- - onfocus %Script; #IMPLIED -- the element got the focus -- - onblur %Script; #IMPLIED -- the element lost the focus -- - onselect %Script; #IMPLIED -- some text was selected -- - onchange %Script; #IMPLIED -- the element value was changed -- - %reserved; -- reserved for possible future use -- - > - -<!-- - #PCDATA is to solve the mixed content problem, - per specification only whitespace is allowed there! - --> -<!ELEMENT FIELDSET - - (#PCDATA,LEGEND,(%flow;)*) -- form control group --> -<!ATTLIST FIELDSET - %attrs; -- %coreattrs, %i18n, %events -- - > - -<!ELEMENT LEGEND - - (%inline;)* -- fieldset legend --> -<!ENTITY % LAlign "(top|bottom|left|right)"> - -<!ATTLIST LEGEND - %attrs; -- %coreattrs, %i18n, %events -- - accesskey %Character; #IMPLIED -- accessibility key character -- - align %LAlign; #IMPLIED -- relative to fieldset -- - > - -<!ELEMENT BUTTON - - - (%flow;)* -(A|%formctrl;|FORM|ISINDEX|FIELDSET|IFRAME) - -- push button --> -<!ATTLIST BUTTON - %attrs; -- %coreattrs, %i18n, %events -- - name CDATA #IMPLIED - value CDATA #IMPLIED -- sent to server when submitted -- - type (button|submit|reset) submit -- for use as form button -- - disabled (disabled) #IMPLIED -- unavailable in this context -- - tabindex NUMBER #IMPLIED -- position in tabbing order -- - accesskey %Character; #IMPLIED -- accessibility key character -- - onfocus %Script; #IMPLIED -- the element got the focus -- - onblur %Script; #IMPLIED -- the element lost the focus -- - %reserved; -- reserved for possible future use -- - > - -<!--======================= Tables =======================================--> - -<!-- IETF HTML table standard, see [RFC1942] --> - -<!-- - The BORDER attribute sets the thickness of the frame around the - table. The default units are screen pixels. - - The FRAME attribute specifies which parts of the frame around - the table should be rendered. The values are not the same as - CALS to avoid a name clash with the VALIGN attribute. - - The value "border" is included for backwards compatibility with - <TABLE BORDER> which yields frame=border and border=implied - For <TABLE BORDER=1> you get border=1 and frame=implied. In this - case, it is appropriate to treat this as frame=border for backwards - compatibility with deployed browsers. ---> -<!ENTITY % TFrame "(void|above|below|hsides|lhs|rhs|vsides|box|border)"> - -<!-- - The RULES attribute defines which rules to draw between cells: - - If RULES is absent then assume: - "none" if BORDER is absent or BORDER=0 otherwise "all" ---> - -<!ENTITY % TRules "(none | groups | rows | cols | all)"> - -<!-- horizontal placement of table relative to document --> -<!ENTITY % TAlign "(left|center|right)"> - -<!-- horizontal alignment attributes for cell contents --> -<!ENTITY % cellhalign - "align (left|center|right|justify|char) #IMPLIED - char %Character; #IMPLIED -- alignment char, e.g. char=':' -- - charoff %Length; #IMPLIED -- offset for alignment char --" - > - -<!-- vertical alignment attributes for cell contents --> -<!ENTITY % cellvalign - "valign (top|middle|bottom|baseline) #IMPLIED" - > - -<!ELEMENT TABLE - - - (CAPTION?, (COL*|COLGROUP*), THEAD?, TFOOT?, TBODY+)> -<!ELEMENT CAPTION - - (%inline;)* -- table caption --> -<!ELEMENT THEAD - O (TR)+ -- table header --> -<!ELEMENT TFOOT - O (TR)+ -- table footer --> -<!ELEMENT TBODY O O (TR)+ -- table body --> -<!ELEMENT COLGROUP - O (col)* -- table column group --> -<!ELEMENT COL - O EMPTY -- table column --> -<!ELEMENT TR - O (TH|TD)+ -- table row --> -<!ELEMENT (TH|TD) - O (%flow;)* -- table header cell, table data cell--> - -<!ATTLIST TABLE -- table element -- - %attrs; -- %coreattrs, %i18n, %events -- - summary %Text; #IMPLIED -- purpose/structure for speech output-- - width %Length; #IMPLIED -- table width -- - border %Pixels; #IMPLIED -- controls frame width around table -- - frame %TFrame; #IMPLIED -- which parts of frame to render -- - rules %TRules; #IMPLIED -- rulings between rows and cols -- - cellspacing %Length; #IMPLIED -- spacing between cells -- - cellpadding %Length; #IMPLIED -- spacing within cells -- - align %TAlign; #IMPLIED -- table position relative to window -- - bgcolor %Color; #IMPLIED -- background color for cells -- - %reserved; -- reserved for possible future use -- - datapagesize CDATA #IMPLIED -- reserved for possible future use -- - > - -<!ENTITY % CAlign "(top|bottom|left|right)"> - -<!ATTLIST CAPTION - %attrs; -- %coreattrs, %i18n, %events -- - align %CAlign; #IMPLIED -- relative to table -- - > - -<!-- -COLGROUP groups a set of COL elements. It allows you to group -several semantically related columns together. ---> -<!ATTLIST COLGROUP - %attrs; -- %coreattrs, %i18n, %events -- - span NUMBER 1 -- default number of columns in group -- - width %MultiLength; #IMPLIED -- default width for enclosed COLs -- - %cellhalign; -- horizontal alignment in cells -- - %cellvalign; -- vertical alignment in cells -- - > - -<!-- - COL elements define the alignment properties for cells in - one or more columns. - - The WIDTH attribute specifies the width of the columns, e.g. - - width=64 width in screen pixels - width=0.5* relative width of 0.5 - - The SPAN attribute causes the attributes of one - COL element to apply to more than one column. ---> -<!ATTLIST COL -- column groups and properties -- - %attrs; -- %coreattrs, %i18n, %events -- - span NUMBER 1 -- COL attributes affect N columns -- - width %MultiLength; #IMPLIED -- column width specification -- - %cellhalign; -- horizontal alignment in cells -- - %cellvalign; -- vertical alignment in cells -- - > - -<!-- - Use THEAD to duplicate headers when breaking table - across page boundaries, or for static headers when - TBODY sections are rendered in scrolling panel. - - Use TFOOT to duplicate footers when breaking table - across page boundaries, or for static footers when - TBODY sections are rendered in scrolling panel. - - Use multiple TBODY sections when rules are needed - between groups of table rows. ---> -<!ATTLIST (THEAD|TBODY|TFOOT) -- table section -- - %attrs; -- %coreattrs, %i18n, %events -- - %cellhalign; -- horizontal alignment in cells -- - %cellvalign; -- vertical alignment in cells -- - > - -<!ATTLIST TR -- table row -- - %attrs; -- %coreattrs, %i18n, %events -- - %cellhalign; -- horizontal alignment in cells -- - %cellvalign; -- vertical alignment in cells -- - bgcolor %Color; #IMPLIED -- background color for row -- - > - - -<!-- Scope is simpler than axes attribute for common tables --> -<!ENTITY % Scope "(row|col|rowgroup|colgroup)"> - -<!-- TH is for headers, TD for data, but for cells acting as both use TD --> -<!ATTLIST (TH|TD) -- header or data cell -- - %attrs; -- %coreattrs, %i18n, %events -- - abbr %Text; #IMPLIED -- abbreviation for header cell -- - axis CDATA #IMPLIED -- names groups of related headers-- - headers IDREFS #IMPLIED -- list of id's for header cells -- - scope %Scope; #IMPLIED -- scope covered by header cells -- - rowspan NUMBER 1 -- number of rows spanned by cell -- - colspan NUMBER 1 -- number of cols spanned by cell -- - %cellhalign; -- horizontal alignment in cells -- - %cellvalign; -- vertical alignment in cells -- - nowrap (nowrap) #IMPLIED -- suppress word wrap -- - bgcolor %Color; #IMPLIED -- cell background color -- - width %Pixels; #IMPLIED -- width for cell -- - height %Pixels; #IMPLIED -- height for cell -- - > - -<!--================== Document Frames ===================================--> - -<!-- - The content model for HTML documents depends on whether the HEAD is - followed by a FRAMESET or BODY element. The widespread omission of - the BODY start tag makes it impractical to define the content model - without the use of a marked section. ---> - -<!-- Feature Switch for frameset documents --> -<!ENTITY % HTML.Frameset "IGNORE"> - -<![ %HTML.Frameset; [ -<!ELEMENT FRAMESET - - ((FRAMESET|FRAME)+ & NOFRAMES?) -- window subdivision--> -<!ATTLIST FRAMESET - %coreattrs; -- id, class, style, title -- - rows %MultiLengths; #IMPLIED -- list of lengths, - default: 100% (1 row) -- - cols %MultiLengths; #IMPLIED -- list of lengths, - default: 100% (1 col) -- - onload %Script; #IMPLIED -- all the frames have been loaded -- - onunload %Script; #IMPLIED -- all the frames have been removed -- - > -]]> - -<![ %HTML.Frameset; [ -<!-- reserved frame names start with "_" otherwise starts with letter --> -<!ELEMENT FRAME - O EMPTY -- subwindow --> -<!ATTLIST FRAME - %coreattrs; -- id, class, style, title -- - longdesc %URI; #IMPLIED -- link to long description - (complements title) -- - name CDATA #IMPLIED -- name of frame for targetting -- - src %URI; #IMPLIED -- source of frame content -- - frameborder (1|0) 1 -- request frame borders? -- - marginwidth %Pixels; #IMPLIED -- margin widths in pixels -- - marginheight %Pixels; #IMPLIED -- margin height in pixels -- - noresize (noresize) #IMPLIED -- allow users to resize frames? -- - scrolling (yes|no|auto) auto -- scrollbar or none -- - > -]]> - -<!ELEMENT IFRAME - - (%flow;)* -- inline subwindow --> -<!ATTLIST IFRAME - %coreattrs; -- id, class, style, title -- - longdesc %URI; #IMPLIED -- link to long description - (complements title) -- - name CDATA #IMPLIED -- name of frame for targetting -- - src %URI; #IMPLIED -- source of frame content -- - frameborder (1|0) 1 -- request frame borders? -- - marginwidth %Pixels; #IMPLIED -- margin widths in pixels -- - marginheight %Pixels; #IMPLIED -- margin height in pixels -- - scrolling (yes|no|auto) auto -- scrollbar or none -- - align %IAlign; #IMPLIED -- vertical or horizontal alignment -- - height %Length; #IMPLIED -- frame height -- - width %Length; #IMPLIED -- frame width -- - > - -<![ %HTML.Frameset; [ -<!ENTITY % noframes.content "(BODY) -(NOFRAMES)"> -]]> - -<!ENTITY % noframes.content "(%flow;)*"> - -<!ELEMENT NOFRAMES - - %noframes.content; - -- alternate content container for non frame-based rendering --> -<!ATTLIST NOFRAMES - %attrs; -- %coreattrs, %i18n, %events -- - > - -<!--================ Document Head =======================================--> -<!-- %head.misc; defined earlier on as "SCRIPT|STYLE|META|LINK|OBJECT" --> -<!ENTITY % head.content "TITLE & ISINDEX? & BASE?"> - -<!ELEMENT HEAD O O (%head.content;) +(%head.misc;) -- document head --> -<!ATTLIST HEAD - %i18n; -- lang, dir -- - profile %URI; #IMPLIED -- named dictionary of meta info -- - > - -<!-- The TITLE element is not considered part of the flow of text. - It should be displayed, for example as the page header or - window title. Exactly one title is required per document. - --> -<!ELEMENT TITLE - - (#PCDATA) -(%head.misc;) -- document title --> -<!ATTLIST TITLE %i18n> - -<!ELEMENT ISINDEX - O EMPTY -- single line prompt --> -<!ATTLIST ISINDEX - %coreattrs; -- id, class, style, title -- - %i18n; -- lang, dir -- - prompt %Text; #IMPLIED -- prompt message --> - -<!ELEMENT BASE - O EMPTY -- document base URI --> -<!ATTLIST BASE - href %URI; #IMPLIED -- URI that acts as base URI -- - target %FrameTarget; #IMPLIED -- render in this frame -- - > - -<!ELEMENT META - O EMPTY -- generic metainformation --> -<!ATTLIST META - %i18n; -- lang, dir, for use with content -- - http-equiv NAME #IMPLIED -- HTTP response header name -- - name NAME #IMPLIED -- metainformation name -- - content CDATA #REQUIRED -- associated information -- - scheme CDATA #IMPLIED -- select form of content -- - > - -<!ELEMENT STYLE - - %StyleSheet -- style info --> -<!ATTLIST STYLE - %i18n; -- lang, dir, for use with title -- - type %ContentType; #REQUIRED -- content type of style language -- - media %MediaDesc; #IMPLIED -- designed for use with these media -- - title %Text; #IMPLIED -- advisory title -- - > - -<!ELEMENT SCRIPT - - %Script; -- script statements --> -<!ATTLIST SCRIPT - charset %Charset; #IMPLIED -- char encoding of linked resource -- - type %ContentType; #REQUIRED -- content type of script language -- - language CDATA #IMPLIED -- predefined script language name -- - src %URI; #IMPLIED -- URI for an external script -- - defer (defer) #IMPLIED -- UA may defer execution of script -- - event CDATA #IMPLIED -- reserved for possible future use -- - for %URI; #IMPLIED -- reserved for possible future use -- - > - -<!ELEMENT NOSCRIPT - - (%flow;)* - -- alternate content container for non script-based rendering --> -<!ATTLIST NOSCRIPT - %attrs; -- %coreattrs, %i18n, %events -- - > - -<!--================ Document Structure ==================================--> -<!ENTITY % version "version CDATA #FIXED '%HTML.Version;'"> - -<![ %HTML.Frameset; [ -<!ENTITY % html.content "HEAD, FRAMESET"> -]]> - -<!ENTITY % html.content "HEAD, BODY"> - -<!ELEMENT HTML O O (%html.content;) -- document root element --> -<!ATTLIST HTML - %i18n; -- lang, dir -- - %version; - > diff --git a/packages/sgml/DTD/HTML4.soc b/packages/sgml/DTD/HTML4.soc deleted file mode 100644 index bc40206d5..000000000 --- a/packages/sgml/DTD/HTML4.soc +++ /dev/null @@ -1,6 +0,0 @@ -OVERRIDE YES -SGMLDECL HTML4.dcl -DOCTYPE HTML HTML4.dtd -PUBLIC "-//W3C//ENTITIES Latin1//EN//HTML" HTMLlat1.ent -PUBLIC "-//W3C//ENTITIES Special//EN//HTML" HTMLspec.ent -PUBLIC "-//W3C//ENTITIES Symbols//EN//HTML" HTMLsym.ent diff --git a/packages/sgml/DTD/HTMLlat1.ent b/packages/sgml/DTD/HTMLlat1.ent deleted file mode 100644 index 7632023a8..000000000 --- a/packages/sgml/DTD/HTMLlat1.ent +++ /dev/null @@ -1,195 +0,0 @@ -<!-- Portions (C) International Organization for Standardization 1986 - Permission to copy in any form is granted for use with - conforming SGML systems and applications as defined in - ISO 8879, provided this notice is included in all copies. ---> -<!-- Character entity set. Typical invocation: - <!ENTITY % HTMLlat1 PUBLIC - "-//W3C//ENTITIES Full Latin 1//EN//HTML"> - %HTMLlat1; ---> - -<!ENTITY nbsp CDATA "&#160;" -- no-break space = non-breaking space, - U+00A0 ISOnum --> -<!ENTITY iexcl CDATA "&#161;" -- inverted exclamation mark, U+00A1 ISOnum --> -<!ENTITY cent CDATA "&#162;" -- cent sign, U+00A2 ISOnum --> -<!ENTITY pound CDATA "&#163;" -- pound sign, U+00A3 ISOnum --> -<!ENTITY curren CDATA "&#164;" -- currency sign, U+00A4 ISOnum --> -<!ENTITY yen CDATA "&#165;" -- yen sign = yuan sign, U+00A5 ISOnum --> -<!ENTITY brvbar CDATA "&#166;" -- broken bar = broken vertical bar, - U+00A6 ISOnum --> -<!ENTITY sect CDATA "&#167;" -- section sign, U+00A7 ISOnum --> -<!ENTITY uml CDATA "&#168;" -- diaeresis = spacing diaeresis, - U+00A8 ISOdia --> -<!ENTITY copy CDATA "&#169;" -- copyright sign, U+00A9 ISOnum --> -<!ENTITY ordf CDATA "&#170;" -- feminine ordinal indicator, U+00AA ISOnum --> -<!ENTITY laquo CDATA "&#171;" -- left-pointing double angle quotation mark - = left pointing guillemet, U+00AB ISOnum --> -<!ENTITY not CDATA "&#172;" -- not sign = discretionary hyphen, - U+00AC ISOnum --> -<!ENTITY shy CDATA "&#173;" -- soft hyphen = discretionary hyphen, - U+00AD ISOnum --> -<!ENTITY reg CDATA "&#174;" -- registered sign = registered trade mark sign, - U+00AE ISOnum --> -<!ENTITY macr CDATA "&#175;" -- macron = spacing macron = overline - = APL overbar, U+00AF ISOdia --> -<!ENTITY deg CDATA "&#176;" -- degree sign, U+00B0 ISOnum --> -<!ENTITY plusmn CDATA "&#177;" -- plus-minus sign = plus-or-minus sign, - U+00B1 ISOnum --> -<!ENTITY sup2 CDATA "&#178;" -- superscript two = superscript digit two - = squared, U+00B2 ISOnum --> -<!ENTITY sup3 CDATA "&#179;" -- superscript three = superscript digit three - = cubed, U+00B3 ISOnum --> -<!ENTITY acute CDATA "&#180;" -- acute accent = spacing acute, - U+00B4 ISOdia --> -<!ENTITY micro CDATA "&#181;" -- micro sign, U+00B5 ISOnum --> -<!ENTITY para CDATA "&#182;" -- pilcrow sign = paragraph sign, - U+00B6 ISOnum --> -<!ENTITY middot CDATA "&#183;" -- middle dot = Georgian comma - = Greek middle dot, U+00B7 ISOnum --> -<!ENTITY cedil CDATA "&#184;" -- cedilla = spacing cedilla, U+00B8 ISOdia --> -<!ENTITY sup1 CDATA "&#185;" -- superscript one = superscript digit one, - U+00B9 ISOnum --> -<!ENTITY ordm CDATA "&#186;" -- masculine ordinal indicator, - U+00BA ISOnum --> -<!ENTITY raquo CDATA "&#187;" -- right-pointing double angle quotation mark - = right pointing guillemet, U+00BB ISOnum --> -<!ENTITY frac14 CDATA "&#188;" -- vulgar fraction one quarter - = fraction one quarter, U+00BC ISOnum --> -<!ENTITY frac12 CDATA "&#189;" -- vulgar fraction one half - = fraction one half, U+00BD ISOnum --> -<!ENTITY frac34 CDATA "&#190;" -- vulgar fraction three quarters - = fraction three quarters, U+00BE ISOnum --> -<!ENTITY iquest CDATA "&#191;" -- inverted question mark - = turned question mark, U+00BF ISOnum --> -<!ENTITY Agrave CDATA "&#192;" -- latin capital letter A with grave - = latin capital letter A grave, - U+00C0 ISOlat1 --> -<!ENTITY Aacute CDATA "&#193;" -- latin capital letter A with acute, - U+00C1 ISOlat1 --> -<!ENTITY Acirc CDATA "&#194;" -- latin capital letter A with circumflex, - U+00C2 ISOlat1 --> -<!ENTITY Atilde CDATA "&#195;" -- latin capital letter A with tilde, - U+00C3 ISOlat1 --> -<!ENTITY Auml CDATA "&#196;" -- latin capital letter A with diaeresis, - U+00C4 ISOlat1 --> -<!ENTITY Aring CDATA "&#197;" -- latin capital letter A with ring above - = latin capital letter A ring, - U+00C5 ISOlat1 --> -<!ENTITY AElig CDATA "&#198;" -- latin capital letter AE - = latin capital ligature AE, - U+00C6 ISOlat1 --> -<!ENTITY Ccedil CDATA "&#199;" -- latin capital letter C with cedilla, - U+00C7 ISOlat1 --> -<!ENTITY Egrave CDATA "&#200;" -- latin capital letter E with grave, - U+00C8 ISOlat1 --> -<!ENTITY Eacute CDATA "&#201;" -- latin capital letter E with acute, - U+00C9 ISOlat1 --> -<!ENTITY Ecirc CDATA "&#202;" -- latin capital letter E with circumflex, - U+00CA ISOlat1 --> -<!ENTITY Euml CDATA "&#203;" -- latin capital letter E with diaeresis, - U+00CB ISOlat1 --> -<!ENTITY Igrave CDATA "&#204;" -- latin capital letter I with grave, - U+00CC ISOlat1 --> -<!ENTITY Iacute CDATA "&#205;" -- latin capital letter I with acute, - U+00CD ISOlat1 --> -<!ENTITY Icirc CDATA "&#206;" -- latin capital letter I with circumflex, - U+00CE ISOlat1 --> -<!ENTITY Iuml CDATA "&#207;" -- latin capital letter I with diaeresis, - U+00CF ISOlat1 --> -<!ENTITY ETH CDATA "&#208;" -- latin capital letter ETH, U+00D0 ISOlat1 --> -<!ENTITY Ntilde CDATA "&#209;" -- latin capital letter N with tilde, - U+00D1 ISOlat1 --> -<!ENTITY Ograve CDATA "&#210;" -- latin capital letter O with grave, - U+00D2 ISOlat1 --> -<!ENTITY Oacute CDATA "&#211;" -- latin capital letter O with acute, - U+00D3 ISOlat1 --> -<!ENTITY Ocirc CDATA "&#212;" -- latin capital letter O with circumflex, - U+00D4 ISOlat1 --> -<!ENTITY Otilde CDATA "&#213;" -- latin capital letter O with tilde, - U+00D5 ISOlat1 --> -<!ENTITY Ouml CDATA "&#214;" -- latin capital letter O with diaeresis, - U+00D6 ISOlat1 --> -<!ENTITY times CDATA "&#215;" -- multiplication sign, U+00D7 ISOnum --> -<!ENTITY Oslash CDATA "&#216;" -- latin capital letter O with stroke - = latin capital letter O slash, - U+00D8 ISOlat1 --> -<!ENTITY Ugrave CDATA "&#217;" -- latin capital letter U with grave, - U+00D9 ISOlat1 --> -<!ENTITY Uacute CDATA "&#218;" -- latin capital letter U with acute, - U+00DA ISOlat1 --> -<!ENTITY Ucirc CDATA "&#219;" -- latin capital letter U with circumflex, - U+00DB ISOlat1 --> -<!ENTITY Uuml CDATA "&#220;" -- latin capital letter U with diaeresis, - U+00DC ISOlat1 --> -<!ENTITY Yacute CDATA "&#221;" -- latin capital letter Y with acute, - U+00DD ISOlat1 --> -<!ENTITY THORN CDATA "&#222;" -- latin capital letter THORN, - U+00DE ISOlat1 --> -<!ENTITY szlig CDATA "&#223;" -- latin small letter sharp s = ess-zed, - U+00DF ISOlat1 --> -<!ENTITY agrave CDATA "&#224;" -- latin small letter a with grave - = latin small letter a grave, - U+00E0 ISOlat1 --> -<!ENTITY aacute CDATA "&#225;" -- latin small letter a with acute, - U+00E1 ISOlat1 --> -<!ENTITY acirc CDATA "&#226;" -- latin small letter a with circumflex, - U+00E2 ISOlat1 --> -<!ENTITY atilde CDATA "&#227;" -- latin small letter a with tilde, - U+00E3 ISOlat1 --> -<!ENTITY auml CDATA "&#228;" -- latin small letter a with diaeresis, - U+00E4 ISOlat1 --> -<!ENTITY aring CDATA "&#229;" -- latin small letter a with ring above - = latin small letter a ring, - U+00E5 ISOlat1 --> -<!ENTITY aelig CDATA "&#230;" -- latin small letter ae - = latin small ligature ae, U+00E6 ISOlat1 --> -<!ENTITY ccedil CDATA "&#231;" -- latin small letter c with cedilla, - U+00E7 ISOlat1 --> -<!ENTITY egrave CDATA "&#232;" -- latin small letter e with grave, - U+00E8 ISOlat1 --> -<!ENTITY eacute CDATA "&#233;" -- latin small letter e with acute, - U+00E9 ISOlat1 --> -<!ENTITY ecirc CDATA "&#234;" -- latin small letter e with circumflex, - U+00EA ISOlat1 --> -<!ENTITY euml CDATA "&#235;" -- latin small letter e with diaeresis, - U+00EB ISOlat1 --> -<!ENTITY igrave CDATA "&#236;" -- latin small letter i with grave, - U+00EC ISOlat1 --> -<!ENTITY iacute CDATA "&#237;" -- latin small letter i with acute, - U+00ED ISOlat1 --> -<!ENTITY icirc CDATA "&#238;" -- latin small letter i with circumflex, - U+00EE ISOlat1 --> -<!ENTITY iuml CDATA "&#239;" -- latin small letter i with diaeresis, - U+00EF ISOlat1 --> -<!ENTITY eth CDATA "&#240;" -- latin small letter eth, U+00F0 ISOlat1 --> -<!ENTITY ntilde CDATA "&#241;" -- latin small letter n with tilde, - U+00F1 ISOlat1 --> -<!ENTITY ograve CDATA "&#242;" -- latin small letter o with grave, - U+00F2 ISOlat1 --> -<!ENTITY oacute CDATA "&#243;" -- latin small letter o with acute, - U+00F3 ISOlat1 --> -<!ENTITY ocirc CDATA "&#244;" -- latin small letter o with circumflex, - U+00F4 ISOlat1 --> -<!ENTITY otilde CDATA "&#245;" -- latin small letter o with tilde, - U+00F5 ISOlat1 --> -<!ENTITY ouml CDATA "&#246;" -- latin small letter o with diaeresis, - U+00F6 ISOlat1 --> -<!ENTITY divide CDATA "&#247;" -- division sign, U+00F7 ISOnum --> -<!ENTITY oslash CDATA "&#248;" -- latin small letter o with stroke, - = latin small letter o slash, - U+00F8 ISOlat1 --> -<!ENTITY ugrave CDATA "&#249;" -- latin small letter u with grave, - U+00F9 ISOlat1 --> -<!ENTITY uacute CDATA "&#250;" -- latin small letter u with acute, - U+00FA ISOlat1 --> -<!ENTITY ucirc CDATA "&#251;" -- latin small letter u with circumflex, - U+00FB ISOlat1 --> -<!ENTITY uuml CDATA "&#252;" -- latin small letter u with diaeresis, - U+00FC ISOlat1 --> -<!ENTITY yacute CDATA "&#253;" -- latin small letter y with acute, - U+00FD ISOlat1 --> -<!ENTITY thorn CDATA "&#254;" -- latin small letter thorn with, - U+00FE ISOlat1 --> -<!ENTITY yuml CDATA "&#255;" -- latin small letter y with diaeresis, - U+00FF ISOlat1 --> \ No newline at end of file diff --git a/packages/sgml/DTD/HTMLspec.ent b/packages/sgml/DTD/HTMLspec.ent deleted file mode 100644 index 29011cc2b..000000000 --- a/packages/sgml/DTD/HTMLspec.ent +++ /dev/null @@ -1,77 +0,0 @@ -<!-- Special characters for HTML --> - -<!-- Character entity set. Typical invocation: - <!ENTITY % HTMLspecial PUBLIC - "-//W3C//ENTITIES Special//EN//HTML"> - %HTMLspecial; --> - -<!-- Portions (C) International Organization for Standardization 1986: - Permission to copy in any form is granted for use with - conforming SGML systems and applications as defined in - ISO 8879, provided this notice is included in all copies. ---> - -<!-- Relevant ISO entity set is given unless names are newly introduced. - New names (i.e., not in ISO 8879 list) do not clash with any - existing ISO 8879 entity names. ISO 10646 character numbers - are given for each character, in hex. CDATA values are decimal - conversions of the ISO 10646 values and refer to the document - character set. Names are Unicode 2.0 names. - ---> - -<!-- C0 Controls and Basic Latin --> -<!ENTITY quot CDATA "&#34;" -- quotation mark = APL quote, - U+0022 ISOnum --> -<!ENTITY amp CDATA "&#38;" -- ampersand, U+0026 ISOnum --> -<!ENTITY lt CDATA "&#60;" -- less-than sign, U+003C ISOnum --> -<!ENTITY gt CDATA "&#62;" -- greater-than sign, U+003E ISOnum --> - -<!-- Latin Extended-A --> -<!ENTITY OElig CDATA "&#338;" -- latin capital ligature OE, - U+0152 ISOlat2 --> -<!ENTITY oelig CDATA "&#339;" -- latin small ligature oe, U+0153 ISOlat2 --> -<!-- ligature is a misnomer, this is a separate character in some languages --> -<!ENTITY Scaron CDATA "&#352;" -- latin capital letter S with caron, - U+0160 ISOlat2 --> -<!ENTITY scaron CDATA "&#353;" -- latin small letter s with caron, - U+0161 ISOlat2 --> -<!ENTITY Yuml CDATA "&#376;" -- latin capital letter Y with diaeresis, - U+0178 ISOlat2 --> - -<!-- Spacing Modifier Letters --> -<!ENTITY circ CDATA "&#710;" -- modifier letter circumflex accent, - U+02C6 ISOpub --> -<!ENTITY tilde CDATA "&#732;" -- small tilde, U+02DC ISOdia --> - -<!-- General Punctuation --> -<!ENTITY ensp CDATA "&#8194;" -- en space, U+2002 ISOpub --> -<!ENTITY emsp CDATA "&#8195;" -- em space, U+2003 ISOpub --> -<!ENTITY thinsp CDATA "&#8201;" -- thin space, U+2009 ISOpub --> -<!ENTITY zwnj CDATA "&#8204;" -- zero width non-joiner, - U+200C NEW RFC 2070 --> -<!ENTITY zwj CDATA "&#8205;" -- zero width joiner, U+200D NEW RFC 2070 --> -<!ENTITY lrm CDATA "&#8206;" -- left-to-right mark, U+200E NEW RFC 2070 --> -<!ENTITY rlm CDATA "&#8207;" -- right-to-left mark, U+200F NEW RFC 2070 --> -<!ENTITY ndash CDATA "&#8211;" -- en dash, U+2013 ISOpub --> -<!ENTITY mdash CDATA "&#8212;" -- em dash, U+2014 ISOpub --> -<!ENTITY lsquo CDATA "&#8216;" -- left single quotation mark, - U+2018 ISOnum --> -<!ENTITY rsquo CDATA "&#8217;" -- right single quotation mark, - U+2019 ISOnum --> -<!ENTITY sbquo CDATA "&#8218;" -- single low-9 quotation mark, U+201A NEW --> -<!ENTITY ldquo CDATA "&#8220;" -- left double quotation mark, - U+201C ISOnum --> -<!ENTITY rdquo CDATA "&#8221;" -- right double quotation mark, - U+201D ISOnum --> -<!ENTITY bdquo CDATA "&#8222;" -- double low-9 quotation mark, U+201E NEW --> -<!ENTITY dagger CDATA "&#8224;" -- dagger, U+2020 ISOpub --> -<!ENTITY Dagger CDATA "&#8225;" -- double dagger, U+2021 ISOpub --> -<!ENTITY permil CDATA "&#8240;" -- per mille sign, U+2030 ISOtech --> -<!ENTITY lsaquo CDATA "&#8249;" -- single left-pointing angle quotation mark, - U+2039 ISO proposed --> -<!-- lsaquo is proposed but not yet ISO standardized --> -<!ENTITY rsaquo CDATA "&#8250;" -- single right-pointing angle quotation mark, - U+203A ISO proposed --> -<!-- rsaquo is proposed but not yet ISO standardized --> -<!ENTITY euro CDATA "&#8364;" -- euro sign, U+20AC NEW --> \ No newline at end of file diff --git a/packages/sgml/DTD/HTMLsym.ent b/packages/sgml/DTD/HTMLsym.ent deleted file mode 100644 index 2a6250ba9..000000000 --- a/packages/sgml/DTD/HTMLsym.ent +++ /dev/null @@ -1,241 +0,0 @@ -<!-- Mathematical, Greek and Symbolic characters for HTML --> - -<!-- Character entity set. Typical invocation: - <!ENTITY % HTMLsymbol PUBLIC - "-//W3C//ENTITIES Symbolic//EN//HTML"> - %HTMLsymbol; --> - -<!-- Portions (C) International Organization for Standardization 1986: - Permission to copy in any form is granted for use with - conforming SGML systems and applications as defined in - ISO 8879, provided this notice is included in all copies. ---> - -<!-- Relevant ISO entity set is given unless names are newly introduced. - New names (i.e., not in ISO 8879 list) do not clash with any - existing ISO 8879 entity names. ISO 10646 character numbers - are given for each character, in hex. CDATA values are decimal - conversions of the ISO 10646 values and refer to the document - character set. Names are Unicode 2.0 names. - ---> - -<!-- Latin Extended-B --> -<!ENTITY fnof CDATA "&#402;" -- latin small f with hook = function - = florin, U+0192 ISOtech --> - -<!-- Greek --> -<!ENTITY Alpha CDATA "&#913;" -- greek capital letter alpha, U+0391 --> -<!ENTITY Beta CDATA "&#914;" -- greek capital letter beta, U+0392 --> -<!ENTITY Gamma CDATA "&#915;" -- greek capital letter gamma, - U+0393 ISOgrk3 --> -<!ENTITY Delta CDATA "&#916;" -- greek capital letter delta, - U+0394 ISOgrk3 --> -<!ENTITY Epsilon CDATA "&#917;" -- greek capital letter epsilon, U+0395 --> -<!ENTITY Zeta CDATA "&#918;" -- greek capital letter zeta, U+0396 --> -<!ENTITY Eta CDATA "&#919;" -- greek capital letter eta, U+0397 --> -<!ENTITY Theta CDATA "&#920;" -- greek capital letter theta, - U+0398 ISOgrk3 --> -<!ENTITY Iota CDATA "&#921;" -- greek capital letter iota, U+0399 --> -<!ENTITY Kappa CDATA "&#922;" -- greek capital letter kappa, U+039A --> -<!ENTITY Lambda CDATA "&#923;" -- greek capital letter lambda, - U+039B ISOgrk3 --> -<!ENTITY Mu CDATA "&#924;" -- greek capital letter mu, U+039C --> -<!ENTITY Nu CDATA "&#925;" -- greek capital letter nu, U+039D --> -<!ENTITY Xi CDATA "&#926;" -- greek capital letter xi, U+039E ISOgrk3 --> -<!ENTITY Omicron CDATA "&#927;" -- greek capital letter omicron, U+039F --> -<!ENTITY Pi CDATA "&#928;" -- greek capital letter pi, U+03A0 ISOgrk3 --> -<!ENTITY Rho CDATA "&#929;" -- greek capital letter rho, U+03A1 --> -<!-- there is no Sigmaf, and no U+03A2 character either --> -<!ENTITY Sigma CDATA "&#931;" -- greek capital letter sigma, - U+03A3 ISOgrk3 --> -<!ENTITY Tau CDATA "&#932;" -- greek capital letter tau, U+03A4 --> -<!ENTITY Upsilon CDATA "&#933;" -- greek capital letter upsilon, - U+03A5 ISOgrk3 --> -<!ENTITY Phi CDATA "&#934;" -- greek capital letter phi, - U+03A6 ISOgrk3 --> -<!ENTITY Chi CDATA "&#935;" -- greek capital letter chi, U+03A7 --> -<!ENTITY Psi CDATA "&#936;" -- greek capital letter psi, - U+03A8 ISOgrk3 --> -<!ENTITY Omega CDATA "&#937;" -- greek capital letter omega, - U+03A9 ISOgrk3 --> - -<!ENTITY alpha CDATA "&#945;" -- greek small letter alpha, - U+03B1 ISOgrk3 --> -<!ENTITY beta CDATA "&#946;" -- greek small letter beta, U+03B2 ISOgrk3 --> -<!ENTITY gamma CDATA "&#947;" -- greek small letter gamma, - U+03B3 ISOgrk3 --> -<!ENTITY delta CDATA "&#948;" -- greek small letter delta, - U+03B4 ISOgrk3 --> -<!ENTITY epsilon CDATA "&#949;" -- greek small letter epsilon, - U+03B5 ISOgrk3 --> -<!ENTITY zeta CDATA "&#950;" -- greek small letter zeta, U+03B6 ISOgrk3 --> -<!ENTITY eta CDATA "&#951;" -- greek small letter eta, U+03B7 ISOgrk3 --> -<!ENTITY theta CDATA "&#952;" -- greek small letter theta, - U+03B8 ISOgrk3 --> -<!ENTITY iota CDATA "&#953;" -- greek small letter iota, U+03B9 ISOgrk3 --> -<!ENTITY kappa CDATA "&#954;" -- greek small letter kappa, - U+03BA ISOgrk3 --> -<!ENTITY lambda CDATA "&#955;" -- greek small letter lambda, - U+03BB ISOgrk3 --> -<!ENTITY mu CDATA "&#956;" -- greek small letter mu, U+03BC ISOgrk3 --> -<!ENTITY nu CDATA "&#957;" -- greek small letter nu, U+03BD ISOgrk3 --> -<!ENTITY xi CDATA "&#958;" -- greek small letter xi, U+03BE ISOgrk3 --> -<!ENTITY omicron CDATA "&#959;" -- greek small letter omicron, U+03BF NEW --> -<!ENTITY pi CDATA "&#960;" -- greek small letter pi, U+03C0 ISOgrk3 --> -<!ENTITY rho CDATA "&#961;" -- greek small letter rho, U+03C1 ISOgrk3 --> -<!ENTITY sigmaf CDATA "&#962;" -- greek small letter final sigma, - U+03C2 ISOgrk3 --> -<!ENTITY sigma CDATA "&#963;" -- greek small letter sigma, - U+03C3 ISOgrk3 --> -<!ENTITY tau CDATA "&#964;" -- greek small letter tau, U+03C4 ISOgrk3 --> -<!ENTITY upsilon CDATA "&#965;" -- greek small letter upsilon, - U+03C5 ISOgrk3 --> -<!ENTITY phi CDATA "&#966;" -- greek small letter phi, U+03C6 ISOgrk3 --> -<!ENTITY chi CDATA "&#967;" -- greek small letter chi, U+03C7 ISOgrk3 --> -<!ENTITY psi CDATA "&#968;" -- greek small letter psi, U+03C8 ISOgrk3 --> -<!ENTITY omega CDATA "&#969;" -- greek small letter omega, - U+03C9 ISOgrk3 --> -<!ENTITY thetasym CDATA "&#977;" -- greek small letter theta symbol, - U+03D1 NEW --> -<!ENTITY upsih CDATA "&#978;" -- greek upsilon with hook symbol, - U+03D2 NEW --> -<!ENTITY piv CDATA "&#982;" -- greek pi symbol, U+03D6 ISOgrk3 --> - -<!-- General Punctuation --> -<!ENTITY bull CDATA "&#8226;" -- bullet = black small circle, - U+2022 ISOpub --> -<!-- bullet is NOT the same as bullet operator, U+2219 --> -<!ENTITY hellip CDATA "&#8230;" -- horizontal ellipsis = three dot leader, - U+2026 ISOpub --> -<!ENTITY prime CDATA "&#8242;" -- prime = minutes = feet, U+2032 ISOtech --> -<!ENTITY Prime CDATA "&#8243;" -- double prime = seconds = inches, - U+2033 ISOtech --> -<!ENTITY oline CDATA "&#8254;" -- overline = spacing overscore, - U+203E NEW --> -<!ENTITY frasl CDATA "&#8260;" -- fraction slash, U+2044 NEW --> - -<!-- Letterlike Symbols --> -<!ENTITY weierp CDATA "&#8472;" -- script capital P = power set - = Weierstrass p, U+2118 ISOamso --> -<!ENTITY image CDATA "&#8465;" -- blackletter capital I = imaginary part, - U+2111 ISOamso --> -<!ENTITY real CDATA "&#8476;" -- blackletter capital R = real part symbol, - U+211C ISOamso --> -<!ENTITY trade CDATA "&#8482;" -- trade mark sign, U+2122 ISOnum --> -<!ENTITY alefsym CDATA "&#8501;" -- alef symbol = first transfinite cardinal, - U+2135 NEW --> -<!-- alef symbol is NOT the same as hebrew letter alef, - U+05D0 although the same glyph could be used to depict both characters --> - -<!-- Arrows --> -<!ENTITY larr CDATA "&#8592;" -- leftwards arrow, U+2190 ISOnum --> -<!ENTITY uarr CDATA "&#8593;" -- upwards arrow, U+2191 ISOnum--> -<!ENTITY rarr CDATA "&#8594;" -- rightwards arrow, U+2192 ISOnum --> -<!ENTITY darr CDATA "&#8595;" -- downwards arrow, U+2193 ISOnum --> -<!ENTITY harr CDATA "&#8596;" -- left right arrow, U+2194 ISOamsa --> -<!ENTITY crarr CDATA "&#8629;" -- downwards arrow with corner leftwards - = carriage return, U+21B5 NEW --> -<!ENTITY lArr CDATA "&#8656;" -- leftwards double arrow, U+21D0 ISOtech --> -<!-- Unicode does not say that lArr is the same as the 'is implied by' arrow - but also does not have any other character for that function. So ? lArr can - be used for 'is implied by' as ISOtech suggests --> -<!ENTITY uArr CDATA "&#8657;" -- upwards double arrow, U+21D1 ISOamsa --> -<!ENTITY rArr CDATA "&#8658;" -- rightwards double arrow, - U+21D2 ISOtech --> -<!-- Unicode does not say this is the 'implies' character but does not have - another character with this function so ? - rArr can be used for 'implies' as ISOtech suggests --> -<!ENTITY dArr CDATA "&#8659;" -- downwards double arrow, U+21D3 ISOamsa --> -<!ENTITY hArr CDATA "&#8660;" -- left right double arrow, - U+21D4 ISOamsa --> - -<!-- Mathematical Operators --> -<!ENTITY forall CDATA "&#8704;" -- for all, U+2200 ISOtech --> -<!ENTITY part CDATA "&#8706;" -- partial differential, U+2202 ISOtech --> -<!ENTITY exist CDATA "&#8707;" -- there exists, U+2203 ISOtech --> -<!ENTITY empty CDATA "&#8709;" -- empty set = null set = diameter, - U+2205 ISOamso --> -<!ENTITY nabla CDATA "&#8711;" -- nabla = backward difference, - U+2207 ISOtech --> -<!ENTITY isin CDATA "&#8712;" -- element of, U+2208 ISOtech --> -<!ENTITY notin CDATA "&#8713;" -- not an element of, U+2209 ISOtech --> -<!ENTITY ni CDATA "&#8715;" -- contains as member, U+220B ISOtech --> -<!-- should there be a more memorable name than 'ni'? --> -<!ENTITY prod CDATA "&#8719;" -- n-ary product = product sign, - U+220F ISOamsb --> -<!-- prod is NOT the same character as U+03A0 'greek capital letter pi' though - the same glyph might be used for both --> -<!ENTITY sum CDATA "&#8721;" -- n-ary sumation, U+2211 ISOamsb --> -<!-- sum is NOT the same character as U+03A3 'greek capital letter sigma' - though the same glyph might be used for both --> -<!ENTITY minus CDATA "&#8722;" -- minus sign, U+2212 ISOtech --> -<!ENTITY lowast CDATA "&#8727;" -- asterisk operator, U+2217 ISOtech --> -<!ENTITY radic CDATA "&#8730;" -- square root = radical sign, - U+221A ISOtech --> -<!ENTITY prop CDATA "&#8733;" -- proportional to, U+221D ISOtech --> -<!ENTITY infin CDATA "&#8734;" -- infinity, U+221E ISOtech --> -<!ENTITY ang CDATA "&#8736;" -- angle, U+2220 ISOamso --> -<!ENTITY and CDATA "&#8743;" -- logical and = wedge, U+2227 ISOtech --> -<!ENTITY or CDATA "&#8744;" -- logical or = vee, U+2228 ISOtech --> -<!ENTITY cap CDATA "&#8745;" -- intersection = cap, U+2229 ISOtech --> -<!ENTITY cup CDATA "&#8746;" -- union = cup, U+222A ISOtech --> -<!ENTITY int CDATA "&#8747;" -- integral, U+222B ISOtech --> -<!ENTITY there4 CDATA "&#8756;" -- therefore, U+2234 ISOtech --> -<!ENTITY sim CDATA "&#8764;" -- tilde operator = varies with = similar to, - U+223C ISOtech --> -<!-- tilde operator is NOT the same character as the tilde, U+007E, - although the same glyph might be used to represent both --> -<!ENTITY cong CDATA "&#8773;" -- approximately equal to, U+2245 ISOtech --> -<!ENTITY asymp CDATA "&#8776;" -- almost equal to = asymptotic to, - U+2248 ISOamsr --> -<!ENTITY ne CDATA "&#8800;" -- not equal to, U+2260 ISOtech --> -<!ENTITY equiv CDATA "&#8801;" -- identical to, U+2261 ISOtech --> -<!ENTITY le CDATA "&#8804;" -- less-than or equal to, U+2264 ISOtech --> -<!ENTITY ge CDATA "&#8805;" -- greater-than or equal to, - U+2265 ISOtech --> -<!ENTITY sub CDATA "&#8834;" -- subset of, U+2282 ISOtech --> -<!ENTITY sup CDATA "&#8835;" -- superset of, U+2283 ISOtech --> -<!-- note that nsup, 'not a superset of, U+2283' is not covered by the Symbol - font encoding and is not included. Should it be, for symmetry? - It is in ISOamsn --> -<!ENTITY nsub CDATA "&#8836;" -- not a subset of, U+2284 ISOamsn --> -<!ENTITY sube CDATA "&#8838;" -- subset of or equal to, U+2286 ISOtech --> -<!ENTITY supe CDATA "&#8839;" -- superset of or equal to, - U+2287 ISOtech --> -<!ENTITY oplus CDATA "&#8853;" -- circled plus = direct sum, - U+2295 ISOamsb --> -<!ENTITY otimes CDATA "&#8855;" -- circled times = vector product, - U+2297 ISOamsb --> -<!ENTITY perp CDATA "&#8869;" -- up tack = orthogonal to = perpendicular, - U+22A5 ISOtech --> -<!ENTITY sdot CDATA "&#8901;" -- dot operator, U+22C5 ISOamsb --> -<!-- dot operator is NOT the same character as U+00B7 middle dot --> - -<!-- Miscellaneous Technical --> -<!ENTITY lceil CDATA "&#8968;" -- left ceiling = apl upstile, - U+2308 ISOamsc --> -<!ENTITY rceil CDATA "&#8969;" -- right ceiling, U+2309 ISOamsc --> -<!ENTITY lfloor CDATA "&#8970;" -- left floor = apl downstile, - U+230A ISOamsc --> -<!ENTITY rfloor CDATA "&#8971;" -- right floor, U+230B ISOamsc --> -<!ENTITY lang CDATA "&#9001;" -- left-pointing angle bracket = bra, - U+2329 ISOtech --> -<!-- lang is NOT the same character as U+003C 'less than' - or U+2039 'single left-pointing angle quotation mark' --> -<!ENTITY rang CDATA "&#9002;" -- right-pointing angle bracket = ket, - U+232A ISOtech --> -<!-- rang is NOT the same character as U+003E 'greater than' - or U+203A 'single right-pointing angle quotation mark' --> - -<!-- Geometric Shapes --> -<!ENTITY loz CDATA "&#9674;" -- lozenge, U+25CA ISOpub --> - -<!-- Miscellaneous Symbols --> -<!ENTITY spades CDATA "&#9824;" -- black spade suit, U+2660 ISOpub --> -<!-- black here seems to mean filled as opposed to hollow --> -<!ENTITY clubs CDATA "&#9827;" -- black club suit = shamrock, - U+2663 ISOpub --> -<!ENTITY hearts CDATA "&#9829;" -- black heart suit = valentine, - U+2665 ISOpub --> -<!ENTITY diams CDATA "&#9830;" -- black diamond suit, U+2666 ISOpub --> \ No newline at end of file diff --git a/packages/sgml/FILES b/packages/sgml/FILES deleted file mode 100644 index 5f58b0bb0..000000000 --- a/packages/sgml/FILES +++ /dev/null @@ -1,20 +0,0 @@ -Files in the SGML/XML parser: - -catalog.c Handle SGML_CATALOG_FILES -catalog.h -charmap.c Character classification and mapping -dtd.h Include file for DTD primitives -dtd2pl.c Main file for dtd2pl: convert DTD to Prolog -error.c Utilities for generating Prolog exceptions -error.h -model.c State engine for handling DDT content model -model.h -parser.c The parser itself -parser.h -prolog.c Print DTD in Prolog source (used by dtd2pl) -prolog.h -sgml.c Main file for sgml (stand-alone parser) -sgml2pl.c SWI-Prolog foreign code wrapper -sgmldefs.h General definitions -util.c Basic character handling and utilities -util.h diff --git a/packages/sgml/INSTALL b/packages/sgml/INSTALL deleted file mode 100644 index 0338fbce2..000000000 --- a/packages/sgml/INSTALL +++ /dev/null @@ -1,167 +0,0 @@ -Basic Installation -================== - - These are generic installation instructions. - - The `configure' shell script attempts to guess correct values for -various system-dependent variables used during compilation. It uses -those values to create a `Makefile' in each directory of the package. -It may also create one or more `.h' files containing system-dependent -definitions. Finally, it creates a shell script `config.status' that -you can run in the future to recreate the current configuration, a file -`config.cache' that saves the results of its tests to speed up -reconfiguring, and a file `config.log' containing compiler output -(useful mainly for debugging `configure'). - - If you need to do unusual things to compile the package, please try -to figure out how `configure' could check whether to do them, and mail -diffs or instructions to the address given in the `README' so they can -be considered for the next release. If at some point `config.cache' -contains results you don't want to keep, you may remove or edit it. - - The file `configure.in' is used to create `configure' by a program -called `autoconf'. You only need `configure.in' if you want to change -it or regenerate `configure' using a newer version of `autoconf'. - -The simplest way to compile this package is: - - 1. `cd' to the directory containing the package's source code and type - `./configure' to configure the package for your system. If you're - using `csh' on an old version of System V, you might need to type - `sh ./configure' instead to prevent `csh' from trying to execute - `configure' itself. - - Running `configure' takes awhile. While running, it prints some - messages telling which features it is checking for. - - 2. Type `make' to compile the package. - - 3. Optionally, type `make check' to run any self-tests that come with - the package. - - 4. Type `make install' to install the programs and any data files and - documentation. - - 5. You can remove the program binaries and object files from the - source directory by typing `make clean'. To also remove the files - that `configure' created (so you can compile the package for a - different kind of computer), type `make distclean'. - -Compilers and Options -===================== - - Some systems require unusual options for compilation or linking that -the `configure' script does not know about. You can give `configure' -initial values for variables by setting them in the environment. Using -a Bourne-compatible shell, you can do that on the command line like -this: - CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure - -Or on systems that have the `env' program, you can do it like this: - env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure - -Using a Different Build Directory -================================= - - You can compile the package in a different directory from the one -containing the source code. Doing so allows you to compile it on more -than one kind of computer at the same time. To do this, you must use a -version of `make' that supports the `VPATH' variable, such as GNU -`make'. `cd' to the directory where you want the object files and -executables to go and run the `configure' script. `configure' -automatically checks for the source code in the directory that -`configure' is in and in `..'. - -Installation Names -================== - - By default, `make install' will install the package's files in -`/usr/local/bin', `/usr/local/man', etc. You can specify an -installation prefix other than `/usr/local' by giving `configure' the -option `--prefix=PATH'. - - You can specify separate installation prefixes for -architecture-specific files and architecture-independent files. If you -give `configure' the option `--exec-prefix=PATH', the package will use -PATH as the prefix for installing programs and libraries. -Documentation and other data files will still use the regular prefix. - - If the package supports it, you can cause programs to be installed -with an extra prefix or suffix on their names by giving `configure' the -option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. - -Optional Features -================= - - Some packages pay attention to `--enable-FEATURE' options to -`configure', where FEATURE indicates an optional part of the package. -They may also pay attention to `--with-PACKAGE' options, where PACKAGE -is something like `gnu-as' or `x' (for the X Window System). The -`README' should mention any `--enable-' and `--with-' options that the -package recognizes. - - For packages that use the X Window System, `configure' can usually -find the X include and library files automatically, but if it doesn't, -you can use the `configure' options `--x-includes=DIR' and -`--x-libraries=DIR' to specify their locations. - -Specifying the System Type -========================== - - There may be some features `configure' can not figure out -automatically, but needs to determine by the type of host the package -will run on. Usually `configure' can figure that out, but if it prints -a message saying it can not guess the host type, give it the -`--host=TYPE' option. TYPE can either be a short name for the system -type, such as `sun4', or a canonical name with three fields: - CPU-COMPANY-SYSTEM - -See the file `config.sub' for the possible values of each field. If -`config.sub' isn't included in this package, then this package doesn't -need to know the host type. - - If you are building compiler tools for cross-compiling, you can also -use the `--target=TYPE' option to select the type of system they will -produce code for and the `--build=TYPE' option to select the type of -system on which you are compiling the package. - -Sharing Defaults -================ - - If you want to set default values for `configure' scripts to share, -you can create a site shell script called `config.site' that gives -default values for variables like `CC', `cache_file', and `prefix'. -`configure' looks for `PREFIX/share/config.site' if it exists, then -`PREFIX/etc/config.site' if it exists. Or, you can set the -`CONFIG_SITE' environment variable to the location of the site script. -A warning: not all `configure' scripts look for a site script. - -Operation Controls -================== - - `configure' recognizes the following options to control how it -operates. - -`--cache-file=FILE' - Save the results of the tests in FILE instead of `config.cache'. - Set FILE to `/dev/null' to disable caching, for debugging - `configure'. - -`--help' - Print a summary of the options to `configure', and exit. - -`--quiet' -`--silent' -`-q' - Do not print messages saying which checks are being made. - -`--srcdir=DIR' - Look for the package's source code in directory DIR. Usually - `configure' can determine that directory automatically. - -`--version' - Print the version of Autoconf used to generate the `configure' - script, and exit. - -`configure' also accepts some other, not widely useful, options. - diff --git a/packages/sgml/Makefile.in b/packages/sgml/Makefile.in deleted file mode 100755 index a76209cbc..000000000 --- a/packages/sgml/Makefile.in +++ /dev/null @@ -1,233 +0,0 @@ -################################################################ -# SWI-Prolog `sgml2pl' package -# Author: Jan Wielemaker. jan@swi.psy.uva.nl -# Copyright: LGPL (see COPYING or www.gnu.org -################################################################ - -.SUFFIXES: .tex .dvi .doc .pl - -ifeq (@PROLOG_SYSTEM@,yap) - -prefix = @prefix@ -exec_prefix = @exec_prefix@ -ROOTDIR = $(prefix) -EROOTDIR = @exec_prefix@ -abs_top_builddir = @abs_top_builddir@ - -srcdir=@srcdir@ - -BINDIR = $(EROOTDIR)/bin -LIBDIR=@libdir@ -YAPLIBDIR=@libdir@/Yap -SHAREDIR=$(ROOTDIR)/share/Yap - -SHELL=@SHELL@ -PL=@INSTALL_ENV@ $(DESTDIR)$(BINDIR)/yap $(DESTDIR)$(YAPLIBDIR)/startup.yss -CHRDIR=$(SHAREDIR)/chr -EXDIR=$(CHRDIR)/examples/chr -LN_S=@LN_S@ -# -# -DEFS=@DEFS@ -D_YAP_NOT_INSTALLED_=1 -CC=@CC@ -CFLAGS= @SHLIB_CFLAGS@ $(YAP_EXTRAS) $(DEFS) -I$(srcdir) -I../.. -I$(srcdir)/../../include @CPPFLAGS@ -LDFLAGS=@LDFLAGS@ -MKINDEX=true - -LD=$(CC) -PLLD=$(CC) - -SO=@SO@ -#4.1VPATH=@srcdir@:@srcdir@/OPTYap -CWD=$(PWD) -# - -TARGETS= sgml2pl.@SO@ - -else # SWI - -PL=@PL@ -LD=@LD@ -PLLD=@PLLD@ -PLBASE=@PLBASE@ -PLARCH=@PLARCH@ -PKGDOC=$(PLBASE)/doc/packages -PCEHOME=../xpce -PLLIB=$(PLBASE)/library -PLFOREIGN=$(PLBASE)/lib/$(PLARCH) -DESTDIR= -SO=@SO@ - -DOCTOTEX=$(PCEHOME)/bin/doc2tex -PLTOTEX=$(PCEHOME)/bin/pl2tex -LATEX=latex -DOC=sgml -TEX=$(DOC).tex -DVI=$(DOC).dvi -PDF=$(DOC).pdf -HTML=$(DOC).html - -CC=@CC@ -COFLAGS=@COFLAGS@ -CWFLAGS=@CWFLAGS@ -CMFLAGS=@CMFLAGS@ -CIFLAGS=-I. -I@PLINCL@ -CFLAGS=$(COFLAGS) $(CWFLAGS) $(CMFLAGS) $(CIFLAGS) @DEFS@ -LDFLAGS=$(COFLAGS) - -LDSOFLAGS=@LDSOFLAGS@ - -TARGETS= sgml2pl.@SO@ - -endif #YAP/SWI - -INSTALL=@INSTALL@ -INSTALL_PROGRAM=@INSTALL_PROGRAM@ -INSTALL_DATA=@INSTALL_DATA@ - -LIBOBJ= parser.o util.o charmap.o catalog.o model.o xmlns.o utf8.o \ - xml_unicode.o -PLOBJ= $(LIBOBJ) error.o sgml2pl.o quote.o -SGMLOBJ= $(LIBOBJ) sgml.o -DTD2PLOBJ= $(LIBOBJ) dtd2pl.o prolog.o - -HDRS= $(srcdir)/catalog.h $(srcdir)/dtd.h \ - $(srcdir)/model.h $(srcdir)/prolog.h \ - $(srcdir)/utf8.h $(srcdir)/xmlns.h \ - $(srcdir)/config.h $(srcdir)/error.h \ - $(srcdir)/parser.h $(srcdir)/sgmldefs.h $(srcdir)/util.h - -ALLCSRC= $(LIBOBJ:.o=.c) \ - $(PLOBJ:.o=.c) $(SGMLOBJ:.o=.c) $(DTD2PLOBJ:.o=.c) \ - $(HDRS) - -LIBPL= $(srcdir)/sgml.pl $(srcdir)/xsdp_types.pl \ - $(srcdir)/iso_639.pl $(srcdir)/sgml_write.pl \ - $(srcdir)/xpath.pl\ - $(srcdir)/pwp.pl \ - $(srcdir)/pltotex.pl -PROGRAMS= dtd2pl sgml -DTDFILES= HTML4.dcl HTML4.dtd \ - HTML4.soc \ - HTMLlat1.ent \ - HTMLspec.ent HTMLsym.ent - -ifeq (@PROLOG_SYSTEM@,yap) - -%.o : $(srcdir)/%.c - $(CC) $(CFLAGS) -o $@ -c $< - -@DO_SECOND_LD@sgml2pl.@SO@: $(PLOBJ) -@DO_SECOND_LD@ @SHLIB_LD@ $(LDFLAGS) -o sgml2pl.@SO@ $(PLOBJ) @EXTRA_LIBS_FOR_SWIDLLS@ - -all: $(TARGETS) $(PROGRAMS) - -install: $(TARGETS) $(LIBPL) install-dtd - mkdir -p $(DESTDIR)$(YAPLIBDIR) - $(INSTALL_PROGRAM) $(TARGETS) $(DESTDIR)$(YAPLIBDIR) - $(INSTALL_DATA) $(LIBPL) $(DESTDIR)$(SHAREDIR) - $(PL) -f none -g make -t halt - -install-dtd:: - mkdir -p $(DESTDIR)$(SHAREDIR)/DTD - for f in $(DTDFILES); do \ - $(INSTALL_DATA) $(srcdir)/DTD/$$f $(DESTDIR)$(SHAREDIR)/DTD; \ - done - -else - -sgml2pl.@SO@: $(PLOBJ) - $(PLLD) -shared -o $@ $(PLOBJ) - -all: coflags $(TARGETS) $(PROGRAMS) - -coflags:: - @echo $(COFLAGS) > .coflags - -install: $(TARGETS) $(LIBPL) install-dtd - mkdir -p $(DESTDIR)$(PLBASE)/lib/$(PLARCH) - $(INSTALL_PROGRAM) $(TARGETS) $(DESTDIR)$(PLFOREIGN) - $(INSTALL_DATA) $(LIBPL) $(DESTDIR)$(PLLIB) - $(PL) -f none -g make -t halt - -install-dtd:: - mkdir -p $(DESTDIR)$(PLBASE)/library/DTD - for f in $(DTDFILES); do \ - $(INSTALL_DATA) DTD/$$f $(DESTDIR)$(PLBASE)/library/DTD; \ - done - -endif - -ln-install:: - @$(MAKE) INSTALL_DATA=../ln-install install - -rpm-install: install - -pdf-install:: - mkdir -p $(DESTDIR)$(PKGDOC) - $(INSTALL_DATA) sgml.pdf $(DESTDIR)$(PKGDOC) - -html-install:: - mkdir -p $(DESTDIR)$(PKGDOC) - $(INSTALL_DATA) sgml.html $(DESTDIR)$(PKGDOC) - -check:: - $(PL) -f $(srcdir)/Test/test.pl -g test,halt - $(PL) -f $(srcdir)/Test/wrtest.pl -g test,halt - -uninstall:: - (cd $(PLBASE)/lib/$(PLARCH) && rm -f $(TARGETS)) - (cd $(PLBASE)/library && rm -f $(LIBPL)) - $(PL) -f none -g make -t halt - -dtd2pl: $(DTD2PLOBJ) - $(LD) $(LDFLAGS) -o $@ $(DTD2PLOBJ) - -sgml: $(SGMLOBJ) - $(LD) $(LDFLAGS) -o $@ $(SGMLOBJ) - -tags: TAGS - -TAGS: $(ALLCSRC) - etags $(ALLCSRC) - -################################################################ -# Documentation -################################################################ - -doc: $(PDF) $(HTML) -pdf: $(PDF) -html: $(HTML) - -$(HTML): $(TEX) - latex2html $(DOC) - mv html/index.html $@ - rmdir html - -$(PDF): $(TEX) - ../../man/runtex --pdf $(DOC) - -$(TEX): $(DOCTOTEX) - -.doc.tex: - $(DOCTOTEX) $*.doc > $*.tex -.pl.tex: - $(PLTOTEX) $*.pl > $*.tex - -docclean:: - rm -f $(TEX) - rm -rf html - ../../man/runtex --clean $(DOC) - -################################################################ -# Clean -################################################################ - -clean:: - rm -f $(PLOBJ) *~ *.o *% a.out core config.log - -distclean: clean - rm -f $(TARGETS) $(PROGRAMS) - rm -f config.cache config.h config.status Makefile - rm -f .coflags - diff --git a/packages/sgml/Makefile.mak b/packages/sgml/Makefile.mak deleted file mode 100644 index 54f801f7d..000000000 --- a/packages/sgml/Makefile.mak +++ /dev/null @@ -1,79 +0,0 @@ -################################################################ -# Build the SWI-Prolog XML/SGML package for MS-Windows -# -# Author: Jan Wielemaker -# -# Use: -# nmake /f Makefile.mak -# nmake /f Makefile.mak install -################################################################ - -PLHOME=..\.. -!include ..\..\src\rules.mk -PKGDLL=sgml2pl - -LIBOBJ= parser.obj util.obj charmap.obj catalog.obj \ - model.obj xmlns.obj utf8.obj xml_unicode.obj -OBJ= $(LIBOBJ) sgml2pl.obj error.obj quote.obj -SGMLOBJ= $(LIBOBJ) sgml.obj -DTDFILES= HTML4.dcl HTML4.dtd HTML4.soc \ - HTMLlat1.ent HTMLspec.ent HTMLsym.ent -DTDDIR= $(PLBASE)\library\DTD - -all: $(PKGDLL).dll - -$(PKGDLL).dll: $(OBJ) - $(LD) /dll /out:$@ $(LDFLAGS) $(OBJ) $(PLLIB) $(LIBS) - -sgml.exe: $(SGMLOBJ) - $(LD) $(LDFLAGS) /out:$@ $(SGMLOBJ) $(LIBS) - -!IF "$(CFG)" == "rt" -install: idll -!ELSE -install: idtd idll ilib -!ENDIF - -idll:: - copy $(PKGDLL).dll "$(PLBASE)\bin" -!IF "$(PDB)" == "true" - copy $(PKGDLL).pdb "$(PLBASE)\bin" -!ENDIF - -ilib:: - copy sgml.pl "$(PLBASE)\library" - copy xsdp_types.pl "$(PLBASE)\library" - copy iso_639.pl "$(PLBASE)\library" - copy sgml_write.pl "$(PLBASE)\library" - $(MAKEINDEX) - -idtd:: - @if not exist "$(DTDDIR)\$(NULL)" $(MKDIR) "$(DTDDIR)" - @echo "Installing DTD files in $(DTDDIR)" - @for %f in ($(DTDFILES)) do \ - @copy DTD\%f "$(DTDDIR)" - @echo "done" - -uninstall:: - del "$(PLBASE)\bin\$(PKGDLL).dll" - del "$(PLBASE)\library\sgml.pl" - del "$(PLBASE)\library\xsdp_types.pl" - del "$(PLBASE)\library\iso_639.pl" - del "$(PLBASE)\library\sgml_write.pl" - $(MAKEINDEX) - -html-install:: - copy sgml.html "$(PKGDOC)" - -xpce-install:: - -check:: - cd Test && "$(PLCON)" -f test.pl -g test,halt. - -clean:: - if exist *.obj del *.obj - if exist *~ del *~ - -distclean: clean - -DEL *.dll *.lib *.exp *.pdb *.ilk 2>nul - diff --git a/packages/sgml/RDF/.cvsignore b/packages/sgml/RDF/.cvsignore deleted file mode 100644 index 9ac5f50c6..000000000 --- a/packages/sgml/RDF/.cvsignore +++ /dev/null @@ -1,9 +0,0 @@ -.plrc -config.h -Online-requests -Literature -Tests -Makefile -config.log -config.status -config.cache diff --git a/packages/sgml/RDF/.gitignore b/packages/sgml/RDF/.gitignore deleted file mode 100644 index 14a0668cc..000000000 --- a/packages/sgml/RDF/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -configure -rdf2pl.html -rdf2pl.pdf -rdf2pl.tex diff --git a/packages/sgml/RDF/ChangeLog b/packages/sgml/RDF/ChangeLog deleted file mode 100644 index 1c65a32fa..000000000 --- a/packages/sgml/RDF/ChangeLog +++ /dev/null @@ -1,237 +0,0 @@ -[Jan 21 2009] - - * FIXED: RDF writer: write valid XML if the namespace entity contains characters - that must be %-escaped. Jacopo Urbani. - -[Jan 13 2009] - - * FIXED: RDF/XML could save illegal XML if multiple namespaces are used - for predicates where one namespace is a prefix of another one. Jacopo Urbani. -[Dec 19 2008] - - * ADDED: Pass content_length through process_rdf/3 -[Sep 11 2008] - - * PORT: Add AC_PREREQ to configure.h for systems that auto-select autoconf - versions. After tip by Ulrich Neumerkel. - -[Aug 11 2008] - - * INSTALL: Remove all configure files from the git repository -[Apr 18 2008] - - * MODIFIED: Renamed hash_term/2 to term_hash/2. Added hash_term/2 to - library(backcomp), so most code should not notice this. -[Feb 28 2008] - - * FIXED: rdf_write_xml/2 loops if it encounters an rdf:Bag. - -[Feb 18 2008] - - * FIXED: More fixes for proper handling of rdf:Bag - -[Feb 13 2008] - - * FIXED: Emit rdf:Bag attributes (etc.) as rdf:li - - * FIXED: possible failure in rdf_write_xml with http://t-d-b.org? - -[Jan 14 2008] - - * FIXED: Bug#343: Handling bnodes in rdf_write_xml. Yver Raimond. - - * FIXED: Added support for rdf:NodeID to rdf_write_xml/2. Yves Raimond. - -[Dec 13 2007] - - * FIXED: library(rdf_write) to deal with operators. Related to Bug#332 - -Oct 29, 2007 - - * FIXED: extract namespaces used in typed literals. Yves Raimond. - -Jul 9, 2007 - - * FIXED: xml:lang with empty literals. Jochem Liem. - -Jun 14, 2007 - - * FIXED: return rdf:parseType="Literal" as literal of type - rdf:XMLLiteral. - -Jan 18, 2007 - - * ADDED: embedded(Bool) option to process_rdf/3 - -Jun 25, 2006 - - * CLEANUP: Delete unused global variable. - -Jun 5, 2006 - - * FIXED: use UTF-8 decoder from new library(utf8). Our own internal one - was broken. - -Apr 25, 2006 - - * FIXED: decoding of unicode-URIs using UTF-8 over %XX%XX. - -Apr 13, 2006 - - * ADDED: library rdf_write to write an RDF file from a list of triples. - -Dec 8, 2005 - - * FIXED: xmlns attributes in descriptions. Bijan Parsia - -Nov 23, 2005 - - * ADDED: option db(DB) to parse_rdf/2. - -Nov 10, 2005 - - * COMMENT: Comment use of IRI - -Jul 7, 2005 - - * ADDED: Pass entity(Name, Value) to XML parser - -Jul 5, 2005 - - * FIXED: Perform proper URI decoding to Unicode atoms - -Jul 4, 2005 - - * FIXED: Make "make check" work from the build directory. - -Mar 31, 2005 - - * FIXED: memory leak in process_rdf/2 - -Mar 29, 2005 - - * FIXED: dataType --> datatype (Vangelis Vassiliadis) - -Oct 21, 2004 - - * FIXED: Bug#196: avoid need for autoloading. Sandro Hawke. - -Sep 13, 2004 - - * ADDED: namespaces(-NameSpaces) option to load_rdf/3 and process_rdf/3 - to query the document namespace declarations. - -Aug 13, 2004 - - * MODIFIED: load_rdf/3 no longer returns resources as Prefix:URI, but - instead returns the plain atoms. - -Jul 31, 2004 - - * ADDED: converted rdf_nt.pl into public rdf_ntriples.pl library for - loading data in the W3C ntriple format. - -Jun 29, 2004 - - * FIXED: sharing code for blank nodes. Broken in recent cleanup. - -Jun 17, 2004 - - * CLEANUP: start/end of loading a file, use option/3 from library - -Apr 21, 2004 - - * ADDED: Support for xml:lang and rdf:dataType attributes. - - * INTERNAL: Use global variables rather than assert/retract for - keeping track of the state for process_rdf/3. - -Nov 29, 2003 - - * ADDED: warning for incorrect and multiple definitions of rdf:ID. - Maarten Menken. - -Nov 7, 2003 - - * ADDED: process_rdf/3: allow processing from a stream - -Oct 6, 2003 - - * MODIFIED: synopsis of process_rdf/3 to - process_rdf(+File, :OnTriples, +Options) for consistency and to allow - extending the option list. Old calls are mapped to the new. - - * Added option blank_nodes(share) to load_rdf/3 and process_rdf/3. - -Aug 18, 2003 - - * Guarantee that anonymous ids start with __ - -Mar 20, 2003 - - * Fixed exception in cleanup. Dominique de Waleffe. - -Feb 28, 2003 - - * ADDED: Use BaseURI to create non-conflicting anonymous resources. - - * FIXED: rdf_parser:global_id to ignore xml:base for absolute URIs - -Jan 17, 2003 - - * FIXED: online.pl (web frontend) to avoid using goal/1 option for the - xml parser. Now uses 4.0.8 clib memfile library primitives. - - * FIXED: process_rdf/3, Peter Marks. - - * ADDED: parseType="Collection", satisfying the W3C Working Draft - 8 November 2002. - -################################################################ -# Sumary of incompatibilities: -# -# Many problems in nested bag handling, changing output of -# suite/t5.rdf -# -# Content of Alt-container was incorrectly rendered as rdf:li -# instead of rdf:_1, rdf:_2, etc (suite/t27.rdf). -################################################################ - - * ADDED: Translate rdf:li predicates into _1, _2, etc. - - * FIXED: parseType=Literal to avoid extraneous [..] around the value - -Oct 28, 2002 - - * CLEANUP: pass base-uri as attribute, preparing for xml:base and making - the parser ready for multi-threading. - -Sep 16, 2002 - - * MODIFIED: Allow for unqualified attribute-names - - * ADDED: "make check" - -Older entries - - * FIXED: Type-exception in atom_chars/2 - - * FIXED: handling mixed <name>literal</name> and <name>object</name> - (space canonisation problem). - - * CGI Demo: report errors generated before a fatal exception. - - * FIXED: handling of propertyElt of the form - rdf:ID="myid" rdf:parseType="Resource" - - * For objects, map NameSpace:Local to the simple concatenation of the two. - This implies: - - # Subjects are always atoms - # Predicates are NameSpace:LocalName or simply Name - # Objects are atoms (URI) or literal(Value) - - * Warn on things that cannot be converted into an RDF-object rather then - failing silently. - - * Removed some undesirable choice-points. diff --git a/packages/sgml/RDF/Makefile.in b/packages/sgml/RDF/Makefile.in deleted file mode 100644 index 37bdc1a3c..000000000 --- a/packages/sgml/RDF/Makefile.in +++ /dev/null @@ -1,128 +0,0 @@ -################################################################ -# SWI-Prolog `RDF' package -# Author: Jan Wielemaker. jan@swi.psy.uva.nl -# Copyright: LGPL (see COPYING or www.gnu.org -################################################################ - -.SUFFIXES: .tex .dvi .doc .pl - -SHELL=@SHELL@ -PLBASE=@PLBASE@ -PLARCH=@PLARCH@ -PL=@PL@ -XPCEBASE=$(PLBASE)/xpce -PKGDOC=$(PLBASE)/doc/packages -PCEHOME=../../xpce -DESTDIR= - -CGISCRIPT=rdf-parser -CGIDIR=/etc/httpd/cgi-bin -CGIURL=http://gollem.science.uva.nl/cgi-bin -WEBPAGE=/swi40/prolog/packages/rdf-online.html -CGIGRP=www - -DOCTOTEX=$(PCEHOME)/bin/doc2tex -PLTOTEX=$(PCEHOME)/bin/pl2tex -RUNTEX=../../../man/runtex -LATEX=latex -DOC=rdf2pl -TEX=$(DOC).tex -DVI=$(DOC).dvi -PDF=$(DOC).pdf -HTML=$(DOC).html - -INSTALL=@INSTALL@ -INSTALL_PROGRAM=@INSTALL_PROGRAM@ -INSTALL_DATA=@INSTALL_DATA@ - -LIBPL= rdf.pl rdf_parser.pl rdf_triple.pl rewrite.pl \ - rdf_ntriples.pl rdf_write.pl -XPCEPL= rdf_diagram.pl - -all: - @echo "Nothing to do for this package" - -install: $(LIBPL) xpce-install - $(INSTALL_DATA) $(LIBPL) $(DESTDIR)$(PLBASE)/library - $(PL) -f none -g make -t halt - -ln-install:: - @$(MAKE) INSTALL_DATA=../../ln-install install - -xpce-install: $(XPCEPL) - if [ -d $(DESTDIR)$(XPCEBASE) ]; then \ - $(INSTALL) -m 644 $(XPCEPL) $(DESTDIR)$(XPCEBASE)/prolog/lib; \ - fi - -rpm-install: install - -pdf-install:: - $(INSTALL_DATA) $(DOC).pdf $(DESTDIR)$(PKGDOC) - -html-install:: - $(INSTALL_DATA) $(DOC).html $(DESTDIR)$(PKGDOC) - -uninstall: - (cd $(PLBASE)/library && rm -f $(LIBPL)) - $(PL) -f none -g make -t halt - -check:: - $(PL) -f rdf_test.pl -g test,halt -t 'halt(1)' - $(PL) -q -f write_test.pl -g run_tests,halt -t 'halt(1)' - -################################################################ -# CGI INSTALL -################################################################ - -cgi-install: $(CGIDIR)/$(CGISCRIPT) \ - Online-requests \ - $(WEBPAGE) - -cgi-uninstall: - rm -f $(CGIDIR)/$(CGISCRIPT) $(WEBPAGE) - -Online-requests: - mkdir $@ - chmod 775 $@ - chgrp $(CGIGRP) $@ - -$(WEBPAGE): online.html - sed 's%@ACTION@%$(CGIURL)/$(CGISCRIPT)%' online.html > $@ - -$(CGIDIR)/$(CGISCRIPT): rdf-parser Makefile - sed -e "s%@BASEDIR@%`pwd`%" -e s%@SWI@%$(PL)% rdf-parser > $@ - chmod 755 $@ - -################################################################ -# Documentation -################################################################ - -doc: $(PDF) $(HTML) -pdf: $(PDF) -html: $(HTML) - -$(HTML): $(TEX) - latex2html $(DOC) - mv html/index.html $@ - -$(PDF): $(TEX) - $(RUNTEX) --pdf $(DOC) - -$(TEX): $(DOCTOTEX) - -.doc.tex: - $(DOCTOTEX) $*.doc > $*.tex -.pl.tex: - $(PLTOTEX) $*.pl > $*.tex - -################################################################ -# Clean -################################################################ - -clean: - rm -f *~ *% config.log - -distclean: clean - rm -f $(TARGETS) config.h config.cache config.status Makefile - rm -f $(TEX) - $(RUNTEX) --clean $(DOC) diff --git a/packages/sgml/RDF/Makefile.mak b/packages/sgml/RDF/Makefile.mak deleted file mode 100644 index cc68c9957..000000000 --- a/packages/sgml/RDF/Makefile.mak +++ /dev/null @@ -1,51 +0,0 @@ -################################################################ -# Build the SWI-Prolog RDF package for MS-Windows -# NOTE: This package requires the SGML package -# -# Author: Jan Wielemaker -# -# Use: -# nmake /f Makefile.mak -# nmake /f Makefile.mak install -################################################################ - -PLHOME=..\..\.. -!include $(PLHOME)\src\rules.mk - -all: - -!IF "$(CFG)" == "rt" -install:: -!ELSE -install:: - copy rdf.pl "$(PLBASE)\library" - copy rdf_parser.pl "$(PLBASE)\library" - copy rdf_triple.pl "$(PLBASE)\library" - copy rewrite.pl "$(PLBASE)\library" - copy rdf_ntriples.pl "$(PLBASE)\library" - copy rdf_write.pl "$(PLBASE)\library" - $(MAKEINDEX) -!ENDIF - -xpce-install:: - copy rdf_diagram.pl "$(PLBASE)\xpce\prolog\lib" - $(MAKEINDEX) - -html-install:: - copy rdf2pl.html "$(PKGDOC)" - -uninstall:: - del "$(PLBASE)\library\rdf.pl" - del "$(PLBASE)\library\rdf_parser.pl" - del "$(PLBASE)\library\rdf_triple.pl" - del "$(PLBASE)\library\rewrite.pl" - del "$(PLBASE)\library\rdf_ntriples.pl" - del "$(PLBASE)\library\rdf_write.pl" - $(MAKEINDEX) - -clean:: - if exist *~ del *~ - -distclean: clean - - diff --git a/packages/sgml/RDF/README b/packages/sgml/RDF/README deleted file mode 100644 index 149fd04c3..000000000 --- a/packages/sgml/RDF/README +++ /dev/null @@ -1,12 +0,0 @@ ----+ RDF/XML parser and writer - -This directory implements the RDF/XML parser on top of the SWI-Prolog -XML parser. The main entry point is provided by load_rdf/3 or the -call-back version process_rdf/3. - -In addition, rdf_write.pl provides writing (serialization) of an RDD/XML -document from a list of triples. - - * [[load_rdf/3]] - * [[process_rdf/3]] - * [[rdf_write_xml/2]] diff --git a/packages/sgml/RDF/configure.in b/packages/sgml/RDF/configure.in deleted file mode 100644 index 2c15deec2..000000000 --- a/packages/sgml/RDF/configure.in +++ /dev/null @@ -1,32 +0,0 @@ -dnl Process this file with autoconf to produce a configure script. - -AC_INIT(install-sh) -AC_PREREQ([2.50]) -AC_CONFIG_HEADER(config.h) - -AC_SUBST(PL) -AC_SUBST(PLBASE) -AC_SUBST(PLARCH) - -# Do not cache this, it changes too often in many configurations -unset ac_cv_prog_PL - -if test -z "$PLINCL"; then -plcandidates="swi-prolog swipl pl" -AC_CHECK_PROGS(PL, $plcandidates, "none") -if test $PL = "none"; then - AC_ERROR("Cannot find SWI-Prolog. SWI-Prolog must be installed first") -else - AC_CHECKING("Running $PL -dump-runtime-variables") - eval `$PL -dump-runtime-variables` -fi -AC_MSG_RESULT(" PLBASE=$PLBASE") -AC_MSG_RESULT(" PLARCH=$PLARCH") -else -PL=../../pl.sh -fi - -AC_CHECK_PROGS(MAKE, gmake make, "make") -AC_PROG_INSTALL - -AC_OUTPUT(Makefile) diff --git a/packages/sgml/RDF/install-sh b/packages/sgml/RDF/install-sh deleted file mode 100755 index ab74c882e..000000000 --- a/packages/sgml/RDF/install-sh +++ /dev/null @@ -1,238 +0,0 @@ -#!/bin/sh -# -# install - install a program, script, or datafile -# This comes from X11R5. -# -# Calling this script install-sh is preferred over install.sh, to prevent -# `make' implicit rules from creating a file called install from it -# when there is no Makefile. -# -# This script is compatible with the BSD install script, but was written -# from scratch. -# - - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit="${DOITPROG-}" - - -# put in absolute paths if you don't have them in your path; or use env. vars. - -mvprog="${MVPROG-mv}" -cpprog="${CPPROG-cp}" -chmodprog="${CHMODPROG-chmod}" -chownprog="${CHOWNPROG-chown}" -chgrpprog="${CHGRPPROG-chgrp}" -stripprog="${STRIPPROG-strip}" -rmprog="${RMPROG-rm}" -mkdirprog="${MKDIRPROG-mkdir}" - -tranformbasename="" -transform_arg="" -instcmd="$mvprog" -chmodcmd="$chmodprog 0755" -chowncmd="" -chgrpcmd="" -stripcmd="" -rmcmd="$rmprog -f" -mvcmd="$mvprog" -src="" -dst="" -dir_arg="" - -while [ x"$1" != x ]; do - case $1 in - -c) instcmd="$cpprog" - shift - continue;; - - -d) dir_arg=true - shift - continue;; - - -m) chmodcmd="$chmodprog $2" - shift - shift - continue;; - - -o) chowncmd="$chownprog $2" - shift - shift - continue;; - - -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; - - -s) stripcmd="$stripprog" - shift - continue;; - - -t=*) transformarg=`echo $1 | sed 's/-t=//'` - shift - continue;; - - -b=*) transformbasename=`echo $1 | sed 's/-b=//'` - shift - continue;; - - *) if [ x"$src" = x ] - then - src=$1 - else - # this colon is to work around a 386BSD /bin/sh bug - : - dst=$1 - fi - shift - continue;; - esac -done - -if [ x"$src" = x ] -then - echo "install: no input file specified" - exit 1 -else - true -fi - -if [ x"$dir_arg" != x ]; then - dst=$src - src="" - - if [ -d $dst ]; then - instcmd=: - else - instcmd=mkdir - fi -else - -# Waiting for this to be detected by the "$instcmd $src $dsttmp" command -# might cause directories to be created, which would be especially bad -# if $src (and thus $dsttmp) contains '*'. - - if [ -f $src -o -d $src ] - then - true - else - echo "install: $src does not exist" - exit 1 - fi - - if [ x"$dst" = x ] - then - echo "install: no destination specified" - exit 1 - else - true - fi - -# If destination is a directory, append the input filename; if your system -# does not like double slashes in filenames, you may need to add some logic - - if [ -d $dst ] - then - dst="$dst"/`basename $src` - else - true - fi -fi - -## this sed command emulates the dirname command -dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` - -# Make sure that the destination directory exists. -# this part is taken from Noah Friedman's mkinstalldirs script - -# Skip lots of stat calls in the usual case. -if [ ! -d "$dstdir" ]; then -defaultIFS=' -' -IFS="${IFS-${defaultIFS}}" - -oIFS="${IFS}" -# Some sh's can't handle IFS=/ for some reason. -IFS='%' -set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` -IFS="${oIFS}" - -pathcomp='' - -while [ $# -ne 0 ] ; do - pathcomp="${pathcomp}${1}" - shift - - if [ ! -d "${pathcomp}" ] ; - then - $mkdirprog "${pathcomp}" - else - true - fi - - pathcomp="${pathcomp}/" -done -fi - -if [ x"$dir_arg" != x ] -then - $doit $instcmd $dst && - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi -else - -# If we're going to rename the final executable, determine the name now. - - if [ x"$transformarg" = x ] - then - dstfile=`basename $dst` - else - dstfile=`basename $dst $transformbasename | - sed $transformarg`$transformbasename - fi - -# don't allow the sed command to completely eliminate the filename - - if [ x"$dstfile" = x ] - then - dstfile=`basename $dst` - else - true - fi - -# Make a temp file name in the proper directory. - - dsttmp=$dstdir/#inst.$$# - -# Move or copy the file name to the temp name - - $doit $instcmd $src $dsttmp && - - trap "rm -f ${dsttmp}" 0 && - -# and set any options; do chmod last to preserve setuid bits - -# If any of these fail, we abort the whole thing. If we want to -# ignore errors from any of these, just make sure not to ignore -# errors from the above "$doit $instcmd $src $dsttmp" command. - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && - -# Now rename the file to the real destination. - - $doit $rmcmd -f $dstdir/$dstfile && - $doit $mvcmd $dsttmp $dstdir/$dstfile - -fi && - - -exit 0 diff --git a/packages/sgml/RDF/online.html b/packages/sgml/RDF/online.html deleted file mode 100644 index 8d8925eee..000000000 --- a/packages/sgml/RDF/online.html +++ /dev/null @@ -1,177 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> - -<html> -<head> -<title>Online SWI-Prolog RDF parser demo</title> -</head> -<body> - -<h1 align=center>Online SWI-Prolog RDF parser demo</h1> - -<p> -This page provides an online demonstration of an RDF parser written in <a -href="http://www.swi-prolog.org">SWI-Prolog</a> and distributed as part of the -normal SWI-Prolog distribution. This RDF parser has a couple of attractive -properties: - -<dl> - <dt><b>Small</b><dd> -Both in terms of source-code (&lt; 1200 lines) and executable. - - <dt><b>Fast</b><dd> -Parses about 1.2 Mbytes/sec on an AMD 1600+ running SWI-Prolog 5.1.6 and -SuSE Linux 8.1 (tested on a 9MB RDFS file containing 179403 triples). - - <dt><b>Conforming</b><dd> -This parser conforms to http://www.w3.org/TR/rdf-syntax-grammar/, -W3C Working Draft 8 November 2002. It includes the revised bag -syntax, <code>xml:base</code>, <code>parseType="Collection"</code> -and <code>nodeID</code> features. - - <dt><b>Prolog based</b><dd> -Many people regard the Prolog programming language a good vehicle to -reason about RDF statements. Having a simple and fast Prolog-based RDF -parser makes life easier. - - <dt><b>Portability</b><dd> -The RDF parser itself is written in ISO Prolog. The XML parser is -written in ANSI-C. There is no standard for interfacing Prolog and C, -but the interface is relatively small. - - <dt><b>Discussion Page</b><dd> -There is a -<a href="http://gollem.science.uva.nl/twiki/pl/bin/view/Library/RdfParse"> -discussion page</a> on this parser on the SWI-Prolog collaborative -(<em>twiki</em> web) </dl> - -A more detailed description of this packages is available in <a -href="http://www.swi-prolog.org/packages/rdf2pl.html">in this -document</a>. The sources of the parser are included in the full -source for SWI-Prolog. The individual source files can also be -examined through the <a -href="http://gollem.science.uva.nl/cgi-bin/pl-cvsweb/pl/packages/sgml/RDF"> -cvsweb service</a>. - -<p> -<hr> -Please write your RDF description into the text-area below or select a -local file using the <b>File:</b> item and submit it. If anything goes -wrong, please mail <a href="mailto:wielemak@science.uva.nl">Jan -Wielemaker</a>. - -<p> -<em>The RDF-data submitted is kept <b>anonymously</b> on our server and -might be used by us to examine problems with our RDF parser. We do not -publish this material.</em> The result-page provides a form for -attaching a comment to the stored RDF statement. - -<p> -<form - name=rdf - method=post - enctype="multipart/form-data" - action="@ACTION@"> -<table align=center> -<tr><td colspan=2> - <textarea name=rdf rows=15 cols=72 wrap=off></textarea> -<tr><td>File: <input name=attachment type=file> - <td align=right> - <input type=button value='Example 1' onClick="ex1()"> - <input type=button value='Example 2' onClick="ex2()"> - <input type=button value='Example 3' onClick="ex3()"> - <input type=button value='Example 19' onClick="ex19()"> -<tr><td align=left><input type=reset value="Clear Text"> - <td align=right><input type=submit value="Parse RDF"> -</table> -</form> - -<h4><hr>Notes<hr></h4 - -<dl> -<dt><b><em>rdf:</em>resource, etc.</b><dd> -The specification and discussion on the rdf interest group yielded no -satisfactory solution how to deal with RDF attributes that are not in -the RDF namespace such as <b>ID</b>, <b>resource</b>, etc. This parser -interprets such attributes in the namespace of the element, so the -statement below is not interpreted as a <b>propertyElt</b> with value -<code>me</code> but as a <b>typedNode</b> with predicate -<code>resource</code> and value <b>literal(</b>me<b>)</b>. - -<pre> - &lt;s:Creator resource="#me"&gt; -</pre> -</dl> - -<!----------------------------------------------------------------> -<!-- EXAMPLES --> -<!----------------------------------------------------------------> - -<script language="JavaScript"> - -function ex1() -{ document.rdf.rdf.value='<?xml version="1.0"?>\n\ -\n\ -<!-- Example from REC-rdf-syntax -->\n\ -\n\ -<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"\n\ - xmlns:s="http://description.org/schema/">\n\ - <rdf:Description about="http://www.w3.org/Home/Lassila">\n\ - <s:Creator>Ora Lassila</s:Creator>\n\ - </rdf:Description>\n\ -</rdf:RDF>'; -} - -function ex2() -{ document.rdf.rdf.value='<?xml version="1.0"?>\n\ -\n\ -<!-- Example from REC-rdf-syntax, demonstrating reification -->\n\ -\n\ -<rdf:RDF\n\ - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"\n\ - xmlns:s="http://description.org/schema/">\n\ - <rdf:Description about="http://www.w3.org/Home/Lassila" bagID="D_001">\n\ - <s:Creator>Ora Lassila</s:Creator>\n\ - <s:Title>Ora\'s Home Page</s:Title>\n\ - </rdf:Description>\n\ -</rdf:RDF>'; -} - -function ex3() -{ document.rdf.rdf.value='<?xml version="1.0"?>\n\ -\n\ -<!-- Example from REC-rdf-syntax, non-binary relations -->\n\ -\n\ -<rdf:RDF\n\ - xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"\n\ - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"\n\ - xmlns:n="http://www.nist.gov/units/">\n\ - <Description about="John_Smith">\n\ - <n:weight rdf:parseType="Resource">\n\ - <rdf:value>200</rdf:value>\n\ - <n:units rdf:resource="http://www.nist.gov/units/Pounds"/>\n\ - </n:weight>\n\ - </Description>\n\ -</rdf:RDF>'; -} - -function ex19() -{ document.rdf.rdf.value='<?xml version="1.0"?>\n\ -\n\ -<!-- Example 19: Complete example of a RDF collection of nodes\n\ - using rdf:parseType="Collection" -->\n\ -\n\ -<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"\n\ - xmlns:ex="http://example.org/stuff/1.0/">\n\ - <rdf:Description rdf:about="http://example.org/basket">\n\ - <ex:hasFruit rdf:parseType="Collection">\n\ - <rdf:Description rdf:about="http://example.org/banana"/>\n\ - <rdf:Description rdf:about="http://example.org/apple"/>\n\ - <rdf:Description rdf:about="http://example.org/pear"/>\n\ - </ex:hasFruit>\n\ - </rdf:Description>\n\ -</rdf:RDF>'; -} - -</script> -</body> -</html> diff --git a/packages/sgml/RDF/online.pl b/packages/sgml/RDF/online.pl deleted file mode 100644 index 891bc7807..000000000 --- a/packages/sgml/RDF/online.pl +++ /dev/null @@ -1,457 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog RDF parser - - Author: Jan Wielemaker - E-mail: jan@swi.psy.uva.nl - WWW: http://www.swi.psy.uva.nl/projects/SWI-Prolog/ - Copying: LGPL-2. See the file COPYING or http://www.gnu.org - - Copyright (C) 1990-2000 SWI, University of Amsterdam. All rights reserved. -*/ - - -:- use_module(library(cgi)). -:- use_module(library(sgml)). -:- use_module(rdf). -:- use_module(rdf_parser). -:- use_module(rewrite). -:- use_module(pretty_print). - -term_expansion(F, T) :- rew_term_expansion(F, T). -goal_expansion(F, T) :- rew_goal_expansion(F, T). - -:- dynamic new_rdf_namespace/1. - -parse(Text, RDFTerm, Triples) :- - parse_atom(Text, Term), - ( find_rdf(Term, RDFTerm) - -> true - ; RDFTerm = Term - ), - xml_to_rdf(RDFTerm, [], Triples). - -find_rdf(Term, RDFTerm) :- - RDFTerm = element(NS:'RDF', _, _), - term_member(RDFTerm, Term), !, - ( rdf_name_space(NS) - -> true - ; assert(rdf_parser:rdf_name_space(NS)), - assert(new_rdf_namespace(NS)) - ). - -term_member(X, X). -term_member(X, Compound) :- - compound(Compound), - arg(_, Compound, Arg), - term_member(X, Arg). - -% parse_atom(+Atom, -Term, +Options -% -% Parse and atom into a structured term - -parse_atom(Atom, Term) :- - atom_to_memory_file(Atom, MemFile), - open_memory_file(MemFile, read, Stream), - new_sgml_parser(Parser, []), - set_sgml_parser(Parser, dialect(xmlns)), - set_sgml_parser(Parser, space(sgml)), - sgml_parse(Parser, - [ source(Stream), - document(Term) - ]), - free_sgml_parser(Parser), - close(Stream), - free_memory_file(MemFile). - - - /******************************* - * HTML GENERATION * - *******************************/ - -:- op(100, fx, #). -:- op(110, xfx, ::). - -emit([]) :- !. -emit([H|T]) :- !, - emit(H), - emit(T). -emit(Fmt-Args) :- !, - format(Fmt, Args), - retractall(nl_done(_)). -emit(#Term) :- !, - #Term. -emit(#Term::Content) :- !, - #Term::Content. -emit(Atom) :- - write(Atom), - retractall(nl_done(_)). - -#Term::Content :- - Term =.. [Name|Attributes], - layout(before(open, Name)), - format('<~w', [Name]), - attlist(Attributes), - format('>', []), - retractall(nl_done(_)), - layout(after(open, Name)), - emit(Content), - end_tag(Name). -#pre(Text) :- !, - sgml_quote(Text, Quoted), - #pre::Quoted. -#box(Text) :- !, - box(Text, '#e0e0e0'). -#box(Text, Colour) :- !, - box(Text, Colour). -#Term :- - Term =.. [Name|Attributes], - layout(before(open, Name)), - format('<~w', [Name]), - attlist(Attributes), - format('>', []), - retractall(nl_done(_)), - layout(after(open, Name)), - end_tag(Name). - -end_tag(Name) :- - blines(Name, _, o), !. -end_tag(Name) :- - layout(before(close, Name)), - format('</~w>', [Name]), - retractall(nl_done(_)), - layout(after(close, Name)). - - -layout(before(open, Name)) :- - blines(Name, N-_, _), !, - nls(N). -layout(after(open, Name)) :- - blines(Name, _-N, _), !, - nls(N). -layout(before(close, Name)) :- - blines(Name, _, N-_), !, - nls(N). -layout(after(close, Name)) :- - blines(Name, _, _-N), !, - nls(N). -layout(_) :- - retractall(nl_done(_)). - -:- dynamic - nl_done/1. - -nls(N) :- - ( nl_done(Done) - -> true - ; Done = 0 - ), - ToDo is N - Done, - New is max(N, Done), - retractall(nl_done(Done)), - assert(nl_done(New)), - do_nl(ToDo). - -do_nl(N) :- - N > 0, !, - nl, - NN is N - 1, - do_nl(NN). -do_nl(_). - -blines(tr, 1-0, 0-0). -blines(table, 2-1, 1-1). -blines(form, 2-1, 1-1). -blines(h1, 2-0, 0-1). -blines(h2, 2-0, 0-2). -blines(h3, 2-0, 0-2). -blines(h4, 2-0, 0-2). -blines(p, 2-1, o). % omitted end-tag - -attlist([]). -attlist([Name=Value|T]) :- !, - sgml_quote_value(Value, Quoted), - format(' ~w=~w', [Name, Quoted]), - attlist(T). -attlist([Name|T]) :- - format(' ~w', [Name]), - attlist(T). - -head(Title) :- - emit([ 'Content-type: text/html\n\n', - '<html>\n', - '<head>\n', - '<title>~w</title>~n'-[Title], - '</head>\n\n', - '<body bgcolor="white">\n' - ]). -foot :- - emit([ '</body>\n', - '</html>\n' - ]). - - -pre(Text) :- - sgml_quote(Text, Quoted), - #pre::Quoted. - -box(Text, Colour) :- - emit('<p>\n'), - #table(width='80%', align=center, border=6, bgcolor=Colour):: - [#tr::[#td(nowrap)::[#pre(Text)]]]. - - - /******************************* - * QUOTING * - *******************************/ - -sgml_quote_value(Value, Arg) :- - atom_chars(Value, Chars), - ( name_chars(Chars) - -> Arg = Value - ; sgml_quote_chars(Chars, Quoted), - atom_chars(Arg, Quoted) - ). - -name_chars([H|T]) :- - char_type(H, alpha), - all_alnum(T). - -all_alnum([]). -all_alnum([H|T]) :- - char_type(H, csymf), - all_alnum(T). - -sgml_quote_chars(L, ['"'|T]) :- - sgml_quote2(L, T, ['"']). - -sgml_quote2([], T, T). -sgml_quote2([H|T0], List, Rest) :- - sgml_quote_char(H, List, T), !, - sgml_quote2(T0, T, Rest). -sgml_quote2([H|T0], [H|T], Rest) :- - sgml_quote2(T0, T, Rest). - -sgml_quote_char('<', [&, l, t, ;|T], T). -sgml_quote_char('>', [&, g, t, ;|T], T). -sgml_quote_char('&', [&, a, m, p, ;|T], T). -sgml_quote_char('"', [&, q, u, o, t, ;|T], T). -%sgml_quote_char('\'', [&, a, p, o, s, ;|T], T). - -sgml_quote(Text, Quoted) :- - atom_chars(Text, Chars), - sgml_quote2(Chars, QuotedChars, []), - atom_chars(Quoted, QuotedChars). - - - /******************************* - * PAGE GENERATION * - *******************************/ - -parsed(Time, Triples) :- - length(Triples, Len), - #h2::'RDF statement parsed successfully', - #p::[ 'Your RDF statement has been parsed in ~2f seconds, '-[Time], - 'creating ', #b::Len, ' triples. ', - 'Please find the created triples in the table below.' - ], - ( getenv('HTTP_REFERER', Referer) - -> #p::[ 'If you want to try another RDF statement, please go ', - 'back to ', #a(href=Referer)::'the request form', '.' - ] - ; true - ). - -rdf_table(Triples) :- - maplist(triple_row, Triples, TripleRows), - #p, - #table(caption='RDF triples', - align=center, border=2, cellpadding=3):: - [ #tr::[#th::'Subject', #th::'Predicate', #th::'Object'] - | TripleRows - ]. - -triple_row(rdf(Subj, Pred, Obj), #tr::[#td::S,#td::P,#td::O]) :- - cell(Subj, S), - cell(Pred, P), - cell(Obj, O). - -cell(rdf:Local, [#em::rdf, :, #b::Local]) :- !. -cell(literal(X), [#b::'literal(', X, #b::')']) :- !. -cell(each(X), [#b::'each(', X, #b::')']) :- !. -cell(pefix(X), [#b::'prefix(', X, #b::')']) :- !. -cell(NS:Local, [NS, :, #b::Local]) :- !. -cell(V, [T]) :- - sformat(T, '~p', [V]). - - /******************************* - * ERRORS * - *******************************/ - -show_errors :- - getenv('ERROR_FILE', File), - size_file(File, Size), - Size > 0, !, - read_file(File, Data), - #h4::[#font(color=red):: - 'The following errors occurred while processing your request'], - #p, - #box(Data, '#ff8c00'). -show_errors. - -show_new_namepace :- - new_rdf_namespace(NS), !, - #h4::[#font(color=red)::'Warning: unofficial RDF Namespace'], - #p::['It appears your RDF description uses the unofficial ', - 'name space ', #b::NS, '. ', - 'This name space has been added for RDF.' - ]. -show_new_namepace. - - - /******************************* - * COMMENT * - *******************************/ - -comment(TextId) :- - #h4::'<hr>Comment', - #p::[ 'If you do not agree with the output or have other comments, ', - 'Please write them in the text-area below and submit them' - ], - getenv('REQUEST_URI', Script), - #form(method=post, action=Script):: - [ #input(type=hidden, name=id, value=TextId), - #table(align=center):: - [ #tr::[#td::[#textarea(name=comment, cols=64, rows=10)]], - #tr::[#td(align=right)::['E-mail: ', #input(name=mail)]], - #tr::[#td(align=right)::[#input(type=submit)]] - ] - ]. - - - /******************************* - * REQUEST * - *******************************/ - -request_location('Online-requests'). - -% Save the request and return a local identifier for it. - -save_request(Text, Id) :- - request_dir(Dir, Date), - concat_atom([Dir, /, Date], DateDir), - ensure_dir(DateDir), - between(1, 10000, N), - concat_atom([DateDir, /, N, '.rdf'], File), - \+ exists_file(File), !, - open(File, write, Fd), - format(Fd, '~w~n', [Text]), - close(Fd), - concat_atom([Date, /, N], Id). - -request_dir(BaseDir, Date) :- - get_time(Time), - convert_time(Time, Y, M, D, _, _, _, _), - request_location(BaseDir), - concat_atom([D, -, M, -, Y], Date). - -ensure_dir(Dir) :- - exists_directory(Dir), !. -ensure_dir(Dir) :- - make_directory(Dir). - -save_comment(Id, Mail, Comment) :- - request_location(Base), - concat_atom([Base, '/', Id], FileBase), - absolute_file_name(FileBase, AbsFileBase), - absolute_file_name(Base, AbsBase), - sub_atom(AbsFileBase, 0, _, _, AbsBase), % verify in tree - atom_concat(AbsFileBase, '.cmt', CmtFile), - open(CmtFile, write, Fd), - format(Fd, 'E-mail: ~w~n~n~w~n', [Mail, Comment]), - close(Fd). - - - /******************************* - * ENTRY * - *******************************/ - -main :- - cgi_get_form(Arguments), - ( ( memberchk(attachment(Text), Arguments), - Text \== '' - ; memberchk(rdf(Text), Arguments) - ) - -> save_request(Text, TextId), - ( OldTime is cputime, - parse(Text, _Prolog, Triples), - Time is cputime - OldTime - -> head('RDF Triples'), - parsed(Time, Triples), - show_errors, - show_new_namepace, - rdf_table(Triples), - comment(TextId), - foot - ; head('Failed to parse'), - #p::[ 'I failed to parse your request' ], - show_errors, - comment(TextId), - foot - ), - halt - ; memberchk(comment(Comment), Arguments), - memberchk(id(Id), Arguments), - memberchk(mail(Mail), Arguments) - -> save_comment(Id, Mail, Comment), - head('Thanks for comment'), - #p::'Thank you for your comments', - foot, - halt - ). -main :- - head('Failed'), - #p::[ 'This CGI-script failed to understand your request' ], - foot, - halt. - -go :- - catch(main, E, error(E)). - -error(E) :- - message_to_string(E, Msg), - head('Failed to parse'), - show_errors, - #p::[ 'An exception was raised while parsing your request:' ], - #pre(Msg), - foot, - halt. - - - /******************************* - * TEST * - *******************************/ - -test :- - read_file('suite/t1.rdf', Text), - catch(parse(Text, _Prolog, Triples), E, error(E)), - head('RDF Triples'), - rdf_table(Triples), - foot. - - - /******************************* - * UTIL * - *******************************/ - -read_file(File, Atom) :- - open(File, read, Fd), - get_code(Fd, C), - read_stream(C, Fd, Chars), - close(Fd), - atom_codes(Atom, Chars). - -read_stream(-1, _, []) :- !. -read_stream(C0, Fd, [C0|T]) :- - get_code(Fd, C), - read_stream(C, Fd, T). diff --git a/packages/sgml/RDF/pretty_print.pl b/packages/sgml/RDF/pretty_print.pl deleted file mode 100644 index 74c737d26..000000000 --- a/packages/sgml/RDF/pretty_print.pl +++ /dev/null @@ -1,167 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog SGML/XML parser - - Author: Jan Wielemaker - E-mail: jan@swi.psy.uva.nl - WWW: http://www.swi.psy.uva.nl/projects/SWI-Prolog/ - Copying: LGPL-2. See the file COPYING or http://www.gnu.org - - Copyright (C) 1990-2000 SWI, University of Amsterdam. All rights reserved. -*/ - -:- module(dia_pretty_print, - [ pretty_print/1 - ]). - -:- require([ atom_length/2 - , between/3 - , forall/2 - , is_list/1 - , member/2 - , memberchk/2 - ]). - - -pretty_print(Term) :- - numbervars(Term, 0, _), - pp(Term, 0), - write('.'), nl, fail. -pretty_print(_). - - -pp(Term, _Indent) :- - atomic(Term), !, - writeq(Term). -pp(Var, _Indent) :- - var(Var), !, - write(Var). -pp(Var, _Indent) :- - Var = '$VAR'(_), !, - print(Var). -pp('$aref'(Name), _Indent) :- !, - write(Name). -pp(Module:Term, Indent) :- - atomic(Module), !, - writeq(Module), write(:), - pp(Term, Indent). -pp([A1 = V1|ArgList], Indent) :- % [] is done by `atomic'! - is_list(ArgList), - forall(member(A, ArgList), A = (_ = _)), - longest_attribute([A1 = V1|ArgList], 0, L), !, - NewIndent is Indent + 2, - ( L > 9, Indent < 25, length(ArgList, Args), Args > 1 - -> ArgIndent is Indent + 4, - ValGoal = (nl, indent(ArgIndent)) - ; ArgIndent is Indent + 6 + L, - ValGoal = write(' ') - ), - write('[ '), - pp(A1, Indent), term_length(A1, L1), - tab(L-L1), write(' ='), ValGoal, - pp(V1, ArgIndent), - forall(member(A = V, ArgList), - (write(','), nl, - indent(NewIndent), - pp(A, Indent), term_length(A, LA), tab(L-LA), - write(' ='), ValGoal, pp(V, ArgIndent))), - nl, - indent(Indent), - write(']'). -pp([H|T], Indent) :- - is_list(T), !, - write('[ '), - NewIndent is Indent + 2, - pp(H, NewIndent), - forall(member(E, T), - (write(','), nl, - indent(NewIndent), - pp(E, NewIndent))), - nl, - indent(Indent), - write(']'). -pp(Term, Indent) :- - functor(Term, Name, 2), - current_op(_, Type, Name), - memberchk(Type, [xfx, yfx]), !, - arg(1, Term, A1), - arg(2, Term, A2), - pp(A1, Indent), format(' ~q ', [Name]), pp(A2, Indent). -pp(Term, Indent) :- - functor(Term, Name, _Arity), - atom_length(Name, L), - NewIndent is Indent + L + 1, - format('~q(', Name), - ( term_argument_length(Term, AL), - NewIndent + AL < 72 - -> Wrap = nowrap - ; Wrap = wrap - ), - forall(generate_arg(I, Term, Arg), - pparg(I, Arg, Wrap, NewIndent)), - write(')'). - -generate_arg(ArgN, Term, Arg) :- - functor(Term, _, Arity), - between(1, Arity, ArgN), - arg(ArgN, Term, Arg). - -pparg(1, Term, _, Indent) :- !, - pp(Term, Indent). -pparg(_, Term, wrap, Indent) :- !, - write(','), nl, - indent(Indent), - pp(Term, Indent). -pparg(_, Term, _, Indent) :- - write(', '), - pp(Term, Indent). - -longest_attribute([], L, L). -longest_attribute([A = _|T], L0, L) :- - term_length(A, AL), - max(L0, AL, L1), - longest_attribute(T, L1, L). - -term_length(A, AL) :- - atomic(A), !, - atom_length(A, AL). -term_length(Var, AL) :- - var(Var), !, - AL = 1. -term_length('$VAR'(N), AL) :- - varname(N, L), - length(L, AL). -term_length('$aref'(N), AL) :- - atom_length(N, AL). - -term_argument_length(Term, L) :- - term_argument_length(Term, 1, 0, L). - -term_argument_length(Term, A, L0, L) :- - arg(A, Term, Arg), !, - term_length(Arg, AL), - L1 is AL + L0, - NA is A + 1, - term_argument_length(Term, NA, L1, L). -term_argument_length(_, _, L, L). - - -max(A, B, M) :- - ( A >= B - -> M = A - ; M = B - ). - - -varname(N, [C]) :- - N < 26, !, - C is N + 0'A. -varname(N, [C1, C2]) :- - C1 is N // 26 + 0'A, - C2 is N mod 26 + 0'A. - -indent(I) :- - Tabs is I // 8, - forall(between(1, Tabs, _), put(9)), - Spaces is I mod 8, - tab(Spaces). diff --git a/packages/sgml/RDF/rdf-parser b/packages/sgml/RDF/rdf-parser deleted file mode 100755 index d2f196e7f..000000000 --- a/packages/sgml/RDF/rdf-parser +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash -# -# This is not the normal parser, just the front-end for the CGI interface. -# The real CGI stuff is written in Prolog in the file online.pl. The -# request is in online.html -# -# The RDF parser itself is just a Prolog library. See rdf2pl.{html,pdf}. - -base=@BASEDIR@ -tmp=/tmp/rdf-parser-$$ -export ERROR_FILE=$tmp - -ulimit -t 20 # seconds CPU time limit - -function error() -{ cat << _EOM_ -Content-type: text/plain - -Sorry, an internal error occurred. For details, see below. - -_EOM_ - cat $tmp - rm -r $tmp - exit 0 -} - -cd $base > $tmp 2>&1 -@SWI@ -f none -F none -t halt \ - -g "load_files(online,[silent(true)]),go" 2>$tmp - -case $? in - 0) rm -f $tmp - exit 0 ;; - *) error ;; -esac diff --git a/packages/sgml/RDF/rdf.html b/packages/sgml/RDF/rdf.html deleted file mode 100644 index a0c089676..000000000 --- a/packages/sgml/RDF/rdf.html +++ /dev/null @@ -1,156 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> - -<html> -<head> -<title>Online SWI-Prolog RDF parser demo</title> -</head> -<body> - -<h1 align=center>Online SWI-Prolog RDF parser demo</h1> - -<p> -This page provides an online demonstration of an RDF parser written in -<a href="http://www.swi.psy.uva.nl/projects/SWI-Prolog/">SWI-Prolog</a>. -This RDF parser has a couple of attractive properties: - -<dl> - <dt><b>Small</b><dd> -Both in terms of source-code (&lt; 700 lines) and executable. - <dt><b>Fast</b><dd> -Parses about 400 Kbytes/sec on a Pentium-II/450. - <dt><b>Conforming</b><dd> -This parser conforms to <a href="http://www.w3.org/TR/REC-rdf-syntax"> -http://www.w3.org/TR/REC-rdf-syntax</a>. - <dt><b>Prolog based</b><dd> -Many people regard the Prolog programming language a good vehicle to -reason about RDF statements. Having a simple and fast Prolog-based RDF -parser makes life easier. - <dt><b>Portability</b><dd> -The RDF parser itself is written in ISO Prolog. The XML parser is -written in ANSI-C. There is no standard for interfacing Prolog and C, -but the interface is relatively small. -</dl> - -A more detailed description of this packages is available in <a -href="rdf2pl.html">in this document</a>. The sources of the parser are -included into the <a -href="http://www.swi.psy.uva.nl/projects/SWI-Prolog/packages/sgml/">sgml</a> -packages for SWI-Prolog. The individual source files can also be -examined through the <a -href="http://gollem.swi.psy.uva.nl/cgi-bin/pl-cvsweb/packages/sgml/RDF"> -cvsweb service</a>, which also provides access to the most recent -<a -href="http://gollem.swi.psy.uva.nl/cgi-bin/pl-cvsweb/packages/sgml/RDF/ChangeLog"> -changes</a> - -<p> -<hr> -Please write your RDF description into the text-area below or select a -local file using the <b>File:</b> item and submit it. If anything goes -wrong, please mail <a href="mailto:jan@swi.psy.uva.nl">Jan -Wielemaker</a>. - -<p> -<em>The RDF-data submitted is kept <b>anonymously</b> on our server and -might be used by us to examine problems with our RDF parser. We do not -publish this material.</em> The result-page provides a form for -attaching a comment to the stored RDF statement. - -<!-- enctype="multipart/form-data" --> - - -<p> -<form - name=rdf - method=get - action="http://localhost:8000/rdf"> -<table align=center> -<tr><td colspan=2> - <textarea name=rdf rows=15 cols=72 wrap=off></textarea> -<tr><td>File: <input name=attachment type=file> - <td align=right> - <input type=button value='Example 1' onClick="ex1()"> - <input type=button value='Example 2' onClick="ex2()"> - <input type=button value='Example 3' onClick="ex3()"> -<tr><td align=left><input type=reset value="Clear Text"> - <td align=right><input type=submit value="Parse RDF"> -</table> -</form> - -<h4><hr>Notes<hr></h4 - -<dl> -<dt><b><em>rdf:</em>resource, etc.</b><dd> -The specification and discussion on the rdf interest group yielded no -satisfactory solution how to deal with RDF attributes that are not in -the RDF namespace such as <b>ID</b>, <b>resource</b>, etc. This parser -interprets such attributes in the namespace of the element, so the -statement below is not interpreted as a <b>propertyElt</b> with value -<code>me</code> but as a <b>typedNode</b> with predicate -<code>resource</code> and value <b>literal(</b>me<b>)</b>. - -<pre> - &lt;s:Creator resource="#me"&gt; -</pre> -</dl> - -<!----------------------------------------------------------------> -<!-- EXAMPLES --> -<!----------------------------------------------------------------> - -<script language="JavaScript"> - -function ex1() -{ document.rdf.rdf.value='<?xml version="1.0"?>\ -\ -<!-- Example from REC-rdf-syntax -->\ -\ -<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"\ - xmlns:s="http://description.org/schema/">\ - <rdf:Description about="http://www.w3.org/Home/Lassila">\ - <s:Creator>Ora Lassila</s:Creator>\ - </rdf:Description>\ -</rdf:RDF>'; -} - -function ex2() -{ document.rdf.rdf.value='<?xml version="1.0"?>\ -\ -<!-- Example from REC-rdf-syntax, demonstrating reification -->\ -\ -<rdf:RDF\ - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"\ - xmlns:s="http://description.org/schema/">\ - <rdf:Description about="http://www.w3.org/Home/Lassila" bagID="D_001">\ - <s:Creator>Ora Lassila</s:Creator>\ - <s:Title>Ora\'s Home Page</s:Title>\ - </rdf:Description>\ -</rdf:RDF>'; -} - -function ex3() -{ document.rdf.rdf.value='<?xml version="1.0"?>\ -\ -<!-- Example from REC-rdf-syntax, non-binary relations -->\ -\ -<RDF\ - xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"\ - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"\ - xmlns:n="http://www.nist.gov/units/">\ - <Description about="John_Smith">\ - <n:weight rdf:parseType="Resource">\ - <rdf:value>200</rdf:value>\ - <n:units rdf:resource="http://www.nist.gov/units/Pounds"/>\ - </n:weight>\ - </Description>\ -</RDF>'; -} -</script> -</body> -</html> - - - - - - diff --git a/packages/sgml/RDF/rdf.pl b/packages/sgml/RDF/rdf.pl deleted file mode 100644 index 7bc083d8c..000000000 --- a/packages/sgml/RDF/rdf.pl +++ /dev/null @@ -1,456 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog - - Author: Jan Wielemaker - E-mail: wielemak@science.uva.nl - WWW: http://www.swi-prolog.org - Copyright (C): 2002-2007, University of Amsterdam - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - As a special exception, if you link this library with other files, - compiled with a Free Software compiler, to produce an executable, this - library does not by itself cause the resulting executable to be covered - by the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - - -:- module(rdf, - [ load_rdf/2, % +File, -Triples - load_rdf/3, % +File, -Triples, +Options - xml_to_rdf/3, % +XML, -Triples, +Options - process_rdf/3 % +File, :OnTriples, +Options - ]). - -:- meta_predicate(process_rdf(+, :, +)). - -:- use_module(library(sgml)). % Basic XML loading -:- use_module(library(option)). % option/3 -:- use_module(library(lists)). -:- use_module(rdf_parser). % Basic parser -:- use_module(rdf_triple). % Generate triples - -%% load_rdf(+File, -Triples) is det. -%% load_rdf(+File, -Triples, +Options) is det. -% -% Parse an XML file holding an RDF term into a list of RDF triples. -% see rdf_triple.pl for a definition of the output format. Options: -% -% * base_uri(+URI) -% URI to use as base -% -% * expand_foreach(+Bool) -% Apply each(Container, Pred, Object) on the members of -% Container -% -% * namespaces(-Namespaces:list(NS=URL)) -% Return list of namespaces declared using xmlns:NS=URL in -% the document. This can be used to update the namespace -% list with rdf_register_ns/2. -% -% @see Use process_rdf/3 for processing large documents in -% _|call-back|_ style. - -load_rdf(File, Triples) :- - load_rdf(File, Triples, []). - -load_rdf(File, Triples, Options0) :- - entity_options(Options0, EntOptions, Options1), - meta_options(Options1, Options), - init_ns_collect(Options, NSList), - load_structure(File, - [ RDFElement - ], - [ dialect(xmlns), - space(sgml), - call(xmlns, rdf:on_xmlns) - | EntOptions - ]), - rdf_start_file(Options, Cleanup), - call_cleanup(xml_to_rdf(RDFElement, Triples0, Options), - rdf_end_file(Cleanup)), - exit_ns_collect(NSList), - post_process(Options, Triples0, Triples). - -entity_options([], [], []). -entity_options([H|T0], Entities, Rest) :- - ( H = entity(_,_) - -> Entities = [H|ET], - entity_options(T0, ET, Rest) - ; Rest = [H|RT], - entity_options(T0, Entities, RT) - ). - - -%% xml_to_rdf(+XML, -Triples, +Options) - -xml_to_rdf(XML, Triples, Options) :- - is_list(Options), !, - xml_to_plrdf(XML, RDF, Options), - rdf_triples(RDF, Triples). -xml_to_rdf(XML, BaseURI, Triples) :- - atom(BaseURI), !, - xml_to_rdf(XML, Triples, [base_uri(BaseURI)]). - - - /******************************* - * POST-PROCESSING * - *******************************/ - -post_process([], Triples, Triples). -post_process([expand_foreach(true)|T], Triples0, Triples) :- !, - expand_each(Triples0, Triples1), - post_process(T, Triples1, Triples). -post_process([_|T], Triples0, Triples) :- !, - post_process(T, Triples0, Triples). - - - /******************************* - * EXPAND * - *******************************/ - -expand_each(Triples0, Triples) :- - select(rdf(each(Container), Pred, Object), - Triples0, Triples1), !, - each_triples(Triples1, Container, Pred, Object, Triples2), - expand_each(Triples2, Triples). -expand_each(Triples, Triples). - -each_triples([], _, _, _, []). -each_triples([H0|T0], Container, P, O, - [H0, rdf(S,P,O)|T]) :- - H0 = rdf(Container, rdf:A, S), - member_attribute(A), !, - each_triples(T0, Container, P, O, T). -each_triples([H|T0], Container, P, O, [H|T]) :- - each_triples(T0, Container, P, O, T). - -member_attribute(A) :- - sub_atom(A, 0, _, _, '_'). % must check number? - - - /******************************* - * BIG FILES * - *******************************/ - -%% process_rdf(+Input, :OnObject, +Options) -% -% Process RDF from Input. Input is either an atom or a term of the -% format stream(Handle). For each encountered description, call -% OnObject(+Triples) to handle the triples resulting from the -% description. Defined Options are: -% -% * base_uri(+URI) -% Determines the reference URI. -% -% * db(DB) -% When loading from a stream, the source is taken from -% this option or -if non-existent- from base_uri. -% -% * lang(LanguageID) -% Set initial language (as xml:lang) -% -% * convert_typed_literal(:Convertor) -% Call Convertor(+Type, +Content, -RDFObject) to create -% a triple rdf(S, P, RDFObject) instead of rdf(S, P, -% literal(type(Type, Content)). -% -% * namespaces(-Namespaces:list(NS=URL)) -% Return list of namespaces declared using xmlns:NS=URL in -% the document. This can be used to update the namespace -% list with rdf_register_ns/2. -% -% * entity(Name, Value) -% Overrule entity values found in the file -% -% * embedded(Boolean) -% If =true=, do not give warnings if rdf:RDF is embedded -% in other XML data. - -process_rdf(File, OnObject, Options0) :- - is_list(Options0), !, - entity_options(Options0, EntOptions, Options1), - meta_options(Options1, Options2), - process_options(Options2, ProcessOptions, Options), - option(base_uri(BaseURI), Options, []), - rdf_start_file(Options, Cleanup), - strip_module(OnObject, Module, Pred), - nb_setval(rdf_object_handler, Module:Pred), - nb_setval(rdf_options, Options), - nb_setval(rdf_state, -), - init_ns_collect(Options, NSList), - ( File = stream(In) - -> Source = BaseURI - ; is_stream(File) - -> In = File, - option(db(Source), Options, BaseURI) - ; open(File, read, In, [type(binary)]), - Close = In, - Source = File - ), - new_sgml_parser(Parser, [dtd(DTD)]), - def_entities(EntOptions, DTD), - set_sgml_parser(Parser, file(Source)), - set_sgml_parser(Parser, dialect(xmlns)), - set_sgml_parser(Parser, space(sgml)), - do_process_rdf(Parser, In, NSList, Close, Cleanup, ProcessOptions). -process_rdf(File, BaseURI, OnObject) :- - process_rdf(File, OnObject, [base_uri(BaseURI)]). - -def_entities([], _). -def_entities([entity(Name, Value)|T], DTD) :- !, - def_entity(DTD, Name, Value), - def_entities(T, DTD). -def_entities([_|T0], DTD) :- - def_entities(T0, DTD). - -def_entity(DTD, Name, Value) :- - open_dtd(DTD, [], Stream), - xml_quote_attribute(Value, QValue), - format(Stream, '<!ENTITY ~w "~w">~n', [Name, QValue]), - close(Stream). - - -do_process_rdf(Parser, In, NSList, Close, Cleanup, Options) :- - call_cleanup(( sgml_parse(Parser, - [ source(In), - call(begin, rdf:on_begin), - call(xmlns, rdf:on_xmlns) - | Options - ]), - exit_ns_collect(NSList) - ), - cleanup_process(Close, Cleanup, Parser)). - -cleanup_process(In, Cleanup, Parser) :- - ( var(In) - -> true - ; close(In) - ), - free_sgml_parser(Parser), - nb_delete(rdf_options), - nb_delete(rdf_object_handler), - nb_delete(rdf_state), - nb_delete(rdf_nslist), - rdf_end_file(Cleanup). - -on_begin(NS:'RDF', Attr, _) :- - rdf_name_space(NS), !, - nb_getval(rdf_options, Options0), - modify_state(Attr, Options0, Options), - nb_setval(rdf_state, Options). -on_begin(Tag, Attr, Parser) :- - nb_getval(rdf_state, Options), - ( Options == (-) - -> nb_getval(rdf_options, RdfOptions), - ( memberchk(embedded(true), RdfOptions) - -> true - ; print_message(warning, rdf(unexpected(Tag, Parser))) - ) - ; get_sgml_parser(Parser, line(Start)), - get_sgml_parser(Parser, file(File)), - sgml_parse(Parser, - [ document(Content), - parse(content) - ]), - nb_getval(rdf_object_handler, OnTriples), - element_to_plrdf(element(Tag, Attr, Content), Objects, Options), - rdf_triples(Objects, Triples), - call(OnTriples, Triples, File:Start) - ). - -%% on_xmlns(+NS, +URL, +Parser) -% -% Build up the list of encountered xmlns:NS=URL declarations. We -% use destructive assignment here as an alternative to -% assert/retract, ensuring thread-safety and better performance. - -on_xmlns(NS, URL, _Parser) :- - ( nb_getval(rdf_nslist, List), - List = list(L0) - -> nb_linkarg(1, List, [NS=URL|L0]) - ; true - ). - -init_ns_collect(Options, NSList) :- - ( option(namespaces(NSList), Options, -), - NSList \== (-) - -> nb_setval(rdf_nslist, list([])) - ; nb_setval(rdf_nslist, -), - NSList = (-) - ). - -exit_ns_collect(NSList) :- - ( NSList == (-) - -> true - ; nb_getval(rdf_nslist, list(NSList)) - ). - -modify_state([], Options, Options). -modify_state([H|T], Options0, Options) :- - modify_state1(H, Options0, Options1), - modify_state(T, Options1, Options). - -modify_state1(xml:base = Base0, Options0, Options) :- !, - remove_fragment(Base0, Base), - set_option(base_uri(Base), Options0, Options). -modify_state1(xml:lang = Lang, Options0, Options) :- !, - set_option(lang(Lang), Options0, Options). -modify_state1(_, Options, Options). - -%% remove_fragment(+URI, -WithoutFragment) -% -% When handling xml:base, we must delete the possible fragment. - -remove_fragment(URI, Plain) :- - sub_atom(URI, B, _, _, #), !, - sub_atom(URI, 0, B, _, Plain). -remove_fragment(URI, URI). - - -set_option(Opt, Options0, [Opt|Options]) :- - functor(Opt, F, A), - functor(VO, F, A), - delete(Options0, VO, Options). - - -%% meta_options(+OptionsIn, -OptionsOut) -% -% Do module qualification for options that are module sensitive. - -:- module_transparent - meta_options/2. - -meta_options([], []). -meta_options([Name=Value|T0], List) :- - atom(Name), !, - Opt =.. [Name, Value], - meta_options([Opt|T0], List). -meta_options([H0|T0], [H|T]) :- - ( H0 = convert_typed_literal(Handler) - -> strip_module(Handler, M, P), - H = convert_typed_literal(M:P) - ; H = H0 - ), - meta_options(T0, T). - - -process_options(Options, Process, RestOptions) :- - select_option(content_length(Len), Options, RestOptions), !, - Process = [content_length(Len)]. -process_options(Options, [], Options). - - - /******************************* - * MESSAGES * - *******************************/ - -:- multifile - prolog:message/3. - -% Catch messages. sgml/4 is generated by the SGML2PL binding. - -prolog:message(rdf(unparsed(Data))) --> - { phrase(unparse_xml(Data), XML) - }, - [ 'RDF: Failed to interpret "~s"'-[XML] ]. -prolog:message(rdf(shared_blank_nodes(N))) --> - [ 'RDF: Shared ~D blank nodes'-[N] ]. -prolog:message(rdf(not_a_name(Name))) --> - [ 'RDF: argument to rdf:ID is not an XML name: ~p'-[Name] ]. -prolog:message(rdf(redefined_id(Id))) --> - [ 'RDF: rdf:ID ~p: multiple definitions'-[Id] ]. -prolog:message(rdf(unexpected(Tag, Parser))) --> - { get_sgml_parser(Parser, file(File)), - get_sgml_parser(Parser, line(Line)) - }, - [ 'RDF: ~w:~d: Unexpected element ~w'-[File, Line, Tag] ]. - - - /******************************* - * XML-TO-TEXT * - *******************************/ - -unparse_xml([]) --> !, - []. -unparse_xml([H|T]) --> !, - unparse_xml(H), - unparse_xml(T). -unparse_xml(Atom) --> - { atom(Atom) - }, !, - atom(Atom). -unparse_xml(element(Name, Attr, Content)) --> - "<", - identifier(Name), - attributes(Attr), - ( { Content == [] - } - -> "/>" - ; ">", - unparse_xml(Content) - ). - -attributes([]) --> - []. -attributes([H|T]) --> - attribute(H), - attributes(T). - -attribute(Name=Value) --> - " ", - identifier(Name), - "=", - value(Value). - -identifier(NS:Local) --> !, - "{", atom(NS), "}", - atom(Local). -identifier(Local) --> - atom(Local). - -atom(Atom, Text, Rest) :- - atom_codes(Atom, Chars), - append(Chars, Rest, Text). - -value(Value) --> - { atom_codes(Value, Chars) - }, - "\"", - quoted(Chars), - "\"". - -quoted([]) --> - []. -quoted([H|T]) --> - quote(H), !, - quoted(T). - -quote(0'<) --> "&lt;". -quote(0'>) --> "&gt;". -quote(0'") --> "&quot;". -quote(0'&) --> "&amp;". -quote(X) --> [X]. - - - /******************************* - * XREF * - *******************************/ - -:- multifile prolog:meta_goal/2. -prolog:meta_goal(process_rdf(_,G,_), [G+2]). diff --git a/packages/sgml/RDF/rdf2pl.doc b/packages/sgml/RDF/rdf2pl.doc deleted file mode 100644 index 31b3732a7..000000000 --- a/packages/sgml/RDF/rdf2pl.doc +++ /dev/null @@ -1,475 +0,0 @@ -\documentclass[11pt]{article} -\usepackage{pl} -\usepackage{html} -\usepackage{times} - -\onefile -\htmloutput{html} % Output directory -\htmlmainfile{index} % Main document file -\bodycolor{white} % Page colour - -\newcommand{\elem}[1]{{\tt\string<#1\string>}} - -\begin{document} - -\title{SWI-Prolog RDF parser} -\author{Jan Wielemaker \\ - HCS, \\ - University of Amsterdam \\ - The Netherlands \\ - E-mail: \email{jan@swi-prolog.org}} - -\maketitle - -\begin{abstract} -\url[RDF]{http://www.w3.org/RDF/} ({\bf R}esource {\bf D}escription {\bf -F}ormat) is a \url[W3C]{http://www.w3.org/} standard for expressing -meta-data about web-resources. It has two representations providing -the same semantics. RDF documents are normally transferred as XML -documents using the RDF-XML syntax. This format is unsuitable for -processing. The parser defined here converts an RDF-XML document into -the \jargon{triple} notation. The library \pllib{rdf_write} creates -an RDF/XML document from a list of triples. -\end{abstract} - -\vfill - -\tableofcontents - -\vfill -\vfill - -\newpage - -\section{Introduction} - -RDF is a promising standard for representing meta-data about documents -on the web as well as exchanging frame-based data (e.g. ontologies). RDF -is often associated with `semantics on the web'. It consists of a formal -data-model defined in terms of \jargon{triples}. In addition, a -\jargon{graph} model is defined for visualisation and an XML application -is defined for exchange. - -`Semantics on the web' is also associated with the Prolog programming -language. It is assumed that Prolog is a suitable vehicle to reason with -the data expressed in RDF models. Most of the related web-infra -structure (e.g. XML parsers, DOM implementations) are defined in Java, -Perl, C or C+{+}. - -Various routes are available to the Prolog user. Low-level XML parsing -is due to its nature best done in C or C+{+}. These languages produce -fast code. As XML/SGML are at the basis of most of the other web-related -formats we will benefit most here. XML and SGML, being very stable -specifications, make fast compiled languages even more attractive. - -But what about RDF? RDF-XML is defined in XML, and provided with a -Prolog term representing the XML document processing it according to the -RDF syntax is quick and easy in Prolog. The alternative, getting yet -another library and language attached to the system, is getting less -attractive. In this document we explore the suitability of Prolog for -processing XML documents in general and into RDF in particular. - - -\section{Parsing RDF in Prolog} - -We realised an RDF compiler in Prolog on top of the {\bf sgml2pl} -package (providing a name-space sensitive XML parser). The -transformation is realised in two passes. - -The first pass rewrites the XML term into a Prolog term conveying the -same information in a more friendly manner. This transformation is -defined in a high-level pattern matching language defined on top of -Prolog with properties similar to DCG (Definite Clause Grammar). - -The source of this translation is very close to the BNF notation used by -the \url[specification]{http://www.w3.org/TR/REC-rdf-syntax/}, so -correctness is `obvious'. Below is a part of the definition for RDF -containers. Note that XML elements are represented using a term of the -format: - -\begin{quote} - \term{element}{Name, [AttrName = Value...], [Content ...]} -\end{quote} - -\begin{code} -memberElt(LI) ::= - \referencedItem(LI). -memberElt(LI) ::= - \inlineItem(LI). - -referencedItem(LI) ::= - element(\rdf(li), - [ \resourceAttr(LI) ], - []). - -inlineItem(literal(LI)) ::= - element(\rdf(li), - [ \parseLiteral ], - LI). -inlineItem(description(description, _, _, Properties)) ::= - element(\rdf(li), - [ \parseResource ], - \propertyElts(Properties)). -inlineItem(LI) ::= - element(\rdf(li), - [], - [\rdf_object(LI)]), !. % inlined object -inlineItem(literal(LI)) ::= - element(\rdf(li), - [], - [LI]). % string value -\end{code} - -Expression in the rule that are prefixed by the \verb$\$ operator acts -as invocation of another rule-set. The body-term is converted into -a term where all rule-references are replaced by variables. The -resulting term is matched and translation of the arguments is achieved -by calling the appropriate rule. Below is the Prolog code for the -{\bf referencedItem} rule: - -\begin{code} -referencedItem(A, element(B, [C], [])) :- - rdf(li, B), - resourceAttr(A, C). -\end{code} - -Additional code can be added using a notation close to the Prolog -DCG notation. Here is the rule for a description, producing -properties both using {\bf propAttrs} and {\bf propertyElts}. - -\begin{code} -description(description, About, BagID, Properties) ::= - element(\rdf('Description'), - \attrs([ \?idAboutAttr(About), - \?bagIdAttr(BagID) - | \propAttrs(PropAttrs) - ]), - \propertyElts(PropElts)), - { !, append(PropAttrs, PropElts, Properties) - }. -\end{code} - - -\section{Predicates} - -The parser is designed to operate in various environments and therefore -provides interfaces at various levels. First we describe the top level -defined in \pllib{rdf}, simply parsing a RDF-XML file into a list of -triples. Please note these are {\em not} asserted into the database -because it is not necessarily the final format the user wishes to reason -with and it is not clean how the user wants to deal with multiple RDF -documents. Some options are using global URI's in one pool, in Prolog -modules or using an additional argument. - -\begin{description} - \predicate{load_rdf}{2}{+File, -Triples} -Same as \term{load_rdf}{File, Triples, []}. - - \predicate{load_rdf}{3}{+File, -Triples, +Options} -Read the RDF-XML file \arg{File} and return a list of \arg{Triples}. -\arg{Options} defines additional processing options. Currently defined -options are: - - \begin{description} - \termitem{base_uri}{BaseURI} -If provided local identifiers and identifier-references are globalised -using this URI. If omited or the atom \verb$[]$, local identifiers are -not tagged. - - \termitem{blank_nodes}{Mode} -If \arg{Mode} is \const{share} (default), blank-node properties (i.e.\ -complex properties without identifier) are reused if they result in -exactly the same triple-set. Two descriptions are shared if their -intermediate description is the same. This means they should produce the -same set of triples in the same order. The value \const{noshare} creates -a new resource for each blank node. - - \termitem{expand_foreach}{Boolean} -If \arg{Boolean} is \const{true}, expand \const{rdf:aboutEach} into -a set of triples. By default the parser generates -\term{rdf}{each(Container), Predicate, Subject}. - - \termitem{lang}{Lang} -Define the initial language (i.e.\ pretend there is an \const{xml:lang} -declaration in an enclosing element). - - \termitem{ignore_lang}{Bool} -If \const{true}, \const{xml:lang} declarations in the document are -ignored. This is mostly for compatibility with older versions of -this library that did not support language identifiers. - - \termitem{convert_typed_literal}{:ConvertPred} -If the parser finds a literal with the \const{rdf:datatype}=\arg{Type} -attribute, call \term{ConvertPred}{+Type, +Content, -Literal}. -\arg{Content} is the XML element contentas returned by the XML -parser (a list). The predicate must unify \arg{Literal} -with a Prolog representation of \arg{Content} according to -\arg{Type} or throw an exception if the conversion cannot be made. - -This option servers two purposes. First of all it can be used -to ignore type declarations for backward compatibility of this -library. Second it can be used to convert typed literals to -a meaningful Prolog representation. E.g.\ convert '42' to the -Prolog integer 42 if the type is \const{xsd:int} or a related -type. - - \termitem{namespaces}{-List} -Unify \arg{List} with a list of \arg{NS}=\arg{URL} for each -encountered \const{xmlns}:\arg{NS}=\arg{URL} declaration found -in the source. - - \termitem{entity}{+Name, +Value} -Overrule entity declaration in file. As it is common practice -to declare namespaces using entities in RDF/XML, this option -allows for changing the namespace without changing the file. -Multiple of these options are allowed. - \end{description} - -The \arg{Triples} list is a list of \term{rdf}{Subject, Predicate, -Object} triples. \arg{Subject} is either a plain resource (an atom), -or one of the terms \term{each}{URI} or \term{prefix}{URI} with the -obvious meaning. \arg{Predicate} is either a plain atom for -explicitely non-qualified names or a term -\mbox{\arg{NameSpace}{\bf :}\arg{Name}}. If \arg{NameSpace} is the -defined RDF name space it is returned as the atom \const{rdf}. -Finally, \arg{Object} is a URI, a \arg{Predicate} or a term of the -format \term{literal}{Value} for literal values. \arg{Value} is -either a plain atom or a parsed XML term (list of atoms and elements). -\end{description} - - -\subsection{RDF Object representation} \label{sec:rdfobject} - -The \emph{Object} (3rd) part of a triple can have several different -types. If the object is a resource it is returned as either a plain -atom or a term \mbox{\arg{NameSpace}{\bf :}\arg{Name}}. If it is a -literal it is returned as \term{literal}{Value}, where \arg{Value} -takes one of the formats defined below. - -\begin{itemlist} - \item [An atom] -If the literal \arg{Value} is a plain atom is a literal value not -subject to a datatype or \const{xml:lang} qualifier. - - \item [\term{lang}{LanguageID, Atom}] -If the literal is subject to an \const{xml:lang} qualifier -\arg{LanguageID} specifies the language and \arg{Atom} the -actual text. - - \item [A list] -If the literal is an XML literal as created by -\mbox{parseType="Literal"}, the raw output of the XML parser for the -content of the element is returned. This content is a list of -\term{element}{Name, Attributes, Content} and atoms for CDATA parts as -described with the SWI-Prolog \url[SGML/XML -parser]{http://www.swi-prolog.org/packages/sgml2pl.html} - - \item [\term{type}{Type, StringValue}] -If the literal has an \verb$rdf:datatype=$\arg{Type} a term of this -format is returned. -\end{itemlist} - - -\subsection{Name spaces} - -XML name spaces are identified using a URI. Unfortunately various URI's -are in common use to refer to RDF. The \file{rdf_parser.pl} module -therefore defines the namespace as a multifile/1 predicate, that can be -extended by the user. For example, to parse the \url[Netscape -OpenDirectory]{http://www.mozilla.org/rdf/doc/inference.html} -\file{structure.rdf} file, the following declarations are used: - -\begin{code} -:- multifile - rdf_parser:rdf_name_space/1. - -rdf_parser:rdf_name_space('http://www.w3.org/TR/RDF/'). -rdf_parser:rdf_name_space('http://directory.mozilla.org/rdf'). -rdf_parser:rdf_name_space('http://dmoz.org/rdf'). -\end{code} - -The initial definition of this predicate is given below. - -\begin{code} -rdf_name_space('http://www.w3.org/1999/02/22-rdf-syntax-ns#'). -rdf_name_space('http://www.w3.org/TR/REC-rdf-syntax'). -\end{code} - - -\subsection{Low-level access} - -The above defined load_rdf/[2,3] is not always suitable. For example, it -cannot deal with documents where the RDF statement is embedded in an XML -document. It also cannot deal with really large documents (e.g.\ the -Netscape OpenDirectory project, currently about 90 MBytes), without huge -amounts of memory. - -For really large documents, the {\bf sgml2pl} parser can be programmed -to handle the content of a specific element (i.e. \elem{rdf:RDF}) -element-by-element. The parsing primitives defined in this section -can be used to process these one-by-one. - -\begin{description} - \predicate{xml_to_rdf}{3}{+XML, +BaseURI, -Triples} -Process an XML term produced by load_structure/3 using the -\term{dialect}{xmlns} output option. \arg{XML} is either -a complete \elem{rdf:RDF} element, a list of RDF-objects -(container or description) or a single description of container. - - \predicate{process_rdf}{3}{+Input, :OnTriples, +Options} - -Exploits the call-back interface of {\bf sgml2pl}, calling -\term{\arg{OnTriples}}{Triples, File:Line} with the list of triples -resulting from a single top level RDF object for each RDF element in the -input as well as the source-location where the description started. -\arg{Input} is either a file name or term \term{stream}{Stream}. When -using a stream all triples are associated to the value of the -\const{base_uri} option. This predicate can be used to process arbitrary -large RDF files as the file is processed object-by-object. The example -below simply asserts all triples into the database: - -\begin{code} -assert_list([], _). -assert_list([H|T], Source) :- - assert(H), - assert_list(T, Source). - -?- process_rdf('structure,rdf', assert_list, []). -\end{code} - -\arg{Options} are described with load_rdf/3. The option -\const{expand_foreach} is not supported as the container may be in a -different description. Additional it provides \const{embedded}: - - \begin{description} - \termitem{embedded}{Boolean} -The predicate process_rdf/3 processes arbitrary XML documents, only -interpreting the content of \const{rdf:RDF} elements. If this option -is \const{false} (default), it gives a warning on elements that are -not processed. The option \term{embedded}{true} can be used to -process RDF embedded in \jargon{xhtml} without warnings. - \end{description} - -\end{description} - - - - -\section{Writing RDF graphs} - -The library \pllib{rdf_write} provides the inverse of load_rdf/2 using -the predicate rdf_write_xml/2. In most cases the RDF parser is used in -combination with the Semweb package providing \pllib{semweb/rdf_db}. -This library defines rdf_save/2 to save a named RDF graph from the -database to a file. This library writes a list of rdf terms to a stream. -It has been developed for the SeRQL server which computes an RDF graph -that needs to be transmitted in an HTTP request. As we see this as a -typical use-case scenario the library only provides writing to a stream. - -\begin{description} - \predicate{rdf_write_xml}{2}{+Stream, +Triples} -Write an RDF/XML document to \arg{Stream} from the list of \arg{Triples}. -\arg{Stream} must use one of the following Prolog stream encodings: -\const{ascii}, \const{iso_latin_1} or \const{utf8}. Characters that -cannot be represented in the encoding are represented as XML entities. -Using ASCII is a good idea for documents that can be represented almost -completely in ASCII. For more international documents using UTF-8 creates -a more compact document that is easier to read. - -\begin{code} -rdf_write(File, Triples) :- - open(File, write, Out, [encoding(utf8)]), - call_cleanup(rdf_write_xml(Out, Triples), - close(Out)). -\end{code} -\end{description} - - -\section{Testing the RDF translator} - -A test-suite and driver program are provided by \file{rdf_test.pl} in -the source directory. To run these tests, load this file into Prolog in -the distribution directory. The test files are in the directory -\file{suite} and the proper output in \file{suite/ok}. Predicates -provided by \file{rdf_test.pl}: - -\begin{description} - \predicate{suite}{1}{+N} -Run test \arg{N} using the file \file{suite/tN.rdf} and display the -RDF source, the intermediate Prolog representation and the resulting -triples. - \predicate{passed}{1}{+N} -Process \file{suite/tN.rdf} and store the resulting triples in -\file{suite/ok/tN.pl} for later validation by test/0. - \predicate{test}{0}{} -Run all tests and classify the result. -\end{description} - -\appendix - -\section{Metrics} - -It took three days to write and one to document the Prolog RDF parser. -A significant part of the time was spent understanding the RDF -specification. - -The size of the source (including comments) is given in the table -below. - -\begin{center} -\begin{tabular}{|rrr|l|l|} -\hline -\bf lines & \bf words & \bf bytes & \bf file & \bf function \\ -\hline - 109 & 255 & 2663 & rdf.pl & Driver program \\ - 312 & 649 & 6416 & rdf_parser.pl & 1-st phase parser \\ - 246 & 752 & 5852 & rdf_triple.pl & 2-nd phase parser \\ - 126 & 339 & 2596 & rewrite.pl & rule-compiler \\ -\hline - 793 & 1995 & 17527 & total & \\ -\hline -\end{tabular} -\end{center} - - -We also compared the performance using an RDF-Schema file generated by -\url[Protege-2000]{http://www.smi.stanford.edu/projects/protege/} and -interpreted as RDF. This file contains 162 descriptions in 50 Kbytes, -resulting in 599 triples. Environment: Intel Pentium-II/450 with -384 Mbytes memory running SuSE Linux 6.3. - -The parser described here requires 0.15 seconds excluding 0.13 seconds -Prolog startup time to process this file. The \url[Pro -Solutions]{http://www.pro-solutions.com/rdfdemo/} parser (written in -Perl) requires 1.5 seconds exluding 0.25 seconds startup time. - - -\section{Installation} - -\subsection{Unix systems} - -Installation on Unix system uses the commonly found {\em configure}, -{\em make} and {\em make install} sequence. SWI-Prolog should be -installed before building this package. If SWI-Prolog is not installed -as \program{pl}, the environment variable \env{PL} must be set to the -name of the SWI-Prolog executable. Installation is now accomplished -using: - -\begin{code} -% ./configure -% make -% make install -\end{code} - -This installs the Prolog library files in \file{$PLBASE/library}, where -\file{$PLBASE} refers to the SWI-Prolog `home-directory'. - -\subsection{Windows} - -Run the file \file{setup.pl} by double clicking it. This will install -the required files into the SWI-Prolog directory and update the -library directory. - -\end{document} - - diff --git a/packages/sgml/RDF/rdf_diagram.pl b/packages/sgml/RDF/rdf_diagram.pl deleted file mode 100644 index c028ca1e4..000000000 --- a/packages/sgml/RDF/rdf_diagram.pl +++ /dev/null @@ -1,492 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog SGML/XML parser - - Author: Jan Wielemaker - E-mail: jan@swi.psy.uva.nl - WWW: http://www.swi.psy.uva.nl/projects/SWI-Prolog/ - Copying: LGPL-2. See the file COPYING or http://www.gnu.org - - Copyright (C) 1990-2002 SWI, University of Amsterdam. All rights reserved. -*/ - -:- module(rdf_diagram, - [ rdf_diagram_from_file/1 % +File - ]). -:- use_module(library(pce)). -:- use_module(library(pce_tagged_connection)). -:- use_module(library(autowin)). -:- use_module(library(pce_report)). -:- use_module(library(print_graphics)). -:- use_module(library(rdf_parser)). % get access to declared namespaces - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -This file defines the class rdf_diagram, a window capable of showing a -set of triples. - -The predicate rdf_diagram_from_file(+File) is a simple demo and useful -tool to show RDF from simple RDF files. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - - - /******************************* - * SIMPLE ENTRY * - *******************************/ - -% rdf_diagram_from_file(+File) -% -% Show the triples from File in a window. - -rdf_diagram_from_file(File) :- - absolute_file_name(File, - [ access(read), - extensions([rdf,rdfs,owl,'']) - ], AbsFile), - load_rdf(AbsFile, Triples, - [ expand_foreach(true) - ]), - new(D, rdf_diagram(string('RDF diagram for %s', File))), - send(new(report_dialog), below, D), - send(D, triples, Triples), - send(D, open). - - - /******************************* - * CLASS RDF-DIAGRAM * - *******************************/ - -:- pce_begin_class(rdf_diagram, auto_sized_picture, - "Show set of RDF triples in a window"). -:- use_class_template(print_graphics). - -variable(auto_layout, bool := @on, both, "Automatically layout on resize"). -variable(type_in_node, bool := @on, both, "Display type inside node"). - -initialise(D, Label:[name]) :-> - send_super(D, initialise, Label), - send(D, scrollbars, both), - send(D, fill_popup), - send(D, resize_message, - if(and(D?auto_layout == @on, - D?focus_recogniser == @nil), - message(D, layout))). - -fill_popup(D) :-> - send(D, popup, new(P, popup)), - send_list(P, append, - [ menu_item(layout, message(D, layout)), - gap, - menu_item(print, message(D, print)) - ]). - -:- pce_group(triples). - -append(D, Triple:prolog) :-> - "Append and rdf(Subject, Predicate, Object) triple":: - ( subject_name(Triple, SubjectName), - get(D, resource, SubjectName, Subject), - ( get(D, type_in_node, @on), - is_type(Triple) - -> object_resource(Triple, ObjectName), - send(Subject, type, ObjectName) - ; predicate_name(Triple, PredName), - ( object_resource(Triple, ObjectName) - -> get(D, resource, ObjectName, Object) - ; object_literal(Triple, Literal) - -> get(D, literal, Literal, Object) - ), - send(Subject, connect, PredName, Object) - ) - -> true - ; term_to_atom(Triple, Atom), - ignore(send(D, report, error, - 'Failed to display triple: %s', Atom)) - ). - -triples(D, Triples:prolog) :-> - "Show disgram from Prolog triples":: - send(D, clear), - forall(member(T, Triples), - send(D, append, T)), - send(D, layout). - -resource(D, Resource:name) :-> - "Add Resource to diagram":: - get(D, resource, Resource, @on, _). - -resource(D, Resource:name, Create:[bool], Subject:rdf_resource) :<- - "Get reference for a subject or create one":: - ( get(D, member, Resource, Subject) - -> true - ; Create \== @off, - get(D, create_resource, Resource, Subject), - send(D, display, Subject, D?visible?center) - ). - -literal(D, Value:prolog, Gr:rdf_literal) :<- - "Display a literal. Don't try to re-use":: - ( literal_name(Value, Name), - get(D, member, Name, Gr) - -> true - ; get(D, create_literal, Value, Gr), - send(D, display, Gr, D?visible?center) - ). - - -create_resource(D, Resource:name, Subject:rdf_resource) :<- - "Create visualisation of Resource":: - new(Subject, rdf_resource(Resource, D)). - - -create_literal(_D, Value:prolog, Gr:rdf_literal) :<- - "Create visualisation of literal":: - new(Gr, rdf_literal(Value)). - - -node_label(_D, Resource:name, Label:name) :<- - "Generate label to show for a node":: - local_name(Resource, Label). - - -:- pce_group(layout). - -layout(D) :-> - "Produce automatic layout":: - new(Nodes, chain), - send(D?graphicals, for_all, - if(message(@arg1, instance_of, rdf_any), - message(Nodes, append, @arg1))), - send(Nodes?head, layout, 2, 40, - iterations := 200, - area := D?visible, - network := Nodes). - -copy_layout(D, From:rdf_diagram, Subst:prolog) :-> - "Copy the layout from another windows":: - send(D?graphicals, for_some, - message(D, copy_location, @arg1, From, prolog(Subst))). - -copy_location(_D, Obj:graphical, From:rdf_diagram, Subst:prolog) :-> - "Copy location of a single RDF object":: - ( send(Obj, instance_of, rdf_any) - -> ( get(Obj, name, Name), - find(From, Name, Subst, FromObj) - -> format('Copied location of ~p from ~p~n', [Obj, FromObj]), - get(FromObj, center, Center), - send(Obj, center, Center) - ) - ; true - ). - -find(D, Name, _Subst, Obj) :- - get(D, member, Name, Obj). -find(D, Name, Subst, Obj) :- - member(Name=AltName, Subst), - atom_concat('_:', AltName, FullAltName), - get(D, member, FullAltName, Obj). -find(D, Name, Subst, _) :- - format('Cannot find ~w in ~p, Subst =~n', [Name, D]), - pp(Subst), - fail. - - -:- pce_end_class(rdf_diagram). - - - /******************************* - * SHAPES * - *******************************/ - -:- pce_begin_class(rdf_connection, tagged_connection, - "Represents a triple"). - -:- pce_global(@rdf_link, new(link(link, link, - line(0,0,0,0,second)))). - -initialise(C, Gr1:graphical, Gr2:graphical, Pred:name, Ctx:[object]) :-> - "Create from predicate":: - send_super(C, initialise, Gr1, Gr2, @rdf_link), - send(C, tag, rdf_label(Pred, italic, Ctx)). - -ideal_length(C, Len:int) :<- - "Layout: compute the desired length":: - get(C, height, H), - ( H < 40 - -> get(C, tag, Tag), - get(Tag, width, W), - Len is W + 30 - ; Len = 40 - ). - -:- pce_end_class(rdf_connection). - -:- pce_begin_class(rdf_any(name), figure, - "Represent an RDF resource or literal"). - -handle(w/2, 0, link, north). -handle(w, h/2, link, east). -handle(w/2, h, link, south). -handle(0, h/2, link, west). - -initialise(F, Ref:name) :-> - "Create visualisation":: - send_super(F, initialise), - send(F, name, Ref). - -connect(F, Pred:name, Object:graphical) :-> - new(_C, rdf_connection(F, Object, Pred, F)). - -:- pce_global(@rdf_any_recogniser, - make_rdf_any_recogniser). -:- pce_global(@rdf_any_popup, - make_rdf_any_popup). - -make_rdf_any_recogniser(G) :- - new(M1, move_gesture(left)), - new(M2, move_network_gesture(left, c)), - new(P, popup_gesture(@receiver?popup)), - new(G, handler_group(M1, M2, P)). - -popup(_F, Popup:popup) :<- - "Create popup menu":: - Popup = @rdf_any_popup. - -make_rdf_any_popup(Popup) :- - new(Popup, popup), - Gr = @arg1, - send(Popup, append, - menu_item(layout, message(Gr, layout))). - -event(F, Ev:event) :-> - ( \+ send(Ev, is_a, ms_right_down), - send_super(F, event, Ev) - -> true - ; send(@rdf_any_recogniser, event, Ev) - ). - -node_label(F, Resource:name, Label:name) :<- - "Return label to use for a resource":: - get(F, device, Dev), - ( send(Dev, has_get_method, node_label) - -> get(Dev, node_label, Resource, Label) - ; local_name(Resource, Label) - ). - -:- pce_end_class(rdf_any). - - -:- pce_begin_class(move_network_gesture, move_gesture, - "Move network of connected graphicals"). - -variable(outline, box, get, - "Box used to indicate move"). -variable(network, chain*, both, - "Stored value of the network"). -variable(origin, point, get, - "Start origin of network"). - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -The gesture maintains an outline, the selection to be moved and the -positon where the move orginiated. The outline itself is given a -normal move_gesture to make it move on dragging. This move_gesture -should operate on the same button and modifier. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -initialise(G, B:[button_name], M:[modifier]) :-> - send(G, send_super, initialise, B, M), - send(G, slot, outline, new(Box, box(0,0))), - send(G, slot, origin, point(0,0)), - send(Box, texture, dotted), - send(Box, recogniser, move_gesture(G?button, G?modifier)). - -initiate(G, Ev:event) :-> - get(Ev, receiver, Gr), - get(Gr, device, Dev), - get(G, outline, Outline), - get(Gr, network, Network), - send(G, network, Network), - new(Union, area(0,0,0,0)), - send(Network, for_all, message(Union, union, @arg1?area)), - send(G?origin, copy, Union?position), - send(Outline, area, Union), - send(Union, done), - send(Dev, display, Outline), - ignore(send(Ev, post, Outline)). - -drag(G, Ev) :-> - send(Ev, post, G?outline). - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Terminate. First undisplay the outline. Next calculate by how much -the outline has been dragged and move all objects of the selection by -this amount. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -terminate(G, Ev:event) :-> - ignore(send(G, drag, Ev)), - get(G, outline, Outline), - send(Outline, device, @nil), - get(Outline?area?position, difference, G?origin, Offset), - get(G, network, Network), - send(Network, for_all, message(@arg1, relative_move, Offset)), - send(G, network, @nil). - -:- pce_end_class(move_network_gesture). - - - -:- pce_begin_class(rdf_label, text, - "Label for an RDF relation"). - -variable(resource, name, get, "Represented predicate"). - -initialise(L, Pred:name, Font:font, Context:[object]) :-> - ( Context == @default - -> local_name(Pred, Label) - ; get(Context, node_label, Pred, Label) - ), - send_super(L, initialise, Label, center, Font), - send(L, slot, resource, Pred), - send(L, background, @default). - -:- pce_global(@rdf_label_recogniser, - make_rdf_label_recogniser). - -make_rdf_label_recogniser(G) :- - new(G, handler_group), - send(G, append, - handler(area_enter, message(@receiver, identify))), - send(G, append, - handler(area_exit, message(@receiver, report, status, ''))), - send(G, append, popup_gesture(new(P, popup))), - send_list(P, append, - [ menu_item(copy, - message(@display, copy, @arg1?resource)) - ]). - -event(F, Ev:event) :-> - ( send_super(F, event, Ev) - -> true - ; send(@rdf_label_recogniser, event, Ev) - ). - -identify(L) :-> - send(L, report, status, '%s', L?resource). - -:- pce_end_class. - - - -:- pce_begin_class(rdf_resource, rdf_any, - "Represent an RDF resource"). - -initialise(F, Ref:name, Ctx:[object]) :-> - "Create visualisation":: - send_super(F, initialise, Ref), - send(F, display, ellipse(100, 50), point(-50,-25)), - send(F, display, new(T, rdf_label(Ref, normal, Ctx))), - send(T, center, point(0,0)). - -type(F, Type:name) :-> - send(F, display, new(TL, rdf_label(Type, small, F))), - send(TL, center, point(0,14)), - get(F, member, ellipse, E), - send(E, shadow, 2). - -identify(F) :-> - send(F, report, status, 'Resource %s', F?name). - -:- pce_end_class(rdf_resource). - - -:- pce_begin_class(rdf_literal, rdf_any, - "Represent an RDF literal value"). - -variable(value, prolog, get, "Represented literal value"). - -initialise(F, Value:prolog) :-> - "Create visualisation":: - send(F, slot, value, Value), - literal_label(Value, Label), - atom_concat('__lit:', Label, Id), - send_super(F, initialise, Id), - send(F, display, new(B, box)), - send(B, fill_pattern, colour(grey80)), - send(B, pen, 0), - send(F, display, new(T, text(Label, center))), - send(T, center, point(0,0)), - send(F, fit). - -literal_label(literal(Value0), Value) :- !, - literal_label(Value0, Value). -literal_label(xml(Value0), Value) :- !, - literal_label(Value0, Value). -literal_label(Value, Value) :- - atomic(Value), !. -literal_label(Value, Label) :- - term_to_atom(Value, Label). - -literal_name(Value, Name) :- - literal_label(Value, Label), - atom_concat('__lit:', Label, Name). - -fit(F) :-> - "Make box fit contents":: - get(F, member, text, Text), - get(Text?area, clone, Area), - send(Area, increase, 3), - get(F, member, box, Box), - send(Box, area, Area). - -:- pce_end_class(rdf_literal). - - - - - - - /******************************* - * PRIMITIVES * - *******************************/ - -subject_name(rdf(Name0, _, _), Name) :- - resource_name(Name0, Name). -predicate_name(rdf(_, Name0, _), Name) :- - resource_name(Name0, Name). -object_resource(rdf(_, _, Name0), Name) :- - resource_name(Name0, Name). -object_literal(rdf(_,_,Literal), Literal). - - -resource_name(Name, Name) :- - atom(Name), !. -resource_name(rdf:Local, Name) :- !, % known namespaces - concat_atom([rdf, :, Local], Name). -resource_name(NS:Local, Name) :- !, - atom_concat(NS, Local, Name). -resource_name(node(Anon), Name) :- % Not for predicates - atom_concat('_:', Anon, Name). - -is_type(rdf(_, rdf:type, _)) :- !. % our parser -is_type(rdf(_, Pred, _)) :- % our parser - atom(Pred), - rdf_name_space(NS), - atom_concat(NS, type, Pred), !. - -% local_name(+Resource, -Label) -% -% Return easy readable local name - -local_name(Resource, Local) :- - sub_atom(Resource, _, _, A, #), - sub_atom(Resource, _, A, 0, Local), - \+ sub_atom(Local, _, _, _, #), !. -local_name(Resource, Local) :- - atom_concat('rdf:', Local, Resource), !. -local_name(Resource, Local) :- - file_base_name(Resource, Local), - Local \== ''. -local_name(Resource, Resource). - diff --git a/packages/sgml/RDF/rdf_ntriples.pl b/packages/sgml/RDF/rdf_ntriples.pl deleted file mode 100644 index bbc303a51..000000000 --- a/packages/sgml/RDF/rdf_ntriples.pl +++ /dev/null @@ -1,311 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog SGML/XML parser - - Author: Jan Wielemaker - E-mail: jan@swi.psy.uva.nl - WWW: http://www.swi.psy.uva.nl/projects/SWI-Prolog/ - Copying: LGPL-2. See the file COPYING or http://www.gnu.org - - Copyright (C) 1990-2002 SWI, University of Amsterdam. All rights reserved. -*/ - -:- module(rdf_ntriples, - [ load_rdf_ntriples/2, % +File, -Triples - rdf_ntriple_part/4 % +Field, -Value, <DCG> - ]). - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -This module parses n-triple files as defined by the W3C RDF working in -http://www.w3.org/TR/rdf-testcases/#ntriples. This format is a -simplified version of the RDF N3 notation used in the *.nt files that -are used to describe the normative outcome of the RDF test-cases. - -The returned list terms are of the form - - rdf(Subject, Predicate, Object) - -where - - # Subject - is an atom or node(Id) for anonymous nodes - - # Predicate - is an atom - - # Object - is an atom, node(Id), literal(Atom) or xml(Atom) -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - - -% load_rdf_ntriples(+Source, -Triples) -% -% Load a file or stream to a list of rdf(S,P,O) triples. - -load_rdf_ntriples(File, Triples) :- - open_nt_file(File, In, Close), - call_cleanup(stream_to_triples(In, Triples), Close). - -% open_nt_file(+Input, -Stream, -Close) -% -% Open Input, returning Stream and a goal to cleanup Stream if it -% was opened. - -open_nt_file(stream(Stream), Stream, true) :- !. -open_nt_file(Stream, Stream, true) :- - is_stream(Stream), !. -open_nt_file(Spec, Stream, close(Stream)) :- - absolute_file_name(Spec, - [ access(read), - extensions([nt,'']) - ], Path), - open(Path, read, Stream). - - -% rdf_ntriple_part(+Type, -Value, <DCG>) -% -% Parse one of the fields of an ntriple. This is used for the -% SWI-Prolog Sesame (www.openrdf.org) implementation to realise -% /servlets/removeStatements. I do not think public use of this -% predicate should be stimulated. - -rdf_ntriple_part(subject, Subject) --> - subject(Subject). -rdf_ntriple_part(predicate, Predicate) --> - predicate(Predicate). -rdf_ntriple_part(object, Object) --> - predicate(Object). - - -% stream_to_triples(+Stream, -ListOfTriples) -% -% Read Stream, returning all its triples - -stream_to_triples(In, Triples) :- - read_line_to_codes(In, Line), - ( Line == end_of_file - -> Triples = [] - ; phrase(line(Triples, Tail), Line), - stream_to_triples(In, Tail) - ). - -line(Triples, Tail) --> - wss, - ( comment - -> {Triples = Tail} - ; triple(Triple) - -> {Triples = [Triple|Tail]} - ). - -comment --> - "#", !, - skip_rest. -comment --> - end_of_input. - -triple(rdf(Subject, Predicate, Object)) --> - subject(Subject), ws, wss, - predicate(Predicate), ws, wss, - object(Object), wss, ".", wss. - -subject(Subject) --> - uniref(Subject), !. -subject(Subject) --> - node_id(Subject). - -predicate(Predicate) --> - uniref(Predicate). - -object(Object) --> - uniref(Object), !. -object(Object) --> - node_id(Object). -object(Object) --> - literal(Object). - - -uniref(URI) --> - "<", - escaped_uri_codes(Codes), - ">", !, - { atom_codes(URI, Codes) - }. - -node_id(node(Id)) --> % anonymous nodes - "_:", - name_start(C0), - name_codes(Codes), - { atom_codes(Id, [C0|Codes]) - }. - -literal(Literal) --> - lang_string(Literal), !. -literal(Literal) --> - xml_string(Literal). - - -% name_start(-Code) -% name_codes(-ListfCodes) -% -% Parse identifier names - -name_start(C) --> - [C], - { code_type(C, alpha) - }. - -name_codes([C|T]) --> - [C], - { code_type(C, alnum) - }, !, - name_codes(T). -name_codes([]) --> - []. - - -% escaped_uri_codes(-CodeList) -% -% Decode string holding %xx escaped characters. - -escaped_uri_codes([]) --> - []. -escaped_uri_codes([C|T]) --> - "%", [D0,D1], !, - { code_type(D0, xdigit(V0)), - code_type(D1, xdigit(V1)), - C is V0<<4 + V1 - }, - escaped_uri_codes(T). -escaped_uri_codes([C|T]) --> - "\\u", [D0,D1,D2,D3], !, - { code_type(D0, xdigit(V0)), - code_type(D1, xdigit(V1)), - code_type(D2, xdigit(V2)), - code_type(D3, xdigit(V3)), - C is V0<<12 + V1<<8 + V2<<4 + V3 - }, - escaped_uri_codes(T). -escaped_uri_codes([C|T]) --> - [C], - escaped_uri_codes(T). - - -% lang_string() -% -% Process a language string - -lang_string(String) --> - "\"", - string(Codes), - "\"", !, - { atom_codes(Atom, Codes) - }, - ( langsep - -> language(Lang), - { String = literal(lang(Lang, Atom)) - } - ; "^^" - -> uniref(Type), - { String = literal(type(Type, Atom)) - } - ; { String = literal(Atom) - } - ). - -langsep --> - "-". -langsep --> - "@". - -% xml_string(String) -% -% Handle xml"..." - -xml_string(xml(String)) --> - "xml\"", % really no whitespace? - string(Codes), - "\"", - { atom_codes(String, Codes) - }. - -string([]) --> - []. -string([C0|T]) --> - string_char(C0), - string(T). - -string_char(0'\\) --> - "\\\\". -string_char(0'") --> - "\\\"". -string_char(10) --> - "\\n". -string_char(13) --> - "\\r". -string_char(9) --> - "\\t". -string_char(C) --> - "\\u", - '4xdigits'(C). -string_char(C) --> - "\\u", - '4xdigits'(C0), - '4xdigits'(C1), - { C is C0<<16 + C1 - }. -string_char(C) --> - [C]. - -'4xdigits'(C) --> - [C0,C1,C2,C3], - { code_type(C0, xdigit(V0)), - code_type(C1, xdigit(V1)), - code_type(C2, xdigit(V2)), - code_type(C3, xdigit(V3)), - - C is V0<<12 + V1<<8 + V2<<4 + V3 - }. - -% language(-Lang) -% -% Return xml:lang language identifier. - -language(Lang) --> - lang_code(C0), - lang_codes(Codes), - { atom_codes(Lang, [C0|Codes]) - }. - -lang_code(C) --> - [C], - { C \== 0'., - \+ code_type(C, white) - }. - -lang_codes([C|T]) --> - lang_code(C), !, - lang_codes(T). -lang_codes([]) --> - []. - - - /******************************* - * BASICS * - *******************************/ - -skip_rest(_,[]). - -ws --> - [C], - { code_type(C, white) - }. - -end_of_input([], []). - - -wss --> - ws, !, - wss. -wss --> - []. diff --git a/packages/sgml/RDF/rdf_parser.pl b/packages/sgml/RDF/rdf_parser.pl deleted file mode 100644 index fa74f8f74..000000000 --- a/packages/sgml/RDF/rdf_parser.pl +++ /dev/null @@ -1,724 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog - - Author: Jan Wielemaker - E-mail: wielemak@science.uva.nl - WWW: http://www.swi-prolog.org - Copyright (C): 2002-2006, University of Amsterdam - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - As a special exception, if you link this library with other files, - compiled with a Free Software compiler, to produce an executable, this - library does not by itself cause the resulting executable to be covered - by the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -:- module(rdf_parser, - [ xml_to_plrdf/3, % +XMLTerm, -RDFTerm, +Options - element_to_plrdf/3, % +ContentList, -RDFTerm, +Options - rdf_name_space/1 - ]). -:- use_module(rewrite). -:- use_module(library(sgml)). % xml_name/1 -:- use_module(library(lists)). -:- use_module(library(url)). -:- use_module(library(utf8)). - -:- op(500, fx, \?). % Optional (attrs) - -term_expansion(F, T) :- rew_term_expansion(F, T). -goal_expansion(F, T) :- rew_goal_expansion(F, T). - -:- multifile rdf_name_space/1. -:- dynamic rdf_name_space/1. - -%% rdf_name_space(?URL) is nondet. -% -% True if URL must be handled as rdf: Determines special handling -% of rdf:about, rdf:resource, etc. - - -rdf_name_space('http://www.w3.org/1999/02/22-rdf-syntax-ns#'). -rdf_name_space('http://www.w3.org/TR/REC-rdf-syntax'). - - -%% xml_to_plrdf(+RDFElementOrObject, -RDFTerm, +Options) -% -% Translate an XML (using namespaces) term into an Prolog term -% representing the RDF data. This term can then be fed into -% rdf_triples/[2,3] to create a list of RDF triples. -% -% if `BaseURI' == [], local URI's are not globalised. - - -xml_to_plrdf(Element, RDF, Options) :- - is_list(Element), !, - rewrite(\xml_content_objects(RDF, Options), Element). -xml_to_plrdf(Element, RDF, Options) :- - rewrite(\xml_objects(RDF, Options), Element). - -%% element_to_plrdf(+DOM, -RDFTerm, +Options) -% -% Rewrite a single XML element. - -element_to_plrdf(Element, RDF, Options) :- - rewrite(\nodeElementList(RDF, Options), [Element]). - -xml_objects(Objects, Options0) ::= - E0, - { modify_state(E0, Options0, E, Options), !, - rewrite(\xml_objects(Objects, Options), E) - }. -xml_objects(Objects, Options) ::= - element((\rdf('RDF'), !), - _, - \nodeElementList(Objects, Options)), - !. -xml_objects(Objects, Options) ::= - element(_, _, \xml_content_objects(Objects, Options)). - -xml_content_objects([], _) ::= - []. -xml_content_objects([H|T], Options) ::= - [ \xml_objects(H, Options) - | \xml_content_objects(T, Options) - ]. - - -nodeElementList([], _Options) ::= - [], !. -nodeElementList(L, Options) ::= - [ (\ws, !) - | \nodeElementList(L, Options) - ]. -nodeElementList([H|T], Options) ::= - [ \nodeElementOrError(H, Options) - | \nodeElementList(T, Options) - ]. - -nodeElementOrError(H, Options) ::= - \nodeElement(H, Options), !. -nodeElementOrError(unparsed(Data), _Options) ::= - Data. - -nodeElement(container(Type, Id, Elements), Options) ::= - \container(Type, Id, Elements, Options), !. % compatibility -nodeElement(description(Type, About, BagID, Properties), Options) ::= - \description(Type, About, BagID, Properties, Options). - - - /******************************* - * DESCRIPTION * - *******************************/ - -description(Type, About, BagID, Properties, Options0) ::= - E0, - { modify_state(E0, Options0, E, Options), !, - rewrite(\description(Type, About, BagID, Properties, Options), E) - }. -description(description, About, BagID, Properties, Options) ::= - element(\rdf('Description'), - \attrs([ \?idAboutAttr(About, Options), - \?bagIdAttr(BagID, Options) - | \propAttrs(PropAttrs, Options) - ]), - \propertyElts(PropElts, Options)), - { !, append(PropAttrs, PropElts, Properties) - }. -description(Type, About, BagID, Properties, Options) ::= - element(Type, - \attrs([ \?idAboutAttr(About, Options), - \?bagIdAttr(BagID, Options) - | \propAttrs(PropAttrs, Options) - ]), - \propertyElts(PropElts, Options)), - { append(PropAttrs, PropElts, Properties) - }. - -propAttrs([], _) ::= - [], !. -propAttrs([H|T], Options) ::= - [ \propAttr(H, Options) - | \propAttrs(T, Options) - ]. - -propAttr(rdf:type = URI, Options) ::= - \rdf_or_unqualified(type) = \uri(URI, Options), !. -propAttr(Name = Literal, Options) ::= - Name = Value, - { mkliteral(Value, Literal, Options) - }. - -propertyElts([], _) ::= - [], !. -propertyElts(Elts, Options) ::= - [ (\ws, !) - | \propertyElts(Elts, Options) - ]. -propertyElts([H|T], Options) ::= - [ \propertyElt(H, Options) - | \propertyElts(T, Options) - ]. - -propertyElt(E, Options) ::= - \propertyElt(Id, Name, Value, Options), - { mkprop(Name, Value, Prop), - ( var(Id) - -> E = Prop - ; E = id(Id, Prop) - ) - }. - -mkprop(NS:Local, Value, rdf:Local = Value) :- - rdf_name_space(NS), !. -mkprop(Name, Value, Name = Value). - - -propertyElt(Id, Name, Value, Options0) ::= - E0, - { modify_state(E0, Options0, E, Options), !, - rewrite(\propertyElt(Id, Name, Value, Options), E) - }. - % 5.14 emptyPropertyElt -propertyElt(Id, Name, Value, Options) ::= - element(Name, A, \all_ws), - { !, - rewrite(\emptyPropertyElt(Id, Value, Options), A) - }. - -propertyElt(_, Name, description(description, Id, _, Properties), Options) ::= - element(Name, - \attrs([ \parseResource, - \?idAboutAttr(Id, Options) - ]), - \propertyElts(Properties, Options)), - !. -propertyElt(_, Name, Literal, Options) ::= - element(Name, - \attrs([ \parseLiteral - ]), - Content), - { !, - literal_value(Content, Literal, Options) - }. -propertyElt(Id, Name, collection(Elements), Options) ::= - element(Name, - \attrs([ \parseCollection, - \?idAttr(Id, Options) - ]), - \nodeElementList(Elements, Options)). -propertyElt(Id, Name, Literal, Options) ::= - element(Name, - \attrs([ \typeAttr(Type, Options), - \?idAttr(Id, Options) - ]), - Content), - { typed_literal(Type, Content, Literal, Options) - }. -propertyElt(Id, Name, Literal, Options) ::= - element(Name, - \attrs([ \?idAttr(Id, Options) - ]), - [ Value ]), - { atom(Value), !, - mkliteral(Value, Literal, Options) - }. -propertyElt(Id, Name, Value, Options) ::= - element(Name, - \attrs([ \?idAttr(Id, Options) - ]), - \an_rdf_object(Value, Options)), !. -propertyElt(Id, Name, unparsed(Value), Options) ::= - element(Name, - \attrs([ \?idAttr(Id, Options) - ]), - Value). - -emptyPropertyElt(Id, Literal, Options) ::= - \attrs([ \?idAttr(Id, Options), - \?parseLiteral - | \noMoreAttrs - ]), - { !, - mkliteral('', Literal, Options) - }. -emptyPropertyElt(Id, - description(description, About, BagID, Properties), - Options) ::= - \attrs([ \?idAttr(Id, Options), - \?aboutResourceEmptyElt(About, Options), - \?bagIdAttr(BagID, Options), - \?parseResource - | \propAttrs(Properties, Options) - ]), !. - -aboutResourceEmptyElt(about(URI), Options) ::= - \resourceAttr(URI, Options), !. -aboutResourceEmptyElt(node(URI), _Options) ::= - \nodeIDAttr(URI). - -%% literal_value(+In, -Value, +Options) -% -% Create the literal value for rdf:parseType="Literal" attributes. -% The content is the Prolog XML DOM tree for the literal. -% -% @tbd Note that the specs demand a canonical textual representation -% of the XML data as a Unicode string. For now the user can -% achieve this using the convert_typed_literal hook. - -literal_value(Value, literal(type(rdf:'XMLLiteral', Value)), _). - -%% mkliteral(+Atom, -Object, +Options) -% -% Translate attribute value Atom into an RDF object using the -% lang(Lang) option from Options. - -mkliteral(Text, literal(Val), Options) :- - atom(Text), - ( memberchk(lang(Lang), Options), - Lang \== '' - -> Val = lang(Lang, Text) - ; Val = Text - ). - -%% typed_literal(+Type, +Content, -Literal, +Options) -% -% Handle a literal attribute with rdf:datatype=Type qualifier. NB: -% possibly it is faster to use a global variable for the -% conversion hook. - -typed_literal(Type, Content, literal(Object), Options) :- - memberchk(convert_typed_literal(Convert), Options), !, - ( catch(call(Convert, Type, Content, Object), E, true) - -> ( var(E) - -> true - ; Object = E - ) - ; Object = error(cannot_convert(Type, Content), _) - ). -typed_literal(Type, [Text], literal(type(Type, Text)), _Options) :- !. -typed_literal(Type, Content, literal(type(Type, Content)), _Options). - - -idAboutAttr(id(Id), Options) ::= - \idAttr(Id, Options), !. -idAboutAttr(about(About), Options) ::= - \aboutAttr(About, Options), !. -idAboutAttr(node(About), _Options) ::= - \nodeIDAttr(About), !. -idAboutAttr(AboutEach, Options) ::= - \aboutEachAttr(AboutEach, Options). - -%% an_rdf_object(-Object, +OptionsURI) -% -% Deals with an object, but there may be spaces around. I'm still -% not sure where to deal with these. Best is to ask the XML parser -% to get rid of them, So most likely this code will change if this -% happens. - -an_rdf_object(Object, Options) ::= - [ \nodeElement(Object, Options) - ], !. -an_rdf_object(Object, Options) ::= - [ (\ws, !) - | \an_rdf_object(Object, Options) - ]. -an_rdf_object(Object, Options) ::= - [ \nodeElement(Object, Options), - \ws - ], !. - -ws ::= - A, - { atom(A), - atom_chars(A, Chars), - all_blank(Chars), ! - }. -ws ::= - pi(_). - -all_ws ::= - [], !. -all_ws ::= - [\ws | \all_ws]. - -all_blank([]). -all_blank([H|T]) :- - char_type(H, space), % SWI-Prolog specific - all_blank(T). - - - /******************************* - * RDF ATTRIBUTES * - *******************************/ - -idAttr(Id, Options) ::= - \rdf_or_unqualified('ID') = \uniqueid(Id, Options). - -bagIdAttr(Id, Options) ::= - \rdf_or_unqualified(bagID) = \globalid(Id, Options). - -aboutAttr(About, Options) ::= - \rdf_or_unqualified(about) = \uri(About, Options). - -nodeIDAttr(About) ::= - \rdf_or_unqualified(nodeID) = About. - -% Not allowed in current RDF! - -aboutEachAttr(each(AboutEach), Options) ::= - \rdf_or_unqualified(aboutEach) = \uri(AboutEach, Options), !. -aboutEachAttr(prefix(Prefix), Options) ::= - \rdf_or_unqualified(aboutEachPrefix) = \uri(Prefix, Options), !. - -resourceAttr(URI, Options) ::= - \rdf_or_unqualified(resource) = \uri(URI, Options). - -typeAttr(Type, Options) ::= - \rdf_or_unqualified(datatype) = \uri(Type, Options). - -uri(URI, Options) ::= - A, - { memberchk(base_uri(Base), Options), - Base \== [] - -> canonical_uri(A, Base, URI) - ; sub_atom(A, 0, _, _, #) - -> sub_atom(A, 1, _, 0, URI) - ; url_iri(A, URI) - }. - -globalid(Id, Options) ::= - A, - { make_globalid(A, Options, Id) - }. - -uniqueid(Id, Options) ::= - A, - { unique_xml_name(A), - make_globalid(A, Options, Id) - }. - -unique_xml_name(Name) :- - ( xml_name(Name) - -> true - ; print_message(warning, rdf(not_a_name(Name))) - ). - -make_globalid(In, Options, Id) :- - ( memberchk(base_uri(Base), Options), - Base \== [] - -> ( is_absolute_url(In) - -> url_iri(In, Id) - ; concat_atom([Base, In], #, Id0), - url_iri(Id0, Id) - ) - ; sub_atom(In, 0, _, _, #) - -> sub_atom(In, 1, _, 0, Id) - ; url_iri(In, Id) - ). - - -%% canonical_uri(+In, +Base, -Absolute) -% -% Make the URI absolute and decode special sequences. For the last -% clause, which is the correct order? - -canonical_uri('', Base, Base) :- !. % '' expands to xml:base -canonical_uri(URI0, [], URI) :- !, % do not use one - url_iri(URI0, URI). -canonical_uri(URI, Base, Global) :- % use our generic library - global_url(URI, Base, Global0), - url_iri(Global0, Global). - - - /******************************* - * CONTAINERS * - *******************************/ - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Note that containers are no longer part of the definition. We'll keep -the code and call it conditionally if we must. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -container(_, _, _, _) ::= - _, - { \+ current_prolog_flag(rdf_container, true), - !, fail - }. -container(Type, Id, Elements, Options0) ::= - E0, - { modify_state(E0, Options0, E, Options), !, - rewrite(\container(Type, Id, Elements, Options), E) - }. -container(Type, Id, Elements, Options) ::= - element(\containertype(Type), - \attrs([ \?idAttr(Id, Options) - | \memberAttrs(Elements) - ]), - []), !. -container(Type, Id, Elements, Options) ::= - element(\containertype(Type), - \attrs([ \?idAttr(Id, Options) - ]), - \memberElts(Elements, Options)). - -containertype(Type) ::= - \rdf(Type), - { containertype(Type) - }. - -containertype('Bag'). -containertype('Seq'). -containertype('Alt'). - -memberElts([], _) ::= - []. -memberElts([H|T], Options) ::= - [ \memberElt(H, Options) - | \memberElts(T, Options) - ]. - -memberElt(LI, Options) ::= - \referencedItem(LI, Options). -memberElt(LI, Options) ::= - \inlineItem(LI, Options). - -referencedItem(LI, Options0) ::= - E0, - { modify_state(E0, Options0, E, Options), !, - rewrite(\referencedItem(LI, Options), E) - }. -referencedItem(LI, Options) ::= - element(\rdf_or_unqualified(li), - [ \resourceAttr(LI, Options) ], - []). - -inlineItem(Item, Options0) ::= - E0, - { modify_state(E0, Options0, E, Options), !, - rewrite(\inlineItem(Item, Options), E) - }. -inlineItem(Literal, Options) ::= - element(\rdf_or_unqualified(li), - [ \parseLiteral ], - Value), - literal_value(Value, Literal, Options). -inlineItem(description(description, _, _, Properties), Options) ::= - element(\rdf_or_unqualified(li), - [ \parseResource ], - \propertyElts(Properties, Options)). -inlineItem(LI, Options) ::= - element(\rdf_or_unqualified(li), - [], - [\nodeElement(LI, Options)]), !. % inlined object -inlineItem(Literal, Options) ::= - element(\rdf_or_unqualified(li), - [], - [Text]), - { mkliteral(Text, Literal, Options) - }. - -memberAttrs([]) ::= - []. -memberAttrs([H|T]) ::= - [ \memberAttr(H) - | \memberAttrs(T) - ]. - -memberAttr(li(Id, Value)) ::= % Id should be _<n> - \rdf(Id) = Value. - -parseLiteral ::= \rdf_or_unqualified(parseType) = 'Literal'. -parseResource ::= \rdf_or_unqualified(parseType) = 'Resource'. -parseCollection ::= \rdf_or_unqualified(parseType) = 'Collection'. - - - /******************************* - * PRIMITIVES * - *******************************/ - -rdf(Tag) ::= - NS:Tag, - { rdf_name_space(NS), ! - }. - -rdf_or_unqualified(Tag) ::= - Tag. -rdf_or_unqualified(Tag) ::= - NS:Tag, - { rdf_name_space(NS), ! - }. - - - /******************************* - * BASICS * - *******************************/ - -attrs(Bag) ::= - L0, - { do_attrs(Bag, L0) - }. - -do_attrs([], _) :- !. -do_attrs([\?H|T], L0) :- !, % optional - ( select(X, L0, L), - rewrite(\H, X) - -> true - ; L = L0 - ), - do_attrs(T, L). -do_attrs([H|T], L0) :- - select(X, L0, L), - rewrite(H, X), !, - do_attrs(T, L). -do_attrs(C, L) :- - rewrite(C, L). - -% \noMoreAttrs -% -% Check attribute-list is empty. Reserved xml: attributes are -% excluded from this test. - -noMoreAttrs ::= - [], !. -noMoreAttrs ::= - [ xml:_=_ - | \noMoreAttrs - ]. - -%% modify_state(+Element0, +Options0, -Element, -Options) -% -% If Element0 contains xml:base = Base, strip it from the -% attributes list and update base_uri(_) in the Options -% -% It Element0 contains xml:lang = Lang, strip it from the -% attributes list and update lang(_) in the Options -% -% Remove all xmlns=_, xmlns:_=_ and xml:_=_. Only succeed -% if something changed. - -modify_state(E0, O0, E, O) :- - modify_states([base, lang, xmlns], M, E0, O0, E, O), - M \== []. - -modify_states([], [], E, O, E, O). -modify_states([How|TH0], [How|TH], E0, O0, E, O) :- - modify_state(How, E0, O0, E1, O1), !, - modify_states(TH0, TH, E1, O1, E, O). -modify_states([_|TH0], TH, E0, O0, E, O) :- - modify_states(TH0, TH, E0, O0, E, O). - - -modify_state(base, - element(Name, Attrs0, Content), Options0, - element(Name, Attrs, Content), Options) :- - select(xml:base=Base1, Attrs0, Attrs), !, - ( select(base_uri(Base0), Options0, Options1) - -> true - ; Base0 = [], - Options1 = Options0 - ), - remove_fragment(Base1, Base2), - canonical_uri(Base2, Base0, Base), - Options = [base_uri(Base)|Options1]. -modify_state(lang, element(Name, Attrs0, Content), Options0, - element(Name, Attrs, Content), Options) :- - select(xml:lang=Lang, Attrs0, Attrs), - \+ memberchk(ignore_lang(true), Options0), !, - delete(Options0, lang(_), Options1), - ( Lang == '' - -> Options = Options1 - ; Options = [lang(Lang)|Options1] - ). -modify_state(xmlns, - element(Name, Attrs0, Content), Options, - element(Name, Attrs, Content), Options) :- - clean_xmlns_attr(Attrs0, Attrs), - Attrs \== Attrs0. - -clean_xmlns_attr([], []). -clean_xmlns_attr([H=_|T0], T) :- - xml_attr(H), !, - clean_xmlns_attr(T0, T). -clean_xmlns_attr([H|T0], [H|T]) :- - clean_xmlns_attr(T0, T). - -xml_attr(xmlns). -xml_attr(xmlns:_). -xml_attr(xml:_). - - -%% remove_fragment(+URI, -WithoutFragment) -% -% When handling xml:base, we must delete the possible fragment. - -remove_fragment(URI, Plain) :- - sub_atom(URI, B, _, _, #), !, - sub_atom(URI, 0, B, _, Plain). -remove_fragment(URI, URI). - - - /******************************* - * HELP PCE-EMACS A BIT * - *******************************/ - -:- multifile - emacs_prolog_colours:term_colours/2, - emacs_prolog_colours:goal_classification/2. - -expand(c(X), _, X) :- !. -expand(In, Pattern, Colours) :- - compound(In), !, - In =.. [F|Args], - expand_list(Args, PatternArgs, ColourArgs), - Pattern =.. [F|PatternArgs], - Colours = functor(F) - ColourArgs. -expand(X, X, classify). - -expand_list([], [], []). -expand_list([H|T], [PH|PT], [CH|CT]) :- - expand(H, PH, CH), - expand_list(T, PT, CT). - -:- discontiguous - term_expansion/2. - -term_expansion(term_colours(C), - emacs_prolog_colours:term_colours(Pattern, Colours)) :- - expand(C, Pattern, Colours). - -term_colours((c(head(+(1))) ::= c(match), {c(body)})). -term_colours((c(head(+(1))) ::= c(match))). - -emacs_prolog_colours:goal_classification(\_, expanded). - -:- dynamic - prolog:meta_goal/2. -:- multifile - prolog:meta_goal/2, - prolog:called_by/2. - -prolog:meta_goal(rewrite(A, _), [A]). -prolog:meta_goal(\A, [A+1]). - -prolog:called_by(attrs(Attrs, _Term), Called) :- - findall(G+1, sub_term(\?G, Attrs), Called, Tail), - findall(G+1, sub_term(\G, Attrs), Tail). - - diff --git a/packages/sgml/RDF/rdf_test.pl b/packages/sgml/RDF/rdf_test.pl deleted file mode 100644 index fd95634ce..000000000 --- a/packages/sgml/RDF/rdf_test.pl +++ /dev/null @@ -1,347 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog SGML/XML parser - - Author: Jan Wielemaker - E-mail: jan@swi.psy.uva.nl - WWW: http://www.swi.psy.uva.nl/projects/SWI-Prolog/ - Copying: LGPL-2. See the file COPYING or http://www.gnu.org - - Copyright (C) 1990-2000 SWI, University of Amsterdam. All rights reserved. -*/ - -:- module(rdf_test, - [ suite/1, % +Test-number - test_dir/1, % +Directory - test_file/1, % +File - time_file/1, % +File - passed/1, % +Test-numberOrFile - test/0, % run whole suite - show_ok/1 % +Test - ]). - -:- multifile - user:file_search_path/2. - -user:file_search_path(library, ..). -user:file_search_path(foreign, ..). - -:- use_module(library(sgml)). -:- use_module(rdf_parser). -:- use_module(rdf_triple). -:- use_module(rdf). -:- use_module(pretty_print). - -:- set_prolog_flag(rdf_container, true). - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Test file for the SWI-Prolog RDF parser. Toplevel predicates: - - # test/0 - Run all tests from the `suite' directory and validate the - the result if the correct result is stored in a .ok file. - - # suite(N) - Run test on suite/t<N>.rdf, showing RDF, intermediate - representation and triples on the console. - - # passed(N) - Parse suite/t<N>.rdf and save the result in suite/t<N>.ok - -The intention is to write tests, use suite/1 to make sure they are -parsed correctly and then run passed/1 to save the correct answer, so -running test/0 can validate all results. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -suite(N) :- - concat_atom(['suite/t', N, '.rdf'], File), - test_file(File). - -test_file(File) :- - rdf_reset_ids, - format('************* Test ~w ***~n', [File]), - cat(File), - load_structure(File, - [ RDFElement ], - [ dialect(xmlns), - space(sgml) - ]), - rdf_start_file([], Cleanup), - xml_to_plrdf(RDFElement, RDF, []), - rdf_end_file(Cleanup), - format('============= Prolog term ==============~n', []), - pretty_print(RDF), - rdf_triples(RDF, Triples), - format('============= Triples ==================~n', []), - write_triples(Triples). - -time_file(File) :- - time(load_rdf(File, Triples)), - length(Triples, Len), - format('Created ~w triples~n', [Len]). - -passed(Id) :- - integer(Id), !, - concat_atom(['suite/t', Id, '.rdf'], File), - passed(File). -passed(File) :- - rdf_reset_ids, - ok_file(File, OkFile), - load_rdf(File, Triples), - open(OkFile, write, Fd, [encoding(utf8)]), - save_triples(Triples, Fd), - close(Fd), - length(Triples, N), - format('Saved ~d triples to ~w~n', [N, OkFile]). - -:- dynamic failed/1. - -test :- - test(load_rdf), - test(process_rdf). - -test(How) :- - retractall(failed(_)), - test_dir(suite, How), - findall(F, failed(F), Failed), - ( Failed == [] - -> true - ; length(Failed, N), - format('ERROR: ~w tests failed~n', [N]), - fail - ). - - -test_dir(Dir) :- - test_dir(Dir, load_rdf). - -test_dir(Dir, How) :- - format('Tests from "~w" [~w]: ', [Dir, How]), - atom_concat(Dir, '/*.rdf', Pattern), - expand_file_name(Pattern, TestFiles), - maplist(test(How), TestFiles), - format(' done~n'). - -test(How, File) :- - format('.'), flush_output, - rdf_reset_ids, - ok_file(File, OkFile), - ( call(How, File, Triples) - -> ( catch(open(OkFile, read, Fd, [encoding(utf8)]), _, fail) - -> ( read_triples(Fd, OkTriples), - close(Fd), - compare_triples(Triples, OkTriples, _Subst) - -> true - ; assert(failed(File)), - format('~N~w: WRONG ANSWER~n', [File]) - ) - ; format('~N~w: (no .ok file)~n', [File]) - ) - ; assert(failed(File)), - format('~N~w: PARSE FAILED~n', [File]) - ). - -ok_file(File, OkFile) :- - file_base_name(File, BaseFile), - file_name_extension(Base, _, BaseFile), - file_directory_name(File, Dir), - concat_atom([Dir, /, ok, /, Base, '.ok'], OkFile). - - -save_triples([], _). -save_triples([H|T], Fd) :- - format(Fd, '~q.~n', [H]), - save_triples(T, Fd). - -read_triples(Fd, Terms) :- - read(Fd, T0), - read_triples(T0, Fd, Terms). - -read_triples(end_of_file, _, []) :- !. -read_triples(rdf(S0,P0,O0), Fd, [rdf(S,P,O)|R]) :- - global_ref(S0, S), - global_ref(P0, P), - global_obj(O0, O), - read(Fd, T1), - read_triples(T1, Fd, R). - -global_ref(rdf:Local, Global) :- - rdf_name_space(NS), !, - atom_concat(NS, Local, Global). -global_ref(NS:Local, Global) :- !, - atom_concat(NS, Local, Global). -global_ref(URI, URI). - -global_obj(literal(X), literal(X)) :- !. -global_obj(Local, Global) :- - global_ref(Local, Global). - - -write_triples([]) :- !. -write_triples([H|T]) :- !, - write_triple(H), - write_triples(T). - -write_triple(Triple) :- - is_rdf_triple(Triple), !, - Triple = rdf(S,P,O), - format('{~p, ~p, ~p}~n', [S,P,O]). -write_triple(Triple) :- - format('@@@@@ Bad Triple: ~p~n', [Triple]), - fail. - -cat(File) :- - open(File, read, Fd), - copy_stream_data(Fd, user_output), - close(Fd). - -:- dynamic triple/1. - -process_rdf(File, Triples) :- - retractall(triple(_)), - process_rdf(File, assert_triples, []), - findall(T, retract(triple(T)), Triples). - -assert_triples([], _). -assert_triples([H|T], Loc) :- - assert(triple(H)), - assert_triples(T, Loc). - - - /******************************* - * VALIDATE * - *******************************/ - -is_rdf_triple(rdf(Subject, Predicate, Object)) :- - is_subject(Subject), - is_predicate(Predicate), - is_object(Object). - -is_subject(0) :- !, fail. % Variables -is_subject(URI) :- is_uri(URI), !. -is_subject(each(URI)) :- is_uri(URI), !. -is_subject(prefix(Pattern)) :- - atom(Pattern), !. - -is_predicate(0) :- !, fail. -is_predicate(rdf:RdfPred) :- !, - is_rdf_predicate(RdfPred). -is_predicate(NS:Pred) :- !, - atom(NS), - atom(Pred). -is_predicate(Pred) :- - atom(Pred). - -is_object(0) :- !, - fail. -is_object(literal(XML)) :- !, - is_xml(XML). -is_object(rdf:RdfType) :- !, - is_rdf_type(RdfType). -is_object(URI) :- - is_uri(URI). - -is_object(Subject) :- - is_subject(Subject), !. -is_object(Pred) :- - is_predicate(Pred), !. - -is_uri(URI) :- atom(URI). - -is_xml(_XML). % for now - -is_rdf_predicate(RdfPred) :- atom(RdfPred). - -is_rdf_type(RdfType) :- atom(RdfType). - - /******************************* - * UTIL * - *******************************/ - -% find_rdf(+XMLTerm, -RDFTerm) -% -% If the document contains an embedded RDF term, return it, else -% return the whole document. The latter is a bit dubious, but good -% for the purpose of this test-file - -find_rdf(Term, RDFTerm) :- - RDFTerm = element(NS:'RDF', _, _), - term_member(RDFTerm, Term), !, - ( rdf_name_space(NS) - -> true - ; assert(rdf_parser:rdf_name_space(NS)), - assert(new_rdf_namespace(NS)) - ). -find_rdf(Term, Term). - -term_member(X, X). -term_member(X, Compound) :- - compound(Compound), - arg(_, Compound, Arg), - term_member(X, Arg). - - /******************************* - * COMPARING * - *******************************/ - -% compare_triples(+PlRDF, +NTRDF, -Substitions) -% -% Compare two models and if they are equal, return a list of -% PlID = NTID, mapping NodeID elements. - - -compare_triples(A, B, Substitutions) :- - compare_list(A, B, [], Substitutions), !. - -compare_list([], [], S, S). -compare_list([H1|T1], In2, S0, S) :- - select(H2, In2, T2), - compare_triple(H1, H2, S0, S1), - compare_list(T1, T2, S1, S). - -compare_triple(rdf(Subj1,P1,O1), rdf(Subj2, P2, O2), S0, S) :- - compare_field(Subj1, Subj2, S0, S1), - compare_field(P1, P2, S1, S2), - compare_field(O1, O2, S2, S). - -compare_field(X, X, S, S) :- !. -compare_field(literal(X), xml(X), S, S) :- !. % TBD -compare_field(rdf:Name, Atom, S, S) :- - atom(Atom), - rdf_parser:rdf_name_space(NS), - atom_concat(NS, Name, Atom), !. -compare_field(NS:Name, Atom, S, S) :- - atom(Atom), - atom_concat(NS, Name, Atom), !. -compare_field(X, Id, S, S) :- - memberchk(X=Id, S), !. -compare_field(X, Y, S, [X=Y|S]) :- - \+ memberchk(X=_, S), - node_id(X), - node_id(Y), - format('Assume ~w = ~w~n', [X, Y]). - -node_id(node(_)) :- !. -node_id(X) :- - atom(X), - generated_prefix(Prefix), - sub_atom(X, 0, _, _, Prefix), !. - -generated_prefix('Bag__'). -generated_prefix('Seq__'). -generated_prefix('Alt__'). -generated_prefix('Description__'). -generated_prefix('Statement__'). - - /******************************* - * SHOW DIAGRAM * - *******************************/ - -show_ok(Test) :- - ok_file(Test, File), - open(File, read, Fd, [encoding(utf8)]), - read_triples(Fd, OkTriples), - close(Fd), - new(D, rdf_diagram(string('Ok for %s', File))), - send(D, triples, OkTriples), - send(D, open). diff --git a/packages/sgml/RDF/rdf_triple.pl b/packages/sgml/RDF/rdf_triple.pl deleted file mode 100644 index 54ba6fcf8..000000000 --- a/packages/sgml/RDF/rdf_triple.pl +++ /dev/null @@ -1,461 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog RDF parser - - Author: Jan Wielemaker - E-mail: jan@swi.psy.uva.nl - WWW: http://www.swi.psy.uva.nl/projects/SWI-Prolog/ - Copying: LGPL-2. See the file COPYING or http://www.gnu.org - - Copyright (C) 1990-2000 SWI, University of Amsterdam. All rights reserved. -*/ - -:- module(rdf_triple, - [ rdf_triples/2, % +Parsed, -Tripples - rdf_triples/3, % +Parsed, -Tripples, +Tail - rdf_reset_ids/0, % Reset gensym id's - rdf_start_file/2, % +Options, -Cleanup - rdf_end_file/1, % +Cleanup - anon_prefix/1 % Prefix for anonynmous resources - ]). -:- use_module(library(gensym)). -:- use_module(rdf_parser). - -/** <module> Create triples from intermediate representation - -Convert the output of xml_to_rdf/3 from library(rdf) into a list of -triples of the format described below. The intermediate representation -should be regarded a proprietary representation. - - rdf(Subject, Predicate, Object). - -Where `Subject' is - - * Atom - The subject is a resource - - * each(URI) - URI is the URI of an RDF Bag - - * prefix(Pattern) - Pattern is the prefix of a fully qualified Subject URI - -And `Predicate' is - - * Atom - The predicate is always a resource - -And `Object' is - - * Atom - URI of Object resource - - * literal(Value) - Literal value (Either a single atom or parsed XML data) -*/ - -%% rdf_triples(+Term, -Triples) is det. -%% rdf_triples(+Term, -Tridpples, +Tail) is det. -% -% Convert an object as parsed by rdf.pl into a list of rdf/3 -% triples. The identifier of the main object created is returned -% by rdf_triples/3. -% -% Input is the `content' of the RDF element in the format as -% generated by load_structure(File, Term, [dialect(xmlns)]). -% rdf_triples/3 can process both individual descriptions as -% well as the entire content-list of an RDF element. The first -% mode is suitable when using library(sgml) in `call-back' mode. - -rdf_triples(RDF, Tripples) :- - rdf_triples(RDF, Tripples, []). - -rdf_triples([]) --> !, - []. -rdf_triples([H|T]) --> !, - rdf_triples(H), - rdf_triples(T). -rdf_triples(Term) --> - triples(Term, _). - -%% triples(-Triples, -Id, +In, -Tail) -% -% DGC set processing the output of xml_to_rdf/3. In Id, the identifier -% of the main description or container is returned. - -triples(container(Type, Id, Elements), Id) --> !, - { container_id(Type, Id) - }, - rdf(Id, rdf:type, rdf:Type), - container(Elements, 1, Id). -triples(description(Type, About, BagId, Props), Subject) --> - { var(About), - var(BagId), - share_blank_nodes(true) - }, !, - ( { shared_description(description(Type, Props), Subject) - } - -> [] - ; { make_id('__Description', Id) - }, - triples(description(Type, about(Id), BagId, Props), Subject), - { assert_shared_description(description(Type, Props), Subject) - } - ). -triples(description(description, IdAbout, BagId, Props), Subject) --> !, - { description_id(IdAbout, Subject) - }, - properties(Props, BagId, Subject). -triples(description(Type, IdAbout, BagId, Props), Subject) --> - { description_id(IdAbout, Subject), - name_to_type_uri(Type, TypeURI) - }, - properties([ rdf:type = TypeURI - | Props - ], BagId, Subject). -triples(unparsed(Data), Id) --> - { make_id('__Error', Id), - print_message(error, rdf(unparsed(Data))) - }, - []. - - -name_to_type_uri(NS:Local, URI) :- !, - atom_concat(NS, Local, URI). -name_to_type_uri(URI, URI). - - /******************************* - * CONTAINERS * - *******************************/ - -container([], _, _) --> - []. -container([H0|T0], N, Id) --> - li(H0, N, Id), - { NN is N + 1 - }, - container(T0, NN, Id). - -li(li(Nid, V), _, Id) --> !, - rdf(Id, rdf:Nid, V). -li(V, N, Id) --> - triples(V, VId), !, - { atom_concat('_', N, Nid) - }, - rdf(Id, rdf:Nid, VId). -li(V, N, Id) --> - { atom_concat('_', N, Nid) - }, - rdf(Id, rdf:Nid, V). - -container_id(_, Id) :- - nonvar(Id), !. -container_id(Type, Id) :- - container_base(Type, Base), - make_id(Base, Id). - -container_base('Bag', '__Bag'). -container_base('Seq', '__Seq'). -container_base('Alt', '__Alt'). - - - /******************************* - * DESCRIPTIONS * - *******************************/ - -:- thread_local - node_id/2, % nodeID --> ID - unique_id/1. % known rdf:ID - -rdf_reset_node_ids :- - retractall(node_id(_,_)), - retractall(unique_id(_)). - -description_id(Id, Id) :- - var(Id), !, - make_id('__Description', Id). -description_id(about(Id), Id). -description_id(id(Id), Id) :- - ( unique_id(Id) - -> print_message(error, rdf(redefined_id(Id))) - ; assert(unique_id(Id)) - ). -description_id(each(Id), each(Id)). -description_id(prefix(Id), prefix(Id)). -description_id(node(NodeID), Id) :- - ( node_id(NodeID, Id) - -> true - ; make_id('__Node', Id), - assert(node_id(NodeID, Id)) - ). - -properties(PlRDF, BagId, Subject) --> - { nonvar(BagId) - }, !, - rdf(BagId, rdf:type, rdf:'Bag'), - properties(PlRDF, 1, Statements, [], Subject), - fill_bag(Statements, 1, BagId). -properties(PlRDF, _BagId, Subject) --> - properties(PlRDF, 1, [], [], Subject). - - -fill_bag([], _, _) --> - []. -fill_bag([H|T], N, BagId) --> - { NN is N + 1, - atom_concat('_', N, ElemId) - }, - rdf(BagId, rdf:ElemId, H), - fill_bag(T, NN, BagId). - - -properties([], _, Bag, Bag, _) --> - []. -properties([H0|T0], N, Bag0, Bag, Subject) --> - property(H0, N, NN, Bag0, Bag1, Subject), - properties(T0, NN, Bag1, Bag, Subject). - -%% property(Property, N, NN, Subject)// is det. -% -% Generate triples for {Subject, Pred, Object}. Also generates -% triples for Object if necessary. -% -% @param Property One of -% -% * Pred = Object -% Used for normal statements -% * id(Id, Pred = Object) -% Used for reified statements - -property(Pred0 = Object, N, NN, BagH, BagT, Subject) --> % inlined object - triples(Object, Id), !, - { li_pred(Pred0, Pred, N, NN) - }, - statement(Subject, Pred, Id, _, BagH, BagT). -property(Pred0 = collection(Elems), N, NN, BagH, BagT, Subject) --> !, - { li_pred(Pred0, Pred, N, NN) - }, - statement(Subject, Pred, Object, _Id, BagH, BagT), - collection(Elems, Object). -property(Pred0 = Object, N, NN, BagH, BagT, Subject) --> !, - { li_pred(Pred0, Pred, N, NN) - }, - statement(Subject, Pred, Object, _Id, BagH, BagT). -property(id(Id, Pred0 = Object), N, NN, BagH, BagT, Subject) --> - triples(Object, ObjectId), !, - { li_pred(Pred0, Pred, N, NN) - }, - statement(Subject, Pred, ObjectId, Id, BagH, BagT). -property(id(Id, Pred0 = collection(Elems)), N, NN, BagH, BagT, Subject) --> !, - { li_pred(Pred0, Pred, N, NN) - }, - statement(Subject, Pred, Object, Id, BagH, BagT), - collection(Elems, Object). -property(id(Id, Pred0 = Object), N, NN, BagH, BagT, Subject) --> - { li_pred(Pred0, Pred, N, NN) - }, - statement(Subject, Pred, Object, Id, BagH, BagT). - -%% statement(+Subject, +Pred, +Object, +Id, +BagH, -BagT) -% -% Add a statement to the model. If nonvar(Id), we reinify the -% statement using the given Id. - -statement(Subject, Pred, Object, Id, BagH, BagT) --> - rdf(Subject, Pred, Object), - { BagH = [Id|BagT] - -> statement_id(Id) - ; BagT = BagH - }, - ( { nonvar(Id) - } - -> rdf(Id, rdf:type, rdf:'Statement'), - rdf(Id, rdf:subject, Subject), - rdf(Id, rdf:predicate, Pred), - rdf(Id, rdf:object, Object) - ; [] - ). - - -statement_id(Id) :- - nonvar(Id), !. -statement_id(Id) :- - make_id('__Statement', Id). - -%% li_pred(+Pred, -Pred, +Nth, -NextNth) -% -% Transform rdf:li predicates into _1, _2, etc. - -li_pred(rdf:li, rdf:Pred, N, NN) :- !, - NN is N + 1, - atom_concat('_', N, Pred). -li_pred(Pred, Pred, N, N). - -%% collection(+Elems, -Id) -% -% Handle the elements of a collection and return the identifier -% for the whole collection in Id. - -collection([], Nil) --> - { global_ref(rdf:nil, Nil) - }. -collection([H|T], Id) --> - triples(H, HId), - { make_id('__List', Id) - }, - rdf(Id, rdf:type, rdf:'List'), - rdf(Id, rdf:first, HId), - rdf(Id, rdf:rest, TId), - collection(T, TId). - - -rdf(S0, P0, O0) --> - { global_ref(S0, S), - global_ref(P0, P), - global_obj(O0, O) - }, - [ rdf(S, P, O) ]. - - -global_ref(URI, URI) :- - var(URI), !. -global_ref(rdf:Local, Global) :- - rdf_name_space(NS), !, - atom_concat(NS, Local, Global). -global_ref(NS:Local, Global) :- !, - atom_concat(NS, Local, Global). -global_ref(URI, URI). - -global_obj(V, V) :- - var(V), !. -global_obj(literal(type(Local, X)), literal(type(Global, X))) :- !, - global_ref(Local, Global). -global_obj(literal(X), literal(X)) :- !. -global_obj(Local, Global) :- - global_ref(Local, Global). - - - /******************************* - * SHARING * - *******************************/ - -:- thread_local - shared_description/3, % +Hash, +Term, -Subject - share_blank_nodes/1, % Boolean - shared_nodes/1. % counter - -reset_shared_descriptions :- - retractall(shared_description(_,_,_)), - retractall(shared_nodes(_)). - -shared_description(Term, Subject) :- - term_hash(Term, Hash), - shared_description(Hash, Term, Subject), - ( retract(shared_nodes(N)) - -> N1 is N + 1 - ; N1 = 1 - ), - assert(shared_nodes(N1)). - - -assert_shared_description(Term, Subject) :- - term_hash(Term, Hash), - assert(shared_description(Hash, Term, Subject)). - - - /******************************* - * START/END * - *******************************/ - -%% rdf_start_file(+Options, -Cleanup) is det. -% -% Initialise for the translation of a file. - -rdf_start_file(Options, Cleanup) :- - rdf_reset_node_ids, % play safe - reset_shared_descriptions, - set_bnode_sharing(Options, C1), - set_anon_prefix(Options, C2), - add_cleanup(C1, C2, Cleanup). - -%% rdf_end_file(:Cleanup) is det. -% -% Cleanup reaching the end of an RDF file. - -rdf_end_file(Cleanup) :- - rdf_reset_node_ids, - ( shared_nodes(N) - -> print_message(informational, rdf(shared_blank_nodes(N))) - ; true - ), - reset_shared_descriptions, - Cleanup. - -set_bnode_sharing(Options, erase(Ref)) :- - option(blank_nodes(Share), Options, noshare), - ( Share == share - -> assert(share_blank_nodes(true), Ref), ! - ; Share == noshare - -> fail % next clause - ; throw(error(domain_error(share, Share), _)) - ). -set_bnode_sharing(_, true). - -set_anon_prefix(Options, erase(Ref)) :- - option(base_uri(BaseURI), Options, []), - BaseURI \== [], !, - concat_atom(['__', BaseURI, '#'], AnonBase), - asserta(anon_prefix(AnonBase), Ref). -set_anon_prefix(_, true). - -add_cleanup(true, X, X) :- !. -add_cleanup(X, true, X) :- !. -add_cleanup(X, Y, (X, Y)). - - - /******************************* - * UTIL * - *******************************/ - -%% anon_prefix(-Prefix) is semidet. -% -% If defined, it is the prefix used to generate a blank node. - -:- thread_local - anon_prefix/1. - -make_id(For, ID) :- - anon_prefix(Prefix), !, - atom_concat(Prefix, For, Base), - gensym(Base, ID). -make_id(For, ID) :- - gensym(For, ID). - -anon_base('__Bag'). -anon_base('__Seq'). -anon_base('__Alt'). -anon_base('__Description'). -anon_base('__Statement'). -anon_base('__List'). -anon_base('__Node'). - -%% rdf_reset_ids is det. -% -% Utility predicate to reset the gensym counters for the various -% generated identifiers. This simplifies debugging and matching -% output with the stored desired output (see rdf_test.pl). - -rdf_reset_ids :- - anon_prefix(Prefix), !, - ( anon_base(Base), - atom_concat(Prefix, Base, X), - reset_gensym(X), - fail - ; true - ). -rdf_reset_ids :- - ( anon_base(Base), - reset_gensym(Base), - fail - ; true - ). diff --git a/packages/sgml/RDF/rdf_write.pl b/packages/sgml/RDF/rdf_write.pl deleted file mode 100644 index e2c86c29a..000000000 --- a/packages/sgml/RDF/rdf_write.pl +++ /dev/null @@ -1,635 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog - - Author: Jan Wielemaker - E-mail: J.Wielemak@uva.nl - WWW: http://www.swi-prolog.org - Copyright (C): 2004-2009, University of Amsterdam - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - As a special exception, if you link this library with other files, - compiled with a Free Software compiler, to produce an executable, this - library does not by itself cause the resulting executable to be covered - by the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -:- module(rdf_write, - [ rdf_write_xml/2 % +Stream, +Triples - ]). -:- use_module(library('semweb/rdf_db')). -:- use_module(library(lists)). -:- use_module(library(sgml)). -:- use_module(library(sgml_write)). -:- use_module(library(assoc)). -:- use_module(library(pairs)). -:- use_module(library(debug)). - - -/** <module> Write RDF/XML from a list of triples - -This module writes an RDF/XML document from a list of triples of the -format rdf(Subject, Predicate, Object). It is primarily intended for -communicating computed RDF model fragments to external programs using -RDF/XML. - -When used from the HTTP library, use the following code: - -== -reply_graph(RDF) :- - format('Content-type: application/rdf+xml; charset=UTF-8~n~n'), - rdf_write_xml(current_output, RDF). -== - -@author Jan Wielemaker -@see library(semweb/rdf_db) offers saving a named graph directly from - the RDF database. -*/ - - - /******************************* - * WRITE RDFXML * - *******************************/ - -%% rdf_write_xml(+Out:stream, +Triples:list(rdf(S,P,O))) is det. -% -% Write an RDF/XML serialization of Triples to Out. - -rdf_write_xml(Out, Triples) :- - sort(Triples, Unique), - rdf_write_header(Out, Unique), - node_id_map(Unique, AnonIDs), - rdf_write_triples(Unique, AnonIDs, Out), - rdf_write_footer(Out). - - - /******************************* - * HEADER/FOOTER * - *******************************/ - -%% rdf_write_header(+Out, +Triples) -% -% Save XML document header, doctype and open the RDF environment. -% This predicate also sets up the namespace notation. - -rdf_write_header(Out, Triples) :- - xml_encoding(Out, Enc, Encoding), - format(Out, '<?xml version=\'1.0\' encoding=\'~w\'?>~n', [Encoding]), - format(Out, '<!DOCTYPE rdf:RDF [', []), - used_namespaces(Triples, NSList), - ( member(Id, NSList), - ns(Id, NS), - rdf_quote_uri(NS, QNS), - xml_quote_attribute(QNS, NSText0, Enc), - xml_escape_parameter_entity(NSText0, NSText), - format(Out, '~N <!ENTITY ~w \'~w\'>', [Id, NSText]), - fail - ; true - ), - format(Out, '~N]>~n~n', []), - format(Out, '<rdf:RDF', []), - ( member(Id, NSList), - format(Out, '~N xmlns:~w="&~w;"~n', [Id, Id]), - fail - ; true - ), - format(Out, '>~n', []). - - -xml_encoding(Out, Enc, Encoding) :- - stream_property(Out, encoding(Enc)), - ( xml_encoding_name(Enc, Encoding) - -> true - ; throw(error(domain_error(rdf_encoding, Enc), _)) - ). - -xml_encoding_name(ascii, 'US-ASCII'). -xml_encoding_name(iso_latin_1, 'ISO-8859-1'). -xml_encoding_name(utf8, 'UTF-8'). - -%% xml_escape_parameter_entity(+In, -Out) is det. -% -% Escape % as &#37; for entity declarations. - -xml_escape_parameter_entity(In, Out) :- - sub_atom(In, _, _, _, '%'), !, - atom_codes(In, Codes), - phrase(escape_parent(Codes), OutCodes), - atom_codes(Out, OutCodes). -xml_escape_parameter_entity(In, In). - -escape_parent([]) --> []. -escape_parent([H|T]) --> - ( { H == 37 } - -> "&#37;" - ; [H] - ), - escape_parent(T). - -%% used_namespaces(+Triples:list(rdf(S,P,O)), -List:atom) is det. -% -% Return the list of namespace abbreviations used in a set of -% triples. - -used_namespaces(Triples, NSList) :- - decl_used_predicate_ns(Triples), - resources(Triples, Resources), - empty_assoc(A0), - put_assoc(rdf, A0, *, A1), % needed for rdf:RDF - res_used_namespaces(Resources, _NoNS, A1, A), - assoc_to_keys(A, NSList). - - -res_used_namespaces([], [], A, A). -res_used_namespaces([Resource|T], NoNS, A0, A) :- - ns(NS, Full), - Full \== '', - atom_concat(Full, _Local, Resource), !, - put_assoc(NS, A0, *, A1), - res_used_namespaces(T, NoNS, A1, A). -res_used_namespaces([R|T0], [R|T], A0, A) :- - res_used_namespaces(T0, T, A0, A). - -%% resources(+Triples:list(rdf(S,P,O)), -Resources:list(atom)) is det. -% -% Resources is the set of resources referenced in Triples. - -resources(Triples, Resources) :- - phrase(resources(Triples), Raw), - sort(Raw, Resources). - -resources([]) --> - []. -resources([rdf(S,P,O)|T]) --> - [S,P], - object_resources(O), - resources(T). - -object_resources(Atom) --> - { atom(Atom) }, !, - [ Atom ]. -object_resources(literal(type(Type, _))) --> !, - [ Type ]. -object_resources(_) --> - []. - -%% decl_used_predicate_ns(+Triples:list(rdf(S,P,O))) -% -% For every URL used as a predicate we *MUST* define a namespace -% as we cannot use names holding /, :, etc. as XML identifiers. - -:- thread_local - predicate_ns/2. - -decl_used_predicate_ns(Triples) :- - retractall(predicate_ns(_,_)), - ( member(rdf(_,P,_), Triples), - decl_predicate_ns(P), - fail - ; true - ). - -decl_predicate_ns(Pred) :- - predicate_ns(Pred, _), !. -decl_predicate_ns(Pred) :- - rdf_global_id(NS:_Local, Pred), - assert(predicate_ns(Pred, NS)), !. -decl_predicate_ns(Pred) :- - is_bag_li_predicate(Pred), !. -decl_predicate_ns(Pred) :- - atom_codes(Pred, Codes), - append(NSCodes, LocalCodes, Codes), - xml_codes(LocalCodes), !, - ( NSCodes \== [] - -> atom_codes(NS, NSCodes), - ( ns(Id, NS) - -> assert(predicate_ns(Pred, Id)) - ; between(1, infinite, N), - atom_concat(ns, N, Id), - \+ ns(Id, _) - -> rdf_register_ns(Id, NS), - print_message(informational, - rdf(using_namespace(Id, NS))) - ), - assert(predicate_ns(Pred, Id)) - ; assert(predicate_ns(Pred, -)) % no namespace used - ). - -xml_codes([]). -xml_codes([H|T]) :- - xml_code(H), - xml_codes(T). - -xml_code(X) :- - code_type(X, csym), !. -xml_code(0'-). % ' - - -rdf_write_footer(Out) :- - format(Out, '</rdf:RDF>~n', []). - - - /******************************* - * ANONYMOUS IDS * - *******************************/ - -%% node_id_map(+Triples, -IdMap) is det. -% -% Create an assoc Resource -> NodeID for those anonymous resources -% in Triples that need a NodeID. This implies all anonymous -% resources that are used multiple times as object value. - -node_id_map(Triples, IdMap) :- - anonymous_objects(Triples, Objs), - msort(Objs, Sorted), - empty_assoc(IdMap0), - nodeid_map(Sorted, 0, IdMap0, IdMap). - -anonymous_objects([], []). -anonymous_objects([rdf(_,_,O)|T0], Anon) :- - rdf_is_bnode(O), !, - Anon = [O|T], - anonymous_objects(T0, T). -anonymous_objects([_|T0], T) :- - anonymous_objects(T0, T). - -nodeid_map([], _, Map, Map). -nodeid_map([H,H|T0], Id, Map0, Map) :- !, - remove_leading(H, T0, T), - atom_concat(bn, Id, NodeId), - put_assoc(H, Map0, NodeId, Map1), - Id2 is Id + 1, - nodeid_map(T, Id2, Map1, Map). -nodeid_map([_|T], Id, Map0, Map) :- - nodeid_map(T, Id, Map0, Map). - -remove_leading(H, [H|T0], T) :- !, - remove_leading(H, T0, T). -remove_leading(_, T, T). - - - /******************************* - * TRIPLES * - *******************************/ - -rdf_write_triples(Triples, NodeIDs, Out) :- - rdf_write_triples(Triples, NodeIDs, Out, [], Anon), - rdf_write_anon(Anon, NodeIDs, Out, Anon). - -rdf_write_triples([], _, _, Anon, Anon). -rdf_write_triples([H|T0], NodeIDs, Out, Anon0, Anon) :- - arg(1, H, S), - subject_triples(S, [H|T0], T, OnSubject), - ( rdf_is_bnode(S) - -> rdf_write_triples(T, NodeIDs, Out, [anon(S,_,OnSubject)|Anon0], Anon) - ; rdf_write_subject(OnSubject, S, NodeIDs, Out, Anon0), - rdf_write_triples(T, NodeIDs, Out, Anon0, Anon) - ). - -subject_triples(S, [H|T0], T, [H|M]) :- - arg(1, H, S), !, - subject_triples(S, T0, T, M). -subject_triples(_, T, T, []). - - -rdf_write_anon([], _, _, _). -rdf_write_anon([anon(Subject, Done, Triples)|T], NodeIDs, Out, Anon) :- - Done \== true, !, - Done = true, - rdf_write_subject(Triples, Subject, NodeIDs, Out, Anon), - rdf_write_anon(T, NodeIDs, Out, Anon). -rdf_write_anon([_|T], NodeIDs, Out, Anon) :- - rdf_write_anon(T, NodeIDs, Out, Anon). - -rdf_write_subject(Triples, Subject, NodeIDs, Out, Anon) :- - rdf_write_subject(Triples, Out, Subject, NodeIDs, -, 0, Anon), !, - format(Out, '~n', []). -rdf_write_subject(_, Subject, _, _, _) :- - throw(error(rdf_save_failed(Subject), 'Internal error')). - -rdf_write_subject(Triples, Out, Subject, NodeIDs, DefNS, Indent, Anon) :- - rdf_equal(rdf:type, RdfType), - select(rdf(_, RdfType,Type), Triples, Triples1), - rdf_id(Type, DefNS, TypeId), - xml_is_name(TypeId), !, - format(Out, '~*|<', [Indent]), - rdf_write_id(Out, TypeId), - save_about(Out, Subject, NodeIDs), - save_attributes(Triples1, DefNS, Out, NodeIDs, TypeId, Indent, Anon). -rdf_write_subject(Triples, Out, Subject, NodeIDs, _DefNS, Indent, Anon) :- - format(Out, '~*|<rdf:Description', [Indent]), - save_about(Out, Subject, NodeIDs), - save_attributes(Triples, rdf, Out, NodeIDs, rdf:'Description', Indent, Anon). - -xml_is_name(_NS:Atom) :- !, - xml_name(Atom). -xml_is_name(Atom) :- - xml_name(Atom). - -save_about(Out, Subject, NodeIDs) :- - rdf_is_bnode(Subject), !, - ( get_assoc(Subject, NodeIDs, NodeID) - -> format(Out,' rdf:nodeID="~w"', [NodeID]) - ; true - ). -save_about(Out, Subject, _) :- - stream_property(Out, encoding(Encoding)), - rdf_value(Subject, QSubject, Encoding), - format(Out, ' rdf:about="~w"', [QSubject]), !. -save_about(_, _, _) :- - assertion(fail). - -%% save_attributes(+List, +DefNS, +Out, +NodeIDs, Element, +Indent, +Anon) -% -% Save the attributes. Short literal attributes are saved in the -% tag. Others as the content of the description element. The -% begin tag has already been filled. - -save_attributes(Triples, DefNS, Out, NodeIDs, Element, Indent, Anon) :- - split_attributes(Triples, InTag, InBody), - SubIndent is Indent + 2, - save_attributes2(InTag, DefNS, tag, Out, NodeIDs, SubIndent, Anon), - ( InBody == [] - -> format(Out, '/>~n', []) - ; format(Out, '>~n', []), - save_attributes2(InBody, _, body, Out, NodeIDs, SubIndent, Anon), - format(Out, '~N~*|</~w>~n', [Indent, Element]) - ). - -% split_attributes(+Triples, -HeadAttrs, -BodyAttr) -% -% Split attribute (Name=Value) list into attributes for the head -% and body. Attributes can only be in the head if they are literal -% and appear only one time in the attribute list. - -split_attributes(Triples, HeadAttr, BodyAttr) :- - duplicate_attributes(Triples, Dupls, Singles), - simple_literal_attributes(Singles, HeadAttr, Rest), - append(Dupls, Rest, BodyAttr). - -% duplicate_attributes(+Attrs, -Duplicates, -Singles) -% -% Extract attributes that appear more than onces as we cannot -% dublicate an attribute in the head according to the XML rules. - -duplicate_attributes([], [], []). -duplicate_attributes([H|T], Dupls, Singles) :- - arg(2, H, Name), - named_attributes(Name, T, D, R), - D \== [], - append([H|D], Dupls2, Dupls), !, - duplicate_attributes(R, Dupls2, Singles). -duplicate_attributes([H|T], Dupls2, [H|Singles]) :- - duplicate_attributes(T, Dupls2, Singles). - -named_attributes(_, [], [], []) :- !. -named_attributes(Name, [H|T], D, R) :- - ( arg(2, H, Name) - -> D = [H|DT], - named_attributes(Name, T, DT, R) - ; R = [H|RT], - named_attributes(Name, T, D, RT) - ). - -% simple_literal_attributes(+Attributes, -Inline, -Body) -% -% Split attributes for (literal) attributes to be used in the -% begin-tag and ones that have to go into the body of the description. - -simple_literal_attributes([], [], []). -simple_literal_attributes([H|TA], [H|TI], B) :- - in_tag_attribute(H), !, - simple_literal_attributes(TA, TI, B). -simple_literal_attributes([H|TA], I, [H|TB]) :- - simple_literal_attributes(TA, I, TB). - -in_tag_attribute(rdf(_,P,literal(Text))) :- - atom(Text), % may not have lang qualifier - atom_length(Text, Len), - Len < 60, - \+ is_bag_li_predicate(P). - - -% save_attributes(+List, +DefNS, +TagOrBody, +Out, +NodeIDs, +Indent, +Anon) -% -% Save a list of attributes. - -save_attributes2([], _, _, _, _, _, _). -save_attributes2([H|T], DefNS, Where, Out, NodeIDs, Indent, Anon) :- - save_attribute(Where, H, DefNS, Out, NodeIDs, Indent, Anon), - save_attributes2(T, DefNS, Where, Out, NodeIDs, Indent, Anon). - -%% save_attribute(+Where, +Triple, +DefNS, +Out, +NodeIDs, +Indent, +Anon) - -save_attribute(tag, rdf(_, Name, literal(Value)), DefNS, Out, _, Indent, _Anon) :- - AttIndent is Indent + 2, - rdf_att_id(Name, DefNS, NameText), - stream_property(Out, encoding(Encoding)), - xml_quote_attribute(Value, QVal, Encoding), - format(Out, '~N~*|', [AttIndent]), - rdf_write_id(Out, NameText), - format(Out, '="~w"', [QVal]). -save_attribute(body, rdf(_,Name,literal(Literal)), DefNS, Out, _, Indent, _) :- !, - rdf_p_id(Name, DefNS, NameText), - format(Out, '~N~*|<', [Indent]), - rdf_write_id(Out, NameText), - ( Literal = lang(Lang, Value) - -> rdf_id(Lang, DefNS, LangText), - format(Out, ' xml:lang="~w">', [LangText]) - ; Literal = type(Type, Value) - -> ( rdf_equal(Type, rdf:'XMLLiteral') - -> write(Out, ' rdf:parseType="Literal">'), - Value = Literal - ; stream_property(Out, encoding(Encoding)), - rdf_value(Type, QVal, Encoding), - format(Out, ' rdf:datatype="~w">', [QVal]) - ) - ; atomic(Literal) - -> write(Out, '>'), - Value = Literal - ; write(Out, ' rdf:parseType="Literal">'), - Value = Literal - ), - save_attribute_value(Value, Out, Indent), - write(Out, '</'), rdf_write_id(Out, NameText), write(Out, '>'). -save_attribute(body, rdf(_, Name, Value), DefNS, Out, NodeIDs, Indent, Anon) :- - rdf_is_bnode(Value), - memberchk(anon(Value, Done, ValueTriples), Anon), !, - rdf_p_id(Name, DefNS, NameText), - format(Out, '~N~*|<', [Indent]), - rdf_write_id(Out, NameText), - ( var(Done) - -> Done = true, - SubIndent is Indent + 2, - ( rdf_equal(RdfType, rdf:type), - rdf_equal(ListClass, rdf:'List'), - memberchk(rdf(_, RdfType, ListClass), ValueTriples) - -> format(Out, ' rdf:parseType="Collection">~n', []), - rdf_save_list(ValueTriples, Out, Value, NodeIDs, DefNS, SubIndent, Anon) - ; format(Out, '>~n', []), - rdf_write_subject(ValueTriples, Out, Value, NodeIDs, DefNS, SubIndent, Anon) - ), - format(Out, '~N~*|</', [Indent]), - rdf_write_id(Out, NameText), - format(Out, '>~n', []) - ; get_assoc(Value, NodeIDs, NodeID) - -> format(Out, ' rdf:nodeID="~w"/>', [NodeID]) - ; assertion(fail) - ). -save_attribute(body, rdf(_, Name, Value), DefNS, Out, _, Indent, _Anon) :- - stream_property(Out, encoding(Encoding)), - rdf_value(Value, QVal, Encoding), - rdf_p_id(Name, DefNS, NameText), - format(Out, '~N~*|<', [Indent]), - rdf_write_id(Out, NameText), - format(Out, ' rdf:resource="~w"/>', [QVal]). - -save_attribute_value(Value, Out, _) :- % strings - atom(Value), !, - stream_property(Out, encoding(Encoding)), - xml_quote_cdata(Value, QVal, Encoding), - write(Out, QVal). -save_attribute_value(Value, Out, _) :- % numbers - number(Value), !, - writeq(Out, Value). % quoted: preserve floats -save_attribute_value(Value, Out, Indent) :- - xml_is_dom(Value), !, - XMLIndent is Indent+2, - xml_write(Out, Value, - [ header(false), - indent(XMLIndent) - ]). -save_attribute_value(Value, _Out, _) :- - throw(error(save_attribute_value(Value), _)). - -rdf_save_list(_, _, List, _, _, _, _) :- - rdf_equal(List, rdf:nil), !. -rdf_save_list(ListTriples, Out, List, NodeIDs, DefNS, Indent, Anon) :- - rdf_equal(RdfFirst, rdf:first), - memberchk(rdf(List, RdfFirst, First), ListTriples), - ( rdf_is_bnode(First), - memberchk(anon(First, true, FirstTriples), Anon) - -> nl(Out), - rdf_write_subject(FirstTriples, Out, First, NodeIDs, DefNS, Indent, Anon) - ; stream_property(Out, encoding(Encoding)), - rdf_value(First, QVal, Encoding), - format(Out, '~N~*|<rdf:Description about="~w"/>', - [Indent, QVal]) - ), - ( rdf_equal(RdfRest, rdf:rest), - memberchk(rdf(List, RdfRest, List2), ListTriples), - \+ rdf_equal(List2, rdf:nil), - memberchk(anon(List2, true, List2Triples), Anon) - -> rdf_save_list(List2Triples, Out, List2, NodeIDs, DefNS, Indent, Anon) - ; true - ). - -%% rdf_p_id(+Resource, +DefNS, -NSLocal) -% -% As rdf_id/3 for predicate names. Maps _:<N> to rdf:li. -% -% @tbd Ensure we are talking about an rdf:Bag - -rdf_p_id(LI, _, 'rdf:li') :- - is_bag_li_predicate(LI), !. -rdf_p_id(Resource, DefNS, NSLocal) :- - rdf_id(Resource, DefNS, NSLocal). - -%% is_bag_li_predicate(+Pred) is semidet. -% -% True if Pred is _:N, as used for members of an rdf:Bag, rdf:Seq -% or rdf:Alt. - -is_bag_li_predicate(Pred) :- - atom_concat('_:', AN, Pred), - catch(atom_number(AN, N), _, true), integer(N), N >= 0, !. - - -%% rdf_id(+Resource, +DefNS, -NSLocal) -% -% Generate a NS:Local name for Resource given the indicated -% default namespace. This call is used for elements. - -rdf_id(Id, NS, NS:Local) :- - ns(NS, Full), - Full \== '', - atom_concat(Full, Local, Id), !. -rdf_id(Id, _, NS:Local) :- - ns(NS, Full), - Full \== '', - atom_concat(Full, Local, Id), !. -rdf_id(Id, _, Id). - - -%% rdf_write_id(+Out, +NSLocal) is det. -% -% Write an identifier. We cannot use native write on it as both NS -% and Local can be operators. - -rdf_write_id(Out, NS:Local) :- !, - format(Out, '~w:~w', [NS, Local]). -rdf_write_id(Out, Atom) :- - write(Out, Atom). - - -rdf_att_id(Id, _, NS:Local) :- - ns(NS, Full), - Full \== '', - atom_concat(Full, Local, Id), !. -rdf_att_id(Id, _, Id). - - -%% rdf_value(+Resource, -Text, +Encoding) -% -% According to "6.4 RDF URI References" of the RDF Syntax -% specification, a URI reference is UNICODE string not containing -% control sequences, represented as UTF-8 and then as escaped -% US-ASCII. -% -% NOTE: the to_be_described/1 trick ensures entity rewrite in -% resources that start with 'http://t-d-b.org?'. This is a of a -% hack to save the artchive data in the MultimediaN project. We -% should use a more general mechanism. - -rdf_value(V, Text, Encoding) :- - to_be_described(Prefix), - atom_concat(Prefix, V1, V), - ns(NS, Full), - atom_concat(Full, Local, V1), !, - rdf_quote_uri(Local, QLocal0), - xml_quote_attribute(QLocal0, QLocal, Encoding), - concat_atom([Prefix, '&', NS, (';'), QLocal], Text). -rdf_value(V, Text, Encoding) :- - ns(NS, Full), - atom_concat(Full, Local, V), !, - rdf_quote_uri(Local, QLocal0), - xml_quote_attribute(QLocal0, QLocal, Encoding), - concat_atom(['&', NS, (';'), QLocal], Text). -rdf_value(V, Q, Encoding) :- - rdf_quote_uri(V, Q0), - xml_quote_attribute(Q0, Q, Encoding). - -to_be_described('http://t-d-b.org?'). - - - /******************************* - * UTIL * - *******************************/ - -ns(Id, Full) :- - rdf_db:ns(Id, Full). diff --git a/packages/sgml/RDF/rdfs.rdfs b/packages/sgml/RDF/rdfs.rdfs deleted file mode 100644 index 45260cf2a..000000000 --- a/packages/sgml/RDF/rdfs.rdfs +++ /dev/null @@ -1,237 +0,0 @@ -<?xml version="1.0" encoding="iso-8859-1"?> - -<!DOCTYPE rdf:RDF [ - <!ENTITY rdfs 'http://www.w3.org/2000/01/rdf-schema#'> - <!ENTITY rdf 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'> -]> - -<rdf:RDF - xmlns:rdf="&rdf;" - xmlns:rdfs="&rdfs;"> - -<rdfs:Class rdf:about="&rdfs;Resource"> - <rdfs:isDefinedBy rdf:resource="&rdfs;"/> - <rdfs:label xml:lang="en">Resource</rdfs:label> - <rdfs:comment>The class resource, everything.</rdfs:comment> -</rdfs:Class> - -<rdf:Property rdf:about="&rdf;type"> - <rdfs:isDefinedBy rdf:resource="&rdf;"/> - <rdfs:label xml:lang="en">type</rdfs:label> - <rdfs:comment>Indicates membership of a class</rdfs:comment> - <rdfs:range rdf:resource="&rdfs;Class"/> - <rdfs:domain rdf:resource="&rdfs;Resource"/> -</rdf:Property> - -<rdfs:Class rdf:about="&rdfs;Class"> - <rdfs:isDefinedBy rdf:resource="&rdfs;"/> - <rdfs:label xml:lang="en">Class</rdfs:label> - <rdfs:comment>The concept of Class</rdfs:comment> - <rdfs:subClassOf rdf:resource="&rdfs;Resource"/> -</rdfs:Class> - -<rdf:Property rdf:about="&rdfs;subClassOf"> - <rdfs:isDefinedBy rdf:resource="&rdfs;"/> - <rdfs:label xml:lang="en">subClassOf</rdfs:label> - <rdfs:comment>Indicates membership of a class</rdfs:comment> - <rdfs:range rdf:resource="&rdfs;Class"/> - <rdfs:domain rdf:resource="&rdfs;Class"/> -</rdf:Property> - -<rdf:Property rdf:about="&rdfs;subPropertyOf"> - <rdfs:isDefinedBy rdf:resource="&rdfs;"/> - <rdfs:label xml:lang="en">subPropertyOf</rdfs:label> - <rdfs:comment>Indicates specialization of properties</rdfs:comment> - <rdfs:range rdf:resource="&rdf;Property"/> - <rdfs:domain rdf:resource="&rdf;Property"/> -</rdf:Property> - -<rdfs:Class rdf:about="&rdf;Property"> - <rdfs:isDefinedBy rdf:resource="&rdf;"/> - <rdfs:label xml:lang="en">Property</rdfs:label> - <rdfs:comment>The concept of a property.</rdfs:comment> - <rdfs:subClassOf rdf:resource="&rdfs;Resource"/> -</rdfs:Class> - -<rdf:Property rdf:about="&rdfs;comment"> - <rdfs:isDefinedBy rdf:resource="&rdfs;"/> - <rdfs:label xml:lang="en">comment</rdfs:label> - <rdfs:comment>Use this for descriptions</rdfs:comment> - <rdfs:domain rdf:resource="&rdfs;Resource"/> - <rdfs:range rdf:resource="&rdfs;Literal"/> -</rdf:Property> - -<rdf:Property rdf:about="&rdfs;label"> - <rdfs:isDefinedBy rdf:resource="&rdfs;"/> - <rdfs:label xml:lang="en">label</rdfs:label> - <rdfs:comment>Provides a human-readable version of a resource name.</rdfs:comment> - <rdfs:domain rdf:resource="&rdfs;Resource"/> - <rdfs:range rdf:resource="&rdfs;Literal"/> -</rdf:Property> - -<rdf:Property rdf:about="&rdfs;domain"> - <rdfs:isDefinedBy rdf:resource="&rdfs;"/> - <rdfs:label xml:lang="en">domain</rdfs:label> - <rdfs:comment>A domain class for a property type</rdfs:comment> - <rdfs:range rdf:resource="&rdfs;Class"/> - <rdfs:domain rdf:resource="&rdf;Property"/> -</rdf:Property> - -<rdf:Property rdf:about="&rdfs;range"> - <rdfs:isDefinedBy rdf:resource="&rdfs;"/> - <rdfs:label xml:lang="en">range</rdfs:label> - <rdfs:comment>A range class for a property type</rdfs:comment> - <rdfs:range rdf:resource="&rdfs;Class"/> - <rdfs:domain rdf:resource="&rdf;Property"/> -</rdf:Property> - -<rdf:Property rdf:about="&rdfs;seeAlso"> - <rdfs:isDefinedBy rdf:resource="&rdfs;"/> - <rdfs:label xml:lang="en">seeAlso</rdfs:label> - <rdfs:comment>A resource that provides information about the subject resource</rdfs:comment> - <rdfs:range rdf:resource="&rdfs;Resource"/> - <rdfs:domain rdf:resource="&rdfs;Resource"/> -</rdf:Property> - -<rdf:Property rdf:about="&rdfs;isDefinedBy"> - <rdfs:isDefinedBy rdf:resource="&rdfs;"/> - <rdf:type resource="&rdf;Property"/> - <rdfs:subPropertyOf rdf:resource="&rdfs;seeAlso"/> - <rdfs:label xml:lang="en">isDefinedBy</rdfs:label> - <rdfs:comment>Indicates the namespace of a resource</rdfs:comment> - <rdfs:range rdf:resource="&rdfs;Resource"/> - <rdfs:domain rdf:resource="&rdfs;Resource"/> -</rdf:Property> - -<rdfs:Class rdf:about="&rdfs;Literal"> - <rdfs:isDefinedBy rdf:resource="&rdfs;"/> - <rdfs:label xml:lang="en">Literal</rdfs:label> - <rdfs:comment>This represents the set of atomic values, eg. textual strings.</rdfs:comment> -</rdfs:Class> - -<rdfs:Class rdf:about="&rdf;Statement"> - <rdfs:isDefinedBy rdf:resource="&rdf;"/> - <rdfs:label xml:lang="en">Statement</rdfs:label> - <rdfs:subClassOf rdf:resource="&rdfs;Resource"/> - <rdfs:comment>The class of RDF statements.</rdfs:comment> -</rdfs:Class> - -<rdf:Property about="&rdf;subject"> - <rdfs:isDefinedBy rdf:resource="&rdf;"/> - <rdfs:label xml:lang="en">subject</rdfs:label> - <rdfs:comment>The subject of an RDF statement.</rdfs:comment> - <rdfs:domain rdf:resource="&rdf;Statement"/> - <rdfs:range rdf:resource="&rdfs;Resource"/> -</rdf:Property> - -<rdf:Property about="&rdf;predicate"> - <rdfs:isDefinedBy rdf:resource="&rdf;"/> - <rdfs:label xml:lang="en">predicate</rdfs:label> - <rdfs:comment>the predicate of an RDF statement.</rdfs:comment> - <rdfs:domain rdf:resource="&rdf;Statement"/> - <rdfs:range rdf:resource="&rdf;Property"/> -</rdf:Property> - -<rdf:Property about="&rdf;object"> - <rdfs:isDefinedBy rdf:resource="&rdf;"/> - <rdfs:label xml:lang="en">object</rdfs:label> - <rdfs:comment>The object of an RDF statement.</rdfs:comment> - <rdfs:domain rdf:resource="&rdf;Statement"/> -</rdf:Property> - -<rdfs:Class rdf:about="&rdfs;Container"> - <rdfs:isDefinedBy rdf:resource="&rdfs;"/> - <rdfs:label xml:lang="en">Container</rdfs:label> - <rdfs:subClassOf rdf:resource="&rdfs;Resource"/> - <rdfs:comment>This represents the set Containers.</rdfs:comment> -</rdfs:Class> - -<rdfs:Class rdf:about="&rdf;Bag"> - <rdfs:isDefinedBy rdf:resource="&rdf;"/> - <rdfs:label xml:lang="en">Bag</rdfs:label> - <rdfs:comment xml:lang="en">An unordered collection.</rdfs:comment> - <rdfs:subClassOf rdf:resource="&rdfs;Container"/> -</rdfs:Class> - -<rdfs:Class rdf:about="&rdf;Seq"> - <rdfs:isDefinedBy rdf:resource="&rdf;"/> - <rdfs:label xml:lang="en">Seq</rdfs:label> - <rdfs:comment xml:lang="en">An ordered collection.</rdfs:comment> - <rdfs:subClassOf rdf:resource="&rdfs;Container"/> -</rdfs:Class> - -<rdfs:Class rdf:about="&rdf;Alt"> - <rdfs:isDefinedBy rdf:resource="&rdf;"/> - <rdfs:label xml:lang="en">Alt</rdfs:label> - <rdfs:comment xml:lang="en">A collection of alternatives.</rdfs:comment> - <rdfs:subClassOf rdf:resource="&rdfs;Container"/> -</rdfs:Class> - -<rdfs:Class rdf:about="&rdfs;ContainerMembershipProperty"> - <rdfs:isDefinedBy rdf:resource="&rdfs;"/> - <rdfs:label xml:lang="en">ContainerMembershipProperty</rdfs:label> - <rdfs:comment>The container membership properties, rdf:1, rdf:2, ..., all of which are sub-properties of 'member'.</rdfs:comment> - <rdfs:subClassOf rdf:resource="&rdf;Property"/> -</rdfs:Class> - -<rdf:Property rdf:about="&rdfs;member"> - <rdfs:isDefinedBy rdf:resource="&rdfs;"/> - <rdfs:label xml:lang="en">member</rdfs:label> - <rdfs:comment>a member of a container</rdfs:comment> - <rdfs:domain rdf:resource="&rdfs;Container"/> -</rdf:Property> - -<rdf:Property rdf:about="&rdf;value"> - <rdfs:isDefinedBy rdf:resource="&rdf;"/> - <rdfs:label xml:lang="en">value</rdfs:label> - <rdfs:comment>Identifies the principal value (usually a string) of a property when the property value is a structured resource</rdfs:comment> - <rdfs:domain rdf:resource="&rdfs;Resource"/> -</rdf:Property> - -<!-- the following are new additions, Nov 2002 --> - -<rdfs:Class rdf:about="&rdf;List"> - <rdfs:isDefinedBy rdf:resource="&rdf;"/> - <rdfs:label xml:lang="en">List</rdfs:label> - <rdfs:comment xml:lang="en">The class of RDF Lists</rdfs:comment> -</rdfs:Class> - -<rdf:List rdf:about="&rdf;nil"> - <rdfs:isDefinedBy rdf:resource="&rdf;"/> - <rdfs:label xml:lang="en">nil</rdfs:label> - <rdfs:comment xml:lang="en">The empty list, with no items in it. If the rest of a list is nil then the list has no more items in it.</rdfs:comment> -</rdf:List> - -<rdf:Property rdf:about="&rdf;first"> - <rdfs:isDefinedBy rdf:resource="&rdf;"/> - <rdfs:label xml:lang="en">first</rdfs:label> - <rdfs:comment xml:lang="en">The first item in an RDF list. Also often called the head.</rdfs:comment> - <rdfs:domain rdf:resource="&rdf;List"/> -</rdf:Property> - -<rdf:Property rdf:about="&rdf;rest"> - <rdfs:isDefinedBy rdf:resource="&rdf;"/> - <rdfs:label xml:lang="en">rest</rdfs:label> - <rdfs:comment xml:lang="en">The rest of an RDF list after the first item. Also often called the tail.</rdfs:comment> - <rdfs:domain rdf:resource="&rdf;List"/> - <rdfs:range rdf:resource="&rdf;List"/> -</rdf:Property> - -<rdfs:Class rdf:about="&rdfs;Datatype"> - <rdfs:isDefinedBy rdf:resource="&rdfs;"/> - <rdfs:label xml:lang="en">Datatype</rdfs:label> - <rdfs:comment xml:lang="en">The class of datatypes.</rdfs:comment> -</rdfs:Class> - -<rdfs:Class rdf:about="&rdfs;XMLLiteral"> - <rdfs:isDefinedBy rdf:resource="&rdfs;"/> - <rdfs:label xml:lang="en">XMLLiteral</rdfs:label> - <rdfs:comment>The class of XML literals.</rdfs:comment> -</rdfs:Class> - - -<rdf:Description rdf:about="&rdfs;"> - <rdfs:seeAlso rdf:resource="http://www.w3.org/2000/01/rdf-schema-more"/> -</rdf:Description> - -</rdf:RDF> diff --git a/packages/sgml/RDF/rewrite.pl b/packages/sgml/RDF/rewrite.pl deleted file mode 100644 index 6c10ca531..000000000 --- a/packages/sgml/RDF/rewrite.pl +++ /dev/null @@ -1,144 +0,0 @@ -/* $Id$ - - Part of XPCE - Designed and implemented by Anjo Anjewierden and Jan Wielemaker - E-mail: jan@swi.psy.uva.nl - - Copyright (C) 2000 University of Amsterdam. All rights reserved. -*/ - -:- module(rewrite, - [ rewrite/2, % +Rule, +Input - rew_term_expansion/2, - rew_goal_expansion/2 - ]). -:- use_module(library(quintus)). - -:- meta_predicate - rewrite(:, +). -:- op(1200, xfx, user:(::=)). - - - /******************************* - * COMPILATION * - *******************************/ - -rew_term_expansion((Rule ::= RuleBody), (Head :- Body)) :- - translate(RuleBody, Term, Body0), - simplify(Body0, Body), - Rule =.. List, - append(List, [Term], L2), - Head =.. L2. - -rew_goal_expansion(rewrite(To, From), Goal) :- - nonvar(To), - To = \Rule, - compound(Rule), - Rule =.. List, - append(List, [From], List2), - Goal =.. List2. - - - /******************************* - * TOPLEVEL * - *******************************/ - -%% rewrite(?To, +From) -% -% Invoke the term-rewriting system - -rewrite(To, From) :- - strip_module(To, M, T), - ( var(T) - -> From = T - ; T = \Rule - -> call(M:Rule, From) - ; match(To, M, From) - ). - -match(Rule, M, From) :- - translate(Rule, From, Code), - M:Code. - -translate(Var, Var, true) :- - var(Var), !. -translate((\Command, !), Var, (Goal, !)) :- !, - ( callable(Command), - Command =.. List - -> append(List, [Var], L2), - Goal =.. L2 - ; Goal = rewrite(\Command, Var) - ). -translate(\Command, Var, Goal) :- !, - ( callable(Command), - Command =.. List - -> append(List, [Var], L2), - Goal =.. L2 - ; Goal = rewrite(\Command, Var) - ). -translate(Atomic, Atomic, true) :- - atomic(Atomic), !. -translate(C, _, Cmd) :- - command(C, Cmd), !. -translate((A, B), T, Code) :- - ( command(A, Cmd) - -> !, translate(B, T, C), - Code = (Cmd, C) - ; command(B, Cmd) - -> !, translate(A, T, C), - Code = (C, Cmd) - ). -translate(Term0, Term, Command) :- - functor(Term0, Name, Arity), - functor(Term, Name, Arity), - translate_args(0, Arity, Term0, Term, Command). - -translate_args(N, N, _, _, true) :- !. -translate_args(I0, Arity, T0, T1, (C0,C)) :- - I is I0 + 1, - arg(I, T0, A0), - arg(I, T1, A1), - translate(A0, A1, C0), - translate_args(I, Arity, T0, T1, C). - -command(0, _) :- !, % catch variables - fail. -command({A}, A). -command(!, !). - - /******************************* - * SIMPLIFY * - *******************************/ - -%% simplify(+Raw, -Simplified) -% -% Get rid of redundant `true' goals generated by translate/3. - -simplify(V, V) :- - var(V), !. -simplify((A0,B), A) :- - B == true, !, - simplify(A0, A). -simplify((A,B0), B) :- - A == true, !, - simplify(B0, B). -simplify((A0, B0), C) :- !, - simplify(A0, A), - simplify(B0, B), - ( ( A \== A0 - ; B \== B0 - ) - -> simplify((A,B), C) - ; C = (A,B) - ). -simplify(X, X). - - /******************************* - * XREF * - *******************************/ - -:- multifile - prolog:called_by/2. - -prolog:called_by(rewrite(Spec, _Term), Called) :- - findall(G+1, sub_term(\G, Spec), Called). diff --git a/packages/sgml/RDF/suite/ex_19.rdf b/packages/sgml/RDF/suite/ex_19.rdf deleted file mode 100644 index 2c67bb089..000000000 --- a/packages/sgml/RDF/suite/ex_19.rdf +++ /dev/null @@ -1,12 +0,0 @@ -<?xml version="1.0"?> -<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:ex="http://example.org/stuff/1.0/"> - <rdf:Description rdf:about="http://example.org/basket"> - <ex:hasFruit rdf:ID="l1" rdf:parseType="Collection"> - <rdf:Description rdf:about="http://example.org/banana"/> - <rdf:Description rdf:about="http://example.org/apple"/> - <rdf:Description rdf:about="http://example.org/pear"/> - </ex:hasFruit> - </rdf:Description> -</rdf:RDF> - diff --git a/packages/sgml/RDF/suite/ok/ex_19.ok b/packages/sgml/RDF/suite/ok/ex_19.ok deleted file mode 100644 index 2086c8b9a..000000000 --- a/packages/sgml/RDF/suite/ok/ex_19.ok +++ /dev/null @@ -1,14 +0,0 @@ -rdf('http://example.org/basket', 'http://example.org/stuff/1.0/':hasFruit, '__List1'). -rdf(l1, rdf:type, rdf:'Statement'). -rdf(l1, rdf:subject, 'http://example.org/basket'). -rdf(l1, rdf:predicate, 'http://example.org/stuff/1.0/':hasFruit). -rdf(l1, rdf:object, '__List1'). -rdf('__List1', rdf:type, rdf:'List'). -rdf('__List1', rdf:first, 'http://example.org/banana'). -rdf('__List1', rdf:rest, '__List2'). -rdf('__List2', rdf:type, rdf:'List'). -rdf('__List2', rdf:first, 'http://example.org/apple'). -rdf('__List2', rdf:rest, '__List3'). -rdf('__List3', rdf:type, rdf:'List'). -rdf('__List3', rdf:first, 'http://example.org/pear'). -rdf('__List3', rdf:rest, rdf:nil). diff --git a/packages/sgml/RDF/suite/ok/t1.ok b/packages/sgml/RDF/suite/ok/t1.ok deleted file mode 100644 index 4234741be..000000000 --- a/packages/sgml/RDF/suite/ok/t1.ok +++ /dev/null @@ -1 +0,0 @@ -rdf('http://www.w3.org/Home/Lassila', 'http://description.org/schema/':'Creator', literal('Ora Lassila')). diff --git a/packages/sgml/RDF/suite/ok/t10.ok b/packages/sgml/RDF/suite/ok/t10.ok deleted file mode 100644 index b27554c1c..000000000 --- a/packages/sgml/RDF/suite/ok/t10.ok +++ /dev/null @@ -1,4 +0,0 @@ -rdf(pages, rdf:type, rdf:'Bag'). -rdf(pages, rdf:'_1', 'http://foo.org/foo.html'). -rdf(pages, rdf:'_2', 'http://bar.org/bar.html'). -rdf(each(pages), 'http://purl.org/metadata/dublin_core/':'Creator', literal('Ora Lassila')). diff --git a/packages/sgml/RDF/suite/ok/t11.ok b/packages/sgml/RDF/suite/ok/t11.ok deleted file mode 100644 index 54903a32c..000000000 --- a/packages/sgml/RDF/suite/ok/t11.ok +++ /dev/null @@ -1 +0,0 @@ -rdf('http://www.swi.psy.uva.nl/projects/SWI-Prolog/', 'http://description.org/schema/':'Creator', literal('Jan Wielemaker')). diff --git a/packages/sgml/RDF/suite/ok/t12.ok b/packages/sgml/RDF/suite/ok/t12.ok deleted file mode 100644 index 4234741be..000000000 --- a/packages/sgml/RDF/suite/ok/t12.ok +++ /dev/null @@ -1 +0,0 @@ -rdf('http://www.w3.org/Home/Lassila', 'http://description.org/schema/':'Creator', literal('Ora Lassila')). diff --git a/packages/sgml/RDF/suite/ok/t13.ok b/packages/sgml/RDF/suite/ok/t13.ok deleted file mode 100644 index 4234741be..000000000 --- a/packages/sgml/RDF/suite/ok/t13.ok +++ /dev/null @@ -1 +0,0 @@ -rdf('http://www.w3.org/Home/Lassila', 'http://description.org/schema/':'Creator', literal('Ora Lassila')). diff --git a/packages/sgml/RDF/suite/ok/t14.ok b/packages/sgml/RDF/suite/ok/t14.ok deleted file mode 100644 index e842e0cf9..000000000 --- a/packages/sgml/RDF/suite/ok/t14.ok +++ /dev/null @@ -1,3 +0,0 @@ -rdf('http://www.w3.org', 'http://description.org/schema/':'Publisher', literal('World Wide Web Consortium')). -rdf('http://www.w3.org', 'http://description.org/schema/':'Title', literal('W3C Home Page')). -rdf('http://www.w3.org', 'http://description.org/schema/':'Date', literal('1998-10-03T02:27')). diff --git a/packages/sgml/RDF/suite/ok/t15.ok b/packages/sgml/RDF/suite/ok/t15.ok deleted file mode 100644 index e842e0cf9..000000000 --- a/packages/sgml/RDF/suite/ok/t15.ok +++ /dev/null @@ -1,3 +0,0 @@ -rdf('http://www.w3.org', 'http://description.org/schema/':'Publisher', literal('World Wide Web Consortium')). -rdf('http://www.w3.org', 'http://description.org/schema/':'Title', literal('W3C Home Page')). -rdf('http://www.w3.org', 'http://description.org/schema/':'Date', literal('1998-10-03T02:27')). diff --git a/packages/sgml/RDF/suite/ok/t16.ok b/packages/sgml/RDF/suite/ok/t16.ok deleted file mode 100644 index 607ee12ea..000000000 --- a/packages/sgml/RDF/suite/ok/t16.ok +++ /dev/null @@ -1,3 +0,0 @@ -rdf('http://www.w3.org/Home/Lassila', 'http://description.org/schema/':'Creator', 'http://www.w3.org/staffId/85740'). -rdf('http://www.w3.org/staffId/85740', 'http://description.org/schema/':'Name', literal('Ora Lassila')). -rdf('http://www.w3.org/staffId/85740', 'http://description.org/schema/':'Email', literal('lassila@w3.org')). diff --git a/packages/sgml/RDF/suite/ok/t17.ok b/packages/sgml/RDF/suite/ok/t17.ok deleted file mode 100644 index c1976913a..000000000 --- a/packages/sgml/RDF/suite/ok/t17.ok +++ /dev/null @@ -1,3 +0,0 @@ -rdf('http://www.w3.org/staffId/85740', 'http://description.org/schema/':'Name', literal('Ora Lassila')). -rdf('http://www.w3.org/staffId/85740', 'http://description.org/schema/':'Email', literal('lassila@w3.org')). -rdf('http://www.w3.org/Home/Lassila', 'http://description.org/schema/':'Creator', 'http://www.w3.org/staffId/85740'). diff --git a/packages/sgml/RDF/suite/ok/t18.ok b/packages/sgml/RDF/suite/ok/t18.ok deleted file mode 100644 index c1976913a..000000000 --- a/packages/sgml/RDF/suite/ok/t18.ok +++ /dev/null @@ -1,3 +0,0 @@ -rdf('http://www.w3.org/staffId/85740', 'http://description.org/schema/':'Name', literal('Ora Lassila')). -rdf('http://www.w3.org/staffId/85740', 'http://description.org/schema/':'Email', literal('lassila@w3.org')). -rdf('http://www.w3.org/Home/Lassila', 'http://description.org/schema/':'Creator', 'http://www.w3.org/staffId/85740'). diff --git a/packages/sgml/RDF/suite/ok/t19.ok b/packages/sgml/RDF/suite/ok/t19.ok deleted file mode 100644 index de0eccc11..000000000 --- a/packages/sgml/RDF/suite/ok/t19.ok +++ /dev/null @@ -1,4 +0,0 @@ -rdf('http://www.w3.org/staffId/85740', rdf:type, 'http://description.org/schema/Person'). -rdf('http://www.w3.org/staffId/85740', 'http://description.org/view/':'Name', literal('Ora Lassila')). -rdf('http://www.w3.org/staffId/85740', 'http://description.org/view/':'Email', literal('lassila@w3.org')). -rdf('http://www.w3.org/Home/Lassila', 'http://description.org/schema/':'Creator', 'http://www.w3.org/staffId/85740'). diff --git a/packages/sgml/RDF/suite/ok/t2.ok b/packages/sgml/RDF/suite/ok/t2.ok deleted file mode 100644 index 288860a45..000000000 --- a/packages/sgml/RDF/suite/ok/t2.ok +++ /dev/null @@ -1,3 +0,0 @@ -rdf('JW', sex, literal(male)). -rdf('JW', employed_at, literal('SWI')). -rdf('SWI-prolog', 'http://description.org/schema/':'Creator', 'JW'). diff --git a/packages/sgml/RDF/suite/ok/t20.ok b/packages/sgml/RDF/suite/ok/t20.ok deleted file mode 100644 index de0eccc11..000000000 --- a/packages/sgml/RDF/suite/ok/t20.ok +++ /dev/null @@ -1,4 +0,0 @@ -rdf('http://www.w3.org/staffId/85740', rdf:type, 'http://description.org/schema/Person'). -rdf('http://www.w3.org/staffId/85740', 'http://description.org/view/':'Name', literal('Ora Lassila')). -rdf('http://www.w3.org/staffId/85740', 'http://description.org/view/':'Email', literal('lassila@w3.org')). -rdf('http://www.w3.org/Home/Lassila', 'http://description.org/schema/':'Creator', 'http://www.w3.org/staffId/85740'). diff --git a/packages/sgml/RDF/suite/ok/t21.ok b/packages/sgml/RDF/suite/ok/t21.ok deleted file mode 100644 index 1fa5f0a49..000000000 --- a/packages/sgml/RDF/suite/ok/t21.ok +++ /dev/null @@ -1,7 +0,0 @@ -rdf('__Bag1', rdf:type, rdf:'Bag'). -rdf('__Bag1', rdf:'_1', 'http://mycollege.edu/students/Amy'). -rdf('__Bag1', rdf:'_2', 'http://mycollege.edu/students/Tim'). -rdf('__Bag1', rdf:'_3', 'http://mycollege.edu/students/John'). -rdf('__Bag1', rdf:'_4', 'http://mycollege.edu/students/Mary'). -rdf('__Bag1', rdf:'_5', 'http://mycollege.edu/students/Sue'). -rdf('http://mycollege.edu/courses/6.001', 'http://description.org/schema/':students, '__Bag1'). diff --git a/packages/sgml/RDF/suite/ok/t22.ok b/packages/sgml/RDF/suite/ok/t22.ok deleted file mode 100644 index a342189e8..000000000 --- a/packages/sgml/RDF/suite/ok/t22.ok +++ /dev/null @@ -1,5 +0,0 @@ -rdf('__Alt1', rdf:type, rdf:'Alt'). -rdf('__Alt1', rdf:'_1', 'ftp://ftp.x.org'). -rdf('__Alt1', rdf:'_2', 'ftp://ftp.cs.purdue.edu'). -rdf('__Alt1', rdf:'_3', 'ftp://ftp.eu.net'). -rdf('http://x.org/packages/X11', 'http://description.org/schema/':'DistributionSite', '__Alt1'). diff --git a/packages/sgml/RDF/suite/ok/t23.ok b/packages/sgml/RDF/suite/ok/t23.ok deleted file mode 100644 index 6003221ec..000000000 --- a/packages/sgml/RDF/suite/ok/t23.ok +++ /dev/null @@ -1 +0,0 @@ -rdf(prefix('http://foo.org/doc'), 'http://description.org/schema/Copyright', literal('© 1998, The Foo Organization')). diff --git a/packages/sgml/RDF/suite/ok/t24.ok b/packages/sgml/RDF/suite/ok/t24.ok deleted file mode 100644 index ea31d774b..000000000 --- a/packages/sgml/RDF/suite/ok/t24.ok +++ /dev/null @@ -1,5 +0,0 @@ -rdf('__Description1', rdf:subject, 'http://www.w3.org/Home/Lassila'). -rdf('__Description1', rdf:predicate, 'http://description.org/schema/Creator'). -rdf('__Description1', rdf:object, literal('Ora Lassila')). -rdf('__Description1', rdf:type, 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement'). -rdf('__Description1', 'http://description.org/schema/':attributedTo, literal('Ralph Swick')). diff --git a/packages/sgml/RDF/suite/ok/t25.ok b/packages/sgml/RDF/suite/ok/t25.ok deleted file mode 100644 index e9edf3956..000000000 --- a/packages/sgml/RDF/suite/ok/t25.ok +++ /dev/null @@ -1,13 +0,0 @@ -rdf('D_001', rdf:type, rdf:'Bag'). -rdf('http://www.w3.org/Home/Lassila', 'http://description.org/schema/':'Creator', literal('Ora Lassila')). -rdf('__Statement1', rdf:type, rdf:'Statement'). -rdf('__Statement1', rdf:subject, 'http://www.w3.org/Home/Lassila'). -rdf('__Statement1', rdf:predicate, 'http://description.org/schema/':'Creator'). -rdf('__Statement1', rdf:object, literal('Ora Lassila')). -rdf('http://www.w3.org/Home/Lassila', 'http://description.org/schema/':'Title', literal('Ora\'s Home Page')). -rdf('__Statement2', rdf:type, rdf:'Statement'). -rdf('__Statement2', rdf:subject, 'http://www.w3.org/Home/Lassila'). -rdf('__Statement2', rdf:predicate, 'http://description.org/schema/':'Title'). -rdf('__Statement2', rdf:object, literal('Ora\'s Home Page')). -rdf('D_001', rdf:'_1', '__Statement1'). -rdf('D_001', rdf:'_2', '__Statement2'). diff --git a/packages/sgml/RDF/suite/ok/t26.ok b/packages/sgml/RDF/suite/ok/t26.ok deleted file mode 100644 index 2b9857745..000000000 --- a/packages/sgml/RDF/suite/ok/t26.ok +++ /dev/null @@ -1,8 +0,0 @@ -rdf('JSPapersByDate', rdf:type, rdf:'Seq'). -rdf('JSPapersByDate', rdf:'_1', 'http://www.dogworld.com/Aug96.doc'). -rdf('JSPapersByDate', rdf:'_2', 'http://www.webnuts.net/Jan97.html'). -rdf('JSPapersByDate', rdf:'_3', 'http://www.carchat.com/Sept97.html'). -rdf('JSPapersBySubj', rdf:type, rdf:'Seq'). -rdf('JSPapersBySubj', rdf:'_1', 'http://www.carchat.com/Sept97.html'). -rdf('JSPapersBySubj', rdf:'_2', 'http://www.dogworld.com/Aug96.doc'). -rdf('JSPapersBySubj', rdf:'_3', 'http://www.webnuts.net/Jan97.html'). diff --git a/packages/sgml/RDF/suite/ok/t27.ok b/packages/sgml/RDF/suite/ok/t27.ok deleted file mode 100644 index 1cbc29893..000000000 --- a/packages/sgml/RDF/suite/ok/t27.ok +++ /dev/null @@ -1,12 +0,0 @@ -rdf('CreatorsAlphabeticalBySurname', rdf:type, rdf:'Seq'). -rdf('CreatorsAlphabeticalBySurname', rdf:'_1', literal('Mary Andrew')). -rdf('CreatorsAlphabeticalBySurname', rdf:'_2', literal('Jacky Crystal')). -rdf('http://www.foo.com/cool.html', 'http://purl.org/metadata/dublin_core#':'Creator', 'CreatorsAlphabeticalBySurname'). -rdf('MirroredSites', rdf:type, rdf:'Bag'). -rdf('MirroredSites', rdf:'_1', 'http://www.foo.com.au/cool.html'). -rdf('MirroredSites', rdf:'_2', 'http://www.foo.com.it/cool.html'). -rdf('http://www.foo.com/cool.html', 'http://purl.org/metadata/dublin_core#':'Identifier', 'MirroredSites'). -rdf('__Alt1', rdf:type, rdf:'Alt'). -rdf('__Alt1', rdf:'_1', literal(lang(en, 'The Coolest Web Page'))). -rdf('__Alt1', rdf:'_2', literal(lang(it, 'Il Pagio di Web Fuba'))). -rdf('http://www.foo.com/cool.html', 'http://purl.org/metadata/dublin_core#':'Title', '__Alt1'). diff --git a/packages/sgml/RDF/suite/ok/t28.ok b/packages/sgml/RDF/suite/ok/t28.ok deleted file mode 100644 index d07bf3ca0..000000000 --- a/packages/sgml/RDF/suite/ok/t28.ok +++ /dev/null @@ -1,3 +0,0 @@ -rdf('__Description1', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#':value, literal('020 - Library Science')). -rdf('__Description1', 'http://mycorp.com/schemas/my-schema#':'Classification', literal('Dewey Decimal Code')). -rdf('http://www.webnuts.net/Jan97.html', 'http://purl.org/metadata/dublin_core#':'Subject', '__Description1'). diff --git a/packages/sgml/RDF/suite/ok/t29.ok b/packages/sgml/RDF/suite/ok/t29.ok deleted file mode 100644 index 3954da907..000000000 --- a/packages/sgml/RDF/suite/ok/t29.ok +++ /dev/null @@ -1,3 +0,0 @@ -rdf('__Description1', rdf:value, literal('200')). -rdf('__Description1', 'http://www.nist.gov/units/':units, 'http://www.nist.gov/units/Pounds'). -rdf('John_Smith', 'http://www.nist.gov/units/':weight, '__Description1'). diff --git a/packages/sgml/RDF/suite/ok/t3.ok b/packages/sgml/RDF/suite/ok/t3.ok deleted file mode 100644 index 9e41fbc44..000000000 --- a/packages/sgml/RDF/suite/ok/t3.ok +++ /dev/null @@ -1,3 +0,0 @@ -rdf('JW', name, literal('Jan Wielemaker')). -rdf('JW', works_at, literal('SWI')). -rdf('http://www.swi.psy.uva.nl/projects/SWI-Prolog/', 'http://description.org/schema/':'Creator', 'JW'). diff --git a/packages/sgml/RDF/suite/ok/t30.ok b/packages/sgml/RDF/suite/ok/t30.ok deleted file mode 100644 index 19601571c..000000000 --- a/packages/sgml/RDF/suite/ok/t30.ok +++ /dev/null @@ -1,12 +0,0 @@ -rdf('http://www.dlib.org', 'http://purl.org/metadata/dublin_core#':'Title', literal('D-Lib Program - Research in Digital Libraries')). -rdf('http://www.dlib.org', 'http://purl.org/metadata/dublin_core#':'Description', literal('The D-Lib program supports the community of people\n with research interests in digital libraries and electronic\n publishing.')). -rdf('http://www.dlib.org', 'http://purl.org/metadata/dublin_core#':'Publisher', literal('Corporation For National Research Initiatives')). -rdf('http://www.dlib.org', 'http://purl.org/metadata/dublin_core#':'Date', literal('1995-01-07')). -rdf('__Bag1', rdf:type, rdf:'Bag'). -rdf('__Bag1', rdf:'_1', literal('Research; statistical methods')). -rdf('__Bag1', rdf:'_2', literal('Education, research, related topics')). -rdf('__Bag1', rdf:'_3', literal('Library use Studies')). -rdf('http://www.dlib.org', 'http://purl.org/metadata/dublin_core#':'Subject', '__Bag1'). -rdf('http://www.dlib.org', 'http://purl.org/metadata/dublin_core#':'Type', literal('World Wide Web Home Page')). -rdf('http://www.dlib.org', 'http://purl.org/metadata/dublin_core#':'Format', literal('text/html')). -rdf('http://www.dlib.org', 'http://purl.org/metadata/dublin_core#':'Language', literal(en)). diff --git a/packages/sgml/RDF/suite/ok/t31.ok b/packages/sgml/RDF/suite/ok/t31.ok deleted file mode 100644 index 9ebb6a357..000000000 --- a/packages/sgml/RDF/suite/ok/t31.ok +++ /dev/null @@ -1,17 +0,0 @@ -rdf('http://www.dlib.org/dlib/may98/05contents.html', 'http://purl.org/metadata/dublin_core#':'Title', literal('DLIB Magazine - The Magazine for Digital Library Research\n - May 1998')). -rdf('http://www.dlib.org/dlib/may98/05contents.html', 'http://purl.org/metadata/dublin_core#':'Description', literal('D-LIB magazine is a monthly compilation of\n contributed stories, commentary, and briefings.')). -rdf('__Description1', 'http://purl.org/metadata/dublin_core_qualifiers#':'AgentType', 'http://purl.org/metadata/dublin_core_qualifiers#Editor'). -rdf('__Description1', rdf:value, literal('Amy Friedlander')). -rdf('http://www.dlib.org/dlib/may98/05contents.html', 'http://purl.org/metadata/dublin_core#':'Contributor', '__Description1'). -rdf('http://www.dlib.org/dlib/may98/05contents.html', 'http://purl.org/metadata/dublin_core#':'Publisher', literal('Corporation for National Research Initiatives')). -rdf('http://www.dlib.org/dlib/may98/05contents.html', 'http://purl.org/metadata/dublin_core#':'Date', literal('1998-01-05')). -rdf('http://www.dlib.org/dlib/may98/05contents.html', 'http://purl.org/metadata/dublin_core#':'Type', literal('electronic journal')). -rdf('__Bag1', rdf:type, rdf:'Bag'). -rdf('__Bag1', rdf:'_1', literal('library use studies')). -rdf('__Bag1', rdf:'_2', literal('magazines and newspapers')). -rdf('http://www.dlib.org/dlib/may98/05contents.html', 'http://purl.org/metadata/dublin_core#':'Subject', '__Bag1'). -rdf('http://www.dlib.org/dlib/may98/05contents.html', 'http://purl.org/metadata/dublin_core#':'Format', literal('text/html')). -rdf('http://www.dlib.org/dlib/may98/05contents.html', 'http://purl.org/metadata/dublin_core#':'Identifier', literal('urn:issn:1082-9873')). -rdf('__Description2', 'http://purl.org/metadata/dublin_core_qualifiers#':'RelationType', 'http://purl.org/metadata/dublin_core_qualifiers#IsPartOf'). -rdf('__Description2', rdf:value, 'http://www.dlib.org'). -rdf('http://www.dlib.org/dlib/may98/05contents.html', 'http://purl.org/metadata/dublin_core#':'Relation', '__Description2'). diff --git a/packages/sgml/RDF/suite/ok/t32.ok b/packages/sgml/RDF/suite/ok/t32.ok deleted file mode 100644 index 4ad411708..000000000 --- a/packages/sgml/RDF/suite/ok/t32.ok +++ /dev/null @@ -1,15 +0,0 @@ -rdf('http://www.dlib.org/dlib/may98/miller/05miller.html', 'http://purl.org/metadata/dublin_core#':'Title', literal('An Introduction to the Resource Description Framework')). -rdf('http://www.dlib.org/dlib/may98/miller/05miller.html', 'http://purl.org/metadata/dublin_core#':'Creator', literal('Eric J. Miller')). -rdf('http://www.dlib.org/dlib/may98/miller/05miller.html', 'http://purl.org/metadata/dublin_core#':'Description', literal('The Resource Description Framework (RDF) is an\n infrastructure that enables the encoding, exchange and reuse of\n structured metadata. rdf is an application of xml that imposes needed\n structural constraints to provide unambiguous methods of expressing\n semantics. rdf additionally provides a means for publishing both\n human-readable and machine-processable vocabularies designed to\n encourage the reuse and extension of metadata semantics among\n disparate information communities. the structural constraints rdf\n imposes to support the consistent encoding and exchange of\n standardized metadata provides for the interchangeability of separate\n packages of metadata defined by different resource description\n communities. ')). -rdf('http://www.dlib.org/dlib/may98/miller/05miller.html', 'http://purl.org/metadata/dublin_core#':'Publisher', literal('Corporation for National Research Initiatives')). -rdf('__Bag1', rdf:type, rdf:'Bag'). -rdf('__Bag1', rdf:'_1', literal('machine-readable catalog record formats')). -rdf('__Bag1', rdf:'_2', literal('applications of computer file organization and\n\t access methods')). -rdf('http://www.dlib.org/dlib/may98/miller/05miller.html', 'http://purl.org/metadata/dublin_core#':'Subject', '__Bag1'). -rdf('http://www.dlib.org/dlib/may98/miller/05miller.html', 'http://purl.org/metadata/dublin_core#':'Rights', literal('Copyright @ 1998 Eric Miller')). -rdf('http://www.dlib.org/dlib/may98/miller/05miller.html', 'http://purl.org/metadata/dublin_core#':'Type', literal('Electronic Document')). -rdf('http://www.dlib.org/dlib/may98/miller/05miller.html', 'http://purl.org/metadata/dublin_core#':'Format', literal('text/html')). -rdf('http://www.dlib.org/dlib/may98/miller/05miller.html', 'http://purl.org/metadata/dublin_core#':'Language', literal(en)). -rdf('__Description1', 'http://purl.org/metadata/dublin_core_qualifiers#':'RelationType', 'http://purl.org/metadata/dublin_core_qualifiers#IsPartOf'). -rdf('__Description1', rdf:value, 'http://www.dlib.org/dlib/may98/05contents.html'). -rdf('http://www.dlib.org/dlib/may98/miller/05miller.html', 'http://purl.org/metadata/dublin_core#':'Relation', '__Description1'). diff --git a/packages/sgml/RDF/suite/ok/t33.ok b/packages/sgml/RDF/suite/ok/t33.ok deleted file mode 100644 index 01924299f..000000000 --- a/packages/sgml/RDF/suite/ok/t33.ok +++ /dev/null @@ -1,2 +0,0 @@ -rdf('http://mycorp.com/papers/NobelPaper1', 'http://purl.org/metadata/dublin_core#Title', literal(type('http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral', ['Ramifications of ', element('http://www.w3.org/TR/REC-mathml':apply, [], [element('http://www.w3.org/TR/REC-mathml':power, [], []), element('http://www.w3.org/TR/REC-mathml':apply, [], [element('http://www.w3.org/TR/REC-mathml':plus, [], []), element('http://www.w3.org/TR/REC-mathml':ci, [], [a]), element('http://www.w3.org/TR/REC-mathml':ci, [], [b])]), element('http://www.w3.org/TR/REC-mathml':cn, [], ['2'])]), ' to World Peace\n ']))). -rdf('http://mycorp.com/papers/NobelPaper1', 'http://purl.org/metadata/dublin_core#Creator', literal('David Hume')). diff --git a/packages/sgml/RDF/suite/ok/t34.ok b/packages/sgml/RDF/suite/ok/t34.ok deleted file mode 100644 index 29ea46ab4..000000000 --- a/packages/sgml/RDF/suite/ok/t34.ok +++ /dev/null @@ -1,44 +0,0 @@ -rdf('L01', rdf:type, rdf:'Bag'). -rdf('http://www.w3.org/PICS/Overview.html', 'http://www.gcf.org/v2.5':suds, literal('0.5')). -rdf('__Statement1', rdf:type, rdf:'Statement'). -rdf('__Statement1', rdf:subject, 'http://www.w3.org/PICS/Overview.html'). -rdf('__Statement1', rdf:predicate, 'http://www.gcf.org/v2.5':suds). -rdf('__Statement1', rdf:object, literal('0.5')). -rdf('http://www.w3.org/PICS/Overview.html', 'http://www.gcf.org/v2.5':density, literal('0')). -rdf('__Statement2', rdf:type, rdf:'Statement'). -rdf('__Statement2', rdf:subject, 'http://www.w3.org/PICS/Overview.html'). -rdf('__Statement2', rdf:predicate, 'http://www.gcf.org/v2.5':density). -rdf('__Statement2', rdf:object, literal('0')). -rdf('http://www.w3.org/PICS/Overview.html', 'http://www.gcf.org/v2.5':'color.hue', literal('1')). -rdf('__Statement3', rdf:type, rdf:'Statement'). -rdf('__Statement3', rdf:subject, 'http://www.w3.org/PICS/Overview.html'). -rdf('__Statement3', rdf:predicate, 'http://www.gcf.org/v2.5':'color.hue'). -rdf('__Statement3', rdf:object, literal('1')). -rdf('L01', rdf:'_1', '__Statement1'). -rdf('L01', rdf:'_2', '__Statement2'). -rdf('L01', rdf:'_3', '__Statement3'). -rdf('L02', rdf:type, rdf:'Bag'). -rdf('http://www.w3.org/PICS/Underview.html', 'http://www.gcf.org/v2.5':subject, literal('2')). -rdf('__Statement4', rdf:type, rdf:'Statement'). -rdf('__Statement4', rdf:subject, 'http://www.w3.org/PICS/Underview.html'). -rdf('__Statement4', rdf:predicate, 'http://www.gcf.org/v2.5':subject). -rdf('__Statement4', rdf:object, literal('2')). -rdf('http://www.w3.org/PICS/Underview.html', 'http://www.gcf.org/v2.5':density, literal('1')). -rdf('__Statement5', rdf:type, rdf:'Statement'). -rdf('__Statement5', rdf:subject, 'http://www.w3.org/PICS/Underview.html'). -rdf('__Statement5', rdf:predicate, 'http://www.gcf.org/v2.5':density). -rdf('__Statement5', rdf:object, literal('1')). -rdf('http://www.w3.org/PICS/Underview.html', 'http://www.gcf.org/v2.5':'color.hue', literal('1')). -rdf('__Statement6', rdf:type, rdf:'Statement'). -rdf('__Statement6', rdf:subject, 'http://www.w3.org/PICS/Underview.html'). -rdf('__Statement6', rdf:predicate, 'http://www.gcf.org/v2.5':'color.hue'). -rdf('__Statement6', rdf:object, literal('1')). -rdf('L02', rdf:'_1', '__Statement4'). -rdf('L02', rdf:'_2', '__Statement5'). -rdf('L02', rdf:'_3', '__Statement6'). -rdf(each('L01'), 'http://www.w3.org/TR/xxxx/WD-PICS-labels#':by, literal('John Doe')). -rdf(each('L01'), 'http://www.w3.org/TR/xxxx/WD-PICS-labels#':on, literal('1994.11.05T08:15-0500')). -rdf(each('L01'), 'http://www.w3.org/TR/xxxx/WD-PICS-labels#':until, literal('1995.12.31T23:59-0000')). -rdf(each('L02'), 'http://www.w3.org/TR/xxxx/WD-PICS-labels#':by, literal('Jane Doe')). -rdf(each('L02'), 'http://www.w3.org/TR/xxxx/WD-PICS-labels#':on, literal('1994.11.05T08:15-0500')). -rdf(each('L02'), 'http://www.w3.org/TR/xxxx/WD-PICS-labels#':until, literal('1995.12.31T23:59-0000')). diff --git a/packages/sgml/RDF/suite/ok/t35.ok b/packages/sgml/RDF/suite/ok/t35.ok deleted file mode 100644 index 30e595469..000000000 --- a/packages/sgml/RDF/suite/ok/t35.ok +++ /dev/null @@ -1,8 +0,0 @@ -rdf('L03', rdf:type, rdf:'Bag'). -rdf(prefix('http://www.w3.org/WWW/'), 'http://www.ages.org/our-service/v1.0/':age, literal('11')). -rdf('__Statement1', rdf:type, rdf:'Statement'). -rdf('__Statement1', rdf:subject, prefix('http://www.w3.org/WWW/')). -rdf('__Statement1', rdf:predicate, 'http://www.ages.org/our-service/v1.0/':age). -rdf('__Statement1', rdf:object, literal('11')). -rdf('L03', rdf:'_1', '__Statement1'). -rdf(each('L03'), 'http://www.w3.org/TR/xxxx/WD-PICS-labels#':by, literal('abaird@w3.org')). diff --git a/packages/sgml/RDF/suite/ok/t36.ok b/packages/sgml/RDF/suite/ok/t36.ok deleted file mode 100644 index 30f016790..000000000 --- a/packages/sgml/RDF/suite/ok/t36.ok +++ /dev/null @@ -1,4 +0,0 @@ -rdf('CreatorsAlphabeticalBySurname', rdf:type, rdf:'Seq'). -rdf('CreatorsAlphabeticalBySurname', rdf:'_1', 'Mary Andrew'). -rdf('CreatorsAlphabeticalBySurname', rdf:'_2', 'Jacky Crystal'). -rdf('http://www.foo.com/cool.html', 'http://purl.org/metadata/dublin_core#':'Creator', 'CreatorsAlphabeticalBySurname'). diff --git a/packages/sgml/RDF/suite/ok/t37.ok b/packages/sgml/RDF/suite/ok/t37.ok deleted file mode 100644 index f5aab84b5..000000000 --- a/packages/sgml/RDF/suite/ok/t37.ok +++ /dev/null @@ -1,7 +0,0 @@ -rdf('JW', name, literal('Jan Wielemaker')). -rdf('JW', works_at, literal('SWI')). -rdf('http://www.swi.psy.uva.nl/projects/SWI-Prolog/', 'http://description.org/schema/':'Creator', 'JW'). -rdf('pl-creator', rdf:type, rdf:'Statement'). -rdf('pl-creator', rdf:subject, 'http://www.swi.psy.uva.nl/projects/SWI-Prolog/'). -rdf('pl-creator', rdf:predicate, 'http://description.org/schema/':'Creator'). -rdf('pl-creator', rdf:object, 'JW'). diff --git a/packages/sgml/RDF/suite/ok/t38.ok b/packages/sgml/RDF/suite/ok/t38.ok deleted file mode 100644 index 9d1858949..000000000 --- a/packages/sgml/RDF/suite/ok/t38.ok +++ /dev/null @@ -1,128 +0,0 @@ -rdf('Resource', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/2000/01/rdf-schema#Class'). -rdf('Resource', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(en, 'Resource'))). -rdf('Resource', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(fr, 'Ressource'))). -rdf('Resource', 'http://www.w3.org/2000/01/rdf-schema#comment', literal('The most general class')). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Property'). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(en, type))). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(fr, type))). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/2000/01/rdf-schema#comment', literal('Indicates membership of a class')). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/2000/01/rdf-schema#range', 'Class'). -rdf(comment, 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Property'). -rdf(comment, 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(en, comment))). -rdf(comment, 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(fr, commentaire))). -rdf(comment, 'http://www.w3.org/2000/01/rdf-schema#domain', 'Resource'). -rdf(comment, 'http://www.w3.org/2000/01/rdf-schema#comment', literal('Use this for descriptions')). -rdf(comment, 'http://www.w3.org/2000/01/rdf-schema#range', 'Literal'). -rdf(label, 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Property'). -rdf(label, 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Property'). -rdf(label, 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(en, label))). -rdf(label, 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(fr, label))). -rdf(label, 'http://www.w3.org/2000/01/rdf-schema#domain', 'Resource'). -rdf(label, 'http://www.w3.org/2000/01/rdf-schema#comment', literal('Provides a human-readable version of a resource name.')). -rdf(label, 'http://www.w3.org/2000/01/rdf-schema#range', 'Literal'). -rdf('Class', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/2000/01/rdf-schema#Class'). -rdf('Class', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(en, 'Class'))). -rdf('Class', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(fr, 'Classe'))). -rdf('Class', 'http://www.w3.org/2000/01/rdf-schema#comment', literal('The concept of Class')). -rdf('Class', 'http://www.w3.org/2000/01/rdf-schema#subClassOf', 'Resource'). -rdf(subClassOf, 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Property'). -rdf(subClassOf, 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(en, subClassOf))). -rdf(subClassOf, 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(fr, sousClasseDe))). -rdf(subClassOf, 'http://www.w3.org/2000/01/rdf-schema#comment', literal('Indicates membership of a class')). -rdf(subClassOf, 'http://www.w3.org/2000/01/rdf-schema#range', 'Class'). -rdf(subClassOf, 'http://www.w3.org/2000/01/rdf-schema#domain', 'Class'). -rdf(subPropertyOf, 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Property'). -rdf(subPropertyOf, 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(en, subPropertyOf))). -rdf(subPropertyOf, 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(fr, sousPropriétéDe))). -rdf(subPropertyOf, 'http://www.w3.org/2000/01/rdf-schema#comment', literal('Indicates specialization of properties')). -rdf(subPropertyOf, 'http://www.w3.org/2000/01/rdf-schema#range', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Property'). -rdf(subPropertyOf, 'http://www.w3.org/2000/01/rdf-schema#domain', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Property'). -rdf(seeAlso, 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Property'). -rdf(seeAlso, 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(en, seeAlso))). -rdf(seeAlso, 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(fr, voirAussi))). -rdf(seeAlso, 'http://www.w3.org/2000/01/rdf-schema#comment', literal('Indicates a resource that provides information about the subject resource.')). -rdf(seeAlso, 'http://www.w3.org/2000/01/rdf-schema#range', 'http://www.w3.org/2000/01/rdf-schema#Resource'). -rdf(seeAlso, 'http://www.w3.org/2000/01/rdf-schema#domain', 'http://www.w3.org/2000/01/rdf-schema#Resource'). -rdf(isDefinedBy, 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Property'). -rdf(isDefinedBy, 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Property'). -rdf(isDefinedBy, 'http://www.w3.org/2000/01/rdf-schema#subPropertyOf', seeAlso). -rdf(isDefinedBy, 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(en, isDefinedBy))). -rdf(isDefinedBy, 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(fr, esDéfiniPar))). -rdf(isDefinedBy, 'http://www.w3.org/2000/01/rdf-schema#comment', literal('Indicates a resource containing and defining the subject resource.')). -rdf(isDefinedBy, 'http://www.w3.org/2000/01/rdf-schema#range', 'http://www.w3.org/2000/01/rdf-schema#Resource'). -rdf(isDefinedBy, 'http://www.w3.org/2000/01/rdf-schema#domain', 'http://www.w3.org/2000/01/rdf-schema#Resource'). -rdf('ConstraintResource', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/2000/01/rdf-schema#Class'). -rdf('ConstraintResource', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(en, 'ConstraintResource'))). -rdf('ConstraintResource', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(fr, 'RessourceContrainte'))). -rdf('ConstraintResource', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'Class'). -rdf('ConstraintResource', 'http://www.w3.org/2000/01/rdf-schema#subClassOf', 'Resource'). -rdf('ConstraintResource', 'http://www.w3.org/2000/01/rdf-schema#comment', literal('Resources used to express RDF Schema constraints.')). -rdf('ConstraintProperty', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/2000/01/rdf-schema#Class'). -rdf('ConstraintProperty', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(en, 'ConstraintProperty'))). -rdf('ConstraintProperty', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(fr, 'PropriétéContrainte'))). -rdf('ConstraintProperty', 'http://www.w3.org/2000/01/rdf-schema#subClassOf', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Property'). -rdf('ConstraintProperty', 'http://www.w3.org/2000/01/rdf-schema#subClassOf', 'ConstraintResource'). -rdf('ConstraintProperty', 'http://www.w3.org/2000/01/rdf-schema#comment', literal('Properties used to express RDF Schema constraints.')). -rdf(domain, 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/2000/01/rdf-schema#ConstraintProperty'). -rdf(domain, 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(en, domain))). -rdf(domain, 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(fr, domaine))). -rdf(domain, 'http://www.w3.org/2000/01/rdf-schema#comment', literal('This is how we associate a class with\n properties that its instances can have')). -rdf(range, 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/2000/01/rdf-schema#ConstraintProperty'). -rdf(range, 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(en, range))). -rdf(range, 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(fr, étendue))). -rdf(range, 'http://www.w3.org/2000/01/rdf-schema#comment', literal('Properties that can be used in a\n schema to provide constraints')). -rdf(range, 'http://www.w3.org/2000/01/rdf-schema#range', 'Class'). -rdf(range, 'http://www.w3.org/2000/01/rdf-schema#domain', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Property'). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#Property', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/2000/01/rdf-schema#Class'). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#Property', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(en, 'Property'))). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#Property', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(fr, 'Propriété'))). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#Property', 'http://www.w3.org/2000/01/rdf-schema#comment', literal('The concept of a property.')). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#Property', 'http://www.w3.org/2000/01/rdf-schema#subClassOf', 'Resource'). -rdf('Literal', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/2000/01/rdf-schema#Class'). -rdf('Literal', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(en, 'Literal'))). -rdf('Literal', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(fr, 'Littéral'))). -rdf('Literal', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'Class'). -rdf('Literal', 'http://www.w3.org/2000/01/rdf-schema#comment', literal('This represents the set of atomic values, eg. textual strings.')). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/2000/01/rdf-schema#Class'). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(en, 'Statement'))). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(fr, 'Déclaration'))). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement', 'http://www.w3.org/2000/01/rdf-schema#subClassOf', 'Resource'). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement', 'http://www.w3.org/2000/01/rdf-schema#comment', literal('This represents the set of reified statements.')). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#subject', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Property'). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#subject', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(en, subject))). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#subject', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(fr, sujet))). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#subject', 'http://www.w3.org/2000/01/rdf-schema#domain', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement'). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#subject', 'http://www.w3.org/2000/01/rdf-schema#range', 'Resource'). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Property'). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(en, predicate))). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(fr, prédicat))). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Property'). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate', 'http://www.w3.org/2000/01/rdf-schema#domain', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement'). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate', 'http://www.w3.org/2000/01/rdf-schema#range', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Property'). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#object', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Property'). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#object', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(en, object))). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#object', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(fr, objet))). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#object', 'http://www.w3.org/2000/01/rdf-schema#domain', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement'). -rdf('Container', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/2000/01/rdf-schema#Class'). -rdf('Container', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(en, 'Container'))). -rdf('Container', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(fr, 'Enveloppe'))). -rdf('Container', 'http://www.w3.org/2000/01/rdf-schema#subClassOf', 'Resource'). -rdf('Container', 'http://www.w3.org/2000/01/rdf-schema#comment', literal('This represents the set Containers.')). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/2000/01/rdf-schema#Class'). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(en, 'Bag'))). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(fr, 'Ensemble'))). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag', 'http://www.w3.org/2000/01/rdf-schema#subClassOf', 'Container'). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#Seq', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/2000/01/rdf-schema#Class'). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#Seq', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(en, 'Sequence'))). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#Seq', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(fr, 'Séquence'))). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#Seq', 'http://www.w3.org/2000/01/rdf-schema#subClassOf', 'Container'). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#Alt', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/2000/01/rdf-schema#Class'). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#Alt', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(en, 'Alt'))). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#Alt', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(fr, 'Choix'))). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#Alt', 'http://www.w3.org/2000/01/rdf-schema#subClassOf', 'Container'). -rdf('ContainerMembershipProperty', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/2000/01/rdf-schema#Class'). -rdf('ContainerMembershipProperty', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(en, 'ContainerMembershipProperty'))). -rdf('ContainerMembershipProperty', 'http://www.w3.org/2000/01/rdf-schema#subClassOf', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Property'). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#value', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Property'). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#value', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(en, object))). -rdf('http://www.w3.org/1999/02/22-rdf-syntax-ns#value', 'http://www.w3.org/2000/01/rdf-schema#label', literal(lang(fr, value))). diff --git a/packages/sgml/RDF/suite/ok/t39.ok b/packages/sgml/RDF/suite/ok/t39.ok deleted file mode 100644 index b0599f6e0..000000000 --- a/packages/sgml/RDF/suite/ok/t39.ok +++ /dev/null @@ -1,9 +0,0 @@ -rdf('OntologyObjectMetaClass', rdf:type, 'http://www.w3.org/TR/1999/PR-rdf-schema-19990303#Class'). -rdf('OntologyObjectMetaClass', 'http://www.w3.org/TR/1999/PR-rdf-schema-19990303#':subClassOf, 'http://www.w3.org/TR/1999/PR-rdf-schema-19990303#Class'). -rdf('OntologyObjectMetaClass', 'http://smi-web.stanford.edu/projects/protege/protege-rdf/protege-19992012#':abstractProperty, literal(concrete)). -rdf(identifier, rdf:type, 'http://www.w3.org/TR/1999/PR-rdf-schema-19990303#Property'). -rdf('__Description1', rdf:type, 'http://www.w3.org/rdfutil#facetResource'). -rdf('__Description1', 'http://www.w3.org/rdfutil#':domain, 'OntologyObjectMetaClass'). -rdf('__Description1', 'http://www.w3.org/rdfutil#':range, 'http://www.w3.org/TR/xmlschema-2/#string'). -rdf('__Description1', 'http://www.w3.org/rdfutil#':cardinality, literal('1')). -rdf(identifier, 'http://www.w3.org/rdfutil#':facets, '__Description1'). diff --git a/packages/sgml/RDF/suite/ok/t4.ok b/packages/sgml/RDF/suite/ok/t4.ok deleted file mode 100644 index a5ff63035..000000000 --- a/packages/sgml/RDF/suite/ok/t4.ok +++ /dev/null @@ -1,6 +0,0 @@ -rdf('http://www.w3.org/Home/Lassila', 'http://description.org/schema/':'Creator', literal('Ora Lassila')). -rdf(statement1, rdf:type, rdf:'Statement'). -rdf(statement1, rdf:subject, 'http://www.w3.org/Home/Lassila'). -rdf(statement1, rdf:predicate, 'http://description.org/schema/':'Creator'). -rdf(statement1, rdf:object, literal('Ora Lassila')). -rdf(statement1, 'http://description.org/schema/':believedBy, literal('Stefan Decker')). diff --git a/packages/sgml/RDF/suite/ok/t40.ok b/packages/sgml/RDF/suite/ok/t40.ok deleted file mode 100644 index 71c6ab496..000000000 --- a/packages/sgml/RDF/suite/ok/t40.ok +++ /dev/null @@ -1,4 +0,0 @@ -rdf('__Description1', rdf:type, 'http://www.mytypes.org/schema/Bicycle'). -rdf('__Description1', wheels, literal('2')). -rdf('__Description2', rdf:type, 'http://www.mytypes.org/schema/Bicycle'). -rdf('__Description2', 'http://www.mytypes.org/schema/':wheels, literal('2')). diff --git a/packages/sgml/RDF/suite/ok/t41.ok b/packages/sgml/RDF/suite/ok/t41.ok deleted file mode 100644 index ce476fcc6..000000000 --- a/packages/sgml/RDF/suite/ok/t41.ok +++ /dev/null @@ -1,3 +0,0 @@ -rdf('JohnWeight', rdf:value, literal('200')). -rdf('JohnWeight', 'http://www.nist.gov/units/':units, 'http://www.nist.gov/units/Pounds'). -rdf('John_Smith', 'http://www.nist.gov/units/':weight, 'JohnWeight'). diff --git a/packages/sgml/RDF/suite/ok/t42.ok b/packages/sgml/RDF/suite/ok/t42.ok deleted file mode 100644 index 326e0a56d..000000000 --- a/packages/sgml/RDF/suite/ok/t42.ok +++ /dev/null @@ -1,4 +0,0 @@ -rdf('John_Smith', a1, literal('John')). -rdf('__Description1', v, literal('200')). -rdf('__Description1', t, literal(pounds)). -rdf('John_Smith', a1, '__Description1'). diff --git a/packages/sgml/RDF/suite/ok/t5.ok b/packages/sgml/RDF/suite/ok/t5.ok deleted file mode 100644 index f5dd815e4..000000000 --- a/packages/sgml/RDF/suite/ok/t5.ok +++ /dev/null @@ -1,7 +0,0 @@ -rdf('__Description1', name, literal('Jan Wielemaker')). -rdf('__Description1', works_at, literal('SWI')). -rdf('http://www.swi.psy.uva.nl/projects/SWI-Prolog/', 'http://description.org/schema/':'Creator', '__Description1'). -rdf('JW', rdf:type, rdf:'Statement'). -rdf('JW', rdf:subject, 'http://www.swi.psy.uva.nl/projects/SWI-Prolog/'). -rdf('JW', rdf:predicate, 'http://description.org/schema/':'Creator'). -rdf('JW', rdf:object, '__Description1'). diff --git a/packages/sgml/RDF/suite/ok/t6.ok b/packages/sgml/RDF/suite/ok/t6.ok deleted file mode 100644 index 281850d72..000000000 --- a/packages/sgml/RDF/suite/ok/t6.ok +++ /dev/null @@ -1,4 +0,0 @@ -rdf('__Bag1', rdf:type, rdf:'Bag'). -rdf('__Bag1', rdf:'_1', literal('Jan Wielemaker')). -rdf('__Bag1', rdf:'_2', literal('Anjo Anjewierden')). -rdf('http://www.swi.psy.uva.nl/projects/xpce/', 'http://description.org/schema/':'Creator', '__Bag1'). diff --git a/packages/sgml/RDF/suite/ok/t7.ok b/packages/sgml/RDF/suite/ok/t7.ok deleted file mode 100644 index f200bb6f8..000000000 --- a/packages/sgml/RDF/suite/ok/t7.ok +++ /dev/null @@ -1,5 +0,0 @@ -rdf('__Bag1', rdf:type, rdf:'Bag'). -rdf('__Description1', name, literal('Jan Wielemaker')). -rdf('__Description1', employed_at, literal('SWI')). -rdf('__Bag1', rdf:'_1', '__Description1'). -rdf('http://www.swi.psy.uva.nl/projects/xpce/', 'http://description.org/schema/':'Creator', '__Bag1'). diff --git a/packages/sgml/RDF/suite/ok/t8.ok b/packages/sgml/RDF/suite/ok/t8.ok deleted file mode 100644 index 737ac05c0..000000000 --- a/packages/sgml/RDF/suite/ok/t8.ok +++ /dev/null @@ -1,3 +0,0 @@ -rdf(weight_001, 'http://www.nist.gov/RDFschema/':'Units', 'http://www.nist.gov/units/pounds'). -rdf(weight_001, value, literal('200')). -rdf('John_Smith', 'http://www.nist.gov/RDFschema/':'Weight', weight_001). diff --git a/packages/sgml/RDF/suite/ok/t9.ok b/packages/sgml/RDF/suite/ok/t9.ok deleted file mode 100644 index e9867c898..000000000 --- a/packages/sgml/RDF/suite/ok/t9.ok +++ /dev/null @@ -1,9 +0,0 @@ -rdf('Statement_001', rdf:type, rdf:'Bag'). -rdf('http://www.bar.com/some.doc', 'http://purl.org/metadata/dublin_core/':'Creator', literal('John Smith')). -rdf('__Statement1', rdf:type, rdf:'Statement'). -rdf('__Statement1', rdf:subject, 'http://www.bar.com/some.doc'). -rdf('__Statement1', rdf:predicate, 'http://purl.org/metadata/dublin_core/':'Creator'). -rdf('__Statement1', rdf:object, literal('John Smith')). -rdf('Statement_001', rdf:'_1', '__Statement1'). -rdf(each('Statement_001'), 'http://www.w3.org/Schemas/DS-Schema/':'CreatedOn', literal('1998-02-06T14:00Z')). -rdf(each('Statement_001'), 'http://www.w3.org/Schemas/DS-Schema/':'CreatedBy', literal('Jane Cooper')). diff --git a/packages/sgml/RDF/suite/ok/types.ok b/packages/sgml/RDF/suite/ok/types.ok deleted file mode 100644 index 047e7390b..000000000 --- a/packages/sgml/RDF/suite/ok/types.ok +++ /dev/null @@ -1,6 +0,0 @@ -rdf('__Description1', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/2002/07/owl#Restriction'). -rdf('http://www.w3.org/2002/03owlt/I5.8/inconsistent001#p', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/2002/07/owl#DatatypeProperty'). -rdf('http://www.w3.org/2002/03owlt/I5.8/inconsistent001#p', 'http://www.w3.org/2000/01/rdf-schema#range', 'http://www.w3.org/2001/XMLSchema#byte'). -rdf('__Description1', 'http://www.w3.org/2002/07/owl#onProperty', 'http://www.w3.org/2002/03owlt/I5.8/inconsistent001#p'). -rdf('__Description1', 'http://www.w3.org/2002/07/owl#cardinality', literal(type('http://www.w3.org/2001/XMLSchema#nonNegativeInteger', '257'))). -rdf('http://www.w3.org/2002/03owlt/I5.8/inconsistent001#john', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', '__Description1'). diff --git a/packages/sgml/RDF/suite/ok/xmllit.ok b/packages/sgml/RDF/suite/ok/xmllit.ok deleted file mode 100644 index b6f7c8f38..000000000 --- a/packages/sgml/RDF/suite/ok/xmllit.ok +++ /dev/null @@ -1,2 +0,0 @@ -rdf(id1, 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.swi.psy.uva.nl/test#test'). -rdf(id1, 'http://www.swi.psy.uva.nl/test#a', literal(type('http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral', [element(b, [], [strong])]))). diff --git a/packages/sgml/RDF/suite/ok/xsdtypes.ok b/packages/sgml/RDF/suite/ok/xsdtypes.ok deleted file mode 100644 index fd42f66d6..000000000 --- a/packages/sgml/RDF/suite/ok/xsdtypes.ok +++ /dev/null @@ -1,2 +0,0 @@ -rdf(id1, rdf:type, 'http://www.swi.psy.uva.nl/test#test'). -rdf(id1, 'http://www.swi.psy.uva.nl/test#':int, literal(type('http://www.w3.org/2000/10/XMLSchema#int', '42'))). diff --git a/packages/sgml/RDF/suite/t1.rdf b/packages/sgml/RDF/suite/t1.rdf deleted file mode 100644 index 56a753b4e..000000000 --- a/packages/sgml/RDF/suite/t1.rdf +++ /dev/null @@ -1,10 +0,0 @@ -<?xml version='1.0'?> - -<!-- Example 1 from REC-rdf-syntax --> - -<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:s="http://description.org/schema/"> - <rdf:Description about="http://www.w3.org/Home/Lassila"> - <s:Creator>Ora Lassila</s:Creator> - </rdf:Description> -</rdf:RDF> diff --git a/packages/sgml/RDF/suite/t10.rdf b/packages/sgml/RDF/suite/t10.rdf deleted file mode 100644 index faaf907af..000000000 --- a/packages/sgml/RDF/suite/t10.rdf +++ /dev/null @@ -1,12 +0,0 @@ -<?xml version="1.0"?> - -<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:DC="http://purl.org/metadata/dublin_core/"> - <Bag ID="pages"> - <li resource="http://foo.org/foo.html" /> - <li resource="http://bar.org/bar.html" /> - </Bag> - <Description aboutEach="#pages"> - <DC:Creator>Ora Lassila</DC:Creator> - </Description> -</RDF> diff --git a/packages/sgml/RDF/suite/t11.rdf b/packages/sgml/RDF/suite/t11.rdf deleted file mode 100644 index a9c760111..000000000 --- a/packages/sgml/RDF/suite/t11.rdf +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version='1.0'?> - -<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:s="http://description.org/schema/"> - <rdf:Description about="http://www.swi.psy.uva.nl/projects/SWI-Prolog/" - s:Creator="Jan Wielemaker"/> -</rdf:RDF> diff --git a/packages/sgml/RDF/suite/t12.rdf b/packages/sgml/RDF/suite/t12.rdf deleted file mode 100644 index 9491f7f75..000000000 --- a/packages/sgml/RDF/suite/t12.rdf +++ /dev/null @@ -1,11 +0,0 @@ -<?xml version="1.0"?> - -<!-- Example from REC-rdf-syntax, demonstrating namespaces --> - -<RDF - xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:s="http://description.org/schema/"> - <Description about="http://www.w3.org/Home/Lassila"> - <s:Creator>Ora Lassila</s:Creator> - </Description> -</RDF> diff --git a/packages/sgml/RDF/suite/t13.rdf b/packages/sgml/RDF/suite/t13.rdf deleted file mode 100644 index 42d6b2e0c..000000000 --- a/packages/sgml/RDF/suite/t13.rdf +++ /dev/null @@ -1,9 +0,0 @@ -<?xml version="1.0"?> - -<!-- Example from REC-rdf-syntax, demonstrating namespaces --> - -<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> - <Description about="http://www.w3.org/Home/Lassila"> - <Creator xmlns="http://description.org/schema/">Ora Lassila</Creator> - </Description> -</RDF> diff --git a/packages/sgml/RDF/suite/t14.rdf b/packages/sgml/RDF/suite/t14.rdf deleted file mode 100644 index ce3d083ce..000000000 --- a/packages/sgml/RDF/suite/t14.rdf +++ /dev/null @@ -1,12 +0,0 @@ -<?xml version="1.0"?> - -<!-- Example from REC-rdf-syntax, demonstrating abbrevation --> - -<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:s="http://description.org/schema/"> - <rdf:Description about="http://www.w3.org"> - <s:Publisher>World Wide Web Consortium</s:Publisher> - <s:Title>W3C Home Page</s:Title> - <s:Date>1998-10-03T02:27</s:Date> - </rdf:Description> -</rdf:RDF> diff --git a/packages/sgml/RDF/suite/t15.rdf b/packages/sgml/RDF/suite/t15.rdf deleted file mode 100644 index 5c6b60332..000000000 --- a/packages/sgml/RDF/suite/t15.rdf +++ /dev/null @@ -1,11 +0,0 @@ -<?xml version="1.0"?> - -<!-- Example from REC-rdf-syntax, demonstrating abbrevation --> - -<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:s="http://description.org/schema/"> - <rdf:Description about="http://www.w3.org" - s:Publisher="World Wide Web Consortium" - s:Title="W3C Home Page" - s:Date="1998-10-03T02:27"/> -</rdf:RDF> diff --git a/packages/sgml/RDF/suite/t16.rdf b/packages/sgml/RDF/suite/t16.rdf deleted file mode 100644 index 236add31b..000000000 --- a/packages/sgml/RDF/suite/t16.rdf +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0"?> - -<!-- Example from REC-rdf-syntax, demonstrating abbrevation --> - -<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:s="http://description.org/schema/"> - <rdf:Description about="http://www.w3.org/Home/Lassila"> - <s:Creator rdf:resource="http://www.w3.org/staffId/85740"/> - </rdf:Description> - - <rdf:Description about="http://www.w3.org/staffId/85740"> - <s:Name>Ora Lassila</s:Name> - <s:Email>lassila@w3.org</s:Email> - </rdf:Description> -</rdf:RDF> diff --git a/packages/sgml/RDF/suite/t17.rdf b/packages/sgml/RDF/suite/t17.rdf deleted file mode 100644 index 933dc074a..000000000 --- a/packages/sgml/RDF/suite/t17.rdf +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0"?> - -<!-- Example from REC-rdf-syntax, demonstrating abbrevation --> - -<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:s="http://description.org/schema/"> - <rdf:Description about="http://www.w3.org/Home/Lassila"> - <s:Creator> - <rdf:Description about="http://www.w3.org/staffId/85740"> - <s:Name>Ora Lassila</s:Name> - <s:Email>lassila@w3.org</s:Email> - </rdf:Description> - </s:Creator> - </rdf:Description> -</rdf:RDF> diff --git a/packages/sgml/RDF/suite/t18.rdf b/packages/sgml/RDF/suite/t18.rdf deleted file mode 100644 index 61bde093c..000000000 --- a/packages/sgml/RDF/suite/t18.rdf +++ /dev/null @@ -1,12 +0,0 @@ -<?xml version="1.0"?> - -<!-- Example from REC-rdf-syntax, demonstrating abbrevation --> - -<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:s="http://description.org/schema/"> - <rdf:Description about="http://www.w3.org/Home/Lassila"> - <s:Creator rdf:resource="http://www.w3.org/staffId/85740" - s:Name="Ora Lassila" - s:Email="lassila@w3.org"/> - </rdf:Description> -</rdf:RDF> diff --git a/packages/sgml/RDF/suite/t19.rdf b/packages/sgml/RDF/suite/t19.rdf deleted file mode 100644 index fde4d032a..000000000 --- a/packages/sgml/RDF/suite/t19.rdf +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0"?> - -<!-- Example from REC-rdf-syntax, demonstrating abbrevation --> - -<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:s="http://description.org/schema/" - xmlns:v="http://description.org/view/"> - <rdf:Description about="http://www.w3.org/Home/Lassila"> - <s:Creator> - <rdf:Description about="http://www.w3.org/staffId/85740"> - <rdf:type resource="http://description.org/schema/Person"/> - <v:Name>Ora Lassila</v:Name> - <v:Email>lassila@w3.org</v:Email> - </rdf:Description> - </s:Creator> - </rdf:Description> -</rdf:RDF> diff --git a/packages/sgml/RDF/suite/t2.rdf b/packages/sgml/RDF/suite/t2.rdf deleted file mode 100644 index 1c079512b..000000000 --- a/packages/sgml/RDF/suite/t2.rdf +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version='1.0'?> - -<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:s="http://description.org/schema/"> - <rdf:Description about="SWI-prolog"> - <s:Creator rdf:resource="JW" sex="male" employed_at="SWI"/> - </rdf:Description> -</rdf:RDF> diff --git a/packages/sgml/RDF/suite/t20.rdf b/packages/sgml/RDF/suite/t20.rdf deleted file mode 100644 index 03109be63..000000000 --- a/packages/sgml/RDF/suite/t20.rdf +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0"?> - -<!-- Example from REC-rdf-syntax, demonstrating abbrevation --> - -<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:s="http://description.org/schema/" - xmlns:v="http://description.org/view/"> - <rdf:Description about="http://www.w3.org/Home/Lassila"> - <s:Creator> - <!-- REC-rdf-syntax just says `about' --> - <s:Person rdf:about="http://www.w3.org/staffId/85740"> - <v:Name>Ora Lassila</v:Name> - <v:Email>lassila@w3.org</v:Email> - </s:Person> - </s:Creator> - </rdf:Description> -</rdf:RDF> diff --git a/packages/sgml/RDF/suite/t21.rdf b/packages/sgml/RDF/suite/t21.rdf deleted file mode 100644 index 09abd8f67..000000000 --- a/packages/sgml/RDF/suite/t21.rdf +++ /dev/null @@ -1,19 +0,0 @@ -<?xml version="1.0"?> - -<!-- Example from REC-rdf-syntax, demonstrating abbrevation --> - -<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:s="http://description.org/schema/" - xmlns:v="http://description.org/view/"> - <rdf:Description about="http://mycollege.edu/courses/6.001"> - <s:students> - <rdf:Bag> - <rdf:li resource="http://mycollege.edu/students/Amy"/> - <rdf:li resource="http://mycollege.edu/students/Tim"/> - <rdf:li resource="http://mycollege.edu/students/John"/> - <rdf:li resource="http://mycollege.edu/students/Mary"/> - <rdf:li resource="http://mycollege.edu/students/Sue"/> - </rdf:Bag> - </s:students> - </rdf:Description> -</rdf:RDF> diff --git a/packages/sgml/RDF/suite/t22.rdf b/packages/sgml/RDF/suite/t22.rdf deleted file mode 100644 index 84ec1aa82..000000000 --- a/packages/sgml/RDF/suite/t22.rdf +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0"?> - -<!-- Example from REC-rdf-syntax, demonstrating abbrevation --> - -<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:s="http://description.org/schema/" - xmlns:v="http://description.org/view/"> - <rdf:Description about="http://x.org/packages/X11"> - <s:DistributionSite> - <rdf:Alt> - <rdf:li resource="ftp://ftp.x.org"/> - <rdf:li resource="ftp://ftp.cs.purdue.edu"/> - <rdf:li resource="ftp://ftp.eu.net"/> - </rdf:Alt> - </s:DistributionSite> - </rdf:Description> -</rdf:RDF> diff --git a/packages/sgml/RDF/suite/t23.rdf b/packages/sgml/RDF/suite/t23.rdf deleted file mode 100644 index 9d826e056..000000000 --- a/packages/sgml/RDF/suite/t23.rdf +++ /dev/null @@ -1,11 +0,0 @@ -<?xml version="1.0"?> - -<!-- Example from REC-rdf-syntax, demonstrating abbrevation --> - -<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:s="http://description.org/schema/" - xmlns:v="http://description.org/view/"> - <rdf:Description aboutEachPrefix="http://foo.org/doc"> - <s:Copyright>© 1998, The Foo Organization</s:Copyright> - </rdf:Description> -</rdf:RDF> diff --git a/packages/sgml/RDF/suite/t24.rdf b/packages/sgml/RDF/suite/t24.rdf deleted file mode 100644 index 60283abcc..000000000 --- a/packages/sgml/RDF/suite/t24.rdf +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0"?> - -<!-- Example from REC-rdf-syntax, demonstrating abbrevation --> - -<rdf:RDF - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:a="http://description.org/schema/"> - <rdf:Description> - <rdf:subject resource="http://www.w3.org/Home/Lassila" /> - <rdf:predicate resource="http://description.org/schema/Creator" /> - <rdf:object>Ora Lassila</rdf:object> - <rdf:type resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement" /> - <a:attributedTo>Ralph Swick</a:attributedTo> - </rdf:Description> -</rdf:RDF> diff --git a/packages/sgml/RDF/suite/t25.rdf b/packages/sgml/RDF/suite/t25.rdf deleted file mode 100644 index bfd1696a8..000000000 --- a/packages/sgml/RDF/suite/t25.rdf +++ /dev/null @@ -1,12 +0,0 @@ -<?xml version="1.0"?> - -<!-- Example from REC-rdf-syntax, demonstrating abbrevation --> - -<rdf:RDF - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:s="http://description.org/schema/"> - <rdf:Description about="http://www.w3.org/Home/Lassila" bagID="D_001"> - <s:Creator>Ora Lassila</s:Creator> - <s:Title>Ora's Home Page</s:Title> - </rdf:Description> -</rdf:RDF> diff --git a/packages/sgml/RDF/suite/t26.rdf b/packages/sgml/RDF/suite/t26.rdf deleted file mode 100644 index 366f69191..000000000 --- a/packages/sgml/RDF/suite/t26.rdf +++ /dev/null @@ -1,16 +0,0 @@ -<?xml version="1.0"?> - -<!-- Example from REC-rdf-syntax, demonstrating abbrevation --> - -<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> - <Seq ID="JSPapersByDate"> - <li resource="http://www.dogworld.com/Aug96.doc"/> - <li resource="http://www.webnuts.net/Jan97.html"/> - <li resource="http://www.carchat.com/Sept97.html"/> - </Seq> - <Seq ID="JSPapersBySubj"> - <li resource="http://www.carchat.com/Sept97.html"/> - <li resource="http://www.dogworld.com/Aug96.doc"/> - <li resource="http://www.webnuts.net/Jan97.html"/> - </Seq> -</RDF> diff --git a/packages/sgml/RDF/suite/t27.rdf b/packages/sgml/RDF/suite/t27.rdf deleted file mode 100644 index 0d297ffd3..000000000 --- a/packages/sgml/RDF/suite/t27.rdf +++ /dev/null @@ -1,30 +0,0 @@ -<?xml version="1.0"?> - -<!-- Example from REC-rdf-syntax, demonstrating abbrevation --> - -<rdf:RDF - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:dc="http://purl.org/metadata/dublin_core#"> - <rdf:Description about="http://www.foo.com/cool.html"> - <dc:Creator> - <rdf:Seq ID="CreatorsAlphabeticalBySurname"> - <rdf:li>Mary Andrew</rdf:li> - <rdf:li>Jacky Crystal</rdf:li> - </rdf:Seq> - </dc:Creator> - - <dc:Identifier> - <rdf:Bag ID="MirroredSites"> - <rdf:li rdf:resource="http://www.foo.com.au/cool.html"/> - <rdf:li rdf:resource="http://www.foo.com.it/cool.html"/> - </rdf:Bag> - </dc:Identifier> - - <dc:Title> - <rdf:Alt> - <rdf:li xml:lang="en">The Coolest Web Page</rdf:li> - <rdf:li xml:lang="it">Il Pagio di Web Fuba</rdf:li> - </rdf:Alt> - </dc:Title> - </rdf:Description> -</rdf:RDF> diff --git a/packages/sgml/RDF/suite/t28.rdf b/packages/sgml/RDF/suite/t28.rdf deleted file mode 100644 index 15e866dff..000000000 --- a/packages/sgml/RDF/suite/t28.rdf +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0"?> - -<!-- Example from REC-rdf-syntax, demonstrating abbrevation --> - -<RDF - xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:dc="http://purl.org/metadata/dublin_core#" - xmlns:l="http://mycorp.com/schemas/my-schema#"> - <Description about="http://www.webnuts.net/Jan97.html"> - <dc:Subject - rdf:value="020 - Library Science" - l:Classification="Dewey Decimal Code"/> - </Description> -</RDF> diff --git a/packages/sgml/RDF/suite/t29.rdf b/packages/sgml/RDF/suite/t29.rdf deleted file mode 100644 index 229c804e8..000000000 --- a/packages/sgml/RDF/suite/t29.rdf +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0"?> - -<!-- Example from REC-rdf-syntax, demonstrating abbrevation --> - -<RDF - xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:n="http://www.nist.gov/units/"> - <Description about="John_Smith"> - <n:weight rdf:parseType="Resource"> - <rdf:value>200</rdf:value> - <n:units rdf:resource="http://www.nist.gov/units/Pounds"/> - </n:weight> - </Description> -</RDF> diff --git a/packages/sgml/RDF/suite/t3.rdf b/packages/sgml/RDF/suite/t3.rdf deleted file mode 100644 index d61cdde38..000000000 --- a/packages/sgml/RDF/suite/t3.rdf +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version='1.0'?> - -<!-- Test inline description --> - -<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:s="http://description.org/schema/"> - <rdf:Description about="http://www.swi.psy.uva.nl/projects/SWI-Prolog/"> - <s:Creator> - <rdf:Description ID="JW"> - <name>Jan Wielemaker</name> - <works_at>SWI</works_at> - </rdf:Description> - </s:Creator> - </rdf:Description> -</rdf:RDF> diff --git a/packages/sgml/RDF/suite/t30.rdf b/packages/sgml/RDF/suite/t30.rdf deleted file mode 100644 index 2540d9f6a..000000000 --- a/packages/sgml/RDF/suite/t30.rdf +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0"?> - -<!-- Example from REC-rdf-syntax, demonstrating abbrevation --> - -<rdf:RDF - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:dc="http://purl.org/metadata/dublin_core#"> - <rdf:Description about="http://www.dlib.org"> - <dc:Title>D-Lib Program - Research in Digital Libraries</dc:Title> - <dc:Description>The D-Lib program supports the community of people - with research interests in digital libraries and electronic - publishing.</dc:Description> - <dc:Publisher>Corporation For National Research Initiatives</dc:Publisher> - <dc:Date>1995-01-07</dc:Date> - <dc:Subject> - <rdf:Bag> - <rdf:li>Research; statistical methods</rdf:li> - <rdf:li>Education, research, related topics</rdf:li> - <rdf:li>Library use Studies</rdf:li> - </rdf:Bag> - </dc:Subject> - <dc:Type>World Wide Web Home Page</dc:Type> - <dc:Format>text/html</dc:Format> - <dc:Language>en</dc:Language> - </rdf:Description> -</rdf:RDF> diff --git a/packages/sgml/RDF/suite/t31.rdf b/packages/sgml/RDF/suite/t31.rdf deleted file mode 100644 index 69eed39ed..000000000 --- a/packages/sgml/RDF/suite/t31.rdf +++ /dev/null @@ -1,36 +0,0 @@ -<?xml version="1.0"?> - -<!-- Example from REC-rdf-syntax, demonstrating abbrevation --> - -<rdf:RDF - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:dc="http://purl.org/metadata/dublin_core#" - xmlns:dcq="http://purl.org/metadata/dublin_core_qualifiers#"> - <rdf:Description about="http://www.dlib.org/dlib/may98/05contents.html"> - <dc:Title>DLIB Magazine - The Magazine for Digital Library Research - - May 1998</dc:Title> - <dc:Description>D-LIB magazine is a monthly compilation of - contributed stories, commentary, and briefings.</dc:Description> - <dc:Contributor rdf:parseType="Resource"> - <dcq:AgentType - rdf:resource="http://purl.org/metadata/dublin_core_qualifiers#Editor"/> - <rdf:value>Amy Friedlander</rdf:value> - </dc:Contributor> - <dc:Publisher>Corporation for National Research Initiatives</dc:Publisher> - <dc:Date>1998-01-05</dc:Date> - <dc:Type>electronic journal</dc:Type> - <dc:Subject> - <rdf:Bag> - <rdf:li>library use studies</rdf:li> - <rdf:li>magazines and newspapers</rdf:li> - </rdf:Bag> - </dc:Subject> - <dc:Format>text/html</dc:Format> - <dc:Identifier>urn:issn:1082-9873</dc:Identifier> - <dc:Relation rdf:parseType="Resource"> - <dcq:RelationType - rdf:resource="http://purl.org/metadata/dublin_core_qualifiers#IsPartOf"/> - <rdf:value resource="http://www.dlib.org"/> - </dc:Relation> - </rdf:Description> -</rdf:RDF> diff --git a/packages/sgml/RDF/suite/t32.rdf b/packages/sgml/RDF/suite/t32.rdf deleted file mode 100644 index 47b4aa432..000000000 --- a/packages/sgml/RDF/suite/t32.rdf +++ /dev/null @@ -1,43 +0,0 @@ -<?xml version="1.0"?> - -<!-- Example from REC-rdf-syntax, demonstrating abbrevation --> - -<rdf:RDF - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:dc="http://purl.org/metadata/dublin_core#" - xmlns:dcq="http://purl.org/metadata/dublin_core_qualifiers#"> - <rdf:Description about= - "http://www.dlib.org/dlib/may98/miller/05miller.html"> - <dc:Title>An Introduction to the Resource Description Framework</dc:Title> - <dc:Creator>Eric J. Miller</dc:Creator> - <dc:Description>The Resource Description Framework (RDF) is an - infrastructure that enables the encoding, exchange and reuse of - structured metadata. rdf is an application of xml that imposes needed - structural constraints to provide unambiguous methods of expressing - semantics. rdf additionally provides a means for publishing both - human-readable and machine-processable vocabularies designed to - encourage the reuse and extension of metadata semantics among - disparate information communities. the structural constraints rdf - imposes to support the consistent encoding and exchange of - standardized metadata provides for the interchangeability of separate - packages of metadata defined by different resource description - communities. </dc:Description> - <dc:Publisher>Corporation for National Research Initiatives</dc:Publisher> - <dc:Subject> - <rdf:Bag> - <rdf:li>machine-readable catalog record formats</rdf:li> - <rdf:li>applications of computer file organization and - access methods</rdf:li> - </rdf:Bag> - </dc:Subject> - <dc:Rights>Copyright @ 1998 Eric Miller</dc:Rights> - <dc:Type>Electronic Document</dc:Type> - <dc:Format>text/html</dc:Format> - <dc:Language>en</dc:Language> - <dc:Relation rdf:parseType="Resource"> - <dcq:RelationType - rdf:resource="http://purl.org/metadata/dublin_core_qualifiers#IsPartOf"/> - <rdf:value resource="http://www.dlib.org/dlib/may98/05contents.html"/> - </dc:Relation> - </rdf:Description> -</rdf:RDF> diff --git a/packages/sgml/RDF/suite/t33.rdf b/packages/sgml/RDF/suite/t33.rdf deleted file mode 100644 index 1154b4ae0..000000000 --- a/packages/sgml/RDF/suite/t33.rdf +++ /dev/null @@ -1,18 +0,0 @@ -<?xml version="1.0"?> - -<!-- Example from REC-rdf-syntax, demonstrating literal value --> - -<rdf:RDF - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> - <rdf:Description - xmlns:dc="http://purl.org/metadata/dublin_core#" - xmlns="http://www.w3.org/TR/REC-mathml" - rdf:about="http://mycorp.com/papers/NobelPaper1"> - - <dc:Title rdf:parseType="Literal"> -Ramifications of <apply><power/><apply><plus/><ci>a</ci><ci>b</ci></apply> -<cn>2</cn></apply> to World Peace - </dc:Title> - <dc:Creator>David Hume</dc:Creator> - </rdf:Description> -</rdf:RDF> diff --git a/packages/sgml/RDF/suite/t34.rdf b/packages/sgml/RDF/suite/t34.rdf deleted file mode 100644 index 9919885a8..000000000 --- a/packages/sgml/RDF/suite/t34.rdf +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0"?> - -<!-- Example from REC-rdf-syntax, demonstrating literal value --> - -<rdf:RDF - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:pics="http://www.w3.org/TR/xxxx/WD-PICS-labels#" - xmlns:gcf="http://www.gcf.org/v2.5"> - <rdf:Description about="http://www.w3.org/PICS/Overview.html" bagID="L01" - gcf:suds="0.5" - gcf:density="0" - gcf:color.hue="1"/> - - <rdf:Description about="http://www.w3.org/PICS/Underview.html" bagID="L02" - gcf:subject="2" - gcf:density="1" - gcf:color.hue="1"/> - - <rdf:Description aboutEach="#L01" - pics:by="John Doe" - pics:on="1994.11.05T08:15-0500" - pics:until="1995.12.31T23:59-0000"/> - - <rdf:Description aboutEach="#L02" - pics:by="Jane Doe" - pics:on="1994.11.05T08:15-0500" - pics:until="1995.12.31T23:59-0000"/> -</rdf:RDF> diff --git a/packages/sgml/RDF/suite/t35.rdf b/packages/sgml/RDF/suite/t35.rdf deleted file mode 100644 index 70a55743a..000000000 --- a/packages/sgml/RDF/suite/t35.rdf +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0"?> - -<!-- Example from REC-rdf-syntax, demonstrating literal value --> - -<rdf:RDF - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:pics="http://www.w3.org/TR/xxxx/WD-PICS-labels#" - xmlns:ages="http://www.ages.org/our-service/v1.0/"> - <rdf:Description aboutEachPrefix="http://www.w3.org/WWW/" bagID="L03" - ages:age="11"/> - - <rdf:Description aboutEach="#L03" - pics:by="abaird@w3.org"/> -</rdf:RDF> - diff --git a/packages/sgml/RDF/suite/t36.rdf b/packages/sgml/RDF/suite/t36.rdf deleted file mode 100644 index af677d04e..000000000 --- a/packages/sgml/RDF/suite/t36.rdf +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0"?> - -<!-- Example from REC-rdf-syntax, demonstrating literal value --> - -<rdf:RDF - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:dc="http://purl.org/metadata/dublin_core#"> - <rdf:Description about="http://www.foo.com/cool.html"> - <dc:Creator> - <rdf:Seq ID="CreatorsAlphabeticalBySurname" - rdf:_1="Mary Andrew" - rdf:_2="Jacky Crystal"/> - </dc:Creator> - </rdf:Description> -</rdf:RDF> diff --git a/packages/sgml/RDF/suite/t37.rdf b/packages/sgml/RDF/suite/t37.rdf deleted file mode 100644 index d8484601f..000000000 --- a/packages/sgml/RDF/suite/t37.rdf +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version='1.0'?> - -<!-- Test inline description --> - -<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:s="http://description.org/schema/"> - <rdf:Description about="http://www.swi.psy.uva.nl/projects/SWI-Prolog/"> - <s:Creator rdf:ID="pl-creator"> - <rdf:Description rdf:about="JW"> - <name>Jan Wielemaker</name> - <works_at>SWI</works_at> - </rdf:Description> - </s:Creator> - </rdf:Description> -</rdf:RDF> diff --git a/packages/sgml/RDF/suite/t38.rdf b/packages/sgml/RDF/suite/t38.rdf deleted file mode 100644 index fa7126490..000000000 --- a/packages/sgml/RDF/suite/t38.rdf +++ /dev/null @@ -1,190 +0,0 @@ -<?xml version="1.0" encoding="iso-8859-1"?> - -<!-- Definition of RDF-schema in itself --> -<!-- From http://www.w3.org/TR/rdf-schema/ --> - -<rdf:RDF - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"> - -<rdfs:Class rdf:ID="Resource"> - <rdfs:label xml:lang="en">Resource</rdfs:label> - <rdfs:label xml:lang="fr">Ressource</rdfs:label> - <rdfs:comment>The most general class</rdfs:comment> -</rdfs:Class> - -<rdf:Property about="http://www.w3.org/1999/02/22-rdf-syntax-ns#type"> - <rdfs:label xml:lang="en">type</rdfs:label> - <rdfs:label xml:lang="fr">type</rdfs:label> - <rdfs:comment>Indicates membership of a class</rdfs:comment> - <rdfs:range rdf:resource="#Class"/> -</rdf:Property> - -<rdf:Property ID="comment"> - <rdfs:label xml:lang="en">comment</rdfs:label> - <rdfs:label xml:lang="fr">commentaire</rdfs:label> - <rdfs:domain rdf:resource="#Resource"/> - <rdfs:comment>Use this for descriptions</rdfs:comment> - <rdfs:range rdf:resource="#Literal"/> -</rdf:Property> - -<rdf:Property ID="label"> - <rdf:type resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Property"/> - <rdfs:label xml:lang="en">label</rdfs:label> - <rdfs:label xml:lang="fr">label</rdfs:label> - <rdfs:domain rdf:resource="#Resource"/> - <rdfs:comment>Provides a human-readable version of a resource name.</rdfs:comment> - <rdfs:range rdf:resource="#Literal"/> -</rdf:Property> - -<rdfs:Class rdf:ID="Class"> - <rdfs:label xml:lang="en">Class</rdfs:label> - <rdfs:label xml:lang="fr">Classe</rdfs:label> - <rdfs:comment>The concept of Class</rdfs:comment> - <rdfs:subClassOf rdf:resource="#Resource"/> -</rdfs:Class> - -<rdf:Property ID="subClassOf"> - <rdfs:label xml:lang="en">subClassOf</rdfs:label> - <rdfs:label xml:lang="fr">sousClasseDe</rdfs:label> - <rdfs:comment>Indicates membership of a class</rdfs:comment> - <rdfs:range rdf:resource="#Class"/> - <rdfs:domain rdf:resource="#Class"/> -</rdf:Property> - -<rdf:Property ID="subPropertyOf"> - <rdfs:label xml:lang="en">subPropertyOf</rdfs:label> - <rdfs:label xml:lang="fr">sousPropriétéDe</rdfs:label> - <rdfs:comment>Indicates specialization of properties</rdfs:comment> - <rdfs:range rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Property"/> - <rdfs:domain rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Property"/> -</rdf:Property> - -<rdf:Property ID="seeAlso"> - <rdfs:label xml:lang="en">seeAlso</rdfs:label> - <rdfs:label xml:lang="fr">voirAussi</rdfs:label> - <rdfs:comment>Indicates a resource that provides information about the subject resource.</rdfs:comment> - <rdfs:range rdf:resource="http://www.w3.org/2000/01/rdf-schema#Resource"/> - <rdfs:domain rdf:resource="http://www.w3.org/2000/01/rdf-schema#Resource"/> -</rdf:Property> - -<rdf:Property ID="isDefinedBy"> - <rdf:type resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Property"/> - <rdfs:subPropertyOf rdf:resource="#seeAlso"/> - <rdfs:label xml:lang="en">isDefinedBy</rdfs:label> - <rdfs:label xml:lang="fr">esDéfiniPar</rdfs:label> - <rdfs:comment>Indicates a resource containing and defining the subject resource.</rdfs:comment> - <rdfs:range rdf:resource="http://www.w3.org/2000/01/rdf-schema#Resource"/> - <rdfs:domain rdf:resource="http://www.w3.org/2000/01/rdf-schema#Resource"/> -</rdf:Property> - -<rdfs:Class rdf:ID="ConstraintResource"> - <rdfs:label xml:lang="en">ConstraintResource</rdfs:label> - <rdfs:label xml:lang="fr">RessourceContrainte</rdfs:label> - <rdf:type resource="#Class"/> - <rdfs:subClassOf rdf:resource="#Resource"/> - <rdfs:comment>Resources used to express RDF Schema constraints.</rdfs:comment> -</rdfs:Class> - -<rdfs:Class rdf:ID="ConstraintProperty"> - <rdfs:label xml:lang="en">ConstraintProperty</rdfs:label> - <rdfs:label xml:lang="fr">PropriétéContrainte</rdfs:label> - <rdfs:subClassOf rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Property"/> - <rdfs:subClassOf rdf:resource="#ConstraintResource"/> - <rdfs:comment>Properties used to express RDF Schema constraints.</rdfs:comment> -</rdfs:Class> - -<rdfs:ConstraintProperty rdf:ID="domain"> - <rdfs:label xml:lang="en">domain</rdfs:label> - <rdfs:label xml:lang="fr">domaine</rdfs:label> - <rdfs:comment>This is how we associate a class with - properties that its instances can have</rdfs:comment> -</rdfs:ConstraintProperty> - -<rdfs:ConstraintProperty rdf:ID="range"> - <rdfs:label xml:lang="en">range</rdfs:label> - <rdfs:label xml:lang="fr">étendue</rdfs:label> - <rdfs:comment>Properties that can be used in a - schema to provide constraints</rdfs:comment> - <rdfs:range rdf:resource="#Class"/> - <rdfs:domain rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Property"/> -</rdfs:ConstraintProperty> - -<rdfs:Class rdf:about="http://www.w3.org/1999/02/22-rdf-syntax-ns#Property"> - <rdfs:label xml:lang="en">Property</rdfs:label> - <rdfs:label xml:lang="fr">Propriété</rdfs:label> - <rdfs:comment>The concept of a property.</rdfs:comment> - <rdfs:subClassOf rdf:resource="#Resource"/> -</rdfs:Class> - -<rdfs:Class rdf:ID="Literal"> - <rdfs:label xml:lang="en">Literal</rdfs:label> - <rdfs:label xml:lang="fr">Littéral</rdfs:label> - <rdf:type resource="#Class"/> - <rdfs:comment>This represents the set of atomic values, eg. textual strings.</rdfs:comment> -</rdfs:Class> - -<rdfs:Class rdf:about="http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement"> - <rdfs:label xml:lang="en">Statement</rdfs:label> - <rdfs:label xml:lang="fr">Déclaration</rdfs:label> - <rdfs:subClassOf rdf:resource="#Resource"/> - <rdfs:comment>This represents the set of reified statements.</rdfs:comment> -</rdfs:Class> - -<rdf:Property about="http://www.w3.org/1999/02/22-rdf-syntax-ns#subject"> - <rdfs:label xml:lang="en">subject</rdfs:label> - <rdfs:label xml:lang="fr">sujet</rdfs:label> - <rdfs:domain rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement"/> - <rdfs:range rdf:resource="#Resource"/> -</rdf:Property> - -<rdf:Property about="http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate"> - <rdfs:label xml:lang="en">predicate</rdfs:label> - <rdfs:label xml:lang="fr">prédicat</rdfs:label> - <rdf:type resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Property"/> - <rdfs:domain rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement"/> - <rdfs:range rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Property"/> -</rdf:Property> - -<rdf:Property about="http://www.w3.org/1999/02/22-rdf-syntax-ns#object"> - <rdfs:label xml:lang="en">object</rdfs:label> - <rdfs:label xml:lang="fr">objet</rdfs:label> - <rdfs:domain rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement"/> -</rdf:Property> - -<rdfs:Class rdf:ID="Container"> - <rdfs:label xml:lang="en">Container</rdfs:label> - <rdfs:label xml:lang="fr">Enveloppe</rdfs:label> - <rdfs:subClassOf rdf:resource="#Resource"/> - <rdfs:comment>This represents the set Containers.</rdfs:comment> -</rdfs:Class> - -<rdfs:Class rdf:about="http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag"> - <rdfs:label xml:lang="en">Bag</rdfs:label> - <rdfs:label xml:lang="fr">Ensemble</rdfs:label> - <rdfs:subClassOf rdf:resource="#Container"/> -</rdfs:Class> - -<rdfs:Class rdf:about="http://www.w3.org/1999/02/22-rdf-syntax-ns#Seq"> - <rdfs:label xml:lang="en">Sequence</rdfs:label> - <rdfs:label xml:lang="fr">Séquence</rdfs:label> - <rdfs:subClassOf rdf:resource="#Container"/> -</rdfs:Class> - -<rdfs:Class rdf:about="http://www.w3.org/1999/02/22-rdf-syntax-ns#Alt"> - <rdfs:label xml:lang="en">Alt</rdfs:label> - <rdfs:label xml:lang="fr">Choix</rdfs:label> - <rdfs:subClassOf rdf:resource="#Container"/> -</rdfs:Class> - -<rdfs:Class rdf:ID="ContainerMembershipProperty"> - <rdfs:label xml:lang="en">ContainerMembershipProperty</rdfs:label> - <rdfs:subClassOf rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Property"/> -</rdfs:Class> - -<rdf:Property rdf:about="http://www.w3.org/1999/02/22-rdf-syntax-ns#value"> - <rdfs:label xml:lang="en">object</rdfs:label> - <rdfs:label xml:lang="fr">value</rdfs:label> -</rdf:Property> - -</rdf:RDF> diff --git a/packages/sgml/RDF/suite/t39.rdf b/packages/sgml/RDF/suite/t39.rdf deleted file mode 100644 index 516e65f49..000000000 --- a/packages/sgml/RDF/suite/t39.rdf +++ /dev/null @@ -1,25 +0,0 @@ -<?xml version='1.0' encoding='ISO-8859-1'?> -<!-- Version Wed Apr 12 12:09:19 CEST 2000 --> -<rdf:RDF - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:rdfs="http://www.w3.org/TR/1999/PR-rdf-schema-19990303#" - xmlns:rdfutil="http://www.w3.org/rdfutil#" - xmlns:protege="http://smi-web.stanford.edu/projects/protege/protege-rdf/protege-19992012#"> - - <rdf:Description rdf:ID="OntologyObjectMetaClass"> - <rdf:type rdf:resource="http://www.w3.org/TR/1999/PR-rdf-schema-19990303#Class"/> - <rdfs:subClassOf rdf:resource="http://www.w3.org/TR/1999/PR-rdf-schema-19990303#Class"/> - <protege:abstractProperty>concrete</protege:abstractProperty> - </rdf:Description> - - <rdf:Description rdf:ID="identifier"> - <rdf:type rdf:resource="http://www.w3.org/TR/1999/PR-rdf-schema-19990303#Property"/> - <rdfutil:facets> - <rdfutil:facetResource> - <rdfutil:domain rdf:resource="#OntologyObjectMetaClass"/> - <rdfutil:range rdf:resource="http://www.w3.org/TR/xmlschema-2/#string"/> - <rdfutil:cardinality>1</rdfutil:cardinality> - </rdfutil:facetResource> - </rdfutil:facets> - </rdf:Description> -</rdf:RDF> diff --git a/packages/sgml/RDF/suite/t4.rdf b/packages/sgml/RDF/suite/t4.rdf deleted file mode 100644 index f721024cd..000000000 --- a/packages/sgml/RDF/suite/t4.rdf +++ /dev/null @@ -1,14 +0,0 @@ -<?xml version='1.0'?> - -<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:s="http://description.org/schema/"> - <rdf:Description about="http://www.w3.org/Home/Lassila"> - <s:Creator rdf:ID="statement1">Ora Lassila</s:Creator> - </rdf:Description> - -<!-- The statement saying that i believe the above statement --> - - <rdf:Description about="#statement1"> - <s:believedBy>Stefan Decker</s:believedBy> - </rdf:Description> -</rdf:RDF> diff --git a/packages/sgml/RDF/suite/t40.rdf b/packages/sgml/RDF/suite/t40.rdf deleted file mode 100644 index 38c7aff0d..000000000 --- a/packages/sgml/RDF/suite/t40.rdf +++ /dev/null @@ -1,11 +0,0 @@ -<?xml version='1.0'?> - -<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:my="http://www.mytypes.org/schema/"> - <my:Bicycle wheels="2"/> - - <rdf:Description type="http://www.mytypes.org/schema/Bicycle"> - <my:wheels>2</my:wheels> - </rdf:Description> - -</rdf:RDF> diff --git a/packages/sgml/RDF/suite/t41.rdf b/packages/sgml/RDF/suite/t41.rdf deleted file mode 100644 index 9c072a883..000000000 --- a/packages/sgml/RDF/suite/t41.rdf +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0"?> - -<!-- Example from REC-rdf-syntax, demonstrating abbrevation --> - -<RDF - xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:n="http://www.nist.gov/units/"> - <Description about="John_Smith"> - <n:weight rdf:ID="JohnWeight" rdf:parseType="Resource"> - <rdf:value>200</rdf:value> - <n:units rdf:resource="http://www.nist.gov/units/Pounds"/> - </n:weight> - </Description> -</RDF> diff --git a/packages/sgml/RDF/suite/t42.rdf b/packages/sgml/RDF/suite/t42.rdf deleted file mode 100644 index cb08c584d..000000000 --- a/packages/sgml/RDF/suite/t42.rdf +++ /dev/null @@ -1,16 +0,0 @@ -<?xml version="1.0"?> - -<!-- Test space handling for mixed literal/compound --> - -<rdf:RDF - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> - <rdf:Description about="John_Smith"> - <a1>John</a1> - <a1> - <rdf:Description> - <v>200</v> - <t>pounds</t> - </rdf:Description> - </a1> - </rdf:Description> -</rdf:RDF> diff --git a/packages/sgml/RDF/suite/t5.rdf b/packages/sgml/RDF/suite/t5.rdf deleted file mode 100644 index a56717b7b..000000000 --- a/packages/sgml/RDF/suite/t5.rdf +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version='1.0'?> - -<!-- Test inline description --> - -<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:s="http://description.org/schema/"> - <rdf:Description about="http://www.swi.psy.uva.nl/projects/SWI-Prolog/"> - <s:Creator rdf:ID="JW"> - <rdf:Description> - <name>Jan Wielemaker</name> - <works_at>SWI</works_at> - </rdf:Description> - </s:Creator> - </rdf:Description> -</rdf:RDF> diff --git a/packages/sgml/RDF/suite/t6.rdf b/packages/sgml/RDF/suite/t6.rdf deleted file mode 100644 index 61193ca24..000000000 --- a/packages/sgml/RDF/suite/t6.rdf +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version='1.0'?> - -<!-- Test attribute-bag --> - -<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:s="http://description.org/schema/"> - <rdf:Description about="http://www.swi.psy.uva.nl/projects/xpce/"> - <s:Creator> - <rdf:Bag> - <rdf:li>Jan Wielemaker</rdf:li> - <rdf:li>Anjo Anjewierden</rdf:li> - </rdf:Bag> - </s:Creator> - </rdf:Description> -</rdf:RDF> diff --git a/packages/sgml/RDF/suite/t7.rdf b/packages/sgml/RDF/suite/t7.rdf deleted file mode 100644 index 55f35ec38..000000000 --- a/packages/sgml/RDF/suite/t7.rdf +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version='1.0'?> - -<!-- Test attribute-bag --> - -<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:s="http://description.org/schema/"> - <rdf:Description about="http://www.swi.psy.uva.nl/projects/xpce/"> - <s:Creator> - <rdf:Bag> - <rdf:li parseType="Resource"> - <name>Jan Wielemaker</name> - <employed_at>SWI</employed_at> - </rdf:li> - </rdf:Bag> - </s:Creator> - </rdf:Description> -</rdf:RDF> diff --git a/packages/sgml/RDF/suite/t8.rdf b/packages/sgml/RDF/suite/t8.rdf deleted file mode 100644 index bc79b4579..000000000 --- a/packages/sgml/RDF/suite/t8.rdf +++ /dev/null @@ -1,16 +0,0 @@ -<?xml version="1.0"?> - -<!-- Copied from Pro Solutions RDF parser examples --> - -<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:NIST="http://www.nist.gov/RDFschema/"> - <Description about="John_Smith"> - <NIST:Weight> - <Description ID="weight_001"> - <NIST:Units rdf:resource="http://www.nist.gov/units/pounds"/> - <value xmlns="">200</value> - </Description> - </NIST:Weight> - </Description> -</RDF> diff --git a/packages/sgml/RDF/suite/t9.rdf b/packages/sgml/RDF/suite/t9.rdf deleted file mode 100644 index de0441974..000000000 --- a/packages/sgml/RDF/suite/t9.rdf +++ /dev/null @@ -1,12 +0,0 @@ -<?xml version="1.0"?> -<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:DC="http://purl.org/metadata/dublin_core/" - xmlns:DS="http://www.w3.org/Schemas/DS-Schema/"> - <Description about="http://www.bar.com/some.doc" bagID="Statement_001"> - <DC:Creator>John Smith</DC:Creator> - </Description> - <Description aboutEach="#Statement_001"> - <DS:CreatedOn>1998-02-06T14:00Z</DS:CreatedOn> - <DS:CreatedBy>Jane Cooper</DS:CreatedBy> - </Description> -</RDF> diff --git a/packages/sgml/RDF/suite/types.rdf b/packages/sgml/RDF/suite/types.rdf deleted file mode 100644 index 992e9cfb4..000000000 --- a/packages/sgml/RDF/suite/types.rdf +++ /dev/null @@ -1,22 +0,0 @@ -<rdf:RDF - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" - xmlns:owl="http://www.w3.org/2002/07/owl#" - xmlns:first="http://www.w3.org/2002/03owlt/I5.8/inconsistent001#" - xml:base="http://www.w3.org/2002/03owlt/I5.8/inconsistent001" > - <rdf:Description rdf:ID="john"> - <rdf:type> - <owl:Restriction> - <owl:onProperty> - <owl:DatatypeProperty rdf:ID="p"> - <rdfs:range rdf:resource= - "http://www.w3.org/2001/XMLSchema#byte" /> - </owl:DatatypeProperty> - </owl:onProperty> - <owl:cardinality - rdf:datatype="http://www.w3.org/2001/XMLSchema#nonNegativeInteger">257</owl:cardinality> - </owl:Restriction> - </rdf:type> - </rdf:Description> - -</rdf:RDF> diff --git a/packages/sgml/RDF/suite/xmllit.rdf b/packages/sgml/RDF/suite/xmllit.rdf deleted file mode 100644 index 7a0220847..000000000 --- a/packages/sgml/RDF/suite/xmllit.rdf +++ /dev/null @@ -1,19 +0,0 @@ -<?xml version="1.0" encoding="iso-8859-1"?> - -<!DOCTYPE rdf [ - <!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#"> - <!ENTITY xsd "http://www.w3.org/2000/10/XMLSchema#"> - <!ENTITY t "http://www.swi.psy.uva.nl/test#"> -]> - -<rdf:RDF - xmlns:rdf ="&rdf;" - xmlns:xsd ="&xsd;" - xmlns:t="&t;" -> - -<t:test rdf:ID="id1"> - <t:a rdf:parseType="Literal"><b>strong</b></t:a> -</t:test> - -</rdf:RDF> diff --git a/packages/sgml/RDF/suite/xsdtypes.rdf b/packages/sgml/RDF/suite/xsdtypes.rdf deleted file mode 100644 index 9bfbb85c1..000000000 --- a/packages/sgml/RDF/suite/xsdtypes.rdf +++ /dev/null @@ -1,19 +0,0 @@ -<?xml version="1.0" encoding="iso-8859-1"?> - -<!DOCTYPE rdf [ - <!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#"> - <!ENTITY xsd "http://www.w3.org/2000/10/XMLSchema#"> - <!ENTITY t "http://www.swi.psy.uva.nl/test#"> -]> - -<rdf:RDF - xmlns:rdf ="&rdf;" - xmlns:xsd ="&xsd;" - xmlns:t="&t;" -> - -<t:test rdf:ID="id1"> - <t:int rdf:datatype="&xsd;int">42</t:int> -</t:test> - -</rdf:RDF> diff --git a/packages/sgml/RDF/w3c_test.pl b/packages/sgml/RDF/w3c_test.pl deleted file mode 100644 index 3d27759e7..000000000 --- a/packages/sgml/RDF/w3c_test.pl +++ /dev/null @@ -1,467 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog SGML/XML parser - - Author: Jan Wielemaker - E-mail: jan@swi.psy.uva.nl - WWW: http://www.swi.psy.uva.nl/projects/SWI-Prolog/ - Copying: LGPL-2. See the file COPYING or http://www.gnu.org - - Copyright (C) 1990-2002 SWI, University of Amsterdam. All rights reserved. -*/ - -:- module(rdf_w3c_test, - [ process_manifest/0, - process_manifest/1, - run_tests/0, % run all tests - run/0, % run selected test - show/1, % RDF diagram for File - run_test/1 % run a single test - ]). - - % get libraries locally -:- asserta(user:file_search_path(library, '.')). - -:- use_module(rdf). % our RDF parser -:- use_module(rdf_ntriples). % read .nt files -:- load_files([ library(pce), - library(toolbar), - library(pce_report), - rdf_diagram, - library('emacs/emacs') - ], - [ silent(true) - ]). - -:- dynamic - verbose/0. -%verbose. - -set_verbose :- - verbose, !. -set_verbose :- - assert(verbose). - -:- dynamic - rdf/3. - -ns(test, - 'http://www.w3.org/2000/10/rdf-tests/rdfcore/testSchema#'). - -local('http://www.w3.org/2000/10/rdf-tests/rdfcore/', - 'W3Ctests/'). - -process_manifest :- - process_manifest('W3Ctests/Manifest.rdf'). -process_manifest(Manifest) :- - retractall(rdf(_,_,_)), - load_rdf(Manifest, Triples), - assert_triples(Triples). - -assert_triples([]). -assert_triples([rdf(S, P, O)|T]) :- - canonise(S, Subject), - canonise(P, Predicate), - canonise(O, Object), - assert(rdf(Subject, Predicate, Object)), - assert_triples(T). - -canonise(NS:Name, N:Name) :- - ns(N, NS), !. -canonise(Absolute, N:Name) :- - atom(Absolute), - ns(N, NS), - atom_concat(NS, Name, Absolute), !. -canonise(X, X). - - -run_tests :- - process_manifest, - start_tests, - ( rdf(About, rdf:type, test:Type), - \+ rdf(About, test:status, literal('OBSOLETE')), - test_type(Type), -% once(run_test(About)), % Should not be needed - run_test(About), - fail - ; true - ), !, - report_results. - -test_type('PositiveParserTest'). -%test_type('NegativeParserTest'). - -run_test(Test) :- - rdf(Test, test:inputDocument, In), - local_file(In, InFile), - exists_file(InFile), - ( load_rdf(InFile, RDF, - [ base_uri(In), - expand_foreach(true) - ]) - -> true - ; RDF = [] - ), - Data = [ source(InFile), - result(RDF), - norm(NT), - substitutions(Substitions) - ], - % there may be alternative output - % documents - ( rdf(Test, test:outputDocument, Out), - local_file(Out, NTFile), - load_rdf_ntriples(NTFile, NT), - feedback('Comparing to ~w~n', [NTFile]), - compare_triples(RDF, NT, Substitions) - -> test_result(pass, Test, Data) - % if all fails, display the first - ; rdf(Test, test:outputDocument, Out), - local_file(Out, NTFile), - load_rdf_ntriples(NTFile, NT), - Substitions = [], - test_result(fail, Test, Data) - ). - - -local_file(URL, File) :- - local(URLPrefix, FilePrefix), - atom_concat(URLPrefix, Base, URL), !, - atom_concat(FilePrefix, Base, File). - - - /******************************* - * GUI * - *******************************/ - -:- pce_begin_class(w3c_rdf_test_gui, frame). - -initialise(F, Show:chain) :-> - send_super(F, initialise, 'W3C RDF test suite results'), - send(F, append, new(B, browser)), - send(B, hor_stretch, 100), - send(B, hor_shrink, 100), - ( send(Show, member, source) - -> new(V, emacs_view(height := 3)), - send(V, name, text) - ; true - ), - ( send(Show, member, result) - -> new(R, rdf_diagram), - send(R, name, result), - send(R, label, 'Result') - ; true - ), - ( send(Show, member, norm) - -> new(N, rdf_diagram), - send(N, name, norm), - send(N, label, 'Norm') - ; true - ), - stack_windows([V,R,N], _, W), - ( nonvar(W) - -> send(W, right, B) - ; true - ), - send(new(D, tool_dialog(F)), above, B), - send(new(report_dialog), below, B), - send(F, fill_menu, D), - send(F, fill_browser, B). - -stack_windows([], L, L). -stack_windows([H|T], W0, W) :- - var(H), !, - stack_windows(T, W0, W). -stack_windows([H|T], W0, W) :- - var(W0), !, - stack_windows(T, H, W). -stack_windows([H|T], WL, W) :- - send(H, below, WL), - stack_windows(T, H, W). - -fill_menu(F, D:tool_dialog) :-> - send_list(D, - [ append(menu_item(exit, message(F, destroy)), - file) - ]). - -fill_browser(_F, B:browser) :-> - send(B, style, pass, style(colour := dark_green)), - send(B, style, fail, style(colour := red)), - send(B?image, recogniser, - handler(ms_right_down, - and(message(B, selection, - ?(B, dict_item, @event)), - new(or)))), - send(B, popup, new(P, popup)), - send(B, select_message, message(@arg1, run)), - send_list(P, append, - [ menu_item(run, - message(@arg1, run)), - menu_item(edit, - message(@arg1, edit_test)), - gap, - menu_item(show_result, - message(@arg1, show_triples, result)), - menu_item(show_norm, - message(@arg1, show_triples, norm)), - gap, - menu_item(discussion, - message(@arg1, open_url, discussion), - condition := - message(@arg1, has_url, discussion)), - menu_item(approval, - message(@arg1, open_url, approval), - condition := - message(@arg1, has_url, approval)), - gap, - menu_item(copy_test_uri, - message(@arg1, copy_test_uri)) - ]). - - -test_result(F, Result:{pass,fail}, Test:name, Data:prolog) :-> - "Test failed":: - get(F, member, browser, B), - ( get(B, member, Test, Item) - -> send(Item, object, prolog(Data)), - send(Item, style, Result) - ; send(B, append, - rdf_test_item(Test, @default, prolog(Data), Result)) - ). - -clear(F) :-> - get(F, member, browser, B), - send(B, clear). - -summarise(F) :-> - get(F, member, browser, Browser), - new(Pass, number(0)), - new(Fail, number(0)), - send(Browser?members, for_all, - if(@arg1?style == pass, - message(Pass, plus, 1), - message(Fail, plus, 1))), - send(F, report, status, '%d tests succeeded; %d failed', - Pass, Fail). - -:- pce_end_class(w3c_rdf_test_gui). - -:- pce_begin_class(rdf_test_item, dict_item). - - -edit_test(Item) :-> - "Edit input document of test":: - get(Item, object, List), - member(source(InFile), List), - edit(file(InFile)). - -show_triples(Item, Set:{result,norm}) :-> - "Show result of our parser":: - get(Item, key, Test), - get(Item, object, List), - Term =.. [Set,Triples], - member(Term, List), - send(Item, show_diagram(Triples, - string('%s for %s', Set?label_name, Test))). - -show_diagram(_Item, Triples:prolog, Label:name) :-> - "Show diagram for triples":: - new(D, rdf_diagram(Label)), - send(new(report_dialog), below, D), - send(D, triples, Triples), - send(D, open). - -open_url(Item, Which:name) :-> - "Open associated URL in browser":: - get(Item, key, Test), - rdf(Test, test:Which, URL), - www_open_url(URL). - -has_url(Item, Which:name) :-> - "Test if item has URL":: - get(Item, key, Test), - rdf(Test, test:Which, _URL). - -run(Item) :-> - "Re-run the test":: - get(Item, key, Test), - run_test(Test), - send(Item, show). - -copy_test_uri(Item) :-> - "Copy URI of test to clipboard":: - get(Item, key, Test), - send(@display, copy, Test). - -show(Item) :-> - "Show source, result and norm diagrams":: - get(Item?image, frame, Frame), - get(Item, object, List), - ( get(Frame, member, result, Result) - -> member(result(RTriples), List), - send(Result, triples, RTriples) - ; true - ), - ( get(Frame, member, norm, Norm) - -> member(norm(NTriples), List), - send(Norm, triples, NTriples) - ; true - ), - ( get(Frame, member, text, View) - -> member(source(File), List), - send(View, text_buffer, new(TB, emacs_buffer(File))), - % scroll to RDF text - ( member(Pattern, [':RDF', 'RDF']), - get(TB, find, 0, Pattern, Start), - get(TB, scan, Start, line, 0, start, BOL) - -> send(View, scroll_to, BOL, 1) - ; true - ) - ; true - ). -% member(substitutions(Substitutions), List), -% send(Result, copy_layout, Norm, Substitutions), - -:- pce_end_class(rdf_test_item). - - -:- pce_global(@rdf_test_gui, make_rdf_test_gui). - -make_rdf_test_gui(Ref) :- - send(new(Ref, w3c_rdf_test_gui(chain(source,result))), open). - - -test_result(Result, Test, Data) :- - send(@rdf_test_gui, test_result, Result, Test, Data), - ( Result == fail, verbose - -> member(result(Our), Data), - length(Our, OurLength), - format('~N** Our Triples (~w)~n', OurLength), - pp(Our), - member(norm(Norm), Data), - length(Norm, NormLength), - format('~N** Normative Triples (~w)~n', NormLength), - pp(Norm) - ; true - ). - - - -start_tests :- - send(@rdf_test_gui, clear). - -report_results :- - send(@rdf_test_gui, summarise). - -run :- - set_verbose, - get(@rdf_test_gui, member, browser, B), - get(B, selection, DI), - get(DI, key, Test), - run_test(Test). - - - /******************************* - * SHOW A FILE * - *******************************/ - - -show(File) :- - rdf_diagram_from_file(File). - - - /******************************* - * COMPARING * - *******************************/ - -% compare_triples(+PlRDF, +NTRDF, -Substitions) -% -% Compare two models and if they are equal, return a list of -% PlID = NTID, mapping NodeID elements. - - -compare_triples(A, B, Substitutions) :- - compare_list(A, B, [], Substitutions). - -compare_list([], [], S, S). -compare_list(L1, L2, S0, S) :- - take_bag(L1, B1, E1, R1), !, - take_bag(L2, B2, E2, R2), - compare_field(B1, B2, S0, S1), - compare_bags(E1, E2, S1, S2), - compare_list(R1, R2, S2, S). -compare_list([H1|T1], In2, S0, S) :- - select(H2, In2, T2), - compare_triple(H1, H2, S0, S1), % put(.), flush_output, - compare_list(T1, T2, S1, S). - -compare_triple(rdf(Subj1,P1,O1), rdf(Subj2, P2, O2), S0, S) :- - compare_field(Subj1, Subj2, S0, S1), - compare_field(P1, P2, S1, S2), - compare_field(O1, O2, S2, S). - -compare_field(X, X, S, S) :- !. -compare_field(literal(X), xml(X), S, S) :- !. % TBD -compare_field(rdf:Name, Atom, S, S) :- - atom(Atom), - rdf_parser:rdf_name_space(NS), - atom_concat(NS, Name, Atom), !. -compare_field(NS:Name, Atom, S, S) :- - atom(Atom), - atom_concat(NS, Name, Atom), !. -compare_field(X, node(Id), S, S) :- - memberchk(X=Id, S), !. -compare_field(X, node(Id), S, [X=Id|S]) :- - \+ memberchk(X=_, S), - atom(X), - generated_prefix(Prefix), - sub_atom(X, 0, _, _, Prefix), !, - feedback('Assume ~w = ~w~n', [X, node(Id)]). - -generated_prefix(Prefix) :- - rdf_truple:anon_base(Prefix). - -% compare_bags(+Members1, +Members2, +S0, -S) -% -% Order of _1, _2, etc. are not relevant in BadID reification. Are -% they in general? Anyway, we'll normalise the order of the bags - -compare_bags([], [], S, S). -compare_bags([E1|T1], M, S0, S) :- - select(E2, M, T2), - compare_field(E1, E2, S0, S1), - compare_bags(T1, T2, S1, S). - -take_bag(Triples, Bag, Elems, RestTriples) :- - select(rdf(Bag, Type, BagClass), Triples, T1), - compare_field(rdf:type, Type, [], []), - compare_field(rdf:'Bag', BagClass, [], []), - bag_members(T1, Bag, Elems, RestTriples). - -bag_members([], _, [], []). -bag_members([rdf(Bag, IsElm, E)|T], Bag, [E|ET], Rest) :- - member_prop(IsElm), !, - bag_members(T, Bag, ET, Rest). -bag_members([T0|T], Bag, Elems, [T0|R]) :- - bag_members(T, Bag, Elems, R). - -member_prop(rdf:Name) :- - atom_codes(Name, [0'_|Codes]), - number_codes(_N, Codes), !. -member_prop(Prop) :- - atom(Prop), - rdf_parser:rdf_name_space(NS), - atom_concat(NS, Name, Prop), - atom_codes(Name, [0'_|Codes]), - number_codes(_N, Codes), !. - - -% feedback(+Format, +Args) -% -% Print if verbose - -feedback(Fmt, Args) :- - verbose, !, - format(user_error, Fmt, Args). -feedback(_, _). diff --git a/packages/sgml/RDF/write_test.pl b/packages/sgml/RDF/write_test.pl deleted file mode 100644 index 1b6e06029..000000000 --- a/packages/sgml/RDF/write_test.pl +++ /dev/null @@ -1,155 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog - - Author: Jan Wielemaker - E-mail: wielemak@science.uva.nl - WWW: http://www.swi-prolog.org - Copyright (C): 1985-2007, University of Amsterdam - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - As a special exception, if you link this library with other files, - compiled with a Free Software compiler, to produce an executable, this - library does not by itself cause the resulting executable to be covered - by the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -:- module(test_rdf_write, - [ run_tests/0, - run_tests/1 - ]). - -:- asserta(user:file_search_path(foreign, '..')). -:- asserta(user:file_search_path(foreign, '../../semweb')). -:- asserta(user:file_search_path(library, '../..')). -:- asserta(user:file_search_path(library, '..')). -:- asserta(user:file_search_path(library, '.')). -:- asserta(user:file_search_path(library, '../../plunit')). - -:- use_module(library(plunit)). -:- use_module(library(rdf_write)). -:- use_module(library(sgml)). -:- use_module(library(lists)). -:- use_module(library(debug)). -:- use_module(library(semweb/rdf_db)). -:- use_module(rdf). - - - /******************************* - * ROUND TRIP * - *******************************/ - -test_graph(Triples) :- - tmp_file(rdf, Tmp), - open(Tmp, write, Out, [encoding(utf8)]), - rdf_write_xml(Out, Triples), - close(Out), - load_rdf(Tmp, ReadTriples), - delete_file(Tmp), - compare_triples(Triples, ReadTriples, _). - - - /******************************* - * COMPARING * - *******************************/ - -% compare_triples(+PlRDF, +NTRDF, -Substitions) -% -% Compare two models and if they are equal, return a list of -% PlID = NTID, mapping NodeID elements. - - -compare_triples(A, B, Substitutions) :- - compare_list(A, B, [], Substitutions), !. - -compare_list([], [], S, S). -compare_list([H1|T1], In2, S0, S) :- - select(H2, In2, T2), - compare_triple(H1, H2, S0, S1), - compare_list(T1, T2, S1, S). - -compare_triple(rdf(Subj1,P1,O1), rdf(Subj2, P2, O2), S0, S) :- - compare_field(Subj1, Subj2, S0, S1), - compare_field(P1, P2, S1, S2), - compare_field(O1, O2, S2, S). - -compare_field(X, X, S, S) :- !. -compare_field(literal(X), xml(X), S, S) :- !. % TBD -compare_field(rdf:Name, Atom, S, S) :- - atom(Atom), - rdf_parser:rdf_name_space(NS), - atom_concat(NS, Name, Atom), !. -compare_field(NS:Name, Atom, S, S) :- - atom(Atom), - atom_concat(NS, Name, Atom), !. -compare_field(X, Id, S, S) :- - memberchk(X=Id, S), !. -compare_field(X, Y, S, [X=Y|S]) :- - \+ memberchk(X=_, S), - rdf_is_bnode(X), - rdf_is_bnode(Y), - debug(bnode, 'Assume ~w = ~w~n', [X, Y]). - - - /******************************* - * TESTS * - *******************************/ - -:- begin_tests(rdf_write). - -test(1, true) :- - test_graph([ rdf(s, p, o) - ]). -test(anon_s, true) :- - test_graph([ rdf('__s', p, o) - ]). -test(anon_o, true) :- - test_graph([ rdf(s, p, '__o') - ]). -test(anon_loop, blocked('NodeID map must check for cycles')) :- - test_graph([ rdf('__r1', p1, '__r2'), - rdf('__r2', p1, '__r1') - ]). -test(anon_loop, true) :- - test_graph([ rdf('__r1', p1, '__r2'), - rdf('__r1', p2, '__r2'), - rdf('__r2', p1, '__r1'), - rdf('__r2', p2, '__r1') - ]). -test(anon_reuse, true) :- - test_graph([ rdf('__s1', p1, '__o1'), - rdf('__s2', p1, '__o1') - ]). -test(anon_reuse, true) :- - test_graph([ rdf('__s1', p1, '__o1'), - rdf('__s2', p1, '__o1'), - rdf('__o1', name, literal(foo)) - ]). -test(literal, true) :- - test_graph([ rdf(s, p, literal(hello)) - ]). -test(lang, true) :- - test_graph([ rdf(s, p, literal(lang(en, hello))) - ]). -test(type, true) :- - test_graph([ rdf(s, p, literal(type(t, hello))) - ]). - -:- end_tests(rdf_write). - - diff --git a/packages/sgml/TODO b/packages/sgml/TODO deleted file mode 100644 index b1932803e..000000000 --- a/packages/sgml/TODO +++ /dev/null @@ -1,26 +0,0 @@ -TODO LIST: - - * Handling of external entities (both param and normal) in Prolog - * Check ID/IDREF - * Donot use quoted values for tag identifications. Right now the - following leads to bad error handling: - - <tag name="value> - * Allow for (a,b) as attribute-type (name-group) - * Handle source-info in included SYSTEM entities - -UNICODE: - - * Started full unicode support under the CVS branch XML_UNICODE. - * Old version only allows for unicide in CDATA (attribute values - and element content) - * New adds throughout: element-names, tags, filenames, etc. - - ISSUES: - - Port to Windows - - Testing - - File-entities - - Leak setting filename using istrdup() in sgml2pl - - Verify performance. Optimise. - - Own character classification and conversion - - Copy from Prolog? diff --git a/packages/sgml/Test/amp.sgml b/packages/sgml/Test/amp.sgml deleted file mode 100644 index beae6e87e..000000000 --- a/packages/sgml/Test/amp.sgml +++ /dev/null @@ -1,7 +0,0 @@ -<!DOCTYPE test [ - <!ELEMENT test o o (p)*> - <!ELEMENT p o o (#PCDATA)> - <!ENTITY amp CDATA "&#38;"> -]> - -&amp; diff --git a/packages/sgml/Test/att.xml b/packages/sgml/Test/att.xml deleted file mode 100644 index 740795cfd..000000000 --- a/packages/sgml/Test/att.xml +++ /dev/null @@ -1,3 +0,0 @@ -<?xml version="1.0"?> - -<foo bar=10/> diff --git a/packages/sgml/Test/badxmlent.xml b/packages/sgml/Test/badxmlent.xml deleted file mode 100644 index c25d3fc04..000000000 --- a/packages/sgml/Test/badxmlent.xml +++ /dev/null @@ -1,5 +0,0 @@ -<?xml version="1.0"> - -<test a="John & Mary"> - John & Mary -</test> diff --git a/packages/sgml/Test/bar.sgml b/packages/sgml/Test/bar.sgml deleted file mode 100644 index 82ec34364..000000000 --- a/packages/sgml/Test/bar.sgml +++ /dev/null @@ -1,8 +0,0 @@ -<!DOCTYPE bar [ - <!ELEMENT bar - O EMPTY> - <!ATTLIST bar a CDATA #REQUIRED b NAME #REQUIRED c NUMBER #REQUIRED - d CDATA #REQUIRED> -]> - -<bar a="Major Mynah" b="&#65;&#66;&#67;" c="&#49;&#50;" d="foo -bar ugh"> diff --git a/packages/sgml/Test/bat.sgml b/packages/sgml/Test/bat.sgml deleted file mode 100644 index 14ad1d490..000000000 --- a/packages/sgml/Test/bat.sgml +++ /dev/null @@ -1,68 +0,0 @@ -<!DOCTYPE bat [ - <!-- The purpose of this is to test bad attribute values --> - <!NOTATION no SYSTEM "http://www.example.com/notations/no.xml"> - <!ENTITY en SYSTEM "http://www.example.com/entities/en.not" NDATA no> - <!ELEMENT bat O O (x+)> - <!ELEMENT x - O EMPTY> - <!ATTLIST x - a CDATA #IMPLIED - b ENTITY #IMPLIED - c ENTITIES #IMPLIED - d ID #IMPLIED - e IDREF #IMPLIED - f IDREFS #IMPLIED - g NAME #IMPLIED - h NAMES #IMPLIED - i NMTOKEN #IMPLIED - j NMTOKENS #IMPLIED - k NUMBER #IMPLIED - l NUMBERS #IMPLIED - m NUTOKEN #IMPLIED - n NUTOKENS #IMPLIED - o NOTATION (no) #IMPLIED - > -]> -<x a=foo> -<x a=bar// -<x a=foo&bar> -<x a=file.cgi?y=1> -<x b=en> -<x b=en en> -<x b="en en"> -<x c=en> -<x c=en en> -<x c="en en"> -<x c=un> -<x c=12> -<x d=an-id> -<x d=an*id> -<x d=*id*> -<x d="an id"> -<x e=an-id> -<x e=un-id> -<x f=""> -<x f=an-id> -<x f=" an-id an-id "> -<x g=1> -<x g=''> -<x g=a-rather-long-name> -<x g=a%name%with%percents> -<x g=" a name "> -<x g=" a-name "> -<x h=""> -<x h=a> -<x h="NAME"> -<x h="A NAME"> -<x k=1> -<x k=999999999999999999999999999999999999999999999> -<x k=1.2> -<x k="1.2"> -<x k="-1.2"> -<x n="one two"> -<x n="1a 2a"> -<x n="1*ft 2*in"> -<x o=no> -<x o=un> -<x p=--a--> -<x p=--b--> -<x p=" --a-- "> diff --git a/packages/sgml/Test/cdata.sgml b/packages/sgml/Test/cdata.sgml deleted file mode 100644 index 6bad9ae57..000000000 --- a/packages/sgml/Test/cdata.sgml +++ /dev/null @@ -1,8 +0,0 @@ -<!DOCTYPE test [ -<!ELEMENT test - - (#PCDATA)> -]> - -<test> -<![CDATA[[Ora Lassila]]]> -</test> - diff --git a/packages/sgml/Test/ce.sgml b/packages/sgml/Test/ce.sgml deleted file mode 100644 index 68e5b7ea0..000000000 --- a/packages/sgml/Test/ce.sgml +++ /dev/null @@ -1,7 +0,0 @@ -<!DOCTYPE test [ - <!ELEMENT test - - (#PCDATA)> -]> - -<test> -Test for handling character entities: &#65; &#RS; -</test> diff --git a/packages/sgml/Test/cent-nul.xml b/packages/sgml/Test/cent-nul.xml deleted file mode 100644 index 06a795751..000000000 --- a/packages/sgml/Test/cent-nul.xml +++ /dev/null @@ -1 +0,0 @@ -<test>This content holds a &#0; byte that should be skipped</test> diff --git a/packages/sgml/Test/cent-utf8.xml b/packages/sgml/Test/cent-utf8.xml deleted file mode 100644 index 80f4939ad..000000000 --- a/packages/sgml/Test/cent-utf8.xml +++ /dev/null @@ -1,19 +0,0 @@ -<!DOCTYPE testdoc [ -<!--* test swi: check to see how SWI handles non-ASCII characters - * in Unicode. Named entities, numeric character references, - * and native UTF8 may all be different. - *--> -<!ENTITY ntilde "&#241;" ><!-- small n, tilde --> -<!ENTITY lsquo "&#x2018;" ><!--=single quotation mark, left--> -<!ENTITY rsquo "&#8217;" ><!-- = x2019 single quotation mark, right--> -<!ENTITY townname "Espa&ntilde;ola"> -<!ENTITY townnum "Espa&#241;ola"> -<!ENTITY scarequote1 "a &lsquo;test&rsquo; for you"> -<!ENTITY scarequote2 "a &#x2018;test&#x2019; for you"> -]> -<testdoc id="t7-20020923" resp="MSM"> -<names>From Espa&ntilde;ola -- a &lsquo;test&rsquo; for you.</names> -<nums>From Espa&#241;ola -- a &#x2018;test&#x2019; for you.</nums> -<names>From &townname; -- &scarequote1;.</names> -<nums>From &townname; -- &scarequote2;.</nums> -</testdoc> diff --git a/packages/sgml/Test/cmt.sgml b/packages/sgml/Test/cmt.sgml deleted file mode 100644 index 3ae403c46..000000000 --- a/packages/sgml/Test/cmt.sgml +++ /dev/null @@ -1,13 +0,0 @@ -<!DOCTYPE a - [ <!ENTITY %attrs - "id ID #implied -- document-wide unique id -- - class CDATA #IMPLIED -- comment --"> - - <!ELEMENT a - - (#PCDATA) -- foo-bar --> - <!ATTLIST a %attrs;> - ] -> - -<!-- x --> - -<a></a> diff --git a/packages/sgml/Test/comment.xml b/packages/sgml/Test/comment.xml deleted file mode 100644 index 050b8d277..000000000 --- a/packages/sgml/Test/comment.xml +++ /dev/null @@ -1,10 +0,0 @@ -<?xml version="1.0"?> - -<test> - <!-- comment --> - <!--- bad comment --> - <!-- bad -- comment --> - <!-- ok-comment --> - <!-- bad comment end ---> -</test> - diff --git a/packages/sgml/Test/conref.sgml b/packages/sgml/Test/conref.sgml deleted file mode 100644 index 19b75e4fa..000000000 --- a/packages/sgml/Test/conref.sgml +++ /dev/null @@ -1,8 +0,0 @@ -<!DOCTYPE con [ - <!ELEMENT con - - (foo,bar)> - <!ATTLIST con missing (missing) #CONREF> - <!ELEMENT (foo|bar) - O (#PCDATA)> -]> - -<con missing> - diff --git a/packages/sgml/Test/conref2.sgml b/packages/sgml/Test/conref2.sgml deleted file mode 100644 index 5684709d8..000000000 --- a/packages/sgml/Test/conref2.sgml +++ /dev/null @@ -1,10 +0,0 @@ -<!DOCTYPE conref [ - <!ELEMENT conref O O (b+)> - <!ELEMENT b - O RCDATA> - <!ATTLIST b x CDATA #CONREF> -]> -<b>1.</b> -<b x=2> -<b>3.</b> -<b x=4> -<b>5.</b> diff --git a/packages/sgml/Test/crlf.sgml b/packages/sgml/Test/crlf.sgml deleted file mode 100644 index fe99410ad..000000000 --- a/packages/sgml/Test/crlf.sgml +++ /dev/null @@ -1,11 +0,0 @@ -<!DOCTYPE text [ -<!ENTITY new.p STARTTAG "p"> -<!SHORTREF for.text - "&#RS;&#RE;" new.p> -<!ELEMENT text O O (p+)> -<!USEMAP for.text text> -<!ELEMENT p O O (#PCDATA)> -]> -par 1 - -par 2 diff --git a/packages/sgml/Test/defent.sgml b/packages/sgml/Test/defent.sgml deleted file mode 100644 index bb4a9c719..000000000 --- a/packages/sgml/Test/defent.sgml +++ /dev/null @@ -1,10 +0,0 @@ -<!DOCTYPE def [ - <!ENTITY #DEFAULT SDATA "?"> - <!ELEMENT def - - RCDATA> -]> - -<def>&#65 -&#66 &#67@ &#68 -&b -&#66 -&c</def> diff --git a/packages/sgml/Test/entent.sgml b/packages/sgml/Test/entent.sgml deleted file mode 100644 index 8c3c06830..000000000 --- a/packages/sgml/Test/entent.sgml +++ /dev/null @@ -1,10 +0,0 @@ -<!DOCTYPE oops [ - <!ENTITY s CDATA "attr"> - <!ENTITY o STARTTAG "snag &#38;s;=2"> - <!ELEMENT snag - O EMPTY> - <!ATTLIST snag attr NUMBER #REQUIRED> - <!ELEMENT oops - O RCDATA> -]> - -<oops> -&o; diff --git a/packages/sgml/Test/estag.sgml b/packages/sgml/Test/estag.sgml deleted file mode 100644 index d746fbeea..000000000 --- a/packages/sgml/Test/estag.sgml +++ /dev/null @@ -1,10 +0,0 @@ -<!DOCTYPE oops [ - <!ENTITY o STARTTAG "snag attr=2"> - <!ELEMENT snag - O EMPTY> - <!ATTLIST snag attr NUMBER #REQUIRED> - <!ELEMENT oops - O RCDATA> -]> - -<oops> -&o; - diff --git a/packages/sgml/Test/foo.sgml b/packages/sgml/Test/foo.sgml deleted file mode 100644 index 7e770176b..000000000 --- a/packages/sgml/Test/foo.sgml +++ /dev/null @@ -1,7 +0,0 @@ -<!DOCTYPE foo [ - <!ELEMENT foo O O (name+)> - <!ELEMENT name - O (#PCDATA)> - <!ATTLIST name title cdata #implied sex cdata #implied> -]> -<name title=Dr sex=M>Neddie Seagoon -<name title=Miss sex=F>Minnie Bannister diff --git a/packages/sgml/Test/i.sgml b/packages/sgml/Test/i.sgml deleted file mode 100644 index e17d51799..000000000 --- a/packages/sgml/Test/i.sgml +++ /dev/null @@ -1,12 +0,0 @@ -<!DOCTYPE test [ - <!ENTITY QS "<q>"> - <!ENTITY QE ENDTAG "q"> - <!ENTITY Q2 CDATA "<q>"> - <!ENTITY S SDATA "special"> - <!ELEMENT test - - (#PCDATA|q)*> - <!ELEMENT q - - (#PCDATA)> -]> - -<test> -&Q2;! Hello &QS;you there&QE;, I'm &S; -</test> diff --git a/packages/sgml/Test/layout.xml b/packages/sgml/Test/layout.xml deleted file mode 100644 index 53b10a4a4..000000000 --- a/packages/sgml/Test/layout.xml +++ /dev/null @@ -1,11 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> - -<document name="value"> - <ul> - <li>Line one</li> - <li>Line with <em>emphasised</em> text</li> - </ul> - -<p>This is a nice paragraph with some <b>bold</b> text</p> - -</document> diff --git a/packages/sgml/Test/mapbug.sgml b/packages/sgml/Test/mapbug.sgml deleted file mode 100644 index 6bc931790..000000000 --- a/packages/sgml/Test/mapbug.sgml +++ /dev/null @@ -1,41 +0,0 @@ -<!DOCTYPE D [ - -<!ELEMENT D O O (P+)> -<!ELEMENT P O O (#PCDATA|Q|M)*> -<!ELEMENT Q - - (#PCDATA|M)*> -<!ELEMENT M - - (#PCDATA)> - -<!ENTITY P STARTTAG "P"> -<!ENTITY beg.q STARTTAG "Q"> -<!ENTITY end.q ENDTAG "Q"> -<!ENTITY err.q STARTTAG "MISS-Q"> -<!ENTITY beg.m STARTTAG "M"> -<!ENTITY end.m ENDTAG "M"> -<!ENTITY err.m STARTTAG "MISS-PCT"> - -<!SHORTREF For.D - "%" beg.m - "&#RS;&#RE;" P - '"' beg.q -> -<!USEMAP For.D (D|P)> - -<!SHORTREF For.Q - "%" beg.m - "&#RS;&#RE;" err.q - '"' end.q -> -<!USEMAP For.Q (Q)> - -<!SHORTREF For.M - "%" end.m - "&#RS;&#RE;" err.m -> -<!USEMAP For.M (M)> -]> -The "first" paragraph. - -The "%2%nd" paragraph. - -The %3%rd paragraph. - diff --git a/packages/sgml/Test/ment.sgml b/packages/sgml/Test/ment.sgml deleted file mode 100644 index 636d80042..000000000 --- a/packages/sgml/Test/ment.sgml +++ /dev/null @@ -1,7 +0,0 @@ -<!DOCTYPE ent [ - <!ENTITY #DEFAULT CDATA "[missing]"> - <!ELEMENT ent O O (#PCDATA)> -]> -One: &one;. -Two: &two;. -Three: &three;. diff --git a/packages/sgml/Test/minus2.xml b/packages/sgml/Test/minus2.xml deleted file mode 100644 index 5af6f644e..000000000 --- a/packages/sgml/Test/minus2.xml +++ /dev/null @@ -1,3 +0,0 @@ -<?xml version="1.0"?> -<x--y/> - diff --git a/packages/sgml/Test/netc.sgml b/packages/sgml/Test/netc.sgml deleted file mode 100644 index b7e3b0c32..000000000 --- a/packages/sgml/Test/netc.sgml +++ /dev/null @@ -1,12 +0,0 @@ -<!DOCTYPE shref [ - <!ELEMENT shref - - (netc|twit|twat)*> - <!ELEMENT netc - - (frob+)> - <!ELEMENT frob O O (twit)> - <!ELEMENT twit - O (#PCDATA)> - <!ELEMENT twat - - CDATA> -]> -<shref> -<netc/<frob><twit>This slash should end netc:/ -<twat/This is a twat/ -<twit/This is a simple shortref/ -</shref> diff --git a/packages/sgml/Test/ng.sgml b/packages/sgml/Test/ng.sgml deleted file mode 100644 index e4c2d08e0..000000000 --- a/packages/sgml/Test/ng.sgml +++ /dev/null @@ -1,10 +0,0 @@ -<!DOCTYPE test -[ <!ELEMENT test - - EMPTY> - <!ATTLIST test - or (a|b|c) #IMPLIED - and (d&e&f) #IMPLIED - seq (g,h,i) #IMPLIED> -]> - -<test or=a and=e seq=i> - diff --git a/packages/sgml/Test/noent.sgml b/packages/sgml/Test/noent.sgml deleted file mode 100644 index c543689d0..000000000 --- a/packages/sgml/Test/noent.sgml +++ /dev/null @@ -1,14 +0,0 @@ -<!DOCTYPE tiny-htm [ - <!ELEMENT tiny-htm - - (p|pre)+> - <!ELEMENT p - O (#PCDATA|i|b|var)*> - <!ELEMENT pre - O (#PCDATA|i|b|var)*> - <!ELEMENT (i|b|var) - - (#PCDATA|i|b|var)*> - ]> -<tiny-htm> -<p>This demonstrates the problem: -<pre> - <var>status</var> = DOM_<var>operation</var ->, &<var>result</var>); -</pre> -<p>I hope this helps. -</tiny-htm> diff --git a/packages/sgml/Test/not.sgml b/packages/sgml/Test/not.sgml deleted file mode 100644 index 9018c2064..000000000 --- a/packages/sgml/Test/not.sgml +++ /dev/null @@ -1,13 +0,0 @@ -<!DOCTYPE not [ - <!ELEMENT not - - (Formula*)> - <!NOTATION TeX SYSTEM ""> - <!NOTATION Eqn SYSTEM ""> - <!ELEMENT formula - O CDATA> - <!ATTLIST formula notation NOTATION (TeX|Eqn) #CURRENT> -]> - -<not> -<formula notation=TeX> -$$E = MC^2$$ -</formula> -</not> diff --git a/packages/sgml/Test/ok/amp.ok b/packages/sgml/Test/ok/amp.ok deleted file mode 100644 index 4672c0ca5..000000000 --- a/packages/sgml/Test/ok/amp.ok +++ /dev/null @@ -1 +0,0 @@ -[element(test, [], [element(p, [], [&])])]. diff --git a/packages/sgml/Test/ok/att.ok b/packages/sgml/Test/ok/att.ok deleted file mode 100644 index 181b871bb..000000000 --- a/packages/sgml/Test/ok/att.ok +++ /dev/null @@ -1,2 +0,0 @@ -[element(foo, [bar='10'], [])]. -[]. diff --git a/packages/sgml/Test/ok/badxmlent.ok b/packages/sgml/Test/ok/badxmlent.ok deleted file mode 100644 index 66de8fb72..000000000 --- a/packages/sgml/Test/ok/badxmlent.ok +++ /dev/null @@ -1,2 +0,0 @@ -[element(test, [a='John & Mary'], ['\n John & Mary\n'])]. -[sgml(sgml_parser(1949540), 'badxmlent.xml', 3, 'Syntax error: Illegal entity, found "& Mary""'), sgml(sgml_parser(1949540), 'badxmlent.xml', 4, 'Syntax error: Illegal entity, found "& "')]. diff --git a/packages/sgml/Test/ok/bar.ok b/packages/sgml/Test/ok/bar.ok deleted file mode 100644 index 6764b91e4..000000000 --- a/packages/sgml/Test/ok/bar.ok +++ /dev/null @@ -1 +0,0 @@ -[element(bar, [a='Major Mynah', b=abc, c='12', d='foo bar ugh'], [])]. diff --git a/packages/sgml/Test/ok/bat.ok b/packages/sgml/Test/ok/bat.ok deleted file mode 100644 index 2b020e170..000000000 --- a/packages/sgml/Test/ok/bat.ok +++ /dev/null @@ -1,2 +0,0 @@ -[element(bat, [], [element(x, [a=foo], []), element(x, [a=bar], []), element(x, [a='foo&bar'], []), element(x, [a='file.cgi?y=1'], []), element(x, [b=en], []), element(x, [b=en], []), element(x, [b='en en'], []), element(x, [c=[en]], []), element(x, [c=[en]], []), element(x, [c=[en, en]], []), element(x, [c=[un]], []), element(x, [c=['12']], []), element(x, [d='an-id'], []), element(x, [d='an*id'], []), element(x, [d='*id*'], []), element(x, [d='an id'], []), element(x, [e='an-id'], []), element(x, [e='un-id'], []), element(x, [f=['']], []), element(x, [f=['an-id']], []), element(x, [f=['an-id', 'an-id']], []), element(x, [g='1'], []), element(x, [g=''], []), element(x, [g='a-rather-long-name'], []), element(x, [g='a%name%with%percents'], []), element(x, [g='a name'], []), element(x, [g='a-name'], []), element(x, [h=['']], []), element(x, [h=[a]], []), element(x, [h=[name]], []), element(x, [h=[a, name]], []), element(x, [k='1'], []), element(x, [k='999999999999999999999999999999999999999999999'], []), element(x, [k=0], []), element(x, [k=0], []), element(x, [k=0], []), element(x, [n=[one, two]], []), element(x, [n=['1a', '2a']], []), element(x, [n=['1*ft', '2*in']], []), element(x, [o=no], []), element(x, [o=un], []), element(x, [p='--a--'], []), element(x, [p='--b--'], []), element(x, [p=' --a-- '], [])])]. -[sgml(sgml_parser(423746), 'bat.sgml', 27, 'Syntax error: Attribute value requires quotes, found "foo&bar"'), sgml(sgml_parser(423746), 'bat.sgml', 28, 'Syntax error: Attribute value requires quotes, found "file.cgi?y=1"'), sgml(sgml_parser(423746), 'bat.sgml', 30, 'Element "x" has no attribute with value "en"'), sgml(sgml_parser(423746), 'bat.sgml', 30, 'Syntax error: Bad attribute list, found "b=en en"'), sgml(sgml_parser(423746), 'bat.sgml', 33, 'Element "x" has no attribute with value "en"'), sgml(sgml_parser(423746), 'bat.sgml', 33, 'Syntax error: Bad attribute list, found "c=en en"'), sgml(sgml_parser(423746), 'bat.sgml', 36, 'Syntax error: entity NAMES expected, found "12"'), sgml(sgml_parser(423746), 'bat.sgml', 38, 'Syntax error: Attribute value requires quotes, found "an*id"'), sgml(sgml_parser(423746), 'bat.sgml', 38, 'Syntax error: NAME expected, found "an*id"'), sgml(sgml_parser(423746), 'bat.sgml', 39, 'Syntax error: Attribute value requires quotes, found "*id*"'), sgml(sgml_parser(423746), 'bat.sgml', 39, 'Syntax error: NAME expected, found "*id*"'), sgml(sgml_parser(423746), 'bat.sgml', 43, 'Syntax error: NAMES expected, found """"'), sgml(sgml_parser(423746), 'bat.sgml', 46, 'Syntax error: NAME expected, found "1"'), sgml(sgml_parser(423746), 'bat.sgml', 47, 'Syntax error: NAME expected, found "\'\'"'), sgml(sgml_parser(423746), 'bat.sgml', 49, 'Syntax error: Attribute value requires quotes, found "a%name%with%percents"'), sgml(sgml_parser(423746), 'bat.sgml', 49, 'Syntax error: NAME expected, found "a%name%with%percents"'), sgml(sgml_parser(423746), 'bat.sgml', 52, 'Syntax error: NAMES expected, found """"'), sgml(sgml_parser(423746), 'bat.sgml', 58, 'Syntax error: NUMBER expected, found "1.2"'), sgml(sgml_parser(423746), 'bat.sgml', 59, 'Syntax error: NUMBER expected, found ""1.2""'), sgml(sgml_parser(423746), 'bat.sgml', 60, 'Syntax error: NUMBER expected, found ""-1.2""'), sgml(sgml_parser(423746), 'bat.sgml', 61, 'Syntax error: NUTOKENS expected, found ""one two""'), sgml(sgml_parser(423746), 'bat.sgml', 63, 'Syntax error: NUTOKENS expected, found ""1*ft 2*in""'), sgml(sgml_parser(423746), 'bat.sgml', 66, 'Element "x" has no attribute "p"')]. diff --git a/packages/sgml/Test/ok/cdata.ok b/packages/sgml/Test/ok/cdata.ok deleted file mode 100644 index 0c88d88e8..000000000 --- a/packages/sgml/Test/ok/cdata.ok +++ /dev/null @@ -1,2 +0,0 @@ -[element(test, [], ['[Ora Lassila]'])]. -[]. diff --git a/packages/sgml/Test/ok/ce.ok b/packages/sgml/Test/ok/ce.ok deleted file mode 100644 index fa7340c2c..000000000 --- a/packages/sgml/Test/ok/ce.ok +++ /dev/null @@ -1 +0,0 @@ -[element(test, [], ['Test for handling character entities: A \n'])]. diff --git a/packages/sgml/Test/ok/cent-nul.ok b/packages/sgml/Test/ok/cent-nul.ok deleted file mode 100644 index 113b25eb1..000000000 --- a/packages/sgml/Test/ok/cent-nul.ok +++ /dev/null @@ -1,2 +0,0 @@ -[element(test, [], ['This content holds a byte that should be skipped'])]. -[sgml(sgml_parser(482992), 'cent-nul.xml', 1, 'Syntax error: Bad character entity, found "#0"')]. diff --git a/packages/sgml/Test/ok/cent-utf8.ok b/packages/sgml/Test/ok/cent-utf8.ok deleted file mode 100644 index 19a4c6b3c..000000000 --- a/packages/sgml/Test/ok/cent-utf8.ok +++ /dev/null @@ -1,2 +0,0 @@ -[element(testdoc, [id='t7-20020923', resp='MSM'], ['\n', element(names, [], ['From Española -- a ‘test’ for you.']), '\n', element(nums, [], ['From Española -- a ‘test’ for you.']), '\n', element(names, [], ['From Española -- a ‘test’ for you.']), '\n', element(nums, [], ['From Española -- a ‘test’ for you.']), '\n'])]. -[]. diff --git a/packages/sgml/Test/ok/cmt.ok b/packages/sgml/Test/ok/cmt.ok deleted file mode 100644 index 7b6ac92ae..000000000 --- a/packages/sgml/Test/ok/cmt.ok +++ /dev/null @@ -1 +0,0 @@ -[element(a, [], [])]. diff --git a/packages/sgml/Test/ok/comment.ok b/packages/sgml/Test/ok/comment.ok deleted file mode 100644 index 5149c333e..000000000 --- a/packages/sgml/Test/ok/comment.ok +++ /dev/null @@ -1,2 +0,0 @@ -[element(test, [], ['\n \n \n \n \n \n'])]. -[sgml(sgml_parser(1951880), 'comment.xml', 5, 'Syntax error: Illegal comment, found "<!---"'), sgml(sgml_parser(1951880), 'comment.xml', 6, 'Syntax error: Illegal comment'), sgml(sgml_parser(1951880), 'comment.xml', 8, 'Syntax error: Illegal comment')]. diff --git a/packages/sgml/Test/ok/conref.ok b/packages/sgml/Test/ok/conref.ok deleted file mode 100644 index db1382bfd..000000000 --- a/packages/sgml/Test/ok/conref.ok +++ /dev/null @@ -1 +0,0 @@ -[element(con, [missing=missing], [])]. diff --git a/packages/sgml/Test/ok/conref2.ok b/packages/sgml/Test/ok/conref2.ok deleted file mode 100644 index 3befca03d..000000000 --- a/packages/sgml/Test/ok/conref2.ok +++ /dev/null @@ -1,2 +0,0 @@ -[element(conref, [], [element(b, [], ['1.']), element(b, [x='2'], []), element(b, [], ['3.']), element(b, [x='4'], []), element(b, [], ['5.'])])]. -[]. diff --git a/packages/sgml/Test/ok/crlf.ok b/packages/sgml/Test/ok/crlf.ok deleted file mode 100644 index 1691d319c..000000000 --- a/packages/sgml/Test/ok/crlf.ok +++ /dev/null @@ -1,2 +0,0 @@ -[element(text, [], [element(p, [], ['par 1']), element(p, [], ['par 2'])])]. -[]. diff --git a/packages/sgml/Test/ok/defent.ok b/packages/sgml/Test/ok/defent.ok deleted file mode 100644 index 033f55ea1..000000000 --- a/packages/sgml/Test/ok/defent.ok +++ /dev/null @@ -1,2 +0,0 @@ -[element(def, [], ['AB C@ D', sdata(?), 'B', sdata(?)])]. -[]. diff --git a/packages/sgml/Test/ok/entent.ok b/packages/sgml/Test/ok/entent.ok deleted file mode 100644 index 721c268b4..000000000 --- a/packages/sgml/Test/ok/entent.ok +++ /dev/null @@ -1 +0,0 @@ -[element(oops, [], ['<snag attr=2>'])]. diff --git a/packages/sgml/Test/ok/estag.ok b/packages/sgml/Test/ok/estag.ok deleted file mode 100644 index c1fc965e2..000000000 --- a/packages/sgml/Test/ok/estag.ok +++ /dev/null @@ -1,2 +0,0 @@ -[element(oops, [], ['<snag attr=2>'])]. -[]. diff --git a/packages/sgml/Test/ok/foo.ok b/packages/sgml/Test/ok/foo.ok deleted file mode 100644 index 3e93de7cc..000000000 --- a/packages/sgml/Test/ok/foo.ok +++ /dev/null @@ -1 +0,0 @@ -[element(foo, [], [element(name, [title='Dr', sex='M'], ['Neddie Seagoon']), element(name, [title='Miss', sex='F'], ['Minnie Bannister'])])]. diff --git a/packages/sgml/Test/ok/i.ok b/packages/sgml/Test/ok/i.ok deleted file mode 100644 index d4f89a617..000000000 --- a/packages/sgml/Test/ok/i.ok +++ /dev/null @@ -1 +0,0 @@ -[element(test, [], ['<q>! Hello ', element(q, [], ['you there']), ', I\'m ', sdata(special)])]. diff --git a/packages/sgml/Test/ok/layout.ok b/packages/sgml/Test/ok/layout.ok deleted file mode 100644 index 140d810ef..000000000 --- a/packages/sgml/Test/ok/layout.ok +++ /dev/null @@ -1,2 +0,0 @@ -[element(document, [name=value], ['\n ', element(ul, [], ['\n ', element(li, [], ['Line one']), '\n ', element(li, [], ['Line with ', element(em, [], [emphasised]), ' text']), '\n ']), '\n\n', element(p, [], ['This is a nice paragraph with some ', element(b, [], [bold]), ' text']), '\n\n'])]. -[]. diff --git a/packages/sgml/Test/ok/mapbug.ok b/packages/sgml/Test/ok/mapbug.ok deleted file mode 100644 index 861c2e3cc..000000000 --- a/packages/sgml/Test/ok/mapbug.ok +++ /dev/null @@ -1,2 +0,0 @@ -[element(d, [], [element(p, [], ['The ', element(q, [], [first]), ' paragraph.']), element(p, [], ['The ', element(q, [], [element(m, [], ['2']), nd]), ' paragraph.']), element(p, [], ['The ', element(m, [], ['3']), 'rd paragraph.']), element(p, [], [])])]. -[]. diff --git a/packages/sgml/Test/ok/ment.ok b/packages/sgml/Test/ok/ment.ok deleted file mode 100644 index 87d917133..000000000 --- a/packages/sgml/Test/ok/ment.ok +++ /dev/null @@ -1,2 +0,0 @@ -[element(ent, [], ['One: [missing].\nTwo: [missing].\nThree: [missing].'])]. -[]. diff --git a/packages/sgml/Test/ok/minus2.ok b/packages/sgml/Test/ok/minus2.ok deleted file mode 100644 index 193838122..000000000 --- a/packages/sgml/Test/ok/minus2.ok +++ /dev/null @@ -1,2 +0,0 @@ -[element('x--y', [], [])]. -[]. diff --git a/packages/sgml/Test/ok/netc.ok b/packages/sgml/Test/ok/netc.ok deleted file mode 100644 index 7b4310f0a..000000000 --- a/packages/sgml/Test/ok/netc.ok +++ /dev/null @@ -1,2 +0,0 @@ -[element(shref, [], [element(netc, [], [element(frob, [], [element(twit, [], ['This slash should end netc:'])])]), element(twat, [], ['This is a twat']), element(twit, [], ['This is a simple shortref'])])]. -[]. diff --git a/packages/sgml/Test/ok/ng.ok b/packages/sgml/Test/ok/ng.ok deleted file mode 100644 index ad8be4c0b..000000000 --- a/packages/sgml/Test/ok/ng.ok +++ /dev/null @@ -1,2 +0,0 @@ -[element(test, [or=a, and=e, seq=i], [])]. -[]. diff --git a/packages/sgml/Test/ok/noent.ok b/packages/sgml/Test/ok/noent.ok deleted file mode 100644 index 33cc08ddb..000000000 --- a/packages/sgml/Test/ok/noent.ok +++ /dev/null @@ -1 +0,0 @@ -[element('tiny-htm', [], [element(p, [], ['This demonstrates the problem:']), element(pre, [], [' ', element(var, [], [status]), ' = DOM_', element(var, [], [operation]), ', &', element(var, [], [result]), ');']), element(p, [], ['I hope this helps.'])])]. diff --git a/packages/sgml/Test/ok/not.ok b/packages/sgml/Test/ok/not.ok deleted file mode 100644 index f05a7e0cb..000000000 --- a/packages/sgml/Test/ok/not.ok +++ /dev/null @@ -1 +0,0 @@ -[element(not, [], [element(formula, [notation=tex], ['$$E = MC^2$$'])])]. diff --git a/packages/sgml/Test/ok/oma.ok b/packages/sgml/Test/ok/oma.ok deleted file mode 100644 index 3535abf75..000000000 --- a/packages/sgml/Test/ok/oma.ok +++ /dev/null @@ -1,2 +0,0 @@ -[element(oma, [foo=foo], [element(obo, [bar=bar], [element(p, [], ['Hello world.']), element(p, [], ['Where did the attributes go?'])])])]. -[]. diff --git a/packages/sgml/Test/ok/omit1.ok b/packages/sgml/Test/ok/omit1.ok deleted file mode 100644 index 7de5e60c8..000000000 --- a/packages/sgml/Test/ok/omit1.ok +++ /dev/null @@ -1 +0,0 @@ -[element(bar, [], [element(foo, [], [element(a, [], [element(b, [], [x]), element(c, [], [y])]), element(a, [], [element(b, [], [x]), element(c, [], [y])]), element(a, [], [element(b, [], [x]), element(c, [], [y])]), element(a, [], [element(b, [], [x]), element(c, [], [y])])])])]. diff --git a/packages/sgml/Test/ok/per.ok b/packages/sgml/Test/ok/per.ok deleted file mode 100644 index 09ce28dc8..000000000 --- a/packages/sgml/Test/ok/per.ok +++ /dev/null @@ -1 +0,0 @@ -[element(per, [], [element(jim, [], [snark])])]. diff --git a/packages/sgml/Test/ok/pi.ok b/packages/sgml/Test/ok/pi.ok deleted file mode 100644 index 319e8f1ca..000000000 --- a/packages/sgml/Test/ok/pi.ok +++ /dev/null @@ -1,2 +0,0 @@ -[element(test, [], ['\n', pi('this is a pi'), '\n'])]. -[]. diff --git a/packages/sgml/Test/ok/rcdata.ok b/packages/sgml/Test/ok/rcdata.ok deleted file mode 100644 index 6a8cfc6c2..000000000 --- a/packages/sgml/Test/ok/rcdata.ok +++ /dev/null @@ -1 +0,0 @@ -[element(doc, [], [element(t, [], ['This is rcdata Hello & World Hello']), element(a, [], ['This is an a'])])]. diff --git a/packages/sgml/Test/ok/rdefent.ok b/packages/sgml/Test/ok/rdefent.ok deleted file mode 100644 index 1a13644fd..000000000 --- a/packages/sgml/Test/ok/rdefent.ok +++ /dev/null @@ -1,2 +0,0 @@ -[element(foo, [], ['_'])]. -[]. diff --git a/packages/sgml/Test/ok/rsre.ok b/packages/sgml/Test/ok/rsre.ok deleted file mode 100644 index 412023cf3..000000000 --- a/packages/sgml/Test/ok/rsre.ok +++ /dev/null @@ -1,2 +0,0 @@ -[element(text, [], [element(page, [], [element(line, [], ['SGML does NOT add record start characters at the beginning or']), element(line, [], ['record end characters at the end of entities unless they are']), element(line, [], ['already there. In this document, there IS a record start']), element(line, [], ['character for the first line of text and there IS a record end']), element(line, [], ['character for the last line of text. The #RS character reference']), element(line, [], ['should match at the beginning of each line except possibly the']), element(line, [], ['first one, so we expect SEVEN (LINE) elements for this file.'])])])]. -[]. diff --git a/packages/sgml/Test/ok/sdata.ok b/packages/sgml/Test/ok/sdata.ok deleted file mode 100644 index fb4095647..000000000 --- a/packages/sgml/Test/ok/sdata.ok +++ /dev/null @@ -1 +0,0 @@ -[element(text, [], ['Van Alpha tot ', sdata('\\Omega')])]. diff --git a/packages/sgml/Test/ok/shortval.ok b/packages/sgml/Test/ok/shortval.ok deleted file mode 100644 index 28c7b04a5..000000000 --- a/packages/sgml/Test/ok/shortval.ok +++ /dev/null @@ -1 +0,0 @@ -[element(num, [val='2'], [])]. diff --git a/packages/sgml/Test/ok/simple.ok b/packages/sgml/Test/ok/simple.ok deleted file mode 100644 index e8bd67085..000000000 --- a/packages/sgml/Test/ok/simple.ok +++ /dev/null @@ -1,2 +0,0 @@ -[element(test, [name=value], ['Some content'])]. -[]. diff --git a/packages/sgml/Test/ok/sr.ok b/packages/sgml/Test/ok/sr.ok deleted file mode 100644 index bb6bc7bb3..000000000 --- a/packages/sgml/Test/ok/sr.ok +++ /dev/null @@ -1 +0,0 @@ -[element(test, [], [element(p, [], ['Peter said: ', element(q, [], ['He, this is a nice program']), '.']), element(p, [], ['Bob said: ', element(q, [], ['Yes, it is'])])])]. diff --git a/packages/sgml/Test/ok/sr2.ok b/packages/sgml/Test/ok/sr2.ok deleted file mode 100644 index d5151f9e2..000000000 --- a/packages/sgml/Test/ok/sr2.ok +++ /dev/null @@ -1 +0,0 @@ -[element(test, [], [element(t, [], [element(name, [], [n]), element(arg, [], [a])])])]. diff --git a/packages/sgml/Test/ok/ugh.ok b/packages/sgml/Test/ok/ugh.ok deleted file mode 100644 index 181bb001b..000000000 --- a/packages/sgml/Test/ok/ugh.ok +++ /dev/null @@ -1 +0,0 @@ -[element(ugh, [], [element(extension, [missing=missing, exchange='479'], []), element(extension, [exchange='479'], ['8494']), element(extension, [exchange='555'], ['1234']), element(extension, [exchange='03-555'], ['1234'])])]. diff --git a/packages/sgml/Test/ok/utf8-cent.ok b/packages/sgml/Test/ok/utf8-cent.ok deleted file mode 100644 index 19a4c6b3c..000000000 --- a/packages/sgml/Test/ok/utf8-cent.ok +++ /dev/null @@ -1,2 +0,0 @@ -[element(testdoc, [id='t7-20020923', resp='MSM'], ['\n', element(names, [], ['From Española -- a ‘test’ for you.']), '\n', element(nums, [], ['From Española -- a ‘test’ for you.']), '\n', element(names, [], ['From Española -- a ‘test’ for you.']), '\n', element(nums, [], ['From Española -- a ‘test’ for you.']), '\n'])]. -[]. diff --git a/packages/sgml/Test/ok/utf8-ru.ok b/packages/sgml/Test/ok/utf8-ru.ok deleted file mode 100644 index 50ef19ddb..000000000 --- a/packages/sgml/Test/ok/utf8-ru.ok +++ /dev/null @@ -1,2 +0,0 @@ -[element('Человек', [Ñзык=мова], ['Borys'])]. -[]. diff --git a/packages/sgml/Test/ok/utf8.ok b/packages/sgml/Test/ok/utf8.ok deleted file mode 100644 index d07b8bb15..000000000 --- a/packages/sgml/Test/ok/utf8.ok +++ /dev/null @@ -1,2 +0,0 @@ -[element(utf8, [], ['\n', element(name, [], ['Dürst']), '\n', element(name, [name='Dürst'], []), '\n'])]. -[]. diff --git a/packages/sgml/Test/ok/wchar.ok b/packages/sgml/Test/ok/wchar.ok deleted file mode 100644 index 97a5640c0..000000000 --- a/packages/sgml/Test/ok/wchar.ok +++ /dev/null @@ -1,2 +0,0 @@ -[element(test, [], ['\n ', element(li, [], ['Some cyrillic chars: ий']), '\n ', element(li, [], ['This a an sizzors symbol: ✄']), '\n ', element(li, [], ['OK, entered via entity: ✓']), '\n ', element(a, [att='Cirle with 1: ➀', ok='✓'], []), '\n'])]. -[]. diff --git a/packages/sgml/Test/ok/wcharlong.ok b/packages/sgml/Test/ok/wcharlong.ok deleted file mode 100644 index da7795bad..000000000 --- a/packages/sgml/Test/ok/wcharlong.ok +++ /dev/null @@ -1,2 +0,0 @@ -[element(test, [], ['\n', element(p, [], ['\nThis is a long test holding, with the intention to switch to wide character\nencoding from the local buffer to malloc\'ed buffer. This (✌) is a\npiece symbol.\n']), '\n', element(p, [], ['\nThis is a long test holding, with the intention to switch to wide character\nencoding after the output buffer has been switched to malloc\'ed mode. For this\nreason, our buffer should should hold more than 256 character, as defined in\nutil.h in the structure ocharbuf. This (âž½) is a fat arrow.\n']), '\n'])]. -[]. diff --git a/packages/sgml/Test/oma.sgml b/packages/sgml/Test/oma.sgml deleted file mode 100644 index c8ae6b5ca..000000000 --- a/packages/sgml/Test/oma.sgml +++ /dev/null @@ -1,8 +0,0 @@ -<!DOCTYPE oma [ <!ELEMENT oma O O (obo)> -<!ATTLIST oma foo CDATA #FIXED "foo"> -<!ELEMENT obo O O (p+)> -<!ATTLIST obo bar CDATA #FIXED "bar"> -<!ELEMENT p - O (#PCDATA)> -]> -<p>Hello world. -<p>Where did the attributes go? diff --git a/packages/sgml/Test/omit1.sgml b/packages/sgml/Test/omit1.sgml deleted file mode 100644 index 2d6b60083..000000000 --- a/packages/sgml/Test/omit1.sgml +++ /dev/null @@ -1,14 +0,0 @@ -<!DOCTYPE bar [ - <!ELEMENT bar - - (foo)> - <!ELEMENT foo O O (a+)> - <!ELEMENT a O O (b,c)> - <!ELEMENT b - O (#PCDATA)> - <!ELEMENT c - O (#PCDATA)> -]> - -<bar> -<b>x<c>y -<b>x<c>y -<b>x<c>y -<b>x<c>y -</bar> diff --git a/packages/sgml/Test/per.sgml b/packages/sgml/Test/per.sgml deleted file mode 100644 index 5f4eb2fc5..000000000 --- a/packages/sgml/Test/per.sgml +++ /dev/null @@ -1,9 +0,0 @@ -<!DOCTYPE per [ - <!ENTITY % fred "jim"> - <!ELEMENT per - - (%fred;)> - <!ELEMENT %fred - - (#PCDATA)> - <!ATTLIST %fred tom (dick|harry) #IMPLIED> - <!USEMAP #EMPTY %fred> -]> - -<per><jim>snark</jim></per> diff --git a/packages/sgml/Test/pi.xml b/packages/sgml/Test/pi.xml deleted file mode 100644 index 91933b5cf..000000000 --- a/packages/sgml/Test/pi.xml +++ /dev/null @@ -1,3 +0,0 @@ -<test> -<?this is a pi> -</test> diff --git a/packages/sgml/Test/rcdata.sgml b/packages/sgml/Test/rcdata.sgml deleted file mode 100644 index a6414c573..000000000 --- a/packages/sgml/Test/rcdata.sgml +++ /dev/null @@ -1,19 +0,0 @@ -<!DOCTYPE doc - [ <!ELEMENT doc - - (t|a)*> - <!ELEMENT a - - (#PCDATA)> - <!ELEMENT t - - rcdata> - <!ENTITY hello "Hello"> - <!ENTITY world "World &hello;"> - ] -> - -<!-- coment --> - -<doc> -<t> -This is rcdata &hello; & &world -</t> - -<a>This is an a</a> - -</doc> diff --git a/packages/sgml/Test/rdefent.sgml b/packages/sgml/Test/rdefent.sgml deleted file mode 100644 index 158dd815f..000000000 --- a/packages/sgml/Test/rdefent.sgml +++ /dev/null @@ -1,9 +0,0 @@ -<!DOCTYPE foo [ - <!-- Test silently ignoring second definition of an entity --> - <!ENTITY nbsp "_"> - <!ENTITY %latin SYSTEM "../DTD/HTMLlat1.ent"> - %latin; - <!ELEMENT foo O O (#PCDATA)> -]> - -&nbsp; diff --git a/packages/sgml/Test/rsre.sgml b/packages/sgml/Test/rsre.sgml deleted file mode 100644 index ffdbcd6cb..000000000 --- a/packages/sgml/Test/rsre.sgml +++ /dev/null @@ -1,18 +0,0 @@ -<!DOCTYPE text [ -<!ENTITY new.page STARTTAG "page"> -<!ENTITY new.line STARTTAG "line"> -<!SHORTREF for.text - "&#RS;" new.line> -<!ELEMENT text O O (page+)> -<!ATTLIST text original CDATA #IMPLIED> -<!USEMAP for.text text> -<!ELEMENT page O O (line+)> -<!ELEMENT line O O (#PCDATA)> -]> -SGML does NOT add record start characters at the beginning or -record end characters at the end of entities unless they are -already there. In this document, there IS a record start -character for the first line of text and there IS a record end -character for the last line of text. The #RS character reference -should match at the beginning of each line except possibly the -first one, so we expect SEVEN (LINE) elements for this file. diff --git a/packages/sgml/Test/sdata.sgml b/packages/sgml/Test/sdata.sgml deleted file mode 100644 index 734d66051..000000000 --- a/packages/sgml/Test/sdata.sgml +++ /dev/null @@ -1,8 +0,0 @@ -<!DOCTYPE text [ - <!ENTITY Omega SDATA "\Omega"> - <!ELEMENT text - - (#PCDATA)> -]> - -<text> -Van Alpha tot &Omega; -</text> diff --git a/packages/sgml/Test/shortval.sgml b/packages/sgml/Test/shortval.sgml deleted file mode 100644 index 48c210b3d..000000000 --- a/packages/sgml/Test/shortval.sgml +++ /dev/null @@ -1,6 +0,0 @@ -<!DOCTYPE num [ - <!ELEMENT num - O EMPTY> - <!ATTLIST num val (1|2|3) #REQUIRED> -]> - -<num 2> diff --git a/packages/sgml/Test/simple.xml b/packages/sgml/Test/simple.xml deleted file mode 100644 index 06b1da17e..000000000 --- a/packages/sgml/Test/simple.xml +++ /dev/null @@ -1 +0,0 @@ -<test name="value">Some content</test> diff --git a/packages/sgml/Test/sr.sgml b/packages/sgml/Test/sr.sgml deleted file mode 100644 index 26b351fe1..000000000 --- a/packages/sgml/Test/sr.sgml +++ /dev/null @@ -1,20 +0,0 @@ -<!DOCTYPE test [ - <!ELEMENT test - - (p)*> - <!ELEMENT p o o (#PCDATA|q)*> - <!ELEMENT q - - (#PCDATA)> - - <!ENTITY beg..q "<q><!USEMAP in..q>"> - <!ENTITY end..q ENDTAG "q"> - <!ENTITY beg..p STARTTAG "p"> - - <!SHORTREF in..p '"' beg..q - '&#RS;B&#RE;' beg..p> - <!SHORTREF in..q '"' end..q> - <!USEMAP in..p p> -]> - -<test> -Peter said: "He, this is a nice program". - -Bob said: "Yes, it is" -</test> diff --git a/packages/sgml/Test/sr2.sgml b/packages/sgml/Test/sr2.sgml deleted file mode 100644 index 4881fc8e8..000000000 --- a/packages/sgml/Test/sr2.sgml +++ /dev/null @@ -1,25 +0,0 @@ -<!DOCTYPE test - [ <!ELEMENT test - - (t*)> - <!ELEMENT t - - ((name|op),arg)> - <!ELEMENT name o o (#PCDATA)> - <!ELEMENT op - - (#PCDATA)> - <!ELEMENT arg - - (#PCDATA)> - <!ELEMENT desc o o (#PCDATA)> - - <!ENTITY end-t ENDTAG "t"> - <!ENTITY beg-arg STARTTAG "arg"> - <!ENTITY end-arg ENDTAG "arg"> - - <!SHORTREF in.t - '&#RE' end-t - '(' beg-arg> - <!SHORTREF in.arg - ')' end-arg> - - <!USEMAP in.t t> - <!USEMAP in.arg arg> - ]> - -<test> -<t>n(a) -</test> diff --git a/packages/sgml/Test/test.pl b/packages/sgml/Test/test.pl deleted file mode 100644 index 2ffc1147c..000000000 --- a/packages/sgml/Test/test.pl +++ /dev/null @@ -1,169 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog SGML/XML parser - - Author: Jan Wielemaker - E-mail: jan@swi.psy.uva.nl - WWW: http://www.swi.psy.uva.nl/projects/SWI-Prolog/ - Copying: LGPL-2. See the file COPYING or http://www.gnu.org - - Copyright (C) 1990-2000 SWI, University of Amsterdam. All rights reserved. -*/ - -:- module(sgml_test, - [ test/1, % +File - testdir/1, % +Dir - pass/1, % +File - show/1, % +File - test/0 - ]). - - -:- expects_dialect(swi). - -:- use_module(library(sgml)). - -:- prolog_load_context(directory, CWD), - assert(wd(CWD)). - -%:- asserta(user:file_search_path(library, '..')). -%:- asserta(user:file_search_path(foreign, '..')). -%:- use_module(library(sgml)). - - -test :- - wd(CWD), - working_directory(_, CWD), - testdir(.). - -testdir(Dir) :- - atom_concat(Dir, '/*', Pattern), - expand_file_name(Pattern, Files), - maplist(dotest, Files). - -dotest(File) :- - file_name_extension(_, Ext, File), - memberchk(Ext, [sgml, xml, html]), !, - test(File). -dotest(_). - -test(File) :- - format('~NTest ~w ... ', [File]), - flush_output, - load_file(File, Term), - ground(Term), % make sure - okfile(File, OkFile), - ( exists_file(OkFile) - -> load_prolog_file(OkFile, TermOk, ErrorsOk), - ( compare_dom(Term, TermOk) - -> format('ok') - ; format('WRONG'), - format('~NOK:~n'), - pp(TermOk), - format('~NANSWER:~n'), - pp(Term) - ), - error_terms(Errors), - ( compare_errors(Errors, ErrorsOk) - -> true - ; format(' [Different errors]~nOK:~n'), - pp(ErrorsOk), - format('~NANSWER:~n'), - pp(Errors) - ), - nl - ; show_errors, - format('Loaded, no validating data~n'), - pp(Term) - ). - -show(File) :- - load_file(File, Term), - pp(Term). - -pass(File) :- - load_file(File, Term), - okfile(File, OkFile), - open(OkFile, write, Fd), - format(Fd, '~q.~n', [Term]), - ( error_terms(Errors) - -> format(Fd, '~q.~n', [Errors]) - ; true - ), - close(Fd). - -:- dynamic - error/3. -:- multifile - user:message_hook/3. - -user:message_hook(Term, Kind, Lines) :- - Term = sgml(_,_,_,_), - assert(error(Term, Kind, Lines)). - -show_errors :- - ( error(_Term, Kind, Lines), - atom_concat(Kind, ': ', Prefix), - print_message_lines(user_error, Prefix, Lines), - fail - ; true - ). - -error_terms(Errors) :- - findall(Term, error(Term, _, _), Errors). - -compare_errors([], []). -compare_errors([sgml(_Parser1, _File1, Line, Msg)|T0], - [sgml(_Parser2, _File2, Line, Msg)|T]) :- - compare_errors(T0, T). - -load_file(File, Term) :- - load_pred(Ext, Pred), - file_name_extension(_, Ext, File), !, - retractall(error(_,_,_)), - call(Pred, File, Term). -load_file(Base, Term) :- - load_pred(Ext, Pred), - file_name_extension(Base, Ext, File), - exists_file(File), !, - retractall(error(_,_,_)), - call(Pred, File, Term). - - -load_pred(sgml, load_sgml_file). -load_pred(xml, load_xml_file). -load_pred(html, load_html_file). - -okfile(File, OkFile) :- - file_name_extension(Base, _, File), - file_directory_name(Base, Dir), - concat_atom([Dir, '/ok/', Base, '.ok'], OkFile). - -load_prolog_file(File, Term, Errors) :- - open(File, read, Fd, - [ encoding(utf8) - ]), - read(Fd, Term), - ( read(Fd, Errors), - Errors \== end_of_file - -> true - ; Errors = [] - ), - close(Fd). - -compare_dom([], []) :- !. -compare_dom([H1|T1], [H2|T2]) :- !, - compare_dom(H1, H2), - compare_dom(T1, T2). -compare_dom(X, X) :- !. -compare_dom(element(Name, A1, Content1), - element(Name, A2, Content2)) :- - compare_attributes(A1, A2), - compare_dom(Content1, Content2). - -compare_attributes(A1, A2) :- - sort(A1, L1), - sort(A2, L2), - L1 == L2. - -pp(X) :- writeln(X). \ No newline at end of file diff --git a/packages/sgml/Test/ugh.sgml b/packages/sgml/Test/ugh.sgml deleted file mode 100644 index 33f54cb28..000000000 --- a/packages/sgml/Test/ugh.sgml +++ /dev/null @@ -1,9 +0,0 @@ -<!DOCTYPE ugh [ - <!ELEMENT ugh O O (extension+)> - <!ELEMENT extension - O (#PCDATA)> - <!ATTLIST extension exchange NUTOKEN 479 missing (missing) #CONREF> -]> -<extension missing> -<extension>8494 -<extension exchange=555>1234 -<extension exchange=03-555>1234 diff --git a/packages/sgml/Test/utf8-cent.xml b/packages/sgml/Test/utf8-cent.xml deleted file mode 100644 index 830711692..000000000 --- a/packages/sgml/Test/utf8-cent.xml +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<testdoc id="t7-20020923" resp="MSM"> -<names>From Española -- a ‘test’ for you.</names> -<nums>From Española -- a ‘test’ for you.</nums> -<names>From Española -- a ‘test’ for you.</names> -<nums>From Española -- a ‘test’ for you.</nums> -</testdoc> diff --git a/packages/sgml/Test/utf8-ru.xml b/packages/sgml/Test/utf8-ru.xml deleted file mode 100644 index 5059daa49..000000000 --- a/packages/sgml/Test/utf8-ru.xml +++ /dev/null @@ -1,3 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> - -<Человек Ñзык="мова">Borys</Человек> diff --git a/packages/sgml/Test/utf8.xml b/packages/sgml/Test/utf8.xml deleted file mode 100644 index c5f3baf19..000000000 --- a/packages/sgml/Test/utf8.xml +++ /dev/null @@ -1,10 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> - -<!-- The ü below is a single character #xFC in NFC - (encoded as two UTF-8 octets #xC3 #xBC) --> - -<utf8> -<name>Dürst</name> -<name name="Dürst"/> -</utf8> - diff --git a/packages/sgml/Test/wchar.xml b/packages/sgml/Test/wchar.xml deleted file mode 100644 index 4db60a540..000000000 --- a/packages/sgml/Test/wchar.xml +++ /dev/null @@ -1,11 +0,0 @@ -<?xml version="1.0"?> -<!DOCTYPE test [ - <!ENTITY ok CDATA "&#10003"> -]> -<test> - <li>Some cyrillic chars: &#1080;&#1081;</li> - <li>This a an sizzors symbol: &#9988;</li> - <li>OK, entered via entity: &ok;</li> - <a att="Cirle with 1: &#10112;" ok="&ok;"/> -</test> - diff --git a/packages/sgml/Test/wcharlong.xml b/packages/sgml/Test/wcharlong.xml deleted file mode 100644 index cb0317690..000000000 --- a/packages/sgml/Test/wcharlong.xml +++ /dev/null @@ -1,16 +0,0 @@ -<?xml version="1.0"?> - -<test> -<p> -This is a long test holding, with the intention to switch to wide character -encoding from the local buffer to malloc'ed buffer. This (&#9996;) is a -piece symbol. -</p> -<p> -This is a long test holding, with the intention to switch to wide character -encoding after the output buffer has been switched to malloc'ed mode. For this -reason, our buffer should should hold more than 256 character, as defined in -util.h in the structure ocharbuf. This (&#10173;) is a fat arrow. -</p> -</test> - diff --git a/packages/sgml/Test/wrtest.pl b/packages/sgml/Test/wrtest.pl deleted file mode 100644 index 44dc38e10..000000000 --- a/packages/sgml/Test/wrtest.pl +++ /dev/null @@ -1,241 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog SGML/XML parser - - Author: Jan Wielemaker - E-mail: jan@swi.psy.uva.nl - WWW: http://www.swi.psy.uva.nl/projects/SWI-Prolog/ - Copying: LGPL-2. See the file COPYING or http://www.gnu.org - - Copyright (C) 1990-2000 SWI, University of Amsterdam. All rights reserved. -*/ - -:- prolog_load_context(directory, CWD), - working_directory(_, CWD). - -:- asserta(file_search_path(foreign, '..')). -:- asserta(file_search_path(library, '..')). - -:- use_module(library(sgml)). -:- use_module(library(sgml_write)). - -test :- % default test - fp('.'). - -test(File) :- - file_name_extension(_, xml, File), !, - load_xml_file(File, Term), - xml_write(user_output, Term, []). -test(File) :- - file_name_extension(_, sgml, File), !, - load_sgml_file(File, Term), - sgml_write(user_output, Term, []). -test(File) :- - file_name_extension(_, html, File), !, - load_html_file(File, Term), - html_write(user_output, Term, []). - -test(File, Into, Encoding) :- - file_name_extension(_, xml, File), !, - load_xml_file(File, Term), - open(Into, write, Out, [encoding(Encoding)]), - xml_write(Out, Term, []), - close(Out). - -fp(Dir) :- - atom_concat(Dir, '/*', Pattern), - expand_file_name(Pattern, Files), - ( member(File, Files), - file_name_extension(_, Ext, File), - ml_file(Ext), - file_base_name(File, Base), - \+ blocked(Base), - format(user_error, '~w ... ', [Base]), - ( \+ utf8(Base) - -> format(user_error, ' (ISO Latin-1) ... ', []), - fixed_point(File, iso_latin_1) - ; true - ), - format(user_error, ' (UTF-8) ... ', []), - fixed_point(File, utf8), - format(user_error, ' done~n', []), - fail - ; true - ). - -ml_file(xml). -ml_file(sgml). -ml_file(html). - -%% blocked(+File) -% -% List of test-files that are blocked. These are either negative -% tests or tests involving SDATA. - -blocked('bat.sgml'). -blocked('i.sgml'). -blocked('sdata.sgml'). -blocked('cent-nul.xml'). -blocked('defent.sgml'). -blocked('comment.xml'). -blocked('badxmlent.xml'). - - -%% utf8(+File) -% -% File requires UTF-8. These are files that have UTF-8 characters -% in element or attribute names. - -utf8('utf8-ru.xml'). - - -%% fixed_point(+File, +Encoding) -% -% Perform write/read round-trip and validate the data has not -% changed. - -fixed_point(File, Encoding) :- - file_name_extension(_, xml, File), !, - fp(File, Encoding, load_xml_file, xml_write). -fixed_point(File, Encoding) :- - file_name_extension(_, sgml, File), !, - fp(File, Encoding, load_sgml_file, sgml_write). -fixed_point(File, Encoding) :- - file_name_extension(_, html, File), !, - fp(File, Encoding, load_html_file, html_write). - -fp(File, Encoding, Load, Write) :- - put_char(user_error, r), - call(Load, File, Term), - tmp_file(xml, TmpFile), - open(TmpFile, write, TmpOut, [encoding(Encoding)]), - put_char(user_error, w), - call(Write, TmpOut, Term, []), - close(TmpOut), -% cat(TmpFile, Encoding), - put_char(user_error, r), - call(Load, TmpFile, Term2), - delete_file(TmpFile), - ( eq(Term, Term2) - -> true - ; format(user_error, 'First file:~n', []), - %pp(Term), - save_in_file(f1, Term), - format(user_error, 'Second file:~n', []), - %pp(Term2), - save_in_file(f2, Term2), - fail - ). - -save_in_file(File, Term) :- - open(File, write, Out, [encoding(iso_latin_1)]), - current_output(C0), - set_output(Out), - pp(Term), - set_output(C0), - close(Out). - - -cat(File, Encoding) :- - open(File, read, In, [encoding(Encoding)]), - copy_stream_data(In, current_output), - close(In). - -% eq(M1, M2) -% -% Test two terms for equivalence. The following mismatches are -% allowed: -% -% * Order of attributes -% * Layout in `element-only' content - -eq(X, X) :- !. -eq([], []) :- !. -eq([B|T], L) :- % delete blanks - blank_atom(B), !, - eq(T, L). -eq(L, [B|T]) :- - blank_atom(B), !, - eq(T, L). -eq([H1|T1], [H2|T2]) :- !, - eq(H1, H2), - eq(T1, T2). -eq(element(Name, A1, C1), element(Name, A2, C2)) :- - att_eq(A1, A2), - ceq(C1, C2). -eq(A1, A2) :- - atom(A1), - atom(A2), !, - normalise_blanks(A1, B1), - normalise_blanks(A2, B2), - ( B1 == B2 - -> true - ; format(user_error, - 'ERROR: CDATA differs:~n\ - \t~p~n\ - \t~p~n', - [B1, B2]) - ). -eq(X, Y) :- - format(user_error, - 'ERROR: Content differs:~n\ - \t~p~n\ - \t~p~n', - [X, Y]). - -att_eq(A1, A2) :- % ordering is unimportant - sort(A1, S), - sort(A2, S), !. -att_eq(A1, A2) :- - format(user_error, - 'ERROR: Attribute lists differ:~n\ - \t~p~n\ - \t~p~n', - [A1, A2]). - -ceq(C1, C2) :- - element_content(C1, E1), - element_content(C2, E2), !, - eq(E1, E2). -ceq(C1, C2) :- - eq(C1, C2). - -element_content([], []). -element_content([element(Name,Atts,C)|T0], [element(Name,Atts,C)|T]) :- !, - element_content(T0, T). -element_content([Blank|T0], T) :- - blank_atom(Blank), - element_content(T0, T). - -blank_atom(Atom) :- - atom(Atom), - atom_codes(Atom, Codes), - all_blanks(Codes). - -all_blanks([]). -all_blanks([H|T]) :- - code_type(H, space), - all_blanks(T). - -normalise_blanks(Atom, Normalised) :- - atom_codes(Atom, Codes), - eat_blanks(Codes, Codes1), - normalise_blanks2(Codes1, N), - atom_codes(Normalised, N). - -normalise_blanks2([], []). -normalise_blanks2([H|T0], T) :- - code_type(H, space), !, - eat_blanks(T0, T1), - ( T1 == [] - -> T = [] - ; T = [32|T2], - normalise_blanks2(T1, T2) - ). -normalise_blanks2([H|T0], [H|T]) :- - normalise_blanks2(T0, T). - -eat_blanks([H|T0], T) :- - code_type(H, space), !, - eat_blanks(T0, T). -eat_blanks(L, L). diff --git a/packages/sgml/VERSION b/packages/sgml/VERSION deleted file mode 100644 index 2165f8f9b..000000000 --- a/packages/sgml/VERSION +++ /dev/null @@ -1 +0,0 @@ -2.0.4 diff --git a/packages/sgml/catalog.c b/packages/sgml/catalog.c deleted file mode 100644 index 929bd7174..000000000 --- a/packages/sgml/catalog.c +++ /dev/null @@ -1,672 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog - - Author: Jan Wielemaker and Richard O'Keefe - E-mail: wielemak@science.uva.nl - WWW: http://www.swi-prolog.org - Copyright (C): 1985-2006, University of Amsterdam - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#define _ISOC99_SOURCE 1 /* fwprintf(), etc prototypes */ -#include "util.h" -#include "catalog.h" -#include <stdio.h> -#include <wctype.h> -#include <string.h> -#include <stdlib.h> -#define DTD_MINOR_ERRORS 1 -#include <dtd.h> /* error codes */ - -#ifdef __WINDOWS__ -#define swprintf _snwprintf -#endif - -#ifdef _REENTRANT -#include <pthread.h> - -static pthread_mutex_t catalog_mutex = PTHREAD_MUTEX_INITIALIZER; -#define LOCK() pthread_mutex_lock(&catalog_mutex) -#define UNLOCK() pthread_mutex_unlock(&catalog_mutex) -#else -#define LOCK() -#define UNLOCK() -#endif - -#ifndef MAXPATHLEN -#define MAXPATHLEN 1024 -#endif -#ifndef MAXLINE -#define MAXLINE 1024 -#endif -#ifndef EOS -#define EOS '\0' -#endif -#ifndef TRUE -#define TRUE 1 -#define FALSE 0 -#endif - -#define streq(s1, s2) istreq(s1, s2) -#define uc(p) (*(p)) - -typedef struct catalogue_item *catalogue_item_ptr; -struct catalogue_item -{ catalogue_item_ptr next; - int kind; - ichar const *target; - ichar const *replacement; -}; - -static catalogue_item_ptr first_item = 0, last_item = 0; - -typedef struct _catalog_file -{ ichar *file; - struct _catalog_file *next; - int loaded; /* did we parse this file? */ - catalogue_item_ptr first_item; /* List of items in the file */ - catalogue_item_ptr last_item; -} catalog_file; - -static catalog_file *catalog; - -#ifdef __WINDOWS__ -#define isDirSep(c) ((c) == '/' || (c) == '\\') -#define DIRSEPSTR L"\\" -#else -#define isDirSep(c) ((c) == '/') -#define DIRSEPSTR L"/" -#endif - -static ichar * -DirName(const ichar *f, ichar *dir) -{ const ichar *base, *p; - - for (base = p = f; *p; p++) - { if (isDirSep(*p) && p[1] != EOS) - base = p; - } - if (base == f) - { if (isDirSep(*f)) - istrcpy(dir, DIRSEPSTR); - else - istrcpy(dir, L"."); - } else - { istrncpy(dir, f, base - f); - dir[base - f] = EOS; - } - - return dir; -} - - -int -is_absolute_path(const ichar *name) -{ if (isDirSep(name[0]) -#ifdef __WINDOWS__ - || (iswalpha(uc(name)) && name[1] == ':') -#endif - ) - return TRUE; - - return FALSE; -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -localpath() creates an absolute path for name relative to ref. The -returned path must be freed using sgml_free() when done. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -ichar * -localpath(const ichar *ref, const ichar *name) -{ ichar *local; - - if (!ref || is_absolute_path(name)) - local = istrdup(name); - else - { ichar buf[MAXPATHLEN]; - - DirName(ref, buf); - istrcat(buf, DIRSEPSTR); - istrcat(buf, name); - - local = istrdup(buf); - } - - if (!local) - sgml_nomem(); - - return local; -} - - -int -register_catalog_file_unlocked(const ichar *file, catalog_location where) -{ catalog_file **f = &catalog; - catalog_file *cf; - - for (; *f; f = &(*f)->next) - { cf = *f; - - if (istreq(cf->file, file)) - return TRUE; /* existing, move? */ - } - - cf = sgml_malloc(sizeof(*cf)); - memset(cf, 0, sizeof(*cf)); - cf->file = istrdup(file); - if (!cf->file) - sgml_nomem(); - - if (where == CTL_END) - { cf->next = NULL; - *f = cf; - } else - { cf->next = catalog; - catalog = cf; - } - - return TRUE; -} - - -static wchar_t * -wgetenv(const char *name) -{ const char *vs; - - if ( (vs = getenv(name)) ) - { size_t wl = mbstowcs(NULL, vs, 0); - - if ( wl > 0 ) - { wchar_t *ws = sgml_malloc((wl+1)*sizeof(wchar_t)); - mbstowcs(ws, vs, wl+1); - - return ws; - } - } - - return NULL; -} - - -static void -init_catalog() -{ static int done = FALSE; - - LOCK(); - if ( !done++ ) - { ichar *path = wgetenv("SGML_CATALOG_FILES"); - - if (!path) - { UNLOCK(); - return; - } - - while (*path) - { ichar buf[MAXPATHLEN]; - ichar *s; - - if ((s = istrchr(path, L':'))) - { istrncpy(buf, path, s - path); - buf[s - path] = '\0'; - path = s + 1; - if ( buf[0] ) /* skip empty entries */ - register_catalog_file_unlocked(buf, CTL_START); - } else - { if ( path[0] ) /* skip empty entries */ - register_catalog_file_unlocked(path, CTL_START); - break; - } - } - } - UNLOCK(); -} - - -int -register_catalog_file(const ichar *file, catalog_location where) -{ int rc; - - init_catalog(); - - LOCK(); - rc = register_catalog_file_unlocked(file, where); - UNLOCK(); - - return rc; -} - - - /******************************* - * CATALOG FILE PARSING * - *******************************/ - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -The code from here to the end of this file was written by Richard -O'Keefe and modified by Jan Wielemaker to fit in with the rest of the -parser. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -#include <ctype.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -/* OVERRIDE YES/NO - sets a boolean flag initialised to NO. - The value of this flag is stored as part of each entry. - (PUBLIC|DOCTYPE|ENTITY)&YES will match whether a system identifier - was provided in the source document or not; - (PUBLIC|DOCTYPE|ENTITY)&NO will only match if a system identifier - was not provided. -*/ - -/* catalogue = - ( PUBLIC pubid filename - | SYSTEM sysid filename - | DOCTYPE name filename - | ENTITY name filename - | OVERRIDE YES - | OVERRIDE NO - | BASE filename - | junk - )* -*/ - - -/* Keywords are matched ignoring case. */ - -static int -ci_streql(ichar const *a, ichar const *b) -{ return istrcaseeq(a, b); -} - -/* Names may be matched heading case in XML. */ - -static int -cs_streql(ichar const *a, ichar const *b) -{ return istreq(a, b); -} - -/* Any other word or any quoted string is reported as CAT_OTHER. - When we are not looking for the beginning of an entry, the only - positive outcome is CAT_OTHER. -*/ - -static int -scan_overflow(size_t buflen) -{ gripe(NULL, ERC_REPRESENTATION, L"token length"); - - return EOF; -} - -static int -scan(FILE* src, ichar *buffer, size_t buflen, int kw_expected) -{ int c, q; - ichar *p = buffer, *e = p + buflen - 1; - - for (;;) - { c = getc(src); - if (c <= ' ') - { if (c < 0) - return EOF; - continue; - } - if (c == '-') - { c = getc(src); - if (c != '-') - { *p++ = '-'; - break; - } - for (;;) - { c = getc(src); - if (c < 0) - return EOF; - if (c == '-') - { c = getc(src); - if (c < 0) - return EOF; - if (c == '-') - break; - } - } - continue; - } - if (c == '"' || c == '\'') - { q = c; - for (;;) - { c = getc(src); - if (c < 0) - return EOF; - if (c == q) - { *p = '\0'; - return CAT_OTHER; - } - if (p == e) - return scan_overflow(buflen); - *p++ = c; - } - } - break; - } - /* We reach here if there is an unquoted token. */ - /* Don't try "PUBLIC--well/sortof--'foo' 'bar'" */ - /* because hyphens are allowed in unquoted words */ - /* and so are slashes and a bunch of other stuff. */ - /* To keep this code simple, an unquoted token */ - /* ends at EOF, ', ", or layout. */ - while (c > ' ' && c != '"' && c != '\'') - { if (p == e) - return scan_overflow(buflen); - *p++ = c; - c = getc(src); - } - *p = '\0'; - if (kw_expected) - { if (ci_streql(buffer, L"public")) - return CAT_PUBLIC; - if (ci_streql(buffer, L"system")) - return CAT_SYSTEM; - if (ci_streql(buffer, L"entity")) - return CAT_ENTITY; - if (ci_streql(buffer, L"doctype")) - return CAT_DOCTYPE; - if (ci_streql(buffer, L"override")) - return CAT_OVERRIDE; - if (ci_streql(buffer, L"base")) - return CAT_BASE; - } - return CAT_OTHER; -} - -/* The strings can represent names (taken verbatim), - system identifiers (ditto), or public identifiers (squished). - We need to squish, and we need to copy. When it comes to - squishing, we don't need to worry about Unicode spaces, - because public identifiers aren't allow to have any characters - that aren't in ASCII. -*/ - -static void -squish(ichar *pubid) -{ ichar const *s = (ichar const *) pubid; - ichar *d = (ichar *) pubid; - ichar c; - int w; - - w = 1; - while ((c = *s++) != '\0') - { if (c <= ' ') - { if (!w) - *d++ = ' ', w = 1; - } else - { *d++ = c, w = 0; - } - } - if (w && d != (ichar *) pubid) - d--; - *d = '\0'; -} - -/* We represent a catalogue internally by a list of - (CAT_xxx, string, string) - triples. -*/ - -static void -load_one_catalogue(catalog_file * file) -{ FILE *src = wfopen(file->file, "r"); - ichar buffer[2 * FILENAME_MAX]; - ichar base[2 * FILENAME_MAX]; - ichar *p; - int t; - catalogue_item_ptr this_item; - int override = 0; - - if ( !src ) - { gripe(NULL, ERC_NO_CATALOGUE, file->file); - return; - } - - (void) istrcpy(base, file->file); - p = base + istrlen(base); - while (p != base && !isDirSep(p[-1])) - p--; - - for (;;) - { t = scan(src, buffer, sizeof(buffer), 1); - switch (t) - { case CAT_BASE: - if (scan(src, buffer, sizeof(buffer), 0) == EOF) - break; - (void) istrcpy(base, buffer); - p = base + istrlen(base); - if (p != base && !isDirSep(p[-1])) - *p++ = '/'; - continue; - case CAT_OVERRIDE: - if (scan(src, buffer, sizeof(buffer), 0) == EOF) - break; - override = towlower(buffer[0]) == 'y' ? CAT_OVERRIDE : 0; - continue; - case CAT_PUBLIC: - case CAT_SYSTEM: - case CAT_ENTITY: - case CAT_DOCTYPE: - this_item = sgml_malloc(sizeof *this_item); - if (scan(src, buffer, sizeof buffer, 0) == EOF) - break; - if (t == CAT_PUBLIC) - squish(buffer); - this_item->next = 0; - this_item->kind = t == CAT_SYSTEM ? t : t + override; - this_item->target = istrdup(buffer); - - if (scan(src, buffer, sizeof buffer, 0) == EOF) - break; - - if (is_absolute_path(buffer) || p == base) - { this_item->replacement = istrdup(buffer); - } else - { (void) istrcpy(p, buffer); - this_item->replacement = istrdup(base); - } - - if (file->first_item == 0) - { file->first_item = this_item; - } else - { file->last_item->next = this_item; - } - - file->last_item = this_item; - continue; - case EOF: - break; - default: - continue; - } - break; - } - - fclose(src); -} - - -/* To look up a DTD: - f = find_in_catalogue(CAT_DOCTYPE, name, pubid, sysid, ci); - If it cannot otherwise be found and name is not null, - ${name}.dtd will be returned. - - To look up a parameter entity: - f = find_in_catalogue(CAT_PENTITY, name, pubid, sysid, ci); - The name may begin with a % but need not; if it doesn't - a % will be prefixed for the search. - If it cannot otherwise be found ${name}.pen will be returned. - - To look up an ordinary entity: - f = find_in_catalogue(CAT_ENTITY, name, pubid, sysid, ci); - If the name begins with a % this is just like a CAT_PENTITY search. - If it cannot otherwise be found %{name}.ent will be returned. - - The full catalogue format allows for NOTATION (which we still need - for XML), SGMLDECL, DTDDECL, and LINKTYPE. At the moment, only - notation is plausible. To handle such things, - f = find_in_catalogue(CAT_OTHER, name, pubid, sysid, ci); - If it cannot be found, NULL is returned. - - The name, pubid, and sysid may each be NULL. It doesn't really - make sense for them all to be NULL. - - For SGML, name matching (DOCTYPE, ENTITY) should normally ignore - alphabetic case. Pass ci=1 to make this happen. For XML, name - matching must heed alphabetic case. Pass ci=0 to make that happen. - - A CAT_DOCTYPE, CAT_ENTITY, or CAT_PENTITY search doesn't really make - sense withint a name, so if the name should happen to be 0, the search - kind is converted to CAT_OTHER. -*/ - -ichar const * -find_in_catalogue(int kind, - ichar const *name, - ichar const *pubid, ichar const *sysid, int ci) -{ ichar penname[FILENAME_MAX]; - const size_t penlen = sizeof(penname)/sizeof(ichar); - catalogue_item_ptr item; - ichar const *result; - catalog_file *catfile; - - init_catalog(); - - if ( name == 0 ) - { kind = CAT_OTHER; - } else - { switch (kind) - { case CAT_OTHER: - case CAT_DOCTYPE: - break; - case CAT_PENTITY: - if (name[0] != '%') - { penname[0] = '%'; - (void) istrcpy(penname + 1, name); - name = penname; - } - break; - case CAT_ENTITY: - if (name[0] == '%') - { kind = CAT_PENTITY; - } - break; - default: - return 0; - } - } - - result = 0; - for (catfile = catalog;; catfile = catfile->next) - { if (catfile) - { if (!catfile->loaded) - { load_one_catalogue(catfile); - catfile->loaded = TRUE; - } - item = catfile->first_item; - } else - item = first_item; - - for (; item != 0; item = item->next) - { switch (item->kind) - { case CAT_PUBLIC: - if (sysid != 0) - break; - /*FALLTHROUGH*/ - case OVR_PUBLIC: - if (pubid != 0 && result == 0 && cs_streql(pubid, item->target)) - result = item->replacement; - break; - case CAT_SYSTEM: - if (sysid != 0 && cs_streql(sysid, item->target)) - return item->replacement; - break; - case CAT_DOCTYPE: - if (sysid != 0) - break; - /*FALLTHROUGH*/ - case OVR_DOCTYPE: - if (name != 0 && kind == CAT_DOCTYPE && result == 0 - && (ci ? ci_streql : cs_streql) (name, item->target)) - result = item->replacement; - break; - case CAT_ENTITY: - if (sysid != 0) - break; - /*FALLTHROUGH*/ case OVR_ENTITY: - if (name != 0 && kind >= CAT_ENTITY && result == 0 - && (ci ? ci_streql : cs_streql) (name, item->target)) - result = item->replacement; - break; - default: - break; - } - } - - if (!catfile) - break; - } - if ( result != 0 ) - return result; - if ( sysid != 0 ) - return sysid; - if ( kind == CAT_OTHER || kind == CAT_DOCTYPE ) - return 0; - - if ( istrlen(name)+4+1 > penlen ) - { gripe(NULL, ERC_REPRESENTATION, L"entity name"); - return NULL; - } - - item = sgml_malloc(sizeof(*item)); - item->next = 0; - item->kind = kind; - item->target = istrdup(name); - - switch (kind) - { case CAT_DOCTYPE: - (void) swprintf(penname, penlen, L"%ls.dtd", name); - break; - case CAT_PENTITY: - item->kind = CAT_ENTITY; - (void) swprintf(penname, penlen, L"%ls.pen", name + 1); - break; - case CAT_ENTITY: - (void) swprintf(penname, penlen, L"%ls.ent", name); - break; - default: - abort(); - } - - item->replacement = istrdup(penname); - if (first_item == 0) - { first_item = item; - } else - { last_item->next = item; - } - last_item = item; - - return item->replacement; -} - diff --git a/packages/sgml/catalog.h b/packages/sgml/catalog.h deleted file mode 100644 index f85deb184..000000000 --- a/packages/sgml/catalog.h +++ /dev/null @@ -1,64 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog - - Author: Jan Wielemaker - E-mail: jan@swi.psy.uva.nl - WWW: http://www.swi-prolog.org - Copyright (C): 1985-2002, University of Amsterdam - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef CATALOG_H_INCLUDED -#define CATALOG_H_INCLUDED -#include "util.h" - -/* When we look for a token, we skip layout characters and comments. - There there is nothing left, we return EOF. - If we are looking for the beginning of an entry, the possibilities - are then -*/ - -#define CAT_OTHER (0) /* token + parameter of find... */ -#define CAT_SYSTEM (1) /* token only */ -#define CAT_PUBLIC (2) /* token only */ -#define CAT_DOCTYPE (3) /* token + parameter of find... */ -#define CAT_ENTITY (4) /* token + parameter of find... */ -#define CAT_PENTITY (5) /* parameter of find... only */ -#define CAT_OVERRIDE (5) /* token only */ -#define CAT_BASE (6) /* token only */ -#define OVR_PUBLIC (CAT_OVERRIDE + CAT_PUBLIC) -#define OVR_DOCTYPE (CAT_OVERRIDE + CAT_DOCTYPE) -#define OVR_ENTITY (CAT_OVERRIDE + CAT_ENTITY) - - -typedef enum -{ CTL_START, - CTL_END -} catalog_location; - -int register_catalog_file(const ichar *file, catalog_location where); -int is_absolute_path(const ichar *iname); -ichar *localpath(const ichar *ref, const ichar *name); -ichar const *find_in_catalogue( - int kind, - ichar const *name, - ichar const *pubid, - ichar const *sysid, - int ci -); - -#endif /*CATALOG_H_INCLUDED*/ diff --git a/packages/sgml/charmap.c b/packages/sgml/charmap.c deleted file mode 100644 index eaab5db44..000000000 --- a/packages/sgml/charmap.c +++ /dev/null @@ -1,104 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog - - Author: Jan Wielemaker - E-mail: jan@swi.psy.uva.nl - WWW: http://www.swi-prolog.org - Copyright (C): 1985-2002, University of Amsterdam - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include <stdio.h> -#include <stdlib.h> -#include "dtd.h" - -static void -char_range(dtd_charclass *map, int from, int to, int msk) -{ unsigned char *ca; - int i; - - for(i=from, ca=map->class+i; i++<=to; ) - *ca++ |= msk; -} - - -dtd_charclass * -new_charclass() -{ dtd_charclass *map = sgml_calloc(1, sizeof(*map)); - unsigned char *ca = map->class; - - char_range(map, 'a', 'z', CH_LCLETTER); - char_range(map, 'A', 'Z', CH_LCLETTER); - char_range(map, '0', '9', CH_DIGIT); - - ca['.'] |= CH_CNM; - ca['-'] |= CH_CNM; - ca[183] |= CH_CNM; /* XML */ - ca[':'] |= CH_CNMSTRT; /* HTML and XML */ - ca['_'] |= CH_CNMSTRT; /* HTML and XML */ - - char_range(map, 192, 214, CH_CNMSTRT); /* XML ISO-LATIN-1 accented chars */ - char_range(map, 216, 246, CH_CNMSTRT); - char_range(map, 248, 255, CH_CNMSTRT); - - ca['\t'] |= CH_WHITE; - ca[' '] |= CH_WHITE; - ca['\r'] |= CH_RE; - ca['\n'] |= CH_RS; - - return map; -} - - -dtd_charfunc * -new_charfunc() -{ dtd_charfunc *f = sgml_calloc(1, sizeof(*f)); - ichar *cf = f->func; - - cf[CF_STAGO] = '<'; - cf[CF_STAGC] = '>'; - cf[CF_ETAGO1] = '<'; - cf[CF_ETAGO2] = '/'; - cf[CF_VI] = '='; - cf[CF_NS] = ':'; - cf[CF_LIT] = '"'; - cf[CF_LITA] = '\''; - cf[CF_PERO] = '%'; - cf[CF_ERO] = '&'; - cf[CF_ERC] = ';'; - cf[CF_MDO1] = '<'; - cf[CF_MDO2] = '!'; - cf[CF_MDC] = '>'; - cf[CF_PRO1] = '<'; - cf[CF_PRO2] = '?'; - cf[CF_PRC] = '>'; - cf[CF_GRPO] = '('; - cf[CF_GRPC] = ')'; - cf[CF_SEQ] = ','; - cf[CF_AND] = '&'; - cf[CF_OR] = '|'; - cf[CF_OPT] = '?'; - cf[CF_PLUS] = '+'; - cf[CF_DSO] = '['; - cf[CF_DSC] = ']'; - cf[CF_REP] = '*'; - cf[CF_RS] = '\n'; - cf[CF_RE] = '\r'; - cf[CF_CMT] = '-'; - - return f; -} diff --git a/packages/sgml/configure.in b/packages/sgml/configure.in deleted file mode 100644 index c383e3835..000000000 --- a/packages/sgml/configure.in +++ /dev/null @@ -1,114 +0,0 @@ -dnl Process this file with autoconf to produce a configure script. - -AC_INIT(install-sh) -AC_PREREQ([2.50]) -AC_CONFIG_HEADER(config.h) - -AC_ARG_WITH(prolog, - [ --with-prolog=PLBINARY use given SWI Prolog binary]) - -AC_SUBST(PL) -AC_SUBST(LD) -AC_SUBST(PLLD) -AC_SUBST(PLLIBS) -AC_SUBST(PLBASE) -AC_SUBST(PLARCH) -AC_SUBST(PLINCL) -AC_SUBST(COFLAGS) -AC_SUBST(CWFLAGS) -AC_SUBST(CMFLAGS) -AC_SUBST(ETAGS) -AC_SUBST(SO) -AC_SUBST(LDSOFLAGS) -AC_SUBST(RUNTEX) - -AC_ARG_ENABLE(mt, [ --enable-mt Enable Multi-threading], - [case "$enableval" in - yes) MT=yes - ;; - *) ;; - esac]) - -AC_PROG_CC -LD=$CC - -# Do not cache this, it changes too often in many configurations -unset ac_cv_prog_PL - -if test -z "$PLINCL"; then -plcandidates="$with_prolog swi-prolog swipl pl" -AC_CHECK_PROGS(PL, $plcandidates, "none") -AC_CHECK_PROGS(PLLD, plld, "none") -if test $PLLD = "none"; then - AC_ERROR("Cannot find SWI-Prolog plld utility. SWI-Prolog must be installed first") -fi -if test $PL = "none"; then - AC_ERROR("Cannot find SWI-Prolog. SWI-Prolog must be installed first") -else - AC_CHECKING("Running $PL -dump-runtime-variables") - eval `$PL -dump-runtime-variables` -fi -PLINCL="$PLBASE/include" -AC_MSG_RESULT(" PLBASE=$PLBASE") -AC_MSG_RESULT(" PLARCH=$PLARCH") -AC_MSG_RESULT(" PLLIBS=$PLLIBS") -AC_MSG_RESULT(" PLLDFLAGS=$PLLDFLAGS") -AC_MSG_RESULT(" PLSHARED=$PLSHARED") -if test "$PLTHREADS" = yes; then MT=yes; fi -else -PLLD=../plld.sh -PL=../pl.sh -fi - -if test "$MT" = yes; then - AC_DEFINE([_REENTRANT], 1, - [Define for multi-threaded version]) -fi - -CC=$PLLD -LD=$PLLD -LDSOFLAGS=-shared -CMFLAGS=-fpic -SO="$PLSOEXT" - -if test ! -z "$GCC"; then - COFLAGS="${COFLAGS--O2 -fno-strict-aliasing}" - CWFLAGS="${CWFLAGS--Wall}" -else - COFLAGS="${COFLAGS--O}" -fi - -case "$PLARCH" in - *irix*) if test -z "$GCC"; then - CWFLAGS="$CWFLAGS -woff 1164" - fi - ;; - *darwin*) CMFLAGS="$CMFLAGS -cc-options,-no-cpp-precomp" - ;; - *) ;; -esac - -AC_CHECK_PROGS(MAKE, gmake make, "make") -AC_MSG_CHECKING("whether make is GNU-make") -if ($MAKE -v 2>&1) | grep GNU > /dev/null; then - AC_MSG_RESULT(yes) - gmake=yes -else - VPATH="VPATH = " - gmake=no -fi -AC_CHECK_PROGS(ETAGS, etags ctags, ":") -AC_CHECK_PROGS(RUNTEX, runtex, ":") -AC_PROG_INSTALL -AC_PROG_CPP -AC_ISC_POSIX -AC_HEADER_STDC -CFLAGS="$CMFLAGS" -AC_C_BIGENDIAN -AC_C_INLINE -AC_CHECK_SIZEOF(long, 4) - -AC_CHECK_HEADERS(malloc.h unistd.h sys/time.h fcntl.h floatingpoint.h) -AC_CHECK_FUNCS(snprintf strerror strtoll) - -AC_OUTPUT(Makefile) diff --git a/packages/sgml/dtd.h b/packages/sgml/dtd.h deleted file mode 100644 index 46ddca482..000000000 --- a/packages/sgml/dtd.h +++ /dev/null @@ -1,481 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog - - Author: Jan Wielemaker - E-mail: jan@swi.psy.uva.nl - WWW: http://www.swi-prolog.org - Copyright (C): 1985-2002, University of Amsterdam - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef DTD_H_INCLUDED -#define DTD_H_INCLUDED -#include "sgmldefs.h" - -#define CH_WHITE 0x0001 -#define CH_LCLETTER 0x0002 -#define CH_UCLETTER 0x0004 -#define CH_CNMSTRT 0x0008 /* may start a name */ -#define CH_CNM 0x0010 /* may be in a name */ -#define CH_DIGIT 0x0020 -#define CH_RE 0x0040 -#define CH_RS 0x0080 - -#define CH_LETTER (CH_LCLETTER|CH_UCLETTER) -#define CH_NMSTART (CH_LCLETTER|CH_UCLETTER|CH_CNMSTRT) -#define CH_NAME (CH_NMSTART|CH_DIGIT|CH_CNM) -#define CH_BLANK (CH_WHITE|CH_RE|CH_RS) - -#define CHR_BLANK 0x1 /* SHORTREF 'B' */ -#define CHR_DBLANK 0x2 /* SHORTREF 'BB' */ - -#define SGML_DTD_MAGIC 0x7364573 - -typedef enum -{ CF_STAGO = 0, /* < */ - CF_STAGC, /* > */ - CF_ETAGO1, /* < */ - CF_ETAGO2, /* / */ - CF_VI, /* = */ - CF_NS, /* : (XMLNS) */ - CF_LIT, /* " */ - CF_LITA, /* ' */ - CF_PERO, /* % */ - CF_ERO, /* & */ - CF_ERC, /* ; */ - CF_MDO1, /* < */ - CF_MDO2, /* ! (MDO=<!) */ - CF_MDC, /* > */ - CF_PRO1, /* < */ - CF_PRO2, /* ? (PRO=<?) */ - CF_PRC, /* > */ - CF_GRPO, /* ( */ - CF_GRPC, /* ) */ - CF_SEQ, /* , */ - CF_AND, /* & */ - CF_OR, /* | */ - CF_OPT, /* ? */ - CF_PLUS, /* + */ - CF_DSO, /* [ */ - CF_DSC, /* ] */ - CF_REP, /* * */ - CF_RS, /* \n */ - CF_RE, /* \r */ - CF_CMT, /* - */ - CF_NG, /* , or & or | */ - CF_ENDTABLE /* to find size */ -} charfunc; /* function of characters */ - -typedef enum -{ SGML_ENC_ISO_LATIN1 = 0, /* ISO Latin-1 */ - SGML_ENC_UTF8 /* Multi-byte UTF-8 encoding */ -} dtd_char_encoding; - -typedef enum -{ C_CDATA, /* pure cdata */ - C_PCDATA, /* parsed character data */ - C_RCDATA, /* pure cdata + entities */ - C_EMPTY, /* empy element */ - C_ANY /* element may contain anything */ -} contenttype; - -typedef enum -{ MC_ONE, /* one time */ - MC_OPT, /* optional element (?) */ - MC_REP, /* any times (*) */ - MC_PLUS /* one-or-more (+) */ -} modelcard; - -typedef enum -{ MT_UNDEF = 0, /* undefined */ - MT_PCDATA, /* Contains PCDATA */ - MT_ELEMENT, /* refers to element */ - MT_SEQ, /* Sequence (,) */ - MT_AND, /* Ony order (&) */ - MT_OR /* Disjunction (|) */ -} modeltype; - -typedef enum -{ AT_CDATA, /* CDATA attribute */ - AT_ENTITY, /* entity-name */ - AT_ENTITIES, /* entity-name list */ - AT_ID, /* identifier */ - AT_IDREF, /* identifier reference */ - AT_IDREFS, /* list of identifier references */ - AT_NAME, /* name token */ - AT_NAMES, /* list of names */ - AT_NAMEOF, /* one of these names */ - AT_NMTOKEN, /* name-token */ - AT_NMTOKENS, /* name-token list */ - AT_NOTATION, /* notation-name */ - AT_NUMBER, /* number */ - AT_NUMBERS, /* number list */ - AT_NUTOKEN, /* number token */ - AT_NUTOKENS /* number token list */ -} attrtype; - -typedef enum -{ AT_FIXED, /* fixed value */ - AT_REQUIRED, /* Required attribute */ - AT_CURRENT, /* most recent value */ - AT_CONREF, /* cross-reference */ - AT_IMPLIED, /* Implied attribute */ - AT_DEFAULT /* has default */ -} attrdef; - - -typedef enum -{ ET_SYSTEM, /* System (file) entity */ - ET_PUBLIC, /* Public (external) entity */ - ET_LITERAL /* Literal text */ -} entity_type; - - -typedef enum -{ EC_SGML, /* SGML data */ - EC_STARTTAG, /* SGML start-tag */ - EC_ENDTAG, /* SGML end-tag */ - EC_CDATA, /* CDATA entity */ - EC_SDATA, /* SDATA entity */ - EC_NDATA, /* non-sgml data */ - EC_PI /* Programming instruction */ -} data_type; - - -typedef enum -{ DL_SGML, /* Use SGML */ - DL_XML, /* Use XML */ - DL_XMLNS /* Use XML + Namespaces */ -} dtd_dialect; - - -typedef enum -{ OPT_SHORTTAG /* do/don't accept shorttag */ -} dtd_option; - - -typedef enum -{ SP_PRESERVE = 0, /* Preserve all white-space */ - SP_DEFAULT, /* Default space handling */ - SP_REMOVE, /* Remove all blank CDATA elements */ - SP_SGML, /* Compliant SGML mode */ - SP_INHERIT /* DTD: inherit from environment */ -} dtd_space_mode; - - -typedef enum -{ NU_TOKEN, /* Treat numbers as tokens */ - NU_INTEGER /* Convert to integer */ -} dtd_number_mode; - - - /******************************* - * ERRORS * - *******************************/ - -#ifdef DTD_IMPLEMENTATION -#define DTD_MINOR_ERRORS 1 -#endif - -typedef enum -{ ERS_WARNING, /* probably correct result */ - ERS_ERROR, /* probably incrorrect result */ - ERS_STYLE /* dubious/bad style; correct result */ -} dtd_error_severity; - - -typedef enum -{ ERC_REPRESENTATION, /* Internal limit */ - /* id */ - ERC_RESOURCE, /* external limit */ - /* id */ - ERC_LIMIT, /* Exceeded SGML limit */ - /* id */ - ERC_VALIDATE, /* DTD Validation */ - /* Message */ - ERC_SYNTAX_ERROR, /* Syntax error */ - /* Message, found */ - ERC_EXISTENCE, /* Existence error */ - /* Type, name */ - ERC_REDEFINED /* Redefined object */ - /* Type, name */ -#ifdef DTD_MINOR_ERRORS - , /* reopen list */ - ERC_SYNTAX_WARNING, /* Syntax warning (i.e. fixed) */ - /* Message, found */ - ERC_DOMAIN, /* Relative to declared type */ - /* Type, found */ - ERC_OMITTED_CLOSE, - /* Element */ - ERC_OMITTED_OPEN, - /* Element */ - ERC_NOT_OPEN, - /* Element */ - ERC_NOT_ALLOWED, - /* Element */ - ERC_NOT_ALLOWED_PCDATA, - /* Text */ - ERC_NO_ATTRIBUTE, - /* Element, Attribute */ - ERC_NO_ATTRIBUTE_VALUE, - /* Element, Value */ - ERC_NO_VALUE, - /* Entity */ - ERC_NO_DOCTYPE, - /* Implicit, file */ - ERC_NO_CATALOGUE - /* file */ -#endif -} dtd_error_id; - - -typedef enum -{ IN_NONE, /* unspecified input */ - IN_FILE, /* input from file */ - IN_ENTITY /* input from entity */ -} input_type; - - -typedef struct _dtd_srcloc -{ input_type type; /* type of input */ - union - { const ichar *file; /* name of the file */ - const ichar *entity; /* name of entity */ - } name; - int line; /* 1-based Line no */ - int linepos; /* 1-based char */ - long charpos; /* 0-based file char */ - struct _dtd_srcloc *parent; /* parent location */ -} dtd_srcloc; - - -typedef struct _dtd_error -{ dtd_error_id id; /* ERC_* identifier */ - dtd_error_id minor; /* Minor code */ - dtd_error_severity severity; /* ERS_* severity */ - dtd_srcloc *location; /* location of the error */ - wchar_t *plain_message; /* Clean message */ - wchar_t *message; /* complete message */ - /* (Warning: file:line: <plain>) */ - wchar_t *argv[2]; /* context arguments */ -} dtd_error; - - - /******************************* - * DTD TYPES * - *******************************/ - -typedef struct _dtd_symbol -{ const ichar *name; /* name of the atom */ - struct _dtd_symbol *next; /* next in atom list */ - struct _dtd_element *element; /* connected element (if any) */ - struct _dtd_entity *entity; /* connected entity (if any) */ -} dtd_symbol; - - -typedef struct _dtd_symbol_table -{ int size; /* Allocated size */ - dtd_symbol **entries; /* Entries */ -} dtd_symbol_table; - - -typedef struct _dtd_entity -{ dtd_symbol *name; /* its name */ - entity_type type; /* ET_* */ - data_type content; /* EC_* */ - int catalog_location; /* what catalog to use for lookup */ - int length; /* size of literal value */ - ichar *value; /* literal value */ - ichar *extid; /* external identifier */ - ichar *exturl; /* url to fetch from */ - ichar *baseurl; /* base url for exturl */ - struct _dtd_entity *next; /* list-link */ -} dtd_entity; - - -typedef struct _dtd_notation -{ dtd_symbol *name; /* name of the notation */ - entity_type type; /* ET_{PUBLIC|SYSTEM} */ - ichar *public; /* public id */ - ichar *system; /* file with info */ - struct _dtd_notation *next; /* list-link */ -} dtd_notation; - - -typedef struct _dtd_element_list -{ struct _dtd_element *value; /* element */ - struct _dtd_element_list *next; /* next in list */ -} dtd_element_list; - - -typedef struct _dtd_name_list -{ dtd_symbol *value; - struct _dtd_name_list *next; -} dtd_name_list; - - -typedef struct _dtd_attr -{ dtd_symbol *name; /* name of attribute */ - attrtype type; /* type (AT_*) */ - attrdef def; /* AT_REQUIRED/AT_IMPLIED */ - int islist; /* attribute is a list */ - union - { dtd_name_list *nameof; /* (name1|name2|...) */ - } typeex; - union - { ichar *cdata; /* default for CDATA */ - ichar *list; /* text for list-data */ - dtd_symbol *name; /* AT_NAME or AT_NAMEOF */ - long number; /* AT_NUMBER */ - } att_def; - int references; /* reference count */ -} dtd_attr; - - -typedef struct _dtd_attr_list -{ dtd_attr *attribute; - struct _dtd_attr_list *next; -} dtd_attr_list; - - -typedef struct _dtd_model -{ modeltype type; /* MT_* */ - modelcard cardinality; /* MC_* */ - - union - { struct _dtd_model *group; /* ,/|/& group */ - struct _dtd_element *element; /* element */ - } content; - struct _dtd_model *next; /* next in list (for groups) */ -} dtd_model; - - -typedef struct _dtd_edef -{ contenttype type; /* EMPTY, MIXED, ... */ - int omit_open; /* allow omitted open tag? */ - int omit_close; /* allow omitted close tag? */ - dtd_model *content; /* the content model */ - dtd_element_list *included; /* +(namegroup) */ - dtd_element_list *excluded; /* -(namegroup) */ - struct _dtd_state *initial_state; /* Initial state in state engine */ - struct _dtd_state *final_state; /* Final state in state engine */ - int references; /* #elements using this def */ -} dtd_edef; - - -typedef struct _dtd_map -{ ichar *from; /* mapped text */ - int len; /* length of mapped text */ - dtd_symbol *to; /* name of symbol mapped onto */ - struct _dtd_map *next; /* next in shortref map */ -} dtd_map; - - -typedef struct _dtd_shortref -{ dtd_symbol *name; /* name of SHORTREF map */ - dtd_map *map; /* implemented map */ - char ends[SHORTMAP_SIZE]; /* ending-characters in map */ - int defined; /* has been defined */ - struct _dtd_shortref *next; /* next declared shortref */ -} dtd_shortref; - - -typedef struct _dtd_element -{ dtd_symbol *name; /* its name */ - dtd_edef *structure; /* content structure of the element */ - dtd_attr_list *attributes; /* defined attributes */ - dtd_space_mode space_mode; /* How to handle white-space (SP_*) */ - dtd_shortref *map; /* SHORTREF map */ - int undefined; /* Only implicitely defined */ - struct _dtd_element *next; /* in DTD'e element list */ -} dtd_element; - - -typedef struct _dtd_charclass -{ unsigned char class[INPUT_CHARSET_SIZE]; /* ichar --> class-mask */ -} dtd_charclass; - - -typedef struct _dtd_charfunc -{ ichar func[(int)CF_ENDTABLE]; /* CF_ --> ichar */ -} dtd_charfunc; - - -typedef struct _dtd -{ int magic; /* SGML_DTD_MAGIC */ - int implicit; /* There is no DTD */ - dtd_dialect dialect; /* DL_* */ - int case_sensitive; /* Tags are case-sensitive */ - int ent_case_sensitive; /* Entities are case-sensitive */ - ichar *doctype; /* defined document type */ - dtd_symbol_table *symbols; /* symbol-table */ - dtd_entity *pentities; /* defined parameter entities */ - dtd_entity *entities; /* defined entities */ - dtd_entity *default_entity; /* default-entity (if any) */ - dtd_notation *notations; /* Declared notations */ - dtd_shortref *shortrefs; /* SHORTREF declarations */ - dtd_element *elements; /* defined elements */ - dtd_charfunc *charfunc; /* CF_ --> ichar */ - dtd_charclass *charclass; /* ichar -> CH_-mask */ - dtd_char_encoding encoding; /* document encoding */ - dtd_space_mode space_mode; /* Default for handling white-space */ - dtd_number_mode number_mode; /* How to treat number attributes */ - int shorttag; /* support SHORTTAG */ - int references; /* destruction reference count */ -} dtd; - -extern dtd_charfunc *new_charfunc(void); /* default classification */ -extern dtd_charclass *new_charclass(void); /* default classification */ - -extern dtd_symbol* dtd_find_symbol(dtd *dtd, const ichar *name); -extern dtd_symbol* dtd_add_symbol(dtd *dtd, const ichar *name); - - - /******************************* - * PUBLIC * - *******************************/ - -#include "parser.h" - -dtd * file_to_dtd(const ichar *file, const ichar *doctype, - dtd_dialect dialect); -int sgml_process_file(dtd_parser *p, - const ichar *file, unsigned flags); -int sgml_process_stream(dtd_parser *p, FILE *in, - unsigned flags); -dtd_parser * new_dtd_parser(dtd *dtd); -void free_dtd_parser(dtd_parser *p); - -void free_dtd(dtd *dtd); -int load_dtd_from_file(dtd_parser *p, const ichar *file); -dtd * new_dtd(const ichar *doctype); -int set_dialect_dtd(dtd *dtd, dtd_dialect dialect); -int set_option_dtd(dtd *dtd, dtd_option option, int set); - -int putchar_dtd_parser(dtd_parser *p, int chr); -int begin_document_dtd_parser(dtd_parser *p); -int end_document_dtd_parser(dtd_parser *p); -void reset_document_dtd_parser(dtd_parser *p); -void set_file_dtd_parser(dtd_parser *p, - input_type in, const ichar *file); -void set_mode_dtd_parser(dtd_parser *p, data_mode mode); -void sgml_cplocation(dtd_srcloc *dst, dtd_srcloc *src); -int xml_set_encoding(dtd_parser *p, const char *enc); - -#endif /*DTD_H_INCLUDED*/ - - diff --git a/packages/sgml/dtd2pl.1 b/packages/sgml/dtd2pl.1 deleted file mode 100644 index 9e18f966f..000000000 --- a/packages/sgml/dtd2pl.1 +++ /dev/null @@ -1,51 +0,0 @@ -.TH SWI 1 "March 8, 2000" -.SH NAME -dtd2pl \- Convert SGML DTD files to Prolog -.SH SYNOPSIS -.BR dtd2pl -.I "dtd-file" -.br -.SH DESCRIPTION -The Program -.BI dtd2pl -Provides a crude translation of an SGML DTD files into a Prolog database. -Curently a DTD is translated into a Prolog -.B module -named -.IR "<doctype>_dtd" "." -This module does no export any predicates. The DTD is represented using -the following predicates. - -.SH Predicates -.TP -.BI "element(" "Name," " omit(" "Open, Close" ")," " Content" ")" -.TP -.BI "include(" "Element, Included" ")" -.TP -.BI "exclude(" "Element, Excluded" ")" -.TP -.BI "attribute(" "Element, Name, Type, Default" ")" - -.SH ENVIRONMENT - -.TP -.BI "SGML_CATALOG_FILES " "file" ":" "file ..." -Catalog files are used to resolve -.B PUBLIC -identifiers of external -.B entities. - -.SH BUGS -Lacks many options to tailor the output to a specific needs. - -.SH AUTHOR -Jan Wielemaker, SWI, University of Amsterdam - -.SH "SEE ALSO" -.I pl(1) plld(1) -.I SWI-Prolog 3.1 Reference Manual, -University of Amsterdam, Dept. of Social Science and Informatics (SWI). -.SH COPYRIGHT -Copyright (C) 1991-1998, Jan Wielemaker -.SH AUTHOR -Jan Wielemaker diff --git a/packages/sgml/dtd2pl.c b/packages/sgml/dtd2pl.c deleted file mode 100644 index f435f95c1..000000000 --- a/packages/sgml/dtd2pl.c +++ /dev/null @@ -1,94 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog - - Author: Jan Wielemaker - E-mail: jan@swi.psy.uva.nl - WWW: http://www.swi-prolog.org - Copyright (C): 1985-2002, University of Amsterdam - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <wchar.h> -#include "dtd.h" -#include "util.h" -#include "prolog.h" - -#define streq(s,q) strcmp((s), (q)) == 0 - -char *program; - -static void -usage() -{ fprintf(stderr, "Usage: %s [-xml|sgml] file.dtd\n", program); -} - -int -main(int argc, char **argv) -{ dtd_dialect dialect = DL_SGML; - - init_ring(); - - program = argv[0]; - argv++; - argc--; - - while(argc > 0 && argv[0][0] == '-') - { if ( streq(argv[0], "-xml") ) - { dialect = DL_XML; - argc--; - argv++; - } else if ( streq(argv[0], "-sgml") ) - { dialect = DL_SGML; - argc--; - argv++; - } else - { usage(); - exit(1); - } - } - - if ( argc == 1 ) - { int wl = mbstowcs(NULL, argv[0], 0); - - if ( wl > 0 ) - { wchar_t *ws = malloc((wl+1)*sizeof(wchar_t)); - dtd *dtd; - - mbstowcs(ws, argv[0], wl+1); - dtd = file_to_dtd(ws, L"test", dialect); - - if ( dtd ) - { prolog_print_dtd(dtd, PL_PRINT_ALL & ~PL_PRINT_PENTITIES); - return 0; - } - } else - { perror("mbstowcs"); - exit(1); - } - } - - usage(); - return 1; -} - - - - - diff --git a/packages/sgml/error.c b/packages/sgml/error.c deleted file mode 100644 index 3f61e29cf..000000000 --- a/packages/sgml/error.c +++ /dev/null @@ -1,185 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog - - Author: Jan Wielemaker - E-mail: J.Wielemaker@cs.vu.nl - WWW: http://www.swi-prolog.org - Copyright (C): 1985-2009, University of Amsterdam - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include <SWI-Prolog.h> -#include <errno.h> -#include <stdlib.h> -#include "error.h" -#include <assert.h> -#include <string.h> -#include <stdio.h> - -int -sgml2pl_error(plerrorid id, ...) -{ int rc; - term_t except, formal, swi; - va_list args; - char msgbuf[1024]; - char *msg = NULL; - - if ( !(except = PL_new_term_ref()) || - !(formal = PL_new_term_ref()) || - !(swi = PL_new_term_ref()) ) - return FALSE; - - va_start(args, id); - switch(id) - { case ERR_ERRNO: - { int err = va_arg(args, int); - - msg = strerror(err); - - switch(err) - { case ENOMEM: - rc = PL_unify_term(formal, - PL_FUNCTOR_CHARS, "resource_error", 1, - PL_CHARS, "no_memory"); - break; - case EACCES: - { const char *file = va_arg(args, const char *); - const char *action = va_arg(args, const char *); - - rc = PL_unify_term(formal, - PL_FUNCTOR_CHARS, "permission_error", 3, - PL_CHARS, action, - PL_CHARS, "file", - PL_CHARS, file); - break; - } - case ENOENT: - { const char *file = va_arg(args, const char *); - - rc = PL_unify_term(formal, - PL_FUNCTOR_CHARS, "existence_error", 2, - PL_CHARS, "file", - PL_CHARS, file); - break; - } - default: - rc = PL_unify_atom_chars(formal, "system_error"); - break; - } - break; - } - case ERR_TYPE: - { const char *expected = va_arg(args, const char*); - term_t actual = va_arg(args, term_t); - - if ( PL_is_variable(actual) && - strcmp(expected, "variable") != 0 ) - rc = PL_unify_atom_chars(formal, "instantiation_error"); - else - rc = PL_unify_term(formal, - PL_FUNCTOR_CHARS, "type_error", 2, - PL_CHARS, expected, - PL_TERM, actual); - break; - } - case ERR_DOMAIN: - { const char *expected = va_arg(args, const char*); - term_t actual = va_arg(args, term_t); - - if ( PL_is_variable(actual) ) - rc = PL_unify_atom_chars(formal, "instantiation_error"); - else - rc = PL_unify_term(formal, - PL_FUNCTOR_CHARS, "domain_error", 2, - PL_CHARS, expected, - PL_TERM, actual); - break; - } - case ERR_EXISTENCE: - { const char *type = va_arg(args, const char *); - term_t obj = va_arg(args, term_t); - - rc = PL_unify_term(formal, - PL_FUNCTOR_CHARS, "existence_error", 2, - PL_CHARS, type, - PL_TERM, obj); - - break; - } - case ERR_FAIL: - { term_t goal = va_arg(args, term_t); - - rc = PL_unify_term(formal, - PL_FUNCTOR_CHARS, "goal_failed", 1, - PL_TERM, goal); - - break; - } - case ERR_LIMIT: - { const char *limit = va_arg(args, const char *); - long maxval = va_arg(args, long); - - rc = PL_unify_term(formal, - PL_FUNCTOR_CHARS, "limit_exceeded", 2, - PL_CHARS, limit, - PL_LONG, maxval); - - break; - } - case ERR_MISC: - { const char *id = va_arg(args, const char *); - const char *fmt = va_arg(args, const char *); - - vsprintf(msgbuf, fmt, args); - msg = msgbuf; - - rc = PL_unify_term(formal, - PL_FUNCTOR_CHARS, "miscellaneous", 1, - PL_CHARS, id); - break; - } - default: - assert(0); - } - va_end(args); - - if ( rc && msg ) - { term_t predterm = PL_new_term_ref(); - term_t msgterm = PL_new_term_ref(); - - if ( !(predterm = PL_new_term_ref()) || - !(msgterm = PL_new_term_ref()) || - !PL_put_atom_chars(msgterm, msg) || - !PL_unify_term(swi, - PL_FUNCTOR_CHARS, "context", 2, - PL_TERM, predterm, - PL_TERM, msgterm) ) - rc = FALSE; - } - - if ( rc ) - rc = PL_unify_term(except, - PL_FUNCTOR_CHARS, "error", 2, - PL_TERM, formal, - PL_TERM, swi); - - if ( rc ) - return PL_raise_exception(except); - - return FALSE; -} - diff --git a/packages/sgml/error.h b/packages/sgml/error.h deleted file mode 100644 index e3c2d23f9..000000000 --- a/packages/sgml/error.h +++ /dev/null @@ -1,46 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog - - Author: Jan Wielemaker - E-mail: jan@swi.psy.uva.nl - WWW: http://www.swi-prolog.org - Copyright (C): 1985-2002, University of Amsterdam - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef H_ERROR_INCLUDED -#define H_ERROR_INCLUDED -#include <stdarg.h> - -typedef enum -{ ERR_ERRNO, /* , int */ - /* ENOMEM */ - /* EACCES --> file, action */ - /* ENOENT --> file */ - ERR_TYPE, /* char *expected, term_t actual */ - ERR_DOMAIN, /* char *expected, term_t actual */ - ERR_EXISTENCE, /* char *expected, term_t actual */ - - ERR_FAIL, /* term_t goal */ - - ERR_LIMIT, /* char *limit, long max */ - ERR_MISC /* char *fmt, ... */ -} plerrorid; - -int sgml2pl_error(plerrorid, ...); - -#endif /*H_ERROR_INCLUDED*/ diff --git a/packages/sgml/install-sh b/packages/sgml/install-sh deleted file mode 100755 index ab74c882e..000000000 --- a/packages/sgml/install-sh +++ /dev/null @@ -1,238 +0,0 @@ -#!/bin/sh -# -# install - install a program, script, or datafile -# This comes from X11R5. -# -# Calling this script install-sh is preferred over install.sh, to prevent -# `make' implicit rules from creating a file called install from it -# when there is no Makefile. -# -# This script is compatible with the BSD install script, but was written -# from scratch. -# - - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit="${DOITPROG-}" - - -# put in absolute paths if you don't have them in your path; or use env. vars. - -mvprog="${MVPROG-mv}" -cpprog="${CPPROG-cp}" -chmodprog="${CHMODPROG-chmod}" -chownprog="${CHOWNPROG-chown}" -chgrpprog="${CHGRPPROG-chgrp}" -stripprog="${STRIPPROG-strip}" -rmprog="${RMPROG-rm}" -mkdirprog="${MKDIRPROG-mkdir}" - -tranformbasename="" -transform_arg="" -instcmd="$mvprog" -chmodcmd="$chmodprog 0755" -chowncmd="" -chgrpcmd="" -stripcmd="" -rmcmd="$rmprog -f" -mvcmd="$mvprog" -src="" -dst="" -dir_arg="" - -while [ x"$1" != x ]; do - case $1 in - -c) instcmd="$cpprog" - shift - continue;; - - -d) dir_arg=true - shift - continue;; - - -m) chmodcmd="$chmodprog $2" - shift - shift - continue;; - - -o) chowncmd="$chownprog $2" - shift - shift - continue;; - - -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; - - -s) stripcmd="$stripprog" - shift - continue;; - - -t=*) transformarg=`echo $1 | sed 's/-t=//'` - shift - continue;; - - -b=*) transformbasename=`echo $1 | sed 's/-b=//'` - shift - continue;; - - *) if [ x"$src" = x ] - then - src=$1 - else - # this colon is to work around a 386BSD /bin/sh bug - : - dst=$1 - fi - shift - continue;; - esac -done - -if [ x"$src" = x ] -then - echo "install: no input file specified" - exit 1 -else - true -fi - -if [ x"$dir_arg" != x ]; then - dst=$src - src="" - - if [ -d $dst ]; then - instcmd=: - else - instcmd=mkdir - fi -else - -# Waiting for this to be detected by the "$instcmd $src $dsttmp" command -# might cause directories to be created, which would be especially bad -# if $src (and thus $dsttmp) contains '*'. - - if [ -f $src -o -d $src ] - then - true - else - echo "install: $src does not exist" - exit 1 - fi - - if [ x"$dst" = x ] - then - echo "install: no destination specified" - exit 1 - else - true - fi - -# If destination is a directory, append the input filename; if your system -# does not like double slashes in filenames, you may need to add some logic - - if [ -d $dst ] - then - dst="$dst"/`basename $src` - else - true - fi -fi - -## this sed command emulates the dirname command -dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` - -# Make sure that the destination directory exists. -# this part is taken from Noah Friedman's mkinstalldirs script - -# Skip lots of stat calls in the usual case. -if [ ! -d "$dstdir" ]; then -defaultIFS=' -' -IFS="${IFS-${defaultIFS}}" - -oIFS="${IFS}" -# Some sh's can't handle IFS=/ for some reason. -IFS='%' -set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` -IFS="${oIFS}" - -pathcomp='' - -while [ $# -ne 0 ] ; do - pathcomp="${pathcomp}${1}" - shift - - if [ ! -d "${pathcomp}" ] ; - then - $mkdirprog "${pathcomp}" - else - true - fi - - pathcomp="${pathcomp}/" -done -fi - -if [ x"$dir_arg" != x ] -then - $doit $instcmd $dst && - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi -else - -# If we're going to rename the final executable, determine the name now. - - if [ x"$transformarg" = x ] - then - dstfile=`basename $dst` - else - dstfile=`basename $dst $transformbasename | - sed $transformarg`$transformbasename - fi - -# don't allow the sed command to completely eliminate the filename - - if [ x"$dstfile" = x ] - then - dstfile=`basename $dst` - else - true - fi - -# Make a temp file name in the proper directory. - - dsttmp=$dstdir/#inst.$$# - -# Move or copy the file name to the temp name - - $doit $instcmd $src $dsttmp && - - trap "rm -f ${dsttmp}" 0 && - -# and set any options; do chmod last to preserve setuid bits - -# If any of these fail, we abort the whole thing. If we want to -# ignore errors from any of these, just make sure not to ignore -# errors from the above "$doit $instcmd $src $dsttmp" command. - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && - -# Now rename the file to the real destination. - - $doit $rmcmd -f $dstdir/$dstfile && - $doit $mvcmd $dsttmp $dstdir/$dstfile - -fi && - - -exit 0 diff --git a/packages/sgml/iso_639.pl b/packages/sgml/iso_639.pl deleted file mode 100644 index 1fe62c435..000000000 --- a/packages/sgml/iso_639.pl +++ /dev/null @@ -1,628 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog - - Author: Jan Wielemaker - E-mail: jan@swi.psy.uva.nl - WWW: http://www.swi-prolog.org - Copyright (C): 1985-2004, University of Amsterdam - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - As a special exception, if you link this library with other files, - compiled with a Free Software compiler, to produce an executable, this - library does not by itself cause the resulting executable to be covered - by the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -:- module(iso_639, - [ iso_639_2/2, % Code, Language - iso_639_3/2, % Code, Language - iso_639/2 % Code, Language - ]). - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -ISO 639 language codes. This material is based on - - http://www.wwp.brown.edu/encoding/training/ISO/iso639.html - -It would be nice to know a bit more about these languages, such as the -applicable character sets. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -iso_639_2(Code, Lang) :- - l2(Code, Lang). -iso_639_3(Code, Lang) :- - l3(Code, Lang). -iso_639(Code, Lang) :- - ( l2(Code, Lang) - ; l3(Code, Lang) - ). - - -% l3(?Code, ?Lang) -% -% ISO-639 3-letter codes - -l3(abk, 'Abkhazian'). -l3(ace, 'Achinese'). -l3(ach, 'Acoli'). -l3(ada, 'Adangme'). -l3(aar, 'Afar'). -l3(afh, 'Afrihili'). -l3(afr, 'Afrikaans'). -l3(afa, 'Afro-Asiatic (Other)'). -l3(aka, 'Akan'). -l3(akk, 'Akkadian'). -l3(alb, 'Albanian'). -l3(sqi, 'Albanian'). -l3(ale, 'Aleut'). -l3(alg, 'Algonquian languages'). -l3(tut, 'Altaic (Other)'). -l3(amh, 'Amharic'). -l3(apa, 'Apache languages'). -l3(ara, 'Arabic'). -l3(arc, 'Aramaic'). -l3(arp, 'Arapaho'). -l3(arn, 'Araucanian'). -l3(arw, 'Arawak'). -l3(arm, 'Armenian'). -l3(hye, 'Armenian'). -l3(art, 'Artificial (Other)'). -l3(asm, 'Assamese'). -l3(ath, 'Athapascan languages'). -l3(map, 'Austronesian (Other)'). -l3(ava, 'Avaric'). -l3(ave, 'Avestan'). -l3(awa, 'Awadhi'). -l3(aym, 'Aymara'). -l3(aze, 'Azerbaijani'). -l3(nah, 'Aztec'). -l3(ban, 'Balinese'). -l3(bat, 'Baltic (Other)'). -l3(bal, 'Baluchi'). -l3(bam, 'Bambara'). -l3(bai, 'Bamileke languages'). -l3(bad, 'Banda'). -l3(bnt, 'Bantu (Other)'). -l3(bas, 'Basa'). -l3(bak, 'Bashkir'). -l3(baq, 'Basque'). -l3(eus, 'Basque'). -l3(bej, 'Beja'). -l3(bem, 'Bemba'). -l3(ben, 'Bengali'). -l3(ber, 'Berber (Other)'). -l3(bho, 'Bhojpuri'). -l3(bih, 'Bihari'). -l3(bik, 'Bikol'). -l3(bin, 'Bini'). -l3(bis, 'Bislama'). -l3(bra, 'Braj'). -l3(bre, 'Breton'). -l3(bug, 'Buginese'). -l3(bul, 'Bulgarian'). -l3(bua, 'Buriat'). -l3(bur, 'Burmese'). -l3(mya, 'Burmese'). -l3(bel, 'Byelorussian'). -l3(cad, 'Caddo'). -l3(car, 'Carib'). -l3(cat, 'Catalan'). -l3(cau, 'Caucasian (Other)'). -l3(ceb, 'Cebuano'). -l3(cel, 'Celtic (Other)'). -l3(cai, 'Central American Indian (Other)'). -l3(chg, 'Chagatai'). -l3(cha, 'Chamorro'). -l3(che, 'Chechen'). -l3(chr, 'Cherokee'). -l3(chy, 'Cheyenne'). -l3(chb, 'Chibcha'). -l3(chi, 'Chinese'). -l3(zho, 'Chinese'). -l3(chn, 'Chinook jargon'). -l3(cho, 'Choctaw'). -l3(chu, 'Church Slavic'). -l3(chv, 'Chuvash'). -l3(cop, 'Coptic'). -l3(cor, 'Cornish'). -l3(cos, 'Corsican'). -l3(cre, 'Cree'). -l3(mus, 'Creek'). -l3(crp, 'Creoles and Pidgins (Other)'). -l3(cpe, 'Creoles and Pidgins, English-based (Other)'). -l3(cpf, 'Creoles and Pidgins, French-based (Other)'). -l3(cpp, 'Creoles and Pidgins, Portuguese-based (Other)'). -l3(cus, 'Cushitic (Other)'). -l3(ces, 'Czech'). -l3(cze, 'Czech'). -l3(dak, 'Dakota'). -l3(dan, 'Danish'). -l3(del, 'Delaware'). -l3(din, 'Dinka'). -l3(div, 'Divehi'). -l3(doi, 'Dogri'). -l3(dra, 'Dravidian (Other)'). -l3(dua, 'Duala'). -l3(dut, 'Dutch'). -l3(nla, 'Dutch'). -l3(dum, 'Dutch, Middle (ca. 1050-1350)'). -l3(dyu, 'Dyula'). -l3(dzo, 'Dzongkha'). -l3(efi, 'Efik'). -l3(egy, 'Egyptian (Ancient)'). -l3(eka, 'Ekajuk'). -l3(elx, 'Elamite'). -l3(eng, 'English'). -l3(enm, 'English, Middle (ca. 1100-1500)'). -l3(ang, 'English, Old (ca. 450-1100)'). -l3(esk, 'Eskimo (Other)'). -l3(epo, 'Esperanto'). -l3(est, 'Estonian'). -l3(ewe, 'Ewe'). -l3(ewo, 'Ewondo'). -l3(fan, 'Fang'). -l3(fat, 'Fanti'). -l3(fao, 'Faroese'). -l3(fij, 'Fijian'). -l3(fin, 'Finnish'). -l3(fiu, 'Finno-Ugrian (Other)'). -l3(fon, 'Fon'). -l3(fra, 'French'). -l3(fre, 'French'). -l3(frm, 'French, Middle (ca. 1400-1600)'). -l3(fro, 'French, Old (842- ca. 1400)'). -l3(fry, 'Frisian'). -l3(ful, 'Fulah'). -l3(gaa, 'Ga'). -l3(gae, 'Gaelic (Scots)'). -l3(gdh, 'Gaelic (Scots)'). -l3(glg, 'Gallegan'). -l3(lug, 'Ganda'). -l3(gay, 'Gayo'). -l3(gez, 'Geez'). -l3(geo, 'Georgian'). -l3(kat, 'Georgian'). -l3(deu, 'German'). -l3(ger, 'German'). -l3(gmh, 'German, Middle High (ca. 1050-1500)'). -l3(goh, 'German, Old High (ca. 750-1050)'). -l3(gem, 'Germanic (Other)'). -l3(gil, 'Gilbertese'). -l3(gon, 'Gondi'). -l3(got, 'Gothic'). -l3(grb, 'Grebo'). -l3(grc, 'Greek, Ancient (to 1453)'). -l3(ell, 'Greek, Modern (1453-)'). -l3(gre, 'Greek, Modern (1453-)'). -l3(kal, 'Greenlandic'). -l3(grn, 'Guarani'). -l3(guj, 'Gujarati'). -l3(hai, 'Haida'). -l3(hau, 'Hausa'). -l3(haw, 'Hawaiian'). -l3(heb, 'Hebrew'). -l3(her, 'Herero'). -l3(hil, 'Hiligaynon'). -l3(him, 'Himachali'). -l3(hin, 'Hindi'). -l3(hmo, 'Hiri Motu'). -l3(hun, 'Hungarian'). -l3(hup, 'Hupa'). -l3(iba, 'Iban'). -l3(ice, 'Icelandic'). -l3(isl, 'Icelandic'). -l3(ibo, 'Igbo'). -l3(ijo, 'Ijo'). -l3(ilo, 'Iloko'). -l3(inc, 'Indic (Other)'). -l3(ine, 'Indo-European (Other)'). -l3(ind, 'Indonesian'). -l3(ina, 'Interlingua (International Auxiliary language Association)'). -l3(ine, 'Interlingue'). -l3(iku, 'Inuktitut'). -l3(ipk, 'Inupiak'). -l3(ira, 'Iranian (Other)'). -l3(gai, 'Irish'). -l3(iri, 'Irish'). -l3(sga, 'Irish, Old (to 900)'). -l3(mga, 'Irish, Middle (900 - 1200)'). -l3(iro, 'Iroquoian languages'). -l3(ita, 'Italian'). -l3(jpn, 'Japanese'). -l3(jav, 'Javanese'). -l3(jaw, 'Javanese'). -l3(jrb, 'Judeo-Arabic'). -l3(jpr, 'Judeo-Persian'). -l3(kab, 'Kabyle'). -l3(kac, 'Kachin'). -l3(kam, 'Kamba'). -l3(kan, 'Kannada'). -l3(kau, 'Kanuri'). -l3(kaa, 'Kara-Kalpak'). -l3(kar, 'Karen'). -l3(kas, 'Kashmiri'). -l3(kaw, 'Kawi'). -l3(kaz, 'Kazakh'). -l3(kha, 'Khasi'). -l3(khm, 'Khmer'). -l3(khi, 'Khoisan (Other)'). -l3(kho, 'Khotanese'). -l3(kik, 'Kikuyu'). -l3(kin, 'Kinyarwanda'). -l3(kir, 'Kirghiz'). -l3(kom, 'Komi'). -l3(kon, 'Kongo'). -l3(kok, 'Konkani'). -l3(kor, 'Korean'). -l3(kpe, 'Kpelle'). -l3(kro, 'Kru'). -l3(kua, 'Kuanyama'). -l3(kum, 'Kumyk'). -l3(kur, 'Kurdish'). -l3(kru, 'Kurukh'). -l3(kus, 'Kusaie'). -l3(kut, 'Kutenai'). -l3(lad, 'Ladino'). -l3(lah, 'Lahnda'). -l3(lam, 'Lamba'). -l3(oci, 'Langue d\'Oc (post 1500)'). -l3(lao, 'Lao'). -l3(lat, 'Latin'). -l3(lav, 'Latvian'). -l3(ltz, 'Letzeburgesch'). -l3(lez, 'Lezghian'). -l3(lin, 'Lingala'). -l3(lit, 'Lithuanian'). -l3(loz, 'Lozi'). -l3(lub, 'Luba-Katanga'). -l3(lui, 'Luiseno'). -l3(lun, 'Lunda'). -l3(luo, 'Luo (Kenya and Tanzania)'). -l3(mac, 'Macedonian'). -l3(mak, 'Macedonian'). -l3(mad, 'Madurese'). -l3(mag, 'Magahi'). -l3(mai, 'Maithili'). -l3(mak, 'Makasar'). -l3(mlg, 'Malagasy'). -l3(may, 'Malay'). -l3(msa, 'Malay'). -l3(mal, 'Malayalam'). -l3(mlt, 'Maltese'). -l3(man, 'Mandingo'). -l3(mni, 'Manipuri'). -l3(mno, 'Manobo languages'). -l3(max, 'Manx'). -l3(mao, 'Maori'). -l3(mri, 'Maori'). -l3(mar, 'Marathi'). -l3(chm, 'Mari'). -l3(mah, 'Marshall'). -l3(mwr, 'Marwari'). -l3(mas, 'Masai'). -l3(myn, 'Mayan languages'). -l3(men, 'Mende'). -l3(mic, 'Micmac'). -l3(min, 'Minangkabau'). -l3(mis, 'Miscellaneous (Other)'). -l3(moh, 'Mohawk'). -l3(mol, 'Moldavian'). -l3(mkh, 'Mon-Kmer (Other)'). -l3(lol, 'Mongo'). -l3(mon, 'Mongolian'). -l3(mos, 'Mossi'). -l3(mul, 'Multiple languages'). -l3(mun, 'Munda languages'). -l3(nau, 'Nauru'). -l3(nav, 'Navajo'). -l3(nde, 'Ndebele, North'). -l3(nbl, 'Ndebele, South'). -l3(ndo, 'Ndongo'). -l3(nep, 'Nepali'). -l3(new, 'Newari'). -l3(nic, 'Niger-Kordofanian (Other)'). -l3(ssa, 'Nilo-Saharan (Other)'). -l3(niu, 'Niuean'). -l3(non, 'Norse, Old'). -l3(nai, 'North American Indian (Other)'). -l3(nor, 'Norwegian'). -l3(nno, 'Norwegian (Nynorsk)'). -l3(nub, 'Nubian languages'). -l3(nym, 'Nyamwezi'). -l3(nya, 'Nyanja'). -l3(nyn, 'Nyankole'). -l3(nyo, 'Nyoro'). -l3(nzi, 'Nzima'). -l3(oji, 'Ojibwa'). -l3(ori, 'Oriya'). -l3(orm, 'Oromo'). -l3(osa, 'Osage'). -l3(oss, 'Ossetic'). -l3(oto, 'Otomian languages'). -l3(pal, 'Pahlavi'). -l3(pau, 'Palauan'). -l3(pli, 'Pali'). -l3(pam, 'Pampanga'). -l3(pag, 'Pangasinan'). -l3(pan, 'Panjabi'). -l3(pap, 'Papiamento'). -l3(paa, 'Papuan-Australian (Other)'). -l3(fas, 'Persian'). -l3(per, 'Persian'). -l3(peo, 'Persian, Old (ca 600 - 400 B.C.)'). -l3(phn, 'Phoenician'). -l3(pol, 'Polish'). -l3(pon, 'Ponape'). -l3(por, 'Portuguese'). -l3(pra, 'Prakrit languages'). -l3(pro, 'Provencal, Old (to 1500)'). -l3(pus, 'Pushto'). -l3(que, 'Quechua'). -l3(roh, 'Rhaeto-Romance'). -l3(raj, 'Rajasthani'). -l3(rar, 'Rarotongan'). -l3(roa, 'Romance (Other)'). -l3(ron, 'Romanian'). -l3(rum, 'Romanian'). -l3(rom, 'Romany'). -l3(run, 'Rundi'). -l3(rus, 'Russian'). -l3(sal, 'Salishan languages'). -l3(sam, 'Samaritan Aramaic'). -l3(smi, 'Sami languages'). -l3(smo, 'Samoan'). -l3(sad, 'Sandawe'). -l3(sag, 'Sango'). -l3(san, 'Sanskrit'). -l3(srd, 'Sardinian'). -l3(sco, 'Scots'). -l3(sel, 'Selkup'). -l3(sem, 'Semitic (Other)'). -l3(scr, 'Serbo-Croatian'). -l3(srr, 'Serer'). -l3(shn, 'Shan'). -l3(sna, 'Shona'). -l3(sid, 'Sidamo'). -l3(bla, 'Siksika'). -l3(snd, 'Sindhi'). -l3(sin, 'Singhalese'). -l3(sit, 'Sino-Tibetan (Other)'). -l3(sio, 'Siouan languages'). -l3(sla, 'Slavic (Other)'). -l3(ssw, 'Siswant'). -l3(slk, 'Slovak'). -l3(slo, 'Slovak'). -l3(slv, 'Slovenian'). -l3(sog, 'Sogdian'). -l3(som, 'Somali'). -l3(son, 'Songhai'). -l3(wen, 'Sorbian languages'). -l3(nso, 'Sotho, Northern'). -l3(sot, 'Sotho, Southern'). -l3(sai, 'South American Indian (Other)'). -l3(esl, 'Spanish'). -l3(spa, 'Spanish'). -l3(suk, 'Sukuma'). -l3(sux, 'Sumerian'). -l3(sun, 'Sudanese'). -l3(sus, 'Susu'). -l3(swa, 'Swahili'). -l3(ssw, 'Swazi'). -l3(sve, 'Swedish'). -l3(swe, 'Swedish'). -l3(syr, 'Syriac'). -l3(tgl, 'Tagalog'). -l3(tah, 'Tahitian'). -l3(tgk, 'Tajik'). -l3(tmh, 'Tamashek'). -l3(tam, 'Tamil'). -l3(tat, 'Tatar'). -l3(tel, 'Telugu'). -l3(ter, 'Tereno'). -l3(tha, 'Thai'). -l3(bod, 'Tibetan'). -l3(tib, 'Tibetan'). -l3(tig, 'Tigre'). -l3(tir, 'Tigrinya'). -l3(tem, 'Timne'). -l3(tiv, 'Tivi'). -l3(tli, 'Tlingit'). -l3(tog, 'Tonga (Nyasa)'). -l3(ton, 'Tonga (Tonga Islands)'). -l3(tru, 'Truk'). -l3(tsi, 'Tsimshian'). -l3(tso, 'Tsonga'). -l3(tsn, 'Tswana'). -l3(tum, 'Tumbuka'). -l3(tur, 'Turkish'). -l3(ota, 'Turkish, Ottoman (1500 - 1928)'). -l3(tuk, 'Turkmen'). -l3(tyv, 'Tuvinian'). -l3(twi, 'Twi'). -l3(uga, 'Ugaritic'). -l3(uig, 'Uighur'). -l3(ukr, 'Ukrainian'). -l3(umb, 'Umbundu'). -l3(und, 'Undetermined'). -l3(urd, 'Urdu'). -l3(uzb, 'Uzbek'). -l3(vai, 'Vai'). -l3(ven, 'Venda'). -l3(vie, 'Vietnamese'). -l3(vol, 'Volap\u00fck'). % Use \uxxxx for portability. (= \"u) -l3(vot, 'Votic'). -l3(wak, 'Wakashan languages'). -l3(wal, 'Walamo'). -l3(war, 'Waray'). -l3(was, 'Washo'). -l3(cym, 'Welsh'). -l3(wel, 'Welsh'). -l3(wol, 'Wolof'). -l3(xho, 'Xhosa'). -l3(sah, 'Yakut'). -l3(yao, 'Yao'). -l3(yap, 'Yap'). -l3(yid, 'Yiddish'). -l3(yor, 'Yoruba'). -l3(zap, 'Zapotec'). -l3(zen, 'Zenaga'). -l3(zha, 'Zhuang'). -l3(zul, 'Zulu'). -l3(zun, 'Zuni'). - -% l2(?Code, ?Lang) -% -% ISO-639 2 letter codes - -l2(aa, 'Afar'). -l2(ab, 'Abkhazian'). -l2(af, 'Afrikaans'). -l2(am, 'Amharic'). -l2(ar, 'Arabic'). -l2(as, 'Assamese'). -l2(ay, 'Aymara'). -l2(az, 'Azerbaijani'). -l2(ba, 'Bashkir'). -l2(be, 'Byelorussian'). -l2(bg, 'Bulgarian'). -l2(bh, 'Bihari'). -l2(bi, 'Bislama'). -l2(bn, 'Bengali, Bangla'). -l2(bo, 'Tibetan'). -l2(br, 'Breton'). -l2(ca, 'Catalan'). -l2(co, 'Corsican'). -l2(cs, 'Czech'). -l2(cy, 'Welsh'). -l2(da, 'Danish'). -l2(de, 'German'). -l2(dz, 'Bhutani'). -l2(el, 'Greek'). -l2(en, 'English, American'). -l2(eo, 'Esperanto'). -l2(es, 'Spanish'). -l2(et, 'Estonian'). -l2(eu, 'Basque'). -l2(fa, 'Persian'). -l2(fi, 'Finnish'). -l2(fj, 'Fiji'). -l2(fo, 'Faeroese'). -l2(fr, 'French'). -l2(fy, 'Frisian'). -l2(ga, 'Irish'). -l2(gd, 'Gaelic, Scots Gaelic'). -l2(gl, 'Galician'). -l2(gn, 'Guarani'). -l2(gu, 'Gujarati'). -l2(ha, 'Hausa'). -l2(hi, 'Hindi'). -l2(hr, 'Croatian'). -l2(hu, 'Hungarian'). -l2(hy, 'Armenian'). -l2(ia, 'Interlingua'). -l2(ie, 'Interlingue'). -l2(ik, 'Inupiak'). -l2(in, 'Indonesian'). -l2(is, 'Icelandic'). -l2(it, 'Italian'). -l2(iw, 'Hebrew'). -l2(ja, 'Japanese'). -l2(ji, 'Yiddish'). -l2(jw, 'Javanese'). -l2(ka, 'Georgian'). -l2(kk, 'Kazakh'). -l2(kl, 'Greenlandic'). -l2(km, 'Cambodian'). -l2(kn, 'Kannada'). -l2(ko, 'Korean'). -l2(ks, 'Kashmiri'). -l2(ku, 'Kurdish'). -l2(ky, 'Kirghiz'). -l2(la, 'Latin'). -l2(ln, 'Lingala'). -l2(lo, 'Laothian'). -l2(lt, 'Lithuanian'). -l2(lv, 'Latvian, Lettish'). -l2(mg, 'Malagasy'). -l2(mi, 'Maori'). -l2(mk, 'Macedonian'). -l2(ml, 'Malayalam'). -l2(mn, 'Mongolian'). -l2(mo, 'Moldavian'). -l2(mr, 'Marathi'). -l2(ms, 'Malay'). -l2(mt, 'Maltese'). -l2(my, 'Burmese'). -l2(na, 'Nauru'). -l2(ne, 'Nepali'). -l2(nl, 'Dutch'). -l2(no, 'Norwegian'). -l2(oc, 'Occitan'). -l2(om, 'Oromo, Afan'). -l2(or, 'Oriya'). -l2(pa, 'Punjabi'). -l2(pl, 'Polish'). -l2(ps, 'Pashto, Pushto'). -l2(pt, 'Portuguese'). -l2(qu, 'Quechua'). -l2(rm, 'Rhaeto-Romance'). -l2(rn, 'Kirundi'). -l2(ro, 'Romanian'). -l2(ru, 'Russian'). -l2(rw, 'Kinyarwanda'). -l2(sa, 'Sanskrit'). -l2(sd, 'Sindhi'). -l2(sg, 'Sangro'). -l2(sh, 'Serbo-Croatian'). -l2(si, 'Singhalese'). -l2(sk, 'Slovak'). -l2(sl, 'Slovenian'). -l2(sm, 'Samoan'). -l2(sn, 'Shona'). -l2(so, 'Somali'). -l2(sq, 'Albanian'). -l2(sr, 'Serbian'). -l2(ss, 'Siswati'). -l2(st, 'Sesotho'). -l2(su, 'Sudanese'). -l2(sv, 'Swedish'). -l2(sw, 'Swahili'). -l2(ta, 'Tamil'). -l2(te, 'Tegulu'). -l2(tg, 'Tajik'). -l2(th, 'Thai'). -l2(ti, 'Tigrinya'). -l2(tk, 'Turkmen'). -l2(tl, 'Tagalog'). -l2(tn, 'Setswana'). -l2(to, 'Tonga'). -l2(tr, 'Turkish'). -l2(ts, 'Tsonga'). -l2(tt, 'Tatar'). -l2(tw, 'Twi'). -l2(uk, 'Ukrainian'). -l2(ur, 'Urdu'). -l2(uz, 'Uzbek'). -l2(vi, 'Vietnamese'). -l2(vo, 'Volapuk'). -l2(wo, 'Wolof'). -l2(xh, 'Xhosa'). -l2(yo, 'Yoruba'). -l2(zh, 'Chinese'). -l2(zu, 'Zulu'). diff --git a/packages/sgml/make.bat b/packages/sgml/make.bat deleted file mode 100755 index 70b43e3f1..000000000 --- a/packages/sgml/make.bat +++ /dev/null @@ -1,3 +0,0 @@ -@echo off - -nmake /f makefile.mak %* diff --git a/packages/sgml/model.c b/packages/sgml/model.c deleted file mode 100644 index 3fec59ad5..000000000 --- a/packages/sgml/model.c +++ /dev/null @@ -1,524 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog - - Author: Jan Wielemaker - E-mail: jan@swi.psy.uva.nl - WWW: http://www.swi-prolog.org - Copyright (C): 1985-2002, University of Amsterdam - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include <stdio.h> -#include <stdlib.h> -#include <assert.h> -#include "dtd.h" -#include "model.h" - -#define MAX_VISITED 256 -#define MAX_ALLOWED 64 - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -This module implements a finite state engine for validating the content -model of elements. A state machine is the only feasible approach for -realising an event-driven SGML parser. - -The public functions are: - -dtd_state *new_dtd_state(void) - Create an anonymous new state. Normally an element creates two of - these for it ->initial_state and ->final_state attributes. - -dtd_state *make_state_engine(dtd_element *e) - Associate a state engine to this element and return the initial - state of the engine. If the element has an engine, simply return - the initial state. - -dtd_state *make_dtd_transition(dtd_state *here, dtd_element *e) - Given the current state, see whether we can accept e and return - the resulting state. If no transition is possible return NULL. - -int same_state(dtd_state *final, dtd_state *here) - See whether two states are the same, or the final state can be - reached only traversing equivalence links. - -The A&B&... model - -Models of the type a&b&c are hard to translate, as the resulting state -machine is of size order N! In practice only a little of this will be -used however and we `fix' this problem using a `lazy state-engine', that -expands to the next level only after reaching some level. See the -function state_transitions(). The design takes more lazy generation into -consideration. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -typedef struct _state_transition -{ dtd_element *element; /* element on transition */ - dtd_state *state; /* state to go to */ - struct _state_transition *next; /* next possible transition */ -} transition; - -typedef struct _dtd_model_list /* list (set) of models */ -{ dtd_model *model; - struct _dtd_model_list *next; -} dtd_model_list; - -typedef enum -{ EX_AND /* expand (a&b&...) */ -} expand_type; - -typedef struct _state_expander -{ dtd_state *target; /* Target state to expand to */ - expand_type type; /* EX_* */ - union - { struct - { dtd_model_list *set; /* Models we should still see */ - } and; /* Expand (a&b&...) */ - } kind; -} expander; - -typedef struct _visited -{ int size; /* set-size */ - dtd_state *states[MAX_VISITED]; /* The set */ -} visited; - - -static void translate_model(dtd_model *m, dtd_state *from, dtd_state *to); -static transition *state_transitions(dtd_state *state); - -static int -visit(dtd_state *state, visited *visited) -{ int i; - - for(i=0; i<visited->size; i++) - { if ( visited->states[i] == state ) - return FALSE; - } - - if ( visited->size >= MAX_VISITED ) - { fprintf(stderr, "Reached MAX_VISITED!\n"); - return FALSE; - } - - visited->states[visited->size++] = state; - - return TRUE; -} - - -static dtd_state * -do_make_dtd_transition(dtd_state *here, dtd_element *e, visited *visited) -{ transition *tset = state_transitions(here); - transition *t; - - for(t=tset; t; t=t->next) - { if ( t->element == e ) - return t->state; - } - - for(t=tset; t; t=t->next) - { if ( t->element == NULL && visit(t->state, visited) ) - { dtd_state *new; - - if ( (new=do_make_dtd_transition(t->state, e, visited)) ) - return new; - } - } - - return NULL; -} - - -dtd_state * -make_dtd_transition(dtd_state *here, dtd_element *e) -{ visited visited; - visited.size = 0; - - if ( !here ) /* from nowhere to nowhere */ - return NULL; - - return do_make_dtd_transition(here, e, &visited); -} - - -static int -find_same_state(dtd_state *final, dtd_state *here, visited *visited) -{ transition *t; - - if ( final == here ) - return TRUE; - - for(t=state_transitions(here); t; t=t->next) - { if ( t->element == NULL && visit(t->state, visited) ) - { if ( find_same_state(final, t->state, visited) ) - return TRUE; - } - } - - return FALSE; -} - - -int -same_state(dtd_state *final, dtd_state *here) -{ visited visited; - visited.size = 0; - - return find_same_state(final, here, &visited); -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -state_allows_for(dtd_state *state, dtd_element **allow, int *n) - See what elements are allowed if we are in this state. This is - currently not used, but might prove handly for error messages or - syntax-directed editors. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -static void -do_state_allows_for(dtd_state *here, dtd_element **allow, int *n, - visited *visited) -{ transition *t; - - for(t=state_transitions(here); t; t=t->next) - { int i; - - if ( t->element == NULL ) - { if ( visit(t->state, visited) ) - do_state_allows_for(t->state, allow, n, visited); - } else - { for(i=0; i<*n; i++) - { if ( allow[i] == t->element ) - goto next; - } - allow[(*n)++] = t->element; - } - next: - ; - } -} - - -void -state_allows_for(dtd_state *state, dtd_element **allow, int *n) -{ visited visited; - visited.size = 0; - - *n = 0; - if ( state ) - do_state_allows_for(state, allow, n, &visited); -} - - -static int -do_find_omitted_path(dtd_state *state, dtd_element *e, - dtd_element **path, int *pl, - visited *visited) -{ transition *tset = state_transitions(state); - transition *t; - int pathlen = *pl; - - for(t=tset; t; t=t->next) - { if ( t->element == e ) - return TRUE; - - if ( t->element && - t->element != CDATA_ELEMENT && - t->element->structure && - t->element->structure->omit_open && - visit(t->state, visited) ) - { dtd_state *initial = make_state_engine(t->element); - - path[pathlen] = t->element; - *pl = pathlen+1; - if ( do_find_omitted_path(initial, e, path, pl, visited) ) - return TRUE; - *pl = pathlen; - } - } - - for(t=tset; t; t=t->next) - { if ( !t->element && - visit(t->state, visited) ) - { if ( do_find_omitted_path(t->state, e, path, pl, visited) ) - return TRUE; - } - } - - return FALSE; -} - - -int -find_omitted_path(dtd_state *state, dtd_element *e, dtd_element **path) -{ int pl = 0; - visited visited; - visited.size = 0; - - if ( state && do_find_omitted_path(state, e, path, &pl, &visited) ) - return pl; - - return -1; -} - - -dtd_state * -new_dtd_state() -{ dtd_state *s = sgml_calloc(1, sizeof(*s)); - - return s; -} - - -static void -link(dtd_state *from, dtd_state *to, dtd_element *e) -{ transition *t = sgml_calloc(1, sizeof(*t)); - - t->state = to; - t->element = e; - t->next = from->transitions; - from->transitions = t; -} - - - /******************************* - * EXPANSION * - *******************************/ - -static void -add_model_list(dtd_model_list **list, dtd_model *m) -{ dtd_model_list *l = sgml_calloc(1, sizeof(*l)); - - l->model = m; - - for( ; *list; list = &(*list)->next) - ; - *list = l; -} - - -static transition * -state_transitions(dtd_state *state) -{ if ( !state->transitions && state->expander ) - { expander *ex = state->expander; - - switch(ex->type) - { case EX_AND: - { dtd_model_list *left = ex->kind.and.set; - - if ( !left ) /* empty AND (should not happen) */ - { link(state, ex->target, NULL); - } else if ( !left->next ) /* only one left */ - { translate_model(left->model, state, ex->target); - } else - { for( ; left; left = left->next ) - { dtd_state *tmp = new_dtd_state(); - expander *nex = sgml_calloc(1, sizeof(*nex)); - dtd_model_list *l; - - translate_model(left->model, state, tmp); - tmp->expander = nex; - nex->target = ex->target; - nex->type = EX_AND; - for(l=ex->kind.and.set; l; l=l->next) - { if ( l != left ) - add_model_list(&nex->kind.and.set, l->model); - } - } - } - } - } - } - - return state->transitions; -} - - - /******************************* - * TRANSLATION * - *******************************/ - - -static void -translate_one(dtd_model *m, dtd_state *from, dtd_state *to) -{ switch(m->type) - { case MT_ELEMENT: - { dtd_element *e = m->content.element; - - link(from, to, e); - return; - } - case MT_SEQ: /* a,b,... */ - { dtd_model *sub; - - for( sub = m->content.group; sub->next; sub = sub->next ) - { dtd_state *tmp = new_dtd_state(); - translate_model(sub, from, tmp); - from = tmp; - } - translate_model(sub, from, to); - return; - } - case MT_AND: /* a&b&... */ - { expander *ex = sgml_calloc(1, sizeof(*ex)); - dtd_model *sub; - - ex->target = to; - ex->type = EX_AND; - - for( sub = m->content.group; sub; sub = sub->next ) - add_model_list(&ex->kind.and.set, sub); - - from->expander = ex; - return; - } - case MT_OR: /* a|b|... */ - { dtd_model *sub; - - for( sub = m->content.group; sub; sub = sub->next ) - translate_model(sub, from, to); - return; - } - case MT_PCDATA: - case MT_UNDEF: - assert(0); - } - -} - - -static void -translate_model(dtd_model *m, dtd_state *from, dtd_state *to) -{ if ( m->type == MT_PCDATA ) - { link(from, from, CDATA_ELEMENT); - link(from, to, NULL); - return; - } - - switch(m->cardinality) - { case MC_OPT: /* ? */ - link(from, to, NULL); - /*FALLTHROUGH*/ - case MC_ONE: - translate_one(m, from, to); - return; - case MC_REP: /* * */ - translate_one(m, from, from); - link(from, to, NULL); - return; - case MC_PLUS: /* + */ - translate_one(m, from, to); - translate_one(m, to, to); - return; - } -} - - -dtd_state * -make_state_engine(dtd_element *e) -{ if ( e->structure ) - { dtd_edef *def = e->structure; - - if ( !def->initial_state ) - { if ( def->content ) - { def->initial_state = new_dtd_state(); - def->final_state = new_dtd_state(); - - translate_model(def->content, def->initial_state, def->final_state); - } else if ( def->type == C_CDATA || def->type == C_RCDATA ) - { def->initial_state = new_dtd_state(); - def->final_state = new_dtd_state(); - - link(def->initial_state, def->initial_state, CDATA_ELEMENT); - link(def->initial_state, def->final_state, NULL); - } else - return NULL; - } - - return def->initial_state; - } - - return NULL; -} - - - /******************************* - * FREE * - *******************************/ - -static void do_free_state_engine(dtd_state *state, visited *visited); - -static void -free_model_list(dtd_model_list *l) -{ dtd_model_list *next; - - for( ; l; l=next) - { next = l->next; - - sgml_free(l); - } -} - - -static void -free_expander(expander *e, visited *visited) -{ if ( visit(e->target, visited) ) - do_free_state_engine(e->target, visited); - - switch(e->type) - { case EX_AND: - free_model_list(e->kind.and.set); - default: - ; - } - - sgml_free(e); -} - - -static void -do_free_state_engine(dtd_state *state, visited *visited) -{ transition *t, *next; - - for(t=state->transitions; t; t=next) - { next = t->next; - - if ( visit(t->state, visited) ) - do_free_state_engine(t->state, visited); - - sgml_free(t); - } - - if ( state->expander ) - free_expander(state->expander, visited); - - sgml_free(state); -} - - -void -free_state_engine(dtd_state *state) -{ if ( state ) - { visited visited; - visited.size = 0; - - visit(state, &visited); - do_free_state_engine(state, &visited); - } -} - - - diff --git a/packages/sgml/model.h b/packages/sgml/model.h deleted file mode 100644 index c3beccbe3..000000000 --- a/packages/sgml/model.h +++ /dev/null @@ -1,47 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog - - Author: Jan Wielemaker - E-mail: jan@swi.psy.uva.nl - WWW: http://www.swi-prolog.org - Copyright (C): 1985-2002, University of Amsterdam - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef MODEL_H_INCLUDED -#define MODEL_H_INCLUDED - -#define MAXOMITTED 32 - -#define CDATA_ELEMENT ((dtd_element *)1) - -typedef struct _dtd_state -{ struct _state_transition *transitions; - struct _state_expander *expander; -} dtd_state; - -dtd_state *new_dtd_state(void); -dtd_state * make_dtd_transition(dtd_state *here, dtd_element *e); -int same_state(dtd_state *final, dtd_state *here); -int find_omitted_path(dtd_state *state, dtd_element *e, - dtd_element **path); -dtd_state * make_state_engine(dtd_element *e); -void free_state_engine(dtd_state *state); -void state_allows_for(dtd_state *state, - dtd_element **allow, int *n); - -#endif /*MODEL_H_INCLUDED*/ diff --git a/packages/sgml/parser.c b/packages/sgml/parser.c deleted file mode 100644 index 816d5058b..000000000 --- a/packages/sgml/parser.c +++ /dev/null @@ -1,5598 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog - - Author: Jan Wielemaker - E-mail: wielemak@science.uva.nl - WWW: http://www.swi-prolog.org - Copyright (C): 1985-2006, University of Amsterdam - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#define _ISOC99_SOURCE 1 /* fwprintf(), etc prototypes */ - -#define DTD_IMPLEMENTATION 1 -#include <stdio.h> -#include <wchar.h> -#include "dtd.h" -#include "model.h" -#include "util.h" -#include "catalog.h" -#include "parser.h" -#include <stdlib.h> -#include <assert.h> -#include <stdarg.h> -#include <ctype.h> -#include <string.h> -#include "utf8.h" -#include <errno.h> -#include <wctype.h> -#include "xml_unicode.h" - -#define DEBUG(g) ((void)0) -#define ZERO_TERM_LEN (-1) /* terminated by nul */ - -#ifdef __WINDOWS__ -#define inline __inline -#define swprintf _snwprintf -#endif - - - /******************************* - * LOCAL TYPES * - *******************************/ - -typedef struct locbuf -{ dtd_srcloc start; /* p->startloc */ - dtd_srcloc here; /* p->location */ -} locbuf; - - - /******************************* - * PROTOYPES * - *******************************/ - -static const ichar * itake_name(dtd_parser *p, - const ichar *in, dtd_symbol **id); -static const ichar * itake_entity_name(dtd_parser *p, const ichar *in, - dtd_symbol **id); -static const ichar * itake_namegroup(dtd_parser *p, const ichar *decl, - dtd_symbol **names, int *n); -static const ichar * iskip_layout(dtd *dtd, const ichar *in); -static dtd_parser * clone_dtd_parser(dtd_parser *p); -static void free_model(dtd_model *m); -static int process_entity_declaration(dtd_parser *p, - const ichar *decl); -static void free_notations(dtd_notation *n); -static void free_shortrefs(dtd_shortref *sr); -static int process_cdata(dtd_parser *p, int last); -static int process_entity(dtd_parser *p, const ichar *name); -static int emit_cdata(dtd_parser *p, int last); -static dtd_space_mode istr_to_space_mode(const ichar *val); -static void update_space_mode(dtd_parser *p, dtd_element *e, - int natts, sgml_attribute *atts); -static dtd_model * make_model(dtd_parser *p, const ichar *decl, - const ichar **end); -static void for_elements_in_model(dtd_model *m, - void (*f)(dtd_element *e, - void *closure), - void *closure); -int putchar_dtd_parser(dtd_parser *p, int chr); -void free_dtd_parser(dtd_parser *p); -static const ichar * isee_character_entity(dtd *dtd, const ichar *in, - int *chr); -static int add_default_attributes(dtd_parser *p, dtd_element *e, - int natts, - sgml_attribute *atts); -static int prepare_cdata(dtd_parser *p); - - - /******************************* - * MACROS * - *******************************/ - -#define WITH_CLASS(p, c, g) \ - { sgml_event_class _oc = p->event_class; \ - p->event_class = c; \ - g; \ - p->event_class = _oc; \ - } - - /******************************* - * STATISTICS * - *******************************/ - -#ifdef O_STATISTICS - -int edefs_created = 0; -int edefs_freed = 0; -int edefs_implicit = 0; -int edefs_atts = 0; -int edefs_decl = 0; -int dtd_created = 0; -int dtd_freed = 0; - -void -sgml_statistics(void) -{ fprintf(stderr, "EDEFS: created %d; freed %d\n", edefs_created, edefs_freed); - fprintf(stderr, "EDEFS: implicit %d; atts %d; decl %d\n", - edefs_implicit, edefs_atts, edefs_decl); - fprintf(stderr, "DTDs: created: %d; freed: %d\n", dtd_created, dtd_freed); -} - -#define STAT(g) g - -#else - -#define STAT(g) ((void)0) - -#endif - - - /******************************* - * SRC LOCATION * - *******************************/ - - -static void /* TBD: also handle startloc */ -push_location(dtd_parser *p, locbuf *save) -{ save->here = p->location; - save->start = p->startloc; - - p->location.parent = &save->here; - p->startloc.parent = &save->start; -} - - -static void -pop_location(dtd_parser *p, locbuf *saved) -{ p->location = saved->here; - p->startloc = saved->start; -} - - -static inline void -_sgml_cplocation(dtd_srcloc *d, dtd_srcloc *loc) -{ d->type = loc->type; - d->name.file = loc->name.file; - d->line = loc->line; - d->linepos = loc->linepos; - d->charpos = loc->charpos; - /* but not the parent! */ -} - -void -sgml_cplocation(dtd_srcloc *d, dtd_srcloc *loc) -{ _sgml_cplocation(d, loc); -} - -#define sgml_cplocation(d,s) _sgml_cplocation(d, s) - -static void -inc_location(dtd_srcloc *l, int chr) -{ if ( chr == '\n' ) - { l->linepos = 0; - l->line++; - } - - l->linepos++; - l->charpos++; -} - - -static void -dec_location(dtd_srcloc *l, int chr) -{ if ( chr == '\n' ) - { l->linepos = 2; /* not good! */ - l->line--; - } - l->linepos--; - l->charpos--; -} - - /******************************* - * CLASSIFICATION PRIMITIVES * - *******************************/ - -static inline int -HasClass(dtd *dtd, wint_t chr, int mask) -{ if ( chr <= 0xff ) - return (dtd->charclass->class[(chr)] & (mask)); - else - { switch(mask) - { case CH_NAME: - return ( xml_basechar(chr) || - xml_digit(chr) || - xml_ideographic(chr) || - xml_combining_char(chr) || - xml_extender(chr) - ); - case CH_NMSTART: - return ( xml_basechar(chr) || - xml_ideographic(chr) ); - case CH_WHITE: - return FALSE; /* only ' ' and '\t' */ - case CH_BLANK: - return iswspace(chr); - case CH_DIGIT: - return xml_digit(chr); - case CH_RS: - case CH_RE: - return FALSE; - default: - assert(0); - return FALSE; - } - } -} - - -static const ichar * -isee_func(dtd *dtd, const ichar *in, charfunc func) -{ if ( dtd->charfunc->func[func] == *in ) - return ++in; - - return NULL; -} - - /******************************* - * SYMBOLS * - *******************************/ - -static dtd_symbol_table * -new_symbol_table() -{ dtd_symbol_table *t = sgml_calloc(1, sizeof(*t)); - t->size = SYMBOLHASHSIZE; - t->entries = sgml_calloc(t->size, sizeof(dtd_symbol*)); - - return t; -} - - -static void -free_symbol_table(dtd_symbol_table *t) -{ int i; - - for(i=0; i<t->size; i++) - { dtd_symbol *s, *next; - - for(s=t->entries[i]; s; s=next) - { next = s->next; - - sgml_free((ichar*)s->name); - sgml_free(s); - } - } - - sgml_free(t->entries); - sgml_free(t); -} - - -dtd_symbol * -dtd_find_symbol(dtd *dtd, const ichar *name) -{ dtd_symbol_table *t = dtd->symbols; - - if ( dtd->case_sensitive ) - { int k = istrhash(name, t->size); - dtd_symbol *s; - - for(s=t->entries[k]; s; s = s->next) - { if ( istreq(s->name, name) ) - return s; - } - } else - { int k = istrcasehash(name, t->size); - dtd_symbol *s; - - for(s=t->entries[k]; s; s = s->next) - { if ( istrcaseeq(s->name, name) ) - return s; - } - } - - return NULL; -} - - -static dtd_symbol * -dtd_find_entity_symbol(dtd *dtd, const ichar *name) -{ dtd_symbol_table *t = dtd->symbols; - - if ( dtd->ent_case_sensitive ) - { int k = istrhash(name, t->size); - dtd_symbol *s; - - for(s=t->entries[k]; s; s = s->next) - { if ( istreq(s->name, name) ) - return s; - } - } else - { int k = istrcasehash(name, t->size); - dtd_symbol *s; - - for(s=t->entries[k]; s; s = s->next) - { if ( istrcaseeq(s->name, name) ) - return s; - } - } - - return NULL; -} - - -dtd_symbol * -dtd_add_symbol(dtd *dtd, const ichar *name) -{ dtd_symbol_table *t = dtd->symbols; - int k = istrhash(name, t->size); - dtd_symbol *s; - - for(s=t->entries[k]; s; s = s->next) - { if ( istreq(s->name, name) ) - return s; - } - - s = sgml_calloc(1, sizeof(*s)); - s->name = istrdup(name); - s->next = t->entries[k]; - t->entries[k] = s; - - return s; -} - - - /******************************* - * ENTITIES * - *******************************/ - -static void -free_entity_list(dtd_entity *e) -{ dtd_entity *next; - - for( ; e; e=next) - { next = e->next; - - if ( e->value ) sgml_free(e->value); - if ( e->extid ) sgml_free(e->extid); - if ( e->exturl ) sgml_free(e->exturl); - if ( e->baseurl ) sgml_free(e->baseurl); - - sgml_free(e); - } -} - - -static dtd_entity * -find_pentity(dtd *dtd, dtd_symbol *id) -{ dtd_entity *e; - - for(e = dtd->pentities; e; e=e->next) - { if ( e->name == id ) - return e; - } - - return NULL; -} - - -/* returned path must be freed when done */ - -static ichar * -entity_file(dtd *dtd, dtd_entity *e) -{ switch(e->type) - { case ET_SYSTEM: - case ET_PUBLIC: - { const ichar *f; - - f = find_in_catalogue(e->catalog_location, - e->name->name, - e->extid, - e->exturl, - dtd->dialect != DL_SGML); - - if ( f ) /* owned by catalog */ - { ichar *file; - - if ( is_absolute_path(f) || !e->baseurl ) - file = istrdup(f); - else - file = localpath(e->baseurl, f); - - return file; - } - } - default: - return NULL; - } -} - - -static const ichar * -entity_value(dtd_parser *p, dtd_entity *e, int *len) -{ ichar *file; - - if ( !e->value && (file=entity_file(p->dtd, e)) ) - { int normalise = (e->content == EC_SGML || e->content == EC_CDATA); - size_t l; - - e->value = load_sgml_file_to_charp(file, normalise, &l); - e->length = (long)l; - sgml_free(file); - } - - if ( len ) - *len = e->length; - - return e->value; -} - - -static int -expand_pentities(dtd_parser *p, const ichar *in, int ilen, ichar *out, int len) -{ dtd *dtd = p->dtd; - int pero = dtd->charfunc->func[CF_PERO]; /* % */ - int ero = dtd->charfunc->func[CF_ERO]; /* & */ - const ichar *s; - const ichar *end; - - if ( ilen == ZERO_TERM_LEN ) - { end = in + wcslen(in); - } else - { end = &in[ilen]; - } - - while(in < end) - { if ( *in == pero ) - { dtd_symbol *id; - - if ( (s = itake_entity_name(p, in+1, &id)) ) - { dtd_entity *e = find_pentity(dtd, id); - const ichar *eval; - int l; - - in = s; - if ( (s=isee_func(dtd, s, CF_ERC)) ) /* ; is not obligatory? */ - in = s; - - if ( !e ) - return gripe(p, ERC_EXISTENCE, L"parameter entity", id->name); - - if ( !(eval = entity_value(p, e, NULL)) ) - return FALSE; - - if ( !expand_pentities(p, eval, ZERO_TERM_LEN, out, len) ) - return FALSE; - l = (int)istrlen(out); /* could be better */ - out += l; - len -= l; - - continue; - } - } - - if ( --len <= 0 ) - { gripe(p, ERC_REPRESENTATION, L"Declaration too long"); - return FALSE; - } - - if ( *in == ero && in[1] == '#' ) /* &# */ - { int chr; - - if ( (s=isee_character_entity(dtd, in, &chr)) ) - { if ( chr == 0 ) - { gripe(p, ERC_SYNTAX_ERROR, L"Illegal character entity", in); - } else - { *out++ = chr; - in = s; - continue; - } - } - } - - *out++ = *in++; - } - - *out = '\0'; - - return TRUE; -} - - -static int -char_entity_value(const ichar *decl) -{ if ( *decl == '#' ) - { const ichar *s = decl+1; - ichar *end; - long v; - - /* do octal too? */ - if ( s[0] == 'x' || s[0] == 'X' ) - v = wcstoul(s+1, &end, 16); - else - v = wcstoul(s, &end, 10); - - if ( *end == '\0' ) - { return (int)v; - } else if ( istreq(s, L"RS") ) - { return '\n'; - } else if ( istreq(s, L"RE") ) - { return '\r'; - } else if ( istreq(s, L"TAB") ) - { return '\t'; - } else if ( istreq(s, L"SPACE") ) - { return ' '; - } - } - - return -1; -} - - -static const ichar * -isee_character_entity(dtd *dtd, const ichar *in, int *chr) -{ const ichar *s; - - if ( (s=isee_func(dtd, in, CF_ERO)) && *s == '#' ) - { ichar e[32]; - ichar *o = e; - int v; - - *o++ = *s++; - while(o < e+sizeof(e)/sizeof(ichar)-1 && HasClass(dtd, *s, CH_NAME)) - *o++ = *s++; - if ( isee_func(dtd, s, CF_ERC)) /* skip ; */ - s++; - - *o = '\0'; - if ( (v=char_entity_value(e)) >= 0 ) - { *chr = v; - return s; - } - } - - return NULL; -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Expand entities in a string. Used to expand CDATA attribute values. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -static int -expand_entities(dtd_parser *p, const ichar *in, int len, ocharbuf *out) -{ const ichar *s; - const ichar *end = &in[len]; - dtd *dtd = p->dtd; - int ero = dtd->charfunc->func[CF_ERO]; /* & */ - - while(in < end) - { if ( *in == ero ) - { const ichar *estart = in; /* for recovery */ - int chr; - - if ( (s=isee_character_entity(dtd, in, &chr)) ) - { if ( chr == 0 ) - gripe(p, ERC_SYNTAX_ERROR, L"Illegal character entity", in); - - add_ocharbuf(out, chr); - in = s; - continue; - } - - if ( HasClass(dtd, in[1], CH_NMSTART) ) - { dtd_symbol *id; - dtd_entity *e; - const ichar *eval; - - if ( !(in = itake_name(p, in+1, &id)) ) - { in = estart; - goto recover; - } - if ( isee_func(dtd, in, CF_ERC) || *in == '\n' ) - in++; - - if ( !(e = id->entity) && !(e=dtd->default_entity) ) - { gripe(p, ERC_EXISTENCE, L"entity", id->name); - in = estart; - goto recover; - } - - if ( !(eval = entity_value(p, e, NULL)) ) - { gripe(p, ERC_NO_VALUE, e->name->name); - in = estart; - goto recover; - } - - if ( e->content == EC_SGML ) - { if ( !expand_entities(p, eval, (int)istrlen(eval), out) ) - return FALSE; - } else - { const ichar *s; - - for(s=eval; *s; s++) - add_ocharbuf(out, *s); - } - - continue; - } - - if ( dtd->dialect != DL_SGML ) - gripe(p, ERC_SYNTAX_ERROR, L"Illegal entity", estart); - } - - recover: - - if ( *in == CR && in[1] == LF ) - in++; - - if ( HasClass(dtd, *in, CH_BLANK) ) - { add_ocharbuf(out, ' '); - in++; - } else - { add_ocharbuf(out, *in++); - } - } - - terminate_ocharbuf(out); - - return TRUE; -} - - - - /******************************* - * ELEMENTS * - *******************************/ - -static dtd_element * -find_element(dtd *dtd, dtd_symbol *id) -{ dtd_element *e; - - if ( id->element ) - return id->element; /* must check */ - - e = sgml_calloc(1, sizeof(*e)); - e->space_mode = SP_INHERIT; - e->undefined = TRUE; - e->name = id; - id->element = e; - - e->next = dtd->elements; - dtd->elements = e; - - return e; -} - - -static dtd_edef * -new_element_definition(dtd *dtd) -{ dtd_edef *def = sgml_calloc(1, sizeof(*def)); - - STAT(edefs_created++); - - return def; -} - - -static dtd_element * -def_element(dtd *dtd, dtd_symbol *id) -{ dtd_element *e = find_element(dtd, id); - - if ( !e->structure ) - { e->structure = new_element_definition(dtd); - e->structure->references = 1; - e->structure->type = C_EMPTY; - } - - return e; -} - - -static void -free_name_list(dtd_name_list *nl) -{ dtd_name_list *next; - - for( ; nl; nl=next) - { next = nl->next; - - sgml_free(nl); - } -} - - -#define REFS_VIRGIN (-42) - -static void -free_attribute(dtd_attr *a) -{ if ( a->references == REFS_VIRGIN || --a->references == 0 ) - { switch(a->type) - { case AT_NAMEOF: - case AT_NOTATION: - free_name_list(a->typeex.nameof); - default: - ; - } - switch(a->def) - { case AT_DEFAULT: - case AT_FIXED: - { if ( a->islist ) - sgml_free(a->att_def.list); - else if ( a->type == AT_CDATA && a->att_def.cdata ) - sgml_free(a->att_def.cdata); - } - default: - ; - } - - sgml_free(a); - } -} - - -static void -free_attribute_list(dtd_attr_list *l) -{ dtd_attr_list *next; - - for(; l; l=next) - { next = l->next; - - free_attribute(l->attribute); - sgml_free(l); - } -} - - -static void -free_element_list(dtd_element_list *l) -{ dtd_element_list *next; - - for( ; l; l=next) - { next = l->next; - - sgml_free(l); - } -} - -static void -free_element_definition(dtd_edef *def) -{ if ( --def->references == 0 ) - { STAT(edefs_freed++); - if ( def->content ) - free_model(def->content); - free_element_list(def->included); - free_element_list(def->excluded); - free_state_engine(def->initial_state); - - sgml_free(def); - } -} - - -static void -free_elements(dtd_element *e) -{ dtd_element *next; - - for( ; e; e=next) - { next = e->next; - - if ( e->structure ) - free_element_definition(e->structure); - free_attribute_list(e->attributes); - - sgml_free(e); - } -} - - - /******************************* - * ATTRIBUTES * - *******************************/ - -static dtd_attr * -find_attribute(dtd_element *e, dtd_symbol *name) -{ dtd_attr_list *a; - - for(a=e->attributes; a; a=a->next) - { if ( a->attribute->name == name ) - return a->attribute; - } - - return NULL; -} - - - /******************************* - * PARSE PRIMITIVES * - *******************************/ - -static const ichar * -iskip_layout(dtd *dtd, const ichar *in) -{ ichar cmt = dtd->charfunc->func[CF_CMT]; /* also skips comment */ - - for( ; *in; in++ ) - { if ( HasClass(dtd, *in, CH_BLANK) ) - continue; - - if ( in[0] == cmt && in[1] == cmt ) - { in += 2; - - for( ; *in; in++ ) - { if ( in[0] == cmt && in[1] == cmt ) - break; - } - in++; - continue; - } - - return in; - } - - return in; -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -See whether we are looking at identifier "id". "id" must be lowercase! -This is only used for reserved words, and parsed case-insentive in both -XML and SGML modes. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -static const ichar * -isee_identifier(dtd *dtd, const ichar *in, char *id) -{ in = iskip_layout(dtd, in); - - /* match */ - while (*id && (wint_t)*id == towlower(*in) ) - id++, in++; - if ( *id == 0 && !HasClass(dtd, *in, CH_NAME) ) - return iskip_layout(dtd, in); - - return NULL; -} - - -static const ichar * -itake_name(dtd_parser *p, const ichar *in, dtd_symbol **id) -{ ichar buf[MAXNMLEN]; - ichar *o = buf; - ichar *e = &buf[MAXNMLEN]-1; - dtd *dtd = p->dtd; - - in = iskip_layout(dtd, in); - if ( !HasClass(dtd, *in, CH_NMSTART) ) - return NULL; - - if ( dtd->case_sensitive ) - { while( HasClass(dtd, *in, CH_NAME) && o < e ) - *o++ = *in++; - } else - { while( HasClass(dtd, *in, CH_NAME) && o < e ) - *o++ = towlower(*in++); - } - - if ( o == e ) - { gripe(p, ERC_REPRESENTATION, L"NAME too long"); - return NULL; - } - - *o++ = '\0'; - - *id = dtd_add_symbol(dtd, buf); - - return iskip_layout(dtd, in); -} - - -static const ichar * -itake_entity_name(dtd_parser *p, const ichar *in, dtd_symbol **id) -{ ichar buf[MAXNMLEN]; - ichar *o = buf; - ichar *e = &buf[MAXNMLEN]-1; - dtd *dtd = p->dtd; - - in = iskip_layout(dtd, in); - if ( !HasClass(dtd, *in, CH_NMSTART) ) - return NULL; - - if ( dtd->ent_case_sensitive ) - { while( HasClass(dtd, *in, CH_NAME) && o < e ) - *o++ = *in++; - } else - { while( HasClass(dtd, *in, CH_NAME) && o < e ) - *o++ = towlower(*in++); - } - if ( o == e ) - { gripe(p, ERC_REPRESENTATION, L"Entity NAME too long"); - return NULL; - } - - *o++ = '\0'; - - *id = dtd_add_symbol(dtd, buf); - - return in; -} - - -static const ichar * -itake_nmtoken(dtd_parser *p, const ichar *in, dtd_symbol **id) -{ ichar buf[MAXNMLEN]; - ichar *o = buf; - ichar *e = &buf[MAXNMLEN]-1; - dtd *dtd = p->dtd; - - in = iskip_layout(dtd, in); - if ( !HasClass(dtd, *in, CH_NAME) ) - return NULL; - if ( dtd->case_sensitive ) - { while( HasClass(dtd, *in, CH_NAME) && o < e ) - *o++ = *in++; - } else - { while( HasClass(dtd, *in, CH_NAME) && o < e ) - *o++ = towlower(*in++); - } - if ( o == e ) - { gripe(p, ERC_REPRESENTATION, L"NMTOKEN too long"); - return NULL; - } - - *o = '\0'; - - *id = dtd_add_symbol(dtd, buf); - - return iskip_layout(dtd, in); -} - - -static const ichar * -itake_nutoken(dtd_parser *p, const ichar *in, dtd_symbol **id) -{ ichar buf[MAXNMLEN]; - ichar *o = buf; - ichar *e = &buf[MAXNMLEN]-1; - dtd *dtd = p->dtd; - - in = iskip_layout(dtd, in); - if ( !HasClass(dtd, *in, CH_DIGIT) ) - return NULL; - - if ( dtd->case_sensitive ) - { while( HasClass(dtd, *in, CH_NAME) && o < e ) - *o++ = *in++; - } else - { while( HasClass(dtd, *in, CH_NAME) && o < e ) - *o++ = towlower(*in++); - } - - if ( o == e ) - { gripe(p, ERC_REPRESENTATION, L"NUTOKEN too long"); - return NULL; - } - - *o = '\0'; - if ( o - buf > 8 ) - gripe(p, ERC_LIMIT, L"nutoken length"); - - *id = dtd_add_symbol(dtd, buf); - - return iskip_layout(dtd, in); -} - - -static const ichar * -itake_number(dtd_parser *p, const ichar *in, dtd_attr *at) -{ dtd *dtd = p->dtd; - - in = iskip_layout(dtd, in); - - switch(dtd->number_mode) - { case NU_TOKEN: - { ichar buf[MAXNMLEN]; - ichar *o = buf; - - while( HasClass(dtd, *in, CH_DIGIT) ) - *o++ = *in++; - if ( o == buf ) - return NULL; /* empty */ - *o = '\0'; - at->att_def.name = dtd_add_symbol(dtd, buf); - - return iskip_layout(dtd, (const ichar *)in); - } - case NU_INTEGER: - { ichar *end; - - at->att_def.number = wcstol(in, &end, 10); - if ( end > in && errno != ERANGE ) - return iskip_layout(dtd, end); - } - } - - return NULL; -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Get a quoted value. After successful return, *start points to the start -of the string in the input and *len to the length. The data is *not* -nul terminated. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -static const ichar * -itake_string(dtd *dtd, const ichar *in, ichar **start, int *len) -{ in = iskip_layout(dtd, in); - - if ( isee_func(dtd, in, CF_LIT) || - isee_func(dtd, in, CF_LITA) ) - { ichar q = *in++; - - *start = (ichar *)in; - while( *in && *in != q ) - in++; - if ( *in ) - { *len = (int)(in - (*start)); - - return iskip_layout(dtd, ++in); - } - } - - return NULL; -} - - -static const ichar * -itake_dubbed_string(dtd *dtd, const ichar *in, ichar **out) -{ ichar *start; - int len; - const ichar *end; - - if ( (end=itake_string(dtd, in, &start, &len)) ) - *out = istrndup(start, len); - - return end; -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -itake_url() is used to get the argument of a SYSTEM or 2nd argument of a -PUBLIC reference. Once upon a time it tried to tag the argument as -file:<path>, but this job cannot be before lookup in the catalogue. It -is now the same as itake_dubbed_string(), so we simply call this one. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -static const ichar * -itake_url(dtd *dtd, const ichar *in, ichar **out) -{ return itake_dubbed_string(dtd, in, out); -} - - -static const ichar * -itake_nmtoken_chars(dtd_parser *p, const ichar *in, ichar *out, int len) -{ dtd *dtd = p->dtd; - - in = iskip_layout(dtd, in); - if ( !HasClass(dtd, *in, CH_NAME) ) - return NULL; - while( HasClass(dtd, *in, CH_NAME) ) - { if ( --len <= 0 ) - gripe(p, ERC_REPRESENTATION, L"Name token too long"); - *out++ = (dtd->case_sensitive ? *in++ : (ichar)towlower(*in++)); - } - *out++ = '\0'; - - return iskip_layout(dtd, in); -} - - -/* There used to be a function - - itake_nonblank_chars(dtd, in, out, len) -> new end - - which - - skipped layout, - - copied characters from in[] to out[] until layout or \0 was found, - - added a terminating \0 to out[], - - skipped any following layout, and - - returned the new position. - - That function was only called by get_attribute_value(), which used - it to parse an unquoted attribute value. According to SGML, that's - not right: unquoted attribute values must look like NMTOKENs (but - have a different length bound). In particular, elements like - <foo a=bar>zoo</foo> - <foo a=ugh/zip/ - are perfectly legal, so scanning an unquoted attribute value MUST - stop at a '/' or '>'. According to HTML practice, pretty much any - old junk will be accepted, and some HTML parsers will allow bare - slashes in such an attribute. - - Typical HTML is *so* bad that it doesn't agree with *any* part of - the HTML specifications (e.g., <FONT> is commonly wrapped around - block-level elements, which has never been legal). It's not clear - that there is much point in trying to accomodate bad HTML; if you - really need to do that, use the free program HTML Tidy (from the - http://www.w3c.org/ site) to clean up, and parse its output instead. - - However, in order to break as little as possible, the new (sgml-1.0.14) - function accepts anything except > / \0 and blanks. - -JW: I decided to accept / as part of an unquoted in SGML-mode if - shorttag is disabled as well as in XML mode if it is not the - end of the begin-element -*/ - -static ichar const * -itake_unquoted(dtd_parser *p, ichar const *in, ichar *out, int len) -{ dtd *dtd = p->dtd; - ichar const end2 = dtd->charfunc->func[CF_ETAGO2]; /* / */ - ichar c; - - /* skip leading layout. Do NOT skip comments! --x-- is a value! */ - while (c = *in, HasClass(dtd, c, CH_BLANK)) - in++; - - /* copy the attribute to out[] */ - while ( !HasClass(dtd, c, CH_BLANK) && - c != '\0' ) - { if ( c == end2 && (dtd->shorttag || - (in[1] == '\0' && dtd->dialect != DL_SGML)) ) - break; - - if ( --len > 0 ) - *out++ = c; - else if ( len == 0 ) - gripe(p, ERC_REPRESENTATION, L"Attribute too long"); - c = *++in; - } - *out = '\0'; - - /* skip trailing layout. While it is kind to skip comments here, - it is technically wrong to do so. Tags may not contain comments. - */ - - return iskip_layout(dtd, in); -} - - - /******************************* - * DTD * - *******************************/ - -dtd * -new_dtd(const ichar *doctype) -{ dtd *dtd = sgml_calloc(1, sizeof(*dtd)); - - STAT(dtd_created++); - dtd->magic = SGML_DTD_MAGIC; - dtd->implicit = TRUE; - dtd->dialect = DL_SGML; - if ( doctype ) - dtd->doctype = istrdup(doctype); - dtd->symbols = new_symbol_table(); - dtd->charclass = new_charclass(); - dtd->charfunc = new_charfunc(); - dtd->space_mode = SP_SGML; - dtd->ent_case_sensitive = TRUE; /* case-sensitive entities */ - dtd->shorttag = TRUE; /* allow for <tag/value/ */ - dtd->number_mode = NU_TOKEN; - - return dtd; -} - - -void -free_dtd(dtd *dtd) -{ if ( --dtd->references == 0 ) - { STAT(dtd_freed++); - - if ( dtd->doctype ) - sgml_free(dtd->doctype); - - free_entity_list(dtd->entities); - free_entity_list(dtd->pentities); - free_notations(dtd->notations); - free_shortrefs(dtd->shortrefs); - free_elements(dtd->elements); - free_symbol_table(dtd->symbols); - sgml_free(dtd->charfunc); - sgml_free(dtd->charclass); - dtd->magic = 0; - - sgml_free(dtd); - } -} - - -static const wchar_t *xml_entities[] = -{ L"lt CDATA \"&#60;\"", /* < */ - L"gt CDATA \"&#62;\"", /* > */ - L"amp CDATA \"&#38;\"", /* & */ - L"apos CDATA \"&#39;\"", /* ' */ - L"quot CDATA \"&#34;\"", /* " */ - NULL -}; - - -int -set_dialect_dtd(dtd *dtd, dtd_dialect dialect) -{ if ( dtd->dialect != dialect ) - { dtd->dialect = dialect; - - switch(dialect) - { case DL_SGML: - { dtd->case_sensitive = FALSE; - dtd->space_mode = SP_SGML; - dtd->shorttag = TRUE; - break; - } - case DL_XML: - case DL_XMLNS: - { const ichar **el; - dtd_parser p; - - dtd->case_sensitive = TRUE; - dtd->encoding = SGML_ENC_UTF8; - dtd->space_mode = SP_PRESERVE; - dtd->shorttag = FALSE; - - memset(&p, 0, sizeof(p)); - p.dtd = dtd; - for(el = xml_entities; *el; el++) - process_entity_declaration(&p, *el); - - break; - } - } - } - - return TRUE; -} - - -int -set_option_dtd(dtd *dtd, dtd_option option, int set) -{ switch(option) - { case OPT_SHORTTAG: - dtd->shorttag = set; - break; - } - - return TRUE; -} - - -static const ichar * -baseurl(dtd_parser *p) -{ if ( p->location.type == IN_FILE && p->location.name.file ) - { return p->location.name.file; - } - - return NULL; -} - - -static const ichar * -process_entity_value_declaration(dtd_parser *p, - const ichar *decl, dtd_entity *e) -{ dtd *dtd = p->dtd; - const ichar *s; - - if ( e->type == ET_SYSTEM ) - { if ( (s=itake_url(dtd, decl, &e->exturl)) ) - { e->baseurl = istrdup(baseurl(p)); - return s; - } - - goto string_expected; - } else - { ichar *start; int len; - ichar val[MAXSTRINGLEN]; - - if ( !(s = itake_string(dtd, decl, &start, &len)) ) - goto string_expected; - decl = s; - - expand_pentities(p, start, len, val, sizeof(val)/sizeof(ichar)); - - switch ( e->type ) - { case ET_PUBLIC: - { e->extid = istrdup(val); - if ( isee_func(dtd, decl, CF_LIT) || - isee_func(dtd, decl, CF_LITA) ) - { if ( (s=itake_url(dtd, decl, &e->exturl)) ) - { e->baseurl = istrdup(baseurl(p)); - decl = s; - } - } - return decl; - } - case ET_LITERAL: - { e->value = istrdup(val); - e->length = (int)wcslen(e->value); - return decl; - } - default: - assert(0); - return NULL; - } - } - -string_expected: - gripe(p, ERC_SYNTAX_ERROR, L"String expected", decl); - return NULL; -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -The sgml-standard tells us to accept the first definition of an entity, -silently suppressing any further attempt to redefine the entity. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -static int -process_entity_declaration(dtd_parser *p, const ichar *decl) -{ dtd *dtd = p->dtd; - const ichar *s; - dtd_symbol *id; - dtd_entity *e; - int isparam; - int isdef = FALSE; - /* parameter entity */ - if ( (s=isee_func(dtd, decl, CF_PERO)) ) - { isparam = TRUE; - decl = s; - } else - isparam = FALSE; - - if ( !(s = itake_entity_name(p, decl, &id)) ) - { if ( !(s = isee_identifier(dtd, decl, "#default")) ) - return gripe(p, ERC_SYNTAX_ERROR, L"Name expected", decl); - id = dtd_add_symbol(dtd, (ichar*)"#DEFAULT"); - isdef = TRUE; - } - - if ( isparam && find_pentity(dtd, id) ) - { gripe(p, ERC_REDEFINED, L"parameter entity", id); - return TRUE; /* already defined parameter entity */ - } - if ( id->entity ) - { gripe(p, ERC_REDEFINED, L"entity", id); - return TRUE; /* already defined normal entity */ - } - - decl = iskip_layout(dtd, s); - e = sgml_calloc(1, sizeof(*e)); - e->name = id; - e->catalog_location = (isparam ? CAT_PENTITY : CAT_ENTITY); - - if ( (s = isee_identifier(dtd, decl, "system")) ) - { e->type = ET_SYSTEM; - e->content = EC_SGML; - decl = s; - } else if ( (s = isee_identifier(dtd, decl, "public")) ) - { e->type = ET_PUBLIC; - e->content = EC_SGML; - decl = s; - } else - { e->type = ET_LITERAL; - - if ( !isparam ) - { if ( (s=isee_identifier(dtd, decl, "cdata")) ) - { decl = s; - e->content = EC_CDATA; - } else if ( (s=isee_identifier(dtd, decl, "sdata")) ) - { decl = s; - e->content = EC_SDATA; - } else if ( (s=isee_identifier(dtd, decl, "pi")) ) - { decl = s; - e->content = EC_PI; - } else if ( (s=isee_identifier(dtd, decl, "starttag")) ) - { decl = s; - e->content = EC_STARTTAG; - } else if ( (s=isee_identifier(dtd, decl, "endtag")) ) - { decl = s; - e->content = EC_ENDTAG; - } else - e->content = EC_SGML; - } - } - - if ( (decl=process_entity_value_declaration(p, decl, e)) ) - { if ( e->type == ET_LITERAL ) - { switch(e->content) - { case EC_STARTTAG: - { ichar *buf = sgml_malloc((e->length + 3)*sizeof(ichar)); - - buf[0] = dtd->charfunc->func[CF_STAGO]; - istrcpy(&buf[1], e->value); - buf[++e->length] = dtd->charfunc->func[CF_STAGC]; - buf[++e->length] = 0; - - sgml_free(e->value); - e->value = buf; - e->content = EC_SGML; - - break; - } - case EC_ENDTAG: - { ichar *buf = sgml_malloc((e->length + 4)*sizeof(ichar)); - - buf[0] = dtd->charfunc->func[CF_ETAGO1]; - buf[1] = dtd->charfunc->func[CF_ETAGO2]; - istrcpy(&buf[2], e->value); - e->length++; - buf[++e->length] = dtd->charfunc->func[CF_STAGC]; - buf[++e->length] = 0; - - sgml_free(e->value); - e->value = buf; - e->content = EC_SGML; - - break; - } - default: - break; - } - } else - { if ( *decl ) - { dtd_symbol *nname; - - if ( (s=isee_identifier(dtd, decl, "cdata")) ) - { decl = s; - e->content = EC_CDATA; - } else if ( (s=isee_identifier(dtd, decl, "sdata")) ) - { decl = s; - e->content = EC_SDATA; - } else if ( (s=isee_identifier(dtd, decl, "ndata")) ) - { decl = s; - e->content = EC_NDATA; - } else - return gripe(p, ERC_SYNTAX_ERROR, L"Bad datatype declaration", decl); - - if ( (s=itake_name(p, decl, &nname)) ) /* what is this? */ - { decl = s; - } else - return gripe(p, ERC_SYNTAX_ERROR, L"Bad notation declaration", decl); - } - } - - if ( *decl ) - return gripe(p, ERC_SYNTAX_ERROR, L"Unexpected end of declaraction", decl); - } - - if ( isparam ) - { e->next = dtd->pentities; - dtd->pentities = e; - } else - { e->name->entity = e; - e->next = dtd->entities; - dtd->entities = e; - } - - if ( isdef ) - dtd->default_entity = e; - - return TRUE; -} - - - /******************************* - * NOTATIONS * - *******************************/ - -static dtd_notation * -find_notation(dtd *dtd, dtd_symbol *name) -{ dtd_notation *n; - - for(n=dtd->notations; n; n = n->next) - { if ( n->name == name ) - return n; - } - - return NULL; -} - - -static void -add_notation(dtd *dtd, dtd_notation *not) -{ dtd_notation **n = &dtd->notations; - - for( ; *n; n = &(*n)->next) - ; - *n = not; -} - -static int -process_notation_declaration(dtd_parser *p, const ichar *decl) -{ dtd *dtd = p->dtd; - dtd_symbol *nname; - const ichar *s; - ichar *system = NULL, *public = NULL; - dtd_notation *not; - - if ( !(s=itake_name(p, decl, &nname)) ) - return gripe(p, ERC_SYNTAX_ERROR, L"Notation name expected", decl); - decl = s; - - if ( find_notation(dtd, nname) ) - { gripe(p, ERC_REDEFINED, L"notation", nname); - return TRUE; - } - - if ( (s=isee_identifier(dtd, decl, "system")) ) - { ; - } else if ( (s=isee_identifier(dtd, decl, "public")) ) - { decl = s; - if ( !(s=itake_dubbed_string(dtd, decl, &public)) ) - return gripe(p, ERC_SYNTAX_ERROR, L"Public identifier expected", decl); - } else - return gripe(p, ERC_SYNTAX_ERROR, L"SYSTEM or PUBLIC expected", decl); - - decl = s; - if ( (s=itake_dubbed_string(dtd, decl, &system)) ) - decl = s; - - if ( *decl ) - return gripe(p, ERC_SYNTAX_ERROR, L"Unexpected end of declaraction", decl); - - not = sgml_calloc(1, sizeof(*not)); - not->name = nname; - not->system = system; - not->public = public; - not->next = NULL; - add_notation(dtd, not); - - return TRUE; -} - - -static void -free_notations(dtd_notation *n) -{ dtd_notation *next; - - for( ; n; n=next) - { next = n->next; - - sgml_free(n->system); - sgml_free(n->public); - - sgml_free(n); - } -} - - /******************************* - * SHORTREF * - *******************************/ - -static void -free_maps(dtd_map *map) -{ dtd_map *next; - - for( ; map; map=next) - { next = map->next; - if ( map->from ) - sgml_free(map->from); - sgml_free(map); - } -} - - -static void -free_shortrefs(dtd_shortref *sr) -{ dtd_shortref *next; - - for( ; sr; sr=next) - { next = sr->next; - free_maps(sr->map); - sgml_free(sr); - } -} - - -static const ichar * -shortref_add_map(dtd_parser *p, const ichar *decl, dtd_shortref *sr) -{ ichar *start; int len; - ichar from[MAXMAPLEN]; - ichar *f = from; - dtd_symbol *to; - const ichar *s; - const ichar *end; - dtd *dtd = p->dtd; - dtd_map **prev; - dtd_map *m; - - if ( !(s=itake_string(dtd, decl, &start, &len)) ) - { gripe(p, ERC_SYNTAX_ERROR, L"map-string expected", decl); - return NULL; - } - decl = s; - if ( !(s=itake_entity_name(p, decl, &to)) ) - { gripe(p, ERC_SYNTAX_ERROR, L"map-to name expected", decl); - return NULL; - } - end = s; - - for(decl=start; len > 0;) - { if ( *decl == 'B' ) /* blank */ - { if ( decl[1] == 'B' ) - { *f++ = CHR_DBLANK; - decl += 2; - len -= 2; - continue; - } - *f++ = CHR_BLANK; - decl++; - len--; - } else - { *f++ = *decl++; /* any other character */ - len--; - } - } - *f = 0; - - for(prev=&sr->map; *prev; prev = &(*prev)->next) - ; - - m = sgml_calloc(1, sizeof(*m)); - m->from = istrdup(from); - m->len = (int)istrlen(from); - m->to = to; - - *prev = m; - - return end; -} - - -static dtd_shortref * -def_shortref(dtd_parser *p, dtd_symbol *name) -{ dtd *dtd = p->dtd; - dtd_shortref *sr, **pr; - - for(pr=&dtd->shortrefs; *pr; pr = &(*pr)->next) - { dtd_shortref *r = *pr; - - if ( r->name == name ) - return r; - } - - sr = sgml_calloc(1, sizeof(*sr)); - sr->name = name; - *pr = sr; - - return sr; -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Create an array with TRUE in any character that can be the last of the -shortref map. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -static void -compile_map(dtd *dtd, dtd_shortref *sr) -{ dtd_map *map; - - for(map = sr->map; map; map = map->next) - { ichar last = map->from[map->len-1]; - - switch( last ) - { case CHR_BLANK: - case CHR_DBLANK: - { wint_t i; - - for( i=0; i< SHORTMAP_SIZE; i++) - { if ( HasClass(dtd, i, CH_BLANK) ) - sr->ends[i] = TRUE; - } - } - - default: - sr->ends[last] = TRUE; - } - } -} - - -static int -process_shortref_declaration(dtd_parser *p, const ichar *decl) -{ dtd *dtd = p->dtd; - ichar buf[MAXDECL]; - dtd_shortref *sr; - dtd_symbol *name; - const ichar *s; - - if ( !expand_pentities(p, decl, ZERO_TERM_LEN, buf, sizeof(buf)/sizeof(ichar)) ) - return FALSE; - decl = buf; - - if ( !(s=itake_name(p, decl, &name)) ) - return gripe(p, ERC_SYNTAX_ERROR, L"Name expected", decl); - decl = s; - - sr = def_shortref(p, name); - if ( sr->defined ) - { gripe(p, ERC_REDEFINED, L"shortref", name); - - return TRUE; - } - - sr->defined = TRUE; - - while( *(decl = iskip_layout(dtd, decl)) != '\0' - && (s=shortref_add_map(p, decl, sr)) ) - decl = s; - compile_map(dtd, sr); - - if ( *decl ) - return gripe(p, ERC_SYNTAX_ERROR, L"Map expected", decl); - - return TRUE; -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Find named name. The name NULL stands for the #empty map - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -static dtd_shortref * -find_map(dtd *dtd, dtd_symbol *name) -{ dtd_shortref *sr; - - if ( !name ) - { static dtd_shortref *empty; - - if ( !empty ) - { empty = sgml_calloc(1, sizeof(*empty)); - empty->name = dtd_add_symbol(dtd, (ichar*)"#EMPTY"); - empty->defined = TRUE; - } - - return empty; - } - - for( sr = dtd->shortrefs; sr; sr = sr->next ) - { if ( sr->name == name ) - { if ( !sr->defined ) - break; - - return sr; - } - } - - return NULL; -} - - -static void -set_map_element(dtd_element *e, void *closure) -{ e->map = closure; -} - - -static int -process_usemap_declaration(dtd_parser *p, const ichar *decl) -{ dtd *dtd = p->dtd; - ichar buf[MAXDECL]; - dtd_symbol *name; - const ichar *s; - dtd_symbol *ename; - dtd_element *e; - dtd_shortref *map; - - if ( !expand_pentities(p, decl, ZERO_TERM_LEN, buf, sizeof(buf)/sizeof(ichar)) ) - return FALSE; - decl = buf; - - if ( !(s=itake_name(p, decl, &name)) ) - { if ( (s=isee_identifier(dtd, decl, "#empty")) ) - name = NULL; - else - return gripe(p, ERC_SYNTAX_ERROR, L"map-name expected", decl); - } - - decl = s; - if ( !(map = find_map(dtd, name)) ) - map = def_shortref(p, name); /* make undefined map */ - - if ( isee_func(dtd, decl, CF_GRPO) ) /* ( */ - { dtd_model *model; - - if ( (model = make_model(p, decl, &s)) ) - { for_elements_in_model(model, set_map_element, map); - free_model(model); - decl = s; - } else - return FALSE; - } else if ( (s=itake_name(p, decl, &ename)) ) - { e = find_element(dtd, ename); - e->map = map; - decl = s; - } else if ( p->environments ) - { if ( !map->defined ) - gripe(p, ERC_EXISTENCE, L"map", name->name); - - p->environments->map = map; - p->map = p->environments->map; - } else - return gripe(p, ERC_SYNTAX_ERROR, L"element-name expected", decl); - - if ( *decl ) - return gripe(p, ERC_SYNTAX_ERROR, L"Unparsed", decl); - - return TRUE; -} - - -static int -match_map(dtd *dtd, dtd_map *map, ocharbuf *buf) -{ wchar_t *data = buf->data.w; - wchar_t *e = data+buf->size-1; - ichar *m = map->from+map->len-1; - - while( m >= map->from ) - { if ( e < data ) - return 0; - - if ( *m == *e ) - { m--; - e--; - continue; - } - if ( *m == CHR_DBLANK ) - { if ( e>data && HasClass(dtd, *e, CH_WHITE) ) - e--; - else - return FALSE; - goto wblank; - } - if ( *m == CHR_BLANK ) - { wblank: - while( e>data && HasClass(dtd, *e, CH_WHITE) ) - e--; - m--; - continue; - } - return 0; - } - - return (int)(data+buf->size-1-e); -} - - -static int -match_shortref(dtd_parser *p) -{ dtd_map *map; - - for(map = p->map->map; map; map = map->next) - { int len; - - if ( (len=match_map(p->dtd, map, p->cdata)) ) - { p->cdata->size -= len; - - if ( p->cdata_must_be_empty ) - { int blank = TRUE; - const wchar_t *s; - int i; - - for(s = p->cdata->data.w, i=0; i++ < p->cdata->size; s++) - { if ( !iswspace(*s) ) - { blank = FALSE; - break; - } - } - - p->blank_cdata = blank; - } - - WITH_CLASS(p, EV_SHORTREF, - { sgml_cplocation(&p->startloc, &p->location); - p->startloc.charpos -= len; - p->startloc.linepos -= len; - if ( p->startloc.linepos < 0 ) - { p->startloc.line--; - p->startloc.linepos = 0; /* not correct! */ - } - DEBUG(printf("%d-%d: Matched map '%s' --> %s, len = %d\n", - p->startloc.charpos, - p->location.charpos, - map->from, map->to->name, len)); - - process_entity(p, map->to->name); - }) /* TBD: optimise */ - return TRUE; - } - } - - return FALSE; -} - - - /******************************* - * ELEMENTS * - *******************************/ - -static void -add_submodel(dtd_model *m, dtd_model *sub) -{ dtd_model **d; - - for( d = &m->content.group; *d; d = &(*d)->next ) - ; - *d = sub; -} - - -/* for_elements_in_model() - Walk along the model, calling f(e, closure) for any element found - in the model. Used for <!SHORTREF name model> -*/ - -static void -for_elements_in_model(dtd_model *m, - void (*f)(dtd_element *e, void *closure), - void *closure) -{ switch(m->type) - { case MT_SEQ: - case MT_AND: - case MT_OR: - { dtd_model *sub = m->content.group; - - for(; sub; sub = sub->next) - for_elements_in_model(sub, f, closure); - break; - } - case MT_ELEMENT: - (*f)(m->content.element, closure); - break; - default: - ; - } -} - - -static void -free_model(dtd_model *m) -{ switch(m->type) - { case MT_SEQ: - case MT_AND: - case MT_OR: - { dtd_model *sub = m->content.group; - dtd_model *next; - - for(; sub; sub = next) - { next = sub->next; - - free_model(sub); - } - } - default: - ; - } - - sgml_free(m); -} - - -static dtd_model * -make_model(dtd_parser *p, const ichar *decl, const ichar **end) -{ const ichar *s; - dtd_model *m = sgml_calloc(1, sizeof(*m)); - dtd_symbol *id; - dtd *dtd = p->dtd; - - decl = iskip_layout(dtd, decl); - - if ( (s=isee_identifier(dtd, decl, "#pcdata")) ) - { m->type = MT_PCDATA; - m->cardinality = MC_ONE; /* actually don't care */ - *end = s; - return m; - } - - if ( (s=itake_name(p, decl, &id)) ) - { m->type = MT_ELEMENT; - m->content.element = find_element(dtd, id); - decl = s; - } else - { if ( !(s=isee_func(dtd, decl, CF_GRPO)) ) - { gripe(p, ERC_SYNTAX_ERROR, L"Name group expected", decl); - free_model(m); - return NULL; - } - decl = s; - - for(;;) - { dtd_model *sub; - modeltype mt; - - if ( !(sub = make_model(p, decl, &s)) ) - { free_model(sub); - return NULL; - } - decl = s; - add_submodel(m, sub); - - if ( (s = isee_func(dtd, decl, CF_OR)) ) - { decl = s; - mt = MT_OR; - } else if ( (s = isee_func(dtd, decl, CF_SEQ)) ) - { decl = s; - mt = MT_SEQ; - } else if ( (s = isee_func(dtd, decl, CF_AND)) ) - { decl = s; - mt = MT_AND; - } else if ( (s = isee_func(dtd, decl, CF_GRPC)) ) - { decl = s; - break; - } else - { gripe(p, ERC_SYNTAX_ERROR, L"Connector ('|', ',' or '&') expected", decl); - free_model(m); - return NULL; - } - decl = iskip_layout(dtd, decl); - - if ( m->type != mt ) - { if ( !m->type ) - m->type = mt; - else - { gripe(p, ERC_SYNTAX_ERROR, L"Different connector types in model", decl); - free_model(m); - return NULL; - } - } - } - } - - if ( (s = isee_func(dtd, decl, CF_OPT)) ) - { decl = s; - m->cardinality = MC_OPT; - } else if ( (s=isee_func(dtd, decl, CF_REP)) ) - { decl = s; - m->cardinality = MC_REP; - } else if ( (s=isee_func(dtd, decl, CF_PLUS)) ) - { /* ROK: watch out for (x) +(y) */ - if ( isee_func(dtd, iskip_layout(dtd, s), CF_GRPO) == NULL ) - { decl = s; - m->cardinality = MC_PLUS; - } - } else - m->cardinality = MC_ONE; - - if ( m->type == MT_UNDEF ) /* simplify (e+), etc. */ - { dtd_model *sub = m->content.group; - modelcard card; - - assert(!sub->next); - if ( sub->cardinality == MC_ONE ) - card = m->cardinality; - else if ( m->cardinality == MC_ONE ) - card = sub->cardinality; - else - { m->type = MT_OR; - goto out; - } - - *m = *sub; - m->cardinality = card; - sgml_free(sub); - } - -out: - *end = iskip_layout(dtd, decl); - return m; -} - - -static const ichar * -process_model(dtd_parser *p, dtd_edef *e, const ichar *decl) -{ const ichar *s; - dtd *dtd = p->dtd; - - decl = iskip_layout(dtd, decl); - if ( (s = isee_identifier(dtd, decl, "empty")) ) - { e->type = C_EMPTY; - return s; - } - if ( (s = isee_identifier(dtd, decl, "cdata")) ) - { e->type = C_CDATA; - return s; - } - if ( (s = isee_identifier(dtd, decl, "rcdata")) ) - { e->type = C_RCDATA; - return s; - } - if ( (s = isee_identifier(dtd, decl, "any")) ) - { e->type = C_ANY; - return s; - } - - e->type = C_PCDATA; - if ( !(e->content = make_model(p, decl, &decl)) ) - return FALSE; - - return decl; -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -See a name-group separator. As long as we haven't decided, this can be -CF_NG. If we have decided they must all be the same. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -static const ichar * -isee_ngsep(dtd *dtd, const ichar *decl, charfunc *sep) -{ const ichar *s; - - if ( (s=isee_func(dtd, decl, *sep)) ) - return iskip_layout(dtd, s); - if ( *sep == CF_NG ) /* undecided */ - { static const charfunc ng[] = { CF_SEQ, CF_OR, CF_AND }; - int n; - - for(n=0; n<3; n++) - { if ( (s=isee_func(dtd, decl, ng[n])) ) - { *sep = ng[n]; - return iskip_layout(dtd, s); - } - } - } - - return NULL; -} - - - -static const ichar * -itake_namegroup(dtd_parser *p, const ichar *decl, - dtd_symbol **names, int *n) -{ const ichar *s; - int en = 0; - dtd *dtd = p->dtd; - - if ( (s=isee_func(dtd, decl, CF_GRPO)) ) - { charfunc ngs = CF_NG; - - for(;;) - { if ( !(decl=itake_name(p, s, &names[en++])) ) - { gripe(p, ERC_SYNTAX_ERROR, L"Name expected", s); - return NULL; - } - if ( (s=isee_ngsep(dtd, decl, &ngs)) ) - { decl = iskip_layout(dtd, s); - continue; - } - if ( (s=isee_func(dtd, decl, CF_GRPC)) ) - { *n = en; - decl = s; - return iskip_layout(dtd, decl); - } - gripe(p, ERC_SYNTAX_ERROR, L"Bad name-group", decl); - return NULL; - } - } - - return NULL; -} - - -typedef struct -{ dtd_symbol **list; - int size; -} namelist; - - -static void -add_list_element(dtd_element *e, void *closure) -{ namelist *nl = closure; - - nl->list[nl->size++] = e->name; -} - - -static const ichar * -itake_el_or_model_element_list(dtd_parser *p, - const ichar *decl, dtd_symbol **names, int *n) -{ const ichar *s; - dtd *dtd = p->dtd; - - if ( isee_func(dtd, decl, CF_GRPO) ) - { dtd_model *model; - - if ( (model = make_model(p, decl, &s)) ) - { namelist nl; - - nl.list = names; - nl.size = 0; - for_elements_in_model(model, add_list_element, &nl); - free_model(model); - - *n = nl.size; - return s; - } else - return NULL; - } else - { if ( !(s = itake_name(p, decl, &names[0])) ) - { gripe(p, ERC_SYNTAX_ERROR, L"Name expected", decl); - return NULL; - } - *n = 1; - return s; - } -} - - -static void -add_element_list(dtd_element_list **l, dtd_element *e) -{ dtd_element_list *n = sgml_calloc(1, sizeof(*n)); - - n->value = e; - - for( ; *l; l = &(*l)->next ) - ; - *l = n; -} - - -static int -process_element_declaraction(dtd_parser *p, const ichar *decl) -{ dtd *dtd = p->dtd; - ichar buf[MAXDECL]; - const ichar *s; - dtd_symbol *eid[MAXATTELEM]; - dtd_edef *def; - int en; - int i; - - /* expand parameter entities */ - if ( !expand_pentities(p, decl, ZERO_TERM_LEN, - buf, sizeof(buf)/sizeof(ichar)) ) - return FALSE; - decl = buf; - - if ( !(s=itake_el_or_model_element_list(p, decl, eid, &en)) ) - return gripe(p, ERC_SYNTAX_ERROR, L"Name or name-group expected", decl); - decl = s; - if ( en == 0 ) - return TRUE; /* 0 elements */ - - STAT(edefs_decl++); - def = new_element_definition(dtd); - for(i=0; i<en; i++) - { find_element(dtd, eid[i]); - assert(eid[i]->element->structure == NULL); - eid[i]->element->structure = def; - eid[i]->element->undefined = FALSE; - } - def->references = en; /* for GC */ - - /* omitted tag declarations (opt) */ - if ( (s = isee_identifier(dtd, decl, "-")) ) - { def->omit_close = FALSE; - goto seeclose; - } else if ( (s = isee_identifier(dtd, decl, "o")) ) - { def->omit_open = TRUE; - - seeclose: - decl = s; - if ( (s = isee_identifier(dtd, decl, "-")) ) - { def->omit_close = FALSE; - } else if ( (s = isee_identifier(dtd, decl, "o")) ) - { for(i=0; i<en; i++) - def->omit_close = TRUE; - } else - return gripe(p, ERC_SYNTAX_ERROR, L"Bad omit-tag declaration", decl); - - decl = s; - } - - /* content model */ - if ( !(decl=process_model(p, def, decl)) ) - return FALSE; - - /* in/excluded elements */ - if ( decl[0] == '-' || decl[0] == '+' ) - { dtd_symbol *ng[MAXNAMEGROUP]; - int ns; - dtd_element_list **l; - - if ( decl[0] == '-' ) - l = &def->excluded; - else - l = &def->included; - - decl++; - if ( (s=itake_namegroup(p, decl, ng, &ns)) ) - { int i; - - decl = s; - - for(i=0; i<ns; i++) - add_element_list(l, find_element(dtd, ng[i])); - } else - { return gripe(p, ERC_SYNTAX_ERROR, L"Name group expected", decl); - } - } - - if (*decl) - return gripe(p, ERC_SYNTAX_ERROR, L"Unexpected end of declaration", decl); - - return TRUE; -} - - -static void -add_name_list(dtd_name_list **nl, dtd_symbol *s) -{ dtd_name_list *n = sgml_calloc(1, sizeof(*n)); - - n->value = s; - - for( ; *nl; nl = &(*nl)->next ) - ; - - *nl = n; -} - - -static void -set_element_properties(dtd_element *e, dtd_attr *a) -{ if ( istreq(a->name->name, L"xml:space") ) - { switch(a->def) - { case AT_FIXED: - case AT_DEFAULT: - break; - default: - return; - } - - switch (a->type ) - { case AT_NAMEOF: - case AT_NAME: - case AT_NMTOKEN: - e->space_mode = istr_to_space_mode(a->att_def.name->name); - break; - case AT_CDATA: - e->space_mode = istr_to_space_mode((ichar *)a->att_def.cdata); - break; - default: - break; - } - } -} - - -static void -add_attribute(dtd_parser *p, dtd_element *e, dtd_attr *a) -{ dtd_attr_list **l; - dtd_attr_list *n; - - for(l = &e->attributes; *l; l = &(*l)->next) - { if ( (*l)->attribute->name == a->name ) - { gripe(p, ERC_REDEFINED, L"attribute", a->name); - a->references++; /* attempt to redefine attribute: */ - free_attribute(a); /* first wins according to standard */ - - return; - } - } - - n = sgml_calloc(1, sizeof(*n)); - - n->attribute = a; - a->references++; - *l = n; - set_element_properties(e, a); -} - - -static int -process_attlist_declaraction(dtd_parser *p, const ichar *decl) -{ dtd *dtd = p->dtd; - dtd_symbol *eid[MAXATTELEM]; - int i, en; - ichar buf[MAXDECL]; - const ichar *s; - - /* expand parameter entities */ - if ( !expand_pentities(p, decl, ZERO_TERM_LEN, buf, sizeof(buf)/sizeof(ichar)) ) - return FALSE; - decl = iskip_layout(dtd, buf); - DEBUG(printf("Expanded to %s\n", decl)); - - if ( !(decl=itake_el_or_model_element_list(p, decl, eid, &en)) ) - return FALSE; - - /* fetch attributes */ - while(*decl) - { dtd_attr *at = sgml_calloc(1, sizeof(*at)); - at->references = REFS_VIRGIN; - - /* name of attribute */ - if ( !(s = itake_name(p, decl, &at->name)) ) - { free_attribute(at); - return gripe(p, ERC_SYNTAX_ERROR, L"Name expected", decl); - } - decl = s; - - /* (name1|name2|...) type */ - if ( (s=isee_func(dtd, decl, CF_GRPO)) ) - { charfunc ngs = CF_NG; - - at->type = AT_NAMEOF; - decl=s; - - for(;;) - { dtd_symbol *nm; - - if ( !(s = itake_nmtoken(p, decl, &nm)) ) - { free_attribute(at); - return gripe(p, ERC_SYNTAX_ERROR, L"Name expected", decl); - } - decl = s; - add_name_list(&at->typeex.nameof, nm); - if ( (s=isee_ngsep(dtd, decl, &ngs)) ) - { decl = s; - continue; - } - if ( (s = isee_func(dtd, decl, CF_GRPC)) ) - { decl=s; - decl = iskip_layout(dtd, decl); - break; - } - free_attribute(at); - return gripe(p, ERC_SYNTAX_ERROR, L"Illegal name-group", decl); - } - } else if ( (s=isee_identifier(dtd, decl, "cdata")) ) - { decl = s; - at->type = AT_CDATA; - } else if ( (s=isee_identifier(dtd, decl, "entity")) ) - { decl = s; - at->type = AT_ENTITY; - } else if ( (s=isee_identifier(dtd, decl, "entities")) ) - { decl = s; - at->type = AT_ENTITIES; - at->islist = TRUE; - } else if ( (s=isee_identifier(dtd, decl, "id")) ) - { decl = s; - at->type = AT_ID; - } else if ( (s=isee_identifier(dtd, decl, "idref")) ) - { decl = s; - at->type = AT_IDREF; - } else if ( (s=isee_identifier(dtd, decl, "idrefs")) ) - { decl = s; - at->type = AT_IDREFS; - at->islist = TRUE; - } else if ( (s=isee_identifier(dtd, decl, "name")) ) - { decl = s; - at->type = AT_NAME; - } else if ( (s=isee_identifier(dtd, decl, "names")) ) - { decl = s; - at->type = AT_NAMES; - at->islist = TRUE; - } else if ( (s=isee_identifier(dtd, decl, "nmtoken")) ) - { decl = s; - at->type = AT_NMTOKEN; - } else if ( (s=isee_identifier(dtd, decl, "nmtokens")) ) - { decl = s; - at->type = AT_NMTOKENS; - at->islist = TRUE; - } else if ( (s=isee_identifier(dtd, decl, "number")) ) - { decl = s; - at->type = AT_NUMBER; - } else if ( (s=isee_identifier(dtd, decl, "numbers")) ) - { decl = s; - at->type = AT_NUMBERS; - at->islist = TRUE; - } else if ( (s=isee_identifier(dtd, decl, "nutoken")) ) - { decl = s; - at->type = AT_NUTOKEN; - } else if ( (s=isee_identifier(dtd, decl, "nutokens")) ) - { decl = s; - at->type = AT_NUTOKENS; - at->islist = TRUE; - } else if ( (s=isee_identifier(dtd, decl, "notation")) ) - { dtd_symbol *ng[MAXNAMEGROUP]; - int ns; - - at->type = AT_NOTATION; - decl=s; - if ( (s=itake_namegroup(p, decl, ng, &ns)) ) - { decl = s; - - for(i=0; i<ns; i++) - add_name_list(&at->typeex.nameof, ng[i]); - } else - { free_attribute(at); - return gripe(p, ERC_SYNTAX_ERROR, L"name-group expected", decl); - } - } else - { free_attribute(at); - return gripe(p, ERC_SYNTAX_ERROR, L"Attribute-type expected", decl); - } - - /* Attribute Defaults */ - if ( (s=isee_identifier(dtd, decl, "#fixed")) ) - { decl = s; - at->def = AT_FIXED; - } else if ( (s=isee_identifier(dtd, decl, "#required")) ) - { decl = s; - at->def = AT_REQUIRED; - } else if ( (s=isee_identifier(dtd, decl, "#current")) ) - { decl = s; - at->def = AT_CURRENT; - } else if ( (s=isee_identifier(dtd, decl, "#conref")) ) - { decl = s; - at->def = AT_CONREF; - } else if ( (s=isee_identifier(dtd, decl, "#implied")) ) - { decl = s; - at->def = AT_IMPLIED; - } else /* real default */ - at->def = AT_DEFAULT; - - if ( at->def == AT_DEFAULT || at->def == AT_FIXED ) - { ichar buf[MAXSTRINGLEN]; - ichar *start; int len; - const ichar *end; - - if ( !(end=itake_string(dtd, decl, &start, &len)) ) - { end=itake_nmtoken_chars(p, decl, buf, sizeof(buf)/sizeof(ichar)); - start = buf; - len = (int)istrlen(buf); - } - if ( !end ) - return gripe(p, ERC_SYNTAX_ERROR, L"Bad attribute default", decl); - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Note: itake_name(), etc. work on nul-terminated strings. The result of -itake_string() is a pointer in a nul-terminated string and these -functions will stop scanning at the quote anyway, so we can use the -length of the parsed data to verify we parsed all of it. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - - switch(at->type) - { case AT_CDATA: - { at->att_def.cdata = istrndup(start, len); - break; - } - case AT_ENTITY: - case AT_NOTATION: - case AT_NAME: - { if ( !(s=itake_name(p, start, &at->att_def.name)) || - (s-start) != len ) - return gripe(p, ERC_DOMAIN, L"name", decl); - break; - } - case AT_NMTOKEN: - case AT_NAMEOF: - { if ( !(s=itake_nmtoken(p, start, &at->att_def.name)) || - (s-start) != len ) - return gripe(p, ERC_DOMAIN, L"nmtoken", decl); - break; - } - case AT_NUTOKEN: - { if ( !(s=itake_nutoken(p, start, &at->att_def.name)) || - (s-start) != len ) - return gripe(p, ERC_DOMAIN, L"nutoken", decl); - break; - } - case AT_NUMBER: - { if ( !(s=itake_number(p, start, at)) || - (s-start) != len ) - return gripe(p, ERC_DOMAIN, L"number", decl); - break; - } - case AT_NAMES: - case AT_ENTITIES: - case AT_IDREFS: - case AT_NMTOKENS: - case AT_NUMBERS: - case AT_NUTOKENS: - { at->att_def.list = istrndup(buf, len); - break; - } - default: - { free_attribute(at); - return gripe(p, ERC_REPRESENTATION, L"No default for type"); - } - } - - decl = end; - } - - /* add to list */ - at->references = 0; - for(i=0; i<en; i++) - { dtd_element *e = def_element(dtd, eid[i]); - - add_attribute(p, e, at); - } - } - - return TRUE; -} - - /******************************* - * GENERIC TAG PROCESSING * - *******************************/ - -typedef enum -{ IE_NORMAL, - IE_INCLUDED, /* is included */ - IE_EXCLUDED /* is excluded */ -} includetype; - - -static includetype -in_or_excluded(sgml_environment *env, dtd_element *e) -{ for(; env; env=env->parent) - { if ( env->element->structure ) - { dtd_edef *def = env->element->structure; - dtd_element_list *el; - - for(el=def->excluded; el; el=el->next) - { if ( el->value == e ) - return IE_EXCLUDED; - } - for(el=def->included; el; el=el->next) - { if ( el->value == e ) - return IE_INCLUDED; - } - } - } - - return IE_NORMAL; -} - - -static int -complete(sgml_environment *env) -{ if ( env->element->structure && - !env->element->undefined && - env->element->structure->type != C_ANY ) - { dtd_edef *def = env->element->structure; - - if ( !same_state(def->final_state, env->state) ) - return FALSE; - } - - return TRUE; -} - - -static void -validate_completeness(dtd_parser *p, sgml_environment *env) -{ if ( !complete(env) ) - { wchar_t buf[MAXNMLEN+50]; - - swprintf(buf, MAXNMLEN+50, L"Incomplete element: <%s>", - env->element->name->name); - - gripe(p, ERC_VALIDATE, buf); /* TBD: expected */ - } -} - - -static sgml_environment * -push_element(dtd_parser *p, dtd_element *e, int callback) -{ if ( e != CDATA_ELEMENT ) - { sgml_environment *env = sgml_calloc(1, sizeof(*env)); - - emit_cdata(p, FALSE); - - env->element = e; - env->state = make_state_engine(e); - env->space_mode = (p->environments ? p->environments->space_mode - : p->dtd->space_mode); - env->parent = p->environments; - p->environments = env; - - if ( p->dtd->shorttag ) - { env->saved_waiting_for_net = p->waiting_for_net; - - if ( p->event_class == EV_SHORTTAG ) - { p->waiting_for_net = TRUE; - env->wants_net = TRUE; - } else - { env->wants_net = FALSE; - if ( e->structure && e->structure->omit_close == FALSE ) - p->waiting_for_net = FALSE; - } - } - - if ( e->map ) - p->map = env->map = e->map; - else if ( env->parent ) - p->map = env->map = env->parent->map; - - p->first = TRUE; - if ( callback && p->on_begin_element ) - { sgml_attribute atts[MAXATTRIBUTES]; - int natts = 0; - - if ( !(p->flags & SGML_PARSER_NODEFS) ) - natts = add_default_attributes(p, e, natts, atts); - - (*p->on_begin_element)(p, e, natts, atts); - } - - if ( e->structure ) - { if ( e->structure->type == C_CDATA || - e->structure->type == C_RCDATA ) - { p->state = (e->structure->type == C_CDATA ? S_CDATA : S_RCDATA); - p->cdata_state = p->state; - p->etag = e->name->name; - p->etaglen = (int)istrlen(p->etag); - sgml_cplocation(&p->startcdata, &p->location); - } else - p->cdata_state = S_PCDATA; - } - } - - return p->environments; -} - - -static void -free_environment(sgml_environment *env) -{ -#ifdef XMLNS - if ( env->xmlns ) - xmlns_free(env->xmlns); -#endif - - sgml_free(env); -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Pop the stack, closing all environment uptil `to'. The close was -initiated by pushing the element `e'. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -static int -pop_to(dtd_parser *p, sgml_environment *to, dtd_element *e0) -{ sgml_environment *env, *parent; - - for(env = p->environments; env != to; env=parent) - { dtd_element *e = env->element; - - validate_completeness(p, env); - parent = env->parent; - - if ( e->structure && !e->structure->omit_close ) - gripe(p, ERC_OMITTED_CLOSE, e->name->name); - - if ( e0 != CDATA_ELEMENT ) - emit_cdata(p, TRUE); - - p->first = FALSE; - p->environments = env; - if ( p->dtd->shorttag ) - p->waiting_for_net = env->saved_waiting_for_net; - - WITH_CLASS(p, EV_OMITTED, - if ( p->on_end_element ) - (*p->on_end_element)(p, e)); - free_environment(env); - } - p->environments = to; - p->map = to->map; - - return TRUE; -} - - -static void -allow_for(dtd_element *in, dtd_element *e) -{ dtd_edef *def = in->structure; - dtd_model *g; - - if ( def->type == C_EMPTY ) - { def->type = C_PCDATA; - def->content = sgml_calloc(1, sizeof(*def->content)); - def->content->type = MT_OR; - def->content->cardinality = MC_REP; - } - assert(def->content->type == MT_OR); - - g = def->content->content.group; - - if ( e == CDATA_ELEMENT ) - { dtd_model *m; - - for(; g; g = g->next) - { if ( g->type == MT_PCDATA ) - return; - } - m = sgml_calloc(1, sizeof(*m)); - m->type = MT_PCDATA; - m->cardinality = MC_ONE; /* ignored */ - add_submodel(def->content, m); - } else - { dtd_model *m; - - for(; g; g = g->next) - { if ( g->type == MT_ELEMENT && g->content.element == e ) - return; - } - m = sgml_calloc(1, sizeof(*m)); - m->type = MT_ELEMENT; - m->cardinality = MC_ONE; /* ignored */ - m->content.element = e; - add_submodel(def->content, m); - } -} - - - -static int -open_element(dtd_parser *p, dtd_element *e, int warn) -{ if ( !p->environments && p->enforce_outer_element ) - { dtd_element *f = p->enforce_outer_element->element; - - if ( f && f != e ) - { if ( !f->structure || - !f->structure->omit_open ) - gripe(p, ERC_OMITTED_OPEN, f->name->name); - - WITH_CLASS(p, EV_OMITTED, - { open_element(p, f, TRUE); - if ( p->on_begin_element ) - { sgml_attribute atts[MAXATTRIBUTES]; - int natts = 0; - - if ( !(p->flags & SGML_PARSER_NODEFS) ) - natts = add_default_attributes(p, f, natts, atts); - - (*p->on_begin_element)(p, f, natts, atts); - } - }); - } - } - - /* no DTD available yet */ - if ( !p->environments && !p->dtd->doctype && e != CDATA_ELEMENT ) - { const ichar *file; - - file = find_in_catalogue(CAT_DOCTYPE, e->name->name, NULL, NULL, - p->dtd->dialect != DL_SGML); - if ( file ) - { dtd_parser *clone = clone_dtd_parser(p); - - gripe(p, ERC_NO_DOCTYPE, e->name->name, file); - - if ( load_dtd_from_file(clone, file) ) - p->dtd->doctype = istrdup(e->name->name); - else - gripe(p, ERC_EXISTENCE, L"file", file); - - free_dtd_parser(clone); - } - } - - if ( p->environments ) - { sgml_environment *env = p->environments; - - if ( env->element->undefined ) - { allow_for(env->element, e); /* <!ELEMENT x - - (model) +(y)> */ - push_element(p, e, FALSE); - return TRUE; - } - - if ( env->element->structure && - env->element->structure->type == C_ANY ) - { if ( e != CDATA_ELEMENT && e->undefined ) - gripe(p, ERC_EXISTENCE, L"Element", e->name->name); - push_element(p, e, FALSE); - return TRUE; - } - - switch(in_or_excluded(env, e)) - { case IE_INCLUDED: - push_element(p, e, FALSE); - return TRUE; - case IE_EXCLUDED: - if ( warn ) - gripe(p, ERC_NOT_ALLOWED, e->name->name); - /*FALLTHROUGH*/ - case IE_NORMAL: - for(; env; env=env->parent) - { dtd_state *new; - - if ( (new = make_dtd_transition(env->state, e)) ) - { env->state = new; - pop_to(p, env, e); - push_element(p, e, FALSE); - return TRUE; - } else - { dtd_element *oe[MAXOMITTED]; /* omitted open */ - int olen; - int i; - - if ( (olen=find_omitted_path(env->state, e, oe)) > 0 ) - { pop_to(p, env, e); - WITH_CLASS(p, EV_OMITTED, - for(i=0; i<olen; i++) - { env->state = make_dtd_transition(env->state, oe[i]); - env = push_element(p, oe[i], TRUE); - }) - env->state = make_dtd_transition(env->state, e); - push_element(p, e, FALSE); - return TRUE; - } - } - - if ( !env->element->structure || - !env->element->structure->omit_close ) - break; - } - } - - if ( warn ) - { if ( e == CDATA_ELEMENT ) - gripe(p, ERC_VALIDATE, L"#PCDATA not allowed here"); - else if ( e->undefined ) - gripe(p, ERC_EXISTENCE, L"Element", e->name->name); - else - gripe(p, ERC_NOT_ALLOWED, e->name->name); - } - } - - if ( warn ) - { push_element(p, e, FALSE); - return TRUE; - } else - return FALSE; -} - - -static int -close_element(dtd_parser *p, dtd_element *e, int conref) -{ sgml_environment *env; - - for(env = p->environments; env; env=env->parent) - { if ( env->element == e ) /* element is open */ - { sgml_environment *parent; - - for(env = p->environments; ; env=parent) - { dtd_element *ce = env->element; - - if ( !(conref && env == p->environments) ) - validate_completeness(p, env); - parent = env->parent; - - p->first = FALSE; - if ( p->on_end_element ) - (*p->on_end_element)(p, env->element); - free_environment(env); - p->environments = parent; - - if ( ce == e ) /* closing current element */ - { p->map = (parent ? parent->map : NULL); - return TRUE; - } else /* omited close */ - { if ( ce->structure && !ce->structure->omit_close ) - gripe(p, ERC_OMITTED_CLOSE, ce->name->name); - } - } - } - } - - return gripe(p, ERC_NOT_OPEN, e->name->name); -} - - -static int -close_current_element(dtd_parser *p) -{ if ( p->environments ) - { dtd_element *e = p->environments->element; - - emit_cdata(p, TRUE); - return close_element(p, e, FALSE); - } - - return gripe(p, ERC_SYNTAX_ERROR, L"No element to close", ""); -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -get_attribute_value() - -Get the value for an attribute. Once I thought this was simple, but -Richard O'Keefe pointed to the complex handling of white-space in SGML -attributes. Basically, if the attribute is quoted, we need: - - * If CDATA, map all blank to space characters, then expand - entities - - * If !CDATA expand all entities, canonise white space by - deleting leading and trailing space and squishing multiple - space characters to a single (lower for us) case. - -This almost, but not completely matches the XML definition. This however -is so complex we will ignore it for now. - -[Rewritten by Richard O'Keefe with these addional comments] -Reads a value, the attribute name and value indicator having been -processed already. It calls itake_string() to read quoted values, and -itake_unquoted() to read unquoted values. - -itake_string(dtd, in, buf, size) - - skips layout INCLUDING comments, - - returns NULL if the next character is not ' or ", - - copies characters from in to buf until a matching ' or " is found, - - adds a terminating \0, - - skips more layout INCLUDING comments, and - - returns the new input position. -It is quite wrong to skip leading comments here. In the tag - - <foo bar = --ugh-- zoo> - -the characters "--ugh--" *are the value*. They are not a comment. -Comments are not in fact allowed inside tags, unfortunately. -This tag is equivalent to - - <foo bar="--ugh--" something="zoo"> - -where something is an attribute that has zoo as one of its enumerals. - -Because itake_string() is called in many other places, this bug has -not yet been fixed. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -static ichar const * -get_attribute_value(dtd_parser *p, ichar const *decl, sgml_attribute *att) -{ ichar tmp[MAXSTRINGLEN]; - ichar *buf = tmp; - ichar const *s; - ichar c; - dtd *dtd = p->dtd; - ichar const *end; - ichar *start; int len; - - enum - { DIG_FIRST = 8, /* any token start with digit? */ - NAM_FIRST = 4, /* any token start with non-digit name char? */ - NAM_LATER = 2, /* any token have non-digit name char later? */ - ANY_OTHER = 1, /* any token have illegal character? */ - YET_EMPTY = 0 - } - token = YET_EMPTY; - - att->value.textW = NULL; /* UCS text */ - att->value.number = 0; - att->flags = 0; - - end = itake_string(dtd, decl, &start, &len); - - if ( end != NULL ) - { ocharbuf out; - - init_ocharbuf(&out); - expand_entities(p, start, len, &out); - - if ( att->definition->type == AT_CDATA ) - { malloc_ocharbuf(&out); - - att->value.number = out.size; - att->value.textW = out.data.w; - - return end; - } else - { ichar *d; - - buf = out.data.w; - - /* canonicalise blanks */ - s = buf; - while ((c = *s++) != '\0' && HasClass(dtd, c, CH_BLANK)) - ; - d = buf; - while ( c != '\0' ) - { token |= HasClass(dtd, c, CH_DIGIT) ? DIG_FIRST - : HasClass(dtd, c, CH_NAME) ? NAM_FIRST : /* oops! */ ANY_OTHER; - if ( d != buf ) - *d++ = ' '; - if ( dtd->case_sensitive ) - { *d++ = c; - while ((c = *s++) != '\0' && !HasClass(dtd, c, CH_BLANK)) - { token |= HasClass(dtd, c, CH_DIGIT) ? 0 - : HasClass(dtd, c, CH_NAME) ? NAM_LATER : /* oops! */ ANY_OTHER; - *d++ = c; - } - } else - { *d++ = towlower(c); - while ((c = *s++) != '\0' && !HasClass(dtd, c, CH_BLANK)) - { token |= HasClass(dtd, c, CH_DIGIT) ? 0 - : HasClass(dtd, c, CH_NAME) ? NAM_LATER : /* oops! */ ANY_OTHER; - *d++ = towlower(c); - } - } - while (c != '\0' && HasClass(dtd, c, CH_BLANK)) - c = *s++; - } - *d = '\0'; - } - } else - { end = itake_unquoted(p, decl, tmp, sizeof(tmp)/sizeof(ichar)); - if (end == NULL) - return NULL; - - s = buf; - c = *s++; - if (c != '\0') - { token |= HasClass(dtd, c, CH_DIGIT) ? DIG_FIRST - : HasClass(dtd, c, CH_NAME) ? NAM_FIRST : /* oops! */ ANY_OTHER; - while ((c = *s++) != 0) - { token |= HasClass(dtd, c, CH_DIGIT) ? 0 - : HasClass(dtd, c, CH_NAME) ? NAM_LATER : /* oops! */ ANY_OTHER; - } - } - if ( token == YET_EMPTY || (token & ANY_OTHER) != 0) - gripe(p, ERC_SYNTAX_WARNING, L"Attribute value requires quotes", buf); - - if (!dtd->case_sensitive && att->definition->type != AT_CDATA) - istrlower(buf); - } - - switch (att->definition->type) - { case AT_NUMBER: /* number */ - if (token != DIG_FIRST) - { gripe(p, ERC_SYNTAX_WARNING, L"NUMBER expected", decl); - } else if (dtd->number_mode == NU_INTEGER) - { (void) istrtol(buf, &att->value.number); - } else - { att->value.textW = istrdup(buf); - att->value.number = (long)istrlen(buf); - } - return end; - case AT_CDATA: /* CDATA attribute */ - att->value.textW = istrdup(buf); - att->value.number = (long)istrlen(buf); - return end; - case AT_ID: /* identifier */ - case AT_IDREF: /* identifier reference */ - case AT_NAME: /* name token */ - case AT_NOTATION: /* notation-name */ - if (token == YET_EMPTY || (token & (DIG_FIRST | ANY_OTHER)) != 0) - gripe(p, ERC_SYNTAX_WARNING, L"NAME expected", decl); - break; - case AT_NAMEOF: /* one of these names */ - case AT_NMTOKEN: /* name-token */ - if (token == YET_EMPTY || (token & ANY_OTHER) != 0) - gripe(p, ERC_SYNTAX_WARNING, L"NMTOKEN expected", decl); - if ( att->definition->type == AT_NAMEOF ) - { dtd_name_list *nl; - - for(nl=att->definition->typeex.nameof; nl; nl = nl->next) - { if ( istreq(nl->value->name, buf) ) - goto passed; - } - gripe(p, ERC_SYNTAX_WARNING, L"unexpected value", decl); - } - break; - case AT_NUTOKEN: /* number token */ - if ((token & (NAM_FIRST | ANY_OTHER)) != 0) - gripe(p, ERC_SYNTAX_WARNING, L"NUTOKEN expected", decl); - break; - case AT_ENTITY: /* entity-name */ - if (token == YET_EMPTY || (token & (DIG_FIRST | ANY_OTHER)) != 0) - gripe(p, ERC_SYNTAX_WARNING, L"entity NAME expected", decl); - break; - case AT_NAMES: /* list of names */ - case AT_IDREFS: /* list of identifier references */ - if (token == YET_EMPTY || (token & (DIG_FIRST | ANY_OTHER)) != 0) - gripe(p, ERC_SYNTAX_WARNING, L"NAMES expected", decl); - break; - case AT_ENTITIES: /* entity-name list */ - if (token == YET_EMPTY || (token & (DIG_FIRST | ANY_OTHER)) != 0) - gripe(p, ERC_SYNTAX_WARNING, L"entity NAMES expected", decl); - break; - case AT_NMTOKENS: /* name-token list */ - if (token == YET_EMPTY || (token & ANY_OTHER) != 0) - gripe(p, ERC_SYNTAX_WARNING, L"NMTOKENS expected", decl); - break; - case AT_NUMBERS: /* number list */ - if (token != DIG_FIRST) - gripe(p, ERC_SYNTAX_WARNING, L"NUMBERS expected", decl); - break; - case AT_NUTOKENS: - if ((token & (NAM_FIRST | ANY_OTHER)) != 0) - gripe(p, ERC_SYNTAX_WARNING, L"NUTOKENS expected", decl); - break; - default: - assert(0); - return NULL; - } - -passed: - att->value.textW = istrdup(buf); /* TBD: more validation */ - att->value.number = (long)istrlen(buf); - return end; -} - - -static const ichar * -process_attributes(dtd_parser *p, dtd_element *e, const ichar *decl, - sgml_attribute *atts, int *argc) -{ int attn = 0; - dtd *dtd = p->dtd; - - decl = iskip_layout(dtd, decl); - while(decl && *decl) - { dtd_symbol *nm; - const ichar *s; - - if ( (s=itake_nmtoken(p, decl, &nm)) ) - { decl = s; - - if ( (s=isee_func(dtd, decl, CF_VI)) ) /* name= */ - { dtd_attr *a; - - if ( !HasClass(dtd, nm->name[0], CH_NMSTART) ) - gripe(p, ERC_SYNTAX_WARNING, - "Illegal start of attribute-name", decl); - - decl = s; - if ( !(a=find_attribute(e, nm)) ) - { a = sgml_calloc(1, sizeof(*a)); - - a->name = nm; - a->type = AT_CDATA; - a->def = AT_IMPLIED; - add_attribute(p, e, a); - - if ( !e->undefined && - !(dtd->dialect != DL_SGML && - (istreq(L"xmlns", nm->name) || - istrprefix(L"xmlns:", nm->name))) ) - gripe(p, ERC_NO_ATTRIBUTE, e->name->name, nm->name); - } - atts[attn].definition = a; - if ( (decl=get_attribute_value(p, decl, atts+attn)) ) - { attn++; - continue; - } - } else if ( e->structure ) - { dtd_attr_list *al; /* value shorthand */ - - for(al=e->attributes; al; al=al->next) - { dtd_attr *a = al->attribute; - - if ( a->type == AT_NAMEOF || a->type == AT_NOTATION ) - { dtd_name_list *nl; - - for(nl=a->typeex.nameof; nl; nl = nl->next) - { if ( nl->value == nm ) - { if ( dtd->dialect != DL_SGML ) - gripe(p, ERC_SYNTAX_WARNING, - "Value short-hand in XML mode", decl); - atts[attn].flags = 0; - atts[attn].definition = a; - atts[attn].value.textW = istrdup(nm->name); - atts[attn].value.number = (long)istrlen(nm->name); - attn++; - goto next; - } - } - } - } - gripe(p, ERC_NO_ATTRIBUTE_VALUE, e->name->name, nm->name); - decl = s; - } else - { gripe(p, ERC_SYNTAX_ERROR, L"Bad attribute", decl); - decl = s; - } - } else - { *argc = attn; - return decl; - } - - next: - ; - } - - *argc = attn; - return decl; -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -sgml_add_default_attributes() - -This function adds attributes for omitted default and fixed attributes. -These attributes are added to the end of the attribute list. This -function returns the new number of attributes. The `atts' array is -assumed to be MAXATTRIBUTES long, normally passed from -process_begin_element. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -static int -add_default_attributes(dtd_parser *p, dtd_element *e, - int natts, sgml_attribute *atts) -{ dtd_attr_list *al; - - if ( e == CDATA_ELEMENT ) - return natts; - - for(al=e->attributes; al; al=al->next) - { dtd_attr *a = al->attribute; - - switch(a->def) - { case AT_REQUIRED: /* TBD: check if present */ - case AT_CURRENT: /* TBD: register in DTD and reuse */ - case AT_CONREF: - case AT_IMPLIED: - goto next; - case AT_FIXED: - case AT_DEFAULT: - { int i; - sgml_attribute *ap; - - for(i=0, ap=atts; i<natts; i++, ap++) - { if ( ap->definition == a ) - goto next; - } - - ap->definition = a; - ap->value.textW = NULL; - ap->value.number = 0; - ap->flags = SGML_AT_DEFAULT; - - switch(a->type) - { case AT_CDATA: - ap->value.textW = a->att_def.cdata; - ap->value.number = (long)istrlen(ap->value.textW); - break; - case AT_NUMBER: - if ( p->dtd->number_mode == NU_TOKEN ) - { ap->value.textW = (ichar*)a->att_def.name->name; - ap->value.number = (long)istrlen(ap->value.textW); - } else - { ap->value.number = a->att_def.number; - } - break; - default: - if ( a->islist ) - { ap->value.textW = a->att_def.list; - } else - { ap->value.textW = (ichar*)a->att_def.name->name; - } - ap->value.number = (long)istrlen(ap->value.textW); - } - - natts++; - } - } - next:; - } - - return natts; -} - - -static void -free_attribute_values(int argc, sgml_attribute *argv) -{ int i; - - for(i=0; i<argc; i++, argv++) - { if ( (argv->flags & SGML_AT_DEFAULT) ) - continue; /* shared with the DTD */ - - if ( argv->value.textW ) - sgml_free(argv->value.textW); - } -} - - -static int -process_begin_element(dtd_parser *p, const ichar *decl) -{ dtd *dtd = p->dtd; - dtd_symbol *id; - const ichar *s; - - if ( (s=itake_name(p, decl, &id)) ) - { sgml_attribute atts[MAXATTRIBUTES]; - int natts; - dtd_element *e = find_element(dtd, id); - int empty = FALSE; - int conref = FALSE; - int rc = TRUE; - - if ( !e->structure ) - { dtd_edef *def; - e->undefined = TRUE; - STAT(edefs_implicit++); - def_element(dtd, id); - def = e->structure; - def->type = C_EMPTY; - } - - open_element(p, e, TRUE); - - decl=s; - if ( (s=process_attributes(p, e, decl, atts, &natts)) ) - decl=s; - - if ( dtd->dialect != DL_SGML ) - { if ( (s=isee_func(dtd, decl, CF_ETAGO2)) ) - { empty = TRUE; /* XML <tag/> */ - decl = s; - } -#ifdef XMLNS - if ( dtd->dialect == DL_XMLNS ) - update_xmlns(p, e, natts, atts); -#endif - if ( dtd->dialect != DL_SGML ) - update_space_mode(p, e, natts, atts); - } else - { int i; - - for(i=0; i<natts; i++) - { if ( atts[i].definition->def == AT_CONREF ) - { empty = TRUE; - conref = TRUE; - } - } - } - if ( *decl ) - gripe(p, ERC_SYNTAX_ERROR, L"Bad attribute list", decl); - - if ( !(p->flags & SGML_PARSER_NODEFS) ) - natts = add_default_attributes(p, e, natts, atts); - - if ( empty || - (dtd->dialect == DL_SGML && - e->structure && - e->structure->type == C_EMPTY && - !e->undefined) ) - p->empty_element = e; - else - p->empty_element = NULL; - - if ( p->on_begin_element ) - rc = (*p->on_begin_element)(p, e, natts, atts); - - free_attribute_values(natts, atts); - - if ( p->empty_element ) - { p->empty_element = NULL; - close_element(p, e, conref); - if ( conref ) /* might be S_CDATA due to declared content */ - p->cdata_state = p->state = S_PCDATA; - } - - return rc; - } - - return gripe(p, ERC_SYNTAX_ERROR, L"Bad open-element tag", decl); -} - - -static int -process_end_element(dtd_parser *p, const ichar *decl) -{ dtd *dtd = p->dtd; - dtd_symbol *id; - const ichar *s; - - emit_cdata(p, TRUE); - if ( (s=itake_name(p, decl, &id)) && *s == '\0' ) - return close_element(p, find_element(dtd, id), FALSE); - - if ( p->dtd->shorttag && *decl == '\0' ) /* </>: close current element */ - return close_current_element(p); - - return gripe(p, ERC_SYNTAX_ERROR, L"Bad close-element tag", decl); -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -process_net(dtd_parser *p) - We've seen a / of a shorttag element. Close this one. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -static int -process_net(dtd_parser *p) -{ sgml_environment *env; - - prepare_cdata(p); - for(env = p->environments; env; env=env->parent) - { if ( env->wants_net ) - { sgml_environment *parent; - - pop_to(p, env, NULL); /* close parents */ - validate_completeness(p, env); - parent = env->parent; - - emit_cdata(p, TRUE); - p->first = FALSE; - - if ( p->on_end_element ) - { WITH_CLASS(p, EV_SHORTTAG, - (*p->on_end_element)(p, env->element)); - } - - free_environment(env); - p->environments = parent; - p->map = (parent ? parent->map : NULL); - - return TRUE; - } - } - - return FALSE; -} - - -static int /* <!DOCTYPE ...> */ -process_doctype(dtd_parser *p, const ichar *decl, const ichar *decl0) -{ dtd *dtd = p->dtd; - dtd_symbol *id; - const ichar *s; - dtd_entity *et = NULL; - - if ( !(s=itake_name(p, decl, &id)) ) - return gripe(p, ERC_SYNTAX_ERROR, L"Name expected", decl); - decl = s; - - if ( (s=isee_identifier(dtd, decl, "system")) ) - { et = sgml_calloc(1, sizeof(*et)); - et->type = ET_SYSTEM; - decl = s; - } else if ( (s=isee_identifier(dtd, decl, "public")) ) - { et = sgml_calloc(1, sizeof(*et)); - et->type = ET_PUBLIC; - decl = s; - } else if ( isee_func(dtd, decl, CF_DSO) ) - goto local; - - if ( et ) - { et->name = id; - et->catalog_location = CAT_DOCTYPE; - if ( !(s=process_entity_value_declaration(p, decl, et)) ) - return FALSE; - decl = s; - } - - if ( !dtd->doctype ) /* i.e. anonymous DTD */ - { ichar *file; - dtd_parser *clone; - - dtd->doctype = istrdup(id->name); /* Fill it */ - if ( et ) - file = entity_file(dtd, et); - else - file = istrdup(find_in_catalogue(CAT_DOCTYPE, - dtd->doctype, NULL, NULL, - dtd->dialect != DL_SGML)); - - if ( !file ) - { gripe(p, ERC_EXISTENCE, L"DTD", dtd->doctype); - } else - { clone = clone_dtd_parser(p); - if ( !load_dtd_from_file(clone, file) ) - gripe(p, ERC_EXISTENCE, L"file", file); - free_dtd_parser(clone); - sgml_free(file); - } - } - - if ( et ) - free_entity_list(et); - -local: - if ( (s=isee_func(dtd, decl, CF_DSO)) ) /* [...] */ - { int grouplevel = 1; - data_mode oldmode = p->dmode; - dtdstate oldstate = p->state; - locbuf oldloc; - const ichar *q; - icharbuf *saved_ibuf = p->buffer; - - push_location(p, &oldloc); - /* try to find start-location. */ - /* fails if there is comment before */ - /* the []! */ - sgml_cplocation(&p->location, &p->startloc); - inc_location(&p->location, '<'); - for(q=decl0; q < s; q++) - inc_location(&p->location, *q); - p->dmode = DM_DTD; - p->state = S_PCDATA; - p->buffer = new_icharbuf(); - - for( ; *s; s++ ) - { if ( isee_func(dtd, s, CF_LIT) || /* skip quoted strings */ - isee_func(dtd, s, CF_LITA) ) - { ichar q = *s; - - putchar_dtd_parser(p, *s++); /* pass open quote */ - - for( ; *s && *s != q; s++ ) - putchar_dtd_parser(p, *s); - - if ( *s == q ) /* pass closing quote */ - putchar_dtd_parser(p, *s); - continue; - } - - if ( isee_func(dtd, s, CF_DSO) ) - grouplevel++; - else if ( isee_func(dtd, s, CF_DSC) && --grouplevel == 0 ) - break; - putchar_dtd_parser(p, *s); - } - p->dtd->implicit = FALSE; - - p->state = oldstate; - p->dmode = oldmode; - free_icharbuf(p->buffer); - p->buffer = saved_ibuf; - pop_location(p, &oldloc); - } - - p->enforce_outer_element = id; /* make this the outer element */ - - return TRUE; -} - - -static void -init_decoding(dtd_parser *p) -{ -#ifdef UTF8 - int decode; - dtd *dtd = p->dtd; - - if ( dtd->encoding == SGML_ENC_UTF8 && - p->encoded == TRUE ) - decode = TRUE; - else - decode = FALSE; - - if ( p->utf8_decode != decode ) - { DEBUG(fprintf(stderr, "%s UTF-8 decoding on %p\n", - decode ? "Enable" : "Disable", - p)); - - p->utf8_decode = decode; - } -#endif -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -xml_set_encoding() is the public interface to set the encoding for the -parser. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -static int /* strcasecmp() with C locale */ -posix_strcasecmp(const char *s1, const char *s2) -{ for(; *s1 && *s2; s1++, s2++) - { int c1 = *s1&0xff; - int c2 = *s2&0xff; - - if ( c1 >= 'A' && c1 <= 'Z' ) c1 += 'a'-'A'; - if ( c2 >= 'A' && c2 <= 'Z' ) c2 += 'a'-'A'; - - if ( c1 != c2 ) - return c1-c2; - } - - return *s1 - *s2; -} - - -int -xml_set_encoding(dtd_parser *p, const char *enc) -{ dtd *dtd = p->dtd; - - if ( posix_strcasecmp(enc, "iso-8859-1") == 0 ) - { dtd->encoding = SGML_ENC_ISO_LATIN1; - } else if ( posix_strcasecmp(enc, "us-ascii") == 0 ) - { dtd->encoding = SGML_ENC_ISO_LATIN1; /* doesn't make a difference */ - } else if ( posix_strcasecmp(enc, "utf-8") == 0 ) - { dtd->encoding = SGML_ENC_UTF8; - } else - return FALSE; - - init_decoding(p); - return TRUE; -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -set_encoding() sets the encoding from the encoding="..." field of the -XML header. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -static void -set_encoding(dtd_parser *p, const ichar *enc) -{ char buf[32]; - char *e = buf+sizeof(buf)-1; - char *o; - const ichar *i; - - for(i=enc, o=buf; *i; ) - { if ( *i < 128 && o < e ) - { *o++ = (char)*i++; - } else - { goto error; - } - } - *o = '\0'; - - if ( !xml_set_encoding(p, buf) ) - { error: - gripe(p, ERC_EXISTENCE, L"character encoding", enc); - } -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Process <? ... ?> - -Should deal with character encoding for XML documents. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -static int -process_pi(dtd_parser *p, const ichar *decl) -{ const ichar *s; - dtd *dtd = p->dtd; - - if ( (s=isee_identifier(dtd, decl, "xml")) ) /* <?xml version="1.0"?> */ - { decl = s; - - switch(dtd->dialect) - { case DL_SGML: - set_dialect_dtd(dtd, DL_XML); - break; - case DL_XML: - case DL_XMLNS: - break; - } - - while(*decl) - { dtd_symbol *nm; - - if ( (s=itake_name(p, decl, &nm)) && - (s=isee_func(dtd, s, CF_VI)) ) /* = */ - { ichar *start; - int len; - ichar buf[MAXSTRINGLEN]; - const ichar *end; - - if ( !(end=itake_string(dtd, s, &start, &len)) ) - { end=itake_nmtoken_chars(p, s, buf, sizeof(buf)/sizeof(ichar)); - start = buf; - len = (int)istrlen(buf); - } - - if ( end ) - { decl = end; - - if ( istrcaseeq(nm->name, L"encoding") ) - { ichar tmp[32]; - - if ( len < (int)(sizeof(tmp)/sizeof(ichar)-1) ) - { istrncpy(tmp, start, len); - tmp[len] = 0; - - set_encoding(p, tmp); - } else - { gripe(p, ERC_SYNTAX_ERROR, L"Unterminated encoding?", decl); - } - } - - /* fprintf(stderr, "XML %s = %s\n", nm->name, buf); */ - - continue; - } - } - - gripe(p, ERC_SYNTAX_ERROR, L"Illegal XML parameter", decl); - break; - } - - return TRUE; - } - - if ( p->on_pi ) - (*p->on_pi)(p, decl); - - return FALSE; /* Warn? */ -} - - -static int -process_sgml_declaration(dtd_parser *p, const ichar *decl) -{ return gripe(p, ERC_SYNTAX_WARNING, L"Ignored <!SGML ...> declaration", NULL); -} - - -static int -process_declaration(dtd_parser *p, const ichar *decl) -{ const ichar *s; - dtd *dtd = p->dtd; - - if ( p->dmode != DM_DTD ) - { if ( (s=isee_func(dtd, decl, CF_ETAGO2)) ) /* </ ... > */ - { return process_end_element(p, s); - } else if ( HasClass(dtd, *decl, CH_NAME) ) /* <letter */ - { return process_begin_element(p, decl); - } - } - - if ( (s=isee_func(dtd, decl, CF_MDO2)) ) /* <! ... >*/ - { decl = s; - - if ( p->on_decl ) - (*p->on_decl)(p, decl); - - if ( (s = isee_identifier(dtd, decl, "entity")) ) - process_entity_declaration(p, s); - else if ( (s = isee_identifier(dtd, decl, "element")) ) - process_element_declaraction(p, s); - else if ( (s = isee_identifier(dtd, decl, "attlist")) ) - process_attlist_declaraction(p, s); - else if ( (s = isee_identifier(dtd, decl, "notation")) ) - process_notation_declaration(p, s); - else if ( (s = isee_identifier(dtd, decl, "shortref")) ) - process_shortref_declaration(p, s); - else if ( (s = isee_identifier(dtd, decl, "usemap")) ) - process_usemap_declaration(p, s); - else if ( (s = isee_identifier(dtd, decl, "sgml")) ) - process_sgml_declaration(p, s); - else if ( (s = isee_identifier(dtd, decl, "doctype")) ) - { if ( p->dmode != DM_DTD ) - process_doctype(p, s, decl-1); - } else - { s = iskip_layout(dtd, decl); - - if ( *s ) - gripe(p, ERC_SYNTAX_ERROR, L"Invalid declaration", s); - } - - return TRUE; - } - - return gripe(p, ERC_SYNTAX_ERROR, L"Invalid declaration", decl); -} - - /******************************* - * STREAM BINDING * - *******************************/ - -void -set_file_dtd_parser(dtd_parser *p, input_type type, const ichar *name) -{ p->location.type = type; - p->location.name.file = name; - p->location.line = 1; - p->location.linepos = 0; - p->location.charpos = 0; -} - - -static void -set_src_dtd_parser(dtd_parser *p, input_type type, const ichar *name) -{ p->location.type = type; - p->location.name.entity = name; - p->location.line = 1; - p->location.linepos = 0; - p->location.charpos = 0; -} - - -void -set_mode_dtd_parser(dtd_parser *p, data_mode m) -{ p->dmode = m; /* DM_DTD or DM_DATA */ - p->state = S_PCDATA; - p->blank_cdata = TRUE; -} - - -dtd_parser * -new_dtd_parser(dtd *dtd) -{ dtd_parser *p = sgml_calloc(1, sizeof(*p)); - - if ( !dtd ) - dtd = new_dtd(NULL); - dtd->references++; - - p->magic = SGML_PARSER_MAGIC; - p->dtd = dtd; - p->state = S_PCDATA; - p->mark_state = MS_INCLUDE; - p->dmode = DM_DTD; - p->encoded = TRUE; /* encoded octet stream */ - p->buffer = new_icharbuf(); - p->cdata = new_ocharbuf(); - p->event_class = EV_EXPLICIT; - set_src_dtd_parser(p, IN_NONE, NULL); - - return p; -} - - -static dtd_parser * -clone_dtd_parser(dtd_parser *p) -{ dtd_parser *clone = sgml_calloc(1, sizeof(*p)); - - *clone = *p; - clone->dtd->references++; - clone->environments = NULL; - clone->marked = NULL; - clone->etag = NULL; - clone->grouplevel = 0; - clone->state = S_PCDATA; - clone->mark_state = MS_INCLUDE; - clone->dmode = DM_DTD; - clone->buffer = new_icharbuf(); - clone->cdata = new_ocharbuf(); - - return clone; -} - - -void -free_dtd_parser(dtd_parser *p) -{ free_icharbuf(p->buffer); - free_ocharbuf(p->cdata); -#ifdef XMLNS - xmlns_free(p->xmlns); -#endif - free_dtd(p->dtd); - - sgml_free(p); -} - - -static int -process_chars(dtd_parser *p, input_type in, const ichar *name, const ichar *s) -{ locbuf old; - - push_location(p, &old); - set_src_dtd_parser(p, in, name); - empty_icharbuf(p->buffer); /* dubious */ - for(; *s; s++) - putchar_dtd_parser(p, *s); - pop_location(p, &old); - - return TRUE; -} - - -static int -process_include(dtd_parser *p, const ichar *entity_name) -{ dtd_symbol *id; - dtd_entity *pe; - dtd *dtd = p->dtd; - - if ( (id=dtd_find_entity_symbol(dtd, entity_name)) && - (pe=find_pentity(p->dtd, id)) ) - { ichar *file; - - if ( (file = entity_file(dtd, pe)) ) - { int rc = sgml_process_file(p, file, SGML_SUB_DOCUMENT); - sgml_free(file); - - return rc; - } else - { const ichar *text = entity_value(p, pe, NULL); - - if ( !text ) - return gripe(p, ERC_NO_VALUE, pe->name->name); - - return process_chars(p, IN_ENTITY, entity_name, text); - } - } - - return gripe(p, ERC_EXISTENCE, L"parameter entity", entity_name); -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Process <![ KEYWORD [ - -Switches ->mark_state according to KEYWORD. Processes the rest in normal -S_PCDATA style, which pops the mark-stack on seeing ]]> - -For the purpose of <!DOCTYPE spec [additions]> we switch to S_GROUP if -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -static void -process_marked_section(dtd_parser *p) -{ ichar buf[MAXDECL]; - dtd *dtd = p->dtd; - const ichar *decl = p->buffer->data; - const ichar *s; - - if ( (decl=isee_func(dtd, decl, CF_MDO2)) && /* ! */ - (decl=isee_func(dtd, decl, CF_DSO)) && /* [ */ - expand_pentities(p, decl, ZERO_TERM_LEN, buf, sizeof(buf)/sizeof(ichar)) ) - { dtd_symbol *kwd; - - decl = buf; - if ( (s=itake_name(p, decl, &kwd)) && - isee_func(dtd, s, CF_DSO) ) /* [ */ - { dtd_marked *m = sgml_calloc(1, sizeof(*m)); - - m->keyword = kwd; /* push on the stack */ - m->parent = p->marked; - p->marked = m; - - if ( istrcaseeq(kwd->name, L"IGNORE") ) - m->type = MS_IGNORE; - else if ( istrcaseeq(kwd->name, L"INCLUDE") ) - m->type = MS_INCLUDE; - else if ( istrcaseeq(kwd->name, L"TEMP") ) - m->type = MS_INCLUDE; - else if ( istrcaseeq(kwd->name, L"CDATA") ) - m->type = MS_CDATA; - else if ( istrcaseeq(kwd->name, L"RCDATA") ) - m->type = MS_RCDATA; - else - m->type = MS_INCLUDE; /* default */ - - empty_icharbuf(p->buffer); - if ( m->type == MS_CDATA ) - p->state = S_MSCDATA; - else - p->state = S_PCDATA; - if ( p->mark_state != MS_IGNORE ) - p->mark_state = m->type; - } - } else - { decl = p->buffer->data; - - if ( (decl=isee_func(dtd, decl, CF_MDO2)) && /* ! */ - !isee_func(dtd, decl, CF_DSO) ) /* [ */ - { p->state = S_GROUP; - p->grouplevel = 1; - } - } -} - - -static void -pop_marked_section(dtd_parser *p) -{ dtd_marked *m = p->marked; - - if ( m ) - { p->marked = m->parent; - sgml_free(m); - p->mark_state = (p->marked ? p->marked->type : MS_INCLUDE); - } -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Update the space-mode for the current element. The space mode defines -how spaces are handled in the CDATA output. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -static dtd_space_mode -istr_to_space_mode(const ichar *val) -{ if ( istreq(val, L"default") ) - return SP_DEFAULT; - if ( istreq(val, L"preserve") ) - return SP_PRESERVE; - if ( istreq(val, L"sgml") ) - return SP_SGML; - if ( istreq(val, L"remove") ) - return SP_REMOVE; - - return SP_INHERIT; /* interpret as error */ -} - - -static void -update_space_mode(dtd_parser *p, dtd_element *e, - int natts, sgml_attribute *atts) -{ for( ; natts-- > 0; atts++ ) - { const ichar *name = atts->definition->name->name; - - if ( istreq(name, L"xml:space") && - atts->definition->type == AT_CDATA && - atts->value.textW ) - { dtd_space_mode m = istr_to_space_mode(atts->value.textW); - - if ( m != SP_INHERIT ) - p->environments->space_mode = m; - else - gripe(p, ERC_EXISTENCE, L"xml:space-mode", atts->value.textW); - - return; - } - } - - if ( e->space_mode != SP_INHERIT ) - p->environments->space_mode = e->space_mode; -} - - -static void -empty_cdata(dtd_parser *p) -{ if ( p->dmode == DM_DATA ) - { empty_ocharbuf(p->cdata); - p->blank_cdata = TRUE; - p->cdata_must_be_empty = FALSE; - } -} - - -static void -cb_cdata(dtd_parser *p, ocharbuf *buf, int offset, int size) -{ if ( p->on_data ) - (*p->on_data)(p, EC_CDATA, size, buf->data.w+offset); -} - - -static int -emit_cdata(dtd_parser *p, int last) -{ dtd *dtd = p->dtd; - locbuf locsafe; - ocharbuf *cdata = p->cdata; - int offset = 0; - int size = cdata->size; - - if ( size == 0 ) - return TRUE; /* empty or done */ - - push_location(p, &locsafe); - sgml_cplocation(&p->location, &p->startloc); /* start of markup */ - sgml_cplocation(&p->startloc, &p->startcdata); /* real start of CDATA */ - - if ( p->environments ) - { switch(p->environments->space_mode) - { case SP_SGML: - case SP_DEFAULT: - if ( p->first ) - { wint_t c = fetch_ocharbuf(cdata, offset); - - if ( HasClass(dtd, c, CH_RE) ) - { inc_location(&p->startloc, c); - offset++; - size--; - c = fetch_ocharbuf(cdata, offset); - } - - if ( HasClass(dtd, c, CH_RS) ) - { inc_location(&p->startloc, c); - offset++; - size--; - } - } - if ( last && size > 0 ) - { wint_t c = fetch_ocharbuf(cdata, offset+size-1); - - if ( HasClass(dtd, c, CH_RS) ) - { dec_location(&p->location, c); - size--; - poke_ocharbuf(cdata, offset+size, '\0'); - if ( size > 0 ) - c = fetch_ocharbuf(cdata, offset+size-1); - else - c = 0; /* HasClass(CH_RE) must fail */ - } - if ( HasClass(dtd, c, CH_RE) ) - { dec_location(&p->location, c); - size--; - poke_ocharbuf(cdata, offset+size, '\0'); - } - } - if ( p->environments->space_mode == SP_DEFAULT ) - { int o = 0; - int i; - - for(i=0; i<size; i++) - { wint_t c = fetch_ocharbuf(cdata, offset+i); - - if ( HasClass(dtd, c, CH_BLANK) ) - { for(i++; i<size; i++) - { wint_t c = fetch_ocharbuf(cdata, offset+i); - - if ( !HasClass(dtd, c, CH_BLANK) ) - break; - } - i--; - poke_ocharbuf(cdata, o++, ' '); - continue; - } - poke_ocharbuf(cdata, o++, c); - } - poke_ocharbuf(cdata, o, '\0'); - offset = 0; /* wrote new output from offset=0 */ - size = o; - } - break; - case SP_REMOVE: - { int o = 0; - int i; - int end = 0; - - for(i=0; i<size; i++) - { wint_t c = fetch_ocharbuf(cdata, offset+i); - - if ( HasClass(dtd, c, CH_BLANK) ) - inc_location(&p->startloc, c); - else - break; - } - - if ( i<size ) - { for(; i<size; i++) - { wint_t c = fetch_ocharbuf(cdata, offset+i); - - if ( HasClass(dtd, c, CH_BLANK) ) - { i++; - - while(i<size && HasClass(dtd, - (wint_t)fetch_ocharbuf(cdata, offset+i), - CH_BLANK)) - i++; - i--; - poke_ocharbuf(cdata, o++, ' '); - continue; - } - poke_ocharbuf(cdata, o++, c); - end = o; - } - } - /* TBD: adjust end */ - poke_ocharbuf(cdata, end, '\0'); - size = end; - break; - } - case SP_PRESERVE: - break; - case SP_INHERIT: - assert(0); - return FALSE; - } - } - - if ( size == 0 ) - { pop_location(p, &locsafe); - empty_cdata(p); - - return TRUE; - } - - assert(size > 0); - - if ( !p->blank_cdata ) - { if ( p->cdata_must_be_empty ) - { gripe(p, ERC_NOT_ALLOWED_PCDATA, p->cdata); /* TBD: now passes buffer! */ - } - cb_cdata(p, cdata, offset, size); - } else if ( p->environments ) - { sgml_environment *env = p->environments; - dtd_state *new; - - /* If an element is not in the DTD we must */ - /* assume mixed content and emit spaces */ - - if ( (new=make_dtd_transition(env->state, CDATA_ELEMENT)) ) - { env->state = new; - cb_cdata(p, cdata, offset, size); - } else if ( env->element->undefined && - p->environments->space_mode == SP_PRESERVE ) - { cb_cdata(p, cdata, offset, size); - } - } - - pop_location(p, &locsafe); - - empty_cdata(p); - - return TRUE; -} - - -static int -prepare_cdata(dtd_parser *p) -{ if ( p->cdata->size == 0 ) - return TRUE; - - terminate_ocharbuf(p->cdata); - - if ( p->mark_state == MS_INCLUDE ) - { dtd *dtd = p->dtd; - - if ( p->environments ) /* needed for <img> <img> */ - { dtd_element *e = p->environments->element; - - if ( e->structure && e->structure->type == C_EMPTY && !e->undefined ) - close_element(p, e, FALSE); - } - - if ( p->blank_cdata == TRUE ) - { int blank = TRUE; - int i; - - for(i=0; i<p->cdata->size; i++) - { wint_t c = fetch_ocharbuf(p->cdata, i); - - if ( !HasClass(dtd, c, CH_BLANK) ) - { blank = FALSE; - break; - } - } - - p->blank_cdata = blank; - if ( !blank ) - { if ( p->dmode == DM_DTD ) - gripe(p, ERC_SYNTAX_ERROR, L"CDATA in DTD", p->cdata->data); - else - open_element(p, CDATA_ELEMENT, TRUE); - } - } - } - - return TRUE; -} - - -static int -process_cdata(dtd_parser *p, int last) -{ prepare_cdata(p); - - return emit_cdata(p, last); -} - - -static int -process_entity(dtd_parser *p, const ichar *name) -{ if ( name[0] == '#' ) /* #charcode: character entity */ - { int v = char_entity_value(name); - - if ( v <= 0 ) - return gripe(p, ERC_SYNTAX_ERROR, L"Bad character entity", name); - - add_ocharbuf(p->cdata, v); - } else - { dtd_symbol *id; - dtd_entity *e; - dtd *dtd = p->dtd; - int len; - const ichar *text; - const ichar *s; - int chr; - ichar *file; - - if ( !(id=dtd_find_entity_symbol(dtd, name)) || - !(e=id->entity) ) - { if ( dtd->default_entity ) - e = dtd->default_entity; - else - return gripe(p, ERC_EXISTENCE, L"entity", name); - } - - if ( !e->value && - e->content == EC_SGML && - (file=entity_file(p->dtd, e)) ) - { int rc; - - empty_icharbuf(p->buffer); /* dubious */ - rc = sgml_process_file(p, file, SGML_SUB_DOCUMENT); - sgml_free(file); - return rc; - } - - if ( !(text = entity_value(p, e, &len)) ) - return gripe(p, ERC_NO_VALUE, e->name->name); - - switch ( e->content ) - { case EC_SGML: - case EC_CDATA: - if ( (s=isee_character_entity(dtd, text, &chr)) && *s == '\0' ) - { if ( chr == 0 ) - return gripe(p, ERC_SYNTAX_ERROR, L"Illegal character entity", text); - - if ( p->blank_cdata == TRUE && - !HasClass(dtd, (wint_t)chr, CH_BLANK) ) - { p->cdata_must_be_empty = !open_element(p, CDATA_ELEMENT, FALSE); - p->blank_cdata = FALSE; - } - - add_ocharbuf(p->cdata, chr); - return TRUE; - } - if ( e->content == EC_SGML ) - { locbuf oldloc; - int decode = p->utf8_decode; - - push_location(p, &oldloc); - p->utf8_decode = FALSE; - set_src_dtd_parser(p, IN_ENTITY, e->name->name); - empty_icharbuf(p->buffer); /* dubious */ - for(s=text; *s; s++) - putchar_dtd_parser(p, *s); - p->utf8_decode = decode; - pop_location(p, &oldloc); - } else if ( *text ) - { const ichar *o; - - if ( p->blank_cdata == TRUE ) - { p->cdata_must_be_empty = !open_element(p, CDATA_ELEMENT, FALSE); - p->blank_cdata = FALSE; - } - - for(o=text; *o; o++) - add_ocharbuf(p->cdata, *o); - } - break; - case EC_SDATA: - case EC_NDATA: - process_cdata(p, FALSE); - if ( p->on_data ) - (*p->on_data)(p, e->content, len, text); - break; - case EC_PI: - process_cdata(p, FALSE); - if ( p->on_pi ) - (*p->on_pi)(p, text); - case EC_STARTTAG: -#if 0 - prepare_cdata(p); - process_begin_element(p, text); -#endif - break; - case EC_ENDTAG: -#if 0 - prepare_cdata(p); - process_end_element(p, text); -#endif - break; - } - - return TRUE; - } - - return TRUE; -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Deal with end of input. We should give a proper error message depending -on the state and the start-location of the error. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -int -end_document_dtd_parser(dtd_parser *p) -{ int rval; - - switch(p->state) - { case S_RCDATA: - case S_CDATA: - case S_PCDATA: - rval = TRUE; - break; - case S_CMT: - case S_CMT1: - case S_CMTE0: - case S_CMTE1: - case S_DECLCMT0: - case S_DECLCMT: - case S_DECLCMTE0: - rval = gripe(p, ERC_SYNTAX_ERROR, - L"Unexpected end-of-file in comment", L""); - break; - case S_ECDATA1: - case S_ECDATA2: - case S_EMSC1: - case S_EMSC2: - case S_DECL0: - case S_DECL: - case S_MDECL0: - case S_STRING: - case S_CMTO: - case S_GROUP: - case S_PENT: - case S_ENT: - case S_ENT0: - rval = gripe(p, ERC_SYNTAX_ERROR, - L"Unexpected end-of-file", L""); - break; -#ifdef UTF8 - case S_UTF8: - rval = gripe(p, ERC_SYNTAX_ERROR, - L"Unexpected end-of-file in UTF-8 sequence", L""); - break; -#endif - case S_MSCDATA: - case S_EMSCDATA1: - case S_EMSCDATA2: - rval = gripe(p, ERC_SYNTAX_ERROR, - L"Unexpected end-of-file in CDATA marked section", L""); - break; - case S_PI: - case S_PI2: - rval = gripe(p, ERC_SYNTAX_ERROR, - L"Unexpected end-of-file in processing instruction", L""); - break; - default: - rval = gripe(p, ERC_SYNTAX_ERROR, - L"Unexpected end-of-file in ???"); - break; - } - - if ( p->dmode == DM_DATA ) - { sgml_environment *env; - - if ( p->cdata->size > 0 && - fetch_ocharbuf(p->cdata, p->cdata->size-1) == CR ) - del_ocharbuf(p->cdata); - - process_cdata(p, TRUE); - - if ( (env=p->environments) ) - { dtd_element *e; - - while(env->parent) - env = env->parent; - - pop_to(p, env, CDATA_ELEMENT); - e = env->element; - if ( e->structure && !e->structure->omit_close ) - gripe(p, ERC_OMITTED_CLOSE, e->name->name); - close_element(p, e, FALSE); - } - } - - return rval; -} - - -int -begin_document_dtd_parser(dtd_parser *p) -{ init_decoding(p); - - return TRUE; -} - - -void -reset_document_dtd_parser(dtd_parser *p) -{ if ( p->environments ) - { sgml_environment *env, *parent; - - for(env = p->environments; env; env=parent) - { parent = env->parent; - - free_environment(env); - } - - p->environments = NULL; - } - - while(p->marked) - pop_marked_section(p); - - empty_icharbuf(p->buffer); - empty_ocharbuf(p->cdata); - - p->mark_state = MS_INCLUDE; - p->state = S_PCDATA; - p->grouplevel = 0; - p->blank_cdata = TRUE; - p->event_class = EV_EXPLICIT; - p->dmode = DM_DATA; - - begin_document_dtd_parser(p); -} - - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Set the UTF-8 state -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -#ifdef UTF8 -static void -process_utf8(dtd_parser *p, int chr) -{ int bytes; - int mask; - - for( bytes=1, mask=0x20; chr&mask; bytes++, mask >>= 1 ) - ; - mask--; /* 0x20 --> 0x1f */ - - p->utf8_saved_state = p->state; /* state to return to */ - p->state = S_UTF8; - p->utf8_char = chr & mask; - p->utf8_left = bytes; -} -#endif - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -add_cdata() adds a character to the output data. It also maps \r\n onto -a single \n for Windows newline conventions. - -There is a problem here in shortref handling. We open the CDATA_ELEMENT -as soon as we find a character as this may open other elements through -omitted tags and thus install a new shortref map. - -If, at a later stage, all CDATA read sofar turns out to be a shortref we -have incorrectly opened the CDATA_ELEMENT. As `undoing' the -open_element() is not an option (it may already have caused `events' on -omitted tags) we are in trouble. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -static void -add_cdata(dtd_parser *p, int chr) -{ if ( p->mark_state == MS_INCLUDE ) - { ocharbuf *buf = p->cdata; - - if ( p->blank_cdata == TRUE && - !HasClass(p->dtd, (wint_t)chr, CH_BLANK) ) - { p->cdata_must_be_empty = !open_element(p, CDATA_ELEMENT, FALSE); - p->blank_cdata = FALSE; - } - - if ( chr == '\n' ) /* insert missing CR */ - { int sz; - - if ( (sz=buf->size) == 0 || - fetch_ocharbuf(buf, sz-1) != CR ) - add_cdata(p, CR); - } - - add_ocharbuf(buf, chr); - - if ( p->map && - chr <= 0xff && p->map->ends[chr] && - match_shortref(p) ) - return; - - if ( chr == '\n' ) /* dubious. Whould we do that */ - { int sz; /* here or in space-handling? */ - - if ( (sz=buf->size) > 1 && - fetch_ocharbuf(buf, sz-1) == LF && - fetch_ocharbuf(buf, sz-2) == CR ) - { poke_ocharbuf(buf, sz-2, LF); - buf->size--; - } - } - } -} - - -static void -add_verbatim_cdata(dtd_parser *p, int chr) -{ if ( p->mark_state != MS_IGNORE ) - { ocharbuf *buf = p->cdata; - - if ( p->blank_cdata == TRUE && - !HasClass(p->dtd, (wint_t)chr, CH_BLANK) ) - { p->cdata_must_be_empty = !open_element(p, CDATA_ELEMENT, FALSE); - p->blank_cdata = FALSE; - } - - if ( chr == '\n' && buf->size > 0 && - fetch_ocharbuf(buf, buf->size-1) == '\r' ) - buf->size--; - - add_ocharbuf(buf, chr); - } -} - - -/* We discovered illegal markup and now process it as normal CDATA -*/ - -static void -recover_parser(dtd_parser *p) -{ const ichar *s; - - terminate_icharbuf(p->buffer); - add_cdata(p, p->saved); - for(s=p->buffer->data; *s; s++) - add_cdata(p, *s); - p->state = S_PCDATA; -} - - -static inline void -setlocation(dtd_srcloc *d, dtd_srcloc *loc, int line, int lpos) -{ d->line = line; - d->linepos = lpos; - d->charpos = loc->charpos - 1; - d->type = loc->type; - d->name = loc->name; -} - - -int -putchar_dtd_parser(dtd_parser *p, int chr) -{ dtd *dtd = p->dtd; - const ichar *f = dtd->charfunc->func; - int line = p->location.line; - int lpos = p->location.linepos; - - p->location.charpos++; /* TBD: actually `bytepos' */ - -#ifdef UTF8 - if ( p->state == S_UTF8 ) - { if ( (chr & 0xc0) != 0x80 ) /* TBD: recover */ - gripe(p, ERC_SYNTAX_ERROR, L"Bad UTF-8 sequence", L""); - p->utf8_char <<= 6; - p->utf8_char |= (chr & ~0xc0); - if ( --p->utf8_left == 0 ) - { chr = p->utf8_char; - p->state = p->utf8_saved_state; - } else - { return TRUE; - } - } else if ( ISUTF8_MB(chr) && p->utf8_decode ) - { process_utf8(p, chr); - return TRUE; - } -#endif - - if ( f[CF_RS] == chr ) - { p->location.line++; - p->location.linepos = 0; - } else - { if ( f[CF_RE] == chr ) - p->location.linepos = 0; - else - p->location.linepos++; - } - -reprocess: - switch(p->state) - { case S_PCDATA: - { if ( f[CF_MDO1] == chr ) /* < */ - { setlocation(&p->startloc, &p->location, line, lpos); - p->state = S_DECL0; - empty_icharbuf(p->buffer); - return TRUE; - } - if ( p->dmode == DM_DTD ) - { if ( f[CF_PERO] == chr ) /* % */ - { setlocation(&p->startloc, &p->location, line, lpos); - p->state = S_PENT; - return TRUE; - } - } else - { if ( f[CF_ERO] == chr ) /* & */ - { setlocation(&p->startloc, &p->location, line, lpos); - p->state = S_ENT0; - return TRUE; - } - } - - if ( p->marked && f[CF_DSC] == chr ) /* ] in marked section */ - { empty_icharbuf(p->buffer); - p->state = S_EMSC1; - p->saved = chr; /* for recovery */ - return TRUE; - } - - if ( p->waiting_for_net && f[CF_ETAGO2] == chr ) /* shorttag */ - { setlocation(&p->startloc, &p->location, line, lpos); - process_net(p); - return TRUE; - } - - /* Real character data */ - if ( p->cdata->size == 0 ) - setlocation(&p->startcdata, &p->location, line, lpos); - - add_cdata(p, chr); - return TRUE; - } - case S_ECDATA2: /* Seen </ in CDATA/RCDATA */ - { if ( f[CF_MDC] == chr && - p->etaglen == p->buffer->size && - istrncaseeq(p->buffer->data, p->etag, p->etaglen) ) - { p->cdata->size -= p->etaglen+2; /* 2 for </ */ - terminate_ocharbuf(p->cdata); - terminate_icharbuf(p->buffer); - if ( p->mark_state == MS_INCLUDE ) - { process_cdata(p, TRUE); - process_end_element(p, p->buffer->data); - empty_cdata(p); - } - empty_icharbuf(p->buffer); - p->cdata_state = p->state = S_PCDATA; - } else - { add_verbatim_cdata(p, chr); - if ( p->etaglen < p->buffer->size || - !HasClass(dtd, (wint_t)chr, CH_NAME)) - { empty_icharbuf(p->buffer); /* mismatch */ - p->state = p->cdata_state; - } else - add_icharbuf(p->buffer, chr); - } - return TRUE; - } - case S_ECDATA1: /* seen < in CDATA */ - { add_verbatim_cdata(p, chr); - if ( f[CF_ETAGO2] == chr ) /* / */ - { empty_icharbuf(p->buffer); - p->state = S_ECDATA2; - } else if ( f[CF_ETAGO1] != chr ) /* <: do not change state */ - p->state = p->cdata_state; - return TRUE; - } - case S_RCDATA: - { if ( f[CF_ERO] == chr ) /* & */ - { setlocation(&p->startloc, &p->location, line, lpos); - p->state = S_ENT0; - return TRUE; - } - /*FALLTHROUGH*/ - } - case S_CDATA: - { add_verbatim_cdata(p, chr); - - if ( f[CF_MDO1] == chr ) /* < */ - { setlocation(&p->startloc, &p->location, line, lpos); - p->state = S_ECDATA1; - } - - /* / in CDATA shorttag element */ - if ( p->waiting_for_net && f[CF_ETAGO2] == chr ) - { setlocation(&p->startloc, &p->location, line, lpos); - p->cdata->size--; - terminate_ocharbuf(p->cdata); - terminate_icharbuf(p->buffer); - if ( p->mark_state == MS_INCLUDE ) - { process_cdata(p, TRUE); - process_net(p); - empty_cdata(p); - } - empty_icharbuf(p->buffer); - p->cdata_state = p->state = S_PCDATA; - } - - return TRUE; - } - case S_MSCDATA: - { add_verbatim_cdata(p, chr); - if ( f[CF_DSC] == chr ) /* ] */ - p->state = S_EMSCDATA1; - return TRUE; - } - case S_EMSCDATA1: - { add_verbatim_cdata(p, chr); - if ( f[CF_DSC] == chr ) /* ]] */ - p->state = S_EMSCDATA2; - else - p->state = S_MSCDATA; - return TRUE; - } - case S_EMSCDATA2: - { add_verbatim_cdata(p, chr); - if ( f[CF_MDC] == chr ) /* ]]> */ - { p->cdata->size -= 3; /* Delete chars for ]] */ - pop_marked_section(p); - p->state = S_PCDATA; - } else if ( f[CF_DSC] != chr ) /* if ]]], stay in this state */ - p->state = S_MSCDATA; - return TRUE; - } - case S_EMSC1: - { if ( f[CF_DSC] == chr ) /* ]] in marked section */ - { p->state = S_EMSC2; - return TRUE; - } else - { add_icharbuf(p->buffer, chr); - recover_parser(p); - return TRUE; - } - } - case S_EMSC2: - { if ( f[CF_MDC] == chr ) /* ]]> in marked section */ - { pop_marked_section(p); - p->state = S_PCDATA; - return TRUE; - } else - { add_icharbuf(p->buffer, chr); - recover_parser(p); - return TRUE; - } - } - case S_PENT: /* %parameter entity; */ - { if ( f[CF_ERC] == chr ) - { p->state = S_PCDATA; - terminate_icharbuf(p->buffer); - if ( p->mark_state == MS_INCLUDE ) - { process_include(p, p->buffer->data); - } - empty_icharbuf(p->buffer); - return TRUE; - } - if ( HasClass(dtd, (wint_t)chr, CH_NAME) ) - { add_icharbuf(p->buffer, chr); - return TRUE; - } - - terminate_icharbuf(p->buffer); - return gripe(p, ERC_SYNTAX_ERROR, - L"Illegal parameter entity", p->buffer->data); - } - case S_ENT0: /* Seen & */ - { if ( chr == '#' || HasClass(dtd, (wint_t)chr, CH_NAME) ) - { empty_icharbuf(p->buffer); - add_icharbuf(p->buffer, chr); - p->state = S_ENT; - } else - { if ( dtd->dialect != DL_SGML ) - { wchar_t buf[3]; - buf[0] = '&'; - buf[1] = chr; - buf[2] = '\0'; - gripe(p, ERC_SYNTAX_ERROR, L"Illegal entity", buf); - } - - add_cdata(p, f[CF_ERO]); - p->state = p->cdata_state; - goto reprocess; - } - - return TRUE; - } - case S_ENT: /* &entity; */ - { if ( HasClass(dtd, (wint_t)chr, CH_NAME) ) - { add_icharbuf(p->buffer, chr); - return TRUE; - } - - terminate_icharbuf(p->buffer); - p->state = p->cdata_state; - if ( p->mark_state == MS_INCLUDE ) - { process_entity(p, p->buffer->data); - } - empty_icharbuf(p->buffer); - - if ( chr == CR ) - p->state = S_ENTCR; - else if ( f[CF_ERC] != chr && chr != '\n' ) - goto reprocess; - - return TRUE; - } - case S_ENTCR: /* seen &entCR, eat the LF */ - { p->state = p->cdata_state; - if ( chr != LF ) - goto reprocess; - - return TRUE; - } - case S_DECL0: /* Seen < */ - { if ( f[CF_ETAGO2] == chr ) /* </ */ - { add_icharbuf(p->buffer, chr); - p->state = S_DECL; - } else if ( HasClass(dtd, (wint_t)chr, CH_NAME) ) /* <letter */ - { add_icharbuf(p->buffer, chr); - p->state = S_DECL; - } else if ( f[CF_MDO2] == chr ) /* <! */ - { p->state = S_MDECL0; - } else if ( f[CF_PRO2] == chr ) /* <? */ - { p->state = S_PI; - } else /* recover */ - { add_cdata(p, f[CF_MDO1]); - add_cdata(p, chr); - p->state = S_PCDATA; - } - - return TRUE; - } - case S_MDECL0: /* Seen <! */ - { if ( f[CF_CMT] == chr ) /* <!- */ - { p->state = S_CMTO; - return TRUE; - } - add_icharbuf(p->buffer, f[CF_MDO2]); - add_icharbuf(p->buffer, chr); - p->state = S_DECL; - return TRUE; - } - case S_DECL: /* <...> */ - { if ( f[CF_MDC] == chr ) /* > */ - { prepare_cdata(p); - p->state = S_PCDATA; - terminate_icharbuf(p->buffer); - if ( p->mark_state == MS_INCLUDE ) - { process_declaration(p, p->buffer->data); - } - empty_icharbuf(p->buffer); - return TRUE; - } - if ( dtd->shorttag && f[CF_ETAGO2] == chr && p->buffer->size > 0 ) - { prepare_cdata(p); - p->state = S_PCDATA; - terminate_icharbuf(p->buffer); - if ( p->mark_state == MS_INCLUDE ) - { WITH_CLASS(p, EV_SHORTTAG, - process_declaration(p, p->buffer->data)); - } - empty_icharbuf(p->buffer); - p->waiting_for_net = TRUE; - return TRUE; - } - - add_icharbuf(p->buffer, chr); - - if ( f[CF_LIT] == chr ) /* " */ - { p->state = S_STRING; - p->saved = chr; - p->lit_saved_state = S_DECL; - } else if ( f[CF_LITA] == chr ) /* ' */ - { p->state = S_STRING; - p->saved = chr; - p->lit_saved_state = S_DECL; - return TRUE; - } else if ( f[CF_CMT] == chr && /* - */ - p->buffer->data[0] == f[CF_MDO2] ) /* Started <! */ - { p->state = S_DECLCMT0; - } else if ( f[CF_DSO] == chr ) /* [: marked section */ - { terminate_icharbuf(p->buffer); - - process_marked_section(p); - } - - return TRUE; - } - case S_DECLCMT0: /* <...- */ - { if ( f[CF_CMT] == chr ) - { p->buffer->size--; - p->state = S_DECLCMT; - } else - { add_icharbuf(p->buffer, chr); - p->state = S_DECL; - } - return TRUE; - } - case S_DECLCMT: /* <...--.. */ - { if ( f[CF_CMT] == chr ) - p->state = S_DECLCMTE0; - return TRUE; - } - case S_DECLCMTE0: /* <...--..- */ - { if ( f[CF_CMT] == chr ) - p->state = S_DECL; - else - p->state = S_DECLCMT; - return TRUE; - } - case S_PI: - { add_icharbuf(p->buffer, chr); - if ( f[CF_PRO2] == chr ) /* <? ... ? */ - p->state = S_PI2; - if ( f[CF_PRC] == chr ) /* no ? is ok too (XML/SGML) */ - goto pi; - return TRUE; - } - case S_PI2: - { if ( f[CF_PRC] == chr ) - { pi: - process_cdata(p, FALSE); - p->state = S_PCDATA; - p->buffer->size--; - terminate_icharbuf(p->buffer); - if ( p->mark_state == MS_INCLUDE ) - { process_pi(p, p->buffer->data); - } - empty_icharbuf(p->buffer); - return TRUE; - } - add_icharbuf(p->buffer, chr); - p->state = S_PI; - return TRUE; - } - case S_STRING: - { add_icharbuf(p->buffer, chr); - if ( chr == p->saved ) - p->state = p->lit_saved_state; - return TRUE; - } - case S_CMTO: /* Seen <!- */ - { if ( f[CF_CMT] == chr ) /* - */ - { p->state = S_CMT1; - return TRUE; - } else - { add_cdata(p, f[CF_MDO1]); - add_cdata(p, f[CF_MDO2]); - add_cdata(p, f[CF_CMT]); - add_cdata(p, chr); - p->state = S_PCDATA; - return TRUE; - } - } - case S_CMT1: /* <!-- */ - { if ( f[CF_CMT] == chr ) /* <!--- */ - { if ( dtd->dialect != DL_SGML ) - gripe(p, ERC_SYNTAX_ERROR, L"Illegal comment", L"<!---"); - } - p->state = S_CMT; - return TRUE; - } - case S_CMT: - { if ( f[CF_CMT] == chr ) - p->state = S_CMTE0; /* <!--...- */ - return TRUE; - } - case S_CMTE0: /* <!--... -- */ - { if ( f[CF_CMT] == chr ) - p->state = S_CMTE1; - else - p->state = S_CMT; - return TRUE; - } - case S_CMTE1: /* <!--...-- seen */ - { if ( f[CF_MDC] == chr ) /* > */ - { if ( p->on_decl ) - (*p->on_decl)(p, (ichar*)""); - p->state = S_PCDATA; - } else - { if ( dtd->dialect != DL_SGML ) - gripe(p, ERC_SYNTAX_ERROR, L"Illegal comment", L""); - if ( f[CF_CMT] != chr ) - p->state = S_CMT; - } - return TRUE; - } - case S_GROUP: /* [...] in declaration */ - { add_icharbuf(p->buffer, chr); - if ( f[CF_DSO] == chr ) - { p->grouplevel++; - } else if ( f[CF_DSC] == chr ) - { if ( --p->grouplevel == 0 ) - p->state = S_DECL; - } else if ( f[CF_LIT] == chr ) /* " */ - { p->state = S_STRING; - p->saved = chr; - p->lit_saved_state = S_GROUP; - } else if ( f[CF_LITA] == chr ) /* ' */ - { p->state = S_STRING; - p->saved = chr; - p->lit_saved_state = S_GROUP; - return TRUE; - } - return TRUE; - } -#ifdef UTF8 - case S_UTF8: -#endif - default: - assert(0); - return FALSE; - } -} - - - /******************************* - * TOPLEVEL * - *******************************/ - -int -load_dtd_from_file(dtd_parser *p, const ichar *file) -{ FILE *fd; - int rval; - data_mode oldmode = p->dmode; - dtdstate oldstate = p->state; - locbuf oldloc; - - push_location(p, &oldloc); - p->dmode = DM_DTD; - p->state = S_PCDATA; - empty_icharbuf(p->buffer); /* dubious */ - set_file_dtd_parser(p, IN_FILE, file); - - if ( (fd = wfopen(file, "rb")) ) - { int chr; - - while( (chr = getc(fd)) != EOF ) - putchar_dtd_parser(p, chr); - - fclose(fd); - - p->dtd->implicit = FALSE; - rval = TRUE; - } else - rval = FALSE; - - pop_location(p, &oldloc); - p->dmode = oldmode; - p->state = oldstate; - - return rval; -} - - -dtd * -file_to_dtd(const ichar *file, const ichar *doctype, dtd_dialect dialect) -{ dtd_parser *p = new_dtd_parser(new_dtd(doctype)); - - set_dialect_dtd(p->dtd, dialect); - - if ( load_dtd_from_file(p, file) ) - { dtd *dtd = p->dtd; - - dtd->references++; /* avoid deletion */ - free_dtd_parser(p); - return dtd; - } else - { free_dtd_parser(p); - - return NULL; - } -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -SGML sees a file as - -[<LF>]Line 1<CR> - <LF> Line 2<CR> - -I.e. the newline appearing just before the end-of-file should be -ignored. In addition, Unix-style files are mapped to CR-LF. Thanks to -Richard O'Keefe. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -int -sgml_process_stream(dtd_parser *p, FILE *fd, unsigned flags) -{ int p0, p1; - - if ( (p0 = getc(fd)) == EOF ) - return TRUE; - if ( (p1 = getc(fd)) == EOF ) - { putchar_dtd_parser(p, p0); - return end_document_dtd_parser(p); - } - - for(;;) - { int p2 = getc(fd); - - if ( p2 == EOF ) - { putchar_dtd_parser(p, p0); - if ( p1 != LF ) - putchar_dtd_parser(p, p1); - else if ( p0 != CR ) - putchar_dtd_parser(p, CR); - - if ( flags & SGML_SUB_DOCUMENT ) - return TRUE; - else - return end_document_dtd_parser(p); - } - - putchar_dtd_parser(p, p0); - p0 = p1; - p1 = p2; - } -} - - -int -sgml_process_file(dtd_parser *p, const ichar *file, unsigned flags) -{ FILE *fd; - int rval; - locbuf oldloc; - - push_location(p, &oldloc); - set_file_dtd_parser(p, IN_FILE, file); - if ( !(flags & SGML_SUB_DOCUMENT) ) - set_mode_dtd_parser(p, DM_DATA); - - if ( (fd = wfopen(file, "rb")) ) - { rval = sgml_process_stream(p, fd, flags); - fclose(fd); - } else - rval = FALSE; - - pop_location(p, &oldloc); - - return rval; -} - - - - /******************************* - * ERRORS * - *******************************/ - -static wchar_t * -format_location(wchar_t *s, size_t len, dtd_srcloc *l) -{ int first = TRUE; - - if ( !l || l->type == IN_NONE ) - return s; - - for( ; l && l->type != IN_NONE; - l = l->parent, first = FALSE ) - { if ( !first ) - { swprintf(s, len, L" (from "); - s += wcslen(s); - } - - switch(l->type) - { case IN_NONE: - assert(0); - case IN_FILE: - swprintf(s, len, L"%ls:%d:%d", l->name.file, l->line, l->linepos); - break; - case IN_ENTITY: - swprintf(s, len, L"&%ls;%d:%d", l->name.entity, l->line, l->linepos); - break; - } - - s += wcslen(s); - if ( !first ) - { *s++ = L')'; - } - } - - *s++ = L':'; - *s++ = L' '; - - return s; -} - - -static void -format_message(dtd_error *e) -{ wchar_t buf[1024]; - wchar_t *s; - int prefix_len; - int left; - - switch(e->severity) - { case ERS_ERROR: - wcscpy(buf, L"Error: "); - break; - case ERS_WARNING: - wcscpy(buf, L"Warning: "); - break; - default: - buf[0] = '\0'; - } - s = buf+wcslen(buf); - - s = format_location(s, 1024-(s-buf), e->location); - prefix_len = (int)(s-buf); - left = 1024-prefix_len; - - switch(e->id) - { case ERC_REPRESENTATION: - swprintf(s, left, L"Cannot represent due to %ls", e->argv[0]); - break; - case ERC_RESOURCE: - swprintf(s, left, L"Insufficient %ls resources", e->argv[0]); - break; - case ERC_LIMIT: - swprintf(s, left, L"%ls limit exceeded", e->argv[0]); - break; - case ERC_VALIDATE: - swprintf(s, left, L"%ls", e->argv[0]); - break; - case ERC_SYNTAX_ERROR: - swprintf(s, left, L"Syntax error: %ls", e->argv[0]); - break; - case ERC_EXISTENCE: - swprintf(s, left, L"%ls \"%ls\" does not exist", e->argv[0], e->argv[1]); - break; - case ERC_REDEFINED: - swprintf(s, left, L"Redefined %ls \"%ls\"", e->argv[0], e->argv[1]); - break; - default: - ; - } - - e->message = str2ring(buf); - e->plain_message = e->message + prefix_len; -} - - -int -gripe(dtd_parser *p, dtd_error_id e, ...) -{ va_list args; - wchar_t buf[1024]; - dtd_error error; - int dtdmode = FALSE; - void *freeme = NULL; - - va_start(args, e); - - memset(&error, 0, sizeof(error)); - error.minor = e; /* detailed error code */ - - if ( p ) - { error.location = &p->location; - if ( p->dmode == DM_DTD ) - dtdmode = TRUE; - } else - { error.location = NULL; - } - - switch(e) - { case ERC_REPRESENTATION: - case ERC_RESOURCE: - error.severity = ERS_ERROR; - error.argv[0] = va_arg(args, wchar_t *); - break; - case ERC_LIMIT: - error.severity = ERS_WARNING; - error.argv[0] = va_arg(args, wchar_t *); - break; - case ERC_SYNTAX_ERROR: - case ERC_SYNTAX_WARNING: - { wchar_t *m = va_arg(args, wchar_t *); - const wchar_t *s = va_arg(args, const wchar_t *); - - if ( s && *s ) - { swprintf(buf, 1024, L"%ls, found \"%ls\"", m, str_summary(s, 25)); - error.argv[0] = buf; - } else - error.argv[0] = m; - - error.severity = (e == ERC_SYNTAX_WARNING ? ERS_WARNING : ERS_ERROR); - e = ERC_SYNTAX_ERROR; - break; - } - case ERC_DOMAIN: - { const wchar_t *expected = va_arg(args, const wchar_t *); - const wchar_t *found = str_summary(va_arg(args, const wchar_t *), 25); - - swprintf(buf, 1024, L"Expected type %ls, found \"%ls\"", expected, found); - error.argv[0] = buf; - error.severity = ERS_ERROR; - e = (dtdmode ? ERC_SYNTAX_ERROR : ERC_VALIDATE); - break; - } - case ERC_REDEFINED: - { dtd_symbol *name; - error.argv[0] = va_arg(args, wchar_t *); /* type */ - name = va_arg(args, dtd_symbol *); /* name */ - error.argv[1] = (ichar*)name->name; - error.severity = ERS_STYLE; - break; - } - case ERC_EXISTENCE: - { error.argv[0] = va_arg(args, wchar_t *); /* type */ - error.argv[1] = va_arg(args, wchar_t *); /* name */ - error.severity = ERS_ERROR; - break; - } - case ERC_VALIDATE: - { error.argv[0] = va_arg(args, wchar_t *); /* message */ - error.severity = ERS_WARNING; - break; - } - case ERC_OMITTED_CLOSE: - { const wchar_t *element = va_arg(args, const wchar_t *); - - swprintf(buf, 1024, L"Inserted omitted end-tag for \"%ls\"", element); - error.argv[0] = buf; - error.severity = ERS_WARNING; - e = ERC_VALIDATE; - break; - } - case ERC_OMITTED_OPEN: - { const wchar_t *element = va_arg(args, const wchar_t *); - - swprintf(buf, 1024, L"Inserted omitted start-tag for \"%ls\"", element); - error.argv[0] = buf; - error.severity = ERS_WARNING; - e = ERC_VALIDATE; - break; - } - case ERC_NOT_OPEN: - { const wchar_t *element = va_arg(args, const wchar_t *); - - swprintf(buf, 1024, L"Ignored end-tag for \"%ls\" which is not open", - element); - error.argv[0] = buf; - error.severity = ERS_WARNING; - e = ERC_VALIDATE; - break; - } - case ERC_NOT_ALLOWED: - { const wchar_t *element = va_arg(args, const wchar_t *); - - swprintf(buf, 1024, L"Element \"%ls\" not allowed here", element); - error.argv[0] = buf; - error.severity = ERS_WARNING; - e = ERC_VALIDATE; - break; - } - case ERC_NOT_ALLOWED_PCDATA: - { const ocharbuf *cdata = va_arg(args, const ocharbuf *); - - swprintf(buf, 1024, L"#PCDATA (\"%ls\") not allowed here", - str_summary(cdata->data.w, 25)); - error.argv[0] = buf; - error.severity = ERS_WARNING; - e = ERC_VALIDATE; - break; - } - case ERC_NO_ATTRIBUTE: - { const wchar_t *elem = va_arg(args, wchar_t *); /* element */ - const wchar_t *attr = va_arg(args, wchar_t *); /* attribute */ - - swprintf(buf, 1024, L"Element \"%ls\" has no attribute \"%ls\"", - elem, attr); - error.argv[0] = buf; - error.severity = ERS_WARNING; - - e = ERC_VALIDATE; - break; - } - case ERC_NO_ATTRIBUTE_VALUE: - { const wchar_t *elem = va_arg(args, wchar_t *); /* element */ - const wchar_t *value = va_arg(args, wchar_t *); /* attribute value */ - - swprintf(buf, 1024, L"Element \"%ls\" has no attribute with value \"%ls\"", - elem, value); - error.argv[0] = buf; - error.severity = ERS_WARNING; - - e = ERC_VALIDATE; - break; - } - case ERC_NO_VALUE: - { error.argv[0] = L"entity value"; - error.argv[1] = va_arg(args, wchar_t *); /* entity */ - - error.severity = ERS_ERROR; - e = ERC_EXISTENCE; - break; - } - case ERC_NO_DOCTYPE: - { const wchar_t *doctype = va_arg(args, wchar_t *); /* element */ - const wchar_t *file = va_arg(args, wchar_t *); /* DTD file */ - - swprintf(buf, 1024, L"No <!DOCTYPE ...>, assuming \"%ls\" from DTD file \"%s\"", - doctype, file); - error.argv[0] = buf; - error.severity = ERS_WARNING; - - e = ERC_VALIDATE; - break; - } - case ERC_NO_CATALOGUE: - { char *file = va_arg(args, char *); /* catalogue file */ - - error.argv[0] = L"catalogue file"; - freeme = error.argv[1] = utf8towcs(file); - error.severity = ERS_WARNING; - e = ERC_EXISTENCE; - - break; - } - } - - error.id = e; - format_message(&error); - - if ( p && p->on_error ) - (*p->on_error)(p, &error); - else - fwprintf(stderr, L"SGML: %ls\n", error.message); - - if ( freeme ) - sgml_free(freeme); - - va_end(args); - - return FALSE; -} diff --git a/packages/sgml/parser.h b/packages/sgml/parser.h deleted file mode 100644 index f98f35808..000000000 --- a/packages/sgml/parser.h +++ /dev/null @@ -1,239 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog - - Author: Jan Wielemaker - E-mail: jan@swi.psy.uva.nl - WWW: http://www.swi-prolog.org - Copyright (C): 1985-2002, University of Amsterdam - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef SGML_PARSER_H_INCLUDED -#define SGML_PARSER_H_INCLUDED -#include "util.h" -#include <wchar.h> - - /******************************* - * CALL-BACK * - *******************************/ - - /* sgml_attribute->flags */ -#define SGML_AT_DEFAULT 0x1 - -typedef struct _sgml_attribute -{ struct /* so we can free members */ - { wchar_t *textW; /* UCS textual value */ - long number; /* numeric value/length */ - } value; - dtd_attr *definition; /* DTD definition */ - unsigned flags; /* additional flags */ -} sgml_attribute; - -typedef struct _dtd_parser *dtd_parser_p; - -typedef int (*sgml_begin_element_f)(dtd_parser_p parser, - dtd_element *e, - int argc, - sgml_attribute *argv); -typedef int (*sgml_end_element_f)(dtd_parser_p parser, - dtd_element *e); -typedef int (*sgml_data_f)(dtd_parser_p parser, - data_type type, int len, const wchar_t *text); -typedef int (*sgml_wdata_f)(dtd_parser_p parser, - data_type type, int len, const wchar_t *text); -typedef int (*sgml_entity_f)(dtd_parser_p parser, - dtd_entity *entity, - int chr); -typedef int (*sgml_pi_f)(dtd_parser_p parser, const ichar *pi); -typedef int (*sgml_error_f)(dtd_parser_p parser, - dtd_error *error); -typedef int (*sgml_decl_f)(dtd_parser_p parser, const ichar *decl); -#ifdef XMLNS -typedef int (*xmlns_f)(dtd_parser_p parser, - dtd_symbol *ns, dtd_symbol *url); -#endif - - - /******************************* - * PARSER AND STATES * - *******************************/ - -#define SGML_PARSER_MAGIC (0x834ab663) - -typedef enum -{ S_PCDATA, /* between declarations */ -#ifdef UTF8 - S_UTF8, /* Loading UTF-8 character */ -#endif - S_CDATA, /* non-parsed data */ - S_RCDATA, /* CDATA+entities */ - S_MSCDATA, /* <![CDATA[...]]> */ - S_EMSCDATA1, /* Seen ] in S_MSCDATA */ - S_EMSCDATA2, /* Seen ]] in S_MSCDATA */ - S_ECDATA1, /* Seen < in CDATA */ - S_ECDATA2, /* Seen </ in CDATA */ - S_EMSC1, /* Seen ] in marked section */ - S_EMSC2, /* Seen ]] in marked section */ - S_PI, /* Seen <? */ - S_PI2, /* Seen <?...? */ - S_DECL0, /* Seen < */ - S_DECL, /* inside a declaration */ - S_MDECL0, /* Seen <! */ - S_STRING, /* inside a "string" or 'string' */ - S_DECLCMT0, /* Seen <...- */ - S_DECLCMT, /* Seen <...-- */ - S_DECLCMTE0, /* Seen <...--..- */ - S_CMTO, /* Seen <!- */ - S_CMT1, /* Seen <!-- */ - S_CMT, /* Seen <!--X... */ - S_CMTE0, /* Seem <!--...- */ - S_CMTE1, /* Seem <!--...-- */ - S_GROUP, /* inside [...] */ - S_PENT, /* Seen % */ - S_ENT0, /* Seen & */ - S_ENT, /* Seen &(#|\w) */ - S_ENTCR /* Seen &entity<CR> */ -} dtdstate; - - -typedef enum -{ DCL_DTD, /* DTD Declaration */ - DCL_BEGIN, /* begin-tag */ - DCL_END /* end-tag */ -} dcl_type; - - -typedef enum -{ MS_IGNORE, /* ignore this data */ - MS_INCLUDE, /* process normally */ - MS_CDATA, /* pass literally */ - MS_RCDATA /* replace entities */ -} marktype; - - -typedef enum -{ EV_EXPLICIT, /* Explicit event */ - EV_OMITTED, /* Omitted tag event */ - EV_SHORTTAG, /* SHORTTAG event: <tag/value/ */ - EV_SHORTREF /* SHORTREF event */ -} sgml_event_class; - - -typedef struct _dtd_marked -{ dtd_symbol *keyword; /* keyword of the marked section */ - marktype type; /* processing type */ - struct _dtd_marked *parent; /* parent marked section */ -} dtd_marked; - - -typedef enum -{ DM_DTD, /* DTD mode: no data allowed (?) */ - DM_DATA /* Environment has only elements */ -} data_mode; - -#ifdef XMLNS -typedef enum -{ NONS_ERROR = 0, - NONS_QUIET -} xmlnons; -#endif - -typedef struct _sgml_environment -{ dtd_element *element; /* element that opened the env */ - struct _dtd_state *state; /* State we are in */ -#ifdef XMLNS - struct _xmlns *xmlns; /* XML namespace */ - struct _xmlns *thisns; /* Name space of element */ -#endif -#ifdef XMLBASE - ichar *uri_base; /* xml:base handling */ -#endif - dtd_space_mode space_mode; /* How to handle blanks */ - dtd_shortref *map; /* SHORTREF map */ - struct _sgml_environment *parent; /* Parent environment */ - int wants_net; /* I want a net */ - int saved_waiting_for_net; /* saved value of waiting for net */ -} sgml_environment; - - /* parser->flags */ -#define SGML_PARSER_NODEFS 0x01 /* don't handle default atts */ -#define SGML_PARSER_QUALIFY_ATTS 0x02 /* qualify attributes in XML mode */ - -typedef struct _dtd_parser -{ unsigned long magic; /* SGML_PARSER_MAGIC */ - dtd *dtd; /* DTD we are building */ - dtdstate state; /* current state */ - dtdstate cdata_state; /* S_CDATA/S_RCDATA */ - dtd_marked *marked; /* marked section stack */ - marktype mark_state; /* processing mode */ - dtd_element *empty_element; /* empty of <tag/> seen */ - sgml_environment *environments; /* Open environments */ - data_mode dmode; /* How to handle characters */ - int first; /* Just seen <tag> */ - int waiting_for_net; /* waiting for / in <shorttag/mode/ */ - icharbuf *buffer; /* buffer for temp data */ - ocharbuf *cdata; /* collected character data */ - int blank_cdata; /* CDATA is all blank */ - int cdata_must_be_empty; /* Only shortrefs allowed here */ - const ichar *etag; /* name of end-tag in CDATA */ - int etaglen; /* length of end-tag */ - int grouplevel; /* [..] level in declaration */ - int saved; /* saved character */ - dtdstate lit_saved_state; /* literal saved-state */ - int encoded; /* TRUE for binary input */ - dtd_shortref *map; /* SHORTREF map */ -#ifdef UTF8 - int utf8_decode; /* decode UTF-8 sequences? */ - int utf8_char; /* building character */ - int utf8_left; /* bytes left */ - dtdstate utf8_saved_state; /* state from which we come */ -#endif - dtd_srcloc location; /* Current location */ - dtd_srcloc startloc; /* Start of last markup */ - dtd_srcloc startcdata; /* Start of last cdata */ - dtd_symbol *enforce_outer_element; /* Outer element to look for */ - sgml_event_class event_class; /* EV_* */ - xmlnons xml_no_ns; /* What if namespace does not exist? */ -#ifdef XMLNS - struct _xmlns *xmlns; /* Outer xmlns declaration */ -#endif - - void *closure; /* client handle */ - sgml_begin_element_f on_begin_element; /* start an element */ - sgml_end_element_f on_end_element; /* end an element */ - sgml_data_f on_data; /* process cdata */ - sgml_entity_f on_entity; /* unprocessed entity */ - sgml_pi_f on_pi; /* processing instruction */ - sgml_error_f on_error; /* handle error */ - sgml_decl_f on_decl; /* handle declarations */ -#ifdef XMLNS - xmlns_f on_xmlns; /* handle new namespace */ -#endif - unsigned flags; /* misc flags */ -} dtd_parser; - - -#ifdef XMLNS -#include "xmlns.h" -#endif - -extern int gripe(dtd_parser *p, dtd_error_id e, ...); - -#define SGML_SUB_DOCUMENT 0x1 - -#endif /*SGML_PARSER_H_INCLUDED*/ - diff --git a/packages/sgml/pltotex.pl b/packages/sgml/pltotex.pl deleted file mode 100644 index 7e002aae8..000000000 --- a/packages/sgml/pltotex.pl +++ /dev/null @@ -1,76 +0,0 @@ -:- module(pltotex, - [ pltotex/2, - pltotex/0 - ]). -:- use_module(library(doc_latex)). -:- use_module(library(main)). -:- use_module(library(error)). -:- use_module(library(apply)). -:- use_module(library(lists)). - -pltotex(File, Options) :- - file_name_extension(_, txt, File), !, - tex_file(File, Out, Options), - doc_latex(File, Out, - [ stand_alone(false) - | Options - ]). -pltotex(Lib, Options) :- - ( file_name_extension(_, pl, Lib) - -> Spec = Lib - ; atom_to_term(Lib, Spec, _) - ), - absolute_file_name(Spec, File, - [ access(read), - file_type(prolog) - ]), - tex_file(File, Out, Options), - user:use_module(File), % we want the operators in user - doc_latex(File, Out, - [ stand_alone(false) - | Options - ]). - -tex_file(_, TeXFile, Options) :- - option(out(Base), Options), !, - file_name_extension(Base, tex, TeXFile). -tex_file(File, TeXFile, _) :- - file_base_name(File, Local), - file_name_extension(Base0, _, Local), - strip(Base0, 0'_, Base), - file_name_extension(Base, tex, TeXFile). - -strip(In, Code, Out) :- - atom_codes(In, Codes0), - delete(Codes0, Code, Codes), - atom_codes(Out, Codes). - - -%% pltotex -% -% Usage: pl -q -s pltotex.pl -g pltotex -- file ... - -pltotex :- - main. - -main(Argv) :- - partition(is_option, Argv, OptArgs, Files), - maplist(to_option, OptArgs, Options), - maplist(process_file(Options), Files). - -is_option(Arg) :- - sub_atom(Arg, 0, _, _, --). - -to_option('--section', section_level(section)) :- !. -to_option('--subsection', section_level(subsection)) :- !. -to_option('--subsubsection', section_level(subsubsection)) :- !. -to_option(Arg, Option) :- - atom_concat(--, Opt, Arg), - sub_atom(Opt, B, _, A, =), !, - sub_atom(Opt, 0, B, _, Name), - sub_atom(Opt, _, A, 0, Value), - Option =.. [Name, Value]. - -process_file(Options, File) :- - pltotex(File, Options). - diff --git a/packages/sgml/prolog.c b/packages/sgml/prolog.c deleted file mode 100644 index 23fe92ffc..000000000 --- a/packages/sgml/prolog.c +++ /dev/null @@ -1,520 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog - - Author: Jan Wielemaker - E-mail: jan@swi.psy.uva.nl - WWW: http://www.swi-prolog.org - Copyright (C): 1985-2002, University of Amsterdam - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#define _ISOC99_SOURCE 1 /* fwprintf(), etc prototypes */ -#include <stdio.h> -#include <wchar.h> -#include <assert.h> -#include <string.h> -#include <wctype.h> -#include <time.h> -#include "dtd.h" -#include "util.h" -#include "prolog.h" - -static int errors; - - /******************************* - * PROLOG SYNTAX * - *******************************/ - -typedef enum -{ AT_LOWER, - AT_QUOTE, - AT_FULLSTOP, - AT_SYMBOL, - AT_SOLO, - AT_SPECIAL -} atomtype; - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Contributed by Richard O'Keefe. Thanks! -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -static int -atomType(ichar const *s, int len) -{ static ichar const symbols[] = L"#$&*+-./:<=>?@\\^`~"; - unsigned char const *u = (unsigned char const *)s; - - switch (len) - { case 0: - return AT_QUOTE; - case 1: - return iswlower(u[0]) ? AT_LOWER - : u[0] == '.' ? AT_FULLSTOP - : u[0] == '!' ? AT_SOLO - : u[0] == ';' ? AT_SOLO - : u[0] == ',' ? AT_SOLO - : AT_QUOTE; - case 2: - if (u[0] == '[' && u[1] == ']') return AT_SPECIAL; - if (u[0] == '{' && u[1] == '}') return AT_SPECIAL; - break; - default: - break; - } - - if (iswlower(u[0])) - { do ++u; while (--len > 0 && (iswalnum(*u) || *u == '_')); - return len == 0 ? AT_LOWER : AT_QUOTE; - } else if (wcschr(symbols, *u) != NULL) - { do ++u; while (--len > 0 && wcschr(symbols, *u) != 0); - return len == 0 ? AT_SYMBOL : AT_QUOTE; - } else - { return AT_QUOTE; - } -} - - -static const ichar * -atom(const ichar *text) -{ int len = wcslen(text); - - switch(atomType(text, len)) - { case AT_QUOTE: - case AT_FULLSTOP: - { ichar *tmp = ringallo((len*2+1)*sizeof(ichar)); - ichar *o = tmp; - - *o++ = '\''; - for( ; --len >= 0; text++) - { switch( *text ) - { case '\n': - *o++ = '\\'; - *o++ = 'n'; - break; - case '\r': - *o++ = '\\'; - *o++ = 'r'; - break; - case '\t': - *o++ = '\\'; - *o++ = 't'; - break; - case '\'': - *o++ = '\\'; - default: - *o++ = *text; - } - } - *o++ = '\''; - *o = '\0'; - - return tmp; - } - default: - return text; - } -} - - -static const char * -bool(int val) -{ return val ? "true" : "false"; -} - - -static void -prolog_print_entity(const char *which, dtd_entity *e) -{ switch( e->type ) - { case ET_LITERAL: - wprintf(L"%s(%ls, %ls).\n", - which, - atom(e->name->name), - atom(e->value)); - break; - case ET_SYSTEM: - wprintf(L"%s(%ls, system(%ls)).\n", - which, - atom(e->name->name), - atom(e->exturl)); - break; - case ET_PUBLIC: - wprintf(L"%s(%ls, public(%ls, %ls)).\n", - which, - atom(e->name->name), - atom(e->extid), - atom(e->exturl)); - break; - } -} - - -static void -prolog_print_model(dtd_model *m) -{ dtd_model *sub; - int n = 0; - const char *sep; - - switch(m->type) - { case MT_PCDATA: - printf("'#pcdata'"); - goto card; - case MT_ELEMENT: - wprintf(L"%ls", atom(m->content.element->name->name)); - goto card; - case MT_AND: - sep = " & "; - break; - case MT_SEQ: - sep = ", "; - break; - case MT_OR: - sep = "|"; - break; - case MT_UNDEF: - default: - assert(0); - sep = NULL; /* should not be used */ - break; - } - - printf("("); - for(sub = m->content.group; sub; sub=sub->next) - { if ( n++ > 0 ) - printf("%s", sep); - prolog_print_model(sub); - } - printf(")"); - -card: - switch(m->cardinality) - { case MC_ONE: - break; - case MC_OPT: - printf("?"); - break; - case MC_REP: - printf("*"); - break; - case MC_PLUS: - printf("+"); - break; - } -} - - -static void -prolog_print_content(dtd_element *e) -{ dtd_edef *def = e->structure; - - switch( def->type ) - { case C_EMPTY: - printf("empty"); - break; - case C_CDATA: - printf("cdata"); - break; - case C_RCDATA: - printf("rcdata"); - break; - case C_ANY: - printf("any"); - break; - default: - if ( def->content ) - { printf("model("); - prolog_print_model(def->content); - printf(")"); - } else - { printf("[]"); - fwprintf(stderr, - L"Warning: element %s has no content model\n", - e->name->name); - errors++; - } - break; - } -} - - -static ichar * -istrblank(const ichar *s) -{ for( ; *s; s++ ) - { if ( iswspace(*s) ) - return (ichar *)s; - } - - return NULL; -} - - -static void -print_listval(attrtype type, int len, const ichar *text) -{ ichar *t = sgml_malloc((len+1)*sizeof(ichar)); - - istrncpy(t, text, len); - t[len] = '\0'; - - if ( type == AT_NUMBERS ) - wprintf(L"%ls", t); - else - wprintf(L"%ls", atom(t)); - - sgml_free(t); -} - - -static void -prolog_print_attribute(dtd_element *e, dtd_attr *at) -{ wprintf(L" attribute(%ls, %ls, ", - atom(e->name->name), atom(at->name->name)); - - switch(at->type) /* print type */ - { case AT_CDATA: - printf("cdata"); - break; - case AT_ENTITY: - printf("entity"); - break; - case AT_ENTITIES: - printf("entities"); - break; - case AT_ID: - printf("id"); - break; - case AT_IDREF: - printf("idref"); - break; - case AT_IDREFS: - printf("list(idref)"); - break; - case AT_NAME: - printf("name"); - break; - case AT_NAMES: - printf("list(name)"); - break; - case AT_NMTOKEN: - printf("nmtoken"); - break; - case AT_NMTOKENS: - printf("list(nmtoken)"); - break; - case AT_NOTATION: - printf("notation"); - break; - case AT_NUMBER: - printf("number"); - break; - case AT_NUMBERS: - printf("list(number)"); - break; - case AT_NAMEOF: - { dtd_name_list *nl; - int n = 0; - - printf("nameof(["); - for(nl = at->typeex.nameof; nl; nl = nl->next) - { if ( n++ > 0 ) - printf(", "); - wprintf(L"%ls", atom(nl->value->name)); - } - printf("])"); - } - break; - case AT_NUTOKEN: - printf("nutoken"); - break; - case AT_NUTOKENS: - printf("list(nutoken)"); - break; - } - - printf(", "); /* print default */ - switch(at->def) - { case AT_REQUIRED: - printf("required"); - break; - case AT_CURRENT: - printf("current"); - break; - case AT_CONREF: - printf("conref"); - break; - case AT_IMPLIED: - printf("implied"); - break; - case AT_DEFAULT: - case AT_FIXED: - { char *f = (at->def == AT_DEFAULT ? "default" : "fixed"); - - printf("%s(", f); - - switch( at->type ) - { case AT_CDATA: - wprintf(L"%ls", atom(at->att_def.cdata)); - break; - case AT_NUMBER: - printf("%ld", at->att_def.number); - break; - case AT_NAME: - case AT_NUTOKEN: - case AT_NMTOKEN: - wprintf(L"%ls", atom(at->att_def.name->name)); - break; - default: - if ( at->islist ) - { const ichar *val = at->att_def.list; - const ichar *e; - int an = 0; - - printf("["); - for(e=istrblank(val); e; val = e+1, e=istrblank(val)) - { if ( e == val ) - continue; /* skip spaces */ - if ( an++ > 0 ) - printf(", "); - print_listval(at->type, e-val, val); - } - if ( an++ > 0 ) - printf(", "); - print_listval(at->type, istrlen(val), val); - printf("]"); - break; - } - assert(0); - } - - printf(")"); - } - } - - printf(").\n"); -} - - -static void -prolog_print_element(dtd_element *e, unsigned int flags) -{ ichar nbuf[MAXNMLEN]; - - istrcpy(nbuf, e->name->name); - istrupper(nbuf); - - wprintf(L"\n%% Element <%s>\n", nbuf); - - if ( e->structure ) - { dtd_edef *def = e->structure; - - wprintf(L"element(%ls, omit(%s, %s), ", - atom(e->name->name), - bool(def->omit_open), - bool(def->omit_close)); - prolog_print_content(e); - printf(").\n"); - - if ( def->excluded ) - { dtd_element_list *el; - - for(el = def->excluded; el; el=el->next) - wprintf(L"exclude(%ls, %ls).\n", - atom(e->name->name), - atom(el->value->name->name)); - } - if ( def->included ) - { dtd_element_list *el; - - for(el = def->included; el; el=el->next) - wprintf(L"include(%ls, %ls).\n", - atom(e->name->name), - atom(el->value->name->name)); - } - - if ( flags & PL_PRINT_ATTRIBUTES ) - { dtd_attr_list *al; - - for(al=e->attributes; al; al=al->next) - prolog_print_attribute(e, al->attribute); - } - } else - { fwprintf(stderr, L"Warning: element %s has no definition\n", - e->name->name); - errors++; - } -} - - -int -prolog_print_dtd(dtd *dtd, unsigned int flags) -{ dtd_entity *et; - dtd_element *e; - time_t now; - - if ( !dtd->doctype ) - fprintf(stderr, "DTD has no document type\n"); - - time(&now); - - if ( !flags ) - flags = PL_PRINT_ALL; - - errors = 0; - - wprintf(L"/* This file represents the SGML DOCTYPE \"%s\"\n", dtd->doctype); - printf(" converted using dtd2pl version %s\n", DTD2PL_VERSION); - printf(" Conversion date: %s\n\n", ctime(&now)); - printf(" dtd2pl is written by Jan Wielemaker\n"); - printf(" E-mail: jan@swi.psy.uva.nl\n"); - printf("*/\n\n"); - - wprintf(L":- module(%s_dtd, []).\n\n", dtd->doctype); - printf(":- op(100, xf, ?).\n"); - printf(":- op(100, xf, +).\n"); - printf(":- op(100, xf, *).\n"); - printf(":- op(200, xfy, &).\n"); - - printf("\n"); - printf(":- discontiguous\n"); - printf("\tattribute/4,\n"); - printf("\telement/3,\n"); - printf("\texclude/2,\n"); - printf("\tinclude/2.\n"); - - if ( flags & PL_PRINT_PENTITIES ) - { printf("\n"); - for( et=dtd->pentities; et; et=et->next ) - prolog_print_entity("parameter_entity", et); - } - - if ( flags & PL_PRINT_ENTITIES ) - { printf("\n"); - for( et=dtd->entities; et; et=et->next ) - prolog_print_entity("entity", et); - } - - if ( flags & PL_PRINT_ELEMENTS ) - { printf("\n"); - for( e=dtd->elements; e; e=e->next ) - prolog_print_element(e, flags); - } - - if ( errors ) - { fprintf(stderr, "Warning: DTD contained %d errors\n", errors); - return FALSE; - } - - return TRUE; -} - diff --git a/packages/sgml/prolog.h b/packages/sgml/prolog.h deleted file mode 100644 index 00cc852eb..000000000 --- a/packages/sgml/prolog.h +++ /dev/null @@ -1,42 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog - - Author: Jan Wielemaker - E-mail: jan@swi.psy.uva.nl - WWW: http://www.swi-prolog.org - Copyright (C): 1985-2002, University of Amsterdam - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef PROLOG_H_INCLUDED -#define PROLOG_H_INCLUDED - -#define DTD2PL_VERSION "0.1, March 2000" - -#define PL_PRINT_PENTITIES 0x001 -#define PL_PRINT_ENTITIES 0x002 -#define PL_PRINT_ELEMENTS 0x004 -#define PL_PRINT_ATTRIBUTES 0x008 - -#define PL_PRINT_ALL (PL_PRINT_PENTITIES| \ - PL_PRINT_ENTITIES| \ - PL_PRINT_ELEMENTS| \ - PL_PRINT_ATTRIBUTES) - -int prolog_print_dtd(dtd *dtd, unsigned int flags); - -#endif /*PROLOG_H_INCLUDED*/ diff --git a/packages/sgml/pwp.pl b/packages/sgml/pwp.pl deleted file mode 100644 index dae6d7ec2..000000000 --- a/packages/sgml/pwp.pl +++ /dev/null @@ -1,638 +0,0 @@ -:- module(pwp, - [ pwp_files/2, % +FileIn, +FileOut - pwp_stream/3, % +StreamIn, +StreamOut, +Context - pwp_xml/3 % +DomIn, -DOMOut, +Context - ]). - -/** <module> Prolog Well-formed Pages - -PWP is an approach to server-side scripting using Prolog -which is based on a simple key principle: - - - The source form of a PWP should be WELL-FORMED XML - -Especially when generating XML rather than HTML, this is such an -obvious thing to do. We have many kinds of XML checking tools. - - - We can tell whether an XML document is WELL FORMED (all the - punctuation is right, all tags balance) using practically - any decent parser, including SWI Prolog's 'sgml'. - - - If we can write a Document Type Description then we can check - that a document is VALID using tools like Open SP (formerly - James Clark's SP) or SWI Prolog's 'sgml'. This does not - guarantee that the output will be valid, but it does catch - a lot of errors very early. - - - If we can write an XML Schema then we can check that a - document is schema-valid. (SWI Prolog's 'sgml' does not - yet come with a schema validator, but who knows what the - future holds?). - - - Since an XML document is just a data structure, we can use - any checking tool that we can write in Prolog, IF the input - is well-formed so that we can load a template as a Prolog - data structure. - -Having decided that the input should be well formed, that means -*|NO NEW SYNTAX|* - -None of the weird and horrible <% ... %> or whatever not-quite-XML -stuff you see in other template systems, making checking so very hard -(and therefore, making errors so distressingly common). - -That in turns means that PWP "markup" must be based on special -elements or special attributes. The fact that an XML parser must -allow undeclared attributes on any element even when validating, -but must not allow undeclared elements, suggests doing this through -attributes. In particular, one should be able to take an existing -DTD, such as an XHTML DTD, and just use that without modification. -So the design reduces to - - - Allow dynamic data selection, insertion, and transformation - just using a small number of extra attributes. - -This description uses the following name space: - - == - xmlns:pwp='http://www.cs.otago.ac.nz/staffpriv/ok/pwp.pl' - == - -The attributes are - - - pwp:ask = Query - - pwp:use = Term - - pwp:how = text | xml - - pwp:tag = QName or '-' - - pwp:att = '' | 'one non-alphanumeric character' - -Here's what they mean. Each element is expanded in the context -of a set of variable bindings. After expansion, if the tag is -not mapped to '-', all attributes in the pwp: namespace are removed -and the children elements are recursively expanded. - - * pwp:ask = Query - - * Query is a Prolog goal. For each solution of Query, the element - is further processed with the new variables of Query added to - the context. - - * If Query is not a well formed Prolog goal, or if execution of - Query throws an exception, page transformation comes to a complete - halt and no page is generated. - - * pwp:use = Term - * pwp:how = text | xml | text-file | xml-file - - Term is a Prolog term; variables in Term are bound by the context. - An empty Term is regarded as a missing value for this attribute. - The Prolog variable CONTEXT refers to the entire context, a list - of Name = Value, where Name is a Prolog atom holding the name of the context variable and Value is an arbitrary Prolog term. - - - If pwp:how is text, - The value of Term is used to define a sequence of characters. - - - A number produces the same characters that write/1 would. - - An atom produces the same characters that write/1 would. - - A string produces the same characters that write/1 would. - - A list of character codes produces those characters. - - - The following terms produce the same sequence of characters - that the corresponding goal would have sent to the current - output stream: - - - write(Datum) - - writeq(Datum) - - write_canonical(Datum) - - print(Datum) - - print(Datum) - - format(Format) - - format(Format, Arguments) - - - A singleton list [X] defines the characters that X defines. - - Any other term F(T1,...,Tn) defines the characters that T1 - defines, followed by the characters that T2 defines, ..., - followed by the characters that Tn defines. - - - If pwp:how is xml, - The value of Term must be an XML term as defined in the - SGML2PL documentation or a list of such terms. A single - term is taken as if it had been [Term]. The resulting - list of terms replaces the children of the current element - and will not be further processed. - - - If pwp:how is text-file, - The value of Term is used to define a sequence of characters. - That sequence of characters is used as a file name. - The file is read as a sequence of characters, and that - sequence used as character data. - - - If pwp:how is xml-file, - The value of Term is used to define a sequence of characters. - That sequence of characters is used as a file name. - The file is loaded as XML, and the sequence of XML items thus - obtained used. This means that PWP provides XML inclusion - without depending on the parser to support XInclude. - - The default value for pwp:how is text. - - * pwp:tag = QName or '-' - - If pwp:tag is missing or the value is empty, the current element - appears in the output (after further processing) with its present - tag. If pwp:tag is a QName, the current element appears (...) - with that as its tag. That option is most useful in DTDs, where - an "authoring" DTD may use one tag and have it automatically mapped - to another tag in the output, e.g., <item> -> <li>. Finally, if - pwp:tag is '-', the children of the current element (either the - result of pwp:use or the transformed original children, whichever - applies) appear in the output but there is no element around them. - - A missing or empty pwp:ask is just like pwp:ask = 'true'. - - * pwp:att = '' | 'one non-alphanumeric character'. - - Attributes in the pwp namespace are not affected by this attribute. - Such attributes are always stripped out and never substituted into. - - If pwp:att is missing or empty, attributes of the current - element are copied over to the output unchanged. - - If pwp:att = 'c' for some non-alphanumeric character c, - each attribute is examined for occurrences of c(...)c which - are as short as possible. - There is no one character which could be used every time, so you - have to explicitly choose a substitution marker which is safe - for the data you do not want to be altered. None of the pwp - attributes are inherited, least of all this one. - - Text outside c(...)c groups is copied unchanged; text inside - such a group is parsed as a Prolog term and treated as if by - pwp:how = text. - - -Examples: - - 1. *|A "Hello World" like example|* - - == - <html - xmlns:pwp="http://www.cs.otago.ac.nz/staffpriv/ok/pwp.pl" - pwp:ask = "ensure_loaded(msg), once(msg(Greeting))"> - <head> - <title pwp:use="Greeting"/> - </head> - <body> - <p><span pwp:use="Greeting" pwp:tag='-'/></p> - </body> - </html> - == - - where msg.pl contains - - == - msg('Hello, World!'). - == - - This example illustrates an important point. Prolog Well-Formed - Pages provide *NO* way to physically incorporate Prolog *clauses* - into a page template. Prolog clauses must be put in separate - files which can be checked by a Prolog syntax checker, compiler, - cross-referencer, &c WITHOUT the Prolog tool in question needing - to know anything whatsoever about PWP. You load the files using - pwp:ask on the root element. - - 2. *|Binding some variables and using them|* - - == - <html - xmlns:pwp="http://www.cs.otago.ac.nz/staffpriv/ok/pwp.pl"> - <head><title>Example 2</title></head> - <body pwp:ask="Hello = 'Hello world', A = 20, B = 22"> - <h1 pwp:use="Hello"/> - <p>The answer is <span pwp:use="C" pwp:ask="C is A+B"/>.</p> - </body> - </html> - == - - 3. *|Making a table|* - We are given a Prolog database staff.pl defining - staff(NickName, FullName, Office, Phone, E_Mail_Address). - status(NickName, full_time | part_time). - We want to make a phone list of full time staff. - - == - <html - xmlns:pwp="http://www.cs.otago.ac.nz/staffpriv/ok/pwp.pl" - pwp:ask='ensure_loaded(staff)'> - <head> - <title>Phone list for Full-Time staff.</title> - </head> - <body> - <h1>Phone list for Full-Time staff.</h1> - <table - pwp:ask = "setof(FullName-Phone, - N^O^E^( - status(N, full_time), - staff(N, FullName, O, Phone, E) - ), - Staff_List)"> - <tr><th>Name</th><th>Phone</th></tr> - <tr pwp:ask="member(FullName-Phone, Staff_List)"> - <td pwp:use="FullName"/> - <td pwp:use="Phone"/> - </tr> - </table> - </body> - </html> - == - - 4. *|Substituting into an attribute|* - Same data base as before, but now we want to make a mailing list - page. - - == - <html - xmlns:pwp="http://www.cs.otago.ac.nz/staffpriv/ok/pwp.pl" - pwp:ask='ensure_loaded(staff)'> - <head> - <title>Phone list for Full-Time staff.</title> - </head> - <body> - <h1>Phone list for Full-Time staff.</h1> - <table - pwp:ask = "setof(FullName-E_Mail, - N^O^P^staff(N, FullName, O, P, E_Mail), - Staff_List)"> - <tr><th>Name</th><th>Address</th></tr> - <tr pwp:ask="member(FullName-E_Mail, Staff_List)"> - <td pwp:use="FullName"/> - <td><a pwp:use="E_Mail" - pwp:att='$' href="mailto:$(E_Mail)$"/></td> - </tr> - </table> - </body> - </html> - == - - 5. *|If-then-else effect|* - A page that displays the value of the 'SHELL' environment - variable if it has one, otherwise displays 'There is no - default shell.' - - == - <html - xmlns:pwp="http://www.cs.otago.ac.nz/staffpriv/ok/pwp.pl"> - <head><title>$SHELL</title></head> - <body> - <p pwp:ask="getenv('SHELL', Shell)" - >The default shell is <span pwp:tag="-" pwp:use="Shell"/>.</p> - <p pwp:ask="\+getenv('SHELL',_)">There is no default shell.</p> - </body> - </html> - == - - There is one other criterion for a good server-side template - language: - - It should be possible to compile templates so as to eliminate - most if not all interpretation overhead. - - This particular notation satisfies that criterion with the - limitation that the conversion of a term to character data requires - run-time traversal of terms (because the terms are not known until - run time). - -@author Richard O'Keefe -@tbd Support compilation of PWP input files -*/ - -:- use_module(library(sgml), [load_xml_file/2]). -:- use_module(library(sgml_write), [xml_write/3]). -:- use_module(library(lists), [append/3]). - -:- meta_predicate - pwp_files(:, +), - pwp_stream(:, +, +), - pwp_xml(:, -, +). - - -%% pwp_files(:In:atom, +Out:atom) is det. -% -% loads an Xml document from the file named In, -% transforms it using the PWP attributes, and -% writes the transformed version to the new file named Out. - -pwp_files(M:In, Out) :- - load_xml_file(In, Contents), - pwp_xml(M:Contents, Transformed, []), !, - setup_call_cleanup(open(Out, write, Output), - xml_write(Output, Transformed, []), - close(Output)). - - -%% pwp_stream(:Input:input_stream, +Output:output_stream, -%% +Context:list) is det. -% -% Loads an Xml document from the given Input stream, transforms it -% using the PWP attributes, and writes the transformed version to -% the given Output stream. Context provides initial contextual -% variables and is a list of Name=Value. - -pwp_stream(M:Input, Output, Context) :- - load_xml_file(stream(Input), Contents), - pwp_xml(M:Contents, Transformed, Context), !, - xml_write(Output, Transformed, []). - - -/* Recall that an XML term is one of - - <atom> Character Data - sdata(...) SDATA (SGML only) - ndata(...) NDATA - pi(...) Processing instruction - - element(Name, [Att...], [Child...]) - - where Att is Attribute=Value and Child is an XML term. - - We are only concerned with elements; all other XML terms are - left alone. I have given some thought to recognising - - <?pwp ...Command...?> - - processing instructions, executing the Command, and removing - the processing instructions, as a debugging tool. But this - is a proof-of-concept implementation; debugging features can - wait for The Real Thing. -*/ - - - -%% pwp_xml(:In:list(xml), -Out:list(xml), +Context) -% -% maps down a list of XML items, acting specially on elements and -% copying everything else unchanged, including white space. -% The Context is a list of 'VariableName'=CurrentValue bindings. - -pwp_xml(M:In, Out, Context) :- - pwp_list(In, Out, M, Context). - -pwp_list([], [], _, _). -pwp_list([element(Tag0,Atts0,Kids0)|Xs], Ys0, M, Context) :- !, - pwp_attributes(Atts0, Ask, Use, How, Att, Tag1, Atts1), - ( nonvar(Tag1), Tag1 \== '' -> Tag2 = Tag1 - ; Tag2 = Tag0 - ), - ( nonvar(Ask), Ask \== '', Ask \== 'true' - -> atom_to_term(Ask, Query, Bindings), - pwp_unite(Bindings, Context, Context1), - findall(Xml, - ( M:Query, - pwp_element(Tag2, Atts1, Kids0, Use, How, Att, - M, Context1, Xml)), - NewContent) - ; /* Ask is missing, empty, or true */ - pwp_element(Tag2, Atts1, Kids0, Use, How, Att, - M, Context, NewContent) - ), - pwp_attach(NewContent, Ys0, Ys1), - pwp_list(Xs, Ys1, M, Context). -pwp_list([X|Xs], [X|Ys], M, Context) :- - pwp_list(Xs, Ys, M, Context). - - -%% pwp_attributes(+Atts0:list(=(atom,atom)), -%% -Ask:atom, -Use:atom, -How:atom, -Att:atom, -%% -Tag:atom, -Atts1:list(=(atom,atom))) -% -% Walks down a list of AttributeName=ItsValue pairs, stripping out -% those whose AttributeName begins with the 'pwp:' prefix, and -% copying the rest to Atts1. Along the way, Ask/Use/How/Att/Tag -% are bound to the values of the -% pwp:ask/pwp:use/pwp:how/pwp:att/pwp:tag attributes, if any. At -% the end, any of these variables that are still unbound REMAIN -% unbound; they are not bound to default values. - -pwp_attributes([], _, _, _, _, _, []). -pwp_attributes([AV|AVs], Ask, Use, How, Att, Tag, New_Atts1) :- - AV = (Name=Value), - ( pwp_attr(Name, PWPName) - -> ( pwp_attr(PWPName, Value, Ask, Use, How, Att, Tag) - -> New_Atts1 = New_Atts2 - ; New_Atts1 = New_Atts2 - ) - ; New_Atts1 = [AV|New_Atts2] - ), - pwp_attributes(AVs, Ask, Use, How, Att, Tag, New_Atts2). - - -pwp_attr(ask, Value, Value, _Use, _How, _Att, _Tag). -pwp_attr(use, Value, _Ask, Value, _How, _Att, _Tag). -pwp_attr(how, Value, _Ask, _Use, Value, _Att, _Tag). -pwp_attr(att, Value, _Ask, _Use, _How, Value, _Tag). -pwp_attr(tag, Value, _Ask, _Use, _How, _Att, Value). - -%% pwp_attr(+XMLAttr, -PWPLocal) is semidet. -% -% True if PWPLocal is the local name of a pwp:Local expression in -% XML. This predicate deals with the three different XML -% representations: the form is returned of XML namespace -% processing is not enabled. The second if it is enabled and the -% namespace is properly defined and the last if the namespace is -% not defined. - -pwp_attr(Atom, PWP) :- - atom(Atom), - atom_concat('pwp:', PWP, Atom), !. -pwp_attr('http://www.cs.otago.ac.nz/staffpriv/ok/pwp.pl':PWP, PWP) :- !. -pwp_attr('pwp':PWP, PWP) :- !. -pwp_attr('xmlns:pwp', -). - -%% pwp_unite(+Bindings, +Context0, -Context:list(=(atom,any))) -% -% merges the new Bindings with the bindings in the outer Context0, -% constructing a new list of VariableName=CurrentValue bindings in -% Context1. This is only used when the CurrentValue parts of the -% new Bindings are known to be distinct new variables, so the -% Bindings cannot possibly conflict with any existing binding in -% Context0. This is O(|Bindings|.|Context0|), which is not that -% efficient, but since we do not expect there to be very many -% variables it doesn't matter much. - -pwp_unite(Bindings, Context0, Context) :- - pwp_unite(Bindings, Context0, Context0, Context). - - -pwp_unite([], _, Context, Context). -pwp_unite([Binding|Bindings], Context0, Context1, Context) :- - memberchk(Binding, Context0), !, - pwp_unite(Bindings, Context0, Context1, Context). -pwp_unite(['CONTEXT'=Context0|Bindings], Context0, Context1, Context) :- !, - pwp_unite(Bindings, Context0, Context1, Context). -pwp_unite([Binding|Bindings], Context0, Context1, Context) :- - pwp_unite(Bindings, Context0, [Binding|Context1], Context). - - - -%% pwp_unite(+Bindings, +Context0: list(=(atom,any))) -% -% looks up the bindings in Bindings in the outer Context0. -% This is only used for 'pwp:use' terms (and the related terms -% in $(...)$ attribute value substitutions), so that we have -% no interest in forming a new context. (If we did, we'd use -% pwp_unite/3 instead.) This is only used when the CurrentValue -% parts of the new Bindings are known to be distinct new variables, -% so the Bindings cannot possibly conflict with any existing -% binding in Context0. However, there _could_ be new variables -% in Bindings, and that would cause problems. An XML term may -% not contain variables, and a term we want to convert to a list -% of character codes had better not contain variables either. -% One approach would be to just bind such variables to something, -% another is to throw some kind of exception. For the moment we -% call functor/3 so as to get an instantiation error. - -pwp_unite([], _). -pwp_unite([Binding|Bindings], Context) :- - memberchk(Binding, Context), !, - pwp_unite(Bindings, Context). -pwp_unite([_=Value|_], _) :- - functor(Value, _, _). - -%% pwp_attach(+Tree, ?Ys0: list(xml), ?Ys: list(xml)) -% -% is a combination of "flatten" and "append". -% It unifies Ys0\Ys with the result of flattening Tree. - -pwp_attach([], Ys, Ys) :- !. -pwp_attach([X|Xs], Ys0, Ys) :- !, - pwp_attach(X, Ys0, Ys1), - pwp_attach(Xs, Ys1, Ys). -pwp_attach(X, [X|Ys], Ys). - - - -pwp_element('-', _, Kids, Use, How, _, M, Context, Xml) :- !, - pwp_use(Use, How, Kids, M, Context, Xml). -pwp_element(Tag, Atts, Kids, Use, How, Magic, M, Context, - element(Tag,Atts1,Kids1)) :- - ( nonvar(Magic) - -> pwp_substitute(Atts, Magic, Context, Atts1) - ; Atts1 = Atts - ), - pwp_use(Use, How, Kids, M, Context, Kids1). - -pwp_use('', _, Kids, M, Context, Kids1) :- !, - pwp_list(Kids, Kids1, M, Context). -pwp_use(Use, How, _, _, Context, Kids1) :- - atom_to_term(Use, Term, Bindings), - pwp_unite(Bindings, Context), - pwp_how(How, Term, Kids1). - -pwp_how('text', Term, [CData]) :- !, - pwp_use_codes(Term, Codes, []), - atom_codes(CData, Codes). -pwp_how('xml', Term, Kids1) :- - ( Term == [] -> Kids1 = Term - ; Term = [_|_] -> Kids1 = Term - ; Kids1 = [Term] - ). -pwp_how('text-file', Term, [CData]) :- - pwp_use_codes(Term, Codes, []), - atom_codes(FileName, Codes), - read_file_to_codes(FileName, FileCodes, []), - atom_codes(CData, FileCodes). -pwp_how('xml-file', Term, Kids1) :- - pwp_use_codes(Term, Codes, []), - atom_codes(FileName, Codes), - load_xml_file(FileName, Kids1). - - -pwp_substitute([], _, _, []). -pwp_substitute([AV|AVs], Magic, Context, [AV1|Atts1]) :- - AV = (Name = Value), - ( sub_atom(Value, _, _, _, Magic) - -> char_code(Magic, C), - atom_codes(Value, Codes), - pwp_split(Codes, C, B0, T0, A0), !, - pwp_substitute(B0, T0, A0, C, Context, V), - atom_codes(New_Value, V), - AV1 = (Name = New_Value), - pwp_substitute(AVs, Magic, Context, Atts1) - ). -pwp_substitute([AV|AVs], Magic, Context, [AV|Atts1]) :- - pwp_substitute(AVs, Magic, Context, Atts1). - - -pwp_substitute(B0, T0, A0, C, Context, V0) :- - append(B0, V1, V0), - atom_codes(Atom, T0), - atom_to_term(Atom, Term, Bindings), - pwp_unite(Bindings, Context, _), - pwp_use_codes(Term, V1, V2), - ( pwp_split(A0, C, B1, T1, A1) - -> pwp_substitute(B1, T1, A1, C, Context, V2) - ; V2 = A0 - ). - - -pwp_split(Codes, C, Before, Text, After) :- - append(Before, [C,0'(|Rest], Codes), - append(Text, [0'),C|After], Rest), !. - - -pwp_use_codes(format(Format), S0, S) :- !, - pwp_format(Format, [], S0, S). -pwp_use_codes(format(Format,Args), S0, S) :- !, - pwp_format(Format, Args, S0, S). -pwp_use_codes(write_canonical(Datum), S0, S) :- !, - pwp_format('~k', [Datum], S0, S). -pwp_use_codes(print(Datum), S0, S) :- !, - pwp_format('~p', [Datum], S0, S). -pwp_use_codes(writeq(Datum), S0, S) :- !, - pwp_format('~q', [Datum], S0, S). -pwp_use_codes(write(Datum), S0, S) :- !, - pwp_format('~w', [Datum], S0, S). -pwp_use_codes(Atomic, S0, S) :- - atomic(Atomic), !, - ( number(Atomic) -> number_codes(Atomic, Codes) - ; atom(Atomic) -> atom_codes(Atomic, Codes) - ; string(Atomic) -> string_to_list(Atomic, Codes) - ; pwp_format('~w', [Atomic], S0, S) - ), - append(Codes, S, S0). -pwp_use_codes([X|Xs], S0, S) :- - pwp_is_codes([X|Xs]), !, - append([X|Xs], S, S0). -pwp_use_codes([X|Xs], S0, S) :- !, - pwp_use_codes(Xs, X, S0, S). -pwp_use_codes(Compound, S0, S) :- - Compound =.. [_,X|Xs], - pwp_use_codes(Xs, X, S0, S). - - - -pwp_use_codes([], X, S0, S) :- !, - pwp_use_codes(X, S0, S). -pwp_use_codes([Y|Ys], X, S0, S) :- - pwp_use_codes(X, S0, S1), - pwp_use_codes(Ys, Y, S1, S). - - - -%% pwp_is_codes(+String: any) -% -% is true when String is a list of integers and each of those -% integers is a possible Unicode value (in the range U+0000..U+10FFFF). -% Back in the days of ISO Latin 1 we would have checked for 0..255, -% and way back in the days of ASCII for 0..127. Yes, there are more -% than a million possible characters in Unicode; currently about -% 100 000 of them are in use. - -pwp_is_codes([]). -pwp_is_codes([C|Cs]) :- - integer(C), C >= 0, C =< 0x10FFFF, - pwp_is_codes(Cs). - -pwp_format(Format, Arguments, S0, S) :- - format(codes(S0, S), Format, Arguments). diff --git a/packages/sgml/quote.c b/packages/sgml/quote.c deleted file mode 100644 index 049138c67..000000000 --- a/packages/sgml/quote.c +++ /dev/null @@ -1,479 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog - - Author: Jan Wielemaker - E-mail: wielemak@science.uva.nl - WWW: http://www.swi-prolog.org - Copyright (C): 1985-2007, University of Amsterdam - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include <SWI-Stream.h> /* encoding */ -#include <SWI-Prolog.h> -#include <stdlib.h> -#ifdef HAVE_MALLOC_H -#include <malloc.h> -#endif -#include "error.h" -#include <errno.h> -#include <string.h> -#include <stdio.h> -#include <wctype.h> -#include "xml_unicode.h" -#include "dtd.h" -#ifdef __WINDOWS__ -#define inline __inline -#endif - -static atom_t ATOM_iso_latin_1; -static atom_t ATOM_utf8; -static atom_t ATOM_unicode; -static atom_t ATOM_ascii; - -#define CHARSET 256 - -typedef struct charbuf -{ char buffer[1024]; - char *bufp; - char *end; - size_t size; -} charbuf; - - -static void -init_buf(charbuf *b) -{ b->bufp = b->end = b->buffer; - b->size = sizeof(b->buffer); -} - - -static void -free_buf(charbuf *b) -{ if ( b->bufp != b->buffer ) - free(b->bufp); -} - - -static int -room_buf(charbuf *b, size_t room) -{ size_t used = b->end - b->bufp; - - if ( room + used > b->size ) - { if ( b->bufp == b->buffer ) - { b->size = sizeof(b->buffer)*2; - if ( !(b->bufp = malloc(b->size)) ) - return sgml2pl_error(ERR_ERRNO); - - memcpy(b->bufp, b->buffer, used); - } else - { char *ptr; - - b->size *= 2; - if ( !(ptr = realloc(b->bufp, b->size)) ) - return sgml2pl_error(ERR_ERRNO); - b->bufp = ptr; - } - b->end = b->bufp + used; - } - - return TRUE; -} - - -static size_t -used_buf(const charbuf *b) -{ return b->end - b->bufp; -} - - -static int -add_char_buf(charbuf *b, int chr) -{ if ( room_buf(b, 1) ) - { *b->end++ = chr; - - return TRUE; - } - - return FALSE; -} - - -static int -add_char_bufW(charbuf *b, int chr) -{ if ( room_buf(b, sizeof(wchar_t)) ) - { wchar_t *p = (wchar_t*)b->end; - - *p++ = chr; - b->end = (char *)p; - - return TRUE; - } - - return FALSE; -} - - -static int -add_str_buf(charbuf *b, const char *s) -{ size_t len = strlen(s); - - if ( room_buf(b, len+1) ) - { memcpy(b->end, s, len+1); - b->end += len; - - return TRUE; - } - - return FALSE; -} - - -static int -add_str_bufW(charbuf *b, const char *s) -{ size_t len = strlen(s); - - if ( room_buf(b, len*sizeof(wchar_t)) ) - { wchar_t *p = (wchar_t*)b->end; - - while(*s) - *p++ = *s++; - b->end = (char *)p; - - return TRUE; - } - - return FALSE; -} - - - -static foreign_t -do_quote(term_t in, term_t quoted, char **map, int maxchr) -{ char *inA = NULL; - wchar_t *inW = NULL; - size_t len; - const unsigned char *s; - charbuf buffer; - int changes = 0; - int rc; - - if ( !PL_get_nchars(in, &len, &inA, CVT_ATOMIC) && - !PL_get_wchars(in, &len, &inW, CVT_ATOMIC) ) - return sgml2pl_error(ERR_TYPE, "atom", in); - if ( len == 0 ) - return PL_unify(in, quoted); - - init_buf(&buffer); - - if ( inA ) - { for(s = (unsigned char*)inA ; len-- > 0; s++ ) - { int c = *s; - - if ( map[c] ) - { if ( !add_str_buf(&buffer, map[c]) ) - return FALSE; - - changes++; - } else if ( c > maxchr ) - { char buf[10]; - - sprintf(buf, "&#%d;", c); - if ( !add_str_buf(&buffer, buf) ) - return FALSE; - - changes++; - } else - { add_char_buf(&buffer, c); - } - } - - if ( changes > 0 ) - rc = PL_unify_atom_nchars(quoted, used_buf(&buffer), buffer.bufp); - else - rc = PL_unify(in, quoted); - } else - { for( ; len-- > 0; inW++ ) - { int c = *inW; - - if ( c <= 0xff && map[c] ) - { if ( !add_str_bufW(&buffer, map[c]) ) - return FALSE; - - changes++; - } else if ( c > maxchr ) - { char buf[10]; - - sprintf(buf, "&#%d;", c); - if ( !add_str_bufW(&buffer, buf) ) - return FALSE; - - changes++; - }else - { add_char_bufW(&buffer, c); - } - } - - if ( changes > 0 ) - rc = PL_unify_wchars(quoted, PL_ATOM, - used_buf(&buffer)/sizeof(wchar_t), - (wchar_t*)buffer.bufp); - else - rc = PL_unify(in, quoted); - } - - free_buf(&buffer); - - return rc; -} - - -static int -get_max_chr(term_t t, int *maxchr) -{ atom_t a; - - if ( PL_get_atom(t, &a) ) - { if ( a == ATOM_iso_latin_1 ) - *maxchr = 0xff; - else if ( a == ATOM_utf8 ) - *maxchr = 0x7ffffff; - else if ( a == ATOM_unicode ) - *maxchr = 0xffff; - else if ( a == ATOM_ascii ) - *maxchr = 0x7f; - else - return sgml2pl_error(ERR_DOMAIN, "encoding", t); - - return TRUE; - } - - return sgml2pl_error(ERR_TYPE, "atom", t); -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -(*) xml_quote_attribute/3 assumes the attribute is quoted using "" and -does *not* escape '. Although escaping ' with &apos; is valid XML, it is -*not* valid html, and this routine is also used by the html_write -library. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -static foreign_t -xml_quote_attribute(term_t in, term_t out, term_t encoding) -{ static char **map; - int maxchr; - - if ( !map ) - { int i; - - if ( !(map = malloc(CHARSET*sizeof(char*))) ) - return sgml2pl_error(ERR_ERRNO, errno); - - for(i=0; i<CHARSET; i++) - map[i] = NULL; - - map['<'] = "&lt;"; - map['>'] = "&gt;"; - map['&'] = "&amp;"; -/* map['\''] = "&apos;"; See (*) */ - map['"'] = "&quot;"; - } - - if ( !get_max_chr(encoding, &maxchr) ) - return FALSE; - - return do_quote(in, out, map, maxchr); -} - - -static foreign_t -xml_quote_cdata(term_t in, term_t out, term_t encoding) -{ static char **map; - int maxchr; - - if ( !map ) - { int i; - - if ( !(map = malloc(CHARSET*sizeof(char*))) ) - return sgml2pl_error(ERR_ERRNO, errno); - - for(i=0; i<CHARSET; i++) - map[i] = NULL; - - map['<'] = "&lt;"; - map['>'] = "&gt;"; - map['&'] = "&amp;"; - } - - if ( !get_max_chr(encoding, &maxchr) ) - return FALSE; - - return do_quote(in, out, map, maxchr); -} - - -static inline int -is_xml_nmstart(dtd_charclass *map, int c) -{ if ( c <= 0xff ) - { return (map->class[c] & CH_NMSTART); - } else - { return ( xml_basechar(c) || - xml_ideographic(c) - ); - } -} - - -static inline int -is_xml_chname(dtd_charclass *map, int c) -{ if ( c <= 0xff ) - { return (map->class[c] & CH_NAME); - } else - { return ( xml_basechar(c) || - xml_digit(c) || - xml_ideographic(c) || - xml_combining_char(c) || - xml_extender(c) - ); - } -} - -static dtd_charclass *map; - -static foreign_t -xml_name(term_t in, term_t encoding) -{ char *ins; - wchar_t *inW; - size_t len; - unsigned int i; - int maxchr; - - if ( !get_max_chr(encoding, &maxchr) ) - return FALSE; - - if ( !map ) - map = new_charclass(); - - if ( PL_get_nchars(in, &len, &ins, CVT_ATOMIC) ) - { int c; - - if ( len == 0 ) - return FALSE; - - c = ins[0] & 0xff; - if ( c > maxchr ) - return FALSE; - - if ( !(map->class[c] & CH_NMSTART) ) - return FALSE; - for(i=1; i<len; i++) - { c = ins[i] & 0xff; - - if ( c > maxchr || !(map->class[c] & CH_NAME) ) - return FALSE; - } - - return TRUE; - } - if ( PL_get_wchars(in, &len, &inW, CVT_ATOMIC) ) - { if ( len == 0 ) - return FALSE; - - if ( inW[0] > maxchr || - !is_xml_nmstart(map, inW[0]) ) - return FALSE; - - for(i=1; i<len; i++) - { int c = inW[i]; - - if ( c > maxchr || - !is_xml_chname(map, c) ) - return FALSE; - } - - return TRUE; - } - - return FALSE; -} - - -static foreign_t -iri_xml_namespace(term_t iri, term_t namespace, term_t localname) -{ char *s; - pl_wchar_t *w; - size_t len; - - if ( !map ) - map = new_charclass(); - - if ( PL_get_nchars(iri, &len, &s, CVT_ATOM|CVT_STRING) ) - { const char *e = &s[len]; - const char *p = e; - - while(p>s && (map->class[p[-1]&0xff] & CH_NAME)) - p--; - while(p<e && !(map->class[p[0]&0xff] & CH_NMSTART)) - p++; - - if ( !PL_unify_atom_nchars(namespace, p-s, s) ) - return FALSE; - if ( localname && - !PL_unify_atom_nchars(localname, e-p, p) ) - return FALSE; - - return TRUE; - } else if ( PL_get_wchars(iri, &len, &w, CVT_ATOM|CVT_STRING|CVT_EXCEPTION) ) - { const pl_wchar_t *e = &w[len]; - const pl_wchar_t *p = e; - - while(p>w && is_xml_chname(map, p[-1]) ) - p--; - while(p<e && !is_xml_nmstart(map, p[0]) ) - p++; - - if ( !PL_unify_wchars(namespace, PL_ATOM, p-w, w) ) - return FALSE; - if ( localname && - !PL_unify_wchars(localname, PL_ATOM, e-p, p) ) - return FALSE; - - return TRUE; - } - - return FALSE; -} - - -static foreign_t -iri_xml_namespace2(term_t iri, term_t namespace) -{ return iri_xml_namespace(iri, namespace, 0); -} - - -install_t -install_xml_quote() -{ ATOM_iso_latin_1 = PL_new_atom("iso_latin_1"); - ATOM_utf8 = PL_new_atom("utf8"); - ATOM_unicode = PL_new_atom("unicode"); - ATOM_ascii = PL_new_atom("ascii"); - - PL_register_foreign("xml_quote_attribute", 3, xml_quote_attribute, 0); - PL_register_foreign("xml_quote_cdata", 3, xml_quote_cdata, 0); - PL_register_foreign("xml_name", 2, xml_name, 0); - PL_register_foreign("iri_xml_namespace", 3, iri_xml_namespace, 0); - PL_register_foreign("iri_xml_namespace", 2, iri_xml_namespace2, 0); -} diff --git a/packages/sgml/sgml.c b/packages/sgml/sgml.c deleted file mode 100644 index 3c4cb1c32..000000000 --- a/packages/sgml/sgml.c +++ /dev/null @@ -1,455 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog - - Author: Jan Wielemaker - E-mail: wielemak@science.uva.nl - WWW: http://www.swi-prolog.org - Copyright (C): 1985-2006, University of Amsterdam - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#define _ISOC99_SOURCE 1 /* fwprintf(), etc prototypes */ -#include <stdio.h> -#include "dtd.h" -#include "util.h" -#include <stdlib.h> -#include <string.h> -#include <assert.h> -#include <wctype.h> -#include <wchar.h> -#include <locale.h> - -#define streq(s1, s2) (strcmp(s1, s2) == 0) - -char *program; -int nerrors = 0; -int nwarnings = 0; -int style_messages = FALSE; - -static void -usage(void) -{ fprintf(stderr, - "Usage: %s [-xml] [-s] [-nodefs] [file.dtd] [file]\n\n", program); - fprintf(stderr, - "\t-xml\tForce XML mode\n" - "\t-s\tSilent: only report errors and warnings\n" - "\t-style\tWarn about correct but dubious input\n" - "\t-nodefs\tDo not include defaulted attributes\n"); - exit(EXIT_FAILURE); -} - - -static int -wputc(int c, FILE *f) -{ char buf[MB_CUR_MAX]; - int i, len = wctomb(buf, c); - - for(i=0; i<len; i++) - putc(buf[i], f); - - return c; -} - - - -static void -print_word(dtd_parser * p, char c, /* preceding character */ - ichar const *s, /* where to start */ - ichar const *e) /* where to end (at NUL if e is NULL) */ -{ FILE *f = stdout; - ichar x; - - wputc(c, f); - if (p->dtd->case_sensitive) - { if (e != 0) - while (s != e) - wputc(*s++, f); - else - while ((x = *s++) != (ichar) 0) - wputc(x, f); - } else - { if (e != 0) - while (s != e) - wputc(towupper((wint_t)*s++), f); - else - while ((x = *s++) != (ichar) 0) - wputc(towupper(x), f); - } -} - - -static void -wprint_escaped(FILE *f, const wchar_t *s, int len) -{ const wchar_t *e = &s[len]; - - while ( s < e ) - { wint_t x = *s++; - - if (x >= ' ') - { if (x == '\\') /* \ --> \\ */ - wputc(x, f); - wputc(x, f); - } else if (x == '\t') - { wputc(x, f); /* \t */ - } else if (x == '\n') - { fprintf(f, "\\n"); /* \n */ - } else - { fprintf(f, "\\%03o", x); - } - } -} - - -static void -print_cdata(char c, sgml_attribute *a) -{ wputc(c, stdout); - wprint_escaped(stdout, a->value.textW, a->value.number); - wputc('\n', stdout); -} - - -static int -print_close(dtd_parser * p, dtd_element * e) -{ print_word(p, ')', e->name->name, 0); - putchar('\n'); - - return TRUE; -} - - -typedef struct atdef -{ attrtype type; /* AT_* */ - char const *name; /* name */ - int islist; /* list-type */ -} atdef; - -static atdef attrs[] = { - {AT_CDATA, "CDATA", FALSE}, - {AT_ENTITY, "ENTITY", FALSE}, - {AT_ENTITIES, "ENTITY", TRUE}, - {AT_ID, "ID", FALSE}, - {AT_IDREF, "IDREF", FALSE}, - {AT_IDREFS, "IDREF", TRUE}, - {AT_NAME, "NAME", FALSE}, - {AT_NAMES, "NAME", TRUE}, - {AT_NMTOKEN, "NMTOKEN", FALSE}, - {AT_NMTOKENS, "NMTOKEN", TRUE}, - {AT_NUMBER, "NUMBER", FALSE}, - {AT_NUMBERS, "NUMBER", TRUE}, - {AT_NUTOKEN, "NUTOKEN", FALSE}, - {AT_NUTOKENS, "NUTOKEN", TRUE}, - {AT_NOTATION, "NOTATION", FALSE}, - - {AT_CDATA, (char *) 0, FALSE} -}; - - -static atdef * -find_attrdef(attrtype type) -{ atdef *ad; - - for (ad = attrs; ad->name != (char *) 0; ad++) - { if (ad->type == type) - return ad; - } - assert(0); - return (atdef *) 0; -} - - -static ichar * -istrblank(ichar const *s) -{ for (; *s; s++) - { if (iswspace(*s)) - return (ichar *) s; - } - return (ichar *) 0; -} - - -static int -print_open(dtd_parser * p, dtd_element * e, int argc, sgml_attribute *argv) -{ int i; - - for (i = 0; i < argc; i++) - { print_word(p, 'A', argv[i].definition->name->name, 0); - switch (argv[i].definition->type) - { case AT_CDATA: - printf(" CDATA"); - print_cdata(' ', &argv[i]); - continue; /* so we don't get two line breaks */ - case AT_NUMBER: - printf(" NUMBER "); - if (argv[i].value.textW) - print_word(p, ' ', argv[i].value.textW, 0); - else - printf("%ld", argv[i].value.number); - break; - case AT_NAMEOF: - printf(" NAME"); - print_word(p, ' ', argv[i].value.textW, 0); - break; - default: - { atdef *ad = find_attrdef(argv[i].definition->type); - ichar const *val = argv[i].value.textW; - - printf(" %s", ad->name); - if (ad->islist) - { ichar const *n; - - while ((n = istrblank(val)) != 0) - { if (n != val) - print_word(p, ' ', val, n); - val = n + 1; - } - } - print_word(p, ' ', val, 0); - } - break; - } - putchar('\n'); - } - print_word(p, '(', e->name->name, 0); - putchar('\n'); - return TRUE; -} - - -static int -print_data(dtd_parser * p, data_type type, int len, const wchar_t *data) -{ char c; - - switch (type) - { case EC_CDATA: - c = '-'; - break; - case EC_NDATA: - c = 'N'; - break; - case EC_SDATA: - c = 'S'; - break; - default: - assert(0); - } - wputc(c, stdout); - wprint_escaped(stdout, data, len); - wputc('\n', stdout); - return TRUE; -} - - -static int -on_entity(dtd_parser *p, dtd_entity *e, int chr) -{ if (e == 0) - printf("&#%d;\n", chr); - else - wprintf(L"&%s;\n", e->name->name); - return TRUE; -} - - -static int -on_pi(dtd_parser *p, ichar const *pi) -{ wputc('?', stdout); - wprint_escaped(stdout, pi, wcslen(pi)); - return TRUE; -} - - -static dtd_srcloc * -file_location(dtd_srcloc *l) -{ while (l->parent && l->type != IN_FILE) - l = l->parent; - return l; -} - -static int -on_error(dtd_parser * p, dtd_error * error) -{ char const *severity; - char const *dialect; - dtd_srcloc *l = file_location(error->location); - - switch (p->dtd->dialect) - { case DL_SGML: - dialect = "sgml"; - break; - case DL_XML: - dialect = "xml"; - break; - case DL_XMLNS: - default: /* make compiler happy */ - dialect = "xmlns"; - break; - } - - switch (error->severity) - { case ERS_STYLE: - severity = "Style"; - if ( !style_messages ) - return TRUE; - break; - case ERS_WARNING: - severity = "Warning"; - nwarnings++; - break; - case ERS_ERROR: - default: /* make compiler happy */ - severity = "Error"; - nerrors++; - break; - } - - if ( l->name.file ) - { fwprintf(stderr, L"%s: (%s mode) %s: %ls:%d:%d %ls\n", - program, dialect, severity, - l->name.entity, l->line, l->linepos, - error->plain_message); - } else - { fwprintf(stderr, L"%s: (%s mode) %s: %d:%d %ls\n", - program, dialect, severity, - error->plain_message); - } - - return TRUE; -} - - -static void -set_functions(dtd_parser * p, int output) -{ if (output) - { p->on_end_element = print_close; - p->on_begin_element = print_open; - p->on_data = print_data; - p->on_entity = on_entity; - p->on_pi = on_pi; - } - p->on_error = on_error; -} - - -static wchar_t * -mb2wc(const char *s) -{ int wl = mbstowcs(NULL, s, 0); - - if ( wl > 0 ) - { wchar_t *ws = malloc((wl+1)*sizeof(wchar_t)); - mbstowcs(ws, s, wl+1); - - return ws; - } - - perror("mbstowcs"); - exit(1); -} - - -#define shift (argc--, argv++) - -#define strcaseeq(x, y) istrcaseeq((ichar const *)(x), (ichar const *)(y)) - -static ichar const *no_dtd = (ichar const *) NULL; - -int -main(int argc, char **argv) -{ dtd_parser *p = NULL; - char *s; - int xml = FALSE; - int output = TRUE; - int nodefs = FALSE; /* include defaulted attributes */ - - setlocale(LC_CTYPE, ""); - - s = strchr(argv[0], '/'); - program = s == NULL ? argv[0] : s + 1; - if (streq(program, "xml")) - xml = TRUE; - - shift; - - while (argc > 0 && argv[0][0] == '-') - { if (streq(argv[0], "-xml")) - { xml = TRUE; - } else if (streq(argv[0], "-s")) - { output = FALSE; - } else if (streq(argv[0], "-nodefs")) - { nodefs = TRUE; - } else if (streq(argv[0], "-style")) - { style_messages = TRUE; - } else - { usage(); - } - shift; - } - - if (argc > 0) - { char *slash = strchr(argv[0], '/'); - char *dot = strchr(argv[0], '.'); - char *ext = dot == 0 || (slash != 0 && slash > dot) ? "." : dot; - - if (strcaseeq(ext, ".dtd")) - { char doctype[256]; - - strncpy(doctype, argv[0], ext - argv[0]); - doctype[ext - argv[0]] = '\0'; - - p = new_dtd_parser(new_dtd(mb2wc(doctype))); - load_dtd_from_file(p, mb2wc(argv[0])); - shift; - } else if (strcaseeq(ext, ".html") || strcaseeq(ext, ".htm")) - { p = new_dtd_parser(new_dtd((ichar const *) "html")); - load_dtd_from_file(p, L"html.dtd"); - } else if (xml || strcaseeq(ext, ".xml")) - { dtd *dtd = new_dtd(no_dtd); - - set_dialect_dtd(dtd, DL_XML); - p = new_dtd_parser(dtd); - } else - { p = new_dtd_parser(new_dtd(no_dtd)); - } - } else - { p = new_dtd_parser(new_dtd(no_dtd)); - } - - if (nodefs) - p->flags |= SGML_PARSER_NODEFS; - - switch (argc) - { case 1: - { set_functions(p, output); - sgml_process_file(p, mb2wc(argv[0]), 0); - free_dtd_parser(p); - if (output && nerrors == 0) - printf("C\n"); - return 0; - } - case 0: - { set_functions(p, output); - set_file_dtd_parser(p, IN_FILE, L"stdin"); - set_mode_dtd_parser(p, DM_DATA); - sgml_process_stream(p, stdin, 0); - free_dtd_parser(p); - if (output && nerrors == 0 && nwarnings == 0) - printf("C\n"); - return 0; - } - default: - { usage(); - return EXIT_FAILURE; - } - } -} diff --git a/packages/sgml/sgml.doc b/packages/sgml/sgml.doc deleted file mode 100644 index bc12f8b5b..000000000 --- a/packages/sgml/sgml.doc +++ /dev/null @@ -1,1376 +0,0 @@ -\documentclass[11pt]{article} -\usepackage{times} -\usepackage{pl} -\usepackage{html} -\sloppy -\makeindex - -\onefile -\htmloutput{html} % Output directory -\htmlmainfile{index} % Main document file -\bodycolor{white} % Page colour - -\begin{document} - -\title{SWI-Prolog SGML/XML parser} -\author{Jan Wielemaker \\ - HCS, \\ - University of Amsterdam \\ - The Netherlands \\ - E-mail: \email{J.Wielemaker@uva.nl}} - -\maketitle - -\begin{abstract} -Markup languages are an increasingly important method for -data-representation and exchange. This article documents the package -\pllib{sgml}, a foreign library for SWI-Prolog to parse SGML -and XML documents, returning information on both the document and the -document's DTD. The parser is designed to be small, fast and flexible. -\end{abstract} - -\pagebreak -\tableofcontents - -\vfill -\vfill - -\newpage - -\section{Introduction} - -Markup languages have recently regained popularity for two reasons. One -is document exchange, which is largely based on HTML, an instance of -SGML, and the other is for data exchange between programs, which is -often based on XML, which can be considered a simplified and -rationalised version of SGML. - -James Clark's SP parser is a flexible SGML and XML parser. Unfortunately -it has some drawbacks. It is very big, not very fast, cannot work under -event-driven input and is generally hard to program beyond the scope of -the well designed generic interface. The generic interface however does -not provide access to the DTD, does not allow for flexible handling of -input or parsing the DTD independently of a document instance. - -The parser described in this document is small (less than 100 kBytes -executable on a Pentium), fast (between 2 and 5 times faster than SP), -provides access to the DTD, and provides flexible input handling. - -The document output is equal to the output produced by \jargon{xml2pl}, -an SP interface to SWI-Prolog written by Anjo Anjewierden. - - -\section{Bluffer's Guide} - -This package allows you to parse SGML, XML and HTML data into a Prolog -data structure. The high-level interface defined in \pllib{sgml} -provides access at the file-level, while the low-level interface defined -in the foreign module works with Prolog streams. Please use the source -of \file{sgml.pl} as a starting point for dealing with data from -other sources than files, such as SWI-Prolog resources, network-sockets, -character strings, \emph{etc.} The first example below loads an HTML file. - -\begin{code} -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> - -<html> -<head> -<title>Demo</title> -</head> -<body> - -<h1 align=center>This is a demo</title> - -Paragraphs in HTML need not be closed. - -This is called `omitted-tag' handling. -</body> -</html> -\end{code} - -\begin{code} -?- load_html_file('test.html', Term), - pretty_print(Term). - -[ element(html, - [], - [ element(head, - [], - [ element(title, - [], - [ 'Demo' - ]) - ]), - element(body, - [], - [ '\n', - element(h1, - [ align = center - ], - [ 'This is a demo' - ]), - '\n\n', - element(p, - [], - [ 'Paragraphs in HTML need not be closed.\n' - ]), - element(p, - [], - [ 'This is called `omitted-tag\' handling.' - ]) - ]) - ]) -]. -\end{code} - -The document is represented as a list, each element being an atom to -represent \const{CDATA} or a term \term{element}{Name, Attributes, Content}. -Entities (e.g. \verb$&lt;$) are expanded and included in the -atom representing the element content or attribute value.% - \footnote{Up to SWI-Prolog 5.4.x, Prolog could not represent - \jargon{wide} characters and entities that did not fit in - the Prolog characters set were emitted as a term - \term{number}{+Code}. With the introduction of wide - characters in the 5.5 branch this is no longer needed.} - - -\subsection{`Goodies' Predicates} - -These predicates are for basic use of the library, converting entire and -self-contained files in SGML, HTML, or XML into a structured term. They -are based on load_structure/3. - -\begin{description} - \predicate{load_sgml_file}{2}{+Source, -ListOfContent} -Same as \term{load_structure}{Source, ListOfContent, [dialect(sgml)]}. - - \predicate{load_xml_file}{2}{+Source, -ListOfContent} -Same as \term{load_structure(Source, ListOfContent, [dialect(xml)]}. - - \predicate{load_html_file}{2}{+Source, -Content} -Load \arg{Source} and parse as HTML. \arg{Source} is either the -name of a file or term \term{stream}{Handle}. Implemented as -below. Note that load_html_file/2 re-uses a cached DTD object as defined -by dtd/2. As DTD objects may be corrupted while loading errornous -documents sharing is undesirable if the documents are not known to be -correct. See dtd/2 for details. - -\begin{code} -load_html_file(Source, Term) :- - dtd(html, DTD), - load_structure(Source, Term, - [ dtd(DTD), - dialect(sgml), - shorttag(false) - ]). -\end{code} -\end{description} - - -\section{Predicate Reference} - -\subsection{Loading Structured Documents} - -SGML or XML files are loaded through the common predicate -load_structure/3. This is a predicate with many options. For -simplicity a number of commonly used shorthands are provided: -load_sgml_file/2, load_xml_file/2, and -load_html_file/2. - -\begin{description} - \predicate{load_structure}{3}{+Source, -ListOfContent, +Options} -Parse \arg{Source} and return the resulting structure in -\arg{ListOfContent}. \arg{Source} is either a term of the format -\term{stream}{StreamHandle} or a file-name. \arg{Options} is a list of -options controlling the conversion process. - -A proper XML document contains only a single toplevel element whose name -matches the document type. Nevertheless, a list is returned for -consistency with the representation of element content. The <aref/ -ListOfContent/ consists of the following types: - -\begin{description} - \termitem{\arg{Atom}}{} -Atoms are used to represent \const{CDATA}. Note -this is possible in SWI-Prolog, as there is no length-limit on atoms and -atom garbage collection is provided. - - \termitem{element}{Name, ListAttributes, ListOfContent} -\arg{Name} is the name of the element. Using SGML, which is -case-insensitive, all element names are returned as lowercase atoms. - -\arg{ListOfAttributes} is a list of \arg{Name}=\arg{Value} pairs for -attributes. Attributes of type \const{CDATA} are returned literal. Multi-valued -attributes (\const{NAMES}, \emph{etc.}) are returned as a list of atoms. -Handling attributes of the types \const{NUMBER} and \const{NUMBERS} depends on -the setting of the \term{number}{+NumberMode} attribute through -set_sgml_parser/2 or load_structure/3. By -default they are returned as atoms, but automatic conversion to Prolog -integers is supported. \arg{ListOfContent} defines the content for the -element. - - \termitem{sdata}{Text} -If an entity with declared content-type \const{SDATA} is encountered, this -term is returned holding the data in \arg{Text}. - - \termitem{ndata}{Text} -If an entity with declared content-type \const{NDATA} is encountered, this -term is returned holding the data in \arg{Text}. - \termitem{pi}{Text} -If a processing instruction is encountered (\verb$<?...?>$), <aref/ -Text/ holds the text of the processing instruction. Please note that the -\verb$<?xml ...?>$ instruction is handled internally. -\end{description} - - -The \arg{Options} list controls the conversion process. Currently -defined options are: - -\begin{description} - \termitem{dtd}{?DTD} -Reference to a DTD object. If specified, the \verb$<!DOCTYPE ...>$ -declaration is ignored and the document is parsed and validated against -the provided DTD. If provided as a variable, the created DTD is -returned. See \secref{implicitdtd}. - - \termitem{dialect}{+Dialect} -Specify the parsing dialect. Supported are \const{sgml} (default), \const{xml} -and \const{xmlns}. See \secref{xml} for details on the differences. - - \termitem{shorttag}{+Bool} -Define whether SHORTTAG abbreviation is accepted. The default is true -for SGML mode and false for the XML modes. Without SHORTTAG, a <c>/</c> -is accepted with warning as part of an unquoted attribute-value, though -<c>/></c> still closes the element-tag in XML mode. It may be set to -false for parsing HTML documents to allow for unquoted URLs containing -<c>/</c>. - - \termitem{space}{+SpaceMode} -Sets the `space-handling-mode' for the initial environment. This mode is -inherited by the other environments, which can override the inherited -value using the XML reserved attribute <elem/xml:space/. See \secref{space}. - - \termitem{number}{+NumberMode} -Determines how attributes of type \const{NUMBER} and \const{NUMBERS} are -handled. If \const{token} (default) they are passed as an atom. If -\const{integer} the parser attempts to convert the value to an integer. -If successful, the attribute is passed as a Prolog integer. Otherwise it -is still passed as an atom. Note that SGML defines a numeric attribute -to be a sequence of digits. The \const{-} sign is not allowed and -\exam{1} is different from \exam{01}. For this reason the default is to -handle numeric attributes as tokens. If conversion to integer is -enabled, negative values are silently accepted. - - \termitem{defaults}{+Bool} -Determines how default and fixed values from the DTD are used. By -default, defaults are included in the output if they do not appear in -the source. If \const{false}, only the attributes occurring in the source -are emitted. - - \termitem{entity}{+Name, +Value} -Defines (overwrites) an entity definition. At the moment, only -\const{CDATA} entities can be specified with this construct. Multiple -entity options are allowed. - - \termitem{file}{+Name} -Sets the name of the file on which errors are reported. Sets the -linenumber to 1. - - \termitem{line}{+Line} -Sets the starting line-number for reporting errors. - - \termitem{max_errors}{+Max} -Sets the maximum number of errors. If this number is reached, an -exception of the format below is raised. The default is 50. Using -\term{max_errors}{-1} makes the parser continue, no matter how many -errors it encounters. - - \begin{quote} - \term{error}{limit_exceeded(max_errors, Max), _} - \end{quote} -\end{description} -\end{description} - -\subsection{Handling white-space} \label{sec:space} - -SGML2PL has four modes for handling white-space. The initial mode can be -switched using the \term{space}{SpaceMode} option to -load_structure/3 and set_sgml_parser/2. In XML -mode, the mode is further controlled by the <elem/xml:space/ attribute, -which may be specified both in the DTD and in the document. The defined -modes are: - -\begin{description} - \termitem{space}{sgml} -In SGML, newlines at the start and end of an element are removed.<fn>In -addition, newlines at the end of lines containing only markup should be -deleted. This is not yet implemented.</fn> This is the default mode for -the SGML dialect. - - \termitem{space}{preserve} -White space is passed literally to the application. This mode leaves all -white space handling to the application. This is the default mode for -the XML dialect. - - \termitem{space}{default} -In addition to \const{sgml} space-mode, all consequtive white-space is -reduced to a single space-character. This mode canonises all white -space. - - \termitem{space}{remove} -In addition to \const{default}, all leading and trailing white-space is -removed from \const{CDATA} objects. If, as a result, the \const{CDATA} -becomes empty, nothing is passed to the application. This mode is -especially handy for processing `data-oriented' documents, such as RDF. -It is not suitable for normal text documents. Consider the HTML -fragment below. When processed in this mode, the spaces between the -three modified words are lost. This mode is not part of any standard; -XML 1.0 allows only \const{default} and \const{preserve}. - -\begin{code} -Consider adjacent <b>bold</b> <ul>and</ul> <it>italic</it> words. -\end{code} -\end{description} - -\subsection{XML documents} \label{sec:xml} - -The parser can operate in two modes: \const{sgml} mode and \const{xml} mode, as -defined by the \term{dialect}{Dialect} option. Regardless of this -option, if the first line of the document reads as below, the parser is -switched automatically into XML mode. - -\begin{code} -<?xml ... ?> -\end{code} - -Currently switching to XML mode implies: - -\begin{itemlist} - \item [XML empty elements] -The construct \verb$<element [attribute...] />$ is recognised as -an empty element. - - \item [Predefined entities] -The following entitities are predefined: \const{lt} (\verb$<$), \const{gt} -(\verb$>$), \const{amp} (\verb$&$), \const{apos} (\verb$'$) -and \const{quot} (\verb$"$). - - \item [Case sensitivity] -In XML mode, names are treated case-sensitive, except for the DTD -reserved names (i.e. \exam{ELEMENT}, \emph{etc.}). - - \item [Character classes] -In XML mode, underscores (\verb$_$) and colon (\verb$:$) are -allowed in names. - - \item [White-space handling] -White space mode is set to \const{preserve}. In addition to setting -white-space handling at the toplevel the XML reserved attribute -<elem/xml:space/ is honoured. It may appear both in the document and the -DTD. The \const{remove} extension is honoured as <elem/xml:space/ value. For -example, the DTD statement below ensures that the <elem/pre/ element -preserves space, regardless of the default processing mode. - -\begin{code} -<!ATTLIST pre xml:space nmtoken #fixed preserve> -\end{code} -\end{itemlist} - - -\subsubsection{XML Namespaces} \label{sec:xmlns} - -Using the \jargon{dialect} \const{xmlns}, the parser will interpret XML -namespaces. In this case, the names of elements are returned as a term -of the format - -\begin{quote} -\arg{URL}\const{:}\arg{LocalName} -\end{quote} - -If an identifier has no namespace and there is no default namespace it -is returned as a simple atom. If an identifier has a namespace but this -namespace is undeclared, the namespace name rather than the related URL -is returned. - -Attributes declaring namespaces ({\tt xmlns:<ns>=<url>}) are reported -as if \const{xmlns} were not a defined resource. - -In many cases, getting attribute-names as \arg{url}:\arg{name} -is not desirable. Such terms are hard to unify and sometimes multiple -URLs may be mapped to the same identifier. This may happen due to poor -version management, poor standardisation or because the the application -doesn't care too much about versions. This package defines two -call-backs that can be set using set_sgml_parser/2 to deal -with this problem. - -The call-back \const{xmlns} is called as XML namespaces are noticed. -It can be used to extend a canonical mapping for later use -by the \const{urlns} call-back. The following illustrates this behaviour. -Any namespace containing \const{rdf-syntax} in its URL or that is used as -\const{rdf} namespace is canonised to \const{rdf}. This implies that any -attribute and element name from the RDF namespace appears as -\verb$rdf:<name>$ - -\begin{code} -:- dynamic - xmlns/3. - -on_xmlns(rdf, URL, _Parser) :- !, - asserta(xmlns(URL, rdf, _)). -on_xmlns(_, URL, _Parser) :- - sub_atom(URL, _, _, _, 'rdf-syntax'), !, - asserta(xmlns(URL, rdf, _)). - -load_rdf_xml(File, Term) :- - load_structure(File, Term, - [ dialect(xmlns), - call(xmlns, on_xmlns), - call(urlns, xmlns) - ]). -\end{code} - -The library provides iri_xml_namespace/3 to break down an IRI into -its namespace and localname: - -\begin{description} - \predicate[det]{iri_xml_namespace}{3}{+IRI, -Namespace, -Localname} -Split an IRI (Unicode URI) into its \arg{Namespace} (an IRI) and -\arg{Localname} (a Unicode XML name, see xml_name/2). The -\arg{Localname} is defined as the longest last part of the IRI that -satisfies the syntax of an XML name. With IRI schemas that are designed -to work with XML namespaces, this will typically break the IRI on the -last \chr{\#} or \chr{/}. Note however that this can produce unexpected -results. E.g., in the example below, one might expect the namespace to -be \url{http://example.com/images\#}, but an XML name cannot start with -a digit. - -\begin{code} -?- iri_xml_namespace('http://example.com/images#12345', NS, L). -NS = 'http://example.com/images#12345', -L = ''. -\end{code} - -As we see from the example above, the \arg{Localname} can be the empty -atom. Similarly, \arg{Namespace} can be the empty atom if \arg{IRI} is -an XML name. Applications will often have to check for either or both -these conditions. We decided against failing in these conditions because -the application typically wants to know which of the two conditions -(empty namespace or empty localname) holds. This predicate is often used -for generating RDF/XML from an RDF graph. - - \predicate[det]{iri_xml_namespace}{2}{+IRI, -Namespace} -Same as iri_xml_namespace/3, but avoids creating an atom for the -\arg{Localname}. -\end{description} - - -\subsection{DTD-Handling} - -The DTD (\textbf{D}ocument \textbf{T}ype \textbf{D}efinition) is a -separate entity in sgml2pl, that can be created, freed, defined and -inspected. Like the parser itself, it is filled by opening it as a -Prolog output stream and sending data to it. This section summarises the -predicates for handling the DTD. - -\begin{description} - \predicate{new_dtd}{2}{+DocType, -DTD} -Creates an empty DTD for the named \arg{DocType}. The returned -DTD-reference is an opaque term that can be used in the other predicates -of this package. - - \predicate{free_dtd}{1}{+DTD} -Deallocate all resources associated to the DTD. Further use of \arg{DTD} -is invalid. - - \predicate{load_dtd}{2}{+DTD, +File} -Define the DTD by loading the SGML-DTD file \arg{File}. Same -as load_dtd/3 with empty option list. - - \predicate{load_dtd}{3}{+DTD, +File, +Options} -Define the DTD by loading \arg{File}. Defined options are the -\const{dialect} option from open_dtd/3 and the \const{encoding} -option from open/4. Notably the \const{dialect} option must -match the dialect used for subsequent parsing using this DTD. - - \predicate{open_dtd}{3}{+DTD, +Options, -OutStream} -Open a DTD as an output stream. See load_dtd/2 for an example. -Defined options are: - -\begin{description} - \termitem{dialect}{Dialect} -Define the DTD dialect. Default is \const{sgml}. Using \const{xml} or -\const{xmlns} processes the DTD case-sensitive. -\end{description} - - \predicate{dtd}{2}{+DocType, -DTD} -Find the DTD representing the indicated \jargon{doctype}. This predicate -uses a cache of DTD objects. If a doctype has no associated dtd, it -searches for a file using the file search path \exam{dtd} using the call: - -\begin{code} -..., -absolute_file_name(dtd(Type), - [ extensions([dtd]), - access(read) - ], DtdFile), -... -\end{code} - -Note that DTD objects may be modified while processing errornous -documents. For example, loading an SGML document starting with -\verb$<?xml ...?>$ switches the DTD to XML mode and encountering unknown -elements adds these elements to the DTD object. Re-using a DTD object to -parse multiple documents should be restricted to situations where the -documents processed are known to be error-free. - - \predicate{dtd_property}{2}{+DTD, ?Property} -This predicate is used to examine the content of a DTD. Property is one -of: - -\begin{description} - \termitem{doctype}{DocType} -An atom representing the document-type defined by this DTD. - - \termitem{elements}{ListOfElements} -A list of atoms representing the names of the elements in this DTD. - - \termitem{element}{Name, Omit, Content} -The DTD contains an element with the given name. \arg{Omit} is a term of -the format \term{omit}{OmitOpen, OmitClose}, where both arguments are -booleans (\const{true} or \const{false} representing whether the open- -or close-tag may be omitted. \arg{Content} is the content-model of the -element represented as a Prolog term. This term takes the following -form: - - \begin{description} - \termitem{empty}{} -The element has no content. - - \termitem{cdata}{} -The element contains non-parsed character data. All data up to the -matching end-tag is included in the data (\jargon{declared content}). - - \termitem{rcdata}{} -As \const{cdata}, but entity-references are expanded. - - \termitem{any}{} -The element may contain any number of any element from the DTD in -any order. - - \termitem{\#pcdata}{} -The element contains parsed character data . - - \termitem{\arg{element}} An element with this name. - - \termitem{*}{SubModel} -0 or more appearances. - - \termitem{?}{SubModel} -0 or one appearance. - - \termitem{+}{SubModel} -1 or more appearances. - - \termitem{,}{SubModel1, SubModel2} -\arg{SubModel1} followed by \arg{SubModel2}. - - \termitem{\&}{SubModel1, SubModel2} -\arg{SubModel1} and \arg{SubModel2} in any order. - - \termitem{\chr{|}}{SubModel1, SubModel2} -\arg{SubModel1} or \arg{SubModel2}. -\end{description} - - \termitem{attributes}{Element, ListOfAttributes} -\arg{ListOfAttributes} is a list of atoms representing the attributes -of the element \arg{Element}. - - \termitem{attribute}{Element, Attribute, Type, Default} -Query an element. \arg{Type} is one of \const{cdata}, \const{entity}, -\const{id}, \const{idref}, \const{name}, \const{nmtoken}, -\const{notation}, \const{number} or \const{nutoken}. For DTD types that -allow for a list, the notation \term{list}{Type} is used. Finally, the -DTD construct \verb$(a|b|...)$ is mapped to the term -\term{nameof}{ListOfValues}. - -\arg{Default} describes the sgml default. It is one \const{required}, -\const{current}, \const{conref} or \const{implied}. If a real default is -present, it is one of \term{default}{Value} or \term{fixed}{Value}. - - \termitem{entities}{ListOfEntities} -\arg{ListOfEntities} is a list of atoms representing the names of the -defined entities. - - \termitem{entity}{Name, Value} -\arg{Name} is the name of an entity with given value. Value is one of -\begin{description} - - \termitem{\arg{Atom}}{} -If the value is atomic, it represents the literal value of the entity. - - \termitem{system}{Url} -\arg{Url} is the URL of the system external entity. - - \termitem{public}{Id, Url} -For external public entities, \arg{Id} is the identifier. If an URL is -provided this is returned in \arg{Url}. Otherwise this argument is -unbound. -\end{description} - - \termitem{notations}{ListOfNotations} -Returns a list holding the names of all \const{NOTATION} declarations. - - \termitem{notation}{Name, Decl} -Unify \arg{Decl} with a list if \term{system}{+File} and/or -\term{public}{+PublicId}. -\end{description} -\end{description} - -\subsubsection{The DOCTYPE declaration} - -As this parser allows for processing partial documents and process the -DTD separately, the DOCTYPE declaration plays a special role. - -If a document has no DOCTYPE declaraction, the parser returns a list -holding all elements and CDATA found. If the document has a DOCTYPE -declaraction, the parser will open the element defined in the DOCTYPE as -soon as the first real data is encountered. - -\subsection{Extracting a DTD} \label{sec:implicitdtd} - -Some documents have no DTD. One of the neat facilities of this library -is that it builds a DTD while parsing a document with an <jargon/ -implicit/ DTD. The resulting DTD contains all elements encountered in -the document. For each element the content model is a disjunction of -elements and possibly \verb$#PCDATA$ that can be repeated. Thus, if we -found element <elem/y/ and CDATA in element <elem/x/, the model is: - -\begin{code} -<!ELEMENT x - - (y|#PCDATA)*> -\end{code} - -Any encountered attribute is added to the attribute list with the type -\const{CDATA} and default \const{\#IMPLIED}. - -The example below extracts the elements used in an unknown XML document. - -\begin{code} -elements_in_xml_document(File, Elements) :- - load_structure(File, _, - [ dialect(xml), - dtd(DTD) - ]), - dtd_property(DTD, elements(Elements)), - free_dtd(DTD). -\end{code} - -\subsection{Parsing Primitives} - -\begin{description} - \predicate{new_sgml_parser}{2}{-Parser, +Options} -Creates a new parser. A parser can be used one or multiple times for -parsing documents or parts thereof. It may be bound to a DTD or the DTD -may be left implicit, in which case it is created from the document -prologue or parsing is performed without a DTD. Options: -\begin{description} - \termitem{dtd}{?DTD} -If specified with an initialised DTD, this DTD is used for parsing the -document, regardless of the document prologue. If specified using as a -variable, a reference to the created DTD is returned. This DTD may be -created from the document prologue or build implicitely from the -document's content. -\end{description} - - \predicate{free_sgml_parser}{1}{+Parser} -Destroy all resources related to the parser. This does not destroy the -DTD if the parser was created using the \term{dtd}{DTD} option. - - \predicate{set_sgml_parser}{2}{+Parser, +Option} -Sets attributes to the parser. Currently defined attributes: - -\begin{description} - \termitem{file}{File} -Sets the file for reporting errors and warnings. Sets the line to 1. - \termitem{line}{Line} -Sets the current line. Useful if the stream is not at the start of the -(file) object for generating proper line-numbers. - \termitem{charpos}{Offset} -Sets the current character location. See also the \term{file}{File} -option. - \termitem{dialect}{Dialect} -Set the markup dialect. Known dialects: -\begin{description} - - \termitem{sgml}{} -The default dialect is to process as SGML. This implies markup is -case-insensitive and standard SGML abbreviation is allowed (abreviated -attributes and omitted tags). - - \termitem{xml}{} -This dialect is selected automatically if the processing instruction -\verb$<?xml ...>$ is encountered. See \secref{xml} for details. - - \termitem{xmlns}{} -Process file as XML file with namespace support. See \secref{xmlns} for -details. See also the \verb$qualify_attributes$ option below. -\end{description} - - \termitem{xmlns}{+URI} -Set the default namespace of the outer environment. This option is -provided to process partial XML content with proper namespace -resolution. - - \termitem{xmlns}{+NS, +URI} -Specify a namespace for the outer environment. This option is -provided to process partial XML content with proper namespace -resolution. - - \termitem{qualify_attributes}{Boolean} -How to handle unqualified attribute (i.e. without an explicit namespace) -in XML namespace (\const{xmlns}) mode. Default and standard compliant is -not to qualify such elements. If \const{true}, such attributes are -qualified with the namespace of the element they appear in. This option -is for backward compatibility as this is the behaviour of older -versions. In addition, the namespace document suggests unqualified -attributes are often interpreted in the namespace of their element. - - \termitem{space}{SpaceMode} -Define the initial handling of white-space in PCDATA. This attribute is -described in \secref{space}. - - \termitem{number}{NumberMode} -If \const{token} (default), attributes of type number are passed as a -Prolog atom. If \const{integer}, such attributes are translated into -Prolog integers. If the conversion fails (e.g. due to overflow) a -warning is issued and the value is passed as an atom. - - \termitem{encoding}{Encoding} -Set the initial encoding. The default initial encoding for XML documents is -UTF-8 and for SGML documents ISO-8859-1. XML documents may change the -encoding using the <xmp>encoding=</xmp> attribute in the header. Explicit -use of this option is only required to parse non-conforming documents. -Currently accepted values are \const{iso-8859-1} and \const{utf-8}. - - \termitem{doctype}{Element} -Defines the toplevel element expected. If a \verb$<!DOCTYPE$ -declaration has been parsed, the default is the defined doctype. The -parser can be instructed to accept the first element encountered as the -toplevel using <xmp>doctype(_)</xmp>. This feature is especially -useful when parsing part of a document (see the \const{parse} option to -sgml_parse/2. -\end{description} - - \predicate{get_sgml_parser}{2}{+Parser, -Option} -Retrieve infomation on the current status of the parser. Notably useful -if the parser is used in the call-back mode. Currently defined options: - -\begin{description} - \termitem{file}{-File} -Current file-name. Note that this may be different from the provided -file if an external entity is being loaded. - - \termitem{line}{-Line} -Line-offset from where the parser started its processing in the file-object. - - \termitem{charpos}{-CharPos} -Offset from where the parser started its processing in the file-object. -See \secref{indexaccess}. - - \termitem{charpos}{-Start, -End} -Character offsets of the start and end of the source processed causing the -current call-back. Used in \program{PceEmacs} to for colouring -text in SGML and XML modes. - - \termitem{source}{-Stream} -Prolog stream being processed. May be used in the \const{on_begin}, \emph{etc.} -callbacks from sgml_parse/2. - - \termitem{dialect}{-Dialect} -Return the current dialect used by the parser (\const{sgml}, \const{xml} or \const{xmlns}). - - \termitem{event_class}{-Class} -The \jargon{event class} can be requested in call-back events. It -denotes the cause of the event, providing useful information for syntax -highlighting. Defined values are: - \begin{description} - - \termitem{explicit}{} - The code generating this event is explicitely present in the - document. - - \termitem{omitted}{} - The current event is caused by the insertion of an omitted tag. - This may be a normal event in SGML mode or an error in XML mode. - - \termitem{shorttag}{} - The current event (\const{begin} or \const{end}) is caused by an - element written down using the \jargon{shorttag} notation - (\verb$<tag/value/>$. - - \termitem{shortref}{} - The current event is caused by the expansion of a - \jargon{shortref}. This allows for highlighting shortref strings - in the source-text. - \end{description} - - \termitem{doctype}{-Element} -Return the defined document-type (= toplevel element). See also -set_sgml_parser/2. - - \termitem{dtd}{-DTD} -Return the currently used DTD. See dtd_property/2 for obtaining information -on the DTD such as element and attribute properties. - - \termitem{context}{-StackOfElements} -Returns the stack of currently open elements as a list. The head of this -list is the current element. This can be used to determine the context -of, for example, CDATA events in call-back mode. The elements -are passed as atoms. Currently no access to the attributes is provided. - - \termitem{allowed}{-Elements} -Determines which elements may be inserted at the current location. This -information is returned as a list of element-names. If character data is -allowed in the current location, \const{\#pcdata} is part of -\arg{Elements}. If no element is open, the \jargon{doctype} is returned. - -This option is intended to support syntax-sensitive editors. Such an -editor should load the DTD, find an appropriate starting point and then -feed all data between the starting point and the caret into the parser. -Next it can use this option to determine the elements allowed at this -point. Below is a code fragment illustrating this use given a parser -with loaded DTD, an input stream and a start-location. - -\begin{code} - ..., - seek(In, Start, bof, _), - set_sgml_parser(Parser, charpos(Start)), - set_sgml_parser(Parser, doctype(_)), - Len is Caret - Start, - sgml_parse(Parser, - [ source(In), - content_length(Len), - parse(input) % do not complete document - ]), - get_sgml_parser(Parser, allowed(Allowed)), - ... -\end{code} -\end{description} - - \predicate{sgml_parse}{2}{+Parser, +Options} -Parse an XML file. The parser can operate in two input and two output -modes. Output is either a structured term as described with -load_structure/2 or call-backs on predefined events. The -first is especially suitable for manipulating not-too-large documents, -while the latter provides a primitive means for handling very large -documents. - -Input is a stream. A full description of the option-list is below. - -\begin{description} - \termitem{document}{+Term} -A variable that will be unified with a list describing the content of -the document (see load_structure/2). - \termitem{source}{+Stream} -An input stream that is read. This option <em/must/ be given. - \termitem{content_length}{+Characters} -Stop parsing after \arg{Characters}. This option is useful to parse -input embedded in <em/envelopes/, such as the HTTP protocol. - \termitem{parse}{Unit} -Defines how much of the input is parsed. This option is used to parse -only parts of a file. - \begin{description} - \termitem{file}{} -Default. Parse everything upto the end of the input. - - \termitem{element}{} -The parser stops after reading the first element. Using -\term{source}{Stream}, this implies reading is stopped as soon -as the element is complete, and another call may be issued on the same -stream to read the next element. - - \termitem{content}{} -The value \const{content} is like \const{element} but assumes the -element has already been opened. It may be used in a call-back from -\term{call}{\const{on_begin}, Pred} to parse individual elements after -validating their headers. - - \termitem{declaration}{} -This may be used to stop the parser after reading the first -declaration. This is especially useful to parse only the \exam{doctype} -declaration. - \termitem{input}{} -This option is intended to be used in conjunction with the -\term{allowed}{Elements} option of get_sgml_parser/2. -It disables the parser's default to complete the parse-tree by closing -all open elements. - \end{description} - - \termitem{max_errors}{+MaxErrors} -Set the maximum number of errors. If this number is exceeded further -writes to the stream will yield an I/O error exception. Printing of -errors is suppressed after reaching this value. The default is 100. - \termitem{syntax_errors}{+ErrorMode} -Defines how syntax errors are handled. - \begin{description} - \termitem{quiet}{} - Suppress all messages. - \termitem{print}{} - Default. Pass messages to <pref builtin>print_message/2. - \termitem{style}{} - Print dubious input such as attempts for redefinitions in the DTD - using <pref builtin>print_message/2 with severity - \const{informational}. - \end{description} - - \termitem{xml_no_ns}{+Mode} -Error handling if an XML namespace is not defined. Default generates -an error. If \const{quiet}, the error is suppressed. Can be used -together with \term{call}{urlns, Closure} to provide external expansion -of namespaces. See also \secref{xmlns}. - - \termitem{call}{+Event, :PredicateName} -Issue call-backs on the specified events. \arg{PredicateName} is the -name of the predicate to call on this event, possibly prefixed with a -module identifier. If the handler throws an exception, parsing is stopped -and sgml_parse/2 re-throws the exception. The defined events are: -\begin{description} - \termitem{begin}{} -An open-tag has been parsed. The named handler is called with three -arguments: \term{\arg{Handler}}{+Tag, +Attributes, +Parser}. - \termitem{end}{} -A close-tag has been parsed. The named handler is called with two -arguments: \term{\arg{Handler}}{+Tag, +Parser}. - - \termitem{cdata}{} -CDATA has been parsed. The named handler is called with two arguments: -\term{Handler}{+CDATA, +Parser}, where CDATA is an atom -representing the data. - - \termitem{pi}{} -A processing instruction has been parsed. The named handler is called -with two arguments: \term{\arg{Handler}}{+Text, +Parser}, where -\arg{Text} is the text of the processing instruction. - - \termitem{decl}{} -A declaration (\verb$<!...>$) has been read. The named handler is -called with two arguments: \term{\arg{Handler}}{+Text, +Parser}, -where \arg{Text} is the text of the declaration with comments removed. - -This option is expecially useful for highlighting declarations and comments in -editor support, where the location of the declaration is extracted using -get_sgml_parser/2. - - \termitem{error}{} -An error has been encountered. the named handler is called with three -arguments: \term{\arg{Handler}}{+Severity, +Message, +Parser}, where -\arg{Severity} is one of \const{warning} or \const{error} and -\arg{Message} is an atom representing the diagnostic message. The -location of the error can be determined using get_sgml_parser/2 - -If this option is present, errors and warnings are not reported using -print_message/3 - - \termitem{xmlns}{} -When parsing an in \const{xmlns} mode, a new namespace declaraction is -pushed on the environment. The named handler is called with three -arguments: \term{\arg{Handler}}{+NameSpace, +URL, +Parser}. -See \secref{xmlns} for details. - - \termitem{urlns}{} -When parsing an in \const{xmlns} mode, this predicate can be used to map a -url into either a canonical URL for this namespace or another internal -identifier. See \secref{xmlns} for details. -\end{description} -\end{description} -\end{description} - -\subsubsection{Partial Parsing} - -In some cases, part of a document needs to be parsed. One option is to -use load_structure/2 or one of its variations and extract -the desired elements from the returned structure. This is a clean -solution, especially on small and medium-sized documents. It however is -unsuitable for parsing really big documents. Such documents can only be -handled with the call-back output interface realised by the -\term{call}{Event, Action} option of sgml_parse/2. -Event-driven processing is not very natural in Prolog. - -The SGML2PL library allows for a mixed approach. Consider the case where -we want to process all descriptions from RDF elements in a document. The -code below calls <xmp>process_rdf_description(Element)</xmp> on each element -that is directly inside an RDF element. - -\begin{code} -:- dynamic - in_rdf/0. - -load_rdf(File) :- - retractall(in_rdf), - open(File, read, In), - new_sgml_parser(Parser, []), - set_sgml_parser(Parser, file(File)), - set_sgml_parser(Parser, dialect(xml)), - sgml_parse(Parser, - [ source(In), - call(begin, on_begin), - call(end, on_end) - ]), - close(In). - -on_end('RDF', _) :- - retractall(in_rdf). - -on_begin('RDF', _, _) :- - assert(in_rdf). -on_begin(Tag, Attr, Parser) :- - in_rdf, !, - sgml_parse(Parser, - [ document(Content), - parse(content) - ]), - process_rdf_description(element(Tag, Attr, Content)). -\end{code} - -\subsection{Type checking} - -\begin{description} - \predicate{xml_is_dom}{1}{@{Term}} -True if \arg{Term} is an SGML/XML term as produced by one of the above -predciates and acceptable by xml_write/3 and friends. -\end{description} - -\section{Stream encoding issues} \label{sec:encoding} - -The parser can deal with ISO Latin-1 and UTF-8 encoded files, doing -decoding based on the encoding argument provided to -set_sgml_parser/2 or, for XML, based on the \const{encoding} -attribute of the XML header. The parser reads from SWI-Prolog streams, -which also provide encoding handling. Therefore, there are two modes -for parsing. If the SWI-Prolog stream has encoding \const{octet} (which -is the default for binary streams), the decoder of the SGML parser will -be used and positions reported by the parser are octet offsets in the -stream. In other cases, the Prolog stream decoder is used and offsets -are character code counts. - -\input{xpath.tex} - -\section{Processing Indexed Files} \label{sec:indexaccess} - -In some cases applications wish to process small portions of large -SGML, XML or RDF files. For example, the \emph{OpenDirectory} project -by Netscape has produced a 90MB RDF file representing the main index. -The parser described here can process this document as a unit, but -loading takes 85 seconds on a Pentium-II 450 and the resulting term -requires about 70MB global stack. One option is to process the entire -document and output it as a Prolog fact-base of RDF triplets, but in -many cases this is undesirable. Another example is a large SGML file -containing online documentation. The application normally wishes to -provide only small portions at a time to the user. Loading the entire -document into memory is then undesirable. - -Using the \term{parse}{element} option, we open a file, seek -(using <pref builtin>seek/4) to the position of the element and -read the desired element. - -The index can be built using the call-back interface of -sgml_parse/2. For example, the following code makes an -index of the \file{ structure.rdf} file of the OpenDirectory -project: - -\begin{code} -:- dynamic - location/3. % Id, File, Offset - -rdf_index(File) :- - retractall(location(_,_)), - open(File, read, In, [type(binary)]), - new_sgml_parser(Parser, []), - set_sgml_parser(Parser, file(File)), - set_sgml_parser(Parser, dialect(xml)), - sgml_parse(Parser, - [ source(In), - call(begin, index_on_begin) - ]), - close(In). - -index_on_begin(_Element, Attributes, Parser) :- - memberchk('r:id'=Id, Attributes), - get_sgml_parser(Parser, charpos(Offset)), - get_sgml_parser(Parser, file(File)), - assert(location(Id, File, Offset)). -\end{code} - -The following code extracts the RDF element with required id: - -\begin{code} -rdf_element(Id, Term) :- - location(Id, File, Offset), - load_structure(File, Term, - [ dialect(xml), - offset(Offset), - parse(element) - ]). -\end{code} - -\section{External entities} - -While processing an SGML document the document may refer to external -data. This occurs in three places: external parameter entities, normal -external entities and the \const{DOCTYPE} declaration. The current version -of this tool deals rather primitively with external data. External -entities can only be loaded from a file and the mapping between the -entity names and the file is done using a \jargon{catalog} file in a -format compatible with that used by James Clark's SP Parser, -based on the SGML Open (now OASIS) specification. - -Catalog files can be specified using two primitives: the predicate -sgml_register_catalog_file/2 or the environment variable -\env{SGML_CATALOG_FILES} (compatible with the SP package). - -\begin{description} - \predicate{sgml_register_catalog_file}{2}{+File, +Location} -Register the indicated \arg{File} as a catalog file. \arg{Location} is -either \const{start} or \const{end} and defines whether the catalog is -considered first or last. This predicate has no effect if \arg{File} is -already part of the catalog. - -If no files are registered using this predicate, the first query on the -catalog examines \env{SGML_CATALOG_FILES} and fills the catalog with -all files in this path. -\end{description} - -Two types of lines are used by this package. - -\begin{quote} -\const{DOCTYPE} \arg{doctype} \arg{file} \\ -\const{PUBLIC} \exam{"}\arg{Id}\exam{"} \arg{file} -\end{quote} - -The specified \arg{file} path is taken relative to the location of the -catolog file. For the \const{DOCTYPE} declaraction, \pllib{sgml} first -makes an attempt to resolve the \const{SYSTEM} or \const{PUBLIC} -identifier. If this fails it tries to resolve the \arg{doctype} using -the provided catalog files. - -Strictly speaking, \pllib{sgml} breaks the rules for XML, -where system identifiers must be Universal Resource Indicators, not -local file names. Simple uses of relative URIs will work correctly under -UNIX and Windows. - -In the future we will design a call-back mechanism for locating and -processing external entities, so Prolog-based file-location and Prolog -resources can be used to store external entities. - -\input{pwp.tex} - -\section{Writing markup} - -\subsection{Writing documents} - -The library \pllib{sgml_write} provides the inverse of the parser, -converting the parser's output back into a file. This process is fairly -simple for XML, but due to the power of the SGML DTD it is much harder -to achieve a reasonable generic result for SGML. - -These predicates can write the output in two encoding schemas depending -on the encoding of the \arg{Stream}. In UTF-8 mode, all characters are -encoded using UTF-8 sequences. In ISO Latin-1 mode, characters outside -the ISO Latin-1 range are represented using a named character entity if -provided by the DTD or a numeric character entity. - -\begin{description} - \predicate{xml_write}{3}{+Stream, +Term, +Options} -Write the XML header with encoding information and the content of -the document as represented by \arg{Term} to \arg{Stream}. This -predicate deals with XML with or without namespaces. If namespace -identifiers are not provided they are generated. This predicate -defines the following \arg{Options} - -\begin{description} - \termitem{dtd}{DTD} -Specify the DTD. In SGML documents the DTD is required to distinguish -between elements that are declared empty in the DTD and elements that -just happen to have no content. Further optimisation (shortref, omitted -tags, etc.) could be considered in the future. The DTD is also used to -find the declared named character entities. - \termitem{doctype}{Doctype} -Document type to include in the header. When omitted it is taken from -the outer element. - \termitem{header}{Bool} -If \arg{Bool} is \const{false}, the XML header is suppressed. Useful for -embedding in other XML streams. - \termitem{layout}{Bool} -Do/do not emit layout characters to make the output readable, Default is -to emit layout. With layout enabled, elements only containing other -elements are written using increasing indentation. This introduces -(depending on the mode and defined whitespace handling) CDATA sequences -with only layout between elements when read back in. If \const{false}, no -layout characters are added. As this mode does not need to analyse the -document it is faster and guarantees correct output when read back. -Unfortunately the output is hardly human readable and causes problems -with many editors. - \termitem{indent}{Integer} -Set the initial element indentation. It more than zero, the indent -is written before the document. - \termitem{nsmap}{Map} -Set the initial namespace map. \arg{Map} is a list of -\arg{Name} = \arg{URI}. This option, together with \const{header} and -\const{ident} is added to use xml_write/3 to generate XML -that is embedded in a larger XML document. - \termitem{net}{Bool} - -Use/do not use \jargon{Null End Tags}. For XML, this applies only to -empty elements, so you get \verb$<foo/>$ (default, -\term{net}{true}) or \verb$<foo></foo>$ -(\term{net}{false}). For SGML, this applies to empty elements, so -you get \verb$<foo>$ (if foo is declared to be \const{EMPTY} in the DTD), -\verb$<foo></foo>$ (default, \term{net}{false}) or -\verb$<foo//$ (\term{net}{true}). In SGML code, short character -content not containing <c>/</c> can be emitted as \verb$<b>xxx</b>$ -(default, \term{net}{false} or \verb$<b/xxx/$ (\term{net}{true}) -\end{description} - - \predicate{sgml_write}{3}{+Stream, +Term, +Options} -Write the SGML \const{DOCTYPE} header and the content of the document as -represented by \arg{Term} to \arg{Stream}. The \arg{Options} are -described with xml_write/3. - - \predicate{html_write}{3}{+Stream, +Term, +Options} -Same as sgml_write/3, but passes the HTML DTD as obtained -from dtd/2. The \arg{Options} are described with -xml_write/3. -\end{description} - -\subsection{Simplify quoting} - -The \pllib{sgml} package is a parser. Output is generally -much easier achieved directly from Prolog. Nevertheless, it contains a -few building blocks for emitting markup data. The quote funtions return -a version of the input text into one that contains entities for -characters that need to be escaped. These are the XML meta characters -and the characters that cannot be expressed by the document encoding. -Therefore these predicates accept an \arg{encoding} argument. Accepted -values are \const{ascii}, \const{iso_latin_1}, \const{utf8} and -\const{unicode}. Versions with two arguments are provided for backward -compatibility, making the safe \const{ascii} encoding assumption. - -\begin{description} - \predicate{xml_quote_attribute}{3}{+In, -Quoted, +Encoding} -Map the characters that may not appear in XML attributes to entities. -Currently these are \verb$<>&"$.% - \footnote{Older versions also mapped \texttt{'} to - \texttt{\&apos;}.} -Characters that cannot represented in \arg{Encoding} are mapped to XML -character entities. - - \predicate{xml_quote_attribute}{2}{+In, -Quoted} -Backward compatibility version for xml_quote_attribute/3. -Assumes \const{ascii} encoding. - - \predicate{xml_quote_cdata}{3}{+In, -Quoted, +Encoding} -Very similar to xml_quote_attribute/3, but does not quote the -single- and double-quotes. - - \predicate{xml_quote_cdata}{2}{+In, -Quoted} -Backward compatibility version for xml_quote_cdata/3. -Assumes \const{ascii} encoding. - - \predicate{xml_name}{2}{+In, +Encoding} -Succeed if \arg{In} is an atom or string that satisfies the rules for -a valid XML element or attribute name. As with the other predicates in -this group, if \arg{Encoding} cannot represent one of the characters, this -function fails. Character classification is based on -\url{http://www.w3.org/TR/2006/REC-xml-20060816}. - - \predicate{xml_name}{1}{+In} -Backward compatibility version for xml_name/2. Assumes \const{ascii} -encoding. -\end{description} - -\section{Unsupported features} - -The current parser is rather limited. While it is able to deal with many -serious documents, it omits several less-used features of SGML and XML. -Known missing SGML features include - -\begin{itemlist} - \item [NOTATION on entities] -Though notation is parsed, notation attributes on external entity -declarations are not handed to the user. - \item [NOTATION attributes] -SGML notations may have attributes, declared using -\verb$<!ATTLIST #NOTATION name attributes>$. Those data attributes -are provided when you declare an external CDATA, NDATA, or SDATA entity. - -XML does not include external CDATA, NDATA, or SDATA entities, -nor any of the other uses to which data attributes are put in SGML, -so it doesn't include data attributes for notations either. - -Sgml2pl does not support this feature and is unlikely to; -you should be aware that SGML documents using this feature cannot -be converted faithfully to XML. - \item [SHORTTAG] -The SGML SHORTTAG syntax is only partially implemented. Currently, -\verb$<tag/content/$ is a valid abbreviation for -\verb$<tag>content</tag>$, which can also be written as -\verb$<tag>content</>$. -Empty start tags (\verb$<>$), unclosed start tags -(\verb$<a<b</verb>) and unclosed end tags (<verb></a<b$) are not -supported. - \item [SGML declaration] -The `SGML declaration' is fixed, though most of the parameters are -handled through indirections in the implementation. - \item [The DATATAG feature] -It is regarded as superseeded by SHORTREF, which is supported. -(SP does not support it either.) - \item [The RANK feature] -It is regarded as obsolete. - \item [The LINK feature] -It is regarded as too complicated. - \item [The CONCUR feature] -Concurrent markup allows a document to be tagged according to more than -one DTD at the same time. It is not supported. -\end{itemlist} - - -In XML mode the parser recognises SGML constructs that are not allowed -in XML. Also various extensions of XML over SGML are not yet realised. -In particular, XInclude is not implemented because the designers of -XInclude can't make up their minds whether to base it on elements or -attributes yet, let alone details. - -\section{Installation} - -\subsection{Unix systems} - -Installation on Unix system uses the commonly found \program{configure}, -<\program{make} and \program{make install} sequence. SWI-Prolog -should be installed before building this package. If SWI-Prolog is not -installed as \program{pl}, the environment variable \env{PL} must be set -to the name of the SWI-Prolog executable. Installation is now -accomplished using: - -\begin{code} -% ./configure -% make -% make install -\end{code} - -This installs the foreign libraries in \file{$PLBASE/lib/$PLARCH} and -the Prolog library files in \file{$PLBASE/library}, where \file{$PLBASE} -refers to the SWI-Prolog `home-directory'. - -\section{Acknowledgements} - -The Prolog representation for parsed documents is based on the -SWI-Prolog interface to SP by Anjo Anjewierden. - -Richard O'Keefe has put a lot of effort testing and providing bug -reports consisting of an illustrative example and explanation of the -standard. He also made many suggestions for improving this document. - -\printindex - -\end{document} - - diff --git a/packages/sgml/sgml.pl b/packages/sgml/sgml.pl deleted file mode 100644 index 8669d8f7c..000000000 --- a/packages/sgml/sgml.pl +++ /dev/null @@ -1,451 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog - - Author: Jan Wielemaker - E-mail: J.Wielemaker@cs.vu.nl - WWW: http://www.swi-prolog.org - Copyright (C): 1985-2009, University of Amsterdam - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - As a special exception, if you link this library with other files, - compiled with a Free Software compiler, to produce an executable, this - library does not by itself cause the resulting executable to be covered - by the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -:- module(sgml, - [ load_sgml_file/2, % +File, -ListOfContent - load_xml_file/2, % +File, -ListOfContent - load_html_file/2, % +File, -Document - - load_structure/3, % +File, -Term, +Options - - load_dtd/2, % +DTD, +File - load_dtd/3, % +DTD, +File, +Options - dtd/2, % +Type, -DTD - dtd_property/2, % +DTD, ?Property - - new_dtd/2, % +Doctype, -DTD - free_dtd/1, % +DTD - open_dtd/3, % +DTD, +Options, -Stream - - new_sgml_parser/2, % -Parser, +Options - free_sgml_parser/1, % +Parser - set_sgml_parser/2, % +Parser, +Options - get_sgml_parser/2, % +Parser, +Options - sgml_parse/2, % +Parser, +Options - - sgml_register_catalog_file/2, % +File, +StartOrEnd - - xml_quote_attribute/3, % +In, -Quoted, +Encoding - xml_quote_cdata/3, % +In, -Quoted, +Encoding - xml_quote_attribute/2, % +In, -Quoted - xml_quote_cdata/2, % +In, -Quoted - xml_name/1, % +In - xml_name/2, % +In, +Encoding - iri_xml_namespace/2, % +IRI, -Namespace - iri_xml_namespace/3, % +IRI, -Namespace, -LocalName - xml_is_dom/1 % +Term - ]). -:- expects_dialect(swi). -:- assert(system:swi_io). - -:- use_module(library(lists)). -:- use_module(library(option)). -:- use_module(library(shlib)). - -:- multifile user:file_search_path/2. -:- dynamic user:file_search_path/2. - -user:file_search_path(dtd, '.'). -:- if(current_prolog_flag(version_data, swi(_,_,_,_))). -user:file_search_path(dtd, swi('library/DTD')). -:- else. -user:file_search_path(dtd, swi('DTD')). -:- endif. - - -sgml_register_catalog_file(File, Location) :- - prolog_to_os_filename(File, OsFile), - '_sgml_register_catalog_file'(OsFile, Location). - -:- use_foreign_library(foreign(sgml2pl)). - -register_catalog(Base) :- - absolute_file_name(dtd(Base), - [ extensions([soc]), - access(read), - file_errors(fail) - ], - SocFile), - sgml_register_catalog_file(SocFile, end). - -:- initialization - ignore(register_catalog('HTML4')). - - - /******************************* - * DTD HANDLING * - *******************************/ - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Note that concurrent access to DTD objects is not allowed, and hence we -will allocate and destroy them in each thread. Possibibly it would be -nicer to find out why concurrent access to DTD's is flawed. It is -diagnosed to mess with the entity resolution by Fabien Todescato. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -:- thread_local - current_dtd/2. -:- volatile - current_dtd/2. -:- thread_local - registered_cleanup/0. -:- volatile - registered_cleanup/0. - -:- multifile - dtd_alias/2. - -dtd_alias(html, 'HTML4'). - -dtd(Type, DTD) :- - current_dtd(Type, DTD), !. -dtd(Type, DTD) :- - new_dtd(Type, DTD), - ( dtd_alias(Type, Base) - -> true - ; Base = Type - ), - absolute_file_name(dtd(Base), - [ extensions([dtd]), - access(read) - ], DtdFile), - load_dtd(DTD, DtdFile), - register_cleanup, - asserta(current_dtd(Type, DTD)). - -%% load_dtd(+DTD, +DtdFile, +Options) -% -% Load file into a DTD. Defined options are: -% -% * dialect(+Dialect) -% Dialect to use (xml, xmlns, sgml) -% -% * encoding(+Encoding) -% Encoding of DTD file - -load_dtd(DTD, DtdFile) :- - load_dtd(DTD, DtdFile, []). -load_dtd(DTD, DtdFile, Options) :- - split_dtd_options(Options, DTDOptions, FileOptions), - open_dtd(DTD, DTDOptions, DtdOut), - open(DtdFile, read, DtdIn, FileOptions), - copy_stream_data(DtdIn, DtdOut), - close(DtdIn), - close(DtdOut). - -split_dtd_options([], [], []). -split_dtd_options([H|T], [H|TD], S) :- - dtd_option(H), !, - split_dtd_options(T, TD, S). -split_dtd_options([H|T], TD, [H|S]) :- - split_dtd_options(T, TD, S). - -dtd_option(dialect(_)). - - -%% destroy_dtds -% -% Destroy DTDs cached by this thread as they will become -% unreachable anyway. - -destroy_dtds :- - ( current_dtd(_Type, DTD), - free_dtd(DTD), - fail - ; true - ). - -%% register_cleanup -% -% Register cleanup of DTDs created for this thread. - -register_cleanup :- - registered_cleanup, !. -register_cleanup :- - catch(thread_at_exit(destroy_dtds), _, true), - assert(registered_cleanup). - - - /******************************* - * EXAMINE DTD * - *******************************/ - -prop(doctype(_), _). -prop(elements(_), _). -prop(entities(_), _). -prop(notations(_), _). -prop(entity(E, _), DTD) :- - ( nonvar(E) - -> true - ; '$dtd_property'(DTD, entities(EL)), - member(E, EL) - ). -prop(element(E, _, _), DTD) :- - ( nonvar(E) - -> true - ; '$dtd_property'(DTD, elements(EL)), - member(E, EL) - ). -prop(attributes(E, _), DTD) :- - ( nonvar(E) - -> true - ; '$dtd_property'(DTD, elements(EL)), - member(E, EL) - ). -prop(attribute(E, A, _, _), DTD) :- - ( nonvar(E) - -> true - ; '$dtd_property'(DTD, elements(EL)), - member(E, EL) - ), - ( nonvar(A) - -> true - ; '$dtd_property'(DTD, attributes(E, AL)), - member(A, AL) - ). -prop(notation(N, _), DTD) :- - ( nonvar(N) - -> true - ; '$dtd_property'(DTD, notations(NL)), - member(N, NL) - ). - -dtd_property(DTD, Prop) :- - prop(Prop, DTD), - '$dtd_property'(DTD, Prop). - - - /******************************* - * SGML * - *******************************/ - -parser_option(dialect(_)). -parser_option(shorttag(_)). -parser_option(file(_)). -parser_option(line(_)). -parser_option(space(_)). -parser_option(number(_)). -parser_option(defaults(_)). -parser_option(doctype(_)). -parser_option(qualify_attributes(_)). -parser_option(encoding(_)). - -set_parser_options(Parser, Options, RestOptions) :- - parser_option(Option), - select_option(Option, Options, RestOptions0), !, - set_sgml_parser(Parser, Option), - set_parser_options(Parser, RestOptions0, RestOptions). -set_parser_options(_, Options, Options). - - -:- meta_predicate - load_structure(+, -, :). - -load_structure(stream(In), Term, M:Options) :- !, - ( select_option(offset(Offset), Options, Options1) - -> seek(In, Offset, bof, _) - ; Options1 = Options - ), - ( select_option(dtd(DTD), Options1, Options2) - -> ExplicitDTD = true - ; ExplicitDTD = false, - Options2 = Options1 - ), - new_sgml_parser(Parser, - [ dtd(DTD) - ]), - def_entities(Options2, Parser, Options3), - call_cleanup(parse(Parser, M:Options3, TermRead, In), - free_sgml_parser(Parser)), - ( ExplicitDTD == true - -> ( DTD = dtd(_, DocType), - dtd_property(DTD, doctype(DocType)) - -> true - ; true - ) - ; free_dtd(DTD) - ), - Term = TermRead. -load_structure(Stream, Term, Options) :- - is_stream(Stream), !, - load_structure(stream(Stream), Term, Options). -load_structure(File, Term, M:Options) :- - open(File, read, In, [type(binary)]), - load_structure(stream(In), Term, M:[file(File)|Options]), - close(In). - -parse(Parser, M:Options, Document, In) :- - set_parser_options(Parser, Options, Options1), - parser_meta_options(Options1, M, Options2), - sgml_parse(Parser, - [ document(Document), - source(In) - | Options2 - ]). - -parser_meta_options([], _, []). -parser_meta_options([call(When, Closure)|T0], M, [call(When, M:Closure)|T]) :- !, - parser_meta_options(T0, M, T). -parser_meta_options([H|T0], M, [H|T]) :- - parser_meta_options(T0, M, T). - - -def_entities([], _, []). -def_entities([H|T], Parser, Opts) :- - def_entity(H, Parser), !, - def_entities(T, Parser, Opts). -def_entities([H|T0], Parser, [H|T]) :- - def_entities(T0, Parser, T). - -def_entity(entity(Name, Value), Parser) :- - get_sgml_parser(Parser, dtd(DTD)), - xml_quote_attribute(Value, QValue), - setup_call_cleanup(open_dtd(DTD, [], Stream), - format(Stream, '<!ENTITY ~w "~w">~n', - [Name, QValue]), - close(Stream)). -def_entity(xmlns(URI), Parser) :- - set_sgml_parser(Parser, xmlns(URI)). -def_entity(xmlns(NS, URI), Parser) :- - set_sgml_parser(Parser, xmlns(NS, URI)). - - - /******************************* - * UTILITIES * - *******************************/ - -load_sgml_file(File, Term) :- - load_structure(File, Term, [dialect(sgml)]). - -load_xml_file(File, Term) :- - load_structure(File, Term, [dialect(xml)]). - -load_html_file(File, Term) :- - dtd(html, DTD), - load_structure(File, Term, - [ dtd(DTD), - dialect(sgml), - shorttag(false) - ]). - - - /******************************* - * ENCODING * - *******************************/ - -% xml_quote_attribute(+In, -Quoted) -% xml_quote_cdata(+In, -Quoted) -% -% Backward compatibility for versions that allow to specify -% encoding. All characters that cannot fit the encoding are mapped -% to XML character entities (&#dd;). Using ASCII is the safest -% value. - -xml_quote_attribute(In, Quoted) :- - xml_quote_attribute(In, Quoted, ascii). - -xml_quote_cdata(In, Quoted) :- - xml_quote_cdata(In, Quoted, ascii). - -xml_name(In) :- - xml_name(In, ascii). - - - /******************************* - * TYPE CHECKING * - *******************************/ - -% xml_is_dome(@Term) -% -% True if term statisfies the structure as returned by -% load_structure/3 and friends. - -xml_is_dom(0) :- !, fail. % catch variables -xml_is_dom([]) :- !. -xml_is_dom([H|T]) :- !, - xml_is_dom(H), - xml_is_dom(T). -xml_is_dom(element(Name, Attributes, Content)) :- !, - dom_name(Name), - dom_attributes(Attributes), - xml_is_dom(Content). -xml_is_dom(pi(Pi)) :- !, - atom(Pi). -xml_is_dom(CDATA) :- - atom(CDATA). - -dom_name(NS:Local) :- - atom(NS), - atom(Local), !. -dom_name(Local) :- - atom(Local). - -dom_attributes(0) :- !, fail. -dom_attributes([]). -dom_attributes([H|T]) :- - dom_attribute(H), - dom_attributes(T). - -dom_attribute(Name=Value) :- - dom_name(Name), - atomic(Value). - - - /******************************* - * MESSAGES * - *******************************/ -:- multifile - prolog:message/3. - -% Catch messages. sgml/4 is generated by the SGML2PL binding. - -prolog:message(sgml(Parser, File, Line, Message)) --> - { get_sgml_parser(Parser, dialect(Dialect)) - }, - [ 'SGML2PL(~w): ~w:~w: ~w'-[Dialect, File, Line, Message] ]. - - - /******************************* - * XREF SUPPORT * - *******************************/ - -:- multifile - prolog:called_by/2. - -prolog:called_by(sgml_parse(_, Options), Called) :- - is_list(Options), - findall(G+3, - ( member(call(_, G), Options), - callable(G) - ), - Called). - -:- retract(system:swi_io). diff --git a/packages/sgml/sgml2pl.c b/packages/sgml/sgml2pl.c deleted file mode 100644 index 8f52e4624..000000000 --- a/packages/sgml/sgml2pl.c +++ /dev/null @@ -1,2606 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog - - Author: Jan Wielemaker - E-mail: wielemak@science.uva.nl - WWW: http://www.swi-prolog.org - Copyright (C): 1985-2008, University of Amsterdam - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#define _ISOC99_SOURCE 1 /* fwprintf(), etc prototypes */ - -#ifdef __WINDOWS__ -#include <windows.h> -#endif - -#define DTD_MINOR_ERRORS 1 /* get detailed errors */ - -#include <stdio.h> -#include "dtd.h" -#include "catalog.h" -#include "model.h" -#include "util.h" -#include <SWI-Stream.h> -#include <SWI-Prolog.h> -#include <errno.h> -#include "error.h" -#include <stdlib.h> -#include <assert.h> -#include <string.h> -#include <wctype.h> - -#define streq(s1, s2) (strcmp(s1, s2) == 0) - -#define MAX_ERRORS 50 -#define MAX_WARNINGS 50 - -#define ENDSNUL ((size_t)-1) - - /******************************* - * PARSER CONTEXT DATA * - *******************************/ - -#define PD_MAGIC 0x36472ba1 /* just a number */ - -typedef enum -{ SA_FILE = 0, /* Stop at end-of-file */ - SA_INPUT, /* Do not complete input */ - SA_ELEMENT, /* Stop after first element */ - SA_CONTENT, /* Stop after close */ - SA_DECL /* Stop after declaration */ -} stopat; - -typedef enum -{ EM_QUIET = 0, /* Suppress messages */ - EM_PRINT, /* Print message */ - EM_STYLE /* include style-messages */ -} errormode; - -typedef struct _env -{ term_t tail; - struct _env *parent; -} env; - - -typedef struct _parser_data -{ int magic; /* PD_MAGIC */ - dtd_parser *parser; /* parser itself */ - - int warnings; /* #warnings seen */ - int errors; /* #errors seen */ - int max_errors; /* error limit */ - int max_warnings; /* warning limit */ - errormode error_mode; /* how to handle errors */ - int positions; /* report file-positions */ - term_t exception; /* pending exception from callback */ - - predicate_t on_begin; /* begin element */ - predicate_t on_end; /* end element */ - predicate_t on_cdata; /* cdata */ - predicate_t on_entity; /* entity */ - predicate_t on_pi; /* processing instruction */ - predicate_t on_xmlns; /* xmlns */ - predicate_t on_urlns; /* url --> namespace */ - predicate_t on_error; /* errors */ - predicate_t on_decl; /* declarations */ - - stopat stopat; /* Where to stop */ - int stopped; /* Environment is complete */ - - IOSTREAM* source; /* Where we are reading from */ - - term_t list; /* output term (if any) */ - term_t tail; /* tail of the list */ - env *stack; /* environment stack */ - int free_on_close; /* sgml_free parser on close */ -} parser_data; - - - /******************************* - * CONSTANTS * - *******************************/ - -static functor_t FUNCTOR_and2; -static functor_t FUNCTOR_bar2; -static functor_t FUNCTOR_comma2; -static functor_t FUNCTOR_default1; -static functor_t FUNCTOR_dialect1; -static functor_t FUNCTOR_document1; -static functor_t FUNCTOR_dtd1; -static functor_t FUNCTOR_dtd2; -static functor_t FUNCTOR_element3; -static functor_t FUNCTOR_entity1; -static functor_t FUNCTOR_equal2; -static functor_t FUNCTOR_file1; -static functor_t FUNCTOR_fixed1; -static functor_t FUNCTOR_line1; -static functor_t FUNCTOR_list1; -static functor_t FUNCTOR_max_errors1; -static functor_t FUNCTOR_nameof1; -static functor_t FUNCTOR_notation1; -static functor_t FUNCTOR_omit2; -static functor_t FUNCTOR_opt1; -static functor_t FUNCTOR_plus1; -static functor_t FUNCTOR_rep1; -static functor_t FUNCTOR_sgml_parser1; -static functor_t FUNCTOR_parse1; -static functor_t FUNCTOR_source1; -static functor_t FUNCTOR_content_length1; -static functor_t FUNCTOR_call2; -static functor_t FUNCTOR_charpos1; -static functor_t FUNCTOR_charpos2; -static functor_t FUNCTOR_ns2; /* :/2 */ -static functor_t FUNCTOR_space1; -static functor_t FUNCTOR_pi1; -static functor_t FUNCTOR_sdata1; -static functor_t FUNCTOR_ndata1; -static functor_t FUNCTOR_number1; -static functor_t FUNCTOR_syntax_errors1; -static functor_t FUNCTOR_xml_no_ns1; -static functor_t FUNCTOR_minus2; -static functor_t FUNCTOR_positions1; -static functor_t FUNCTOR_event_class1; -static functor_t FUNCTOR_doctype1; -static functor_t FUNCTOR_allowed1; -static functor_t FUNCTOR_context1; -static functor_t FUNCTOR_defaults1; -static functor_t FUNCTOR_shorttag1; -static functor_t FUNCTOR_qualify_attributes1; -static functor_t FUNCTOR_encoding1; -static functor_t FUNCTOR_xmlns1; -static functor_t FUNCTOR_xmlns2; - -static atom_t ATOM_true; -static atom_t ATOM_false; -static atom_t ATOM_cdata; -static atom_t ATOM_rcdata; -static atom_t ATOM_pcdata; -static atom_t ATOM_empty; -static atom_t ATOM_any; -static atom_t ATOM_position; - -#define mkfunctor(n, a) PL_new_functor(PL_new_atom(n), a) - -static void -initConstants() -{ - FUNCTOR_sgml_parser1 = mkfunctor("sgml_parser", 1); - FUNCTOR_equal2 = mkfunctor("=", 2); - FUNCTOR_dtd1 = mkfunctor("dtd", 1); - FUNCTOR_element3 = mkfunctor("element", 3); - FUNCTOR_entity1 = mkfunctor("entity", 1); - FUNCTOR_document1 = mkfunctor("document", 1); - FUNCTOR_dtd2 = mkfunctor("dtd", 2); - FUNCTOR_omit2 = mkfunctor("omit", 2); - FUNCTOR_and2 = mkfunctor("&", 2); - FUNCTOR_comma2 = mkfunctor(",", 2); - FUNCTOR_bar2 = mkfunctor("|", 2); - FUNCTOR_opt1 = mkfunctor("?", 1); - FUNCTOR_rep1 = mkfunctor("*", 1); - FUNCTOR_plus1 = mkfunctor("+", 1); - FUNCTOR_default1 = mkfunctor("default", 1); - FUNCTOR_fixed1 = mkfunctor("fixed", 1); - FUNCTOR_list1 = mkfunctor("list", 1); - FUNCTOR_nameof1 = mkfunctor("nameof", 1); - FUNCTOR_notation1 = mkfunctor("notation", 1); - FUNCTOR_file1 = mkfunctor("file", 1); - FUNCTOR_line1 = mkfunctor("line", 1); - FUNCTOR_dialect1 = mkfunctor("dialect", 1); - FUNCTOR_max_errors1 = mkfunctor("max_errors", 1); - FUNCTOR_parse1 = mkfunctor("parse", 1); - FUNCTOR_source1 = mkfunctor("source", 1); - FUNCTOR_content_length1= mkfunctor("content_length", 1); - FUNCTOR_call2 = mkfunctor("call", 2); - FUNCTOR_charpos1 = mkfunctor("charpos", 1); - FUNCTOR_charpos2 = mkfunctor("charpos", 2); - FUNCTOR_ns2 = mkfunctor(":", 2); - FUNCTOR_space1 = mkfunctor("space", 1); - FUNCTOR_pi1 = mkfunctor("pi", 1); - FUNCTOR_sdata1 = mkfunctor("sdata", 1); - FUNCTOR_ndata1 = mkfunctor("ndata", 1); - FUNCTOR_number1 = mkfunctor("number", 1); - FUNCTOR_syntax_errors1 = mkfunctor("syntax_errors", 1); - FUNCTOR_xml_no_ns1 = mkfunctor("xml_no_ns", 1); - FUNCTOR_minus2 = mkfunctor("-", 2); - FUNCTOR_positions1 = mkfunctor("positions", 1); - FUNCTOR_event_class1 = mkfunctor("event_class", 1); - FUNCTOR_doctype1 = mkfunctor("doctype", 1); - FUNCTOR_allowed1 = mkfunctor("allowed", 1); - FUNCTOR_context1 = mkfunctor("context", 1); - FUNCTOR_defaults1 = mkfunctor("defaults", 1); - FUNCTOR_shorttag1 = mkfunctor("shorttag", 1); - FUNCTOR_qualify_attributes1 = mkfunctor("qualify_attributes", 1); - FUNCTOR_encoding1 = mkfunctor("encoding", 1); - FUNCTOR_xmlns1 = mkfunctor("xmlns", 1); - FUNCTOR_xmlns2 = mkfunctor("xmlns", 2); - - ATOM_true = PL_new_atom("true"); - ATOM_false = PL_new_atom("false"); - ATOM_cdata = PL_new_atom("cdata"); - ATOM_rcdata = PL_new_atom("rcdata"); - ATOM_pcdata = PL_new_atom("#pcdata"); - ATOM_empty = PL_new_atom("empty"); - ATOM_any = PL_new_atom("any"); - ATOM_position = PL_new_atom("#position"); -} - - /******************************* - * ACCESS * - *******************************/ - -static int -unify_parser(term_t parser, dtd_parser *p) -{ return PL_unify_term(parser, PL_FUNCTOR, FUNCTOR_sgml_parser1, - PL_POINTER, p); -} - - -static int -get_parser(term_t parser, dtd_parser **p) -{ if ( PL_is_functor(parser, FUNCTOR_sgml_parser1) ) - { term_t a = PL_new_term_ref(); - void *ptr; - - _PL_get_arg(1, parser, a); - if ( PL_get_pointer(a, &ptr) ) - { dtd_parser *tmp = ptr; - - if ( tmp->magic == SGML_PARSER_MAGIC ) - { *p = tmp; - - return TRUE; - } - return sgml2pl_error(ERR_EXISTENCE, "sgml_parser", parser); - } - } - - return sgml2pl_error(ERR_TYPE, "sgml_parser", parser); -} - - -static int -unify_dtd(term_t t, dtd *dtd) -{ if ( dtd->doctype ) - return PL_unify_term(t, PL_FUNCTOR, FUNCTOR_dtd2, - PL_POINTER, dtd, - PL_CHARS, dtd->doctype); - else - return PL_unify_term(t, PL_FUNCTOR, FUNCTOR_dtd2, - PL_POINTER, dtd, - PL_VARIABLE); -} - - -static int -get_dtd(term_t t, dtd **dtdp) -{ if ( PL_is_functor(t, FUNCTOR_dtd2) ) - { term_t a = PL_new_term_ref(); - void *ptr; - - _PL_get_arg(1, t, a); - if ( PL_get_pointer(a, &ptr) ) - { dtd *tmp = ptr; - - if ( tmp->magic == SGML_DTD_MAGIC ) - { *dtdp = tmp; - - return TRUE; - } - return sgml2pl_error(ERR_EXISTENCE, "dtd", t); - } - } - - return sgml2pl_error(ERR_TYPE, "dtd", t); -} - - - /******************************* - * NEW/FREE * - *******************************/ - -static foreign_t -pl_new_sgml_parser(term_t ref, term_t options) -{ term_t head = PL_new_term_ref(); - term_t tail = PL_copy_term_ref(options); - term_t tmp = PL_new_term_ref(); - - dtd *dtd = NULL; - dtd_parser *p; - - while ( PL_get_list(tail, head, tail) ) - { if ( PL_is_functor(head, FUNCTOR_dtd1) ) - { _PL_get_arg(1, head, tmp); - - if ( PL_is_variable(tmp) ) /* dtd(X) */ - { dtd = new_dtd(NULL); /* no known doctype */ - dtd->references++; - unify_dtd(tmp, dtd); - } else if ( !get_dtd(tmp, &dtd) ) - return FALSE; - } - } - if ( !PL_get_nil(tail) ) - return sgml2pl_error(ERR_TYPE, "list", tail); - - p = new_dtd_parser(dtd); - - return unify_parser(ref, p); -} - - -static foreign_t -pl_free_sgml_parser(term_t parser) -{ dtd_parser *p; - - if ( get_parser(parser, &p) ) - { free_dtd_parser(p); - return TRUE; - } - - return FALSE; -} - - -static foreign_t -pl_new_dtd(term_t doctype, term_t ref) -{ ichar *dt; - dtd *dtd; - - if ( !PL_get_wchars(doctype, NULL, &dt, CVT_ATOM|CVT_EXCEPTION) ) - return FALSE; - - if ( !(dtd=new_dtd(dt)) ) - return FALSE; - - dtd->references++; - - return unify_dtd(ref, dtd); -} - - -static foreign_t -pl_free_dtd(term_t t) -{ dtd *dtd; - - if ( get_dtd(t, &dtd) ) - { free_dtd(dtd); - return TRUE; - } - - return FALSE; -} - - /******************************* - * DATA EXCHANGE * - *******************************/ - -static int -put_atom_wchars(term_t t, wchar_t const *s) -{ PL_put_variable(t); - return PL_unify_wchars(t, PL_ATOM, ENDSNUL, s); -} - - - /******************************* - * PROPERTIES * - *******************************/ - -static foreign_t -pl_set_sgml_parser(term_t parser, term_t option) -{ dtd_parser *p; - - if ( !get_parser(parser, &p) ) - return FALSE; - - if ( PL_is_functor(option, FUNCTOR_file1) ) - { term_t a = PL_new_term_ref(); - wchar_t *file; - dtd_symbol *fs; - - _PL_get_arg(1, option, a); - if ( !PL_get_wchars(a, NULL, &file, CVT_ATOM|CVT_EXCEPTION) ) - return FALSE; - fs = dtd_add_symbol(p->dtd, file); /* symbol will be freed */ - set_file_dtd_parser(p, IN_FILE, fs->name); - } else if ( PL_is_functor(option, FUNCTOR_line1) ) - { term_t a = PL_new_term_ref(); - - _PL_get_arg(1, option, a); - if ( !PL_get_integer(a, &p->location.line) ) - return sgml2pl_error(ERR_TYPE, "integer", a); - } else if ( PL_is_functor(option, FUNCTOR_charpos1) ) - { term_t a = PL_new_term_ref(); - - _PL_get_arg(1, option, a); - if ( !PL_get_long(a, &p->location.charpos) ) - return sgml2pl_error(ERR_TYPE, "integer", a); - } else if ( PL_is_functor(option, FUNCTOR_dialect1) ) - { term_t a = PL_new_term_ref(); - char *s; - - _PL_get_arg(1, option, a); - if ( !PL_get_atom_chars(a, &s) ) - return sgml2pl_error(ERR_TYPE, "atom", a); - - if ( streq(s, "xml") ) - set_dialect_dtd(p->dtd, DL_XML); - else if ( streq(s, "xmlns") ) - set_dialect_dtd(p->dtd, DL_XMLNS); - else if ( streq(s, "sgml") ) - set_dialect_dtd(p->dtd, DL_SGML); - else - return sgml2pl_error(ERR_DOMAIN, "sgml_dialect", a); - } else if ( PL_is_functor(option, FUNCTOR_space1) ) - { term_t a = PL_new_term_ref(); - char *s; - - _PL_get_arg(1, option, a); - if ( !PL_get_atom_chars(a, &s) ) - return sgml2pl_error(ERR_TYPE, "atom", a); - - if ( streq(s, "preserve") ) - p->dtd->space_mode = SP_PRESERVE; - else if ( streq(s, "default") ) - p->dtd->space_mode = SP_DEFAULT; - else if ( streq(s, "remove") ) - p->dtd->space_mode = SP_REMOVE; - else if ( streq(s, "sgml") ) - p->dtd->space_mode = SP_SGML; - - else - return sgml2pl_error(ERR_DOMAIN, "space", a); - } else if ( PL_is_functor(option, FUNCTOR_defaults1) ) - { term_t a = PL_new_term_ref(); - int val; - - _PL_get_arg(1, option, a); - if ( !PL_get_bool(a, &val) ) - return sgml2pl_error(ERR_TYPE, "boolean", a); - - if ( val ) - p->flags &= ~SGML_PARSER_NODEFS; - else - p->flags |= SGML_PARSER_NODEFS; - } else if ( PL_is_functor(option, FUNCTOR_qualify_attributes1) ) - { term_t a = PL_new_term_ref(); - int val; - - _PL_get_arg(1, option, a); - if ( !PL_get_bool(a, &val) ) - return sgml2pl_error(ERR_TYPE, "boolean", a); - - if ( val ) - p->flags |= SGML_PARSER_QUALIFY_ATTS; - else - p->flags &= ~SGML_PARSER_QUALIFY_ATTS; - } else if ( PL_is_functor(option, FUNCTOR_shorttag1) ) - { term_t a = PL_new_term_ref(); - int val; - - _PL_get_arg(1, option, a); - if ( !PL_get_bool(a, &val) ) - return sgml2pl_error(ERR_TYPE, "boolean", a); - - set_option_dtd(p->dtd, OPT_SHORTTAG, val); - } else if ( PL_is_functor(option, FUNCTOR_number1) ) - { term_t a = PL_new_term_ref(); - char *s; - - _PL_get_arg(1, option, a); - if ( !PL_get_atom_chars(a, &s) ) - return sgml2pl_error(ERR_TYPE, "atom", a); - - if ( streq(s, "token") ) - p->dtd->number_mode = NU_TOKEN; - else if ( streq(s, "integer") ) - p->dtd->number_mode = NU_INTEGER; - else - return sgml2pl_error(ERR_DOMAIN, "number", a); - } else if ( PL_is_functor(option, FUNCTOR_encoding1) ) - { term_t a = PL_new_term_ref(); - char *val; - - _PL_get_arg(1, option, a); - if ( !PL_get_atom_chars(a, &val) ) - return sgml2pl_error(ERR_TYPE, "atom", a); - if ( !xml_set_encoding(p, val) ) - return sgml2pl_error(ERR_DOMAIN, "encoding", a); - } else if ( PL_is_functor(option, FUNCTOR_doctype1) ) - { term_t a = PL_new_term_ref(); - ichar *s; - - _PL_get_arg(1, option, a); - if ( PL_is_variable(a) ) - { p->enforce_outer_element = NULL; - } else - { if ( !PL_get_wchars(a, NULL, &s, CVT_ATOM) ) - return sgml2pl_error(ERR_TYPE, "atom_or_variable", a); - - p->enforce_outer_element = dtd_add_symbol(p->dtd, s); - } - } else if ( PL_is_functor(option, FUNCTOR_xmlns1) ) - { term_t a = PL_new_term_ref(); - ichar ns[1] = {0}; - ichar *uri; - - _PL_get_arg(1, option, a); - if ( !PL_get_wchars(a, NULL, &uri, CVT_ATOM|CVT_EXCEPTION) ) - return FALSE; - - xmlns_push(p, ns, uri); - } else if ( PL_is_functor(option, FUNCTOR_xmlns2) ) - { term_t a = PL_new_term_ref(); - ichar *ns, *uri; - - _PL_get_arg(1, option, a); - if ( !PL_get_wchars(a, NULL, &ns, CVT_ATOM|CVT_EXCEPTION) ) - return FALSE; - _PL_get_arg(2, option, a); - if ( !PL_get_wchars(a, NULL, &uri, CVT_ATOM|CVT_EXCEPTION) ) - return FALSE; - - xmlns_push(p, ns, uri); - } else - return sgml2pl_error(ERR_DOMAIN, "sgml_parser_option", option); - - return TRUE; -} - - -static dtd_srcloc * -file_location(dtd_parser *p, dtd_srcloc *l) -{ while(l->parent && l->type != IN_FILE) - l = l->parent; - - return l; -} - - -static foreign_t -pl_get_sgml_parser(term_t parser, term_t option) -{ dtd_parser *p; - - if ( !get_parser(parser, &p) ) - return FALSE; - - if ( PL_is_functor(option, FUNCTOR_charpos1) ) - { term_t a = PL_new_term_ref(); - - _PL_get_arg(1, option, a); - return PL_unify_integer(a, file_location(p, &p->startloc)->charpos); - } else if ( PL_is_functor(option, FUNCTOR_line1) ) - { term_t a = PL_new_term_ref(); - - _PL_get_arg(1, option, a); - return PL_unify_integer(a, file_location(p, &p->startloc)->line); - } else if ( PL_is_functor(option, FUNCTOR_charpos2) ) - { term_t a = PL_new_term_ref(); - - if ( PL_get_arg(1, option, a) && - PL_unify_integer(a, file_location(p, &p->startloc)->charpos) && - PL_get_arg(2, option, a) && - PL_unify_integer(a, file_location(p, &p->location)->charpos) ) - return TRUE; - else - return FALSE; - } else if ( PL_is_functor(option, FUNCTOR_file1) ) - { dtd_srcloc *l = file_location(p, &p->location); - - if ( l->type == IN_FILE && l->name.file ) - { term_t a = PL_new_term_ref(); - - _PL_get_arg(1, option, a); - return PL_unify_wchars(a, PL_ATOM, ENDSNUL, l->name.file); - } - } else if ( PL_is_functor(option, FUNCTOR_source1) ) - { parser_data *pd = p->closure; - - if ( pd && pd->magic == PD_MAGIC && pd->source ) - { term_t a = PL_new_term_ref(); - - _PL_get_arg(1, option, a); - return PL_unify_stream(a, pd->source); - } - } else if ( PL_is_functor(option, FUNCTOR_dialect1) ) - { term_t a = PL_new_term_ref(); - - _PL_get_arg(1, option, a); - switch(p->dtd->dialect) - { case DL_SGML: - return PL_unify_atom_chars(a, "sgml"); - case DL_XML: - return PL_unify_atom_chars(a, "xml"); - case DL_XMLNS: - return PL_unify_atom_chars(a, "xmlns"); - } - } else if ( PL_is_functor(option, FUNCTOR_event_class1) ) - { term_t a = PL_new_term_ref(); - - _PL_get_arg(1, option, a); - switch(p->event_class) - { case EV_EXPLICIT: - return PL_unify_atom_chars(a, "explicit"); - case EV_OMITTED: - return PL_unify_atom_chars(a, "omitted"); - case EV_SHORTTAG: - return PL_unify_atom_chars(a, "shorttag"); - case EV_SHORTREF: - return PL_unify_atom_chars(a, "shortref"); - } - } else if ( PL_is_functor(option, FUNCTOR_dtd1) ) - { term_t a = PL_new_term_ref(); - - _PL_get_arg(1, option, a); - - return unify_dtd(a, p->dtd); - } else if ( PL_is_functor(option, FUNCTOR_doctype1) ) - { term_t a = PL_new_term_ref(); - - _PL_get_arg(1, option, a); - if ( p->enforce_outer_element ) - return PL_unify_wchars(a, PL_ATOM, ENDSNUL, - p->enforce_outer_element->name); - else - return TRUE; /* leave variable */ - } else if ( PL_is_functor(option, FUNCTOR_allowed1) ) - { term_t tail, head, tmp; - sgml_environment *env = p->environments; - - if ( !(tail = PL_new_term_ref()) || - !(head = PL_new_term_ref()) || - !(tmp = PL_new_term_ref()) ) - return FALSE; - - _PL_get_arg(1, option, tail); - - if ( env ) - { for( ; env; env = env->parent) - { dtd_element *buf[256]; /* MAX_VISITED! */ - int n = sizeof(buf)/sizeof(dtd_element *); /* not yet used! */ - int i; - - state_allows_for(env->state, buf, &n); - - for(i=0; i<n; i++) - { int rc; - - if ( buf[i] == CDATA_ELEMENT ) - rc = PL_put_atom_chars(tmp, "#pcdata"); - else - rc = put_atom_wchars(tmp, buf[i]->name->name); - - if ( !rc || - !PL_unify_list(tail, head, tail) || - !PL_unify(head, tmp) ) - return FALSE; - } - - if ( !env->element->structure || - !env->element->structure->omit_close ) - break; - } - } else if ( p->enforce_outer_element ) - { put_atom_wchars(tmp, p->enforce_outer_element->name); - - if ( !PL_unify_list(tail, head, tail) || - !PL_unify(head, tmp) ) - return FALSE; - } - - return PL_unify_nil(tail); - } else if ( PL_is_functor(option, FUNCTOR_context1) ) - { term_t tail = PL_new_term_ref(); - term_t head = PL_new_term_ref(); - term_t tmp = PL_new_term_ref(); - sgml_environment *env = p->environments; - - _PL_get_arg(1, option, tail); - - for( ; env; env = env->parent) - { put_atom_wchars(tmp, env->element->name->name); - - if ( !PL_unify_list(tail, head, tail) || - !PL_unify(head, tmp) ) - return FALSE; - } - - return PL_unify_nil(tail); - } else - return sgml2pl_error(ERR_DOMAIN, "parser_option", option); - - return FALSE; -} - - -static int -call_prolog(parser_data *pd, predicate_t pred, term_t av) -{ qid_t qid = PL_open_query(NULL, PL_Q_PASS_EXCEPTION, pred, av); - int rc = PL_next_solution(qid); - - if ( !rc && PL_exception(qid) ) - pd->exception = TRUE; - else - pd->exception = FALSE; - - PL_close_query(qid); - - return rc; -} - - -static void -end_frame(fid_t fid, term_t ex) -{ if ( ex ) - PL_close_foreign_frame(fid); - else - PL_discard_foreign_frame(fid); -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -put_url(dtd_parser *p, term_t t, const ichar *url) - Store the url-part of a name-space qualifier in term. We call - xml:xmlns(-Canonical, +Full) trying to resolve the specified - namespace to an internal canonical namespace. - - We do a little caching as there will generally be only a very - small pool of urls in use. We assume the url-pointers we get - life for the time of the parser. It might be possible that - multiple url pointers point to the same url, but this only clobbers - the cache a little. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -#define URL_CACHE 4 /* # entries cached */ - -typedef struct -{ const ichar *url; /* URL pointer */ - atom_t canonical; -} url_cache; - -static url_cache cache[URL_CACHE]; - -static void -reset_url_cache() -{ int i; - url_cache *c = cache; - - for(i=0; i<URL_CACHE; i++) - { c[i].url = NULL; - if ( c[i].canonical ) - PL_unregister_atom(c[i].canonical); - c[i].canonical = 0; - } -} - - -WUNUSED static int -put_url(dtd_parser *p, term_t t, const ichar *url) -{ parser_data *pd = p->closure; - fid_t fid; - int i; - - if ( !pd->on_urlns ) - return put_atom_wchars(t, url); - - for(i=0; i<URL_CACHE; i++) - { if ( cache[i].url == url ) /* cache hit */ - { if ( cache[i].canonical ) /* and a canonical value */ - return PL_put_atom(t, cache[i].canonical); - else - return put_atom_wchars(t, url); - } - } - /* shift the cache */ - i = URL_CACHE-1; - if ( cache[i].canonical ) - PL_unregister_atom(cache[i].canonical); - for(i=URL_CACHE-1; i>0; i--) - cache[i] = cache[i-1]; - cache[0].url = url; - cache[0].canonical = 0; - - if ( (fid = PL_open_foreign_frame()) ) - { int rc; - term_t av = PL_new_term_refs(3); - atom_t a; - - rc = (put_atom_wchars(av+0, url) && - unify_parser(av+2, p)); - - if ( rc && - PL_call_predicate(NULL, PL_Q_NORMAL, pd->on_urlns, av) && - PL_get_atom(av+1, &a) ) - { PL_register_atom(a); - cache[0].canonical = a; - PL_put_atom(t, a); - } else if ( rc ) - { rc = put_atom_wchars(t, url); - } - PL_discard_foreign_frame(fid); - - return rc; - } - - return FALSE; -} - - -WUNUSED static int -put_attribute_name(dtd_parser *p, term_t t, dtd_symbol *nm) -{ const ichar *url, *local; - - if ( p->dtd->dialect == DL_XMLNS ) - { xmlns_resolve_attribute(p, nm, &local, &url); - - if ( url ) - { term_t av; - - return ( (av=PL_new_term_refs(2)) && - put_url(p, av+0, url) && - put_atom_wchars(av+1, local) && - PL_cons_functor_v(t, FUNCTOR_ns2, av) ); - } else - return put_atom_wchars(t, local); - } else - return put_atom_wchars(t, nm->name); -} - - -WUNUSED static int -put_element_name(dtd_parser *p, term_t t, dtd_element *e) -{ const ichar *url, *local; - - if ( p->dtd->dialect == DL_XMLNS ) - { assert(p->environments->element == e); - xmlns_resolve_element(p, &local, &url); - - if ( url ) - { term_t av; - - return ( (av=PL_new_term_refs(2)) && - put_url(p, av+0, url) && - put_atom_wchars(av+1, local) && - PL_cons_functor_v(t, FUNCTOR_ns2, av) ); - } else - return put_atom_wchars(t, local); - } else - return put_atom_wchars(t, e->name->name); -} - - -static ichar * -istrblank(const ichar *s) -{ for( ; *s; s++ ) - { if ( iswspace(*s) ) - return (ichar *)s; - } - - return NULL; -} - - -static int -unify_listval(dtd_parser *p, - term_t t, attrtype type, size_t len, const ichar *text) -{ if ( type == AT_NUMBERS && p->dtd->number_mode == NU_INTEGER ) - { wchar_t *e; - -#if SIZEOF_LONG == 4 && defined(HAVE_WCSTOLL) - int64_t v = wcstoll(text, &e, 10); - if ( (size_t)(e-text) == len && errno != ERANGE ) - return PL_unify_int64(t, v); -#else - long v = wcstol(text, &e, 10); - - if ( (size_t)(e-text) == len && errno != ERANGE ) - return PL_unify_integer(t, v); -#endif - /* TBD: Error!? */ - } - - return PL_unify_wchars(t, PL_ATOM, len, text); -} - - -static int -put_att_text(term_t t, sgml_attribute *a) -{ if ( a->value.textW ) - { PL_put_variable(t); - return PL_unify_wchars(t, PL_ATOM, a->value.number, a->value.textW); - } else - return FALSE; -} - - -static int -put_attribute_value(dtd_parser *p, term_t t, sgml_attribute *a) -{ switch(a->definition->type) - { case AT_CDATA: - return put_att_text(t, a); - case AT_NUMBER: - { if ( !put_att_text(t, a) ) - return PL_put_integer(t, a->value.number); - return TRUE; - } - default: /* multi-valued attribute */ - { if ( a->definition->islist && a->value.textW ) - { term_t tail, head; - const ichar *val = a->value.textW; - const ichar *e; - - PL_put_variable(t); - if ( !(head = PL_new_term_ref()) || - !(tail = PL_copy_term_ref(t)) ) - return FALSE; - - for(e=istrblank(val); e; val = e+1, e=istrblank(val)) - { if ( e == val ) - continue; /* skip spaces */ - if ( !PL_unify_list(tail, head, tail) || - !unify_listval(p, head, a->definition->type, e-val, val) ) - return FALSE; - } - - return ( PL_unify_list(tail, head, tail) && - unify_listval(p, head, a->definition->type, - istrlen(val), val) && - PL_unify_nil(tail) ); - } else - return put_att_text(t, a); - } - } -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Produce a tag-location in the format - - start_location=file:char-char -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -static int -put_tag_position(dtd_parser *p, term_t pos) -{ dtd_srcloc *l = &p->startloc; - - if ( l->type == IN_FILE && l->name.file ) - { PL_put_variable(pos); - return PL_unify_term(pos, - PL_FUNCTOR, FUNCTOR_ns2, - PL_NWCHARS, wcslen(l->name.file), l->name.file, - PL_FUNCTOR, FUNCTOR_minus2, - PL_LONG, l->charpos, - PL_LONG, p->location.charpos); - } - - return FALSE; -} - - - -static int -unify_attribute_list(dtd_parser *p, term_t alist, - int argc, sgml_attribute *argv) -{ int i; - term_t tail = PL_copy_term_ref(alist); - term_t h = PL_new_term_ref(); - term_t a = PL_new_term_refs(2); - parser_data *pd = p->closure; - - for(i=0; i<argc; i++) - { if ( !put_attribute_name(p, a+0, argv[i].definition->name) || - !put_attribute_value(p, a+1, &argv[i]) || - !PL_cons_functor_v(a, FUNCTOR_equal2, a) || - !PL_unify_list(tail, h, tail) || - !PL_unify(h, a) ) - return FALSE; - } - - if ( pd->positions && put_tag_position(p, a+1) ) - { PL_put_atom(a, ATOM_position); - - if ( !PL_cons_functor_v(a, FUNCTOR_equal2, a) || - !PL_unify_list(tail, h, tail) || - !PL_unify(h, a) ) - return FALSE; - } - - if ( PL_unify_nil(tail) ) - { PL_reset_term_refs(tail); - - return TRUE; - } - - return FALSE; -} - - - -static int -on_begin(dtd_parser *p, dtd_element *e, int argc, sgml_attribute *argv) -{ parser_data *pd = p->closure; - - if ( pd->stopped ) - return TRUE; - - if ( pd->tail ) - { term_t content = PL_new_term_ref(); /* element content */ - term_t alist = PL_new_term_ref(); /* attribute list */ - term_t et = PL_new_term_ref(); /* element structure */ - term_t h = PL_new_term_ref(); - - if ( !h || - !put_element_name(p, h, e) || - !unify_attribute_list(p, alist, argc, argv) || - !PL_unify_term(et, - PL_FUNCTOR, FUNCTOR_element3, - PL_TERM, h, - PL_TERM, alist, - PL_TERM, content) ) - { pd->exception = PL_exception(0); - return FALSE; - } - - if ( PL_unify_list(pd->tail, h, pd->tail) && - PL_unify(h, et) ) - { env *env = sgml_calloc(1, sizeof(*env)); - - env->tail = pd->tail; - env->parent = pd->stack; - pd->stack = env; - - pd->tail = content; - PL_reset_term_refs(alist); - - return TRUE; - } - - pd->exception = PL_exception(0); - return FALSE; - } - - if ( pd->on_begin ) - { fid_t fid; - - if ( (fid = PL_open_foreign_frame()) ) - { int rc; - term_t av = PL_new_term_refs(3); - - rc = ( put_element_name(p, av+0, e) && - unify_attribute_list(p, av+1, argc, argv) && - unify_parser(av+2, p) && - call_prolog(pd, pd->on_begin, av) - ); - - PL_discard_foreign_frame(fid); - if ( rc ) - return TRUE; - } - - pd->exception = PL_exception(0); - return FALSE; - } - - return TRUE; -} - - -static int -on_end(dtd_parser *p, dtd_element *e) -{ parser_data *pd = p->closure; - - if ( pd->stopped ) - return TRUE; - - if ( pd->on_end ) - { fid_t fid; - - if ( (fid = PL_open_foreign_frame()) ) - { int rc; - term_t av = PL_new_term_refs(2); - - rc = ( put_element_name(p, av+0, e) && - unify_parser(av+1, p) && - call_prolog(pd, pd->on_end, av) - ); - - PL_discard_foreign_frame(fid); - if ( rc ) - return TRUE; - } - - pd->exception = PL_exception(0); - return FALSE; - } - - if ( pd->tail && !pd->stopped ) - { if ( !PL_unify_nil(pd->tail) ) - return FALSE; - PL_reset_term_refs(pd->tail); /* ? */ - - if ( pd->stack ) - { env *parent = pd->stack->parent; - - pd->tail = pd->stack->tail; - sgml_free(pd->stack); - pd->stack = parent; - } else - { if ( pd->stopat == SA_CONTENT ) - pd->stopped = TRUE; - } - } - - if ( pd->stopat == SA_ELEMENT && !p->environments->parent ) - pd->stopped = TRUE; - - return TRUE; -} - - -static int -on_entity(dtd_parser *p, dtd_entity *e, int chr) -{ parser_data *pd = p->closure; - - if ( pd->stopped ) - return TRUE; - - if ( pd->on_entity ) - { fid_t fid; - - if ( (fid=PL_open_foreign_frame()) ) - { int rc; - term_t av = PL_new_term_refs(2); - - if ( e ) - rc = put_atom_wchars(av+0, e->name->name); - else - rc = PL_put_integer(av+0, chr); - - if ( rc ) - rc = ( unify_parser(av+1, p) && - call_prolog(pd, pd->on_end, av) - ); - - PL_discard_foreign_frame(fid); - if ( rc ) - return TRUE; - } - - pd->exception = PL_exception(0); - return FALSE; - } - - if ( pd->tail ) - { int rc; - term_t h = PL_new_term_ref(); - - if ( !h || - !PL_unify_list(pd->tail, h, pd->tail) ) - { pd->exception = PL_exception(0); - return FALSE; - } - - if ( e ) - rc = PL_unify_term(h, - PL_FUNCTOR, FUNCTOR_entity1, - PL_CHARS, e->name->name); - else - rc = PL_unify_term(h, - PL_FUNCTOR, FUNCTOR_entity1, - PL_INT, chr); - - PL_reset_term_refs(h); - if ( !rc ) - pd->exception = PL_exception(0); - - return rc; - } - - return TRUE; -} - - -static int -on_data(dtd_parser *p, data_type type, int len, const wchar_t *data) -{ parser_data *pd = p->closure; - - if ( pd->on_cdata ) - { fid_t fid; - - if ( (fid=PL_open_foreign_frame()) ) - { int rc; - term_t av = PL_new_term_refs(2); - - rc = ( PL_unify_wchars(av+0, PL_ATOM, len, data) && - unify_parser(av+1, p) && - call_prolog(pd, pd->on_cdata, av) ); - - PL_discard_foreign_frame(fid); - if ( rc ) - return TRUE; - } - - pd->exception = PL_exception(0); - return FALSE; - } - - if ( pd->tail && !pd->stopped ) - { term_t h = PL_new_term_ref(); - - if ( PL_unify_list(pd->tail, h, pd->tail) ) - { int rval = TRUE; - term_t a; - - switch(type) - { case EC_CDATA: - a = h; - break; - case EC_SDATA: - { term_t d = PL_new_term_ref(); - - a = d; - rval = PL_unify_term(h, PL_FUNCTOR, FUNCTOR_sdata1, PL_TERM, d); - break; - } - case EC_NDATA: - { term_t d = PL_new_term_ref(); - - a = d; - rval = PL_unify_term(h, PL_FUNCTOR, FUNCTOR_ndata1, PL_TERM, d); - break; - } - default: - rval = FALSE; - assert(0); - } - - if ( rval ) - rval = PL_unify_wchars(a, PL_ATOM, len, data); - - if ( rval ) - { PL_reset_term_refs(h); - return TRUE; - } else - { pd->exception = PL_exception(0); - } - } - } - - return FALSE; -} - - -static int -on_cdata(dtd_parser *p, data_type type, int len, const wchar_t *data) -{ return on_data(p, type, len, data); -} - - -static int -can_end_omitted(dtd_parser *p) -{ sgml_environment *env; - - for(env=p->environments; env; env = env->parent) - { dtd_element *e = env->element; - - if ( !(e->structure && e->structure->omit_close) ) - return FALSE; - } - - return TRUE; -} - - -static int -on_error(dtd_parser *p, dtd_error *error) -{ parser_data *pd = p->closure; - const char *severity; - - if ( pd->stopped ) - return TRUE; - - if ( pd->stopat == SA_ELEMENT && - (error->minor == ERC_NOT_OPEN || error->minor == ERC_NOT_ALLOWED) && - can_end_omitted(p) ) - { end_document_dtd_parser(p); - sgml_cplocation(&p->location, &p->startloc); - pd->stopped = TRUE; - return TRUE; - } - - switch(error->severity) - { case ERS_STYLE: - if ( pd->error_mode != EM_STYLE ) - return TRUE; - severity = "informational"; - break; - case ERS_WARNING: - pd->warnings++; - severity = "warning"; - break; - case ERS_ERROR: - default: /* make compiler happy */ - pd->errors++; - severity = "error"; - break; - } - - if ( pd->on_error ) /* msg, parser */ - { fid_t fid; - - if ( (fid=PL_open_foreign_frame()) ) - { int rc; - term_t av = PL_new_term_refs(3); - - rc = ( PL_put_atom_chars(av+0, severity) && - PL_unify_wchars(av+1, PL_ATOM, - wcslen(error->plain_message), - error->plain_message) && - unify_parser(av+2, p) && - call_prolog(pd, pd->on_error, av) - ); - PL_discard_foreign_frame(fid); - if ( rc ) - return TRUE; - } - pd->exception = PL_exception(0); - return FALSE; - } else if ( pd->error_mode != EM_QUIET ) - { fid_t fid; - - if ( (fid=PL_open_foreign_frame()) ) - { int rc; - predicate_t pred = PL_predicate("print_message", 2, "user"); - term_t av = PL_new_term_refs(2); - term_t src = PL_new_term_ref(); - term_t parser = PL_new_term_ref(); - dtd_srcloc *l = file_location(p, &p->startloc); - - rc = ( unify_parser(parser, p) && - PL_put_atom_chars(av+0, severity) ); - - if ( rc ) - { if ( l->name.file ) - { if ( l->type == IN_FILE ) - rc = put_atom_wchars(src, l->name.file); - else - rc = put_atom_wchars(src, l->name.entity); - } else - { PL_put_nil(src); - } - } - - if ( rc ) - rc = PL_unify_term(av+1, - PL_FUNCTOR_CHARS, "sgml", 4, - PL_TERM, parser, - PL_TERM, src, - PL_INT, l->line, - PL_NWCHARS, wcslen(error->plain_message), - error->plain_message); - - if ( rc ) - rc = PL_call_predicate(NULL, PL_Q_NODEBUG, pred, av); - - PL_discard_foreign_frame(fid); - if ( rc ) - return TRUE; - } - - pd->exception = PL_exception(0); - return FALSE; - } - - return TRUE; -} - - -static int -on_xmlns(dtd_parser *p, dtd_symbol *ns, dtd_symbol *url) -{ parser_data *pd = p->closure; - - if ( pd->stopped ) - return TRUE; - - if ( pd->on_xmlns ) - { fid_t fid; - term_t av; - - if ( (fid = PL_open_foreign_frame()) && - (av = PL_new_term_refs(3)) ) - { int rc; - - if ( ns ) - { rc = put_atom_wchars(av+0, ns->name); - } else - { PL_put_nil(av+0); - rc = TRUE; - } - - if ( rc ) - { rc = ( put_atom_wchars(av+1, url->name) && - unify_parser(av+2, p) && - call_prolog(pd, pd->on_xmlns, av) - ); - } - end_frame(fid, pd->exception); - PL_discard_foreign_frame(fid); - if ( rc ) - return TRUE; - } - - pd->exception = PL_exception(0); - return FALSE; - } - - return TRUE; -} - - -static int -on_pi(dtd_parser *p, const ichar *pi) -{ parser_data *pd = p->closure; - - if ( pd->stopped ) - return TRUE; - - if ( pd->on_pi ) - { fid_t fid; - - if ( (fid=PL_open_foreign_frame()) ) - { int rc; - term_t av = PL_new_term_refs(2); - - rc = ( put_atom_wchars(av+0, pi) && - unify_parser(av+1, p) && - call_prolog(pd, pd->on_pi, av) - ); - - PL_discard_foreign_frame(fid); - if ( rc ) - return TRUE; - } - - pd->exception = PL_exception(0); - return FALSE; - } - - if ( pd->tail ) - { term_t h; - - if ( !(h = PL_new_term_ref()) || - !PL_unify_list(pd->tail, h, pd->tail) ) - { pd->exception = PL_exception(0); - return FALSE; - } - - if ( !PL_unify_term(h, - PL_FUNCTOR, FUNCTOR_pi1, - PL_NWCHARS, wcslen(pi), pi) ) - { pd->exception = PL_exception(0); - return FALSE; - } - - PL_reset_term_refs(h); - } - - return TRUE; -} - - -static int -on_decl(dtd_parser *p, const ichar *decl) -{ parser_data *pd = p->closure; - - if ( pd->stopped ) - return TRUE; - - if ( pd->on_decl ) - { fid_t fid; - term_t av; - - if ( (fid = PL_open_foreign_frame()) && - (av = PL_new_term_refs(2)) ) - { int rc; - - rc = ( put_atom_wchars(av+0, decl) && - unify_parser(av+1, p) && - call_prolog(pd, pd->on_decl, av) - ); - end_frame(fid, pd->exception); - PL_discard_foreign_frame(fid); - if ( rc ) - return TRUE; - } - - pd->exception = PL_exception(0); - return FALSE; - } - - if ( pd->stopat == SA_DECL ) - pd->stopped = TRUE; - - return TRUE; -} - - -static int -write_parser(void *h, char *buf, int len) -{ parser_data *pd = h; - unsigned char *s = (unsigned char *)buf; - unsigned char *e = s+len; - - if ( !pd->parser || pd->parser->magic != SGML_PARSER_MAGIC ) - { errno = EINVAL; - return -1; - } - - if ( (pd->errors > pd->max_errors && pd->max_errors >= 0) || pd->stopped ) - { errno = EIO; - return -1; - } - - for(; s<e; s++) - { putchar_dtd_parser(pd->parser, *s); - if ( pd->exception ) - break; - } - - return len; -} - - -static int -close_parser(void *h) -{ parser_data *pd = h; - dtd_parser *p; - - if ( !(p=pd->parser) || p->magic != SGML_PARSER_MAGIC ) - { errno = EINVAL; - return -1; - } - - if ( pd->tail ) - { if ( !PL_unify_nil(pd->tail) ) - return -1; /* resource error */ - } - - if ( p->dmode == DM_DTD ) - p->dtd->implicit = FALSE; /* assume we loaded a DTD */ - - if ( pd->free_on_close ) - free_dtd_parser(p); - else - p->closure = NULL; - - sgml_free(pd); - - return 0; -} - - -static IOFUNCTIONS sgml_stream_functions = -{ (Sread_function) NULL, - (Swrite_function) write_parser, - (Sseek_function) NULL, - (Sclose_function) close_parser, - NULL -}; - - -static parser_data * -new_parser_data(dtd_parser *p) -{ parser_data *pd; - - pd = sgml_calloc(1, sizeof(*pd)); - pd->magic = PD_MAGIC; - pd->parser = p; - pd->max_errors = MAX_ERRORS; - pd->max_warnings = MAX_WARNINGS; - pd->error_mode = EM_PRINT; - pd->exception = FALSE; - p->closure = pd; - - return pd; -} - - -static foreign_t -pl_open_dtd(term_t ref, term_t options, term_t stream) -{ dtd *dtd; - dtd_parser *p; - parser_data *pd; - IOSTREAM *s; - term_t tail = PL_copy_term_ref(options); - term_t option = PL_new_term_ref(); - - if ( !get_dtd(ref, &dtd) ) - return FALSE; - p = new_dtd_parser(dtd); - p->dmode = DM_DTD; - pd = new_parser_data(p); - pd->free_on_close = TRUE; - - while( PL_get_list(tail, option, tail) ) - { if ( PL_is_functor(option, FUNCTOR_dialect1) ) - { term_t a = PL_new_term_ref(); - char *s; - - _PL_get_arg(1, option, a); - if ( !PL_get_atom_chars(a, &s) ) - return sgml2pl_error(ERR_TYPE, "atom", a); - - if ( streq(s, "xml") ) - set_dialect_dtd(dtd, DL_XML); - else if ( streq(s, "xmlns") ) - set_dialect_dtd(dtd, DL_XMLNS); - else if ( streq(s, "sgml") ) - set_dialect_dtd(dtd, DL_SGML); - else - return sgml2pl_error(ERR_DOMAIN, "sgml_dialect", a); - } else - return sgml2pl_error(ERR_DOMAIN, "dtd_option", option); - } - if ( !PL_get_nil(tail) ) - return sgml2pl_error(ERR_TYPE, "list", options); - - s = Snew(pd, SIO_OUTPUT|SIO_FBUF, &sgml_stream_functions); - - if ( !PL_open_stream(stream, s) ) - return FALSE; - - return TRUE; -} - - -static int -set_callback_predicates(parser_data *pd, term_t option) -{ term_t a = PL_new_term_ref(); - char *fname; - atom_t pname; - predicate_t *pp = NULL; /* keep compiler happy */ - int arity; - module_t m = NULL; - - _PL_get_arg(2, option, a); - PL_strip_module(a, &m, a); - if ( !PL_get_atom(a, &pname) ) - return sgml2pl_error(ERR_TYPE, "atom", a); - _PL_get_arg(1, option, a); - if ( !PL_get_atom_chars(a, &fname) ) - return sgml2pl_error(ERR_TYPE, "atom", a); - - if ( streq(fname, "begin") ) - { pp = &pd->on_begin; /* tag, attributes, parser */ - arity = 3; - } else if ( streq(fname, "end") ) - { pp = &pd->on_end; /* tag, parser */ - arity = 2; - } else if ( streq(fname, "cdata") ) - { pp = &pd->on_cdata; /* cdata, parser */ - arity = 2; - } else if ( streq(fname, "entity") ) - { pp = &pd->on_entity; /* name, parser */ - arity = 2; - } else if ( streq(fname, "pi") ) - { pp = &pd->on_pi; /* pi, parser */ - arity = 2; - } else if ( streq(fname, "xmlns") ) - { pp = &pd->on_xmlns; /* ns, url, parser */ - arity = 3; - } else if ( streq(fname, "urlns") ) - { pp = &pd->on_urlns; /* url, ns, parser */ - arity = 3; - } else if ( streq(fname, "error") ) - { pp = &pd->on_error; /* severity, message, parser */ - arity = 3; - } else if ( streq(fname, "decl") ) - { pp = &pd->on_decl; /* decl, parser */ - arity = 2; - } else - return sgml2pl_error(ERR_DOMAIN, "sgml_callback", a); - - *pp = PL_pred(PL_new_functor(pname, arity), m); - return TRUE; -} - - -static foreign_t -pl_sgml_parse(term_t parser, term_t options) -{ dtd_parser *p; - parser_data *pd; - parser_data *oldpd; - term_t head = PL_new_term_ref(); - term_t tail = PL_copy_term_ref(options); - IOSTREAM *in = NULL; - int recursive; - int has_content_length = FALSE; - int64_t content_length = 0; /* content_length(Len) */ - int count = 0; - int rc = TRUE; - - if ( !get_parser(parser, &p) ) - return FALSE; - - if ( p->closure ) /* recursive call */ - { recursive = TRUE; - - oldpd = p->closure; - if ( oldpd->magic != PD_MAGIC || oldpd->parser != p ) - return sgml2pl_error(ERR_MISC, "sgml", - "Parser associated with illegal data"); - - pd = sgml_calloc(1, sizeof(*pd)); - *pd = *oldpd; - p->closure = pd; - - in = pd->source; - } else - { recursive = FALSE; - oldpd = NULL; /* keep compiler happy */ - - set_mode_dtd_parser(p, DM_DATA); - - p->on_begin_element = on_begin; - p->on_end_element = on_end; - p->on_entity = on_entity; - p->on_pi = on_pi; - p->on_data = on_cdata; - p->on_error = on_error; - p->on_xmlns = on_xmlns; - p->on_decl = on_decl; - - pd = new_parser_data(p); - } - - while ( PL_get_list(tail, head, tail) ) - { if ( PL_is_functor(head, FUNCTOR_document1) ) - { pd->list = PL_new_term_ref(); - _PL_get_arg(1, head, pd->list); - pd->tail = PL_copy_term_ref(pd->list); - pd->stack = NULL; - } else if ( PL_is_functor(head, FUNCTOR_source1) ) - { term_t a = PL_new_term_ref(); - - _PL_get_arg(1, head, a); - if ( !PL_get_stream_handle(a, &in) ) - return FALSE; - } else if ( PL_is_functor(head, FUNCTOR_content_length1) ) - { term_t a = PL_new_term_ref(); - - _PL_get_arg(1, head, a); - if ( !PL_get_int64(a, &content_length) ) - return sgml2pl_error(ERR_TYPE, "integer", a); - has_content_length = TRUE; - } else if ( PL_is_functor(head, FUNCTOR_call2) ) - { if ( !set_callback_predicates(pd, head) ) - return FALSE; - } else if ( PL_is_functor(head, FUNCTOR_xml_no_ns1) ) - { term_t a = PL_new_term_ref(); - char *s; - - _PL_get_arg(1, head, a); - if ( !PL_get_atom_chars(a, &s) ) - return sgml2pl_error(ERR_TYPE, "atom", a); - if ( streq(s, "error") ) - p->xml_no_ns = NONS_ERROR; - else if ( streq(s, "quiet") ) - p->xml_no_ns = NONS_QUIET; - else - return sgml2pl_error(ERR_DOMAIN, "xml_no_ns", a); - } else if ( PL_is_functor(head, FUNCTOR_parse1) ) - { term_t a = PL_new_term_ref(); - char *s; - - _PL_get_arg(1, head, a); - if ( !PL_get_atom_chars(a, &s) ) - return sgml2pl_error(ERR_TYPE, "atom", a); - if ( streq(s, "element") ) - pd->stopat = SA_ELEMENT; - else if ( streq(s, "content") ) - pd->stopat = SA_CONTENT; - else if ( streq(s, "file") ) - pd->stopat = SA_FILE; - else if ( streq(s, "input") ) - pd->stopat = SA_INPUT; - else if ( streq(s, "declaration") ) - pd->stopat = SA_DECL; - else - return sgml2pl_error(ERR_DOMAIN, "parse", a); - } else if ( PL_is_functor(head, FUNCTOR_max_errors1) ) - { term_t a = PL_new_term_ref(); - - _PL_get_arg(1, head, a); - if ( !PL_get_integer(a, &pd->max_errors) ) - return sgml2pl_error(ERR_TYPE, "integer", a); - } else if ( PL_is_functor(head, FUNCTOR_syntax_errors1) ) - { term_t a = PL_new_term_ref(); - char *s; - - _PL_get_arg(1, head, a); - if ( !PL_get_atom_chars(a, &s) ) - return sgml2pl_error(ERR_TYPE, "atom", a); - - if ( streq(s, "quiet") ) - pd->error_mode = EM_QUIET; - else if ( streq(s, "print") ) - pd->error_mode = EM_PRINT; - else if ( streq(s, "style") ) - pd->error_mode = EM_STYLE; - else - return sgml2pl_error(ERR_DOMAIN, "syntax_error", a); - } else if ( PL_is_functor(head, FUNCTOR_positions1) ) - { term_t a = PL_new_term_ref(); - char *s; - - _PL_get_arg(1, head, a); - if ( !PL_get_atom_chars(a, &s) ) - return sgml2pl_error(ERR_TYPE, "atom", a); - - if ( streq(s, "true") ) - pd->positions = TRUE; - else if ( streq(s, "false") ) - pd->positions = FALSE; - else - return sgml2pl_error(ERR_DOMAIN, "positions", a); - } else - return sgml2pl_error(ERR_DOMAIN, "sgml_option", head); - } - if ( !PL_get_nil(tail) ) - return sgml2pl_error(ERR_TYPE, "list", tail); - - /* Parsing input from a stream */ -#define CHECKERROR \ - { if ( pd->exception ) \ - { rc = FALSE; \ - goto out; \ - } \ - if ( pd->errors > pd->max_errors && pd->max_errors >= 0 ) \ - { rc = sgml2pl_error(ERR_LIMIT, "max_errors", (long)pd->max_errors); \ - goto out; \ - } \ - } - - if ( pd->stopat == SA_CONTENT && p->empty_element ) - goto out; - - if ( in ) - { int eof = FALSE; - - if ( in->encoding == ENC_OCTET ) - p->encoded = TRUE; /* parser must decode */ - else - p->encoded = FALSE; /* already decoded */ - - if ( !recursive ) - { pd->source = in; - begin_document_dtd_parser(p); - } - - while(!eof) - { int c, ateof; - - if ( (++count % 8192) == 0 && PL_handle_signals() < 0 ) - { rc = FALSE; - goto out; - } - - if ( has_content_length ) - { if ( content_length <= 0 ) - c = EOF; - else - c = Sgetcode(in); - ateof = (--content_length <= 0); - } else - { c = Sgetcode(in); - ateof = Sfeof(in); - } - - if ( ateof ) - { eof = TRUE; - if ( c == LF ) /* file ends in LF */ - c = CR; - else if ( c != CR ) /* file ends in normal char */ - { if ( has_content_length && in->position ) - { int64_t bc0 = in->position->byteno; - putchar_dtd_parser(p, c); - content_length -= in->position->byteno-bc0; - } else - { putchar_dtd_parser(p, c); - } - CHECKERROR; - if ( pd->stopped ) - goto stopped; - c = CR; - } - } - - if ( has_content_length && in->position ) - { int64_t bc0 = in->position->byteno; - putchar_dtd_parser(p, c); - content_length -= in->position->byteno-bc0; - } else - { putchar_dtd_parser(p, c); - } - CHECKERROR; - if ( pd->stopped ) - { stopped: - pd->stopped = FALSE; - if ( pd->stopat != SA_CONTENT ) - reset_document_dtd_parser(p); /* ensure a clean start */ - goto out; - } - } - - if ( !recursive && pd->stopat != SA_INPUT ) - end_document_dtd_parser(p); - CHECKERROR; - - out: - reset_url_cache(); - if ( pd->tail ) - { if ( !PL_unify_nil(pd->tail) ) - return FALSE; - } - - if ( recursive ) - { p->closure = oldpd; - } else - { p->closure = NULL; - } - - pd->magic = 0; /* invalidate */ - sgml_free(pd); - - return rc; - } - - reset_url_cache(); - - return TRUE; -} - - - /******************************* - * DTD PROPERTIES * - *******************************/ - -static int put_model(term_t t, dtd_model *m) WUNUSED; - -/* doctype(DocType) */ - -static int -dtd_prop_doctype(dtd *dtd, term_t prop) -{ if ( dtd->doctype ) - return PL_unify_wchars(prop, PL_ATOM, ENDSNUL, dtd->doctype); - return FALSE; -} - - -/* elements(ListOfElements) */ - -WUNUSED static int -make_model_list(term_t t, dtd_model *m, functor_t f) -{ if ( !m->next ) - { return put_model(t, m); - } else - { term_t av; - - if ( (av=PL_new_term_refs(2)) && - put_model(av+0, m) && - make_model_list(av+1, m->next, f) && - PL_cons_functor_v(t, f, av) ) - { PL_reset_term_refs(av); - return TRUE; - } - - return FALSE; - } -} - - -WUNUSED static int -put_model(term_t t, dtd_model *m) -{ int rc = TRUE; - functor_t f; - - switch(m->type) - { case MT_PCDATA: - rc = PL_put_atom(t, ATOM_pcdata); - goto card; - case MT_ELEMENT: - rc = put_atom_wchars(t, m->content.element->name->name); - goto card; - case MT_AND: - f = FUNCTOR_and2; - break; - case MT_SEQ: - f = FUNCTOR_comma2; - break; - case MT_OR: - f = FUNCTOR_bar2; - break; - case MT_UNDEF: - default: - assert(0); - f = 0; - break; - } - - if ( rc ) - { if ( !m->content.group ) - rc = PL_put_atom(t, ATOM_empty); - else - rc = make_model_list(t, m->content.group, f); - } - -card: - if ( !rc ) - return FALSE; - - switch(m->cardinality) - { case MC_ONE: - break; - case MC_OPT: - rc = PL_cons_functor_v(t, FUNCTOR_opt1, t); - break; - case MC_REP: - rc = PL_cons_functor_v(t, FUNCTOR_rep1, t); - break; - case MC_PLUS: - rc = PL_cons_functor_v(t, FUNCTOR_plus1, t); - break; - } - - return rc; -} - - -WUNUSED static int -put_content(term_t t, dtd_edef *def) -{ switch(def->type) - { case C_EMPTY: - return PL_put_atom(t, ATOM_empty); - case C_CDATA: - return PL_put_atom(t, ATOM_cdata); - case C_RCDATA: - return PL_put_atom(t, ATOM_rcdata); - case C_ANY: - return PL_put_atom(t, ATOM_any); - default: - if ( def->content ) - return put_model(t, def->content); - - return TRUE; - } -} - - -static int -dtd_prop_elements(dtd *dtd, term_t prop) -{ term_t tail = PL_copy_term_ref(prop); - term_t head = PL_new_term_ref(); - term_t et = PL_new_term_ref(); - dtd_element *e; - - for( e=dtd->elements; e; e=e->next ) - { put_atom_wchars(et, e->name->name); - if ( !PL_unify_list(tail, head, tail) || - !PL_unify(head, et) ) - return FALSE; - } - - return PL_unify_nil(tail); -} - - -static int -get_element(dtd *dtd, term_t name, dtd_element **elem) -{ ichar *s; - dtd_element *e; - dtd_symbol *id; - - if ( !PL_get_wchars(name, NULL, &s, CVT_ATOM|CVT_EXCEPTION) ) - return FALSE; - - if ( !(id=dtd_find_symbol(dtd, s)) || - !(e=id->element) ) - return FALSE; - - *elem = e; - return TRUE; -} - - - - -static int -dtd_prop_element(dtd *dtd, term_t name, term_t omit, term_t content) -{ dtd_element *e; - dtd_edef *def; - term_t model = PL_new_term_ref(); - - if ( !get_element(dtd, name, &e) || !(def=e->structure) ) - return FALSE; - - if ( !PL_unify_term(omit, PL_FUNCTOR, FUNCTOR_omit2, - PL_ATOM, def->omit_open ? ATOM_true : ATOM_false, - PL_ATOM, def->omit_close ? ATOM_true : ATOM_false) ) - return FALSE; - - return ( put_content(model, def) && - PL_unify(content, model) ); -} - - -static int -dtd_prop_attributes(dtd *dtd, term_t ename, term_t atts) -{ dtd_element *e; - term_t tail = PL_copy_term_ref(atts); - term_t head = PL_new_term_ref(); - term_t elem = PL_new_term_ref(); - dtd_attr_list *al; - - if ( !get_element(dtd, ename, &e) ) - return FALSE; - - for(al=e->attributes; al; al=al->next) - { put_atom_wchars(elem, al->attribute->name->name); - - if ( !PL_unify_list(tail, head, tail) || - !PL_unify(head, elem) ) - return FALSE; - } - - return PL_unify_nil(tail); -} - - -typedef struct _plattrdef -{ attrtype type; /* AT_* */ - const char * name; /* name */ - int islist; /* list-type */ - atom_t atom; /* name as atom */ -} plattrdef; - -static plattrdef plattrs[] = -{ - { AT_CDATA, "cdata", FALSE }, - { AT_ENTITY, "entity", FALSE }, - { AT_ENTITIES, "entity", TRUE }, - { AT_ID, "id", FALSE }, - { AT_IDREF, "idref", FALSE }, - { AT_IDREFS, "idref", TRUE }, - { AT_NAME, "name", FALSE }, - { AT_NAMES, "name", TRUE }, -/*{ AT_NAMEOF, "nameof", FALSE },*/ - { AT_NMTOKEN, "nmtoken", FALSE }, - { AT_NMTOKENS, "nmtoken", TRUE }, - { AT_NUMBER, "number", FALSE }, - { AT_NUMBERS, "number", TRUE }, - { AT_NUTOKEN, "nutoken", FALSE }, - { AT_NUTOKENS, "nutoken", TRUE }, - { AT_NOTATION, "notation", FALSE }, - - { AT_CDATA, NULL, FALSE } -}; - - -static int -unify_attribute_type(term_t type, dtd_attr *a) -{ plattrdef *ad = plattrs; - - for( ; ad->name; ad++ ) - { if ( ad->type == a->type ) - { if ( !ad->atom ) - ad->atom = PL_new_atom(ad->name); - - if ( ad->islist ) - return PL_unify_term(type, PL_FUNCTOR, FUNCTOR_list1, - PL_ATOM, ad->atom); - else - return PL_unify_atom(type, ad->atom); - } - } - - if ( a->type == AT_NAMEOF || a->type == AT_NOTATION ) - { dtd_name_list *nl; - term_t tail, head, elem; - - if ( !(tail = PL_new_term_ref()) || - !(head = PL_new_term_ref()) || - !(elem = PL_new_term_ref()) || - !PL_unify_functor(type, - a->type == AT_NAMEOF ? - FUNCTOR_nameof1 : - FUNCTOR_notation1) ) - return FALSE; - - _PL_get_arg(1, type, tail); - - for(nl = a->typeex.nameof; nl; nl = nl->next) - { if ( !put_atom_wchars(elem, nl->value->name) || - !PL_unify_list(tail, head, tail) || - !PL_unify(head, elem) ) - return FALSE; - } - return PL_unify_nil(tail); - } - - assert(0); - return FALSE; -} - - - -static int -unify_attribute_default(term_t defval, dtd_attr *a) -{ int v; - - switch(a->def) - { case AT_REQUIRED: - return PL_unify_atom_chars(defval, "required"); - case AT_CURRENT: - return PL_unify_atom_chars(defval, "current"); - case AT_CONREF: - return PL_unify_atom_chars(defval, "conref"); - case AT_IMPLIED: - return PL_unify_atom_chars(defval, "implied"); - case AT_DEFAULT: - v = PL_unify_functor(defval, FUNCTOR_default1); - goto common; - case AT_FIXED: - v = PL_unify_functor(defval, FUNCTOR_fixed1); - common: - if ( v ) - { term_t tmp; - - if ( !(tmp=PL_new_term_ref()) ) - return FALSE; - - _PL_get_arg(1, defval, tmp); - switch( a->type ) - { case AT_CDATA: - return PL_unify_wchars(tmp, PL_ATOM, ENDSNUL, a->att_def.cdata); - case AT_NAME: - case AT_NMTOKEN: - case AT_NAMEOF: - case AT_NOTATION: - return PL_unify_wchars(tmp, PL_ATOM, ENDSNUL, a->att_def.name->name); - case AT_NUMBER: - return PL_unify_integer(tmp, a->att_def.number); - default: - assert(0); - } - } else - return FALSE; - default: - assert(0); - return FALSE; - } -} - - -static int -dtd_prop_attribute(dtd *dtd, term_t ename, term_t aname, - term_t type, term_t def_value) -{ dtd_element *e; - ichar *achars; - dtd_symbol *asym; - dtd_attr_list *al; - - - if ( !get_element(dtd, ename, &e) ) - return FALSE; - if ( !PL_get_wchars(aname, NULL, &achars, CVT_ATOM|CVT_EXCEPTION) ) - return FALSE; - if ( !(asym=dtd_find_symbol(dtd, achars)) ) - return FALSE; - - for(al=e->attributes; al; al=al->next) - { if ( al->attribute->name == asym ) - { if ( unify_attribute_type(type, al->attribute) && - unify_attribute_default(def_value, al->attribute) ) - return TRUE; - - return FALSE; - } - } - - return FALSE; -} - - -static int -dtd_prop_entities(dtd *dtd, term_t list) -{ term_t tail = PL_copy_term_ref(list); - term_t head = PL_new_term_ref(); - term_t et = PL_new_term_ref(); - dtd_entity *e; - - for( e=dtd->entities; e; e=e->next ) - { put_atom_wchars(et, e->name->name); - if ( !PL_unify_list(tail, head, tail) || - !PL_unify(head, et) ) - return FALSE; - } - - return PL_unify_nil(tail); -} - - -static int -dtd_prop_entity(dtd *dtd, term_t ename, term_t value) -{ ichar *s; - dtd_entity *e; - dtd_symbol *id; - - if ( !PL_get_wchars(ename, NULL, &s, CVT_ATOM|CVT_EXCEPTION) ) - return FALSE; - - if ( !(id=dtd_find_symbol(dtd, s)) || - !(e=id->entity) ) - return FALSE; - - switch(e->type) - { case ET_SYSTEM: - return PL_unify_term(value, PL_FUNCTOR_CHARS, "system", 1, - PL_CHARS, e->exturl); - case ET_PUBLIC: - if ( e->exturl ) - return PL_unify_term(value, PL_FUNCTOR_CHARS, "public", 2, - PL_CHARS, e->extid, - PL_CHARS, e->exturl); - else - return PL_unify_term(value, PL_FUNCTOR_CHARS, "public", 2, - PL_CHARS, e->extid, - PL_VARIABLE); - - case ET_LITERAL: - default: - if ( e->value ) - { const char *wrap; - - switch(e->content) - { case EC_SGML: wrap = "sgml"; break; - case EC_STARTTAG: wrap = "start_tag"; break; - case EC_ENDTAG: wrap = "end_tag"; break; - case EC_CDATA: wrap = NULL; break; - case EC_SDATA: wrap = "sdata"; break; - case EC_NDATA: wrap = "ndata"; break; - case EC_PI: wrap = "pi"; break; - default: wrap = NULL; assert(0); - } - - if ( wrap ) - return PL_unify_term(value, PL_FUNCTOR_CHARS, wrap, 1, - PL_CHARS, e->value); - else - return PL_unify_wchars(value, PL_ATOM, wcslen(e->value), e->value); - } - } - - assert(0); - return FALSE; -} - - -static int -dtd_prop_notations(dtd *dtd, term_t list) -{ dtd_notation *n; - term_t tail = PL_copy_term_ref(list); - term_t head = PL_new_term_ref(); - - for(n=dtd->notations; n; n=n->next) - { if ( PL_unify_list(tail, head, tail) && - PL_unify_wchars(head, PL_ATOM, wcslen(n->name->name), n->name->name) ) - continue; - - return FALSE; - } - - return PL_unify_nil(tail); -} - - -static int -dtd_prop_notation(dtd *dtd, term_t nname, term_t desc) -{ char *s; - dtd_symbol *id; - - if ( !PL_get_atom_chars(nname, &s) ) - return sgml2pl_error(ERR_TYPE, "atom", nname); - - if ( (id=dtd_find_symbol(dtd, (ichar *)s)) ) - { dtd_notation *n; - - for(n=dtd->notations; n; n=n->next) - { if ( n->name == id ) - { term_t tail = PL_copy_term_ref(desc); - term_t head = PL_new_term_ref(); - - if ( n->system ) - { if ( !PL_unify_list(tail, head, tail) || - !PL_unify_term(head, - PL_FUNCTOR_CHARS, "system", 1, - PL_CHARS, n->system) ) - return FALSE; - } - if ( n->public ) - { if ( !PL_unify_list(tail, head, tail) || - !PL_unify_term(head, - PL_FUNCTOR_CHARS, "public", 1, - PL_CHARS, n->public) ) - return FALSE; - } - - return PL_unify_nil(tail); - } - } - } - - return FALSE; -} - - - -typedef struct _prop -{ int (*func)(); - const char *name; - int arity; - functor_t functor; -} prop; - - -static prop dtd_props[] = -{ { dtd_prop_doctype, "doctype", 1 }, - { dtd_prop_elements, "elements", 1 }, - { dtd_prop_element, "element", 3 }, - { dtd_prop_attributes, "attributes", 2, }, - { dtd_prop_attribute, "attribute", 4, }, - { dtd_prop_entities, "entities", 1, }, - { dtd_prop_entity, "entity", 2, }, - { dtd_prop_notations, "notations", 1, }, - { dtd_prop_notation, "notation", 2, }, - { NULL } -}; - - -static void -initprops() -{ static int done = FALSE; - - if ( !done ) - { prop *p; - - done = TRUE; - for(p=dtd_props; p->func; p++) - p->functor = PL_new_functor(PL_new_atom(p->name), p->arity); - } -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -dtd_property(DTD, doctype(DocType)) -dtd_property(DTD, elements(ListOfNames)) -dtd_property(DTD, element(Name, Omit, Model)) -dtd_property(DTD, attributes(ElementName, ListOfAttributes)), -dtd_property(DTD, attribute(ElementName, AttributeName, Type, Default)) -dtd_property(DTD, entities(ListOfEntityNames)) -dtd_property(DTD, entity(Name, Type)) -dtd_property(DTD, notations(ListOfNotationNames) -dtd_property(DTD, notation(Name, File)) -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -static foreign_t -pl_dtd_property(term_t ref, term_t property) -{ dtd *dtd; - const prop *p; - - initprops(); - - if ( !get_dtd(ref, &dtd) ) - return FALSE; - - for(p=dtd_props; p->func; p++) - { if ( PL_is_functor(property, p->functor) ) - { term_t a = PL_new_term_refs(p->arity); - int i; - - for(i=0; i<p->arity; i++) - _PL_get_arg(i+1, property, a+i); - - switch(p->arity) - { case 1: - return (*p->func)(dtd, a+0); - case 2: - return (*p->func)(dtd, a+0, a+1); - case 3: - return (*p->func)(dtd, a+0, a+1, a+2); - case 4: - return (*p->func)(dtd, a+0, a+1, a+2, a+3); - default: - assert(0); - return FALSE; - } - } - } - - return sgml2pl_error(ERR_DOMAIN, "dtd_property", property); -} - - /******************************* - * CATALOG * - *******************************/ - -static foreign_t -pl_sgml_register_catalog_file(term_t file, term_t where) -{ wchar_t *fn; - char *w; - catalog_location loc; - - if ( !PL_get_wchars(file, NULL, &fn, CVT_ATOM|CVT_EXCEPTION) ) - return FALSE; - if ( !PL_get_atom_chars(where, &w) ) - return sgml2pl_error(ERR_TYPE, "atom", where); - - if ( streq(w, "start") ) - loc = CTL_START; - else if ( streq(w, "end") ) - loc = CTL_END; - else - return sgml2pl_error(ERR_DOMAIN, "location", where); - - return register_catalog_file(fn, loc); -} - - - /******************************* - * INSTALL * - *******************************/ - -extern install_t install_xml_quote(void); -#ifdef O_STATISTICS -extern void sgml_statistics(void); -#endif - -install_t -install() -{ initConstants(); - - init_ring(); - - PL_register_foreign("new_dtd", 2, pl_new_dtd, 0); - PL_register_foreign("free_dtd", 1, pl_free_dtd, 0); - PL_register_foreign("new_sgml_parser", 2, pl_new_sgml_parser, 0); - PL_register_foreign("free_sgml_parser", 1, pl_free_sgml_parser, 0); - PL_register_foreign("set_sgml_parser", 2, pl_set_sgml_parser, 0); - PL_register_foreign("get_sgml_parser", 2, pl_get_sgml_parser, 0); - PL_register_foreign("open_dtd", 3, pl_open_dtd, 0); - PL_register_foreign("sgml_parse", 2, pl_sgml_parse, - PL_FA_TRANSPARENT); - PL_register_foreign("_sgml_register_catalog_file", 2, - pl_sgml_register_catalog_file, 0); - - PL_register_foreign("$dtd_property", 2, pl_dtd_property, 0); - - install_xml_quote(); -#ifdef O_STATISTICS - atexit(sgml_statistics); -#endif -} - diff --git a/packages/sgml/sgml_mode.html b/packages/sgml/sgml_mode.html deleted file mode 100644 index 518b6e706..000000000 --- a/packages/sgml/sgml_mode.html +++ /dev/null @@ -1,115 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> - -<html> -<head> -<title>PceEmacs SGML mode</title> -</head> - -<body> -<h1>PceEmacs SGML mode</h1> - -<p> -This page describes the <em>PceEmacs</em> modes <b>SGML</b>, <b>HTML</b> and -<b>XML</b>. These modes are based on the -<a href="http://www.swi.psy.uva.nl/projects/SWI-Prolog">SWI-Prolog</a> -package sgml2pl, an SGML/XML parser for Prolog. It exploits this parser -to achieve both colouring syntax elements and errors as well as to -provided menu-driven editing of SGML, HTML and XML documents. - - -<h2>Syntax highlighting</h2> - -<p> -These PceEmacs modes are designed to be simple. Colouring uses the -following colours - -<p> -<table align=center border="2"> -<tr><td><font color="#0000ff"><tt><b>bold blue</b></tt></font> - <td>begin tag -<tr><td bgcolor="#e7e7e7"><font color="#0000ff"> - <tt><b>bold blue onlight-grey</b></tt> - </font> - <td>SGML SHORTREF expansion -<tr><td><font color="#0000ff"><tt>blue</tt></font> - <td>end tag -<tr><td><font color="#288a51">sea-green</font> - <td>CDATA declared content element -<tr><td bgcolor="#ffa600"><tt>orange</tt> - <td>warning -<tr><td bgcolor="#ff0000"><tt>red</tt> - <td>error -</table> - -<p> -Colouring the whole buffer is the only really safe colouring method, but -unfortunately doesn't scale with large files. Therefore, this mode is -only initiated after loading a file in this mode, after typing -<b>Control-L</b> (<b>recenter</b>) or after an explicit -<b>colourise_buffer</b> command. - -<p> -The more error-prone <b>colourise_element</b> is activated after many -commands as well as after an idle-period of 2 seconds. This command -searches backward to the first element that encloses the caret and then -colourises this element. It is errorprone for two reasons. First of -all, it does not validate whether the checked element itself is at a -valid location. Second, it does not see elements allowed throught the -DTD's <b>+(<i>Model</i>)</b> construct. - - -<h2>Errors and warnings</h2> - -<p> -Errors and warning encountered during parsing cause the suspect region -to be coloured <font color="#ffa600">orange</font> (warning) or <font -color="#ff0000">red</font> (error). Moving the caret in the suspect -area causes the error to be printed in the status line at the bottom -of the editor. - - -<h2>Syntax-guided editing</h2> - -<p> -Most syntax-guided editing is supported using a context-sensitive -popup-menu associated with the right mouse button. To create an -<b>new element</b>, press the right mouse-button at the desired location -and select the desired element. The modifier buttons define how -the element is inserted: - -<p> -<table align="center" border="2"> -<tr><td>control <td>Insert adjacent begin- and end-tag. -<tr><td>shift <td>Place begin- and end-tag each on their own line -<tr><td>alt <td>(SGML only) create a <b>SHORTTAG</b> element -</table> - -<p> -To <b>tag the current selection</b> with a tag, first make a selection and -then press the right mouse-button inside the selection. The same -modifiers as above apply. If no modifier is given, the default -is to place the tag at their own line of the selection contains -complete lines and `in-line' otherwise. - -<p> -To <b>add attributes</b> to an element, press the right-button inside the -elements begin-tag and select the desired elements. - - -<h2>Bugs and TODO</h2> - -<ul> -<li>Cache the parsed DTD -<li>Deal with included +(Group) elements properly -<li>Display total number of encountered errors and provide navigation - on large files -<li>Personalise layout: style to use for certain tags, syntax - highlighting, etc. -<li>Take are of already present attributes and elements. -</ul> - - - - -</body> -</html> diff --git a/packages/sgml/sgml_mode.pl b/packages/sgml/sgml_mode.pl deleted file mode 100644 index 02bd703a5..000000000 --- a/packages/sgml/sgml_mode.pl +++ /dev/null @@ -1,1081 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog - - Author: Jan Wielemaker - E-mail: jan@swi.psy.uva.nl - WWW: http://www.swi-prolog.org - Copyright (C): 1985-2002, University of Amsterdam - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - As a special exception, if you link this library with other files, - compiled with a Free Software compiler, to produce an executable, this - library does not by itself cause the resulting executable to be covered - by the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -:- module(emacs_sgml_mode, []). -:- use_module(library(pce)). -:- use_module(library(emacs_extend)). - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -This module exploits the SGML/XML parser from the SWI-Prolog package -sgml2pl to provide syntax colouring for SGML, XML and HTML modes. Based -on a true parser, we can provide much better feedback as heuristic -parsers used in most syntax-driven editors. For example, we can provide -feedback on SHORTREF matches in SGML mode by highlighting the tokens -acting as a short reference. We can also easily give the scope of -elements that are closed by omited elements. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -:- emacs_begin_mode(sgml, language, - "Mode for editing SGML documents", - % BINDINGS - [ open_document = button(sgml), - reload_dtd = button(sgml), - colourise_buffer = button(sgml), - colourise_and_recenter = key('\\C-l'), - tag_selection = key('\\e,'), - colourise_element = key('\\C-c\\C-s'), - forward_move_out = key('\\ee') - ], - % SYNTAX TABLE - [ '"' = string_quote('"'), - '\'' = string_quote('\''), - paragraph_end('\\s *$\\|^<p>\\|\\s +<') - ]). - -class_variable(auto_colourise_size_limit, int, 100000, - "Auto-colourise if buffer is smaller then this"). - -variable(dialect, - {sgml,xml,html}:=sgml, - both, - "?ML Dialect used to parse"). -variable(upcase_elements, - bool := @off, - both, - "Upcase inserted elements?"). -variable(parser, - prolog, - none, - "Associated (DTD) parser"). -variable(auto_colourise_size_limit, - int, - both, - "Auto-colourise if buffer is smaller then this"). - -% make_parser(M, Parser) -% -% Create a parser suitable for the current mode and load the DTD -% into it. - -make_parser(M, Parser) :- - get(M, dialect, Dialect), - get(M, text_buffer, TB), - get(TB, file, File), - get(File, name, FileName), - get(M, dialect, Dialect), - ( Dialect == html - -> TheDialect = sgml, - dtd(html, DTD), - Options = [dtd(DTD)] - ; TheDialect = Dialect, - Options = [] - ), - new_sgml_parser(Parser, Options), - set_sgml_parser(Parser, file(FileName)), - set_sgml_parser(Parser, dialect(TheDialect)). - - -% load_dtd(+Mode, +Parser) -% -% Load the document DTD into the given parser. - -load_dtd(M, _) :- - get(M, dialect, html), !. -load_dtd(M, Parser) :- - get(M, text_buffer, TB), - new(Re, regex('<!DOCTYPE', @off)), - ( send(Re, search, TB) - -> get(Re, register_start, Start), - pce_open(TB, read, In), - seek(In, Start, bof, _), - catch(sgml_parse(Parser, - [ source(In), - parse(declaration) - ]), - E, - show_message(M, E)), - close(In) - ; send(M, report, warning, 'No <!DOCTYPE declaration') - ). - - -parser(M, Reload:[bool], Parser:prolog) :<- - "Fetch the default parser":: - ( Reload \== @on, - get(M, slot, parser, Parser), - Parser = sgml_parser(_) - -> true - ; send(M, destroy_dtd), - make_parser(M, Parser), - load_dtd(M, Parser), - send(M, slot, parser, Parser), - set_sgml_parser(Parser, doctype(_)) % use for partial parsing - ). - - -dtd(M, Reload:[bool], DTD:prolog) :<- - "Fetch the current DTD":: - get(M, parser, Reload, Parser), - get_sgml_parser(Parser, dtd(DTD)). - - -reload_dtd(M) :-> - "Reload the DTD":: - get(M, dtd, _). - - -destroy_dtd(M) :-> - "Destroy the associated DTD object":: - ( get(M, slot, parser, Parser), - Parser = sgml_parser(_) - -> free_sgml_parser(Parser), - send(M, slot, parser, []) - ; true - ). - - - /******************************* - * INITIALISE * - *******************************/ - -setup_mode(E) :-> - "Switch editor into fill-mode":: - send(E, fill_mode, @on). - - -unlink(M) :-> - send(M, destroy_dtd), - send_super(M, unlink). - - -open_document(M, DT:doctype=name) :-> - "Insert <!DOCTYPE line":: - send(M, format, '<!DOCTYPE %s SYSTEM "">\n\n', DT), - send(M, backward_char, 4). - - - /******************************* - * HELP * - *******************************/ - -help_on_mode(M) :-> - ( absolute_file_name(sgml_mode, - [ extensions([html]), - access(read), - file_errors(fail) - ], - HTML) - -> atom_concat('file:', HTML, URI), - www_open_url(URI) - ; send(M, report, warning, 'Can''t find help file') - ). - - /******************************* - * RECOULOR POLICIES * - *******************************/ - -idle(M) :-> - "Idle event was received, colour the current element":: - send(M, colourise_element, @off). - -setup_styles(M) :-> - "Associate defined syntax-styles":: - ( get(M, attribute, styles_initialised, @on) - -> true - ; send(M, reload_styles), - send(M, attribute, styles_initialised, @on) - ). - -set_caret_and_inform(M) :-> - get(M, editor, Editor), - get(Editor?image, index, @event, Caret), - send(M, caret, Caret), - get(M?text_buffer, find_all_fragments, - message(@arg1, overlap, Caret), - Fragments), - send(Fragments, sort, ?(@arg1?length, compare, @arg2?length)), - get(Fragments, find, ?(@arg1, attribute, balloon), Frag), - get(Frag, balloon, Balloon), - send(M, report, warning, 'SGML warning: %s', Balloon). - -event(M, Ev:event) :-> - "Show insert-menu on right-down":: - send(Ev, is_a, ms_right_down), - ( get(M?image, index, Ev, I) - -> send(M, caret, I) - ; true - ), - send(M, show_menu, Ev). - -reload_styles(M) :-> - "Force reloading the styles":: - ( style_object(Name, Style), - send(M, style, Name, Style), - fail - ; true - ). - -colourise_element(M, Warn:[bool]) :-> - "Colour element at location":: - send(M, setup_styles), - get(M, caret, Caret), - get(M, text_buffer, TB), - new(Re, regex('<\\w+')), - make_parser(M, Parser), - load_dtd(M, Parser), - set_sgml_parser(Parser, doctype(_)), - pce_open(TB, read, In), - ( get(TB, scan, Caret, line, -2, start, Start), -% format('Starting from ~w~n', [Start]), - find_element(M, Parser, Re, In, Start, From-To), - Caret < To - -> send(M, remove_syntax_fragments, From, To), -% colour_item(element, TB, From, To), - seek(In, From, bof, _), - set_sgml_parser(Parser, charpos(From)), - colourise(M, Parser, - [ source(In), - parse(element) - ]) - ; Warn == @off - -> true - ; send(M, report, warning, 'Could not find element') - ), - close(In), - free_sgml_parser(Parser). - -% find_element(+Mode, +Parser, +BeginRegex, +In, +Caret, -From-To) -% -% Find the start and end of the current element. We do so by scanning -% backwards to '<\\w+' (Re). Then we parse the element and see where -% it ends. If this isn't passed the current caret location we look -% further backward. -% -% This predicate is non-deterministic, broadening the scope on -% backtracking. -% -% By asserting caret/1 before calling this predicate, it will -% assert a term element(Tag, Attributes, Start, End), where both -% locations are terms of the form loc(Class, Start, End) indicating -% the location and type of the begin- and end-tag. - -:- dynamic - caret/1, % Caret - element/4, % Tag, Attributes, Start, End - stack/5. % Tag, Attributes, Class, Fro, To - -set_caret(Caret) :- - retractall(caret(Caret)), - assert(caret(Caret)). - -unset_caret :- - retractall(caret(_)). - -find_element(M, Caret, Range) :- - get(M, parser, Parser), - get(M, text_buffer, TB), - pce_open(TB, read, In), - new(Re, regex('<\\w+')), - ( find_element(M, Parser, Re, In, Caret, Range) - -> close(In) - ; close(In), - fail - ). - -find_element(M, Parser, Re, In, Caret, Range) :- - get(M, text_buffer, TB), - send(Re, search, TB, Caret, 0), - get(Re, register_start, 0, Start0), - find_element(M, Parser, Re, In, Caret, Start0, Range). - -find_element(M, Parser, _Re, In, Caret, Start, Start-To) :- - \+ get(M?text_buffer, find_fragment, - and(message(@arg1, overlap, Start), - @arg1?parsed == @off), - _), - seek(In, Start, bof, _), - set_sgml_parser(Parser, charpos(Start)), - ( caret(_) - -> retractall(element(_,_,_,_)), - retractall(stack(_,_,_,_,_)), - Extra = [ call(begin, emacs_sgml_mode:find_on_begin), - call(end, emacs_sgml_mode:find_on_end) - ] - ; Extra = [] - ), - catch(sgml_parse(Parser, - [ source(In), - parse(element), - syntax_errors(quiet) - | Extra - ]), - E, - show_message(M, E)), - % charpos/1 yields start-position - get_sgml_parser(Parser, charpos(_, To)), -% format('Found ~d-~d~n', [Start, To]), - To-1 > Caret. -find_element(M, Parser, Re, In, Caret, Start0, Range) :- - get(M, text_buffer, TB), - send(Re, search, TB, Start0, 0), - get(Re, register_start, 0, Start1), - find_element(M, Parser, Re, In, Caret, Start1, Range). - -find_on_begin(Tag, Attributes, Parser) :- - get_sgml_parser(Parser, charpos(From, To)), - get_sgml_parser(Parser, event_class(Class)), -% format('BEGIN: ~w ~w-~w (~w)~n', [Tag, From, To, Class]), - asserta(stack(Tag, Attributes, Class, From, To)). -find_on_end(Tag, Parser) :- - get_sgml_parser(Parser, charpos(EFrom, ETo)), -% format('END: ~w ~w-~w~n', [Tag, EFrom, ETo]), - retract(stack(Tag, Attributes, BClass, BFrom, BTo)), - caret(Caret), - ( between(BFrom, ETo, Caret) - -> get_sgml_parser(Parser, event_class(EClass)), - ( element(_,_,_,_) - -> true - ; assert(element(Tag, Attributes, - loc(BClass, BFrom, BTo), - loc(EClass, EFrom, ETo))) - ) - ; true - ). - - - /******************************* - * COLOURISING * - *******************************/ - -colourise_and_recenter(M) :-> - "Colour according to syntax and recenter":: - send(M, auto_colourise_buffer), - send(M, recenter). - -colourise_buffer(M) :-> - OldTime is cputime, - new(Class, class(sgml_mode_fragment)), - get(Class, no_created, OldCreated), - - send(M, setup_styles), - send(M, remove_syntax_fragments), - send(M, report, progress, 'Colourising buffer ...'), - colourise_buffer(M), - Used is cputime - OldTime, - get(Class, no_created, NewCreated), - Created is NewCreated - OldCreated, - send(M, report, done, - 'done, %.2f seconds, %d fragments', Used, Created). - -:- dynamic - current_tb/2. - -colourise_buffer(M) :- - make_parser(M, Parser), - get(M, text_buffer, TB), - pce_open(TB, read, In), - colourise(M, Parser, - [ source(In) - ]), - free_sgml_parser(Parser). - -colourise(M, Parser, Options) :- - get_sgml_parser(Parser, file(File)), - get(M, text_buffer, TB), - asserta(current_tb(TB, File), Ref), - catch(sgml_parse(Parser, - [ call(begin, emacs_sgml_mode:on_begin), - call(end, emacs_sgml_mode:on_end), - call(cdata, emacs_sgml_mode:on_cdata), - call(decl, emacs_sgml_mode:on_decl), - call(error, emacs_sgml_mode:on_error) - | Options - ]), - E, - show_message(M, E)), - erase(Ref). - -on_begin(_Tag, _Attributes, Parser) :- - get_sgml_parser(Parser, file(File)), - current_tb(TB, File), -% format('Tag ~w, Attr = ~p~n', [Tag, Attributes]), - get_sgml_parser(Parser, charpos(From, To)), - get_sgml_parser(Parser, event_class(Class)), - Class \== omitted, - colour_item(tag(begin, Class), TB, From, To). -on_end(_Tag, Parser) :- - get_sgml_parser(Parser, file(File)), - current_tb(TB, File), - get_sgml_parser(Parser, charpos(From, To)), - get_sgml_parser(Parser, event_class(Class)), -% format('At ~d-~d: Class = ~w~n', [From, To, Class]), - Class \== omitted, - colour_item(tag(end, Class), TB, From, To). -on_cdata(_CDATA, Parser) :- - get_sgml_parser(Parser, file(File)), - current_tb(TB, File), - get_sgml_parser(Parser, charpos(From, To)), - ( get_sgml_parser(Parser, context([Tag|_])) - -> ( get_sgml_parser(Parser, dtd(DTD)), - dtd_property(DTD, element(Tag, _, Model)), - ( Model == cdata - ; Model == rcdata - ) - -> Type = cdata - ; Type = pcdata - ) - ), -% format('CDATA from ~d-~d~n', [From, To]), - colour_item(cdata(Type), TB, From, To, Fragment), - ( Type == cdata - -> send(Fragment, parsed, @off) - ; true - ). -on_decl(DECL, Parser) :- - get_sgml_parser(Parser, file(File)), - current_tb(TB, File), - get_sgml_parser(Parser, event_class(explicit)), - get_sgml_parser(Parser, charpos(From, To)), -% format('Decl ~d-~d: ~w~n', [From, To, DECL]), - ( DECL == '' - -> colour_item(comment, TB, From, To, Fragment), - send(Fragment, parsed, @off) - ; send(regex('DOCTYPE', @off), match, DECL) - -> colour_item(doctype, TB, From, To) - ; new(Re, regex('\\w*')), - send(Re, match, DECL), - get(Re, register_value, DECL, 0, name, DeclType0), - get(DeclType0, downcase, DeclType), -% format('Decl(~w)~n', [DeclType]), - colour_item(decl(DeclType), TB, From, To) - ). -on_error(Severity, Message, Parser) :- - current_tb(TB, File), - ( get_sgml_parser(Parser, file(File)) - -> get_sgml_parser(Parser, charpos(From, To)), - colour_item(error(Severity), TB, From, To, Fragment), - ( Fragment \== @nil - -> send(Fragment, message, Message), - send(Fragment, severity, Severity) - ; true - ) - ; format(user_error, 'SGML: Error in other file!~n', []) - ). - -% colour_item(+Class, +TB, +Pos) -% -% colourise region if a style is defined for this class. - -colour_item(Class, TB, From, To) :- - colour_item(Class, TB, From, To, _Fragment). - -colour_item(Class, TB, From, To, Fragment) :- - style_name(Class, Name), !, - Len is To - From, - Len > 0, - new(Fragment, sgml_mode_fragment(TB, From, Len, Name)). -colour_item(_, _, _, _, @nil). - - - /******************************* - * STYLES * - *******************************/ - -:- discontiguous - style_name/2, % +Pattern, -StyleName - style_object/2. % +Name, -Style - -term_expansion(style(Pattern, Style), - [ style_name(Pattern, Name), - style_object(Name, Style) - ]) :- - gensym(syntax_style_, Name). - -style(tag(begin, shortref), style(colour := blue, - background := grey90, - bold := @on)). -style(tag(begin, _), style(colour := blue, - bold := @on)). -style(tag(end, shorttag), style(colour := blue, - bold := @on)). -style(tag(end, shortref), style(colour := blue, - background := grey90, - bold := @on)). -style(tag(end, _), style(colour := blue)). -style(cdata(cdata), style(colour := sea_green)). -style(doctype, style(bold := @on)). -style(comment, style(colour := dark_green, - background := grey90)). -style(decl(_), style(colour := purple)). -style(error(warning), style(background := orange)). -style(error(_), style(background := red)). -style(entity, style(colour := dark_green)). -style(element, style(background := pale_turquoise)). - - - /******************************* - * TAGGING * - *******************************/ - -set_insert_point(M, Point:[int]) :-> - "Set mark at point if not set":: - get(M, mark, Mark), - ( Mark == 0 - -> ( Point == @default - -> send(M, mark, M?caret) - ; send(M, mark, Point) - ) - ; true - ). - -insert_begin(M, Tag:name) :-> - "Insert begin-tag and required attributes":: - fix_case(M, Tag, TheTag), - send(M, format, '<%s>', TheTag), - get(M, dtd, DTD), - findall(A, dtd_property(DTD, attribute(Tag, A, _, required)), List), - send(M, backward_char), - insert_attributes(List, M), - send(M, forward_char). - - -insert_attributes([], _). -insert_attributes([H|T], M) :- - send(M, format, ' %s=""', H), - send(M, set_insert_point, M?caret-1), - insert_attributes(T, M). - - -insert_end(M, Tag:name) :-> - "Insert end-tag for element":: - fix_case(M, Tag, TheTag), - send(M, format, '</%s>', TheTag). - - -fix_case(M, Tag, TheTag) :- - ( get(M, upcase_elements, @on) - -> get(Tag, upcase, TheTag) - ; TheTag = Tag - ). - - -style_for_event(Ev, Style) :- - ( send(Ev, has_modifier, c) - -> Style = inline - ; send(Ev, has_modifier, s) - -> Style = block - ; send(Ev, has_modifier, m) - -> Style = shorttag - ; Style = @default - ). - - -show_menu(M, Ev:event) :-> - "Show menu to insert-tag/tag selection":: - ( send(M, in_tag) - -> send(M, show_attribute_menu, Ev) - ; send(M, show_element_menu, Ev) - ). - - -in_tag(M) :-> - "Test whether caret is between <>":: - get(M, caret, Caret), - get(M, text_buffer, TB), - send(regex('<[^>]*'), match, TB, Caret, 0), - send(regex('[^<]*[>/]'), match, TB, Caret). % / for shortag - - -show_element_menu(M, Ev:event) :-> - "Show menu for inserting a new element":: - ( get(M, allowed_elements, List), - delete(List, '#pcdata', Elems), - Elems \== [], - sort(Elems, Sorted) - -> ( get(M, selection, point(A,B)), B > A - -> Label = tag_selection - ; Label = insert_element - ), - get(Ev, button, Button), - style_for_event(Ev, Style), - new(G, popup_gesture(new(P, popup(Label, - message(M, popup_tag_selection, - @arg1, Style))), - Button, new(modifier))), - send(P, show_label, @on), - length(Sorted, Len), - Cols is max(1, Len // 20), - send(P, columns, Cols), - send_list(P, append, Sorted), - send(G, event, Ev) - ; send(M, report, warning, 'No element allowed here') - ). - - -show_attribute_menu(M, Ev:event) :-> - "Show menu for adding attributes":: - get(M, caret, Caret), - get(M, text_buffer, TB), - new(Re, regex('<[^>]*')), - send(Re, match, TB, Caret, 0), - get(Re, register_start, 0, Start), - ( get(M, looking_at_element, Start, E) - -> make_parser(M, Parser), - load_dtd(M, Parser), - get_sgml_parser(Parser, dtd(DTD)), - dtd_property(DTD, attributes(E, Atts)), - ( Atts == [] - -> free_sgml_parser(Parser), - send(M, report, warning, 'Element "%s" has no attributes', E) - ; sort(Atts, Sorted), -% format('Atts = ~p~n', [Sorted]), - get(Ev, button, Button), - new(G, popup_gesture(new(P, popup(add_attribute, - message(M, insert_attribute, - @arg1))), - Button, - new(modifier))), - send(P, show_label, @on), - length(Sorted, Len), - Cols is max(1, Len // 10), - send(P, columns, Cols), - fill_attribute_menu(Sorted, DTD, E, P, M), - free_sgml_parser(Parser), - send(G, event, Ev) - ) - ; send(M, report, warning, 'Not in begin-tag') - ). - - -fill_attribute_menu([], _, _, _, _). -fill_attribute_menu([A|T], DTD, E, P, Mode) :- - dtd_property(DTD, attribute(E, A, Type, Default)), - add_attribute_menu(Type, Default, A, P, Mode), - fill_attribute_menu(T, DTD, E, P, Mode). - -add_attribute_menu(nameof(List), Def, A, P, Mode) :- !, - send(P, append, new(P2, popup(A, message(Mode, insert_attribute, - A, @arg1)))), - add_attribute_values(List, Def, P2). -add_attribute_menu(Type, Def, A, P, _Mode) :- !, - type_label(Type, TypeLabel), - send(P, append, new(MI, menu_item(A, @default, - string('%s (%s)', A, TypeLabel)))), - ( Def == required - -> send(MI, font, bold) - ; true - ). - -type_label(list(Type), Label) :- !, - atom_concat(Type, s, Label). -type_label(Type, Type). - -add_attribute_values([], _, _). -add_attribute_values([H|T], Def, P) :- - send(P, append, new(MI, menu_item(H))), - ( Def == default(H) - -> send(MI, font, bold) - ; true - ), - add_attribute_values(T, Def, P). - - -insert_attribute(M, Att:name, Val:'[name|int|real]') :-> - "Add attribute-value pair":: - get(M, text_buffer, TB), - get(M, caret, Caret), - new(Re, regex('\\(\\s +\\|[/>]\\)')), - send(Re, search, TB, Caret), % find place to insert - get(Re, register_start, 0, Where), - ( send(regex('\\s +'), match, TB, Where) - -> get(Re, register_end, 0, NewCaret), % after blanks - send(M, caret, NewCaret) - ; send(M, caret, Where), - send(M, format, ' ') - ), - ( Val == @default - -> send(M, format, '%s=""', Att), - get(M, caret, C), - ( send(M, looking_at, '\\s \\|[/>]') - -> true - ; send(M, format, ' ') - ), - send(M, caret, C-1) - ; send(M, format, '%s="%s"', Att, Val), - ( send(M, looking_at, '\\s \\|[/>]') - -> true - ; send(M, format, ' ') - ) - ), - send(M, mark_undo). % called from popup! - - -popup_tag_selection(M, Tag:name, Style0:[{inline,shorttag,block}]) :-> - "->tag_selection wrapper for popup":: - ( Style0 == @default - -> style_for_event(@event, Style) - ; Style = Style0 - ), - send(M, tag_selection, Tag, Style), - send(M, mark_undo). - - -tag_selection(M, Tag:[name], Style:[{inline,block,shorttag}]) :-> - "Tag the current selection using element":: - ( Tag == @default - -> new(TI, text_item(element)), - ( get(M, allowed_elements, List), -% format('Allowed: ~p~n', [List]), - delete(List, '#pcdata', Elems), - sort(Elems, Sorted) - -> send(TI, value_set, Sorted) - ; true - ), - get(M, prompt_using, TI, String), - get(String, value, TheTag) - ; TheTag = Tag - ), - ( get(M, selection, point(A,B)), - B > A - -> send(M, tag_region, TheTag, A, B, Style), - send(M, selection, 0, 0), - send(M, colourise_element) - ; send(M, insert_element, TheTag, Style) - ). - - -tag_region(M, Tag:[name], From:int, To:int, - Style:[{inline,block,shorttag}]) :-> - "Tag a defined region":: - fix_case(M, Tag, TheTag), - get(M, text_buffer, TB), - ( Style == shorttag - -> send(TB, insert, To, /), - send(TB, insert, From, string('<%s/', TheTag)) - ; Style == block - -> ( get(M, column, To, 0) - -> send(TB, insert, To, string('</%s>\n', TheTag)) - ; send(TB, insert, From, string('\n</%s>\n', TheTag)) - ), - ( get(M, column, From, 0) - -> send(TB, insert, From, string('<%s>\n', TheTag)) - ; send(TB, insert, From, string('\n<%s>\n', TheTag)) - ) - ; Style == inline - -> send(TB, insert, To, string('</%s>', TheTag)), - send(TB, insert, From, string('<%s>', TheTag)) - ; get(M, column, From, 0), - get(M, column, To, 0) - -> send(M, tag_region, Tag, From, To, block) - ; send(M, tag_region, Tag, From, To, inline) - ). - - -insert_element(M, Tag:element=name, Style:[{inline,shorttag,block}]) :-> - "Insert a new empty element":: - ( get(M, dtd, DTD), - dtd_property(DTD, element(Tag, Omit, Content)) - -> true - ; Omit = omit(false, false), - Content = '#pcdata' - ), - fix_case(M, Tag, TheTag), - send(M, prepare_insert), - send(M, mark, 0), % put insert position here - insert_by_style(Style, M, TheTag, Omit, Content, _), - send(M, colourise_element), - ( get(M, mark, Mark), - Mark > 0 - -> send(M, caret, Mark) - ; true - ). - -prepare_insert(M) :-> - "Find location to insert a new tag":: - get(M, caret, Caret), - ( find_element(M, Caret, From-_To) - -> get(M, looking_at_element, From, E), -% format('~p: Inserting in "~w" at ~w~n', [M, E, From]), - get(M, dtd, DTD), - dtd_property(DTD, element(E, _, Content)), - ( mixed_content(Content) - -> true - ; get(M, column, From, Col0), - Col is Col0+2, - get(M, text_buffer, TB), - get(TB, scan, Caret, line, 0, start, SOL), - ( new(Re, regex('\\s *')), - send(Re, match, TB, SOL, Caret), - get(Re, register_end, Caret) - -> true % at a blank line - ; send(M, newline) - ), - send(M, align_line, Col) - ) - ; true - ). - -insert_by_style(_, M, Tag, _, empty, End) :- !, - send(M, insert_begin, Tag), - ( get(M, dialect, xml) - -> send(M, backward_char), - send(M, format, /), - send(M, forward_char) - ; true - ), - get(M, caret, End). -insert_by_style(Style, M, Tag, _, Model, End) :- - required_content(Model, List), - ( mixed_content(Model) - -> def_style(Style, inline, TheStyle), - insert_by_style(TheStyle, M, Tag, End), - send(M, set_insert_point) - ; insert_by_style(block, M, Tag, End0), - get(M, text_buffer, TB), - new(Mark, fragment(TB, End0, 0)), - insert_sub_elements(List, M), - get(Mark, start, End), - free(Mark) - ). - -mixed_content(M) :- - term_member('#pcdata', M), !. - -term_member(X, X). -term_member(X, C) :- - compound(C), - arg(_, C, A), - term_member(X, A). - -insert_by_style(shorttag, M, Tag, End) :- !, - send(M, insert_begin, Tag), - send(M, backward_delete_char), - send(M, format, '//'), - get(M, caret, End), - send(M, backward_char). -insert_by_style(inline, M, Tag, End) :- !, - send(M, insert_begin, Tag), - get(M, caret, New), - send(M, insert_end, Tag), - get(M, caret, End), - send(M, caret, New). -insert_by_style(block, M, Tag, End) :- !, - send(M, insert_begin, Tag), - get(M, caret, Insert), - send(M, newline_and_indent), - send(M, insert_end, Tag), - get(M, caret, End), - send(M, caret, Insert). -insert_by_style(@default, M, Tag, End) :- - get(M, text_buffer, TB), - get(M, caret, Caret), - get(TB, scan, Caret, line, 0, start, SOL), - ( send(regex('\\s *$'), match, TB, SOL) - -> insert_by_style(block, M, Tag, End) - ; insert_by_style(inline, M, Tag, End) - ). - - -def_style(@default, Style, Style) :- !. -def_style(Style, _, Style). - -insert_sub_elements([], _). -insert_sub_elements([H|T], M) :- - send(M, format, ' '), - get(M, dtd, DTD), - dtd_property(DTD, element(H, Omit, Content)), - send(M, prepare_insert), - insert_by_style(@default, M, H, Omit, Content, End), - ( T == [] - -> true - ; send(M, caret, End), - insert_sub_elements(T, M) - ). - - -required_content(empty, []). -required_content(cdata, []). -required_content(Model, Elems) :- - phrase(required_content(Model), Elems). - -required_content((A,B)) --> !, - required_content(A), - required_content(B). -required_content(&(A,B)) --> !, - required_content(A), - required_content(B). -required_content('|'(_,_)) --> !, - []. -required_content(?(_)) --> - []. -required_content(*(_)) --> - []. -required_content(+(A)) --> - required_content(A). -required_content('#pcdata') --> !, - []. -required_content(A) --> - [A]. - - -looking_at_element(M, From:int, Elem:name) :<- - new(Re, regex('<\\([-_:a-zA-Z0-9]+\\)')), - get(M, text_buffer, TB), - send(Re, match, TB, From), - get(Re, register_value, TB, 1, name, Elem). - - -allowed_elements(M, Allowed:prolog) :<- - "Show elements allowed here":: - get(M, caret, Caret), - get(M, text_buffer, TB), - new(Re, regex('<\\w+')), - make_parser(M, Parser), - load_dtd(M, Parser), - get_sgml_parser(Parser, dtd(DTD)), - set_sgml_parser(Parser, doctype(_)), - pce_open(TB, read, In), - set_caret(Caret), - ( find_element(M, Parser, Re, In, Caret, From-_To), - get(M, looking_at_element, From, E), -% format('Looking at ~w~n', [E]), - ( dtd_property(DTD, doctype(E)) - ; dtd_property(DTD, element(E, omit(_, false), _)) - ) - -> unset_caret, - seek(In, From, bof, _), - set_sgml_parser(Parser, charpos(From)), - Len is Caret - From, - catch(sgml_parse(Parser, - [ goal(emacs_sgml_mode:feed(In, Len)), - syntax_errors(quiet), - parse(input) % do not complete document - ]), - E, - show_message(M, E)), - ( element(_,_,_,loc(explicit,_,_)) - -> format('End-tag available~n', []) - ; true - ), - get_sgml_parser(Parser, allowed(Allowed)) - ; unset_caret, - dtd_property(DTD, doctype(DocType)), - atom(DocType) - -> Allowed = [DocType] - ; send(M, report, warning, 'No current element'), - Allowed = [] - ), - close(In), - free_sgml_parser(Parser). - -feed(In, Len, Parser) :- - copy_stream_data(In, Parser, Len). - -report_allowed(M) :-> % DEBUGGING - "Report allowed elements at point":: - get(M, allowed_elements, Allowed), - atomic_list_concat(Allowed, ', ', Atom), - send(M, report, status, 'Allowed: %s', Atom). - -show_message(M, E) :- - message_to_string(E, String), - send(M, report, warning, 'Caught error: %s', String). - - - /******************************* - * MOVING AROUND * - *******************************/ - -forward_move_out(M) :-> - "Move forwards to end of current element":: - get(M, caret, Caret), - ( find_element(M, Caret, _From-To) - -> send(M, caret, To) - ; send(M, report, warning, 'Cannot find element') - ). - -:- emacs_end_mode. - - - - /******************************* - * XML * - *******************************/ - -:- emacs_begin_mode(xml, sgml, - "Mode for editing XML documents", - [], - []). - -initialise(M) :-> - send_super(M, initialise), - send(M, dialect, xml). - -open_document(M, DTD:doctype=name) :-> - "Insert document header":: - send(M, format, '<?xml version="1.0"?>\n'), - send_super(M, open_document, DTD). - -:- emacs_end_mode. - - - /******************************* - * HTML * - *******************************/ - -:- emacs_begin_mode(html, sgml, - "Mode for editing HTML documents", - [], - []). - -initialise(M) :-> - send_super(M, initialise), - send(M, dialect, html). - -open_document(M) :-> - "Insert document header":: - send(M, format, - '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">\n\n'), - send(M, insert_element, html). - -:- emacs_end_mode. - - - /******************************* - * FRAGMENT * - *******************************/ - -:- pce_begin_class(sgml_mode_fragment, emacs_colour_fragment, - "Provide colourised region"). - -variable(parsed, bool := @on, both, "@off for unparsed fragments"). - -:- pce_end_class. diff --git a/packages/sgml/sgml_write.pl b/packages/sgml/sgml_write.pl deleted file mode 100644 index d89736759..000000000 --- a/packages/sgml/sgml_write.pl +++ /dev/null @@ -1,819 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog - - Author: Jan Wielemaker & Richard O'Keefe - E-mail: wielemaker@science.uva.nl - WWW: http://www.swi-prolog.org - Copyright (C): 1985-2004, University of Amsterdam - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - As a special exception, if you link this library with other files, - compiled with a Free Software compiler, to produce an executable, this - library does not by itself cause the resulting executable to be covered - by the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -:- module(sgml_write, - [ html_write/2, % +Data, +Options - html_write/3, % +Stream, +Data, +Options - sgml_write/2, % +Data, +Options - sgml_write/3, % +Stream, +Data, +Options - xml_write/2, % +Data, +Options - xml_write/3 % +Stream, +Data, +Options - ]). -:- use_module(library(lists)). -:- use_module(library(sgml)). -:- use_module(library(debug)). -:- use_module(library(assoc)). -:- use_module(library(option)). -:- use_module(library(error)). - -/** <module> XML/SGML writer module - -This library provides the inverse functionality of the sgml.pl parser -library, writing XML, SGML and HTML documents from the parsed output. It -is intended to allow rewriting in a different dialect or encoding or to -perform document transformation in Prolog on the parsed representation. - -The current implementation is particularly keen on getting character -encoding and the use of character entities right. Some work has been -done providing layout, but space handling in XML and SGML make this a -very hazardous area. - -The Prolog-based low-level character and escape handling is the real -bottleneck in this library and will probably be moved to C in a later -stage. - -@see library(http/html_write) provides a high-level library for - emitting HTML and XHTML. -*/ - -%% xml_write(+Data, +Options) is det. -%% sgml_write(+Data, +Options) is det. -%% html_write(+Data, +Options) is det. -%% xml_write(+Stream, +Data, +Options) is det. -%% sgml_write(+Stream, +Data, +Options) is det. -%% html_write(+Stream, +Data, +Options) is det. -% -% Write a term as created by the SGML/XML parser to a stream in -% SGML or XML format. Options: -% -% * dtd(DTD) -% The DTD. This is needed for SGML documents that contain -% elements with content model EMPTY. Characters which may -% not be written directly in the Stream's encoding will be -% written using character data entities from the DTD if at -% all possible, otherwise as numeric character references. -% Note that the DTD will NOT be written out at all; as yet -% there is no way to write out an internal subset, though -% it would not be hard to add one. -% -% * doctype(DocType) -% Document type for the SGML document type declaration. -% If omitted it is taken from the root element. There is -% never any point in having this be disagree with the -% root element. A <!DOCTYPE> declaration will be written -% if and only if at least one of doctype(_), public(_), or -% system(_) is provided in Options. -% -% * public(PubId) -% The public identifier to be written in the <!DOCTYPE> line. -% -% * system(SysId) -% The system identifier to be written in the <!DOCTYPE> line. -% -% * header(Bool) -% If Bool is 'false', do not emit the <xml ...> header -% line. (xml_write/3 only) -% -% * nsmap(Map:list(Id=URI)) -% When emitting embedded XML, assume these namespaces -% are already defined from the environment. (xml_write/3 -% only). -% -% * indent(Indent) -% Indentation of the document (for embedding) -% -% * layout(Bool) -% Emit/do not emit layout characters to make output -% readable. -% -% * net(Bool) -% Use/do not use Null End Tags. -% For XML, this applies only to empty elements, so you get -% -% == -% <foo/> (default, net(true)) -% <foo></foo> (net(false)) -% == -% -% For SGML, this applies to empty elements, so you get -% -% == -% <foo> (if foo is declared to be EMPTY in the DTD) -% <foo></foo> (default, net(false)) -% <foo// (net(true)) -% == -% -% and also to elements with character content not containing / -% -% == -% <b>xxx</b> (default, net(false)) -% <b/xxx/ (net(true)). -% == -% -% Note that if the stream is UTF-8, the system will write special -% characters as UTF-8 sequences, while if it is ISO Latin-1 it -% will use (character) entities if there is a DTD that provides -% them, otherwise it will use numeric character references. - -xml_write(Data, Options) :- - current_output(Stream), - xml_write(Stream, Data, Options). - -xml_write(Stream0, Data, Options) :- - fix_user_stream(Stream0, Stream), - ( stream_property(Stream, encoding(text)) - -> set_stream(Stream, encoding(utf8)), - call_cleanup(xml_write(Stream, Data, Options), - set_stream(Stream, encoding(text))) - ; new_state(xml, State), - init_state(Options, State), - get_state(State, nsmap, NSMap), - add_missing_namespaces(Data, NSMap, Data1), - emit_xml_encoding(Stream, Options), - emit_doctype(Options, Data, Stream), - write_initial_indent(State, Stream), - emit(Data1, Stream, State) - ). - - -sgml_write(Data, Options) :- - current_output(Stream), - sgml_write(Stream, Data, Options). - -sgml_write(Stream0, Data, Options) :- - fix_user_stream(Stream0, Stream), - ( stream_property(Stream, encoding(text)) - -> set_stream(Stream, encoding(utf8)), - call_cleanup(sgml_write(Stream, Data, Options), - set_stream(Stream, encoding(text))) - ; new_state(sgml, State), - init_state(Options, State), - write_initial_indent(State, Stream), - emit_doctype(Options, Data, Stream), - emit(Data, Stream, State) - ). - - -html_write(Data, Options) :- - current_output(Stream), - html_write(Stream, Data, Options). - -html_write(Stream, Data, Options) :- - sgml_write(Stream, Data, - [ dtd(html) - | Options - ]). - -fix_user_stream(user, user_output) :- !. -fix_user_stream(Stream, Stream). - - -init_state([], _). -init_state([H|T], State) :- - update_state(H, State), - init_state(T, State). - -update_state(dtd(DTD), State) :- !, - ( atom(DTD) - -> dtd(DTD, DTDObj) - ; DTDObj = DTD - ), - set_state(State, dtd, DTDObj), - dtd_character_entities(DTDObj, EntityMap), - set_state(State, entity_map, EntityMap). -update_state(nsmap(Map), State) :- !, - set_state(State, nsmap, Map). -update_state(indent(Indent), State) :- !, - must_be(integer, Indent), - set_state(State, indent, Indent). -update_state(layout(Bool), State) :- !, - must_be(boolean, Bool), - set_state(State, layout, Bool). -update_state(doctype(_), _) :- !. -update_state(public(_), _) :- !. -update_state(system(_), _) :- !. -update_state(net(Bool), State) :- !, - must_be(boolean, Bool), - set_state(State, net, Bool). -update_state(header(Bool), _) :- !, - must_be(boolean, Bool). -update_state(Option, _) :- - domain_error(xml_write_option, Option). - -% emit_xml_encoding(+Stream, +Options) -% -% Emit the XML fileheader with encoding information. Setting the -% right encoding on the output stream must be done before calling -% xml_write/3. - -emit_xml_encoding(Out, Options) :- - option(header(Hdr), Options, true), - Hdr == true, !, - stream_property(Out, encoding(Encoding)), - ( ( Encoding == utf8 - ; Encoding == wchar_t - ) - -> format(Out, '<?xml version="1.0" encoding="UTF-8"?>~n~n', []) - ; Encoding == iso_latin_1 - -> format(Out, '<?xml version="1.0" encoding="ISO-8859-1"?>~n~n', []) - ; domain_error(xml_encoding, Encoding) - ). -emit_xml_encoding(_, _). - - -%% emit_doctype(+Options, +Data, +Stream) -% -% Emit the document-type declaration. -% There is a problem with the first clause if we are emitting SGML: -% the SGML DTDs for HTML up to HTML 4 *do not allow* any 'version' -% attribute; so the only time this is useful is when it is illegal! - -emit_doctype(_Options, Data, Out) :- - ( memberchk(element(html,Att,_), Data) - ; Data = element(html,Att,_) - ), - memberchk(version=Version, Att), - !, - format(Out, '<!DOCTYPE HTML PUBLIC "~w">~n~n', [Version]). -emit_doctype(Options, Data, Out) :- - ( memberchk(public(PubId), Options) -> true - ; PubId = (-) - ), - ( memberchk(system(SysId), Options) -> true - ; SysId = (-) - ), - \+ (PubId == (-), - SysId == (-), - \+ memberchk(doctype(_), Options) - ), - ( Data = element(DocType,_,_) - ; memberchk(element(DocType,_,_), Data) - ; memberchk(doctype(DocType), Options) - ), - !, - write_doctype(Out, DocType, PubId, SysId). -emit_doctype(_, _, _). - -write_doctype(Out, DocType, -, -) :- !, - format(Out, '<!DOCTYPE ~w []>~n~n', [DocType]). -write_doctype(Out, DocType, -, SysId) :- !, - format(Out, '<!DOCTYPE ~w SYSTEM "~w">~n~n', [DocType,SysId]). -write_doctype(Out, DocType, PubId, -) :- !, - format(Out, '<!DOCTYPE ~w PUBLIC "~w">~n~n', [DocType,PubId]). -write_doctype(Out, DocType, PubId, SysId) :- - format(Out, '<!DOCTYPE ~w PUBLIC "~w" "~w">~n~n', [DocType,PubId,SysId]). - - -%% emit(+Element, +Out, +State, +Options) -% -% Emit a single element - -emit([], _, _) :- !. -emit([H|T], Out, State) :- !, - emit(H, Out, State), - emit(T, Out, State). -emit(CDATA, Out, State) :- - atom(CDATA), !, - sgml_write_content(Out, CDATA, State). -emit(Element, Out, State) :- - \+ \+ emit_element(Element, Out, State). - -emit_element(pi(PI), Out, State) :- - get_state(State, entity_map, EntityMap), - write(Out, <?), - write_quoted(Out, PI, "", EntityMap), - ( get_state(State, dialect, xml) -> - write(Out, ?>) - ; write(Out, >) - ). -emit_element(element(Name, Attributes, Content), Out, State) :- - att_length(Attributes, State, Alen), - ( Alen > 60, - get_state(State, layout, true) - -> Sep = nl, - AttIndent = 4 - ; Sep = sp, - AttIndent = 0 - ), - ( get_state(State, dialect, xml) - -> update_nsmap(Attributes, State) - ; true - ), - put_char(Out, '<'), - emit_name(Name, Out, State), - ( AttIndent > 0 - -> \+ \+ ( inc_indent(State, AttIndent), - attributes(Attributes, Sep, Out, State) - ) - ; attributes(Attributes, Sep, Out, State) - ), - content(Content, Out, Name, State). - -attributes([], _, _, _). -attributes([H|T], Sep, Out, State) :- - ( Sep == nl - -> write_indent(State, Out) - ; put_char(Out, ' ') - ), - attribute(H, Out, State), - attributes(T, Sep, Out, State). - -attribute(Name=Value, Out, State) :- - emit_name(Name, Out, State), - put_char(Out, =), - sgml_write_attribute(Out, Value, State). - -att_length(Atts, State, Len) :- - att_length(Atts, State, 0, Len). - -att_length([], _, Len, Len). -att_length([A0|T], State, Len0, Len) :- - alen(A0, State, AL), - Len1 is Len0 + 1 + AL, - att_length(T, State, Len1, Len). - -alen(URI:Name=Value, State, Len) :- !, - atom_length(Value, AL), - vlen(Name, NL), - get_state(State, nsmap, Nsmap), - ( memberchk(NS=URI, Nsmap) - -> atom_length(NS, NsL) - ; atom_length(URI, NsL) - ), - Len is AL+NL+NsL+3. -alen(Name=Value, _, Len) :- - atom_length(Name, NL), - vlen(Value, AL), - Len is AL+NL+3. - -vlen(Value, Len) :- - is_list(Value), !, - vlen_list(Value, 0, Len). -vlen(Value, Len) :- - atom_length(Value, Len). - -vlen_list([], L, L). -vlen_list([H|T], L0, L) :- - atom_length(H, HL), - ( L0 == 0 - -> L1 is L0 + HL - ; L1 is L0 + HL + 1 - ), - vlen_list(T, L1, L). - - -emit_name(Name, Out, _) :- - atom(Name), !, - write(Out, Name). -emit_name(URI:Name, Out, State) :- - get_state(State, nsmap, NSMap), - memberchk(NS=URI, NSMap), !, - ( NS == [] - -> write(Out, Name) - ; format(Out, '~w:~w', [NS, Name]) - ). -emit_name(Term, Out, _) :- - write(Out, Term). - -%% update_nsmap(+Attributes, !State) -% -% Modify the nsmap of State to reflect modifications due to xmlns -% arguments. - -update_nsmap(Attributes, State) :- - get_state(State, nsmap, Map0), - update_nsmap(Attributes, Map0, Map), - set_state(State, nsmap, Map). - -update_nsmap([], Map, Map). -update_nsmap([xmlns:NS=URI|T], Map0, Map) :- !, - set_nsmap(NS, URI, Map0, Map1), - update_nsmap(T, Map1, Map). -update_nsmap([xmlns=URI|T], Map0, Map) :- !, - set_nsmap([], URI, Map0, Map1), - update_nsmap(T, Map1, Map). -update_nsmap([_|T], Map0, Map) :- !, - update_nsmap(T, Map0, Map). - -set_nsmap(NS, URI, Map0, Map) :- - select(NS=_, Map0, Map1), !, - Map = [NS=URI|Map1]. -set_nsmap(NS, URI, Map, [NS=URI|Map]). - - -%% content(+Content, +Out, +Element, +State, +Options) -% -% Emit the content part of a structure as well as the termination -% for the content. For empty content we have three versions: XML -% style '/>', SGML declared EMPTY element (nothing) or normal SGML -% element (we must close with the same element name). - -content([], Out, Element, State) :- !, % empty element - ( get_state(State, net, true) - -> ( get_state(State, dialect, xml) -> - write(Out, />) - ; empty_element(State, Element) -> - write(Out, >) - ; write(Out, //) - ) - ;/* get_state(State, net, false) */ - write(Out, >), - ( get_state(State, dialect, sgml), - empty_element(State, Element) - -> true - ; emit_close(Element, Out, State) - ) - ). -content([Atom], Out, Element, State) :- - atom(Atom), !, - ( get_state(State, dialect, sgml), - get_state(State, net, true), - \+ sub_atom(Atom, _, _, _, /), - atom_length(Atom, Len), - Len < 20 - -> write(Out, /), - sgml_write_content(Out, Atom, State), - write(Out, /) - ;/* XML or not NET */ - write(Out, >), - sgml_write_content(Out, Atom, State), - emit_close(Element, Out, State) - ). -content(Content, Out, Element, State) :- - get_state(State, layout, true), - /* If xml:space='preserve' is present, */ - /* we MUST NOT tamper with white space at all. */ - \+ (Element = element(_,Atts,_), - memberchk('xml:space'=preserve, Atts) - ), - element_content(Content, Elements), - !, - format(Out, >, []), - \+ \+ ( - inc_indent(State), - write_element_content(Elements, Out, State) - ), - write_indent(State, Out), - emit_close(Element, Out, State). -content(Content, Out, Element, State) :- - format(Out, >, []), - write_mixed_content(Content, Out, Element, State), - emit_close(Element, Out, State). - - -emit_close(Element, Out, State) :- - write(Out, '</'), - emit_name(Element, Out, State), - write(Out, '>'). - - -write_mixed_content([], _, _, _). -write_mixed_content([H|T], Out, Element, State) :- - write_mixed_content_element(H, Out, State), - write_mixed_content(T, Out, Element, State). - -write_mixed_content_element(H, Out, State) :- - ( atom(H) - -> sgml_write_content(Out, H, State) - ; functor(H, element, 3) - -> emit(H, Out, State) - ; functor(H, pi, 1) - -> emit(H, Out, State) - ; H = sdata(Data) % cannot be written without entity! - -> print_message(warning, sgml_write(sdata_as_cdata(Data))), - sgml_write_content(Out, Data, State) - ; assertion(fail) - ). - - -element_content([], []). -element_content([element(Name,Atts,C)|T0], [element(Name,Atts,C)|T]) :- !, - element_content(T0, T). -element_content([Blank|T0], T) :- - atom(Blank), - atom_codes(Blank, Codes), - all_blanks(Codes), - element_content(T0, T). - -all_blanks([]). -all_blanks([H|T]) :- - code_type(H, space), - all_blanks(T). - -write_element_content([], _, _). -write_element_content([H|T], Out, State) :- - write_indent(State, Out), - emit(H, Out, State), - write_element_content(T, Out, State). - - - /******************************* - * NAMESPACES * - *******************************/ - -%% add_missing_namespaces(+DOM0, +NsMap, -DOM) -% -% Add xmlns:NS=URI definitions to the toplevel element(s) to -% deal with missing namespaces. - -add_missing_namespaces([], _, []) :- !. -add_missing_namespaces([H0|T0], Def, [H|T]) :- !, - add_missing_namespaces(H0, Def, H), - add_missing_namespaces(T0, Def, T). -add_missing_namespaces(Elem0, Def, Elem) :- - Elem0 = element(Name, Atts0, Content), !, - missing_namespaces(Elem0, Def, Missing), - ( Missing == [] - -> Elem = Elem0 - ; add_missing_ns(Missing, Atts0, Atts), - Elem = element(Name, Atts, Content) - ). -add_missing_namespaces(DOM, _, DOM). % CDATA, etc. - -add_missing_ns([], Atts, Atts). -add_missing_ns([H|T], Atts0, Atts) :- - generate_ns(H, NS), - add_missing_ns(T, [xmlns:NS=H|Atts0], Atts). - -%% generate_ns(+URI, -NS) is det. -% -% Generate a namespace (NS) identifier for URI. - -generate_ns(URI, NS) :- - default_ns(URI, NS), !. -generate_ns(_, NS) :- - gensym(xns, NS). - -:- multifile - rdf_db:ns/2. - -default_ns('http://www.w3.org/2001/XMLSchema-instance', xsi). -default_ns('http://www.w3.org/1999/xhtml', xhtml). -default_ns(URI, NS) :- - rdf_db:ns(NS, URI). - -%% missing_namespaces(+DOM, +NSMap, -Missing) -% -% Return a list of URIs appearing in DOM that are not covered -% by xmlns definitions. - -missing_namespaces(DOM, Defined, Missing) :- - missing_namespaces(DOM, Defined, [], Missing). - -missing_namespaces([], _, L, L) :- !. -missing_namespaces([H|T], Def, L0, L) :- !, - missing_namespaces(H, Def, L0, L1), - missing_namespaces(T, Def, L1, L). -missing_namespaces(element(Name, Atts, Content), Def, L0, L) :- !, - update_nsmap(Atts, Def, Def1), - missing_ns(Name, Def1, L0, L1), - missing_att_ns(Atts, Def1, L1, L2), - missing_namespaces(Content, Def1, L2, L). -missing_namespaces(_, _, L, L). - -missing_att_ns([], _, M, M). -missing_att_ns([Name=_|T], Def, M0, M) :- - missing_ns(Name, Def, M0, M1), - missing_att_ns(T, Def, M1, M). - -missing_ns(URI:_, Def, M0, M) :- !, - ( ( memberchk(_=URI, Def) - ; memberchk(URI, M0) - ; URI = xml % predefined ones - ; URI = xmlns - ) - -> M = M0 - ; M = [URI|M0] - ). -missing_ns(_, _, M, M). - - /******************************* - * QUOTED WRITE * - *******************************/ - -sgml_write_attribute(Out, Values, State) :- - is_list(Values), !, - get_state(State, entity_map, EntityMap), - put_char(Out, '"'), - write_quoted_list(Values, Out, """<&>", EntityMap), - put_char(Out, '"'). -sgml_write_attribute(Out, Value, State) :- - get_state(State, entity_map, EntityMap), - put_char(Out, '"'), - write_quoted(Out, Value, """<&>", EntityMap), - put_char(Out, '"'). - -write_quoted_list([], _, _, _). -write_quoted_list([H|T], Out, Escape, EntityMap) :- - write_quoted(Out, H, Escape, EntityMap), - ( T == [] - -> true - ; put_char(Out, ' '), - write_quoted_list(T, Out, Escape, EntityMap) - ). - - -sgml_write_content(Out, Value, State) :- - get_state(State, entity_map, EntityMap), - write_quoted(Out, Value, "<&>", EntityMap). - - -write_quoted(Out, Atom, Escape, EntityMap) :- - atom_codes(Atom, Codes), - writeq(Codes, Out, Escape, EntityMap). - - -writeq([], _, _, _). -writeq([H|T], Out, Escape, EntityMap) :- - ( memberchk(H, Escape) - -> write_entity(H, Out, EntityMap) - ; H >= 256 - -> ( stream_property(Out, encoding(Enc)), - unicode_encoding(Enc) - -> put_code(Out, H) - ; write_entity(H, Out, EntityMap) - ) - ; put_code(Out, H) - ), - writeq(T, Out, Escape, EntityMap). - -unicode_encoding(utf8). -unicode_encoding(wchar_t). -unicode_encoding(unicode_le). -unicode_encoding(unicode_be). - -write_entity(Code, Out, EntityMap) :- - ( get_assoc(Code, EntityMap, EntityName) - -> format(Out, '&~w;', [EntityName]) - ; format(Out, '&#~w;', [Code]) - ). - - - /******************************* - * INDENTATION * - *******************************/ - -write_initial_indent(State, Out) :- - ( get_state(State, indent, Indent), - Indent > 0 - -> emit_indent(Indent, Out) - ; true - ). - -write_indent(State, _) :- - get_state(State, layout, false), !. -write_indent(State, Out) :- - get_state(State, indent, Indent), - emit_indent(Indent, Out). - -emit_indent(Indent, Out) :- - Tabs is Indent // 8, - Spaces is Indent mod 8, - format(Out, '~N', []), - write_n(Tabs, '\t', Out), - write_n(Spaces, ' ', Out). - -write_n(N, Char, Out) :- - ( N > 0 - -> put_char(Out, Char), - N2 is N - 1, - write_n(N2, Char, Out) - ; true - ). - -inc_indent(State) :- - inc_indent(State, 2). - -inc_indent(State, Inc) :- - state(indent, Arg), - arg(Arg, State, I0), - I is I0 + Inc, - setarg(Arg, State, I). - - - /******************************* - * DTD HANDLING * - *******************************/ - -%% empty_element(+State, +Element) -% -% True if Element is declared with EMPTY content in the (SGML) -% DTD. - -empty_element(State, Element) :- - get_state(State, dtd, DTD), - DTD \== (-), - dtd_property(DTD, element(Element, _, empty)). - -%% dtd_character_entities(+DTD, -Map) -% -% Return an assoc mapping character entities to their name. Note -% that the entity representation is a bit dubious. Entities should -% allow for a wide-character version and avoid the &#..; trick. - -dtd_character_entities(DTD, Map) :- - empty_assoc(Empty), - dtd_property(DTD, entities(Entities)), - fill_entity_map(Entities, DTD, Empty, Map). - -fill_entity_map([], _, Map, Map). -fill_entity_map([H|T], DTD, Map0, Map) :- - ( dtd_property(DTD, entity(H, CharEntity)), - atom(CharEntity), - ( sub_atom(CharEntity, 0, _, _, '&#'), - sub_atom(CharEntity, _, _, 0, ';') - -> sub_atom(CharEntity, 2, _, 1, Name), - atom_number(Name, Code) - ; atom_length(CharEntity, 1), - char_code(CharEntity, Code) - ) - -> put_assoc(Code, Map0, H, Map1), - fill_entity_map(T, DTD, Map1, Map) - ; fill_entity_map(T, DTD, Map0, Map) - ). - - - - /******************************* - * FIELDS * - *******************************/ - -state(indent, 1). % current indentation -state(layout, 2). % use layout (true/false) -state(dtd, 3). % DTD for entity names -state(entity_map, 4). % compiled entity-map -state(dialect, 5). % xml/sgml -state(nsmap, 6). % defined namespaces -state(net, 7). % Should null end-tags be used? - -new_state(Dialect, - state( - 0, % indent - true, % layout - -, % DTD - EntityMap, % entity_map - Dialect, % dialect - [], % NS=Full map - Net % Null End-Tags? - )) :- - ( Dialect == sgml - -> Net = false, - empty_assoc(EntityMap) - ; Net = true, - xml_entities(EntityMap) - ). - -get_state(State, Field, Value) :- - state(Field, Arg), - arg(Arg, State, Value). - -set_state(State, Field, Value) :- - state(Field, Arg), - setarg(Arg, State, Value). - -xml_entities(Map) :- - list_to_assoc([ 60 - lt, - 61 - amp, - 62 - gt, - 39 - apos, - 34 - quot - ], Map). - - - /******************************* - * MESSAGES * - *******************************/ - -:- multifile - prolog:message/3. - -prolog:message(sgml_write(sdata_as_cdata(Data))) --> - [ 'SGML-write: emitting SDATA as CDATA: "~p"'-[Data] ]. diff --git a/packages/sgml/sgmldefs.h b/packages/sgml/sgmldefs.h deleted file mode 100644 index 9b0879b25..000000000 --- a/packages/sgml/sgmldefs.h +++ /dev/null @@ -1,85 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog - - Author: Jan Wielemaker - E-mail: jan@swi.psy.uva.nl - WWW: http://www.swi-prolog.org - Copyright (C): 1985-2002, University of Amsterdam - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef SGMLDEFS_H_INCLUDED -#define SGMLDEFS_H_INCLUDED - -#ifdef HAVE_CONFIG_H -#include <config.h> -#else -#ifdef __WINDOWS__ -#define HAVE_MALLOC_H 1 -#define HAVE_IO_H 1 -#endif -#endif - -#ifdef HAVE_DMALLOC_H -#include <dmalloc.h> -#endif - -#define UTF8 1 /* Include UTF-8 decoding */ -#define XMLNS 1 /* support XML namespaces */ - -#include <wchar.h> - - /******************************* - * INPUT/OUTPUT CHARACTERS * - *******************************/ - -typedef wchar_t ichar; /* input character */ - -#define SHORTMAP_SIZE 256 /* shortmaps in 0..255 */ - -#define USE_STRING_FUNCTIONS 1 /* use built-in str* functions */ - - - /******************************* - * LIMITS * - *******************************/ - -#define INPUT_CHARSET_SIZE 256 /* for now */ -#define SYMBOLHASHSIZE 256 -#define MAXSTRINGLEN 2048 -#define MAXNMLEN 256 -#define MAXDECL 10240 -#define MAXATTELEM 256 /* #elements in one ATTLIST */ -#define MAXNAMEGROUP 256 /* #names in a (group) */ -#define MAXATTRIBUTES 256 /* attributes per element */ -#define MAXMAPLEN 32 /* max sequence length for SHORTREF */ -#define SHORTENTITYFILE 100 /* short external entities in mem */ - - - /******************************* - * CONSTANTS * - *******************************/ - -#ifndef TRUE -#define TRUE 1 -#define FALSE 0 -#endif - -#define LF 10 -#define CR 13 - -#endif /*SGMLDEFS_H_INCLUDED*/ diff --git a/packages/sgml/utf8.c b/packages/sgml/utf8.c deleted file mode 100644 index 68e90143e..000000000 --- a/packages/sgml/utf8.c +++ /dev/null @@ -1,117 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog - - Author: Jan Wielemaker - E-mail: jan@swi.psy.uva.nl - WWW: http://www.swi-prolog.org - Copyright (C): 1985-2002, University of Amsterdam - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include <stdio.h> -#include "utf8.h" - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -UTF-8 Decoding, based on http://www.cl.cam.ac.uk/~mgk25/unicode.html -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -#define CONT(i) ((in[i]&0xc0) == 0x80) -#define VAL(i, s) ((in[i]&0x3f) << s) - -char * -sgml__utf8_get_char(const char *in, int *chr) -{ /* 2-byte, 0x80-0x7ff */ - if ( (in[0]&0xe0) == 0xc0 && CONT(1) ) - { *chr = ((in[0]&0x1f) << 6)|VAL(1,0); - return (char *)in+2; - } - /* 3-byte, 0x800-0xffff */ - if ( (in[0]&0xf0) == 0xe0 && CONT(1) && CONT(2) ) - { *chr = ((in[0]&0xf) << 12)|VAL(1,6)|VAL(2,0); - return (char *)in+3; - } - /* 4-byte, 0x10000-0x1FFFFF */ - if ( (in[0]&0xf8) == 0xf0 && CONT(1) && CONT(2) && CONT(3) ) - { *chr = ((in[0]&0x7) << 18)|VAL(1,12)|VAL(2,6)|VAL(3,0); - return (char *)in+4; - } - /* 5-byte, 0x200000-0x3FFFFFF */ - if ( (in[0]&0xfc) == 0xf8 && CONT(1) && CONT(2) && CONT(3) && CONT(4) ) - { *chr = ((in[0]&0x3) << 24)|VAL(1,18)|VAL(2,12)|VAL(3,6)|VAL(4,0); - return (char *)in+5; - } - /* 6-byte, 0x400000-0x7FFFFFF */ - if ( (in[0]&0xfe) == 0xfc && CONT(1) && CONT(2) && CONT(3) && CONT(4) && CONT(5) ) - { *chr = ((in[0]&0x1) << 30)|VAL(1,24)|VAL(2,18)|VAL(3,12)|VAL(4,6)|VAL(5,0); - return (char *)in+4; - } - - *chr = *in; - - return (char *)in+1; -} - - -char * -sgml_utf8_put_char(char *out, int chr) -{ if ( chr < 0x80 ) - { *out++ = chr; - } else if ( chr < 0x800 ) - { *out++ = 0xc0|((chr>>6)&0x1f); - *out++ = 0x80|(chr&0x3f); - } else if ( chr < 0x10000 ) - { *out++ = 0xe0|((chr>>12)&0x0f); - *out++ = 0x80|((chr>>6)&0x3f); - *out++ = 0x80|(chr&0x3f); - } else if ( chr < 0x200000 ) - { *out++ = 0xf0|((chr>>18)&0x07); - *out++ = 0x80|((chr>>12)&0x3f); - *out++ = 0x80|((chr>>6)&0x3f); - *out++ = 0x80|(chr&0x3f); - } else if ( chr < 0x4000000 ) - { *out++ = 0xf8|((chr>>24)&0x03); - *out++ = 0x80|((chr>>18)&0x3f); - *out++ = 0x80|((chr>>12)&0x3f); - *out++ = 0x80|((chr>>6)&0x3f); - *out++ = 0x80|(chr&0x3f); - } else if ( (unsigned)chr < 0x80000000 ) - { *out++ = 0xfc|((chr>>30)&0x01); - *out++ = 0x80|((chr>>24)&0x3f); - *out++ = 0x80|((chr>>18)&0x3f); - *out++ = 0x80|((chr>>12)&0x3f); - *out++ = 0x80|((chr>>6)&0x3f); - *out++ = 0x80|(chr&0x3f); - } - - return out; -} - - -size_t -sgml_utf8_strlen(const char *s, size_t len) -{ const char *e = &s[len]; - unsigned int l = 0; - - while(s<e) - { int chr; - - s = utf8_get_char(s, &chr); - l++; - } - - return l; -} diff --git a/packages/sgml/utf8.h b/packages/sgml/utf8.h deleted file mode 100644 index e0fbefcc7..000000000 --- a/packages/sgml/utf8.h +++ /dev/null @@ -1,45 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog - - Author: Jan Wielemaker - E-mail: jan@swi.psy.uva.nl - WWW: http://www.swi-prolog.org - Copyright (C): 1985-2002, University of Amsterdam - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef UTF8_H_INCLUDED -#define UTF8_H_INCLUDED - -#define ISUTF8_MB(c) ((unsigned)(c) >= 0xc0 && (unsigned)(c) <= 0xfd) - -#define utf8_get_char(in, chr) \ - (*(in) & 0x80 ? sgml__utf8_get_char(in, chr) \ - : (*(chr) = *(in), (char *)(in)+1)) - -extern char *sgml__utf8_get_char(const char *in, int *chr); -#define utf8_get_uchar(in, chr) (unsigned char*)utf8_get_char((char*)(in), chr) - -extern char *sgml_utf8_put_char(char *out, int chr); -#define utf8_put_char(out, chr) \ - ((chr) < 0x80 ? out[0]=(char)(chr), out+1 \ - : sgml_utf8_put_char(out, (chr))) - -extern size_t sgml_utf8_strlen(const char *s, size_t len); -#define utf8_strlen sgml_utf8_strlen - -#endif /*UTF8_H_INCLUDED*/ diff --git a/packages/sgml/util.c b/packages/sgml/util.c deleted file mode 100644 index 66253a8ec..000000000 --- a/packages/sgml/util.c +++ /dev/null @@ -1,804 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog - - Author: Jan Wielemaker - E-mail: jan@swi.psy.uva.nl - WWW: http://www.swi-prolog.org - Copyright (C): 1985-2002, University of Amsterdam - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#define _ISOC99_SOURCE 1 /* fwprintf(), etc prototypes */ - -#define UTIL_H_IMPLEMENTATION -#include "util.h" -#include <ctype.h> -#include <wctype.h> -#include <stdlib.h> -#ifdef HAVE_MALLOC_H -#include <malloc.h> -#endif -#include <stdio.h> -#include <string.h> -#include <errno.h> -#ifdef HAVE_UNISTD_H -#include <unistd.h> -#endif -#ifdef HAVE_IO_H -#include <io.h> -#endif -#include <sys/stat.h> -#include <fcntl.h> -#include <assert.h> -#include "utf8.h" - -size_t -istrlen(const ichar *s) -{ size_t len =0; - - while(*s++) - len++; - - return len; -} - - -ichar * -istrdup(const ichar *s) -{ if ( s ) - { ichar *dup = sgml_malloc((istrlen(s)+1)*sizeof(ichar)); - ichar *d = dup; - - while(*s) - *d++ = *s++; - *d = 0; - - return dup; - } else - { return NULL; - } -} - - -ichar * -istrndup(const ichar *s, int len) -{ ichar *dup = sgml_malloc((len+1)*sizeof(ichar)); - ichar *d = dup; - - while(--len >= 0) - *d++ = *s++; - *d = 0; - - return dup; -} - - -ichar * -istrcpy(ichar *d, const ichar *s) -{ ichar *r = d; - - while(*s) - *d++ = *s++; - *d = 0; - - return r; -} - - -ichar * -istrcat(ichar *d, const ichar *s) -{ ichar *r = d; - - d += istrlen(d); - istrcpy(d, s); - - return r; -} - - -ichar * -istrncpy(ichar *d, const ichar *s, size_t len) -{ ichar *r = d; - - while(*s && len-- > 0) - *d++ = *s++; - - return r; -} - - - -int -istrcaseeq(const ichar *s1, const ichar *s2) -{ ichar c; - - while ((c = *s1++) != '\0') - { if (towlower(*s2++) != towlower(c)) - return FALSE; - } - - return *s2 == '\0'; -} - - -int -istreq(const ichar *s1, const ichar *s2) -{ while(*s1 && *s1 == *s2) - s1++, s2++; - - if ( *s1 == 0 && *s2 == 0 ) - return TRUE; - - return FALSE; -} - - -int -istrncaseeq(const ichar *s1, const ichar *s2, int len) -{ while(--len >= 0 && towlower(*s1) == towlower(*s2)) - s1++, s2++; - - if ( len < 0 ) - return TRUE; - - return FALSE; -} - - -int -istrprefix(const ichar *pref, const ichar *s) -{ while(*pref && *pref == *s) - pref++, s++; - - if ( *pref == 0 ) - return TRUE; - - return FALSE; -} - - -ichar * -istrchr(const ichar *s, int c) -{ for( ; *s; s++ ) - { if ( c == *s ) - return (ichar *)s; - } - - return NULL; -} - - -ichar * -istrupper(ichar *s) -{ ichar *r = s; - - for( ; *s; s++) - *s = toupper(*s); - - return r; -} - - -ichar * -istrlower(ichar *s) -{ ichar *r = s; - - for( ; *s; s++) - *s = towlower(*s); - - return r; -} - - -int -istrhash(const ichar *t, int tsize) -{ unsigned int value = 0; - unsigned int shift = 5; - - while(*t) - { unsigned int c = *t++; - - c -= 'a'; - value ^= c << (shift & 0xf); - shift ^= c; - } - - value = value ^ (value >> 16); - - return value % tsize; -} - - -int -istrcasehash(const ichar *t, int tsize) -{ unsigned int value = 0; - unsigned int shift = 5; - - while(*t) - { unsigned int c = towlower(*t++); /* case insensitive */ - - c -= 'a'; - value ^= c << (shift & 0xf); - shift ^= c; - } - - value = value ^ (value >> 16); - - return value % tsize; -} - - -int -istrtol(const ichar *s, long *val) -{ long v; - ichar *e; - - if ( *s ) - { v = wcstol(s, &e, 10); - if ( !e[0] && errno != ERANGE ) - { *val = v; - return TRUE; - } - } - - return FALSE; -} - - - - /******************************* - * INPUT CHARACTER BUFFER * - *******************************/ - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Input character buffer is used to collect data between SGML markup, such -as <...> -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -icharbuf * -new_icharbuf() -{ icharbuf *buf = sgml_malloc(sizeof(*buf)); - - buf->allocated = 0; - buf->size = 0; - buf->data = NULL; - - return buf; -} - - -void -free_icharbuf(icharbuf *buf) -{ if ( buf->data ) - sgml_free(buf->data); - - sgml_free(buf); -} - - -void -__add_icharbuf(icharbuf *buf, int chr) -{ if ( buf->size == buf->allocated ) - { buf->allocated = (buf->allocated ? buf->allocated*2 : 128); - - if ( buf->data ) - buf->data = sgml_realloc(buf->data, buf->allocated*sizeof(ichar)); - else - buf->data = sgml_malloc(buf->allocated*sizeof(ichar)); - } - - buf->data[buf->size++] = chr; -} - - -void -del_icharbuf(icharbuf *buf) -{ if ( buf->size > 0 ) - buf->size--; -} - - -void -terminate_icharbuf(icharbuf *buf) -{ add_icharbuf(buf, '\0'); - buf->size--; -} - - -void -empty_icharbuf(icharbuf *buf) -{ buf->size = 0; -} - - - /******************************* - * OUTPUT CHARACTER BUFFER * - *******************************/ - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Output character buffer deals with two representations: ISO Latin-1 and -UCS. It starts life as ISO Latin-1 and is upgraded to UCS as the first -character that doesn't fit ISO Latin-1 is added to the buffer. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -ocharbuf * -init_ocharbuf(ocharbuf *buf) -{ buf->size = 0; - buf->allocated = sizeof(buf->localbuf)/sizeof(wchar_t); - buf->data.w = buf->localbuf; - - return buf; -} - - -ocharbuf * -new_ocharbuf() -{ ocharbuf *buf = sgml_malloc(sizeof(*buf)); - - return init_ocharbuf(buf); -} - - -void -free_ocharbuf(ocharbuf *buf) -{ if ( buf->data.w && buf->data.w != buf->localbuf ) - sgml_free(buf->data.w); - - sgml_free(buf); -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Make sure the data of the buffer is malloc'ed and nul-terminated. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -ocharbuf * -malloc_ocharbuf(ocharbuf *buf) -{ if ( buf->data.w == buf->localbuf ) - { int bytes = (buf->size+1) * sizeof(wchar_t); - - buf->data.w = sgml_malloc(bytes); - memcpy(buf->data.w, buf->localbuf, bytes); - buf->data.w[buf->size] = 0; - } else - terminate_ocharbuf(buf); - - return buf; -} - - -void -add_ocharbuf(ocharbuf *buf, int chr) -{ if ( buf->size == buf->allocated ) - { buf->allocated *= 2; - - if ( buf->data.w != (wchar_t*)buf->localbuf ) - { buf->data.w = sgml_realloc(buf->data.w, buf->allocated*sizeof(wchar_t)); - } else - { buf->data.w = sgml_malloc(buf->allocated*sizeof(wchar_t)); - memcpy(buf->data.w, buf->localbuf, sizeof(buf->localbuf)); - } - } - buf->data.w[buf->size++] = chr; -} - - -void -del_ocharbuf(ocharbuf *buf) -{ if ( buf->size > 0 ) - buf->size--; -} - - -void -terminate_ocharbuf(ocharbuf *buf) -{ add_ocharbuf(buf, '\0'); - buf->size--; -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -empty_ocharbuf() frees the associated buffer after a big lump has been -in it. Otherwise it simply sets the size to 0. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -void -empty_ocharbuf(ocharbuf *buf) -{ buf->size = 0; - - if ( buf->allocated > 8192 ) - { assert(buf->data.w != buf->localbuf); - sgml_free(buf->data.w); - - buf->allocated = sizeof(buf->localbuf)/sizeof(wchar_t); - buf->data.w = buf->localbuf; - } -} - - - /******************************* - * BUFFER RING * - *******************************/ - -#define RINGSIZE 16 - -typedef struct ring -{ void *ring[RINGSIZE]; - int ringp; -} ring; - -#ifdef _REENTRANT -#include <pthread.h> -static pthread_key_t ring_key; - -static void -free_ring(void *ptr) -{ ring *r = ptr; - int i; - void **bp; - - for(i=0, bp=r->ring; i<RINGSIZE; i++, bp++) - { if ( *bp ) - { sgml_free(*bp); - *bp = NULL; - } - } - - sgml_free(r); -} - - -static ring * -my_ring() -{ ring *r; - - if ( (r=pthread_getspecific(ring_key)) ) - return r; - - if ( (r = sgml_calloc(1, sizeof(*r))) ) - pthread_setspecific(ring_key, r); - - return r; -} - -void -init_ring(void) -{ pthread_key_create(&ring_key, free_ring); -} - -#else -static ring ring_store; -#define my_ring() (&ring_store) - -void init_ring(void) {} -#endif - - -wchar_t * -str2ring(const wchar_t *in) -{ ring *r; - wchar_t *copy; - - if ( !(r=my_ring()) || - !(copy = sgml_malloc((wcslen(in)+1)*sizeof(wchar_t))) ) - { sgml_nomem(); - return NULL; - } - - wcscpy(copy, in); - if ( r->ring[r->ringp] ) - sgml_free(r->ring[r->ringp]); - r->ring[r->ringp++] = copy; - if ( r->ringp == RINGSIZE ) - r->ringp = 0; - - return copy; -} - - -void * -ringallo(size_t size) -{ ring *r; - char *result; - - if ( !(r=my_ring()) || !(result = sgml_malloc(size)) ) - { sgml_nomem(); - return NULL; - } - - if ( r->ring[r->ringp] ) - sgml_free(r->ring[r->ringp]); - r->ring[r->ringp++] = result; - if ( r->ringp == RINGSIZE ) - r->ringp = 0; - - return result; -} - - - /******************************* - * MISC * - *******************************/ - -wchar_t const * -str_summary(wchar_t const *s, int len) -{ wchar_t *buf; - size_t l = wcslen(s); - - if ( l < (size_t)len ) - return s; - buf = ringallo((len + 10)*sizeof(wchar_t)); - wcsncpy(buf, s, len-5); - wcscpy(&buf[len-5], L" ... "); - wcscpy(&buf[len], &s[l-5]); - - return buf; -} - - -wchar_t * -utf8towcs(const char *in) -{ size_t sl = strlen(in); - size_t len = utf8_strlen(in, sl); - wchar_t *buf = sgml_malloc((len + 1)*sizeof(wchar_t)); - const char *e = in+sl; - int i; - - for(i=0; in < e;) - { int chr; - - in = utf8_get_char(in, &chr); - buf[i++] = chr; - } - - buf[i] = 0; - return buf; -} - - -char * -wcstoutf8(const wchar_t *in) -{ size_t size = 0; - const wchar_t *s; - char *rc, *o; - - for(s=in; *s; s++) - { char buf[6]; - - if ( *s >= 0x80 ) - { char *o2 = utf8_put_char(buf, *s); - size += o2-buf; - } else - { size++; - } - } - - rc = sgml_malloc(size+1); - for(o=rc, s=in; *s; s++) - { o = utf8_put_char(o, *s); - } - *o = '\0'; - - return rc; -} - - - /******************************* - * FILES * - *******************************/ - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Load a file into memory. This would be so easy if we didn't had to deal -with &#RE/&#RS handling that forces us to create the proper record start -and end. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -#ifndef O_BINARY -#define O_BINARY 0 -#endif - -FILE * -wfopen(const wchar_t *name, const char *mode) -{ size_t mbl = wcstombs(NULL, name, 0); - - if ( mbl > 0 ) - { char *mbs = sgml_malloc(mbl+1); - FILE *f; - - wcstombs(mbs, name, mbl+1); - f = fopen(mbs, mode); - sgml_free(mbs); - - return f; - } - - return NULL; -} - - -static int -wopen(const wchar_t *name, int flags) -{ size_t mbl = wcstombs(NULL, name, 0); - - if ( mbl > 0 ) - { char *mbs = sgml_malloc(mbl+1); - int fd; - - wcstombs(mbs, name, mbl+1); - fd = open(mbs, flags); - sgml_free(mbs); - - return fd; - } - - return -1; -} - - -ichar * -load_sgml_file_to_charp(const ichar *file, int normalise_rsre, size_t *length) -{ int fd; - - if ( (fd = wopen(file, O_RDONLY|O_BINARY)) >= 0 ) - { struct stat buf; - - if ( fstat(fd, &buf) == 0 ) - { size_t len = buf.st_size; - char *r = sgml_malloc(len+1); - - if ( r ) - { char *s = r; - - while(len>0) - { int n; - - if ( (n=(int)read(fd, s, (unsigned int)len)) < 0 ) - { close(fd); /* I/O error */ - sgml_free(r); - return NULL; - } else if ( n == 0 ) - break; - len -= n; - s += n; - } - - len = s-r; - *s = '\0'; /* ensure closing EOS */ - close(fd); - - { int nl; - int last_is_lf; - ichar *r2, *t; - - if ( normalise_rsre ) - { last_is_lf = (len > 0 && s[-1] == '\n'); - for(s=r, nl=0; *s; s++) - { if ( *s == '\n' && s>r && s[-1] != '\r' ) - nl++; - } - } else - { nl = 0; - last_is_lf = 0; - } - - r2 = sgml_malloc((len+nl+1)*sizeof(ichar)); - for(s=r, t=r2; *s; s++) - { if ( *s == '\n' ) - { if ( s>r && s[-1] != '\r' ) - *t++ = CR; - *t++ = LF; - } else - *t++ = *s; - } - len = t-r2; - *t = '\0'; - - if ( last_is_lf ) - r2[--len] = '\0'; /* delete last LF */ - - if ( length ) - *length = len; - sgml_free(r); - return r2; - } - } - } - } - - return NULL; -} - - - /******************************* - * ALLOCATION * - *******************************/ - -#ifdef _WINDOWS -#include <windows.h> -#endif - -void -sgml_nomem() -{ fprintf(stderr, "SGML: Fatal: out of memory\n"); - -#ifdef _WINDOWS - MessageBox(NULL, "SGML: Fatal: out of memory", "SGML", MB_OK|MB_TASKMODAL); -#endif - - exit(1); -} - - -void * -sgml_malloc(size_t size) -{ void *mem; - - if ( size == 0 ) - return NULL; - - if ( (mem = malloc(size)) ) - return mem; - - sgml_nomem(); - return NULL; -} - - -void * -sgml_realloc(void *old, size_t size) -{ void *mem; - - if ( old ) - { if ( (mem = realloc(old, size)) ) - return mem; - } else - { if ( (mem = malloc(size)) ) - return mem; - } - - sgml_nomem(); - return NULL; -} - - -void * -sgml_calloc(size_t n, size_t size) -{ void *mem; - - if ( (mem=calloc(n, size)) ) - return mem; - - sgml_nomem(); - return NULL; -} - - -void -sgml_free(void *mem) -{ if ( mem ) - free(mem); -} - - - /******************************* - * DEBUG * - *******************************/ - -void -wputs(ichar *s) -{ fwprintf(stderr, L"%ls", s); -} diff --git a/packages/sgml/util.h b/packages/sgml/util.h deleted file mode 100644 index 8ae7663e9..000000000 --- a/packages/sgml/util.h +++ /dev/null @@ -1,118 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog - - Author: Jan Wielemaker - E-mail: jan@swi.psy.uva.nl - WWW: http://www.swi-prolog.org - Copyright (C): 1985-2002, University of Amsterdam - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef DTD_UTIL_H_INCLUDED -#define DTD_UTIL_H_INCLUDED -#include "sgmldefs.h" - -#include <stdio.h> -#include <sys/types.h> -#include <wchar.h> - -#ifdef _WINDOWS /* get size_t */ -#include <malloc.h> -#endif - -typedef struct -{ int allocated; - int size; - ichar *data; -} icharbuf; - -typedef struct -{ int allocated; - int size; - union - { wchar_t *w; /* UCS */ - } data; - wchar_t localbuf[256]; /* Initial local store */ -} ocharbuf; - -size_t istrlen(const ichar *s); -ichar * istrdup(const ichar *s); -ichar * istrndup(const ichar *s, int len); -ichar * istrcpy(ichar *d, const ichar *s); -ichar * istrcat(ichar *d, const ichar *s); -ichar * istrncpy(ichar *d, const ichar *s, size_t len); -ichar * istrupper(ichar *s); -ichar * istrlower(ichar *s); -int istrprefix(const ichar *pref, const ichar *s); -int istreq(const ichar *s1, const ichar *s2); -int istrcaseeq(const ichar *s1, const ichar *s2); -int istrncaseeq(const ichar *s1, const ichar *s2, int len); -int istrhash(const ichar *t, int tsize); -int istrcasehash(const ichar *t, int tsize); -ichar * istrchr(const ichar *s, int c); -int istrtol(const ichar *s, long *val); -void * sgml_malloc(size_t size); -void * sgml_calloc(size_t n, size_t size); -void sgml_free(void *mem); -void * sgml_realloc(void *old, size_t size); -void sgml_nomem(void); - -#define add_icharbuf(buf, chr) \ - do { if ( buf->size < buf->allocated && chr < 128 ) \ - buf->data[buf->size++] = chr; \ - else \ - __add_icharbuf(buf, chr); \ - } while(0) - -icharbuf * new_icharbuf(void); -void free_icharbuf(icharbuf *buf); -void __add_icharbuf(icharbuf *buf, int chr); -void del_icharbuf(icharbuf *buf); -void terminate_icharbuf(icharbuf *buf); -void empty_icharbuf(icharbuf *buf); - -ocharbuf * init_ocharbuf(ocharbuf *buf); -ocharbuf * new_ocharbuf(void); -void free_ocharbuf(ocharbuf *buf); -ocharbuf * malloc_ocharbuf(ocharbuf *buf); -void add_ocharbuf(ocharbuf *buf, int chr); -void del_ocharbuf(ocharbuf *buf); -void terminate_ocharbuf(ocharbuf *buf); -void empty_ocharbuf(ocharbuf *buf); -#define fetch_ocharbuf(buf, at) ((wint_t)buf->data.w[at]) -#define poke_ocharbuf(buf, at, chr) \ - { buf->data.w[at] = chr; \ - } - -void init_ring(void); -const wchar_t * str_summary(const wchar_t *s, int len); -wchar_t * str2ring(const wchar_t *in); -void * ringallo(size_t); -wchar_t * utf8towcs(const char *in); -char * wcstoutf8(const wchar_t *in); -ichar * load_sgml_file_to_charp(const ichar *file, int normalise_rsre, - size_t *len); -FILE * wfopen(const wchar_t *name, const char *mode); - -#if defined(USE_STRING_FUNCTIONS) && !defined(UTIL_H_IMPLEMENTATION) - -#define istrlen(s1) wcslen((s1)) -#define istreq(s1,s2) (wcscmp((s1),(s2))==0) - -#endif - -#endif /*DTD_UTIL_H_INCLUDED*/ diff --git a/packages/sgml/xml_unicode.c b/packages/sgml/xml_unicode.c deleted file mode 100644 index 1df69405c..000000000 --- a/packages/sgml/xml_unicode.c +++ /dev/null @@ -1,1258 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog - - Author: Jan Wielemaker - E-mail: wielemak@science.uva.nl - WWW: http://www.swi-prolog.org - Copyright (C): 1985-2006, University of Amsterdam - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - As a special exception, if you link this library with other files, - compiled with a Free Software compiler, to produce an executable, this - library does not by itself cause the resulting executable to be covered - by the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -XML character classification. - -The core of this file is generated by xml_unicode.pl using the data from -http://www.w3.org/TR/2006/REC-xml-20060816. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -int -xml_basechar(int c) -{ if ( c <= 0x0c10 ) - { if ( c <= 0x0939 ) - { if ( c <= 0x03e0 ) - { if ( c <= 0x01f5 ) - { if ( c <= 0x0131 ) - { if ( c <= 0x00d6 ) - { if ( c <= 0x005a ) - { return (c >= 0x0041 && c <= 0x005a); - } else - { if ( c <= 0x007a ) - { return (c >= 0x0061 && c <= 0x007a); - } else - { return (c >= 0x00c0 && c <= 0x00d6); - } - } - } else - { if ( c <= 0x00f6 ) - { return (c >= 0x00d8 && c <= 0x00f6); - } else - { if ( c <= 0x00ff ) - { return (c >= 0x00f8 && c <= 0x00ff); - } else - { return (c >= 0x0100 && c <= 0x0131); - } - } - } - } else - { if ( c <= 0x017e ) - { if ( c <= 0x013e ) - { return (c >= 0x0134 && c <= 0x013e); - } else - { if ( c <= 0x0148 ) - { return (c >= 0x0141 && c <= 0x0148); - } else - { return (c >= 0x014a && c <= 0x017e); - } - } - } else - { if ( c <= 0x01c3 ) - { return (c >= 0x0180 && c <= 0x01c3); - } else - { if ( c <= 0x01f0 ) - { return (c >= 0x01cd && c <= 0x01f0); - } else - { return (c >= 0x01f4 && c <= 0x01f5); - } - } - } - } - } else - { if ( c <= 0x038c ) - { if ( c <= 0x02c1 ) - { if ( c <= 0x0217 ) - { return (c >= 0x01fa && c <= 0x0217); - } else - { if ( c <= 0x02a8 ) - { return (c >= 0x0250 && c <= 0x02a8); - } else - { return (c >= 0x02bb && c <= 0x02c1); - } - } - } else - { if ( c <= 0x0386 ) - { return (c == 0x0386);} else - { if ( c <= 0x038a ) - { return (c >= 0x0388 && c <= 0x038a); - } else - { return (c == 0x038c);} - } - } - } else - { if ( c <= 0x03d6 ) - { if ( c <= 0x03a1 ) - { return (c >= 0x038e && c <= 0x03a1); - } else - { if ( c <= 0x03ce ) - { return (c >= 0x03a3 && c <= 0x03ce); - } else - { return (c >= 0x03d0 && c <= 0x03d6); - } - } - } else - { if ( c <= 0x03dc ) - { if ( c <= 0x03da ) - { return (c == 0x03da);} else - { return (c == 0x03dc);} - } else - { if ( c <= 0x03de ) - { return (c == 0x03de);} else - { return (c == 0x03e0);} - } - } - } - } - } else - { if ( c <= 0x0556 ) - { if ( c <= 0x04c4 ) - { if ( c <= 0x044f ) - { if ( c <= 0x03f3 ) - { return (c >= 0x03e2 && c <= 0x03f3); - } else - { if ( c <= 0x040c ) - { return (c >= 0x0401 && c <= 0x040c); - } else - { return (c >= 0x040e && c <= 0x044f); - } - } - } else - { if ( c <= 0x045c ) - { return (c >= 0x0451 && c <= 0x045c); - } else - { if ( c <= 0x0481 ) - { return (c >= 0x045e && c <= 0x0481); - } else - { return (c >= 0x0490 && c <= 0x04c4); - } - } - } - } else - { if ( c <= 0x04eb ) - { if ( c <= 0x04c8 ) - { return (c >= 0x04c7 && c <= 0x04c8); - } else - { if ( c <= 0x04cc ) - { return (c >= 0x04cb && c <= 0x04cc); - } else - { return (c >= 0x04d0 && c <= 0x04eb); - } - } - } else - { if ( c <= 0x04f5 ) - { return (c >= 0x04ee && c <= 0x04f5); - } else - { if ( c <= 0x04f9 ) - { return (c >= 0x04f8 && c <= 0x04f9); - } else - { return (c >= 0x0531 && c <= 0x0556); - } - } - } - } - } else - { if ( c <= 0x064a ) - { if ( c <= 0x05ea ) - { if ( c <= 0x0559 ) - { return (c == 0x0559);} else - { if ( c <= 0x0586 ) - { return (c >= 0x0561 && c <= 0x0586); - } else - { return (c >= 0x05d0 && c <= 0x05ea); - } - } - } else - { if ( c <= 0x05f2 ) - { return (c >= 0x05f0 && c <= 0x05f2); - } else - { if ( c <= 0x063a ) - { return (c >= 0x0621 && c <= 0x063a); - } else - { return (c >= 0x0641 && c <= 0x064a); - } - } - } - } else - { if ( c <= 0x06ce ) - { if ( c <= 0x06b7 ) - { return (c >= 0x0671 && c <= 0x06b7); - } else - { if ( c <= 0x06be ) - { return (c >= 0x06ba && c <= 0x06be); - } else - { return (c >= 0x06c0 && c <= 0x06ce); - } - } - } else - { if ( c <= 0x06d5 ) - { if ( c <= 0x06d3 ) - { return (c >= 0x06d0 && c <= 0x06d3); - } else - { return (c == 0x06d5);} - } else - { if ( c <= 0x06e6 ) - { return (c >= 0x06e5 && c <= 0x06e6); - } else - { return (c >= 0x0905 && c <= 0x0939); - } - } - } - } - } - } - } else - { if ( c <= 0x0aa8 ) - { if ( c <= 0x0a0a ) - { if ( c <= 0x09b0 ) - { if ( c <= 0x098c ) - { if ( c <= 0x093d ) - { return (c == 0x093d);} else - { if ( c <= 0x0961 ) - { return (c >= 0x0958 && c <= 0x0961); - } else - { return (c >= 0x0985 && c <= 0x098c); - } - } - } else - { if ( c <= 0x0990 ) - { return (c >= 0x098f && c <= 0x0990); - } else - { if ( c <= 0x09a8 ) - { return (c >= 0x0993 && c <= 0x09a8); - } else - { return (c >= 0x09aa && c <= 0x09b0); - } - } - } - } else - { if ( c <= 0x09dd ) - { if ( c <= 0x09b2 ) - { return (c == 0x09b2);} else - { if ( c <= 0x09b9 ) - { return (c >= 0x09b6 && c <= 0x09b9); - } else - { return (c >= 0x09dc && c <= 0x09dd); - } - } - } else - { if ( c <= 0x09e1 ) - { return (c >= 0x09df && c <= 0x09e1); - } else - { if ( c <= 0x09f1 ) - { return (c >= 0x09f0 && c <= 0x09f1); - } else - { return (c >= 0x0a05 && c <= 0x0a0a); - } - } - } - } - } else - { if ( c <= 0x0a39 ) - { if ( c <= 0x0a30 ) - { if ( c <= 0x0a10 ) - { return (c >= 0x0a0f && c <= 0x0a10); - } else - { if ( c <= 0x0a28 ) - { return (c >= 0x0a13 && c <= 0x0a28); - } else - { return (c >= 0x0a2a && c <= 0x0a30); - } - } - } else - { if ( c <= 0x0a33 ) - { return (c >= 0x0a32 && c <= 0x0a33); - } else - { if ( c <= 0x0a36 ) - { return (c >= 0x0a35 && c <= 0x0a36); - } else - { return (c >= 0x0a38 && c <= 0x0a39); - } - } - } - } else - { if ( c <= 0x0a74 ) - { if ( c <= 0x0a5c ) - { return (c >= 0x0a59 && c <= 0x0a5c); - } else - { if ( c <= 0x0a5e ) - { return (c == 0x0a5e);} else - { return (c >= 0x0a72 && c <= 0x0a74); - } - } - } else - { if ( c <= 0x0a8d ) - { if ( c <= 0x0a8b ) - { return (c >= 0x0a85 && c <= 0x0a8b); - } else - { return (c == 0x0a8d);} - } else - { if ( c <= 0x0a91 ) - { return (c >= 0x0a8f && c <= 0x0a91); - } else - { return (c >= 0x0a93 && c <= 0x0aa8); - } - } - } - } - } - } else - { if ( c <= 0x0b5d ) - { if ( c <= 0x0b0c ) - { if ( c <= 0x0ab9 ) - { if ( c <= 0x0ab0 ) - { return (c >= 0x0aaa && c <= 0x0ab0); - } else - { if ( c <= 0x0ab3 ) - { return (c >= 0x0ab2 && c <= 0x0ab3); - } else - { return (c >= 0x0ab5 && c <= 0x0ab9); - } - } - } else - { if ( c <= 0x0abd ) - { return (c == 0x0abd);} else - { if ( c <= 0x0ae0 ) - { return (c == 0x0ae0);} else - { return (c >= 0x0b05 && c <= 0x0b0c); - } - } - } - } else - { if ( c <= 0x0b30 ) - { if ( c <= 0x0b10 ) - { return (c >= 0x0b0f && c <= 0x0b10); - } else - { if ( c <= 0x0b28 ) - { return (c >= 0x0b13 && c <= 0x0b28); - } else - { return (c >= 0x0b2a && c <= 0x0b30); - } - } - } else - { if ( c <= 0x0b39 ) - { if ( c <= 0x0b33 ) - { return (c >= 0x0b32 && c <= 0x0b33); - } else - { return (c >= 0x0b36 && c <= 0x0b39); - } - } else - { if ( c <= 0x0b3d ) - { return (c == 0x0b3d);} else - { return (c >= 0x0b5c && c <= 0x0b5d); - } - } - } - } - } else - { if ( c <= 0x0b9c ) - { if ( c <= 0x0b90 ) - { if ( c <= 0x0b61 ) - { return (c >= 0x0b5f && c <= 0x0b61); - } else - { if ( c <= 0x0b8a ) - { return (c >= 0x0b85 && c <= 0x0b8a); - } else - { return (c >= 0x0b8e && c <= 0x0b90); - } - } - } else - { if ( c <= 0x0b95 ) - { return (c >= 0x0b92 && c <= 0x0b95); - } else - { if ( c <= 0x0b9a ) - { return (c >= 0x0b99 && c <= 0x0b9a); - } else - { return (c == 0x0b9c);} - } - } - } else - { if ( c <= 0x0baa ) - { if ( c <= 0x0b9f ) - { return (c >= 0x0b9e && c <= 0x0b9f); - } else - { if ( c <= 0x0ba4 ) - { return (c >= 0x0ba3 && c <= 0x0ba4); - } else - { return (c >= 0x0ba8 && c <= 0x0baa); - } - } - } else - { if ( c <= 0x0bb9 ) - { if ( c <= 0x0bb5 ) - { return (c >= 0x0bae && c <= 0x0bb5); - } else - { return (c >= 0x0bb7 && c <= 0x0bb9); - } - } else - { if ( c <= 0x0c0c ) - { return (c >= 0x0c05 && c <= 0x0c0c); - } else - { return (c >= 0x0c0e && c <= 0x0c10); - } - } - } - } - } - } - } - } else - { if ( c <= 0x114c ) - { if ( c <= 0x0e8d ) - { if ( c <= 0x0d0c ) - { if ( c <= 0x0c90 ) - { if ( c <= 0x0c39 ) - { if ( c <= 0x0c28 ) - { return (c >= 0x0c12 && c <= 0x0c28); - } else - { if ( c <= 0x0c33 ) - { return (c >= 0x0c2a && c <= 0x0c33); - } else - { return (c >= 0x0c35 && c <= 0x0c39); - } - } - } else - { if ( c <= 0x0c61 ) - { return (c >= 0x0c60 && c <= 0x0c61); - } else - { if ( c <= 0x0c8c ) - { return (c >= 0x0c85 && c <= 0x0c8c); - } else - { return (c >= 0x0c8e && c <= 0x0c90); - } - } - } - } else - { if ( c <= 0x0cb9 ) - { if ( c <= 0x0ca8 ) - { return (c >= 0x0c92 && c <= 0x0ca8); - } else - { if ( c <= 0x0cb3 ) - { return (c >= 0x0caa && c <= 0x0cb3); - } else - { return (c >= 0x0cb5 && c <= 0x0cb9); - } - } - } else - { if ( c <= 0x0cde ) - { return (c == 0x0cde);} else - { if ( c <= 0x0ce1 ) - { return (c >= 0x0ce0 && c <= 0x0ce1); - } else - { return (c >= 0x0d05 && c <= 0x0d0c); - } - } - } - } - } else - { if ( c <= 0x0e30 ) - { if ( c <= 0x0d39 ) - { if ( c <= 0x0d10 ) - { return (c >= 0x0d0e && c <= 0x0d10); - } else - { if ( c <= 0x0d28 ) - { return (c >= 0x0d12 && c <= 0x0d28); - } else - { return (c >= 0x0d2a && c <= 0x0d39); - } - } - } else - { if ( c <= 0x0d61 ) - { return (c >= 0x0d60 && c <= 0x0d61); - } else - { if ( c <= 0x0e2e ) - { return (c >= 0x0e01 && c <= 0x0e2e); - } else - { return (c == 0x0e30);} - } - } - } else - { if ( c <= 0x0e82 ) - { if ( c <= 0x0e33 ) - { return (c >= 0x0e32 && c <= 0x0e33); - } else - { if ( c <= 0x0e45 ) - { return (c >= 0x0e40 && c <= 0x0e45); - } else - { return (c >= 0x0e81 && c <= 0x0e82); - } - } - } else - { if ( c <= 0x0e88 ) - { if ( c <= 0x0e84 ) - { return (c == 0x0e84);} else - { return (c >= 0x0e87 && c <= 0x0e88); - } - } else - { if ( c <= 0x0e8a ) - { return (c == 0x0e8a);} else - { return (c == 0x0e8d);} - } - } - } - } - } else - { if ( c <= 0x0f47 ) - { if ( c <= 0x0eab ) - { if ( c <= 0x0ea3 ) - { if ( c <= 0x0e97 ) - { return (c >= 0x0e94 && c <= 0x0e97); - } else - { if ( c <= 0x0e9f ) - { return (c >= 0x0e99 && c <= 0x0e9f); - } else - { return (c >= 0x0ea1 && c <= 0x0ea3); - } - } - } else - { if ( c <= 0x0ea5 ) - { return (c == 0x0ea5);} else - { if ( c <= 0x0ea7 ) - { return (c == 0x0ea7);} else - { return (c >= 0x0eaa && c <= 0x0eab); - } - } - } - } else - { if ( c <= 0x0eb3 ) - { if ( c <= 0x0eae ) - { return (c >= 0x0ead && c <= 0x0eae); - } else - { if ( c <= 0x0eb0 ) - { return (c == 0x0eb0);} else - { return (c >= 0x0eb2 && c <= 0x0eb3); - } - } - } else - { if ( c <= 0x0ebd ) - { return (c == 0x0ebd);} else - { if ( c <= 0x0ec4 ) - { return (c >= 0x0ec0 && c <= 0x0ec4); - } else - { return (c >= 0x0f40 && c <= 0x0f47); - } - } - } - } - } else - { if ( c <= 0x1107 ) - { if ( c <= 0x10f6 ) - { if ( c <= 0x0f69 ) - { return (c >= 0x0f49 && c <= 0x0f69); - } else - { if ( c <= 0x10c5 ) - { return (c >= 0x10a0 && c <= 0x10c5); - } else - { return (c >= 0x10d0 && c <= 0x10f6); - } - } - } else - { if ( c <= 0x1100 ) - { return (c == 0x1100);} else - { if ( c <= 0x1103 ) - { return (c >= 0x1102 && c <= 0x1103); - } else - { return (c >= 0x1105 && c <= 0x1107); - } - } - } - } else - { if ( c <= 0x1112 ) - { if ( c <= 0x1109 ) - { return (c == 0x1109);} else - { if ( c <= 0x110c ) - { return (c >= 0x110b && c <= 0x110c); - } else - { return (c >= 0x110e && c <= 0x1112); - } - } - } else - { if ( c <= 0x113e ) - { if ( c <= 0x113c ) - { return (c == 0x113c);} else - { return (c == 0x113e);} - } else - { if ( c <= 0x1140 ) - { return (c == 0x1140);} else - { return (c == 0x114c);} - } - } - } - } - } - } else - { if ( c <= 0x1f15 ) - { if ( c <= 0x1175 ) - { if ( c <= 0x1163 ) - { if ( c <= 0x1155 ) - { if ( c <= 0x114e ) - { return (c == 0x114e);} else - { if ( c <= 0x1150 ) - { return (c == 0x1150);} else - { return (c >= 0x1154 && c <= 0x1155); - } - } - } else - { if ( c <= 0x1159 ) - { return (c == 0x1159);} else - { if ( c <= 0x1161 ) - { return (c >= 0x115f && c <= 0x1161); - } else - { return (c == 0x1163);} - } - } - } else - { if ( c <= 0x1169 ) - { if ( c <= 0x1165 ) - { return (c == 0x1165);} else - { if ( c <= 0x1167 ) - { return (c == 0x1167);} else - { return (c == 0x1169);} - } - } else - { if ( c <= 0x116e ) - { return (c >= 0x116d && c <= 0x116e); - } else - { if ( c <= 0x1173 ) - { return (c >= 0x1172 && c <= 0x1173); - } else - { return (c == 0x1175);} - } - } - } - } else - { if ( c <= 0x11ba ) - { if ( c <= 0x11ab ) - { if ( c <= 0x119e ) - { return (c == 0x119e);} else - { if ( c <= 0x11a8 ) - { return (c == 0x11a8);} else - { return (c == 0x11ab);} - } - } else - { if ( c <= 0x11af ) - { return (c >= 0x11ae && c <= 0x11af); - } else - { if ( c <= 0x11b8 ) - { return (c >= 0x11b7 && c <= 0x11b8); - } else - { return (c == 0x11ba);} - } - } - } else - { if ( c <= 0x11f0 ) - { if ( c <= 0x11c2 ) - { return (c >= 0x11bc && c <= 0x11c2); - } else - { if ( c <= 0x11eb ) - { return (c == 0x11eb);} else - { return (c == 0x11f0);} - } - } else - { if ( c <= 0x1e9b ) - { if ( c <= 0x11f9 ) - { return (c == 0x11f9);} else - { return (c >= 0x1e00 && c <= 0x1e9b); - } - } else - { if ( c <= 0x1ef9 ) - { return (c >= 0x1ea0 && c <= 0x1ef9); - } else - { return (c >= 0x1f00 && c <= 0x1f15); - } - } - } - } - } - } else - { if ( c <= 0x1fcc ) - { if ( c <= 0x1f5b ) - { if ( c <= 0x1f4d ) - { if ( c <= 0x1f1d ) - { return (c >= 0x1f18 && c <= 0x1f1d); - } else - { if ( c <= 0x1f45 ) - { return (c >= 0x1f20 && c <= 0x1f45); - } else - { return (c >= 0x1f48 && c <= 0x1f4d); - } - } - } else - { if ( c <= 0x1f57 ) - { return (c >= 0x1f50 && c <= 0x1f57); - } else - { if ( c <= 0x1f59 ) - { return (c == 0x1f59);} else - { return (c == 0x1f5b);} - } - } - } else - { if ( c <= 0x1fb4 ) - { if ( c <= 0x1f5d ) - { return (c == 0x1f5d);} else - { if ( c <= 0x1f7d ) - { return (c >= 0x1f5f && c <= 0x1f7d); - } else - { return (c >= 0x1f80 && c <= 0x1fb4); - } - } - } else - { if ( c <= 0x1fbe ) - { if ( c <= 0x1fbc ) - { return (c >= 0x1fb6 && c <= 0x1fbc); - } else - { return (c == 0x1fbe);} - } else - { if ( c <= 0x1fc4 ) - { return (c >= 0x1fc2 && c <= 0x1fc4); - } else - { return (c >= 0x1fc6 && c <= 0x1fcc); - } - } - } - } - } else - { if ( c <= 0x2126 ) - { if ( c <= 0x1fec ) - { if ( c <= 0x1fd3 ) - { return (c >= 0x1fd0 && c <= 0x1fd3); - } else - { if ( c <= 0x1fdb ) - { return (c >= 0x1fd6 && c <= 0x1fdb); - } else - { return (c >= 0x1fe0 && c <= 0x1fec); - } - } - } else - { if ( c <= 0x1ff4 ) - { return (c >= 0x1ff2 && c <= 0x1ff4); - } else - { if ( c <= 0x1ffc ) - { return (c >= 0x1ff6 && c <= 0x1ffc); - } else - { return (c == 0x2126);} - } - } - } else - { if ( c <= 0x2182 ) - { if ( c <= 0x212b ) - { return (c >= 0x212a && c <= 0x212b); - } else - { if ( c <= 0x212e ) - { return (c == 0x212e);} else - { return (c >= 0x2180 && c <= 0x2182); - } - } - } else - { if ( c <= 0x30fa ) - { if ( c <= 0x3094 ) - { return (c >= 0x3041 && c <= 0x3094); - } else - { return (c >= 0x30a1 && c <= 0x30fa); - } - } else - { if ( c <= 0x312c ) - { return (c >= 0x3105 && c <= 0x312c); - } else - { return (c >= 0xac00 && c <= 0xd7a3); - } - } - } - } - } - } - } - } -} - -int -xml_ideographic(int c) -{ if ( c <= 0x9fa5 ) - { return (c >= 0x4e00 && c <= 0x9fa5); - } else - { if ( c <= 0x3007 ) - { return (c == 0x3007);} else - { return (c >= 0x3021 && c <= 0x3029); - } - } -} - -int -xml_combining_char(int c) -{ if ( c <= 0x0b43 ) - { if ( c <= 0x0983 ) - { if ( c <= 0x0670 ) - { if ( c <= 0x05b9 ) - { if ( c <= 0x0361 ) - { if ( c <= 0x0345 ) - { return (c >= 0x0300 && c <= 0x0345); - } else - { return (c >= 0x0360 && c <= 0x0361); - } - } else - { if ( c <= 0x0486 ) - { return (c >= 0x0483 && c <= 0x0486); - } else - { if ( c <= 0x05a1 ) - { return (c >= 0x0591 && c <= 0x05a1); - } else - { return (c >= 0x05a3 && c <= 0x05b9); - } - } - } - } else - { if ( c <= 0x05c2 ) - { if ( c <= 0x05bd ) - { return (c >= 0x05bb && c <= 0x05bd); - } else - { if ( c <= 0x05bf ) - { return (c == 0x05bf);} else - { return (c >= 0x05c1 && c <= 0x05c2); - } - } - } else - { if ( c <= 0x05c4 ) - { return (c == 0x05c4);} else - { if ( c <= 0x0652 ) - { return (c >= 0x064b && c <= 0x0652); - } else - { return (c == 0x0670);} - } - } - } - } else - { if ( c <= 0x0903 ) - { if ( c <= 0x06e4 ) - { if ( c <= 0x06dc ) - { return (c >= 0x06d6 && c <= 0x06dc); - } else - { if ( c <= 0x06df ) - { return (c >= 0x06dd && c <= 0x06df); - } else - { return (c >= 0x06e0 && c <= 0x06e4); - } - } - } else - { if ( c <= 0x06e8 ) - { return (c >= 0x06e7 && c <= 0x06e8); - } else - { if ( c <= 0x06ed ) - { return (c >= 0x06ea && c <= 0x06ed); - } else - { return (c >= 0x0901 && c <= 0x0903); - } - } - } - } else - { if ( c <= 0x094d ) - { if ( c <= 0x093c ) - { return (c == 0x093c);} else - { if ( c <= 0x094c ) - { return (c >= 0x093e && c <= 0x094c); - } else - { return (c == 0x094d);} - } - } else - { if ( c <= 0x0954 ) - { return (c >= 0x0951 && c <= 0x0954); - } else - { if ( c <= 0x0963 ) - { return (c >= 0x0962 && c <= 0x0963); - } else - { return (c >= 0x0981 && c <= 0x0983); - } - } - } - } - } - } else - { if ( c <= 0x0a3f ) - { if ( c <= 0x09cd ) - { if ( c <= 0x09bf ) - { if ( c <= 0x09bc ) - { return (c == 0x09bc);} else - { if ( c <= 0x09be ) - { return (c == 0x09be);} else - { return (c == 0x09bf);} - } - } else - { if ( c <= 0x09c4 ) - { return (c >= 0x09c0 && c <= 0x09c4); - } else - { if ( c <= 0x09c8 ) - { return (c >= 0x09c7 && c <= 0x09c8); - } else - { return (c >= 0x09cb && c <= 0x09cd); - } - } - } - } else - { if ( c <= 0x0a02 ) - { if ( c <= 0x09d7 ) - { return (c == 0x09d7);} else - { if ( c <= 0x09e3 ) - { return (c >= 0x09e2 && c <= 0x09e3); - } else - { return (c == 0x0a02);} - } - } else - { if ( c <= 0x0a3c ) - { return (c == 0x0a3c);} else - { if ( c <= 0x0a3e ) - { return (c == 0x0a3e);} else - { return (c == 0x0a3f);} - } - } - } - } else - { if ( c <= 0x0abc ) - { if ( c <= 0x0a4d ) - { if ( c <= 0x0a42 ) - { return (c >= 0x0a40 && c <= 0x0a42); - } else - { if ( c <= 0x0a48 ) - { return (c >= 0x0a47 && c <= 0x0a48); - } else - { return (c >= 0x0a4b && c <= 0x0a4d); - } - } - } else - { if ( c <= 0x0a71 ) - { return (c >= 0x0a70 && c <= 0x0a71); - } else - { if ( c <= 0x0a83 ) - { return (c >= 0x0a81 && c <= 0x0a83); - } else - { return (c == 0x0abc);} - } - } - } else - { if ( c <= 0x0acd ) - { if ( c <= 0x0ac5 ) - { return (c >= 0x0abe && c <= 0x0ac5); - } else - { if ( c <= 0x0ac9 ) - { return (c >= 0x0ac7 && c <= 0x0ac9); - } else - { return (c >= 0x0acb && c <= 0x0acd); - } - } - } else - { if ( c <= 0x0b03 ) - { return (c >= 0x0b01 && c <= 0x0b03); - } else - { if ( c <= 0x0b3c ) - { return (c == 0x0b3c);} else - { return (c >= 0x0b3e && c <= 0x0b43); - } - } - } - } - } - } - } else - { if ( c <= 0x0e31 ) - { if ( c <= 0x0c4d ) - { if ( c <= 0x0bc8 ) - { if ( c <= 0x0b57 ) - { if ( c <= 0x0b48 ) - { return (c >= 0x0b47 && c <= 0x0b48); - } else - { if ( c <= 0x0b4d ) - { return (c >= 0x0b4b && c <= 0x0b4d); - } else - { return (c >= 0x0b56 && c <= 0x0b57); - } - } - } else - { if ( c <= 0x0b83 ) - { return (c >= 0x0b82 && c <= 0x0b83); - } else - { if ( c <= 0x0bc2 ) - { return (c >= 0x0bbe && c <= 0x0bc2); - } else - { return (c >= 0x0bc6 && c <= 0x0bc8); - } - } - } - } else - { if ( c <= 0x0c03 ) - { if ( c <= 0x0bcd ) - { return (c >= 0x0bca && c <= 0x0bcd); - } else - { if ( c <= 0x0bd7 ) - { return (c == 0x0bd7);} else - { return (c >= 0x0c01 && c <= 0x0c03); - } - } - } else - { if ( c <= 0x0c44 ) - { return (c >= 0x0c3e && c <= 0x0c44); - } else - { if ( c <= 0x0c48 ) - { return (c >= 0x0c46 && c <= 0x0c48); - } else - { return (c >= 0x0c4a && c <= 0x0c4d); - } - } - } - } - } else - { if ( c <= 0x0cd6 ) - { if ( c <= 0x0cc4 ) - { if ( c <= 0x0c56 ) - { return (c >= 0x0c55 && c <= 0x0c56); - } else - { if ( c <= 0x0c83 ) - { return (c >= 0x0c82 && c <= 0x0c83); - } else - { return (c >= 0x0cbe && c <= 0x0cc4); - } - } - } else - { if ( c <= 0x0cc8 ) - { return (c >= 0x0cc6 && c <= 0x0cc8); - } else - { if ( c <= 0x0ccd ) - { return (c >= 0x0cca && c <= 0x0ccd); - } else - { return (c >= 0x0cd5 && c <= 0x0cd6); - } - } - } - } else - { if ( c <= 0x0d48 ) - { if ( c <= 0x0d03 ) - { return (c >= 0x0d02 && c <= 0x0d03); - } else - { if ( c <= 0x0d43 ) - { return (c >= 0x0d3e && c <= 0x0d43); - } else - { return (c >= 0x0d46 && c <= 0x0d48); - } - } - } else - { if ( c <= 0x0d4d ) - { return (c >= 0x0d4a && c <= 0x0d4d); - } else - { if ( c <= 0x0d57 ) - { return (c == 0x0d57);} else - { return (c == 0x0e31);} - } - } - } - } - } else - { if ( c <= 0x0f3f ) - { if ( c <= 0x0ecd ) - { if ( c <= 0x0eb1 ) - { if ( c <= 0x0e3a ) - { return (c >= 0x0e34 && c <= 0x0e3a); - } else - { if ( c <= 0x0e4e ) - { return (c >= 0x0e47 && c <= 0x0e4e); - } else - { return (c == 0x0eb1);} - } - } else - { if ( c <= 0x0eb9 ) - { return (c >= 0x0eb4 && c <= 0x0eb9); - } else - { if ( c <= 0x0ebc ) - { return (c >= 0x0ebb && c <= 0x0ebc); - } else - { return (c >= 0x0ec8 && c <= 0x0ecd); - } - } - } - } else - { if ( c <= 0x0f37 ) - { if ( c <= 0x0f19 ) - { return (c >= 0x0f18 && c <= 0x0f19); - } else - { if ( c <= 0x0f35 ) - { return (c == 0x0f35);} else - { return (c == 0x0f37);} - } - } else - { if ( c <= 0x0f39 ) - { return (c == 0x0f39);} else - { if ( c <= 0x0f3e ) - { return (c == 0x0f3e);} else - { return (c == 0x0f3f);} - } - } - } - } else - { if ( c <= 0x0fb7 ) - { if ( c <= 0x0f95 ) - { if ( c <= 0x0f84 ) - { return (c >= 0x0f71 && c <= 0x0f84); - } else - { if ( c <= 0x0f8b ) - { return (c >= 0x0f86 && c <= 0x0f8b); - } else - { return (c >= 0x0f90 && c <= 0x0f95); - } - } - } else - { if ( c <= 0x0f97 ) - { return (c == 0x0f97);} else - { if ( c <= 0x0fad ) - { return (c >= 0x0f99 && c <= 0x0fad); - } else - { return (c >= 0x0fb1 && c <= 0x0fb7); - } - } - } - } else - { if ( c <= 0x20e1 ) - { if ( c <= 0x0fb9 ) - { return (c == 0x0fb9);} else - { if ( c <= 0x20dc ) - { return (c >= 0x20d0 && c <= 0x20dc); - } else - { return (c == 0x20e1);} - } - } else - { if ( c <= 0x302f ) - { return (c >= 0x302a && c <= 0x302f); - } else - { if ( c <= 0x3099 ) - { return (c == 0x3099);} else - { return (c == 0x309a);} - } - } - } - } - } - } -} - -int -xml_digit(int c) -{ if ( c <= 0x0aef ) - { if ( c <= 0x06f9 ) - { if ( c <= 0x0039 ) - { return (c >= 0x0030 && c <= 0x0039); - } else - { if ( c <= 0x0669 ) - { return (c >= 0x0660 && c <= 0x0669); - } else - { return (c >= 0x06f0 && c <= 0x06f9); - } - } - } else - { if ( c <= 0x09ef ) - { if ( c <= 0x096f ) - { return (c >= 0x0966 && c <= 0x096f); - } else - { return (c >= 0x09e6 && c <= 0x09ef); - } - } else - { if ( c <= 0x0a6f ) - { return (c >= 0x0a66 && c <= 0x0a6f); - } else - { return (c >= 0x0ae6 && c <= 0x0aef); - } - } - } - } else - { if ( c <= 0x0cef ) - { if ( c <= 0x0bef ) - { if ( c <= 0x0b6f ) - { return (c >= 0x0b66 && c <= 0x0b6f); - } else - { return (c >= 0x0be7 && c <= 0x0bef); - } - } else - { if ( c <= 0x0c6f ) - { return (c >= 0x0c66 && c <= 0x0c6f); - } else - { return (c >= 0x0ce6 && c <= 0x0cef); - } - } - } else - { if ( c <= 0x0e59 ) - { if ( c <= 0x0d6f ) - { return (c >= 0x0d66 && c <= 0x0d6f); - } else - { return (c >= 0x0e50 && c <= 0x0e59); - } - } else - { if ( c <= 0x0ed9 ) - { return (c >= 0x0ed0 && c <= 0x0ed9); - } else - { return (c >= 0x0f20 && c <= 0x0f29); - } - } - } - } -} - -int -xml_extender(int c) -{ if ( c <= 0x0640 ) - { if ( c <= 0x02d0 ) - { if ( c <= 0x00b7 ) - { return (c == 0x00b7);} else - { return (c == 0x02d0);} - } else - { if ( c <= 0x02d1 ) - { return (c == 0x02d1);} else - { if ( c <= 0x0387 ) - { return (c == 0x0387);} else - { return (c == 0x0640);} - } - } - } else - { if ( c <= 0x3005 ) - { if ( c <= 0x0e46 ) - { return (c == 0x0e46);} else - { if ( c <= 0x0ec6 ) - { return (c == 0x0ec6);} else - { return (c == 0x3005);} - } - } else - { if ( c <= 0x3035 ) - { return (c >= 0x3031 && c <= 0x3035); - } else - { if ( c <= 0x309e ) - { return (c >= 0x309d && c <= 0x309e); - } else - { return (c >= 0x30fc && c <= 0x30fe); - } - } - } - } -} - diff --git a/packages/sgml/xml_unicode.h b/packages/sgml/xml_unicode.h deleted file mode 100644 index d0d17bed4..000000000 --- a/packages/sgml/xml_unicode.h +++ /dev/null @@ -1,41 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog - - Author: Jan Wielemaker - E-mail: wielemak@science.uva.nl - WWW: http://www.swi-prolog.org - Copyright (C): 1985-2006, University of Amsterdam - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - As a special exception, if you link this library with other files, - compiled with a Free Software compiler, to produce an executable, this - library does not by itself cause the resulting executable to be covered - by the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#ifndef XML_UNICODE_H_INCLUDED -#define XML_UNICODE_H_INCLUDED - -int xml_basechar(int c); -int xml_ideographic(int c); -int xml_combining_char(int c); -int xml_digit(int c); -int xml_extender(int c); - -#endif /*XML_UNICODE_H_INCLUDED*/ diff --git a/packages/sgml/xml_unicode.pl b/packages/sgml/xml_unicode.pl deleted file mode 100644 index 245071c1a..000000000 --- a/packages/sgml/xml_unicode.pl +++ /dev/null @@ -1,436 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog - - Author: Jan Wielemaker - E-mail: wielemak@science.uva.nl - WWW: http://www.swi-prolog.org - Copyright (C): 1985-2006, University of Amsterdam - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - As a special exception, if you link this library with other files, - compiled with a Free Software compiler, to produce an executable, this - library does not by itself cause the resulting executable to be covered - by the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -:- module(xml_unicode, - [ mkclassify/0 - ]). - -%% mkclassify -% -% Generate the core of xml_unicode.c. - -mkclassify :- - forall(list(List, _), - mkfunc(List)). - -mkfunc(Name) :- - format('int~n'), - format('wcis_~w(int c)~n', [Name]), - format('{ '), - list(Name, List), - mkswitch(List), - format('}~n~n'). - -mkswitch(List) :- - mkswitch(List, 2). - -mkswitch([Low-High], Indent) :- !, - indent(Indent), - format('return (c >= 0x~|~`0t~16r~4+ && c <= 0x~|~`0t~16r~4+);~n', [Low, High]). -mkswitch([Value], Indent) :- !, - indent(Indent), - format('return (c == 0x~|~`0t~16r~4+);', [Value]). -mkswitch(List, Indent) :- - split(List, Low, High), - end(Low, MaxLow), - indent(Indent), - NextIndent is Indent + 2, - format('if ( c <= 0x~|~`0t~16r~4+ )~n', [MaxLow]), - indent(Indent), - format('{ '), - mkswitch(Low, NextIndent), - indent(Indent), - format('} else~n'), - indent(Indent), - format('{ '), - mkswitch(High, NextIndent), - indent(Indent), - format('}~n'). - -end(List, Max) :- - last(List, Last), - ( Last = _-Max - -> true - ; Max = Last - ). - -split(List, Low, High) :- - length(List, Len), - Mid is Len//2, - length(Low, Mid), - append(Low, High, List). - -indent(N) :- - line_position(current_output, Pos), - Spaces is N - Pos, - format('~*c', [Spaces, 32]). - - - -list(basechar, - [ 0x0041-0x005A, - 0x0061-0x007A, - 0x00C0-0x00D6, - 0x00D8-0x00F6, - 0x00F8-0x00FF, - 0x0100-0x0131, - 0x0134-0x013E, - 0x0141-0x0148, - 0x014A-0x017E, - 0x0180-0x01C3, - 0x01CD-0x01F0, - 0x01F4-0x01F5, - 0x01FA-0x0217, - 0x0250-0x02A8, - 0x02BB-0x02C1, - 0x0386, - 0x0388-0x038A, - 0x038C, - 0x038E-0x03A1, - 0x03A3-0x03CE, - 0x03D0-0x03D6, - 0x03DA, - 0x03DC, - 0x03DE, - 0x03E0, - 0x03E2-0x03F3, - 0x0401-0x040C, - 0x040E-0x044F, - 0x0451-0x045C, - 0x045E-0x0481, - 0x0490-0x04C4, - 0x04C7-0x04C8, - 0x04CB-0x04CC, - 0x04D0-0x04EB, - 0x04EE-0x04F5, - 0x04F8-0x04F9, - 0x0531-0x0556, - 0x0559, - 0x0561-0x0586, - 0x05D0-0x05EA, - 0x05F0-0x05F2, - 0x0621-0x063A, - 0x0641-0x064A, - 0x0671-0x06B7, - 0x06BA-0x06BE, - 0x06C0-0x06CE, - 0x06D0-0x06D3, - 0x06D5, - 0x06E5-0x06E6, - 0x0905-0x0939, - 0x093D, - 0x0958-0x0961, - 0x0985-0x098C, - 0x098F-0x0990, - 0x0993-0x09A8, - 0x09AA-0x09B0, - 0x09B2, - 0x09B6-0x09B9, - 0x09DC-0x09DD, - 0x09DF-0x09E1, - 0x09F0-0x09F1, - 0x0A05-0x0A0A, - 0x0A0F-0x0A10, - 0x0A13-0x0A28, - 0x0A2A-0x0A30, - 0x0A32-0x0A33, - 0x0A35-0x0A36, - 0x0A38-0x0A39, - 0x0A59-0x0A5C, - 0x0A5E, - 0x0A72-0x0A74, - 0x0A85-0x0A8B, - 0x0A8D, - 0x0A8F-0x0A91, - 0x0A93-0x0AA8, - 0x0AAA-0x0AB0, - 0x0AB2-0x0AB3, - 0x0AB5-0x0AB9, - 0x0ABD, - 0x0AE0, - 0x0B05-0x0B0C, - 0x0B0F-0x0B10, - 0x0B13-0x0B28, - 0x0B2A-0x0B30, - 0x0B32-0x0B33, - 0x0B36-0x0B39, - 0x0B3D, - 0x0B5C-0x0B5D, - 0x0B5F-0x0B61, - 0x0B85-0x0B8A, - 0x0B8E-0x0B90, - 0x0B92-0x0B95, - 0x0B99-0x0B9A, - 0x0B9C, - 0x0B9E-0x0B9F, - 0x0BA3-0x0BA4, - 0x0BA8-0x0BAA, - 0x0BAE-0x0BB5, - 0x0BB7-0x0BB9, - 0x0C05-0x0C0C, - 0x0C0E-0x0C10, - 0x0C12-0x0C28, - 0x0C2A-0x0C33, - 0x0C35-0x0C39, - 0x0C60-0x0C61, - 0x0C85-0x0C8C, - 0x0C8E-0x0C90, - 0x0C92-0x0CA8, - 0x0CAA-0x0CB3, - 0x0CB5-0x0CB9, - 0x0CDE, - 0x0CE0-0x0CE1, - 0x0D05-0x0D0C, - 0x0D0E-0x0D10, - 0x0D12-0x0D28, - 0x0D2A-0x0D39, - 0x0D60-0x0D61, - 0x0E01-0x0E2E, - 0x0E30, - 0x0E32-0x0E33, - 0x0E40-0x0E45, - 0x0E81-0x0E82, - 0x0E84, - 0x0E87-0x0E88, - 0x0E8A, - 0x0E8D, - 0x0E94-0x0E97, - 0x0E99-0x0E9F, - 0x0EA1-0x0EA3, - 0x0EA5, - 0x0EA7, - 0x0EAA-0x0EAB, - 0x0EAD-0x0EAE, - 0x0EB0, - 0x0EB2-0x0EB3, - 0x0EBD, - 0x0EC0-0x0EC4, - 0x0F40-0x0F47, - 0x0F49-0x0F69, - 0x10A0-0x10C5, - 0x10D0-0x10F6, - 0x1100, - 0x1102-0x1103, - 0x1105-0x1107, - 0x1109, - 0x110B-0x110C, - 0x110E-0x1112, - 0x113C, - 0x113E, - 0x1140, - 0x114C, - 0x114E, - 0x1150, - 0x1154-0x1155, - 0x1159, - 0x115F-0x1161, - 0x1163, - 0x1165, - 0x1167, - 0x1169, - 0x116D-0x116E, - 0x1172-0x1173, - 0x1175, - 0x119E, - 0x11A8, - 0x11AB, - 0x11AE-0x11AF, - 0x11B7-0x11B8, - 0x11BA, - 0x11BC-0x11C2, - 0x11EB, - 0x11F0, - 0x11F9, - 0x1E00-0x1E9B, - 0x1EA0-0x1EF9, - 0x1F00-0x1F15, - 0x1F18-0x1F1D, - 0x1F20-0x1F45, - 0x1F48-0x1F4D, - 0x1F50-0x1F57, - 0x1F59, - 0x1F5B, - 0x1F5D, - 0x1F5F-0x1F7D, - 0x1F80-0x1FB4, - 0x1FB6-0x1FBC, - 0x1FBE, - 0x1FC2-0x1FC4, - 0x1FC6-0x1FCC, - 0x1FD0-0x1FD3, - 0x1FD6-0x1FDB, - 0x1FE0-0x1FEC, - 0x1FF2-0x1FF4, - 0x1FF6-0x1FFC, - 0x2126, - 0x212A-0x212B, - 0x212E, - 0x2180-0x2182, - 0x3041-0x3094, - 0x30A1-0x30FA, - 0x3105-0x312C, - 0xAC00-0xD7A3]). - -list(ideographic, - [ 0x4E00-0x9FA5, - 0x3007, - 0x3021-0x3029 - ]). - -list(combining_char, - [ 0x0300-0x0345, - 0x0360-0x0361, - 0x0483-0x0486, - 0x0591-0x05A1, - 0x05A3-0x05B9, - 0x05BB-0x05BD, - 0x05BF, - 0x05C1-0x05C2, - 0x05C4, - 0x064B-0x0652, - 0x0670, - 0x06D6-0x06DC, - 0x06DD-0x06DF, - 0x06E0-0x06E4, - 0x06E7-0x06E8, - 0x06EA-0x06ED, - 0x0901-0x0903, - 0x093C, - 0x093E-0x094C, - 0x094D, - 0x0951-0x0954, - 0x0962-0x0963, - 0x0981-0x0983, - 0x09BC, - 0x09BE, - 0x09BF, - 0x09C0-0x09C4, - 0x09C7-0x09C8, - 0x09CB-0x09CD, - 0x09D7, - 0x09E2-0x09E3, - 0x0A02, - 0x0A3C, - 0x0A3E, - 0x0A3F, - 0x0A40-0x0A42, - 0x0A47-0x0A48, - 0x0A4B-0x0A4D, - 0x0A70-0x0A71, - 0x0A81-0x0A83, - 0x0ABC, - 0x0ABE-0x0AC5, - 0x0AC7-0x0AC9, - 0x0ACB-0x0ACD, - 0x0B01-0x0B03, - 0x0B3C, - 0x0B3E-0x0B43, - 0x0B47-0x0B48, - 0x0B4B-0x0B4D, - 0x0B56-0x0B57, - 0x0B82-0x0B83, - 0x0BBE-0x0BC2, - 0x0BC6-0x0BC8, - 0x0BCA-0x0BCD, - 0x0BD7, - 0x0C01-0x0C03, - 0x0C3E-0x0C44, - 0x0C46-0x0C48, - 0x0C4A-0x0C4D, - 0x0C55-0x0C56, - 0x0C82-0x0C83, - 0x0CBE-0x0CC4, - 0x0CC6-0x0CC8, - 0x0CCA-0x0CCD, - 0x0CD5-0x0CD6, - 0x0D02-0x0D03, - 0x0D3E-0x0D43, - 0x0D46-0x0D48, - 0x0D4A-0x0D4D, - 0x0D57, - 0x0E31, - 0x0E34-0x0E3A, - 0x0E47-0x0E4E, - 0x0EB1, - 0x0EB4-0x0EB9, - 0x0EBB-0x0EBC, - 0x0EC8-0x0ECD, - 0x0F18-0x0F19, - 0x0F35, - 0x0F37, - 0x0F39, - 0x0F3E, - 0x0F3F, - 0x0F71-0x0F84, - 0x0F86-0x0F8B, - 0x0F90-0x0F95, - 0x0F97, - 0x0F99-0x0FAD, - 0x0FB1-0x0FB7, - 0x0FB9, - 0x20D0-0x20DC, - 0x20E1, - 0x302A-0x302F, - 0x3099, - 0x309A - ]). - -list(digit, - [ 0x0030-0x0039, - 0x0660-0x0669, - 0x06F0-0x06F9, - 0x0966-0x096F, - 0x09E6-0x09EF, - 0x0A66-0x0A6F, - 0x0AE6-0x0AEF, - 0x0B66-0x0B6F, - 0x0BE7-0x0BEF, - 0x0C66-0x0C6F, - 0x0CE6-0x0CEF, - 0x0D66-0x0D6F, - 0x0E50-0x0E59, - 0x0ED0-0x0ED9, - 0x0F20-0x0F29 - ]). - -list(extender, - [ 0x00B7, - 0x02D0, - 0x02D1, - 0x0387, - 0x0640, - 0x0E46, - 0x0EC6, - 0x3005, - 0x3031-0x3035, - 0x309D-0x309E, - 0x30FC-0x30FE - ]). diff --git a/packages/sgml/xmlns.c b/packages/sgml/xmlns.c deleted file mode 100644 index 444babd93..000000000 --- a/packages/sgml/xmlns.c +++ /dev/null @@ -1,255 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog - - Author: Jan Wielemaker - E-mail: jan@swi.psy.uva.nl - WWW: http://www.swi-prolog.org - Copyright (C): 1985-2002, University of Amsterdam - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include <stdio.h> -#include <stdlib.h> -#include "dtd.h" -#include "parser.h" - -#ifdef XMLNS - -xmlns * -xmlns_push(dtd_parser *p, const ichar *ns, const ichar *url) -{ sgml_environment *env = p->environments; - dtd_symbol *n = (*ns ? dtd_add_symbol(p->dtd, ns) : (dtd_symbol *)NULL); - dtd_symbol *u = dtd_add_symbol(p->dtd, url); /* TBD: ochar/ichar */ - xmlns *x = sgml_malloc(sizeof(*x)); - - x->name = n; - x->url = u; - - if ( env ) - { if ( p->on_xmlns ) - (*p->on_xmlns)(p, n, u); - - x->next = env->xmlns; - env->xmlns = x; - } else - { x->next = p->xmlns; - p->xmlns = x; - } - - return x; -} - - -void -xmlns_free(xmlns *n) -{ xmlns *next; - - for(; n; n = next) - { next = n->next; - - sgml_free(n); - } -} - - -xmlns * -xmlns_find(dtd_parser *p, dtd_symbol *ns) -{ sgml_environment *env = p->environments; - xmlns *n; - - for(; env; env = env->parent) - { for(n=env->xmlns; n; n = n->next) - { if ( n->name == ns ) - return n; - } - } - - for (n=p->xmlns; n; n = n->next) - { if ( n->name == ns ) - return n; - } - - return NULL; -} - - -static ichar * -isxmlns(const ichar *s, int nschr) -{ if ( s[0]=='x' && s[1]=='m' && s[2]=='l' && s[3] =='n'&& s[4]=='s' ) - { if ( !s[5] ) - return (ichar *)s+5; /* implicit */ - if ( s[5] == nschr ) - return (ichar *)s+6; - } - - return NULL; -} - - -void -update_xmlns(dtd_parser *p, dtd_element *e, int natts, sgml_attribute *atts) -{ dtd_attr_list *al; - int nschr = p->dtd->charfunc->func[CF_NS]; /* : */ - - for(al=e->attributes; al; al=al->next) - { dtd_attr *a = al->attribute; - const ichar *name = a->name->name; - - if ( (name = isxmlns(name, nschr)) && /* TBD: flag when processing DTD */ - a->type == AT_CDATA && - (a->def == AT_FIXED || a->def == AT_DEFAULT) ) - xmlns_push(p, name, a->att_def.cdata); - } - - for( ; natts-- > 0; atts++ ) - { const ichar *name = atts->definition->name->name; - - if ( (name=isxmlns(name, nschr)) && - atts->definition->type == AT_CDATA && - atts->value.textW ) - xmlns_push(p, name, atts->value.textW); - } -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -xmlns_resolve() - Convert a symbol as returned by the XML level-1.0 parser to its namespace - tuple {url}localname. This function is not used internally, but provided - for use from the call-back functions of the parser. - - It exploits the stack of namespace-environments managed by the parser - itself (see update_xmlns()) -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -int -xmlns_resolve_attribute(dtd_parser *p, dtd_symbol *id, - const ichar **local, const ichar **url) -{ dtd *dtd = p->dtd; - int nschr = dtd->charfunc->func[CF_NS]; /* : */ - ichar buf[MAXNMLEN]; - ichar *o = buf; - const ichar *s; - xmlns *ns; - - for(s=id->name; *s; s++) - { if ( *s == nschr ) - { dtd_symbol *n; - - *o = '\0'; - *local = s+1; - n = dtd_add_symbol(dtd, buf); - - if ( istrprefix(L"xml", buf) ) /* XML reserved namespaces */ - { *url = n->name; - return TRUE; - } else if ( (ns = xmlns_find(p, n)) ) - { if ( ns->url->name[0] ) - *url = ns->url->name; - else - *url = NULL; - return TRUE; - } else - { *url = n->name; /* undefined namespace */ - if ( p->xml_no_ns == NONS_QUIET ) - return TRUE; - gripe(p, ERC_EXISTENCE, L"namespace", n->name); - return FALSE; - } - } - *o++ = *s; - } - - *local = id->name; - - if ( (p->flags & SGML_PARSER_QUALIFY_ATTS) && - (ns = p->environments->thisns) && ns->url->name[0] ) - *url = ns->url->name; - else - *url = NULL; /* no default namespace is defined */ - - return TRUE; -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Resolve the namespace for the current element. This namespace is stored -in the environment as `thisns' and acts as default for resolving the -namespaces of the attributes (see above). -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -int -xmlns_resolve_element(dtd_parser *p, const ichar **local, const ichar **url) -{ sgml_environment *e; - - if ( (e=p->environments) ) - { dtd_symbol *id = e->element->name; - dtd *dtd = p->dtd; - int nschr = dtd->charfunc->func[CF_NS]; /* : */ - ichar buf[MAXNMLEN]; - ichar *o = buf; - const ichar *s; - xmlns *ns; - - for(s=id->name; *s; s++) - { if ( *s == nschr ) /* explicit namespace */ - { dtd_symbol *n; - - *o = '\0'; - *local = s+1; - n = dtd_add_symbol(dtd, buf); - - if ( (ns = xmlns_find(p, n)) ) - { if ( ns->url->name[0] ) - *url = ns->url->name; - else - *url = NULL; - e->thisns = ns; /* default for attributes */ - return TRUE; - } else - { *url = n->name; /* undefined namespace */ - e->thisns = xmlns_push(p, n->name, n->name); /* define implicitly */ - if ( p->xml_no_ns == NONS_QUIET ) - return TRUE; - gripe(p, ERC_EXISTENCE, L"namespace", n->name); - return FALSE; - } - } - *o++ = *s; - } - - *local = id->name; - - if ( (ns = xmlns_find(p, NULL)) ) - { if ( ns->url->name[0] ) - *url = ns->url->name; - else - *url = NULL; - e->thisns = ns; - } else - { *url = NULL; /* no default namespace is defined */ - e->thisns = NULL; - } - - return TRUE; - } else - return FALSE; -} - - -#endif /*XMLNS*/ - diff --git a/packages/sgml/xmlns.h b/packages/sgml/xmlns.h deleted file mode 100644 index b222d4088..000000000 --- a/packages/sgml/xmlns.h +++ /dev/null @@ -1,44 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog - - Author: Jan Wielemaker - E-mail: jan@swi.psy.uva.nl - WWW: http://www.swi-prolog.org - Copyright (C): 1985-2002, University of Amsterdam - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef XMLNS_H_INCLUDED -#define XMLNS_H_INCLUDED - -typedef struct _xmlns -{ dtd_symbol *name; /* Prefix of the NS */ - dtd_symbol *url; /* pointed-to URL */ - struct _xmlns *next; /* next name */ -} xmlns; - -void xmlns_free(xmlns *list); -xmlns* xmlns_find(dtd_parser *p, dtd_symbol *ns); -xmlns * xmlns_push(dtd_parser *p, const ichar *ns, const ichar *url); -void update_xmlns(dtd_parser *p, dtd_element *e, - int natts, sgml_attribute *atts); -int xmlns_resolve_attribute(dtd_parser *p, dtd_symbol *id, - const ichar **local, const ichar **url); -int xmlns_resolve_element(dtd_parser *p, - const ichar **local, const ichar **url); - -#endif /*XMLNS_H_INCLUDED*/ diff --git a/packages/sgml/xpath.pl b/packages/sgml/xpath.pl deleted file mode 100644 index e74bd3250..000000000 --- a/packages/sgml/xpath.pl +++ /dev/null @@ -1,336 +0,0 @@ -/* This file is part of ClioPatria. - - Author: Jan Wielemaker <J.Wielemaker@cs.vu.nl> - HTTP: http://e-culture.multimedian.nl/ - Copyright: 2007, E-Culture/MultimediaN - - ClioPatria is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 2 of the License, or - (at your option) any later version. - - ClioPatria is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with ClioPatria. If not, see <http://www.gnu.org/licenses/>. -*/ - -:- module(xpath, - [ xpath/3, % +DOM, +Spec, -Value - xpath_chk/3, % +DOM, +Spec, -Value - - op(400, fx, //), - op(400, fx, /), - op(200, fy, @) - ]). -:- use_module(library(record)). -:- use_module(library(lists)). -:- use_module(library(occurs)). -:- use_module(library(debug)). - -/** <module> Select nodes in an XML DOM - -The library xpath.pl provides predicates to select nodes from an XML DOM -tree as produced by library(sgml) based on descriptions inspired by the -XPATH language. - -The predicate xpath/3 selects a sub-structure of the DOM -non-deterministically based on an xpath-like specification. Not all -selectors of XPATH are implemented, but the ability to mix xpath/3 calls -with arbitrary Prolog code provides a powerful tool for extracting -information from XML parse-trees. - -@see http://www.w3.org/TR/xpath -*/ - -:- record - element(name, attributes, content). - -%% xpath_chk(+DOM, +Spec, ?Content) is semidet. -% -% Semi-deterministic version of xpath/3. - -xpath_chk(DOM, Spec, Content) :- - xpath(DOM, Spec, Content), !. - -%% xpath(+DOM, +Spec, ?Content) is nondet. -% -% Match an element in a DOM structure. The syntax is inspired by -% XPath, using () rather than [] to select inside an element. -% First we can construct paths using / and //: -% -% $ =|//|=Term : -% Select any node in the DOM matching term. -% $ =|/|=Term : -% Match the root against Term. -% $ Term : -% Select the immediate children of the root matching Term. -% -% The Terms above are of type _callable_. The functor specifies -% the element name. The element name '*' refers to any element. -% The name =self= refers to the top-element itself and is often -% used for processing matches of an earlier xpath/3 query. A term -% NS:Term refers to an XML name in the namespace NS. Optional -% arguments specify additional constraints and functions. The -% arguments are processed from left to right. Defined conditional -% argument values are: -% -% $ Integer : -% The N-th element with the given name -% $ =last= : -% The last element with the given name. -% $ =last= - IntExpr : -% The IntExpr-th element counting from the last (0-based) -% -% Defined function argument values are: -% -% $ =self= : -% Evaluate to the entire element -% $ =text= : -% Evaluates to all text from the sub-tree as an atom -% $ =normalize_space= : -% As =text=, but uses normalize_space/2 to normalise -% white-space in the output -% $ =number= : -% Extract an integer or float from the value. Ignores -% leading and trailing white-space -% $ =|@|=Attribute : -% Evaluates to the value of the given attribute -% -% In addition, the argument-list can be _conditions_: -% -% $ Left = Right : -% Succeeds if the left-hand unifies with the right-hand. -% E.g. normalize_space = 'euro' -% $ contains(Haystack, Needle) : -% Succeeds if Needle is a sub-string of Haystack. -% -% Examples: -% -% Match each table-row in DOM: -% -% == -% xpath(DOM, //tr, TR) -% == -% -% Match the last cell of each tablerow in DOM. This example -% illustrates that a result can be the input of subsequent xpath/3 -% queries. Using multiple queries on the intermediate TR term -% guarantee that all results come from the same table-row: -% -% == -% xpath(DOM, //tr, TR), -% xpath(TR, /td(last), TD) -% == -% -% Match each =href= attribute in an <a> element -% -% == -% xpath(DOM, //a(@href), HREF) -% == -% -% Suppose we have a table containing rows where each first column -% is the name of a product with a link to details and the second -% is the price (a number). The following predicate matches the -% name, URL and price: -% -% == -% product(DOM, Name, URL, Price) :- -% xpath(DOM, //tr, TR), -% xpath(TR, td(1), C1), -% xpath(C1, /self(normalize_space), Name), -% xpath(C1, a(@href), URL), -% xpath(TR, td(2, number), Price). -% == - -xpath(DOM, Spec, Content) :- - in_dom(Spec, DOM, Content). - -in_dom(//Spec, DOM, Value) :- !, - element_spec(Spec, Name, Modifiers), - sub_dom(I, Len, Name, E, DOM), - modifiers(Modifiers, I, Len, E, Value). -in_dom(/Spec, E, Value) :- !, - element_spec(Spec, Name, Modifiers), - ( Name == self - -> true - ; element_name(E, Name) - ), - modifiers(Modifiers, 1, 1, E, Value). -in_dom(A/B, DOM, Value) :- !, - in_dom(A, DOM, Value0), - in_dom(B, Value0, Value). -in_dom(A//B, DOM, Value) :- !, - in_dom(A, DOM, Value0), - in_dom(//B, Value0, Value). -in_dom(Spec, element(_, _, Content), Value) :- - element_spec(Spec, Name, Modifiers), - count_named_elements(Content, Name, CLen), - CLen > 0, - nth_element(N, Name, E, Content), - modifiers(Modifiers, N, CLen, E, Value). - -element_spec(Var, _, _) :- - var(Var), !, - instantiation_error(Var). -element_spec(NS:Term, NS:Name, Modifiers) :- !, - Term =.. [Name0|Modifiers], - star(Name0, Name). -element_spec(Term, Name, Modifiers) :- !, - Term =.. [Name0|Modifiers], - star(Name0, Name). - -star(*, _) :- !. -star(Name, Name). - - -%% sub_dom(-Index, -Count, +Name, -Sub, +DOM) is nondet. -% -% Sub is a node in DOM with Name. -% -% @param Count is the total number of nodes in the content -% list Sub appears that have the same name. -% @param Index is the 1-based index of Sub of nodes with -% Name. - -sub_dom(1, 1, Name, DOM, DOM) :- - element_name(DOM, Name). -sub_dom(N, Len, Name, E, element(_,_,Content)) :- !, - sub_dom_2(N, Len, Name, E, Content). -sub_dom(N, Len, Name, E, Content) :- - is_list(Content), - sub_dom_2(N, Len, Name, E, Content). - -sub_dom_2(N, Len, Name, Element, Content) :- - ( count_named_elements(Content, Name, Len), - nth_element(N, Name, Element, Content) - ; member(element(_,_,C2), Content), - sub_dom_2(N, Len, Name, Element, C2) - ). - - -%% count_named_elements(+Content, +Name, -Count) is det. -% -% Count is the number of nodes with Name in Content. - -count_named_elements(Content, Name, Count) :- - count_named_elements(Content, Name, 0, Count). - -count_named_elements([], _, Count, Count). -count_named_elements([element(Name,_,_)|T], Name, C0, C) :- !, - C1 is C0+1, - count_named_elements(T, Name, C1, C). -count_named_elements([_|T], Name, C0, C) :- - count_named_elements(T, Name, C0, C). - - -%% nth_element(?N, +Name, -Element, +Content:list) is nondet. -% -% True if Element is the N-th element with name in Content. - -nth_element(N, Name, Element, Content) :- - nth_element_(1, N, Name, Element, Content). - -nth_element_(I, N, Name, E, [H|T]) :- - element_name(H, Name), !, - ( N = I, - E = H - ; I2 is I + 1, - ( nonvar(N), I2 > N - -> !, fail - ; true - ), - nth_element_(I2, N, Name, E, T) - ). -nth_element_(I, N, Name, E, [_|T]) :- - nth_element_(I, N, Name, E, T). - - -%% modifiers(+Modifiers, +I, +Clen, +DOM, -Value) -% -% - -modifiers([], _, _, Value, Value). -modifiers([H|T], I, L, Value0, Value) :- - modifier(H, I, L, Value0, Value1), - modifiers(T, I, L, Value1, Value). - -modifier(N, I, _, Value, Value) :- % Integer - integer(N), !, - N =:= I. -modifier(last, I, L, Value, Value) :- !, % last - I =:= L. -modifier(last-Expr, I, L, Value, Value) :- !, % last-Expr - I =:= L-Expr. -modifier(Function, _, _, In, Out) :- - xpath_function(Function, In, Out). - -xpath_function(self, DOM, Value) :- !, % self - Value = DOM. -xpath_function(text, DOM, Text) :- !, % text - text_of_dom(DOM, Text). -xpath_function(normalize_space, DOM, Text) :- !, % normalize_space - text_of_dom(DOM, Text0), - normalize_space(atom(Text), Text0). -xpath_function(number, DOM, Number) :- !, % number - text_of_dom(DOM, Text0), - normalize_space(string(Text), Text0), - catch(atom_number(Text, Number), _, fail). -xpath_function(@Name, element(_, Attrs, _), Value) :- !, % @Name - memberchk(Name=Value, Attrs). -xpath_function(Left = Right, Value, Value) :- !, % = - var_or_function(Left, Value, LeftValue), - var_or_function(Right, Value, RightValue), - LeftValue = RightValue. -xpath_function(contains(Haystack, Needle), Value, Value) :- !, % contains(Haystack, Needle) - val_or_function(Haystack, Value, HaystackValue), - val_or_function(Needle, Value, NeedleValue), - atom(HaystackValue), atom(NeedleValue), - ( sub_atom(HaystackValue, _, _, _, NeedleValue) - -> true - ). - -var_or_function(Arg, _, Arg) :- - var(Arg), !. -var_or_function(Func, Value0, Value) :- - xpath_function(Func, Value0, Value). - -val_or_function(Arg, _, Arg) :- - var(Arg), !, - instantiation_error(Arg). -val_or_function(Func, Value0, Value) :- % TBD - xpath_function(Func, Value0, Value). - - -%% text_of_dom(+DOM, -Text:atom) is det. -% -% Text is the joined textual content of DOM. - -text_of_dom(DOM, Text) :- - phrase(text_of(DOM), Tokens), - concat_atom(Tokens, Text). - -text_of(element(_,_,Content)) --> - text_of_list(Content). -text_of([]) --> - []. -text_of([H|T]) --> - text_of(H), - text_of(T). - - -text_of_list([]) --> - []. -text_of_list([H|T]) --> - text_of_1(H), - text_of_list(T). - - -text_of_1(element(_,_,Content)) --> !, - text_of_list(Content). -text_of_1(Data) --> - { assertion(atom(Data)) }, - [Data]. diff --git a/packages/sgml/xsdp_types.pl b/packages/sgml/xsdp_types.pl deleted file mode 100644 index ba9a373cd..000000000 --- a/packages/sgml/xsdp_types.pl +++ /dev/null @@ -1,223 +0,0 @@ -/* $Id$ - - Part of SWI-Prolog - - Author: Jan Wielemaker - E-mail: wielemak@science.uva.nl - WWW: http://www.swi-prolog.org - Copyright (C): 1985-2006, University of Amsterdam - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - As a special exception, if you link this library with other files, - compiled with a Free Software compiler, to produce an executable, this - library does not by itself cause the resulting executable to be covered - by the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -:- module(xsdp_type, - [ xsdp_type/1, % ?Type - xsdp_uri_type/2, % ?URI, ?Type - xsdp_numeric_uri/2, % ?URI, ?Primary - xsdp_subtype_of/2, % ?Type, ?Super - xsdp_convert/3 % +Type, +Content, -Value - ]). - - -/** <module> XML-Schema primitie types - -This modules provides support for the primitive XML-Schema (XSD) -datatypes. It defines the type hierarchy which allows for reasoning over -types as well as xsdp_convert/3 to convert XML content to a natural -Prolog representation of the XSD type. - -Based on the W3C definitions at - - * http://www.w3.org/TR/xmlschema-2/#built-in-datatypes - -The current implementation is incomplete and only there to test the API -and its integration with rdf:dataType=Type handling in the RDF parser. - -The extra 'p' in the module prefix (xsdp_*) is used to allow for a -module xsd_*, providing full user-defined XSD types on top of this -module. -*/ - -ns('http://www.w3.org/2001/XMLSchema#'). - - - /******************************* - * PRIMITIVE TYPE HIERARCHY * - *******************************/ - -%% xsdp_type(?Type) -% -% Test/generate the names for the XML schema primitive types - -xsdp_type(Type) :- - subtype_of(Type, _). - -%% xsdp_uri_type(?URI, ?Type) -% -% True if URI is the URI for the the XML-Schema primitive Type. - -xsdp_uri_type(URI, Type) :- - xsd_local_id(URI, Type), - subtype_of(Type, _). - -%% xsdp_subtype_of(?Type, ?Super) -% -% True if Type is a (transitive) subtype of Super. - -xsdp_subtype_of(Type, Type). -xsdp_subtype_of(Type, Super) :- - ( nonvar(Type) - -> subtype_of(Type, Super0), - Super0 \== (-), - xsdp_subtype_of(Type, Super) - ; subtype_of(Sub0, Super), - xsdp_subtype_of(Type, Sub0) - ). - -subtype_of(anyType, -). -subtype_of(anySimpleType, anyType). - % string hierarchy -subtype_of(string, anySimpleType). -subtype_of(normalizedString, string). -subtype_of(token, normalizedString). -subtype_of(language, token). -subtype_of('Name', token). -subtype_of('NCName', 'Name'). -subtype_of('NMTOKEN', token). -subtype_of('NMTOKENS', 'NMTOKEN'). -subtype_of('ID', 'NCName'). -subtype_of('IDREF', 'NCName'). -subtype_of('IDREFS', 'IDREF'). -subtype_of('ENTITY', 'NCName'). -subtype_of('ENTITIES', 'ENTITY'). - % numeric hierarchy -subtype_of(decimal, anySimpleType). -subtype_of(integer, decimal). -subtype_of(nonPositiveInteger, integer). -subtype_of(negativeInteger, nonPositiveInteger). -subtype_of(long, integer). -subtype_of(int, long). -subtype_of(short, int). -subtype_of(byte, short). -subtype_of(nonNegativeInteger, integer). -subtype_of(unsignedLong, nonNegativeInteger). -subtype_of(positiveInteger, nonNegativeInteger). -subtype_of(unsignedInt, unsignedLong). -subtype_of(unsignedShort, unsignedInt). -subtype_of(unsignedByte, unsignedShort). - % other simple types -subtype_of(duration, anySimpleType). -subtype_of(dateTime, anySimpleType). -subtype_of(time, anySimpleType). -subtype_of(date, anySimpleType). -subtype_of(gYearMonth, anySimpleType). -subtype_of(gYear, anySimpleType). -subtype_of(gMonthDay, anySimpleType). -subtype_of(gDay, anySimpleType). -subtype_of(gMonth, anySimpleType). -subtype_of(boolean, anySimpleType). -subtype_of(base64Binary, anySimpleType). -subtype_of(hexBinary, anySimpleType). -subtype_of(float, anySimpleType). -subtype_of(double, anySimpleType). -subtype_of(anyURI, anySimpleType). -subtype_of('QName', anySimpleType). -subtype_of('NOTATION', anySimpleType). - -%% xsdp_numeric_uri(?URI, -PromoteURI) is nondet. -% -% Table mapping all XML-Schema numeric URIs into the type they -% promote to. Types are promoted to =integer=, =float=, =double= -% and =decimal=. - -term_expansion(integer_types, Clauses) :- - findall(integer_type(Type), xsdp_subtype_of(Type, integer), Clauses). -term_expansion(xsd_local_ids, Clauses) :- - ns(NS), - findall(xsd_local_id(URI, Type), - ( xsdp_type(Type), - atom_concat(NS, Type, URI) - ), - Clauses). -term_expansion(numeric_uirs, Clauses) :- - findall(xsdp_numeric_uri(URI, PrimaryURI), - ( ( integer_type(Type), Primary = integer - ; Type = float, Primary = float - ; Type = double, Primary = double - ; Type = decimal, Primary = decimal - ), - xsd_local_id(URI, Type), - xsd_local_id(PrimaryURI, Primary) - ), - Clauses). - -integer_types. -xsd_local_ids. - -numeric_uirs. - -%% xsdp_convert(+Type, +Content, -Value) -% -% Convert the content model Content to an object of the given XSD -% type and return the Prolog value in Value. - -xsdp_convert(URI, Content, Value) :- - ( xsd_local_id(URI, Type) - -> convert(Type, Content, Value) - ; convert(URI, Content, Value) - ). - -convert(anyType, Term, Term) :- !. -convert(anySimpleType, [Simple], Simple) :- !. - % strings -convert(string, [String], String) :- !. - % numbers -convert(IntType, [Text], Integer) :- - integer_type(IntType), !, - atom_number(Text, Integer), - ( integer(Integer), - validate_int_domain(IntType, Integer) - -> true - ; throw(error(domain_error(Text, IntType), _)) - ). -convert(float, [Text], Float) :- !, - atom_number(Text, Number), - Float is float(Number). -convert(double, [Text], Float) :- !, - atom_number(Text, Number), - Float is float(Number). -convert(_Any, [X], X) :- !. % TBD: provide for more types -convert(_Any, X, X). - -validate_int_domain(integer, _). -validate_int_domain(int, _). -validate_int_domain(long, _). -validate_int_domain(nonPositiveInteger, I) :- \+ I > 0. -validate_int_domain(negativeInteger, I) :- I < 0. -validate_int_domain(short, I) :- between(-32768, 32767, I). -validate_int_domain(byte, I) :- between(-128, 127, I). -validate_int_domain(nonNegativeInteger, I) :- \+ I < 0. -validate_int_domain(unsignedLong, I) :- I >= 0. -validate_int_domain(positiveInteger, I) :- I > 0. -validate_int_domain(unsignedInt, I) :- I >= 0. -validate_int_domain(unsignedShort, I) :- between(0, 65535, I). -validate_int_domain(unsignedByte, I) :- between(0, 255, I).