XPath

Started work on XPath integration into the mandarax project today. This is one of the three current projects I am working on, and to say the least, is interesting. Before a few days ago I didn’t even know what XPath was, let alone how to extend it to be able to retrieve data stored within an uncommon document model (i.e. the Mandarax KnowledgeBase class).

Results have started appearing. I can now request all facts (think declarative programming, knowledge bases, and in general, a Java version of Prolog) simply by giving the following XPath query:

/fact

Isn’t that cool? Ok, maybe not to you, but to the people at Massey who created the rest of Mandarax, this will be incredibly useful. Maybe another example would be in order. If I want a list (an Iterator to be specific) of all predicates in the head of a rule, I can give the XPath query:

/rule/head/predicate

I’m still working on a lot of things, so whilst this looks like good progress, I know I have a fair bit more work to do (considering this is a 3-4 week job).

Leave a Reply