I arrived at this looking at Notation 3, with quoted graph support and
trying to figure out how to bolt inferencing support onto rdflib, a
commonly
used RDF library for Python.
Notation 3 has constructs that look like,
{ ?X a something:Foo } => { ?X a something:Bar }
which naturally translate to prolog as something like
bar(X) := foo(X)
I would like to be able to read in rules expressed in N3 and then use
them when querying the graph, perhaps doing some forward inferencing
to pre-populate triples, etc.
I have not been able to find obvious examples of how to create clauses
like this from C. One option is to generate a prolog source file and
then
consult/1 it, but that seems needlessly circuitous.
Is there a recommended way to create "bar(X) := foo(X)" from C?
Cheers,
-w
You may want to take a look at Henry, a N3 parser and reasoner for SWI-
Prolog:
http://code.google.com/p/km-rdf/wiki/Henry
Cheers,
Paulo
Thank you that seems very useful - better to not reinvent the
wheel.
My novice level with prolog is showing, I found something close
to the answer to my question, that you can treat ':=' as a
functor. Not sure why,
assert(bar(1)).
assert(':='(foo(X), bar(X))).
foo(X).
ERROR: toplevel: Undefined procedure: foo/1 (DWIM could not correct
goal)
I like to know why that doesn't work for interest's sake, but
Henry seems like the answer to my immediate problem...
Thanks!
-w
Replace ':=' by ':-'.
Cheers,
Paulo
Don't I feel silly now :P
Cheers,
-w