kibi-swipl-linux-x64-gnu 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -0
- package/bin/swipl +0 -0
- package/bin/swipl-win +0 -0
- package/build-manifest.json +70 -0
- package/lib/cmake/swipl/SWIPLConfig.cmake +21 -0
- package/lib/cmake/swipl/SWIPLConfigVersion.cmake +65 -0
- package/lib/cmake/swipl/SWIPLTargets-release.cmake +28 -0
- package/lib/cmake/swipl/SWIPLTargets.cmake +109 -0
- package/lib/swipl/ABI +1 -0
- package/lib/swipl/LICENSE +41 -0
- package/lib/swipl/README.md +116 -0
- package/lib/swipl/app/README.md +25 -0
- package/lib/swipl/app/app.pl +87 -0
- package/lib/swipl/app/pack.pl +350 -0
- package/lib/swipl/app/qlf.pl +521 -0
- package/lib/swipl/app/splfr.pl +177 -0
- package/lib/swipl/app/sys.pl +310 -0
- package/lib/swipl/bin/swipl.home +1 -0
- package/lib/swipl/boot/apply.pl +73 -0
- package/lib/swipl/boot/attvar.pl +344 -0
- package/lib/swipl/boot/autoload.pl +1226 -0
- package/lib/swipl/boot/bags.pl +283 -0
- package/lib/swipl/boot/dcg.pl +388 -0
- package/lib/swipl/boot/dicts.pl +193 -0
- package/lib/swipl/boot/dwim.pl +485 -0
- package/lib/swipl/boot/engines.pl +152 -0
- package/lib/swipl/boot/expand.pl +1628 -0
- package/lib/swipl/boot/gc.pl +65 -0
- package/lib/swipl/boot/history.pl +304 -0
- package/lib/swipl/boot/init.pl +4682 -0
- package/lib/swipl/boot/iri.pl +64 -0
- package/lib/swipl/boot/license.pl +390 -0
- package/lib/swipl/boot/load.pl +81 -0
- package/lib/swipl/boot/messages.pl +2521 -0
- package/lib/swipl/boot/packs.pl +306 -0
- package/lib/swipl/boot/predopts.pl +154 -0
- package/lib/swipl/boot/qlf.pl +141 -0
- package/lib/swipl/boot/rc.pl +263 -0
- package/lib/swipl/boot/syspred.pl +1634 -0
- package/lib/swipl/boot/tabling.pl +2321 -0
- package/lib/swipl/boot/threads.pl +42 -0
- package/lib/swipl/boot/toplevel.pl +2248 -0
- package/lib/swipl/boot/topvars.pl +261 -0
- package/lib/swipl/boot.prc +0 -0
- package/lib/swipl/cmake/swipl.cmake +131 -0
- package/lib/swipl/customize/README.md +23 -0
- package/lib/swipl/customize/edit +101 -0
- package/lib/swipl/customize/init.pl +164 -0
- package/lib/swipl/demo/README.md +33 -0
- package/lib/swipl/demo/likes.pl +44 -0
- package/lib/swipl/doc/packages/examples/chr/bool.chr +281 -0
- package/lib/swipl/doc/packages/examples/chr/chrdif.chr +87 -0
- package/lib/swipl/doc/packages/examples/chr/chrfreeze.chr +6 -0
- package/lib/swipl/doc/packages/examples/chr/family.chr +116 -0
- package/lib/swipl/doc/packages/examples/chr/fib.chr +24 -0
- package/lib/swipl/doc/packages/examples/chr/fibonacci.chr +31 -0
- package/lib/swipl/doc/packages/examples/chr/gcd.chr +28 -0
- package/lib/swipl/doc/packages/examples/chr/leq.chr +34 -0
- package/lib/swipl/doc/packages/examples/chr/listdom.chr +138 -0
- package/lib/swipl/doc/packages/examples/chr/primes.chr +29 -0
- package/lib/swipl/doc/packages/examples/http/README.md +98 -0
- package/lib/swipl/doc/packages/examples/http/calc.pl +92 -0
- package/lib/swipl/doc/packages/examples/http/demo_body.pl +232 -0
- package/lib/swipl/doc/packages/examples/http/demo_client.pl +165 -0
- package/lib/swipl/doc/packages/examples/http/demo_daemon.pl +38 -0
- package/lib/swipl/doc/packages/examples/http/demo_files.pl +50 -0
- package/lib/swipl/doc/packages/examples/http/demo_hello.pl +15 -0
- package/lib/swipl/doc/packages/examples/http/demo_login.pl +280 -0
- package/lib/swipl/doc/packages/examples/http/demo_openid.pl +177 -0
- package/lib/swipl/doc/packages/examples/http/demo_pwp.pl +20 -0
- package/lib/swipl/doc/packages/examples/http/demo_rest.pl +56 -0
- package/lib/swipl/doc/packages/examples/http/demo_threads.pl +52 -0
- package/lib/swipl/doc/packages/examples/http/linux-init-script +126 -0
- package/lib/swipl/doc/packages/examples/http/pwp/context.pwp +23 -0
- package/lib/swipl/doc/packages/examples/http/pwp/index.pwp +25 -0
- package/lib/swipl/doc/packages/examples/http/pwp/pwp1.pwp +12 -0
- package/lib/swipl/doc/packages/examples/http/pwp/pwp2.pwp +10 -0
- package/lib/swipl/doc/packages/examples/http/pwp/pwp3.pwp +25 -0
- package/lib/swipl/doc/packages/examples/http/pwp/pwp4.pwp +23 -0
- package/lib/swipl/doc/packages/examples/http/pwp/pwp5.pwp +11 -0
- package/lib/swipl/doc/packages/examples/http/pwp/pwp6.pwp +3 -0
- package/lib/swipl/doc/packages/examples/http/pwp/pwp7.pwp +3 -0
- package/lib/swipl/doc/packages/examples/http/pwp/pwp8.pwp +3 -0
- package/lib/swipl/doc/packages/examples/http/pwp/pwpdb.pl +12 -0
- package/lib/swipl/doc/packages/examples/http/systemd-script.service +18 -0
- package/lib/swipl/doc/packages/examples/http/upstart-script.conf +20 -0
- package/lib/swipl/doc/packages/examples/plunit/read.pl +17 -0
- package/lib/swipl/doc/packages/examples/plunit/simple.pl +33 -0
- package/lib/swipl/doc/packages/examples/ssl/client.pl +83 -0
- package/lib/swipl/doc/packages/examples/ssl/etc/README +52 -0
- package/lib/swipl/doc/packages/examples/ssl/etc/client/client-cert.p12 +0 -0
- package/lib/swipl/doc/packages/examples/ssl/etc/client/client-cert.pem +85 -0
- package/lib/swipl/doc/packages/examples/ssl/etc/client/client-key.pem +30 -0
- package/lib/swipl/doc/packages/examples/ssl/etc/demoCA/cacert.pem +82 -0
- package/lib/swipl/doc/packages/examples/ssl/etc/demoCA/careq.pem +18 -0
- package/lib/swipl/doc/packages/examples/ssl/etc/demoCA/crlnumber +1 -0
- package/lib/swipl/doc/packages/examples/ssl/etc/demoCA/index.txt +3 -0
- package/lib/swipl/doc/packages/examples/ssl/etc/demoCA/index.txt.attr +1 -0
- package/lib/swipl/doc/packages/examples/ssl/etc/demoCA/newcerts/9DC08797A0F63F7C.pem +85 -0
- package/lib/swipl/doc/packages/examples/ssl/etc/demoCA/newcerts/9DC08797A0F63F7D.pem +85 -0
- package/lib/swipl/doc/packages/examples/ssl/etc/demoCA/private/cakey.pem +30 -0
- package/lib/swipl/doc/packages/examples/ssl/etc/demoCA/serial +1 -0
- package/lib/swipl/doc/packages/examples/ssl/etc/server/server-cert.pem +85 -0
- package/lib/swipl/doc/packages/examples/ssl/etc/server/server-key.pem +30 -0
- package/lib/swipl/doc/packages/examples/ssl/https.pl +267 -0
- package/lib/swipl/doc/packages/examples/ssl/server.pl +106 -0
- package/lib/swipl/include/SWI-Prolog.h +1544 -0
- package/lib/swipl/include/SWI-Stream.h +537 -0
- package/lib/swipl/include/Yap/YapInterface.h +283 -0
- package/lib/swipl/include/sicstus/sicstus.h +452 -0
- package/lib/swipl/lib/x86_64-linux/cgi.so +0 -0
- package/lib/swipl/lib/x86_64-linux/crypt.so +0 -0
- package/lib/swipl/lib/x86_64-linux/crypto4pl.so +0 -0
- package/lib/swipl/lib/x86_64-linux/double_metaphone.so +0 -0
- package/lib/swipl/lib/x86_64-linux/files.so +0 -0
- package/lib/swipl/lib/x86_64-linux/hashstream.so +0 -0
- package/lib/swipl/lib/x86_64-linux/http_stream.so +0 -0
- package/lib/swipl/lib/x86_64-linux/isub.so +0 -0
- package/lib/swipl/lib/x86_64-linux/json.so +0 -0
- package/lib/swipl/lib/x86_64-linux/libswipl.so.10 +0 -0
- package/lib/swipl/lib/x86_64-linux/mallocinfo.so +0 -0
- package/lib/swipl/lib/x86_64-linux/md54pl.so +0 -0
- package/lib/swipl/lib/x86_64-linux/memfile.so +0 -0
- package/lib/swipl/lib/x86_64-linux/ntriples.so +0 -0
- package/lib/swipl/lib/x86_64-linux/pcre4pl.so +0 -0
- package/lib/swipl/lib/x86_64-linux/porter_stem.so +0 -0
- package/lib/swipl/lib/x86_64-linux/process.so +0 -0
- package/lib/swipl/lib/x86_64-linux/prolog_stream.so +0 -0
- package/lib/swipl/lib/x86_64-linux/rdf_db.so +0 -0
- package/lib/swipl/lib/x86_64-linux/readutil.so +0 -0
- package/lib/swipl/lib/x86_64-linux/rlimit.so +0 -0
- package/lib/swipl/lib/x86_64-linux/sched.so +0 -0
- package/lib/swipl/lib/x86_64-linux/sgml2pl.so +0 -0
- package/lib/swipl/lib/x86_64-linux/sha4pl.so +0 -0
- package/lib/swipl/lib/x86_64-linux/snowball.so +0 -0
- package/lib/swipl/lib/x86_64-linux/socket.so +0 -0
- package/lib/swipl/lib/x86_64-linux/ssl4pl.so +0 -0
- package/lib/swipl/lib/x86_64-linux/streaminfo.so +0 -0
- package/lib/swipl/lib/x86_64-linux/syslog.so +0 -0
- package/lib/swipl/lib/x86_64-linux/time.so +0 -0
- package/lib/swipl/lib/x86_64-linux/turtle.so +0 -0
- package/lib/swipl/lib/x86_64-linux/uid.so +0 -0
- package/lib/swipl/lib/x86_64-linux/unix.so +0 -0
- package/lib/swipl/lib/x86_64-linux/uri.so +0 -0
- package/lib/swipl/lib/x86_64-linux/websocket.so +0 -0
- package/lib/swipl/lib/x86_64-linux/zlib4pl.so +0 -0
- package/lib/swipl/library/INDEX.pl +1020 -0
- package/lib/swipl/library/aggregate.pl +755 -0
- package/lib/swipl/library/ansi_term.pl +653 -0
- package/lib/swipl/library/apply.pl +426 -0
- package/lib/swipl/library/apply_macros.pl +497 -0
- package/lib/swipl/library/arithmetic.pl +320 -0
- package/lib/swipl/library/assoc.pl +522 -0
- package/lib/swipl/library/atom.pl +169 -0
- package/lib/swipl/library/backcomp.pl +688 -0
- package/lib/swipl/library/base32.pl +291 -0
- package/lib/swipl/library/base64.pl +441 -0
- package/lib/swipl/library/broadcast.pl +161 -0
- package/lib/swipl/library/build/cmake.pl +137 -0
- package/lib/swipl/library/build/conan.pl +232 -0
- package/lib/swipl/library/build/make.pl +168 -0
- package/lib/swipl/library/build/tools.pl +825 -0
- package/lib/swipl/library/charsio.pl +195 -0
- package/lib/swipl/library/check.pl +1097 -0
- package/lib/swipl/library/check_installation.pl +912 -0
- package/lib/swipl/library/clp/INDEX.pl +157 -0
- package/lib/swipl/library/clp/bounds.pl +2036 -0
- package/lib/swipl/library/clp/clp_distinct.pl +263 -0
- package/lib/swipl/library/clp/clp_events.pl +92 -0
- package/lib/swipl/library/clp/clpb.pl +1896 -0
- package/lib/swipl/library/clp/clpfd.pl +7906 -0
- package/lib/swipl/library/clp/simplex.pl +1580 -0
- package/lib/swipl/library/codesio.pl +182 -0
- package/lib/swipl/library/coinduction.pl +183 -0
- package/lib/swipl/library/console_input.pl +289 -0
- package/lib/swipl/library/csv.pl +611 -0
- package/lib/swipl/library/ctypes.pl +161 -0
- package/lib/swipl/library/date.pl +370 -0
- package/lib/swipl/library/dcg/INDEX.pl +35 -0
- package/lib/swipl/library/dcg/basics.pl +514 -0
- package/lib/swipl/library/dcg/high_order.pl +227 -0
- package/lib/swipl/library/debug.pl +499 -0
- package/lib/swipl/library/dialect/bim.pl +186 -0
- package/lib/swipl/library/dialect/commons.pl +77 -0
- package/lib/swipl/library/dialect/eclipse/test_util_iso.pl +355 -0
- package/lib/swipl/library/dialect/hprolog/format.pl +44 -0
- package/lib/swipl/library/dialect/hprolog.pl +314 -0
- package/lib/swipl/library/dialect/ifprolog.pl +1317 -0
- package/lib/swipl/library/dialect/iso/iso_predicates.pl +277 -0
- package/lib/swipl/library/dialect/sicstus/README.TXT +1 -0
- package/lib/swipl/library/dialect/sicstus/arrays.pl +121 -0
- package/lib/swipl/library/dialect/sicstus/block.pl +278 -0
- package/lib/swipl/library/dialect/sicstus/lists.pl +167 -0
- package/lib/swipl/library/dialect/sicstus/ordsets.pl +52 -0
- package/lib/swipl/library/dialect/sicstus/sockets.pl +174 -0
- package/lib/swipl/library/dialect/sicstus/system.pl +262 -0
- package/lib/swipl/library/dialect/sicstus/terms.pl +57 -0
- package/lib/swipl/library/dialect/sicstus/timeout.pl +92 -0
- package/lib/swipl/library/dialect/sicstus.pl +582 -0
- package/lib/swipl/library/dialect/sicstus4/aggregate.pl +60 -0
- package/lib/swipl/library/dialect/sicstus4/between.pl +62 -0
- package/lib/swipl/library/dialect/sicstus4/clpfd.pl +75 -0
- package/lib/swipl/library/dialect/sicstus4/file_systems.pl +413 -0
- package/lib/swipl/library/dialect/sicstus4/lists.pl +274 -0
- package/lib/swipl/library/dialect/sicstus4/ordsets.pl +54 -0
- package/lib/swipl/library/dialect/sicstus4/samsort.pl +86 -0
- package/lib/swipl/library/dialect/sicstus4/sets.pl +124 -0
- package/lib/swipl/library/dialect/sicstus4/sockets.pl +164 -0
- package/lib/swipl/library/dialect/sicstus4/system.pl +80 -0
- package/lib/swipl/library/dialect/sicstus4/terms.pl +89 -0
- package/lib/swipl/library/dialect/sicstus4/timeout.pl +43 -0
- package/lib/swipl/library/dialect/sicstus4/types.pl +103 -0
- package/lib/swipl/library/dialect/sicstus4.pl +200 -0
- package/lib/swipl/library/dialect/swi/syspred_options.pl +250 -0
- package/lib/swipl/library/dialect/xsb/README.md +20 -0
- package/lib/swipl/library/dialect/xsb/basics.pl +318 -0
- package/lib/swipl/library/dialect/xsb/consult.pl +87 -0
- package/lib/swipl/library/dialect/xsb/curr_sym.pl +57 -0
- package/lib/swipl/library/dialect/xsb/error_handler.pl +111 -0
- package/lib/swipl/library/dialect/xsb/gensym.pl +53 -0
- package/lib/swipl/library/dialect/xsb/gpp.pl +138 -0
- package/lib/swipl/library/dialect/xsb/intern.pl +48 -0
- package/lib/swipl/library/dialect/xsb/lists.pl +47 -0
- package/lib/swipl/library/dialect/xsb/machine.pl +295 -0
- package/lib/swipl/library/dialect/xsb/ordsets.pl +53 -0
- package/lib/swipl/library/dialect/xsb/setof.pl +54 -0
- package/lib/swipl/library/dialect/xsb/source.pl +308 -0
- package/lib/swipl/library/dialect/xsb/standard.pl +169 -0
- package/lib/swipl/library/dialect/xsb/storage.pl +70 -0
- package/lib/swipl/library/dialect/xsb/string.pl +76 -0
- package/lib/swipl/library/dialect/xsb/thread.pl +62 -0
- package/lib/swipl/library/dialect/xsb/timed_call.pl +158 -0
- package/lib/swipl/library/dialect/xsb.pl +688 -0
- package/lib/swipl/library/dialect/yap/README.TXT +8 -0
- package/lib/swipl/library/dialect/yap.pl +283 -0
- package/lib/swipl/library/dialect.pl +123 -0
- package/lib/swipl/library/dicts.pl +399 -0
- package/lib/swipl/library/dif.pl +426 -0
- package/lib/swipl/library/edinburgh.pl +138 -0
- package/lib/swipl/library/edit.pl +783 -0
- package/lib/swipl/library/error.pl +495 -0
- package/lib/swipl/library/exceptions.pl +231 -0
- package/lib/swipl/library/explain.pl +543 -0
- package/lib/swipl/library/ext/RDF/INDEX.pl +25 -0
- package/lib/swipl/library/ext/RDF/rdf.pl +450 -0
- package/lib/swipl/library/ext/RDF/rdf_parser.pl +649 -0
- package/lib/swipl/library/ext/RDF/rdf_triple.pl +448 -0
- package/lib/swipl/library/ext/RDF/rdf_write.pl +701 -0
- package/lib/swipl/library/ext/RDF/rewrite_term.pl +177 -0
- package/lib/swipl/library/ext/chr/chr/a_star.pl +80 -0
- package/lib/swipl/library/ext/chr/chr/binomialheap.pl +142 -0
- package/lib/swipl/library/ext/chr/chr/builtins.pl +629 -0
- package/lib/swipl/library/ext/chr/chr/chr_compiler_errors.pl +179 -0
- package/lib/swipl/library/ext/chr/chr/chr_compiler_options.pl +382 -0
- package/lib/swipl/library/ext/chr/chr/chr_compiler_utility.pl +338 -0
- package/lib/swipl/library/ext/chr/chr/chr_debug.pl +59 -0
- package/lib/swipl/library/ext/chr/chr/chr_hashtable_store.pl +425 -0
- package/lib/swipl/library/ext/chr/chr/chr_integertable_store.pl +139 -0
- package/lib/swipl/library/ext/chr/chr/chr_messages.pl +176 -0
- package/lib/swipl/library/ext/chr/chr/chr_op.pl +53 -0
- package/lib/swipl/library/ext/chr/chr/chr_runtime.pl +1016 -0
- package/lib/swipl/library/ext/chr/chr/chr_translate.pl +25424 -0
- package/lib/swipl/library/ext/chr/chr/clean_code.pl +252 -0
- package/lib/swipl/library/ext/chr/chr/find.pl +78 -0
- package/lib/swipl/library/ext/chr/chr/guard_entailment.pl +19432 -0
- package/lib/swipl/library/ext/chr/chr/listmap.pl +108 -0
- package/lib/swipl/library/ext/chr/chr/pairlist.pl +78 -0
- package/lib/swipl/library/ext/chr/chr.pl +686 -0
- package/lib/swipl/library/ext/clib/INDEX.pl +158 -0
- package/lib/swipl/library/ext/clib/cgi.pl +86 -0
- package/lib/swipl/library/ext/clib/crypt.pl +44 -0
- package/lib/swipl/library/ext/clib/filesex.pl +644 -0
- package/lib/swipl/library/ext/clib/hash_stream.pl +119 -0
- package/lib/swipl/library/ext/clib/mallocinfo.pl +138 -0
- package/lib/swipl/library/ext/clib/md5.pl +68 -0
- package/lib/swipl/library/ext/clib/memfile.pl +61 -0
- package/lib/swipl/library/ext/clib/process.pl +573 -0
- package/lib/swipl/library/ext/clib/prolog_server.pl +157 -0
- package/lib/swipl/library/ext/clib/prolog_stream.pl +80 -0
- package/lib/swipl/library/ext/clib/rlimit.pl +54 -0
- package/lib/swipl/library/ext/clib/sched.pl +85 -0
- package/lib/swipl/library/ext/clib/sha.pl +162 -0
- package/lib/swipl/library/ext/clib/socket.pl +1102 -0
- package/lib/swipl/library/ext/clib/streaminfo.pl +103 -0
- package/lib/swipl/library/ext/clib/streampool.pl +136 -0
- package/lib/swipl/library/ext/clib/syslog.pl +180 -0
- package/lib/swipl/library/ext/clib/time.pl +194 -0
- package/lib/swipl/library/ext/clib/udp_broadcast.pl +975 -0
- package/lib/swipl/library/ext/clib/uid.pl +220 -0
- package/lib/swipl/library/ext/clib/unix.pl +317 -0
- package/lib/swipl/library/ext/clib/uri.pl +530 -0
- package/lib/swipl/library/ext/clib/uuid.pl +207 -0
- package/lib/swipl/library/ext/http/http/INDEX.pl +266 -0
- package/lib/swipl/library/ext/http/http/README.md +34 -0
- package/lib/swipl/library/ext/http/http/ax.pl +189 -0
- package/lib/swipl/library/ext/http/http/dcg_basics.pl +49 -0
- package/lib/swipl/library/ext/http/http/graphql.pl +1367 -0
- package/lib/swipl/library/ext/http/http/html_decl.pl +416 -0
- package/lib/swipl/library/ext/http/http/html_head.pl +654 -0
- package/lib/swipl/library/ext/http/http/html_quasiquotations.pl +120 -0
- package/lib/swipl/library/ext/http/http/html_write.pl +1425 -0
- package/lib/swipl/library/ext/http/http/htmx.pl +139 -0
- package/lib/swipl/library/ext/http/http/http_authenticate.pl +364 -0
- package/lib/swipl/library/ext/http/http/http_client.pl +412 -0
- package/lib/swipl/library/ext/http/http/http_cookie.pl +245 -0
- package/lib/swipl/library/ext/http/http/http_cors.pl +176 -0
- package/lib/swipl/library/ext/http/http/http_digest.pl +820 -0
- package/lib/swipl/library/ext/http/http/http_dirindex.pl +296 -0
- package/lib/swipl/library/ext/http/http/http_dispatch.pl +1552 -0
- package/lib/swipl/library/ext/http/http/http_dyn_workers.pl +214 -0
- package/lib/swipl/library/ext/http/http/http_error.pl +126 -0
- package/lib/swipl/library/ext/http/http/http_exception.pl +225 -0
- package/lib/swipl/library/ext/http/http/http_files.pl +163 -0
- package/lib/swipl/library/ext/http/http/http_header.pl +2820 -0
- package/lib/swipl/library/ext/http/http/http_hook.pl +106 -0
- package/lib/swipl/library/ext/http/http/http_host.pl +204 -0
- package/lib/swipl/library/ext/http/http/http_load.pl +113 -0
- package/lib/swipl/library/ext/http/http/http_log.pl +738 -0
- package/lib/swipl/library/ext/http/http/http_multipart_plugin.pl +232 -0
- package/lib/swipl/library/ext/http/http/http_open.pl +1821 -0
- package/lib/swipl/library/ext/http/http/http_openid.pl +1561 -0
- package/lib/swipl/library/ext/http/http/http_parameters.pl +504 -0
- package/lib/swipl/library/ext/http/http/http_path.pl +380 -0
- package/lib/swipl/library/ext/http/http/http_proxy.pl +80 -0
- package/lib/swipl/library/ext/http/http/http_pwp.pl +351 -0
- package/lib/swipl/library/ext/http/http/http_redis_plugin.pl +332 -0
- package/lib/swipl/library/ext/http/http/http_server.pl +105 -0
- package/lib/swipl/library/ext/http/http/http_server_files.pl +126 -0
- package/lib/swipl/library/ext/http/http/http_server_health.pl +186 -0
- package/lib/swipl/library/ext/http/http/http_session.pl +1040 -0
- package/lib/swipl/library/ext/http/http/http_sgml_plugin.pl +137 -0
- package/lib/swipl/library/ext/http/http/http_stream.pl +376 -0
- package/lib/swipl/library/ext/http/http/http_unix_daemon.pl +989 -0
- package/lib/swipl/library/ext/http/http/http_wrapper.pl +559 -0
- package/lib/swipl/library/ext/http/http/hub.pl +600 -0
- package/lib/swipl/library/ext/http/http/js_write.pl +461 -0
- package/lib/swipl/library/ext/http/http/mimepack.pl +224 -0
- package/lib/swipl/library/ext/http/http/mimetype.pl +276 -0
- package/lib/swipl/library/ext/http/http/term_html.pl +797 -0
- package/lib/swipl/library/ext/http/http/thread_httpd.pl +1181 -0
- package/lib/swipl/library/ext/http/http/web/css/dirindex.css +24 -0
- package/lib/swipl/library/ext/http/http/web/css/openid.css +57 -0
- package/lib/swipl/library/ext/http/http/web/icons/back.png +0 -0
- package/lib/swipl/library/ext/http/http/web/icons/c.png +0 -0
- package/lib/swipl/library/ext/http/http/web/icons/compressed.png +0 -0
- package/lib/swipl/library/ext/http/http/web/icons/folder.png +0 -0
- package/lib/swipl/library/ext/http/http/web/icons/generic.png +0 -0
- package/lib/swipl/library/ext/http/http/web/icons/layout.png +0 -0
- package/lib/swipl/library/ext/http/http/web/icons/openid-logo-square.png +0 -0
- package/lib/swipl/library/ext/http/http/web/icons/openid-logo-tiny.png +0 -0
- package/lib/swipl/library/ext/http/http/websocket.pl +729 -0
- package/lib/swipl/library/ext/http/http/yadis.pl +205 -0
- package/lib/swipl/library/ext/json/INDEX.pl +36 -0
- package/lib/swipl/library/ext/json/http/INDEX.pl +16 -0
- package/lib/swipl/library/ext/json/http/http_json.pl +490 -0
- package/lib/swipl/library/ext/json/http/js_grammar.pl +53 -0
- package/lib/swipl/library/ext/json/http/json.pl +48 -0
- package/lib/swipl/library/ext/json/http/json_convert.pl +48 -0
- package/lib/swipl/library/ext/json/json.pl +1215 -0
- package/lib/swipl/library/ext/json/json_convert.pl +681 -0
- package/lib/swipl/library/ext/json/json_grammar.pl +349 -0
- package/lib/swipl/library/ext/json/json_rpc_client.pl +423 -0
- package/lib/swipl/library/ext/json/json_rpc_common.pl +104 -0
- package/lib/swipl/library/ext/json/json_rpc_server.pl +489 -0
- package/lib/swipl/library/ext/json/json_schema.pl +2111 -0
- package/lib/swipl/library/ext/nlp/INDEX.pl +15 -0
- package/lib/swipl/library/ext/nlp/double_metaphone.pl +86 -0
- package/lib/swipl/library/ext/nlp/isub.pl +162 -0
- package/lib/swipl/library/ext/nlp/porter_stem.pl +50 -0
- package/lib/swipl/library/ext/nlp/snowball.pl +97 -0
- package/lib/swipl/library/ext/pcre/INDEX.pl +17 -0
- package/lib/swipl/library/ext/pcre/pcre.pl +974 -0
- package/lib/swipl/library/ext/plunit/INDEX.pl +20 -0
- package/lib/swipl/library/ext/plunit/plunit.pl +2631 -0
- package/lib/swipl/library/ext/plunit/test_wizard.pl +249 -0
- package/lib/swipl/library/ext/semweb/semweb/INDEX.pl +288 -0
- package/lib/swipl/library/ext/semweb/semweb/rdf11.pl +2106 -0
- package/lib/swipl/library/ext/semweb/semweb/rdf11_containers.pl +299 -0
- package/lib/swipl/library/ext/semweb/semweb/rdf_cache.pl +278 -0
- package/lib/swipl/library/ext/semweb/semweb/rdf_compare.pl +132 -0
- package/lib/swipl/library/ext/semweb/semweb/rdf_db.pl +3468 -0
- package/lib/swipl/library/ext/semweb/semweb/rdf_edit.pl +1145 -0
- package/lib/swipl/library/ext/semweb/semweb/rdf_http_plugin.pl +274 -0
- package/lib/swipl/library/ext/semweb/semweb/rdf_library.pl +1021 -0
- package/lib/swipl/library/ext/semweb/semweb/rdf_litindex.pl +1035 -0
- package/lib/swipl/library/ext/semweb/semweb/rdf_ntriples.pl +422 -0
- package/lib/swipl/library/ext/semweb/semweb/rdf_persistency.pl +1576 -0
- package/lib/swipl/library/ext/semweb/semweb/rdf_portray.pl +182 -0
- package/lib/swipl/library/ext/semweb/semweb/rdf_prefixes.pl +681 -0
- package/lib/swipl/library/ext/semweb/semweb/rdf_sandbox.pl +153 -0
- package/lib/swipl/library/ext/semweb/semweb/rdf_turtle.pl +54 -0
- package/lib/swipl/library/ext/semweb/semweb/rdf_turtle_write.pl +1587 -0
- package/lib/swipl/library/ext/semweb/semweb/rdf_zlib_plugin.pl +52 -0
- package/lib/swipl/library/ext/semweb/semweb/rdfa.pl +1510 -0
- package/lib/swipl/library/ext/semweb/semweb/rdfs.pl +475 -0
- package/lib/swipl/library/ext/semweb/semweb/sparql_client.pl +643 -0
- package/lib/swipl/library/ext/semweb/semweb/turtle.pl +455 -0
- package/lib/swipl/library/ext/sgml/DTD/HTML4.dcl +88 -0
- package/lib/swipl/library/ext/sgml/DTD/HTML4.dtd +1092 -0
- package/lib/swipl/library/ext/sgml/DTD/HTML4.soc +6 -0
- package/lib/swipl/library/ext/sgml/DTD/HTML5.dtd +906 -0
- package/lib/swipl/library/ext/sgml/DTD/HTMLlat1.ent +195 -0
- package/lib/swipl/library/ext/sgml/DTD/HTMLspec.ent +77 -0
- package/lib/swipl/library/ext/sgml/DTD/HTMLsym.ent +241 -0
- package/lib/swipl/library/ext/sgml/INDEX.pl +64 -0
- package/lib/swipl/library/ext/sgml/c14n2.pl +203 -0
- package/lib/swipl/library/ext/sgml/iso_639.pl +631 -0
- package/lib/swipl/library/ext/sgml/pwp.pl +705 -0
- package/lib/swipl/library/ext/sgml/sgml.pl +815 -0
- package/lib/swipl/library/ext/sgml/sgml_write.pl +1003 -0
- package/lib/swipl/library/ext/sgml/xpath.pl +620 -0
- package/lib/swipl/library/ext/sgml/xsdp_types.pl +232 -0
- package/lib/swipl/library/ext/ssl/INDEX.pl +60 -0
- package/lib/swipl/library/ext/ssl/crypto.pl +1015 -0
- package/lib/swipl/library/ext/ssl/http/INDEX.pl +5 -0
- package/lib/swipl/library/ext/ssl/http/http_ssl_plugin.pl +296 -0
- package/lib/swipl/library/ext/ssl/saml.pl +609 -0
- package/lib/swipl/library/ext/ssl/ssl.pl +647 -0
- package/lib/swipl/library/ext/ssl/xmldsig.pl +391 -0
- package/lib/swipl/library/ext/ssl/xmlenc.pl +354 -0
- package/lib/swipl/library/ext/zlib/INDEX.pl +8 -0
- package/lib/swipl/library/ext/zlib/zlib.pl +112 -0
- package/lib/swipl/library/fastrw.pl +105 -0
- package/lib/swipl/library/files.pl +80 -0
- package/lib/swipl/library/gensym.pl +111 -0
- package/lib/swipl/library/git.pl +1027 -0
- package/lib/swipl/library/hashtable.pl +365 -0
- package/lib/swipl/library/heaps.pl +252 -0
- package/lib/swipl/library/hotfix.pl +239 -0
- package/lib/swipl/library/http/jquery.pl +103 -0
- package/lib/swipl/library/http/web/js/jquery-3.6.0.min.js +2 -0
- package/lib/swipl/library/increval.pl +217 -0
- package/lib/swipl/library/intercept.pl +263 -0
- package/lib/swipl/library/iostream.pl +237 -0
- package/lib/swipl/library/iri_scheme/file.pl +70 -0
- package/lib/swipl/library/lazy_lists.pl +481 -0
- package/lib/swipl/library/listing.pl +1362 -0
- package/lib/swipl/library/lists.pl +860 -0
- package/lib/swipl/library/lynx/INDEX.pl +14 -0
- package/lib/swipl/library/lynx/format.pl +380 -0
- package/lib/swipl/library/lynx/html_style.pl +129 -0
- package/lib/swipl/library/lynx/html_text.pl +865 -0
- package/lib/swipl/library/lynx/pldoc_style.pl +87 -0
- package/lib/swipl/library/macros.pl +451 -0
- package/lib/swipl/library/main.pl +1200 -0
- package/lib/swipl/library/make.pl +197 -0
- package/lib/swipl/library/modules.pl +129 -0
- package/lib/swipl/library/nb_rbtrees.pl +267 -0
- package/lib/swipl/library/nb_set.pl +203 -0
- package/lib/swipl/library/obfuscate.pl +115 -0
- package/lib/swipl/library/occurs.pl +241 -0
- package/lib/swipl/library/operators.pl +182 -0
- package/lib/swipl/library/option.pl +388 -0
- package/lib/swipl/library/optparse.pl +966 -0
- package/lib/swipl/library/ordsets.pl +518 -0
- package/lib/swipl/library/oset.pl +160 -0
- package/lib/swipl/library/pairs.pl +187 -0
- package/lib/swipl/library/persistency.pl +713 -0
- package/lib/swipl/library/pio.pl +47 -0
- package/lib/swipl/library/portray_text.pl +277 -0
- package/lib/swipl/library/pprint.pl +940 -0
- package/lib/swipl/library/predicate_options.pl +975 -0
- package/lib/swipl/library/prolog_autoload.pl +233 -0
- package/lib/swipl/library/prolog_breakpoints.pl +396 -0
- package/lib/swipl/library/prolog_clause.pl +1104 -0
- package/lib/swipl/library/prolog_code.pl +416 -0
- package/lib/swipl/library/prolog_codewalk.pl +1248 -0
- package/lib/swipl/library/prolog_colour.pl +3301 -0
- package/lib/swipl/library/prolog_colour.qlf +0 -0
- package/lib/swipl/library/prolog_config.pl +154 -0
- package/lib/swipl/library/prolog_coverage.pl +1333 -0
- package/lib/swipl/library/prolog_debug.pl +404 -0
- package/lib/swipl/library/prolog_deps.pl +675 -0
- package/lib/swipl/library/prolog_evaluable.pl +234 -0
- package/lib/swipl/library/prolog_format.pl +219 -0
- package/lib/swipl/library/prolog_history.pl +161 -0
- package/lib/swipl/library/prolog_jiti.pl +333 -0
- package/lib/swipl/library/prolog_locale.pl +61 -0
- package/lib/swipl/library/prolog_metainference.pl +307 -0
- package/lib/swipl/library/prolog_pack.pl +3906 -0
- package/lib/swipl/library/prolog_profile.pl +346 -0
- package/lib/swipl/library/prolog_qlfmake.pl +533 -0
- package/lib/swipl/library/prolog_source.pl +1188 -0
- package/lib/swipl/library/prolog_stack.pl +794 -0
- package/lib/swipl/library/prolog_trace.pl +365 -0
- package/lib/swipl/library/prolog_versions.pl +347 -0
- package/lib/swipl/library/prolog_wrap.pl +164 -0
- package/lib/swipl/library/prolog_xref.pl +3090 -0
- package/lib/swipl/library/prolog_xref.qlf +0 -0
- package/lib/swipl/library/pure_input.pl +266 -0
- package/lib/swipl/library/qpforeign.pl +695 -0
- package/lib/swipl/library/qsave.pl +1516 -0
- package/lib/swipl/library/quasi_quotations.pl +300 -0
- package/lib/swipl/library/quintus.pl +437 -0
- package/lib/swipl/library/random.pl +459 -0
- package/lib/swipl/library/rbtrees.pl +1153 -0
- package/lib/swipl/library/readln.pl +256 -0
- package/lib/swipl/library/readutil.pl +304 -0
- package/lib/swipl/library/record.pl +544 -0
- package/lib/swipl/library/rwlocks.pl +172 -0
- package/lib/swipl/library/sandbox.pl +1384 -0
- package/lib/swipl/library/semweb/dc.rdfs +198 -0
- package/lib/swipl/library/semweb/eor.rdfs +95 -0
- package/lib/swipl/library/semweb/owl.owl +287 -0
- package/lib/swipl/library/semweb/rdf_library.ttl +90 -0
- package/lib/swipl/library/semweb/rdfs.rdfs +251 -0
- package/lib/swipl/library/settings.pl +755 -0
- package/lib/swipl/library/shell.pl +462 -0
- package/lib/swipl/library/shlib.pl +670 -0
- package/lib/swipl/library/solution_sequences.pl +439 -0
- package/lib/swipl/library/sort.pl +119 -0
- package/lib/swipl/library/statistics.pl +541 -0
- package/lib/swipl/library/streams.pl +118 -0
- package/lib/swipl/library/strings.pl +469 -0
- package/lib/swipl/library/system.pl +95 -0
- package/lib/swipl/library/tables.pl +381 -0
- package/lib/swipl/library/tableutil.pl +771 -0
- package/lib/swipl/library/tabling.pl +42 -0
- package/lib/swipl/library/terms.pl +457 -0
- package/lib/swipl/library/theme/auto.pl +61 -0
- package/lib/swipl/library/theme/dark.pl +455 -0
- package/lib/swipl/library/theme/light.pl +45 -0
- package/lib/swipl/library/thread.pl +810 -0
- package/lib/swipl/library/thread_pool.pl +508 -0
- package/lib/swipl/library/threadutil.pl +574 -0
- package/lib/swipl/library/tty.pl +316 -0
- package/lib/swipl/library/ugraphs.pl +644 -0
- package/lib/swipl/library/unicode/INDEX.pl +6 -0
- package/lib/swipl/library/unicode/blocks.pl +414 -0
- package/lib/swipl/library/url.pl +1129 -0
- package/lib/swipl/library/utf8.pl +145 -0
- package/lib/swipl/library/varnumbers.pl +221 -0
- package/lib/swipl/library/vm.pl +251 -0
- package/lib/swipl/library/wfs.pl +205 -0
- package/lib/swipl/library/when.pl +263 -0
- package/lib/swipl/library/writef.pl +278 -0
- package/lib/swipl/library/www_browser.pl +251 -0
- package/lib/swipl/library/yall.pl +574 -0
- package/lib/swipl/library/zip.pl +211 -0
- package/lib/swipl/swipl.home +1 -0
- package/lib/vendor/libcrypto.so.3 +0 -0
- package/lib/vendor/libpcre2-8.so.0 +0 -0
- package/lib/vendor/libssl.so.3 +0 -0
- package/lib/vendor/libz.so.1 +0 -0
- package/licenses/OpenSSL-LICENSE.txt +177 -0
- package/licenses/PCRE2-COPYING +5 -0
- package/licenses/README.md +12 -0
- package/licenses/SWI-Prolog-LICENSE +41 -0
- package/licenses/zlib-LICENSE +22 -0
- package/package.json +27 -0
|
@@ -0,0 +1,1145 @@
|
|
|
1
|
+
/* Part of SWI-Prolog
|
|
2
|
+
|
|
3
|
+
Author: Jan Wielemaker
|
|
4
|
+
E-mail: J.Wielemaker@vu.nl
|
|
5
|
+
WWW: http://www.swi-prolog.org
|
|
6
|
+
Copyright (c) 2003-2013, University of Amsterdam
|
|
7
|
+
VU University Amsterdam
|
|
8
|
+
All rights reserved.
|
|
9
|
+
|
|
10
|
+
Redistribution and use in source and binary forms, with or without
|
|
11
|
+
modification, are permitted provided that the following conditions
|
|
12
|
+
are met:
|
|
13
|
+
|
|
14
|
+
1. Redistributions of source code must retain the above copyright
|
|
15
|
+
notice, this list of conditions and the following disclaimer.
|
|
16
|
+
|
|
17
|
+
2. Redistributions in binary form must reproduce the above copyright
|
|
18
|
+
notice, this list of conditions and the following disclaimer in
|
|
19
|
+
the documentation and/or other materials provided with the
|
|
20
|
+
distribution.
|
|
21
|
+
|
|
22
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
23
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
24
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
25
|
+
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
26
|
+
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
27
|
+
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
28
|
+
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
29
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
30
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
31
|
+
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
32
|
+
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
33
|
+
POSSIBILITY OF SUCH DAMAGE.
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
:- module(rdf_edit,
|
|
37
|
+
[ rdfe_assert/3, % Sub, Pred, Obj
|
|
38
|
+
rdfe_assert/4, % Sub, Pred, Obj, PayLoad
|
|
39
|
+
rdfe_retractall/3, % Sub, Pred, Obj
|
|
40
|
+
rdfe_retractall/4, % Sub, Pred, Obj, PayLoad
|
|
41
|
+
rdfe_update/4, % Sub, Pred, Obj, +Action
|
|
42
|
+
rdfe_update/5, % Sub, Pred, Obj, +PayLoad, +Action
|
|
43
|
+
rdfe_load/1, % +File
|
|
44
|
+
rdfe_load/2, % +File, +Options
|
|
45
|
+
rdfe_delete/1, % +Resource
|
|
46
|
+
|
|
47
|
+
rdfe_register_ns/2, % +Id, +URI
|
|
48
|
+
rdfe_unregister_ns/2, % +Id, +URI
|
|
49
|
+
|
|
50
|
+
rdfe_reset/0, % clear everything
|
|
51
|
+
|
|
52
|
+
rdfe_transaction/1, % :Goal
|
|
53
|
+
rdfe_transaction/2, % :Goal, +Name
|
|
54
|
+
rdfe_transaction_member/2, % +Transactions, -Action
|
|
55
|
+
rdfe_transaction_name/2, % +Transactions, -Name
|
|
56
|
+
rdfe_set_transaction_name/1,% +Name
|
|
57
|
+
|
|
58
|
+
rdfe_set_watermark/1, % +Name
|
|
59
|
+
|
|
60
|
+
rdfe_undo/0, %
|
|
61
|
+
rdfe_redo/0,
|
|
62
|
+
rdfe_can_undo/1, % -TID
|
|
63
|
+
rdfe_can_redo/1, % -TID
|
|
64
|
+
|
|
65
|
+
rdfe_set_file_property/2, % +File, +Property
|
|
66
|
+
rdfe_get_file_property/2, % ?File, ?Property
|
|
67
|
+
|
|
68
|
+
rdfe_is_modified/1, % ?File
|
|
69
|
+
rdfe_clear_modified/1, % +File
|
|
70
|
+
|
|
71
|
+
rdfe_open_journal/2, % +File, +Mode
|
|
72
|
+
rdfe_close_journal/0,
|
|
73
|
+
rdfe_replay_journal/1, % +File
|
|
74
|
+
rdfe_current_journal/1, % -Path
|
|
75
|
+
|
|
76
|
+
rdfe_snapshot_file/1 % -File
|
|
77
|
+
]).
|
|
78
|
+
:- use_module(library(semweb/rdf_prefixes),
|
|
79
|
+
[ (rdf_meta)/1,
|
|
80
|
+
op(_,_,rdf_meta)
|
|
81
|
+
]).
|
|
82
|
+
|
|
83
|
+
:- autoload(rdf_db,
|
|
84
|
+
[ rdf_assert/4, rdf/4, rdf_retractall/4, rdf_update/4,
|
|
85
|
+
rdf_update/5, rdf_load/2, rdf_statistics/1, rdf_md5/2,
|
|
86
|
+
rdf_unload/1, rdf_save_db/2, rdf_load_db/1, rdf_register_ns/2,
|
|
87
|
+
rdf_source/2, rdf_graph_property/2, rdf_graph/1, rdf_set_graph/2,
|
|
88
|
+
rdf_reset_db/0, rdf_load/1
|
|
89
|
+
]).
|
|
90
|
+
:- autoload(library(broadcast),[broadcast/1]).
|
|
91
|
+
:- use_module(library(debug),[debug/3,debugging/1]).
|
|
92
|
+
:- autoload(library(gui_tracer),[gtrace/0]).
|
|
93
|
+
:- autoload(library(lists),[append/3]).
|
|
94
|
+
:- autoload(library(uri),[uri_file_name/2,uri_components/2,uri_data/3]).
|
|
95
|
+
|
|
96
|
+
:- meta_predicate
|
|
97
|
+
rdfe_transaction(0),
|
|
98
|
+
rdfe_transaction(0, +).
|
|
99
|
+
|
|
100
|
+
:- predicate_options(rdfe_load/2, 2,
|
|
101
|
+
[pass_to(rdf_db:rdf_load/2, 2)]).
|
|
102
|
+
|
|
103
|
+
:- dynamic
|
|
104
|
+
undo_log/5, % TID, Action, Subj, Pred, Obj
|
|
105
|
+
current_transaction/1, % TID
|
|
106
|
+
transaction_name/2, % TID, Name
|
|
107
|
+
undo_marker/2, % Mode, TID
|
|
108
|
+
journal/3, % Path, Mode, Stream
|
|
109
|
+
snapshot_file/1. % File
|
|
110
|
+
|
|
111
|
+
/** <module> RDF edit layer
|
|
112
|
+
This library provides a number of functions on top of the rdf_db module:
|
|
113
|
+
|
|
114
|
+
* Broadcast modifications
|
|
115
|
+
* Provide undo/redo
|
|
116
|
+
|
|
117
|
+
@tbd This library must be rewritten using rdf_monitor/3. This allows
|
|
118
|
+
using edit layer without having to choose between rdf_ and rdfe_
|
|
119
|
+
predicates.
|
|
120
|
+
|
|
121
|
+
@see rdf_persistency.pl provides reliable persistency, but without
|
|
122
|
+
changes boardcasting and undo/redo.
|
|
123
|
+
*/
|
|
124
|
+
|
|
125
|
+
:- rdf_meta
|
|
126
|
+
rdfe_assert(r,r,o),
|
|
127
|
+
rdfe_assert(r,r,o,+),
|
|
128
|
+
rdfe_retractall(r,r,o),
|
|
129
|
+
rdfe_update(r,r,o,t),
|
|
130
|
+
rdfe_delete(r),
|
|
131
|
+
rdfe_transaction(:),
|
|
132
|
+
rdfe_transaction(:, +).
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
/*******************************
|
|
136
|
+
* BASIC EDIT OPERATIONS *
|
|
137
|
+
*******************************/
|
|
138
|
+
|
|
139
|
+
rdfe_assert(Subject, Predicate, Object) :-
|
|
140
|
+
rdfe_assert(Subject, Predicate, Object, user).
|
|
141
|
+
|
|
142
|
+
rdfe_assert(Subject, Predicate, Object, PayLoad) :-
|
|
143
|
+
rdf_assert(Subject, Predicate, Object, PayLoad),
|
|
144
|
+
rdfe_current_transaction(TID),
|
|
145
|
+
assert_action(TID, assert(PayLoad), Subject, Predicate, Object),
|
|
146
|
+
journal(assert(TID, Subject, Predicate, Object, PayLoad)).
|
|
147
|
+
|
|
148
|
+
rdfe_retractall(Subject, Predicate, Object) :-
|
|
149
|
+
rdfe_retractall(Subject, Predicate, Object, _).
|
|
150
|
+
|
|
151
|
+
rdfe_retractall(Subject, Predicate, Object, PayLoad) :-
|
|
152
|
+
rdfe_current_transaction(TID),
|
|
153
|
+
( rdf(Subject, Predicate, Object, PayLoad),
|
|
154
|
+
assert_action(TID, retract(PayLoad), Subject, Predicate, Object),
|
|
155
|
+
journal(retract(TID, Subject, Predicate, Object, PayLoad)),
|
|
156
|
+
fail
|
|
157
|
+
; true
|
|
158
|
+
),
|
|
159
|
+
rdf_retractall(Subject, Predicate, Object, PayLoad).
|
|
160
|
+
|
|
161
|
+
%! rdfe_update(+Subject, +Predicate, +Object, +Action)
|
|
162
|
+
%
|
|
163
|
+
% Update an existing triple. Possible actions are:
|
|
164
|
+
%
|
|
165
|
+
%! subject(+Subject)
|
|
166
|
+
%! predicate(+Predicate)
|
|
167
|
+
%! object(+Object)
|
|
168
|
+
%! source(+Source)
|
|
169
|
+
|
|
170
|
+
rdfe_update(Subject, Predicate, Object, Action) :-
|
|
171
|
+
rdfe_current_transaction(TID),
|
|
172
|
+
rdf_update(Subject, Predicate, Object, Action),
|
|
173
|
+
( Action = object(New)
|
|
174
|
+
-> assert_action(TID, object(Object), Subject, Predicate, New)
|
|
175
|
+
; Action = predicate(New)
|
|
176
|
+
-> assert_action(TID, predicate(Predicate), Subject, New, Object)
|
|
177
|
+
; Action = subject(New)
|
|
178
|
+
-> assert_action(TID, subject(Subject), New, Predicate, Object)
|
|
179
|
+
; Action = source(New)
|
|
180
|
+
-> forall(rdf(Subject, Predicate, Object, PayLoad),
|
|
181
|
+
assert_action(TID, source(PayLoad, New),
|
|
182
|
+
Subject, Predicate, Object))
|
|
183
|
+
),
|
|
184
|
+
journal(update(TID, Subject, Predicate, Object, Action)).
|
|
185
|
+
|
|
186
|
+
rdfe_update(Subject, Predicate, Object, PayLoad, Action) :-
|
|
187
|
+
rdfe_current_transaction(TID),
|
|
188
|
+
rdf_update(Subject, Predicate, Object, PayLoad, Action),
|
|
189
|
+
( Action = source(New)
|
|
190
|
+
-> assert_action(TID, source(PayLoad, New),
|
|
191
|
+
Subject, Predicate, Object)
|
|
192
|
+
; throw(tbd) % source is used internally
|
|
193
|
+
),
|
|
194
|
+
journal(update(TID, Subject, Predicate, Object, PayLoad, Action)).
|
|
195
|
+
|
|
196
|
+
%! rdfe_delete(+Subject)
|
|
197
|
+
%
|
|
198
|
+
% Delete a subject and all we know about it. This is a bit tricky.
|
|
199
|
+
% If we are involved in transitive relations, should we re-joint
|
|
200
|
+
% these in this module?
|
|
201
|
+
|
|
202
|
+
rdfe_delete(Subject) :-
|
|
203
|
+
rdfe_transaction(delete(Subject)).
|
|
204
|
+
|
|
205
|
+
delete(Subject) :-
|
|
206
|
+
rdfe_retractall(Subject, _, _),
|
|
207
|
+
rdfe_retractall(_, Subject, _),
|
|
208
|
+
rdfe_retractall(_, _, Subject).
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
/*******************************
|
|
212
|
+
* FILE HANDLING *
|
|
213
|
+
*******************************/
|
|
214
|
+
|
|
215
|
+
%! rdfe_load(+File) is det.
|
|
216
|
+
%! rdfe_load(+File, +Options) is det.
|
|
217
|
+
%
|
|
218
|
+
% Load an RDF file and record this action including version information
|
|
219
|
+
% to facilitate reliable reload.
|
|
220
|
+
|
|
221
|
+
rdfe_load(File) :-
|
|
222
|
+
rdfe_load(File, []).
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
rdfe_load(File, Options) :-
|
|
226
|
+
rdfe_current_transaction(TID),
|
|
227
|
+
absolute_file_name(File,
|
|
228
|
+
[ access(read),
|
|
229
|
+
extensions([rdf,rdfs,owl,ttl,nt,''])
|
|
230
|
+
], Path),
|
|
231
|
+
rdf_load(Path,
|
|
232
|
+
[ graph(Graph),
|
|
233
|
+
modified(Modified)
|
|
234
|
+
| Options
|
|
235
|
+
]),
|
|
236
|
+
( Modified == not_modified
|
|
237
|
+
-> true
|
|
238
|
+
; absolute_file_name('.', PWD),
|
|
239
|
+
size_file(Path, Size),
|
|
240
|
+
( Modified = last_modified(Stamp)
|
|
241
|
+
-> true
|
|
242
|
+
; time_file(Path, Stamp)
|
|
243
|
+
),
|
|
244
|
+
SecTime is round(Stamp),
|
|
245
|
+
rdf_statistics(triples_by_graph(Graph, Triples)),
|
|
246
|
+
rdf_md5(Graph, MD5),
|
|
247
|
+
assert_action(TID, load_file(Path), -, -, -),
|
|
248
|
+
journal(rdf_load(TID,
|
|
249
|
+
Path,
|
|
250
|
+
[ pwd(PWD),
|
|
251
|
+
size(Size),
|
|
252
|
+
modified(SecTime),
|
|
253
|
+
triples(Triples),
|
|
254
|
+
md5(MD5),
|
|
255
|
+
from(File)
|
|
256
|
+
])),
|
|
257
|
+
ensure_snapshot(Path)
|
|
258
|
+
).
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
rdfe_unload(Path) :-
|
|
262
|
+
rdfe_current_transaction(TID),
|
|
263
|
+
rdf_unload(Path),
|
|
264
|
+
assert_action(TID, unload_file(Path), -, -, -),
|
|
265
|
+
journal(rdf_unload(TID, Path)).
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
%! ensure_snapshot(+Path)
|
|
269
|
+
%
|
|
270
|
+
% Ensure we have a snapshot of Path if we are making a journal, so
|
|
271
|
+
% we can always reload the snapshot to ensure exactly the same
|
|
272
|
+
% state.
|
|
273
|
+
|
|
274
|
+
ensure_snapshot(Path) :-
|
|
275
|
+
rdfe_current_journal(_),
|
|
276
|
+
rdf_md5(Path, MD5),
|
|
277
|
+
( snapshot_file(Path, MD5,
|
|
278
|
+
[ access(read),
|
|
279
|
+
file_errors(fail)
|
|
280
|
+
],
|
|
281
|
+
File)
|
|
282
|
+
-> debug(snapshot, 'Existing snapshot for ~w on ~w', [Path, File])
|
|
283
|
+
; snapshot_file(Path, MD5,
|
|
284
|
+
[ access(write)
|
|
285
|
+
],
|
|
286
|
+
File),
|
|
287
|
+
debug(snapshot, 'Saving snapshot for ~w to ~w', [Path, File]),
|
|
288
|
+
rdf_save_db(File, Path)
|
|
289
|
+
),
|
|
290
|
+
assert(snapshot_file(File)).
|
|
291
|
+
ensure_snapshot(_).
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
%! load_snapshot(+Source, +Path)
|
|
295
|
+
%
|
|
296
|
+
% Load triples from the given snapshot file. One of the troubles
|
|
297
|
+
% is the time-stamp to avoid rdf_make/0 from reloading the file.
|
|
298
|
+
% for the time being we use 1e12, which is a lot further in the
|
|
299
|
+
% future than this system is going to live.
|
|
300
|
+
|
|
301
|
+
load_snapshot(Source, Path) :-
|
|
302
|
+
statistics(cputime, T0),
|
|
303
|
+
rdf_load_db(Path),
|
|
304
|
+
statistics(cputime, T1),
|
|
305
|
+
Time is T1 - T0,
|
|
306
|
+
rdf_statistics(triples_by_graph(Source, Triples)),
|
|
307
|
+
rdf_md5(Source, MD5),
|
|
308
|
+
% 1e10: modified far in the future
|
|
309
|
+
assert(rdf_db:rdf_source(Source, 1e12, Triples, MD5)),
|
|
310
|
+
print_message(informational,
|
|
311
|
+
rdf(loaded(Source, Triples, snapshot(Time)))),
|
|
312
|
+
assert(snapshot_file(Path)).
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
%! snapshot_file(+Path, +MD5, +Access, -File)
|
|
316
|
+
%
|
|
317
|
+
% Find existing snapsnot file or location to save a new one.
|
|
318
|
+
|
|
319
|
+
snapshot_file(Path, MD5, Options, SnapShot) :-
|
|
320
|
+
file_base_name(Path, Base),
|
|
321
|
+
atomic_list_concat([Base, @, MD5], File),
|
|
322
|
+
absolute_file_name(snapshot(File),
|
|
323
|
+
[ extensions([trp])
|
|
324
|
+
| Options
|
|
325
|
+
],
|
|
326
|
+
SnapShot).
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
%! rdfe_snapshot_file(-File)
|
|
330
|
+
%
|
|
331
|
+
% Enumerate the MD5 snapshot files required to restore the current
|
|
332
|
+
% journal file. Using this call we can write a routine that
|
|
333
|
+
% packages the journal file with all required snapshots to restore
|
|
334
|
+
% the journal on another computer.
|
|
335
|
+
|
|
336
|
+
rdfe_snapshot_file(File) :-
|
|
337
|
+
snapshot_file(File).
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
/*******************************
|
|
341
|
+
* NAMESPACE HANDLING *
|
|
342
|
+
*******************************/
|
|
343
|
+
|
|
344
|
+
:- dynamic
|
|
345
|
+
system_ns/2.
|
|
346
|
+
:- volatile
|
|
347
|
+
system_ns/2.
|
|
348
|
+
|
|
349
|
+
%! rdfe_register_ns(Id, URI)
|
|
350
|
+
%
|
|
351
|
+
% Encapsulation of rdf_register_ns(Id, URI)
|
|
352
|
+
|
|
353
|
+
rdfe_register_ns(Id, URI) :-
|
|
354
|
+
rdf_db:ns(Id, URI),
|
|
355
|
+
!.
|
|
356
|
+
rdfe_register_ns(Id, URI) :-
|
|
357
|
+
save_system_ns,
|
|
358
|
+
rdfe_current_transaction(TID),
|
|
359
|
+
rdf_register_ns(Id, URI),
|
|
360
|
+
broadcast(rdf_ns(register(Id, URI))),
|
|
361
|
+
assert_action(TID, ns(register(Id, URI)), -, -, -),
|
|
362
|
+
journal(ns(TID, register(Id, URI))).
|
|
363
|
+
|
|
364
|
+
rdfe_unregister_ns(Id, URI) :-
|
|
365
|
+
save_system_ns,
|
|
366
|
+
rdfe_current_transaction(TID),
|
|
367
|
+
retractall(rdf_db:ns(Id, URI)),
|
|
368
|
+
broadcast(rdf_ns(unregister(Id, URI))),
|
|
369
|
+
assert_action(TID, ns(unregister(Id, URI)), -, -, -),
|
|
370
|
+
journal(ns(TID, unregister(Id, URI))).
|
|
371
|
+
|
|
372
|
+
% rdfe_register_ns/0
|
|
373
|
+
%
|
|
374
|
+
% Reset namespaces to the state they were before usage of the
|
|
375
|
+
% rdf_edit layer.
|
|
376
|
+
|
|
377
|
+
rdfe_reset_ns :-
|
|
378
|
+
( system_ns(_, _)
|
|
379
|
+
-> retractall(rdf_db:ns(Id, URI)),
|
|
380
|
+
forall(system_ns(Id, URI), assert(rdf_db:ns(Id, URI)))
|
|
381
|
+
; true
|
|
382
|
+
).
|
|
383
|
+
|
|
384
|
+
save_system_ns :-
|
|
385
|
+
system_ns(_, _),
|
|
386
|
+
!. % already done
|
|
387
|
+
save_system_ns :-
|
|
388
|
+
forall(rdf_db:ns(Id, URI), assert(system_ns(Id, URI))).
|
|
389
|
+
|
|
390
|
+
|
|
391
|
+
/*******************************
|
|
392
|
+
* TRANSACTIONS *
|
|
393
|
+
*******************************/
|
|
394
|
+
|
|
395
|
+
%! rdfe_transaction(:Goal)
|
|
396
|
+
%
|
|
397
|
+
% Run Goal, recording all modifications as a single transaction.
|
|
398
|
+
% If Goal raises an exception or fails, all changes are
|
|
399
|
+
% rolled-back.
|
|
400
|
+
|
|
401
|
+
rdfe_transaction(Goal) :-
|
|
402
|
+
rdfe_transaction(Goal, []).
|
|
403
|
+
rdfe_transaction(Goal, Name) :-
|
|
404
|
+
rdfe_begin_transaction(Name),
|
|
405
|
+
( catch(Goal, E, true)
|
|
406
|
+
-> ( var(E)
|
|
407
|
+
-> check_file_protection(Error),
|
|
408
|
+
( var(Error)
|
|
409
|
+
-> rdfe_commit
|
|
410
|
+
; rdfe_rollback,
|
|
411
|
+
throw(Error)
|
|
412
|
+
)
|
|
413
|
+
; rdfe_rollback,
|
|
414
|
+
throw(E)
|
|
415
|
+
)
|
|
416
|
+
; rdfe_rollback,
|
|
417
|
+
fail
|
|
418
|
+
).
|
|
419
|
+
|
|
420
|
+
%! rdfe_begin_transaction
|
|
421
|
+
%
|
|
422
|
+
% Start a transaction. This is followed by either rdfe_end_transaction
|
|
423
|
+
% or rdfe_rollback. Transactions may be nested.
|
|
424
|
+
|
|
425
|
+
rdfe_begin_transaction(Name) :-
|
|
426
|
+
current_transaction(TID), % nested transaction
|
|
427
|
+
!,
|
|
428
|
+
append(TID, [1], TID2),
|
|
429
|
+
asserta(current_transaction(TID2)),
|
|
430
|
+
assert(transaction_name(TID2, Name)).
|
|
431
|
+
rdfe_begin_transaction(Name) :- % toplevel transaction
|
|
432
|
+
flag(rdf_edit_tid, TID, TID+1),
|
|
433
|
+
asserta(current_transaction([TID])),
|
|
434
|
+
assert(transaction_name(TID, Name)).
|
|
435
|
+
|
|
436
|
+
rdfe_current_transaction(TID) :-
|
|
437
|
+
current_transaction(TID),
|
|
438
|
+
!.
|
|
439
|
+
rdfe_current_transaction(_) :-
|
|
440
|
+
throw(error(existence_error(rdf_transaction, _), _)).
|
|
441
|
+
|
|
442
|
+
rdfe_commit :-
|
|
443
|
+
retract(current_transaction(TID)),
|
|
444
|
+
!,
|
|
445
|
+
retractall(undo_marker(_, _)),
|
|
446
|
+
( rdfe_transaction_member(TID, _)
|
|
447
|
+
-> get_time(Time), % transaction is not empty
|
|
448
|
+
journal(commit(TID, Time)),
|
|
449
|
+
( TID = [Id]
|
|
450
|
+
-> broadcast(rdf_transaction(Id))
|
|
451
|
+
; true
|
|
452
|
+
)
|
|
453
|
+
; true
|
|
454
|
+
).
|
|
455
|
+
|
|
456
|
+
rdfe_rollback :-
|
|
457
|
+
retract(current_transaction(TID)),
|
|
458
|
+
!,
|
|
459
|
+
journal(rollback(TID)),
|
|
460
|
+
rollback(TID).
|
|
461
|
+
|
|
462
|
+
%! rollback(+TID)
|
|
463
|
+
%
|
|
464
|
+
% This is the same as undo/1, but it must not record the undone
|
|
465
|
+
% actions as rollbacks cannot be `redone'. Somehow there should
|
|
466
|
+
% be a cleaner way to distinguish between transactional operations
|
|
467
|
+
% and plain operations.
|
|
468
|
+
|
|
469
|
+
rollback(TID) :-
|
|
470
|
+
append(TID, _, Id),
|
|
471
|
+
( retract(undo_log(Id, Action, Subject, Predicate, Object)),
|
|
472
|
+
( rollback(Action, Subject, Predicate, Object)
|
|
473
|
+
-> fail
|
|
474
|
+
; print_message(error,
|
|
475
|
+
rdf_undo_failed(undo(Action, Subject,
|
|
476
|
+
Predicate, Object))),
|
|
477
|
+
fail
|
|
478
|
+
)
|
|
479
|
+
; true
|
|
480
|
+
).
|
|
481
|
+
|
|
482
|
+
rollback(assert(PayLoad), Subject, Predicate, Object) :-
|
|
483
|
+
!,
|
|
484
|
+
rdf_retractall(Subject, Predicate, Object, PayLoad).
|
|
485
|
+
rollback(retract(PayLoad), Subject, Predicate, Object) :-
|
|
486
|
+
!,
|
|
487
|
+
rdf_assert(Subject, Predicate, Object, PayLoad).
|
|
488
|
+
rollback(Action, Subject, Predicate, Object) :-
|
|
489
|
+
action(Action),
|
|
490
|
+
!,
|
|
491
|
+
rdf_update(Subject, Predicate, Object, Action).
|
|
492
|
+
|
|
493
|
+
|
|
494
|
+
assert_action(TID, Action, Subject, Predicate, Object) :-
|
|
495
|
+
asserta(undo_log(TID, Action, Subject, Predicate, Object)).
|
|
496
|
+
|
|
497
|
+
%! undo(+TID)
|
|
498
|
+
%
|
|
499
|
+
% Undo a transaction as well as possible transactions nested into
|
|
500
|
+
% it.
|
|
501
|
+
|
|
502
|
+
undo(TID) :-
|
|
503
|
+
append(TID, _, Id),
|
|
504
|
+
( retract(undo_log(Id, Action, Subject, Predicate, Object)),
|
|
505
|
+
( undo(Action, Subject, Predicate, Object)
|
|
506
|
+
-> fail
|
|
507
|
+
; print_message(warning,
|
|
508
|
+
rdf_undo_failed(undo(Action, Subject,
|
|
509
|
+
Predicate, Object))),
|
|
510
|
+
fail
|
|
511
|
+
)
|
|
512
|
+
; true
|
|
513
|
+
).
|
|
514
|
+
|
|
515
|
+
undo(assert(PayLoad), Subject, Predicate, Object) :-
|
|
516
|
+
!,
|
|
517
|
+
rdfe_retractall(Subject, Predicate, Object, PayLoad).
|
|
518
|
+
undo(retract(PayLoad), Subject, Predicate, Object) :-
|
|
519
|
+
!,
|
|
520
|
+
rdfe_assert(Subject, Predicate, Object, PayLoad).
|
|
521
|
+
undo(source(Old, New), Subject, Predicate, Object) :-
|
|
522
|
+
!,
|
|
523
|
+
rdfe_update(Subject, Predicate, Object, Old, source(New)).
|
|
524
|
+
undo(ns(Action), -, -, -) :-
|
|
525
|
+
!,
|
|
526
|
+
( Action = register(Id, URI)
|
|
527
|
+
-> rdfe_unregister_ns(Id, URI)
|
|
528
|
+
; Action = unregister(Id, URI)
|
|
529
|
+
-> rdfe_register_ns(Id, URI)
|
|
530
|
+
).
|
|
531
|
+
undo(load_file(Path), -, -, -) :-
|
|
532
|
+
!,
|
|
533
|
+
rdfe_unload(Path).
|
|
534
|
+
undo(unload_file(Path), -, -, -) :-
|
|
535
|
+
!,
|
|
536
|
+
rdfe_load(Path).
|
|
537
|
+
undo(Action, Subject, Predicate, Object) :-
|
|
538
|
+
action(Action),
|
|
539
|
+
!,
|
|
540
|
+
rdfe_update(Subject, Predicate, Object, Action).
|
|
541
|
+
|
|
542
|
+
action(subject(_)).
|
|
543
|
+
action(predicate(_)).
|
|
544
|
+
action(object(_)).
|
|
545
|
+
|
|
546
|
+
%! rdfe_undo
|
|
547
|
+
%
|
|
548
|
+
% Undo a (toplevel) transaction. More calls do further undo. The
|
|
549
|
+
% `Undone' actions are re-added to the undo log, so the user can
|
|
550
|
+
% redo them. Fails if there are no more undo/redo transactions.
|
|
551
|
+
|
|
552
|
+
rdfe_undo :-
|
|
553
|
+
undo_marker(undo, TID),
|
|
554
|
+
!,
|
|
555
|
+
( undo_previous(TID, UnDone)
|
|
556
|
+
-> retractall(undo_marker(_, _)),
|
|
557
|
+
assert(undo_marker(undo, UnDone)),
|
|
558
|
+
broadcast(rdf_undo(undo, UnDone))
|
|
559
|
+
; fail % start of undo log
|
|
560
|
+
).
|
|
561
|
+
rdfe_undo :-
|
|
562
|
+
retract(undo_marker(redo, _)),
|
|
563
|
+
!,
|
|
564
|
+
last_transaction(TID),
|
|
565
|
+
undo_previous(TID, UnDone),
|
|
566
|
+
assert(undo_marker(undo, UnDone)),
|
|
567
|
+
broadcast(rdf_undo(undo, UnDone)).
|
|
568
|
+
rdfe_undo :-
|
|
569
|
+
last_transaction(TID),
|
|
570
|
+
undo_previous(TID, UnDone),
|
|
571
|
+
assert(undo_marker(undo, UnDone)),
|
|
572
|
+
broadcast(rdf_undo(undo, UnDone)).
|
|
573
|
+
|
|
574
|
+
find_previous_undo(-1, _) :-
|
|
575
|
+
!,
|
|
576
|
+
fail.
|
|
577
|
+
find_previous_undo(TID, TID) :-
|
|
578
|
+
undo_log([TID|_], _, _, _, _),
|
|
579
|
+
!.
|
|
580
|
+
find_previous_undo(TID0, TID) :-
|
|
581
|
+
TID1 is TID0 - 1,
|
|
582
|
+
find_previous_undo(TID1, TID).
|
|
583
|
+
|
|
584
|
+
undo_previous(TID, Undone) :-
|
|
585
|
+
find_previous_undo(TID, Undone),
|
|
586
|
+
rdfe_transaction(undo([Undone])).
|
|
587
|
+
|
|
588
|
+
last_transaction(TID) :-
|
|
589
|
+
undo_log([TID|_], _, _, _, _),
|
|
590
|
+
!.
|
|
591
|
+
|
|
592
|
+
%! rdfe_redo
|
|
593
|
+
%
|
|
594
|
+
% Start a redo-session
|
|
595
|
+
|
|
596
|
+
rdfe_redo :-
|
|
597
|
+
( retract(undo_marker(undo, _))
|
|
598
|
+
-> last_transaction(TID),
|
|
599
|
+
undo_previous(TID, UnDone),
|
|
600
|
+
assert(undo_marker(redo, UnDone)),
|
|
601
|
+
broadcast(rdf_undo(redo, UnDone))
|
|
602
|
+
; retract(undo_marker(redo, TID))
|
|
603
|
+
-> undo_previous(TID, UnDone),
|
|
604
|
+
assert(undo_marker(redo, UnDone)),
|
|
605
|
+
broadcast(rdf_undo(redo, UnDone))
|
|
606
|
+
; true
|
|
607
|
+
).
|
|
608
|
+
|
|
609
|
+
|
|
610
|
+
%! rdfe_can_redo(-TID) is semidet.
|
|
611
|
+
%! rdfe_can_undo(-TID) is semidet.
|
|
612
|
+
%
|
|
613
|
+
% Check if we can undo and if so return the id of the transaction
|
|
614
|
+
% that will be un/re-done. A subsequent call to rdfe_transaction_name
|
|
615
|
+
% can be used to give a hint in the UI.
|
|
616
|
+
|
|
617
|
+
rdfe_can_redo(Redo) :-
|
|
618
|
+
undo_marker(undo, _),
|
|
619
|
+
!,
|
|
620
|
+
last_transaction(TID),
|
|
621
|
+
find_previous_undo(TID, Redo).
|
|
622
|
+
rdfe_can_redo(Redo) :-
|
|
623
|
+
undo_marker(redo, TID),
|
|
624
|
+
find_previous_undo(TID, Redo).
|
|
625
|
+
|
|
626
|
+
rdfe_can_undo(Undo) :- % continue undo
|
|
627
|
+
undo_marker(undo, TID),
|
|
628
|
+
!,
|
|
629
|
+
find_previous_undo(TID, Undo).
|
|
630
|
+
rdfe_can_undo(Undo) :- % start undo
|
|
631
|
+
last_transaction(TID),
|
|
632
|
+
find_previous_undo(TID, Undo).
|
|
633
|
+
|
|
634
|
+
%! rdfe_transaction_name(+TID, -Name)
|
|
635
|
+
%
|
|
636
|
+
% Return name if the transaction is named.
|
|
637
|
+
|
|
638
|
+
rdfe_transaction_name(TID, Name) :-
|
|
639
|
+
transaction_name(TID, Name),
|
|
640
|
+
Name \== [].
|
|
641
|
+
|
|
642
|
+
%! rdfe_set_transaction_name(+Name)
|
|
643
|
+
%
|
|
644
|
+
% Set name of the current transaction
|
|
645
|
+
|
|
646
|
+
rdfe_set_transaction_name(Name) :-
|
|
647
|
+
current_transaction(TID),
|
|
648
|
+
!,
|
|
649
|
+
assert(transaction_name(TID, Name)).
|
|
650
|
+
|
|
651
|
+
%! rdfe_transaction_member(+TID, -Action)
|
|
652
|
+
%
|
|
653
|
+
% Query actions inside a transaction to allow for quick update
|
|
654
|
+
% of visualisers.
|
|
655
|
+
|
|
656
|
+
rdfe_transaction_member(TID, Member) :-
|
|
657
|
+
( integer(TID)
|
|
658
|
+
-> Id = [TID|_]
|
|
659
|
+
; append(TID, _, Id)
|
|
660
|
+
),
|
|
661
|
+
undo_log(Id, Action, Subject, Predicate, Object),
|
|
662
|
+
user_transaction_member(Action, Subject, Predicate, Object, Member).
|
|
663
|
+
|
|
664
|
+
user_transaction_member(assert(_), Subject, Predicate, Object,
|
|
665
|
+
assert(Subject, Predicate, Object)) :- !.
|
|
666
|
+
user_transaction_member(retract(_), Subject, Predicate, Object,
|
|
667
|
+
retract(Subject, Predicate, Object)) :- !.
|
|
668
|
+
user_transaction_member(load_file(Path), -, -, -,
|
|
669
|
+
file(load(Path))) :- !.
|
|
670
|
+
user_transaction_member(unload_file(Path), -, -, -,
|
|
671
|
+
file(unload(Path))) :- !.
|
|
672
|
+
user_transaction_member(Update, Subject, Predicate, Object,
|
|
673
|
+
update(Subject, Predicate, Object, Update)).
|
|
674
|
+
|
|
675
|
+
|
|
676
|
+
/*******************************
|
|
677
|
+
* PROTECTION *
|
|
678
|
+
*******************************/
|
|
679
|
+
|
|
680
|
+
:- dynamic
|
|
681
|
+
rdf_source_permission/2, % file, ro/rw
|
|
682
|
+
rdf_current_default_file/2. % file, all/fallback
|
|
683
|
+
|
|
684
|
+
%! rdfe_set_file_property(+File, +Options)
|
|
685
|
+
%
|
|
686
|
+
% Set properties on the file. Options is one of
|
|
687
|
+
%
|
|
688
|
+
% * access(ro/rw)
|
|
689
|
+
% * default(all/fallback)
|
|
690
|
+
|
|
691
|
+
rdfe_set_file_property(File, access(Access)) :-
|
|
692
|
+
!,
|
|
693
|
+
to_uri(File, URL),
|
|
694
|
+
retractall(rdf_source_permission(URL, _)),
|
|
695
|
+
assert(rdf_source_permission(URL, Access)),
|
|
696
|
+
broadcast(rdf_file_property(URL, access(Access))).
|
|
697
|
+
rdfe_set_file_property(File, default(Type)) :-
|
|
698
|
+
to_uri(File, URL),
|
|
699
|
+
rdfe_set_file_property(URL, access(rw)), % must be writeable
|
|
700
|
+
retractall(rdf_current_default_file(_,_)),
|
|
701
|
+
assert(rdf_current_default_file(URL, Type)),
|
|
702
|
+
broadcast(rdf_file_property(URL, default(Type))).
|
|
703
|
+
|
|
704
|
+
|
|
705
|
+
%! rdfe_get_file_property(+FileOrURL, ?Option).
|
|
706
|
+
%! rdfe_get_file_property(-URL, ?Option).
|
|
707
|
+
%
|
|
708
|
+
% Fetch file properties set with rdfe_set_file_property/2.
|
|
709
|
+
|
|
710
|
+
rdfe_get_file_property(FileOrURL, access(Access)) :-
|
|
711
|
+
( ground(FileOrURL)
|
|
712
|
+
-> to_uri(FileOrURL, URL)
|
|
713
|
+
; rdf_source(_DB, URL),
|
|
714
|
+
FileOrURL = URL
|
|
715
|
+
),
|
|
716
|
+
( rdf_source_permission(URL, Access0)
|
|
717
|
+
-> Access0 = Access
|
|
718
|
+
; uri_file_name(URL, File),
|
|
719
|
+
access_file(File, write)
|
|
720
|
+
-> assert(rdf_source_permission(URL, rw)),
|
|
721
|
+
Access = rw
|
|
722
|
+
; assert(rdf_source_permission(URL, ro)),
|
|
723
|
+
Access = ro
|
|
724
|
+
).
|
|
725
|
+
rdfe_get_file_property(FileOrURL, default(Default)) :-
|
|
726
|
+
ground(FileOrURL),
|
|
727
|
+
to_uri(FileOrURL, URL),
|
|
728
|
+
( rdf_current_default_file(URL, Default)
|
|
729
|
+
-> true
|
|
730
|
+
; FileOrURL = user,
|
|
731
|
+
Default = fallback
|
|
732
|
+
).
|
|
733
|
+
rdfe_get_file_property(URL, default(Default)) :-
|
|
734
|
+
( rdf_current_default_file(URL, Default)
|
|
735
|
+
-> true
|
|
736
|
+
; URL = user,
|
|
737
|
+
Default = fallback
|
|
738
|
+
).
|
|
739
|
+
|
|
740
|
+
|
|
741
|
+
%! check_file_protection(-Error)
|
|
742
|
+
%
|
|
743
|
+
% Check modification of all protected files
|
|
744
|
+
|
|
745
|
+
check_file_protection(Error) :-
|
|
746
|
+
( rdfe_get_file_property(File, access(ro)),
|
|
747
|
+
rdfe_is_modified(File)
|
|
748
|
+
-> Error = error(permission_error(modify, source, File), triple20)
|
|
749
|
+
; true
|
|
750
|
+
).
|
|
751
|
+
|
|
752
|
+
|
|
753
|
+
%! to_uri(+Spec, -URL) is det.
|
|
754
|
+
%
|
|
755
|
+
% Convert a specification into a URL.
|
|
756
|
+
|
|
757
|
+
to_uri(URL, URL) :-
|
|
758
|
+
uri_components(URL, Components),
|
|
759
|
+
uri_data(scheme, Components, Scheme),
|
|
760
|
+
nonvar(Scheme),
|
|
761
|
+
uri_scheme(Scheme),
|
|
762
|
+
!.
|
|
763
|
+
to_uri(File, URL) :-
|
|
764
|
+
uri_file_name(URL, File).
|
|
765
|
+
|
|
766
|
+
|
|
767
|
+
uri_scheme(file).
|
|
768
|
+
uri_scheme(http).
|
|
769
|
+
uri_scheme(https).
|
|
770
|
+
uri_scheme(ftp).
|
|
771
|
+
uri_scheme(ftps).
|
|
772
|
+
|
|
773
|
+
|
|
774
|
+
/*******************************
|
|
775
|
+
* MODIFIED *
|
|
776
|
+
*******************************/
|
|
777
|
+
|
|
778
|
+
%! rdfe_is_modified(?Source)
|
|
779
|
+
%
|
|
780
|
+
% True if facts have been added, deleted or updated that have
|
|
781
|
+
% Source as `payload'.
|
|
782
|
+
|
|
783
|
+
rdfe_is_modified(Source) :-
|
|
784
|
+
rdf_source(Graph, Source),
|
|
785
|
+
rdf_graph_property(Graph, modified(true)).
|
|
786
|
+
|
|
787
|
+
|
|
788
|
+
rdfe_clear_modified :-
|
|
789
|
+
forall(rdf_graph(File),
|
|
790
|
+
rdfe_clear_modified(File)).
|
|
791
|
+
|
|
792
|
+
%! rdfe_clear_modified(+Graph) is det.
|
|
793
|
+
%
|
|
794
|
+
% Consider the current state of Graph as _unmodified_.
|
|
795
|
+
|
|
796
|
+
rdfe_clear_modified(Graph) :-
|
|
797
|
+
rdf_set_graph(Graph, modified(false)).
|
|
798
|
+
|
|
799
|
+
|
|
800
|
+
/*******************************
|
|
801
|
+
* WATERMARKS *
|
|
802
|
+
*******************************/
|
|
803
|
+
|
|
804
|
+
%! rdfe_set_watermark(Name)
|
|
805
|
+
%
|
|
806
|
+
% Create a watermark for undo and replay journal upto this point.
|
|
807
|
+
% The rest of the logic needs to be written later.
|
|
808
|
+
|
|
809
|
+
rdfe_set_watermark(Name) :-
|
|
810
|
+
rdfe_current_transaction(TID),
|
|
811
|
+
assert_action(TID, watermark(Name), -, -, -),
|
|
812
|
+
journal(watermark(TID, Name)).
|
|
813
|
+
|
|
814
|
+
|
|
815
|
+
/*******************************
|
|
816
|
+
* RESET *
|
|
817
|
+
*******************************/
|
|
818
|
+
|
|
819
|
+
%! rdfe_reset
|
|
820
|
+
%
|
|
821
|
+
% Clear database, undo, namespaces and journalling info.
|
|
822
|
+
|
|
823
|
+
rdfe_reset :-
|
|
824
|
+
rdfe_reset_journal,
|
|
825
|
+
rdfe_reset_ns,
|
|
826
|
+
rdfe_reset_undo,
|
|
827
|
+
rdf_reset_db,
|
|
828
|
+
broadcast(rdf_reset).
|
|
829
|
+
|
|
830
|
+
%! rdfe_reset_journal
|
|
831
|
+
%
|
|
832
|
+
% If a journal is open, close it using rdfe_close_journal/0
|
|
833
|
+
|
|
834
|
+
rdfe_reset_journal :-
|
|
835
|
+
( rdfe_current_journal(_)
|
|
836
|
+
-> rdfe_close_journal
|
|
837
|
+
; true
|
|
838
|
+
).
|
|
839
|
+
|
|
840
|
+
rdfe_reset_undo :-
|
|
841
|
+
retractall(undo_log(_,_,_,_,_)),
|
|
842
|
+
retractall(current_transaction(_)),
|
|
843
|
+
retractall(transaction_name(_,_)),
|
|
844
|
+
retractall(undo_marker(_,_)),
|
|
845
|
+
retractall(snapshot_file(_)).
|
|
846
|
+
|
|
847
|
+
% close possible open journal at exit. Using a Prolog hook
|
|
848
|
+
% guarantees closure, even for most crashes.
|
|
849
|
+
|
|
850
|
+
:- at_halt(rdfe_reset_journal).
|
|
851
|
+
|
|
852
|
+
|
|
853
|
+
/*******************************
|
|
854
|
+
* JOURNALLING *
|
|
855
|
+
*******************************/
|
|
856
|
+
|
|
857
|
+
journal_version(1).
|
|
858
|
+
|
|
859
|
+
%! rdfe_open_journal(+File, +Mode) is det.
|
|
860
|
+
%
|
|
861
|
+
% Open a journal writing to File in Mode. Mode is one of
|
|
862
|
+
%
|
|
863
|
+
% * read
|
|
864
|
+
% Open and replay the journal
|
|
865
|
+
%
|
|
866
|
+
% * write
|
|
867
|
+
% Delete current journal and create a fresh one
|
|
868
|
+
%
|
|
869
|
+
% * append
|
|
870
|
+
% Read and replay the existing journal and append new
|
|
871
|
+
% modifications to the File.
|
|
872
|
+
|
|
873
|
+
rdfe_open_journal(_, _) :- % already open
|
|
874
|
+
journal(_, _, _),
|
|
875
|
+
!.
|
|
876
|
+
rdfe_open_journal(File, read) :-
|
|
877
|
+
!,
|
|
878
|
+
absolute_file_name(File,
|
|
879
|
+
[ extensions([rdfj, '']),
|
|
880
|
+
access(read)
|
|
881
|
+
],
|
|
882
|
+
Path),
|
|
883
|
+
rdfe_replay_journal(Path),
|
|
884
|
+
rdfe_clear_modified.
|
|
885
|
+
rdfe_open_journal(File, write) :-
|
|
886
|
+
!,
|
|
887
|
+
absolute_file_name(File,
|
|
888
|
+
[ extensions([rdfj, '']),
|
|
889
|
+
access(write)
|
|
890
|
+
],
|
|
891
|
+
Path),
|
|
892
|
+
open(Path, write, Stream, [close_on_abort(false)]),
|
|
893
|
+
assert(journal(Path, write, Stream)),
|
|
894
|
+
get_time(T),
|
|
895
|
+
journal_open(start, T).
|
|
896
|
+
rdfe_open_journal(File, append) :-
|
|
897
|
+
working_directory(CWD, CWD),
|
|
898
|
+
absolute_file_name(File,
|
|
899
|
+
[ extensions([rdfj, '']),
|
|
900
|
+
relative_to(CWD),
|
|
901
|
+
access(write)
|
|
902
|
+
],
|
|
903
|
+
Path),
|
|
904
|
+
( exists_file(Path)
|
|
905
|
+
-> rdfe_replay_journal(Path),
|
|
906
|
+
rdfe_clear_modified,
|
|
907
|
+
get_time(T),
|
|
908
|
+
assert(journal(Path, append(T), []))
|
|
909
|
+
; rdfe_open_journal(Path, write)
|
|
910
|
+
).
|
|
911
|
+
|
|
912
|
+
|
|
913
|
+
journal_open(Type, Time) :-
|
|
914
|
+
journal_comment(Type, Time),
|
|
915
|
+
SecTime is round(Time),
|
|
916
|
+
journal_version(Version),
|
|
917
|
+
Start =.. [ Type, [ time(SecTime),
|
|
918
|
+
version(Version)
|
|
919
|
+
]
|
|
920
|
+
],
|
|
921
|
+
journal(Start),
|
|
922
|
+
broadcast(rdf_journal(Start)).
|
|
923
|
+
|
|
924
|
+
journal_comment(start, Time) :-
|
|
925
|
+
journal(_, _, Stream),
|
|
926
|
+
format_time(string(String), '%+', Time),
|
|
927
|
+
format(Stream,
|
|
928
|
+
'/* Triple20 Journal File\n\n \c
|
|
929
|
+
Created: ~w\n \c
|
|
930
|
+
Triple20 by Jan Wielemaker <wielemak@science.uva.nl>\n\n \c
|
|
931
|
+
EDIT WITH CARE!\n\c
|
|
932
|
+
*/~n~n', [String]).
|
|
933
|
+
journal_comment(resume, Time) :-
|
|
934
|
+
journal(_, _, Stream),
|
|
935
|
+
format_time(string(String), '%+', Time),
|
|
936
|
+
format(Stream,
|
|
937
|
+
'\n\c
|
|
938
|
+
/* Resumed: ~w\n\c
|
|
939
|
+
*/~n~n', [String]).
|
|
940
|
+
|
|
941
|
+
%! rdfe_close_journal
|
|
942
|
+
%
|
|
943
|
+
% Close the journal. Automatically called from at program
|
|
944
|
+
% termination from at_halt/1.
|
|
945
|
+
|
|
946
|
+
rdfe_close_journal :-
|
|
947
|
+
get_time(T),
|
|
948
|
+
SecTime is round(T),
|
|
949
|
+
journal(end([ time(SecTime)
|
|
950
|
+
])),
|
|
951
|
+
retract(journal(_, Mode, Stream)),
|
|
952
|
+
( Mode = append(_)
|
|
953
|
+
-> true
|
|
954
|
+
; close(Stream)
|
|
955
|
+
).
|
|
956
|
+
|
|
957
|
+
%! rdfe_current_journal(-Path)
|
|
958
|
+
%
|
|
959
|
+
% Query the currently open journal
|
|
960
|
+
|
|
961
|
+
rdfe_current_journal(Path) :-
|
|
962
|
+
journal(Path, _Mode, _Stream).
|
|
963
|
+
|
|
964
|
+
journal(Term) :-
|
|
965
|
+
journal(Path, append(T), _),
|
|
966
|
+
!,
|
|
967
|
+
( Term = end(_)
|
|
968
|
+
-> true
|
|
969
|
+
; open(Path, append, Stream, [close_on_abort(false)]),
|
|
970
|
+
retractall(journal(Path, _, _)),
|
|
971
|
+
assert(journal(Path, append, Stream)),
|
|
972
|
+
journal_open(resume, T),
|
|
973
|
+
journal(Term)
|
|
974
|
+
).
|
|
975
|
+
journal(Term) :-
|
|
976
|
+
( journal(_, _, Stream)
|
|
977
|
+
-> write_journal(Term, Stream),
|
|
978
|
+
flush_output(Stream)
|
|
979
|
+
; broadcast(rdf_no_journal(Term))
|
|
980
|
+
).
|
|
981
|
+
|
|
982
|
+
write_journal(commit(TID, Time), Stream) :-
|
|
983
|
+
!,
|
|
984
|
+
format(Stream, 'commit(~q, ~2f).~n~n', [TID, Time]).
|
|
985
|
+
write_journal(Term, Stream) :-
|
|
986
|
+
format(Stream, '~q.~n', [Term]).
|
|
987
|
+
|
|
988
|
+
|
|
989
|
+
%! rdfe_replay_journal(+File)
|
|
990
|
+
%
|
|
991
|
+
% Replay a journal file. For now this is our cheap way to deal
|
|
992
|
+
% with save/load. Future versions may be more clever when dealing
|
|
993
|
+
% with the version information stored in the journal.
|
|
994
|
+
|
|
995
|
+
rdfe_replay_journal(File) :-
|
|
996
|
+
absolute_file_name(File,
|
|
997
|
+
[ extensions([rdfj, '']),
|
|
998
|
+
access(read)
|
|
999
|
+
],
|
|
1000
|
+
Path),
|
|
1001
|
+
open(Path, read, Stream),
|
|
1002
|
+
replay(Stream),
|
|
1003
|
+
close(Stream).
|
|
1004
|
+
|
|
1005
|
+
replay(Stream) :-
|
|
1006
|
+
read(Stream, Term),
|
|
1007
|
+
replay(Term, Stream).
|
|
1008
|
+
|
|
1009
|
+
replay(end_of_file, _) :- !.
|
|
1010
|
+
replay(start(_Attributes), Stream) :-
|
|
1011
|
+
!,
|
|
1012
|
+
read(Stream, Term),
|
|
1013
|
+
replay(Term, Stream).
|
|
1014
|
+
replay(resume(_Attributes), Stream) :-
|
|
1015
|
+
!,
|
|
1016
|
+
read(Stream, Term),
|
|
1017
|
+
replay(Term, Stream).
|
|
1018
|
+
replay(end(_Attributes), Stream) :-
|
|
1019
|
+
!,
|
|
1020
|
+
read(Stream, Term),
|
|
1021
|
+
replay(Term, Stream).
|
|
1022
|
+
replay(Term0, Stream) :-
|
|
1023
|
+
replay_transaction(Term0, Stream),
|
|
1024
|
+
read(Stream, Term),
|
|
1025
|
+
replay(Term, Stream).
|
|
1026
|
+
|
|
1027
|
+
replay_transaction(Term0, Stream) :-
|
|
1028
|
+
collect_transaction(Term0, Stream, Transaction, Last),
|
|
1029
|
+
( committed_transaction(Last)
|
|
1030
|
+
-> replay_actions(Transaction)
|
|
1031
|
+
; true
|
|
1032
|
+
).
|
|
1033
|
+
|
|
1034
|
+
collect_transaction(End, _, [], End) :-
|
|
1035
|
+
ends_transaction(End),
|
|
1036
|
+
!.
|
|
1037
|
+
collect_transaction(A, Stream, [A|T], End) :-
|
|
1038
|
+
read(Stream, Term),
|
|
1039
|
+
collect_transaction(Term, Stream, T, End).
|
|
1040
|
+
|
|
1041
|
+
committed_transaction(commit(_)).
|
|
1042
|
+
committed_transaction(commit(_, _)).
|
|
1043
|
+
|
|
1044
|
+
ends_transaction(end_of_file).
|
|
1045
|
+
ends_transaction(commit(_)).
|
|
1046
|
+
ends_transaction(commit(_, _)).
|
|
1047
|
+
ends_transaction(rollback(_)).
|
|
1048
|
+
ends_transaction(end(_)).
|
|
1049
|
+
ends_transaction(start(_)).
|
|
1050
|
+
|
|
1051
|
+
replay_actions([]).
|
|
1052
|
+
replay_actions([H|T]) :-
|
|
1053
|
+
( replay_action(H)
|
|
1054
|
+
-> replay_actions(T)
|
|
1055
|
+
; print_message(warning,
|
|
1056
|
+
rdf_replay_failed(H)),
|
|
1057
|
+
( debugging(journal)
|
|
1058
|
+
-> gtrace,
|
|
1059
|
+
replay_actions([H|T])
|
|
1060
|
+
; replay_actions(T)
|
|
1061
|
+
)
|
|
1062
|
+
).
|
|
1063
|
+
|
|
1064
|
+
|
|
1065
|
+
%! replay_action(+Action)
|
|
1066
|
+
%
|
|
1067
|
+
% Replay actions from the journal. Tricky is rdf_load/3. It should
|
|
1068
|
+
% reload the file in the state it was in at the moment it was
|
|
1069
|
+
% created. For now this has been hacked for files that were empry
|
|
1070
|
+
% at the moment they where loaded (e.g. created from `new_file' in
|
|
1071
|
+
% our GUI prototype). How to solve this? We could warn if the file
|
|
1072
|
+
% appears changed, but this isn't really easy as copying and OS
|
|
1073
|
+
% differences makes it hard to decide on changes by length as well
|
|
1074
|
+
% as modification time. Alternatively we could save the state in
|
|
1075
|
+
% separate quick-load states.
|
|
1076
|
+
|
|
1077
|
+
replay_action(retract(_, Subject, Predicate, Object, PayLoad)) :-
|
|
1078
|
+
rdf_retractall(Subject, Predicate, Object, PayLoad).
|
|
1079
|
+
replay_action(assert(_, Subject, Predicate, Object, PayLoad)) :-
|
|
1080
|
+
rdf_assert(Subject, Predicate, Object, PayLoad).
|
|
1081
|
+
replay_action(update(_, Subject, Predicate, Object, Action)) :-
|
|
1082
|
+
rdf_update(Subject, Predicate, Object, Action).
|
|
1083
|
+
replay_action(update(_, Subject, Predicate, Object, Payload, Action)) :-
|
|
1084
|
+
rdf_update(Subject, Predicate, Object, Payload, Action).
|
|
1085
|
+
replay_action(rdf_load(_, File, Options)) :-
|
|
1086
|
+
memberchk(md5(MD5), Options),
|
|
1087
|
+
snapshot_file(File, MD5,
|
|
1088
|
+
[ access(read),
|
|
1089
|
+
file_errors(fail)
|
|
1090
|
+
],
|
|
1091
|
+
Path),
|
|
1092
|
+
!,
|
|
1093
|
+
debug(snapshot, 'Reloading snapshot ~w~n', [Path]),
|
|
1094
|
+
load_snapshot(File, Path).
|
|
1095
|
+
replay_action(rdf_load(_, File, Options)) :-
|
|
1096
|
+
find_file(File, Options, Path),
|
|
1097
|
+
( memberchk(triples(0), Options),
|
|
1098
|
+
memberchk(modified(Modified), Options)
|
|
1099
|
+
-> rdf_retractall(_,_,_,Path:_),
|
|
1100
|
+
retractall(rdf_db:rdf_source(Path, _, _, _)), % TBD: move
|
|
1101
|
+
rdf_md5(Path, MD5),
|
|
1102
|
+
assert(rdf_db:rdf_source(Path, Modified, 0, MD5))
|
|
1103
|
+
; rdf_load(Path)
|
|
1104
|
+
).
|
|
1105
|
+
replay_action(rdf_unload(_, Source)) :-
|
|
1106
|
+
rdf_unload(Source).
|
|
1107
|
+
replay_action(ns(_, register(ID, URI))) :-
|
|
1108
|
+
!,
|
|
1109
|
+
rdf_register_ns(ID, URI).
|
|
1110
|
+
replay_action(ns(_, unregister(ID, URI))) :-
|
|
1111
|
+
retractall(rdf_db:ns(ID, URI)).
|
|
1112
|
+
replay_action(watermark(_, _Name)) :-
|
|
1113
|
+
true.
|
|
1114
|
+
|
|
1115
|
+
find_file(File, _, File) :-
|
|
1116
|
+
exists_file(File),
|
|
1117
|
+
!.
|
|
1118
|
+
find_file(File, Options, Path) :-
|
|
1119
|
+
memberchk(pwd(PWD), Options),
|
|
1120
|
+
make_path(File, PWD, Path),
|
|
1121
|
+
exists_file(Path),
|
|
1122
|
+
!.
|
|
1123
|
+
|
|
1124
|
+
%! make_path(+File, +PWD, -Path)
|
|
1125
|
+
%
|
|
1126
|
+
% Return location of File relative to PWD, Parent of PWD, etc. (TBD)
|
|
1127
|
+
|
|
1128
|
+
make_path(File, PWD, Path) :-
|
|
1129
|
+
atom_concat(PWD, /, PWD2),
|
|
1130
|
+
atom_concat(PWD2, Path, File).
|
|
1131
|
+
|
|
1132
|
+
|
|
1133
|
+
/*******************************
|
|
1134
|
+
* MESSAGES *
|
|
1135
|
+
*******************************/
|
|
1136
|
+
|
|
1137
|
+
:- multifile
|
|
1138
|
+
prolog:message/3.
|
|
1139
|
+
|
|
1140
|
+
% Catch messages.
|
|
1141
|
+
|
|
1142
|
+
prolog:message(rdf_replay_failed(Term)) -->
|
|
1143
|
+
[ 'RDFDB: Replay of ~p failed'-[Term] ].
|
|
1144
|
+
prolog:message(rdf_undo_failed(Term)) -->
|
|
1145
|
+
[ 'RDFDB: Undo of ~p failed'-[Term] ].
|