next up previous contents index
Next: 1.0.0.0.4 Interfaces Up: 1. Introduction Previous: 1.0.0.0.2 Multi-threading   Contents   Index

1.0.0.0.3 Indexing Methods

Data oriented applications may also require indices other than Prolog's first argument indexing. XSB offers a variety of indexing techniques for asserted code. Clauses can be indexed on a group of arguments or on alternative arguments. For instance, the executable directive index(p/4,[3,2+1]) specifies indexes on the (outer functor symbol of) the third argument or on a combination of (the outer function symbol of) the second and first arguments. If data is expected to be structured within function symbols and is in unit clauses, the directive index(p/4,trie) constructs an indexing trie of the p/4 clauses using a depth-first, left-to-right traversal through each clause. Representing data in this way allows discrimination of information nested arbitrarily deep within clauses. Advantages of both kinds of indexing can be combined via star-indexing. Star-indexing indicates that up to the first 5 fields in an argument will be used for indexing (the ordering of the fields is via a depth-first traversal). For instance, index(p/4,[*(4),3,2+1]) acts as above, but looks within 4th argument of p/4 before examining the outer functor of argument 3 (and finally examining the outer functors of arguments 2 and 1 together. Using such indexing, XSB routinely performs efficiently intensive analyses of in-memory knowledge bases with millions of highly structured facts. Indexing techniques for asserted code are covered in Section 6.13.


next up previous contents index
Next: 1.0.0.0.4 Interfaces Up: 1. Introduction Previous: 1.0.0.0.2 Multi-threading   Contents   Index
Terrance Swift 2007-10-05