From: Barry B. <bar...@st...> - 2009-09-16 06:17:30
|
Hi Lee, Thanks for the code snippet. We have known for some time that our parser (based on sablecc) performs very badly with large input files. We will look to improve this at some point in the future. IDataSource was an idea that has not reached fruition. The plan was to have facts supplied to the reasoner stored outside the reasoner's memory space, the most obvious being in some database. However, the implementation so far is very naive and will simply read in all facts when the knowledge base is initialised. If you wish to use it, then create a class that implements the IDataSource interface and pass it in the knowledge base's configuration object. The class must provide the data requested by the reasoner according to the javadoc for IDataSource. Have fun! barry lee youpeng wrote: > When I use IRIS's parser to parse a big file(size > 2MB), its performance is > really bad, and I wrote a method to parse the file increasingly(attached > fiile), and got a dramatic performance improvement, I think you may use it > in parse directly. > > And I got another question here, > In the user guide file I found that IRIS has an IDataSource interface, > however, there was no example about how to use it, could you give me some > demo or code snippet about how to use it. > > > 2009/9/15, Barry Bishop <bar...@st...>: >> No problem! >> >> lee youpeng wrote: >>> Thanks a lot for your help. >>> >>> 2009/9/15, Barry Bishop <bar...@st...>: >>>> Hello, >>>> >>>> Thanks very much for your interest in IRIS! >>>> >>>> >>>> >>>> lee youpeng wrote: >>>>> Hi Mr. Bishop >>>>> I am a Master student from Tsinghua University China. Recently I >>>> try >>>>> to use IRIS to build a source code search tool for Java kind like .QL >>>> from >>>>> Semmle. >>>>> During the developement I found some questions about IRIS, could >>>>> you give me some advise. >>>>> >>>>> 1. Aggregate Function. >>>>> I need to count the result size of a query,is there some >> build-in >>>>> aggregate function? >>>>> >>>> The are no aggregate built-ins in IRIS. If you simply want to know how >>>> many results are obtained from a query, then you will need to call >>>> .size() on the returned relation. >>>> >>>> i.e. kb.execute( query ).size() >>>> >>>>> 2. Assignment. >>>>> Is there build-in assignment rule? or just use ?x + 0 =?y. >>>> Yes, just use '=', e.g. >>>> >>>> f(?x) :- g(?z,?y), ?x = ?y . >>>> >>>>> 3. Fail to do recursion rule. >>>>> I find a demo from DES(Datalog Education System) which calculate >>>>> Fibonacci numbers. here is the program: >>>>> >>>>> fib(0,1). >>>>> fib(1,1). >>>>> fib(?n,?f):- ?n > 1, ?n - 2 = ?n2, fib(?n2,?f2), ?n - 1 = ?n1, >>>>> fib(?n1,?f1), ?f1 + ?f2 = ?f. >>>>> >>>>> It works fine with DES,however, when run with IRIS, It never >> halt >>>>> until I got out of memory error. >>>>> dose IRIS have some bug about such program? or something wrong >>>> with >>>>> the program. >>>> The problem is, that IRIS is using bottom up evaluation, i.e. it tries >>>> to compute all possible inferences. The example above is open ended and >>>> will never terminate. >>>> >>>> You could try adding "?n < 20" to the body of the rule to compute just >>>> the first twenty fibonacci numbers. >>>> >>>> I hope this helps, >>>> >>>> -- >>>> Barry Bishop >>>> Semantic Technology Institute (STI) >>>> University of Innsbruck, Austria >>>> ----------------------------------- >>>> E-Mail: bar...@st... >>>> Tel: +43 512 507 6469 >>>> ----------------------------------- >>>> >> -- >> Barry Bishop >> Semantic Technology Institute (STI) >> University of Innsbruck, Austria >> ----------------------------------- >> E-Mail: bar...@st... >> Tel: +43 512 507 6469 >> ----------------------------------- >> > -- Barry Bishop Semantic Technology Institute (STI) University of Innsbruck, Austria ----------------------------------- E-Mail: bar...@st... Tel: +43 512 507 6469 ----------------------------------- |