C      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcd e f g h i j k l m n o p q r s t u v w x y z { | } ~        !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~           !!!!!!!"""""""##$$$%%%%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&'(((((((())))))+H98 experimental Douglas Burke"  !"#"  !"#"  !"#"  !"#H98 experimental Douglas Burke$:ShowM is a type class for values that may be formatted in  multi-line displays. % Multi-line value display method ; Create a multiline displayable form of a value, returned  as a 1 value. The default implementation behaves just  like a normal instance of . EThis function is intended to allow the calling function some control & of multiline displays by providing: = the first line of the value is not preceded by any text, so B it may be appended to some preceding text on the same line, A the supplied line break string is used to separate lines of the C formatted text, and may include any desired indentation, and 8 no newline is output following the final line of text. &1Return a string representation of a ShowM value. $%&$%&$%%&H98 experimental Douglas Burke'()*+,-./012<Convert a filepath to a file: URI stored in a QName. If the ?input file path is relative then the working directory is used %to convert it into an absolute path. ;If the input represents a directory then it *must* end in the directory separator - e.g. "/foo/bar/" rather than "/foo/bar" for Posix systems. %This has not been tested on Windows.  '()*+,-./012 '()*+,-./012 '()*()*+,-./012H98 experimental Douglas Burke345678345678345687345678GDeriveFunctor, DeriveFoldable, DeriveTraversable, MultiParamTypeClasses experimental Douglas Burke9: Arc type ;<=>? Label class OA label may have a fixed binding, which means that the label identifies (is) a N particular graph node, and different such labels are always distinct nodes. M Alternatively, a label may be unbound (variable), which means that it is a J placeholder for an unknown node label. Unbound node labels are used as G graph-local identifiers for indicating when the same node appears in  several arcs. RFor the purposes of graph-isomorphism testing, fixed labels are matched when they O are the same. Variable labels may be matched with any other variable label. P Our definition of isomorphism (for RDF graphs) does not match variable labels  with fixed labels. @(Does this node have a variable binding? A9Calculate the hash of the label using the supplied seed. B<Extract the local id from a variable node. C&Make a label value from a local id. DLabelled Directed Graph class "Minimum required implementation: E, F and L. >NOTE: I wanted to declare this as a subclass of Functor, but : the constraint on the label type seems to prevent that.  So I'4ve just declared specific instances to be Functors. E(Replace the existing arcs in the graph. F"Extract all the arcs from a graph G(Extract those arcs that match the given 9. HAdd the two graphs I5Remove those arcs in the first graph from the second  graph g1 g2 g2 - g1 -> g3 J4Enumerate the distinct labels contained in a graph; 1 that is, any label that appears in the subject, $ predicate or object position of an ;:. K3Enumerate the distinct nodes contained in a graph; 0 that is, any label that appears in the subject  or object position of an ;:. L'Test for graph containment in another. M6Update the arcs in a graph using a supplied function. N>Function to replace arcs in a graph with a given list of arcs OPQRCreate an arc. The subject of the arc. The predicate of the arc. The object of the arc. STUV!Return all the labels in an arc. 6Return just the subject and object labels in the arc. 9:;<=>?@ABCDEFGHIJKLMNOPQRSTUVDEFGHIJKLMN?@ABC:;<=>OPQRST9UV9:;<=>;<=>?@ABC@ABCD EFGHIJKLMEFGHIJKLMNOPQRSTUVH98 experimental Douglas Burke+WXYZ?Representation of a graph as a collection of (possibly nested) C partitions. Each node in the graph appears at least once as the  root value of a W value: @ Nodes that are the subject of at least one statement appear as # the first value of exactly one X constructor, and may ! also appear in any number of Y constructors. > Nodes appearing only as objects of statements appear only in  Y constructors. [\]^_`a7Turning a partitioned graph into a flat graph is easy. ; The interesting challenge is to turn a flat graph into a > partitioned graph that is more useful for certain purposes.  Currently, I'm interested in:  & isolating differences between graphs  pretty-printing graphs :For (1), the goal is to separate subgraphs that are known B to be equivalent from subgraphs that are known to be different,  such that: % different sub-graphs are minimized,  different D sub-graphs are placed into 1:1 correspondence (possibly with null  subgraphs), and 1 only deterministic matching decisions are made. @For (2), the goal is to decide when a subgraph is to be treated K as nested in another partition, or treated as a new top-level partition. H If a subgraph is referenced by exactly one graph partition, it should F be nested in that partition, otherwise it should be a new top-level  partition. 4Strategy. Examining just subject and object nodes: C all non-blank subject nodes are the root of a top-level partition F blank subject nodes that are not the object of exactly one statement , are the root of a top-level partition. = blank nodes referenced as the object of exactly 1 statement E of an existing partition are the root of a sub-partition of the  refering partition. ? what remain are circular chains of blank nodes not referenced D elsewhere: for each such chain, pick a root node arbitrarily. b  CCollect a list of items by some comparison of a selected component  or other derived value. Bcmp a comparison function that determines if a pair of values % should be grouped together 8 sel a function that selects a value from any item Example: collect fst [(1,a),(2,b),(1,c)] =  [(1,[(1,a),(1,c)] ),(2,[(2,b)])]    3Add new values to an existing list of collections. B The list of collections is not extended, but each collection is B augmented with a further list of values from the supplied list, D each of which are related to the existing collection in some way. NOTE: the basic pattern of   and  is similar, @ and might be generalized into a common set of core functions. <Remove supplied element from a list using the supplied test 9 function, and return Just the element remoived and the D remaining list, or Nothing if no element was matched for removal. EReverse first argument, prepending the result to the second argument <Remove each element from a list, returning a list of pairs, ? each of which is the element removed and the list remaining. GList differences between the members of two lists, where corresponding I elements may appear at arbitrary locations in the corresponding lists. )Elements are compared using the function cmp, which returns: 6 * Nothing if the elements are completely unrelated  * Just [] if the elements are identical J * Just ds if the elements are related but not identical, in which case I ds is a list of values describing differences between them. Returns (ds,u1,u2), where: C ds is null if the related elements from each list are identical, C otherwise is a list of differences between the related elements. @ u1 is a list of elements in a1 not related to elements in a2. @ u2 is a list of elements in a2 not related to elements in a1. WXYZ[\]^_`ab Z[\]WYX^_ab` WYXXYZ[[\]^_`abH98 experimental Douglas Burkecccc H98 experimental Douglas Burked?Select is like filter, except that it tests one list to select  elements from a second list. e@Collect set of values from list under supplied mapping function f Delete the n'+th element of a list, returning the result If the list doesn' t have an n''th element, return the list unchanged. g Subset test hSet equivalence test iSet partition test *Is it possible to be more efficient here?  Maybe something like sort/merge/ compare? jAdd element to set kReturn head of a list of Maybe's, or Nothing if list is empty  Use with  filter isJust& to select a non-Nothing value from a % list when such a value is present. lmnop9Break list into a list of sublists, separated by element ! satisfying supplied condition. q0Powerset of a list, in ascending order of size. 7 Assumes the supplied list has no duplicate elements. rCCombinations of n elements from a list, each being returned in the & order that they appear in the list. st;Given a list of lists, construct a new list of lists where A each member of the new list is the same length as the original = list, and each member corresponds to a different choice of 7 one element from each of the original members in the ! corresponding position. Thus:  & listProduct [[a1,a2],[b1],[c1,c2]] = 9 [ [a1,b1,c1], [a1,b1,c2], [a2,b1,c1], [a2,b1,c2] ] ;Note: The length of the resulting list is the prodicty of < lengths of the components of the original list. Thus, if : any member of the original list is empty then so is the  resulting list:  ' listProduct [[a1,a2],[],[c1,c2]] = [] NOTE: this is subsumed by  u/Function to choose all sequences of any length - from a supplied set of values, returned in  increasing length. :Construct list of lists of sequences of increasing length 7Return sequences of length n+1 given original sequence ( and list of all sequences of length n v,Return all powersequences of a given length w/Return all powersequences of indefinite length A Observe that any such powersequence will consist of a sequence B of a finite length sequence followed by an indefinite number of B copies of the head of the base set. To prevent duplicates, the C generator constructs only sequences that do not end in the first  member of the base set. xBApply list of functions to some value, returning list of results.  It' s kind of like an converse map. This is similar to the ap function in the Monad library. y:Fold result from list of functions applied to some value, $ returning the result of the fold. This is similar to the ap function in the Monad library. z>Test if application of all functions in list to a given value  satisfies a given condition {>Test if application of any functions in list to a given value  satisfies a given condition |3Test if a value satisfies all predicates in a list }2Test if a value satisfies any predicate in a list defghijklmnopqrstuvwxyz{|}defghijklmnopqrstuvwxyz{|}defghijklmnopqrstuvwxyz{|} H98 experimental Douglas Burke ~6This function finds the maxima in a list of partially 6 ordered values, preserving the sequence of retained ! values from the supplied list. 1It returns all those values in the supplied list 4 for which there is no larger element in the list. 6This function finds the minima in a list of partially 6 ordered values, preserving the sequence of retained ! values from the supplied list. 1It returns all those values in the supplied list 5 for which there is no smaller element in the list. Partial ordering for Eq values  Partial ordering for Ord values -Part-ordering comparison on pairs of values, . where each has a part-ordering relationship FPart-ordering comparison on lists of partially ordered values, where:  as==bs@ if members of as are all equal to corresponding members of bs as<=bs? if members of as are all less than or equal to corresponding  members of bs as>=bsB if members of as are all greater than or equal to corresponding  members of bs  otherwise as and bs are unrelated FThe comparison is restricted to the common elements in the two lists. 8Part-ordering comparison on lists of Ord values, where: as==bs@ if members of as are all equal to corresponding members of bs as<=bs? if members of as are all less than or equal to corresponding  members of bs as>=bsB if members of as are all greater than or equal to corresponding  members of bs  otherwise as and bs are unrelated +Part-ordering comparison for Maybe values. 3Part-ordering comparison on lists of Maybe values. ?Part-ordering comparison on lists based on subset relationship ~ ~ ~ A lot of LANGUAGE extensions... experimental Douglas Burke./Define a lookup map based on a list of values. 5Note: the class constraint that a is an instance of  G is not defined here, for good reasons (which I forget right now, but B something to do with the method dictionary being superfluous on  an algebraic data type). LookupEntryClass- defines essential functions of any datatype  that can be used to make a . Minimal definition: newEntry and keyVal 7Empty lookup map of arbitrary (i.e. polymorphic) type. Function to create a  from a list of entries. 8Currently, this is trivial but future versions could be  more substantial. #Return list of lookup map entries. 8Currently, this is trivial but future versions could be  more substantial. >Given a lookup map entry, return a new entry that can be used A in the reverse direction of lookup. This is used to construct  a reverse LookupMap. 6Given a lookup map, return a new map that can be used ' in the opposite direction of lookup. BGiven a pair of lookup entry values, return the ordering of their  key values. 7Find key in lookup map and return corresponding value, % otherwise return default supplied. @Find key in lookup map and return Just the corresponding value,  otherwise return Nothing. 2Test to see if key is present in the supplied map EReplace an existing occurrence of a key a with a new key-value pair. BThe resulting lookup map has the same form as the original in all G other respects. Assumes exactly one occurrence of the supplied key. EReplace an existing occurrence of a key a with a new key-value pair, J or add a new key-value pair if the supplied key is not already present. =Replace any occurrence of a key a with a new key-value pair. BThe resulting lookup map has the same form as the original in all  other respects. =Replace any occurrence of a key in the first argument with a E corresponding key-value pair from the second argument, if present. 6This could be implemented by multiple applications of , 3 but is arranged differently so that only one new  LookupMap value is  created. ?Note: keys in the new map that are not present in the old map % are not included in the result map /Add supplied key-value pair to the lookup map. )This is effectively an optimized case of  or , = where the caller guarantees to avoid duplicate key values. /Add supplied key-value pair to the lookup map, 0 only if the key value is not already present. /Delete supplied key value from the lookup map. .This function assumes exactly one occurrence. CDelete any occurrence of a supplied key value from the lookup map. DReturn a list of values obtained by applying a function to each key @ in the map. Creates an alternative set of values that can be  retrieved using mapTranslate. 2Find a node in a lookup map list, and returns the F corresponding value from a supplied list. The appropriate ordering G of the list is not specified here, but an appropriately ordered list  may be obtained by . &Compare two lookup maps for equality. =Two maps are equal if they have the same set of keys, and if ( each key maps to an equivalent value. 0Return the list of keys in a supplied LookupMap 7Return list of distinct values in a supplied LookupMap 3Select portion of a lookup map that corresponds to  a supplied list of keys =Merge two lookup maps, ensuring that if the same key appears 5 in both maps it is associated with the same value. ?Creates a new map that is the same as the supplied map, except , that its entries are sorted by key value. (What'+s this used for? It should be redundant.) ?Creates a new map that is the same as the supplied map, except , that its entries are sorted by key value. (What'+s this used for? It should be redundant.) >An fmap-like function that returns a new lookup map that is a A copy of the supplied map with entry keys replaced according to  a supplied function. >An fmap-like function that returns a new lookup map that is a C copy of the supplied map with entry values replaced according to  a supplied function. ?A function that returns a new lookup map that is a copy of the ; supplied map with complete entries replaced according to  a supplied function. Since  now has a  instance this is just   A monadic form of . Since  now has a Data.Traversable.Traversable instance  this is just !. "8Define Show instance for LookupMap based on Showing the  list of entries. #Define equality of & values based on equality of entries. D(This is possibly a poor definition, as it is dependent on ordering F of list members. But it passes all current test cases, and is used  only for testing.)  See also  % (why not just use that here? I don' t know: it's probably historic.) $EPredefine a pair of appropriate values as a valid lookup table entry * (i.e. an instance of LookupEntryClass). ((( +TypeSynonymInstances, MultiParamTypeClasses experimental Douglas Burke:A full ScopedName value has a QName prefix, namespace URI ; and a local part. ScopedName values may omit the prefix  (see ) or the local part. <Some applications may handle null namespace URIs as meaning / the local part is relative to some base URI. @A NameSpace value consists of a prefix and a corresponding URI.  The prefix may be empty ("".), in which case it is assumed to be unknown. NOTE: not clear whether nsPrefix should be empty or set to "?". %&')Get QName corresponding to a scoped name ?Get URI corresponding to a scoped name (using RDF conventions) 6Test if supplied string matches the display form of a  scoped name. 7Construct a ScopedName from prefix, URI and local name $Construct a ScopedName from a QName &Construct a ScopedName for a bare URI )This should never appear as a valid name  H98 experimental Douglas Burke0000+MultiParamTypeClasses, TypeSynonymInstances experimental Douglas Burke09VarBindingFilter is a function type that tests to see if , a query binding satisfies some criterion. =Queries often want to apply some kind of filter or condition D to the variable bindings that are processed. In inference rules, E it sometimes seems desirable to stipulate additional conditions on  the things that are matched. 2This function type is used to perform such tests. 9 A number of simple implementations are included below. CType for variable binding modifier that has yet to be instantiated 7 with respect to the variables that it operates upon. =Define the type of a function to modify variable bindings in ; forward chaining based on rule antecedent matches. This $ function is used to implement the " allocated to" logic described C in Appendix B of the RDF semantics document, in which a specific C blank node is associated with all matches of some specific value 0 by applications of the rule on a given graph.  Use (: if no modification of the variable bindings is required. >This datatype consists of the modifier function itself, which ? operates on a list of variable bindings rather than a single D variable binding (because some modifications share context across B a set of bindings), and some additional descriptive information 6 that allows possible usage patterns to be analyzed. Some usage patterns (see  for more details):  filter4 all variables are input variables, and the effect A of the modifier function is to drop variable bindings that  don't satisfy some criterion. * Identifiable by an empty element in vbmUsage. source3 all variables are output variables: a raw query 8 could be viewed as a source of variable bindings. $ Identifiable by an element of vbmUsage equal to vbmVocab. modifier2 for each supplied variable binding, one or more < new variable bindings may be created that contain the H input variables bound as supplied plus some additional variables. $ Identifiable by an element of vbmUsage some subset of vbmVocab. AA variety of variable usage patterns may be supported by a given D modifier: a modifier may be used to define new variable bindings F from existing bindings in a number of ways, or simply to check that < some required relationship between bindings is satisfied.  (Example, for  a + b = c+, any one variable can be deduced from the I other two, or all three may be supplied to check that the relationship  does indeed hold.) ,Name used to identify this variable binding * modifier when building inference rules. %Apply variable binding modifier to a ) list of variable bindings, returning a $ new list. The result list is not % necessarily the same length as the  supplied list. )List of variables used by this modifier. 0 All results of applying this modifier contain  bindings for these variables. (List of binding modifier usage patterns / supported. Each pattern is characterized as - a list of variables for which new bindings - may be created by some application of this 1 modifier, assuming that bindings for all other  variables in vbmVocab are supplied. 9VarBinding is the type of an arbitrary variable bindings > value, where the type of the bound values is not specified. maps no query variables. DReturn a list of the variables bound by a supplied variable binding >VarBinding subset function, tests to see if one query binding E is a subset of another; i.e. every query variable mapping defined ' by one is also defined by the other. 3Function to make a variable binding from a list of 6 pairs of variable and corresponding assigned value.  =Apply query binding to a supplied value, returning the value % unchanged if no binding is defined  <Join a pair of query bindings, returning a new binding that A maps all variables recognized by either of the input bindings. C If the bindings should overlap, such overlap is not detected and A the value from the first binding provided is used arbitrarily.  FAdd a single new value to a variable binding and return the resulting  new variable binding. )#Extract variable binding name from OpenVarBindingModify value D(Because only the name is required, the application to an undefined D list of variable labels should never be evaluated, as long as the ; name is not dependent on the variable names in any way.) /NOT QUITE... some of the functions that create OpenVarBindingModify F instances also pattern-match the number of labels provided, forcing 4 evaluation of the labels parameter, even though it' s not used.  .Variable binding modifier compatibility test. HGiven a list of bound variables and a variable binding modifier, return 0 a list of new variables that may be bound, or Nothing. ?Note: if the usage pattern component is well-formed (i.e. all F elements different) then at most one element can be compatible with  a given input variable set. *+Variable binding usage compatibility test. Returns True5 if the supplied variable bindings can be compatibly E processed by a variable binding usage with supplied vocabulary and  usage pattern. !variables supplied with bindings /variables returned with bindings by a modifier .variables assigned new bindings by a modifier  $Compose variable binding modifiers. Returns Just a3 new variable binding modifier that corresponds to D applying the first supplied modifier and then applying the second  one, or Nothing5 if the two modifiers cannot be compatibly composed. 4NOTE: this function does not, in general, commute. CNOTE: if there are different ways to achieve the same usage, that 6 usage is currently repeated in the result returned. +BDetermine compatible ways in which variable binding modifiers may  be combined. DThe total vocabulary of a modifier is the complete set of variables G that are used or bound by the modifier. After the modifier has been ; applied, bindings must exist for all of these variables. BA usage pattern of a modifier is a set of variables for which new - bindings may be generated by the modifier. IThe only way in which two variable binding modifiers can be incompatible H with each other is when they both attempt to create a new binding for I the same variable. (Note that this does not mean the composition will & be compatible with all inputs: see *.) CNOTE: if there are different ways to achieve the same usage, that 6 usage is currently repeated in the result returned. 9the total vocabulary of the first modifier to be applied &usage patterns for the first modifier 'usage patterns for the second modifier 9a list of possible usage patterns for the composition of C the first modifier with the second modifier, or an empty list if " the modifiers are incompatible. ?Find all compatible compositions of a list of variable binding 9 modifiers for a given set of supplied bound variables. ,:Compose sequence of variable binding modifiers, and check > that the result can be used compatibly with a supplied list  of bound variables, returning Just (composed modifier),  or Nothing. 0Compose sequence of variable binding modifiers. -8Compose a pair of variable binding modifiers, returning  Just (composed modifier), or Nothing. Return Just a6 compatible composition of variable binding modifiers 2 for a given set of supplied bound variables, or Nothing if there  is no compatible composition 5Variable binding modifier that returns exactly those  variable bindings presented. Null variable binding modifier  This is like & except parameterized by some labels. 7 I think this is redundant, and should be eliminated. GMake a variable binding modifier from a variable binding filter value. 9Make a variable test filter for a named variable using a # supplied value testing function. <Make a variable comparison filter for named variables using ( a supplied value comparison function. AThis function generates a query binding filter that ensures that > two indicated query variables are mapped to the same value. AThis function generates a query binding filter that ensures that @ two indicated query variables are mapped to different values. 9This function composes a number of query binding filters > into a composite filter that accepts any query binding that 2 satisfies at least one of the component values. 9This function composes a number of query binding filters > into a composite filter that accepts any query binding that ) satisfies all of the component values. ?The same function could be achieved by composing the component ? filter-based modifiers, but this function is more convenient = as it avoids the need to check for modifier compatibility. .FAllow an OpenVarBindingModify value to be accessed using a LookupMap. / Allow an OpenVarBindingModify value to be accessed using a  LookupMap. 06Allow a VarBindingModify value to be accessed using a  LookupMap. 1:VarBinding is an instance of class Show, so that variable  bindings can be displayed 28VarBinding is an instance of class Eq, so that variable + bindings can be compared for equivalence &     &     &     MultiParamTypeClasses experimental Douglas Burke9Rule is a data type for inference rules that can be used " to construct a step in a proof. .Name of rule, for use when displaying a proof /Forward application of a rule, takes a list of 2 expressions and returns a list (possibly empty) 6 of forward applications of the rule to combinations ! of the antecedent expressions. : Note that all of the results returned can be assumed to < be (simultaneously) true, given the antecedents provided. 4Backward application of a rule, takes an expression 9 and returns a list of alternative antecedents, each of 8 which is a list of expressions that jointly yield the 9 given consequence through application of the inference 5 rule. An empty list is returned if no antecedents - will allow the consequence to be inferred.  9Inference check. Takes a list of antecedent expressions 5 and a consequent expression, returning True if the 6 consequence can be obtained from the antecedents by 5 application of the rule. When the antecedents and > consequent are both given, this is generally more efficient 2 that using either forward or backward chaining. 7 Also, a particular rule may not fully support either ; forward or backward chaining, but all rules are required " to fully support this function. 6A default implementation based on forward chaining is  given below. !!A Formula is a named expression. "#%Name used for formula in proof chain $Named formula value %8Expression is a type class for values over which proofs  may be constructed. &+Is expression true in all interpretations? : If so, then its truth is assumed without justification. 'The namespace http:id.ninebynine.org2003Ruleset/null ()9Return a displayable form of a list of labelled formulae *0Create a displayable form of a labelled formula +,-.BShow a string left justified in a field of at least the specified  number of characters width. 3-Define ordering of rules based on rule names 43Define equality of rules as equality of rule names 53Define ordering of formulae based on formula names 69Define equality of formulae as equality of formula names  !"#$%&'()*+,-.%&!"#$ '(-+,*).  !"#$"#$%&&'()*+,-.MultiParamTypeClasses experimental Douglas Burke/0,Ruleset, having namespace, axioms and rules 1234567899Find a named axiom or rule in a ruleset or proof context :;<=>/0123456789:;<=>01234/56789:;<=>/01234123456789:;<=>0ExistentialQuantification, MultiParamTypeClasses experimental Douglas BurkeJ?Describe a subtype/4supertype relationship between a pair of datatypes. JOriginally, I had this as a supertype field of the DatatypeVal structure, ( but that suffered from some problems: / supertypes may be introduced retrospectively, > the relationship expressed with respect to a single datatype + cannot indicate hiow to do injections/restrictions between the  underlying value types. exE is the type of expression with which the datatype may be used. lb/ is the type of the variable labels used. vnB is the type of value node used to contain a datatyped value supvt4 is the internal value type of the super-datatype subvt2 is the internal value type of the sub-datatype @A Datatype that is a supertype of trelSub,  having value space supvt. BDatatype that is a subtype of trelSup,  having value space supvt. C$Function that maps subtype value to " corresponding supertype value. D&Function that maps supertype value to ) corresponding subtype value, if there  is such a value. E7 support for list functions: function applicator type FFunction table type G: support for list functions (e.g. sum over list of args), C where first element of list is a fold over the rest of the list, < and remaining elements of list can be calculated in terms 7 of the result of the fold and the remaining elements List function descriptor is %(a) list-fold function, f (e.g. (+) $(b) list-fold identity, z (e.g. 0) -(c) list-fold-function inverse, g (e.g. (-)) !(d) index of element to evaluate  such that:   (a `f` z) == (z `f` a) == a $ (a `g` c) == b <=> a == b `f` c  (a `g` z) == a  (a `g` a) == z 9and the result of the folded function does not depend on 2 the order that the list elements are processed. NOTE: the list of G values supplied to  must D be at least as long as the argument list. In many cases, Haskell B lazy evaluation can be used to supply an arbitrarily long list. 5 See test cases in spike-altargs.hs for an example. Function descriptor type H; support for binary function with provision for indicating : inconsistent supplied values: function applicator type I; support for binary function with provision for indicating @ inconsistent supplied values: function descriptor table type J; support for binary function with provision for indicating : inconsistent supplied values: function descriptor type K8 support for binary functions: function applicator type L> support for binary functions: function descriptor table type M8 support for binary functions: function descriptor type N7 support for unary functions: function applicator type O= support for unary functions: function descriptor table type P7 support for unary functions: function descriptor type Q<Wrapper for data type variable binding modifier included in  a datatype value. RSTUVBType of function used to apply a data value modifier to specified A variables in a supplied variable binding. It also accepts the B name of the datatype modifier and carries it into the resulting  variable binding modifier.  (Note that vn is not necessarily the same as vt, the datatype value C type: the modifier functions may be lifted or otherwise adapted C to operate on some other type from which the raw data values are  extracted.) W'Datatype value modifier functions type EEach function accepts a list of values and returns a list of values. G The exact significance of the different values supplied and returned 4 depends on the variable binding pattern used (cf. V), G but in all cases an empty list returned means that the corresponding B inputs are not consistent with the function and cannot be used. X7Datatype for a named relation on values of a datatype. YZ[\@Type for datatype relation predicate: accepts a list of values ; and determines whether or not they satisfy the relation. ]1Type for a datatype relation inference function. ?A datatype relation defines tuples of values that satisfy some ? relation. A datatype relation inference function calculates 8 values that complete a relation with values supplied. The function accepts a list of Maybe vt, where vt is the + datatype value type. It returns one of: ; Just a list of lists, where each inner list returned is a B complete set of values, including the values supplied, that  are in the relation. ; Just an empty list is returned if the supplied values are A insufficient to compute any complete sets of values in the  relation. 8 Nothing if the supplied values are not consistent with  the relation. ^>DatatypeMap consists of methods that perform lexical-to-value : and value-to-canonical-lexical mappings for a datatype. 5The datatype mappings apply to string lexical forms. _`"Function to map lexical string to % datatype value. This effectively $ defines the lexical space of the ( datatype to be all strings for which  yield a value other than Nothing. a)Function to map a value to its canonical ! lexical form, if it has such. b>DatatypeVal is a structure that defines a number of functions < and values that characterize the behaviour of a datatype. @A datatype is specified with respect to (polymophic in) a given @ type of (syntactic) expression with which it may be used, and @ a value type (whos existence is hidden as an existential type  within _^. <(I tried hiding the value type with an internal existential  declaration, but that wouldn't wash. Hence this two-part  structure with lk in which the internal detail 0 of the value type is hidden from users of the lk class.) 6The datatype characteristic functions have two goals:  = to support the general datatype entailment rules defined by + the RDF semantics specification, and > to define additional datatype-specific inference patterns by > means of which provide additional base functionality to + applications based on RDF inference. 4Datatype-specific inferences are provided using the YX E structure for a datatype, which allows a number of named relations ? to be defined on datatype values, and provides mechanisms to > calculate missing values in a partially-specified member of  a relation. >Note that rules and variable binding modifiers that deal with ; combined values of more than one datatype may be defined C separately. Definitions in this module are generally applicable % only when using a single datatype. AAn alternative model for datatype value calculations is inspired < by that introduced by CWM for arithmetic operations, e.g.  + (1 2 3) math:sum ?x => ?x rdf:value 6 (where the bare integer n here is shorthand for "n" ^^xsd:integer). ?Datatype-specific inference patterns are provided in two ways: = by variable binding modifiers that can be combined with the ; query results during forward- for backward-chaining of  inference rules, and 6 by the definition of inference rulesets that involve  datatype values. @I believe the first method to be more flexible than the second, B in that it more readily supports forward and backward chaining, < but can be used only through the definition of new rules. Type parameters: ex@ is the type of expression with which the datatype may be used. vtB is the internal value type with which the labels are associated. lb; is the type of label that may be used as a variable in an  expression or rule. vn= is the type of node that may be used to carry a value in an  expression or rule. cd"Identifies the datatype, and also  its value space class. e%A set of named expressions and rules ' that are valid in in any theory that # recognizes the current datatype. f&A function that accepts an expression & and devives some datatype-dependent ( rules from it. This is provided as a $ hook for creating datatyped class  restriction rules. g#Constructs a list of open variable & binding modifiers based on tvalMod, $ but hiding the actual value type. h Lexical to value mapping, where vt is + a datatype used within a Haskell program ( to represent and manipulate values in  the datatype's value space i%A set of named relations on datatype ( values. Each relation accepts a list  of Maybe vt, and computes any % unspecified values that are in the ! relation with values supplied. j(A list of named values that are used to . construct variable binding modifiers, which , in turn may be used by a rule definition. 'TODO: In due course, this value may be - calculated automatically from the supplied  value for tvalRel. kDatatype wraps a cb# value, hiding the value type that 3 is used only in implementations of the datatype. ; Users see just the datatype name and associated ruleset. lm"Get type name from Datatype value n%Get static rules from Datatype value o;Make rules for Datatype value based on supplied expression p9Make variable binding modifiers based on values supplied q$Get named axiom from Datatype value r#Get named rule from Datatype value s%Get canonical form of datatype value tuv)Get canonical form of datatype value, or Nothing. wNull datatype value modifier xV function for use with RQ in cases  when the value mapping is a 1->1 function and inverse, such  as negate.  nam is the name from the RQ value that is carried into 3 the resulting variable binding modifier. fns= are functions used to implement details of the variable  binding modifier:   is [x,y] -> [?]*, used as a filter (i.e. not creating any D new variable bindings), returning a non-empty list if x and y 3 are in the appropriate relationship.  is [y] -> [x]/, used to perform the calculation in a forward  direction.  is [x] -> [y]0, used to perform the calculation in a backward J direction. This may be the same as (2) (e.g. for negation) 4 or may be different (e.g. increment).  lbsE is a list of specific label values for which a variable binding K modifier will be generated. (The intent is that a variable-free I value can be generated as a Curried function, and instantiated 1 for particular variables as required.) 'Note: an irrefutable pattern match for lbs is used so that a name  for the + value can be extracted using an undefined  label value. yV function for use with RQ in cases when ( the value mapping is a non-invertable 1->1 injection, such as  absolute value.  nam is the name from the RQ value that is carried into 3 the resulting variable binding modifier. fns9 are functions used to implement details of the variable  binding modifier:   is [x,y] -> [?]*, used as a filter (i.e. not creating any D new variable bindings), returning a non-empty list if x and y 3 are in the appropriate relationship.  is [x] -> [y]#, used to perform the calculation.  lbsA is a list of specific label values for which a variable binding & modifier will be generated. 'Note: an irrefutable pattern match for lbs is used so that a name  for the + value can be extracted using an undefined  label value. zV function for use with RQ in cases  when the value mapping is a 2->1 invertable function, such as  addition or subtraction.  nam is the name from the RQ value that is carried into 3 the resulting variable binding modifier. fns= are functions used to implement details of the variable  binding modifier:   is [x,y,z] -> [?]*, used as a filter (i.e. not creating any D new variable bindings), returning a non-empty list if  x, y and z& are in the appropriate relationship.  is [y,z] -> [x]', used to perform the calculation in a ! forward direction.  is [x,z] -> [y]+, used to run the calculation backwards to 1 determine the first input argument  is [x,y] -> [z]+, used to run the calculation backwards to 2 determine the second input argument  lbsE is a list of specific label values for which a variable binding & modifier will be generated. 'Note: an irrefutable pattern match for lbs is used so that a name  for the + value can be extracted using an undefined  label value. {V function for use with RQ in cases  when the value mapping is a 2->1" non-invertable function, such as  logical AND or OR.  nam is the name from the RQ value that is carried into 3 the resulting variable binding modifier. fns= are functions used to implement details of the variable  binding modifier:   is [x,y,z] -> [?]*, used as a filter (i.e. not creating any D new variable bindings), returning a non-empty list if  x, y and z& are in the appropriate relationship.  is [y,z] -> [x]', used to perform the calculation in a ! forward direction.  lbsE is a list of specific label values for which a variable binding & modifier will be generated. 'Note: an irrefutable pattern match for lbs is used so that a name  for the + value can be extracted using an undefined  label value. |V function for use with RQ in cases > when the value mapping is a simple comparson of two values.  nam is the name from the RQ value that is carried into 3 the resulting variable binding modifier. fns= are functions used to implement details of the variable  binding modifier:   is [x,y] -> [?]*, used as a filter (i.e. not creating any D new variable bindings), returning a non-empty list if  x and y& are in the appropriate relationship.  lbsE is a list of specific label values for which a variable binding & modifier will be generated. 'Note: an irrefutable pattern match for lbs is used so that a name  for the + value can be extracted using an undefined  label value. }V function for use with RQ in cases  when the value mapping is a 2->2" non-invertable function, such as  quotient/ remainder  nam is the name from the RQ value that is carried into 3 the resulting variable binding modifier. fns= are functions used to implement details of the variable  binding modifier:   is [w,x,y,z] -> [?]&, used as a filter (i.e. not creating H any new variable bindings), returning a non-empty list if  w, x, y and z& are in the appropriate relationship.  is [y,z] -> [w,x](, used to perform the calculation given  two input values.  lbsE is a list of specific label values for which a variable binding & modifier will be generated. 'Note: an irrefutable pattern match for lbs is used so that a name  for the + value can be extracted using an undefined  label value. 0NOTE: this might be generalized to allow one of w or x to be ( specified, and return null if it doesn't match the calculated value. ~V function for use with RQ in cases  when the value mapping is a N->1 function, # such as Sigma (sum) of a vector.  nam is the name from the RQ value that is carried into 3 the resulting variable binding modifier. fns= are functions used to implement details of the variable  binding modifier:   is [x,y...] -> [?]&, used as a filter (i.e. not creating H any new variable bindings), returning a non-empty list if  x and y...& are in the appropriate relationship.  is [y...] -> [x]#, used to perform the calculation.  lbsE is a list of specific label values for which a variable binding & modifier will be generated. 'Note: an irrefutable pattern match for lbs is used so that a name  for the + value can be extracted using an undefined  label value. 789<Given a list of argument values and a list of functions for = calculating new values from supplied values, return a list  of argument values, or Nothing if the supplied values are 0 inconsistent with the calculations specified. AEach list of values returned corresponds to a set of values that = satisfy the relation, consistent with the values supplied. 0Functions are described as tuple consisting of: 9(a) a predicate that the argument is required to satisfy (b) a function to apply, <(c) a function to apply function (b) to a list of arguments A(d) argument list index values to which the function is applied. &Each supplied argument is of the form Maybe a, where the argument  has value type a. Nothing' indicates arguments of unknown value. DThe basic idea is that, for each argument position in the relation, 7 a function may be supplied to calculate that argument's possible values H from some combination of the other arguments. The results calculated A in this way are compared with the original arguments provided: = if the values conflict then the relation is presumed to be . unsatisfiable with the supplied values, and Nothing is returned; D if there are any calculated values for arguments supplied without 3 any values, then tbe calculated values are used. A If there are any arguments for which no values are supplied or C calculated, then the relation is presumed to be underdetermined,  and Just [] is returned.  fnss, is a list of argument value predicates and = function descriptors. The predicate indicates any E additional constraints on argument values (e.g. the result ) of abs must be positive). Use  (const True) for the predicate < associated with unconstrained relation arguments. ? For each argument, a list of function descriptors is F supplied corresponding to alternative values (e.g. a square E relation would offer two alternative values for the root.) apfn7 is a function that takes an argument value predicate, F a function descriptor and applies it to a supplied argument  list to return:  Just a: calculated list of one or more possible argument values,  Just []2 indicating insufficient information provided, or  Nothing/ indicating inconsistent information provided.  May be one of , ,  or , some other caller-supplied value. 0 The value used must match the type of fnss used.  Returns a ] vt value that can be used as the  [ component of a YX value. :;2 support for unary functions: function applicator 3 support for binary functions: function applicator ; support for binary function with provision for indicating 5 inconsistent supplied values: function applicator 2 support for list functions: function applicator E?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~Eklmnopsqrbcdefghijutv^_`aXYZ[]\PONMLKJIHGFEQRSTUWVwxyz{|}~?@ABCDE?@ABCD@ABCDEFGHIJKLMNOPQRSTURSTUVWXYZ[YZ[\]^_`a_`abcdefghijcdefghijkllmnopqrstuvwxyz{|}~H98 experimental Douglas Burke?mapXsdInteger contains functions that perform lexical-to-value A and value-to-canonical-lexical mappings for xsd:integer values <=H98 experimental Douglas Burke@Proof is a structure that presents a chain of rule applications 9 that yield a result expression from a given expression "Proof context: list of rulesets, & each of which provides a number of  axioms and rules. Given expression Result expression %Chain of inference rule applications $ progressing from input to result Step in proof chain EThe display name for a proof step comes from the display name of its  consequence formula. Inference rule used Antecedents of inference rule $Named consequence of inference rule >9Return a list of axioms from all the rulesets in a proof ?8Return a list of rules from all the rulesets in a proof @5Return list of axioms actually referenced by a proof "Check consistency of given proof. ; The supplied rules and axioms are assumed to be correct. A8Check proof, and return identification of failing step. BC4Create a displayable form of a proof, returned as a  value. EThis function is intended to allow the calling function some control & of multiline displays by providing: = the first line of the proof is not preceded by any text, so B it may be appended to some preceding text on the same line, > the supplied newline string is used to separate lines of the C formatted text, and may include any desired indentation, and 8 no newline is output following the final line of text. 3Returns a simple string representation of a proof. D<Create a displayable form of a list of labelled proof steps E4Create a displayable form of a labelled proof step. F,Return a string containing a list of names. G,Return a string representing a single name. **>FlexibleInstances, TypeSynonymInstances, MultiParamTypeClasses experimental Douglas Burke$8This instance of class label adds a graph identifier to 4 each variable label, so that variable labels from 7 different graphs are always seen as distinct values. =The essential logic added by this class instance is embodied A in the eq and hash functions. Note that variable label hashes B depend only on the graph in which they appear, and non-variable C label hashes depend only on the variable. Label hash values are A used when initializing a label equivalence-class map (and, for < non-variable labels, also for resolving hash collisions). 'Type for equivalence class description 7 (An equivalence class is a collection of labels with  the same LabelIndex value.) #Type for label->index lookup table ?LabelIndex is a unique value assigned to each label, such that ? labels with different values are definitely different values < in the graph; e.g. do not map to each other in the graph < bijection. The first member is a generation counter that 7 ensures new values are distinct from earlier passes. HI8Graph matching function accepting two lists of arcs and % returning a node map if successful 1a function that tests for additional constraints 4 that may prevent the matching of a supplied pair  of nodes. Returns J if the supplied nodes may be 6 matched. (Used in RDF graph matching for checking - that formula assignments are compatible.) 2the first graph to be compared, as a list of arcs 3the second graph to be compared, as a list of arcs If the first element is J( then the secondelement maps each label < to an equivalence class identifier, otherwise it is just  . "Recursive graph matching function EThis function assumes that no variable label appears in both graphs.  (Function ., which calls this, ensures that all variable  labels are distinct.) TODO: # replace Equivalence class pair by  (index,[lb],[lb]) ?  possible optimization: the K test should be  needed only if  has been used to guess a  mapping; either: 8 a) supply flag saying guess has been used, or  b) move test to  and use different = test to prevent rechecking for each guess used. J9 if a guess has been used before trying this comparison,  L2 if nodes are being matched without any guesswork >Test for additional constraints that may prevent the matching ( of a supplied pair of nodes. Returns J if the supplied  nodes may be matched. (gs1 argument) 7 first of two lists of arcs (triples) to be compared (gs2 argument) 8 secind of two lists of arcs (triples) to be compared =the map so far used to map label values to equivalence class  values (the ecpairs* argument) list of pairs of corresponding % equivalence classes of nodes from gs1 and gs2 that have not ? been confirmed in 1:1 correspondence with each other. Each B pair of equivalence classes contains nodes that must be placed * in 1:1 correspondence with each other.  the pair  (match, map) where match is True if the supplied . sets of arcs can be matched, in which case map is a C corresponding map from labels to equivalence class identifiers.  When match is False, map" is the most detailed equivalence @ class map obtained before a mismatch was detected or a guess ? was required -- this is intended to help identify where the  graph mismatch may be. "Auxiliary graph matching function AThis function is called when deterministic decomposition of node 2 mapping equivalence classes has run its course. KIt picks a pair of equivalence classes in ecpairs, and arbitrarily matches G pairs of nodes in those equivalence classes, recursively calling the F graph matching function until a suitable node mapping is discovered @ (success), or until all such pairs have been tried (failure). MThis function represents a point to which arbitrary choices are backtracked.  The list comprehension glp+ represents the alternative choices at the  point of backtracking PThe selected pair of nodes are placed in a new equivalence class based on their N original equivalence class value, but with a new NodeVal generation number. M5Returns a string representation of a LabelMap value LMap a label to its corresponding label index value in the supplied LabelMap N;Confirm that a given pair of labels are matchable, and are 5 mapped to the same value by the supplied label map IReplace selected values in a label map with new values from the supplied G list of labels and new label index values. The generation number is E supplied from the current label map. The generation number in the & resulting label map is incremented. 8Replace a label and its associated value in a label map A with a new value using the supplied hash value and the current  = generation number. If the key is not found, then no change  is made to the label map. +Increment the generation of the label map. 8Returns a new label map identical to the supplied value - but with an incremented generation number. 5Scan label list, assigning initial label map values, / adding new values to the label map supplied. 2Label map values are assigned on the basis of the $ label alone, without regard for it's connectivity in  the graph. (cf. ). 7All variable node labels are assigned the same initial 1 value, as they may be matched with each other. OPQ label map !list of nodes to be reclassified 9the equivalence classes of the supplied labels under the  supplied label map Reclassify labels GExamines the supplied label equivalence classes (based on the supplied E label map), and evaluates new equivalence subclasses based on node : values and adjacency (for variable nodes) and rehashing  (for non-variable nodes). <Note, assumes that all all equivalence classes supplied are 5 non-singletons; i.e. contain more than one label. (the gs1A argument) the first of two lists of arcs (triples) to perform a ? basis for reclassifying the labels in the first equivalence  class in each pair of ecpairs. (the gs2B argument) the second of two lists of arcs (triples) to perform a @ basis for reclassifying the labels in the second equivalence  class in each pair of the ecpairs argument 7the label map used for classification of the labels in $ the supplied equivalence classes (the ecpairsC argument) a list of pairs of corresponding equivalence classes of  nodes from gs1 and gs2 that have not been confirmed * in 1:1 correspondence with each other. The output tuple consists of: 71) a revised label map reflecting the reclassification 62) a new list of equivalence class pairs based on the  new node map 13) if the reclassification partitions any of the ' supplied equivalence classes then J, else L 94) if reclassification results in each equivalence class C being split same-sized equivalence classes in the two graphs,  then J , otherwise L. RGCalculate a new index value for a supplied list of labels based on the F supplied label map and adjacency calculations in the supplied graph 4arcs used for adjacency calculations when remapping the current label index values :the graph labels for which new mappings are to be created Athe updated label map containing recalculated label index values @ for the given graph labels. The label map generation number is  incremented by 1. /Return list of distinct labels used in a graph SMCalculate a signature value for each arc that can be used in constructing an R adjacency based value for a node. The adjacancy value for a label is obtained F by summing the signatures of all statements containing that label. the current label index values $calculate signatures for these arcs the signatures of the arcs T9Return a new graph that is supplied graph with every node/arc < mapped to a new value according to the supplied function. 8Used for testing for graph equivalence under a supplied  label mapping; e.g. K if ( graphMap nodeMap gs1 ) `equiv` ( graphMap nodeMap gs2 ) then (same) K?Compare a pair of graphs for equivalence under a given mapping  function. >This is used to perform the ultimate test that two graphs are # indeed equivalent: guesswork in  means that it is C occasionally possible to construct a node mapping that generates A the required singleton equivalence classes, but does not fully & reflect the topology of the graphs. @A@A>FlexibleInstances, MultiParamTypeClasses, TypeSynonymInstances experimental Douglas BurkeSMemory-based RDF graph type 1Memory-based graph with namespaces and subgraphs Graph formula entry UNamespace prefix list entry RDF Triple (statement) RDF graph node values cf.  7http://www.w3.org/TR/rdf-concepts/#section-Graph-syntax ;This is extended from the RDF abstract graph syntax in the  following ways: 9(a) a graph can be part of a resource node or blank node  (cf. Notation3 formulae) (b) a "variable"% node option is distinguished from a  blank node. 9 I have found this useful for encoding and handling < queries, even though query variables can be expressed  as blank nodes. (c) a "NoNode" option is defined. ) This might otherwise be handled by Maybe (RDFLabel g). 'no node (not used in ordinary graphs) 'variable (not used in ordinary graphs)  blank node  literal [type/language]  resource V(Get the canonical string for RDF label. :Used for hashing, so that equivalent labels always return  the same hash value. WBDefine equality of nodes possibly based on different graph types. IThe version of equality defined here is not strictly RDF abstract syntax D equality, but my interpretation of equivalence for the purposes of E entailment, in the absence of any specific datatype knowledge other  than XML literals. .Test if supplied labal is a URI resource node )Test if supplied labal is a literal node 2Test if supplied labal is an untyped literal node 2Test if supplied labal is an untyped literal node .Test if supplied labal is an XML literal node DTest if supplied label is an typed literal node of a given datatype :Test if supplied label is a container membership property )Check for namespace is RDF namespace and # first character of local name is '_' and 4 remaining characters of local name are all digits 'Test if supplied labal is a blank node +Test if supplied labal is a query variable 'Extract text value from a literal node .Extract ScopedName value from a resource node 2Make a blank node from a supplied query variable, * or return the supplied label unchanged. 7 (Use this in when substituting an existential for an ! unsubstituted query variable.) XYZ[\]^_=Merge RDF graphs, renaming blank and query variable nodes as @ needed to neep variable nodes from the two graphs distinct in  the resulting graph. >Return list of all labels (including properties) in the graph * satisfying a supplied filter predicate. 5Return list of all subjects and objects in the graph * satisfying a supplied filter predicate. `AList all nodes in graph formulae satisfying a supplied predicate aBHelper to filter variable nodes and merge with those found so far Remap selected nodes in graph: ?This is the node renaming operation that prevents graph-scoped ? variable nodes from being merged when two graphs are merged. variable nodes to be renamed (dupbn) *variable nodes used that must be avoided (allbn) 2node conversion function that is applied to nodes  from dupbn) in the graph that are to be replaced by 6 new blank nodes. If no such conversion is required,  supply id. The function  can be used to convert ' RDF query nodes into RDF blank nodes. 'graph in which nodes are to be renamed >Externally callable function to construct a list of (old,new) / values to be used for graph label remapping. labels to be remaped &labels to be avoided by the remapping Remap a single graph node. 0If the node is not one of those to be remapped, , the supplied value is returned unchanged. <Construct a list of (oldnode,newnode) values to be used for E graph label remapping. The function operates recursiovely, adding 0 new nodes generated to the mapping list (mapbn') and also to the $ list of nodes to be avoided (allbn'). ?Given a node and a list of existing nodes, find a new node for @ the supplied node that does not clash with any existing node. C (Generates an non-terminating list of possible replacements, and  picks the first one that isn't already in use.) $TODO: optimize this for common case nnn and _nnn:  always generate _nnn" and keep track of last allocated BGiven a node and a list of existing nodes, generate a list of new H nodes for the supplied node that do not clash with any existing node. bcd4Create a new RDF graph from a supplied list of arcs Create a new, empty RDF graph. \9:;<=>?@ABCDEFGHIJKLMOPQR\DEFGHIJKLM?@ABC:;<=>ROPQ9CH98 experimental Douglas BurkeRDFVarBindingFilter) is a function type that tests to see if ; a query binding satisfies some criterion, and is used to 8 create a variable binding modifier that simply filers  given variable bindings. =Queries often want to apply some kind of filter or condition D to the variable bindings that are processed. In inference rules, E it sometimes seems desirable to stipulate additional conditions on  the things that are matched. 2This function type is used to perform such tests. 3 A number of simple implementations are included. ;Define type for lookup map of open query binding modifiers @Open variable binding modifier that operates on RDFLabel values >Define type of query binding modifier for RDF graph inference  RDFVarBinding) is the specific type type of a variable . binding value used with RDF graph queries. maps no query variables. <This function generates a query binding filter that ensures 5 an indicated variable is bound to a URI reference. <This function generates a query binding filter that ensures 2 an indicated variable is bound to a blank node. <This function generates a query binding filter that ensures 5 an indicated variable is bound to a literal value. <This function generates a query binding filter that ensures > an indicated variable is bound to an untyped literal value. <This function generates a query binding filter that ensures ; an indicated variable is bound to a typed literal value. <This function generates a query binding filter that ensures : an indicated variable is bound to an XML literal value. <This function generates a query binding filter that ensures C an indicated variable is bound to container membership property. <This function generates a query binding filter that ensures ; an indicated variable is bound to a literal value with a . datatype whose URI is bound to another node *variable bound to the required datatype. 1variable bound to the literal node to be tested. eH98 experimental Douglas Burkef7Type of query node testing function. Return value is:  Nothing if no match   Just True% if match with new variable binding   Just False$ if match with new variable binding Basic graph-query function. 4A very basic form of graph query, a query graph and ( a target graph, and returns a list of  9 values, each of which corresponds to a set of variable 7 bindings that make the query graph a subgraph of the  target graph, or []! if the query cannot be matched. 8The triples of the query graph are matched sequentially 7 against the target graph, each taking account of any 7 variable bindings that have already been determined, 9 and adding new variable bindings as triples containing 1 query variables are matched against the graph. ghRDF query filter. /This function applies a supplied query binding & filter to the result from a call of . ?If none of the query bindings found satisfy the filter, a null " list is returned (which is what  returns if the  query cannot be satisfied). <(Because of lazy evaluation, this should be as efficient as B applying the filter as the search proceeds. I started to build C the filter logic into the query function itself, with consequent B increase in complexity, until I remembered lazy evaluation lets  me keep things separate.) Reverse graph-query function.  Similar to ', but with different success criteria. 9 The query graph is matched against the supplied graph, ? but not every triple of the query is required to be matched. < Rather, every triple of the target graph must be matched, : and substitutions for just the variables thus bound are < returned. In effect, these are subsitutions in the query & that entail the target graph (where  rdfQueryFind returns 8 substitutions that are entailed by the target graph). ;Multiple substitutions may be used together, so the result = returned is a list of lists of query bindings. Each inner C list contains several variable bindings that must all be applied C separately to the closure antecendents to obtain a collection of ; expressions that together are antecedent to the supplied : conclusion. A null list of bindings returned means the 6 conclusion can be inferred without any antecedents. ?Note: in back-chaining, the conditions required to prove each D target triple are derived independently, using the inference rule > for each such triple, so there are no requirements to check ? consistency with previously determined variable bindings, as C there are when doing forward chaining. A result of this is that @ there may be redundant triples generated by the back-chaining A process. Any process using back-chaining should deal with the  results returned accordingly. 5An empty outer list is returned if no combination of / substitutions can infer the supplied target. ijBRDF back-chaining query filter. This function applies a supplied 4 query binding filter to the result from a call of . CEach inner list contains bindings that must all be used to satisfy D the backchain query, so if any query binding does not satisfy the 2 filter, the entire corresponding row is removed DRDF back-chaining query modifier. This function applies a supplied 6 query binding modifier to the result from a call of . CEach inner list contains bindings that must all be used to satisfy E a backchaining query, so if any query binding does not satisfy the 2 filter, the entire corresponding row is removed k*Simple entailment (instance) graph query. 7This function queries a graph to find instances of the 7 query graph in the target graph. It is very similar ' to the normal forward chaining query , ; except that blank nodes rather than query variable nodes = in the query graph are matched against nodes in the target 8 graph. Neither graph should contain query variables. ;An instance is defined by the RDF semantics specification,  per  http://www.w3.org/TR/rdf-mt/, and is obtained by replacing = blank nodes with URIs, literals or other blank nodes. RDF = simple entailment can be determined in terms of instances. > This function looks for a subgraph of the target graph that > is an instance of the query graph, which is a necessary and A sufficient condition for RDF entailment (see the Interpolation ( Lemma in RDF Semantics, section 1.2). :It is anticipated that this query function can be used in ; conjunction with backward chaining to determine when the < search for sufficient antecendents to determine some goal  has been concluded. lmnGraph substitution function. ?Uses the supplied variable bindings to substitute variables in D a supplied graph, returning a list of result graphs corresponding ? to each set of variable bindings applied to the input graph. A This function is used for formward chaining substitutions, and A returns only those result graphs for which all query variables  are bound. "Graph back-substitution function. )Uses the supplied variable bindings from  to perform D a series of variable substitutions in a supplied graph, returning I a list of lists of result graphs corresponding to each set of variable ( bindings applied to the input graphs. CThe outer list of the result contains alternative antecedent lists E that satisfy the query goal. Each inner list contains graphs that 2 must all be inferred to satisfy the query goal. Graph substitution function. ?This function performs the substitutions and returns a list of C result graphs each paired with a list unbound variables in each. Graph substitution function. 4This function performs each of the substitutions in vars, and > replaces any nodes corresponding to unbound query variables  with new blank nodes.  CGraph back-substitution function, replacing variables with bnodes. )Uses the supplied variable bindings from  to perform D a series of variable substitutions in a supplied graph, returning I a list of lists of result graphs corresponding to each set of variable ( bindings applied to the input graphs. CThe outer list of the result contains alternative antecedent lists E that satisfy the query goal. Each inner list contains graphs that 2 must all be inferred to satisfy the query goal.  op CrdfFindArcs is the main function here: it takes a predicate on an E RDF statement and a graph, and returns all statements in the graph  satisfying that predicate. &Use combinations of these as follows: ) find all statements with given subject:  rdfQuerySimple (rdfSubjEq s) * find all statements with given property:  rdfQuerySimple (rdfPredEq p) ( find all statements with given object:  rdfQuerySimple (rdfObjEq o) ? find all statements matching conjunction of these conditions:  rdfQuerySimple (| [...]) ? find all statements matching disjunction of these conditions:  rdfQuerySimple (} [...]) $Custom predicates can also be used.  $Test if statement has given subject  &Test if statement has given predicate #Test if statement has given object 3Find values of given predicate for a given subject =Find integer values of a given predicate for a given subject GFind all subjects that have a of given value for for a given predicate >Return a list of nodes that comprise an rdf:collection value, < given the head element of the collection. If the list is 4 ill-formed then some arbitrary value is returned.                ZDeriveFunctor, DeriveFoldable, DeriveTraversable, FlexibleInstances, MultiParamTypeClasses experimental Douglas Burke (Minimal graph label value - for testing Memory-based graph type qrReturn Boolean graph equality BGraphMem matching function accepting GraphMem value and returning  node map if successful if the first element is True" then the second value is a label @ map that maps each label to an equivalence-class identifier,  otherwise . @AEFGHIJEFHIGJ@AH98 experimental Douglas Burkestuvwxyz{|}~H98 experimental Douglas Burke #Type for special name lookup table  .The language definition for N3-style formats. !"The lexer for N3 style languages. ")Lookup prefix in table and return URI or  'prefix:' ##Define default table of namespaces $"Define default special-URI table. 4The optional argument defines the initial base URI. %&FAnnotate a Parsec error with the local context - i.e. the actual text % that caused the error and preceeding/ succeeding lines (if available) 5the number of extra lines to include in the context (<=0 is ignored) text being parsed the parse error %Parsec error with additional context 'Create a typed literal.  the type  the value  !"#$%&' "#$ !%&'  !"#$%&'H98 experimental Douglas Burke"()NT parser state *+,Parse a string. input in NTriples format. -<Function to supply initial context and parse supplied term. .We augment the Parsec error with the context. parser to apply input to be parsed ./0123456789:;<=()*+,-./0123456789:;<=,-()*+./012=3456789:;<()*+*+,-./0123456789:;<=H98 experimental Douglas BurkeU>AGiven a set of statements and a label, return the details of the 1RDF collection referred to by label, or Nothing. GFor label to be considered as representing a collection we require the :following conditions to hold (this is only to support the serialisation using the '(..)'( syntax and does not make any statement Cabout semantics of the statements with regard to RDF Collections): 8 there must be one rdf_first and one rdf_rest statement 4 - there must be no other predicates for the label  statements organized by subject "does this label represent a list? .the statements with the elements removed; the B content elements of the collection (the objects of the rdf:first : predicate) and the nodes that represent the spine of the G collection (in reverse order, unlike the actual contents which are in  order). 2Removes the first occurrence of the item from the association list, returning it's contents and the rest of the list, if it exists. ?@ABC/Format graph and return additional information >?@ABC>?@ABC>?@ABC*TypeSynonymInstances experimental Douglas BurkeH98 experimental Douglas BurkeqDEN3 parser state FGHIJKLMNOPQRAFunctions to update N3State vector (use with Parsec updateState) $Set name for special syntax element ESet the list of tokens that can be used without needing the leading  @ symbol. 2Get name for special syntax element, default null S.Parse a string as N3 (with no real base URI). See T$ if you need to provide a base URI. input in N3 format. T*Parse a string with an optional base URI.  See also S. input in N3 format. optional base URI U<Function to supply initial context and parse supplied term. .We augment the Parsec error with the context. parser to apply base URI of the input, or Nothing to use default base value input to be parsed VWXYZ[\]^5Update the set of keywords that can be given without an @ sign. _` a   b c !"#$%&'()*+,-#DEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abc#TSUWXYZ[\]DEFGHIJKLMNOPQR`b^a_cV DEFGHIJKLMFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcH98 experimental Douglas Burked/Datatype for constructing a graph closure rule efName of rule for proof display gAntecedent triples pattern  (may include variable nodes) hConsequent triples pattern  (may include variable nodes) i"Structure that defines additional  constraints and/ or variable # bindings based on other matched " query variables. Matching the  antecedents. Use  if & no additional variable constraints & or bindings are added beyond those  arising from graph queries. jklmnopq:Define a value of type Rule based on an RDFClosure value. rs./01t7Helper function to parse a string containing Notation3 / and return the corresponding RDFGraph value. uCreate an RDF formula.  local name graph in Notation 3 format v<Constructs an RDF graph closure rule. That is, a rule that A given some set of antecedent statements returns new statements " that may be added to the graph. scoped name for the new rule /RDFGraphs that are the entecedent of the rule. ;(Note: bnodes and variable names are assumed to be shared ) by all the entecedent graphs supplied. is this right?) the consequent graph 5is a variable binding modifier value that may impose > additional conditions on the variable bindings that < can be used for this inference rule, or which may B cause new values to be allocated for unbound variables. ? These modifiers allow for certain inference patterns * that are not captured by simple  closure rules, such A as the allocation of bnodes corresponding to literals, A and are an extension point for incorporating datatypes % into an inference process. 6If no additional constraints or variable bindings are # to be applied, use value  w<Constructs an RDF graph closure rule. That is, a rule that A given some set of antecedent statements returns new statements 9 that may be added to the graph. This is the basis for = implementation of most of the inference rules given in the ! RDF formal semantics document. 6scope is a namespace to which the rule is allocated > local is a local name for the rule in the given namespace " ant is a string containing " con is a string containing )namespace to which the rule is allocated )local name for the rule in the namespace the Notation3 representation 9 of the antecedent graph. (Note: multiple antecedents 1 can be handled by combining multiple graphs.) 6the Notation3 representation of the consequent graph. 2a variable binding modifier value that may impose 7 additional conditions on the variable bindings that 5 can be used for this inference rule, or which may ; cause new values to be allocated for unbound variables. 8 These modifiers allow for certain inference patterns 7 that are not captured by simple closure rules, such : as the allocation of bnodes corresponding to literals, : and are an extension point for incorporating datatypes  into an inference process. 6If no additional constraints or variable bindings are  to be applied, use value  x2Construct a simple RDF graph closure rule without ? additional node allocations or variable binding constraints. y7Constructs an RDF graph closure rule that incorporates = a variable binding filter and a variable binding modifier. )namespace to which the rule is allocated /local name for the rule in the given namespace the Notation3 representation C of the antecedent graph. (Note: multiple antecedents ; can be handled by combining multiple graphs.) 6the Notation3 representation of the consequent graph. 2a variable binding modifier value that may impose 7 additional conditions on the variable bindings that ( can be used for this inference rule (vflt). 5These modifiers allow for certain inference patterns 7 that are not captured by simple closure rules, such 7 as deductions that pertain only to certain kinds of  nodes in a graph. 3a variable binding modifier that is applied to the 8 variable bindings obtained, typically to create some 9 additional variable bindings. This is applied before  the preceeding filter rule (vflt). z<Construct an RDF graph closure rule with a bnode allocator. This function is rather like y, except that D the variable binding modifier is a function from the variables in > the variables and bnodes contained in the antecedent graph. scope is a  local is a " ant is a string containing " con is a string containing  vflt is a  aloc is a )namespace to which the rule is allocated /local name for the rule in the given namespace the Notation3 representation C of the antecedent graph. (Note: multiple antecedents ; can be handled by combining multiple graphs.) 6the Notation3 representation of the consequent graph. 0variable binding modifier value that may impose 7 additional conditions on the variable bindings that ( can be used for this inference rule (vflt). /function applied to a list of nodes to yield a $ variable binding modifier value. 6The supplied parameter is applied to a list of all of 9 the variable nodes (including all blank nodes) in the 0 antecedent graph, and then composed with the vflt + value. This allows any node allocation 5 function to avoid allocating any blank nodes that - are already used in the antecedent graph.  (See {). {7This function defines a variable binding mofifier that 5 allocates a new blank node for each value bound to 5 a query variable, and binds it to another variable  in each query binding. >This provides a single binding for query variables that would > otherwise be unbound by a query. For example, consider the  inference pattern:  9 ?a hasUncle ?c => ?a hasFather ?b . ?b hasBrother ?c .  For a given ?a and ?c$, there is insufficient information + here to instantiate a value for variable ?b. Using this ; function as part of a graph instance closure rule allows 7 forward chaining to allocate a single bnode for each  occurrence of ?a, so that given:   Jimmy hasUncle Fred .  Jimmy hasUncle Bob . )leads to exactly one bnode inference of:   Jimmy hasFather _:f . giving:   Jimmy hasFather _:f .  _:f hasBrother Fred .  _:f hasBrother Bob .  rather than:   Jimmy hasFather _:f1 .  _:f1 hasBrother Fred .  Jimmy hasFather _:f2 .  _:f2 hasBrother Bob . CThis form of constrained allocation of bnodes is also required for H some of the inference patterns described by the RDF formal semantics, H particularly those where bnodes are substituted for URIs or literals. 1variable node to which a new blank node is bound 1variable which is bound in each query to a graph / node to which new blank nodes are allocated. 2defghijklmnopqrstuvwxyz{onmlkjpdefghiqtuvwxyz{rsdefghiefghijklmnopqrstuvwxyz{'FlexibleInstances, UndecidableInstances experimental Douglas Burke|}~Make an RDF graph proof step rule to use for this step &antecedent RDF formulae for this step 2RDF formula that is the consequent for this step Make an RDF proof <RDF rulesets that constitute a proof context for this proof >initial statement from which the goal is claimed to be proven 'statement that is claimed to be proven =Make an inference rule dealing with RDF instance entailment; C i.e. entailments that are due to replacement of a URI or literal  node with a blank node. /The part of this rule expected to be useful is  .  The  and # functions defined here may return C rather large results if applied to graphs with many variables or ; a large vocabulary, and are defined for experimentation. =Forward and backward chaining is performed with respect to a D specified vocabulary. In the case of backward chaining, it would ? otherwise be impossible to bound the options thus generated. @ In the case of forward chaining, it is often not desirable to D have the properties generalized. If forward or backward backward 9 chaining will not be used, supply an empty vocabulary.  Note: graph method allNodes% can be used to obtain a list of all A the subjects and objuects used ina graph, not counting nested % formulae; use a call of the form: $ allNodes (not . labelIsVar) graph 345=Make an inference rule dealing with RDF subgraph entailment. 1 The part of this rule expected to be useful is  .  The / function defined here may return rather large @ results. But in the name of completeness and experimentation B with the possibilities of lazy evaluation, it has been defined. BBackward chaining is not performed, as there is no reasonable way 6 to choose a meaningful supergraph of that supplied. 67;Make an inference rule dealing with RDF simple entailment. 1 The part of this rule expected to be useful is  .  The  and  functions defined return null @ results, indicating that they are not useful for the purposes  of proof discovery. 89 Instances of D are also instance of the   Expression- class, for which proofs can be constructed.  The empty RDF graph is always True (other enduring " truths are asserted as axioms). |}~}|~|}~H98 experimental Douglas Burke-RDF value modifier application function type @This indicates a function that applies RDFModifierFn functions. !RDF value modifier function type 4This indicates a modifier function that operates on  values. Describe a subtype/&supertype relationship between a pair  of RDF datatypes. 1RDF datatype modifier used with RDF graph values .RDF datatype value used with RDF graph values 0RDF datatype wrapper used with RDF graph values  Create an  value. 9The key purpose of this function is to lift the supplied G variable constraint functions from operating on data values directly H to a corresponding list of functions that operate on values contained A in RDF graph labels (i.e. RDF literal nodes). It also applies D node type checking, such that if the actual RDF nodes supplied do B not contain appropriate values then the variable binding is not  accepted. is an * value containing details of the datatype 5 for which a variable binding modifier is created. ?is the data value modifier value that defines the calculations ; that are used to implement a variable binding modifier. FCreate all RDFOpenVarBindingModify values for a given datatype value.  See . is an * value containing details of the datatype 6 for which variable binding modifiers are created. BApply a datatype modifier using supplied RDF labels to a supplied  RDF variable binding. :DGiven details of a datatype and a single value constraint function, 4 return a new constraint function that operates on  values. GThe returned constraint function incorporates checks for appropriately B typed literal nodes, and returns similarly typed literal nodes. ;Extract datatyped value from  value, or return Nothing. <BReturn new RDF literal node with a representation of the supplied  value, or Nothing.     MultiParamTypeClasses experimental Douglas Burke%Datatype for named class restriction 9Type of function that evaluates missing node values in a # restriction from those supplied. 3Make a class restriction from a datatype relation. ;This lifts application of the datatype relation to operate  on 5 values, which are presumed to contain appropriately  datatyped values. EMake a class restriction function from a datatype relation function. =IMake a list of class restriction rules given a list of class restriction K values and a graph containing one or more class restriction definitions. >?@ABCDEFGHIJ!Delete a Maybe value from a list    !H98 experimental Douglas BurkeKType name for  xsd:string datatype Namespace for  xsd:string datatype functions LDefine Datatype value for  xsd:string. M>mapXsdString contains functions that perform lexical-to-value . and value-to-canonical-lexical mappings for  xsd:string values These are identity mappings. N+relXsdString contains useful relations for  xsd:string values. OPQRST5modXsdString contains variable binding modifiers for  xsd:string values. UVWXArulesetXsdString contains rules and axioms that allow additional 7 deductions when xsd:string values appear in a graph. 'makeRuleset :: Namespace -> [Formula ex] -> [Rule ex] -> Ruleset ex YZ[\]^_`a"H98 experimental Douglas Burke1b#Type name for xsd:integer datatype -Namespace for xsd:integer datatype functions cde&Define Datatype value for xsd:integer D Members of this datatype are positive or negative integer values. 'The lexical form consists of an option + or - , followed by a sequence of decimal digits. 1The canonical lexical form has leading zeros and + sign removed. fNrelXsdInteger contains arithmetic and other relations for xsd:Integer values. HThe functions are inspired by those defined by CWM as math: properties.  (cf. http: www.w3.org200010swapdoc/CwmBuiltins.html) ghijklmnopqrstuvwxyJmodXsdInteger contains variable binding modifiers for xsd:Integer values. >The functions are selected from those defined by CWM as math:  properties.  (cf. http: www.w3.org200010swapdoc/CwmBuiltins.html) z{|}~BrulesetXsdInteger contains rules and axioms that allow additional 8 deductions when xsd:integer values appear in a graph. CThe rules defined here are concerned with basic integer arithmetic  operations: +, -, *, div, rem 'makeRuleset :: Namespace -> [Formula ex] -> [Rule ex] -> Ruleset ex #H98 experimental Douglas Burke$H98 experimental Douglas Burkel%H98 experimental Douglas Burke>List of rdfOpenVarBindingModify values for predefined filters +H98 experimental Douglas Burke&(FlexibleInstances, MultiParamTypeClasses experimental Douglas Burke0/The graphs dictionary contains named graphs and/ or lists < of graphs that are created and used by script statements. Status of the processor error executing a Swish script command-line argument error data access error input data problem (ie format/syntax) graphs do not compare successful run The State for a Swish "program". format to use for I/O "base to use rather than file name current graph script processor named graphs script processor named rules script processor rulesets  information message, or Nothing error message, or Nothing current status message (The supported input and output formats. NTriples format  N3 format &Report error and set exit status code )Output text to the standard error stream 6Each string in the supplied list is a line of text to  be displayed. 000 'H98 experimental Douglas BurkeB"Parser for Swish script processor      AReturn a message to the user. At present the message begins with '# '  but this may be removed. message contents label for the message message contents  !"#$%&'()*+,-./0123456789(H98 experimental Douglas Burke:;<=>?@A9Calculate the base URI to use; it combines the file name with any user-supplied base. 9If both the file name and user-supplied base are Nothing then the value http:id.ninebynine.org2003Swish/  is used. Needs some work. B file name  base URI CDEFGHI=Open a file (or stdin), read its contents, and process them. 1Convert filename and contents into desired value 0the value to use if the file can not be read in the file name or stdin if Nothing JAOpen and read file, returning its handle and content, or Nothing H WARNING: the handle must not be closed until input is fully evaluated KLfilename (if not stdin) contents of file M,given a file name and a handle, write to it N8Open file for writing, returning its handle, or Nothing 8 Also returned is a flag indicating whether or not the < handled should be closed when writing is done (if writing = to standard output, the handle should not be closed as the * run-time system should deal with that). )H98 experimental Douglas Burke 9Represent an Swish action, with an optional argument and , the Swish routine to act on that argument. 9At present this type is a black box to external modules. OPWrite out the help for Swish SReturn any arguments that need processing immediately, namely  the "help", "quiet" and "version" options. QBGiven a list of command-line arguments create the list of actions D to perform or a string and status value indicating an input error. RS"Execute the given set of actions. TExecute an action. U:Parse and run the given string as if given at the command  line. The "quiet", "version" and "help" options are  ignored. "Execute the given set of actions.  V,-./01223456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVVWXYZ[\]^_`abcdefghhijklmnopqrstuvwxyz{|}~s                                     !!"#$%&&'()*+,-./0123456789:;<=>?@@ABCDEEFGHIJKLMNOPQRSSTUVWXYZ[\]^_`aabcdefghijklmnopqrrstuvwxxyz{|}}~EE      !"#$%&'()**+,-./0123456789:;<<=>?@ABCDEFGHIJKLMNO-P./QRSTT=UVWXYZ[\]^_`abcdefghijklmnopqqrstuvwxyz{|}~           !!!!!!!"""""""##$$$%%%%&&&&&&&&&&&&&&&&&,&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&'(((((((()))))),,      !,"# $ % & ' (,)*,)+,,- . / 0 1 2 3,)456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYVWZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~dX7d     GMI !"#$%&'()*+,-./01 2 3 4 5 6 7 8 9 : ; < = > ?!@!A!B!C!D!E!F!G!H!I!J!K!L!M!N!O!P!Q!R!S!T!U!V"W"A"X"Y"Z"["\"]"^"_"`"a"b"c"d"E"F"e"f"g"h"i"j"k"l"m"n"o"p"q"r"s"t"u"v"w"x"y"z"N"O"{$|$}$~$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$%%%%''''''''''''''''''''D''''''''''''''' ' ' ' ' ''''''''''''''''''' '!'"'#'$'%'&''((()(*(+(,(-(.(/(0(((1(2(3(4(5(6(7(8(9(:));)<)=)>)?)@A swish-0.3.0.2Swish.Utils.TraceHelpersSwish.RDF.N3ParserSwish.Utils.DateTimeSwish.Utils.ShowMSwish.Utils.QNameSwish.Utils.MiscHelpersSwish.RDF.GraphClassSwish.RDF.GraphPartitionSwish.Utils.ListHelpers!Swish.Utils.PartOrderedCollectionSwish.Utils.LookupMapSwish.Utils.NamespaceSwish.RDF.VocabularySwish.RDF.VarBindingSwish.RDF.RuleSwish.RDF.RulesetSwish.RDF.DatatypeSwish.RDF.MapXsdIntegerSwish.RDF.ProofSwish.RDF.GraphMatchSwish.RDF.RDFGraphSwish.RDF.RDFVarBindingSwish.RDF.RDFQuerySwish.RDF.GraphMemSwish.RDF.NTFormatterSwish.RDF.RDFParserSwish.RDF.NTParserSwish.RDF.N3FormatterSwish.RDF.RDFRulesetSwish.RDF.RDFProofSwish.RDF.RDFDatatypeSwish.RDF.ClassRestrictionRuleSwish.RDF.RDFDatatypeXsdStringSwish.RDF.RDFDatatypeXsdIntegerSwish.RDF.BuiltInDatatypesSwish.RDF.RDFProofContextSwish.RDF.BuiltInRulesSwish.RDF.SwishMonadSwish.RDF.SwishScriptSwish.RDF.SwishCommandsSwish.RDF.SwishMainSwish.RDF.RDFGraphShowMSwish.RDF.BuiltInMapbase Debug.Tracetraceparsec-2.1.0.1(Text.ParserCombinators.Parsec.CombinatoreofDateTimeleapYear daysInMonthvalidJulianDate toJulianDate1 toJulianDatefromJulianDatedatetimedtYeardtMonthdtDaydtHourdtMinutedtSecond dtMillisecs dtTimezonelenFixshowTZ showTZabsshowTimeshowDatedtShow carryMins carryHoursnormTZ addMilliSecs addSeconds addMinutesaddHoursaddDayssimpleEqsimpleLTShowMshowmsshowmQNameqnNsuriqnLocalnewQName qnameFromPair qnameFromURI getNamespace getLocalName getQNameURIsplitURIqnameFromFilePathassertlowerstricmpquote hashModulushashSelectorArcasubjapredaobjLabel labelIsVar labelHashgetLocal makeLabelLDGraphsetArcsgetArcsextractadddeletelabelsnodes containedInupdate replaceArcsarcSubjarcPredarcObjarc arcToTriple arcFromTriplehasLabel arcLabelsGraphPartitionPartSubPartObjPartitionedGraph getPartitionsnodetoArcspartitionShowPpartitionGraphcomparePartitions traceShowselectmapset deleteIndexsubsetequiv hasPartitions addSetElem headOrNothing pairUngroup pairsUngrouppairSort pairGroupbreakAllpowerSet combinations permutations listProductpowerSequencespowerSequences_lenpowerSequences_infflistffoldallfanyfallpanyp PartComparemaximaminima partCompareEqpartCompareOrdpartComparePairpartCompareListPartOrdpartCompareListOrdpartCompareMaybepartCompareListMaybepartCompareListSubset LookupMapLookupEntryClassnewEntrykeyValentryKeyentryValentryEq entryShowkmapvmapemptyLookupMap makeLookupMap listLookupMapreverseLookupMapkeyOrdermapFind mapFindMaybe mapContains mapReplacemapReplaceOrAdd mapReplaceAll mapReplaceMapmapAdd mapAddIfNew mapDelete mapDeleteAll mapApplyToAll mapTranslatemapEqmapKeysmapVals mapSelectmapMerge mapSortByKey mapSortByValmapTranslateKeysmapTranslateValsmapTranslateEntriesmapTranslateEntriesM ScopedNamesnScopesnLocal NamespacensPrefixnsURImakeNamespaceQName nullNamespacegetScopePrefix getScopeURIgetQNamegetScopedNameURI matchNamemakeScopedNamemakeQNameScopedNamemakeUriScopedNamenullScopedName namespaceNull namespaceRDF namespaceRDFS namespaceRDFD namespaceOWL namespaceXSDnamespaceXsdType namespaceMATH namespaceLOG namespaceDAMLnamespaceDefaultnamespaceSwish swishName namespaceLanglangNamelangTagisLangscopeRDF scopeRDFS scopeRDFD rdf_datatype rdf_resource rdf_aboutrdf_IDrdf_type rdf_firstrdf_restrdf_nilrdf_XMLLiteral rdfs_memberrdfd_GeneralRestrictionrdfd_onPropertiesrdfd_constraintrdfd_maxCardinalityxsd_type xsd_string xsd_boolean xsd_decimal xsd_integerxsd_nonneg_integerxsd_nonpos_integerxsd_pos_integerxsd_neg_integer xsd_float xsd_double owl_sameAs log_implies default_baseVarBindingFiltervbfNamevbfVocabvbfTestOpenVarBindingModifyVarBindingModifyvbmNamevbmApplyvbmVocabvbmUsage VarBindingvbMapvbEnumvbNullnullVarBinding boundVars subBindingmakeVarBindingapplyVarBindingjoinVarBindings addVarBindingvbmCompatibility vbmComposefindCompositionscomposeSequencefindComposition varBindingIdnullVarBindingModifymakeVarFilterModifymakeVarTestFiltermakeVarCompareFilter varFilterEQ varFilterNEvarFilterDisjunctionvarFilterConjunctionRuleMapRuleruleNamefwdApplybwdApplycheckInferenceFormulaformNameformExpr ExpressionisValid nullScope nullFormula showsFormulae showsFormulafwdCheckInferencebwdCheckInferencenullRule showsWidth RulesetMapRuleset rsNamespacersAxiomsrsRules makeRulesetgetRulesetNamespacegetRulesetAxiomsgetRulesetRulesgetRulesetAxiomgetRulesetRulegetContextAxiomgetMaybeContextAxiomgetContextRulegetMaybeContextRule DatatypeSubtrelSuptrelSub trelToSup trelToSub ListFnApply ListFnTable ListFnDescrBinMaybeFnApplyBinMaybeFnTableBinMaybeFnDescr BinaryFnApply BinaryFnTable BinaryFnDescr UnaryFnApply UnaryFnTable UnaryFnDescr DatatypeModdmNamedmModfdmAppf ApplyModifier ModifierFn DatatypeRel dtRelName dtRelFunc DatatypeRelPr DatatypeRelFn DatatypeMapmapL2VmapV2L DatatypeValtvalName tvalRules tvalMkRules tvalMkModstvalMaptvalReltvalModDatatypetypeName typeRules typeMkRulestypeMkModifiers getTypeAxiom getTypeRuletypeMkCanonicalFormgetDTRelgetDTModtvalMkCanonicalFormnullDatatypeModmakeVmod_1_1_inv makeVmod_1_1makeVmod_2_1_inv makeVmod_2_1 makeVmod_2_0 makeVmod_2_2 makeVmod_N_1altArgs unaryFnApp binaryFnApp binMaybeFnApp listFnApp mapXsdIntegerProof proofContext proofInput proofResult proofChainStepstepRulestepAntstepCon checkProof checkStep explainProof showsProof showProof ScopedLabelEquivalenceClassLabelMap GenLabelMap LabelEntry GenLabelEntry LabelIndex nullLabelValemptyMapmakeScopedLabel makeScopedArc graphMatch graphMatch1 graphMatch2 mapLabelIndex newLabelMap setLabelHashnewGenerationMapassignLabelMapequivalenceClasses reclassify graphLabelsRDFGraphNSGraph namespacesformulae statements FormulaMap LookupFormula formLabel formGraphRevNamespaceMap RevNamespace NamespaceMap RDFTripleRDFLabelNoNodeVarBlankLitRes res_rdf_type res_rdf_first res_rdf_rest res_rdf_nilres_rdfs_memberres_rdfd_GeneralRestrictionres_rdfd_onPropertiesres_rdfd_constraintres_rdfd_maxCardinalityres_owl_sameAsres_log_impliesisUri isLiteralisUntypedLiteralisTypedLiteral isXMLLiteral isDatatyped isMemberPropisBlank isQueryVargetLiteralText getScopedName makeBlankemptyNamespaceMapemptyFormulaMap getNamespaces setNamespaces getFormulae setFormulae getFormula setFormulaaddArcgrEq grMatchMapmerge allLabelsallNodes remapLabelsremapLabelListmapnodemaplistnewNodenewNodes toRDFGraph emptyRDFGraphRDFVarBindingFilterRDFOpenVarBindingModifyMapRDFOpenVarBindingModifyRDFVarBindingModify RDFVarBindingnullRDFVarBindingrdfVarBindingUriRefrdfVarBindingBlankrdfVarBindingLiteralrdfVarBindingUntypedLiteralrdfVarBindingTypedLiteralrdfVarBindingXMLLiteralrdfVarBindingMemberProprdfVarBindingDatatyped rdfQueryFindrdfQueryFilter rdfQueryBackrdfQueryBackFilterrdfQueryBackModifyrdfQueryInstance rdfQuerySubsrdfQueryBackSubsrdfQuerySubsAllrdfQuerySubsBlankrdfQueryBackSubsBlank rdfQuerySubs2 rdfFindArcs rdfSubjEq rdfPredEqrdfObjEqrdfFindPredValrdfFindPredIntrdfFindValSubj rdfFindListLabelMemLVLFGraphMemarcs matchGraphMemNodeGenLookupMapformatGraphAsStringformatGraphAsShowS ParseResult RDFParser SpecialMapn3Stylen3Lexer mapPrefix prefixTable specialTableignoreannotateParsecError mkTypedLitNTParserNTState graphStateparseNTparsefromString ntripleDoclinewscommenteolnnametriplesubject predicateobjecturiref urirefLblnodeIDliterallanguage characterformatGraphAsStringNlformatGraphIndentformatGraphDiagN3ParserN3StatethisNode prefixUris syntaxUrisnodeGen keywordsListallowLocalNames whiteSpacesymbollexeme identStart identLetterparseN3fromStringparseN3parseAnyfromString newBlankNodeparseTextFromStringparseAltFromStringparseNameFromStringparsePrefixFromStringparseAbsURIrefFromStringparseLexURIrefFromStringparseURIref2FromString quickVariabledocument getPrefix lexUriRefn3symbolsubgraph GraphClosure nameGraphRuleruleAntruleCon ruleModify RDFRulesetMap RDFRuleset RDFClosure RDFRuleMapRDFRule RDFFormulanullRDFFormulamakeGraphClosureRulegraphClosureFwdApplygraphClosureBwdApplymakeRDFGraphFromN3StringmakeRDFFormulamakeRDFClosureRulemakeN3ClosureRulemakeN3ClosureSimpleRulemakeN3ClosureModifyRulemakeN3ClosureAllocatorRulemakeNodeAllocTo RDFProofStepRDFProofmakeRDFProofStep makeRDFProofmakeRdfInstanceEntailmentRulemakeRdfSubgraphEntailmentRulemakeRdfSimpleEntailmentRuleRDFApplyModifier RDFModifierFnRDFDatatypeSubRDFDatatypeModRDFDatatypeVal RDFDatatypemakeRdfDtOpenVarBindingModify makeRdfDtOpenVarBindingModifiersapplyRDFDatatypeMod fromRDFLabel toRDFLabelmakeDatatypedLiteralClassRestrictioncrNamecrFuncClassRestrictionFnmakeDatatypeRestrictionmakeDatatypeRestrictionFn falseGraph falseGraphStrmakeRDFClassRestrictionRulesmakeRDFDatatypeRestrictionRulestypeNameXsdStringnamespaceXsdStringrdfDatatypeXsdStringrdfDatatypeValXsdStringprefixXsdStringaxiomsXsdStringrulesXsdStringtypeNameXsdIntegernamespaceXsdIntegerrdfDatatypeXsdIntegerrdfDatatypeValXsdIntegerprefixXsdIntegeraxiomsXsdIntegerrulesXsdInteger allDatatypesfindRDFDatatype rulesetRDF rulesetRDFS rulesetRDFDfindRDFOpenVarBindingModifier rdfRulesetMap allRulesetsallDatatypeRulesets NamedGraphMap NamedGraphngNamengGraph SwishStateIO SwishStatusSwishExecutionErrorSwishArgumentErrorSwishDataAccessErrorSwishDataInputErrorSwishGraphCompareError SwishSuccess SwishStateformatgraphgraphsrulesrulesetsinfomsgerrormsgexitcode SwishFormatNTN3 emptyState setFormatsetBasesetGraph modGraphs findGraph findFormulamodRulesfindRule modRulesets findRulesetfindOpenVarModify findDatatypesetInfo resetInfosetError resetError setStatus swishError reportLines reportLineparseScriptFromString swishFormat swishBase swishInput swishMerge swishCompareswishGraphDiff swishScript swishOutput SwishActiondisplaySwishHelpsplitArgumentsvalidateCommandsrunSwishrunSwishActionsGHC.ShowShowSShowqnEqscanURIisNameStartChar isNameChar filePathToURIquote1hash1arcNodesMakePartitionState partitionEq partitionShowmakePartitionsmakePartitions1makePartitions2makeStatements makeStatementpickNextSubjectpickIntSubjectpickVarSubjectcomparePartitions1comparePartitions2comparePartitions3comparePartitions4 matchNodescollect collectBy collectBy1 collectBy2reverseCollection collectMore collectMoreBycollectMoreBy1collectMoreBy2reverseMoreCollectionremoveBy removeBy1 reverseTo removeEachlistDifferences Control.MonadsequencepowerSeq_bylen powerSeq_nextgLM reverseEntrymapConsGHC.BaseFunctorfmapData.TraversablemapM$fShowLookupMap $fEqLookupMap$fLookupEntryClass(,)kvnsEqsnEqsnLeid openVbmNamevbmCompatibleVarscompatibleUsagecomposeCheckSequence composePair $fShow(->)$$fLookupEntryClass(->)ScopedName(->)<$fLookupEntryClassVarBindingModifyScopedNameVarBindingModify$fShowVarBinding$fEqVarBinding $fOrdRule$fEqRule $fOrdFormula $fEqFormulaaddvaddv2selvapplyFdescToTuplemergeTupleVals fromStringfs proofAxioms proofRulesproofAxiomsUsed checkProof1 explainProof1 explainStep showsSteps showsStep showNamesshowNameecLabels ecRemoveLabelghc-primGHC.BoolTrue graphMapEqFalse showLabelMap labelMatchassignLabelMap1initValhashVal arcSignaturesgraphMap showCanonlabelEq formulaeMapformulaEntryMap formulaeMapAformulaEntryMapA grShowListgrShowshowArcs toNSGraph formulaNodes unionNodes noderootindex splitnodeidtrynodes testDatatyped NodeQuery rdfQueryPrim1 rdfQueryPrim2 rdfQueryBack1 rdfQueryBack2rdfQueryBackModify1 getBindingmatchQueryVariablematchQueryBnodemapNodeaddVar graphShowgraphEq FormatterNTFormatterStateNTFS ntfsNodeMap ntfsNodeGen emptyNTFSformatGraphInternal applyShowS formatGraph formatArc formatLabel mapBlankNodeshowScopedNamequoteStr updateGraphfullStop addStatementhCharsbCharsdtlang asciiChars asciiCharsNT ntHexDigithex4hex8 protectedChar SortedArcsSA LabelContext ObjContext PredContext SubjContext NodeGenStateNgsprefixesnodeMapN3FormatterStateN3FSindent lineBreaksubjspropsobjs formAvail formQueue nodeGenSt bNodesChecktraceBufPredTreeSubjTreeputs emptyN3FSemptyNgs getIndent setIndent getLineBreak setLineBreakgetNgssetNgs getPrefixesgetSubjssetSubjsgetPropssetPropsgetBnodesCheck queueFormulaextractFormulalen1 getCollection extractList removeItemformatGraphDiag1formatPrefixesformatSubjectsformatProperties formatObjects insertFormula insertList insertBnode moreSubjects nextSubjectmoreProperties nextProperty moreObjects nextObjectnextLineformatAnnotation formatNodeIdsortArcsarcTree commonFstEq findMaxBnodegetAutoBnodeIndex countBnodes AddStatementlexer setPrefixsetSNamesetSUrisetKeywordsListgetSNamegetSUri getPrefixNsgetPrefixScopedNamegetKeywordsListgetAllowLocalNamescomma semiColonbratSignatWordshowURIgetScopedNameURI' operatorLabeladdStatementRevinitCharbodyCharn3Namen3string n3CharactersQuot singleQuoted tripleQuotedgetDefaultPrefixaddBase addPrefixupdateKeywordsListstatementsOptional statement declaration explicitURI appendUris bareNameCslbareNameprefix symbolCslqnamefullOrLocalQName fullQName findPrefix localQName existentialsimpleStatement expressionpathItempathListformulaContent statementListbooleanlangcodenumericLiteraln3sign n3integer n3decimaln3doublepropertyListBNodepropertyListWith objectList objectWithobjectListWithverb verbReverse verbForward universal queryFind queryBack querySubsquerySubsBlankapplyNodeAllocTordfInstanceEntailFwdApplyrdfInstanceEntailBwdApplyrdfInstanceEntailCheckInferencerdfSubgraphEntailFwdApplyrdfSubgraphEntailCheckInferencerdfSimpleEntailCheckInference$fExpressionlgmakeRDFModifierFnrdfNodeExtract rdfNodeInject ruleQuerymakeRestrictionRule1makeRestrictionRule2fwdApplyRestrictionfwdApplyRestriction1bwdApplyRestrictionbwdApplyRestriction1 deriveTupleapplyRestrictionallJustAndNothing mostOneValue coverSets coversVals deleteMaybe nameXsdString+++ mapXsdString relXsdString mkStrRel2liftL2lcomprelXsdStringEqrelXsdStringNe modXsdStringmodXsdStringEqmodXsdStringNemodXsdStringComparerdfRulesetXsdStringmkPrefixmkAxiomrulesXsdStringRestrictionrulesXsdStringStrrulesXsdStringClosurexsdstrlsxsdstrsl stringPlainstringPlainValuenameXsdIntegerc2intPower relXsdInteger mkIntRel2 mkIntRel3mkIntRel3mayberelXsdIntegerAbsrelXsdIntegerNegrelXsdIntegerSumrelXsdIntegerDiffrelXsdIntegerProdrelXsdIntegerDivModrelXsdIntegerPowerrelXsdIntegerEqrelXsdIntegerNerelXsdIntegerLtrelXsdIntegerLerelXsdIntegerGtrelXsdIntegerGe modXsdIntegermodXsdIntegerAbsmodXsdIntegerNegmodXsdIntegerSummodXsdIntegerDiffmodXsdIntegerProdmodXsdIntegerDivModmodXsdIntegerPowermodXsdIntegerEqmodXsdIntegerNemodXsdIntegerLtmodXsdIntegerLemodXsdIntegerGtmodXsdIntegerGemodXsdIntegerComparerdfRulesetXsdIntegerrulesXsdIntegerStr makeFormula requireAny isLiteralV isUntypedLitV isXMLLitV isUriRefVisBlankV isDatatypedV isMemberPropV allocateTo valueSamesameDatatypedValuesameDatatypedValueApplyAllsameDatatypedValueApply getCanonical prefixRDFrdfa1rdfa2rdfa3rdfa4rdfa5rdfa6rdfa7rdfa8 axiomsRDFrdfsubrdfserdflgrdfglrdfr1rdfr2rdfcp1rdfcp2rdfcp3rulesRDFrdfsa01rdfsa02rdfsa03rdfsa04rdfsa05rdfsa06rdfsa07rdfsa08rdfsa09rdfsa10rdfsa11rdfsa12rdfsa13rdfsa14rdfsa15rdfsa16rdfsa17rdfsa18rdfsa19rdfsa20rdfsa21rdfsa22rdfsa23rdfsa24rdfsa25rdfsa26rdfsa27rdfsa28rdfsa29rdfsa30rdfsa31rdfsa32rdfsa33rdfsa34rdfsa35rdfsa36rdfsa37rdfsa38rdfsa39rdfsa40 axiomsRDFSrdfsr1rdfsr2rdfsr3rdfsr4ardfsr4brdfsr5rdfsr6rdfsr7rdfsr8rdfsr9rdfsr10rdfsr11rdfsr12rdfsr13rdfscp11rdfscp12rdfscp13rdfscp21rdfscp22rdfscp23rdfscp31rdfscp32rdfscp33 rulesRDFS axiomsRDFDrdfdr1rdfdr2rdfdr3 rulesRDFDrdfVarBindingFiltersrdfVarBindingModifiersallOpenVarBindingModifydtsVarBindingModifiersscriptisymbolcommand prefixLinenameItem readGraph writeGraph mergeGraphs compareGraphs assertEquiv assertMember defineRule defineRulesetdefineConstraints checkProofCmdfwdChainbwdChain commandName restOfLinenameList nameOrList graphExpr graphOnly graphList graphOrList formulaExpr namedGraph formulaList varModifiers varModListvarModssReport ssReportLabelssAddReturnFormula ssAddGraph ssGetGraph ssGetFormula ssGetListssRead ssReadGraph ssWriteListsplitBylastseginitseg ssWriteGraphssMerge ssCompare ssAssertEq ssAssertIn ssDefineRulessFindVarModifyssDefineRuleset ssFindRulessDefineConstraintsssFindDatatype ssCheckProof ssCheckStep ssFwdChainssFindRulesetRule ssFindRuleset ssBwdChaingetResourceDataputResourceData mergeGraph compareGraph diffGraphswishOutputDiffsswishOutputDiffswishOutputPartswishReadScriptdefURIcalculateBaseURIswishParseScriptswishCheckResultswishOutputGraphswishReadGraph swishReadFile swishOpenFilereadFromHandle swishParseswishWriteFileswishCreateWriteableFile usageText splitArgumentvalidateCommand swishCommands swishCommand validateBase