id
int64 0
45.1k
| file_name
stringlengths 4
68
| file_path
stringlengths 14
193
| content
stringlengths 32
9.62M
| size
int64 32
9.62M
| language
stringclasses 1
value | extension
stringclasses 6
values | total_lines
int64 1
136k
| avg_line_length
float64 3
903k
| max_line_length
int64 3
4.51M
| alphanum_fraction
float64 0
1
| repo_name
stringclasses 779
values | repo_stars
int64 0
882
| repo_forks
int64 0
108
| repo_open_issues
int64 0
90
| repo_license
stringclasses 8
values | repo_extraction_date
stringclasses 146
values | sha
stringlengths 64
64
| __index_level_0__
int64 0
45.1k
| exdup_ids_cmlisp_stkv2
sequencelengths 1
47
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
28,686 | search.lsp | shlomif_Kevin-Atkinson-AI-Freecell-Solver-in-Lisp/code/search.lsp | ;; search.lsp - the actual code to play a game.
;; Copyright (C) 2001 by Kevin Atkinson <[email protected]>
;;
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License,
;; version 2, as published by the Free Software Foundation.
;;
;; 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 program; if not, write to the Free Software
;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
;; USA or go to www.gnu.org.
(provide 'search)
(require 'game)
(declaim (inline est))
(defun est (game)
#!(decl-type (game game))
(+ (cards-left game)))
;;
;; df-search
;;
(defstruct result
(num-moves max-moves ; num moves till this one
:type num-moves)
(lp-moves-left 0 ; least possible moves left
:type num-moves)
(est 0
:type num-moves)
(old nil
:type boolean))
(deftype depth () `num-moves)
(defun df-search (start-game
&key
(limit 150)
(jump-when 20000)
(jump-scale 0.90)
(give-up-after nil)
(after-sol (* jump-when
(+ (expt 2 5) 2)))
;; set give-up-after amd after-sol to nil
;; to let the search run to completion
&aux
(visited (make-hash-table :test #'equalp))
(count 0)
(key nil)
(moves nil)
#|(last-jump-depth 0)
(tally-old (make-array limit
:element-type 'fixnum
:initial-element 0))
(tally-new (make-array limit
:element-type 'fixnum
:initial-element 0))|#
(best-sol nil)
(best-sol-num-moves limit)
(since-last 0) ; count since last solution or jump
(prev-jumps '(0))
(jump-to nil))
#!(decl-type (game start-game)
(depth limit)
(fixnum jump-when)
(single-float jump-scale)
((or null fixnum) give-up-after after-sol)
((list-of fixnum) prev-jumps)
(fixnum count)
#|(depth last-jump-depth)|#
((or null game) best-sol)
(num-moves best-sol-num-moves)
(fixnum since-last)
((or null depth) jump-to))
(labels
((search0 (game depth &aux result)
#!(decl-type (game game) (depth depth))
(incf count)
(incf since-last)
(setf key (game-key game))
(let* ((prev (gethash key visited)))
(cond
((null prev)
(setf result (make-result :num-moves (num-moves game)
:lp-moves-left (est game))))
((< (num-moves game) (result-num-moves prev))
(setf (result-num-moves prev) (num-moves game))
(setf result prev)
(remhash key visited))
(t
#|(let ((i (- depth last-jump-depth)))
(when (< i 0)
(setf i 0))
(if (result-old prev)
(incf (aref tally-old i))
(incf (aref tally-new i)))
(setf (result-old prev) nil))|#
(setf result prev)
(return-from search0 max-moves))))
;; found a solution
(when (= (cards-left game) 0)
(setf (result-lp-moves-left result) 0)
(setf best-sol game)
(setf best-sol-num-moves (num-moves game))
(setf since-last 0)
(setf prev-jumps '(0))
(when after-sol
(setf give-up-after after-sol)
(setf count 0))
(format t "*** Found a sol with ~A moves. *** " (num-moves game))
(let ((c 0))
(declare (type fixnum c))
(maphash (lambda (k v)
(when (<= (num-moves game)
(+ (result-num-moves v) (result-est v)))
(remhash k visited)
(incf c)))
visited)
(format t "Purged ~A states.~%" c))
(return-from search0 (result-lp-moves-left result)))
;; give up
(when (and give-up-after (> count give-up-after))
(return-from search0 (result-lp-moves-left result)))
;; if this solution is not going to possible be better
;; there is no point is constantly trying
(when (>= (+ (num-moves game) (result-lp-moves-left result))
best-sol-num-moves)
(return-from search0 (result-lp-moves-left result)))
;; If a solution has not been found in x number of moves
;; jump up some in the stack
(when (> since-last jump-when)
(let ((fac 1) (scale 0.0))
(declare (type fixnum fac) (type single-float scale))
(do ((f 1 (* f 2)))
((/= (the fixnum (car prev-jumps)) f)
(setf fac f))
(declare (type fixnum f))
(pop prev-jumps))
(setf scale (expt jump-scale fac))
(setf jump-to (truncate (* depth scale)))
(unless (= jump-to 0)
(push fac prev-jumps))
(setf since-last 0)
#|(setf last-jump-depth jump-to)|#
(maphash (lambda (k v)
(declare (ignore k))
(setf (result-old v) t))
visited)
(format t ">> Count: ~A, Hash Size: ~A~%"
count (hash-table-count visited))
(format t "Jumping To ~A from ~A, Scale: ~A, ~A ... "
jump-to depth scale prev-jumps)
(return-from search0 (result-lp-moves-left result))))
(setf moves (valid-single-moves game))
(when moves
(setf (result-est result) (est game))
(setf (gethash key visited) result))
;; try possibe moves
(let ((local-min max-moves))
(dolist (move moves)
(let ((new-game (copy-game game)))
(unsafe-make-single-move new-game
(move-from move) (move-to move))
(let ((min (search0 new-game (+ 1 depth))))
(declare (type num-moves min))
(incf min)
(when (< min local-min)
(setf local-min min))
(when jump-to
(cond
((<= depth jump-to)
(format t " Done~%" depth)
(setf jump-to nil))
(t
(return)))))))
(setf (result-lp-moves-left result) local-min))
(return-from search0 (result-lp-moves-left result))))
(search0 start-game 0)
#|(dotimes (x limit)
(format t "~3@A: ~6@A ~6@A~%" x (aref tally-old x) (aref tally-new x)))|#
(values best-sol #|tally-old tally-new|#)))
| 6,083 | Common Lisp | .l | 181 | 28.044199 | 79 | 0.615438 | shlomif/Kevin-Atkinson-AI-Freecell-Solver-in-Lisp | 0 | 0 | 0 | GPL-2.0 | 9/19/2024, 11:36:04 AM (Europe/Amsterdam) | 57226aeaa355c25b14d15fdbc6bac1f224b191f41fc2c4f2a37514f707b32584 | 28,686 | [
-1
] |
28,687 | card.lsp | shlomif_Kevin-Atkinson-AI-Freecell-Solver-in-Lisp/code/card.lsp | ;; card.lsp -
;; Copyright (C) 2001 by Kevin Atkinson <[email protected]>
;;
;; 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 program; if not, write to the Free Software
;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
;; USA or go to www.gnu.org.
;;; This file contains various structures and utilies for dealing
;;; with playing cards
(provide 'card)
(require 'util)
;;
;; Constants and types
;;
(deftype card-num ()
`(integer 0 51))
(defconstant num-suits 4)
(declaim (type (unsigned-byte 3) num-suits))
(defconstant num-ranks 13)
(declaim (type (unsigned-byte 5) num-ranks))
(defconstant num-cards 52)
(declaim (type (unsigned-byte 8) num-cards))
(defconstant ranks (num-list num-ranks :start 1)
"Valid ranks of a card.")
(deftype rank ()
"A valid rank of a card"
`(integer 1 #.num-ranks))
(defconstant suits (num-list num-suits)
"Valid suits of a card")
(deftype suit ()
"A valid suit of a card"
'(integer 0 #.(- #.num-suits 1)))
;;
;; Variable(s) to control how cards are printed
;; (printing also controled my *print-pretty*)
;;
(defvar *card-format* :numeric
"Format to print cards in. One of :numeric :compact :standard.")
(declaim (type (member :numeric :compact :standard) *card-format*))
;;
;; Card Structure
;;
(deftype card () `(unsigned-byte 6))
(declaim (inline make-card rank gen-rank suit card-null))
(defun make-card (rank suit)
#!(decl-type (rank rank) (suit suit))
(the card (dpb suit (byte 2 4) rank)))
(defun rank (card)
#!(decl-type (card card))
(the rank (ldb (byte 4 0) card)))
(defun gen-rank (card)
#!(decl-type ((unsigned-byte 6) card))
(ldb (byte 4 0) card))
(defun suit (card)
#!(decl-type (card card))
(the suit (ldb (byte 2 4) card)))
(declaim (type card card-nil))
(defconstant card-nil #x3F)
(defun card-null (card)
#!(decl-type (card card))
(= card card-nil))
(declaim (inline card-lt))
(defun card-lt (c1 c2)
#!(decl-type (card c1 c2))
(< c1 c2))
(defun print-card (card &optional (stream *standard-output*))
(declare (optimize (speed 0)))
#!(decl-type (card card) (stream stream))
(ecase *card-format*
((:compact :standard) (print-card-standard card stream))
(:numeric (print-card-numeric card stream))))
(defun print-card-standard (card &optional (stream *standard-output*))
(declare (optimize (speed 0)))
#!(decl-type (card card) (stream stream))
(if (card-null card)
(write-string (if (eq *card-format* :standard) "---" "--") stream)
(progn
(when (eq *card-format* :standard)
(write-char (if (= (rank card) 10) #\1 #\Space) stream))
(format stream "~A" (case (rank card)
(1 #\A)
(10 #\0)
(11 #\J)
(12 #\Q)
(13 #\K)
(t (rank card))))
(write-char (ecase (suit card)
(0 #\D)
(1 #\C)
(2 #\H)
(3 #\S))
stream))))
(defun print-card-numeric (card &optional (stream *standard-output*) d)
(declare (ignore d))
(declare (optimize (speed 0)))
#!(decl-type (card card) (stream stream))
(if (card-null card)
(format stream "----")
(format stream "~2D-~D" (rank card) (suit card))))
(defun read-card (stream)
(declare (optimize (speed 0)))
#!(decl-type (stream stream))
(prog (card (with-< nil))
(skip-whitespace stream)
(when (eq #\< (peek-char nil stream))
(setf with-< t)
(read-char stream))
(setf card (make-card (read-rank stream) (read-suit stream)))
(when with-<
(skip-whitespace stream)
(when (not (eq #\> (read-char stream)))
(error "expecting >")))
(return card)))
(defun read-rank (stream)
(declare (optimize (speed 0)))
#!(decl-type (stream stream))
(skip-whitespace stream)
(the rank (prog (c)
(setf c (read-char stream))
(case (char-downcase c)
(#\k (return 13))
(#\q (return 12))
(#\j (return 11))
(#\0 (return 10))
(#\a (return 1)))
(setf c (to-digit c))
(when (or (/= c 1) (not (digit-char-p (peek-char nil stream))))
(return c))
;; the first digit *is* 1
(setf c (read-char stream))
(setf c (to-digit c))
(return (+ 10 c)))))
(defun read-suit (stream)
(declare (optimize (speed 0)))
#!(decl-type (stream stream))
(skip-whitespace stream)
(the suit (prog (c)
(setf c (read-char stream))
(case (char-downcase c)
(#\d (return 0))
(#\c (return 1))
(#\h (return 2))
(#\s (return 3)))
(setf c (to-digit c))
(return c))))
(defconstant colors '(:black :red)
"Valid colors of a Card.")
(declaim (inline color))
(defun color (card)
"Returns the color of a card"
#!(decl-type (card card))
(if (logbitp 4 card)
:red
:black))
;;
;; Deck Structure
;;
(defstruct (deck
(:constructor make-deck ())
(:print-function (lambda (o s d)
(print-unreadable o #'print-deck s d))))
"A deck of cards."
(size 52
:type (integer 0 52))
(cards (prog* ((i 0)
(v (make-array 52 :element-type 'card)))
(dolist (r ranks)
(dolist (s suits)
(setf (aref v i) (make-card r s))
(incf i)))
(return v))
:type (svector card 52)))
(defun print-deck (deck stream)
(declare (optimize (speed 0)))
#!(decl-type (deck deck) (stream stream))
(format stream "Deck ~A" (deck-size deck)))
(defun take-rand (deck)
"Extracts a random card from a deck of cards."
(declare (optimize (speed 0)))
#!(decl-type (deck deck))
(prog* ((r (random (deck-size deck)))
(c (deck-cards deck))
(v (aref c r)))
(decf (deck-size deck))
(setf (aref c r) (aref c (deck-size deck)))
(return v)))
| 6,249 | Common Lisp | .l | 196 | 27.857143 | 72 | 0.625706 | shlomif/Kevin-Atkinson-AI-Freecell-Solver-in-Lisp | 0 | 0 | 0 | GPL-2.0 | 9/19/2024, 11:36:04 AM (Europe/Amsterdam) | a3c1bd8b7ff228ee2e456feb5e3e85abd5947062403a481a46f9c99a75ab4bfb | 28,687 | [
-1
] |
28,688 | util.lsp | shlomif_Kevin-Atkinson-AI-Freecell-Solver-in-Lisp/code/util.lsp | ;; util.lsp - various utility functions
;; Copyright (C) 2001 by Kevin Atkinson <[email protected]>
;;
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License,
;; version 2, as published by the Free Software Foundation.
;;
;; 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 program; if not, write to the Free Software
;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
;; USA or go to www.gnu.org.
(provide 'util)
;; The read-macro #! and macro decl-type is here because clisp
;; completly ignored type declarations. This is a problem becuase I
;; use the type declaration as a form as error checking. I also use
;; the type declaration to obtain faster code when compiling with
;; cmucl. Thus decl-type macro will expand to either a declare
;; or a type check code or nothing depending on which compiler
;; is used and if the code is compiled or interpreted
;; The read macro #! is needed because macro are not allowed to
;; expand into declare statements in common lisp so the macro
;; has to be expanded at read-time.
;;
;; The proper way to use the two is to use them where ever a declare
;; is used as follows
;; #!(decl-type ((TYPE PARM+)+) where '+' means 1 or more times
(defmacro eval-always (&body body)
`(eval-when (compile load eval) ,.body))
(eval-always
(set-dispatch-macro-character #\# #\!
#'(lambda (stream char1 char2)
(declare (ignore char1 char2))
(multiple-value-bind (x) (macroexpand-1 (read stream t nil t))
x))))
(defmacro decl-type (&rest args)
"Fancy type declare. See util.lisp"
(if (and (member :clisp *features*) (eval-when (:load-toplevel :execute) t))
`(progn
,@(mapcan #'(lambda (tl)
(mapcar #'(lambda (var)
(list 'check-type var (car tl)))
(cdr tl)))
args))
`(declare
,@(mapcar #'(lambda (tl) (cons 'type tl))
args))))
;; Curry is a standard concept used in many functional programming
;; languages. It takes in a function and returns a new function
;; with the provided args supplied. For example to add 2 to each
;; number in a list one would use:
;; (mapcar (curry #'+ 1) lst)
;; Which is the same as
;; (mapcar (lambda (i) (+ 1 i)) lst)
(declaim (inline curry))
(defun curry (fn &rest args)
#!(decl-type (function fn))
#'(lambda (&rest args2)
(apply fn (append args args2))))
;;(declaim (ext:constant-function num-list))
(defun num-list (count &key (start 0))
"Returns a list of COUNT numbers in sequence starting at START."
#!(decl-type (fixnum count start))
(let ((end (- (+ start count) 1))
(brk (- start 1))
(lst nil))
(do ((i end (- i 1)))
((= i brk) lst)
(declare (type fixnum i))
(push i lst))))
(declaim (inline not-null))
(defun not-null (lst)
(not (null lst)))
(deftype svector (type num)
`(simple-array ,type (,num)))
(defun to-digit (char)
"convert CHAR to an integer or error"
#!(decl-type (character char))
(let ((digit (digit-char-p char)))
(when (null digit)
(error "'~A' is not a digit" char))
digit))
(defun skip-whitespace (stream)
"skip over whitspace for STREAM"
#!(decl-type (stream stream))
(peek-char t stream)
nil)
(defmacro ignore-error (error &body body)
"like ignore-errors but only ignores a specific error"
`(block error-block
(handler-bind ((,error (lambda (e)
(declare (ignore e))
(return-from error-block))))
,.body)))
;;
;;
;;
(defun print-unreadable (obj fun stream d)
(declare (optimize (speed 0)))
(declare (ignore d))
(cond
(*print-pretty* (apply fun obj stream nil))
(T (write-string "#<" stream)
(apply fun obj stream nil)
(write-string ">" stream))))
(deftype list-of (what)
;; recursive deftype or not actually supported in lisp but
;; clisp seasms to support it
`(or null (cons ,what list)))
| 4,315 | Common Lisp | .l | 113 | 34.212389 | 78 | 0.665233 | shlomif/Kevin-Atkinson-AI-Freecell-Solver-in-Lisp | 0 | 0 | 0 | GPL-2.0 | 9/19/2024, 11:36:04 AM (Europe/Amsterdam) | d2f03067223bbcec875b042ec240039094b5e9a3814c1a361576b670c56f8995 | 28,688 | [
-1
] |
28,709 | package.lisp | wvxvw_agraph-client/src/openrdf/vocabulary/package.lisp | (in-package :cl)
(defpackage :openrdf.vocabulary (:use :cl :openrdf.model)
(:export :+ns+
:+duration+
:+datetime+
:time+
:+date+
:+gyearmonth+
:+gyear+
:+gmonthday+
:+gday+
:+gmonth+
:+string+
:+boolean+
:+base64binary+
:+hexbinary+
:+float+
:+decimal+
:+double+
:+anyuri+
:+qname+
:+notation+
:+normalizedstring+
:+token+
:+language+
:+nmtoken+
:+nmtokens+
:+name+
:+ncname+
:+id+
:+idref+
:+idrefs+
:+entity+
:+entities+
:+integer+
:+long+
:+int+
:+short+
:+number+
:+byte+
:+non-positive-integer+
:+negative-nteger+
:+non-negative-integer+
:+positive-nteger+
:+unsigned-long+
:+unsigned-int+
:+unsigned-short+
:+unsigned-byte+))
| 1,589 | Common Lisp | .lisp | 48 | 12.166667 | 57 | 0.268657 | wvxvw/agraph-client | 0 | 0 | 0 | EPL-1.0 | 9/19/2024, 11:36:20 AM (Europe/Amsterdam) | 8a27eae4ad4818ea8b9718c58cfdd0c4f198a56662df54e5f0d2bc1136c79e0c | 28,709 | [
-1
] |
28,710 | xmlschema.lisp | wvxvw_agraph-client/src/openrdf/vocabulary/xmlschema.lisp | (in-package :openrdf.vocabulary)
(defparameter +ns+ "http://www.w3.org/2001/XMLSchema#")
(defparameter +duration+ (make-instance 'uri :namespace +ns+ :localname "duration"))
(defparameter +datetime+ (make-instance 'uri :namespace +ns+ :localname "dateTime"))
(defparameter time+ (make-instance 'uri :namespace +ns+ :localname "time"))
(defparameter +date+ (make-instance 'uri :namespace +ns+ :localname "date"))
(defparameter +gyearmonth+ (make-instance 'uri :namespace +ns+ :localname "gYearMonth"))
(defparameter +gyear+ (make-instance 'uri :namespace +ns+ :localname "gYear"))
(defparameter +gmonthday+ (make-instance 'uri :namespace +ns+ :localname "gMonthDay"))
(defparameter +gday+ (make-instance 'uri :namespace +ns+ :localname "gDay"))
(defparameter +gmonth+ (make-instance 'uri :namespace +ns+ :localname "gMonth"))
(defparameter +string+ (make-instance 'uri :namespace +ns+ :localname "string"))
(defparameter +boolean+ (make-instance 'uri :namespace +ns+ :localname "boolean"))
(defparameter +base64binary+ (make-instance 'uri :namespace +ns+ :localname "base64Binary"))
(defparameter +hexbinary+ (make-instance 'uri :namespace +ns+ :localname "hexBinary"))
(defparameter +float+ (make-instance 'uri :namespace +ns+ :localname "float"))
(defparameter +decimal+ (make-instance 'uri :namespace +ns+ :localname "decimal"))
(defparameter +double+ (make-instance 'uri :namespace +ns+ :localname "double"))
(defparameter +anyuri+ (make-instance 'uri :namespace +ns+ :localname "anyURI"))
(defparameter +qname+ (make-instance 'uri :namespace +ns+ :localname "QName"))
(defparameter +notation+ (make-instance 'uri :namespace +ns+ :localname "NOTATION"))
(defparameter +normalizedstring+ (make-instance 'uri :namespace +ns+ :localname "normalizedString"))
(defparameter +token+ (make-instance 'uri :namespace +ns+ :localname "token"))
(defparameter +language+ (make-instance 'uri :namespace +ns+ :localname "language"))
(defparameter +nmtoken+ (make-instance 'uri :namespace +ns+ :localname "NMTOKEN"))
(defparameter +nmtokens+ (make-instance 'uri :namespace +ns+ :localname "NMTOKENS"))
(defparameter +name+ (make-instance 'uri :namespace +ns+ :localname "Name"))
(defparameter +ncname+ (make-instance 'uri :namespace +ns+ :localname "NCName"))
(defparameter +id+ (make-instance 'uri :namespace +ns+ :localname "ID"))
(defparameter +idref+ (make-instance 'uri :namespace +ns+ :localname "IDREF"))
(defparameter +idrefs+ (make-instance 'uri :namespace +ns+ :localname "IDREFS"))
(defparameter +entity+ (make-instance 'uri :namespace +ns+ :localname "ENTITY"))
(defparameter +entities+ (make-instance 'uri :namespace +ns+ :localname "ENTITIES"))
(defparameter +integer+ (make-instance 'uri :namespace +ns+ :localname "integer"))
(defparameter +long+ (make-instance 'uri :namespace +ns+ :localname "long"))
(defparameter +int+ (make-instance 'uri :namespace +ns+ :localname "int"))
(defparameter +short+ (make-instance 'uri :namespace +ns+ :localname "short"))
(defparameter +number+ (make-instance 'uri :namespace +ns+ :localname "number") +)
(defparameter +byte+ (make-instance 'uri :namespace +ns+ :localname "byte"))
(defparameter +non-positive-integer+ (make-instance 'uri :namespace +ns+ :localname "nonPositiveInteger"))
(defparameter +negative-nteger+ (make-instance 'uri :namespace +ns+ :localname "negativeInteger"))
(defparameter +non-negative-integer+ (make-instance 'uri :namespace +ns+ :localname "nonNegativeInteger"))
(defparameter +positive-nteger+ (make-instance 'uri :namespace +ns+ :localname "positiveInteger"))
(defparameter +unsigned-long+ (make-instance 'uri :namespace +ns+ :localname "unsignedLong"))
(defparameter +unsigned-int+ (make-instance 'uri :namespace +ns+ :localname "unsignedInt"))
(defparameter +unsigned-short+ (make-instance 'uri :namespace +ns+ :localname "unsignedShort"))
(defparameter +unsigned-byte+ (make-instance 'uri :namespace +ns+ :localname "unsignedByte"))
| 3,917 | Common Lisp | .lisp | 47 | 82.319149 | 106 | 0.745412 | wvxvw/agraph-client | 0 | 0 | 0 | EPL-1.0 | 9/19/2024, 11:36:20 AM (Europe/Amsterdam) | e5de40fff946f1b819f567d4462f57e67169f9f551d150073efb74aa12b2d782 | 28,710 | [
-1
] |
28,711 | queryresult.lisp | wvxvw_agraph-client/src/openrdf/query/queryresult.lisp | ;; -*- coding: utf-8 -*-
(in-package :openrdf.query)
(defstruct binding name value)
(defclass query-result () ())
(defclass graph-query-result (query-result repository-result) ())
;; TODO: This is begging to implement some container interface
(defclass tuple-query-result (query-result)
((variable-names :accessor tuple-query-result-variable-names)
(string-tuples :accessor tuple-query-result-string-tuples)
(cursor :initform 0 :accessor tuple-query-result-cursor)
(tuple-count :initform 0 :accessor tuple-query-result-tuple-count)
(binding-set :accessor tuple-query-result-binding-set)))
(defmethod initialize-instance :after
((this tuple-query-result) &rest initargs
&key lambda-list argument-precence-order &allow-other-keys)
(declare (ignore lambda-list argument-precence-order))
(destructuring-bind (&key variable-names string-tuples &allow-other-keys)
initargs
(setf (tuple-query-result-variable-names this)
(openrdf.utils:ensure-array variable-names)
(tuple-query-result-string-tuples this)
(openrdf.utils:ensure-array string-tuples)
(tuple-query-result-tuple-count this)
(length (tuple-query-result-string-tuples this))
(tuple-query-result-binding-set this)
(make-instance 'list-binding-set
:names (tuple-query-result-variable-names this)))))
(defmethod row-count ((this tuple-query-result))
(tuple-query-result-tuple-count this))
(defmethod close-query ((this tuple-query-result)))
;; This must be the iterator implementation, must look into how
;; cl-containers handles this
(defmethod next-item ((this tuple-query-result))
(unless (>= (tuple-query-result-cursor this)
(tuple-query-result-tuple-count this))
(let ((bset (tuple-query-result-binding-set this)))
(reset bset (aref (tuple-query-result-string-tuples this)
(tuple-query-result-cursor this)))
(incf (tuple-query-result-cursor this))
bset)))
;; We inherit two more slots, which we could reuse: `key' and `test'
;; not sure what `key' does, but it could be a hash function?
;; actually, seems like a lot more then that...
(defclass list-binding-set (cl-containers:set-container)
((variable-names :accessor list-binding-set-variable-names)
(string-tuple :accessor list-binding-set-string-tuple)
(value-cache :initform nil :accessor list-binding-set-value-cache)))
(defmethod reset ((this list-binding-set) string-tuple)
(setf (list-binding-set-string-tuple this) string-tuple)
;; I've no idea what this does
(iter
(for i :from 0 :below (length (list-binding-set-variable-names this)))
(setf (aref (list-binding-set-value-cache this) i) nil)))
(defmethod validate-index ((this list-binding-set) index)
(if (and (>= index 0) (< index (length (list-binding-set-string-tuple this))))
index
(error "index out of bounds, must be 0..~d"
(1- (length (list-binding-set-string-tuple this))))))
(defmethod ith-value ((this list-binding-set) i)
(labels ((%convert (x)
(if (consp x) (mapcar #'%convert x)
(string->term x))))
(or (aref (list-binding-set-value-cache this) i)
(setf (list-binding-set-value-cache this)
(%convert (aref (list-binding-set-string-tuple this) i))))))
(defmethod cl-containers:find-item ((this list-binding-set) item)
(typecase item
(integer (ith-value this (validate-index this item)))
(otherwise
(ith-value this (position (list-binding-set-variable-names this) item)))))
(defmethod cl-containers:iterate-elements ((this list-binding-set) func)
;; Maybe...
(mapc func (list-binding-set-variable-names this)))
(defmethod get-binding ((this list-binding-set) name)
(make-binding :name name :value (cl-containers:find-item self name)))
(defmethod get-row ((this list-binding-set))
(list-binding-set-string-tuple this))
(defmethod size ((this list-binding-set))
(length (list-binding-set-value-cache this)))
(defmethod list-binding->hash-table ((this list-binding-set) &optional string-dict)
(let ((result (make-hash-table :test #'equal)))
(cl-containers:iterate-elements
(lambda (key)
(setf (gethash key result)
(let ((value (cl-containers:find-item this key)))
(if string-dict (write-to-string value) value)))))
result))
(defmethod print-object ((this list-binding-set) stream)
(format stream "~a" (list-binding->hash-table this t)))
| 4,530 | Common Lisp | .lisp | 89 | 45.202247 | 83 | 0.697252 | wvxvw/agraph-client | 0 | 0 | 0 | EPL-1.0 | 9/19/2024, 11:36:20 AM (Europe/Amsterdam) | b77d81a95213aa94e68708da6c7ef47373ee88ce22ccdc6f778ba442565fc861 | 28,711 | [
-1
] |
28,712 | dataset.lisp | wvxvw_agraph-client/src/openrdf/query/dataset.lisp | ;; -*- coding: utf-8 -*-
(in-package :openrdf.query)
(defparameter all-contexts "ALL_CONTEXTS")
(defclass dataset ()
((contexts :initform nil :initarg :contexts :accessor dataset-contexts)
(default-graphs :initform (make-instance 'cl-containers:set-container)
:accessor dataset-default-graphs)
(named-graphs :initform (make-instance 'cl-containers:set-container)
:accessor dataset-named-graphs)))
(defmethod initialize-instance :after
((this dataset) &rest initargs
&key lambda-list argument-precence-order &allow-other-keys)
(declare (ignore lambda-list argument-precence-order))
(destructuring-bind (&key contexts &allow-other-keys) initargs
(when contexts
(iter
(with ngraphs := (dataset-named-graphs this))
(for ctx :in contexts)
(cl-containers:insert-item ngraphs ctx)))))
(defmethod list-default-graphs ((this dataset))
(let ((graphs (dataset-default-graphs this)))
(if (zerop (cl-containers:size graphs)) all-contexts
(cl-containers:collect-nodes graphs))))
(defmethod add-default-graph ((this dataset) uri)
(cl-containers:insert-item (dataset-default-graphs this) uri))
(defmethod remove-default-graph ((this dataset) uri)
(cl-containers:delete-item (dataset-default-graphs this) uri))
(defmethod list-named-graphs ((this dataset))
(let ((graphs (dataset-named-graphs this)))
(if (zerop (cl-containers:size graphs)) all-contexts
(cl-containers:collect-nodes graphs))))
(defmethod add-named-graph ((this dataset) uri)
(cl-containers:insert-item (dataset-named-graphs this) uri))
(defmethod remove-named-graph ((this dataset) uri)
(cl-containers:delete-item (dataset-named-graphs this) uri))
(defmethod clear ((this dataset))
(cl-containers:empty! (dataset-default-graphs this))
(cl-containers:empty! (dataset-named-graphs this)))
(defmethod as-query ((this dataset) exclude-null-context-p)
(if (not (or (dataset-named-graphs this)
(dataset-default-graphs this)))
(if exclude-null-context-p "" "## empty dataset ##")
;; this begs for iterate macro
(with-output-to-string (stream)
(cl-containers:iterate-nodes
(dataset-default-graphs this)
(lambda (item)
(unless (and (not item) exclude-null-context-p)
;; this can probably be replaced by format
(princ "FROM " stream)
(append-uri this stream item)
(princ #\Space))))
;; this block is the same as the block above
;; needs refactoring
(cl-containers:iterate-nodes
(dataset-named-graphs this)
(lambda (item)
(unless (and (not item) exclude-null-context-p)
;; this can probably be replaced by format
(princ "FROM NAMED " stream)
(append-uri this stream item)
(princ #\Space)))))))
(defmethod print-object ((this dataset) stream)
(print (as-query this) stream))
(defmethod append-uri ((this dataset) stream uri)
;; this needs to be made more generic
(let ((uri-string
(if (some
(lambda (slot)
(string= (symbol-name
(sb-mop:slot-definition-name slot)) "value"))
(sb-mop:class-slots (class-of uri)))
(slot-value uri 'value)
(coerce uri 'string))))
;; magic!
(if (> (length uri-string) 50)
(format stream "<~a..~a>"
(subseq uri-string 0 19)
(subseq uri-string (- (length uri-string) 29)))
(format stream "<~a>" uri-string))))
| 3,589 | Common Lisp | .lisp | 80 | 37.425 | 73 | 0.649785 | wvxvw/agraph-client | 0 | 0 | 0 | EPL-1.0 | 9/19/2024, 11:36:20 AM (Europe/Amsterdam) | 2cd5c48051c8467f90baa1e7f46de95c5b7c8dc56a74c5a49a2f385010abd97a | 28,712 | [
-1
] |
28,713 | query.lisp | wvxvw_agraph-client/src/openrdf/query/query.lisp | ;; -*- coding: utf-8 -*-
(in-package :openrdf.query)
(defclass query-language ()
((registered-languages :initform nil
:accessor query-language-registered-languages :allocation :class)
(sparql :initform nil :accessor query-language-sparql :allocation :class)
(prolog :initform nil :accessor query-language-prolog :allocation :class)
(name :initarg :name :accessor query-language-name)))
(defmethod print-object ((this query-language) stream)
(print (query-language-name this) stream))
(defmethod query-values ((this query-language))
(copy-list (query-language-registered-languages this)))
(defmethod query-value-of ((this query-language) name)
(iter
(with lname := (string-downcase name))
(for ql :in (query-language-registered-languages this))
(when (string= (string-downcase (query-language-name ql)) lname)
(return ql))))
;; Maybe there's a better way to do this
(defparameter *query-language*
(let ((lang (make-instance 'query-language :name "SPARQL")))
(setf (query-language-sparql lang) lang
(query-language-prolog lang) (make-instance 'query-language :name "PROLOG"))))
(defclass query ()
((query-language :initform nil :accessor query-query-language)
(query-string :initform nil :accessor query-query-string)
(base-uri :initform nil :accessor query-base-uri)
(dataset :initform nil :accessor query-dataset)
(include-infered-p :initform nil :accessor query-include-inferred-p)
(bindings :initform nil :accessor query-bindings)
(connection :initform nil :accessor query-connection)
(check-variables-p :initform nil :accessor query-check-variables-p)
(preferred-exectuion-language :initform nil :accessor query-preferred-execution-language)
(actual-exectuion-language :initform nil :accessor query-actual-execution-language)
(subject-comes-first-p :initform nil :accessor query-subject-comes-first-p)))
(defparameter *trace-query* nil)
;; No idea why this should be a method...
(defmethod set-trace-query ((this query) settings)
(declare (ignore this))
(setf *trace-query* settings))
(defmethod set-binding ((this query) name value)
(when (stringp value)
(setf value (create-literal (query-connection this) value)))
(setf (gethash name (query-bindings this)) value))
(defmethod remove-binding ((this query) name)
(remhash name (query-bindings this)))
(defmethod set-contexts ((this query) contexts)
(when contexts
(let ((ds (make-instance 'dataset)))
(iter
(for ctx :in contexts)
(add-named-graph
ds
(if (stringp ctx)
(create-uri (query-connection this) ctx) ctx)))
(setf (query-dataset this) ds))))
(defmethod evaluate-generic-query
((this query) &key countp acceptp analyzep analysis-technique analysis-timeout updatep)
(let* ((conn (query-connection this))
(named-contexts (contexts->ntriple-contexts
(when (query-dataset this)
(named-graphs (query-dataset this)))))
(regular-contexts (contexts->ntriple-contexts
(if (query-dataset this)
(default-graphs (query-dataset this))
+all-contexts+)))
bindings)
(when (query-bindings this)
(setf bindings (make-hash-table))
(iter
(for (key value) :in-hashtable (query-bindings this))
(setf (gethash key bindings) (term->mini-term conn value))))
(let ((mini (mini-repository conn)) response)
(if (eql (query-language this)
(query-language-sparql *query-language*))
(setf response ; this is ugly
(eval-sparql-query mini (query-string this)
:context regular-contexts
:named-context named-contexts
:inferp (query-include-infered-p this)
:bindings bindings
:check-variables-p (query-check-variables-p this)
:countp countp
:acceptp acceptp
:analyzep analyzep
:analysis-technique analysis-technique
:analysis-timeout analysis-timeout
:updatep updatep))
(when (eql (query-language this)
(query-language-prolog *query-language*))
(when named-contexts (error "Prolog queries don't support datasets"))
(when analyzep (error "Prolog queries don't support analysis"))
(setf response
(eval-prolog-query mini (query-string this)
:inferp (query-include-infered-p this)
:countp countp
:acceptp acceptp))))
response)))
(defun check-language (language)
(when (stringp language)
(setf language
(cond
((string= language "SPARQL")
(query-language-sparql *query-language*))
((string= language "PROLOG")
(query-language-prolog *query-language*)))))
(if (or (eql (query-language-sparql *query-language*) language)
(eql (query-language-prolog *query-language*) language))
language
(error "Language ~a not recognized as query language" language)))
(defclass tuple-query (query) ())
(defclass update-query (query) ())
(defclass graph-query (query) ())
(defclass boolean-query (query) ())
(defgeneric evaluate (query &rest more-args)
(:method ((this tuple-query) &rest countp)
(let ((response (evaluate-generic-query this :countp (first countp))))
(if countp response
(make-instance 'tuple-query-result
:names (gethash "names" response)
:values (gethash "values" response)))))
(:method ((this update-query) &rest unused)
(declare (ignore unused))
(evaluate-generic-query this :updatep t))
(:method ((this graph-query) &rest unused)
(declare (ignore unused))
(make-instance 'graph-query-result
:value (evaluate-generic-query this :updatep t)))
(:method ((this boolean-query) &rest unused)
(declare (ignore unused))
(evaluate-generic-query this)))
(defmethod analyze ((this tuple-query) &key analysis-technique analysis-timeout)
(evaluate-generic-query this :analysis-technique analysis-technique
:analysis-timeout analysis-timeout))
| 6,653 | Common Lisp | .lisp | 134 | 39.052239 | 92 | 0.623634 | wvxvw/agraph-client | 0 | 0 | 0 | EPL-1.0 | 9/19/2024, 11:36:20 AM (Europe/Amsterdam) | b2ec5e60821864aaf10c84cedbfcd740145babfb96dbd22bbd0511b7579612dc | 28,713 | [
-1
] |
28,714 | package.lisp | wvxvw_agraph-client/src/openrdf/util/package.lisp | (in-package :cl)
(defpackage :openrdf.utils (:use :cl :iterate :cl-ppcre)
(:export :encode-ntriple-string
:local-name-index
:ensure-uri-string
:local-name
:namespace
:parse-uriref
:parse-nodeid
:parse-literal
:ensure-array))
| 315 | Common Lisp | .lisp | 11 | 19.454545 | 56 | 0.555921 | wvxvw/agraph-client | 0 | 0 | 0 | EPL-1.0 | 9/19/2024, 11:36:20 AM (Europe/Amsterdam) | 0101a80cd827fd03f23fe1ac43bebaa9f1f731f1f684e8bf9f3e4e2889bc5db9 | 28,714 | [
-1
] |
28,715 | utils.lisp | wvxvw_agraph-client/src/openrdf/util/utils.lisp | ;; -*- coding: utf-8 -*-
(in-package :openrdf.utils)
(defun encode-ntriple-string (string)
(with-output-to-string (stream)
(iter
(for c :in-string string)
(princ
(case c
(#\Tab "\\t")
(#\Rubout "\\r")
(#\Newline "\\n")
(#\Space " ")
(#\" "\\\"")
(#\\ "\\")
(otherwise
(if (and (char>= c #\#)
(char<= c #\~)
(not (char= c #\')))
(make-string 1 :initial-element c)
(format nil "\\u~4,'0x" (char-code char)))))
stream))))
(defun local-name-index (uri)
(iter
(initially (setq index -1))
(for needle :in '(#\# #\/ #\:))
(for index :next (when (< index 0) (position needle uri)))
(finally
(if (< index 0)
(error "No separator found in URI '%s'" uri)
(return (1+ index))))))
(defun ensure-uri-string (value)
(if (char= (char value 0) #\<) value (format nil "<~a>" value)))
(defun local-name (uri)
(subseq uri (local-name-index uri)))
(defun namespace (uri)
(subseq uri 0 (local-name-index uri)))
(defparameter *uri-scanner*
(create-scanner "^<([^:]+:[^\s\"<>]+)>$" :single-line-mode t))
(defparameter *nodeid-scanner*
(create-scanner "^_:([A-Za-z][A-Za-z0-9]*)$" :single-line-mode t))
;; Not sure if this is intended: you cannot specify both language and uri
(defparameter *literal-scanner*
(create-scanner
"^\"([^\"\\\\]*(?:\\.[^\"\\\\]*)*)\"(?:@([a-z]+(?:-[a-z0-9]+)*)|\\^\\^<([^:]+:[^\\s\"<>]+)>)?$"
:single-line-mode t))
(defun parse-uriref (maybe-uri)
(nth-value 1 (scan-to-strings *uri-scanner* maybe-uri)))
(defun parse-nodeid (maybe-nodeid)
(nth-value 1 (scan-to-strings *nodeid-scanner* maybe-nodeid)))
(defun parse-literal (maybe-literal)
(let ((groups (nth-value 1 (scan-to-strings *literal-scanner* maybe-literal))))
(and groups (values (aref groups 0) (aref groups 1) (aref groups 2)))))
(defun ensure-array (value)
(typecase value
(array value)
(cons (make-array (length value) :initial-contents value))
(null nil)
(otherwise (make-array 1 :element-type (type-of value)
:initial-element value))))
| 2,187 | Common Lisp | .lisp | 59 | 31.271186 | 98 | 0.561702 | wvxvw/agraph-client | 0 | 0 | 0 | EPL-1.0 | 9/19/2024, 11:36:20 AM (Europe/Amsterdam) | b3ba5d78912b17cc33c4bb425aaaccec6250ed5456743be5dbf76dbcdff39c6e | 28,715 | [
-1
] |
28,716 | package.lisp | wvxvw_agraph-client/src/openrdf/model/package.lisp | (in-package :cl)
(defpackage :openrdf.model (:use :cl :local-time :iterate)
(:export :value
:resource
:uri
:bnode
:namespace
:ntriples
:value=
:get-uri
:get-value
:get-local-name
:get-namespace))
| 418 | Common Lisp | .lisp | 13 | 14.076923 | 58 | 0.348148 | wvxvw/agraph-client | 0 | 0 | 0 | EPL-1.0 | 9/19/2024, 11:36:20 AM (Europe/Amsterdam) | 02697638e39d8da63d861337e141322c3f7a4b25d99b22a9939b7e91fcbcdbf0 | 28,716 | [
-1
] |
28,717 | value.lisp | wvxvw_agraph-client/src/openrdf/model/value.lisp | ;; -*- coding: utf-8 -*-
(in-package :openrdf.model)
(defclass value () ())
(defclass resource (value) ())
;; All this string parsing nonsense looks bad, why not have
;; a uri struct to encode all parts?
(defclass uri (resource)
((value :initform nil :initarg :value
:accessor uri-value :type (or null string)))
(:default-initargs :uri nil))
(defclass bnode (resource)
((id :initform nil :initarg :id :accessor bnode-id)))
(defclass namespace ()
((prefix :initarg :prefix :accessor namespace-prefix)
(name :initarg :name :accessor namespace-name)))
(defgeneric ntriples (rdf-term)
(:documentation "Converts RDF-TERM to ntriples. You MUST implement it.")
(:method ((this value)) (error "Not implemented"))
(:method ((this uri)) (openrdf.utils:encode-ntriple-string (uri-value this)))
(:method ((this bnode)) (format nil "_:~a" (bnode-id this))))
(defgeneric value= (term-a term-b)
(:documentation "Compares two RDF term. You MUST implement it.")
(:method ((this value) (that value)) (error "Not implemented"))
(:method ((this uri) (that uri)) (string= (uri-value this) (uri-value that)))
(:method ((this bnode) (that bnode)) (string= (bnode-id this) (bnode-id that))))
(defmethod print-object ((this value) stream)
(print (ntriples this) stream))
(defmethod print-object ((this namespace) stream)
(format stream "~a :: ~a" (namespace-prefix this) (namespace-name this)))
(defgeneric get-uri (uri)
(:documentation "One more accessor for value slot?")
(:method ((this uri)) (uri-value this)))
(defgeneric get-value (uri)
(:documentation "One more accessor for value slot?")
(:method ((this uri)) (uri-value this)))
(defgeneric get-local-name (uri)
(:documentation "")
(:method ((this uri)) (openrdf.utils:local-name (uri-value this))))
(defgeneric get-namespace (uri)
(:documentation "")
(:method ((this uri)) (openrdf.utils:namespace (uri-value this))))
(defmethod initialize-instance :after
((this uri) &rest initargs
&key lambda-list argument-precence-order &allow-other-keys)
(declare (ignore lambda-list argument-precence-order))
(destructuring-bind (&key value &allow-other-keys) initargs
(when (and value
(char= (char value 0) #\<)
(char= (char value (1- (length value))) #\>))
(setf (uri-value this) (subseq value 1 (1- (length value)))))))
(defun ensure-uri (maybe-uri)
(if (typep maybe-uri 'uri) maybe-uri
(make-instance 'uri :value maybe-uri)))
| 2,487 | Common Lisp | .lisp | 53 | 43.396226 | 82 | 0.685691 | wvxvw/agraph-client | 0 | 0 | 0 | EPL-1.0 | 9/19/2024, 11:36:20 AM (Europe/Amsterdam) | 700bc71335bae9a7c6fde45e8378b942892aa2f063fb0a7a8ac35b84cc560191 | 28,717 | [
-1
] |
28,718 | literal.lisp | wvxvw_agraph-client/src/openrdf/model/literal.lisp | ;; -*- coding: utf-8 -*-
(in-package :openrdf.model)
;; This is ugly, maybe there's some way to sidestep this with `eval-when'
(defun voc (symbol)
(symbol-value (find-symbol symbol :openrdf.vocabulary)))
(defun voc-uri (symbol)
(uri-value (symbol-value (find-symbol symbol :openrdf.vocabulary))))
(defun datatype-from-python (value datatype)
;; this translation is all messed up, but will do for the time being
;; some date-related noise has been dropped, I don't understand how it
;; can be relevant.
(typecase value
(string (values value datatype))
(boolean (values (if value "true" "false") (voc '+boolean+)))
(bignum (values (write-to-string value) (voc '+long+)))
(fixnum (values (write-to-string value) (voc '+integer+)))
(float (values (write-to-string value) (voc '+double+)))
(timestamp (values (format-timestring nil value) (voc '+datetime+)))
(otherwise (values (write-to-string value) datatype))))
(defclass literal (value)
((label :initarg :label :accessor literal-label)
(datatype :initform nil :initarg :datatype :accessor literal-datatype)
(language :initform nil :initarg :language :accessor literal-language)))
(defmethod convert-to-python ((this literal))
"This is probably the reverse of `datatype-from-python'"
;; Why is value called label?
(funcall
(let ((datatype-uri (uri-value (literal-datatype this))))
(cond
((string= datatype-uri (voc-uri +string+)) #'literal-value)
((string= datatype-uri (voc-uri +boolean+)) #'boolean-value)
((string= datatype-uri (voc-uri +long+)) #'long-value)
((string= datatype-uri (voc-uri +integer+)) #'int-value)
((string= datatype-uri (voc-uri +double+)) #'float-value)
((string= datatype-uri (voc-uri +datetime+)) #'date-value)) this)))
(defmethod (setf literal-datatype) (value (this literal))
(setf (slot-value this 'datatype) (ensure-uri value)))
(defmethod value= ((this literal) (that literal))
(with-slots ((label-a label) (datatype-a datatype) (language-a language)) this
(with-slots ((label-b label) (datatype-b datatype) (language-b language)) this
(and (eqal label-a label-b)
(eqal datatype-a datatype-b)
(eqal language-a language-b)))))
(defmethod int-value ((this literal))
(truncate (coerce (literal-label this) 'integer) #xffffffff))
(defmethod long-value ((this literal))
(truncate (coerce (literal-label this) 'integer) #xffffffffffffffff))
(defmethod float-value ((this literal))
(coerce (literal-label this) 'float))
(defmethod boolean-value ((this literal))
(coerce (literal-label this) 'boolean))
(defmethod date-value ((this literal))
(parse-timestring (coerce (literal-label this) 'string)))
(defmethod ntriples ((this literal))
(format nil "\"~a\"~@[@~a~]~@[~@*^^~a~]"
(openrdf.utils:encode-ntriple-string (literal-label this))
(literal-language this)
(ntriples (literal-datatype this))))
;; no idea why, this should be the choice of the compound-literal...
(defparameter +range-literal+ "rangeLiteral")
(defclass compound-literal (literal)
((choice :initarg :choice :accessor compound-literal-choice :type string)
(lower-bound :initform nil :initarg :lower-bound :type literal-impl
:accessor compound-literal-lower-bound)
(upper-bound :initform nil :initarg :upper-bound :type literal-impl
:accessor compound-literal-upper-bound)))
(defmethod range-literal-p ((this compound-literal))
(string= (compound-literal-choice this) +range-literal+))
;; The original code extends this from compound-literal, but it doesn
;; make sense to do so...
(defclass range-literal (literal)
((lower-bound :initform nil :initarg :lower-bound :type literal-impl
:accessor range-literal-lower-bound)
(upper-bound :initform nil :initarg :upper-bound :type literal-impl
:accessor range-literal-upper-bound)))
(defun geounitp (value) (member value '(:km :mile :radian :degree)))
(deftype geounit () '(satisfies geounitp))
(defclass geo-coordinate (compound-literal)
((x :initarg :x :accessor geo-x)
(y :initarg :y :accessor geo-y)
(unit :initform nil :initarg :unit :type geounit
:accessor geo-unit)
(geo-type :initform nil :initarg :geo-type
:accessor geo-type)))
(defclass geo-spatial-region (geo-coordinate) ())
(defclass geo-box (geo-spatial-region)
((x-min :initarg :x-min :accessor geo-x-min)
(x-max :initarg :x-max :accessor geo-x-max)
(y-max :initarg :y-max :accessor geo-y-max)
(y-min :initarg :y-min :accessor geo-y-min)))
(defclass geo-circle (geo-spatial-region)
((radius :initarg :radius :accessor geo-radius)))
(defclass geo-polygon (geo-spatial-region)
((vertices :initarg :vertices :accessor geo-vertices)
(resource :initarg :resource :accessor geo-resource)))
(defmethod print-object ((this geo-circle) stream)
(with-slots (x y radius) this
(format stream "|Circle|~d,~d radius=~d" x y radius)))
(defmethod print-object ((this geo-coordinate) stream)
(with-slots (x y) this (format stream "|COOR|(~d, ~d)" % x y)))
(defmethod print-object ((this geo-box) stream)
(with-slots (x-min x-max y-min y-max) this
(format stream "|Box|~d,~d ~d,~d" % x-min x-max y-min y-max)))
(defmethod print-object ((this geo-polygon) stream)
(format stream "|Polygon|~s" (geo-vertices this)))
| 5,413 | Common Lisp | .lisp | 105 | 47.057143 | 82 | 0.693503 | wvxvw/agraph-client | 0 | 0 | 0 | EPL-1.0 | 9/19/2024, 11:36:20 AM (Europe/Amsterdam) | cc3d50facee975c044141e84037ad2e1444c4c90f84d81ebb359aefe42c93826 | 28,718 | [
-1
] |
28,719 | statement.lisp | wvxvw_agraph-client/src/openrdf/model/statement.lisp | ;; -*- coding: utf-8 -*-
(in-package :openrdf.model)
(defclass statement ()
((subject :initarg :subject :accessor statement-subject)
(predicate :initarg :predicate :accessor statement-predicate)
(object :initarg :object :accessor statement-object)
(context :initarg :context :accessor statement-context)
(string-tuple :accessor statement-tuple)))
(defmethod initialize-instance :after
((this statement) &rest initargs
&key lambda-list argument-precence-order &allow-other-keys)
(declare (ignore initargs lambda-list argument-precence-order))
(setf (statment-tuple this) nil))
(defmethod value= ((this statement) (that statement))
(with-slots ((subject-a subject) (predicate-a predicate)
(object-a object) (context-a context))
this
(with-slots ((subject-b subject) (predicate-b predicate)
(object-b object) (context-b context))
that
(and (equal subject-a subject-b)
(equal predicate-a predicate-b)
(equal object-a object-b)
(equal context-a context-b)))))
(defmethod print-object ((this literal) stream)
(format stream "~a" (statement-tuple this)))
(defmethod value-length ((this statement))
(length (statement-tuple this)))
(defmethod statement-object ((this statement))
(unless (slot-value this 'statement-object)
(setf (statement-object this) (first (statement-tuple this))))
(slot-value this 'statement-object))
(defmethod statement-subject ((this statement))
(unless (slot-value this 'statement-subject)
(setf (statement-subject this) (second (statement-tuple this))))
(slot-value this 'statement-subject))
(defmethod statement-predicate ((this statement))
(unless (slot-value this 'statement-predicate)
(setf (statement-predicate this) (third (statement-tuple this))))
(slot-value this 'statement-predicate))
(defmethod statement-context ((this statement))
(unless (slot-value this 'statement-context)
(setf (statement-context this) (third (statement-tuple this))))
(slot-value this 'statement-context))
(defmethod statement-id ((this statement))
(let ((id (fourth (statement-tuple this))))
(if id (parse-integer id) -1)))
(defmethod nth-component ((this statement) (n integer))
(nth n (statement-tuple this)))
(defun make-uri (uri) (make-instance 'uri :value uri))
(defun make-literal (label &optional datatype language)
(make-instance 'literal :label label :datatype datatype :language language))
(defun make-bnode (id) (make-instance 'bnode :id id))
(defun string->term (string)
(iter
(for (parser . constructor) :in
`((null . ,(constantly nil))
(openrdf.utils:parse-uriref . make-uri)
(openrdf.utils:parse-literal . make-literal)
(openrdf.utils:parse-nodeid . make-bnode)))
(for parsed := (funcall parser string))
(when parsed (return (apply constructor parsed)))
(finally (return (make-literal string)))))
| 2,954 | Common Lisp | .lisp | 63 | 42.111111 | 78 | 0.70713 | wvxvw/agraph-client | 0 | 0 | 0 | EPL-1.0 | 9/19/2024, 11:36:20 AM (Europe/Amsterdam) | f00682ccc3251a267e716a0a610b8bb8ab4052911b292278986863c552385ae5 | 28,719 | [
-1
] |
28,720 | valuefactory.lisp | wvxvw_agraph-client/src/openrdf/model/valuefactory.lisp | ;; -*- coding: utf-8 -*-
(in-package :openrdf.model)
;; this is that rare case, which calls for funcallable object
;; but let us not decide hastily, maybe we don't need this at all.
(defclass value-factory ()
((blank-node-amount :initform 10 :initarg :blank-node-amount
:accessor value-factory-blank-node-amount)
(store :initform nil :initarg :store
:accessor value-factory-store)
(unused-bnode-ids :initform nil :initarg :unused-bnode-ids
:accessor value-factory-unused-bnode-ids)))
(defmethod value-factory-unused-bnode-id ((this value-factory))
(unless (value-factory-unused-bnode-ids this)
(setf (value-factory-unused-bnode-ids this)
(get-blank-nodes (mini-repository (value-factory-store this))
(value-factory-blank-node-amount this))))
(subseq (pop (value-factory-unused-bnode-ids this)) 2))
(defmethod create-bnode ((this value-factory) &optional node-id)
(make-instance 'bnode :id (or node-id (value-factory-unused-bnode-id this))))
(defmethod create-literal ((this value-factory) value &key datatype language)
(if (and (consp value) (cdr value))
(create-range this (first value) (second value))
(make-instance 'literal :label value :datatype datatype :language language)))
(defmethod create-statement
((this value-factory) subject predicate object &optional context)
(declare (ignore this))
(make-instance 'statement
:subject subject :predicate predicate
:object object :context context))
;; This is something really odd... not sure what happens, if there's no
;; local-name, but there is a namespace
(defmethod create-uri ((this value-factory) &key uri namespace local-name)
(declare (ignore this))
(when (and namespace local-name)
(setf uri (concatenate 'string namespace local-name)))
(make-instance 'uri :value uri))
;; This all looks too odd, why do I need predicate here?
(defmethod validate-range-constant ((this value-factory) term predicate)
(declare (ignore predicate))
(let ((datatype (get-datatype term)))
(unless datatype (error "~a must have datatype" (get-value term)))))
;; Same as above + there was a to-do for `geo-term'
(defmethod validate-compound-literal ((this value-factory) term predicate)
(typecase term
(range-literal
(validate-range-constant this (lower-bound term) predicate)
(validate-range-constant this (upper-bound term) predicate))
(geo-term )))
(defmethod position->term ((this value-factory) term &optional predicate)
(typecase term
(compound-literal (validate-compound-literal this term predicate))
(value (setf term (clreate-literal this term))))
term)
(defmethod create-range ((this value-factory) lower-bound upper-bound)
;; `range-literal' needs some defaults for `:label' slot
(make-instance 'range-literal
:upper-bound (position->term this upper-bound)
:lower-bound (position->term this lower-bound)))
| 2,993 | Common Lisp | .lisp | 58 | 46.465517 | 83 | 0.71238 | wvxvw/agraph-client | 0 | 0 | 0 | EPL-1.0 | 9/19/2024, 11:36:20 AM (Europe/Amsterdam) | 46b7f0e8b7f6d3f79dd49b5dbaee4539f40f567d8f5755d3a3331aa0df3177c9 | 28,720 | [
-1
] |
28,721 | test-client.lisp | wvxvw_agraph-client/tests/test-client.lisp | (in-package :agraph-client.test)
(in-suite :agraph-client.test)
(def-suite test-suite
:description "Minimal testing suite for agraph-client project.")
(defparameter *test-board*
(make-array
'(9 9)
:initial-contents
'((0 0 0 1 0 5 0 6 8)
(0 0 0 0 0 0 7 0 1)
(9 0 1 0 0 0 0 3 0)
(0 0 7 0 2 6 0 0 0)
(5 0 0 0 0 0 0 0 3)
(0 0 0 8 7 0 4 0 0)
(0 3 0 0 0 0 8 0 5)
(1 0 5 0 0 0 0 0 0)
(7 9 0 4 0 1 0 0 0))))
(test test-solve-simple
"Tries to solve a simple (classic) sudoku board"
(is
(iter
(with result := (agraph-client:solve *test-board*))
(for i :from 0 :below 9)
(iter
(for j :from 0 :below 9)
(when (zerop (aref result i j))
(return)))
(finally (return t)))))
| 767 | Common Lisp | .lisp | 28 | 22.5 | 68 | 0.568707 | wvxvw/agraph-client | 0 | 0 | 0 | EPL-1.0 | 9/19/2024, 11:36:20 AM (Europe/Amsterdam) | de82e18cfd7ea74ed2cfb81d73f2c4c6be6ec4f490067dc0322ac3d1cc1b33fb | 28,721 | [
-1
] |
28,722 | suite.lisp | wvxvw_agraph-client/tests/suite.lisp | (in-package :agraph-client.test)
(eval-when (:compile-toplevel :load-toplevel :execute)
(unless (get-test :agraph-client)
(def-suite :agraph-client)))
(def-suite :agraph-client.test :in :agraph-client)
| 210 | Common Lisp | .lisp | 5 | 39.4 | 54 | 0.738916 | wvxvw/agraph-client | 0 | 0 | 0 | EPL-1.0 | 9/19/2024, 11:36:20 AM (Europe/Amsterdam) | 3e8db3a9451329751dadf60f2fc51f5cc29070de6fdd2163ef7473fed702d1b7 | 28,722 | [
-1
] |
28,723 | agraph-client.asd | wvxvw_agraph-client/agraph-client.asd | (in-package :cl)
(defpackage agraph-client-asd (:use :cl :asdf))
(in-package :agraph-client-asd)
(defsystem agraph-client
:version "0.1"
:author "Oleg Sivokon <[email protected]>,
derived from Python source written by Franz Inc.
<http://www.franz.com/agraph/allegrograph/>"
:license "EPL"
:depends-on (:alexandria :cl-ppcre :iterate :local-time :cl-containers)
:components ((:module
"src" :serial t
:components
((:module
"openrdf" :serial t
:components
((:module
"util" :serial t
:components
((:file "package")
(:file "utils" :depends-on ("package"))))
(:module
"query" :serial t
:components
((:file "package")
(:file "dataset" :depends-on ("package"))
(:file "queryresult" :depends-on ("dataset"))
(:file "query" :depends-on ("queryresult"))))
(:module
"model" :serial t :depends-on ("util")
:components
((:file "package")
(:file "value" :depends-on ("package"))
(:file "literal" :depends-on ("value"))
(:file "statement" :depends-on ("value"))
(:file "valuefactory" :depends-on ("statement"))))
(:module
"vocabulary" :serial t :depends-on ("model")
:components
((:file "package")
(:file "xmlschema" :depends-on ("package")))))))))
:description "Port of Franz' client for AllegroGraph database"
:long-description
#.(with-open-file
(stream (merge-pathnames
#p"README.org" (or *load-pathname* *compile-file-pathname*))
:if-does-not-exist nil :direction :input)
(when stream
(let ((seq (make-array (file-length stream)
:element-type 'character
:fill-pointer t)))
(setf (fill-pointer seq) (read-sequence seq stream)) seq)))
:in-order-to ((test-op (load-op :agraph-client-test)))
:perform (test-op :after (op c)
(funcall (intern (string '#:run!) :agraph-client.test)
:agraph-client.test)))
(defsystem :agraph-client-test
:author "Oleg Sivokon <[email protected]>"
:description "Minimal test suite for testing agraph-client"
:license "EPL"
:depends-on (:agraph-client :fiveam)
:components ((:module "tests"
:serial t
:components
((:file "package")
(:file "suite" :depends-on ("package"))
(:file "test-client" :depends-on ("suite"))))))
| 2,979 | Common Lisp | .asd | 67 | 29.432836 | 77 | 0.489691 | wvxvw/agraph-client | 0 | 0 | 0 | EPL-1.0 | 9/19/2024, 11:36:20 AM (Europe/Amsterdam) | 04552517956b431ee8072751eca006da886a15bc8dc280c82f9a709d1b1f75fb | 28,723 | [
-1
] |
28,728 | python-blankNodes3.rdf | wvxvw_agraph-client/tutorial/python-blankNodes3.rdf | <?xml version='1.0' encoding='ISO-8859-1'?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc = "http://purl.org/dc/elements/1.1/"
xmlns:foaf = "http://xmlns.com/foaf/0.1/">
<!-- Example 3: Two books, plus separate URI-identified Author. Show no duplicates. -->
<rdf:Description rdf:about="http://www.franz.com/tutorial#book5">
<dc:title>The Call of the Wild</dc:title>
<dc:creator rdf:resource="http://www.franz.com/tutorial#author1"/>
</rdf:Description>
<rdf:Description rdf:about="http://www.franz.com/tutorial#book6">
<dc:title>White Fang</dc:title>
<dc:creator rdf:resource="http://www.franz.com/tutorial#author1"/>
</rdf:Description>
<foaf:Person rdf:about="http://www.franz.com/tutorial#author1">
<dc:title>Jack London</dc:title>
</foaf:Person>
</rdf:RDF> | 834 | Common Lisp | .l | 17 | 45.352941 | 88 | 0.696406 | wvxvw/agraph-client | 0 | 0 | 0 | EPL-1.0 | 9/19/2024, 11:36:20 AM (Europe/Amsterdam) | 88089f35414772a89098efdf19b65f836b5ce6bb795a97047443f9beae15ba1a | 28,728 | [
-1
] |
28,729 | python-kennedy.ntriples | wvxvw_agraph-client/tutorial/python-kennedy.ntriples | <http://www.franz.com/simple#person1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person1> <http://www.franz.com/simple#first-name> "Joseph" .
<http://www.franz.com/simple#person1> <http://www.franz.com/simple#middle-initial> "Patrick" .
<http://www.franz.com/simple#person1> <http://www.franz.com/simple#last-name> "Kennedy" .
<http://www.franz.com/simple#person1> <http://www.franz.com/simple#suffix> "none" .
<http://www.franz.com/simple#person1> <http://www.franz.com/simple#alma-mater> <http://www.franz.com/simple#Harvard> .
<http://www.franz.com/simple#person1> <http://www.franz.com/simple#birth-year> "1888" .
<http://www.franz.com/simple#person1> <http://www.franz.com/simple#death-year> "1969" .
<http://www.franz.com/simple#person1> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#male> .
<http://www.franz.com/simple#person1> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person2> .
<http://www.franz.com/simple#person1> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person3> .
<http://www.franz.com/simple#person3> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person1> .
<http://www.franz.com/simple#person1> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person4> .
<http://www.franz.com/simple#person4> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person1> .
<http://www.franz.com/simple#person1> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person6> .
<http://www.franz.com/simple#person6> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person1> .
<http://www.franz.com/simple#person1> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person7> .
<http://www.franz.com/simple#person7> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person1> .
<http://www.franz.com/simple#person1> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person9> .
<http://www.franz.com/simple#person9> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person1> .
<http://www.franz.com/simple#person1> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person11> .
<http://www.franz.com/simple#person11> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person1> .
<http://www.franz.com/simple#person1> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person13> .
<http://www.franz.com/simple#person13> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person1> .
<http://www.franz.com/simple#person1> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person15> .
<http://www.franz.com/simple#person15> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person1> .
<http://www.franz.com/simple#person1> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person17> .
<http://www.franz.com/simple#person17> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person1> .
<http://www.franz.com/simple#person1> <http://www.franz.com/simple#profession> <http://www.franz.com/simple#banker> .
<http://www.franz.com/simple#person1> <http://www.franz.com/simple#profession> <http://www.franz.com/simple#producer> .
<http://www.franz.com/simple#person1> <http://www.franz.com/simple#profession> <http://www.franz.com/simple#ambassador> .
<http://www.franz.com/simple#person2> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person2> <http://www.franz.com/simple#first-name> "Rose" .
<http://www.franz.com/simple#person2> <http://www.franz.com/simple#middle-initial> "Elizabeth" .
<http://www.franz.com/simple#person2> <http://www.franz.com/simple#last-name> "Fitzgerald" .
<http://www.franz.com/simple#person2> <http://www.franz.com/simple#suffix> "none" .
<http://www.franz.com/simple#person2> <http://www.franz.com/simple#alma-mater> <http://www.franz.com/simple#Sacred-Heart-Convent> .
<http://www.franz.com/simple#person2> <http://www.franz.com/simple#birth-year> "1890" .
<http://www.franz.com/simple#person2> <http://www.franz.com/simple#death-year> "1995" .
<http://www.franz.com/simple#person2> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#female> .
<http://www.franz.com/simple#person2> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person1> .
<http://www.franz.com/simple#person2> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person3> .
<http://www.franz.com/simple#person3> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person2> .
<http://www.franz.com/simple#person2> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person4> .
<http://www.franz.com/simple#person4> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person2> .
<http://www.franz.com/simple#person2> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person6> .
<http://www.franz.com/simple#person6> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person2> .
<http://www.franz.com/simple#person2> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person7> .
<http://www.franz.com/simple#person7> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person2> .
<http://www.franz.com/simple#person2> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person9> .
<http://www.franz.com/simple#person9> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person2> .
<http://www.franz.com/simple#person2> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person11> .
<http://www.franz.com/simple#person11> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person2> .
<http://www.franz.com/simple#person2> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person13> .
<http://www.franz.com/simple#person13> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person2> .
<http://www.franz.com/simple#person2> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person15> .
<http://www.franz.com/simple#person15> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person2> .
<http://www.franz.com/simple#person2> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person17> .
<http://www.franz.com/simple#person17> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person2> .
<http://www.franz.com/simple#person2> <http://www.franz.com/simple#profession> <http://www.franz.com/simple#home-maker> .
<http://www.franz.com/simple#person3> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person3> <http://www.franz.com/simple#first-name> "Joseph" .
<http://www.franz.com/simple#person3> <http://www.franz.com/simple#middle-initial> "P" .
<http://www.franz.com/simple#person3> <http://www.franz.com/simple#last-name> "Kennedy" .
<http://www.franz.com/simple#person3> <http://www.franz.com/simple#suffix> "Jr" .
<http://www.franz.com/simple#person3> <http://www.franz.com/simple#alma-mater> <http://www.franz.com/simple#Harvard> .
<http://www.franz.com/simple#person3> <http://www.franz.com/simple#birth-year> "1915" .
<http://www.franz.com/simple#person3> <http://www.franz.com/simple#death-year> "1944" .
<http://www.franz.com/simple#person3> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#male> .
<http://www.franz.com/simple#person3> <http://www.franz.com/simple#profession> <http://www.franz.com/simple#navy> .
<http://www.franz.com/simple#person4> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person4> <http://www.franz.com/simple#first-name> "John" .
<http://www.franz.com/simple#person4> <http://www.franz.com/simple#middle-initial> "Fitzgerald" .
<http://www.franz.com/simple#person4> <http://www.franz.com/simple#last-name> "Kennedy" .
<http://www.franz.com/simple#person4> <http://www.franz.com/simple#suffix> "none" .
<http://www.franz.com/simple#person4> <http://www.franz.com/simple#alma-mater> <http://www.franz.com/simple#Princeton> .
<http://www.franz.com/simple#person4> <http://www.franz.com/simple#alma-mater> <http://www.franz.com/simple#Harvard> .
<http://www.franz.com/simple#person4> <http://www.franz.com/simple#birth-year> "1917" .
<http://www.franz.com/simple#person4> <http://www.franz.com/simple#death-year> "1963" .
<http://www.franz.com/simple#person4> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#male> .
<http://www.franz.com/simple#person4> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person5> .
<http://www.franz.com/simple#person4> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person20> .
<http://www.franz.com/simple#person20> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person4> .
<http://www.franz.com/simple#person4> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person22> .
<http://www.franz.com/simple#person22> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person4> .
<http://www.franz.com/simple#person4> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person24> .
<http://www.franz.com/simple#person24> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person4> .
<http://www.franz.com/simple#person4> <http://www.franz.com/simple#profession> <http://www.franz.com/simple#navy> .
<http://www.franz.com/simple#person4> <http://www.franz.com/simple#profession> <http://www.franz.com/simple#congressman> .
<http://www.franz.com/simple#person4> <http://www.franz.com/simple#profession> <http://www.franz.com/simple#senator> .
<http://www.franz.com/simple#person4> <http://www.franz.com/simple#profession> <http://www.franz.com/simple#president> .
<http://www.franz.com/simple#person5> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person5> <http://www.franz.com/simple#first-name> "Jacqueline" .
<http://www.franz.com/simple#person5> <http://www.franz.com/simple#middle-initial> "Lee" .
<http://www.franz.com/simple#person5> <http://www.franz.com/simple#last-name> "Bouvier" .
<http://www.franz.com/simple#person5> <http://www.franz.com/simple#suffix> "none" .
<http://www.franz.com/simple#person5> <http://www.franz.com/simple#alma-mater> <http://www.franz.com/simple#George-Washington> .
<http://www.franz.com/simple#person5> <http://www.franz.com/simple#birth-year> "1929" .
<http://www.franz.com/simple#person5> <http://www.franz.com/simple#death-year> "1994" .
<http://www.franz.com/simple#person5> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#female> .
<http://www.franz.com/simple#person5> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person4> .
<http://www.franz.com/simple#person5> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person20> .
<http://www.franz.com/simple#person20> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person5> .
<http://www.franz.com/simple#person5> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person22> .
<http://www.franz.com/simple#person22> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person5> .
<http://www.franz.com/simple#person5> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person24> .
<http://www.franz.com/simple#person24> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person5> .
<http://www.franz.com/simple#person5> <http://www.franz.com/simple#profession> <http://www.franz.com/simple#photographer> .
<http://www.franz.com/simple#person5> <http://www.franz.com/simple#profession> <http://www.franz.com/simple#home-maker> .
<http://www.franz.com/simple#person5> <http://www.franz.com/simple#profession> <http://www.franz.com/simple#editor> .
<http://www.franz.com/simple#person6> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person6> <http://www.franz.com/simple#first-name> "Rose" .
<http://www.franz.com/simple#person6> <http://www.franz.com/simple#middle-initial> "Marie" .
<http://www.franz.com/simple#person6> <http://www.franz.com/simple#last-name> "Kennedy" .
<http://www.franz.com/simple#person6> <http://www.franz.com/simple#suffix> "none" .
<http://www.franz.com/simple#person6> <http://www.franz.com/simple#birth-year> "1918" .
<http://www.franz.com/simple#person6> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#female> .
<http://www.franz.com/simple#person7> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person7> <http://www.franz.com/simple#first-name> "Kathleen" .
<http://www.franz.com/simple#person7> <http://www.franz.com/simple#middle-initial> "Agnes" .
<http://www.franz.com/simple#person7> <http://www.franz.com/simple#last-name> "Kennedy" .
<http://www.franz.com/simple#person7> <http://www.franz.com/simple#suffix> "none" .
<http://www.franz.com/simple#person7> <http://www.franz.com/simple#birth-year> "1920" .
<http://www.franz.com/simple#person7> <http://www.franz.com/simple#death-year> "1948" .
<http://www.franz.com/simple#person7> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#female> .
<http://www.franz.com/simple#person7> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person8> .
<http://www.franz.com/simple#person7> <http://www.franz.com/simple#profession> <http://www.franz.com/simple#volunteer> .
<http://www.franz.com/simple#person8> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person8> <http://www.franz.com/simple#first-name> "William" .
<http://www.franz.com/simple#person8> <http://www.franz.com/simple#middle-initial> "JR" .
<http://www.franz.com/simple#person8> <http://www.franz.com/simple#last-name> "Cavendish" .
<http://www.franz.com/simple#person8> <http://www.franz.com/simple#suffix> "none" .
<http://www.franz.com/simple#person8> <http://www.franz.com/simple#birth-year> "1917" .
<http://www.franz.com/simple#person8> <http://www.franz.com/simple#death-year> "1944" .
<http://www.franz.com/simple#person8> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#male> .
<http://www.franz.com/simple#person8> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person7> .
<http://www.franz.com/simple#person8> <http://www.franz.com/simple#profession> <http://www.franz.com/simple#army> .
<http://www.franz.com/simple#person9> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person9> <http://www.franz.com/simple#first-name> "Eunice" .
<http://www.franz.com/simple#person9> <http://www.franz.com/simple#middle-initial> "Mary" .
<http://www.franz.com/simple#person9> <http://www.franz.com/simple#last-name> "Kennedy" .
<http://www.franz.com/simple#person9> <http://www.franz.com/simple#suffix> "none" .
<http://www.franz.com/simple#person9> <http://www.franz.com/simple#birth-year> "1921" .
<http://www.franz.com/simple#person9> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#female> .
<http://www.franz.com/simple#person9> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person10> .
<http://www.franz.com/simple#person9> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person25> .
<http://www.franz.com/simple#person25> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person9> .
<http://www.franz.com/simple#person9> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person26> .
<http://www.franz.com/simple#person26> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person9> .
<http://www.franz.com/simple#person9> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person28> .
<http://www.franz.com/simple#person28> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person9> .
<http://www.franz.com/simple#person9> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person31> .
<http://www.franz.com/simple#person31> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person9> .
<http://www.franz.com/simple#person9> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person33> .
<http://www.franz.com/simple#person33> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person9> .
<http://www.franz.com/simple#person9> <http://www.franz.com/simple#profession> <http://www.franz.com/simple#volunteer> .
<http://www.franz.com/simple#person10> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person10> <http://www.franz.com/simple#first-name> "Robert" .
<http://www.franz.com/simple#person10> <http://www.franz.com/simple#middle-initial> "Sargent" .
<http://www.franz.com/simple#person10> <http://www.franz.com/simple#last-name> "Shriver" .
<http://www.franz.com/simple#person10> <http://www.franz.com/simple#suffix> "none" .
<http://www.franz.com/simple#person10> <http://www.franz.com/simple#alma-mater> <http://www.franz.com/simple#Yale> .
<http://www.franz.com/simple#person10> <http://www.franz.com/simple#birth-year> "1915" .
<http://www.franz.com/simple#person10> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#male> .
<http://www.franz.com/simple#person10> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person9> .
<http://www.franz.com/simple#person10> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person25> .
<http://www.franz.com/simple#person25> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person10> .
<http://www.franz.com/simple#person10> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person26> .
<http://www.franz.com/simple#person26> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person10> .
<http://www.franz.com/simple#person10> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person28> .
<http://www.franz.com/simple#person28> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person10> .
<http://www.franz.com/simple#person10> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person31> .
<http://www.franz.com/simple#person31> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person10> .
<http://www.franz.com/simple#person10> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person33> .
<http://www.franz.com/simple#person33> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person10> .
<http://www.franz.com/simple#person10> <http://www.franz.com/simple#profession> <http://www.franz.com/simple#navy> .
<http://www.franz.com/simple#person10> <http://www.franz.com/simple#profession> <http://www.franz.com/simple#peace-corp> .
<http://www.franz.com/simple#person10> <http://www.franz.com/simple#profession> <http://www.franz.com/simple#ambassador> .
<http://www.franz.com/simple#person11> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person11> <http://www.franz.com/simple#first-name> "Patricia" .
<http://www.franz.com/simple#person11> <http://www.franz.com/simple#middle-initial> "nil" .
<http://www.franz.com/simple#person11> <http://www.franz.com/simple#last-name> "Kennedy" .
<http://www.franz.com/simple#person11> <http://www.franz.com/simple#suffix> "none" .
<http://www.franz.com/simple#person11> <http://www.franz.com/simple#alma-mater> <http://www.franz.com/simple#Rosemont-College> .
<http://www.franz.com/simple#person11> <http://www.franz.com/simple#birth-year> "1924" .
<http://www.franz.com/simple#person11> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#female> .
<http://www.franz.com/simple#person11> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person12> .
<http://www.franz.com/simple#person11> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person35> .
<http://www.franz.com/simple#person35> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person11> .
<http://www.franz.com/simple#person11> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person37> .
<http://www.franz.com/simple#person37> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person11> .
<http://www.franz.com/simple#person11> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person39> .
<http://www.franz.com/simple#person39> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person11> .
<http://www.franz.com/simple#person11> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person41> .
<http://www.franz.com/simple#person41> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person11> .
<http://www.franz.com/simple#person11> <http://www.franz.com/simple#profession> <http://www.franz.com/simple#producer> .
<http://www.franz.com/simple#person11> <http://www.franz.com/simple#profession> <http://www.franz.com/simple#home-maker> .
<http://www.franz.com/simple#person12> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person12> <http://www.franz.com/simple#first-name> "Peter" .
<http://www.franz.com/simple#person12> <http://www.franz.com/simple#middle-initial> "nil" .
<http://www.franz.com/simple#person12> <http://www.franz.com/simple#last-name> "Lawford" .
<http://www.franz.com/simple#person12> <http://www.franz.com/simple#suffix> "none" .
<http://www.franz.com/simple#person12> <http://www.franz.com/simple#birth-year> "1923" .
<http://www.franz.com/simple#person12> <http://www.franz.com/simple#death-year> "1984" .
<http://www.franz.com/simple#person12> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#male> .
<http://www.franz.com/simple#person12> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person11> .
<http://www.franz.com/simple#person12> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person35> .
<http://www.franz.com/simple#person35> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person12> .
<http://www.franz.com/simple#person12> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person37> .
<http://www.franz.com/simple#person37> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person12> .
<http://www.franz.com/simple#person12> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person39> .
<http://www.franz.com/simple#person39> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person12> .
<http://www.franz.com/simple#person12> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person41> .
<http://www.franz.com/simple#person41> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person12> .
<http://www.franz.com/simple#person12> <http://www.franz.com/simple#profession> <http://www.franz.com/simple#actor> .
<http://www.franz.com/simple#person13> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person13> <http://www.franz.com/simple#first-name> "Robert" .
<http://www.franz.com/simple#person13> <http://www.franz.com/simple#middle-initial> "Francis" .
<http://www.franz.com/simple#person13> <http://www.franz.com/simple#last-name> "Kennedy" .
<http://www.franz.com/simple#person13> <http://www.franz.com/simple#suffix> "none" .
<http://www.franz.com/simple#person13> <http://www.franz.com/simple#alma-mater> <http://www.franz.com/simple#University-of-Virginia> .
<http://www.franz.com/simple#person13> <http://www.franz.com/simple#birth-year> "1925" .
<http://www.franz.com/simple#person13> <http://www.franz.com/simple#death-year> "1968" .
<http://www.franz.com/simple#person13> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#male> .
<http://www.franz.com/simple#person13> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person14> .
<http://www.franz.com/simple#person13> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person42> .
<http://www.franz.com/simple#person42> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person13> .
<http://www.franz.com/simple#person13> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person44> .
<http://www.franz.com/simple#person44> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person13> .
<http://www.franz.com/simple#person13> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person47> .
<http://www.franz.com/simple#person47> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person13> .
<http://www.franz.com/simple#person13> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person50> .
<http://www.franz.com/simple#person50> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person13> .
<http://www.franz.com/simple#person13> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person51> .
<http://www.franz.com/simple#person51> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person13> .
<http://www.franz.com/simple#person13> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person54> .
<http://www.franz.com/simple#person54> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person13> .
<http://www.franz.com/simple#person13> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person56> .
<http://www.franz.com/simple#person56> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person13> .
<http://www.franz.com/simple#person13> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person58> .
<http://www.franz.com/simple#person58> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person13> .
<http://www.franz.com/simple#person13> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person60> .
<http://www.franz.com/simple#person60> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person13> .
<http://www.franz.com/simple#person13> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person62> .
<http://www.franz.com/simple#person62> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person13> .
<http://www.franz.com/simple#person13> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person64> .
<http://www.franz.com/simple#person64> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person13> .
<http://www.franz.com/simple#person13> <http://www.franz.com/simple#profession> <http://www.franz.com/simple#navy> .
<http://www.franz.com/simple#person13> <http://www.franz.com/simple#profession> <http://www.franz.com/simple#attorney-general> .
<http://www.franz.com/simple#person13> <http://www.franz.com/simple#profession> <http://www.franz.com/simple#senator> .
<http://www.franz.com/simple#person14> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person14> <http://www.franz.com/simple#first-name> "Ethel" .
<http://www.franz.com/simple#person14> <http://www.franz.com/simple#middle-initial> "nil" .
<http://www.franz.com/simple#person14> <http://www.franz.com/simple#last-name> "Skakel" .
<http://www.franz.com/simple#person14> <http://www.franz.com/simple#suffix> "none" .
<http://www.franz.com/simple#person14> <http://www.franz.com/simple#alma-mater> <http://www.franz.com/simple#Manhattanville-College> .
<http://www.franz.com/simple#person14> <http://www.franz.com/simple#birth-year> "1928" .
<http://www.franz.com/simple#person14> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#female> .
<http://www.franz.com/simple#person14> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person13> .
<http://www.franz.com/simple#person14> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person42> .
<http://www.franz.com/simple#person42> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person14> .
<http://www.franz.com/simple#person14> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person44> .
<http://www.franz.com/simple#person44> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person14> .
<http://www.franz.com/simple#person14> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person47> .
<http://www.franz.com/simple#person47> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person14> .
<http://www.franz.com/simple#person14> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person50> .
<http://www.franz.com/simple#person50> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person14> .
<http://www.franz.com/simple#person14> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person51> .
<http://www.franz.com/simple#person51> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person14> .
<http://www.franz.com/simple#person14> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person54> .
<http://www.franz.com/simple#person54> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person14> .
<http://www.franz.com/simple#person14> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person56> .
<http://www.franz.com/simple#person56> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person14> .
<http://www.franz.com/simple#person14> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person58> .
<http://www.franz.com/simple#person58> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person14> .
<http://www.franz.com/simple#person14> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person60> .
<http://www.franz.com/simple#person60> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person14> .
<http://www.franz.com/simple#person14> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person62> .
<http://www.franz.com/simple#person62> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person14> .
<http://www.franz.com/simple#person14> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person64> .
<http://www.franz.com/simple#person64> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person14> .
<http://www.franz.com/simple#person14> <http://www.franz.com/simple#profession> <http://www.franz.com/simple#home-maker> .
<http://www.franz.com/simple#person14> <http://www.franz.com/simple#profession> <http://www.franz.com/simple#non-profit> .
<http://www.franz.com/simple#person15> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person15> <http://www.franz.com/simple#first-name> "Jean" .
<http://www.franz.com/simple#person15> <http://www.franz.com/simple#middle-initial> "Ann" .
<http://www.franz.com/simple#person15> <http://www.franz.com/simple#last-name> "Kennedy" .
<http://www.franz.com/simple#person15> <http://www.franz.com/simple#suffix> "none" .
<http://www.franz.com/simple#person15> <http://www.franz.com/simple#alma-mater> <http://www.franz.com/simple#Manhattanville-College> .
<http://www.franz.com/simple#person15> <http://www.franz.com/simple#birth-year> "1928" .
<http://www.franz.com/simple#person15> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#female> .
<http://www.franz.com/simple#person15> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person16> .
<http://www.franz.com/simple#person15> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person66> .
<http://www.franz.com/simple#person66> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person15> .
<http://www.franz.com/simple#person15> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person67> .
<http://www.franz.com/simple#person67> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person15> .
<http://www.franz.com/simple#person15> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person68> .
<http://www.franz.com/simple#person68> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person15> .
<http://www.franz.com/simple#person15> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person70> .
<http://www.franz.com/simple#person70> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person15> .
<http://www.franz.com/simple#person15> <http://www.franz.com/simple#profession> <http://www.franz.com/simple#writer> .
<http://www.franz.com/simple#person15> <http://www.franz.com/simple#profession> <http://www.franz.com/simple#non-profit> .
<http://www.franz.com/simple#person15> <http://www.franz.com/simple#profession> <http://www.franz.com/simple#ambassador> .
<http://www.franz.com/simple#person16> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person16> <http://www.franz.com/simple#first-name> "Stephen" .
<http://www.franz.com/simple#person16> <http://www.franz.com/simple#middle-initial> "Edward" .
<http://www.franz.com/simple#person16> <http://www.franz.com/simple#last-name> "Smith" .
<http://www.franz.com/simple#person16> <http://www.franz.com/simple#suffix> "none" .
<http://www.franz.com/simple#person16> <http://www.franz.com/simple#birth-year> "1927" .
<http://www.franz.com/simple#person16> <http://www.franz.com/simple#death-year> "1990" .
<http://www.franz.com/simple#person16> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#female> .
<http://www.franz.com/simple#person16> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person15> .
<http://www.franz.com/simple#person16> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person66> .
<http://www.franz.com/simple#person66> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person16> .
<http://www.franz.com/simple#person16> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person67> .
<http://www.franz.com/simple#person67> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person16> .
<http://www.franz.com/simple#person16> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person68> .
<http://www.franz.com/simple#person68> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person16> .
<http://www.franz.com/simple#person16> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person70> .
<http://www.franz.com/simple#person70> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person16> .
<http://www.franz.com/simple#person16> <http://www.franz.com/simple#profession> <http://www.franz.com/simple#campaign-organizer> .
<http://www.franz.com/simple#person17> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person17> <http://www.franz.com/simple#first-name> "Edward" .
<http://www.franz.com/simple#person17> <http://www.franz.com/simple#middle-initial> "Moore" .
<http://www.franz.com/simple#person17> <http://www.franz.com/simple#last-name> "Kennedy" .
<http://www.franz.com/simple#person17> <http://www.franz.com/simple#suffix> "none" .
<http://www.franz.com/simple#person17> <http://www.franz.com/simple#alma-mater> <http://www.franz.com/simple#Harvard> .
<http://www.franz.com/simple#person17> <http://www.franz.com/simple#alma-mater> <http://www.franz.com/simple#University-of-Virginia> .
<http://www.franz.com/simple#person17> <http://www.franz.com/simple#birth-year> "1932" .
<http://www.franz.com/simple#person17> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#male> .
<http://www.franz.com/simple#person17> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person18> .
<http://www.franz.com/simple#person17> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person19> .
<http://www.franz.com/simple#person17> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person72> .
<http://www.franz.com/simple#person72> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person17> .
<http://www.franz.com/simple#person17> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person74> .
<http://www.franz.com/simple#person74> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person17> .
<http://www.franz.com/simple#person17> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person76> .
<http://www.franz.com/simple#person76> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person17> .
<http://www.franz.com/simple#person17> <http://www.franz.com/simple#profession> <http://www.franz.com/simple#army> .
<http://www.franz.com/simple#person17> <http://www.franz.com/simple#profession> <http://www.franz.com/simple#senator> .
<http://www.franz.com/simple#person18> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person18> <http://www.franz.com/simple#first-name> "Virginia" .
<http://www.franz.com/simple#person18> <http://www.franz.com/simple#middle-initial> "Joan" .
<http://www.franz.com/simple#person18> <http://www.franz.com/simple#last-name> "Bennett" .
<http://www.franz.com/simple#person18> <http://www.franz.com/simple#suffix> "none" .
<http://www.franz.com/simple#person18> <http://www.franz.com/simple#alma-mater> <http://www.franz.com/simple#Manhattanville-College> .
<http://www.franz.com/simple#person18> <http://www.franz.com/simple#birth-year> "1936" .
<http://www.franz.com/simple#person18> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#female> .
<http://www.franz.com/simple#person18> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person17> .
<http://www.franz.com/simple#person18> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person72> .
<http://www.franz.com/simple#person72> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person18> .
<http://www.franz.com/simple#person18> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person74> .
<http://www.franz.com/simple#person74> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person18> .
<http://www.franz.com/simple#person18> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person76> .
<http://www.franz.com/simple#person76> <http://www.franz.com/simple#has-parent> <http://www.franz.com/simple#person18> .
<http://www.franz.com/simple#person18> <http://www.franz.com/simple#profession> <http://www.franz.com/simple#model> .
<http://www.franz.com/simple#person18> <http://www.franz.com/simple#profession> <http://www.franz.com/simple#home-maker> .
<http://www.franz.com/simple#person19> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person19> <http://www.franz.com/simple#first-name> "Victoria" .
<http://www.franz.com/simple#person19> <http://www.franz.com/simple#middle-initial> "Anne" .
<http://www.franz.com/simple#person19> <http://www.franz.com/simple#last-name> "Reggie" .
<http://www.franz.com/simple#person19> <http://www.franz.com/simple#suffix> "none" .
<http://www.franz.com/simple#person19> <http://www.franz.com/simple#birth-year> "1954" .
<http://www.franz.com/simple#person19> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#female> .
<http://www.franz.com/simple#person19> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person17> .
<http://www.franz.com/simple#person19> <http://www.franz.com/simple#profession> <http://www.franz.com/simple#attorney> .
<http://www.franz.com/simple#person20> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person20> <http://www.franz.com/simple#first-name> "Caroline" .
<http://www.franz.com/simple#person20> <http://www.franz.com/simple#middle-initial> "Bouvier" .
<http://www.franz.com/simple#person20> <http://www.franz.com/simple#last-name> "Kennedy" .
<http://www.franz.com/simple#person20> <http://www.franz.com/simple#suffix> "none" .
<http://www.franz.com/simple#person20> <http://www.franz.com/simple#alma-mater> <http://www.franz.com/simple#Harvard> .
<http://www.franz.com/simple#person20> <http://www.franz.com/simple#alma-mater> <http://www.franz.com/simple#Columbia> .
<http://www.franz.com/simple#person20> <http://www.franz.com/simple#birth-year> "1957" .
<http://www.franz.com/simple#person20> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#female> .
<http://www.franz.com/simple#person20> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person21> .
<http://www.franz.com/simple#person20> <http://www.franz.com/simple#profession> <http://www.franz.com/simple#non-profit> .
<http://www.franz.com/simple#person21> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person21> <http://www.franz.com/simple#first-name> "Edwin" .
<http://www.franz.com/simple#person21> <http://www.franz.com/simple#middle-initial> "Arthur" .
<http://www.franz.com/simple#person21> <http://www.franz.com/simple#last-name> "Schlossberg" .
<http://www.franz.com/simple#person21> <http://www.franz.com/simple#suffix> "none" .
<http://www.franz.com/simple#person21> <http://www.franz.com/simple#birth-year> "1945" .
<http://www.franz.com/simple#person21> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#male> .
<http://www.franz.com/simple#person21> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person20> .
<http://www.franz.com/simple#person22> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person22> <http://www.franz.com/simple#first-name> "John" .
<http://www.franz.com/simple#person22> <http://www.franz.com/simple#middle-initial> "F" .
<http://www.franz.com/simple#person22> <http://www.franz.com/simple#last-name> "Kennedy" .
<http://www.franz.com/simple#person22> <http://www.franz.com/simple#suffix> "Jr" .
<http://www.franz.com/simple#person22> <http://www.franz.com/simple#alma-mater> <http://www.franz.com/simple#Brown> .
<http://www.franz.com/simple#person22> <http://www.franz.com/simple#alma-mater> <http://www.franz.com/simple#NYU> .
<http://www.franz.com/simple#person22> <http://www.franz.com/simple#birth-year> "1960" .
<http://www.franz.com/simple#person22> <http://www.franz.com/simple#death-year> "1999" .
<http://www.franz.com/simple#person22> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#male> .
<http://www.franz.com/simple#person22> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person23> .
<http://www.franz.com/simple#person22> <http://www.franz.com/simple#profession> <http://www.franz.com/simple#district-attorney> .
<http://www.franz.com/simple#person22> <http://www.franz.com/simple#profession> <http://www.franz.com/simple#publisher> .
<http://www.franz.com/simple#person23> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person23> <http://www.franz.com/simple#first-name> "Carolyn" .
<http://www.franz.com/simple#person23> <http://www.franz.com/simple#middle-initial> "nil" .
<http://www.franz.com/simple#person23> <http://www.franz.com/simple#last-name> "Bessette" .
<http://www.franz.com/simple#person23> <http://www.franz.com/simple#suffix> "none" .
<http://www.franz.com/simple#person23> <http://www.franz.com/simple#alma-mater> <http://www.franz.com/simple#Boston-University> .
<http://www.franz.com/simple#person23> <http://www.franz.com/simple#birth-year> "1966" .
<http://www.franz.com/simple#person23> <http://www.franz.com/simple#death-year> "1999" .
<http://www.franz.com/simple#person23> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#female> .
<http://www.franz.com/simple#person23> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person22> .
<http://www.franz.com/simple#person23> <http://www.franz.com/simple#profession> <http://www.franz.com/simple#model> .
<http://www.franz.com/simple#person23> <http://www.franz.com/simple#profession> <http://www.franz.com/simple#PR> .
<http://www.franz.com/simple#person24> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person24> <http://www.franz.com/simple#first-name> "Patrick" .
<http://www.franz.com/simple#person24> <http://www.franz.com/simple#middle-initial> "Bouvier" .
<http://www.franz.com/simple#person24> <http://www.franz.com/simple#last-name> "Kennedy" .
<http://www.franz.com/simple#person24> <http://www.franz.com/simple#suffix> "none" .
<http://www.franz.com/simple#person24> <http://www.franz.com/simple#birth-year> "1963" .
<http://www.franz.com/simple#person24> <http://www.franz.com/simple#death-year> "1963" .
<http://www.franz.com/simple#person24> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#male> .
<http://www.franz.com/simple#person25> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person25> <http://www.franz.com/simple#first-name> "Robert" .
<http://www.franz.com/simple#person25> <http://www.franz.com/simple#middle-initial> "S" .
<http://www.franz.com/simple#person25> <http://www.franz.com/simple#last-name> "Shriver" .
<http://www.franz.com/simple#person25> <http://www.franz.com/simple#suffix> "III" .
<http://www.franz.com/simple#person25> <http://www.franz.com/simple#alma-mater> <http://www.franz.com/simple#Yale> .
<http://www.franz.com/simple#person25> <http://www.franz.com/simple#birth-year> "1954" .
<http://www.franz.com/simple#person25> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#male> .
<http://www.franz.com/simple#person25> <http://www.franz.com/simple#profession> <http://www.franz.com/simple#attorney> .
<http://www.franz.com/simple#person25> <http://www.franz.com/simple#profession> <http://www.franz.com/simple#producer> .
<http://www.franz.com/simple#person25> <http://www.franz.com/simple#profession> <http://www.franz.com/simple#goverment> .
<http://www.franz.com/simple#person26> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person26> <http://www.franz.com/simple#first-name> "Maria" .
<http://www.franz.com/simple#person26> <http://www.franz.com/simple#middle-initial> "Owings" .
<http://www.franz.com/simple#person26> <http://www.franz.com/simple#last-name> "Shriver" .
<http://www.franz.com/simple#person26> <http://www.franz.com/simple#suffix> "none" .
<http://www.franz.com/simple#person26> <http://www.franz.com/simple#alma-mater> <http://www.franz.com/simple#Georgetown-University> .
<http://www.franz.com/simple#person26> <http://www.franz.com/simple#birth-year> "1955" .
<http://www.franz.com/simple#person26> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#female> .
<http://www.franz.com/simple#person26> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person27> .
<http://www.franz.com/simple#person26> <http://www.franz.com/simple#profession> <http://www.franz.com/simple#reporter> .
<http://www.franz.com/simple#person27> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person27> <http://www.franz.com/simple#first-name> "Arnold" .
<http://www.franz.com/simple#person27> <http://www.franz.com/simple#middle-initial> "Alois" .
<http://www.franz.com/simple#person27> <http://www.franz.com/simple#last-name> "Schwarzenegger" .
<http://www.franz.com/simple#person27> <http://www.franz.com/simple#suffix> "none" .
<http://www.franz.com/simple#person27> <http://www.franz.com/simple#alma-mater> <http://www.franz.com/simple#University-of-Wisconsin> .
<http://www.franz.com/simple#person27> <http://www.franz.com/simple#birth-year> "1947" .
<http://www.franz.com/simple#person27> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#male> .
<http://www.franz.com/simple#person27> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person26> .
<http://www.franz.com/simple#person27> <http://www.franz.com/simple#profession> <http://www.franz.com/simple#body-builder> .
<http://www.franz.com/simple#person27> <http://www.franz.com/simple#profession> <http://www.franz.com/simple#actor> .
<http://www.franz.com/simple#person27> <http://www.franz.com/simple#profession> <http://www.franz.com/simple#governor> .
<http://www.franz.com/simple#person28> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person28> <http://www.franz.com/simple#first-name> "Timothy" .
<http://www.franz.com/simple#person28> <http://www.franz.com/simple#middle-initial> "Perry" .
<http://www.franz.com/simple#person28> <http://www.franz.com/simple#last-name> "Shriver" .
<http://www.franz.com/simple#person28> <http://www.franz.com/simple#suffix> "none" .
<http://www.franz.com/simple#person28> <http://www.franz.com/simple#alma-mater> <http://www.franz.com/simple#Yale> .
<http://www.franz.com/simple#person28> <http://www.franz.com/simple#alma-mater> <http://www.franz.com/simple#Catholic-University> .
<http://www.franz.com/simple#person28> <http://www.franz.com/simple#alma-mater> <http://www.franz.com/simple#University-of-Connecticut> .
<http://www.franz.com/simple#person28> <http://www.franz.com/simple#birth-year> "1959" .
<http://www.franz.com/simple#person28> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#male> .
<http://www.franz.com/simple#person28> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person30> .
<http://www.franz.com/simple#person28> <http://www.franz.com/simple#profession> <http://www.franz.com/simple#teacher> .
<http://www.franz.com/simple#person28> <http://www.franz.com/simple#profession> <http://www.franz.com/simple#non-profit> .
<http://www.franz.com/simple#person30> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person30> <http://www.franz.com/simple#first-name> "Linda" .
<http://www.franz.com/simple#person30> <http://www.franz.com/simple#middle-initial> "Sophia" .
<http://www.franz.com/simple#person30> <http://www.franz.com/simple#last-name> "Potter" .
<http://www.franz.com/simple#person30> <http://www.franz.com/simple#suffix> "none" .
<http://www.franz.com/simple#person30> <http://www.franz.com/simple#birth-year> "1956" .
<http://www.franz.com/simple#person30> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#female> .
<http://www.franz.com/simple#person30> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person28> .
<http://www.franz.com/simple#person31> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person31> <http://www.franz.com/simple#first-name> "Mark" .
<http://www.franz.com/simple#person31> <http://www.franz.com/simple#middle-initial> "Kennedy" .
<http://www.franz.com/simple#person31> <http://www.franz.com/simple#last-name> "Shriver" .
<http://www.franz.com/simple#person31> <http://www.franz.com/simple#suffix> "none" .
<http://www.franz.com/simple#person31> <http://www.franz.com/simple#birth-year> "1964" .
<http://www.franz.com/simple#person31> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#male> .
<http://www.franz.com/simple#person31> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person32> .
<http://www.franz.com/simple#person32> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person32> <http://www.franz.com/simple#first-name> "Jeannie" .
<http://www.franz.com/simple#person32> <http://www.franz.com/simple#middle-initial> "nil" .
<http://www.franz.com/simple#person32> <http://www.franz.com/simple#last-name> "Ripp" .
<http://www.franz.com/simple#person32> <http://www.franz.com/simple#suffix> "none" .
<http://www.franz.com/simple#person32> <http://www.franz.com/simple#birth-year> "1965" .
<http://www.franz.com/simple#person32> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#female> .
<http://www.franz.com/simple#person32> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person31> .
<http://www.franz.com/simple#person33> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person33> <http://www.franz.com/simple#first-name> "Anthony" .
<http://www.franz.com/simple#person33> <http://www.franz.com/simple#middle-initial> "Kennedy" .
<http://www.franz.com/simple#person33> <http://www.franz.com/simple#last-name> "Shriver" .
<http://www.franz.com/simple#person33> <http://www.franz.com/simple#suffix> "none" .
<http://www.franz.com/simple#person33> <http://www.franz.com/simple#birth-year> "1965" .
<http://www.franz.com/simple#person33> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#male> .
<http://www.franz.com/simple#person33> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person34> .
<http://www.franz.com/simple#person34> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person34> <http://www.franz.com/simple#first-name> "Alina" .
<http://www.franz.com/simple#person34> <http://www.franz.com/simple#middle-initial> "nil" .
<http://www.franz.com/simple#person34> <http://www.franz.com/simple#last-name> "Mojica" .
<http://www.franz.com/simple#person34> <http://www.franz.com/simple#suffix> "none" .
<http://www.franz.com/simple#person34> <http://www.franz.com/simple#birth-year> "1965" .
<http://www.franz.com/simple#person34> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#female> .
<http://www.franz.com/simple#person34> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person33> .
<http://www.franz.com/simple#person35> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person35> <http://www.franz.com/simple#first-name> "Christopher" .
<http://www.franz.com/simple#person35> <http://www.franz.com/simple#middle-initial> "Kennedy" .
<http://www.franz.com/simple#person35> <http://www.franz.com/simple#last-name> "Lawford" .
<http://www.franz.com/simple#person35> <http://www.franz.com/simple#suffix> "none" .
<http://www.franz.com/simple#person35> <http://www.franz.com/simple#birth-year> "1955" .
<http://www.franz.com/simple#person35> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#male> .
<http://www.franz.com/simple#person35> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person36> .
<http://www.franz.com/simple#person35> <http://www.franz.com/simple#profession> <http://www.franz.com/simple#actor> .
<http://www.franz.com/simple#person36> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person36> <http://www.franz.com/simple#first-name> "Jean" .
<http://www.franz.com/simple#person36> <http://www.franz.com/simple#middle-initial> "nil" .
<http://www.franz.com/simple#person36> <http://www.franz.com/simple#last-name> "Olsson" .
<http://www.franz.com/simple#person36> <http://www.franz.com/simple#suffix> "none" .
<http://www.franz.com/simple#person36> <http://www.franz.com/simple#birth-year> "1955" .
<http://www.franz.com/simple#person36> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#female> .
<http://www.franz.com/simple#person36> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person35> .
<http://www.franz.com/simple#person37> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person37> <http://www.franz.com/simple#first-name> "Sydney" .
<http://www.franz.com/simple#person37> <http://www.franz.com/simple#middle-initial> "Maleia" .
<http://www.franz.com/simple#person37> <http://www.franz.com/simple#last-name> "Lawford" .
<http://www.franz.com/simple#person37> <http://www.franz.com/simple#suffix> "none" .
<http://www.franz.com/simple#person37> <http://www.franz.com/simple#birth-year> "1956" .
<http://www.franz.com/simple#person37> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#female> .
<http://www.franz.com/simple#person37> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person38> .
<http://www.franz.com/simple#person38> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person38> <http://www.franz.com/simple#first-name> "James" .
<http://www.franz.com/simple#person38> <http://www.franz.com/simple#middle-initial> "Peter" .
<http://www.franz.com/simple#person38> <http://www.franz.com/simple#last-name> "McKelvy" .
<http://www.franz.com/simple#person38> <http://www.franz.com/simple#suffix> "none" .
<http://www.franz.com/simple#person38> <http://www.franz.com/simple#birth-year> "1955" .
<http://www.franz.com/simple#person38> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#male> .
<http://www.franz.com/simple#person38> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person37> .
<http://www.franz.com/simple#person39> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person39> <http://www.franz.com/simple#first-name> "Victoria" .
<http://www.franz.com/simple#person39> <http://www.franz.com/simple#middle-initial> "nil" .
<http://www.franz.com/simple#person39> <http://www.franz.com/simple#last-name> "Lawford" .
<http://www.franz.com/simple#person39> <http://www.franz.com/simple#suffix> "none" .
<http://www.franz.com/simple#person39> <http://www.franz.com/simple#birth-year> "1958" .
<http://www.franz.com/simple#person39> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#female> .
<http://www.franz.com/simple#person39> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person40> .
<http://www.franz.com/simple#person40> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person40> <http://www.franz.com/simple#first-name> "Robert" .
<http://www.franz.com/simple#person40> <http://www.franz.com/simple#middle-initial> "B" .
<http://www.franz.com/simple#person40> <http://www.franz.com/simple#last-name> "Pender" .
<http://www.franz.com/simple#person40> <http://www.franz.com/simple#suffix> "Jr" .
<http://www.franz.com/simple#person40> <http://www.franz.com/simple#birth-year> "1953" .
<http://www.franz.com/simple#person40> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#male> .
<http://www.franz.com/simple#person40> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person39> .
<http://www.franz.com/simple#person41> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person41> <http://www.franz.com/simple#first-name> "Robin" .
<http://www.franz.com/simple#person41> <http://www.franz.com/simple#middle-initial> "Elizabeth" .
<http://www.franz.com/simple#person41> <http://www.franz.com/simple#last-name> "Lawford" .
<http://www.franz.com/simple#person41> <http://www.franz.com/simple#suffix> "none" .
<http://www.franz.com/simple#person41> <http://www.franz.com/simple#birth-year> "1961" .
<http://www.franz.com/simple#person41> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#female> .
<http://www.franz.com/simple#person42> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person42> <http://www.franz.com/simple#first-name> "Kathleen" .
<http://www.franz.com/simple#person42> <http://www.franz.com/simple#middle-initial> "Hartington" .
<http://www.franz.com/simple#person42> <http://www.franz.com/simple#last-name> "Kennedy" .
<http://www.franz.com/simple#person42> <http://www.franz.com/simple#suffix> "none" .
<http://www.franz.com/simple#person42> <http://www.franz.com/simple#alma-mater> <http://www.franz.com/simple#Harvard> .
<http://www.franz.com/simple#person42> <http://www.franz.com/simple#alma-mater> <http://www.franz.com/simple#University-of-New-Maxico> .
<http://www.franz.com/simple#person42> <http://www.franz.com/simple#birth-year> "1951" .
<http://www.franz.com/simple#person42> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#female> .
<http://www.franz.com/simple#person42> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person43> .
<http://www.franz.com/simple#person42> <http://www.franz.com/simple#profession> <http://www.franz.com/simple#attorney> .
<http://www.franz.com/simple#person42> <http://www.franz.com/simple#profession> <http://www.franz.com/simple#Lt-governor> .
<http://www.franz.com/simple#person43> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person43> <http://www.franz.com/simple#first-name> "David" .
<http://www.franz.com/simple#person43> <http://www.franz.com/simple#middle-initial> "Lee" .
<http://www.franz.com/simple#person43> <http://www.franz.com/simple#last-name> "Townsend" .
<http://www.franz.com/simple#person43> <http://www.franz.com/simple#suffix> "none" .
<http://www.franz.com/simple#person43> <http://www.franz.com/simple#birth-year> "1947" .
<http://www.franz.com/simple#person43> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#male> .
<http://www.franz.com/simple#person43> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person42> .
<http://www.franz.com/simple#person44> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person44> <http://www.franz.com/simple#first-name> "Joseph" .
<http://www.franz.com/simple#person44> <http://www.franz.com/simple#middle-initial> "P" .
<http://www.franz.com/simple#person44> <http://www.franz.com/simple#last-name> "Kennedy" .
<http://www.franz.com/simple#person44> <http://www.franz.com/simple#suffix> "II" .
<http://www.franz.com/simple#person44> <http://www.franz.com/simple#birth-year> "1952" .
<http://www.franz.com/simple#person44> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#male> .
<http://www.franz.com/simple#person44> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person45> .
<http://www.franz.com/simple#person44> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person46> .
<http://www.franz.com/simple#person44> <http://www.franz.com/simple#profession> <http://www.franz.com/simple#congressman> .
<http://www.franz.com/simple#person45> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person45> <http://www.franz.com/simple#first-name> "Sheila" .
<http://www.franz.com/simple#person45> <http://www.franz.com/simple#middle-initial> "Brewster" .
<http://www.franz.com/simple#person45> <http://www.franz.com/simple#last-name> "Rauch" .
<http://www.franz.com/simple#person45> <http://www.franz.com/simple#suffix> "none" .
<http://www.franz.com/simple#person45> <http://www.franz.com/simple#birth-year> "1949" .
<http://www.franz.com/simple#person45> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#female> .
<http://www.franz.com/simple#person45> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person44> .
<http://www.franz.com/simple#person46> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person46> <http://www.franz.com/simple#first-name> "Anne" .
<http://www.franz.com/simple#person46> <http://www.franz.com/simple#middle-initial> "Elizabeth" .
<http://www.franz.com/simple#person46> <http://www.franz.com/simple#last-name> "Kelly" .
<http://www.franz.com/simple#person46> <http://www.franz.com/simple#suffix> "none" .
<http://www.franz.com/simple#person46> <http://www.franz.com/simple#birth-year> "1957" .
<http://www.franz.com/simple#person46> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#female> .
<http://www.franz.com/simple#person46> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person44> .
<http://www.franz.com/simple#person47> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person47> <http://www.franz.com/simple#first-name> "Robert" .
<http://www.franz.com/simple#person47> <http://www.franz.com/simple#middle-initial> "F" .
<http://www.franz.com/simple#person47> <http://www.franz.com/simple#last-name> "Kennedy" .
<http://www.franz.com/simple#person47> <http://www.franz.com/simple#suffix> "Jr" .
<http://www.franz.com/simple#person47> <http://www.franz.com/simple#alma-mater> <http://www.franz.com/simple#Harvard> .
<http://www.franz.com/simple#person47> <http://www.franz.com/simple#alma-mater> <http://www.franz.com/simple#Univeristy-of-Virginia> .
<http://www.franz.com/simple#person47> <http://www.franz.com/simple#birth-year> "1954" .
<http://www.franz.com/simple#person47> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#male> .
<http://www.franz.com/simple#person47> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person48> .
<http://www.franz.com/simple#person47> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person49> .
<http://www.franz.com/simple#person47> <http://www.franz.com/simple#profession> <http://www.franz.com/simple#attorney> .
<http://www.franz.com/simple#person47> <http://www.franz.com/simple#profession> <http://www.franz.com/simple#professor> .
<http://www.franz.com/simple#person47> <http://www.franz.com/simple#profession> <http://www.franz.com/simple#broadcaster> .
<http://www.franz.com/simple#person48> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person48> <http://www.franz.com/simple#first-name> "Emily" .
<http://www.franz.com/simple#person48> <http://www.franz.com/simple#middle-initial> "Ruth" .
<http://www.franz.com/simple#person48> <http://www.franz.com/simple#last-name> "Black" .
<http://www.franz.com/simple#person48> <http://www.franz.com/simple#suffix> "none" .
<http://www.franz.com/simple#person48> <http://www.franz.com/simple#birth-year> "1957" .
<http://www.franz.com/simple#person48> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#female> .
<http://www.franz.com/simple#person48> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person47> .
<http://www.franz.com/simple#person49> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person49> <http://www.franz.com/simple#first-name> "Mary" .
<http://www.franz.com/simple#person49> <http://www.franz.com/simple#middle-initial> "nil" .
<http://www.franz.com/simple#person49> <http://www.franz.com/simple#last-name> "Richardson" .
<http://www.franz.com/simple#person49> <http://www.franz.com/simple#suffix> "none" .
<http://www.franz.com/simple#person49> <http://www.franz.com/simple#birth-year> "1960" .
<http://www.franz.com/simple#person49> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#female> .
<http://www.franz.com/simple#person49> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person47> .
<http://www.franz.com/simple#person50> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person50> <http://www.franz.com/simple#first-name> "David" .
<http://www.franz.com/simple#person50> <http://www.franz.com/simple#middle-initial> "Anthony" .
<http://www.franz.com/simple#person50> <http://www.franz.com/simple#last-name> "Kennedy" .
<http://www.franz.com/simple#person50> <http://www.franz.com/simple#suffix> "none" .
<http://www.franz.com/simple#person50> <http://www.franz.com/simple#birth-year> "1955" .
<http://www.franz.com/simple#person50> <http://www.franz.com/simple#death-year> "1984" .
<http://www.franz.com/simple#person50> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#male> .
<http://www.franz.com/simple#person50> <http://www.franz.com/simple#profession> <http://www.franz.com/simple#writer> .
<http://www.franz.com/simple#person51> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person51> <http://www.franz.com/simple#first-name> "Mary" .
<http://www.franz.com/simple#person51> <http://www.franz.com/simple#middle-initial> "Courtney" .
<http://www.franz.com/simple#person51> <http://www.franz.com/simple#last-name> "Kennedy" .
<http://www.franz.com/simple#person51> <http://www.franz.com/simple#suffix> "none" .
<http://www.franz.com/simple#person51> <http://www.franz.com/simple#birth-year> "1956" .
<http://www.franz.com/simple#person51> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#female> .
<http://www.franz.com/simple#person51> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person52> .
<http://www.franz.com/simple#person51> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person53> .
<http://www.franz.com/simple#person52> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person52> <http://www.franz.com/simple#first-name> "Jeffrey" .
<http://www.franz.com/simple#person52> <http://www.franz.com/simple#middle-initial> "Robert" .
<http://www.franz.com/simple#person52> <http://www.franz.com/simple#last-name> "Ruhe" .
<http://www.franz.com/simple#person52> <http://www.franz.com/simple#suffix> "none" .
<http://www.franz.com/simple#person52> <http://www.franz.com/simple#birth-year> "1952" .
<http://www.franz.com/simple#person52> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#male> .
<http://www.franz.com/simple#person52> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person51> .
<http://www.franz.com/simple#person53> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person53> <http://www.franz.com/simple#first-name> "Paul" .
<http://www.franz.com/simple#person53> <http://www.franz.com/simple#middle-initial> "Michael" .
<http://www.franz.com/simple#person53> <http://www.franz.com/simple#last-name> "Hill" .
<http://www.franz.com/simple#person53> <http://www.franz.com/simple#suffix> "none" .
<http://www.franz.com/simple#person53> <http://www.franz.com/simple#birth-year> "1954" .
<http://www.franz.com/simple#person53> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#male> .
<http://www.franz.com/simple#person53> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person51> .
<http://www.franz.com/simple#person54> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person54> <http://www.franz.com/simple#first-name> "Michael" .
<http://www.franz.com/simple#person54> <http://www.franz.com/simple#middle-initial> "LeMoyne" .
<http://www.franz.com/simple#person54> <http://www.franz.com/simple#last-name> "Kennedy" .
<http://www.franz.com/simple#person54> <http://www.franz.com/simple#suffix> "none" .
<http://www.franz.com/simple#person54> <http://www.franz.com/simple#birth-year> "1958" .
<http://www.franz.com/simple#person54> <http://www.franz.com/simple#death-year> "1997" .
<http://www.franz.com/simple#person54> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#male> .
<http://www.franz.com/simple#person54> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person55> .
<http://www.franz.com/simple#person55> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person55> <http://www.franz.com/simple#first-name> "Victoria" .
<http://www.franz.com/simple#person55> <http://www.franz.com/simple#middle-initial> "Denise" .
<http://www.franz.com/simple#person55> <http://www.franz.com/simple#last-name> "Gifford" .
<http://www.franz.com/simple#person55> <http://www.franz.com/simple#suffix> "none" .
<http://www.franz.com/simple#person55> <http://www.franz.com/simple#birth-year> "1957" .
<http://www.franz.com/simple#person55> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#female> .
<http://www.franz.com/simple#person55> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person54> .
<http://www.franz.com/simple#person56> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person56> <http://www.franz.com/simple#first-name> "Mary" .
<http://www.franz.com/simple#person56> <http://www.franz.com/simple#middle-initial> "Kerry" .
<http://www.franz.com/simple#person56> <http://www.franz.com/simple#last-name> "Kennedy" .
<http://www.franz.com/simple#person56> <http://www.franz.com/simple#suffix> "none" .
<http://www.franz.com/simple#person56> <http://www.franz.com/simple#birth-year> "1959" .
<http://www.franz.com/simple#person56> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#female> .
<http://www.franz.com/simple#person56> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person57> .
<http://www.franz.com/simple#person56> <http://www.franz.com/simple#profession> <http://www.franz.com/simple#non-profit> .
<http://www.franz.com/simple#person57> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person57> <http://www.franz.com/simple#first-name> "Andrew" .
<http://www.franz.com/simple#person57> <http://www.franz.com/simple#middle-initial> "Mark" .
<http://www.franz.com/simple#person57> <http://www.franz.com/simple#last-name> "Cuomo" .
<http://www.franz.com/simple#person57> <http://www.franz.com/simple#suffix> "none" .
<http://www.franz.com/simple#person57> <http://www.franz.com/simple#birth-year> "1957" .
<http://www.franz.com/simple#person57> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#male> .
<http://www.franz.com/simple#person57> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person56> .
<http://www.franz.com/simple#person57> <http://www.franz.com/simple#profession> <http://www.franz.com/simple#cabinet-secretary> .
<http://www.franz.com/simple#person58> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person58> <http://www.franz.com/simple#first-name> "Christopher" .
<http://www.franz.com/simple#person58> <http://www.franz.com/simple#middle-initial> "George" .
<http://www.franz.com/simple#person58> <http://www.franz.com/simple#last-name> "Kennedy" .
<http://www.franz.com/simple#person58> <http://www.franz.com/simple#suffix> "none" .
<http://www.franz.com/simple#person58> <http://www.franz.com/simple#birth-year> "1963" .
<http://www.franz.com/simple#person58> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#male> .
<http://www.franz.com/simple#person58> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person59> .
<http://www.franz.com/simple#person59> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person59> <http://www.franz.com/simple#first-name> "Sheila" .
<http://www.franz.com/simple#person59> <http://www.franz.com/simple#middle-initial> "Sinclair" .
<http://www.franz.com/simple#person59> <http://www.franz.com/simple#last-name> "Berner" .
<http://www.franz.com/simple#person59> <http://www.franz.com/simple#suffix> "none" .
<http://www.franz.com/simple#person59> <http://www.franz.com/simple#birth-year> "1962" .
<http://www.franz.com/simple#person59> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#female> .
<http://www.franz.com/simple#person59> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person58> .
<http://www.franz.com/simple#person60> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person60> <http://www.franz.com/simple#first-name> "Matthew" .
<http://www.franz.com/simple#person60> <http://www.franz.com/simple#middle-initial> "Maxwell" .
<http://www.franz.com/simple#person60> <http://www.franz.com/simple#last-name> "Kennedy" .
<http://www.franz.com/simple#person60> <http://www.franz.com/simple#suffix> "none" .
<http://www.franz.com/simple#person60> <http://www.franz.com/simple#birth-year> "1965" .
<http://www.franz.com/simple#person60> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#male> .
<http://www.franz.com/simple#person60> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person61> .
<http://www.franz.com/simple#person61> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person61> <http://www.franz.com/simple#first-name> "Victoria" .
<http://www.franz.com/simple#person61> <http://www.franz.com/simple#middle-initial> "Anne" .
<http://www.franz.com/simple#person61> <http://www.franz.com/simple#last-name> "Stauss" .
<http://www.franz.com/simple#person61> <http://www.franz.com/simple#suffix> "nill" .
<http://www.franz.com/simple#person61> <http://www.franz.com/simple#birth-year> "1964" .
<http://www.franz.com/simple#person61> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#female> .
<http://www.franz.com/simple#person61> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person60> .
<http://www.franz.com/simple#person62> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person62> <http://www.franz.com/simple#first-name> "Douglas" .
<http://www.franz.com/simple#person62> <http://www.franz.com/simple#middle-initial> "Harriman" .
<http://www.franz.com/simple#person62> <http://www.franz.com/simple#last-name> "Kennedy" .
<http://www.franz.com/simple#person62> <http://www.franz.com/simple#suffix> "none" .
<http://www.franz.com/simple#person62> <http://www.franz.com/simple#alma-mater> <http://www.franz.com/simple#Brown> .
<http://www.franz.com/simple#person62> <http://www.franz.com/simple#birth-year> "1967" .
<http://www.franz.com/simple#person62> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#male> .
<http://www.franz.com/simple#person62> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person63> .
<http://www.franz.com/simple#person62> <http://www.franz.com/simple#profession> <http://www.franz.com/simple#reporter> .
<http://www.franz.com/simple#person63> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person63> <http://www.franz.com/simple#first-name> "Molly" .
<http://www.franz.com/simple#person63> <http://www.franz.com/simple#middle-initial> "Elizabeth" .
<http://www.franz.com/simple#person63> <http://www.franz.com/simple#last-name> "Stark" .
<http://www.franz.com/simple#person63> <http://www.franz.com/simple#suffix> "none" .
<http://www.franz.com/simple#person63> <http://www.franz.com/simple#birth-year> "1968" .
<http://www.franz.com/simple#person63> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#female> .
<http://www.franz.com/simple#person63> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person62> .
<http://www.franz.com/simple#person64> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person64> <http://www.franz.com/simple#first-name> "Rory" .
<http://www.franz.com/simple#person64> <http://www.franz.com/simple#middle-initial> "Elizabeth" .
<http://www.franz.com/simple#person64> <http://www.franz.com/simple#last-name> "Kennedy" .
<http://www.franz.com/simple#person64> <http://www.franz.com/simple#suffix> "none" .
<http://www.franz.com/simple#person64> <http://www.franz.com/simple#alma-mater> <http://www.franz.com/simple#Brown> .
<http://www.franz.com/simple#person64> <http://www.franz.com/simple#birth-year> "1968" .
<http://www.franz.com/simple#person64> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#female> .
<http://www.franz.com/simple#person64> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person65> .
<http://www.franz.com/simple#person64> <http://www.franz.com/simple#profession> <http://www.franz.com/simple#producer> .
<http://www.franz.com/simple#person65> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person65> <http://www.franz.com/simple#first-name> "Mark" .
<http://www.franz.com/simple#person65> <http://www.franz.com/simple#middle-initial> "nil" .
<http://www.franz.com/simple#person65> <http://www.franz.com/simple#last-name> "Bailey" .
<http://www.franz.com/simple#person65> <http://www.franz.com/simple#suffix> "none" .
<http://www.franz.com/simple#person65> <http://www.franz.com/simple#birth-year> "1967" .
<http://www.franz.com/simple#person65> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#male> .
<http://www.franz.com/simple#person65> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person64> .
<http://www.franz.com/simple#person66> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person66> <http://www.franz.com/simple#first-name> "Stephen" .
<http://www.franz.com/simple#person66> <http://www.franz.com/simple#middle-initial> "E" .
<http://www.franz.com/simple#person66> <http://www.franz.com/simple#last-name> "Smith" .
<http://www.franz.com/simple#person66> <http://www.franz.com/simple#suffix> "Jr" .
<http://www.franz.com/simple#person66> <http://www.franz.com/simple#birth-year> "1957" .
<http://www.franz.com/simple#person66> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#male> .
<http://www.franz.com/simple#person67> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person67> <http://www.franz.com/simple#first-name> "William" .
<http://www.franz.com/simple#person67> <http://www.franz.com/simple#middle-initial> "Kennedy" .
<http://www.franz.com/simple#person67> <http://www.franz.com/simple#last-name> "Smith" .
<http://www.franz.com/simple#person67> <http://www.franz.com/simple#suffix> "none" .
<http://www.franz.com/simple#person67> <http://www.franz.com/simple#birth-year> "1960" .
<http://www.franz.com/simple#person67> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#male> .
<http://www.franz.com/simple#person67> <http://www.franz.com/simple#profession> <http://www.franz.com/simple#doctor> .
<http://www.franz.com/simple#person68> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person68> <http://www.franz.com/simple#first-name> "Amanda" .
<http://www.franz.com/simple#person68> <http://www.franz.com/simple#middle-initial> "Mary" .
<http://www.franz.com/simple#person68> <http://www.franz.com/simple#last-name> "Smith" .
<http://www.franz.com/simple#person68> <http://www.franz.com/simple#suffix> "none" .
<http://www.franz.com/simple#person68> <http://www.franz.com/simple#birth-year> "1967" .
<http://www.franz.com/simple#person68> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#female> .
<http://www.franz.com/simple#person68> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person69> .
<http://www.franz.com/simple#person69> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person69> <http://www.franz.com/simple#first-name> "Cart" .
<http://www.franz.com/simple#person69> <http://www.franz.com/simple#middle-initial> "Harmon" .
<http://www.franz.com/simple#person69> <http://www.franz.com/simple#last-name> "Hood" .
<http://www.franz.com/simple#person69> <http://www.franz.com/simple#suffix> "none" .
<http://www.franz.com/simple#person69> <http://www.franz.com/simple#birth-year> "1966" .
<http://www.franz.com/simple#person69> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#male> .
<http://www.franz.com/simple#person69> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person68> .
<http://www.franz.com/simple#person70> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person70> <http://www.franz.com/simple#first-name> "Kym" .
<http://www.franz.com/simple#person70> <http://www.franz.com/simple#middle-initial> "Maria" .
<http://www.franz.com/simple#person70> <http://www.franz.com/simple#last-name> "Smith" .
<http://www.franz.com/simple#person70> <http://www.franz.com/simple#suffix> "none" .
<http://www.franz.com/simple#person70> <http://www.franz.com/simple#birth-year> "1972" .
<http://www.franz.com/simple#person70> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#female> .
<http://www.franz.com/simple#person70> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person71> .
<http://www.franz.com/simple#person71> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person71> <http://www.franz.com/simple#first-name> "Alfred" .
<http://www.franz.com/simple#person71> <http://www.franz.com/simple#middle-initial> "nil" .
<http://www.franz.com/simple#person71> <http://www.franz.com/simple#last-name> "Tucker" .
<http://www.franz.com/simple#person71> <http://www.franz.com/simple#suffix> "none" .
<http://www.franz.com/simple#person71> <http://www.franz.com/simple#birth-year> "1967" .
<http://www.franz.com/simple#person71> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#male> .
<http://www.franz.com/simple#person71> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person70> .
<http://www.franz.com/simple#person72> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person72> <http://www.franz.com/simple#first-name> "Kara" .
<http://www.franz.com/simple#person72> <http://www.franz.com/simple#middle-initial> "Anne" .
<http://www.franz.com/simple#person72> <http://www.franz.com/simple#last-name> "Kennedy" .
<http://www.franz.com/simple#person72> <http://www.franz.com/simple#suffix> "none" .
<http://www.franz.com/simple#person72> <http://www.franz.com/simple#birth-year> "1960" .
<http://www.franz.com/simple#person72> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#female> .
<http://www.franz.com/simple#person72> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person73> .
<http://www.franz.com/simple#person73> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person73> <http://www.franz.com/simple#first-name> "Michael" .
<http://www.franz.com/simple#person73> <http://www.franz.com/simple#middle-initial> "nil" .
<http://www.franz.com/simple#person73> <http://www.franz.com/simple#last-name> "Allen" .
<http://www.franz.com/simple#person73> <http://www.franz.com/simple#suffix> "none" .
<http://www.franz.com/simple#person73> <http://www.franz.com/simple#birth-year> "1958" .
<http://www.franz.com/simple#person73> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#male> .
<http://www.franz.com/simple#person73> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person72> .
<http://www.franz.com/simple#person74> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person74> <http://www.franz.com/simple#first-name> "Edward" .
<http://www.franz.com/simple#person74> <http://www.franz.com/simple#middle-initial> "M" .
<http://www.franz.com/simple#person74> <http://www.franz.com/simple#last-name> "Kennedy" .
<http://www.franz.com/simple#person74> <http://www.franz.com/simple#suffix> "Jr" .
<http://www.franz.com/simple#person74> <http://www.franz.com/simple#alma-mater> <http://www.franz.com/simple#Wesleyan-University> .
<http://www.franz.com/simple#person74> <http://www.franz.com/simple#alma-mater> <http://www.franz.com/simple#Yale> .
<http://www.franz.com/simple#person74> <http://www.franz.com/simple#alma-mater> <http://www.franz.com/simple#University-of-Connecticut> .
<http://www.franz.com/simple#person74> <http://www.franz.com/simple#birth-year> "1961" .
<http://www.franz.com/simple#person74> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#male> .
<http://www.franz.com/simple#person74> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person75> .
<http://www.franz.com/simple#person74> <http://www.franz.com/simple#profession> <http://www.franz.com/simple#attorney> .
<http://www.franz.com/simple#person74> <http://www.franz.com/simple#profession> <http://www.franz.com/simple#business> .
<http://www.franz.com/simple#person75> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person75> <http://www.franz.com/simple#first-name> "Katherine" .
<http://www.franz.com/simple#person75> <http://www.franz.com/simple#middle-initial> "Anne" .
<http://www.franz.com/simple#person75> <http://www.franz.com/simple#last-name> "Gershman" .
<http://www.franz.com/simple#person75> <http://www.franz.com/simple#suffix> "none" .
<http://www.franz.com/simple#person75> <http://www.franz.com/simple#birth-year> "1959" .
<http://www.franz.com/simple#person75> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#female> .
<http://www.franz.com/simple#person75> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person74> .
<http://www.franz.com/simple#person75> <http://www.franz.com/simple#profession> <http://www.franz.com/simple#professor> .
<http://www.franz.com/simple#person76> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> .
<http://www.franz.com/simple#person76> <http://www.franz.com/simple#first-name> "Patrick" .
<http://www.franz.com/simple#person76> <http://www.franz.com/simple#middle-initial> "Joseph" .
<http://www.franz.com/simple#person76> <http://www.franz.com/simple#last-name> "Kennedy" .
<http://www.franz.com/simple#person76> <http://www.franz.com/simple#suffix> "none" .
<http://www.franz.com/simple#person76> <http://www.franz.com/simple#birth-year> "1967" .
<http://www.franz.com/simple#person76> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#male> .
<http://www.franz.com/simple#person76> <http://www.franz.com/simple#profession> <http://www.franz.com/simple#congressman> .
<http://www.franz.com/simple#Harvard> <http://www.franz.com/simple#ivy-league> <http://www.franz.com/simple#true> .
<http://www.franz.com/simple#Yale> <http://www.franz.com/simple#ivy-league> <http://www.franz.com/simple#true> .
<http://www.franz.com/simple#Princeton> <http://www.franz.com/simple#ivy-league> <http://www.franz.com/simple#true> .
<http://www.franz.com/simple#Brown> <http://www.franz.com/simple#ivy-league> <http://www.franz.com/simple#true> .
<http://www.franz.com/simple#Columbia> <http://www.franz.com/simple#ivy-league> <http://www.franz.com/simple#true> .
<http://www.franz.com/simple#Manhattanville-College> <http://www.franz.com/simple#ivy-league> <http://www.franz.com/simple#false> .
<http://www.franz.com/simple#NYU> <http://www.franz.com/simple#ivy-league> <http://www.franz.com/simple#false> .
<http://www.franz.com/simple#University-of-Virginia> <http://www.franz.com/simple#ivy-league> <http://www.franz.com/simple#false> .
<http://www.franz.com/simple#University-of-Connecticut> <http://www.franz.com/simple#ivy-league> <http://www.franz.com/simple#false> .
<http://www.franz.com/simple#Boston-University> <http://www.franz.com/simple#ivy-league> <http://www.franz.com/simple#false> .
<http://www.franz.com/simple#Georgetown-University> <http://www.franz.com/simple#ivy-league> <http://www.franz.com/simple#false> .
<http://www.franz.com/simple#George-Washington> <http://www.franz.com/simple#ivy-league> <http://www.franz.com/simple#false> .
<http://www.franz.com/simple#Rosemont-College> <http://www.franz.com/simple#ivy-league> <http://www.franz.com/simple#false> .
<http://www.franz.com/simple#Catholic-University> <http://www.franz.com/simple#ivy-league> <http://www.franz.com/simple#false> .
<http://www.franz.com/simple#University-of-Wisconsin> <http://www.franz.com/simple#ivy-league> <http://www.franz.com/simple#false> .
<http://www.franz.com/simple#Sacred-Heart-Convent> <http://www.franz.com/simple#ivy-league> <http://www.franz.com/simple#false> .
<http://www.franz.com/simple#Wesleyan-University> <http://www.franz.com/simple#ivy-league> <http://www.franz.com/simple#false> .
<http://www.franz.com/simple#place1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#Place> .
<http://www.franz.com/simple#place1> <http://www.franz.com/simple#name> "Coulee" .
<http://www.franz.com/simple#place1> <http://www.franz.com/simple#state> "North Dakota" .
<http://www.franz.com/simple#place1> <http://www.franz.com/simple#latitude> "48.719925" .
<http://www.franz.com/simple#place1> <http://www.franz.com/simple#longitude> "-102.08301" .
<http://www.franz.com/simple#place2> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#Place> .
<http://www.franz.com/simple#place2> <http://www.franz.com/simple#name> "Grand Rapids" .
<http://www.franz.com/simple#place2> <http://www.franz.com/simple#state> "Michigan" .
<http://www.franz.com/simple#place2> <http://www.franz.com/simple#latitude> "42.964176" .
<http://www.franz.com/simple#place2> <http://www.franz.com/simple#longitude> "-85.65885" .
<http://www.franz.com/simple#place3> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#Place> .
<http://www.franz.com/simple#place3> <http://www.franz.com/simple#name> "Kennebunkport" .
<http://www.franz.com/simple#place3> <http://www.franz.com/simple#state> "Maine" .
<http://www.franz.com/simple#place3> <http://www.franz.com/simple#latitude> "43.399494" .
<http://www.franz.com/simple#place3> <http://www.franz.com/simple#longitude> "-70.4769" .
<http://www.franz.com/simple#place4> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#Place> .
<http://www.franz.com/simple#place4> <http://www.franz.com/simple#name> "Limerick" .
<http://www.franz.com/simple#place4> <http://www.franz.com/simple#state> "Maine" .
<http://www.franz.com/simple#place4> <http://www.franz.com/simple#latitude> "43.682793" .
<http://www.franz.com/simple#place4> <http://www.franz.com/simple#longitude> "-70.77178" .
<http://www.franz.com/simple#place5> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#Place> .
<http://www.franz.com/simple#place5> <http://www.franz.com/simple#name> "Boston" .
<http://www.franz.com/simple#place5> <http://www.franz.com/simple#state> "Massachusetts" .
<http://www.franz.com/simple#place5> <http://www.franz.com/simple#latitude> "42.357903" .
<http://www.franz.com/simple#place5> <http://www.franz.com/simple#longitude> "-71.06408" .
<http://www.franz.com/simple#place6> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#Place> .
<http://www.franz.com/simple#place6> <http://www.franz.com/simple#name> "Salem" .
<http://www.franz.com/simple#place6> <http://www.franz.com/simple#state> "Massachusetts" .
<http://www.franz.com/simple#place6> <http://www.franz.com/simple#latitude> "42.516846" .
<http://www.franz.com/simple#place6> <http://www.franz.com/simple#longitude> "-70.8985" .
<http://www.franz.com/simple#place7> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#Place> .
<http://www.franz.com/simple#place7> <http://www.franz.com/simple#name> "Dover" .
<http://www.franz.com/simple#place7> <http://www.franz.com/simple#state> "Massachusetts" .
<http://www.franz.com/simple#place7> <http://www.franz.com/simple#latitude> "42.23888" .
<http://www.franz.com/simple#place7> <http://www.franz.com/simple#longitude> "-71.28241" .
<http://www.franz.com/simple#place8> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#Place> .
<http://www.franz.com/simple#place8> <http://www.franz.com/simple#name> "Cambridge" .
<http://www.franz.com/simple#place8> <http://www.franz.com/simple#state> "Massachusetts" .
<http://www.franz.com/simple#place8> <http://www.franz.com/simple#latitude> "42.362297" .
<http://www.franz.com/simple#place8> <http://www.franz.com/simple#longitude> "-71.08412" .
<http://www.franz.com/simple#place9> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#Place> .
<http://www.franz.com/simple#place9> <http://www.franz.com/simple#name> "Somerville" .
<http://www.franz.com/simple#place9> <http://www.franz.com/simple#state> "Massachusetts" .
<http://www.franz.com/simple#place9> <http://www.franz.com/simple#latitude> "42.381927" .
<http://www.franz.com/simple#place9> <http://www.franz.com/simple#longitude> "-71.09908" .
<http://www.franz.com/simple#place10> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#Place> .
<http://www.franz.com/simple#place10> <http://www.franz.com/simple#name> "Quincy" .
<http://www.franz.com/simple#place10> <http://www.franz.com/simple#state> "Massachusetts" .
<http://www.franz.com/simple#place10> <http://www.franz.com/simple#latitude> "42.25074" .
<http://www.franz.com/simple#place10> <http://www.franz.com/simple#longitude> "-70.99593" .
<http://www.franz.com/simple#place11> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#Place> .
<http://www.franz.com/simple#place11> <http://www.franz.com/simple#name> "Melrose" .
<http://www.franz.com/simple#place11> <http://www.franz.com/simple#state> "Massachusetts" .
<http://www.franz.com/simple#place11> <http://www.franz.com/simple#latitude> "42.459045" .
<http://www.franz.com/simple#place11> <http://www.franz.com/simple#longitude> "-71.06233" .
<http://www.franz.com/simple#place12> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#Place> .
<http://www.franz.com/simple#place12> <http://www.franz.com/simple#name> "Weymouth" .
<http://www.franz.com/simple#place12> <http://www.franz.com/simple#state> "Massachusetts" .
<http://www.franz.com/simple#place12> <http://www.franz.com/simple#latitude> "42.212868" .
<http://www.franz.com/simple#place12> <http://www.franz.com/simple#longitude> "-70.95872" .
<http://www.franz.com/simple#place13> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#Place> .
<http://www.franz.com/simple#place13> <http://www.franz.com/simple#name> "Louisville" .
<http://www.franz.com/simple#place13> <http://www.franz.com/simple#state> "Kentucky" .
<http://www.franz.com/simple#place13> <http://www.franz.com/simple#latitude> "38.270855" .
<http://www.franz.com/simple#place13> <http://www.franz.com/simple#longitude> "-85.48322" .
<http://www.franz.com/simple#place14> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#Place> .
<http://www.franz.com/simple#place14> <http://www.franz.com/simple#name> "Berkeley" .
<http://www.franz.com/simple#place14> <http://www.franz.com/simple#state> "California" .
<http://www.franz.com/simple#place14> <http://www.franz.com/simple#latitude> "37.879623" .
<http://www.franz.com/simple#place14> <http://www.franz.com/simple#longitude> "-122.2668" .
<http://www.franz.com/simple#place15> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#Place> .
<http://www.franz.com/simple#place15> <http://www.franz.com/simple#name> "Oakland" .
<http://www.franz.com/simple#place15> <http://www.franz.com/simple#state> "California" .
<http://www.franz.com/simple#place15> <http://www.franz.com/simple#latitude> "37.75398" .
<http://www.franz.com/simple#place15> <http://www.franz.com/simple#longitude> "-122.18969" .
<http://www.franz.com/simple#place16> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#Place> .
<http://www.franz.com/simple#place16> <http://www.franz.com/simple#name> "Moraga" .
<http://www.franz.com/simple#place16> <http://www.franz.com/simple#state> "California" .
<http://www.franz.com/simple#place16> <http://www.franz.com/simple#latitude> "37.839424" .
<http://www.franz.com/simple#place16> <http://www.franz.com/simple#longitude> "-122.12426" .
<http://www.franz.com/simple#place17> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#Place> .
<http://www.franz.com/simple#place17> <http://www.franz.com/simple#name> "San Francisco" .
<http://www.franz.com/simple#place17> <http://www.franz.com/simple#state> "California" .
<http://www.franz.com/simple#place17> <http://www.franz.com/simple#latitude> "37.72423" .
<http://www.franz.com/simple#place17> <http://www.franz.com/simple#longitude> "-122.47958" .
<http://www.franz.com/simple#place18> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#Place> .
<http://www.franz.com/simple#place18> <http://www.franz.com/simple#name> "Rio Vista" .
<http://www.franz.com/simple#place18> <http://www.franz.com/simple#state> "California" .
<http://www.franz.com/simple#place18> <http://www.franz.com/simple#latitude> "38.15691" .
<http://www.franz.com/simple#place18> <http://www.franz.com/simple#longitude> "-121.72075" .
<http://www.franz.com/simple#place19> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#Place> .
<http://www.franz.com/simple#place19> <http://www.franz.com/simple#name> "Colorado Springs" .
<http://www.franz.com/simple#place19> <http://www.franz.com/simple#state> "Colorado" .
<http://www.franz.com/simple#place19> <http://www.franz.com/simple#latitude> "38.79124" .
<http://www.franz.com/simple#place19> <http://www.franz.com/simple#longitude> "-104.82492" .
<http://www.franz.com/simple#place20> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#Place> .
<http://www.franz.com/simple#place20> <http://www.franz.com/simple#name> "New Britain" .
<http://www.franz.com/simple#place20> <http://www.franz.com/simple#state> "Connecticut" .
<http://www.franz.com/simple#place20> <http://www.franz.com/simple#latitude> "41.6591" .
<http://www.franz.com/simple#place20> <http://www.franz.com/simple#longitude> "-72.80129" .
<http://www.franz.com/simple#place21> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#Place> .
<http://www.franz.com/simple#place21> <http://www.franz.com/simple#name> "Windsor Locks" .
<http://www.franz.com/simple#place21> <http://www.franz.com/simple#state> "Connecticut" .
<http://www.franz.com/simple#place21> <http://www.franz.com/simple#latitude> "41.927" .
<http://www.franz.com/simple#place21> <http://www.franz.com/simple#longitude> "-72.64688" .
<http://www.franz.com/simple#place22> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#Place> .
<http://www.franz.com/simple#place22> <http://www.franz.com/simple#name> "Lebanon" .
<http://www.franz.com/simple#place22> <http://www.franz.com/simple#state> "Connecticut" .
<http://www.franz.com/simple#place22> <http://www.franz.com/simple#latitude> "41.618404" .
<http://www.franz.com/simple#place22> <http://www.franz.com/simple#longitude> "-72.24215" .
<http://www.franz.com/simple#place23> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#Place> .
<http://www.franz.com/simple#place23> <http://www.franz.com/simple#name> "Trumbull" .
<http://www.franz.com/simple#place23> <http://www.franz.com/simple#state> "Connecticut" .
<http://www.franz.com/simple#place23> <http://www.franz.com/simple#latitude> "41.25613" .
<http://www.franz.com/simple#place23> <http://www.franz.com/simple#longitude> "-73.21227" .
<http://www.franz.com/simple#place24> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#Place> .
<http://www.franz.com/simple#place24> <http://www.franz.com/simple#name> "Atlanta" .
<http://www.franz.com/simple#place24> <http://www.franz.com/simple#state> "Georgia" .
<http://www.franz.com/simple#place24> <http://www.franz.com/simple#latitude> "33.750004" .
<http://www.franz.com/simple#place24> <http://www.franz.com/simple#longitude> "-84.31854" .
<http://www.franz.com/simple#place25> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#Place> .
<http://www.franz.com/simple#place25> <http://www.franz.com/simple#name> "Nashville" .
<http://www.franz.com/simple#place25> <http://www.franz.com/simple#state> "Indiana" .
<http://www.franz.com/simple#place25> <http://www.franz.com/simple#latitude> "39.199356" .
<http://www.franz.com/simple#place25> <http://www.franz.com/simple#longitude> "-86.2395" .
<http://www.franz.com/simple#place26> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#Place> .
<http://www.franz.com/simple#place26> <http://www.franz.com/simple#name> "Miami Beach" .
<http://www.franz.com/simple#place26> <http://www.franz.com/simple#state> "Florida" .
<http://www.franz.com/simple#place26> <http://www.franz.com/simple#latitude> "25.759474" .
<http://www.franz.com/simple#place26> <http://www.franz.com/simple#longitude> "-80.13907" .
<http://www.franz.com/simple#place27> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#Place> .
<http://www.franz.com/simple#place27> <http://www.franz.com/simple#name> "Algona" .
<http://www.franz.com/simple#place27> <http://www.franz.com/simple#state> "Iowa" .
<http://www.franz.com/simple#place27> <http://www.franz.com/simple#latitude> "43.0739" .
<http://www.franz.com/simple#place27> <http://www.franz.com/simple#longitude> "-94.22602" .
<http://www.franz.com/simple#place28> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#Place> .
<http://www.franz.com/simple#place28> <http://www.franz.com/simple#name> "Neal" .
<http://www.franz.com/simple#place28> <http://www.franz.com/simple#state> "Kansas" .
<http://www.franz.com/simple#place28> <http://www.franz.com/simple#latitude> "37.83135" .
<http://www.franz.com/simple#place28> <http://www.franz.com/simple#longitude> "-96.07111" .
<http://www.franz.com/simple#place29> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#Place> .
<http://www.franz.com/simple#place29> <http://www.franz.com/simple#name> "Hodge" .
<http://www.franz.com/simple#place29> <http://www.franz.com/simple#state> "Louisiana" .
<http://www.franz.com/simple#place29> <http://www.franz.com/simple#latitude> "32.27214" .
<http://www.franz.com/simple#place29> <http://www.franz.com/simple#longitude> "-92.72489" .
<http://www.franz.com/simple#place30> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#Place> .
<http://www.franz.com/simple#place30> <http://www.franz.com/simple#name> "Bentley" .
<http://www.franz.com/simple#place30> <http://www.franz.com/simple#state> "Michigan" .
<http://www.franz.com/simple#place30> <http://www.franz.com/simple#latitude> "43.93724" .
<http://www.franz.com/simple#place30> <http://www.franz.com/simple#longitude> "-84.12889" .
<http://www.franz.com/simple#place31> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#Place> .
<http://www.franz.com/simple#place31> <http://www.franz.com/simple#name> "Willernie" .
<http://www.franz.com/simple#place31> <http://www.franz.com/simple#state> "Minnesota" .
<http://www.franz.com/simple#place31> <http://www.franz.com/simple#latitude> "45.054665" .
<http://www.franz.com/simple#place31> <http://www.franz.com/simple#longitude> "-92.95703" .
<http://www.franz.com/simple#place32> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#Place> .
<http://www.franz.com/simple#place32> <http://www.franz.com/simple#name> "Lanesboro" .
<http://www.franz.com/simple#place32> <http://www.franz.com/simple#state> "Minnesota" .
<http://www.franz.com/simple#place32> <http://www.franz.com/simple#latitude> "43.70844" .
<http://www.franz.com/simple#place32> <http://www.franz.com/simple#longitude> "-91.95965" .
<http://www.franz.com/simple#place33> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#Place> .
<http://www.franz.com/simple#place33> <http://www.franz.com/simple#name> "Bernie" .
<http://www.franz.com/simple#place33> <http://www.franz.com/simple#state> "Missouri" .
<http://www.franz.com/simple#place33> <http://www.franz.com/simple#latitude> "36.6624" .
<http://www.franz.com/simple#place33> <http://www.franz.com/simple#longitude> "-90.00768" .
<http://www.franz.com/simple#place34> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#Place> .
<http://www.franz.com/simple#place34> <http://www.franz.com/simple#name> "Jamestown" .
<http://www.franz.com/simple#place34> <http://www.franz.com/simple#state> "Missouri" .
<http://www.franz.com/simple#place34> <http://www.franz.com/simple#latitude> "38.77066" .
<http://www.franz.com/simple#place34> <http://www.franz.com/simple#longitude> "-92.48206" .
<http://www.franz.com/simple#place35> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#Place> .
<http://www.franz.com/simple#place35> <http://www.franz.com/simple#name> "Raynesford" .
<http://www.franz.com/simple#place35> <http://www.franz.com/simple#state> "Montana" .
<http://www.franz.com/simple#place35> <http://www.franz.com/simple#latitude> "47.26124" .
<http://www.franz.com/simple#place35> <http://www.franz.com/simple#longitude> "-110.725" .
<http://www.franz.com/simple#place36> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#Place> .
<http://www.franz.com/simple#place36> <http://www.franz.com/simple#name> "Snyder" .
<http://www.franz.com/simple#place36> <http://www.franz.com/simple#state> "Nebraska" .
<http://www.franz.com/simple#place36> <http://www.franz.com/simple#latitude> "41.704483" .
<http://www.franz.com/simple#place36> <http://www.franz.com/simple#longitude> "-96.78794" .
<http://www.franz.com/simple#place37> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#Place> .
<http://www.franz.com/simple#place37> <http://www.franz.com/simple#name> "Silver City" .
<http://www.franz.com/simple#place37> <http://www.franz.com/simple#state> "Nevada" .
<http://www.franz.com/simple#place37> <http://www.franz.com/simple#latitude> "39.262836" .
<http://www.franz.com/simple#place37> <http://www.franz.com/simple#longitude> "-119.64083" .
<http://www.franz.com/simple#place38> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#Place> .
<http://www.franz.com/simple#place38> <http://www.franz.com/simple#name> "Georges Mills" .
<http://www.franz.com/simple#place38> <http://www.franz.com/simple#state> "New Hampshire" .
<http://www.franz.com/simple#place38> <http://www.franz.com/simple#latitude> "43.437504" .
<http://www.franz.com/simple#place38> <http://www.franz.com/simple#longitude> "-72.07185" .
<http://www.franz.com/simple#place39> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#Place> .
<http://www.franz.com/simple#place39> <http://www.franz.com/simple#name> "Charlestown" .
<http://www.franz.com/simple#place39> <http://www.franz.com/simple#state> "New Hampshire" .
<http://www.franz.com/simple#place39> <http://www.franz.com/simple#latitude> "43.24947" .
<http://www.franz.com/simple#place39> <http://www.franz.com/simple#longitude> "-72.39026" .
<http://www.franz.com/simple#place40> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#Place> .
<http://www.franz.com/simple#place40> <http://www.franz.com/simple#name> "Groveton" .
<http://www.franz.com/simple#place40> <http://www.franz.com/simple#state> "New Hampshire" .
<http://www.franz.com/simple#place40> <http://www.franz.com/simple#latitude> "44.610603" .
<http://www.franz.com/simple#place40> <http://www.franz.com/simple#longitude> "-71.48147" .
<http://www.franz.com/simple#place41> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#Place> .
<http://www.franz.com/simple#place41> <http://www.franz.com/simple#name> "Berlin" .
<http://www.franz.com/simple#place41> <http://www.franz.com/simple#state> "New Hampshire" .
<http://www.franz.com/simple#place41> <http://www.franz.com/simple#latitude> "44.463337" .
<http://www.franz.com/simple#place41> <http://www.franz.com/simple#longitude> "-71.19092" .
<http://www.franz.com/simple#place42> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#Place> .
<http://www.franz.com/simple#place42> <http://www.franz.com/simple#name> "Union" .
<http://www.franz.com/simple#place42> <http://www.franz.com/simple#state> "New Jersey" .
<http://www.franz.com/simple#place42> <http://www.franz.com/simple#latitude> "40.6954" .
<http://www.franz.com/simple#place42> <http://www.franz.com/simple#longitude> "-74.26933" .
<http://www.franz.com/simple#place43> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#Place> .
<http://www.franz.com/simple#place43> <http://www.franz.com/simple#name> "New York" .
<http://www.franz.com/simple#place43> <http://www.franz.com/simple#state> "New York" .
<http://www.franz.com/simple#place43> <http://www.franz.com/simple#latitude> "40.82618" .
<http://www.franz.com/simple#place43> <http://www.franz.com/simple#longitude> "-73.9371" .
<http://www.franz.com/simple#place44> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#Place> .
<http://www.franz.com/simple#place44> <http://www.franz.com/simple#name> "Bronx" .
<http://www.franz.com/simple#place44> <http://www.franz.com/simple#state> "New York" .
<http://www.franz.com/simple#place44> <http://www.franz.com/simple#latitude> "40.825726" .
<http://www.franz.com/simple#place44> <http://www.franz.com/simple#longitude> "-73.81752" .
<http://www.franz.com/simple#place45> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#Place> .
<http://www.franz.com/simple#place45> <http://www.franz.com/simple#name> "Brooklyn" .
<http://www.franz.com/simple#place45> <http://www.franz.com/simple#state> "New York" .
<http://www.franz.com/simple#place45> <http://www.franz.com/simple#latitude> "40.68209" .
<http://www.franz.com/simple#place45> <http://www.franz.com/simple#longitude> "-73.97783" .
<http://www.franz.com/simple#place46> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#Place> .
<http://www.franz.com/simple#place46> <http://www.franz.com/simple#name> "Flushing" .
<http://www.franz.com/simple#place46> <http://www.franz.com/simple#state> "New York" .
<http://www.franz.com/simple#place46> <http://www.franz.com/simple#latitude> "40.76052" .
<http://www.franz.com/simple#place46> <http://www.franz.com/simple#longitude> "-73.79612" .
<http://www.franz.com/simple#place47> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#Place> .
<http://www.franz.com/simple#place47> <http://www.franz.com/simple#name> "East Elmhurst" .
<http://www.franz.com/simple#place47> <http://www.franz.com/simple#state> "New York" .
<http://www.franz.com/simple#place47> <http://www.franz.com/simple#latitude> "40.763016" .
<http://www.franz.com/simple#place47> <http://www.franz.com/simple#longitude> "-73.89052" .
<http://www.franz.com/simple#place48> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#Place> .
<http://www.franz.com/simple#place48> <http://www.franz.com/simple#name> "Richville" .
<http://www.franz.com/simple#place48> <http://www.franz.com/simple#state> "New York" .
<http://www.franz.com/simple#place48> <http://www.franz.com/simple#latitude> "44.41476" .
<http://www.franz.com/simple#place48> <http://www.franz.com/simple#longitude> "-75.37897" .
<http://www.franz.com/simple#place49> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#Place> .
<http://www.franz.com/simple#place49> <http://www.franz.com/simple#name> "Oneonta" .
<http://www.franz.com/simple#place49> <http://www.franz.com/simple#state> "New York" .
<http://www.franz.com/simple#place49> <http://www.franz.com/simple#latitude> "42.46976" .
<http://www.franz.com/simple#place49> <http://www.franz.com/simple#longitude> "-75.05192" .
<http://www.franz.com/simple#place50> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#Place> .
<http://www.franz.com/simple#place50> <http://www.franz.com/simple#name> "Bailey" .
<http://www.franz.com/simple#place50> <http://www.franz.com/simple#state> "North Carolina" .
<http://www.franz.com/simple#place50> <http://www.franz.com/simple#latitude> "35.79799" .
<http://www.franz.com/simple#place50> <http://www.franz.com/simple#longitude> "-78.10641" .
<http://www.franz.com/simple#place51> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#Place> .
<http://www.franz.com/simple#place51> <http://www.franz.com/simple#name> "Wien" .
<http://www.franz.com/simple#place51> <http://www.franz.com/simple#state> "Austria" .
<http://www.franz.com/simple#place51> <http://www.franz.com/simple#latitude> "48.2" .
<http://www.franz.com/simple#place51> <http://www.franz.com/simple#longitude> "16.37" .
<http://www.franz.com/simple#person28> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place13> .
<http://www.franz.com/simple#person56> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place14> .
<http://www.franz.com/simple#person1> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place5> .
<http://www.franz.com/simple#person29> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place21> .
<http://www.franz.com/simple#person57> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place5> .
<http://www.franz.com/simple#person2> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place5> .
<http://www.franz.com/simple#person30> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place12> .
<http://www.franz.com/simple#person58> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place20> .
<http://www.franz.com/simple#person3> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place5> .
<http://www.franz.com/simple#person31> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place14> .
<http://www.franz.com/simple#person59> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place11> .
<http://www.franz.com/simple#person4> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place5> .
<http://www.franz.com/simple#person32> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place14> .
<http://www.franz.com/simple#person60> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place4> .
<http://www.franz.com/simple#person5> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place5> .
<http://www.franz.com/simple#person33> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place20> .
<http://www.franz.com/simple#person61> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place12> .
<http://www.franz.com/simple#person6> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place5> .
<http://www.franz.com/simple#person34> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place12> .
<http://www.franz.com/simple#person62> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place11> .
<http://www.franz.com/simple#person7> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place5> .
<http://www.franz.com/simple#person35> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place5> .
<http://www.franz.com/simple#person63> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place43> .
<http://www.franz.com/simple#person8> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place5> .
<http://www.franz.com/simple#person36> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place22> .
<http://www.franz.com/simple#person64> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place21> .
<http://www.franz.com/simple#person9> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place5> .
<http://www.franz.com/simple#person37> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place23> .
<http://www.franz.com/simple#person65> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place24> .
<http://www.franz.com/simple#person10> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place18> .
<http://www.franz.com/simple#person38> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place1> .
<http://www.franz.com/simple#person66> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place10> .
<http://www.franz.com/simple#person11> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place9> .
<http://www.franz.com/simple#person39> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place26> .
<http://www.franz.com/simple#person67> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place14> .
<http://www.franz.com/simple#person12> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place26> .
<http://www.franz.com/simple#person40> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place10> .
<http://www.franz.com/simple#person68> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place4> .
<http://www.franz.com/simple#person13> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place26> .
<http://www.franz.com/simple#person41> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place17> .
<http://www.franz.com/simple#person69> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place22> .
<http://www.franz.com/simple#person14> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place0> .
<http://www.franz.com/simple#person42> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place9> .
<http://www.franz.com/simple#person70> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place16> .
<http://www.franz.com/simple#person15> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place12> .
<http://www.franz.com/simple#person43> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place34> .
<http://www.franz.com/simple#person71> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place25> .
<http://www.franz.com/simple#person16> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place18> .
<http://www.franz.com/simple#person44> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place22> .
<http://www.franz.com/simple#person72> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place0> .
<http://www.franz.com/simple#person17> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place1> .
<http://www.franz.com/simple#person45> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place10> .
<http://www.franz.com/simple#person73> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place3> .
<http://www.franz.com/simple#person18> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place2> .
<http://www.franz.com/simple#person46> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place28> .
<http://www.franz.com/simple#person74> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place20> .
<http://www.franz.com/simple#person19> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place21> .
<http://www.franz.com/simple#person47> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place24> .
<http://www.franz.com/simple#person75> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place29> .
<http://www.franz.com/simple#person20> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place26> .
<http://www.franz.com/simple#person48> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place7> .
<http://www.franz.com/simple#person76> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place13> .
<http://www.franz.com/simple#person21> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place17> .
<http://www.franz.com/simple#person49> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place22> .
<http://www.franz.com/simple#person22> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place13> .
<http://www.franz.com/simple#person50> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place9> .
<http://www.franz.com/simple#person23> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place23> .
<http://www.franz.com/simple#person51> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place22> .
<http://www.franz.com/simple#person24> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place22> .
<http://www.franz.com/simple#person52> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place0> .
<http://www.franz.com/simple#person25> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place28> .
<http://www.franz.com/simple#person53> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place2> .
<http://www.franz.com/simple#person26> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place11> .
<http://www.franz.com/simple#person54> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place20> .
<http://www.franz.com/simple#person27> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place51> .
<http://www.franz.com/simple#person55> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place23> .
| 127,981 | Common Lisp | .l | 1,214 | 104.420923 | 137 | 0.724384 | wvxvw/agraph-client | 0 | 0 | 0 | EPL-1.0 | 9/19/2024, 11:36:20 AM (Europe/Amsterdam) | c2e5bf86546ac20e8ea347d7249579c121d8b703d7b3725b7eb9ad995d50f3ae | 28,729 | [
-1
] |
28,730 | python-lesmis.rdf | wvxvw_agraph-client/tutorial/python-lesmis.rdf | <?xml version='1.0' encoding='ISO-8859-1'?>
<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:dc = "http://purl.org/dc/elements/1.1/"
xmlns:dcterms = "http://purl.org/dc/terms/"
xmlns:char = "http://www.franz.com/lesmis#">
<char:Character rdf:about="http://www.franz.com/lesmis#character0">
<dc:title>Myriel</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character1">
<dc:title>Napoleon</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character2">
<dc:title>MlleBaptistine</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character3">
<dc:title>MmeMagloire</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character4">
<dc:title>CountessDeLo</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character5">
<dc:title>Geborand</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character6">
<dc:title>Champtercier</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character7">
<dc:title>Cravatte</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character8">
<dc:title>Count</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character9">
<dc:title>OldMan</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character10">
<dc:title>Labarre</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character11">
<dc:title>Valjean</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character12">
<dc:title>Marguerite</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character13">
<dc:title>MmeDeR</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character14">
<dc:title>Isabeau</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character15">
<dc:title>Gervais</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character16">
<dc:title>Tholomyes</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character17">
<dc:title>Listolier</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character18">
<dc:title>Fameuil</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character19">
<dc:title>Blacheville</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character20">
<dc:title>Favourite</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character21">
<dc:title>Dahlia</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character22">
<dc:title>Zephine</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character23">
<dc:title>Fantine</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character24">
<dc:title>MmeThenardier</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character25">
<dc:title>Thenardier</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character26">
<dc:title>Cosette</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character27">
<dc:title>Javert</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character28">
<dc:title>Fauchelevent</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character29">
<dc:title>Bamatabois</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character30">
<dc:title>Perpetue</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character31">
<dc:title>Simplice</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character32">
<dc:title>Scaufflaire</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character33">
<dc:title>Woman1</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character34">
<dc:title>Judge</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character35">
<dc:title>Champmathieu</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character36">
<dc:title>Brevet</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character37">
<dc:title>Chenildieu</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character38">
<dc:title>Cochepaille</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character39">
<dc:title>Pontmercy</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character40">
<dc:title>Boulatruelle</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character41">
<dc:title>Eponine</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character42">
<dc:title>Anzelma</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character43">
<dc:title>Woman2</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character44">
<dc:title>MotherInnocent</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character45">
<dc:title>Gribier</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character46">
<dc:title>Jondrette</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character47">
<dc:title>MmeBurgon</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character48">
<dc:title>Gavroche</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character49">
<dc:title>Gillenormand</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character50">
<dc:title>Magnon</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character51">
<dc:title>MlleGillenormand</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character52">
<dc:title>MmePontmercy</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character53">
<dc:title>MlleVaubois</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character54">
<dc:title>LtGillenormand</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character55">
<dc:title>Marius</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character56">
<dc:title>BaronessT</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character57">
<dc:title>Mabeuf</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character58">
<dc:title>Enjolras</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character59">
<dc:title>Combeferre</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character60">
<dc:title>Prouvaire</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character61">
<dc:title>Feuilly</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character62">
<dc:title>Courfeyrac</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character63">
<dc:title>Bahorel</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character64">
<dc:title>Bossuet</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character65">
<dc:title>Joly</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character66">
<dc:title>Grantaire</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character67">
<dc:title>MotherPlutarch</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character68">
<dc:title>Gueulemer</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character69">
<dc:title>Babet</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character70">
<dc:title>Claquesous</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character71">
<dc:title>Montparnasse</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character72">
<dc:title>Toussaint</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character73">
<dc:title>Child1</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character74">
<dc:title>Child2</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character75">
<dc:title>Brujon</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character76">
<dc:title>MmeHucheloup</dc:title>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character1">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character0"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character2">
<char:knows rdf:resource="http://www.franz.com/lesmis#character0"/>
<rdfs:comment>8</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character3">
<char:knows rdf:resource="http://www.franz.com/lesmis#character0"/>
<rdfs:comment>10</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character3">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character2"/>
<rdfs:comment>6</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character4">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character0"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character5">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character0"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character6">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character0"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character7">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character0"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character8">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character0"/>
<rdfs:comment>2</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character9">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character0"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character11">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character10"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character11">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character3"/>
<rdfs:comment>3</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character11">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character2"/>
<rdfs:comment>3</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character11">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character0"/>
<rdfs:comment>5</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character12">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character11"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character13">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character11"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character14">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character11"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character15">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character11"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character17">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character16"/>
<rdfs:comment>4</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character18">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character16"/>
<rdfs:comment>4</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character18">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character17"/>
<rdfs:comment>4</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character19">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character16"/>
<rdfs:comment>4</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character19">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character17"/>
<rdfs:comment>4</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character19">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character18"/>
<rdfs:comment>4</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character20">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character16"/>
<rdfs:comment>3</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character20">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character17"/>
<rdfs:comment>3</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character20">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character18"/>
<rdfs:comment>3</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character20">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character19"/>
<rdfs:comment>4</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character21">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character16"/>
<rdfs:comment>3</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character21">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character17"/>
<rdfs:comment>3</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character21">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character18"/>
<rdfs:comment>3</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character21">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character19"/>
<rdfs:comment>3</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character21">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character20"/>
<rdfs:comment>5</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character22">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character16"/>
<rdfs:comment>3</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character22">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character17"/>
<rdfs:comment>3</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character22">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character18"/>
<rdfs:comment>3</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character22">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character19"/>
<rdfs:comment>3</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character22">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character20"/>
<rdfs:comment>4</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character22">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character21"/>
<rdfs:comment>4</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character23">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character16"/>
<rdfs:comment>3</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character23">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character17"/>
<rdfs:comment>3</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character23">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character18"/>
<rdfs:comment>3</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character23">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character19"/>
<rdfs:comment>3</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character23">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character20"/>
<rdfs:comment>4</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character23">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character21"/>
<rdfs:comment>4</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character23">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character22"/>
<rdfs:comment>4</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character23">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character12"/>
<rdfs:comment>2</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character23">
<char:knows rdf:resource="http://www.franz.com/lesmis#character11"/>
<rdfs:comment>9</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character24">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character23"/>
<rdfs:comment>2</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character24">
<char:knows rdf:resource="http://www.franz.com/lesmis#character11"/>
<rdfs:comment>7</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character25">
<char:knows rdf:resource="http://www.franz.com/lesmis#character24"/>
<rdfs:comment>13</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character25">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character23"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character25">
<char:knows rdf:resource="http://www.franz.com/lesmis#character11"/>
<rdfs:comment>12</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character26">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character24"/>
<rdfs:comment>4</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character26">
<char:knows_well rdf:resource="http://www.franz.com/lesmis#character11"/>
<rdfs:comment>31</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character26">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character16"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character26">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character25"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character27">
<char:knows_well rdf:resource="http://www.franz.com/lesmis#character11"/>
<rdfs:comment>17</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character27">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character23"/>
<rdfs:comment>5</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character27">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character25"/>
<rdfs:comment>5</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character27">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character24"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character27">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character26"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character28">
<char:knows rdf:resource="http://www.franz.com/lesmis#character11"/>
<rdfs:comment>8</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character28">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character27"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character29">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character23"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character29">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character27"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character29">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character11"/>
<rdfs:comment>2</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character30">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character23"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character31">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character30"/>
<rdfs:comment>2</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character31">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character11"/>
<rdfs:comment>3</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character31">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character23"/>
<rdfs:comment>2</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character31">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character27"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character32">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character11"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character33">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character11"/>
<rdfs:comment>2</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character33">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character27"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character34">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character11"/>
<rdfs:comment>3</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character34">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character29"/>
<rdfs:comment>2</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character35">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character11"/>
<rdfs:comment>3</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character35">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character34"/>
<rdfs:comment>3</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character35">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character29"/>
<rdfs:comment>2</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character36">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character34"/>
<rdfs:comment>2</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character36">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character35"/>
<rdfs:comment>2</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character36">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character11"/>
<rdfs:comment>2</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character36">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character29"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character37">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character34"/>
<rdfs:comment>2</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character37">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character35"/>
<rdfs:comment>2</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character37">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character36"/>
<rdfs:comment>2</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character37">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character11"/>
<rdfs:comment>2</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character37">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character29"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character38">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character34"/>
<rdfs:comment>2</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character38">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character35"/>
<rdfs:comment>2</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character38">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character36"/>
<rdfs:comment>2</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character38">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character37"/>
<rdfs:comment>2</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character38">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character11"/>
<rdfs:comment>2</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character38">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character29"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character39">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character25"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character40">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character25"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character41">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character24">
</char:barely_knows><rdfs:comment>2</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character41">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character25"/>
<rdfs:comment>3</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character42">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character41"/>
<rdfs:comment>2</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character42">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character25"/>
<rdfs:comment>2</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character42">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character24"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character43">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character11"/>
<rdfs:comment>3</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character43">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character26"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character43">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character27"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character44">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character28"/>
<rdfs:comment>3</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character44">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character11"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character45">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character28"/>
<rdfs:comment>2</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character47">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character46"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character48">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character47"/>
<rdfs:comment>2</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character48">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character25"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character48">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character27"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character48">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character11"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character49">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character26"/>
<rdfs:comment>3</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character49">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character11"/>
<rdfs:comment>2</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character50">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character49"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character50">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character24"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character51">
<char:knows rdf:resource="http://www.franz.com/lesmis#character49"/>
<rdfs:comment>9</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character51">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character26"/>
<rdfs:comment>2</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character51">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character11"/>
<rdfs:comment>2</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character52">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character51"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character52">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character39"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character53">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character51"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character54">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character51"/>
<rdfs:comment>2</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character54">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character49"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character54">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character26"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character55">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character51"/>
<rdfs:comment>6</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character55">
<char:knows rdf:resource="http://www.franz.com/lesmis#character49"/>
<rdfs:comment>12</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character55">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character39"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character55">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character54"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character55">
<char:knows_well rdf:resource="http://www.franz.com/lesmis#character26"/>
<rdfs:comment>21</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character55">
<char:knows_well rdf:resource="http://www.franz.com/lesmis#character11"/>
<rdfs:comment>19</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character55">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character16"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character55">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character25"/>
<rdfs:comment>2</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character55">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character41"/>
<rdfs:comment>5</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character55">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character48"/>
<rdfs:comment>4</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character56">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character49"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character56">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character55"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character57">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character55"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character57">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character41"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character57">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character48"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character58">
<char:knows rdf:resource="http://www.franz.com/lesmis#character55"/>
<rdfs:comment>7</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character58">
<char:knows rdf:resource="http://www.franz.com/lesmis#character48"/>
<rdfs:comment>7</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character58">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character27"/>
<rdfs:comment>6</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character58">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character57"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character58">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character11"/>
<rdfs:comment>4</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character59">
<char:knows_well rdf:resource="http://www.franz.com/lesmis#character58"/>
<rdfs:comment>15</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character59">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character55"/>
<rdfs:comment>5</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character59">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character48"/>
<rdfs:comment>6</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character59">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character57"/>
<rdfs:comment>2</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character60">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character48"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character60">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character58"/>
<rdfs:comment>4</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character60">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character59"/>
<rdfs:comment>2</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character61">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character48"/>
<rdfs:comment>2</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character61">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character58"/>
<rdfs:comment>6</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character61">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character60"/>
<rdfs:comment>2</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character61">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character59"/>
<rdfs:comment>5</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character61">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character57"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character61">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character55"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character62">
<char:knows rdf:resource="http://www.franz.com/lesmis#character55"/>
<rdfs:comment>9</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character62">
<char:knows_well rdf:resource="http://www.franz.com/lesmis#character58"/>
<rdfs:comment>17</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character62">
<char:knows rdf:resource="http://www.franz.com/lesmis#character59"/>
<rdfs:comment>13</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character62">
<char:knows rdf:resource="http://www.franz.com/lesmis#character48"/>
<rdfs:comment>7</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character62">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character57"/>
<rdfs:comment>2</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character62">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character41"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character62">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character61"/>
<rdfs:comment>6</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character62">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character60"/>
<rdfs:comment>3</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character63">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character59"/>
<rdfs:comment>5</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character63">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character48"/>
<rdfs:comment>5</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character63">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character62"/>
<rdfs:comment>6</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character63">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character57"/>
<rdfs:comment>2</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character63">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character58"/>
<rdfs:comment>4</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character63">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character61"/>
<rdfs:comment>3</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character63">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character60"/>
<rdfs:comment>2</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character63">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character55"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character64">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character55"/>
<rdfs:comment>5</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character64">
<char:knows rdf:resource="http://www.franz.com/lesmis#character62"/>
<rdfs:comment>12</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character64">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character48"/>
<rdfs:comment>5</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character64">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character63"/>
<rdfs:comment>4</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character64">
<char:knows rdf:resource="http://www.franz.com/lesmis#character58"/>
<rdfs:comment>10</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character64">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character61"/>
<rdfs:comment>6</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character64">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character60"/>
<rdfs:comment>2</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character64">
<char:knows rdf:resource="http://www.franz.com/lesmis#character59"/>
<rdfs:comment>9</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character64">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character57"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character64">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character11"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character65">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character63"/>
<rdfs:comment>5</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character65">
<char:knows rdf:resource="http://www.franz.com/lesmis#character64"/>
<rdfs:comment>7</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character65">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character48"/>
<rdfs:comment>3</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character65">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character62"/>
<rdfs:comment>5</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character65">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character58"/>
<rdfs:comment>5</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character65">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character61"/>
<rdfs:comment>5</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character65">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character60"/>
<rdfs:comment>2</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character65">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character59"/>
<rdfs:comment>5</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character65">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character57"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character65">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character55"/>
<rdfs:comment>2</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character66">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character64"/>
<rdfs:comment>3</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character66">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character58"/>
<rdfs:comment>3</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character66">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character59"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character66">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character62"/>
<rdfs:comment>2</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character66">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character65"/>
<rdfs:comment>2</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character66">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character48"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character66">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character63"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character66">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character61"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character66">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character60"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character67">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character57"/>
<rdfs:comment>3</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character68">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character25"/>
<rdfs:comment>5</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character68">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character11"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character68">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character24"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character68">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character27"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character68">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character48"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character68">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character41"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character69">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character25"/>
<rdfs:comment>6</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character69">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character68"/>
<rdfs:comment>6</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character69">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character11"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character69">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character24"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character69">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character27"/>
<rdfs:comment>2</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character69">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character48"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character69">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character41"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character70">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character25"/>
<rdfs:comment>4</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character70">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character69"/>
<rdfs:comment>4</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character70">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character68"/>
<rdfs:comment>4</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character70">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character11"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character70">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character24"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character70">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character27"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character70">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character41"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character70">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character58"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character71">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character27"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character71">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character69"/>
<rdfs:comment>2</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character71">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character68"/>
<rdfs:comment>2</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character71">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character70"/>
<rdfs:comment>2</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character71">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character11"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character71">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character48"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character71">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character41"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character71">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character25"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character72">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character26"/>
<rdfs:comment>2</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character72">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character27"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character72">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character11"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character73">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character48"/>
<rdfs:comment>2</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character74">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character48"/>
<rdfs:comment>2</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character74">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character73"/>
<rdfs:comment>3</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character75">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character69"/>
<rdfs:comment>3</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character75">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character68"/>
<rdfs:comment>3</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character75">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character25"/>
<rdfs:comment>3</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character75">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character48"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character75">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character41"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character75">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character70"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character75">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character71"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character76">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character64"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character76">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character65"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character76">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character66"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character76">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character63"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character76">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character62"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character76">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character48"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
<char:Character rdf:about="http://www.franz.com/lesmis#character76">
<char:barely_knows rdf:resource="http://www.franz.com/lesmis#character58"/>
<rdfs:comment>1</rdfs:comment>
</char:Character>
</rdf:RDF>
| 61,219 | Common Lisp | .l | 1,254 | 45.660287 | 79 | 0.742234 | wvxvw/agraph-client | 0 | 0 | 0 | EPL-1.0 | 9/19/2024, 11:36:20 AM (Europe/Amsterdam) | 3b10c58b10301556899c5c7c6b4011479c2fc4b0e328aa8d40bbad1bf420a63a | 28,730 | [
-1
] |
28,731 | python-blankNodes4.rdf | wvxvw_agraph-client/tutorial/python-blankNodes4.rdf | <?xml version='1.0' encoding='ISO-8859-1'?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc = "http://purl.org/dc/elements/1.1/"
xmlns:foaf = "http://xmlns.com/foaf/0.1/">
<!-- Example 2: Two books, use literal Author name, show no duplicates. -->
<rdf:Description rdf:about="http://www.franz.com/tutorial#book3">
<dc:title>The Call of the Wild</dc:title>
<dc:creator>Jack London</dc:creator>
</rdf:Description>
<rdf:Description rdf:about="http://www.franz.com/tutorial#book4">
<dc:title>White Fang</dc:title>
<dc:creator>Jack London"</dc:creator>
</rdf:Description>
</rdf:RDF> | 641 | Common Lisp | .l | 14 | 42.142857 | 75 | 0.687702 | wvxvw/agraph-client | 0 | 0 | 0 | EPL-1.0 | 9/19/2024, 11:36:20 AM (Europe/Amsterdam) | 10592b748361c09f83f0f16a3cb9b77c932e51d554e44695f366dd87377c17a8 | 28,731 | [
-1
] |
28,732 | python-tutorial-40.html | wvxvw_agraph-client/tutorial/python-tutorial-40.html | <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" >
<title>Python API Tutorial for AllegroGraph 4.2</title>
<style type="text/css">
.input { margin-left:4em; background-color:#ADDFFF;}
.output { margin-left:4em; background-color:#F1F1F1;}
.returnlink {font-size:small; font-weight:normal; }
</style>
</head>
<body>
<h1>Python Sesame API Tutorial for AllegroGraph 4.2</h1>
<p>This is an introduction to the Python client API to AllegroGraph RDFStore™ version 4.2 from <a href="http://agraph.franz.com/allegrograph/">Franz Inc.</a> </p>
<p>
The Python Sesame API offers convenient and efficient
access to an AllegroGraph server from a Python-based application. This API provides methods for
creating, querying and maintaining RDF data, and for managing the stored triples. </p>
<p>The Python Sesame API deliberately emulates the Aduna Sesame API to make it easier to migrate from Sesame to AllegroGraph. The Python Sesame API has also been extended in ways that make it easier and more intuitive than the Sesame API. </p>
<h2 id="Contents">Contents</h2>
<table width="554" border="0" style="vertical-align:top" >
<tr>
<td width="249"><ul>
<li><a href="#Overview">Overview</a></li>
<!-- <li><a href="#PrerequisitesWindows">Prerequisites (Windows)</a> </li>
--> <li><a href="#PrerequisitesLinux">Prerequisites (Linux)</a></li>
<li><a href="#Terminology">Terminology</a></li>
<li><a href="#Creating Users with WebView">Creating Users with WebView</a></li>
<li><a href="#Running Python">Running Python Tutorial Examples</a></li>
<li><a href="#Creating a Repository">Creating a Repository and Triple Indices </a></li>
<li><a href="#Asserting and Retracting Triples">Asserting and Retracting Triples</a></li>
<li><a href="#A SPARQL Query">A SPARQL Query</a></li>
<li><a href="#Statement Matching">Statement Matching</a></li>
<li><a href="#Literal Values">Literal Values</a></li>
<li><a href="#Importing Triples">Importing Triples</a></li>
<li><a href="#Exporting Triples">Exporting Triples</a></li>
<li><a href="#Datasets and Contexts">Searching Multiple Graphs </a></li>
</ul></td>
<td width="295"><ul>
<li><a href="#Namespaces">Namespaces</a></li>
<li><a href="#Free Text Search">Free Text Search</a></li>
<li><a href="#Ask, Describe, and Construct Queries">Select, Ask, Describe, and Construct Queries</a></li>
<li><a href="#Parametric Queries">Parametric Queries</a></li>
<li><a href="#Range Matches">Range Matches</a></li>
<li><a href="#Federated Repositories">Federated Repositories</a></li>
<li><a href="#Prolog Rule Queries">Prolog Rule Queries</a></li>
<li><a href="#Loading Prolog Rules">Loading Prolog Rules</a> </li>
<li><a href="#RDFS++ Inference">RDFS++ Inference</a> </li>
<li><a href="#Geospatial Search">Geospatial Search</a> </li>
<li><a href="#Social Network Analysis">Social Network Analysis</a> </li>
<li><a href="#Transaction Control">Transaction Control</a></li>
<li><a href="#Duplicate Triples">Duplicate Triples</a></li>
<p> </p></td>
</tr>
</table>
<p> </p>
<h2 id="Overview">Overview <a class="returnlink" href="#Contents">Return to Top</a></h2>
<p>The Python client tutorial rests on a simple architecture involving AllegroGraph, disk-based data files, Python, and a file of Python examples called tutorial_examples_40.py.</p>
<table width="944" border="0">
<tr>
<td width="309"><p>AllegroGraph 4.1 Server contains the Python API, which is part of the AllegroGraph installation. </p>
<p>Python communicates with AllegroGraph through HTTP port 8080 in this example. Python and AllegroGraph may be installed on the same computer, but in practice one server is shared by multiple clients. </p>
<p>Load tutorial_examples_40.py into Python to view the tutorial examples. </p></td>
<td width="625"><img src="allegrographdiagram.jpg" width="617" height="412"></td>
</tr>
</table>
<p>Each lesson in <strong>tutorial_examples_40.py</strong> is encapsulated in a Python function, named exampleN(), where N ranges from 0 to 21 (or more). The function names are referenced in the title of each section to make it easier to compare the tutorial text and the living code of the examples file. </p>
<!-- Commented out until new procedures become clear.
<h2 id="PrerequisitesLinux">Prerequisites (Windows) <a class="returnlink" href="#Contents">Return to Top</a></h2>
<table border="1">
<tr>
<td width="867">The following procedure describes the installation of both the paid and free versions of AllegroGraph Server. Note that you cannot install both versions on the same computer. Follow the instructions that are appropriate to your version. </td>
</tr>
</table>
<p>The tutorial examples can be run on a 32-bit Windows XP computer, running AllegroGraph and Python on the same computer ("localhost"). The tutorial assumes that AllegroGraph and Python 2.5 have been installed and configured using this procedure:</p>
<p> </p>
<ol>
<li>Download an AllegroGraph 4.0 installation file (agraph-4.0-windows.exe). The free edition is available <a href="http://www.franz.com/downloads/clp/ag_survey">here.</a> For the licensed edition please contact <a href="mailto:[email protected]">Franz customer support</a> for a download link and authorizing key. </li>
<li>Run the agraph-4.0-windows.exe to install AllegroGraph. The default installation directory is C:\Program Files\AllegroGraphFJE32 for the free edition, or c:\Program Files\AllegroGraphJEE32 for the licensed edition.</li>
<li>Create a scratch directory for AllegroGraph to use for disk-based data storage. In this tutorial the directory is c:\tmp\scratch. If you elect to use a different location, the configuration and example files will have to be modified in the same way.</li>
<li>
Edit the <strong>agraph.cfg</strong> configuration file. You'll find it in the AllegroGraph installation directory. Set the following parameters to the indicated values.
<pre>:new-http-port 8080
:new-http-catalog ("c:/tmp/scratch")
:client-prolog t </pre>
If you use a different port number, you will need to change the value of the AG_PORT variable at the top of tutorial_examples_40.py.
It defaults to 8080. <br>
<br>
NOTE: On Windows Vista and Windows 7 systems, you must edit this file with elevated privileges. To do this, either start a Command Prompt with the context menu item "Run as Administrator" then edit the file using a text editor launched in that shell, or run your favorite editor with "Run as Administrator". If you do not edit with elevated privileges, the file will look like it was saved successfully but the changes will not be seen by the service when it is started. This produces a "cannot connect to server" error message.
<li>To update AllegroGraph Server with recent patches, open a connection to the Internet. Run <strong>update.exe</strong>, which you will find the AllegroGraph installation directory. This automatically downloads and installs all current patches. </li>
<li>On a Windows computer, the AllegroGraph Server runs as a Windows service. You have to restart this service to load the updates. Beginning at the Windows <strong>Start </strong>button, navigate this path: <br>
<br>
Start > Settings > Control Panel > Administrative Tools > Services. <br>
<br>
Locate the AllegroGraph Server service and select it. Click the <strong>Restart</strong> link to restart the service. </li>
<li>This example used ActivePython 2.5 from ActiveState.com. Download and install the Windows installation file,
<a href="http://downloads.activestate.com/ActivePython/windows/2.5/ActivePython-2.5.2.2-win32-x86.msi">ActivePython-2.5.2.2-win32-x86.msi.</a> The default installation direction is C:\Python25.</li>
<li>It is necessary to augment Python 2.5 with the CJSON package from python.cs.hu. Download and run the installation file,
<a href="http://python.cx.hu/python-cjson/python-cjson-1.0.3x6.win32-py2.5.exe">python-cjson-1.0.3x6.win32-py2.5.exe.</a> It will add files to the default Python directory structure.</li>
<li>It is also necessary to augment Python 2.5 with the Pycurl package. Download and run the installation file,
<a href="http://pycurl.sourceforge.net/download/pycurl-ssl-7.18.2.win32-py2.5.exe">pycurl-ssl-7.18.2.win32-py2.5.exe.</a> It will add a small directory to your default Python directory structure. </li>
<li>
Link the Python software to the AllegroGraph Python API by setting a PYTHONPATH environment variable. For the free edition of AllegroGraph, the path value is:
<pre>PYTHONPATH=C:\Program Files\AllegroGraphFJE40\python</pre>
For the licensed edition of AllegroGraph, the path value is:
<pre>PYTHONPATH=C:\Program Files\AllegroGraphJEE40\python</pre>
In Windows XP, you can set an environment variable by
right-clicking on the <strong>My Computer</strong> icon, then navigate to Properties > Advanced tab > Environment Variables. Create a new variable showing the path to the AllegroGraph python subdirectory.<br>
<br>
<img src="environmentvariable.jpg" width="423" height="205"> <br>
</li>
<li>Start the ActivePython 2.5 PythonWin editor. Navigate this path: <strong>Start</strong> button > Programs > ActiveState ActivePython 2.5 > PythonWin Editor. </li>
<li>In the PythonWin editor, open the File menu, select Run, and browse to the location of the tutorial_examples_40.py file. It will be in the AllegroGraph\python subdirectory. Run this file. This loads and runs the Python tutorial examples.</li>
</ol>
-->
<h2 id="PrerequisitesLinux">Prerequisites (Linux) <a class="returnlink" href="#Contents">Return to Top</a></h2>
<p>The tutorial examples can be run on a Linux system, running AllegroGraph and the examples on the same computer ("localhost"). The tutorial assumes that AllegroGraph and Python 2.5 have been installed and configured using the procedure posted on <a href="http://www.franz.com/agraph/support/documentation/4.0/server-installation.html">this webpage</a>. </p>
<h2 id="Terminology">Terminology <a class="returnlink" href="#Contents">Return to Top</a></h2>
<p>We need to clarify some terminology before proceeding. </p>
<ul>
<li>"RDF" is the <a href="http://www.w3.org/RDF/">Resource Description Framework</a> defined by the <a href="http://www.w3.org/">World Wide Web Consortium</a> (W3C). It provides a elegantly simple means for describing multi-faceted resource objects and for linking them into complex relationship graphs. AllegroGraph Server creates, searches, and manages such RDF graphs. </li>
<li>A "URI" is a <a href="http://www.isi.edu/in-notes/rfc2396.txt">Uniform Resource Identifier</a>. It is label used to uniquely identify variosu types of entities in an RDF graph. A typical URI looks a lot like a web address: <http:\\www.company.com\project\class#number>. In spite of the resemblance, a URI is not a web address. It is simply a unique label. </li>
<li>A "triple" is a data statement, a "fact," stored in RDF format. It states that a resource has an attribute with a value. It consists of three fields:</li>
<ul> <li>Subject: The first field contains the URI that uniquely identifies the resource that this triple describes. </li>
<li>Predicate: The second field contains the URI identifying a property of this resource, such as its color or size, or a relationship between this resource and another one, such as parentage or ownership. </li>
<li>Object: The third field is the value of the property. It could be a literal value, such as "red," or the URI of a linked resource. </li>
</ul>
<li>A "quad" is a triple with an added "context" field, which is used to divide the repository into "subgraphs." This context or subgraph is just a URI label that appears in the fourth field of related triples. </li>
<li>A "quint" is a quad with fifth field used for the "tripleID." AllegroGraph Server implements all triples as quints behind the scenes. The fourth and fifth fields are often ignored, however, so we speak casually of "triples," and sometimes of "quads," when it would be more rigorous to call them all "quints." </li>
<li>A "resource description" is defined as a collection of triples that all have the same URI in the subject field. In other words, the triples all describe attributes of the same thing.</li>
<li>A "statement" is a client-side Python object that describes a triple (quad, quint). </li>
</ul>
<table width="809" border="0">
<tr>
<td width="378"><p>In the context of AllegroGraph Server: </p>
<ul>
<li>A "catalog" is a list of repositories owned by an AllegroGraph server.</li>
<li>A "repository" is a collection of triples within a Catalog, stored and indexed on a hard disk.</li>
<li>A "context" is a subgraph of the triples in a repository. </li>
<li>If contexts are not in use, the triples are stored in the background (default) graph. </li>
</ul> </td>
<td width="421"><img src="catalogrepositorycontext.jpg" width="397" height="400" align="right"></td>
</tr>
</table>
<h2 id="Creating Users with WebView">Creating Users with WebView <a class="returnlink" href="#Contents">Return to Top</a></h2>
<p>Each connection to an AllegroGraph server runs under the credentials of a registered AllegroGraph user account. </p>
<h3>Initial Superuser Account </h3>
<p>The installation instructions for AllegroGraph advise you to create a default <strong>superuser</strong> called "test", with password "xyzzy". This is the user (and password) expected by the tutorial examples. If you created this account as directed, you can proceed to the <a href="#Creating a Repository">next section</a> and return to this topic at a later time when you need to create non-superuser accounts. </p>
<p>If you created a different superuser account you'll have to edit the <strong>tutorial_examples_40.py</strong> file before proceeding. Modify these entries near the top of the file:</p>
<pre class="input">AG_USER = 'test'<br>AG_PASSWORD = 'xyzzy' </pre>
<p>Otherwise you'll get an authentication failure when you attempt to connect to the server. </p>
<h3>Users, Permissions, Access Rules, and Roles</h3>
<p>AllegroGraph user accounts may be given any combination of the following three permissions:</p>
<ul>
<li>Superuser</li>
<li>Start Session</li>
<li>Evaluate Arbritray Code</li>
</ul>
<p>In addition, a user account may be given read, write or read/write access to individual repositories. </p>
<p>You can also define a <strong>role</strong> (such as "librarian") and give the role a set of permissions and access rules. Then you can assign several users to a shared role. This lets you manage their permissions and access by editing the role instead of the individual user accounts. </p>
<p>A <strong>superuser</strong> automatically has all possible permissions and unlimited access. A superuser can also create, manage and delete other user accounts. Non-superusers cannot view or edit account settings. </p>
<p>A user with the <strong>Start Sessions</strong> permission can use the AllegroGraph features that require spawning a dedicated session, such as <a href="#Transaction Control">Transactions </a> and <a href="#Social Network Analysis">Social Network Analysis</a>. If you try to use these features without the appropriate permission, you'll encounter authentication errors. </p>
<p>A user with permission to <strong>Evaluate Arbitrary Code </strong>can run <a href="#Prolog Rule Queries">Prolog Rule Queries</a>. This user can also do anything else that allows executing Lisp code, such as defining select-style generators, or doing eval-in-server, as well as loading server-side files. </p>
<h3>WebView</h3>
<p>WebView is AllegroGraph's HTTP-based graphical user interface for user and repository management. It provides a SPARQL endpoint for querying your triple stores as well as various tools that let you create and maintain triple stores interactively. </p>
<p>To connect to WebView, simply direct your Web browser to the AllegroGraph port of your server. If you have installed AllegroGraph locally (and used the default port number), use:</p>
<pre class="output">http://localhost:10035</pre>
<p>You will be asked to log in. Use the superuser credentials described in the previous section. </p>
<p>The first page of WebView is a summary of your catalogs, repositories, and federations. Click the <strong>user account</strong> link in the lower left corner of the page. This exposes the <strong>Users and Roles</strong> page.</p>
<p><img src="webviewUser1.jpg" width="668" height="340"> </p>
<p>This is the environment for creating and managing user accounts. </p>
<p>To create a new user, click the [add a user] link. This exposes a small form where you can enter the username (one symbol) and password. Click OK to save the new account.</p>
<p>The new user will appear in the list of users. Click the [view permissions] link to open a control panel for the new user account:</p>
<p><img src="webviewNewUser.jpg" width="658" height="171"> </p>
<p>Use the checkboxes to apply permissions to this account (superuser, start session, evaluate arbitrary code). </p>
<p>It is imporant that you set up access permissions for the new user. Use the form to create an access rule by selecting read, write or read/write access, naming a catalog (or * for all), and naming a repository within that catalog (or * for all). Click the [add] link. This creates an access rule for your new user. The access rule will appear in the permissions display:</p>
<p><img src="webviewAccessRule.jpg" width="629" height="196"> </p>
<p>This new user can log in and perform transactions on any repository in the system. </p>
<p>To repeat, the "test" superuser is all you need to run all of the tutorial examples. This section is for the day when you want to issue more modest credentials to some of your operators. </p>
<h2 id="Running Python">Running Python Tutorial Examples <a class="returnlink" href="#Contents">Return to Top</a></h2>
<p>The AllegroGraph Python Tutorial examples are in the<strong> tutorial </strong>subdirectory where you unpacked the Python client tar.gz file. Navigate to that directory and follow one of these examples:</p>
<pre> $ python tutorial_examples_40.py runs all tests.
$ python tutorial_examples_40.py all runs all tests.
$ python tutorial_examples_40.py 10 runs example10()
$ python tutorial_examples_40.py 1 5 22 runs examples 1, 5, and 22</pre>
<h2 id="Creating a Repository">Creating a Repository and Triple Indices (example1()) <a class="returnlink" href="#Contents">Return to Top</a></h2>
<p>The first task is to attach to our AllegroGraph Server and open a repository. This task is implemented in<strong> example1()</strong> from<strong> tutorial_examples_40.py</strong>. </p>
<p>In <strong>example1()</strong> we build a chain of Python objects, ending in a"connection" object that lets us manipulate triples in a specific repository. The overall process of generating the connection object follows
this diagram:</p>
<table width="809" border="0">
<tr>
<td width="378"><p>The example1() function opens (or creates) a repository by building a series of client-side objects, culminating in a "connection" object. The connection object will be passed to other functions in tutorial_examples_40.py. </p>
<p>The connection object contains the methods that let us manipulate triples in a specific repository. </p></td>
<td width="421"><img src="createconnectionobject.jpg" width="448" height="212"></td>
</tr>
</table>
<p>The example first connects to an AllegroGraph Server by providing the endpoint (host IP address and port number) of an already-launched AllegroGraph server. This creates a client-side server object, which can access the AllegroGraph server's list of available catalogs through the <strong>listCatalogs()</strong> method:. </p>
<pre class="input">def example1(accessMode=Repository.RENEW):
server = AllegroGraphServer(AG_HOST, AG_PORT, 'user', 'password')
print "Available catalogs", server.listCatalogs()
</pre>
<p>This is the output so far:</p>
<pre class="output">>>> example1()
Defining connnection to AllegroGraph server -- host:'localhost' port:8080
Available catalogs ['/', 'scratch']</pre>
<p>This output says that the server has two catalogs, the default <strong>rootCatalog, '/'</strong>, and a named catalog 'scratch' that someone has created for some experimentation.</p>
<p>In the next line of example1(), we use the <strong>server.openCatalog()</strong> method to create a client-side catalog object. In this example we will connect to the default rootCatalog by calling openCatalog() with no arguments. When we look inside the root catalog, we can see which repositories are available:</p>
<pre class="input">
catalog = server.openCatalog()
print "Available repositories in catalog '%s': %s" % (catalog.getName(), catalog.listRepositories()) </pre>
<p>The corresponding output lists the available repositories. (When you run the examples, you may see a different list of repositories.)</p>
<pre class="output">Available repositories in catalog 'None': ['tutorial'] </pre>
<p>The next step is to create a client-side repository object representing the respository we wish to open, by calling the
<strong>getRepository()</strong> method of the catalog object. We have to provide the name of the desired repository (<strong>AG_REPOSITORY,</strong> bound to <strong>python-tutorial </strong> in this case), and select one of four access modes:</p>
<ul>
<li><strong>Repository.RENEW</strong> clears the contents of an existing repository before opening. If the indicated repository does not exist,
it creates one. </li>
<li><strong>Repository.OPEN</strong> opens an existing repository, or throws an exception if the repository is not found. </li>
<li><strong>Repository.ACCESS</strong> opens an existing repository, or creates a new one if the repository is not found.</li>
<li><strong>Repository.CREATE</strong> creates a new repository, or throws an exception if one by that name already exists.</li>
</ul>
<p>Repository.RENEW is the default setting for the example1() function of tutorial_examples_40.py. It can be overridden by calling
example1() with the appropriate argument, such as example1(Repository.OPEN).</p>
<pre class="input">
myRepository = catalog.getRepository(AG_REPOSITORY, accessMode)
myRepository.initialize()</pre>
<p>A new or renewed repository must be initialized, using the <strong>initialize()</strong> method of the repository object. If you try to initialize a respository twice you get a warning message in the Python window but no exception. </p>
<p>The goal of all this object-building has been to create a client-side connection object, whose methods let us manipulate the triples of the repository. The repository object's <strong>getConnection()</strong> method returns this connection object. </p>
<pre class="input">
connection = myRepository.getConnection()
print "Repository %s is up! It contains %i statements." % (
myRepository.getDatabaseName(), connection.size())
</pre>
<p>The <strong>size()</strong> method of the connection object returns how many triples are present. In the example1() function, this number should always be zero because we "renewed" the repository. This is the output in the Python window: </p>
<pre class="output"> Repository pythontutorial is up! It contains 0 statements.
<franz.openrdf.repository.repositoryconnection.RepositoryConnection object at 0x0127D710>
>>> </pre>
<p>Whenever you create a new repository, you should stop to consider which kinds of triple indices you will need. This is an important efficiency decision. AllegroGraph uses a set of sorted indices to quickly identify a contiguous block of triples that are likely to match a specific query pattern. </p>
<p>These indices are identified by names that describe their organization. The default set of indices are called <strong>spogi, posgi, ospgi, gspoi, gposi, gospi</strong>, and<strong> i</strong> , where: </p>
<ul>
<li>S stands for the subject URI. </li>
<li>P stands for the predicate URI. </li>
<li>O stands for the object URI or literal. </li>
<li>G stands for the graph URI. </li>
<li>I stands for the triple identifier (its unique id number within the triple store). </li>
</ul>
<p> The order of the letters denotes how the index has been organized. For instance, the <strong>spogi</strong> index contains all of the triples in the store, sorted first by subject, then by predicate, then by object, and finally by graph. The triple id number is present as a fifth column in the index. If you know the URI of a desired resource (the <em>subject</em> value of the query pattern), then the <strong>spogi</strong> index lets you retrieve all triples with that subject as a single block. </p>
<p>The idea is to provide your respository with the indices that your queries will need, and to avoid maintaining indices that you will never need. </p>
<p>We can use the connection object's <strong>listValidIndices()</strong> method to examine the list of all possible AllegroGraph triple indices: </p>
<pre class="input"> indices = conn.listValidIndices()<br> print "All valid triple indices: %s" % (indices)</pre>
<p>This is the list of all possible valid indices:</p>
<pre class="output">All valid triple indices: ['spogi', 'spgoi', 'sopgi', 'sogpi', 'sgpoi', 'sgopi',
'psogi', 'psgoi', 'posgi', 'pogsi', 'pgsoi', 'pgosi', 'ospgi', 'osgpi', 'opsgi',
'opgsi', 'ogspi', 'ogpsi', 'gspoi', 'gsopi', 'gpsoi', 'gposi', 'gospi', 'gopsi', 'i']</pre>
<p>AllegroGraph can generate any of these indices if you need them, but it creates only seven indices by default. We can see the current indices by using the connection object's <strong>listIndices()</strong> method:</p>
<pre class="input"> indices = conn.listIndices()<br> print "Current triple indices: %s" % (indices)</pre>
<p>There are currently seven indices:</p>
<pre class="output">Current triple indices: ['i', 'gospi', 'gposi', 'gspoi', 'ospgi', 'posgi', 'spogi']</pre>
<p>The indices that begin with "g" are sorted primarily by subgraph (or "context"). If you application does not use subgraphs, you should consider removing these indices from the repository. You don't want to build and maintain triple indices that your application will never use. This wastes CPU time and disk space. The connection object has a convenient <strong>dropIndex()</strong> method:</p>
<pre class="input"> print "Removing graph indices..."<br> conn.dropIndex("gospi")<br> conn.dropIndex("gposi")<br> conn.dropIndex("gspoi")<br> indices = conn.listIndices()<br> print "Current triple indices: %s" % (indices)</pre>
<p>Having dropped three of the triple indices, there are now four remaining:</p>
<pre class="output">Removing graph indices...<br>Current triple indices: ['i', 'ospgi', 'posgi', 'spogi']</pre>
<p>The <strong>i</strong> index is for deleting triples by using the triple id number. The <strong>ospgi</strong> index is sorted primarily by object value, which makes it possible to grab a range of object values as a single block of triples from the index. Similarly, the <strong>posgi</strong> index lets us reach for a block of triples that all share the same predicate. We mentioned previously that the <strong>spogi</strong> index lets us retrieve blocks of triples that all have the same subject URI. </p>
<p>As it happens, we may have been overly hasty in eliminating all of the graph indices. AllegroGraph can find the right matches as long as there is <em>any</em> one index present, but using the "right" index is much faster. Let's put one of the graph indices back, just in case we need it. We'll use the connection object's<strong> addIndex()</strong> method: </p>
<pre class="input"> print "Adding one graph index back in..."<br> conn.addIndex("gspoi")<br> indices = conn.listIndices()<br> print "Current triple indices: %s" % (indices)
return conn</pre>
<pre class="output">Adding one graph index back in...<br>Current triple indices: ['i', 'gspoi', 'ospgi', 'posgi', 'spogi']</pre>
<p>The last line (return conn) is the pointer to the new connection object. This is the value returned by example1() when it is called by other functions in tutorial_examples_40.py. The other functions then use the connection object to access the repository. </p>
<h2 id="Asserting and Retracting Triples">Asserting and Retracting Triples (example2()) <a class="returnlink" href="#Contents">Return to Top</a></h2>
<p>
In example example2(), we show how
to create resources describing two
people, Bob and Alice, by asserting individual triples into the respository. The example also retracts and replaces a triple. Assertions and retractions to the triple store
are executed by 'add' and 'remove' methods belonging to the connection object, which we obtain by calling the example1() function (described above).
</p>
<p>Before asserting a triple, we have to generate the URI values for the subject, predicate and object fields. The Python Sesame API to AllegroGraph Server predefines a number of classes and predicates for the RDF, RDFS, XSD, and OWL ontologies. RDF.TYPE is one of the predefined predicates we will use. </p>
<p>
The 'add' and 'remove' methods take an optional 'contexts' argument that
specifies one or more subgraphs that are the target of triple assertions
and retractions. When the context is omitted, triples are asserted/retracted
to/from the background graph. In the example below, facts about Alice and Bob
reside in the background graph.
</p>
<p>The example2() function begins by calling example1() to create the appropriate connection object, which is bound to the variable <strong>conn</strong>. </p>
<pre class="input">def example2():
conn = example1()
</pre>
<p>The next step is to begin assembling the URIs we will need for the new triples. The createURI() method generates a URI from a string. These are the subject URIs identifying the resources "Bob" and "Alice":</p>
<pre class="input">
alice = conn.createURI("http://example.org/people/alice")
bob = conn.createURI("http://example.org/people/bob")
</pre>
<p>Bob and Alice will be members of the "person" class (RDF:TYPE person). </p>
<pre class="input"> person = conn.createURI("http://example.org/ontology/Person")
</pre>
<p>Both Bob and Alice will have a "name" attribute. </p>
<pre class="input"> name = conn.createURI("http://example.org/ontology/name")
</pre>
<p>The name attributes will contain literal values. We have to generate the Literal objects from strings: </p>
<pre class="input"> bobsName = conn.createLiteral("Bob")
alicesName = conn.createLiteral("Alice")</pre>
<p>The next line prints out the number of triples currently in the repository. </p>
<pre class="input">
print "Triple count before inserts: ", conn.size()
</pre>
<pre class="output">Triple count before inserts: 0
</pre>
<p>Now we assert four triples, two for Bob and two more for Alice, using the connection object's <strong>add()</strong> method. After the assertions, we count triples again (there should be four) and print out the triples for inspection. </p>
<pre class="input"> ## alice is a person
conn.add(alice, RDF.TYPE, person)
## alice's name is "Alice"
conn.add(alice, name, alicesName)
## bob is a person
conn.add(bob, RDF.TYPE, person)
## bob's name is "Bob":
conn.add(bob, name, bobsName)
print "Triple count: ", conn.size()
for s in conn.getStatements(None, None, None, None, False): print s </pre>
<p>The "None" arguments to the getStatements() method say that we don't want to restrict what values may be present in the subject, predicate, object or context positions. Just print out all the triples. </p>
<p>This is the output at this point. We see four triples, two about Alice and two about Bob:</p>
<pre class="output">
Triple count: 4
(<http://example.org/people/alice>, <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>, <http://example.org/ontology/Person>)
(<http://example.org/people/alice>, <http://example.org/ontology/name>, "Alice")
(<http://example.org/people/bob>, <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>, <http://example.org/ontology/Person>)
(<http://example.org/people/bob>, <http://example.org/ontology/name>, "Bob")</pre>
<p>We see two resources of type "person," each with a literal name. </p>
<p>The next step is to demonstrate how to remove a triple. Use the remove() method of the connection object, and supply a triple pattern that matches the target triple. In this case we want to remove Bob's name triple from the repository. Then we'll count the triples again to verify that there are only three remaining. Finally, we re-assert Bob's name so we can use it in subsequent examples, and we'll return the connection object.. </p>
<pre class="input">
conn.remove(bob, name, bobsName)
print "Triple count: ", conn.size()
conn.add(bob, name, bobsName)
return conn</pre>
<pre class="output">
Triple count: 3
<franz.openrdf.repository.repositoryconnection.RepositoryConnection object at 0x01466830></pre>
<h2 id="A SPARQL Query">A SPARQL Query (example3()) <a class="returnlink" href="#Contents">Return to Top</a></h2>
<p>SPARQL stands for the "<a href="http://www.w3.org/TR/rdf-sparql-query/">SPARQL Protocol and RDF Query Language</a>," a recommendation of the <a href="http://www.w3.org/">World Wide Web Consortium (W3C)</a>. SPARQL is a query language for retrieving RDF triples. </p>
<p>Our next example illustrates how to evaluate a SPARQL query. This is the simplest query, the one that returns all triples. Note that example3() continues with the four triples created in example2(). </p>
<pre class="input">def example3():
conn = example2()
try:
queryString = "SELECT ?s ?p ?o WHERE {?s ?p ?o .}"
</pre>
<p>The SELECT clause returns the variables ?s, ?p and ?o in the bindingSet. The variables are bound to the subject, predicate and objects values of each triple that satisfies the WHERE clause. In this case the WHERE clause is unconstrained. The dot (.) in the fourth position signifies the end of the pattern. </p>
<p>The connection object's prepareTupleQuery() method
creates a query object that can be evaluated one or more times. (A "tuple" is an ordered sequence of data elements in Python.) The results are returned in an iterator that yields a sequence of bindingSets.</p>
<pre class="input">
tupleQuery = conn.prepareTupleQuery(QueryLanguage.SPARQL, queryString)
result = tupleQuery.evaluate();
</pre>
<p>Below we illustrate one (rather heavyweight) method for extracting the values
from a binding set, indexed by the name of the corresponding column variable
in the SELECT clause.</p>
<pre class="input">
try:
for bindingSet in result:
s = bindingSet.getValue("s")
p = bindingSet.getValue("p")
o = bindingSet.getValue("o")
print "%s %s %s" % (s, p, o)
</pre>
<pre class="output">
http://example.org/people/alice http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://example.org/ontology/Person
http://example.org/people/alice http://example.org/ontology/name "Alice"
http://example.org/people/bob http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://example.org/ontology/Person
http://example.org/people/bob http://example.org/ontology/name "Bob"
</pre>
<p>The Connection class is designed to be created for the duration of a sequence of updates and queries, and then closed. In practice, many AllegroGraph applications keep a connection open indefinitely. However, best practice dictates that the connection should be closed, as illustrated below. The same hygiene applies to the iterators that generate binding sets.</p>
<pre class="input"> finally:<br> result.close();<br> finally:<br> conn.close();<br> myRepository = conn.repository<br> myRepository.shutDown()</pre>
<h2 id="Statement Matching">Statement Matching (example4()) <a class="returnlink" href="#Contents">Return to Top</a></h2>
<p>
The getStatements() method of the connection object provides a simple way to perform unsophisticated queries. This method lets you enter a mix of required values and wildcards, and retrieve all matching triples. (If you need to perform sophisticated tests and comparisons you should use the SPARQL query instead.)</p>
<p>
Below, we illustrate two kinds of 'getStatement' calls. The first mimics
traditional Sesame syntax, and returns a Statement object at each iteration. This is the <strong>example4()</strong> function of tutorial_examples_40.py. It begins by calling example2() to create a connection object and populate the <strong>pythontutorial</strong> repository with four triples describing Bob and Alice. We're going to search for triples that mention Alice, so we have to create an "Alice" URI to use in the search pattern: </p>
<pre class="input">def example4():<br> conn = example2()<br> alice = conn.createURI("http://example.org/people/alice")
</pre>
<p> Now we search for triples with Alice's URI in the subject position. The "None" values are wildcards for the predicate and object positions of the triple. </p>
<pre class="input"> print "Searching for Alice using getStatements():"
statements = conn.getStatements(alice, None, None)
</pre>
<p>The getStatements() method returns a repositoryResult object (bound to the variable "statements" in this case). This object can be iterated over, exposing one result statement at a time. It is sometimes desirable to screen the results for duplicates, using the enableDuplicateFilter() method. Note, however, that duplicate filtering can be expensive. Our example does not contain any duplicates, but it is possible for them to occur. </p>
<pre class="input"> statements.enableDuplicateFilter() <br> for s in statements:<br> print s
</pre>
<p>This prints out the two matching triples for "Alice." </p>
<pre class="output">Searching for Alice using getStatements():<br>(<http://example.org/people/alice>, <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>, <http://example.org/ontology/Person>)
(<http://example.org/people/alice>, <http://example.org/ontology/name>, "Alice") </pre>
<p>At this point it is good form to close the respositoryResponse object because they occupy memory and are rarely reused in most programs. </p>
<pre class="input"> statements.close()</pre>
<h2 id="Literal Values">Literal Values (example5()) <a class="returnlink" href="#Contents">Return to Top</a></h2>
<p>The next example, <strong>example5()</strong>, illustrates some variations on what we have seen so far. The example creates and asserts <a href="http://www.w3.org/TR/rdf-concepts/#section-Graph-Literal">typed and plain literal values</a>, including language-specific plain literals, and then conducts searches for them in three ways:</p>
<ul>
<li>getStatements() search, which is an efficient way to match a single triple pattern. </li>
<li>SPARQL direct match, for efficient multi-pattern search. </li>
<li>SPARQL filter match, for sophisticated filtering such as performing range matches. </li>
</ul>
<p>The getStatements() and SPARQL direct searches return exactly the datatype you ask for. The SPARQL filter queries can sometimes return multiple datatypes. This behavior will be one focus of this section. </p>
<p>If you are not explicit about the datatype of a value, either when asserting the triple or when writing a search pattern, AllegroGraph will deduce an appropriate datatype and use it. This is another focus of this section. This helpful behavior can sometimes surprise you with unanticipated results. </p>
<h3>Setup</h3>
<p>Example5() begins by obtaining a connection object from example1(), and then clears the repository of all existing triples. </p>
<pre class="input">def example5():<br> conn = example1()<br> conn.clear()
</pre>
<p>For sake of coding efficiency, it is good practice to create variables for namespace strings. We'll use this namespace again and again in the following lines. We have made the URIs in this example very short to keep the result displays compact.</p>
<pre class="input"> exns = "http://people/"
</pre>
<p>The example creates new resources describing seven people, named alphabetically from Alice to Greg. These are URIs to use in the subject field of the triples. The example shows how to enter a full URI string, or alternately how to combine a namespace with a local resource name. </p>
<pre class="input"> alice = conn.createURI("http://example.org/people/alice")<br> bob = conn.createURI("http://example.org/people/bob")<br> carol = conn.createURI("http://example.org/people/carol")<br> dave = conn.createURI(namespace=exns, localname="dave")<br> eric = conn.createURI(namespace=exns, localname="eric")<br> fred = conn.createURI(namespace=exns, localname="fred")
greg = conn.createURI(namesapce=exns, localname="greg")</pre>
<h3>Numeric Literal Values </h3>
<p>This section explores the behavior of numeric literals.</p>
<h3>Asserting Numeric Data</h3>
<p>The first section assigns ages to the participants, using a variety of numeric types. First we need a URI for the "age" predicate. </p>
<pre class="input"> age = conn.createURI(namespace=exns, localname="age")</pre>
<p>The next step is to create a variety of values representing ages. Coincidentally, these people are all 42 years old, but we're going to record that information in multiple ways:</p>
<pre class="input"> fortyTwo = conn.createLiteral(42) # creates long
fortyTwoDouble = conn.createLiteral(42.0) # creates double
fortyTwoInt = conn.createLiteral('42', datatype=XMLSchema.INT)
fortyTwoLong = conn.createLiteral('42', datatype=XMLSchema.LONG)
fortyTwoFloat = conn.createLiteral('42', datatype=XMLSchema.FLOAT)
fortyTwoString = conn.createLiteral('42', datatype=XMLSchema.STRING)
fortyTwoPlain = conn.createLiteral('42') # creates plain literal</pre>
<p>In four of these statements, we explicitly identified the datatype of the value in order to create an INT, a LONG, a FLOAT and a STRING. This is the best practice. </p>
<p>In three other statements, we just handed AllegroGraph numeric-looking values to see what it would do with them. As we will see in a moment, 42 creates a LONG, 42.0 becomes into a DOUBLE, and '42' becomes a "plain" (untyped) literal value. (Note that plain literals are not <em>quite </em>the same thing as typed literal strings. A search for a plain literal will not always match a typed string, and <em>vice versa</em>.)</p>
<p>Now we need to assemble the URIs and values into statements (which are client-side triples):</p>
<pre class="input"> stmt1 = conn.createStatement(alice, age, fortyTwo)
stmt2 = conn.createStatement(bob, age, fortyTwoDouble)
stmt3 = conn.createStatement(carol, age, fortyTwoInt)
stmt4 = conn.createStatement(dave, age, fortyTwoLong)
stmt5 = conn.createStatement(eric, age, fortyTwoFloat)
stmt6 = conn.createStatement(fred, age, fortyTwoString)
stmt7 = conn.createStatement(greg, age, fortyTwoPlain)</pre>
<p>And then add the statements to the triple store on the AllegroGraph server. We can use either <strong>add()</strong> or <strong>addStatement()</strong> for this purpose. </p>
<pre class="input"> conn.add(stmt1)
conn.add(stmt2)
conn.add(stmt3)
conn.addStatement(stmt4)
conn.addStatement(stmt5)
conn.addStatement(stmt6)
conn.addStatement(stmt7)
</pre>
<p>Now we'll complete the round trip to see what triples we get back from these assertions. This is how we use <strong>getStatements()</strong> in this example to retrieve and display triples for us:</p>
<pre class="input"> print "\nShowing all age triples using getStatements(). Seven matches."
statements = conn.getStatements(None, age, None)
for s in statements:
print s</pre>
<p>This loop prints all age triples to the interaction window. Note that the retrieved triples are of six types: two ints, a long, a float, a double, a string, and a "plain literal." All of them say that their person's age is 42. Note that the triple for Greg has the plain literal value "42", while the triple for Fred uses "42" as a typed string.</p>
<pre class="output">Showing all age triples using getStatements(). Seven matches.<br>(<http://people/greg>, <http://people/age>, "42")<br>(<http://people/fred>, <http://people/age>, "42"^^<http://www.w3.org/2001/XMLSchema#string>)<br>(<http://people/eric>, <http://people/age>, "4.2E1"^^<http://www.w3.org/2001/XMLSchema#float>)<br>(<http://people/dave>, <http://people/age>, "42"^^<http://www.w3.org/2001/XMLSchema#long>)<br>(<http://people/carol>, <http://people/age>, "42"^^<http://www.w3.org/2001/XMLSchema#int>)<br>(<http://people/bob>, <http://people/age>, "4.2E1"^^<http://www.w3.org/2001/XMLSchema#double>)<br>(<http://people/alice>, <http://people/age>, "42"^^<http://www.w3.org/2001/XMLSchema#long>)</pre>
<p>If you ask for a specific datatype, you will get it. If you leave the decision up to AllegroGraph, you might get something unexpected such as an plain literal value. </p>
<h3>Matching Numeric Data</h3>
<p>This section explores getStatements() and SPARQL matches against numeric triples. </p>
<p>In the first example, we asked AllegroGraph to find an untyped number, <strong>42.</strong> </p>
<table width="1038" border="1">
<tr>
<td width="140"><strong>Query Type </strong></td>
<td width="368"><strong>Query</strong></td>
<td width="508"><strong>Matches which types? </strong></td>
</tr>
<tr>
<td><strong>getStatements()</strong></td>
<td>conn.getStatements(None, age, 42)</td>
<td>"42"^^<http://www.w3.org/2001/XMLSchema#long> </td>
</tr>
<tr>
<td><strong>SPARQL direct match </strong></td>
<td>SELECT ?s ?p WHERE {?s ?p 42 .}</td>
<td>No direct matches. </td>
</tr>
<tr>
<td><strong>SPARQL filter match </strong></td>
<td>SELECT ?s ?p ?o WHERE {?s ?p ?o . filter (?o = 42)}</td>
<td>"42"^^<http://www.w3.org/2001/XMLSchema#int><br> "4.2E1"^^<http://www.w3.org/2001/XMLSchema#float><br>
"42"^^<http://www.w3.org/2001/XMLSchema#long><br> "4.2E1"^^<http://www.w3.org/2001/XMLSchema#double></td>
</tr>
</table>
<p>The getStatements() query returned triples containing longs only. The SPARQL direct match didn't know how to interpret the untyped value and found zero matches. The SPARQL filter match, however, opened the doors to matches of multiple numeric types, and returned ints, floats, longs and doubles. </p>
<p><strong>"Match 42.0"</strong> without explicitly declaring the number's type.</p>
<table width="1038" border="1">
<tr>
<td width="140"><strong>Query Type </strong></td>
<td width="368"><strong>Query</strong></td>
<td width="508"><strong>Matches which types? </strong></td>
</tr>
<tr>
<td><strong>getStatements()</strong></td>
<td>conn.getStatements(None, age, 42.0)</td>
<td><p>"42"^^<http://www.w3.org/2001/XMLSchema#double><br>
Matches a double but not a float. </p> </td>
</tr>
<tr>
<td><strong>SPARQL direct match </strong></td>
<td>SELECT ?s ?p WHERE {?s ?p 42.0 .}</td>
<td>No direct matches. </td>
</tr>
<tr>
<td><strong>SPARQL filter match </strong></td>
<td>SELECT ?s ?p ?o WHERE {?s ?p ?o . filter (?o = 42.0)}</td>
<td>"42"^^<http://www.w3.org/2001/XMLSchema#int><br> "4.2E1"^^<http://www.w3.org/2001/XMLSchema#float><br> "42"^^<http://www.w3.org/2001/XMLSchema#long><br>
"4.2E1"^^<http://www.w3.org/2001/XMLSchema#double></td>
</tr>
</table>
<p>The getStatements() search returned a double but not the similar float. The filter match returned all numeric types that were equal to 42.0.</p>
<p><strong>"Match '42'^^<http://www.w3.org/2001/XMLSchema#int>."</strong> Note that we have to use a variable (fortyTwoInt) bound to a Literal value in order to offer this int to getStatements(). We can't just type the value into the getStatements() method directly. </p>
<table width="1038" border="1">
<tr>
<td width="140"><strong>Query Type </strong></td>
<td width="368"><strong>Query</strong></td>
<td width="508"><strong>Matches which types? </strong></td>
</tr>
<tr>
<td><strong>getStatements()</strong></td>
<td>conn.getStatements(None, age, fortyTwoInt)</td>
<td><p>"42"^^<http://www.w3.org/2001/XMLSchema#int><br>
</p> </td>
</tr>
<tr>
<td><strong>SPARQL direct match </strong></td>
<td>SELECT ?s ?p WHERE {?s ?p "42"^^<http://www.w3.org/2001/XMLSchema#int>}</td>
<td>"42"^^<http://www.w3.org/2001/XMLSchema#int></td>
</tr>
<tr>
<td><strong>SPARQL filter match </strong></td>
<td>SELECT ?s ?p ?o WHERE {?s ?p ?o . filter (?o = "42"^^<http://www.w3.org/2001/XMLSchema#int>)}</td>
<td>"42"^^<http://www.w3.org/2001/XMLSchema#int><br> "4.2E1"^^<http://www.w3.org/2001/XMLSchema#float><br> "42"^^<http://www.w3.org/2001/XMLSchema#long><br>
"4.2E1"^^<http://www.w3.org/2001/XMLSchema#double></td>
</tr>
</table>
<p>Both the getStatements() query and the SPARQL direct query returned exactly what we asked for: ints. The filter match returned all numeric types that matches in value. </p>
<p><strong>"Match '42'^^<http://www.w3.org/2001/XMLSchema#long>."</strong> Again we need a bound variable to offer a Literal value to getStatements(). </p>
<table width="1038" border="1">
<tr>
<td width="140"><strong>Query Type </strong></td>
<td width="368"><strong>Query</strong></td>
<td width="508"><strong>Matches which types? </strong></td>
</tr>
<tr>
<td><strong>getStatements()</strong></td>
<td>conn.getStatements(None, age, fortyTwoLong)</td>
<td><p>"42"^^<http://www.w3.org/2001/XMLSchema#long><br>
</p></td>
</tr>
<tr>
<td><strong>SPARQL direct match </strong></td>
<td>SELECT ?s ?p WHERE {?s ?p "42"^^<http://www.w3.org/2001/XMLSchema#long>}</td>
<td>"42"^^<http://www.w3.org/2001/XMLSchema#long></td>
</tr>
<tr>
<td><strong>SPARQL filter match </strong></td>
<td>SELECT ?s ?p ?o WHERE {?s ?p ?o . filter (?o = "42"^^<http://www.w3.org/2001/XMLSchema#long>)}</td>
<td>"42"^^<http://www.w3.org/2001/XMLSchema#int><br>
"4.2E1"^^<http://www.w3.org/2001/XMLSchema#float><br>
"42"^^<http://www.w3.org/2001/XMLSchema#long><br>
"4.2E1"^^<http://www.w3.org/2001/XMLSchema#double></td>
</tr>
</table>
<p>Both the getStatements() query and the SPARQL direct query returned longs. The filter match returned all numeric types. </p>
<p><strong>"Match '42'^^<http://www.w3.org/2001/XMLSchema#double>."</strong> </p>
<table width="1038" border="1">
<tr>
<td width="140"><strong>Query Type </strong></td>
<td width="368"><strong>Query</strong></td>
<td width="508"><strong>Matches which types? </strong></td>
</tr>
<tr>
<td><strong>getStatements()</strong></td>
<td>conn.getStatements(None, age, fortyTwoDouble)</td>
<td><p>"42"^^<http://www.w3.org/2001/XMLSchema#double><br>
</p></td>
</tr>
<tr>
<td><strong>SPARQL direct match </strong></td>
<td>SELECT ?s ?p WHERE {?s ?p "42"^^<http://www.w3.org/2001/XMLSchema#double>}</td>
<td>"42"^^<http://www.w3.org/2001/XMLSchema#double></td>
</tr>
<tr>
<td><strong>SPARQL filter match </strong></td>
<td>SELECT ?s ?p ?o WHERE {?s ?p ?o . filter (?o = "42"^^<http://www.w3.org/2001/XMLSchema#double>)}</td>
<td>"42"^^<http://www.w3.org/2001/XMLSchema#int><br>
"4.2E1"^^<http://www.w3.org/2001/XMLSchema#float><br>
"42"^^<http://www.w3.org/2001/XMLSchema#long><br>
"4.2E1"^^<http://www.w3.org/2001/XMLSchema#double></td>
</tr>
</table>
<p>Both the getStatements() query and the SPARQL direct query returned doubles. The filter match returned all numeric types. </p>
<h3>Matching Numeric Strings and Plain Literals</h3>
<p>At this point we are transitioning from tests of numeric matches to tests of string matches, but there is a gray zone to be explored first. What do we find if we search for strings that contain numbers? In particular, what about "plain literal" values that are almost, but not quite, strings?</p>
<p><strong>"Match '42'^^<http://www.w3.org/2001/XMLSchema#string>."</strong> This example asks for a typed string to see if we get any numeric matches back. </p>
<table width="1038" border="1">
<tr>
<td width="140"><strong>Query Type </strong></td>
<td width="368"><strong>Query</strong></td>
<td width="508"><strong>Matches which types? </strong></td>
</tr>
<tr>
<td><strong>getStatements()</strong></td>
<td>conn.getStatements(None, age, fortyTwoString)</td>
<td><p>"42"^^<http://www.w3.org/2001/XMLSchema#string><br>
It did not match the plain literal.
<br>
</p></td>
</tr>
<tr>
<td><strong>SPARQL direct match </strong></td>
<td>SELECT ?s ?p WHERE {?s ?p "42"^^<http://www.w3.org/2001/XMLSchema#string>}</td>
<td><p>"42"^^<http://www.w3.org/2001/XMLSchema#string><br>"42" This is the plain literal value. </p> </td>
</tr>
<tr>
<td><strong>SPARQL filter match </strong></td>
<td>SELECT ?s ?p ?o WHERE {?s ?p ?o . filter (?o = "42"^^<http://www.w3.org/2001/XMLSchema#string>)}</td>
<td>"42"^^<http://www.w3.org/2001/XMLSchema#string><br>
"42" This is the plain literal value. </td>
</tr>
</table>
<p>The getStatements() query matched a literal string only. The SPARQL queries returned matches that were both typed strings and plain literals. There were no numeric matches. </p>
<p><strong>"Match plain literal '42'."</strong> This example asks for a plain literal to see if we get any numeric matches back. </p>
<table width="1038" border="1">
<tr>
<td width="140"><strong>Query Type </strong></td>
<td width="368"><strong>Query</strong></td>
<td width="508"><strong>Matches which types? </strong></td>
</tr>
<tr>
<td><strong>getStatements()</strong></td>
<td>conn.getStatements(None, age, fortyTwoPlain)</td>
<td><p>"42" This is the plain literal. It did not match the string. <br>
</p></td>
</tr>
<tr>
<td><strong>SPARQL direct match </strong></td>
<td>SELECT ?s ?p WHERE {?s ?p "42"}</td>
<td><p>"42"^^<http://www.w3.org/2001/XMLSchema#string><br>
"42" This is the plain literal value. </p></td>
</tr>
<tr>
<td><strong>SPARQL filter match </strong></td>
<td>SELECT ?s ?p ?o WHERE {?s ?p ?o . filter (?o = "42")}</td>
<td>"42"^^<http://www.w3.org/2001/XMLSchema#string><br>
"42" This is the plain literal value. </td>
</tr>
</table>
<p>The getStatements() query matched the plain literal only, and did not match the string. The SPARQL queries returned matches that were both typed strings and plain literals. There were no numeric matches. </p>
<p>The interesting lesson here is that AllegroGraph distinguishes between strings and plain literals when you use getStatements(), but it lumps them together when you use SPARQL. </p>
<h3>Matching Strings</h3>
<p>In this section we'll set up a variety of string triples and experiment with matching them using getStatements() and SPARQL. Note that <a href="#Free Text Search">Free Text Search</a> is a different topic. In this section we're doing simple matches of whole strings.</p>
<h3>Asserting String Values </h3>
<p>We're going to add a "favorite color" attribute to five of the person resources we have used so far. First we need a predicate.</p>
<pre class="input"> favoriteColor = conn.createURI(namespace=exns, localname="favoriteColor")
</pre>
<p>Now we'll create a variety of string values, and a single "plain literal" value. </p>
<pre class="input"> UCred = conn.createLiteral('Red', datatype=XMLSchema.STRING)<br> LCred = conn.createLiteral('red', datatype=XMLSchema.STRING)<br> RedPlain = conn.createLiteral('Red') #plain literal<br> rouge = conn.createLiteral('rouge', datatype=XMLSchema.STRING)<br> Rouge = conn.createLiteral('Rouge', datatype=XMLSchema.STRING)<br> RougePlain = conn.createLiteral('Rouge') #plain literal<br> FrRouge = conn.createLiteral('Rouge', language="fr") #plain literal with language tag</pre>
<p>Note that in the last line we created a plain literal and assigned it a French language tag. <em>You cannot assign a language tag to strings, only to plain literals.</em> See <a href="http://www.w3.org/TR/rdf-concepts/#section-Graph-Literal">typed and plain literal values</a> for the specification.</p>
<p>Next we'll add these values to new triples in the triple store. For variety, we bypassed creating client-side statements and just asserted the triples in one step.</p>
<pre class="input"> conn.addTriples([(alice, favoriteColor, UCred),<br> (bob, favoriteColor, LCred),<br> (carol, favoriteColor, RedPlain),<br> (dave, favoriteColor, rouge),<br> (eric, favoriteColor, Rouge),<br> (fred, favoriteColor, RougePlain),<br> (greg, favoriteColor, FrRouge)])</pre>
<p>If we run a getStatements() query for all favoriteColor triples, we get these values returned:</p>
<pre class="input">(<http://people/alice>, <http://people/favoriteColor>, "Red"^^<http://www.w3.org/2001/XMLSchema#string>)<br>(<http://people/bob>, <http://people/favoriteColor>, "red"^^<http://www.w3.org/2001/XMLSchema#string>)<br>(<http://people/carol>, <http://people/favoriteColor>, "Red")<br>(<http://people/dave>, <http://people/favoriteColor>, "rouge"^^<http://www.w3.org/2001/XMLSchema#string>)<br>(<http://people/eric>, <http://people/favoriteColor>, "Rouge"^^<http://www.w3.org/2001/XMLSchema#string>)<br>(<http://people/fred>, <http://people/favoriteColor>, "Rouge")<br>(<http://people/greg>, <http://people/favoriteColor>, "Rouge"@fr)</pre>
<p>That's four typed strings, capitalized and lower case, plus three plain literals, one with a language tag. </p>
<h3>Matching String Data</h3>
<p>First let's search for "Red" without specifying a datatype. </p>
<p><strong>"Match 'Red'."</strong> What happens if we search for "Red" without specifying a string datatype? </p>
<table width="1038" border="1">
<tr>
<td width="140"><strong>Query Type </strong></td>
<td width="368"><strong>Query</strong></td>
<td width="508"><strong>Matches which types? </strong></td>
</tr>
<tr>
<td><strong>getStatements()</strong></td>
<td>conn.getStatements(None, age, "Red")</td>
<td><p>"Red" This is the plain literal. It did not match the string. <br>
</p></td>
</tr>
<tr>
<td><strong>SPARQL direct match </strong></td>
<td>SELECT ?s ?p WHERE {?s ?p "Red"}</td>
<td><p>"Red"^^<http://www.w3.org/2001/XMLSchema#string><br>
"Red" This is the plain literal value.</p>
</td>
</tr>
<tr>
<td><strong>SPARQL filter match </strong></td>
<td>SELECT ?s ?p ?o WHERE {?s ?p ?o . filter (?o = "Red")}</td>
<td>"Red"^^<http://www.w3.org/2001/XMLSchema#string><br>
"Red" This is the plain literal value.</td>
</tr>
</table>
<p>The getStatements() query matched the plain literal only, and did not match the similar string. The SPARQL queries matched both "Red" typed strings and "Red" plain literals, but they did not return the lower case "red" triple. The match was liberal regarding datatype but strict about case. </p>
<p>Let's try "Rouge".</p>
<p><strong>"Match 'Rouge'."</strong> What happens if we search for "Rouge" without specifying a string datatype or language? Will it match the triple with the French tag? </p>
<table width="1038" border="1">
<tr>
<td width="140"><strong>Query Type </strong></td>
<td width="368"><strong>Query</strong></td>
<td width="508"><strong>Matches which types? </strong></td>
</tr>
<tr>
<td><strong>getStatements()</strong></td>
<td>conn.getStatements(None, age, "Rouge")</td>
<td><p>"Rouge" This is the plain literal. It did not match the string. <br>
</p></td>
</tr>
<tr>
<td><strong>SPARQL direct match </strong></td>
<td>SELECT ?s ?p WHERE {?s ?p "Rouge"}</td>
<td><p>"Rouge"^^<http://www.w3.org/2001/XMLSchema#string><br>
"Rouge" This is the plain literal value. <br>
Did not match the "Rouge"@fr triple. </p></td>
</tr>
<tr>
<td><strong>SPARQL filter match </strong></td>
<td>SELECT ?s ?p ?o WHERE {?s ?p ?o . filter (?o = "Rouge")}</td>
<td>"Rouge"^^<http://www.w3.org/2001/XMLSchema#string><br>
"Rouge" This is the plain literal value. <br>
Did not match the"Rouge"@fr triple. </td>
</tr>
</table>
<p>The getStatements() query matched the plain literal only, and did not match the similar string. The SPARQL queries matched both "Rouge" typed strings and "Rouge" plain literals, but they did not return the "Rouge"@fr triple. The match was liberal regarding datatype but strict about language. We didn't ask for French, so we didn't get French. </p>
<p><strong>"Match 'Rouge'@fr."</strong> What happens if we search for "Rouge"@fr? We'll have to bind the value to a variable (FrRouge) to use getStatements(). We can type the value directly into the SPARQL queries. </p>
<table width="1038" border="1">
<tr>
<td width="140"><strong>Query Type </strong></td>
<td width="368"><strong>Query</strong></td>
<td width="508"><strong>Matches which types? </strong></td>
</tr>
<tr>
<td><strong>getStatements()</strong></td>
<td>conn.getStatements(None, age, FrRouge)</td>
<td><p>"Rouge"@fr <br>
</p></td>
</tr>
<tr>
<td><strong>SPARQL direct match </strong></td>
<td>SELECT ?s ?p WHERE {?s ?p "Rouge"@fr}</td>
<td><p>"Rouge"@fr </p></td>
</tr>
<tr>
<td><strong>SPARQL filter match </strong></td>
<td>SELECT ?s ?p ?o WHERE {?s ?p ?o . filter (?o = "Rouge"@fr)}</td>
<td>"Rouge"@fr </td>
</tr>
</table>
<p>If you ask for a specific language, that's exactly what you are going to get, in all three types of queries. </p>
<p>You may be wondering how to perform a string match where language and capitalization don't matter. You can do that with a SPARQL filter query using the <strong>str()</strong> function, which strips out the string portion of a literal, leaving behind the datatype or language tag. Then the <strong>lowercase()</strong> function eliminates case issues:</p>
<pre class="input">PREFIX fn: <http://www.w3.org/2005/xpath-functions#>
SELECT ?s ?p ?o
WHERE {?s ?p ?o . filter (fn:lower-case(str(?o)) = "rouge")}</pre>
<p>This query returns a variety of "Rouge" triples:</p>
<pre class="output"><http://people/greg> <http://people/favoriteColor> "Rouge"@fr<br><http://people/fred> <http://people/favoriteColor> "Rouge"<br><http://people/eric> <http://people/favoriteColor> "Rouge"^^<http://www.w3.org/2001/XMLSchema#string><br><http://people/dave> <http://people/favoriteColor> "rouge"^^<http://www.w3.org/2001/XMLSchema#string> </pre>
<p>This query matched all triples containing the string "rouge" regardless of datatype or language tag. Remember that the SPARQL "filter" queries are powerful, but they are also the slowest queries. SPARQL direct queries and getStatements() queries are faster. </p>
<h3>Matching Booleans</h3>
<p>In this section we'll assert and then search for Boolean values.</p>
<h3>Asserting Boolean Values</h3>
<p>The Python language includes predefined True and False symbols for use in your decision-making logic. These Boolean constants are fine for programming, but they are not appropriate for asserting Boolean values into triples. They do not result in legal RDF Boolean values, and this creates subsequent matching issues.</p>
<p>We'll be adding a new attribute to the person resources in our example. Are they, or are they not, seniors?</p>
<pre class="input"> senior = conn.createURI(namespace=exns, localname="seniorp") </pre>
<p>The correct way to create Boolean values for use in triples is to create literal values of type Boolean:</p>
<pre class="input"> trueValue = conn.createLiteral("true", datatype=XMLSchema.BOOLEAN)<br> falseValue = conn.createLiteral("false", datatype=XMLSchema.BOOLEAN)</pre>
<p>Note that "true" and "false" must be lower case. </p>
<p>We'll only need two triples:</p>
<pre class="input"> conn.addTriple(alice, senior, trueValue)<br> conn.addTriple(bob, senior, falseValue)</pre>
<p>When we retrieve the triples (using getStatements()) we see:</p>
<pre class="output">(<http://people/bob>, <http://people/seniorp>, "false"^^<http://www.w3.org/2001/XMLSchema#boolean>)<br>(<http://people/alice>, <http://people/seniorp>, "true"^^<http://www.w3.org/2001/XMLSchema#boolean>) </pre>
<p>These are RDF-legal Boolean values that work with the AllegroGraph query engine. Note that "true" and "false" are lower case.</p>
<p>As an object lesson, this getStatements() query uses the Python "True" Boolean, which does not match the values in the RDF store:</p>
<pre class="input">conn.getStatements(None, senior, True) # no matches</pre>
<p><strong>"Match 'true'."</strong> There are three correct ways to perform a Boolean search. One is to use the varible trueValue (defined above) to pass a Boolean literal value to getStatements(). SPARQL queries will recognize <strong>true</strong> and <strong>false</strong>, and of course the fully-typed <strong>"true"^^<http://www.w3.org/2001/XMLSchema#boolean></strong> format is also respected by SPARQL:</p>
<table width="1038" border="1">
<tr>
<td width="140"><strong>Query Type </strong></td>
<td width="368"><strong>Query</strong></td>
<td width="508"><strong>Matches which types? </strong></td>
</tr>
<tr>
<td><strong>getStatements()</strong></td>
<td>conn.getStatements(None, senior, trueValue)</td>
<td><p>"true"^^<http://www.w3.org/2001/XMLSchema#boolean><br>
</p></td>
</tr>
<tr>
<td><strong>SPARQL direct match </strong></td>
<td>SELECT ?s ?p WHERE {?s ?p true}</td>
<td><p>"true"^^<http://www.w3.org/2001/XMLSchema#boolean></p></td>
</tr>
<tr>
<td><strong>SPARQL direct match </strong></td>
<td>SELECT ?s ?p WHERE {?s ?p "true"^^<http://www.w3.org/2001/XMLSchema#boolean></td>
<td>"true"^^<http://www.w3.org/2001/XMLSchema#boolean></td>
</tr>
<tr>
<td><strong>SPARQL filter match </strong></td>
<td>SELECT ?s ?p ?o WHERE {?s ?p ?o . filter (?o = true)}</td>
<td>"true"^^<http://www.w3.org/2001/XMLSchema#boolean></td>
</tr>
<tr>
<td><strong>SPARQL filter match </strong></td>
<td>SELECT ?s ?p ?o WHERE {?s ?p ?o . filter (?o = "true"^^<http://www.w3.org/2001/XMLSchema#boolean>}</td>
<td>"true"^^<http://www.w3.org/2001/XMLSchema#boolean></td>
</tr>
</table>
<p>All of these queries correctly match Boolean values. </p>
<h3>Dates, Times and Datetimes </h3>
<p>In this final section of example5(), we'll assert and retrieve dates, times and datetimes. </p>
<p>In this context, you might be surprised by the way that AllegroGraph handles time zone data. If you assert (or search for) a timestamp that includes a time-zone offset, AllegroGraph will "normalize" the expression to Greenwich (zulu) time before proceeding. This normalization greatly speeds up searching and happens transparently to you, but you'll notice that the matched values are all zulu times. </p>
<h3>Asserting Date, Time and Datetime Values</h3>
<p>We're going to add birthdates to our personnel records. We'll need a birthdate predicate:</p>
<pre class="input"> birthdate = conn.createURI(namespace=exns, localname="birthdate") </pre>
<p>We'll also need four types of literal values: a date, a time, a datetime, and a datetime with a time-zone offset.</p>
<pre class="input"> date = conn.createLiteral('1984-12-06', datatype=XMLSchema.DATE) <br> datetime = conn.createLiteral('1984-12-06T09:00:00', datatype=XMLSchema.DATETIME) <br> time = conn.createLiteral('09:00:00Z', datatype=XMLSchema.TIME) <br> datetimeOffset = conn.createLiteral('1984-12-06T09:00:00+01:00', datatype=XMLSchema.DATETIME)</pre>
<p>It is interesting to notice that these literal values print out exactly as we defined them. </p>
<pre class="output">Printing out Literals for date, datetime, time, and datetime with Zulu offset.<br>"1984-12-06"^^<http://www.w3.org/2001/XMLSchema#date><br>"1984-12-06T09:00:00"^^<http://www.w3.org/2001/XMLSchema#dateTime><br>"09:00:00Z"^^<http://www.w3.org/2001/XMLSchema#time><br>"1984-12-06T09:00:00+01:00"^^<http://www.w3.org/2001/XMLSchema#dateTime></pre>
<p>Now we'll add them to the triple store:</p>
<pre class="input"> conn.addTriples([(alice, birthdate, date),<br> (bob, birthdate, datetime),<br> (carol, birthdate, time),<br> (dave, birthdate, datetimeOffset)])</pre>
<p>And then retrieve them using getStatements():</p>
<pre class="output">Showing all birthday triples using getStatements(). Should be four.<br>(<http://people/alice>, <http://people/birthdate>, "1984-12-06"^^<http://www.w3.org/2001/XMLSchema#date>)<br>(<http://people/bob>, <http://people/birthdate>, "1984-12-06T09:00:00Z"^^<http://www.w3.org/2001/XMLSchema#dateTime>)<br>(<http://people/carol>, <http://people/birthdate>, "09:00:00Z"^^<http://www.w3.org/2001/XMLSchema#time>)<br>(<http://people/dave>, <http://people/birthdate>, "1984-12-06T08:00:00Z"^^<http://www.w3.org/2001/XMLSchema#dateTime>)</pre>
<p>If you look sharply, you'll notice that the zulu offset has been normalized:</p>
<pre>Was:<span class="output">"1984-12-06T09:00:00+01:00"</span>
Now:<span class="output">"1984-12-06T08:00:00Z"</span></pre>
<p>Note that the one-hour zulu offset has been applied to the timestamp. "9:00" turned into "8:00." </p>
<h3>Matching Date, Time, and Datetime Literals</h3>
<p><strong>"Match date."</strong> What happens if we search for the date literal we defined? We'll use the "date" variable with getStatements(), but just type the expected value into the SPARQL queries. </p>
<table width="1038" border="1">
<tr>
<td width="140"><strong>Query Type </strong></td>
<td width="368"><strong>Query</strong></td>
<td width="508"><strong>Matches which types? </strong></td>
</tr>
<tr>
<td><strong>getStatements()</strong></td>
<td>conn.getStatements(None, age, date)</td>
<td><p>"1984-12-06"<br>
^^<http://www.w3.org/2001/XMLSchema#date><br>
</p></td>
</tr>
<tr>
<td><strong>SPARQL direct match </strong></td>
<td>SELECT ?s ?p WHERE {?s ?p '1984-12-06'^^<http://www.w3.org/2001/XMLSchema#date></td>
<td><p>"1984-12-06"<br>
^^<http://www.w3.org/2001/XMLSchema#date></p></td>
</tr>
<tr>
<td><strong>SPARQL filter match </strong></td>
<td>SELECT ?s ?p ?o WHERE {?s ?p ?o . filter (?o =<br>
'1984-12-06'<br>
^^<http://www.w3.org/2001/XMLSchema#date>)}</td>
<td>"1984-12-06"<br>
^^<http://www.w3.org/2001/XMLSchema#date></td>
</tr>
</table>
<p>All three queries match narrowly, meaning the exact date and datatype we asked for is returned. </p>
<p><strong>"Match datetime."</strong> What happens if we search for the datetime literal? We'll use the "datetime" variable with getStatements(), but just type the expected value into the SPARQL queries. </p>
<table width="1038" border="1">
<tr>
<td width="140"><strong>Query Type </strong></td>
<td width="368"><strong>Query</strong></td>
<td width="508"><strong>Matches which types? </strong></td>
</tr>
<tr>
<td><strong>getStatements()</strong></td>
<td>conn.getStatements(None, age, datetime)</td>
<td><p>"1984-12-06T09:00:00Z"<br>
^^<http://www.w3.org/2001/XMLSchema#dateTime><br>
</p></td>
</tr>
<tr>
<td><strong>SPARQL direct match </strong></td>
<td>SELECT ?s ?p WHERE {?s ?p '1984-12-06T09:00:00Z'<br>
^^<http://www.w3.org/2001/XMLSchema#dateTime> .}</td>
<td><p>"1984-12-06T09:00:00Z"<br>
^^<http://www.w3.org/2001/XMLSchema#dateTime></p></td>
</tr>
<tr>
<td><strong>SPARQL filter match </strong></td>
<td>SELECT ?s ?p ?o WHERE {?s ?p ?o . filter (?o = '1984-12-06T09:00:00Z'^^<http://www.w3.org/2001/XMLSchema#dateTime>)}</td>
<td>"1984-12-06T09:00:00Z"<br>
^^<http://www.w3.org/2001/XMLSchema#dateTime></td>
</tr>
</table>
<p>The matches are specific for the exact date, time and type. </p>
<p><strong>"Match time."</strong> What happens if we search for the time literal? We'll use the "time" variable with getStatements(), but just type the expected value into the SPARQL queries. </p>
<table width="1038" border="1">
<tr>
<td width="140"><strong>Query Type </strong></td>
<td width="368"><strong>Query</strong></td>
<td width="508"><strong>Matches which types? </strong></td>
</tr>
<tr>
<td><strong>getStatements()</strong></td>
<td>conn.getStatements(None, age, time)</td>
<td><p>"09:00:00Z"<br>
^^<http://www.w3.org/2001/XMLSchema#time><br>
</p></td>
</tr>
<tr>
<td><strong>SPARQL direct match </strong></td>
<td>SELECT ?s ?p WHERE {?s ?p "09:00:00Z"<br>
^^<http://www.w3.org/2001/XMLSchema#time> .}</td>
<td><p>"09:00:00Z"<br>
^^<http://www.w3.org/2001/XMLSchema#time></p></td>
</tr>
<tr>
<td><strong>SPARQL filter match </strong></td>
<td>SELECT ?s ?p ?o WHERE {?s ?p ?o . filter (?o = "09:00:00Z"^^<http://www.w3.org/2001/XMLSchema#time>)}</td>
<td>"09:00:00Z"<br>
^^<http://www.w3.org/2001/XMLSchema#time></td>
</tr>
</table>
<p>The matches are specific for the exact time and type. </p>
<p><strong>"Match datetime with offset."</strong> What happens if we search for a datetime with zulu offset? </p>
<table width="1038" border="1">
<tr>
<td width="140"><strong>Query Type </strong></td>
<td width="368"><strong>Query</strong></td>
<td width="508"><strong>Matches which types? </strong></td>
</tr>
<tr>
<td><strong>getStatements()</strong></td>
<td>conn.getStatements(None, age, datetimeOffset)</td>
<td><p>"1984-12-06T08:00:00Z"<br>
^^<http://www.w3.org/2001/XMLSchema#dateTime><br>
</p></td>
</tr>
<tr>
<td><strong>SPARQL direct match </strong></td>
<td>SELECT ?s ?p WHERE {?s ?p "1984-12-06T09:00:00+01:00"<br>
^^<http://www.w3.org/2001/XMLSchema#dateTime> .}</td>
<td><p>"1984-12-06T08:00:00Z"<br>
^^<http://www.w3.org/2001/XMLSchema#dateTime></p></td>
</tr>
<tr>
<td><strong>SPARQL filter match </strong></td>
<td><p>SELECT ?s ?p ?o WHERE {?s ?p ?o . filter (?o = "1984-12-06T09:00:00+01:00"^^<http://www.w3.org/2001/XMLSchema#dateTime>)}</p> </td>
<td>"1984-12-06T08:00:00Z"<br>
^^<http://www.w3.org/2001/XMLSchema#dateTime></td>
</tr>
</table>
<p>Note that we searched for "1984-12-06T09:00:00+01:00" but found "1984-12-06T08:00:00Z". It is the same moment in time. </p>
<h2 id="Importing Triples">Importing Triples (example6() and example7()) <a class="returnlink" href="#Contents">Return to Top</a></h2>
<p>
The Python Sesame API client can load triples in either RDF/XML format or NTriples format. The example below calls the connection object's <strong>add()</strong> method to load
an NTriples file, and <strong>addFile()</strong> to load an RDF/XML file. Both methods work, but the best practice is to use addFile(). </p>
<table width="769" border="2px" cellpadding="4px" style="border-collapse:collapse; border-color:#0000FF;">
<tr>
<td width="928"><strong>Note:</strong> If you get a "file not found" error while running this example, it means that Python is looking in the wrong directory for the data files to load. The usual explanation is that you have moved the tutorial_examples_40.py file to an unexpected directory. You can clear the issue by putting the data files in the same directory as tutorial_examples_40.py, or by setting the Python current working directory to the location of the data files using os.setcwd(). </td>
</tr>
</table>
<p>The RDF/XML file contains a short list of v-cards (virtual business cards), like this one:</p>
<pre> <rdf:Description rdf:about="http://somewhere/JohnSmith/"><br> <vCard:FN>John Smith</vCard:FN><br> <vCard:N rdf:parseType="Resource"><br> <vCard:Family>Smith</vCard:Family><br> <vCard:Given>John</vCard:Given><br> </vCard:N><br> </rdf:Description> </pre>
<p>The NTriples file contains a graph of resources describing the Kennedy family, the places where they were each born, their colleges, and their professions. A typical entry from that file looks like this:</p>
<pre><http://www.franz.com/simple#person1> <http://www.franz.com/simple#first-name> "Joseph" .
<http://www.franz.com/simple#person1> <http://www.franz.com/simple#middle-initial> "Patrick" .
<http://www.franz.com/simple#person1> <http://www.franz.com/simple#last-name> "Kennedy" .
<http://www.franz.com/simple#person1> <http://www.franz.com/simple#suffix> "none" .
<http://www.franz.com/simple#person1> <http://www.franz.com/simple#alma-mater> <http://www.franz.com/simple#Harvard> .
<http://www.franz.com/simple#person1> <http://www.franz.com/simple#birth-year> "1888" .
<http://www.franz.com/simple#person1> <http://www.franz.com/simple#death-year> "1969" .
<http://www.franz.com/simple#person1> <http://www.franz.com/simple#sex> <http://www.franz.com/simple#male> .
<http://www.franz.com/simple#person1> <http://www.franz.com/simple#spouse> <http://www.franz.com/simple#person2> .
<http://www.franz.com/simple#person1> <http://www.franz.com/simple#has-child> <http://www.franz.com/simple#person3> .
<http://www.franz.com/simple#person1> <http://www.franz.com/simple#profession> <http://www.franz.com/simple#banker> .
<http://www.franz.com/simple#person1> <http://www.franz.com/simple#birth-place> <http://www.franz.com/simple#place5> .
<http://www.franz.com/simple#person1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.franz.com/simple#person> . </pre>
<p>Note that AllegroGraph can segregate triples into contexts (subgraphs) by treating them as quads, but the NTriples and RDF/XML formats can not include context information. They deal with triples only, so there is no place to store a fourth field in those formats. In the case of the add() call, we have omitted the context
argument so the triples are loaded the default background graph (sometimes called the "null context<em>.</em>") The
addFile() call includes an explicit context setting, so the fourth argument of
each vcard triple will be the context named "/tutorial/vc_db_1_rdf".
The connection size() method takes an optional context argument. With no
argument, it returns the total number of triples in the repository. Below, it returns the number
'16' for the 'context' context argument, and the number '28' for the null context
(None) argument. </p>
<p>The example6() function of tutorial_examples_40.py creates a <a href="#Transaction Control">dedicated session</a> connection to AllegroGraph, using methods you have seen before, plus the Connection object's <strong>openSession()</strong> method: </p>
<pre class="input">def example6(close=True):<br> print "Starting example6()."<br> server = AllegroGraphServer(AG_HOST, AG_PORT, AG_USER, AG_PASSWORD)<br> catalog = server.openCatalog(AG_CATALOG) <br> myRepository = catalog.getRepository(AG_REPOSITORY, Repository.RENEW)<br> myRepository.initialize()<br> conn = myRepository.getConnection()<br> conn.clear()<br> conn.openSession()</pre>
<p>The dedicated session is not immediately pertinent to the examples in this section, but will become important in later examples that reuse this connection to demonstrate <a href="#Prolog Rule Queries">Prolog Rules</a> and <a href="#Social Network Analysis">Social Network Analysis</a>. </p>
<p>The variables path1 and path2 are bound to the RDF/XML and NTriples files, respectively. </p>
<pre class="input"> path1 = "./python-vcards.rdf" <br> path2 = "./python-kennedy.ntriples" </pre>
<p>The NTriples about the vcards will be added to a specific context, so naturally we need a URI to identify that context. </p>
<pre class="input"> context = conn.createURI("http://example.org#vcards")</pre>
<p>In the next step we use addFile() to load the vcard triples into the #vcards context: </p>
<pre class="input"> conn.addFile(path1, None, format=RDFFormat.RDFXML, context=context)</pre>
<p>Then we use add() to load the Kennedy family tree into the null context: </p>
<pre class="input"> conn.add(path2, base=None, format=RDFFormat.NTRIPLES, contexts=None)</pre>
<p>Now we'll ask AllegroGraph to report on how many triples it sees in the null context and in the #vcards context: </p>
<pre class="input"> print "After loading, repository contains %i vcard triples in context '%s'\n
and %i kennedy triples in context '%s'." % <br> (conn.size(context), context, conn.size('null'), 'null')<br> return conn</pre>
<p>The output of this report was:</p>
<pre class="output">After loading, repository contains 16 vcard triples in context 'http://example.org#vcards'<br> and 1214 kennedy triples in context 'null'. </pre>
<p>The SPARQL query below is found in example7() of tutorial_examples_40.py. It borrows the same triples we loaded in example6(), above, and runs two unconstrained retrievals. The first uses getStatement, and prints out the subject URI and context of each triple. </p>
<pre class="input">def example7(): <br> conn = example6()<br> print "Match all and print subjects and contexts"<br> result = conn.getStatements(None, None, None, None, limit=25)<br> for row in result: print row.getSubject(), row.getContext()</pre>
<p>This loop prints out a mix of triples from the null context and from the #vcards context. We set a limit of 25 triples because the Kennedy dataset contains over a thousand triples. </p>
<p>The following loop, however, does not produce the same results. This is a SPARQL query that should match all available triples, printing out the subject and context of each triple. We limited this query by using the DISTINCT keyword. Otherwise there would be many duplicate results. </p>
<pre class="input"> print "\nSame thing with SPARQL query (can't retrieve triples in the null context)"<br> queryString = "SELECT DISTINCT ?s ?c WHERE {graph ?c {?s ?p ?o .} }"<br> tupleQuery = conn.prepareTupleQuery(QueryLanguage.SPARQL, queryString)<br> result = tupleQuery.evaluate();<br> for i, bindingSet in enumerate(result):<br> print bindingSet[0], bindingSet[1]<br> conn.close()</pre>
<p>In this case, the loop prints out only v-card results. The SPARQL query is not able to access the null context when a non-null context is also present. </p>
<h2 id="Exporting Triples">Exporting Triples (example8() and example9()) <a class="returnlink" href="#Contents">Return to Top</a></h2>
<p>The next examples show how to write triples out to a file in either NTriples format or RDF/XML format. The output of either format may be optionally redirected to standard output (the Python command window) for inspection.</p>
<p>Example example8() begins by obtaining a connection object from example6(). This means the repository contains v-card triples in the <strong>#vcards</strong> context, and Kennedy family tree triples in the<strong> null </strong>context. </p>
<pre class="input">def example8():<br> conn = example6()</pre>
<p>In this example, we'll export the triples in the #vcards context. </p>
<pre class="input"> context = conn.createURI("http://example.org#vcards")</pre>
<p>To write triples in
NTriples format, call NTriplesWriter(). You have to tell it the path and file name of the exported file. If the output file argument is 'None', the writers write to standard
output. You can uncomment that line if you'd like to see it work. This code exports the vcards triples in ntriples format:</p>
<pre class="input"> outputFile = "/tmp/temp.nt"<br> #outputFile = None<br> if outputFile == None:<br> print "Writing RDF to Standard Out instead of to a file"<br> ntriplesWriter = NTriplesWriter(outputFile)<br> conn.export(ntriplesWriter, context);</pre>
<p>To write triples in RDF/XML format, call RDFXMLWriter(). This code exports the Kennedy triples in RDF/XML format.</p>
<pre class="input"> outputFile2 = "/tmp/temp.rdf"<br> #outputFile2 = None<br> if outputFile2 == None:<br> print "Writing NTriples to Standard Out instead of to a file"<br> rdfxmlfWriter = RDFXMLWriter(outputFile2) <br> conn.export(rdfxmlfWriter, 'null')</pre>
<p>
The <strong>export()</strong> method writes
out all triples in one or more contexts. This provides a convenient means for making
local backups of sections of your RDF store. The 'null' argument targets the triples of the default graph. If two or more contexts are specified,
then triples from all of those contexts will be written to<em> the same file</em>. Since the
triples are "mixed together" in the file, the context information is not recoverable. If the context argument is omitted, all triples in the store are written out, and again all context information is lost. </p>
<p>Finally, if the objective is to write out a filtered set of triples,
the <strong>exportStatements()</strong> method can be used. The example below (from<strong> example9()</strong>) writes
out all <strong>familyName</strong> triples from the vcards context to standard output. </p>
<pre class="input">
familyName = conn.createURI("http://www.w3.org/2001/vcard-rdf/3.0#FN")
conn.exportStatements(None, familyName, None, False, RDFXMLWriter(None), context)
</pre>
<h2 id="Datasets and Contexts">Searching Multiple Graphs (example10()) <a class="returnlink" href="#Contents">Return to Top</a></h2>
<p>
We have already seen contexts (subgraphs) at work when loading and saving files. In example10() we provide more realistic examples of contexts, and we explore the FROM, FROM DEFAULT, and FROM NAMED clauses of a SPARQL query to see how they interact with multiple subgraphs in the triple store. Finally, we will introduce the dataset object. A dataset is a list of contexts that should all be searched simultaneously. It is an object for use with SPARQL queries.
</p>
<p>To set up the example, we create six statements, and add two
of each to three different contexts: context1, context2, and the null context. The process of setting up the six statements follows the same pattern as we used in the previous examples: </p>
<pre class="input"> ## Create URIs for resources, predicates and classes.<br> exns = "http://example.org/people/"<br> alice = conn.createURI(namespace=exns, localname="alice")<br> bob = conn.createURI(namespace=exns, localname="bob")<br> ted = conn.createURI(namespace=exns, localname="ted")<br> person = conn.createURI(namespace=exns, localname="Person")<br> name = conn.createURI(namespace=exns, localname="name") <br> ## Create literal name values. <br> alicesName = conn.createLiteral("Alice") <br> bobsName = conn.createLiteral("Bob")<br> tedsName = conn.createLiteral("Ted") <br> ## Create URIs to identify the named contexts. <br> context1 = conn.createURI(namespace=exns, localname="context1") <br> context2 = conn.createURI(namespace=exns, localname="context2") </pre>
<p>The next step is to assert two triples into each of three contexts: </p>
<pre class="input"> ## Assemble new statements and add them to the contexts. <br> conn.add(alice, RDF.TYPE, person, context1)<br> conn.add(alice, name, alicesName, context1)<br> conn.add(bob, RDF.TYPE, person, context2)<br> conn.add(bob, name, bobsName, context2)<br> conn.add(ted, RDF.TYPE, person) // Added to null context<br> conn.add(ted, name, tedsName) // Added to null context</pre>
<p> Note that the final two statements (about Ted) were added to the null context (the unnamed default graph). </p>
<h3>GetStatements</h3>
<p> The first test uses <strong>getStatements()</strong> to return all triples in all contexts (context1, context2, and null). This is default search behavior, so there is no need to specify the contexts in the<strong> conn.getStatements()</strong> method. Note that <strong>conn.size()</strong> also reports on all contexts by default. </p>
<pre class="input"> statements = <strong>conn.getStatements(None, None, None)</strong><br> print "All triples in all contexts: %s" % <strong>(conn.size())</strong> <br> for s in statements:<br> print s</pre>
<p>The output of this loop is shown below. The context URIs are in the fourth position. Triples from the null context have no context value. </p>
<pre class="output">All triples in all contexts: 6<br>(<http://example.org/people/alice>, <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>, <http://example.org/people/Person>, <http://example.org/people/context1>)<br>(<http://example.org/people/alice>, <http://example.org/people/name>, "Alice", <http://example.org/people/context1>)<br>(<http://example.org/people/bob>, <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>, <http://example.org/people/Person>, <http://example.org/people/context2>)<br>(<http://example.org/people/bob>, <http://example.org/people/name>, "Bob", <http://example.org/people/context2>)<br>(<http://example.org/people/ted>, <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>, <http://example.org/people/Person>)<br>(<http://example.org/people/ted>, <http://example.org/people/name>, "Ted")</pre>
<!--
<p>Our second experiment explicitly asks for the triples in the null context:</p>
<pre class="input"> statements = conn.getStatements(None, None, None, ['null'])<br> print "All triples in null context: %s" % (conn.size(['null'])) <br> for s in statements:<br> print s</pre>
<p>Note that we identified the null context as ['null'], which is a tuple containing the value 'null'. That tuple can contain as many context URIs as necessary, as will will see in the next example. In this instance, getStatements() found two triples:</p>
<pre class="output">All triples in null context: 2<br>(<http://example.org/people/ted>, <http://example.org/people/name>, "Ted")<br>(<http://example.org/people/ted>, <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>, <http://example.org/people/Person>) </pre>
-->
<p>The next match explicitly lists 'context1' and 'context2' as the only contexts to participate in the match. It returns four statements.
The conn.size() method can also address individual contexts.</p>
<pre class="input"> statements = conn.getStatements(None, None, None, [context1, context2])<br> print "Triples in contexts 1 or 2: %s" % (conn.size([context1, context2]))<br> for s in statements:<br> print s</pre>
<p>The output of this loop shows that the triples in the null context have been excluded. </p>
<pre class="output">Triples in contexts 1 or 2: 4<br>(<http://example.org/people/bob>, <http://example.org/people/name>, "Bob", <http://example.org/people/context2>)<br>(<http://example.org/people/bob>, <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>, <http://example.org/people/Person>, <http://example.org/people/context2>)<br>(<http://example.org/people/alice>, <http://example.org/people/name>, "Alice", <http://example.org/people/context1>)<br>(<http://example.org/people/alice>, <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>, <http://example.org/people/Person>, <http://example.org/people/context1>)</pre>
<p>This time we use getStatements() to search explicitly for triples in the null context and in context 2.</p>
<pre class="input"> statements = conn.getStatements(None, None, None, ['null', context2])<br> print "Triples in contexts null or 2: %s" % (conn.size(['null', context2]))<br> for s in statements:<br> print s</pre>
<p>The output of this loop is:</p>
<pre class="output">Triples in contexts null or 2: 4<br>(<http://example.org/people/bob>, <http://example.org/people/name>, "Bob", <http://example.org/people/context2>)<br>(<http://example.org/people/bob>, <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>, <http://example.org/people/Person>, <http://example.org/people/context2>)<br>(<http://example.org/people/ted>, <http://example.org/people/name>, "Ted")<br>(<http://example.org/people/ted>, <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>, <http://example.org/people/Person>)</pre>
<p> The lesson is that getStatements() can freely mix triples from the null context and named contexts. It is all you need as long as the query is a very simple one. </p>
<h3>SPARQL using FROM, FROM DEFAULT, and FROM NAMED </h3>
<p>In many of our examples we have used a simple SPARQL query to retrieve triples from AllegroGraph's default graph. This has been very convenient but it is also misleading. As soon as we tell SPARQL to search a <em>specific</em> graph, we lose the ability to search AllegroGraph's default graph! Triples from the null graph vanish from the search results. Why is that? </p>
<ul>
<li style="margin-bottom: 15px ">It is important to understand that AllegroGraph and SPARQL use the phrase "default graph" to identify two very different things. AllegroGraph's default graph, or null context, is simply the set of all triples that have "null" in the fourth field of the "triple." The "default graph" is an <em>unnamed subgraph</em> of the AllegroGraph triple store. </li>
<li>SPARQL uses "default graph" to describe something that is very different. In SPARQL, the "default graph" is a temporary pool of triples imported from one or more "named" graphs. SPARQL's "default graph" is constructed and discarded in the service of a single query. </li>
</ul>
<p>Standard SPARQL was designed for <em>named graphs only</em>, and has no syntax to indentify a truly unnamed graph. AllegroGraph's SPARQL, however, has been extended to allow the unnamed graph to participate in multi-graph queries. </p>
<p>We can use AllegroGraph's SPARQL to search specific subgraphs in three ways. We can create a temporary "default graph" using the FROM operator; we can put AllegroGraph's unnamed graph into SPARQL's default graph using FROM DEFAULT; or we can target specific named graphs using the FROM NAMED operator. </p>
<ul>
<li style="margin-bottom: 15px "><strong>FROM</strong> takes one (or more) subgraphs identified by their URIs and temporarily turns them into a single default graph. We match triples in this graph using simple (non-GRAPH) patterns. </li>
<li style="margin-bottom: 15px "><strong>FROM DEFAULT</strong> takes AllegroGraph's null graph and temporarily makes it part of SPARQL's default graph. Again, we use simple patterns to match this graph. </li>
<li><strong>FROM NAMED</strong> takes one (or more) named graphs, and declares them to be named graphs in the query. Named graphs must be addressed using explicit GRAPH patterns. </li>
</ul>
<p>We can also combine these operators in a single query, to search the SPARQL default graph and one or more named graphs at the same time.
<p>The first example is a SPARQL query that used FROM DEFAULT to place AllegroGraph's unnamed graph into SPARQL's default graph.
<pre class="input">SELECT ?s ?p ?o FROM DEFAULT <br>WHERE {?s ?p ?o . }</pre>
<p>This query finds triples from the unnamed graph only (which are triples about Ted). Note the simple query pattern.
<pre class="output">['<http://example.org/people/ted>', '<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>', '<http://example.org/people/Person>']<br>['<http://example.org/people/ted>', '<http://example.org/people/name>', '"Ted"']
</pre>
<p>Here's an example of a query that uses FROM. It instructs SPARQL to regard context1 as the default graph for the purposes of this query.
<pre class="input">SELECT ?s ?p ?o
FROM <http://example.org/people/context1>
WHERE {?s ?p ?o . }</pre>
<p>SPARQL uses the simple pattern {?s ?p ?o . } to match triples in context1, which is the temporary default graph:</p>
<pre class="output">['<http://example.org/people/alice>', '<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>', '<http://example.org/people/Person>']<br>['<http://example.org/people/alice>', '<http://example.org/people/name>', '"Alice"']</pre>
<p>Notice that these query results do not have the fourth value we have come to expect. That was stripped off when context1 became the (temporary) default context. </p>
<p>The next example changes FROM to FROM NAMED in the same query:</p>
<pre class="input">SELECT ?s ?p ?o
FROM NAMED <http://example.org/people/context1>
WHERE {?s ?p ?o . }</pre>
<p>This time there are no matches! The pattern {?s ?p ?o . } only matches the SPARQL default graph. We declared context1 to be a "named" graph, so it is no longer the default graph. To match triples in named graphs, SPARQL requires a GRAPH pattern: </p>
<pre class="input">SELECT ?s ?p ?o ?g
FROM NAMED <http://example.org/people/context1>
WHERE {GRAPH ?g {?s ?p ?o . }}";</pre>
<p>When we combine GRAPH with FROM NAMED, we get the expected matches: </p>
<pre class="output">['<http://example.org/people/alice>', '<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>', '<http://example.org/people/Person>', '<http://example.org/people/context1>']<br>['<http://example.org/people/alice>', '<http://example.org/people/name>', '"Alice"', '<http://example.org/people/context1>']</pre>
<p>What about a combination query? The graph commands can be mixed in a single query.</p>
<pre class="input">SELECT ?s ?p ?o ?g <br>FROM DEFAULT<br>FROM <http://example.org/people/context1><br>FROM NAMED <http://example.org/people/context2> <br>WHERE {{GRAPH ?g {?s ?p ?o . }} UNION {?s ?p ?o .}}</pre>
<p>This query puts AllegroGraph's unnamed graph and the context1 graph into SPARQL's default graph, where the triples can be found by using a simple {?s ?p ?o . } query. Then it identifies context2 as a named graph, which can be searched using a GRAPH pattern. In the final line, we used a UNION operator to combine the matches of the simple and GRAPH patterns. </p>
<p>This query should find all six triples, and here they are: </p>
<pre class="output">['<http://example.org/people/bob>', '<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>', '<http://example.org/people/Person>', '<http://example.org/people/context2>']<br>['<http://example.org/people/bob>', '<http://example.org/people/name>', '"Bob"', '<http://example.org/people/context2>']<br>['<http://example.org/people/alice>', '<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>', '<http://example.org/people/Person>']<br>['<http://example.org/people/alice>', '<http://example.org/people/name>', '"Alice"']<br>['<http://example.org/people/ted>', '<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>', '<http://example.org/people/Person>']<br>['<http://example.org/people/ted>', '<http://example.org/people/name>', '"Ted"'] </pre>
<h3>SPARQL with Dataset Object</h3>
<p>Next, we switch to SPARQL queries where the subgraphs are constrained by Sesame dataset objects. First we'll run the wide-open SPARQL query to see what it finds. In the next two SPARQL examples, we will control the scope of the search by using datasets. A dataset contains lists of contexts to search, and is applied to the tupleQuery object to control the scope of the search. </p>
<p>Here's the wide-open search, which contains no information about which graph we want to search:</p>
<pre class="input"> queryString = """<br> SELECT ?s ?p ?o WHERE {?s ?p ?o . } <br> """<br> tupleQuery = conn.prepareTupleQuery(QueryLanguage.SPARQL, queryString)<br> result = tupleQuery.evaluate(); <br> print "No dataset restrictions."<br> for bindingSet in result:<br> print bindingSet.getRow()</pre>
<p>In this case the query returns triples from AllegroGraph's default graph <em>and </em>from both named graphs. This accommodates the person who just wants to "search everything." </p>
<pre class="output">No dataset restrictions.<br>['<http://example.org/people/alice>', '<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>', '<http://example.org/people/Person>']<br>['<http://example.org/people/alice>', '<http://example.org/people/name>', '"Alice"']<br>['<http://example.org/people/bob>', '<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>', '<http://example.org/people/Person>']<br>['<http://example.org/people/bob>', '<http://example.org/people/name>', '"Bob"']<br>['<http://example.org/people/ted>', '<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>', '<http://example.org/people/Person>']<br>['<http://example.org/people/ted>', '<http://example.org/people/name>', '"Ted"']</pre>
<p>A dataset object is a Sesame construct that contains two lists of named graphs. There is one list of graphs that will become the SPARQL default graph, just like using FROM in the query. There is a second list of graphs that will be "named" graphs in the query, just like using FROM NAMED. To use the dataset, we put the graph URIs into the dataset object, and then add the dataset to the tupleQuery object. When we evaluate the tupleQuery, the results will be confined to the graphs listed in the dataset. </p>
<p>The next example shows how to use an AllegroGraph <strong>dataset</strong> object in an exceptional way, to restrict the SPARQL query to the triples in AllegroGraph's default graph. The dataset.addDefaultGarph() method accepts "null" as the name of AllegroGraph's default graph. This lets us direct a SPARQL query at AllegoGraph's default graph. </p>
<pre class="input"> queryString = """<br> SELECT ?s ?p ?o WHERE {?s ?p ?o . } <br> """<br> ds = Dataset()<br> <strong>ds.addDefaultGraph('null')</strong><br> tupleQuery = conn.prepareTupleQuery(QueryLanguage.SPARQL, queryString)<br> tupleQuery.setDataset(ds) <br> result = tupleQuery.evaluate(); <br> print "SPARQL query over the null context."<br> for bindingSet in result:<br> print bindingSet.getRow()</pre>
<p>The output of this loop is the two triples that are in the default graph:</p>
<!-- TODO Java was returning six triples, should be two. -->
<pre class="output">SPARQL query over the null context.<br>['<http://example.org/people/ted>', '<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>', '<http://example.org/people/Person>']<br>['<http://example.org/people/ted>', '<http://example.org/people/name>', '"Ted"']</pre>
<p>In the next example we'll add a graph to the dataset using the<strong> addNamedGraph() </strong>method. This time the wide-open query is restricted to only those statements in context1, which will be treated as a "named graph" in the query:</p>
<pre class="input"> queryString = """<br> SELECT ?s ?p ?o WHERE {?s ?p ?o . } <br> """<br> ds = Dataset()<br> <strong>ds.addNamedGraph(context1)</strong><br> tupleQuery = conn.prepareTupleQuery(QueryLanguage.SPARQL, queryString)<br> tupleQuery.setDataset(ds)<br> result = tupleQuery.evaluate(); <br> print "SPARQL query over context1, no GRAPH pattern."<br> for bindingSet in result:<br> print bindingSet.getRow()</pre>
<p>The output of this query is somewhat unexpected. The query returns no results! </p>
<pre class="output">SPARQL query over context1, no GRAPH pattern.</pre>
<p>Why did this happen? Once we explicitly identify a subgraph as a "named graph" in the query, SPARQL insists that we use a GRAPH pattern. The following example uses a dataset to target context1, and adds a GRAPH element to the query. This small change lets us focus on one subgraph only. </p>
<pre class="input"> queryString = """<br><strong> SELECT ?s ?p ?o ?c<br> WHERE { GRAPH ?c {?s ?p ?o . } } </strong><br> """<br> ds = Dataset()<br> ds.addNamedGraph(context1)<br> tupleQuery = conn.prepareTupleQuery(QueryLanguage.SPARQL, queryString)<br> tupleQuery.setDataset(ds)<br> result = tupleQuery.evaluate(); <br> print "SPARQL query over context1, with GRAPH pattern."<br> for bindingSet in result:<br> print bindingSet.getRow()</pre>
<p>The output of this loop contains two triples, as expected. These are the triples from context1.</p>
<pre class="output">SPARQL query over context1, with GRAPH pattern.<br>['<http://example.org/people/alice>', '<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>', '<http://example.org/people/Person>', '<http://example.org/people/context1>']<br>['<http://example.org/people/alice>', '<http://example.org/people/name>', '"Alice"', '<http://example.org/people/context1>']</pre>
<p>One naturally wonders what the SPARQL GRAPH query would find if we got out of its way and ran it without any dataset restrictions. Here it is:</p>
<pre class="input"> queryString = """<br> SELECT ?s ?p ?o ?c<br> WHERE { GRAPH ?c {?s ?p ?o . } } <br> """<br> tupleQuery = conn.prepareTupleQuery(QueryLanguage.SPARQL, queryString)<br> result = tupleQuery.evaluate(); <br> print "SPARQL query with GRAPH pattern, no context constraints."<br> for bindingSet in result:<br> print bindingSet.getRow()</pre>
<p>The output of this loop contains four triples, two from each of the named subgraphs in the store (context1 and context2). The query was not able to find the triples that were in the AllegroGraph default graph. </p>
<pre class="output">SPARQL query with GRAPH pattern, no context constraints.<br>['<http://example.org/people/alice>', '<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>', '<http://example.org/people/Person>', '<http://example.org/people/context1>']<br>['<http://example.org/people/alice>', '<http://example.org/people/name>', '"Alice"', '<http://example.org/people/context1>']<br>['<http://example.org/people/bob>', '<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>', '<http://example.org/people/Person>', '<http://example.org/people/context2>']<br>['<http://example.org/people/bob>', '<http://example.org/people/name>', '"Bob"', '<http://example.org/people/context2>']</pre>
<h2 id="Namespaces">Namespaces (example11()) <a class="returnlink" href="#Contents">Return to Top</a></h2>
<p>
A <i>namespace</i> is that portion of a URI that preceeds the last '#',
'/', or ':' character, inclusive. The remainder of a URI is called the
<i>localname</i>. For example, with respect to the URI "http://example.org/people/alice",
the namespace is "http://example.org/people/" and the localname is "alice".
When writing SPARQL queries, it is convenient to define prefixes or nicknames
for the namespaces, so that abbreviated URIs can be specified. For example,
if we define "ex" to be a nickname for "http://example.org/people/", then the
string "ex:alice" is a recognized abbreviation for "http://example.org/people/alice".
This abbreviation is called a <i>qname</i>.
</p>
<p>
In the SPARQL query in the example below, we see two qnames, "rdf:type" and
"ex:alice". Ordinarily, we would expect to see "PREFIX" declarations in
SPARQL that define namespaces for the "rdf" and "ex" nicknames. However,
the Connection and Query machinery can do that job for you. The
mapping of prefixes to namespaces includes the built-in prefixes RDF, RDFS, XSD, and OWL.
Hence, we can write "rdf:type" in a SPARQL query, and the system already knows
its meaning. In the case of the 'ex' prefix, we need to instruct it. The
setNamespace() method of the connection object registers a new namespace. In the example
below, we first register the 'ex' prefix, and then submit the SPARQL query.
It is legal, although not recommended, to redefine the built-in prefixes RDF, etc..
</p>
<p>The example example11() begins by borrowing a connection object from example1(). </p>
<pre class="input">def example11():<br> conn = example1()</pre>
<p>We need a namespace string (bound to the variable <strong>exns</strong>) to use when generating the <strong>alice</strong> and <strong>person</strong> URIs. </p>
<pre class="input">
exns = "http://example.org/people/"<br> alice = conn.createURI(namespace=exns, localname="alice")<br> person = conn.createURI(namespace=exns, localname="Person")</pre>
<p>Now we can assert Alice's RDF:TYPE triple. </p>
<pre class="input">
conn.add(alice, RDF.TYPE, person)</pre>
<p>Now we register the exns namespace with the connection object, so we can use it in a SPARQL query. The query looks for triples that have "rdf:type" in the predicate position, and "ex:Person" in the object position. </p>
<pre class="input">
conn.setNamespace('ex', exns)<br> queryString = """<br> SELECT ?s ?p ?o <br> WHERE { ?s ?p ?o . FILTER ((?p = rdf:type) && (?o = ex:Person) ) }<br> """<br> tupleQuery = conn.prepareTupleQuery(QueryLanguage.SPARQL, queryString)<br> result = tupleQuery.evaluate(); <br> print <br> for bindingSet in result:<br> print bindingSet[0], bindingSet[1], bindingSet[2]</pre>
<p>The output shows the single triple with its fully-expanded URIs. This demonstrates that the qnames in the SPARQL query successfully matched the fully-expanded URIs in the triple. </p>
<pre class="output">http://example.org/people/alice http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://example.org/people/Person</pre>
<p>It is worthwhile to briefly discuss performance here. In the current
AllegroGraph system, queries run more efficiently if constants appear inside
of the "where" portion of a query, rather than in the "filter" portion. For
example, the SPARQL query below will evaluate more efficiently than the one
in the above example. However, in this case, you have lost the ability to
output the constants "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" and
"http://example.org/people/alice". Occasionally you may find it useful to
output constants in the output of a 'select' clause; in general though,
the above code snippet illustrates a query syntax that is discouraged. </p>
<pre class="input">
SELECT ?s
WHERE { ?s rdf:type ex:person }
</pre>
<h2 id="Free Text Search">Free Text Search (example12()) <a class="returnlink" href="#Contents">Return to Top</a></h2>
<p>
It is common for users to build RDF applications that combine
some form of "keyword search" with their queries. For example, a user
might want to retrieve all triples for which the string "Alice" appears
as a word within the third (object) argument to the triple. AllegroGraph
provides a capability for including free text matching within a SPARQL
query, and also by using the <strong>evalFreeTextSearch()</strong> method of the connection object. It requires, however, that you create and configure indexes appropriate to the searches you want to pursue. </p>
<p> Example12() begins by borrowing the connection object from example1(). Then it creates a namespace string and registers the namespace with the connection object, as in the previous example. </p>
<pre class="input">def example12():<br> conn = example1()<br> conn.clear() <br> exns = "http://example.org/people/"<br> conn.setNamespace('ex', exns)</pre>
<p>We have to create an index. AllegroGraph lets you create any number of text indexes, each for a specific purpose. In this case we are indexing the literal values we find in the "fullname" predicate, which we will use in resources that describe people. The createFreeTextIndex() method has many configurable parameters. Their default settings are appropriate to this situation. All we have to provide is a name for the index and the URI of the predicate (or predicates) that contain the text to be indexed. </p>
<pre class="input"> conn.createFreeTextIndex("index1", predicates=[URI(namespace=exns, localname='fullname')])</pre>
<p>We can view the index configuration using the <strong>getFreeTextIndexConfiguration()</strong> method: </p>
<pre class="input"> config = conn.getFreeTextIndexConfiguration("index1")<br> print(config)<br> for item in config["predicates"]:<br> print(item)</pre>
<p>The configuration object is a simple Python dictionary. Most of it is easy to interpret, but the predicate list has to be extracted before we see the actual predicates:</p>
<pre>{'indexLiterals': True, 'minimumWordSize': 3, 'indexFields': ['object'],
'stopWords': ['and', 'are', 'but', 'for', 'into', 'not', 'such', 'that', 'the',
'their', 'then', 'there', 'these', 'they', 'this', 'was', 'will', 'with'],
'predicates': [<franz.openrdf.model.value.URI object at 0x025831F0>],
'wordFilters': [], 'indexResources': False}
<br><http://example.org/people/fullname></pre>
<p>This configuration says that "index1" will operate on the literal values it finds in the object position of the <strong><http://example.org/people/fullname></strong> predicate. It ignores words smaller than three characters in length. It will ignore the worlds in its "stopWords" list. If it encounters a resource URI in the object position, it will ignore it. This index doesn't use any wordFilters, which are sometimes used to remove accented letters and to perform stemming on indexed text and search strings. </p>
<p>The next step is to create three new resources. One is a person, "Alice," whose full name is "Alice B. Toklas." There will also be a book, "Alice in Wonderland," which is linked to an author resource, "Lewis Carroll." The first step is to create some URIs and literal values: </p>
<pre class="input"> alice = conn.createURI(namespace=exns, localname="alice")<br> carroll = conn.createURI(namespace=exns, localname="carroll")<br> persontype = conn.createURI(namespace=exns, localname="Person")<br> fullname = conn.createURI(namespace=exns, localname="fullname") <br> alicename = conn.createLiteral('Alice B. Toklas')
<br> book = conn.createURI(namespace=exns, localname="book1")<br> booktype = conn.createURI(namespace=exns, localname="Book")<br> booktitle = conn.createURI(namespace=exns, localname="title")<br> author = conn.createURI(namespace=exns, localname="author") <br> wonderland = conn.createLiteral('Alice in Wonderland')
<br> lewisCarroll = conn.createLiteral('Lewis Carroll')</pre>
<p>Add the resource for the new person, Alice B. Toklas: </p>
<pre class="input"> # Creating Alice B. Toklas resource <br> conn.add(alice, RDF.TYPE, persontype)<br> conn.add(alice, fullname, alicename)</pre>
<p>Add the new book, <em>Alice in Wonderland</em>. </p>
<pre class="input"> # Creating Alice in Wonderland book resource<br> conn.add(book, RDF.TYPE, booktype) <br> conn.add(book, booktitle, wonderland) <br> conn.add(book, author, carroll)</pre>
<p>Note that the book's author predicate links to the resource URI of the Lewis Carroll author resource. The author is a Person with a fullname:</p>
<pre class="input"> # Creating Lewis Carrol resource<br> conn.add(carroll, fullname, lewisCarroll)<br> conn.add(carroll, RDF.TYPE, persontype)</pre>
<p>Let's use getStatements() to retrieve the new triples and inspect them:</p>
<pre class="output">Current content of triple store:<br>(<http://example.org/people/alice>, <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>, <http://example.org/people/Person>)<br>(<http://example.org/people/alice>, <http://example.org/people/fullname>, "Alice B. Toklas")<br>
(<http://example.org/people/book1>, <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>, <http://example.org/people/Book>)<br>(<http://example.org/people/book1>, <http://example.org/people/title>, "Alice in Wonderland")<br>(<http://example.org/people/book1>, <http://example.org/people/author>, <http://example.org/people/carroll>)<br>
(<http://example.org/people/carroll>, <http://example.org/people/fullname>, "Lewis Carroll")<br>(<http://example.org/people/carroll>, <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>, <http://example.org/people/Person>) </pre>
<p>Now we set up the SPARQL query that looks for triples containing "Alice" in the object position. </p>
<p>The text match occurs through a "magic" predicate called <strong>fti:match</strong>. This is not an RDF "predicate" but a LISP "predicate," meaning that it behaves as a true/false test. This predicate has two arguments. One is the subject URI of the resources to search. The other is the string pattern to search for, such as "Alice". Only full-word matches will be found. </p>
<pre class="input"> queryString = """<br> SELECT ?s ?p ?o<br> WHERE { ?s ?p ?o .
?s fti:match 'Alice' . }<br> """<br> tupleQuery = conn.prepareTupleQuery(QueryLanguage.SPARQL, queryString)<br> result = tupleQuery.evaluate(); </pre>
<p>There is no need to include a prefix declaration for the 'fti' nickname. That is because 'fti' is included among the built-in namespace/nickname mappings in AllegroGraph.</p>
<p>When we execute our SPARQL query, it matches the "Alice" within the literal "Alice B. Toklas" because that literal occurs in a triple having the <strong>fullname</strong> predicate, but it does not match the "Alice" in the literal "Alice in Wonderland" because the <strong>booktitle</strong> predicate was not included in our index. The SPARQL query returns <em>all of the triples of the matching resource</em>, not just the one that matched the text search. </p>
<pre class="input"> print "Found %i query results" % len(result) <br> count = 0<br> for bindingSet in result:<br> print bindingSet<br> count += 1<br> if count > 5: break</pre>
<p>The output of this loop is:</p>
<pre class="output">Found 2 query results<br>{'p': 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 's': 'http://example.org/people/alice1', 'o': 'http://example.org/people/Person'}
{'p': 'http://example.org/people/fullname', 's': 'http://example.org/people/alice1', 'o': '"Alice B. Toklas"'}</pre>
<p>Note that the result set included both the matching triple and the<strong> rdf:type</strong> triple from the same resource. SPARQL returns the entire resource, not just the matching triple. </p>
<p>As it happens, the SPARQL interface to text search does not let you specify which index(es) to use, so SPARQL queries use <em>all</em> of the text indexes in the system. If you want to limit the search to a specific index, use the <strong>evalFreeTextSearch()</strong> method of the connection object:</p>
<pre class="input"> print("\nEvalFreeTextSearch() match 'Alice' in index1.")<br> for triple in conn.evalFreeTextSearch("Alice", index="index1"):<br> print " " + str(triple)</pre>
<p>Unlike SPARQL, evalFreeTextSearch() returns only the matching triple:</p>
<pre class="output">EvalFreeTextSearch() match 'Alice' in index1.<br> ['<http://example.org/people/alice>', '<http://example.org/people/fullname>', '"Alice B. Toklas"']</pre>
<p>The text index supports simple wildcard queries. The asterisk (*) may be appended to the end of the pattern to indicate "any number of additional characters." For instance, this query looks for whole words that begin with "Ali":</p>
<pre class="input"> queryString = """<br> SELECT ?s ?p ?o<br> WHERE { ?s ?p ?o . ?s fti:match 'Ali*' . }<br> """</pre>
<p>It finds the same two triples as before.</p>
<p>There is also a single-character wildcard, the questionmark. You can add as many question marks as you need to the string pattern. This query looks for a five-letter word that has "l" in the second position, and "c" in the fourth position:</p>
<pre class="input"> queryString = """<br> SELECT ?s ?p ?o<br> WHERE { ?s ?p ?o . ?s fti:match '?l?c?' . }<br> """</pre>
<p>This query finds the same two triples as before. </p>
<p>This time we'll do something a little different. The free text indexing matches whole words only, even when using wildcards. What if you really need to match a substring in a word of unknown length. You can write a SPARQL query that performs a regex match against object values. This can be inefficient compared to indexed search, and the match is not confined to the registered free-text predicates. The following query looks for the substring "lic" in literal object values:</p>
<pre class="input"> queryString = """<br> SELECT ?s ?p ?o<br> WHERE { ?s ?p ?o . FILTER regex(?o, "lic") }<br> """</pre>
<p>This query returns two triples, but they are not quite the same as before:</p>
<pre class="output">Substring match for 'lic'<br>Found 2 query results<br>{'p': 'http://example.org/people/fullname', 's': 'http://example.org/people/alice1', 'o': '"Alice B. Toklas"'}<br>{'p': 'http://example.org/people/title', 's': 'http://example.org/people/book1', 'o': '"Alice in Wonderland"'} </pre>
<p>As you can see, the regex match found "lic" in "Alice in Wonderland," which was not a registered free-text predicate. It made this match by doing a string comparison against every object value in the triple store. Even though you can streamline the SPARQL query considerably by writing more restrictive patterns, this is still inherently less efficient than using the indexed approach. </p>
<p>Note that evalFreeTextSearch() does not offer any way to do a regex substring search. </p>
<p>In addition to indexing literal values, AllegroGraph can also index resource URIs. "Index2" is an index that looks for URIs in the object position of the "author" predicate, and then indexes only the "short" name of the resource (the characters following the rightmost / or # in the URI). This lets us avoid indexing highly-repetitive namespace strings, which would fill the index with data that would not be very useful. </p>
<pre class="input"> conn.createFreeTextIndex("index2", predicates=[URI(namespace=exns, localname='author')],<br> indexResources="short", indexFields=["object"])</pre>
<p>Now we'll search for the string "Carroll" in "index2:"</p>
<pre class="input"> print("\nMatch 'Carroll' in index2.")<br> for triple in conn.evalFreeTextSearch("Carroll", index="index2"):<br> print " " + str(triple)</pre>
<pre class="output">
Match 'Carroll' in index2.<br> ['<http://example.org/people/book1>', '<http://example.org/people/author>', '<http://example.org/people/carroll>']
</pre>
<p>The text search located the triple that has "Carroll" in the URI in the object position. </p>
<h2 id="Ask, Describe, and Construct Queries">Select, Ask, Describe, and Construct Queries (example13()) <a class="returnlink" href="#Contents">Return to Top</a></h2>
<p>SPARQL provides alternatives to the standard SELECT query. Example example13() exercises these alternatives to show how AllegroGraph Server handles them. </p>
<ul>
<li> SELECT: Returns variables bound in a query pattern match. </li>
<li>ASK: Returns a boolean indicating whether a query matches or not. </li>
<li>CONSTRUCT: Returns triples constructed by substituting variables in a set of triple templates. </li>
<li>DESCRIBE: Returns all of the triples of a matching resource. </li>
</ul>
<p>The example begins by borrowing a connection object from example6(). This connects to a repository that contains vcard and Kennedy data. We'll need to register a Kennedy namespace to make the queries easier to read. <pre class="input">def example13():<br> conn = example6(False) # kennedy and vcards data
conn.setNamespace("kdy", "http://www.franz.com/simple#")</pre>
<p>As it happens, we don't need the vcard data this time, so we'll remove it. This is an example of how to delete an entire subgraph (the vcards "context"):</p>
<pre class=input> context = conn.createURI("http://example.org#vcards")<br> conn.remove(None, None, None, context)</pre>
<p>The example begins with a SELECT query so we can see some of the Kennedy resources. </p>
<pre class="input"> queryString = """select ?s where { ?s rdf:type kdy:person} limit 5"""<br> tupleQuery = conn.prepareTupleQuery(QueryLanguage.SPARQL, queryString)<br> result = tupleQuery.evaluate();<br> print "\nSELECT some persons"<br> for r in result: print r </pre>
Note that SELECT returns variable bindings. In this case it returns subject URIs of five people:
<pre class="output">SELECT some persons<br>{'s': u'<http://www.franz.com/simple#person1>'}<br>{'s': u'<http://www.franz.com/simple#person2>'}<br>{'s': u'<http://www.franz.com/simple#person3>'}<br>{'s': u'<http://www.franz.com/simple#person4>'}<br>{'s': u'<http://www.franz.com/simple#person5>'}</pre>
<p>The ASK query returns a Boolean, depending on whether the triple pattern matched any triples. In this case we ran two tests; one seeking "John" and the other looking for "Alice." Note that the ASK query uses a different construction method than the SELECT query:<strong> prepareBooleanQuery()</strong>. </p>
<pre class="input"> queryString = """ask { ?s kdy:first-name "John" } """<br> booleanQuery = conn.prepareBooleanQuery(QueryLanguage.SPARQL, queryString)<br> result = booleanQuery.evaluate(); <br> print "\nASK: Is there anyone named John?", result
<br> queryString = """ask { ?s kdy:first-name "Alice" } """<br> booleanQuery = conn.prepareBooleanQuery(QueryLanguage.SPARQL, queryString)<br> result = booleanQuery.evaluate(); <br> print "\nASK: Is there an Alice?", result</pre>
<p>The output of this loop is:</p>
<pre class="output">ASK: Is there anyone named John? True
ASK: Is there an Alice? False</pre>
<p>The CONSTRUCT query contructs a statement object out of the matching values in the triple pattern. A "statement" is a client-side triple. Construction queries use <strong>prepareGraphQuery()</strong>. The point is that the query can bind variables from existing triples and then "construct" a<em> new triple</em> by recombining the values. This query constructs new triples using a <strong>kdy:has-grandchild</strong> predicate. </p>
<pre class="input"> queryString = """<br> construct {?a kdy:has-grandchild ?c} <br> where { ?a kdy:has-child ?b . <br> ?b kdy:has-child ?c . } <br> """<br> constructQuery = conn.prepareGraphQuery(QueryLanguage.SPARQL, queryString)<br> result = constructQuery.evaluate(); </pre>
<p>The CONSTRUCT query does not actually add the new triples to the store. You have to iterate through the results and add them yourself: </p>
<pre class="input"> print "/nConstruct result, creating new has-grandchild triples:"<br> for st in result:<br> conn.add(st.getSubject(), st.getPredicate(), st.getObject())</pre>
<p>The DESCRIBE query returns a "graph," meaning all triples of the matching resources. It uses <strong>prepareGraphQuery()</strong>. In this case we asked SPARQL to describe one grandparent and one grandchild. (This confirms that the kdy:has-grandchild triples successfully entered the triple store.) </p>
<pre class="input"> queryString = """describe ?s ?o where { ?s kdy:has-grandchild ?o . } limit 1"""<br> describeQuery = conn.prepareGraphQuery(QueryLanguage.SPARQL, queryString)<br> result = describeQuery.evaluate(); <br> print "Describe one grandparent and one grandchild:"<br> for st in result: print st </pre>
<p>The output of this loop is lengthy, because the Kennedy resources have many triples. One block of triples looked like this, showing the new has-grandchild triples: </p>
<pre class="output">(<http://www.franz.com/simple#person1>, <http://www.franz.com/simple#has-grandchild>, <http://www.franz.com/simple#person20>)<br>(<http://www.franz.com/simple#person1>, <http://www.franz.com/simple#has-grandchild>, <http://www.franz.com/simple#person22>)<br>(<http://www.franz.com/simple#person1>, <http://www.franz.com/simple#has-grandchild>, <http://www.franz.com/simple#person24>)<br>(<http://www.franz.com/simple#person1>, <http://www.franz.com/simple#has-grandchild>, <http://www.franz.com/simple#person25>)<br>(<http://www.franz.com/simple#person1>, <http://www.franz.com/simple#has-grandchild>, <http://www.franz.com/simple#person26>)</pre>
<h2 id="Parametric Queries">Parametric Queries (example14()) <a class="returnlink" href="#Contents">Return to Top</a></h2>
<p>The Python Sesame API to AllegroGraph Server lets you set up a SPARQL query and then fix the value of one of the query variables prior to matching the triples. This is more efficient than testing for the same value in the body of the query. </p>
<p>In <strong>example14()</strong> we set up two-triple resources for Bob and Alice, and then use an unconstrained SPARQL query to retrieve the triples. Normally this query would find all four triples, but by binding the subject value ahead of time, we can retrieve the "Bob" triples separately from the "Alice" triples.</p>
<p>The example begins by borrowing a connection object from example2(). This means there are already Bob and Alice resources in the repository. We do need to recreate the URIs for the two resources, however. </p>
<pre class="input">def example14():<br> conn = example2()<br> alice = conn.createURI("http://example.org/people/alice")<br> bob = conn.createURI("http://example.org/people/bob")</pre>
<p>The SPARQL query is the simple, unconstrained query that returns all triples. We use <strong>prepareTupleQuery()</strong> to create the query object. </p>
<pre class="input">
queryString = """select ?s ?p ?o where { ?s ?p ?o} """<br> tupleQuery = conn.prepareTupleQuery(QueryLanguage.SPARQL, queryString)</pre>
<p>Before evaluating the query, however, we'll use the query object's <strong>setBinding()</strong> method to assign Alice's URI to the "s" variable in the query. This means that all matching triples are required to have Alice's URI in the subject position of the triple. </p>
<pre class="input">
tupleQuery.setBinding("s", alice)<br> result = tupleQuery.evaluate() <br> print "Facts about Alice:"<br> for r in result: print r </pre>
<p>The output of this loop consists of all triples that describe Alice:</p>
<pre class="output">Facts about Alice:<br>{'p': 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 's': 'http://example.org/people/alice', 'o': 'http://example.org/ontology/Person'}
{'p': 'http://example.org/ontology/name', 's': 'http://example.org/people/alice', 'o': '"Alice"'}</pre>
<p>Now we'll run the same query again, but this time we'll constrain "s" to be Bob's URI. The query will return all triples that describe Bob. </p>
<pre class="input">
tupleQuery.setBinding("s", bob)<br> print "Facts about Bob:" <br> result = tupleQuery.evaluate()<br> for r in result: print r
</pre>
The output of this loop is:
<pre class="output">Facts about Bob:<br>{'p': 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 's': 'http://example.org/people/bob', 'o': 'http://example.org/ontology/Person'}
{'p': 'http://example.org/ontology/name', 's': 'http://example.org/people/bob', 'o': '"Bob"'}</pre>
<h2 id="Range Matches">Range Matches (example15()) <a class="returnlink" href="#Contents">Return to Top</a></h2>
<p>Example15() demonstrates how to set up a query that matches a range of values. In this case, we'll retrieve all people between 30 and 50 years old (inclusive). We can accomplish this using the connection object's <strong>createRange()</strong> method. </p>
<p>This example begins by getting a connection object from example1(), and then clearing the repository of the existing triples. </p>
<pre class="input">
def example15():<br> conn = example1()<br> conn.clear()</pre>
<p>Then we register a namespace to use in the query. </p>
<pre class="input">
exns = "http://example.org/people/"<br> conn.setNamespace('ex', exns)</pre>
<p>Next we need to set up the URIs for Alice, Bob, Carol and the predicate "age". </p>
<pre class="input">
alice = conn.createURI(namespace=exns, localname="alice")<br> bob = conn.createURI(namespace=exns, localname="bob")<br> carol = conn.createURI(namespace=exns, localname="carol") <br> age = conn.createURI(namespace=exns, localname="age") </pre>
<p>In this step, we use the connection's createRange() method to generate a range object with limits 30 and 50:</p>
<pre class="input"> range = conn.createRange(30, 50)</pre>
<p>The next two lines are essential to the experiment, but you can take your pick of which one to use. The range comparison requires that all of the matching values must have the same datatype. In this case, the values must all be ints. The connection object lets us force this uniformity on the data through the <strong>registerDatatypeMapping()</strong> method. You can force all values of a specific predicate to be internally represented as one datatype, as we do here: </p>
<pre class="input">
conn.registerDatatypeMapping(predicate=age, nativeType="int")</pre>
<p>This line declares that all values of the age predicate will be represented in triples as if they were "int" values in Python. </p>
<pre class="input">
conn.registerDatatypeMapping(datatype=XMLSchema.INT, nativeType="int") </pre>
<p>However, this doesn't mean quite what you think it does. As it happens, due to implementation details that differ between Python and AllegroGraph, the closest AllegroGraph datatype to Python's "int" is XMLSchema.LONG. When we create the following triples, we find that they contain XMLSchema.LONG values. </p>
<pre class="input"> conn.add(alice, age, 42)
conn.add(bob, age, 24) <br> conn.add(carol, age, "39")
</pre>
<p>The next step is to use getStatements() to retrieve all triples where the age value is between 30 and 50. </p>
<pre class="input"> statements = conn.getStatements(None, age, range)<br> for s in statements:<br> print s</pre>
<p>The output of this loop is:</p>
<pre class="output">(<http://example.org/people/alice>, <http://example.org/people/age>, "42"^^<http://www.w3.org/2001/XMLSchema#long>)
(<http://example.org/people/carol>, <http://example.org/people/age>, "39"^^<http://www.w3.org/2001/XMLSchema#long>)</pre>
<p>The range query has matched 42 and "39", but not 24. </p>
<h2 id="Federated Repositories">Federated Repositories (example16()) <a class="returnlink" href="#Contents">Return to Top</a></h2>
<p>AllegroGraph lets you split up your triples among repositories on multiple servers and then search them all in parallel. To do this we query a single "federated" repository that automatically distributes the queries to the secondary repositories and combines the results. From the point of view of your Python code, it looks like you are working with a single repository. </p>
<p>Example16() begins by defining a small output function that we'll use at the end of the lesson. It prints out responses from different repositories. This example is about red apples and green apples, so the output function talks about apples. </p>
<pre class="input">def example16():<br> def pt(kind, rows, expected):<br> print "\n%s Apples:\t" % kind.capitalize(),<br> for r in rows: print r[0].getLocalName(),</pre>
<p>In the next block of code, we open connections to a redRepository and a greenRepository on the local server. In a typical federation scenario, these respositories would be distributed across multiple servers. </p>
<pre class="input"> server = AllegroGraphServer(AG_HOST, AG_PORT, 'test', 'xyzzy')<br> catalog = server.openCatalog(AG_CATALOG)<br> ## create two ordinary stores, and one federated store: <br> redConn = catalog.getRepository("redthings", Repository.RENEW).initialize().getConnection()<br> greenConn = catalog.getRepository("greenthings", Repository.RENEW).initialize().getConnection()</pre>
<p>Now we create a "federated" respository, which is connected to the distributed repositories at the back end. When we open a federated repository, AllegroGraph creates a session and returns a connection: </p>
<pre class="input"> rainbowThings = server.openFederated([redConn, greenConn], True)</pre>
<p>It is necessary to register the "ex" namespace in all three repositories so we can use it in the upcoming query. </p>
<pre class="input"> ex = "http://www.demo.com/example#"<br> redConn.setNamespace('ex', ex)<br> greenConn.setNamespace('ex', ex)<br> rainbowThings.setNamespace('ex', ex) </pre>
<p>The next step is to populate the Red and Green repositories with a few triples. Note that one of the green objects is not an apple: </p>
<pre class="input"> redConn.add(redConn.createURI(ex+"mcintosh"), RDF.TYPE, redConn.createURI(ex+"Apple"))<br> redConn.add(redConn.createURI(ex+"reddelicious"), RDF.TYPE, redConn.createURI(ex+"Apple")) <br> greenConn.add(greenConn.createURI(ex+"pippin"), RDF.TYPE, greenConn.createURI(ex+"Apple"))<br> greenConn.add(greenConn.createURI(ex+"kermitthefrog"), RDF.TYPE, greenConn.createURI(ex+"Frog"))</pre>
<p>Let's check to see if the federated session can "see" the new triples:</p>
<pre class="input"> print "\nFederated size: " + str(rainbowThings.size())</pre>
<pre class="output">Federated size: 4</pre>
<p>This tells us that the federated store can see the triples in the component stores. Now we write a query that retrieves Apples from the Red repository, the Green repository, and the federated repository, and prints out the results. </p>
<pre class="input">
queryString = "select ?s where { ?s rdf:type ex:Apple }"<br> ## query each of the stores; observe that the federated one is the union of the other two:<br> pt("red", redConn.prepareTupleQuery(QueryLanguage.SPARQL, queryString).evaluate())<br> pt("green", greenConn.prepareTupleQuery(QueryLanguage.SPARQL, queryString).evaluate())<br> pt("federated", rainbowConn.prepareTupleQuery(QueryLanguage.SPARQL, queryString).evaluate()) </pre>
<p>The output is shown below. The federated response combines the individual responses. </p>
<pre class="output">Red Apples: reddelicious mcintosh <br>Green Apples: pippin <br>Federated Apples: reddelicious mcintosh pippin</pre>
<p>It should go without saying that a search for apples does not turn up a frog. </p>
<h2 id="Prolog Rule Queries">Prolog Rule Queries (example17()) <a class="returnlink" href="#Contents">Return to Top</a></h2>
<p>AllegroGraph Server lets us load Prolog backward-chaining rules to make query-writing simpler. The Prolog rules let us write the queries in terms of higher-level concepts. When a query refers to one of these concepts, Prolog rules become active in the background to determine if the concept is valid in the current context. </p>
<p>For instance, in this example the query says that the matching resource must be a "man". A Prolog rule examines the matching resources to see which of them are persons who are male. The query can proceed for those resources. The rules provide a level of abstraction that makes the queries simpler to express. </p>
<p>The example17() example begins by borrowing a connection object from example example6(), which contains the Kennedy family tree. Note that example6() creates a <a href="#Transaction Control">dedicated session</a> for the rules to operate in, using the Connection object's <strong>openSession()</strong> method. Python rules cannot be loaded into the AllegroGraph common back end. </p>
<pre class="input">conn.openSession(); # in example6()</pre>
<p>This converts the connection to a "dedicated" connection. After that step, all of the code is exactly the same as when using the common back end.</p>
<pre class="input">def example17():<br> conn = example6() #obtain dedicated connection from example6()</pre>
<p>We will need the same namespace as we used in the Kennedy example. </p>
<pre class="input">
conn.setNamespace("kdy", "http://www.franz.com/simple#")</pre>
<p>These are the "man" and "woman" rules. A resource represents a "woman" if the resource contains a sex=female triple and an rdf:type = person triple. A similar deduction identifies a "man". The "q" at the beginning of each pattern simply stands for "query" and introduces a triple pattern. </p>
<pre class="input"> rules1 = """<br> (<-- (woman ?person) ;; IF<br> (q ?person !kdy:sex !kdy:female)<br> (q ?person !rdf:type !kdy:person))<br> (<-- (man ?person) ;; IF<br> (q ?person !kdy:sex !kdy:male)<br> (q ?person !rdf:type !kdy:person))<br> """</pre>
<p>The rules must be explicitly added to the dedicated session. </p>
<pre class="input">
conn.addRules(rules1)</pre>
<p>This is the query. This query locates all the "man" resources, and retrieves their first and last names. </p>
<pre class="input">
queryString = """<br> (select (?first ?last)<br> (man ?person)<br> (q ?person !kdy:first-name ?first)<br> (q ?person !kdy:last-name ?last)<br> )<br> """</pre>
<p>Here we perform the query and retrieve the result object. </p>
<pre class="input"> tupleQuery = conn.prepareTupleQuery(QueryLanguage.PROLOG, queryString)<br> result = tupleQuery.evaluate(); </pre>
<p>The result object contains multiple bindingSets. We can iterate over them to print out the values. </p>
<pre class="input">
for bindingSet in result:<br> f = bindingSet.getValue("first")<br> l = bindingSet.getValue("last")<br> print "%s %s" % (f.toPython(), l.toPython())</pre>
<p>The output contains many names; there are just a few of them. </p>
<pre class="output">Robert Kennedy<br>Alfred Tucker<br>Arnold Schwarzenegger<br>Paul Hill<br>John Kennedy</pre>
<p>It is good form to close the dedicated session when you are finished with it.</p>
<pre class="input"> conn.closeDedicated()</pre>
<h2 id="Loading Prolog Rules">Loading Prolog Rules (example18()) <a class="returnlink" href="#Contents">Return to Top</a></h2>
<p>Example <strong>example18()</strong> demonstrates how to load a file of Prolog rules into the Python Sesame API of AllegroGraph Server. It also demonstrates how robust a rule-augmented system can become. The domain is the Kennedy family tree again, borrowed from example6(). After loading a file of rules (<strong>python-rules.txt</strong>), we'll pose a simple query. The query asks AllegroGraph to list all the uncles in the family tree, along with each of their nieces or nephews. This is the query:</p>
<pre class="input">(select (?ufirst ?ulast ?cfirst ?clast)<br> (uncle ?uncle ?child)<br> (name ?uncle ?ufirst ?ulast)<br> (name ?child ?cfirst ?clast))</pre>
<p>The problem is that the triple store contains no information about uncles. The rules will have to deduce this relationship by finding paths across the RDF graph. </p>
<p>What's an "uncle," then? Here's a rule that can recognize uncles:</p>
<pre class="input">(<-- (uncle ?uncle ?child) <br> (man ?uncle)<br> (parent ?grandparent ?uncle)<br> (parent ?grandparent ?siblingOfUncle)<br> (not (= ?uncle ?siblingOfUncle))<br> (parent ?siblingOfUncle ?child))</pre>
<p>The rule says that an "uncle" is a "man" who has a sibling who is the "parent" of a child. (Rules like this always check to be sure that the two nominated siblings are not the same resource.) Note that none of these relationships are triple patterns. They all deal in higher-order concepts. We'll need additional rules to determine what a "man" is, and what a "parent" is.</p>
<p>What is a "parent?" It turns out that there are two ways to be classified as a parent:</p>
<pre class="input">(<-- (parent ?father ?child)<br> (father ?father ?child))
(<-- (parent ?mother ?child)<br> (mother ?mother ?child))</pre>
<p>A person is a "parent" if a person is a "father." Similarly, a person is a "parent" if a person is a "mother." </p>
<p>What's a "father?"</p>
<pre class="input">(<-- (father ?parent ?child)<br> (man ?parent)<br> (q ?parent !rltv:has-child ?child))</pre>
<p>A person is a "father" if the person is "man" and has a child. The final pattern (beginning with "q") is a triple match from the Kennedy family tree.</p>
<p>What's a "man?"</p>
<pre class="input">(<-- (man ?person)<br> (q ?person !rltv:sex !rltv:male)<br> (q ?person !rdf:type !rltv:person))</pre>
<p>A "man" is a person who is male. These patterns both match triples in the repository. </p>
<p>The<strong> python_rules.txt</strong> file contains many more Prolog rules describing relationships, including transitive relationships like "ancestor" and "descendant." Please examine this file for more ideas about how to use rules with AllegroGraph. </p>
<p>The <strong>example18()</strong> example begins by borrowing a connection object from example6(), which means the Kennedy family tree is already loaded into the repository, and we are dealing with a <a href="#Transaction Control">dedicated session</a>. </p>
<pre class="input">def example18():<br> conn = example6()</pre>
<p>We need these two namespaces because they are used in the query and in the file of rules. </p>
<pre class="input">
conn.setNamespace("kdy", "http://www.franz.com/simple#")<br> conn.setNamespace("rltv", "http://www.franz.com/simple#") </pre>
<p>The next step is to load the rule file: </p>
<pre class="input">
path = "./python_rules.txt"<br> conn.loadRules(path)</pre>
<p>The query asks for the first and last names of each uncle and each niece/nephew. The name strings are provided by another Prolog rule: </p>
<pre class="input"> queryString = """(select (?ufirst ?ulast ?cfirst ?clast)<br> (uncle ?uncle ?child)<br> (name ?uncle ?ufirst ?ulast)<br> (name ?child ?cfirst ?clast))"""</pre>
<p>Here we execute the query and display the results. The code is a little more complicated than usual because of the string concatenations that build the names. </p>
<pre class="input"> tupleQuery = conn.prepareTupleQuery(QueryLanguage.PROLOG, queryString)<br> result = tupleQuery.evaluate(); <br> for bindingSet in result:<br> u1 = bindingSet.getValue("ufirst")<br> u2 = bindingSet.getValue("ulast")<br> ufull = u1.toPython() + " " + u2.toPython()<br> c1 = bindingSet.getValue("cfirst")<br> c2 = bindingSet.getValue("clast")<br> cfull = c1.toPython() + " " + c2.toPython()<br> print "%s is the uncle of %s." % (ufull, cfull)</pre>
<p>The output of this loop (in part) looks like this:
<pre class="output">Robert Kennedy is the uncle of Amanda Smith.<br>Robert Kennedy is the uncle of Kym Smith.<br>Edward Kennedy is the uncle of Robert Shriver.<br>Edward Kennedy is the uncle of Maria Shriver.<br>Edward Kennedy is the uncle of Timothy Shriver.</pre>
<p>As before, it is good form to close the dedicated session when you are finished with it.</p>
<pre class="input"> conn.closeSession()<br> conn.close();<br> myRepository = conn.repository<br> myRepository.shutDown()</pre>
<h2 id="RDFS++ Inference">RDFS++ Inference (example19()) <a class="returnlink" href="#Contents">Return to Top</a></h2>
<p>The great promise of the semantic web is that we can use RDF metadata to combine information from multiple sources into a single, common model. The great problem of the semantic web is that it is so difficult to recognize when two resource descriptions from different sources actually represent the same thing. This problem arises because there is no uniform or universal way to generate URIs identifying resources. As a result, we may create two resources, Bob and Robert, that actually represent the same person. </p>
<p>This problem has generated much creativity in the field. One way to approach the problem is through inference. There are certain relationships and circumstances where an inference engine can deduce that two resource descriptions actually represent one thing, and then automatically merge the descriptions. AllegroGraph's <a href="../reasoner-tutorial.html">inference engine</a> can be turned on or off each time you run a query against the triple store. (Note that inference is turned off by default, which is the opposite of standard Sesame behavior.) </p>
<p>In example example19(), we will create four resources: Bob, with son Bobby, and Robert with daughter Roberta. </p>
<p><img src="inferenceSetup.jpg" width="448" height="101"></p>
<p>First we have to set up the data. We begin by generating four URIs for the new resources. </p>
<pre class="input"> ## Create URIs for Bob and Robert (and kids)
robert = conn.createURI("http://example.org/people/robert")
roberta = conn.createURI("http://example.org/people/roberta")
bob = conn.createURI("http://example.org/people/bob")
bobby = conn.createURI("http://example.org/people/bobby")
</pre>
The next step is to create URIs for the predicates we'll need (<em>name</em> and <em>fatherOf</em>), plus one for the Person class. <br>
<pre class="input"> ## create name and child predicates, and Person class.<br> name = conn.createURI("http://example.org/ontology/name")<br> fatherOf = conn.createURI("http://example.org/ontology/fatherOf")<br> person = conn.createURI("http://example.org/ontology/Person")
</pre>
The names of the four people will be literal values. <br>
<pre class="input"> ## create literal values for names <br> bobsName = conn.createLiteral("Bob")<br> bobbysName = conn.createLiteral("Bobby")<br> robertsName = conn.createLiteral("Robert")<br> robertasName = conn.createLiteral("Roberta")
</pre>
<p>Robert, Bob and the children are all instances of class Person. It is good practice to identify all resources by an rdf:type link to a class.</p>
<pre class="input"> ## Robert, Bob, and children are people<br> conn.add(robert, RDF.TYPE, person)<br> conn.add(roberta, RDF.TYPE, person)<br> conn.add(bob, RDF.TYPE, person)<br> conn.add(bobby, RDF.TYPE, person)
</pre>
The four people all have literal names. <br>
<pre class="input"> ## They all have names.<br> conn.add(robert, name, robertsName)<br> conn.add(roberta, name, robertasName)<br> conn.add(bob, name, bobsName)<br> conn.add(bobby, name, bobbysName)
</pre>
Robert and Bob have links to the child resources:
<br>
<pre class="input"> ## robert has a child<br> conn.add(robert, fatherOf, roberta)<br> ## bob has a child<br> conn.add(bob, fatherOf, bobby)
</pre>
<h3>SameAs, using a SPARQL Query </h3>
<p>Now that the basic resources and relations are in place, we'll seed the triple store with a statement that "Robert is the same as Bob," using the <strong>owl:sameAs</strong> predicate. The AllegroGraph inference engine recognizes the semantics of owl:sameAs, and automatically infers that Bob and Robert share the same attributes. Each of them originally had one child. When inference is turned on, however, they each have two children. </p>
<p><img src="inferenceSaveAs.jpg" width="459" height="182"></p>
<p>Note that SameAs does not combine the two resources. Instead it links each of the two resources to all of the combined children. The red links in the image are "inferred" triples. They have been deduced to be true, but are not actually present in the triple store. </p>
<p>This is the critical link that tells the inference engine to regard Bob and Robert as the same resource. </p>
<pre class="input"> ## Bob is the same person as Robert<br> conn.add(bob, OWL.SAMEAS, robert)
</pre>
<p>This is a simple SPARQL query asking for the children of Robert, with inference turned OFF. Note the use of <strong>tupleQuery.setIncludeInferred()</strong>, which controls whether or not inferred triples may be included in the query results. Inference is turned off by default, but for teaching purposes we have turned it of explicitly. We also took the liberty of setting variable bindings for ?robert and ?fatherOf, simply to make the code easier to read. Otherwise we would have had to put full-length URIs in the query string. </p>
<pre class="input"> queryString = <strong>"SELECT ?child WHERE {?robert ?fatherOf ?child .}"</strong><br> tupleQuery = conn.prepareTupleQuery(QueryLanguage.SPARQL, queryString)<br> <strong>tupleQuery.setIncludeInferred(False)</strong> # Turn off inference<br> tupleQuery.setBinding("robert", robert)<br> tupleQuery.setBinding("fatherOf", fatherOf)<br> result = tupleQuery.evaluate() <br> print "Children of Robert, inference OFF:"<br> for r in result: print r </pre>
<p>The search returns one triple, which is the link from Robert to his direct child, Roberta. </p>
<pre class="output">Children of Robert, inference OFF
{'child': u'<http://example.org/people/roberta>'}</pre>
<p>Now we'll perform the same query (the same tupleQuery, in fact), with inference turned ON. </p>
<pre class="input"> tupleQuery.setIncludeInferred(True)<br> result = tupleQuery.evaluate() <br> print "Children of Robert, inference ON:"<br> for r in result: print r </pre>
<pre class="output">Children of Robert, inference ON
{'child': u'<http://example.org/people/roberta>'}<br>{'child': u'<http://example.org/people/bobby>'}</pre>
<p>Note that with inference ON, Robert suddenly has two children because Bob's child has been included. Also note that the final triple (robert fatherOf bobby) has been inferred. The inference engine has determined that this triple logically must be true, even though it does not appear in the repository. </p>
<h3>InverseOf</h3>
<p>We can reuse the Robert family tree to see how the inference engine can deduce the presence of inverse relationships. </p>
<p>Up to this point in this tutorial, we have created new predicates simply by creating a URI and using it in the predicate position of a triple. This time we need to create a predicate<em> resource</em> so we can set an attribute of that resource. We're going to declare that the <strong>hasFather</strong> predicate is the <strong>owl:inverseOf</strong> the existing fatherOf predicate. </p>
<p>The first step is to remove the owl:sameAs link, because we are done with it. </p>
<pre class="input"> conn.remove(bob, OWL.SAMEAS, robert)
</pre>
<p>We'll need a URI for the new hasFather predicate:</p>
<pre class="input"> hasFather = conn.createURI("http://example.org/ontology/hasFather")</pre>
<p>This is the line where we create a predicate resource. It is just a triple that describes a property of the predicate. The hasFather predicate is the inverse of the fatherOf predicate: </p>
<pre class="input"> conn.add(hasFather, OWL.INVERSEOF, fatherOf)</pre>
<p>For this example, we're going to use <strong>getStatements()</strong> instead of SPARQL. The simple getStatements() format is sufficient to our needs, and simplifies the code. First, we'll search for hasFather triples, leaving inference OFF to show that there are no such triples in the repository. The fifth parameter to getStatements(), shown here as <strong>False</strong>, controls inferencing. </p>
<pre class="input"> print "People with fathers, inference OFF"
for s in conn.getStatements(None, hasFather, None, None, <strong>False</strong>): print s
</pre>
<pre class="output">People with fathers, inference OFF<br></pre>
<p>Now we'll turn inference ON by changing the fifth parameter to <strong>True</strong>. This time, the AllegroGraph inference engine discovers two "new" hasFather triples. </p>
<pre class="input"> print "People with fathers, inference ON"
for s in conn.getStatements(None, hasFather, None, None, <strong>True</strong>): print s
</pre>
<pre class="output">People with fathers, inference ON<br>(<http://example.org/people/bobby>, <http://example.org/ontology/hasFather>, <http://example.org/people/bob>)
(<http://example.org/people/roberta>, <http://example.org/ontology/hasFather>, <http://example.org/people/robert>)</pre>
<p>Both of these triples are inferred by the inference engine.</p>
<h3>SubPropertyOf</h3>
<p>Invoking inference using the <strong>rdfs:subPropertyO</strong>f predicate lets us "combine" two predicates so they can be searched as one. For instance, in our Robert/Bob example, we have explicit fatherOf relations. Suppose there were other resources that used a parentOf relation instead of fatherOf. By making fatherOf a subproperty of parentOf, we can search for parentOf triples and automatically find the fatherOf triples at the same time. </p>
<p>First we should remove the owl:inverseOf relation from the previous example. We don't have to, but it keeps things simple. </p>
<pre class="input"> ## Remove owl:inverseOf property.<br> conn.remove(hasFather, OWL.INVERSEOF, fatherOf) </pre>
<p>We'll need a parentOf URI to use as the new predicate. Then we'll add a triple saying that fatherOf is an rdfs:subPropertyOf the new predicate, parentOf:</p>
<pre class="input"> parentOf = conn.createURI("http://example.org/ontology/parentOf")<br> conn.add(fatherOf, RDFS.SUBPROPERTYOF, parentOf)
</pre>
<p>If we now search for parentOf triples with inference OFF, we won't find any. No such triples exist in the repository. </p>
<pre class="input"> print "People with parents, inference OFF"<br> for s in conn.getStatements(None, parentOf, None, None, False): print s
</pre><pre class="output">People with parents, inference OFF
</pre>
<p>With inference ON, however, AllegroGraph infers two new triples: </p>
<pre class="input">
print "People with parents, inference ON"<br> for s in conn.getStatements(None, parentOf, None, None, True): print s
</pre>
<pre class="output">People with parents, inference ON<br>(<http://example.org/people/bob>, <http://example.org/ontology/parentOf>, <http://example.org/people/bobby>)<br>(<http://example.org/people/robert>, <http://example.org/ontology/parentOf>, <http://example.org/people/roberta>)</pre>
<p>The fact that two fatherOf triples exist means that two correponding parentOf triples must be valid. There they are.</p>
<p>Before setting up the next example, we should clean up:</p>
<pre class="input">conn.remove(fatherOf, RDFS.SUBPROPERTYOF, parentOf) </pre>
<h3>Domain and Range</h3>
<p>When you declare the domain and range of a predicate, the AllegroGraph inference engine can infer the rdf:type of resources found in the subject and object positions of the triple. For instance, in the triple <<em>subject</em>, fatherOf, <em>object</em>> we know that the <em>subject</em> is always an instance of class Parent, and the <em>object</em> is always an instance of class Child. </p>
<p>In RDF-speak, we would say that the <strong>domain</strong> of the fatherOf predicate is rdf:type Parent. The <strong>range</strong> of fatherOf is rdf:type Child. </p>
<p>This lets the inference engine determine the rdf:type of every resource that participates in a fatherOf relationship. </p>
<p>We'll need two new classes, Parent and Child. Note that RDF classes are always capitalized, just as predicates are always lowercase.</p>
<pre class="input"> parent = conn.createURI("http://example.org/ontology/Parent")<br> child = conn.createURI("http://exmaple.org/ontology/Child")
</pre>
<p>Now we add two triples defining the domain and rage of the fatherOf predicate: </p><pre class="input"> conn.add(fatherOf, RDFS.DOMAIN, parent)<br> conn.add(fatherOf, RDFS.RANGE, child)
</pre>
<p>Now we'll search for resources of rdf:type Parent. The inference engine supplies the appropriate triples: </p>
<pre class="input"> print "Who are the parents? Inference ON."<br> for s in conn.getStatements(None, RDF.TYPE, parent, None, True): print s
</pre><pre class="output">
Who are the parents? Inference ON.
(<http://example.org/people/bob>, <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>, <http://example.org/ontology/Parent>
(<http://example.org/people/robert>, <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>, <http://example.org/ontology/Parent>)
</pre>
<p>Bob and Robert are parents. Who are the children? </p>
<pre class="input"> print "Who are the children? Inference ON."<br> for s in conn.getStatements(None, RDF.TYPE, child, None, True): print s
</pre><pre class="output">Who are the children? Inference ON.
(<http://example.org/people/bobby>, <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>, <http://exmaple.org/ontology/Child>)
(<http://example.org/people/roberta>, <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>, <http://exmaple.org/ontology/Child>)</pre>
<p>Bobby and Roberta are the children. </p>
<h2 id="Geospatial Search">Geospatial Search (example20()) <a class="returnlink" href="#Contents">Return to Top</a></h2>
<p>AllegroGraph provides the ability to locate resources within a geospatial coordinate system. You can set up either a flat (X,Y Cartesian) or spherical (latitude, longitude) system. The systems are two-dimensional only. (There is no Z or altitude dimension available). </p>
<p>The purpose of the geospatial representation is to efficiently find all entities that are located within a specific circular, rectangular or polygonal area. </p>
<h3>Cartesian System </h3>
<p>A Cartesian system is a flat (X,Y) plane. Locations are designated by (X,Y) pairs. At this time, AllegroGraph does not support real-world measurement units (km, miles, latitude, etc.,) in the Cartesian system. </p>
<p>The first example uses a Cartesian (X,Y) system that is 100 units square, and contains three people located at various points along the X = Y diagonal.</p>
<p><img src="gepCartesian.jpg" width="417" height="333"> </p>
<p>The example is in the function example20(). After establishing a connection, it begins by creating URIs for the three people.</p>
<pre class="input"> exns = "http://example.org/people/"<br> conn.setNamespace('ex', exns)<br> alice = conn.createURI(exns, "alice")<br> bob = conn.createURI(exns, "bob")<br> carol = conn.createURI(exns, "carol")</pre>
<p>Then we have the connection object generate a rectangular coordinate system for us to use. A rectangular (Cartesian) system can be used to represent anything that can be plotted using (X,Y) coordinates, such as the location of transistors on a silicon chip. </p>
<pre class="input"> conn.createRectangularSystem(scale=10, xMax=100, yMax=100)
</pre>
<p>The size of the coordinate system is determined by the <strong>xMin, xMax, yMin</strong> and <strong>yMax</strong> parameters. The minimum values default to zero, so this system is 0 to 100 in the X dimension, and 0 to 100 in the Y dimension. </p>
<p>The <strong>scale</strong> parameter influences how the coordinate data is stored and retrieved, and impacts search performance. The task is to locate the people who are within a specific region. As a rule of thumb, set the scale parameter to approximately the same value as the height (Y-axis) of your typical search region. You can be off by a factor of ten without impacting performance too badly, but if your application will search regions that are orders of magnitude different in size, you'll want to create multiple coordinate systems that are scaled for different sized search regions. In this case, our search region is about 20 units high (Y), and we have set the scale parameter to 10 units. That's close enough.</p>
<p>The next step is to create a "location" predicate and enter the locations of the three people. </p>
<pre class="input"> location = conn.createURI(exns, "location")<br> conn.add(alice, location, conn.createCoordinate(30,30))<br> conn.add(bob, location, conn.createCoordinate(40, 40))<br> conn.add(carol, location, conn.createCoordinate(50, 50))
</pre>
<p>Note that the coordinate pairs need to be encapsulated in a GeoCoordinate object to facilitate indexing and retrieval, using the connection object's <strong>createCoordinate()</strong> method. </p>
<p>At this point we have a Cartesian coordinate system containing three entities at specific (X,Y) locations. The next step is to define a search region. The first example is a "box" that is twenty units square, with the upper left corner at position (20, 20). The <strong>createBox()</strong> method requires parameters for <strong>xMin, xMax, yMin</strong>, and <strong>yMax</strong>. </p>
<pre class="input"> box1 = conn.createBox(20, 40, 20, 40)
</pre>
<p>The problem is to find the people whose locations lie within this box:</p>
<p><img src="geoBox1.jpg" width="412" height="330"></p>
<p>Locating the matching entities is remarkably easy to do:</p>
<pre class="input"> for r in conn.getStatements(None, location, box1) : print r
</pre>
<p>This retrieves all the location triples whose coordinates fall within the box1 region. Here are the resulting triples:</p>
<pre class="output">(<http://example.org/people/alice>, <http://example.org/people/location>,
"+30.000000004656613+30.000000004656613"^^<http://franz.com/ns/allegrograph/3.0/geospatial/cartesian/0.0/100.0/0.0/100.0/1.0>)<br>(<http://example.org/people/bob>, <http://example.org/people/location>,
"+39.999999990686774+39.999999990686774"^^<http://franz.com/ns/allegrograph/3.0/geospatial/cartesian/0.0/100.0/0.0/100.0/1.0>) </pre>
<p>AllegroGraph has located Alice and Bob, as expected. Note that Bob was exactly on the corner of the search area, showing that the boundaries are inclusive. </p>
<p>We can also find all objects within a circle with a known center and radius. Circle1 is centered at (35, 35) and has a radius of 10 units.</p>
<pre class="input"> circle1 = conn.createCircle(35, 35, radius=10)
</pre>
<p><img src="geoCircle1.jpg" width="415" height="333"></p>
<p>A search within circle1 finds Alice and Bob again:</p>
<pre class="input"> for r in conn.getStatements(None, location, circle1) : print r
</pre>
<pre class="output">(<http://example.org/people/alice>, <http://example.org/people/location>,
"+30.000000004656613+30.000000004656613"^^<http://franz.com/ns/allegrograph/3.0/geospatial/cartesian/0.0/100.0/0.0/100.0/1.0>)<br>(<http://example.org/people/bob>, <http://example.org/people/location>,
"+39.999999990686774+39.999999990686774"^^<http://franz.com/ns/allegrograph/3.0/geospatial/cartesian/0.0/100.0/0.0/100.0/1.0>) </pre>
<p>AllegroGraph can also locate points that lie within an irregular polygon. Just tell AllegroGraph the vertices of the polygon:</p>
<pre class="input"> polygon1 = conn.createPolygon([(10,40), (50,10), (35,40), (50,70)])
</pre>
<p><img src="geoPolygon1.jpg" width="423" height="330"></p>
<p>When we ask which people are within polygon1, AllegroGraph finds Alice.</p>
<pre class="input"> for r in conn.getStatements(None, location, polygon1) : print r
</pre>
<pre class="output">(<http://example.org/people/alice>, <http://example.org/people/location>,
"+30.000000004656613+30.000000004656613"^^<http://franz.com/ns/allegrograph/3.0/geospatial/cartesian/0.0/100.0/0.0/100.0/1.0>)</pre>
<h3>Spherical System</h3>
<p>A spherical coordinate system projects (X,Y) locations on a spherical surface, simulating locations on the surface of the earth. AllegroGraph supports the usual units of latitude and longitude in the spherical system. The default unit of distance is the kilometer (km). (These functions presume that the sphere is the size of the planet earth. For spherical coordinate systems of other sizes, you will have to work with the Lisp radian functions that underlie this interface.)</p>
<p><img src="geoWorld.jpg" width="602" height="340"></p>
<p>To establish a global coordinate system, use the connection object's createLatLongSystem() method. </p>
<pre class="input"> latLongGeoType = conn.createLatLongSystem(scale=5, unit='degree')</pre>
<p>Once again, the <strong>scale</strong> parameter is an estimate of the size of a typical search area, in the longitudinal direction this time. The default unit is the degree. For this system, we expect a typical search to cover about five degrees in the east-west direction. Actual search regions may be as much as ten times larger or smaller without significantly impacting performance. If the application will use search regions that are significantly larger or smaller, then you will want to create multiple coordinate systems that have been optimized for different scales. </p>
<p>First we set up the resources for the entities within the spherical system. We'll need these subject URIs:</p>
<pre class="input"> amsterdam = conn.createURI(exns, "amsterdam")<br> london = conn.createURI(exns, "london")<br> sanfrancisto = conn.createURI(exns, "sanfrancisco")<br> salvador = conn.createURI(exns, "salvador")
</pre>
<p>Then we'll need a <strong>geolocation</strong> predicate to describe the lat/long coordinates of each entity.</p>
<pre class="input"> location = conn.createURI(exns, "geolocation")</pre>
<p>Now we can create the entities by asserting a geolocation for each one. Note that the coordinates have to be encapsulated in coordinate objects: </p>
<pre class="input"> conn.add(amsterdam, location, conn.createCoordinate(52.366665, 4.883333))<br> conn.add(london, location, conn.createCoordinate(51.533333, -0.08333333))<br> conn.add(sanfrancisto, location, conn.createCoordinate(37.783333, -122.433334)) <br> conn.add(salvador, location, conn.createCoordinate(13.783333, -88.45)) </pre>
<p>The coordinates are decimal degrees. Northern latitudes and eastern longitudes are positive. </p>
<p>The next step is to create a box-shaped region, so we can see what entities lie within it. </p>
<pre class="input"> box2 = conn.createBox( 25.0, 50.0, -130.0, -70.0)
</pre>
<p>This region corresponds roughly to the contiguous United States. </p>
<p><img src="geoBox2.jpg" width="634" height="361"></p>
<p>Now we retrieve all the triples located within the search region:</p>
<pre class="input"> for r in conn.getStatements(None, location, box2) : print r
</pre>
<p>AllegroGraph has located San Francisco:</p>
<pre class="output">(<http://example.org/people/sanfrancisco>, <http://example.org/people/geolocation>,
"+374659.49909-1222600.00212"^^<http://franz.com/ns/allegrograph/3.0/geospatial/
spherical/degrees/-180.0/180.0/-90.0/90.0/5.0>)
</pre>
<p>This time let's search for entities within 2000 kilometers of Mexico City, which is located at 19.3994 degrees north latitude, -99.08 degrees west longitude. </p>
<pre class="input"> circle2 = conn.createCircle(19.3994, -99.08, 2000, unit='km')</pre>
<p><img src="geoCircle2.jpg" width="630" height="365"></p>
<pre class="input"> for r in conn.getStatements(None, location, circle2) : print r</pre>
<pre class="output">(<http://example.org/people/salvador>, <http://example.org/people/geolocation>,
"+134659.49939-0882700"^^<http://franz.com/ns/allegrograph/3.0/geospatial/spherical/degrees/-180.0/180.0/-90.0/90.0/5.0>)</pre>
<p>And AllegroGraph returns the triple representing El Salvador. </p>
<p>In the next example, the search area is a triangle roughly enclosing the United Kingdom:</p>
<pre class="input"> polygon2 = conn.createPolygon([(51.0, 2.00),(60.0, -5.0),(48.0,-12.5)])
</pre>
<p><em><img src="geoPolygon2.jpg" width="631" height="385"> </em></p>
<p>We ask AllegroGraph to find all entities within this triangle:</p>
<pre class="input"> for r in conn.getStatements(None, location, polygon2) : print r
</pre>
<pre class="output">(<http://example.org/people/london>, <http://example.org/people/geolocation>,
"+513159.49909-0000459.99970"^^<http://franz.com/ns/allegrograph/3.0/geospatial/spherical/degrees/-180.0/180.0/-90.0/90.0/5.0>)</pre>
<p>AllegroGraph returns the location of London, but not the nearby Amsterdam.</p>
<h2 id="Social Network Analysis">Social Network Analysis (example21()) <a class="returnlink" href="#Contents">Return to Top</a></h2>
<p>AllegroGraph includes sophisticated algorithms for social-network analysis (SNA). It can examine an RDF graph of relationships among people (or similar entities, such as businesses) and discover:</p>
<ul>
<li>Cliques of mutually-supporting individuals.</li>
<li>The importance of a person within a clique. </li>
<li>Paths from one individual to another.</li>
<li>Bottlenecks where information flow might be controlled or break down. </li>
</ul>
<p>This section has multiple subsections:</p>
<ul>
<li><a href="#Example Network">Example Network</a></li>
<li><a href="#Setting Up the Example">Setting Up the Example</a></li>
<li><a href="#Creating SNA Generators">Creating SNA Generators</a></li>
<li><a href="#Creating Neighbor Matrices">Creating Neighbor Matrices</a></li>
<li><a href="#Deleting Generators and Matrices">Deleting Generators and Matrices</a></li>
<li><a href="#SNA Search - Ego Group">SNA Search - Ego Group</a></li>
<li><a href="#SNA Search - Path from A to B">SNA Search - Path from A to B</a></li>
<li><a href="#Graph Measures">Graph Measures</a></li>
<li><a href="#Cliques">Cliques</a></li>
<li><a href="#Actor Centrality">Actor Centrality</a></li>
<li><a href="#Group Centrality">Group Centrality</a></li>
</ul>
<p>Most (but not all) of AllegroGraph's SNA features can be accessed from Python. We access them in multiple ways:</p>
<ul>
<li>The Python Sesame API to AllegroGraph contains setup functions that let you create an SNA environment ready for queries.</li>
<li>From Python, we can issue Prolog queries to AllegroGraph. Some of the SNA functions have Prolog equivalents that can be called directly from a query. These are explored in the sections below. </li>
<li>Within a Prolog query, we can open a window into Lisp and reach for the AllegroGraph's Lisp SNA functions. </li>
</ul>
<h3 id="Example Network">Example Network</h3>
<p>The example file for this exercise is <strong>python-lesmis.rdf</strong>. It contains resources representing 80 characters from Victor Hugo's <em>Les Miserables</em>, a novel about Jean Valjean's search for redemption in 17th-century Paris. </p>
<p>The raw data behind the model measured the strength of relationships by counting the number of book chapters where two characters were both present. The five-volume novel has 365 chapters, so it was possible to create a relationship network that had some interesting features. This is a partial display of the graph in <a href="http://www.franz.com/agraph/gruff/index.lhtml">Franz's Gruff graphical browser</a>. </p>
<p><img src="lesmismap.jpg" width="768" height="426"> </p>
<p>There are four possible relationships between any two characters. </p>
<ul>
<li><strong>No direct connection</strong>. (They never appeared in the same chapter.) AllegroGraph can locate indirect connections through their mutual acquaintances.</li>
<li><span class="style1"><strong>Barely knows</strong></span><strong>.</strong> The characters barely know each other.</li>
<li><span class="style2"><strong>Knows</strong></span><strong>.</strong> The two characters appear together in 15 or more chapters.</li>
<li><span class="style3"><strong>Knows well</strong></span><strong>.</strong> The two characters appear together in 25 or more chapters. </li>
</ul>
<p>(The Gruff illustrations were made from a parallel repository in which the resources were altered to display the character's name in the graph node rather than his URI. That file is called<strong> lemisNames.rdf</strong>.) </p>
<h3 id="Setting Up the Example">Setting Up the Example</h3>
<p>The SNA examples are in function <strong>example21() </strong>in <strong>tutorial_examples_40.py</strong>. This exercise begins by creating a <a href="#Transaction Control">dedicated session</a> for the SNA Prolog queries to operation within. These are the same initializing steps we have used in previous examples, plus <strong>conn.openSession()</strong> to create a dedicated connection. </p>
<pre class="input"> server = AllegroGraphServer(AG_HOST, AG_PORT, AG_USER, AG_PASSWORD)<br> catalog = server.openCatalog(AG_CATALOG) <br> myRepository = catalog.getRepository(AG_REPOSITORY, Repository.RENEW)<br> myRepository.initialize()<br> conn = myRepository.getConnection()<br> conn.openSession() # SNA requires dedicated session.</pre>
<p>The next step is to load the python-lesmis.rdf file.</p>
<pre class="input"> path1 = "./python-lesmis.rdf"
print "Load Les Miserables triples."
conn.addFile(path1, None, format=RDFFormat.RDFXML);
</pre>
<p>There are three predicates of interest in the Les Miserables repository. We need to create their URIs and bind them for later use. These are the <strong>knows, barely_knows,</strong> and <strong>knows_well</strong> predicates. </p>
<pre class="input"> # Create URIs for relationship predicates.
lmns = "http://www.franz.com/lesmis#"
conn.setNamespace('lm', lmns)
knows = conn.createURI(lmns, "knows")
barely_knows = conn.createURI(lmns, "barely_knows")
knows_well = conn.createURI(lmns, "knows_well")
</pre>
<p>We need to bind URIs for two characters: Valjean and Bossuet. Any analysis of <em>Les Miserables</em> will involve Valjean. Bossuet is someone who "barely knows" Valjean, but the two characters are linked through multiple characters who are more strongly connected. We will ask AllegroGraph to find paths from Valjean to Bossuet.</p>
<pre class="input"> # Create URIs for some characters.
valjean = conn.createURI(lmns, "character11")
bossuet = conn.createURI(lmns, "character64")
</pre>
<h3 id="Creating SNA Generators">Creating SNA Generators</h3>
<p>The SNA functions use "generators" to describe the relationships we want to analyze. A generator encapsulates a list of predicates to use in social network analysis. It also describes the directions in which each predicate is interesting. </p>
<p>In an RDF graph, two resources are linked by a single triple, sometimes called a "resource-valued predicate." This triple has a resource URI in the <em>subject</em> position, and a different one in the <em>object</em> position. For instance:</p>
<pre> (<Cosette>, knows_well, <Valjean>)</pre>
<p>This triple is a one-way link unless we tell the generator to treat it as bidirectional. This is frequently necessary in RDF data, where inverse relations are often implied but not explicitly declared as triples. </p>
<p>For this exercise, we will declare three generators:</p>
<ul>
<li>"intimates" uses <strong>knows_well</strong> as a bidirectional predicate.</li>
<li>"associates" uses <strong>knows</strong> and <strong>knows_well</strong> as bidirectional predicates.</li>
<li>"everyone" uses <strong>barely_knows</strong>, <strong>knows</strong>, and <strong>knows_well</strong> as bidirectional predicates. </li>
</ul>
<p>"Intimates" takes a narrow view of persons who know one another quite well. "Associates" follows both strong and medium relationships. "Everyone" follows all relationships, even the weak ones. This provides three levels of resolution for our analysis.</p>
<p>The connection object's <strong>registerSNAGenerator()</strong> method asks for a generator name (any label), and then for one or more predicates of interest. Each predicate should be assigned to the "subjectOf" direction, the "objectOf" direction, or the "undirected" direction (both ways at once). In addition, you may specify a "generator query," which is a Prolog "select" query that lets you be more specific about the links you want to analyze. </p>
<p>"Intimates" follows "knows_well" links only, but it treats them as bidirectional. If Cosette knows Valjean, then we'll assume that Valjean knows Cosette. </p>
<pre class=input> conn.registerSNAGenerator("intimates", subjectOf=None, objectOf=None, <br> undirected=knows_well, generator_query=None)</pre>
<p>"Associates" follows "knows" and "knows_well" links. </p>
<pre class="input">
conn.registerSNAGenerator("associates", subjectOf=None, objectOf=None, <br> undirected=[knows, knows_well], generator_query=None)
</pre>
<p>"Everyone" follows all three relationship links. </p>
<pre class="input"> conn.registerSNAGenerator("everyone", subjectOf=None, objectOf=None, <br> undirected=[knows, knows_well, barely_knows],
generator_query=None)</pre>
<p> </p>
<h3 id="Creating Neighbor Matrices">Creating Neighbor Matrices</h3>
<p>A generator provides a powerful and flexible tool for examining a graph, but it performs repeated queries against the repository in order to extract the subgraph appropriate to your query. If your data is static, the generator will extract the same subgraph each time you use it. It is better to run the generator once and store the results for quick retrieval. </p>
<p>That is the purpose of a "neighbor matrix." This is a persistent, in-memory cache of a generator's output. You can substitute the matrix for the generator in AllegroGraph's SNA functions. </p>
<p>The advantage of using a matrix instead of a generator is a many-fold increase in speed. This benefit is especially visible if you are searching for paths between two nodes in your graph. The exact difference in speed is difficult to estimate because there can be complex trade-offs and scaling issues to consider, but it is easy to try the experiment and observe the effect. </p>
<p>To create a matrix, use the connection object's <strong>registerNeighborMatrix()</strong> method. You must supply a matrix name (any symbol), the name of the generator, the URI of a resource to serve as the starting point, and a maximum depth. The idea is to place limits on the subgraph so that the search algorithms can operate in a restricted space rather than forcing them to analyze the entire repository. </p>
<p>In the following excerpt, we are creating three matrices to match the three generators we created. In this example, "matrix1" is the matrix for generator "intimates," and so forth. </p>
<pre class="input"> conn.registerNeighborMatrix("matrix1", "intimates", valjean, max_depth=2)<br> conn.registerNeighborMatrix("matrix2", "associates", valjean, max_depth=2)<br> conn.registerNeighborMatrix("matrix3", "everyone", valjean, max_depth=2)</pre>
<p>A matrix is a static snapshot of the output of a generator. If your data is dynamic, you should regenerate the matrix at intervals.</p>
<h3 id="Deleting Generators and Matrices">Deleting Generators and Matrices</h3>
<p>There is no direct way to delete individual matrices and generators, but closing the dedicated session frees all of the resources formerly used by all of the objects and structures that were created there. </p>
<h3 id="SNA Search - Ego Group"><strong>SNA Search - Ego Group</strong></h3>
<p>Our first search will enumerate Valjean's "ego group members." This is the set of nodes (characters) that can be found by following the interesting predicates out from Valjean's node of the graph to some specified depth. We'll use the "associates" generator ("knows" and "knows_well") to specify the predicates, and we'll impose a depth limit of one link. This is the group we expect to find:</p>
<p><img src="snaEgoGroup.jpg" width="599" height="203"></p>
<p>The following Python code sends a Prolog query to AllegroGraph and returns the result to Python. </p>
<pre class="input"> print "Valjean's ego group (using associates)."
queryString = """
(select (?member ?name)
(ego-group-member !lm:character11 1 associates ?member)
(q ?member !dc:title ?name))
"""
tupleQuery = conn.prepareTupleQuery(QueryLanguage.PROLOG, queryString)
result = tupleQuery.evaluate();
print "Found %i query results" % len(result) <br> for bindingSet in result:
p = bindingSet.getValue("member")
n = bindingSet.getValue("name")
print "%s %s" % (p, n)
</pre>
<p>This is the iconic block of code that is repeated in the SNA examples, below, with minor variations in the display of bindingSet values. To save virtual trees, we'll focus more tightly on the Prolog query from this point on:</p>
<pre class="input"> (select (?member ?name)
(ego-group-member !lm:character11 1 associates ?member)
(q ?member !dc:title ?name))
</pre>
<p>In this example, <strong>ego-group-member</strong> is an AllegroGraph SNA function that has been adapted for use in Prolog queries. There is a list of such functions on the <a href="http://www.franz.com/agraph/support/documentation/current/lisp-reference.html#sna">AllegroGraph documentation reference page</a>. </p>
<p>The query will execute <strong>ego-group-member</strong>, using Valjean (character11) as the starting point, following the predicates described in "associates," to a depth of 1 link. It binds each matching node to <strong>?member</strong>. Then, for each binding of ?member, the query looks for the member's <strong>dc:title</strong> triple, and binds the member's <strong>?name</strong>. The query returns multiple results, where each result is a (?member ?name) pair. The result object is passed back to Python, where we can iterate over the results and print out their values. </p>
<p>This is the output of the example:</p>
<pre class="output">Valjean's ego group (using associates).
Found 8 query results
<http://www.franz.com/lesmis#character27> "Javert"
<http://www.franz.com/lesmis#character24> "MmeThenardier"
<http://www.franz.com/lesmis#character25> "Thenardier"
<http://www.franz.com/lesmis#character28> "Fauchelevent"
<http://www.franz.com/lesmis#character11> "Valjean"
<http://www.franz.com/lesmis#character26> "Cosette"
<http://www.franz.com/lesmis#character23> "Fantine"
<http://www.franz.com/lesmis#character55> "Marius"</pre>
<p>If you compare this list with the Gruff-generated image of Valjean's ego group, you'll see that AllegroGraph has found all eight expected nodes. You might be surprised that Valjean is regarded as a member of his <em>own</em> ego group, but that is a logical result of the definition of "ego group." The ego group is the set of all nodes within a certain depth of the starting point, and certainly the starting point must be is a member of that set. </p>
<p>We can perform the same search using a neighbor matrix, simply by substituting "matrix2" for "associates" in the query:</p>
<pre class="input"> (select (?member ?name)
(ego-group-member !lm:character11 1 <strong>matrix2</strong> ?member)
(q ?member !dc:title ?name))
</pre>
<p>This produces the same set of result nodes, but under the right circumstances the matrix would run a lot faster than the generator. </p>
<p>This variation returns Valjean's ego group as a single list. </p>
<pre class="input"> (select (?group)
(ego-group !lm:character11 1 associates ?group))</pre>
<p>The result in the Python interaction window is: </p>
<pre class="output">Valjean's ego group in one list depth 1 (using associates).<br>Found 1 query results<br>[ <http://www.franz.com/lesmis#character27> <http://www.franz.com/lesmis#character25> <br><http://www.franz.com/lesmis#character28> <http://www.franz.com/lesmis#character23> <br><http://www.franz.com/lesmis#character26> <http://www.franz.com/lesmis#character55> <br><http://www.franz.com/lesmis#character11> <http://www.franz.com/lesmis#character24> ]</pre>
<h3 id="SNA Search - Path from A to B">SNA Search - Path from A to B</h3>
<p>In the following examples, we explore the graph for the shortest path from Valjean to Bossuet, using the three generators to place restrictions on the quality of the path. These are the relevant paths between these two characters:</p>
<img src="pathsValBos.jpg" width="913" height="254">
<p>Our first query asks AllegroGraph to use <strong>intimates</strong> to find the shortest possible path between Valjean and Bossuet that is composed entirely of "knows_well" links. Those would be the green arrows in the diagram above. The <strong>breadth-first-search-path</strong> function asks for a start node and an end node, a generator, an optional maximum path length, and a variable to bind to the resulting path(s). Valjean is character11, and Bossuet is character64.</p>
<pre class="input"> (select (?path)
(breadth-first-search-path !lm:character11 !lm:character64 intimates 10 ?path))</pre>
<p>It is easy to examine the diagram and see that there is no such path. Valjean and Bossuet are not well-acquainted, and do not have any chain of well-acquainted mutual friends. AllegroGraph lets us know that.</p>
<pre class="output">Shortest breadth-first path connecting Valjean to Bossuet using intimates.
Found 1 query results
[ ]</pre>
<p>It says there is one result, but that is actually the empty list. </p>
<p>This time we'll broaden the criteria. What is the shortest path from Valjean to Bossuet, using <strong>associates</strong>? We can follow either "knows_well" or "knows" links across the graph. Those are the green and the blue links in the diagram. </p>
<pre class="input">(select (?path)
(breadth-first-search-path !lm:character11 !lm:character64 associates 10 ?path))</pre>
<p>Although there are multiple such paths, there are only two that are "shortest" paths. </p>
<pre class="output">Shortest breadth-first path connecting Valjean to Bossuet using associates.<br>Found 2 query results<br>[ <http://www.franz.com/lesmis#character11> <http://www.franz.com/lesmis#character55><br> <http://www.franz.com/lesmis#character58> <http://www.franz.com/lesmis#character64> ]<br>[ <http://www.franz.com/lesmis#character11> <http://www.franz.com/lesmis#character55><br> <http://www.franz.com/lesmis#character62> <http://www.franz.com/lesmis#character64> ]</pre>
<p>These are the paths "Valjean > Marius > Enjolras > Bossuet" and "Valjean > Marius > Courfeyrac > Bossuet." AllegroGraph returns two paths because they are of equal length. If one of the paths had been shorter, it would have returned only the short path. </p>
<p>Our third query asks for the shortest path from Valjean to Bossuet using <strong>everyone</strong>, which means that "barely-knows" links are permitted in addition to "knows" and "knows_well" links. </p>
<pre class="input"> (select (?path)
(breadth-first-search-path !lm:character11 !lm:character64 everyone 10 ?path))
</pre>
<p>This time AllegroGraph returns a single, short path:</p>
<pre class="output">Shortest breadth-first path connecting Valjean to Bossuet using everyone.<br>Found 1 query results<br>[ <http://www.franz.com/lesmis#character11> <http://www.franz.com/lesmis#character64> ]</pre>
<p>This is the "barely-knows" link directly from from Valjean to Bossuet. </p>
<p>The Prolog select query can also use <strong>depth-first-search-path()</strong> and <strong>bidirectional-search-path()</strong>. Their syntax is essentially identical to that shown above. These algorithms offer different efficiencies:</p>
<ul>
<li>Breadth-first and bidirectional searches explore all paths by incrementing the search radius until a success is achieved. This guarantees that the returned path(s) will be "shortest" paths. They return one or more paths of equal lengths. </li>
<li>Depth-first search tries to bypass the costly expansion of all paths by exploring each path to its end, and aborting the search when it locates a successful path. There is no implication that this path is the "shortest" path through the graph. </li>
</ul>
<p>In addition, the depth-first algorithm uses less memory than the others, so a depth-first search may succeed when a breadth-first search would run out of memory. </p>
<h3 id="Graph Measures">Graph Measures</h3>
<p>AllegroGraph provides several utility functions that measure the characteristics of a node, such as the number of connections it has to other nodes, and its importance as a communication path in a clique. </p>
<p>For instance, we can use the <strong>nodal-degree</strong> function to ask how many nodal neighbors Valjean has, using <strong>everyone</strong> to catalog all the nodes connected to Valjean by "knows," "barely_knows", and "knows_well" predicates. There are quite a few of them:</p>
<p><img src="allLinksValjean.jpg" width="720" height="341"> </p>
<p>The nodal-degree function requires the URI of the target node (Valjean is character11), the generator, and a variable to bind the returned value to. </p>
<pre class="input"> print "\nHow many neighbors are around Valjean? (should be 36)."<br> queryString = """<br> (select ?neighbors<br> (nodal-degree !lm:character11 everyone ?neighbors))<br> """<br> tupleQuery = conn.prepareTupleQuery(QueryLanguage.PROLOG, queryString)<br> result = tupleQuery.evaluate();<br> for bindingSet in result:<br> p = bindingSet.getValue("neighbors")<br> print "%s" % (p)<br> print "%s" % <strong>p.toPython()</strong></pre>
<p>Note that this function returns a string that describes an integer, which in its raw form is difficult for Python to use. We convert the raw value to a Python integer using the <strong>.toPython() </strong>method that is available to all literal values in the Python Sesame API to AllegroGraph. This example prints out both the string value and the converted number.</p>
<pre class="output">How many neighbors are around Valjean? (should be 36).
"36"^^<http://www.w3.org/2001/XMLSchema#integer>
36</pre>
<p>If you want to see the names of these neighbors, you can use either the <strong>ego-group-member</strong> function described earlier on this page, or the <strong>nodal-neighbors</strong> function shown below:</p>
<pre class="input"> print "\nWho are Valjean's neighbors? (using everyone)."<br> queryString = """<br> (select (?name)<br> (nodal-neighbors !lm:character11 everyone ?member)<br> (q ?member !dc:title ?name))<br> """<br> tupleQuery = conn.prepareTupleQuery(QueryLanguage.PROLOG, queryString)<br> result = tupleQuery.evaluate();<br> count = 0<br> for bindingSet in result:<br> count = count + 1<br> n = bindingSet.getValue("name")<br> print "%s. %s " % (count,n.toPython())</pre>
<p>This example enumerates all immediate neighbors of Valjean and returns their names. This example prints a numbered list with 36 entries:
<pre class="output">Who are Valjean's neighbors? (using everyone).<br>1. Isabeau <br>2. Fantine <br>3. Labarre <br>4. Bossuet <br>5. Brevet ...</pre>
<p>Another descriptive statistic is <strong>graph-density</strong>, which measures the density of connections within a subgraph. </p>
<p>For instance, this is Valjean's ego group with all <strong>associates</strong> included. </p>
<p><img src="graphDensity.jpg" width="806" height="297"> </p>
<p>Only 9 of 28 possible links are in place in this subgraph, so the graph density is 0.32. The following query asks AllegroGraph to calculate this figure for Valjean's ego group:</p>
<pre class="input">
(select ?density
(ego-group !lm:character11 1 associates ?group)
(graph-density ?group associates ?density))
</pre>
<p>We used the<strong> ego-group</strong> function to return a list of Valjean's ego-group members, bound to the variable <strong>?group</strong>, and then we used ?group to feed that subgraph to the <strong>graph-density</strong> function. The return value, <strong>?density</strong>, came back as a string describing a float, and had to be converted to a Python float using <strong>.toPython()</strong>.</p>
<pre class="output">Graph density of Valjean's ego group? (using associates).
"3.2142857e-1"^^<http://www.w3.org/2001/XMLSchema#double>
3.2142857e-1</pre>
<h3 id="Cliques">Cliques</h3>
<p>A "clique" is a subgraph where every node is connected to every other node by predicates specified in some generator. AllegroGraph, using everyone ("knows," "knows_well," and "barely_knows"), found that Valjean participates in 239 cliques! </p>
<p><img src="valjeanBigClique.jpg" width="859" height="301"> </p>
<p>It is counterintuitive that a "clique" should be composed mainly of people who "barely_know" each other, so let's try the same experiment using "associates," which restricts the cliques to people Valjean "knows" or "knows_well." In this case, AllegroGraph returns two cliques. One contains Valjean, Cosette, and Marius. The other contains Valjean and the Thenardiers. </p>
<p><img src="valjeanSmallCliques.jpg" width="397" height="248"> </p>
<p>This is the query that finds Valjean's "associates" cliques:</p>
<pre class="input">
(select (?clique)
(clique !lm:character11 associates ?clique))
</pre>
<p>AllegroGraph returns two cliques:</p>
<pre class="output">Valjean's cliques? Should be two (using associates).<br>[ <http://www.franz.com/lesmis#character11> <http://www.franz.com/lesmis#character25><br> <http://www.franz.com/lesmis#character24> ]<br>[ <http://www.franz.com/lesmis#character11> <http://www.franz.com/lesmis#character55><br> <http://www.franz.com/lesmis#character26> ]</pre>
<p>The first list is the clique with Marius and Cosette. The second one represents the Thernardier clique. </p>
<h3 id="Actor Centrality">Actor Centrality </h3>
<p>AllegroGraph lets us measure the relative importance of a node in a subgraph using the <strong>actor-degree-centrality()</strong> function. For instance, it should be obvious that Valjean is very "central" to his own ego group (depth of one link), because he is linked directly to all other links in the subgraph. In that case he is linked to 7 of 7 possible nodes, and his actor-degree-centrality value is 7/7 = 1. </p>
<p>However, we can regenerate Valjean's ego group using a depth of 2. This adds three nodes that are not directly connected to Valjean. How "central" is he then?</p>
<p><img src="valjeanActorCentrality.jpg" width="875" height="303"> </p>
<p>In this subgraph, Valjean's actor-degree-centrality is 0.70, meaning that he is connected to 70% of the nodes in the subgraph. </p>
<p>This example asks AllegroGraph to generate the expanded ego group, and then to measure Valjean's actor-degree-centrality:</p>
<pre class="input">
(select (?centrality)
(ego-group !lm:character11 2 associates ?group)
(actor-degree-centrality !lm:character11 ?group associates ?centrality))
</pre>
<p>Note that we asked <strong>ego-group()</strong> to explore to a depth of two links, and then fed its result (<strong>?group</strong>) to <strong>actor-degree-centrality()</strong>. This is the output:</p>
<pre class="output">Valjean's centrality to his ego group at depth 2 (using associates).
"7.0e-1"^^<http://www.w3.org/2001/XMLSchema#double>
0.7</pre>
<p>This confirms our expectation that Valjean's actor-degree-centrality should be 0.70 in this circumstance.</p>
<p>We can also measure actor centrality by calculating the average path length from a given node to the other nodes of the subgraph. This is called <strong>actor-closeness-centrality</strong>. For instance, we can calculate the average path length from Valjean to the ten nodes of his ego group (using associates and depth 2). Then we take the inverse of the average, so that bigger values will be "more central." </p>
<p><img src="valjeanActorClosenessCentrality.jpg" width="875" height="303"> </p>
<p>The actor-closeness-centrality for Valjean is 0.769. For Marius it is 0.60, showing that Valjean is more central and important to the group than is Marius. </p>
<p>This example calculates Valjean's <strong>actor-closeness-centrality</strong> for the associates ego group of depth 2. </p>
<pre class="input">
(select (?centrality)
(ego-group !lm:character11 2 associates ?group)
(actor-closeness-centrality !lm:character11 ?group associates ?centrality))
</pre>
<pre class="output">Valjean's actor-closeness-centrality to his ego group at depth 2 (using associates).
"7.692308e-1"^^<http://www.w3.org/2001/XMLSchema#double>
0.7692308</pre>
<p>That is the expected value of 0.769. </p>
<p>Another approach to centrality is to count the number of information paths that are "controlled" by a specific node. This is called<strong> actor-betweenness-centrality</strong>. For instance, there are 45 possible "shortest paths" between pairs of nodes in Valjean's associates depth-2 ego group. Valjean can act as an information valve, potentially cutting off communication on 34 of these 45 paths. Therefore, he controls 75% of the communication in the group. </p>
<p><img src="valjeanActorBetweenCentrality.jpg" width="875" height="303"></p>
<p>This example calculates Valjean's actor-betweenness-centrality:</p>
<pre class="input">
(select (?centrality)
(ego-group !lm:character11 2 associates ?group)
(actor-betweenness-centrality !lm:character11 ?group associates ?centrality))
</pre>
<pre class="output">Valjean's actor-betweenness-centrality to his ego group at depth 2 (using associates).
"7.5555557e-1"^^<http://www.w3.org/2001/XMLSchema#double>
7.5555557</pre>
<p>That's the expected result of 0.755. </p>
<h3 id="Group Centrality">Group Centrality</h3>
<p>Group-centrality measures express the "cohesiveness" of a group. There are three group-centrality measures in AllegroGraph: <strong>group-degree-centrality()</strong>, <strong>group-closeness-centrality()</strong>, and <strong>group-betweenness-centrality()</strong>.</p>
<p>To demonstrate these measures, we'll use Valjean's ego group, first at radius 1 and then at radius 2. As you recall, the smaller ego group is radially symmetrical, but the larger one is quite lop-sided. That makes the smaller group "more cohesive" than the larger one.</p>
<p> <strong>Group-degree-centrality()</strong> measures
group cohesion by finding the maximum actor centrality in the group,
summing the difference between this and each other actor's degree
centrality, and then normalizing. It ranges from 0 (when all actors have
equal degree) to 1 (when one actor is connected to every other and no
other actors have connections.</p>
<p>The prolog query takes this form:</p>
<pre class="input"> (select (?centrality)
(ego-group !lm:character11 1 associates ?group)
(group-degree-centrality ?group associates ?centrality))</pre>
<p>The query first generates Valjean's (character11) ego group at radius 1, and binds that list of characters to ?group. Then it calls group-degree-centrality() on the group and returns the answer as ?centrality. </p>
<p>The group-degree-centrality for Valjean's radius-1 ego group is 0.129. When we expand to radius 2, the group-degree-centrality drops to 0.056. The larger group is less cohesive than the smaller one. </p>
<p>The following examples were all generated from queries that strongly resemble the one above. </p>
<p> <strong>Group-closeness-centrality()</strong> is
measured by first finding the actor whose `closeness-centrality` <br>
is maximized and then summing the difference between this maximum
value and the actor-closeness-centrality of all other actors.
This value is then normalized so that it ranges between 0 and 1. </p>
<p>The group-closeness-centrality of Valjean's smaller ego group is 0.073. The expanded ego group has a group-closeness-centrality of 0.032. Again, the smaller group is more cohesive.</p>
<p> <strong>Group-betweenness-centrality()</strong> is
measured by first finding the actor whose actor-betweenness-centrality<br>
is maximized and then summing the difference between this maximum
value and the actor-betweenness-centrality of all other actors.
This value is then normalized so that it ranges between 0 and 1. </p>
<p>Valjean's smaller ego group has a group-betweenness-centrality of 0.904. The value for the larger ego group is 0.704. Even by this measure, the larger group is less cohesive. </p>
<h2 id="Transaction Control">Transaction Control (example22()) <a class="returnlink" href="#Contents">Return to Top</a></h2>
<p>Most of the time, multiple AllegroGraph users pool triples in a common session. Their data may be segregated into multiple contexts (subgraphs) for convenience, but in fact any part of this data may be retrieved by any of the users.</p>
<p>There are situations where a little more security is required. You may open a "dedicated session" and populate it with triples that the other users cannot view. These triples may be searched and manipulated in the usual ways, but do not become visible to other users until you "commit" them to the common session. </p>
<p>In order to use transaction semantics, the user account must have "start sessions" privileges with AllegroGraph Server. This is an elevated level of privilege. AllegroGraph users are profiled through the <a href="#Creating Users with WebView">WebView interface.</a></p>
<p>To experiment with transaction semantics in AllegroGraph, we will need two connections to the triple store. In the "transaction connection" we will load, rollback, reload and commit incoming triples. In the "autocommit connection" we will run queries against the resulting triple store, where the resources are always in a known and complete state. </p>
<p>In practice, transactions require only one connection. We create a special connection for transaction behavior, use it, and close it. </p>
<p>"Commit" means to make the triples in the dedicated session visible in the common session. At the time of the commit, triples in the common session are also made visible to queries in the dedicated session. The two sessions are "synched up" by the commit. </p>
<p>"Rollback" means to discard the contents of the dedicated session. It also makes all common-session triples visible in the dedicated session. </p>
<p>"Closing" the dedicated session deletes all uncommitted triples, and all rules, generators and matrices that were created in the dedicated session. Rules, generators and matrices cannot be committed. They persist as long as the dedicated session persists, and are deleted when the dedicated session is closed.</p>
<p>Example example22() performs some simple data manipulations on a dedicated session to demonstrate the rollback and commit features. It begins by creating a connection to a repository (the common session), and a second connection to a dedicated session. To do that, all you need is a second connection object, and invoke its <strong>openSession()</strong> method. </p>
<pre class="input"> server = AllegroGraphServer(AG_HOST, AG_PORT, 'test', 'xyzzy')<br> catalog = server.openCatalog('scratch') <br> myRepository = catalog.getRepository(AG_REPOSITORY, Repository.RENEW)<br> myRepository.initialize()<br> common = myRepository.getConnection()<br> dedicated = myRepository.getConnection()<br> dedicated.openSession() # open dedicated session </pre>
<p>We'll reuse the Kennedy and Les Miserables data. The Les Miserables data goes in the common session, and the Kennedy data goes in the dedicated session. </p>
<pre class="input"> path1 = "./python-kennedy.ntriples"<br> path2 = "./python-lesmis.rdf" <br> baseURI = "http://example.org/example/local"<br> ## read kennedy triples into the dedicated session:<br> print "Load 1214 python-kennedy.ntriples into dedicated session."<br> dedicated.add(path1, base=baseURI, format=RDFFormat.NTRIPLES, contexts=None)<br> ## read lesmis triples into the common session:<br> print "Load 916 lesmis triples into the common session."<br> common.addFile(path2, baseURI, format=RDFFormat.RDFXML, context=None);</pre>
<p>The two sessions should now have independent content. When we look in the common session we should see only Les Miserables triples. The dedicated session could contain only Kennedy triples. We set up a series of simple tests similar to this one:</p>
<pre class="input"> print "\nUsing getStatements() on common session; should find Valjean:"
Valjean = common.createLiteral("Valjean")
statements = common.getStatements(None, None, Valjean, 'null', limit=1)
print "Number of results: %s" % len(statements)
for s in statements:
print s
</pre>
<p>This test looks for our friend Valjean in the common session. He should be there. This is the output:</p>
<pre class="output">Using getStatements() on common session; should find Valjean:
Number of results: 1
(<http://www.franz.com/lesmis#character11>, <http://purl.org/dc/elements/1.1/title>, "Valjean")
</pre>
<p>However, there should not be anyone in the common session named "Kennedy." The code of the test is almost identical to that shown above, so we'll skip straight to the output.</p>
<pre class="output">Using getStatements() on common session; should not find Kennedy:
Number of results: 0</pre>
<p>There should be a Kennedy (at least one) visible in the dedicated session:</p>
<pre class="output">Using getStatements() on dedicated session; should find Kennedys:
Number of results: 1
(<http://www.franz.com/simple#person1>, <http://www.franz.com/simple#last-name>, "Kennedy") </pre>
<p>And finally, we should not see Valjean in the dedicated session:</p>
<pre class="output">Using getStatements() on dedicated session; should not find Valjean:
Number of results: 0 </pre>
<p>The next step in the demonstration is to roll back the data in the dedicated session. This will make the Kennedy data disappear. It will also make the Les Miserables data visible in both sessions. We'll perform the same four tests, with slightly different expectations.</p>
<p>First we roll back the transaction:</p>
<pre class="input"> dedicated.rollback() </pre>
<p>Valjean is still visible in the common session:</p>
<pre class="output">Using getStatements() on common session; should find Valjean:
Number of results: 1
(<http://www.franz.com/lesmis#character11>, <http://purl.org/dc/elements/1.1/title>, "Valjean")
</pre>
<p>There are still no Kennedys in the common session: </p>
<pre class="output">Using getStatements() on common session; should find Kennedys:<br>Number of results: 0</pre>
<p>There should be no Kennedys visible in the dedicated session:</p>
<pre class="output">Using getStatements() on dedicated session; should find Kennedys:
Number of results: 0
</pre>
<p>And finally, we should suddenly see Valjean in the dedicated session:</p>
<pre class="output">Using getStatements() on dedicated session; should not find Valjean:
Number of results: 1
(<http://www.franz.com/lesmis#character11>, <http://purl.org/dc/elements/1.1/title>, "Valjean")</pre>
<p>The rollback has succeeded in deleting the uncommitted triples from the dedicated session. It has also refreshed or resynched the dedicated session with the common session.</p>
<p>To set up the next test, we have to reload the Kennedy triples. Then we'll perform a commit. </p>
<pre class="input"> print "\nReload 1214 python-kennedy.ntriples into dedicated session."<br> dedicated.add(path1, base=baseURI, format=RDFFormat.NTRIPLES, contexts=None)<br> dedicated.commit()</pre>
<p>This should make both types of triples visible in both sessions. Here are the four tests:</p>
<pre class="output">Using getStatements() on common session; should find Valjean:
Number of results: 1
(<http://www.franz.com/lesmis#character11>, <http://purl.org/dc/elements/1.1/title>, "Valjean")</pre>
<pre class="output">Using getStatements() on common session; should find Kennedys:
Number of results: 1
(<http://www.franz.com/simple#person1>, <http://www.franz.com/simple#last-name>, "Kennedy")</pre>
<pre class="output">Using getStatements() on dedicated session; should find Kennedys:
Number of results: 1
(<http://www.franz.com/simple#person1>, <http://www.franz.com/simple#last-name>, "Kennedy")</pre>
<pre class="output">Using getStatements() on dedicated session; should find Valjean:
Number of results: 1
(<http://www.franz.com/lesmis#character11>, <http://purl.org/dc/elements/1.1/title>, "Valjean")</pre>
<p>The Les Miserables triples are visible in both sessions. So too are the Kennedy triples. </p>
<p>Remember that when you are done with a session or connection, it is appropriate to close it:</p>
<pre class="input"> dedicated.closeSession()<br> dedicated.close()<br> common.close()</pre>
<p>This recovers resources that would otherwise remain bound. </p>
<h2 id="Duplicate Triples">Duplicate Triples (example23()) <a class="returnlink" href="#Contents">Return to Top</a></h2>
<p>Most people find it annoying when a query returns multiple copies of the same information. This can happen in mulitple ways, and there are multiple strategies for reducing or eliminating the problem. There are two broad strategies to pursue:</p>
<ul>
<li>Don't create duplicate triples. It is surprisingly easy to fill the triple store with duplicates if you are not careful to generate clean RDF files.</li>
<li>Filter the duplicate results from the output of your queries. SPARQL in particular has features that reduce or eliminate duplicate results. </li>
</ul>
<h3>Tighten Up Your Queries</h3>
<p>Triple patterns sometimes act in unexpected ways, resulting in "too many" matches.</p>
<p><strong>Example23()</strong> revives the Kennedy family tree. It loads the <strong>python-kennedy.ntriples</strong> file, resulting in 1214 triples.</p>
<p>This example focuses on the three children of Ted Kennedy (person17). A simple <strong>getStatements() </strong>query shows us that all three are, in fact, present. They are person72, person74, and person76. </p>
<pre class="output">Using getStatements() find children of Ted Kennedy: three children.<br>Number of results: 3<br>(<http://www.franz.com/simple#person17>, <http://www.franz.com/simple#has-child>, <http://www.franz.com/simple#person72>)<br>(<http://www.franz.com/simple#person17>, <http://www.franz.com/simple#has-child>, <http://www.franz.com/simple#person74>)<br>(<http://www.franz.com/simple#person17>, <http://www.franz.com/simple#has-child>, <http://www.franz.com/simple#person76>) </pre>
<p>Let's imagine that for some bureaucratic or legal reason we need to retrieve any two of the senator's three children from the triple store. We might begin with a SPARQL query like this one:</p>
<pre class="input"> SELECT ?o1 ?o2 <br> WHERE {kdy:person17 kdy:has-child ?o1 .<br> kdy:person17 kdy:has-child ?o2 .} </pre>
<p>Since there are only three ways to retrieve a pair from a pool of three, we might be startled to get nine answers:</p>
<pre class="output">SPARQL matches for two children of Ted Kennedy, inept pattern.<br><http://www.franz.com/simple#person72> and <http://www.franz.com/simple#person72><br><http://www.franz.com/simple#person72> and <http://www.franz.com/simple#person74><br><http://www.franz.com/simple#person72> and <http://www.franz.com/simple#person76><br><http://www.franz.com/simple#person74> and <http://www.franz.com/simple#person72><br><http://www.franz.com/simple#person74> and <http://www.franz.com/simple#person74><br><http://www.franz.com/simple#person74> and <http://www.franz.com/simple#person76><br><http://www.franz.com/simple#person76> and <http://www.franz.com/simple#person72><br><http://www.franz.com/simple#person76> and <http://www.franz.com/simple#person74><br><http://www.franz.com/simple#person76> and <http://www.franz.com/simple#person76> </pre>
<p>Three of these matches involve the same triple matching both patterns, claiming that each person is a sibling of himself. The other six are permutations of the correct answers, in which we first discover that person72 is a sibling of person74, and then subsequently discover that person74 is a sibling of person72. We didn't need to receive that information twice. </p>
<p>Let's eliminate the useless duplications with a simple trick. Here it is in SPARQL: </p>
<pre class="input"> SELECT ?o1 ?o2 <br> WHERE {kdy:person17 kdy:has-child ?o1 .<br> kdy:person17 kdy:has-child ?o2 .<br> filter (?o1 < ?o2)} </pre>
<p>And this is the equivalent query in Prolog. Note that <strong>lispp</strong> is correct, not a typo:</p>
<pre class="input"> (select (?o1 ?o2)<br> (q !kdy:person17 !kdy:has-child ?o1)<br> (q !kdy:person17 !kdy:has-child ?o2) <br> (lispp (upi< ?o1 ?o2)))</pre>
<p>The inequality insures that the two object variables cannot be bound to the same value, eliminating the sibling-of-self issue, and also that only one of the persons can be bound to ?o1, which eliminates the duplication issue. Now we have the expected three results:</p>
<pre class="output">SPARQL matches for two children of Ted Kennedy, better pattern.<br><http://www.franz.com/simple#person72> and <http://www.franz.com/simple#person74><br><http://www.franz.com/simple#person72> and <http://www.franz.com/simple#person76><br><http://www.franz.com/simple#person74> and <http://www.franz.com/simple#person76>
</pre>
<p>Our task, however, is to pluck "any two" of the children from the triple store and then stop. That's easy in SPARQL:</p>
<pre class="input"> SELECT ?o1 ?o2 <br> WHERE {kdy:person17 kdy:has-child ?o1 .<br> kdy:person17 kdy:has-child ?o2 .<br> filter (?o1 < ?o2)}<br> LIMIT 1 </pre>
<p>This query returns one result that is guaranteed to reference two different children. </p>
<p>The moral of this example is that triple patterns often return more information than you expected, and need to be rewritten to make them less exuberant. You may be able to reduce the incidence of duplicate results simply by writing better queries. </p>
<h3>Tighten Up Your RDF</h3>
<p>The Resource Description Framework (RDF) has many fine qualities, but there are also a few RDF features that create headaches for users. One of these is the ability to encode resources as "blank nodes." This is a convenience to the person who is generating the data, but it often creates problems for the data consumer.</p>
<p>Here's a simple example. These two RDF resource descriptions represent two books by the same author. The author is described using a "blank node" within the book resource description:</p>
<pre class="input"> <rdf:Description rdf:about="http://www.franz.com/tutorial#book1"><br> <dc:title>The Call of the Wild</dc:title><br> <strong><dc:creator><br> <foaf:Person foaf:name="Jack London"/> <br> </dc:creator></strong><br> </rdf:Description><br> <br> <rdf:Description rdf:about="http://www.franz.com/tutorial#book2"><br> <dc:title>White Fang</dc:title><br> <strong><dc:creator><br> <foaf:Person foaf:name="Jack London"/> <br> </dc:creator></strong><br> </rdf:Description> </pre>
<p>This is a common RDF format used by programs that transcribe databases into RDF. In this format, there is no resource URI designated for the foaf:Person resource. Therefore, the RDF parser will generate a URI to use as the subject value of the new resource. The problem is that it generates a new URI each time it encounters an embedded resource. We wind up with eight triples and two different "Jack London" resources:</p>
<pre class="output">Two books, with one author as blank node in each book.<br>Number of results: 8<br><br>(<http://www.franz.com/tutorial#book1>, <http://purl.org/dc/elements/1.1/title>, "The Call of the Wild")<br>(<http://www.franz.com/tutorial#book1>, <http://purl.org/dc/elements/1.1/creator>, _:bE26D2A88x1)<br><br>(<http://www.franz.com/tutorial#book2>, <http://purl.org/dc/elements/1.1/title>, "White Fang")<br>(<http://www.franz.com/tutorial#book2>, <http://purl.org/dc/elements/1.1/creator>, _:bE26D2A88x2)<br><br>(_:bE26D2A88x1, <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>, <http://xmlns.com/foaf/0.1/Person>)<br>(_:bE26D2A88x1, <http://xmlns.com/foaf/0.1/name>, "Jack London")<br><br>(_:bE26D2A88x2, <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>, <http://xmlns.com/foaf/0.1/Person>)<br>(_:bE26D2A88x2, <http://xmlns.com/foaf/0.1/name>, "Jack London") </pre>
<p>You can see the two books, each with a title and a creator. Then there are two "anonymous" resources with generated subject URIs, both of which represent the same author. This is very undesirable. </p>
<p>Duplicate <em>resources</em> are difficult to remove or fix. They have different subject values, which mean their triples are technically not duplicates of each other. The author resources are directly linked to book resources, one-to-one, meaning that you can't just delete the extra authors. That would leave book resources linked to authors that don't exist anymore. </p>
<p>Clearly we don't want to be in this situation. We have to back out and generate the RDF a different way. </p>
<p>We might decide to fix this problem by rewriting the resource descriptions. This time we'll be sure that the formerly anonymous nodes are set up with URIs. This way we'll get only one author resource. This format is what RDF calls "striped syntax."</p>
<pre class="input"> <rdf:Description rdf:about="http://www.franz.com/tutorial#book1"><br> <dc:title>The Call of the Wild</dc:title><br> <dc:creator><br> <strong><foaf:Person rdf:about="#Jack"><br> <foaf:name>Jack London</foaf:name> <br> </foaf:Person></strong><br> </dc:creator><br> </rdf:Description><br> <br> <rdf:Description rdf:about="http://www.franz.com/tutorial#book2"><br> <dc:title>White Fang</dc:title><br> <dc:creator><br> <strong><foaf:Person rdf:about="#Jack"><br> <foaf:name>Jack London</foaf:name> <br> </foaf:Person></strong><br> </dc:creator><br> </rdf:Description></pre>
<p>Even though we have embedded two resource descriptions, we gave them both the same URI ("#Jack"). Did this solve the problem? We now have only one "Jack London" resource, but we still have eight triples! </p>
<pre class="output">Two books, with one author identified by URI but in striped syntax in each book.<br>Number of results: 8<br><br>(<http://www.franz.com/tutorial#book1>, <http://purl.org/dc/elements/1.1/title>, "The Call of the Wild")<br>(<http://www.franz.com/tutorial#book1>, <http://purl.org/dc/elements/1.1/creator>, <http://www.franz.com/simple#Jack>)<br>(<http://www.franz.com/tutorial#book2>, <http://purl.org/dc/elements/1.1/title>, "White Fang")<br>(<http://www.franz.com/tutorial#book2>, <http://purl.org/dc/elements/1.1/creator>, <http://www.franz.com/simple#Jack>)<br><br>(<http://www.franz.com/simple#Jack>, <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>, <http://xmlns.com/foaf/0.1/Person>)
(<http://www.franz.com/simple#Jack>, <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>, <http://xmlns.com/foaf/0.1/Person>)<br>(<http://www.franz.com/simple#Jack>, <http://xmlns.com/foaf/0.1/name>, "Jack London")<br>(<http://www.franz.com/simple#Jack>, <http://xmlns.com/foaf/0.1/name>, "Jack London")</pre>
<p>We have only one "Jack London" author resource, which means we will have a more useful graph than before, but <em>every triple in that resource is duplicated</em>. If we had cataloged fifty books by Jack London, there would be fifty copies of each of these triples. The "striped syntax" generates floods of duplicate triples. </p>
<p>It is much better to avoid blank nodes and striped syntax altogether. Here are the same two books, using a separate author resource that is linked to the books by a URI:</p>
<pre class="input"> <rdf:Description rdf:about="http://www.franz.com/tutorial#book5"><br> <dc:title>The Call of the Wild</dc:title><br> <strong><dc:creator rdf:resource="http://www.franz.com/tutorial#author1"/></strong><br> </rdf:Description><br> <br> <rdf:Description rdf:about="http://www.franz.com/tutorial#book6"><br> <dc:title>White Fang</dc:title><br> <strong><dc:creator rdf:resource="http://www.franz.com/tutorial#author1"/></strong><br> </rdf:Description><br> <br> <rdf:Description <strong>rdf:about="http://www.franz.com/tutorial#author1"</strong>><br> <dc:title>Jack London</dc:title><br> </rdf:Description> </pre>
<p>This is arguably the "best" syntax to follow because one author resource is directly connected to all of that author's books. The graph is rich in nodes and connections, while avoiding duplicate triples. This example creates six triples, none of which are duplicates:</p>
<pre class="output">Two books, with one author linked by a URI.<br>Number of results: 6<br><br>(<http://www.franz.com/tutorial#book5>, <http://purl.org/dc/elements/1.1/title>, "The Call of the Wild")<br>(<http://www.franz.com/tutorial#book5>, <http://purl.org/dc/elements/1.1/creator>, <http://www.franz.com/tutorial#author1>)<br>(<http://www.franz.com/tutorial#book6>, <http://purl.org/dc/elements/1.1/title>, "White Fang")<br>(<http://www.franz.com/tutorial#book6>, <http://purl.org/dc/elements/1.1/creator>, <http://www.franz.com/tutorial#author1>)<br><br>(<http://www.franz.com/tutorial#author1>, <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>, <http://xmlns.com/foaf/0.1/Person>)<br>(<http://www.franz.com/tutorial#author1>, <http://purl.org/dc/elements/1.1/title>, "Jack London")</pre>
<p>There is only one way to simplify the example from here. Perhaps you really don't need author resources at all. It could be sufficient to know the name of a book's author and never reify the author as a node in the graph. In that case, you can pare down the resource descriptions by including the author name as a literal string:</p>
<pre class="input"> <rdf:Description rdf:about="http://www.franz.com/tutorial#book3"><br> <dc:title>The Call of the Wild</dc:title><br> <strong><dc:creator>Jack London</dc:creator></strong><br> </rdf:Description><br> <br> <rdf:Description rdf:about="http://www.franz.com/tutorial#book4"><br> <dc:title>White Fang</dc:title><br> <strong><dc:creator>Jack London</dc:creator></strong><br> </rdf:Description>
</pre>
<p>This example generates only four triples, none of which are duplicates. We have two books, and no author resource. </p>
<pre class="output" >Two books, with one author as a literal value.<br>Number of results: 4
<br>(<http://www.franz.com/tutorial#book3>, <http://purl.org/dc/elements/1.1/title>, "The Call of the Wild")<br>(<http://www.franz.com/tutorial#book3>, <http://purl.org/dc/elements/1.1/creator>, "Jack London")<br><br>(<http://www.franz.com/tutorial#book4>, <http://purl.org/dc/elements/1.1/title>, "White Fang")<br>(<http://www.franz.com/tutorial#book4>, <http://purl.org/dc/elements/1.1/creator>, "Jack London")</pre>
<p>The lesson here is to keep the representation simple. The fewer resources there are, the faster everything will work. </p>
<h3>Don't Create Duplicate Triples</h3>
<p>Now we'll consider the situation where we have multiple copies of the same information in the triple store. This is the classic "duplicate triples" situation. </p>
<p>True duplicate triples do not occur by accident. They occur only when you have loaded the same information into the triple store more than once. </p>
<p>This is easy to demonstrate. Let's load the Kennedy graph into an empty triple store:</p>
<pre class="output">Load 1214 python-kennedy.ntriples.
After loading, there are:
1214 kennedy triples in context 'null';</pre>
<p>Then just load the same file again:</p>
<pre class="output">Reload 1214 python-kennedy.ntriples.
After loading, there are:
2428 kennedy triples in context 'null';</pre>
<p>Now there are two copies of every Kennedy triple. If you add the same triple multiple times, you will get multiple copies of it. </p>
<h3></h3>
<h3>Filter Out Duplicate Results </h3>
<p>In practice, our advice "don't create duplicate triples" may be difficult to follow. Some data feeds contain duplicated information and there is no convenient or efficient way to filter it out. So now you have duplicated data in the system. How much trouble might that cause?</p>
<p>This simple query should return three matches, one for each of Ted Kennedy's three children: </p>
<pre class="input"> SELECT ?o WHERE {kdy:person17 kdy:has-child ?o}</pre>
<p>However, because each of the expected triples has a duplicate, we get six answers instead of three: </p>
<pre class="output">SPARQL matches for children of Ted Kennedy.<br><http://www.franz.com/simple#person72><br><http://www.franz.com/simple#person74><br><http://www.franz.com/simple#person76><br><http://www.franz.com/simple#person72><br><http://www.franz.com/simple#person74><br><http://www.franz.com/simple#person76></pre>
<p>That's a nuisance, but SPARQL provides an easy way to wipe out the duplicate answers: </p>
<pre class="input"> SELECT DISTINCT ?o WHERE {kdy:person17 kdy:has-child ?o}</pre>
<p>The DISTINCT operator does not remove duplicate triples, but it detects and eliminates duplicate variable bindings in the query's output. The duplicate triples are still there in the triple store, but we don't see them in the output:</p>
<pre class="output">SPARQL DISTINCT matches for children of Ted Kennedy.<br><http://www.franz.com/simple#person72><br><http://www.franz.com/simple#person76><br><http://www.franz.com/simple#person74></pre>
<p>DISTINCT works by sorting the bindings by each of the bound variables in the result. This forces duplicate results to be adjacent to each other in the result list. Then it runs over the list and eliminates bindings that are the same as the previous binding. As you can imagine, there are situations where forcing an exhaustive sort on a large binding set might use up a lot of time. </p>
<p>For this reason, SPARQL also offers a REDUCED operator:</p>
<pre class="input"> SELECT REDUCED ?o WHERE {kdy:person17 kdy:has-child ?o} ORDER BY ?o</pre>
<p>REDUCED performs the same sweep for duplicates that DISTINCT performs, but it lets you control the sorting. In this example the values of the subject and predicate are fixed, so sorting by the object value is sufficient to force all duplicate bindings into contact with each other. REDUCED is often much faster than DISTINCT.</p>
<h3>Filtering Duplicate Triples while Loading </h3>
<p>AllegroGraph could check each incoming triple to see if that information is already present in the triple store, but this process would be very time-consuming, slowing down our extremely-fast <a href="http://www.franz.com/agraph/allegrograph/">load times</a> by orders of magnitude. Loading speed is important to almost everyone, so AllegroGraph does not filter duplicates during the load. </p>
<p>If loading speed isn't critical in your application, you can add triples one at a time while checking for duplicates as shown here:</p>
<pre class="input"> if conn.getStatements(newParent, hasChild, newChild):<br> print "Did not add new triple."<br> else:<br> conn.add(newParent, hasChild, newChild)<br> print "Added new triple." </pre>
<p>If <strong>getStatements()</strong> return any value, then the new triple is already present in the store. If not, then we can add it to the store knowing that it will be unique. </p>
<p>When you run this example twice it adds a triple the first time, but not the second time:</p>
<pre class="output">Test before adding triple, first trial:
Added new triple.
Test before adding triple, second trial:
Did not add new triple.</pre>
<h3>Duplicates in Federated Stores</h3>
<p>A <a href="#Federated Repositories">federated store</a> is a single connection to multiple AllegroGraph repositories, possibly on multiple servers at multiple sites. Such systems can have duplicate triples, but deleting them is unwise.</p>
<p>Presumably any existing repository has a purpose of its own, and has been federated with other respositories to serve some combined purpose. It would be a mistake to delete triples from one repository simply because they also occur elsewhere in the federated store. This could damage the integrity of the individual repositories when they are used in stand-alone mode. By similar reasoning, it is a mistake to add triples to a federated repository. Which repository gets the new triples? </p>
<p>For all of these reasons, federated stores are "read only" in AllegroGraph. Attempting to add or delete triples in a federated system result in error messages. </p>
<p>Federation changes the semantics of "duplicate triples." Be sure to take this into account in your project design. </p>
</body>
</html>
| 243,984 | Common Lisp | .l | 2,046 | 116.835288 | 1,001 | 0.729918 | wvxvw/agraph-client | 0 | 0 | 0 | EPL-1.0 | 9/19/2024, 11:36:20 AM (Europe/Amsterdam) | 199c9ac78588df20eeffee24dc121288b4388ac2be6774d639099b7fe98ed761 | 28,732 | [
-1
] |
28,733 | python-blankNodes2.rdf | wvxvw_agraph-client/tutorial/python-blankNodes2.rdf | <?xml version='1.0' encoding='ISO-8859-1'?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc = "http://purl.org/dc/elements/1.1/"
xmlns:foaf = "http://xmlns.com/foaf/0.1/">
<!-- Example 1: Two books, same author, anonymous nodes, show duplicate triples. -->
<rdf:Description rdf:about="http://www.franz.com/tutorial#book1">
<dc:title>The Call of the Wild</dc:title>
<dc:creator>
<foaf:Person rdf:about="#Jack">
<foaf:name>Jack London</foaf:name>
</foaf:Person>
</dc:creator>
</rdf:Description>
<rdf:Description rdf:about="http://www.franz.com/tutorial#book2">
<dc:title>White Fang</dc:title>
<dc:creator>
<foaf:Person rdf:about="#Jack">
<foaf:name>Jack London</foaf:name>
</foaf:Person>
</dc:creator>
</rdf:Description>
</rdf:RDF> | 827 | Common Lisp | .l | 22 | 33.363636 | 84 | 0.664573 | wvxvw/agraph-client | 0 | 0 | 0 | EPL-1.0 | 9/19/2024, 11:36:20 AM (Europe/Amsterdam) | 8329f2790f3c7dc8a2fd3bcc46ee6b7da0b6da5f3f4983bc64d42ac12a95107a | 28,733 | [
-1
] |
28,734 | python-blankNodes1.rdf | wvxvw_agraph-client/tutorial/python-blankNodes1.rdf | <?xml version='1.0' encoding='ISO-8859-1'?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc = "http://purl.org/dc/elements/1.1/"
xmlns:foaf = "http://xmlns.com/foaf/0.1/">
<!-- Example 1: Two books, same author, anonymous nodes, show duplicate triples. -->
<rdf:Description rdf:about="http://www.franz.com/tutorial#book1">
<dc:title>The Call of the Wild</dc:title>
<dc:creator>
<foaf:Person foaf:name="Jack London"/>
</dc:creator>
</rdf:Description>
<rdf:Description rdf:about="http://www.franz.com/tutorial#book2">
<dc:title>White Fang</dc:title>
<dc:creator>
<foaf:Person foaf:name="Jack London"/>
</dc:creator>
</rdf:Description>
</rdf:RDF> | 719 | Common Lisp | .l | 18 | 36.222222 | 84 | 0.677746 | wvxvw/agraph-client | 0 | 0 | 0 | EPL-1.0 | 9/19/2024, 11:36:20 AM (Europe/Amsterdam) | a4ac944fad92cd14e74b5499d950a060772a88a1e29111ed9b0e6fa5f1d60fde | 28,734 | [
-1
] |
28,735 | python-rules.txt | wvxvw_agraph-client/tutorial/python-rules.txt | ;; Prolog rules that define relative relations
;; Assumes that the prefix 'rltv' is bound to a namespace
;; of your choice
(<-- (string-concat ?result ?string1 ?string2 ?string3)
(lisp ?result (string+ ?string1 ?string2 ?string3)))
(<-- (name ?person ?first ?last)
(q ?person !rltv:first-name ?first)
(q ?person !rltv:last-name ?last))
(<-- (woman ?person)
(q ?person !rltv:sex !rltv:female)
(q ?person !rdf:type !rltv:person))
(<-- (man ?person)
(q ?person !rltv:sex !rltv:male)
(q ?person !rdf:type !rltv:person))
(<-- (father ?parent ?child)
(man ?parent)
(q ?parent !rltv:has-child ?child))
(<-- (mother ?parent ?child)
(woman ?parent)
(q ?parent !rltv:has-child ?child))
(<-- (parent ?father ?child)
(father ?father ?child))
(<-- (parent ?mother ?child)
(mother ?mother ?child))
(<-- (grandparent ?x ?y)
(parent ?x ?z)
(parent ?z ?y))
(<-- (grandchild ?x ?y)
(grandparent ?y ?x))
(<-- (ancestor ?x ?y)
(parent ?x ?y))
(<- (ancestor ?x ?y)
(parent ?x ?z)
(ancestor ?z ?y))
(<-- (descendent ?x ?y)
(ancestor ?y ?x))
(<-- (aunt ?x ?y)
(father ?z ?x)
(woman ?x)
(father ?z ?w)
(not (= ?x ?w))
(parent ?w ?y))
(<-- (uncle ?uncle ?child)
(man ?uncle)
(parent ?grandparent ?uncle)
(parent ?grandparent ?siblingOfUncle)
(not (= ?uncle ?siblingOfUncle))
(parent ?siblingOfUncle ?child))
(<-- (nephew ?x ?y)
(aunt ?y ?x)
(man ?x))
(<- (nephew ?x ?y)
(uncle ?y ?x)
(man ?x))
(<-- (niece ?x ?y)
(aunt ?y ?x)
(woman ?x))
(<- (niece ?x ?y)
(uncle ?y ?x)
(woman ?x))
(<-- (parent-child-have-same-name ?x ?y)
(q- ?x !rltv:first-name ?n1)
(parent ?x ?y)
(q- ?y !rltv:first-name ?n2)
(= ?n1 ?n2))
(<-- (parent-child-went-to-ivy-league-school ?x ?y)
(q- ?x !rltv:alma-mater ?am)
(q- ?am !rltv:ivy-league !rltv:true)
(parent ?x ?y)
(q- ?y !rltv:alma-mater ?am2)
(q- ?am2 !rltv:ivy-league !rltv:true))
(<-- (parent-child-went-to-same-ivy-league-school ?x ?y)
(q- ?x !rltv:alma-mater ?am)
(q- ?am !rltv:ivy-league !rltv:true)
(parent ?x ?y)
(q- ?y !rltv:alma-mater ?am))
(<-- (spouse ?x ?y)
(q ?x !rltv:spouse ?y))
;; ?x has a spouse and children
(<-- (family ?x ?fam)
(q ?x !rltv:spouse ?sp)
(bagof ?ch (parent ?x ?ch) ?bag)
(append ?bag (?sp) ?fam)
;#!
)
| 2,424 | Common Lisp | .l | 85 | 24.188235 | 61 | 0.556134 | wvxvw/agraph-client | 0 | 0 | 0 | EPL-1.0 | 9/19/2024, 11:36:20 AM (Europe/Amsterdam) | 83fa03c281de7089218774393781f9d898617247c2fb9dbb1d09c9129085be3c | 28,735 | [
-1
] |
28,736 | python-API-40.html | wvxvw_agraph-client/tutorial/python-API-40.html | <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" >
<title>Python API Tutorial for AllegroGraph 4.2</title>
<style type="text/css">
.input { margin-left:4em; background-color:#ADDFFF;}
.output { margin-left:4em; background-color:#F1F1F1;}
.returnlink {font-size:small; font-weight:normal; }
</style>
</head>
<body>
<h1>Python API Reference for AllegroGraph 4.2</h1>
<p>This is a description of the Python Application Programmer's Interface (API) to AllegroGraph RDFStore™ version 4.2 from <a href="http://agraph.franz.com/allegrograph/">Franz Inc.</a> </p>
<p>
The Python API offers convenient and efficient
access to an AllegroGraph server from a Python-based application. This API provides methods for
creating, querying and maintaining RDF data, and for managing the stored triples. </p>
<table border="1">
<tr>
<td width="867">The Python API deliberately emulates the Aduna Sesame API to make it easier to migrate from Sesame to AllegroGraph. The Python API has also been extended in ways that make it easier and more intuitive than the Sesame API.</td>
</tr>
</table>
<h2 id="Contents">Contents</h2>
<ul>
<li><a href="#AllegroGraphServer Class">AllegroGraphServer Class</a></li>
<li><a href="#Catalog Class">Catalog Class</a></li>
<li><a href="#Repository Class">Repository Class</a></li>
<li><a href="#RepositoryConnection Class">RepositoryConnection Class</a></li>
<li><a href="#Query Class">Query Class</a></li>
<ul>
<li><a href="#Subclass TupleQuery">Subclass TupleQuery</a></li>
<li><a href="#Subclass GraphQuery">Subclass GraphQuery</a></li>
<li><a href="#Subclass BooleanQuery">Subclass BooleanQuery</a></li>
</ul>
<li><a href="#RepositoryResult Class">RepositoryResult Class</a> </li>
<li><a href="#Statement Class">Statement Class</a> </li>
<li><a href="#ValueFactory Class">ValueFactory Class</a></li>
</ul>
<h2 id="AllegroGraphServer Class">AllegroGraphServer Class <a class="returnlink" href="#Contents">Return to Top</a></h2>
<p>The AllegroGraphServer object represents a remote AllegroGraph server on the network. It is used to inventory and access the catalogs of that server.</p>
<p> Source: /AllegroGraphDirectory/src2/franz/openrdf/sail/allegrographserver.py.</p>
<h3>Constructor</h3>
<p>AllegroGraphServer(self, host, port=10035,user=None,password=None)</p>
<ul>
<li><em>host</em> is a string describing the network path to the AllegroGraph server. No default. </li>
<li><em>port</em> is the AllegroGraph HTTP port on the server. It is an integer that defaults to 10035.</li>
<li><em>user</em> is an AllegroGraph user name.</li>
<li><em>password</em> is the user's password. </li>
</ul>
<dl>
<dt>Example:</dt>
</dl>
<pre> server = AllegroGraphServer(path="localhost", port="8080", user="test", password="pw") </pre>
<h3>Methods</h3>
<table width="769" border="2px" cellpadding="4px" style="border-collapse:collapse; border-color:#0000FF;" >
<tr>
<td>getInitfile(self)</td>
<td>Retrieve the contents of the server initialization file. </td>
</tr>
<tr>
<td>listCatalogs(self)</td>
<td>Returns a string containing the names of the server's catalogs. </td>
</tr>
<tr>
<td>openCatalog(self, name=None)</td>
<td>Returns a <a href="#Catalog Class">Catalog</a> object. <em>Name</em> is one of the catalog names from listCatalogs() or "None" to open the rootCatalog described in the AllegroGraph configuration file. </td>
</tr>
<tr>
<td>openFederated(self, repositories, autocommit=False, lifetime=None, loadinitfile=False)</td>
<td>Open a session that federates several repositories. The<br>
<em>repositories</em> argument should be an array containing store<br>
designators, which can be Repository or RepositoryConnection
objects, strings (naming a store in the root catalog, or the
URL of a store), or (storename, catalogname) tuples.<br></td>
</tr>
<tr>
<td>openSession(self,spec, autocommit=False, lifetime=None, loadinitfile=False)</td>
<td>Open a session on a federated, reasoning, or filtered store.<br>
Use the helper functions in the franz.openrdf.sail.spec module
to create the spec string.</td>
</tr>
<tr>
<td>setInitfile(self, content=None, restart=True)</td>
<td>Replace the current initialization file contents with the content string or remove if None. Restart specifies whether to shut down any current running back ends, so that subsequent requests will be handled by back ends that have loaded the new init file. </td>
</tr>
<tr>
<td>url(self)</td>
<td>Return the server's URL. </td>
</tr>
<tr>
<td>version(self)</td>
<td>Return the server's version as a string. </td>
</tr>
</table>
<h2 id="Catalog Class">Catalog Class <a class="returnlink" href="#Contents">Return to Top</a></h2>
<p>A Catalog object is a container for multiple repositories. </p>
<p>Source: /AllegroGraphDirectory/scr2/franz/openrdf/sail/allegrographserver.py.</p>
<h3>Constructor</h3>
<p>Invoke the Catalog constructor using the <a href="#AllegroGraphServer Class">AllegroGraphServer</a>.openCatalog() method.</p>
<pre> catalog = server.openCatalog('scratch') </pre>
<h3>Methods</h3>
<table width="969" border="2px" cellpadding="4px" style="border-collapse:collapse; border-color:#0000FF;">
<tr>
<td valign="top">createRepository(self, name)</td>
<td>Creates a new Repository within the Catalog. <em>name</em> is a string identifying the repository. </td>
</tr>
<tr>
<td valign="top">deleteRepository(self, name) </td>
<td>Deletes the named Respository from the Catalog. </td>
</tr>
<tr>
<td width="168" valign="top">getName(self)</td>
<td width="591">Returns a string containing the name of this Catalog. </td>
</tr>
<tr>
<td valign="top">getRepository(self, name, access_verb)</td>
<td>Returns a <a href="#Repository Class">Repository</a> object. <em>name </em>is a repository name from listRepositories(). <em>access_verb</em> is one of the following:
<ul>
<li><strong>Repository.RENEW</strong> clears the contents of an existing repository before opening. If the indicated repository does not exist, it creates one. </li>
<li><strong>Repository.OPEN</strong> opens an existing repository, or throws an exception if the repository is not found. </li>
<li><strong>Repository.ACCESS</strong> opens an existing repository, or creates a new one if the repository is not found.</li>
<li><strong>Repository.CREATE</strong> creates a new repository, or throws an exception if one by that name already exists.</li>
</ul></td>
</tr>
<tr>
<td valign="top">listRepositories(self)</td>
<td>Returns a list of repository names (triple stores) managed by this Catalog.</td>
</tr>
</table>
<h2 id="Repository Class">Repository Class <a class="returnlink" href="#Contents">Return to Top</a></h2>
<p>A repository contains RDF data that can be queried and updated.
Access to the repository can be acquired by opening a connection to it.
This connection can then be used to query and/or update the contents of the
repository. Depending on the implementation of the repository, it may or may
not support multiple concurrent connections.</p>
<p>Please note that a repository needs to be initialized before it can be used
and that it should be shut down before it is discarded/garbage collected.
Forgetting the latter can result in loss of data (depending on the Repository
implementation)! </p>
<p>Source: /AllegroGraphDirectory/scr2/franz/openrdf/repository/repository.py.</p>
<h3>Constructor</h3>
<p>Invoke the Repository constructor using the <a href="#AllegroGraphServer Class">AllegroGraphServer</a>.getRepository() method.</p>
<pre> myRepository = catalog.getRepository("agraph_test", accessMode)</pre>
<h3>Methods</h3>
<table width="969" border="2px" cellpadding="4px" style="border-collapse:collapse; border-color:#0000FF;">
<tr>
<td valign="top">getConnection(self)</td>
<td><p>Creates a <a href="#RepositoryConnection Class">RepositoryConnection</a> object that can be used for querying and<br>
updating the contents of the Repository. Returns the RepositoryConnection object. </p></td>
</tr>
<tr>
<td width="168" valign="top">getDatabaseName(self)</td>
<td width="591">Returns a string containing the name of this Repository. </td>
</tr>
<tr>
<td valign="top">getSpec(self)</td>
<td>Returns a string consisting of the catalog name concatenated with the repository name. </td>
</tr>
<tr>
<td valign="top">getValueFactory(self)</td>
<td>Return a <a href="#ValueFactory Class">ValueFactory</a> for this store. This is present for Aduma Sesame compatibility, but in the Python API all ValueFactory functionality has been duplicated or subsumed in the <a href="#RepositoryConnection Class">RepositoryConnection</a> class. It isn't necessary to manipulate the ValueFactory class at all. </td>
</tr>
<tr>
<td valign="top">initialize(self)</td>
<td> A Repository must be initialized before it can be used. Returns the initialized Repository object. </td>
</tr>
<tr>
<td valign="top">isWritable(self)</td>
<td> Checks whether this Repository is writable, i.e. if the data contained in this store can be changed. </td>
</tr>
<tr>
<td valign="top">registerDatatypeMapping(self, predicate=None, datatype=None, nativeType=None)</td>
<td><p>Register an inlined datatype. <em>Predicate</em> is the URI of predicate used in the triple store. <em>Datatype</em> may be one of: XMLSchema.INT, XMLSchema.LONG, XMLSchema.FLOAT, XMLSchema.DATE, and XMLSchema.DATETIME. <em>NativeType</em> may be "int", "datetime", or "float".</p>
<p> You must supply <em>nativeType</em> and either <em>predicate</em> or <em>datatype</em>. </p>
<p>If <em>predicate</em>, then object arguments to triples with that predicate will use an inlined encoding of type <em>nativeType</em> in their internal representation. If <em>datatype</em>, then typed literal objects with a datatype matching <em>datatype</em> will use an inlined encoding of type <em>nativeType</em>. (Duplicated in the <a href="#RepositoryConnection Class">RepositoryConnection</a> class for Python user convenience.) </p></td>
</tr>
<tr>
<td valign="top">shutdown(self)</td>
<td><p>Shuts the Repository down, releasing any resources that it keeps hold of.<br>
Once shut down, the store can no longer be used.</p></td>
</tr>
</table>
<h2 id="RepositoryConnection Class">RepositoryConnection Class <a class="returnlink" href="#Contents">Return to Top</a></h2>
<p>The RepositoryConnection class is the main interface for updating data in and performing queries on a <a href="#Repository Class">Repository</a>. By default, a RespositoryConnection is in autoCommit mode, meaning that each operation corresponds to a single transaction on the underlying triple store. autoCommit can be switched off, in which case it is up to the user to handle transaction commit/rollback. Note that care should be taken to always properly close a RepositoryConnection after one is finished with it, to free up resources and avoid unnecessary locks.<br>
<br>
Several methods take a <em>vararg</em> argument that optionally specifies a (set of) context(s) on which the method should operate. (A context is the URI of a subgraph.) Note that a <em>vararg</em> parameter is optional, it can be completely left out of the method call, in which case a method either operates on a provided statement's context (if one of the method parameters is a statement or collection of statements), or operates on the repository as a whole, completely ignoring context. A <em>vararg</em> argument may also be null (cast to Resource) meaning that the method operates on those statements which have no associated context only.</p>
<p>Source: /AllegroGraphDirectory/scr2/franz/openrdf/repository/repositoryconnection.py.</p>
<h3>Constructor</h3>
<p>RepositoryConnection(self, repository)</p>
<p>where <em>repository</em> is the <a href="#Repository Class">Repository</a> object that created this RepositoryConnection. </p>
<p>Example: The best practice is to use the <a href="#Repository Class">Repository</a>.getConnection() method, which supplies the <em>repository</em> parameter to the construction method. .</p>
<pre> connection = myRepository.getConnection()</pre>
<h3>General Connection Methods</h3>
<p>This table contains the repositoryConnection methods that create, maintain, search, and delete triple stores. There are following tables that list special methods for <a href="#Free Text Search Methods">Free Text Search</a>, <a href="#Prolog Rule Inference Methods">Prolog Rule Inference</a>, <a href="#Geospatial Reasoning Methods">Geospatial Reasoning</a>, <a href="#Social Network Analysis Methods">Social Network Analysis,</a> <a href="#Transactions">Transactions</a> and <a href="#SPOGI">Subject Triples Caching</a>. </p>
<table width="1057" border="2px" cellpadding="4px" style="border-collapse:collapse; border-color:#0000FF;">
<tr>
<td valign="top">add(self, arg0, arg1=None, arg2=None, contexts=None, base=None, format=None, serverSide=False)</td>
<td><p>Calls addTriple(), addStatement(), or addFile(). Best practice is to avoid add() and use addFile(), addStatement(), and addTriple() instead. </p>
<p><em>arg0</em> may be a <a href="#Statement Class">Statement</a> or a <em>filepath</em>. If so, <em>arg1</em> and <em>arg2</em> default to None. </p>
<p><em>arg0, arg1</em>, and <em>arg2</em> may be the subject, predicate and object of a single triple. </p>
<p><em>contexts</em> is an optional list of contexts (subgraph URIs), defaulting to None. A context is the URI of a subgraph. If None, the triple(s) will be added to the null context (the default or background graph).</p>
<p><em>base</em> is the baseURI to associate with loading a file. Defaults to None. </p>
<p><em>format</em> is RDFFormat.NTRIPLES or RDFFormat.RDFXML. Defaults to None.</p>
<p><em>serverSide</em> indicates whether the <em>filepath</em> refers to a file on the client computer or on the server. Defaults to False. </p></td>
</tr>
<tr>
<td valign="top">addFile(self, filePath, base=None, format=None, context=None, serverSide=False)</td>
<td><p>Loads a file into the triple store. Note that a file can be loaded into only one context. </p>
<p><em>filepath</em> identifies the file to load. </p>
<p><em>context</em> is an optional context URI (subgraph URI), defaulting to None. If None, the triple(s) will be added to the null context (the default or background graph).</p>
<p><em>base</em> is the baseURI to associate with loading a file. Defaults to None. </p>
<p><em>format</em> is RDFFormat.NTRIPLES or RDFFormat.RDFXML. Defaults to None.</p>
<p><em>serverSide</em> indicates whether the <em>filepath</em> refers to a file on the client computer or on the server. Defaults to False. </p></td>
</tr>
<tr>
<td valign="top">addStatement(self, statement, contexts=None)</td>
<td>Add the supplied <em><a href="#Statement Class">Statement</a></em> to the specified <em>contexts</em> of the repository. <em>contexts</em> defaults to None, which adds the statement to the null context (the default or background graph).</td>
</tr>
<tr>
<td valign="top">addTriple(self, subject, predicate, object, contexts=None)</td>
<td>Adds a single triple to the repository. <em>subject, predicate</em> and <em>object</em> are the three values of the triple. <em>contexts </em>is an optional list of context URIs to add the triple to, defaulting to None. If None, the triple will be added to the null context (the default or background graph). </td>
</tr>
<tr>
<td valign="top">addTriples(self, triples_or_quads, context=ALL_CONTEXTS, ntriples=False)</td>
<td>Add the supplied <em>triples_or_quads</em> to this repository. Each triple can be a list or a tuple of Values.<em> context</em> is the URI of a subgraph, which will be stored in the fourth field of the "triple," defaulting to ALL_CONTEXTS. If <em>ntriples</em> is True, then the triples or quads are assumed to contain valid ntriples strings, and they are passed to the server with no conversion. The default value is False. </td>
</tr>
<tr>
<td valign="top">clear(self, contexts=ALL_CONTEXTS)</td>
<td>Removes all statements from the designated list of <em>contexts</em> (subgraphs) in the repository. If
<em>contexts</em> is ALL_CONTEXTS (the default), it clears the repository of all statements. </td>
</tr>
<tr>
<td valign="top">clearNamespaces(self)</td>
<td>Remove all namespace declarations from the current environment. </td>
</tr>
<tr>
<td width="233" valign="top">close(self)</td>
<td width="549">Closes the connection in order to free up resources. </td>
</tr>
<tr>
<td valign="top">createBNode(self, nodeID=None)</td>
<td>Creates a new blank node with the given node identifier. nodeID defaults to None. If <em>nodeID</em> is None, a new, unused node ID is generated. </td>
</tr>
<tr>
<td valign="top">createLiteral(self, value, datatype=None, language=None)</td>
<td>Create a new literal with <em>value</em>. <em>datatype</em> if supplied, should be a URI, in which case <em>value</em> should be a string. You may optionally include an RDF <em>language</em> attribute. <em>datatype </em>and <em>language</em> default to None. </td>
</tr>
<tr>
<td valign="top">createRange(self, lowerBound, upperBound)</td>
<td>Create a compound literal representing a range from <em>lowerBound</em> to <em>upperBound</em>.</td>
</tr>
<tr>
<td valign="top">createStatement(self, subject, predicate, object, context=None)</td>
<td>Create a new <a href="#Statement Class">Statement</a> object using the supplied <em>subject, predicate</em> and <em>object</em>
and associated <em>context</em>, which defaults to None. The context is the URI of a subgraph.</td>
</tr>
<tr>
<td valign="top">createURI(self, uri=None, namespace=None, localname=None)</td>
<td>Creates a new URI object from the supplied string-representation(s). <em>uri</em> is a string representing an entire URI. <em>namespace</em> and <em>localname</em> are combined to create a URI. If two non-keyword arguments are passed, it assumes they represent a<br>
<em>namespace/localname </em>pair.</td>
</tr>
<tr>
<td valign="top">export(self, handler, contexts=ALL_CONTEXTS)</td>
<td>Exports all triples in the repository to an external file. <em>handler</em> is either an NTriplesWriter() object or an RDFXMLWriter() object. The export may be optionally confined to a list of <em>contexts</em> (default is ALL_CONTEXTS). Each context is the URI of a subgraph. </td>
</tr>
<tr>
<td valign="top">exportStatements(self, subj, pred, obj, includeInferred, handler, contexts=ALL_CONTEXTS)</td>
<td>Exports all triples that match <em>subj</em>, <em>pred</em> and/or <em>obj</em>. May optionally <em>includeInferred</em> statements provided by RDFS++ inference (default is False). <em>handler</em> is either an NTriplesWriter() object or an RDFXMLWriter() object. The export may be optionally confined to a list of <em>contexts</em> (default is ALL_CONTEXTS). Each context is the URI of a subgraph. </td>
</tr>
<tr>
<td valign="top">getAddCommitSize(self)</td>
<td>Returns the current setting of the add_commit_size property. See setAddCommitSize(). </td>
</tr>
<tr>
<td valign="top">getContextIDs(self)</td>
<td>Return a list of context URIs, one for each subgraph referenced by a quad in
the triple store. Omits the default context because its ID would be null.</td>
</tr>
<tr>
<td valign="top">getNamespace(self, prefix)</td>
<td>Returns the namespace that is associated with <em>prefix</em>, if any. </td>
</tr>
<tr>
<td valign="top">getNamespaces(self)</td>
<td>Returns a Python dictionary of prefix/namespace pairings. The default namespaces are: rdf, rdfs, xsd, owl, fti, dc, and dcterms. </td>
</tr>
<tr>
<td valign="top">getSpec(self)</td>
<td>Returns a string composed of the catalog name concatenated with the repository name. </td>
</tr>
<tr>
<td valign="top">getStatements(self, subject, predicate, object, contexts=ALL_CONTEXTS, includeInferred=False,<br>
limit=None, tripleIDs=False)</td>
<td>Gets all statements with a specific <em>subject</em>, <em>predicate</em> and/or <em>object</em> from the repository. The result is optionally restricted to the specified set of named <em>contexts</em> (default is ALL_CONTEXTS). A context is the URI of a subgraph. Returns a <a href="#RepositoryResult Class">RepositoryResult</a> iterator that produces a '<a href="#Statement Class">Statement</a>' each time that 'next' is called. May optionally <em>includeInferred</em> statements provided by RDFS++ inference (default is False). Takes an optional <em>limit</em> on the number of statements to return. If <em>tripleIDs</em> is True, the output includes the triple ID field (the fifth field of the quad). </td>
</tr>
<tr>
<td valign="top">getStatementsById(self, ids) </td>
<td>Return all statements whose triple ID matches an ID in the list of <em>ids.</em> </td>
</tr>
<tr>
<td valign="top">getValueFactory(self)</td>
<td>Returns the <a href="#ValueFactory Class">ValueFactory</a> object associated with this RepositoryConnection. </td>
</tr>
<tr>
<td valign="top">isEmpty(self)</td>
<td>Returns True if size() is zero. </td>
</tr>
<tr>
<td valign="top">prepareBooleanQuery(self, queryLanguage, queryString, baseURI=None)</td>
<td>Parse <em>queryString</em> into a <a href="#Query Class">Query</a> object which can be executed against the RDF storage. <em>queryString</em> must be an ASK query. The result is true or false. <em>queryLanguage</em> is one of SPARQL, PROLOG, or COMMON_LOGIC. <em>baseURI</em> optionally provides a URI prefix (defaults to None). Returns a <a href="#Query Class">Query</a> object. The result of query execution will be True of False. </td>
</tr>
<tr>
<td valign="top">prepareGraphQuery(self, queryLanguage, queryString, baseURI=None)</td>
<td>Parse <em>queryString</em> into a <a href="#Query Class">Query</a> object which can be executed against the RDF storage. <em>queryString</em> must be a CONSTRUCT or DESCRIBE query. <em>queryLanguage</em> is one of SPARQL, PROLOG, or COMMON_LOGIC. <em>baseURI</em> optionally provides a URI prefix (defaults to None). Returns a <a href="#Query Class">Query</a> object. The result of query execution is an iterator of <a href="#Statement Class">Statement</a>s/quads.</td>
</tr>
<tr>
<td valign="top">prepareTupleQuery(self, queryLanguage, queryString, baseURI=None)</td>
<td>Embed <em>queryString</em> into a <a href="#Query Class">Query</a> object which can be executed against the RDF storage. <em>queryString</em> must be a SELECT query. <em>queryLanguage</em> is one of SPARQL, PROLOG, or COMMON_LOGIC. <em>baseURI</em> optionally provides a URI prefix (defaults to None). Returns a <a href="#Query Class">Query</a> object. The result of query execution is an iterator of tuples.</td>
</tr>
<tr>
<td valign="top">registerDatatypeMapping(self, predicate=None, datatype=None, nativeType=None)</td>
<td><p>Register an inlined datatype. <em>Predicate</em> is the URI of predicate used in the triple store. <em>Datatype</em> may be one of: XMLSchema.INT, XMLSchema.LONG, XMLSchema.FLOAT, XMLSchema.DATE, and XMLSchema.DATETIME. <em>NativeType</em> may be "int", "datetime", or "float".</p>
<p> You must supply <em>nativeType</em> and either <em>predicate</em> or <em>datatype</em>. </p>
<p>If <em>predicate</em>, then object arguments to triples with that predicate will use an inlined encoding of type <em>nativeType</em> in their internal representation. If <em>datatype</em>, then typed literal objects with a datatype matching <em>datatype</em> will use an inlined encoding of type <em>nativeType</em>.</p></td>
</tr>
<tr>
<td valign="top">remove(self, arg0, arg1=None, arg2=None, contexts=None)</td>
<td><p>Calls removeTriples() or removeStatement(). Best practice would be to avoid remove() and use removeTriples() or removeStatement() directly. </p>
<p><em>arg0</em> may be a <a href="#Statement Class">Statement</a>. If so, then <em>arg1</em> and <em>arg2</em> default to None. </p>
<p><em>arg0, arg1</em>, and <em>arg2</em> may be the subject, predicate and object of a triple.</p>
<p><em>contexts</em> is an optional list of contexts, defaulting to None. </p></td>
</tr>
<tr>
<td valign="top">removeNamespace(self, prefix)</td>
<td>Remove the namespace associate with <em>prefix</em>. </td>
</tr>
<tr>
<td valign="top">removeQuads(self, quads, ntriples=False)</td>
<td>Remove enumerated quads from this repository. Each <em>quad</em> can be a list or a tuple of Values. If <em>ntriples</em> is True (default is False), then the quads are assumed to contain valid ntriples strings, and they are passed to the server with no conversion. </td>
</tr>
<tr>
<td valign="top">removeQuadsByID(self, tids)</td>
<td><em>tids</em> contains a list of triple IDs (integers). Remove all quads with IDs that match. </td>
</tr>
<tr>
<td valign="top">removeStatement(self, statement, contexts=None)</td>
<td>Removes the supplied <em><a href="#Statement Class">Statement</a></em>(s) from the specified <em>contexts</em> (default is None). </td>
</tr>
<tr>
<td valign="top">removeTriples(self, subject, predicate, object, contexts=None)</td>
<td>Removes the triples with the specified <em>subject</em>, <em>predicate</em> and <em>object</em><br>
from the repository, optionally restricted to the specified <em>contexts</em> (defaults to None)..</td>
</tr>
<tr>
<td valign="top">setAddCommitSize(self, triple_count) </td>
<td>The threshold for commit size during triple add operations. "Set to 0 (zero) or None to clear size-based autocommit behavior. When set to an integer triple_count > 0, loads and adds commit each triple_count triples added and at the end of the triples being added.</td>
</tr>
<tr>
<td valign="top">setNamespace(self, prefix, namespace)</td>
<td>Define (or redefine) a <em>namespace</em> associated with <em>prefix</em>. </td>
</tr>
<tr>
<td valign="top">size(self, contexts=ALL_CONTEXTS)</td>
<td>Returns the number of (explicit) statements that are in the specified <em>contexts</em> in this repository. contexts defaults to ALL_CONTEXTS, but can be a context URI or a tuple of context URIs from getContextIDs(). Use 'null' to get the size of the default graph (the unnamed context). </td>
</tr>
</table>
<h3 id="Triple Index Methods">Triple Index Methods</h3>
<p>These repositoryConnection methods support user-defined triple indices. See <a href="../triple-index.html">AllegroGraph Triple Indices</a> for more information on this topic. </p>
<table width="792" border="2px" cellpadding="4px" style="border-collapse:collapse; border-color:#0000FF;">
<tr>
<td valign="top">listIndices(self)</td>
<td><p>Returns a tuple containing a list of the current set of triple indices.</p></td>
</tr>
<tr>
<td valign="top">listValidIndices(self)</td>
<td>Returns a tuple containing the list of all possible triple indices. </td>
</tr>
<tr>
<td valign="top">addIndex(self, type)</td>
<td>Adds a specific type of index to the current set of triple indices. <em> type </em>is a string containing one of the following index names: spogi, spgoi, sopgi, sogpi, sgpoi, sgopi, psogi, psgoi, posgi, pogsi, pgsoi, pgosi, ospgi, osgpi, opsgi, opgsi, ogspi, ogpsi, gspoi, gsopi, gpsoi, gposi, gospi, gopsi, or i. </td>
</tr>
<tr>
<td valign="top">dropIndex(self, type)</td>
<td>Removes a specific type of index to the current set of triple indices. <em> type </em>is a string containing one of the following index names: spogi, spgoi, sopgi, sogpi, sgpoi, sgopi, psogi, psgoi, posgi, pogsi, pgsoi, pgosi, ospgi, osgpi, opsgi, opgsi, ogspi, ogpsi, gspoi, gsopi, gpsoi, gposi, gospi, gopsi, or i. </td>
</tr>
</table>
<h3 id="Geospatial Reasoning Methods"></h3>
<h3 id="Free Text Search Methods">Free Text Search Methods</h3>
<p>The following repositoryConnection method supports free-text indexing in AllegroGraph. </p>
<table width="792" border="2px" cellpadding="4px" style="border-collapse:collapse; border-color:#0000FF;">
<tr>
<td valign="top">createFreeTextIndex(self, name, predicates=None, indexLiterals=None, indexResources=None,<br>
indexFields=None, minimumWordSize=None, stopWords=None, wordFilters=None)</td>
<td> Create a free-text index with the given parameters. <em>name</em> is a string identifying the new index.
If no <em>predicates</em> are given, triples are indexed regardless of
predicate.
<em>indexLiterals</em> determines which literals to index. It can be
True (the default), False, or a list of resources, indicating
the literal types that should be indexed.
<em>indexResources</em> determines which resources are indexed. It can
be True, False (the default), or "short", to index only the
part of resources after the last slash or hash character.
<em>indexFields</em> can be a list containing any combination of the<br>
elements "subject", "predicate", "object", and<br>
"graph". The default is ["object"].
<em>minimumWordSize</em>, an integer, and determines the minimum size a
word must have to be indexed. The default is 3.
<em>stopWords</em> should hold a list of words that should not be
indexed. When not given, a list of common English words is
used.
<em>wordFilters</em> can be used to apply some normalizing filters to
words as they are indexed or queried. Can be a list of filter
names. Currently, only "drop-accents" and "stem.english"
are supported. </td>
</tr>
<tr>
<td valign="top">deleteFreeTextIndex(self, name)</td>
<td>Deletes the named index. </td>
</tr>
<tr>
<td valign="top">evalFreeTextSearch(self, pattern, infer=False, limit=None, index=None)</td>
<td>Return an array of statements for the given free-text pattern search. If no index is provided, all indices will be used. </td>
</tr>
<tr>
<td valign="top">getFreeTextIndexConfiguration(self, name)</td>
<td>Returns a Python dictionary containing all of the configuration settings of the named index. </td>
</tr>
<tr>
<td valign="top">listFreeTextIndices(self)</td>
<td>List the free-text indices. </td>
</tr>
<tr>
<td valign="top">modifyFreeTextIndex(self, name, predicates=None, indexLiterals=None, indexResources=None,<br>
indexFields=None, minimumWordSize=None, stopWords=None, wordFilters=None,<br>
reIndex=None)</td>
<td><em>name</em> is a string identifying the index to be modified. If no <em>predicates</em> are given, triples are indexed regardless of predicate. <em>indexLiterals</em> determines which literals to index. It can be True (the default), False, or a list of resources, indicating the literal types that should be indexed. <em>indexResources</em> determines which resources are indexed. It can be True, False (the default), or "short", to index only the part of resources after the last slash or hash character. <em>indexFields</em> can be a list containing any combination of the<br>
elements "subject", "predicate", "object", and<br>
"graph". The default is ["object"]. <em>minimumWordSize</em>, an integer, and determines the minimum size a word must have to be indexed. The default is 3. <em>stopWords</em> should hold a list of words that should not be indexed. When not given, a list of common English words is used. <em>wordFilters</em> can be used to apply some normalizing filters to words as they are indexed or queried. Can be a list of filter names. Currently, only "drop-accents" and "stem.english" are supported. <em>reIndex</em> if True (the default) will rebuild the index. If False, it will apply the new settings to new triples only, while maintaining the index data for existing triples. </td>
</tr>
</table>
<p>Note that text search is implemented through a SPARQL query using a "magic" predicate called <strong>fti:search</strong>. See the AllegroGraph Python API Tutorial for an example of how to set up this search. </p>
<h3 id="Prolog Rule Inference Methods">Prolog Rule Inference Methods</h3>
<p>These repositoryConnection methods support the use of Prolog rules in AllegroGraph. Any use of Prolog rules requires that you create a <a href="#Transactions">dedicated session</a> to run them in. </p>
<table width="792" border="2px" cellpadding="4px" style="border-collapse:collapse; border-color:#0000FF;">
<tr>
<td valign="top">addRules(self, rules, language=None)</td>
<td><p>Add a sequence of one or more rules (in ASCII format).<br>
If the <em>language</em> is QueryLanguage.PROLOG, rule declarations start with '<-' or '<--'. The former appends a new rule; the latter overwrites any rule with the same predicate. <em>language</em> defaults to QueryLanguage.PROLOG. <br>
For use with a <a href="#Transactions">dedicated session</a>. </p> </td>
</tr>
<tr>
<td valign="top">loadRules(self, file ,language=None)</td>
<td>Load a file of rules. <em>file</em> is assumed to reside on the client machine. <em>language</em> defaults to QueryLanguage.PROLOG.
For use with a <a href="#Transactions">dedicated session</a>. </td>
</tr>
</table>
<h3 id="Geospatial Reasoning Methods">Geospatial Reasoning Methods</h3>
<p>These repositoryConnection methods support geospatial reasoning. </p>
<table width="792" border="2px" cellpadding="4px" style="border-collapse:collapse; border-color:#0000FF;">
<tr>
<td valign="top">createBox(self, xMin=None, xMax=None, yMin=None, yMax=None)</td>
<td>Create a rectangular search region (a box) for geospatial search. This method works for both Cartesian and spherical coordinate systems. xMin, xMax may be used to input latitude. yMin, yMax may be used to input longitude.</td>
</tr>
<tr>
<td valign="top">createCircle(self, x, y, radius, unit=None)</td>
<td>Create a circular search region for geospatial search. This method works for both Cartesian and spherical coordinate systems.<em> radius</em> is the radius of the circle expressed in the designated <em>unit</em>, which defaults to the unit assigned to the coordinate system. <em>x</em> and <em>y</em> locate the center of the circle and may be used for latitude and longitude. </td>
</tr>
<tr>
<td valign="top">createCoordinate(self, x=None, y=None, lat=None, long=None)</td>
<td>Create a coordinate point in a geospatial coordinate system. Must include <em>x</em> and <em>y</em>, or <em>lat</em> and <em>long.</em> Use this method to create the object value for a location triple. </td>
</tr>
<tr>
<td valign="top">createLatLongSystem(self, unit='degree', scale=None, latMin=None, latMax=None, longMin=None, longMax=None)</td>
<td>Create a spherical coordinate system for geospatial location matching. <em>unit</em> can be 'degree', 'mile', 'radian', or 'km'. <em>scale</em> should be your estimate of the size of a typical search region in the latitudinal direction. <em>latMin</em> and <em>latMax</em> are the bottom and top borders of the coordinate system. <em>longMin</em> and <em>longMax</em> are the left and right sides of the coordinate system. </td>
</tr>
<tr>
<td valign="top">createPolygon(self, vertices, uri=None, geoType=None)</td>
<td>Create a polygonal search region for geospatial search. The vertices are saved as triples in AllegroGraph. <em>vertices</em> is a list of (x, y) pairs such as [(51.0, 2.00),(60.0, -5.0),(48.0,-12.5)]. <em>uri</em> is an optional subject value for the vertex triples, in case you want to manipulate them. <em>geoType</em> is 'CARTESIAN' or 'SPHERICAL', but defaults to None. </td>
</tr>
<tr>
<td valign="top">createRectangularSystem(self, scale=1, unit=None, xMin=0, xMax=None, yMin=0, yMax=None)</td>
<td>Create a Cartesian coordinate system for geospatial location matching. <em>scale</em> should be your estimate of the Y size of a typical search region. <em>unit </em>must be None. <em>xMin</em> and <em>xMax</em> are the left and right edges of the rectangle. <em>yMin</em> and <em>yMax</em> are the bottom and top edges of the rectangle. </td>
</tr>
<tr>
<td valign="top">getGeoType(self)</td>
<td>Returns what type of geospatial object it is. </td>
</tr>
<tr>
<td valign="top">setGeoType(self)</td>
<td>Sets the geoType of a geospatial object. </td>
</tr>
</table>
<h3 id="Social Network Analysis Methods">Social Network Analysis Methods</h3>
<p>The following repositoryConnection methods support Social Network Analysis in AllegroGraph. The Python API to the Social Network Analysis methods of AllegroGraph requires Prolog queries, and therefore must be run in a <a href="#Transactions">dedicated session</a>. </p>
<table width="792" border="2px" cellpadding="4px" style="border-collapse:collapse; border-color:#0000FF;">
<tr>
<td valign="top">registerNeighborMatrix(self, name, generator, group_uris, max_depth=2)</td>
<td>Construct a neighbor matrix named 'name'. The generator named 'generator' is applied
to each URI in 'group_uris' (a collection of fullURIs or qnames (strings)),<br>
computing edges to max depth 'max_depth'.<br>
For use in a <a href="#Transactions">dedicated session</a>. </td>
</tr>
<tr>
<td valign="top">registerSNAGenerator(self, name, subjectOf=None, objectOf=None, undirected=None, generator_query=None)</td>
<td>Create (and remember) a generator named 'name'.
If one already exists with the same name; redefine it.
'subjectOf', 'objectOf' and 'undirected' expect a list of predicate URIs, expressed as
fullURIs or qnames, that define the edges traversed by the generator.
Alternatively, instead of an adjacency map, one may provide a 'generator_query',
that defines the edges.<br>
For use in a <a href="#Transactions">dedicated session</a>. </td>
</tr>
</table>
<h3 id="Transactions">Transactions</h3>
<p>AllegroGraph lets you set up a special RepositoryConnection (a "session") that supports transaction semantics. You can add statements to this session until you accumulate all the triples you need for a specific transaction. Then you can commit the triples in a single act. Up to that moment the triples will not be visible to other users of the repository.</p>
<p>If anything interrupts the accumulation of triples building to the transaction, you can roll back the session. This discards all of the uncommitted triples and resynchronizes the session with the repository as a whole. </p>
<p>Closing the session deletes all uncommitted triples, all rules, generators and matrices that were created in the session. Rules, generators and matrices cannot be committed. They persist as long as the session persists. </p>
<table width="792" border="2px" cellpadding="4px" style="border-collapse:collapse; border-color:#0000FF;">
<tr>
<td valign="top">openSession(self)</td>
<td>Open a dedicated session. </td>
</tr>
<tr>
<td valign="top">closeSession(self)</td>
<td>Close a dedicated session connection. </td>
</tr>
<tr>
<td valign="top">session(self, autocommit=False, lifetime=None, loadinitfile=False)</td>
<td><p>A dedicated connection context manager for use with the 'with' statement. Automatically calls openSession() at block start and closeSession() at block end. </p>
<p> If autocommit is True, commits are done on each request, otherwise
you will need to call commit() or rollback() as appropriate for your
application.</p>
<p> lifetime is an integer specifying the time to live in seconds of <br>
the session.</p>
<p> If loadinitfile is True, then the current initfile will be loaded<br>
for you when the session starts.</p></td>
</tr>
<tr>
<td valign="top">commit(self)</td>
<td>Commits changes on a dedicated connection. </td>
</tr>
<tr>
<td valign="top">rollback(self)</td>
<td>Rolls back changes on a dedicated connection. </td>
</tr>
</table>
<h3 id="SPOGI">Subject Triples Caching </h3>
<p>You can enable subject triple caching to speed up queries where the same subject URI appears in multiple patterns. The first time AllegroGraph retrieves triples for a specific resource, it caches the triples in memory. Subsequent query patterns that ask for the same subject URI can retrieve the matching triples very quickly from the cache. The cache has a size limit and automatically rolls over as that limit is exceeded.</p>
<table width="769" border="2px" cellpadding="4px" style="border-collapse:collapse; border-color:#0000FF;">
<tr>
<td valign="top">enableSubjectTriplesCache(self, size=None)</td>
<td>Maintain a cache of size 'size' that caches, for each accessed
resource, quads where the resource appears in subject position.
This can accelerate the performance of certain types of queries.
The size is the maximum number of subjects whose triples will be cached.
Default is 100,000.</td>
</tr>
<tr>
<td valign="top">disableSubjectTriplesCache(self)</td>
<td>Turn of caching. </td>
</tr>
<tr>
<td valign="top">getSubjectTriplesCacheSize(self)</td>
<td>Return the current size of the subject triples cache.</td>
</tr>
</table>
<h2 id="Query Class">Query Class (and Subclasses) <a class="returnlink" href="#Contents">Return to Top</a></h2>
<p>The Query class is
non-instantiable. It is an abstract class from which the three query subclasses are derived. It is included here because of its methods, which are inherited by the subclasses. </p>
<p>A query on a <a href="#Repository Class">Repository</a> that can be formulated in one of the
supported query languages (for example SPARQL). It allows one to
predefine bindings in the query to be able to reuse the same query with
different bindings. </p>
<p>Source: /AllegroGraphDirectory/scr2/franz/openrdf/query/query.py.</p>
<h3>Constructor</h3>
<p>The best practice is to allow the <a href="#RepositoryConnection Class">RepositoryConnection</a> object to create an instance of one of the Query subclasses (<a href="#Subclass TupleQuery">TupleQuery</a>, <a href="#Subclass GraphQuery">GraphQuery</a>, <a href="#Subclass BooleanQuery">BooleanQuery</a>). There is no reason for the Python application programmer to create a Query object directly. </p>
<pre> tupleQuery = conn.prepareTupleQuery(QueryLanguage.SPARQL, queryString)
result = tupleQuery.evaluate()</pre>
<h3>Methods</h3>
<table width="969" border="2px" cellpadding="4px" style="border-collapse:collapse; border-color:#0000FF;">
<tr>
<td valign="top">evaluate_generic_query(self, count=False, accept=None)</td>
<td>Evaluate a SPARQL or PROLOG query. If SPARQL, it may be a 'select', 'construct', 'describe' or 'ask' query. Return a RepositoryResult object, unless the <em>accept</em> parameter is set to
'application/sparql-results+xml'
or
'application/sparql-results+json'
to return the results as a string in xml or json format. (Best practice is to use (and evaluate) one of the more specific query subclasses instead of using the Query class directly.) </td>
</tr>
<tr>
<td valign="top">getBindings(self)</td>
<td>Retrieves the bindings that have been set on this query in the form of a dictionary. </td>
</tr>
<tr>
<td valign="top">getDataset(self)</td>
<td>Returns the current dataset setting for this query. </td>
</tr>
<tr>
<td valign="top">getIncludeInferred(self)</td>
<td>Returns whether or not this query will return inferred statements (if any<br>
are present in the repository).</td>
</tr>
<tr>
<td valign="top">removeBinding(self, name)</td>
<td><p>Removes the named binding so that it has no value.</p></td>
</tr>
<tr>
<td width="168" valign="top">setBinding(self, name, value)</td>
<td width="591">Binds the named attribute to the supplied value. Any value that was previously bound to the specified attribute will be overwritten. </td>
</tr>
<tr>
<td valign="top">setBindings(self, dict)</td>
<td>Sets multiple bindings using a dictionary of attribute names and values. </td>
</tr>
<tr>
<td valign="top">setCheckVariables(self, setting)</td>
<td> If true, the presence of variables in the SELECT clause not referenced in a triple pattern <br>
are flagged.</td>
</tr>
<tr>
<td valign="top">setContexts(self, contexts)</td>
<td>Assert a set of contexts (a list of subgraph URIs) that filter all triples.</td>
</tr>
<tr>
<td valign="top">setDataset(self, dataset)</td>
<td>Specifies the dataset against which to evaluate a query, overriding any dataset that is specified in the query itself.</td>
</tr>
<tr>
<td valign="top">setIncludeInferred(self, includeInferred)</td>
<td>Determines whether results of this query should include inferred statements (if any inferred statements are present in the repository). Inference is turned off by default (which is the opposite of standard Sesame behavior). The default value of setIncludeInferred() is True. </td>
</tr>
</table>
<h3 id="Subclass TupleQuery">Subclass TupleQuery <a class="returnlink" href="#Contents">Return to Top</a> </h3>
<p>This subclass is used with SELECT queries. Use the <a href="#RepositoryConnection Class">RepositoryConnection</a> object's <strong>prepareTupleQuery()</strong> method to create a TupleQuery object. The results of the query are returned in a <a href="#RepositoryResult Class">RepositoryResult</a> iterator that yields a sequence of bindingSets.</p>
<p><strong>Methods</strong></p>
<p>TupleQuery uses all the methods of the <a href="#Query Class">Query</a> class, plus one more: </p>
<table width="769" border="2px" cellpadding="4px" style="border-collapse:collapse; border-color:#0000FF;">
<tr>
<td valign="top">evaluate(self, count=False)</td>
<td>Execute the embedded query against the RDF store. Return
an iterator that produces for each step a tuple of values
(resources and literals) corresponding to the variables
or expressions in a 'select' clause (or its equivalent).</td>
</tr>
</table>
<h3 id="Subclass GraphQuery">Subclass GraphQuery <a class="returnlink" href="#Contents">Return to Top</a> </h3>
<p>This subclass is used with CONSTRUCT and DESCRIBE queries. Use the <a href="#RepositoryConnection Class">RepositoryConnection</a> object's <strong>prepareGraphQuery()</strong> method to create a GraphQuery object. The results of the query are returned in a <a href="#RepositoryResult Class">RepositoryResult</a> iterator that yields a sequence of bindingSets.</p>
<p><strong>Methods</strong></p>
<p>GraphQuery uses all the methods of the <a href="#Query Class">Query</a> class, plus one more:</p>
<table width="769" border="2px" cellpadding="4px" style="border-collapse:collapse; border-color:#0000FF;">
<tr>
<td valign="top">evaluate(self)</td>
<td>Execute the embedded query against the RDF store.</td>
</tr>
</table>
<h3 id="Subclass BooleanQuery">Subclass BooleanQuery <a class="returnlink" href="#Contents">Return to Top</a></h3>
<p>This subclass is used with ASK queries. Use the <a href="#RepositoryConnection Class">RepositoryConnection</a> object's <strong>prepareBooleanQuery()</strong> method to create a BooleanQuery object. The results of the query are True or False.</p>
<p><strong>Methods</strong></p>
<p>BooleanQuery uses all the methods of the <a href="#Query Class">Query</a> class, plus one more:</p>
<table width="769" border="2px" cellpadding="4px" style="border-collapse:collapse; border-color:#0000FF;">
<tr>
<td valign="top">evaluate(self)</td>
<td>Execute the embedded query against the RDF store.</td>
</tr>
</table>
<h2 id="RepositoryResult Class">RepositoryResult Class <a class="returnlink" href="#Contents">Return to Top</a></h2>
<p>A RepositoryResult object is a result collection of objects (for example, <a href="#Statement Class">Statement</a> objects) that can be iterated over. It keeps an open connection to the backend for lazy retrieval of individual results. Additionally it has some utility methods to fetch all results and add them to a collection.<br>
<br>
By default, a RepositoryResult is not necessarily a (mathematical) set: it may contain duplicate objects. Duplicate filtering can be switched on, but this should not be used lightly as the filtering mechanism is potentially memory-intensive.<br>
<br>
A RepositoryResult needs to be closed after use to free up any resources (open connections, read locks, etc.) it has on the underlying repository.</p>
<p>Source: /AllegroGraphDirectory/scr2/franz/openrdf/repository/repositoryresult.py.</p>
<h3>Constructor</h3>
<p>Best practice is to allow a querySubclass.evaluate() method to create and return the RepositoryResult object. There is no reason for the Python application programmer to create a RepositoryResult object directly. </p>
<pre> tupleQuery = conn.prepareTupleQuery(QueryLanguage.SPARQL, queryString)
results = tupleQuery.evaluate()
for result in results:
print result
</pre>
<h3>Methods</h3>
<table width="969" border="2px" cellpadding="4px" style="border-collapse:collapse; border-color:#0000FF;">
<tr>
<td width="168" valign="top">close(self)</td>
<td width="591">Shut down the iterator to be sure the resources are freed up. </td>
</tr>
<tr>
<td valign="top">next(next)</td>
<td>Return the next <a href="#Statement Class">Statement</a> in the answer, if there is one.</td>
</tr>
<tr>
<td valign="top">enableDuplicateFilter(self)</td>
<td> Switches on duplicate filtering while iterating over objects. The RepositoryResult will keep track of the previously returned objects in a java.util.Set and on calling next() will ignore any objects that already occur in this Set.<br> <br>
Caution: use of this filtering mechanism is potentially memory-intensive.</td>
</tr>
<tr>
<td valign="top">asList(self)</td>
<td>Returns a list containing all objects of this RepositoryResult in
order of iteration. The RepositoryResult is fully consumed and
automatically closed by this operation.</td>
</tr>
<tr>
<td valign="top">addTo(self, collection)</td>
<td>Adds all objects of this RepositoryResult to the supplied collection. The
RepositoryResult is fully consumed and automatically closed by this
operation.</td>
</tr>
<tr>
<td valign="top">rowCount(self)</td>
<td>Returns the number of result items stored in this object. </td>
</tr>
</table>
<p> </p>
<h2 id="Statement Class">Statement Class <a class="returnlink" href="#Contents">Return to Top</a></h2>
<p>A Statement is a client-side triple. It encapsulates the subject, predicate, object and context (subgraph) values of a single triple and makes them available. </p>
<p>Source: /AllegroGraphDirectory/scr2/franz/openrdf/model/statement.py.</p>
<h3>Constructor</h3>
<p>Statement(self, subject, predicate, object, context=None)</p>
<ul>
<li><em>subject, predicate, object </em>are the values of a typical triple.</li>
<li><em>context </em> is the optional URI of the subgraph of the repository.</li>
</ul>
<p>Example: Best practice is to allow the <a href="#RepositoryConnection Class">RepositoryConnection</a>.createStatement() method to create and return the Statement object. There is no reason for the Python application programmer to create a Statement object directly. </p>
<pre> stmt1 = conn.createStatement(alice, age, fortyTwo)</pre>
<h3>Methods</h3>
<table width="769" border="2px" cellpadding="4px" style="border-collapse:collapse; border-color:#0000FF;">
<tr>
<td valign="top">getContext(self)</td>
<td>Returns the value in the fourth position of the stored tuple (the subgraph URI).</td>
</tr>
<tr>
<td valign="top">getObject(self)</td>
<td>Returns the value in the third position of the stored tuple. </td>
</tr>
<tr>
<td valign="top">getPredicate(self)</td>
<td>Returns the value in the second position of the stored tuple. </td>
</tr>
<tr>
<td valign="top">getSubject(self)</td>
<td>Returns the value in the first position of the stored tuple. </td>
</tr>
<tr>
<td width="168" valign="top">setQuad(self, string_tuple)</td>
<td width="591"><p>Stores a string_tuple of a triple or quad. This method is called only by an internal method of the <a href="#RepositoryResult Class">RepositoryResult</a> class. There is no need for a Python application programmer to use it. </p></td>
</tr>
</table>
<p> </p>
<h2 id="ValueFactory Class">ValueFactory Class <a class="returnlink" href="#Contents">Return to Top</a></h2>
<p>A ValueFactory is a factory for creating URIs, blank nodes, literals and <a href="#Statement Class">Statement</a>s. In the AllegroGraph Python interface, the ValueFactory class would be regarded as obsolete. Its functions have been subsumed by the expanded capability of the RepositoryConnection class. It is documented here for the convenience of the person who is porting an application from Aduma Sesame. </p>
<p>Source: /AllegroGraphDirectory/scr2/franz/openrdf/model/valuefactory.py.</p>
<h3>Constructor</h3>
<p>ValueFactory(self, store)</p>
<ul>
<li><em>store </em>is the <a href="#Repository Class">Repository</a> object that generated this ValueFactory.</li>
</ul>
<p>Example: Best practice is to allow the <a href="#Repository Class">Repository</a> constructor to generate the ValueFactory automatically at the same time that the Repository object is created. There is no reason for a Python application programmer to attempt this step manually. </p>
<h3>Methods</h3>
<table width="769" border="2px" cellpadding="4px" style="border-collapse:collapse; border-color:#0000FF;">
<tr>
<td width="168" valign="top">createBNode()</td>
<td width="591"><p>See <a href="#RepositoryConnection Class">RepositoryConnection</a> class. </p></td>
</tr>
<tr>
<td valign="top">createLiteral()</td>
<td>See <a href="#RepositoryConnection Class">RepositoryConnection</a> class. </td>
</tr>
<tr>
<td valign="top">createStatement()</td>
<td>See <a href="#RepositoryConnection Class">RepositoryConnection</a> class. </td>
</tr>
<tr>
<td valign="top">createURI()</td>
<td>See <a href="#RepositoryConnection Class">RepositoryConnection</a> class. </td>
</tr>
</table>
<p></p>
<p> </p>
</body>
| 56,197 | Common Lisp | .l | 777 | 68.207207 | 725 | 0.720555 | wvxvw/agraph-client | 0 | 0 | 0 | EPL-1.0 | 9/19/2024, 11:36:20 AM (Europe/Amsterdam) | 97a64b0782a871d66dfc652470b5c0a5cf23046430e9529bbdb0c3d0f384d619 | 28,736 | [
-1
] |
28,739 | relative_rules.txt | wvxvw_agraph-client/src/openrdf/tests/relative_rules.txt | ;; Prolog rules that define relative relations
;; Assumes that the prefix 'rltv' is bound to a namespace
;; of your choice
(<-- (string-concat ?result ?string1 ?string2 ?string3)
(lisp ?result (string+ ?string1 ?string2 ?string3)))
(<-- (name ?person (?first ?last))
(q ?person !rltv:first-name ?first)
(q ?person !rltv:last-name ?last))
(<-- (name ?person ?fullname)
(q ?person !rltv:first-name ?first)
(q ?person !rltv:last-name ?last)
(string-concat ?fullname ?first " " ?last))
(<-- (woman ?person)
(q ?person !rltv:sex !rltv:female)
(q ?person !rdf:type !rltv:person))
(<-- (man ?person)
(q ?person !rltv:sex !rltv:male)
(q ?person !rdf:type !rltv:person))
(<-- (father ?parent ?child)
(man ?parent)
(q ?parent !rltv:has-child ?child))
(<-- (mother ?parent ?child)
(woman ?parent)
(q ?parent !rltv:has-child ?child))
(<-- (parent ?father ?child)
(father ?father ?child))
(<-- (parent ?mother ?child)
(mother ?mother ?child))
(<-- (grandparent ?x ?y)
(parent ?x ?z)
(parent ?z ?y))
(<-- (grandchild ?x ?y)
(grandparent ?y ?x))
(<-- (ancestor ?x ?y)
(parent ?x ?y))
(<- (ancestor ?x ?y)
(parent ?x ?z)
(ancestor ?z ?y))
(<-- (descendent ?x ?y)
(ancestor ?y ?x))
(<-- (aunt ?x ?y)
(father ?z ?x)
(woman ?x)
(father ?z ?w)
(not (= ?x ?w))
(parent ?w ?y))
(<-- (uncle ?uncle ?child)
(man ?uncle)
(parent ?grandparent ?uncle)
(parent ?grandparent ?siblingOfUncle)
(not (= ?uncle ?siblingOfUncle))
(parent ?siblingOfUncle ?child))
(<-- (nephew ?x ?y)
(aunt ?y ?x)
(man ?x))
(<- (nephew ?x ?y)
(uncle ?y ?x)
(man ?x))
(<-- (niece ?x ?y)
(aunt ?y ?x)
(woman ?x))
(<- (niece ?x ?y)
(uncle ?y ?x)
(woman ?x))
(<-- (parent-child-have-same-name ?x ?y)
(q- ?x !rltv:first-name ?n1)
(parent ?x ?y)
(q- ?y !rltv:first-name ?n2)
(= ?n1 ?n2))
(<-- (parent-child-went-to-ivy-league-school ?x ?y)
(q- ?x !rltv:alma-mater ?am)
(q- ?am !rltv:ivy-league !rltv:true)
(parent ?x ?y)
(q- ?y !rltv:alma-mater ?am2)
(q- ?am2 !rltv:ivy-league !rltv:true))
(<-- (parent-child-went-to-same-ivy-league-school ?x ?y)
(q- ?x !rltv:alma-mater ?am)
(q- ?am !rltv:ivy-league !rltv:true)
(parent ?x ?y)
(q- ?y !rltv:alma-mater ?am))
(<-- (spouse ?x ?y)
(q ?x !rltv:spouse ?y))
;; ?x has a spouse and children
(<-- (family ?x ?fam)
(q ?x !rltv:spouse ?sp)
(bagof ?ch (parent ?x ?ch) ?bag)
(append ?bag (?sp) ?fam)
;#!
)
| 2,586 | Common Lisp | .l | 89 | 24.696629 | 61 | 0.559253 | wvxvw/agraph-client | 0 | 0 | 0 | EPL-1.0 | 9/19/2024, 11:36:20 AM (Europe/Amsterdam) | 9af23c5cf2a39a96c5bf854297ac9750381291d9be852bc9429922c018827468 | 28,739 | [
-1
] |
28,740 | ssl-dir.sh | wvxvw_agraph-client/src/openrdf/tests/ssl-dir.sh | #!/bin/bash
dir=$( cd "$( dirname "$0" )" && pwd )
cacert="${dir}/ca.cert"
# Point this at the client certificate
testcert="${dir}/test.cert"
echo "${dir}"
db_dir="${dir}/certs.db"
p12=/tmp/$$.p12
mkdir -p $db_dir
certutil -d $db_dir "$@"-A -n FranzTestCA -i $cacert -t TC,,
openssl pkcs12 -export -in $testcert -name "Test Client" -passout pass: \
-out $p12
pk12util -d $db_dir -i $p12 -K "" -W ""
rm $p12
| 416 | Common Lisp | .l | 14 | 28.071429 | 73 | 0.636364 | wvxvw/agraph-client | 0 | 0 | 0 | EPL-1.0 | 9/19/2024, 11:36:20 AM (Europe/Amsterdam) | 7abd6e85b96e59feb8856e308e6d1856a5d9155a7ae38f3d1f14810aa234c7da | 28,740 | [
-1
] |
28,768 | suite-test.lisp | rodrigow_wizard_adventure/suite-test.lisp | (load "lib/lisp-unit.lisp")
(use-package :lisp-unit)
;; loading test files
(load "test/wizard-test.lisp")
(run-tests)
| 120 | Common Lisp | .lisp | 5 | 22.6 | 30 | 0.734513 | rodrigow/wizard_adventure | 0 | 0 | 0 | LGPL-3.0 | 9/19/2024, 11:36:28 AM (Europe/Amsterdam) | c64f84d93299549a8fcfa0f2a2db13449281cafce42e0bb9219a5366a6121206 | 28,768 | [
-1
] |
28,769 | wizard-test.lisp | rodrigow_wizard_adventure/test/wizard-test.lisp | (load "source/wizard.lisp")
(define-test "should describe garden location"
(assert-equal '(YOU ARE IN A BEATIFUL GARDEN. THERE IS A WELL IN FRONT OF YOU.) (describe-location 'garden *nodes*)))
(define-test "should describe path to garden"
(assert-equal '(THERE IS A DOOR GOING WEST FROM HERE.) (describe-path '(garden west door))))
(define-test "should describe paths to living-room"
(assert-equal '(THERE IS A DOOR GOING WEST FROM HERE. THERE IS A LADDER GOING UPSTAIRS FROM HERE.) (describe-paths 'living-room *edges*)))
| 533 | Common Lisp | .lisp | 7 | 73.714286 | 140 | 0.743786 | rodrigow/wizard_adventure | 0 | 0 | 0 | LGPL-3.0 | 9/19/2024, 11:36:28 AM (Europe/Amsterdam) | bf47015220f9dca73ae00425e1fddb191b0f0479c53a4bfcd9c1e3c959e4551c | 28,769 | [
-1
] |
28,770 | wizard.lisp | rodrigow_wizard_adventure/source/wizard.lisp | (defparameter *nodes* '((living-room (you are in the living-room.
a wizard is snoring loudly on the couch.))
(garden (you are in a beatiful garden.
there is a well in front of you.))
(attic (you are in the attic.
there is a giant welding torch in the orner.))))
(defun describe-location (location nodes)
(cadr (assoc location nodes)))
(defparameter *edges* '((living-room (garden west door)
(attic upstairs ladder))
(garden (living-room east door))
(attic (living-room downstairs ladder))))
(defun describe-path (edge)
`(there is a ,(caddr edge) going ,(cadr edge) from here.))
(defun describe-paths (location edges)
(apply #'append (mapcar #'describe-path (cdr (assoc location edges)))))
| 745 | Common Lisp | .lisp | 16 | 42.0625 | 73 | 0.690608 | rodrigow/wizard_adventure | 0 | 0 | 0 | LGPL-3.0 | 9/19/2024, 11:36:28 AM (Europe/Amsterdam) | 3de790f3f88786fbafe78504523a32cc0e5f801e9b5ec67d8dccaafce5e430f9 | 28,770 | [
-1
] |
28,789 | guess-number.lisp | nomikomu_LOLisp/src/guess-number.lisp | (defparameter *small* 1)
(defparameter *big* 100)
(defun guess-number ()
(ash (+ *small* *big*) -1))
(defun smaller ()
(setf *big* (1- (guess-number)))
(guess-number))
(defun bigger ()
(setf *small* (1+ (guess-number)))
(guess-number))
(defun start-over ()
(defparameter *small* 1)
(defparameter *big* 100)
(guess-number)) | 357 | Common Lisp | .lisp | 14 | 22.071429 | 38 | 0.615836 | nomikomu/LOLisp | 0 | 0 | 0 | GPL-3.0 | 9/19/2024, 11:36:36 AM (Europe/Amsterdam) | 956e52176c11fe0fd5f8bfadf094b0f6e6a78d558dc847253ec07f5635d27049 | 28,789 | [
-1
] |
28,790 | cheat-sheet.lisp | nomikomu_LOLisp/src/cheat-sheet.lisp | ;;;; Common Lisp - CHEAT SHEET
; i i i i i i i ooooo o ooooooo ooooo ooooo
; I I I I I I I 8 8 8 8 8 o 8 8
; I \ `+' / I 8 8 8 8 8 8
; \ `-+-' / 8 8 8 ooooo 8oooo
; `-__|__-' 8 8 8 8 8
; | 8 o 8 8 o 8 8
; ------+------ ooooo 8oooooo ooo8ooo ooooo 8
;;;; *tips menora
;; define function:
(defun name (parameters)
"Documentation for name."
())
;; define parameter (global variable):
(defparameter *name* value
"Documentation for name.")
;; set the local variables
(let (variables)
(body))
;; set the local function
(flet ((function_name (arguments)
function body))
body)
; example:
(flet ((a (n)
(+ n 10))
(b (n)
(+ n 20))
(c (n)
(+ n 30)))
(a (b (c 5))))
;; binary search with two variables:
(ash (+ a b) -1)
;; setf - change variable
(setf place value)
;; labels - makes functions available in defined functions
(labels ((a (n)
(+ n 5))
(b (n)
(+ (a n) 6)))
(b 10))
;;;; cons,car,cdr
;; > cons
; In Lisp, a chain of cons cells and
; a list are exactly the same thing.
;; cons with two symbols
(cons 'chicken 'cat)
; output: (CHICKEN . CAT)
;; cons with nil
(cons 'chicken 'nil)
(cons 'chicken ())
; output: (CHICKEN)
;; multiple lists
(cons 'pork '(beef chicken))
; output (PORK BEEF CHICKEN)
;; consing everything up
(cons 'pork (cons 'beef (cons 'chicken ())))
; output (PORK BEEF CHICKEN)
;; > car
(car '(pork beef chicken))
; output: PORK
;; > cdr
(cdr '(pork beef chicken))
; output: (BEEF CHICKEN)
;; > cadr
(car (cdr '(pork beef chicken)))
; output: BEEF
(cadr '(pork beef chicken))
; output: BEEF
;; LIST
(list 'pork 'beef 'chicken)
; output: (PORK BEEF CHICKEN)
;; conditions - if
; TESTS
(if '()
'i-am-true
'i-am-false)
; i-am-false
(if '(1)
'i-am-true
'i-am-false)
; i-am-true
(eq '() nil) ; ==> T
(eq '() ()) ; ==> T
(eq '() 'nil) ; ==> T
;; progn
(defvar *number-was-odd* nil)
(if (oddp 5)
(progn (setf *number-was-odd* t)
'odd-number)
'even-number)
;; conditions - when
(defvar *number-is-odd* nil)
(when (oddp 5)
(setf *number-is-odd* t)
'odd-number)
;; conditions - unless
(unless (oddp 4)
(setf *number-is-odd* nil)
'even-number)
;; and,or
(and (oddp 3) (oddp 5) (oddp 7)) ; => T
(or (oddp 3) (oddp 4) (oddp 9)) ; => T
(and (oddp 3) (oddp 5) (oddp 6)) ; => NIL
(or (oddp 4) (oddp 6) (oddp 8)) ; => NIL
; shortcut boolean
(and *file-modified* (ask-user-about-saving) (save-file))
; instead of
(if *file-modified*
(if (ask-user-about-saving)
(save-file)))
; or you can always do this:
(if (and *file-modified*
(ask-user-about-saving))
(save-file))
;; member and find if
(if (member nil '(3 4 nil 5))
'nil-is-in-the-list
'nil-is-not-in-the-list)
(if (find-if #'oddp '(2 4 5 6))
'there-is-an-odd-number
'there-is-no-odd-number)
;; comparing
(defparameter *fruit* 'apple)
(cond ((eq *fruit* 'apple) 'its-an-apple)
((eq *fruit* 'orange) 'its-an-orange))
; eq - symbols
; equal - everything else
; eql - like eq but handles numbers
;; equalp
(equalp "Bob Smith" "bob smith") ; => T
(equalp 0 0.0) ; => T
; equalp can compare strings and int with float | 3,468 | Common Lisp | .lisp | 133 | 23.210526 | 66 | 0.555455 | nomikomu/LOLisp | 0 | 0 | 0 | GPL-3.0 | 9/19/2024, 11:36:36 AM (Europe/Amsterdam) | bbdde7482f12313f35eef72760ec12bd1b5703d2979a1c754148d1527ec0ac6e | 28,790 | [
-1
] |
28,791 | check-empty-list.lisp | nomikomu_LOLisp/src/check-empty-list.lisp | ; (check-empty-list nil)
; THE-LIST-IS-EMPTY
; (check-empty-list '(a b))
; THE-LIST-ISNT-EMPTY
(defun check-empty-list (list)
(if list
'the-list-isnt-empty
'the-list-is-empty)) | 183 | Common Lisp | .lisp | 8 | 21.125 | 30 | 0.701149 | nomikomu/LOLisp | 0 | 0 | 0 | GPL-3.0 | 9/19/2024, 11:36:36 AM (Europe/Amsterdam) | 2ef8a0b9349ea1709524f837191a2e118f29ca99f096a678a78da845e0aa42cc | 28,791 | [
-1
] |
28,792 | length-list.lisp | nomikomu_LOLisp/src/length-list.lisp | (defun length-list (list)
(if list
(1+ (length-list (cdr list)))
0)) | 74 | Common Lisp | .lisp | 4 | 16.25 | 31 | 0.619718 | nomikomu/LOLisp | 0 | 0 | 0 | GPL-3.0 | 9/19/2024, 11:36:36 AM (Europe/Amsterdam) | 874a8ad2525a88ad29678fa1f4e0d8a5c0f5d10dbccf9822d034df70366469c6 | 28,792 | [
-1
] |
28,793 | short-story.lisp | nomikomu_LOLisp/src/short-story.lisp | (defvar *arch-enemy* nil)
(defun pudding-eater-cond (person)
(cond ((eq person 'henry) (setf *arch-enemy* 'stupid-lisp-alien)
'(curse you lisp alien - you ate my pudding))
((eq person 'johnny) (setf *arch-enemy* 'useless-old-johnny)
'(i hope you choked on my pudding johnny))
(t '(why you eat my pudding stranger ?))))
(defun pudding-eater-case (person)
(case person
((henry) (setf *arch-enemy* 'stupid-lisp-alien)
'(curse you lisp alien - you ate my pudding))
((johnny) (setf *arch-enemy* 'useless-old-johnny)
'(i hope you choked on my pudding johnny))
(otherwise '(why you eat my pudding stranger ?)))) | 714 | Common Lisp | .lisp | 14 | 42.642857 | 67 | 0.607703 | nomikomu/LOLisp | 0 | 0 | 0 | GPL-3.0 | 9/19/2024, 11:36:36 AM (Europe/Amsterdam) | 055e0a59160d519db2696c896d9a7624e7ef82f9a3c1cd21147701c21ee0a3c7 | 28,793 | [
-1
] |
28,794 | text-game.lisp | nomikomu_LOLisp/src/text-game.lisp | ; location nodes
(defparameter *nodes* '(
(living-room (you are in the living-room.
a wizard is snoring loudly on the couch.))
(garden (you are in a beautiful garden.
there is a well in front of you.))
(attic (you are in the attic.
there is a giant welding torch in the corner.))))
; Paths - edges
(defparameter *edges* '(
(living-room (garden west door)
(attic upstairs ladder))
(garden (living-room east door))
(attic (living-room downstairs ladder))))
; assoc for finding correct item in list
(defun describe-location (location nodes)
(cadr (assoc location nodes)))
; example usage:
;(describe-location 'living-room *nodes*)
(defun describe-path (edge)
'(there is a ,(caddr edge) going ,(cadr edge) from here.))
;example usage:
s;(describe-path '(garden west door))
| 893 | Common Lisp | .lisp | 23 | 33.130435 | 67 | 0.643599 | nomikomu/LOLisp | 0 | 0 | 0 | GPL-3.0 | 9/19/2024, 11:36:36 AM (Europe/Amsterdam) | fd8b88092a0b2f74d5ba718718db5f0292aa681f9229df1a94adef0411d71f6e | 28,794 | [
-1
] |
28,816 | simplify.lisp | akiyeng2_symbolic-math/simplify.lisp | ;;;; Functions for handling symbolic manipulation
(defconstant e (exp 1) "Euler's Number")
(defconstant i #C(0 1) "Imaginary Number")
(defconstant π pi "PI")
(defun ^ (a b) (expt a b))
(defparameter *ops* nil)
(defun flatten (obj)
(do* ((result (list obj))
(node result))
((null node) (delete nil result))
(cond ((consp (car node))
(when (cdar node) (push (cdar node) (cdr node)))
(setf (car node) (caar node)))
(t (setf node (cdr node))))))
(defmacro defsimple ((operator &rest aliases) (&key (infix nil)) (a &optional b) &body body)
(let ((name (gensym)))
(push name *ops*)
(push operator *ops*)
(dolist (alias aliases)
(push alias *ops*)
(push name *ops*))
(cond (infix `(defun ,name (,a ,b)
(cond ((and (numberp ,a) (numberp ,b))
(,operator ,a ,b))
,@body
(t `(,a ,',operator ,b)))))
(t `(defun ,name (,a)
(cond ,@body
(t `(,',operator ,a))))))))
(defmacro do-infix ((var1 var2) (var3 var4) &body body)
`(dolist (,var1 '(0 2))
(dolist (,var2 '(0 2))
(let ((,var3 (- 2 ,var1)) (,var4 (- 2 ,var2)))
,@body))))
(defmacro let-infix ((left right list) &body body)
`(let ((,left (first ,list)) (,right (third ,list)))
,@body))
(defun greater-order (operator)
(cond ((or (eql operator '+) (eql operator '-)) '*)
((or (eql operator '*) (eql operator '/)) '^)))
(defun like-order (operator)
(cond ((or (eql operator '+) (eql operator '-)) '+)
((or (eql operator '*) (eql operator '/)) '*)))
(defun lower-order (operator)
(cond ((or (eql operator '+) (eql operator '-)) '+)
((or (eql operator '*) (eql operator '/)) '+)
((or (eql operator '^) '*))))
(defun base-order (operator)
(cond ((or (eql operator '+) (eql operator '*)) '+)
((or (eql operator '-) (eql operator '/)) '-)))
(defun exprp (object)
(or (listp object) (symbolp object)))
(defun negative (object)
(simple '* -1 object))
(defun plusify (list)
(simple '+ (first list) (negative (third list))))
(defun operator-memberp (arg1 op1 &optional (arg2 '(t)) (op2 't))
(and (listp arg1) (member op1 arg1) (listp arg2) (member op2 arg2)))
(defun combine-like (arg1 arg2 op)
(let ((same-op (like-order op)))
(do-infix (k j) (p q)
(when (and (exprp (nth k arg1)) (exprp (nth j arg2)))
(return-from combine-like
(simple same-op
(simple op (nth k arg1) (nth j arg2))
(simple op (nth p arg1) (nth q arg2))))))))
(defun combine-higher (arg1 arg2 op)
(let ((big-op (greater-order op)) (base-op (base-order op)))
(do-infix (k j) (p q)
(when (and (exprp (nth k arg1)) (exprp (nth j arg2)))
(return-from combine-higher
(simple big-op (nth k arg1)
(simple base-op (nth p arg1) (nth q arg2))))))))
(defun combine-hybrid (arg1 arg2 op)
(let ((big-op (greater-order op)))
(do-infix (k j) (p q)
(when (and (exprp (nth k arg1)) (exprp (nth j arg2)))
(return-from combine-hybrid
(simple op (simple op arg1 (nth j arg2))
(nth q arg2)))))))
(defun combine-hybrid-higher (arg1 arg2 op)
(let ((big-op (greater-order op)))
(do-infix (k j) (p q)
(when (and (exprp (nth k arg1)))
(return-from combine-hybrid-higher
(simple op (simple op arg1 (nth j arg2))
(nth q arg2)))))))
(defun combine-hybrid-atom (arg1 arg2 op)
(let ((same-op (like-order op)))
(do-infix (k j) (p q)
(when (or (and (symbolp arg2) (exprp (nth k arg1)))
(and (numberp arg2) (numberp (nth k arg1))))
(return-from combine-hybrid-atom
(simple same-op (simple op (nth k arg1) arg2)
(nth p arg1)))))))
(defun identical (arg1 arg2)
(or (equal arg1 arg2)
(and (listp arg1) (listp arg2)
(not (set-difference (flatten arg1) (flatten arg2))))))
(defsimple (+) (:infix t) (a b)
((equalp a 0) b) ((equalp b 0) a)
((identical a b) `(,2 * ,a))
((and (listp b) (eql (first b) '-))
(simple '- a (second b)))
((operator-memberp a '+ b '+)
(combine-like a b '+))
((operator-memberp a '+ b '-)
(simple '+ a (plusify b)))
((operator-memberp a '- b '+)
(simple '+ b a)) ; Reverse order.
((operator-memberp a '- b '-)
(simple '+ (plusify a) (plusify b))) ; Cheat.
((operator-memberp a '* b '*)
(combine-higher a b '+))
((operator-memberp a '* b '+)
(combine-hybrid a b '+))
((operator-memberp a '+ b '*)
(simple '+ b a)) ; Reverse order.
((operator-memberp a '* b '-)
(simple '+ a (plusify b)))
((operator-memberp a '- b '*)
(simple '+ b a))
((operator-memberp a '+)
(combine-hybrid-atom a b '+))
((operator-memberp b '+)
(simple '+ b a)))
(defsimple (-) (:infix t) (a b)
((equalp a 0) (negative b)) ((equalp b 0) a)
((identical a b) 0)
((and (listp b) (eql (first b) '-))
(simple '+ a (second b)))
((operator-memberp a '+ b '+)
(combine-like a b '-))
((operator-memberp a '+ b '-)
(simple '- a (plusify b)))
((operator-memberp a '- b '+)
(negative (simple '- b a))) ; Reverse order.
((operator-memberp a '- b '-)
(simple '- (plusify a) (plusify b))) ; Cheat.
((operator-memberp a '* b '*)
(combine-higher a b '-))
((operator-memberp a '* b '+)
(combine-hybrid a b '-))
((operator-memberp a '+ b '*)
(negative (simple '- b a))) ; Reverse order.
((operator-memberp a '-)
(combine-hybrid-atom a b '-))
((operator-memberp b '-)
(negative (simple '- b a))))
(defsimple (*) (:infix t) (a b)
((equalp a 0) 0) ((equalp b 0) 0)
((equalp a 1) b) ((equalp b 1) a)
((identical a b) `(,a ^ ,2))
((operator-memberp a '^ b '^)
(combine-higher a b '*))
((operator-memberp a '^ b '*)
(combine-hybrid a b '*))
((operator-memberp a '^)
(combine-hybrid-atom a b '*))
((operator-memberp b '^)
(simple '* b a)))
(defsimple (/) (:infix t) (a b)
((equalp a 0) 0) ((equalp b 0) `(,a / ,0))
((identical a b) 1))
(defsimple (^) (:infix t) (a b)
((equalp a 0) 0) ((equalp b 0) 1)
((equalp a 1) 1) ((equalp b 1) a))
(defsimple (log ln) () (a)
((or (eql a 'e) (equalp a e)) 1))
(defsimple (sin) () (a)
((equalp a 0) 0)
((or (equalp a 'pi) (equalp a pi) (equal a 'π)) 0)
((and (operator-memberp a '*) (member-if #'numberp a)
(or (member pi a) (member 'pi a) (member 'π a)))
(let ((z (car (member-if #'numberp a))))
(getf (getf *unit-circle* (mod (* 12 z) 24)) :sin))))
(defsimple (cos) () (a)
((equalp a 0) 0)
((or (equalp a 'pi) (equalp a pi) (equal a 'π)) 1)
((and (operator-memberp a '*) (member-if #'numberp a)
(or (member pi a) (member 'pi a) (member 'π a)))
(let ((z (car (member-if #'numberp a))))
(getf (getf *unit-circle* (mod (* 12 z) 24)) :cos))))
(defsimple (tan) () (a))
(defsimple (asin) () (a))
(defsimple (acos) () (a))
(defsimple (atan) () (a))
(defsimple (sinh) () (a))
(defsimple (cosh) () (a))
(defsimple (asinh) () (a))
(defsimple (acosh) () (a))
(defsimple (atanh) () (a))
(defun simple (operator &rest args)
(apply (getf *ops* operator) args))
(defun precedence-match (expr op1 op2)
(and (eql (second expr) op1) (eql (fourth expr) op2)))
(defun precedence-operate (expr op1 op2)
(simple op2 (simple op1 (first expr) (third expr))
(simplify (cddddr expr))))
(defun simplify (expr)
(cond ((atom expr) expr)
((null (rest expr)) (simplify (first expr)))
((eql (first expr) '-) (negative (second expr)))
((= (length expr) 2)
(simple (first expr) (simplify (second expr))))
((precedence-match expr '- '-)
(setf (fifth expr) (negative (fifth expr)))
(precedence-operate expr '- '+))
((precedence-match expr '* '+)
(precedence-operate expr '* '+))
((precedence-match expr '* '-)
(setf (fifth expr) (negative (fifth expr)))
(precedence-operate expr '* '+))
((precedence-match expr '/ '+)
(precedence-operate expr '/ '+))
((precedence-match expr '/ '-)
(setf (fifth expr) (negative (fifth expr)))
(precedence-operate expr '/ '+))
((precedence-match expr '^ '+)
(precedence-operate expr '^ '+))
((precedence-match expr '^ '-)
(setf (fifth expr) (negative (fifth expr)))
(precedence-operate expr '^ '+))
((precedence-match expr '^ '*)
(precedence-operate expr '^ '*))
((precedence-match expr '^ '/)
(precedence-operate expr '^ '/))
(t (simple (second expr) (simplify (first expr)) (simplify (cddr expr))))))
| 8,228 | Common Lisp | .lisp | 228 | 32.631579 | 92 | 0.585657 | akiyeng2/symbolic-math | 0 | 0 | 0 | GPL-3.0 | 9/19/2024, 11:36:45 AM (Europe/Amsterdam) | be2884538274a0e81b98dfff79a5bd44f7fa812f5364c8458b768dcc89a2b623 | 28,816 | [
-1
] |
28,817 | unit-circle.lisp | akiyeng2_symbolic-math/unit-circle.lisp | (defvar *unit-circle*
'(0 (:sin 0 :cos 1)
2 (:sin 1/2 :cos ((3 ^ 1/2) / 2))
3 (:sin ((2 ^ 1/2) / 2) :cos ((2 ^ 1/2) / 2))
4 (:sin ((3 ^ 1/2) / 2) :cos 1/2)
6 (:sin 1 :cos 0)
8 (:sin ((3 ^ 1/2) / 2) :cos -1/2)
9 (:sin ((2 ^ 1/2) / 2) :cos (- ((2 ^ 1/2) / 2)))
10 (:sin 1/2 :cos (- ((3 ^ 1/2) / 2)))
12 (:sin 0 :cos -1)
14 (:sin -1/2 :cos (- ((3 ^ 1/2) / 2)))
15 (:sin (- ((2 ^ 1/2) / 2)) :cos (- ((2 ^ 1/2) / 2)))
16 (:sin (- ((3 ^ 1/2) / 2)) :cos -1/2)
18 (:sin -1 :cos 0)
20 (:sin (- ((3 ^ 1/2) / 2)) :cos 1/2)
21 (:sin (- ((2 ^ 1/2) / 2)) :cos ((2 ^ 1/2) / 2))
22 (:sin -1/2 :cos ((3 ^ 1/2) / 2))))
| 664 | Common Lisp | .lisp | 17 | 34.352941 | 58 | 0.348297 | akiyeng2/symbolic-math | 0 | 0 | 0 | GPL-3.0 | 9/19/2024, 11:36:45 AM (Europe/Amsterdam) | 4e9fe2e6d9c5163e10ce0ed7280c6eca1098148983f38a49a1f74d9be0d052db | 28,817 | [
-1
] |
28,818 | delta.lisp | akiyeng2_symbolic-math/delta.lisp | ;;;; Derivatives
(defvar *delta-table* '((sin (cos x)) (cos (0 - (sin x)))
(tan (1 / ((cos x) ^ 2)))
(sinh (cosh x)) (cosh (sinh x))
(tanh (1 / ((cosh x) ^ 2)))
(asin (1 / ((1 - (x ^ 2)) ^ 1/2)))
(acos (0 - (1 / ((1 - (x ^ 2)) ^ 1/2))))
(atan (1 / (1 + (x ^ 2))))
(asinh (1 / ((1 + (x ^ 2)) ^ 1/2)))
(acosh (1 / (((x - 1) * (x + 1)) ^ 1/2)))
(atanh (1 / (1 - (x ^ 2)))) (log (1 / x))))
(defun delta-atom (atom wrt)
(if (eql atom wrt) 1 0))
(defun delta-+ (list wrt)
(let-infix (a b list)
(simple-+ (delta a wrt) (delta b wrt))))
(defun delta-- (list wrt)
(let-infix (a b list)
(simple-- (delta a wrt) (delta b wrt))))
(defun delta-* (list wrt)
(let-infix (a b list)
(simple-+ (simple-* (delta a wrt) b)
(simple-* (delta b wrt) a))))
(defun delta-/ (list wrt)
(let-infix (a b list)
(simple-/ (simple-- (simple-* (delta a wrt) b)
(simple-* (delta b wrt) a))
(simple-^ b 2))))
(defun delta-power (list wrt)
(let-infix (a b list)
(simple-* (delta a wrt)
(simple-* b (simple-^ a (simple-- b 1))))))
(defun delta-exp (list wrt)
(let-infix (a b list)
(simple-* (delta b wrt)
(simple-* (simple 'log a) (simple-^ a b)))))
(defun delta-^ (list wrt)
(simple-+ (delta-power list wrt)
(delta-exp list wrt)))
(defun delta-operate (operator list wrt)
(cond
((eql operator '+) (delta-+ list wrt))
((eql operator '-) (delta-- list wrt))
((eql operator '*) (delta-* list wrt))
((eql operator '/) (delta-/ list wrt))
((eql operator '^) (delta-^ list wrt))
(t (dolist (pair *delta-table*)
(when (eql operator (first pair))
(return (simple-* (delta (second list) wrt)
(simplify (second pair)))))))))
(defun delta (expr wrt)
(cond
((atom expr) (delta-atom expr wrt))
((null (rest expr)) (delta (first expr) wrt))
((eql (first expr) '-) (delta-* (negative expr) wrt))
(t (dolist (pair *op*)
(when (eql (first pair) (nth (second pair) expr))
(return (delta-operate (first pair) expr wrt)))))))
| 2,048 | Common Lisp | .lisp | 58 | 31.241379 | 57 | 0.542698 | akiyeng2/symbolic-math | 0 | 0 | 0 | GPL-3.0 | 9/19/2024, 11:36:45 AM (Europe/Amsterdam) | 6edb29312e02055b57ff05594efcc3099f2d02b9305bee0ab34926f503562fc2 | 28,818 | [
-1
] |
28,838 | ttf-flash.lisp | sgarciac_ttf-flash/ttf-flash.lisp | (in-package #:cl-user)
(defpackage #:ttf-flash
(:use #:cl #:gordon)
(:export
#:generate-flash-font
#:generate-flash-font-file
))
(in-package #:ttf-flash)
(defun glyph-to-swf-contours (glyph ratio)
(let ((contours '()
))
(labels ((x-trans (x) (floor (* x ratio)))
(y-trans (y) (* -1 (floor (* y ratio))))
)
(zpb-ttf:do-contours (contour glyph)
(setf contours
(nconc contours
(list
(let ((points '()
))
(zpb-ttf:do-contour-segments (s c e) contour
(setf points
(nconc
points
(list
(if c
(list
(x-trans (- (zpb-ttf:x c)
(zpb-ttf:x s)))
(y-trans (- (zpb-ttf:y c)
(zpb-ttf:y s)))
(x-trans
(- (zpb-ttf:x e)
(zpb-ttf:x c)))
(y-trans
(- (zpb-ttf:y e)
(zpb-ttf:y c)))
)
(list
(x-trans
(- (zpb-ttf:x e)
(zpb-ttf:x s)
))
(y-trans
(- (zpb-ttf:y e)
(zpb-ttf:y s))))
)))))
(close-contour (cons (list (x-trans (zpb-ttf:x (aref contour 0))) (y-trans (zpb-ttf:y (aref contour 0)))) points))
))))))
contours
))
(defun generate-flash-font (ttf-path name default-id &optional (max-glyphs 10000))
(zpb-ttf:with-font-loader (loader ttf-path)
(let ((ratio (/ 1024 (zpb-ttf:units/em loader)))
(unicodes (sort
(loop for i from 0 upto (min max-glyphs (1- (zpb-ttf:glyph-count loader)))
when (zpb-ttf:index-glyph i loader) collect (zpb-ttf:code-point (zpb-ttf:index-glyph i loader))) #'<)))
(make-instance 'tag-define-font-2
:id default-id
:name (zpb-ttf:name-entry-value :FULL-NAME loader)
:shapes (loop for code in unicodes
for glyph = (zpb-ttf:find-glyph code loader) then (zpb-ttf:find-glyph code loader)
collect (make-instance 'shape :records (mapcan (lambda (x) (make-records-from-contour x :linestyle 0)) (glyph-to-swf-contours glyph ratio))))
:codes unicodes
:ascent (floor (* ratio (zpb-ttf:ascender loader)))
:descent (floor (* ratio -1 (zpb-ttf:descender loader)))
:advance (loop for code in unicodes
for glyph = (zpb-ttf:find-glyph code loader) then (zpb-ttf:find-glyph code loader)
collect (floor (* ratio (zpb-ttf:advance-width glyph)))
)
))))
(defun generate-flash-font-file (ttf-path flash-font-path name default-id &optional (max-glyphs 1000000))
(with-open-file (stream flash-font-path :direction :output :if-exists :supersede :element-type '(unsigned-byte 8))
(write-sequence
(flat-marshall-data (marshall (generate-flash-font ttf-path name default-id max-glyphs)))
stream
)))
;
;(ttf-flash:generate-flash-font-file "/home/sergio/dev/flash/ttf-flash2/freeserif.ttf" "radio.fo" "_sans" 64000 500)
| 2,892 | Common Lisp | .lisp | 79 | 29.265823 | 148 | 0.593343 | sgarciac/ttf-flash | 0 | 0 | 0 | LGPL-2.1 | 9/19/2024, 11:36:45 AM (Europe/Amsterdam) | 07d029937848085675d0da9e2489079facdf9ed189a2d0af7aad6323c1348e5d | 28,838 | [
-1
] |
28,839 | ttf-flash.asd | sgarciac_ttf-flash/ttf-flash.asd | ;;; COPYRIGHT 2006 Sergio Garcia <[email protected]>
;;;
;;; This program 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 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 program; if not, write to the Free Software
;;; Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
(in-package #:cl-user)
(defpackage #:ttf-flash-system
(:use #:asdf #:cl))
(in-package #:ttf-flash-system)
(defsystem "ttf-flash"
:depends-on ("gordon" "zpb-ttf")
:components (
(:file "ttf-flash")))
| 1,020 | Common Lisp | .asd | 23 | 42.347826 | 79 | 0.73003 | sgarciac/ttf-flash | 0 | 0 | 0 | LGPL-2.1 | 9/19/2024, 11:36:45 AM (Europe/Amsterdam) | 664c3f13e3224db9ed926600043cf2ae061254fbd99a30d9d424e5d1ba1b8f8f | 28,839 | [
-1
] |
28,857 | power.lisp | aseeshr_LispTests/power.lisp | (defun power (X Y)
"Compute the power of (power B E)"
(if (<= Y 1)
X
(* X (power X (- Y 1))))) | 107 | Common Lisp | .lisp | 5 | 18 | 36 | 0.485437 | aseeshr/LispTests | 0 | 0 | 0 | LGPL-3.0 | 9/19/2024, 11:36:53 AM (Europe/Amsterdam) | 7fbd5f06cfe604e73f8a41b060728733b6ba150f9eb0f4e129a6c257c5432994 | 28,857 | [
-1
] |
28,858 | triangular.lisp | aseeshr_LispTests/triangular.lisp | (defun triangular (N)
"Compute the triangular N"
(if (= N 1)
1
(+ N (triangular (- N 1))))) | 103 | Common Lisp | .lisp | 5 | 17.4 | 30 | 0.555556 | aseeshr/LispTests | 0 | 0 | 0 | LGPL-3.0 | 9/19/2024, 11:36:53 AM (Europe/Amsterdam) | ebd9754528b14cc22612180167bfd51ef84e298d0d11afe3f3b1412b3057a5fd | 28,858 | [
-1
] |
28,859 | testing.lisp | aseeshr_LispTests/testing.lisp | ;;; testing.lisp
;;; by Philip Fong
;;;
;;; Introductory comments are preceded by ;;;
;;; Function headers are preceded by ";;"
;;; Inline comments are introduced by ";"
;;;
;;
;; Triple the value of a number
;;
(defun triple (X)
"Compute three times X." ;Inline comments can
(* 3 X)); be placed here.
;;
;; Negate the sign of a number
;;
(defun negate (X)
"Negate the value of X." ; This is a documentation of a string
(- X))
| 440 | Common Lisp | .lisp | 19 | 21.473684 | 64 | 0.666667 | aseeshr/LispTests | 0 | 0 | 0 | LGPL-3.0 | 9/19/2024, 11:36:53 AM (Europe/Amsterdam) | bc084fe5bfa398e9de4847982e9218fd2b91bea80cc628b87ac9163425307d79 | 28,859 | [
-1
] |
28,860 | binomial.lisp | aseeshr_LispTests/binomial.lisp | (defun binomial (N R)
"Compute the binomial expansion"
(if (or (zerop R) (= R N))
1
(+ (binomial (- N 1) (- R 1))
(binomial (- N 1) R))))
(defun sumlist (L)
"A recursive implementation of sum function"
(if (null L)
0
(+ (first L) (sumlist (rest L))))) | 286 | Common Lisp | .lisp | 11 | 21.909091 | 46 | 0.56 | aseeshr/LispTests | 0 | 0 | 0 | LGPL-3.0 | 9/19/2024, 11:36:53 AM (Europe/Amsterdam) | 1af89adad9c4cdb4e8c4669c813409834f572930c455c0886c5fcbaa64ffedd4 | 28,860 | [
-1
] |
28,861 | factorial.lisp | aseeshr_LispTests/factorial.lisp | (defun factorial (N)
"Compute the factorial of N."
(if (= N 1)
1
(* N (factorial (- N 1)))))
(defun sum (X Y)
"Compute the sum of X and Y"
(+ X Y))
(defun power (X Y)
"Compute the power of (power B E)"
(if (<= Y 1)
X
(* X (power X (- Y 1)))))
| 277 | Common Lisp | .lisp | 13 | 17.692308 | 36 | 0.521073 | aseeshr/LispTests | 0 | 0 | 0 | LGPL-3.0 | 9/19/2024, 11:36:53 AM (Europe/Amsterdam) | dd2cef81296014ca93b284b148ac8e686b277aefa20a5d43ce1bfcb60a53c752 | 28,861 | [
-1
] |
28,867 | testing.fasl | aseeshr_LispTests/testing.fasl | #!/usr/bin/sbcl --script
# FASL
compiled from "testing.lisp"
using SBCL version 1.0.55.0.debian
ˇ X86N 1.0.55.0.debian2 (:GENCGC :SB-PACKAGE-LOCKS :SB-THREAD :SB-UNICODE)ùS B - I M P L % D E F U N ùC O M M O N - L I S P - U S E R T R I P L E > $EB$ $@$"$%$ NS T A N D A R D NM I N I M A L $ $$$O$$#ê (NE X T E R N A L ùS B - C T L - X E P
C O M P I L E D - D E B U G - F U N ( $ $ $ -
LS T R U C T U R E - O B J E C T
($$$ -ùS B - S Y S S T R U C T U R E ! O B J E C T
($$$ - D E B U G - F U N
($$$ -($$
$ -1
$*$E$*$%$ $ $$$E(1
(C O M P I L E D - D E B U G - I N F O
D E B U G - I N F O
( $$$ -!("$$$ -#1$%;E * èEçeËɢuâU¸ãU¸ø Ë sã„ã¯]√Ã
ONR E L A T I V E ùS B - V M ' G E N E R I C - * î3 =)X +LF U N C T I O N -LV A L U E S LN U M B E R L & |