You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
|
Feb
|
Mar
|
Apr
(6) |
May
|
Jun
|
Jul
(3) |
Aug
(2) |
Sep
(6) |
Oct
(2) |
Nov
(2) |
Dec
(2) |
2009 |
Jan
(1) |
Feb
(9) |
Mar
|
Apr
(4) |
May
|
Jun
|
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
(2) |
From: Florian F. <flo...@st...> - 2009-12-03 13:46:29
|
Hi Nathan, sorry for the late answer. I am not aware of a definite reason for that - at least not from a technical point of view. However, IRIS supports a range of different datatypes so this explicit treatment of booleans is mostly for the sake of consistency. Best, Florian Nathan Marz wrote: > Hello IRIS team! > > I'm using the IRIS datalog parser for a project, and I find the syntax > for booleans to be rather unfortunate (_boolean('true') instead of > true). What's the reason for designing it this way? > > Thanks, > Nathan Marz > Rapleaf > > ------------------------------------------------------------------------------ > Join us December 9, 2009 for the Red Hat Virtual Experience, > a free event focused on virtualization and cloud computing. > Attend in-depth sessions from your desk. Your couch. Anywhere. > http://p.sf.net/sfu/redhat-sfdev2dev > _______________________________________________ > iris-reasoner-support mailing list > iri...@li... > https://lists.sourceforge.net/lists/listinfo/iris-reasoner-support |
From: Nathan M. <na...@ra...> - 2009-12-01 03:01:55
|
Hello IRIS team! I'm using the IRIS datalog parser for a project, and I find the syntax for booleans to be rather unfortunate (_boolean('true') instead of true). What's the reason for designing it this way? Thanks, Nathan Marz Rapleaf |
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 ----------------------------------- |
From: Florian F. <flo...@st...> - 2009-09-15 12:54:10
|
Hi, nice to see that you are trying IRIS. Since you already know QL I would like to point out http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.60.5470 which might be a very helpful paper. Furthermore, an external user of IRIS has created a more in-depth documentation than the one that we currently have: http://www.murat-knecht.de/schuerfen/irisdoc/html-multiple/index.html I cannot guarantee for the correctness of all of this, but it is fairly useful. Then to your questions: 1.) We implemented aggregates on a tool on-top of IRIS a while ago, however this was for a specific use case and is likely not helpful in your case. IRIS itself unfortunately does not implement aggregates right at the moment, although it is something that has been on our todo-list for a while. 2.) Just using equality like that is fine in general. Watch out for different data types. 3.) This has to do with the IRIS evaluation model. Per default IRIS starts with a set of facts and computes new facts in a bottom up fashion whereas it is also possible to start with the query, decompose that and gradually compute what is required to answer it. In the particular case of the Fibonacci example this does not really make a difference in terms of efficiency. Now consider the rule: fib(?n,?f):- ?n > 1, ?n - 2 = ?n2, fib(?n2,?f2), ?n - 1 = ?n1, fib(?n1,?f1), ?f1 + ?f2 = ?f. In that case the problem is that IRIS does not know the value of ?n when it starts computing new values (for more details see http://www.iris-reasoner.org/saferules) To fix that you can i.e. do: number(1). number(?x) :- number(?y), ?y + 1 = ?x, ?y < 6. #this just generates a sequence of natural numbers 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, number(?n). ?- fib(5,?x). The purpose of this is to limit the range of ?n during the computation. I have also cc'ed this to the official iris support mailing list, which is the best place for questions. Best, Florian lee youpeng wrote: > Hi Mr. Fischer > 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? > > 2. Assignment. > Is there build-in assignment rule? or just use ?x + 0 =?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. > > Thank you for reading this. > > > > -- > > Best > Wishes > > YP Lee > Master Candidate > School of Software Engineering > Tsinghua University, Beijing, P.R.China > Postcode: 100084 > Tel: (86-10) 62778595 > Mobile: (86) 13811782249 > Email: lov...@gm... <mailto:lov...@gm...> > > 黎云 > 清华大学软件学院在读硕士 > 清华大学14号楼155室 > 电话: 010 82330804 > 手机: 13811782249 > 电邮: lov...@gm... <mailto:lov...@gm...> |
From: Barry B. <bar...@st...> - 2009-04-23 12:19:02
|
Hi Murat, The whole point of the well-founded semantics is to provide a certain interpretation of negation. A stratified model for negation can not be computed when the rule set can not be stratified, e.g. p(X) :- q(X), !r(X). r(X) :- p(X) When applying a well-founded interpretation of negation to the 'difficult' rule-set above then we are able to compute something. In fact, we infer things which are definitely true, as well as things that are definitely not true, but also things that we can't tell with this interpretation. In logic programming, things that we can't be sure of are assumed to be false. Hence, the ultimate output from the reasoner contains only those statements that are are definitely true (in the given interpretation). I have used a lot of words to say very little - I hope it makes sense! barry Murat Knecht wrote: > Hi Barry, > > thanks for your comments. I'll have to think about your two answers at > the bottom some more. > > My question regarding the "two-valued logics" came from the simple > observation that no query will ever return "undefined", when using the > well-founded semantics. I thought the point of the well-founded > semantics was two-fold: First, it allows additional (negative) > conclusions from unfounded sets and, second, a literal in a well-founded > model is either true, false or undefined. > I do believe that you build your model correctly, but the distinction > between "false" and "unknown" is dropped after the KB build up. > > All the best, > Murat > > > > Barry Bishop schrieb: >> Hi Murat, >> >> Thanks for your continued interest! Comments in line: >> >> Murat Knecht wrote: >> >>> Hi, >>> >>> I've been having a look at the implementation of the well-founded >>> semantics in IRIS, having just read the paper from van Gelder, et. al. >>> on the topic. >>> >>> As far as I understand it, you do not implement the approach from the >>> paper, but rather resort to a two-valued logic. From this point of view >>> the implementation is somewhat unfinished - no query will ever return >>> "undefined". I believe the root of the problem lies in the interface of >>> the evaluation strategies, which only allows to return a relation of >>> (positive) terms. Is this correct, or am I missing something big? >>> >> The 3 valued logic is implicit in the alternating fixed point algorithm. >> See the attached paper. >> >> The input program is 'doubled' and one half computes the definitely true >> facts, while the other half computes possibly false facts. Any possible >> statement that does not appear in the minimal models of each half is >> therefore 'unknown'. >> >> Once a stable model for each half is reached, nothing can be said about >> statements whose truth value is 'unknown' and so only those definitely >> true facts are considered. >> >> >>> The other question: You reorder the rules, before building up the >>> well-founded model. This is not a prerequisite, right? I also am not >>> quite sure, how this helps speeding things up, since you always build >>> the _complete_ model ... >>> >> Rule re-ordering is a general optimisation and not required by the >> alternating-fixed point algorithm. It takes time to actually evaluate a >> rule and since the output of one can feed the input of another, then it >> makes sense to try to order rules such that this can happen. >> >> >>> In the method WellFoundedEvaluationStrategy.calculateMinimalModel() you >>> have the following comment: >>> >>> // Keep these facts and re-use. The positive side is monotonic >>> increasing, >>> // so we don't need to throw away and start again each time. >>> // However, the negative side is monotonic decreasing, so we do >>> have to >>> // throw away each time. >>> >>> It does make sense(to me, but I don't see its optimization reflected in >>> the code. For both the positive and negative rules, you do exactly the same. >>> >> Yes, we do the same things each time, but the result (the minimal model >> for each half of the program) is not the same. Each time round the whole >> loop, we calculate more definitely true statements and less possibly >> false statements. >> >> Since the positive side computes things that are definitely always true, >> then we can keep them and use them as a better starting point each time >> we compute the positive side minimal model. >> >> I hope this helps, >> barry > -- Barry Bishop Senior Scientific Programmer Semantic Technology Institute (STI) University of Innsbruck, Austria ----------------------------------- E-Mail: bar...@st... Tel: +43 512 507 6469 ----------------------------------- |
From: Murat K. <mur...@st...> - 2009-04-22 15:04:10
|
Hi Barry, thanks for your comments. I'll have to think about your two answers at the bottom some more. My question regarding the "two-valued logics" came from the simple observation that no query will ever return "undefined", when using the well-founded semantics. I thought the point of the well-founded semantics was two-fold: First, it allows additional (negative) conclusions from unfounded sets and, second, a literal in a well-founded model is either true, false or undefined. I do believe that you build your model correctly, but the distinction between "false" and "unknown" is dropped after the KB build up. All the best, Murat Barry Bishop schrieb: > Hi Murat, > > Thanks for your continued interest! Comments in line: > > Murat Knecht wrote: > >> Hi, >> >> I've been having a look at the implementation of the well-founded >> semantics in IRIS, having just read the paper from van Gelder, et. al. >> on the topic. >> >> As far as I understand it, you do not implement the approach from the >> paper, but rather resort to a two-valued logic. From this point of view >> the implementation is somewhat unfinished - no query will ever return >> "undefined". I believe the root of the problem lies in the interface of >> the evaluation strategies, which only allows to return a relation of >> (positive) terms. Is this correct, or am I missing something big? >> > > The 3 valued logic is implicit in the alternating fixed point algorithm. > See the attached paper. > > The input program is 'doubled' and one half computes the definitely true > facts, while the other half computes possibly false facts. Any possible > statement that does not appear in the minimal models of each half is > therefore 'unknown'. > > Once a stable model for each half is reached, nothing can be said about > statements whose truth value is 'unknown' and so only those definitely > true facts are considered. > > >> The other question: You reorder the rules, before building up the >> well-founded model. This is not a prerequisite, right? I also am not >> quite sure, how this helps speeding things up, since you always build >> the _complete_ model ... >> > > Rule re-ordering is a general optimisation and not required by the > alternating-fixed point algorithm. It takes time to actually evaluate a > rule and since the output of one can feed the input of another, then it > makes sense to try to order rules such that this can happen. > > >> In the method WellFoundedEvaluationStrategy.calculateMinimalModel() you >> have the following comment: >> >> // Keep these facts and re-use. The positive side is monotonic >> increasing, >> // so we don't need to throw away and start again each time. >> // However, the negative side is monotonic decreasing, so we do >> have to >> // throw away each time. >> >> It does make sense(to me, but I don't see its optimization reflected in >> the code. For both the positive and negative rules, you do exactly the same. >> > > Yes, we do the same things each time, but the result (the minimal model > for each half of the program) is not the same. Each time round the whole > loop, we calculate more definitely true statements and less possibly > false statements. > > Since the positive side computes things that are definitely always true, > then we can keep them and use them as a better starting point each time > we compute the positive side minimal model. > > I hope this helps, > barry |
From: Barry B. <bar...@st...> - 2009-04-22 12:22:02
|
Hi Murat, Thanks for your continued interest! Comments in line: Murat Knecht wrote: > Hi, > > I've been having a look at the implementation of the well-founded > semantics in IRIS, having just read the paper from van Gelder, et. al. > on the topic. > > As far as I understand it, you do not implement the approach from the > paper, but rather resort to a two-valued logic. From this point of view > the implementation is somewhat unfinished - no query will ever return > "undefined". I believe the root of the problem lies in the interface of > the evaluation strategies, which only allows to return a relation of > (positive) terms. Is this correct, or am I missing something big? The 3 valued logic is implicit in the alternating fixed point algorithm. See the attached paper. The input program is 'doubled' and one half computes the definitely true facts, while the other half computes possibly false facts. Any possible statement that does not appear in the minimal models of each half is therefore 'unknown'. Once a stable model for each half is reached, nothing can be said about statements whose truth value is 'unknown' and so only those definitely true facts are considered. > The other question: You reorder the rules, before building up the > well-founded model. This is not a prerequisite, right? I also am not > quite sure, how this helps speeding things up, since you always build > the _complete_ model ... Rule re-ordering is a general optimisation and not required by the alternating-fixed point algorithm. It takes time to actually evaluate a rule and since the output of one can feed the input of another, then it makes sense to try to order rules such that this can happen. > In the method WellFoundedEvaluationStrategy.calculateMinimalModel() you > have the following comment: > > // Keep these facts and re-use. The positive side is monotonic > increasing, > // so we don't need to throw away and start again each time. > // However, the negative side is monotonic decreasing, so we do > have to > // throw away each time. > > It does make sense(to me, but I don't see its optimization reflected in > the code. For both the positive and negative rules, you do exactly the same. Yes, we do the same things each time, but the result (the minimal model for each half of the program) is not the same. Each time round the whole loop, we calculate more definitely true statements and less possibly false statements. Since the positive side computes things that are definitely always true, then we can keep them and use them as a better starting point each time we compute the positive side minimal model. I hope this helps, barry |
From: Murat K. <mur...@st...> - 2009-04-22 11:17:11
|
Hi, I've been having a look at the implementation of the well-founded semantics in IRIS, having just read the paper from van Gelder, et. al. on the topic. As far as I understand it, you do not implement the approach from the paper, but rather resort to a two-valued logic. From this point of view the implementation is somewhat unfinished - no query will ever return "undefined". I believe the root of the problem lies in the interface of the evaluation strategies, which only allows to return a relation of (positive) terms. Is this correct, or am I missing something big? The other question: You reorder the rules, before building up the well-founded model. This is not a prerequisite, right? I also am not quite sure, how this helps speeding things up, since you always build the _complete_ model ... In the method WellFoundedEvaluationStrategy.calculateMinimalModel() you have the following comment: // Keep these facts and re-use. The positive side is monotonic increasing, // so we don't need to throw away and start again each time. // However, the negative side is monotonic decreasing, so we do have to // throw away each time. It does make sense(to me, but I don't see its optimization reflected in the code. For both the positive and negative rules, you do exactly the same. Thanks, Murat |
From: Nathan M. <na...@ra...> - 2009-02-20 00:35:56
|
Thanks for your reply. Can you point me to any papers or additional information on what is involved on implementing aggregate functions in a Datalog engine? On Feb 19, 2009, at 2:31 PM, Barry Bishop wrote: > Hi Nathan, > > Some Datalog engines support aggregate functions in rules, but sadly > not > IRIS. It's actually quite a complex feature and requires a > stratification of rules in a similar way to stratification due to > negation. > > If using IRIS then aggregation must be done post-processing, i.e. you > will have to write your own loop(s) over the result set and do the > summing, averaging, maxing, grouping 'by hand'. > > Sorry I couldn't help this time, > barry > > > Nathan Marz wrote: >> Hello, >> >> Thanks so much for your help so far. I have another question which >> may >> be more of a Datalog question than anything else. Is there anyway to >> get "aggregate" values from the data (counts, sums, averages, etc)? >> For example, let's say I have a relation "age" which contains >> mappings >> of "person ids" to "ages", and I want to get the counts of every age. >> Intuitively, I want to specify something like: >> >> age_counts(?a, ?c) :- age(?p, ?a), ?c = count(). >> >> Is this possible with the Datalog model? >> >> Thanks, >> Nathan Marz >> >> ------------------------------------------------------------------------------ >> Open Source Business Conference (OSBC), March 24-25, 2009, San >> Francisco, CA >> -OSBC tackles the biggest issue in open source: Open Sourcing the >> Enterprise >> -Strategies to boost innovation and cut costs with open source >> participation >> -Receive a $600 discount off the registration fee with the source >> code: SFAD >> http://p.sf.net/sfu/XcvMzF8H >> _______________________________________________ >> iris-reasoner-support mailing list >> iri...@li... >> https://lists.sourceforge.net/lists/listinfo/iris-reasoner-support > > -- > Barry Bishop > Senior Scientific Programmer > Semantic Technology Institute (STI) > University of Innsbruck, Austria > ----------------------------------- > E-Mail: bar...@st... > Tel: +43 512 507 6469 > ----------------------------------- |
From: Barry B. <bar...@st...> - 2009-02-19 23:31:36
|
Hi Nathan, Some Datalog engines support aggregate functions in rules, but sadly not IRIS. It's actually quite a complex feature and requires a stratification of rules in a similar way to stratification due to negation. If using IRIS then aggregation must be done post-processing, i.e. you will have to write your own loop(s) over the result set and do the summing, averaging, maxing, grouping 'by hand'. Sorry I couldn't help this time, barry Nathan Marz wrote: > Hello, > > Thanks so much for your help so far. I have another question which may > be more of a Datalog question than anything else. Is there anyway to > get "aggregate" values from the data (counts, sums, averages, etc)? > For example, let's say I have a relation "age" which contains mappings > of "person ids" to "ages", and I want to get the counts of every age. > Intuitively, I want to specify something like: > > age_counts(?a, ?c) :- age(?p, ?a), ?c = count(). > > Is this possible with the Datalog model? > > Thanks, > Nathan Marz > > ------------------------------------------------------------------------------ > Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA > -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise > -Strategies to boost innovation and cut costs with open source participation > -Receive a $600 discount off the registration fee with the source code: SFAD > http://p.sf.net/sfu/XcvMzF8H > _______________________________________________ > iris-reasoner-support mailing list > iri...@li... > https://lists.sourceforge.net/lists/listinfo/iris-reasoner-support -- Barry Bishop Senior Scientific Programmer Semantic Technology Institute (STI) University of Innsbruck, Austria ----------------------------------- E-Mail: bar...@st... Tel: +43 512 507 6469 ----------------------------------- |
From: Nathan M. <na...@ra...> - 2009-02-19 19:37:03
|
Hello, Thanks so much for your help so far. I have another question which may be more of a Datalog question than anything else. Is there anyway to get "aggregate" values from the data (counts, sums, averages, etc)? For example, let's say I have a relation "age" which contains mappings of "person ids" to "ages", and I want to get the counts of every age. Intuitively, I want to specify something like: age_counts(?a, ?c) :- age(?p, ?a), ?c = count(). Is this possible with the Datalog model? Thanks, Nathan Marz |
From: Barry B. <bar...@st...> - 2009-02-19 08:15:57
|
Hi Nathan, To do this: p(?max) :- q(?x,?y), MAX(?x, ?y, ?max). where ?max is computed from the maximum of ?x and ?y You will need to create a new built-in for this purpose. I suggest doing something like the following: package org.deri.iris.builtins; import static org.deri.iris.factory.Factory.BASIC; import org.deri.iris.api.basics.IPredicate; import org.deri.iris.api.terms.ITerm; /** * <p> * Represents an x = max(y,z) operation. At evaluation time only the result can be unknown. * </p> * <p> * The syntax in Datalog will be, e.g. * p(?max) :- q(?x,?y), MAX(?x, ?y, ?max). * </p> */ public class MaxBuiltin extends ArithmeticBuiltin { /** * Constructor. Three terms must be passed to the constructor, * otherwise an exception will be thrown. * * @param t the terms */ public MaxBuiltin(final ITerm... t) { super(PREDICATE, t); } protected ITerm computeMissingTerm( int missingTermIndex, ITerm[] terms ) { switch( missingTermIndex ) { case 0: return null; case 1: return null; default: if( BuiltinHelper.less( terms[ 0 ], terms[ 1 ] ) ) return terms[ 1 ]; else return terms[ 0 ]; } } /** The predicate defining this built-in. */ private static final IPredicate PREDICATE = BASIC.createPredicate( "MAX", 3 ); } For the parser to use this, you have to tell it about the new built-in, by doing something like this: parser.getBuiltinRegister().registerBuiltin( new MaxBuiltin( Factory.TERM.createVariable( "a" ), Factory.TERM.createVariable( "b" ), Factory.TERM.createVariable( "c" ) ) ); I haven't tested this. Please play around and see if it works! :) Regards, barry Nathan Marz wrote: > Are there any built-in functions for doing min/max of two numbers like > how there are functions for doing addition, subtraction, etc.? > > I'm trying to write a program which computes the "distance" in a graph > of a node to a number of marked "source" nodes. My program is as > follows: > > source(1). > > person(1). > person(2). > person(3). > person(4). > person(5). > > friend(1,2). > friend(1,3). > friend(2,3). > > reachable(?p, 0) :- source(?p). > > reachable(?p, 10000) :- person(?p), !source(?p). > > reachable(?p, ?steps) :- reachable(?p, ?esteps), friend(?p2, ?p), > reachable(?p2, ?s2), min(?s2 + 1, ?esteps) = ?steps. > > ?-reachable(?p, ?steps). > > > Of course, "min" isn't valid. Is there another way to do this kind of > recursive computation? > > > Thanks, > Nathan Marz > > ------------------------------------------------------------------------------ > Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA > -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise > -Strategies to boost innovation and cut costs with open source participation > -Receive a $600 discount off the registration fee with the source code: SFAD > http://p.sf.net/sfu/XcvMzF8H > _______________________________________________ > iris-reasoner-support mailing list > iri...@li... > https://lists.sourceforge.net/lists/listinfo/iris-reasoner-support -- Barry Bishop Senior Scientific Programmer Semantic Technology Institute (STI) University of Innsbruck, Austria ----------------------------------- E-Mail: bar...@st... Tel: +43 512 507 6469 ----------------------------------- |
From: Nathan M. <na...@ra...> - 2009-02-19 03:22:57
|
Are there any built-in functions for doing min/max of two numbers like how there are functions for doing addition, subtraction, etc.? I'm trying to write a program which computes the "distance" in a graph of a node to a number of marked "source" nodes. My program is as follows: source(1). person(1). person(2). person(3). person(4). person(5). friend(1,2). friend(1,3). friend(2,3). reachable(?p, 0) :- source(?p). reachable(?p, 10000) :- person(?p), !source(?p). reachable(?p, ?steps) :- reachable(?p, ?esteps), friend(?p2, ?p), reachable(?p2, ?s2), min(?s2 + 1, ?esteps) = ?steps. ?-reachable(?p, ?steps). Of course, "min" isn't valid. Is there another way to do this kind of recursive computation? Thanks, Nathan Marz |
From: Florian F. <flo...@st...> - 2009-02-19 01:21:15
|
I forgot to cc the mailinglist, in case somebody wants to reply/add something. Florian |
From: Nathan M. <na...@ra...> - 2009-02-18 23:31:31
|
Is it possible to obtain the source code for IRIS? Thanks, Nathan Marz |
From: Nathan M. <na...@ra...> - 2009-02-18 19:23:15
|
Hello, I was taking a look at IRIS, and I can't figure out how to incorporate equality and arithmetic into a query. (This is probably a basic logic programming question more than anything else). Can you give an example program that uses equality and arithmetic? For example, I tried to do something like the following: man('joe'). woman('alice'). funky(?x) = 5 :- man(?x). funky(?x) = 7 :- woman(?x). ?-funky(?y) = 5. However, nothing gets printed out. I also tried: man('joe'). woman('alice'). funky(?x) = 5 :- man(?x). funky(?x) = 7 :- woman(?x). isFunky(?x) :- funky(?x) < 6. ?-isFunky(?x). This time, I got an "unlimited variable" error. What am I doing wrong? Thanks, Nathan Marz |
From: Florian F. <flo...@st...> - 2009-02-02 12:13:41
|
Hi, first of all thanks for your interest in Iris. We highly appreciate any feedback. First of all, there is a user's guide which should cover some of your questions and provide an overview. http://www.iris-reasoner.org/pages/user_guide.pdf It also describes the steps needed to use custom predicates/built-ins in Section 6. For small Java examples I can point you to two places: 1.) In the /app directory of the source version you can find several examples that show how to use Iris, including a GUI/Command line tool to play with. 2.) In the /test directory of the source (org.deri.iris.functional) there are short test cases that show how to use Iris with different configurations (i.e. in Helper.java - executeAndCheckReslts(...) ) I hope this is helpful. Best, Florian Jeffrey Straszheim wrote: > Hi, > > I am evaluating Iris. Is there any simple code examples for building > queries directly from Java, and executing them? > > Also, is is possible to construct arbitrary predicates (as Java > functions) and include them in your rules? If so, can you point me to a > code example? > > Thanks in advance, > > Jeffrey Straszheim > > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by: > SourcForge Community > SourceForge wants to tell your story. > http://p.sf.net/sfu/sf-spreadtheword > _______________________________________________ > iris-reasoner-support mailing list > iri...@li... > https://lists.sourceforge.net/lists/listinfo/iris-reasoner-support |
From: Jeffrey S. <sti...@ea...> - 2009-01-31 18:07:29
|
Hi, I am evaluating Iris. Is there any simple code examples for building queries directly from Java, and executing them? Also, is is possible to construct arbitrary predicates (as Java functions) and include them in your rules? If so, can you point me to a code example? Thanks in advance, Jeffrey Straszheim |
From: Federico M. F. <fed...@st...> - 2008-12-30 19:56:50
|
Things are getting funnier. The violation is not always happening.... maybe something that remains dirty in memory. Federico M. Facca wrote: > Hi, > me and Srdjan have updated the wsmx-choreography to use the new reasoner. > now using previous running tests, I am getting some message like: > Consitency Violation detected! (first: Minimum cardinality violation > on instance ... > > from what I can see ontologies are correct... so it must be something > in the reasoner. > > I am sending you the ontology set. > > Best, > Federico > > -- > ------------------------------------------------------------------------ > *Federico M. Facca > * > STI Innsbruck > Leopold-Franzens-Universität Innsbruck > ICT Technologiepark, Technikerstrasse 21a > 6020 Innsbruck, Austria > > T +43 (0) 512 507 6460 > M +43 (0) 664 163 5077 > F +43 (0) 512 507 9872 > E fed...@st... <mailto:fed...@st...> > W www.sti-innsbruck.at <http://www.sti-innsbruck.at> > ------------------------------------------------------------------------ -- ------------------------------------------------------------------------ *Federico M. Facca * STI Innsbruck Leopold-Franzens-Universität Innsbruck ICT Technologiepark, Technikerstrasse 21a 6020 Innsbruck, Austria T +43 (0) 512 507 6460 M +43 (0) 664 163 5077 F +43 (0) 512 507 9872 E fed...@st... <mailto:fed...@st...> W www.sti-innsbruck.at <http://www.sti-innsbruck.at> ------------------------------------------------------------------------ |
From: Barry B. <bar...@st...> - 2008-11-13 20:05:02
|
Hi Thomas, Thanks for your interest in IRIS! I've had a look at your program and have some comments. First of all, anything in quotes (single or double) is interpreted as a string. So these values won't give any results when used with arithmetic built-ins predicates. Numbers with no '.' are assumed to be integers and numbers with a '.' are double precision, i.e. java 'double' type. You can even be more specific by using constructors, e.g. _float(1.2), _decimal(3), etc. Assuming you want to use floating point numbers, I re-wrote your program to: database(1.0, 10.0, 100.0). database(2.0, 5.0, -10.0). score(?s, ?x1, ?x2) :- 3 * ?x1 =?wx1, 2 * ?x2 = ?wx2, ?wx1 + ?wx2 = ?s. ds(?id, ?s) :- database(?id, ?x1, ?x2), score(?s, ?x1, ?x2). ?-ds(?id, ?s). However, I'm not sure what you are trying to do. Certainly, the rule with "score(?s, ?x1, ?x2)" in the head is un-safe (unbound head variables). IRIS can be configured to handle un-safe rules, however, but it seems you are trying to 'pass' values for ?x1 and ?x2 and 'return' something for ?s, i.e. use score() like a function call. This may be possible in proper logic programming, but sadly not so in simple'ish Datalog. However, if you combine the two rules: database(1.0, 10.0, 100.0). database(2.0, 5.0, -10.0). ds(?id, ?s) :- database(?id, ?x1, ?x2), 3 * ?x1 =?wx1, 2 * ?x2 = ?wx2, ?wx1 + ?wx2 = ?s. ?-ds(?id, ?s). Then you get rid of the unsafe rule and this computes quite nicely: Query: ?- ds(?id, ?s). ==>> 2 rows in 0ms Variables: ?id, ?s (1.0, 230.0) (2.0, -5.0) I hope this helps, barry -- Barry Bishop Senior Scientific Programmer Semantic Technology Institute (STI) University of Innsbruck, Austria ----------------------------------- E-Mail: bar...@st... Tel: +43 512 507 96873 ----------------------------------- Thomas TRIPLET wrote: > Hello all ! > > I need to use Datalog and I found IRIS which looks like it is exactly > what I am looking for. > > I'm kinda struggling with the syntax though. this should work but does not: > > database('1', '10', '100'). database('2', '5', '-10'). score(?s, ?x1, > ?x2) :- 3 * ?x1 =?wx1, 2 * ?x2 = ?wx2, ?wx1 + ?wx2 = ?s. ds(?id, ?s) :- > database(?id, ?x1, ?x2), score(?s, ?x1, ?x2). ?-ds(?id, ?s). > > I > have a database with an id and 2 values for each. I need to computer a weighted sum of those values for each id and return the sum. > But for some reason, this doesn't work. It's working with another Datalog interpreter (MLPQ) so I am not sure what I am missing here. > > By the way does anyone know if IRIS uses double or simple precision for numbers? > > > Thanks for any input! > Thomas > > -- > Thomas Triplet > PhD student - Bioinformatics > Computer Science and Engineering Department > University of Nebraska - Lincoln, USA > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > > > ------------------------------------------------------------------------ > > _______________________________________________ > iris-reasoner-support mailing list > iri...@li... > https://lists.sourceforge.net/lists/listinfo/iris-reasoner-support |
From: Thomas T. <tho...@gm...> - 2008-11-13 17:31:11
|
Hello all ! I need to use Datalog and I found IRIS which looks like it is exactly what I am looking for. I'm kinda struggling with the syntax though. this should work but does not: database('1', '10', '100'). database('2', '5', '-10'). score(?s, ?x1, ?x2) :- 3 * ?x1 =?wx1, 2 * ?x2 = ?wx2, ?wx1 + ?wx2 = ?s. ds(?id, ?s) :- database(?id, ?x1, ?x2), score(?s, ?x1, ?x2). ?-ds(?id, ?s). I have a database with an id and 2 values for each. I need to computer a weighted sum of those values for each id and return the sum. But for some reason, this doesn't work. It's working with another Datalog interpreter (MLPQ) so I am not sure what I am missing here. By the way does anyone know if IRIS uses double or simple precision for numbers? Thanks for any input! Thomas -- Thomas Triplet PhD student - Bioinformatics Computer Science and Engineering Department University of Nebraska - Lincoln, USA |
From: Barry B. <bar...@st...> - 2008-10-19 20:00:44
|
Hi Murat, I'll do my best to answer these, but I ma not an expert on magic sets. Murat Knecht wrote: > Hi all, > > once more, I have come up with some questions. Currently, I am looking > at the magic set implementation, so the questions mostly concern it. > > 1. Conjunctive queries > The following rules give different adorned predicates, since the order > of predicates in this case determines the adornments. In the following > example, the first rule (with the given query) produces four, while the > second rule produces just two adorned predicates of anc/2. > > anc(?x,?z) :- anc(?x,?y), par(?y,?z). // 1. > anc(?x,?z) :- par(?x,?y), anc(?y,?z). // 2. > ?-anc(?x, 'l3-1'), anc(?x, 'l3-2'). > > The difference between rule 1 and 2 in respect to the query ought to be > nullified by the SIP, which resides over the order of evaluation, right? Not sure. If the rule body predicates have a different order, then I would expect different bindings and therefore adornments. > 2. AdornedProgram.createAdornedRules(Collection, IQuery) > The method assumes there to be exactly one literal: > > final ILiteral head_literal = rule.getHead().get(0); > // ... > adorned_rule = adorned_rule.replaceHeadLiteral(head_literal, > adorned_predicate); > > Why is this? replaceHeadLiteral() could easily support more. > Additionally, this generates a java.lang.IllegalArgumentException: > > anc(?x,?y),blub(?y) :- anc(?y,?x). > ?-anc('l1-1', ?z). The reason that the object model for rules allow multiple head predicates, is that we wanted to leave open the possibility that we *might* one day extend IRIS to be a disjunctive Datalog reasoner. Multiple rule body predicates are interpreted as being conjunctive, whereas multiple head predicates (at least in Datalog type scenarios) are interpreted as being disjunctive. If a conjunctive rule head is required, one only needs two rules with the same body, but different heads. Disjunctive rule heads is a whole new ball game, as it were. So to answer your question, some algorithms make perfect sense for rules with one or more rule head predicates, but some do not. At the moment, IRIS does not allow it. > 3. AdornedProgram.createAdornedRules(Collection,IQuery) > Just a small coding question. With > final Set<AdornedPredicate> predicatesToProcess = new > HashSet<AdornedPredicate>(); > you simulate a queue. Why not just use one? Good question. It is used like a queue, but not quite, because the order of a set is determined to some degree by the hash code of its elements. This is basically a rather suspect (but probably harmless) implementation detail. A queue, list or something simpler would be more appropriate. > 4. Bug in OptimisedProgramStrategyAdaptor.evaluateQuery(IQuery, List) ? > While applying optimizations, you iterate through the configured > optimizers. In my understanding, each optimizer gets the results of the > previous optimizations, i.e. rules and the query for which the rules are > being optimized, as in the case of magic sets. But in the crucial line, > you always fall back to the original rules (mRules) - though using the > possibly previously optimized query. > > IProgramOptimisation.Result result = > optimisation.optimise( mRules, query ); > > Is this as intended? > As far as I understand this, it probably never posed a problem, as there > is but one optimization available, the magic sets. I looks very much like a bug to me. Thanks! > 5. You often impose the limitation of rules having at most one head > literal. While queries with more predicates are simply conjunctively > connected (as they are a rule without head), are rules with multiple > disjunctively connected? I think I answered this already: Rule body literals are conjunctive Rule head literals are disjunctive* *but not allowed in IRIS (at the moment) > Thanks and hoping to hear from you soon. No problem. Thanks for your interest and for finding bugs for us! Get in touch whenever you have questions, barry |
From: Murat K. <mur...@st...> - 2008-10-19 15:35:57
|
Hi all, once more, I have come up with some questions. Currently, I am looking at the magic set implementation, so the questions mostly concern it. 1. Conjunctive queries The following rules give different adorned predicates, since the order of predicates in this case determines the adornments. In the following example, the first rule (with the given query) produces four, while the second rule produces just two adorned predicates of anc/2. anc(?x,?z) :- anc(?x,?y), par(?y,?z). // 1. anc(?x,?z) :- par(?x,?y), anc(?y,?z). // 2. ?-anc(?x, 'l3-1'), anc(?x, 'l3-2'). The difference between rule 1 and 2 in respect to the query ought to be nullified by the SIP, which resides over the order of evaluation, right? 2. AdornedProgram.createAdornedRules(Collection, IQuery) The method assumes there to be exactly one literal: final ILiteral head_literal = rule.getHead().get(0); // ... adorned_rule = adorned_rule.replaceHeadLiteral(head_literal, adorned_predicate); Why is this? replaceHeadLiteral() could easily support more. Additionally, this generates a java.lang.IllegalArgumentException: anc(?x,?y),blub(?y) :- anc(?y,?x). ?-anc('l1-1', ?z). 3. AdornedProgram.createAdornedRules(Collection,IQuery) Just a small coding question. With final Set<AdornedPredicate> predicatesToProcess = new HashSet<AdornedPredicate>(); you simulate a queue. Why not just use one? 4. Bug in OptimisedProgramStrategyAdaptor.evaluateQuery(IQuery, List) ? While applying optimizations, you iterate through the configured optimizers. In my understanding, each optimizer gets the results of the previous optimizations, i.e. rules and the query for which the rules are being optimized, as in the case of magic sets. But in the crucial line, you always fall back to the original rules (mRules) - though using the possibly previously optimized query. IProgramOptimisation.Result result = optimisation.optimise( mRules, query ); Is this as intended? As far as I understand this, it probably never posed a problem, as there is but one optimization available, the magic sets. 5. You often impose the limitation of rules having at most one head literal. While queries with more predicates are simply conjunctively connected (as they are a rule without head), are rules with multiple disjunctively connected? Thanks and hoping to hear from you soon. All the best, Murat |
From: Murat K. <mur...@st...> - 2008-09-09 21:47:39
|
Good Morning! Now, this *is* tricky, but I read the new validator code and I think I understand it (and it ought to do what you've explained below). Thanks for clearing this up. As I hinted at in an earlier mail, I am producing a documentation for v0.5.7, focusing on architecture and the algorithms - so it is very possible, that I have further questions. :) Also, if I find the time, I want to implement a IDataSource for a relational database, to be able to integrate RDBMS. In the head, there is no such thing yet. In this direction, there might be questions later, too. Btw, is your answer to 1) "yes"? Just to be sure ... Thanks, Murat Barry Bishop wrote: > Hi Murat, > > Thanks once again for your most helpful code inspection! > > Yes, this is clearly a bug and I have investigated, created unit tests > and fixed: > > See: > https://sourceforge.net/tracker/index.php?func=detail&aid=2101601&group_id=167309&atid=842434 > > It turns out to be surprisingly complicated to detect all variations of > equality (unification) with function symbols. Here is the behaviour that > is now supported: > > 1) All variables that appear in the rule head must be 'limited' > 2) A variable is limited if it appears in a positive ordinary literal > 3) A variable is limited if it is the result of an arithmetic built-in > and all other terms are limited > 4) A variable is limited if it is equated with another limited variable > > (Now it gets tricky) > > 5) Positive equality with constructed terms where the two arguments > unify and the resulting variable mappings contain: > 5a) variable maps to ground term -> variable is limited > 5b) variable maps to another variable -> treated as equality of > variables, i.e. if one of these variables is limited elsewhere then the > other is also limited > 5c) variable maps to constructed term (with variables) -> variable is > limited if all variables present in the constructed term are limited > elsewhere > > I hope this helps. > > If you find any more peculiarities then please keep let me know. > > Thanks once again, > barry > > > > Murat Knecht wrote: > >> Greetings, yet again, >> >> I would like to understand some more about the coding in the >> RuleValidator. If you could clear things up, I'd appreciate it. >> >> 1. If a literal contains constructed terms, you disable the built-in >> handling, effectively treating the literal as a non-builtin. I assume >> this is, because the arithmetic deduction (configurable by >> mAllowArithmeticPredicatesToImplyLimited) does not work with function >> symbols anyway. For example, it is hard to see where ADD(2, f(2,3), ?x) >> implies anything but an EvaluationException. So, these situations either >> trigger an UnsafeRuleException in the RuleValidator, or an >> EvaluationException later on, when the built-in is fed the function >> symbol. Is this train of thought correct? >> >> 2. If so, what about EQUAL, which does support function symbols >> (according to its documentation, anyways)? It does support computing the >> missing term, too, so I assume it is basically collateral damage as this >> scenario is not considered? >> >> Thanks, >> Murat >> >> >> >> ------------------------------------------------------------------------- >> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge >> Build the coolest Linux based applications with Moblin SDK & win great prizes >> Grand prize is a trip for two to an Open Source event anywhere in the world >> http://moblin-contest.org/redirect.php?banner_id=100&url=/ >> _______________________________________________ >> iris-reasoner-support mailing list >> iri...@li... >> https://lists.sourceforge.net/lists/listinfo/iris-reasoner-support >> > > |
From: Murat K. <mur...@st...> - 2008-09-08 20:25:49
|
Greetings, yet again, I would like to understand some more about the coding in the RuleValidator. If you could clear things up, I'd appreciate it. 1. If a literal contains constructed terms, you disable the built-in handling, effectively treating the literal as a non-builtin. I assume this is, because the arithmetic deduction (configurable by mAllowArithmeticPredicatesToImplyLimited) does not work with function symbols anyway. For example, it is hard to see where ADD(2, f(2,3), ?x) implies anything but an EvaluationException. So, these situations either trigger an UnsafeRuleException in the RuleValidator, or an EvaluationException later on, when the built-in is fed the function symbol. Is this train of thought correct? 2. If so, what about EQUAL, which does support function symbols (according to its documentation, anyways)? It does support computing the missing term, too, so I assume it is basically collateral damage as this scenario is not considered? Thanks, Murat |