Is there a way to set a user-defined predicate property?
My use case is having a large (and changing) human knowledge base that is expressed using prolog predicates. I would like to be able to attach ‘properties’ to the predicates (and maybe even specific clauses) so that I can query something like this:
?- knowledge_property(author_of_predicate_knowledge,formula(e=mc**2,_),Value). Value=author('Albert Einstein', [iri('https://en.wikipedia.org/wiki/Albert_Einstein'),type(human),...]).
I can think of two ways to do this (there are probably many more):
Use term_expansion, and declare predicates with some predefined syntax. The term_expansion would take care of storing clause/predicate properties.
Use something modeled after :- begin_test/end_test; something like :- begin_properties(…), :- end_properties(…), especially for cases where the propertie(s) are the same for a group of predicates.
However I wanted to see if there is already a built-in way that I can use to set properties and then call predicate_property/2 to get the user-defined property.