G'day all,
I'm happy to say my code is working fine, but my question is about Jess, Java and memory. I plan to use shadow facts in conjunction with a DB in order to store large numbers of facts - but only get 'em when I need 'em. Anyway, in the mean time, I was just going to assert a whole bunch of facts (say, 66927) into Jess so I could work with them directly - and do the database stuff later. But when trying to do this, I get the following error:
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
I know my code works fine, as I tested it with only asserting 200 facts. Is this just simply because Jess ran out memory? A great reason why to use the database/shadow fact technique mentioned previously?
My code, if it's relevant:
-----------------------------------------
public void writeJessFacts(String jf)
{
String factsFilename = jf;
try
{
engine.executeCommand("(deftemplate street_name_alias \"fact template\" (slot actual_name) (slot actual_type) (slot dli_id) (slot soundex) (multislot alias) (slot lga) (slot locality) )");
int count = 0;
for (count = 0; count < street_name_array.size(); count++)
//for (count = 0; count < 200; count++)
{
engine.executeCommand("(assert (street_name_alias (actual_name \""+street_name_array.get(count).toString()+"\") " +
"(actual_type \""+street_type_array.get(count).toString()+"\") " +
"(dli_id "+street_name_ID_array.get(count).toString()+" ) " +
"(lga \""+lga_name_array.get(count).toString()+"\") " +
"(locality \""+locality_name_array.get(count).toString()+"\") " +
"(soundex \""+soundex_code.get(count).toString()+"\") ) )");
}
System.out.println("A total of " + count + " facts asserted");
engine.executeCommand("(save-facts "+factsFilename+" street_name_alias)");
System.out.println(count + " facts written to file (Jess format)");
}
catch (JessException e)
{
System.out.println("error with knowledge base: " + e);
}
}
-----------------------------------------
A sample fact as written to file:
(MAIN::street_name_alias (actual_name "ANNA PLAINS") (actual_type "RD") (dli_id 100060001) (soundex "A514") (alias ) (lga "BROOME") (locality "EIGHTY MILE BEACH"))
Thanks all,
Matt
--
Matthew Hutchinson
Ph.D. Candidate
Department of Spatial Sciences
Curtin University of Technology
GPO Box U1987
Perth, Western Australia 6845
Visiting Scholar
Department of Geography and Planning
University of Akron
Akron, Ohio USA
- JESS: Java out of memory :-( Matthew Hutchinson
- Re: JESS: Java out of memory :-( ejfried
- JESS: Matching on fields of a collection slot erich.oliphant
- JESS: defclasses and backchaining erich.oliphant
- Re: JESS: Java out of memory :-( Aero19 Jopalhan
