diff --git a/nars_core/nars/entity/Sentence.java b/nars_core/nars/entity/Sentence.java index ec988a02ae48bd3bb531e310bd9ab8e896bcb6f7..b49d13be78d23d5e4e0ad36ce36dc609ecb1ce55 100644 --- a/nars_core/nars/entity/Sentence.java +++ b/nars_core/nars/entity/Sentence.java @@ -110,7 +110,7 @@ public class Sentence<T extends Term> implements Cloneable, Serializable { //refined: int u = 0; while(c.term[c.term.length-1-u] instanceof Interval) { - time += ((Interval)c.term[c.term.length-1]).time; + time += ((Interval)c.term[c.term.length-1-u]).time; u++; } @@ -123,6 +123,24 @@ public class Sentence<T extends Term> implements Cloneable, Serializable { if(!c.isSpatial && stamp!=null && stamp.getOccurrenceTime() != Stamp.ETERNAL) stamp.setOccurrenceTime(stamp.getOccurrenceTime()-time); } + if(c.term[0] instanceof Interval) { + long time=0; + //refined: + int u = 0; + while(c.term[u] instanceof Interval) { + time += ((Interval)c.term[u]).time; + u++; + } + + Term[] term2=new Term[c.term.length-u]; + System.arraycopy(c.term, u, term2, 0, term2.length); + _content=(T) Conjunction.make(term2, c.getTemporalOrder(), c.isSpatial); + //ok we removed a part of the interval, we have to transform the occurence time of the sentence back + //accordingly + + if(!c.isSpatial && stamp!=null && stamp.getOccurrenceTime() != Stamp.ETERNAL) + stamp.setOccurrenceTime(stamp.getOccurrenceTime()+time); + } } } } diff --git a/nars_core/nars/inference/CompositionalRules.java b/nars_core/nars/inference/CompositionalRules.java index 1b2e8b222b5d5f3429112248a6240e89567734c2..64858e97dea36219a2e179af482a452181bd1fab 100644 --- a/nars_core/nars/inference/CompositionalRules.java +++ b/nars_core/nars/inference/CompositionalRules.java @@ -300,7 +300,7 @@ public final class CompositionalRules { long occurrence_time = nal.getTheNewStamp().getOccurrenceTime(); if(isTemporalConjunction && (compound.getTemporalOrder() == TemporalRules.ORDER_FORWARD)) { if(!nal.getCurrentTask().sentence.isEternal() && compound.term[index + 1] instanceof Interval) { - long shift_occurrence = ((Interval)compound.term[1]).time; + long shift_occurrence = ((Interval)compound.term[index + 1]).time; occurrence_time = nal.getCurrentTask().sentence.getOccurenceTime() + shift_occurrence; } } diff --git a/nars_core/nars/inference/RuleTables.java b/nars_core/nars/inference/RuleTables.java index ea6079a1a5cb0402976227db585323598638fcf2..a896c74e1996605e47194fa435b6d4da2c64ff89 100644 --- a/nars_core/nars/inference/RuleTables.java +++ b/nars_core/nars/inference/RuleTables.java @@ -829,10 +829,12 @@ public class RuleTables { if (task.sentence.isJudgment()) { if (statement instanceof Inheritance) { StructuralRules.structuralCompose1(compound, index, statement, nal); - if (!(compound instanceof SetExt || compound instanceof SetInt || compound instanceof Negation)) { + if (!(compound instanceof SetExt || compound instanceof SetInt || compound instanceof Negation + || compound instanceof Conjunction || compound instanceof Disjunction)) { StructuralRules.structuralCompose2(compound, index, statement, side, nal); } // {A --> B, A @ (A&C)} |- (A&C) --> (B&C) - } else if ((statement instanceof Similarity) && !(compound instanceof Conjunction)) { + } else if (!(compound instanceof SetExt || compound instanceof SetInt || compound instanceof Negation + || compound instanceof Conjunction || compound instanceof Disjunction)) { StructuralRules.structuralCompose2(compound, index, statement, side, nal); } // {A <-> B, A @ (A&C)} |- (A&C) <-> (B&C) } diff --git a/nars_core/nars/inference/SyllogisticRules.java b/nars_core/nars/inference/SyllogisticRules.java index 7366bc4075b04da8a5785008b5eec916aaa5d304..33bdb7bf5aca6446144d0ee51118c05ea20d787a 100644 --- a/nars_core/nars/inference/SyllogisticRules.java +++ b/nars_core/nars/inference/SyllogisticRules.java @@ -181,29 +181,29 @@ public final class SyllogisticRules { return true; //no need for other syllogistic inference, it were sensational terms, } //but it would not hurt to allow it either.. but why afford tasks that summarize //so little evidence in comparison to the amount summarized by the array comparison. - long delta2 = 0; - while ((term2 instanceof Conjunction) && (((CompoundTerm) term2).term[0] instanceof Interval)) { + long occurrence_time2 = nal.getTheNewStamp().getOccurrenceTime(); + while (occurrence_time2!=Stamp.ETERNAL && (term2 instanceof Conjunction) && (((CompoundTerm) term2).term[0] instanceof Interval)) { Interval interval = (Interval) ((CompoundTerm) term2).term[0]; - delta2 += interval.time; + occurrence_time2 += interval.time; term2 = ((CompoundTerm)term2).setComponent(0, null, nal.mem()); } - long delta1 = 0; - while ((term1 instanceof Conjunction) && (((CompoundTerm) term1).term[0] instanceof Interval)) { + long occurrence_time1 = nal.getTheNewStamp().getOccurrenceTime(); + while (occurrence_time1!=Stamp.ETERNAL && (term1 instanceof Conjunction) && (((CompoundTerm) term1).term[0] instanceof Interval)) { Interval interval = (Interval) ((CompoundTerm) term1).term[0]; - delta1 += interval.time; + occurrence_time1 += interval.time; term1 = ((CompoundTerm)term1).setComponent(0, null, nal.mem()); } if (order != ORDER_INVALID) { - nal.getTheNewStamp().setOccurrenceTime(delta1); + nal.getTheNewStamp().setOccurrenceTime(occurrence_time1); nal.doublePremiseTask( Statement.make(taskContent, term1, term2, order), truth1, budget1,false, false); - nal.getTheNewStamp().setOccurrenceTime(delta2); + nal.getTheNewStamp().setOccurrenceTime(occurrence_time2); nal.doublePremiseTask( Statement.make(taskContent, term2, term1, reverseOrder(order)), truth2, budget2,false, false); - nal.getTheNewStamp().setOccurrenceTime(delta1); + nal.getTheNewStamp().setOccurrenceTime(occurrence_time1); nal.doublePremiseTask( Statement.makeSym(taskContent, term1, term2, order), truth3, budget3,false, false); diff --git a/nars_core/nars/language/Interval.java b/nars_core/nars/language/Interval.java index c0242f450707cbb92b5f8e7276d7d4eb95ecee63..722bcdf6d4461b3f720828c55a39a1bd7f149479 100644 --- a/nars_core/nars/language/Interval.java +++ b/nars_core/nars/language/Interval.java @@ -29,7 +29,7 @@ import nars.io.Symbols; public class Interval extends Term { public static Interval interval(final String i) { - return new Interval( Long.parseLong(i.substring(1)) - 1); + return new Interval(Long.parseLong(i.substring(1))); } @Override diff --git a/nars_core/nars/main/Plugins.java b/nars_core/nars/main/Plugins.java index 9a947fd4e8b9966fc4648e3d2d0d4c33bd7314f0..fe10d9931ffa232e893243e5d3bd6f8e02c2afdf 100644 --- a/nars_core/nars/main/Plugins.java +++ b/nars_core/nars/main/Plugins.java @@ -21,8 +21,8 @@ public class Plugins { n.addPlugin(new Emotions()); n.addPlugin(new Anticipate()); // expect an event Term label = SetInt.make(new Term("bright")); - n.addSensoryChannel(label.toString(), - new VisionChannel(label, n, n, 30, 30)); + //n.addSensoryChannel(label.toString(), + // new VisionChannel(label, n, n, 30, 30)); boolean full_internal_experience = false; if(!full_internal_experience) { n.addPlugin(new InternalExperience());