Class ProjogSourceReader
java.lang.Object
org.projog.core.parser.ProjogSourceReader
Populates a
KnowledgeBase with clauses parsed from Prolog syntax.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidparseFile(KnowledgeBase kb, File prologSourceFile) Populates the KnowledgeBase with clauses defined in the file.static voidparseReader(KnowledgeBase kb, Reader reader) Populates the KnowledgeBase with clauses read from the Reader.static voidparseResource(KnowledgeBase kb, String prologSourceResourceName) Populates the KnowledgeBase with clauses defined in the specified resource.
-
Method Details
-
parseFile
Populates the KnowledgeBase with clauses defined in the file.- Parameters:
kb- the KnowledgeBase to add the clauses toprologSourceFile- source of the prolog syntax defining clauses to add to the KnowledgeBase- Throws:
ProjogException- if there is any problem parsing the syntax or adding the new clauses to the KnowledgeBase
-
parseResource
Populates the KnowledgeBase with clauses defined in the specified resource.If
prologSourceResourceNamerefers to an existing file on the file system then that file is used as the source of the prolog syntax elseprologSourceResourceNameis read from the classpath.- Parameters:
kb- the KnowledgeBase to add the clauses toprologSourceResourceName- source of the prolog syntax defining clauses to add to the KnowledgeBase- Throws:
ProjogException- if there is any problem parsing the syntax or adding the new clauses to the KnowledgeBase
-
parseReader
Populates the KnowledgeBase with clauses read from the Reader.Note that this method will call
close()on the specified reader - regardless of whether this method completes successfully or if an exception is thrown.- Parameters:
kb- the KnowledgeBase to add the clauses toreader- source of the prolog syntax defining clauses to add to the KnowledgeBase- Throws:
ProjogException- if there is any problem parsing the syntax or adding the new clauses to the KnowledgeBase
-