Re: Date query question

2016-12-31 Thread Alexander Burger
Hi Bruno,

> A picolisp clone of VI? That sounds awesome! Please do write the article
> for the wiki.
> Also, where do I find the source code?

Both scheduled for January :)
- Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Date query question

2016-12-29 Thread Bruno Franco
Hi Alex.
A picolisp clone of VI? That sounds awesome! Please do write the article
for the wiki.
Also, where do I find the source code?

On Thu, Dec 29, 2016 at 2:31 AM, Alexander Burger 
wrote:

> On Wed, Dec 28, 2016 at 07:47:13PM -0500, Bruno Franco wrote:
> > This is a tangent on your conversation, but...
> > Alex, that graph looks so cool. Did you do it by hand or did you use some
> > juicy picolisp program that I can get my hands on?
>
> No, just with VI.
>
> In fact you are right, because it was a version of VI written in PicoLisp
> (called 'vip'), which is my standard editor now, and thus also the editor
> used
> by my 'mutt' mail client.
>
> I plan to write a wiki article about 'vip' soon.
>
> - Alex
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>


Re: Date query question

2016-12-28 Thread Alexander Burger
On Wed, Dec 28, 2016 at 07:47:13PM -0500, Bruno Franco wrote:
> This is a tangent on your conversation, but...
> Alex, that graph looks so cool. Did you do it by hand or did you use some
> juicy picolisp program that I can get my hands on?

No, just with VI.

In fact you are right, because it was a version of VI written in PicoLisp
(called 'vip'), which is my standard editor now, and thus also the editor used
by my 'mutt' mail client.

I plan to write a wiki article about 'vip' soon.

- Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Date query question

2016-12-28 Thread Bruno Franco
This is a tangent on your conversation, but...
Alex, that graph looks so cool. Did you do it by hand or did you use some
juicy picolisp program that I can get my hands on?

On Wed, Dec 28, 2016 at 5:45 AM, Alexander Burger 
wrote:

> On Wed, Dec 28, 2016 at 10:26:22AM +0100, Alexander Burger wrote:
> >(let Today (date)
> >   (collect 'sDate '+Proj (list Today Today) (list NIL T)) )
>
> The 'list' is of course not necessary:
>
>(collect 'sDate '+Proj (list Today Today) '(NIL T))
>
>
> But probably it is better anyway to scan both index parts in the same
> direction
> (upwards).
>
> Also, if I remember correctly, 'T' cannot be used for "infinite" here, the
> value
> for +UB trees must be a number or NIL (same as 0). So you can just use a
> number
> greater than any possible date, like (date 99) -> (2738 1 25)
>
>(collect 'sDate '+Proj (list NIL Today) (list Today 9))
>
> Sorry, nothing tested ;)
>
> - Alex
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>


Re: Date query question

2016-12-28 Thread Alexander Burger
On Wed, Dec 28, 2016 at 10:26:22AM +0100, Alexander Burger wrote:
>(let Today (date)
>   (collect 'sDate '+Proj (list Today Today) (list NIL T)) )

The 'list' is of course not necessary:

   (collect 'sDate '+Proj (list Today Today) '(NIL T))


But probably it is better anyway to scan both index parts in the same direction
(upwards).

Also, if I remember correctly, 'T' cannot be used for "infinite" here, the value
for +UB trees must be a number or NIL (same as 0). So you can just use a number
greater than any possible date, like (date 99) -> (2738 1 25)

   (collect 'sDate '+Proj (list NIL Today) (list Today 9))

Sorry, nothing tested ;)

- Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Date query question

2016-12-28 Thread Alexander Burger
On Tue, Dec 27, 2016 at 10:52:51PM +0100, Henrik Sarvell wrote:
> ## We want all projects that are NOT outside of the range, ie:
> ## 1.) End date is lower than the start date of the range.
> ## 2.) Start date is higher than the end date of the range.
> ## Therefore we generate all projects whose:
> ## 1.) Start date is smaller than the end date of the range.
> ## 2.) End date is larger than the start date of the range.
> ... 
> The above works, tested 100%, it looks like it's going to scan the whole
> database though in the generate clauses, which means collect on id with
> subsequent list filter is probably just as fast, or perhaps not?

Right. And that is the problem! You always end up scanning the whole DB.

You could try to improve the situation somewhat by assuming a maximal project
length, so that you don't need to scan from -infinite till +infinite. But this
is not really satisfactory.


That's why I think there is no way around +UB trees. They give a single index to
traverse, so you avoid having to AND two separate open-ended ranges. You get the
exact hits directly from the scan / collect.

As I said, the start date S and the end date E are coordinates in a
2-dimensional space. A project is a point in that space:


^ S
|   /
|  /
| /
|/
|   /
|  /
| /
|/
|   /
|  /
| /
|/
  --+--> E
   /|
  / |
 /  |
/   |
   /|
  / |X
 /  |
/   |
   /|
  / |
 /  |
/   |


If we assume that E >= S, then all legal projects will be right/below the
diagonal line (today is S = 0 and E = 0). All projects which start today or
earlier, AND end today or later (i.e. the ones you want to collect) must lie in
quadrant X.

So to collect all projects which have sDate <= today AND eDate >= today

   (let Today (date)
  (collect 'sDate '+Proj (list Today Today) (list NIL T)) )

Won't that work?

- Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Date query question

2016-12-27 Thread Henrik Sarvell
Yes, like I thought, so I doubt that it will be an improvement over the
current state which looks like this:

## We want all projects that are NOT outside of the range, ie:
## 1.) End date is lower than the start date of the range.
## 2.) Start date is higher than the end date of the range.
## Therefore we generate all projects whose:
## 1.) Start date is smaller than the end date of the range.
## 2.) End date is larger than the start date of the range.
(dm getCurrent> (Sdate Edate)
   (solve
  (quote
 @Rng1 (cons NIL Edate)# The first range
 @Rng2 (cons Sdate T)  # The second range
 (select (@Proj)
((sDate +Proj @Rng1) (eDate +Proj @Rng2)) # Search two indexes
in parallel
(range @Rng1 @Proj sDate)  # Check ranges
(range @Rng2 @Proj eDate) ) )
  @Proj ) )

The above works, tested 100%, it looks like it's going to scan the whole
database though in the generate clauses, which means collect on id with
subsequent list filter is probably just as fast, or perhaps not?




On Tue, Dec 27, 2016 at 8:27 AM, Alexander Burger 
wrote:

> On Mon, Dec 26, 2016 at 11:19:02PM +0100, Henrik Sarvell wrote:
> > If I do the relations with the +UB index and put 2016-10-01 as the start
> > date and 2016-10-20 as the end date for a specific project, do I get that
> > project in my result set if I do the collect with sdate 2016-10-15 and
> end
> > date 2016-11-15?
>
> > > >(rel sDate (+UB +Aux +Ref +Date) (eDate))
> > > >(rel eDate (+Date))
> > > >
> > > > Then a 'collect' would find the range directly:
> > > >
> > > >(collect 'sDate '+Proj (list Sdate Sdate) (list Edate Edate))
>
> No. Consider eDate and sDate as coordinates in a 2-dimensional space,
> where a
> project is a point in that space.
>
> So you need to collect all projects with sDate at least in the range
> (2016-10-01 . 2016-10-01) and eDate at least in the range
> (2016-10-20 . 2016-10-20) to include the above project.
>
> A collection with the ranges (2016-10-1 . 2016-10-31) and (2016-11-1 .
> 2016-11-30), for example, would return all projects which started in
> October AND
> ended in November 2016.
>
> The ranges are inclusive btw.
>
> - Alex
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>


Re: Date query question

2016-12-26 Thread Alexander Burger
On Mon, Dec 26, 2016 at 11:19:02PM +0100, Henrik Sarvell wrote:
> If I do the relations with the +UB index and put 2016-10-01 as the start
> date and 2016-10-20 as the end date for a specific project, do I get that
> project in my result set if I do the collect with sdate 2016-10-15 and end
> date 2016-11-15?

> > >(rel sDate (+UB +Aux +Ref +Date) (eDate))
> > >(rel eDate (+Date))
> > >
> > > Then a 'collect' would find the range directly:
> > >
> > >(collect 'sDate '+Proj (list Sdate Sdate) (list Edate Edate))

No. Consider eDate and sDate as coordinates in a 2-dimensional space, where a
project is a point in that space.

So you need to collect all projects with sDate at least in the range
(2016-10-01 . 2016-10-01) and eDate at least in the range
(2016-10-20 . 2016-10-20) to include the above project.

A collection with the ranges (2016-10-1 . 2016-10-31) and (2016-11-1 .
2016-11-30), for example, would return all projects which started in October AND
ended in November 2016.

The ranges are inclusive btw.

- Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Date query question

2016-12-26 Thread Henrik Sarvell
If I do the relations with the +UB index and put 2016-10-01 as the start
date and 2016-10-20 as the end date for a specific project, do I get that
project in my result set if I do the collect with sdate 2016-10-15 and end
date 2016-11-15?


On Mon, Dec 12, 2016 at 1:01 PM, Alexander Burger 
wrote:

> On Mon, Dec 12, 2016 at 11:12:22AM +0100, Henrik Sarvell wrote:
> > This looks like the one I need, I want all projects whose date range
> > has any kind of overlap with the given date range.
>
> How do you think about the '+UB' tree solution I suggested in my follow-up
> mail?
>
> >(class +Proj +Macropisobj)
> >...
> >(rel sDate (+UB +Aux +Ref +Date) (eDate))
> >(rel eDate (+Date))
> >
> > Then a 'collect' would find the range directly:
> >
> >(collect 'sDate '+Proj (list Sdate Sdate) (list Edate Edate))
>
> I think that is much more elegant and efficient.
>
> - Alex
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>


Re: Date query question

2016-12-12 Thread Alexander Burger
On Mon, Dec 12, 2016 at 11:12:22AM +0100, Henrik Sarvell wrote:
> This looks like the one I need, I want all projects whose date range
> has any kind of overlap with the given date range.

How do you think about the '+UB' tree solution I suggested in my follow-up mail?

>(class +Proj +Macropisobj)
>...
>(rel sDate (+UB +Aux +Ref +Date) (eDate))
>(rel eDate (+Date))
> 
> Then a 'collect' would find the range directly:
> 
>(collect 'sDate '+Proj (list Sdate Sdate) (list Edate Edate))

I think that is much more elegant and efficient.

- Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Date query question

2016-12-12 Thread Henrik Sarvell
This looks like the one I need, I want all projects whose date range
has any kind of overlap with the given date range.

Thanks, will try it!

On Thu, Nov 17, 2016 at 4:10 PM, Alexander Burger  wrote:
> Hi Henrik,
>
>> (class +Proj +Macropisobj)
>> (rel id (+Key +Number))
>> (rel nm (+Ref +String))
>> (rel sDate (+Ref +String))
>> (rel eDate (+Ref +String))
>>
>> (dm getCurrent> (Sdate Edate)
>>(filter '((P) (or
>> (< Sdate (; P sDate) Edate)
>> (< Sdate (; P eDate) Edate)
>> (< Sdate (; P sDate) (; P eDate) Edate) ) )
>>   (collect 'id This) ) )
>> ...
>> But how would the above problem be solved with Pilog and select if we have
>> more than "a couple of hundred objects" in the database?
>
> If you know that the *result* will be within a few hundred hits (not the
> total DB size), and the difference between start and end is less than
> e.g. 100 days, then you could first restrict the collection a bit
>
>(collect 'sDate '+Proj Sdate (+ Edate 100))
>
> (works of course only for +Date types), and then filter that further.
> This is surely the most efficient way for a small set of results.
>
>
> The same you can do in Pilog with the 'db' predicate for an larger
> result set, and if you want to avoid a 'select'
>
>(? @Rng (cons Sdate (+ Edate 100))
>   (db sDate +Proj @Rng @Proj) )
>
>
> But 'select' is the most general - and on big data sets perhaps the most
> efficient - way. You could try
>
>(?
>   @Sdate (cons Sdate T)  # Range with open end
>   @Edate (cons Edate NIL)# Reversed range with open start
>   (select (@Proj)
>  ((sDate +Proj @Sdate) (eDate +Proj @Edate))  # Search two indexes in 
> parallel
>  (range @Sdate @Proj sDate)   # Check ranges
>  (range @Edate @Proj eDate) ) )   # Check ranges
>
> I haven't tested this ;)
>
> ♪♫ Alex
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Date query question

2016-11-17 Thread Alexander Burger
Another possibility (which I mentioned initially when we discussed this in IRC)
is to use a 2-dimensional UB-Tree index. This would be the most efficient way,
both in speed and in size (only a single index is required).

   (class +Proj +Macropisobj)
   ...
   (rel sDate (+UB +Aux +Ref +Date) (eDate))
   (rel eDate (+Date))

Then a 'collect' would find the range directly:

   (collect 'sDate '+Proj (list Sdate Sdate) (list Edate Edate))

♪♫ Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Date query question

2016-11-17 Thread Alexander Burger
On Thu, Nov 17, 2016 at 04:10:32PM +0100, Alexander Burger wrote:
>(?
>   @Sdate (cons Sdate T)  # Range with open end
>   @Edate (cons Edate NIL)# Reversed range with open start
>   (select (@Proj)
>  ((sDate +Proj @Sdate) (eDate +Proj @Edate))  # Search two indexes in 
> parallel
>  (range @Sdate @Proj sDate)   # Check ranges
>  (range @Edate @Proj eDate) ) )   # Check ranges

Sorry, that's probably wrong. You want both start and end to be in the
range, right? Then better:

   (?
  @Rng (cons Sdate Edate)# Range
  (select (@Proj)
 ((sDate +Proj @Rng) (eDate +Proj @Rng))  # Search two indexes in 
parallel
 (range @Rng @Proj sDate) # Check ranges
 (range @Rng @Proj eDate) ) ) # Check ranges

The corresponding 'collect' would be

   (filter
  '((This)
 (and
(>= Edate (: sDate) Sdate)
(>= Edate (: eDate) Sdate) ) )
  (collect 'sDate '+Proj Sdate (+ Edate 100)) )

Again, not tested!

♪♫ Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Date query question

2016-11-17 Thread Alexander Burger
Hi Joe,

> For my own curiosity, should Pilog perform much better than a
> collect/filter? I would think that collect/filter should be nearly
> instant on upwards of a few thousand items (untested). When the data

Yes, I would say so too. And for larger results sets, or if multiple
indexes are involved where you don't know which one will give the best
hits, 'select' is better.


> psuedocode:
> 
> (let
>(Started (collect 'sDate '+Proj Sdate)  # find project started
> after the S date
> Ended (collect 'eDate '+Proj "1900-01-01" Edate) # find projects
> ended before the end date
> StartedBefore (collect 'sDate '+Proj "1900-01-01" Sdate) #
> projects with start date before range
> EndedAfter (collect 'eDate '+Proj Edate) # projects with end date
> after the range
> 
> 
> With this approach, the various sets would be tested and duplicates removed
> 
> maybe something like this
> 
> (uniq Started Ended (sect StartedBefore EndedAfter))
> ..
> 
> I might have the logic wrong, but I would wonder if that's faster than
> just hitting all the entries and filtering with a typical use case

I would say that multiple 'collect's, followed by merging and uniq'ing,
are more expensive.

♪♫ Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Date query question

2016-11-17 Thread Alexander Burger
Hi Henrik,

> (class +Proj +Macropisobj)
> (rel id (+Key +Number))
> (rel nm (+Ref +String))
> (rel sDate (+Ref +String))
> (rel eDate (+Ref +String))
> 
> (dm getCurrent> (Sdate Edate)
>(filter '((P) (or
> (< Sdate (; P sDate) Edate)
> (< Sdate (; P eDate) Edate)
> (< Sdate (; P sDate) (; P eDate) Edate) ) )
>   (collect 'id This) ) )
> ...
> But how would the above problem be solved with Pilog and select if we have
> more than "a couple of hundred objects" in the database?

If you know that the *result* will be within a few hundred hits (not the
total DB size), and the difference between start and end is less than
e.g. 100 days, then you could first restrict the collection a bit

   (collect 'sDate '+Proj Sdate (+ Edate 100))

(works of course only for +Date types), and then filter that further.
This is surely the most efficient way for a small set of results.


The same you can do in Pilog with the 'db' predicate for an larger
result set, and if you want to avoid a 'select'

   (? @Rng (cons Sdate (+ Edate 100))
  (db sDate +Proj @Rng @Proj) )


But 'select' is the most general - and on big data sets perhaps the most
efficient - way. You could try

   (?
  @Sdate (cons Sdate T)  # Range with open end
  @Edate (cons Edate NIL)# Reversed range with open start
  (select (@Proj)
 ((sDate +Proj @Sdate) (eDate +Proj @Edate))  # Search two indexes in 
parallel
 (range @Sdate @Proj sDate)   # Check ranges
 (range @Edate @Proj eDate) ) )   # Check ranges

I haven't tested this ;)

♪♫ Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Date query question

2016-11-17 Thread Joe Bogner
Henrik, thanks for sharing. Interesting question!

> I can fairly trivially do a collect and then a filter on the results of the
> collect as shown above.
>
> But how would the above problem be solved with Pilog and select if we have
> more than "a couple of hundred objects" in the database?
>

For my own curiosity, should Pilog perform much better than a
collect/filter? I would think that collect/filter should be nearly
instant on upwards of a few thousand items (untested). When the data
starts to get massive, indexes could theoretically help. Working
through the logic, it seems like the various indexes would have to be
hit a few times at least

psuedocode:

(let
   (Started (collect 'sDate '+Proj Sdate)  # find project started
after the S date
Ended (collect 'eDate '+Proj "1900-01-01" Edate) # find projects
ended before the end date
StartedBefore (collect 'sDate '+Proj "1900-01-01" Sdate) #
projects with start date before range
EndedAfter (collect 'eDate '+Proj Edate) # projects with end date
after the range


With this approach, the various sets would be tested and duplicates removed

maybe something like this

(uniq Started Ended (sect StartedBefore EndedAfter))
..

I might have the logic wrong, but I would wonder if that's faster than
just hitting all the entries and filtering with a typical use case
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Date query question

2016-11-17 Thread Rafik NACCACHE
All right, but shall you need some auto-scheduling, to YU know where to
look!

Le 17 nov. 2016 12:54 PM, "Henrik Sarvell"  a écrit :

> Hi Rafik,
>
> Nice stuff, but I don't need that magic, the goal here is simply adding
> humans to projects and displaying the schedule to see who might be
> available to do new stuff at some point in time.
>
>
>
>
>
> On Thu, Nov 17, 2016 at 12:15 PM, Rafik NACCACHE  > wrote:
>
>> HEy Henrik,
>>
>> Not related by U wrote a project scheduling library and a tasks parser
>> for natural language in Clojure,
>>
>> You might want to take a look on it here:
>>
>> https://github.com/turbopape/milestones
>>
>> There is one online dome here:
>> http://turbopape.github.io/milestones/
>>
>> I'll be happy if you can review it (and why not, leave a star on it :) )
>>
>> If you want any explanationa on the scheduling algorihtm, I'll be more
>> than happy to discuss it with you !
>>
>> Cheers,
>>
>> Rafik
>>
>> 2016-11-17 12:05 GMT+01:00 Henrik Sarvell :
>>
>>> Hi list,
>>>
>>> I'm trying to build a project scheduler / planner.
>>>
>>> This is the E/R for a project:
>>>
>>> (class +Proj +Macropisobj)
>>> (rel id (+Key +Number))
>>> (rel nm (+Ref +String))
>>> (rel sDate (+Ref +String))
>>> (rel eDate (+Ref +String))
>>>
>>> (dm getCurrent> (Sdate Edate)
>>>(filter '((P) (or
>>> (< Sdate (; P sDate) Edate)
>>> (< Sdate (; P eDate) Edate)
>>> (< Sdate (; P sDate) (; P eDate) Edate) ) )
>>>   (collect 'id This) ) )
>>>
>>> I haven't decided on whether or not to use +Date yet so the above dates
>>> are on the "Y-m-d" format currently.
>>>
>>> I need to find all projects which are active during a certain time
>>> period, for instance between 2016-11-01 and 2016-12-31.
>>>
>>> Logically that means finding all projects which have either a start date
>>> or an end date in the period OR all projects with a start date before the
>>> range that also have an end date after the range.
>>>
>>> I can fairly trivially do a collect and then a filter on the results of
>>> the collect as shown above.
>>>
>>> But how would the above problem be solved with Pilog and select if we
>>> have more than "a couple of hundred objects" in the database?
>>>
>>>
>>>
>>
>>
>> --
>>
>>
>> [image: --]
>>
>> Rafik Naccache
>> [image: https://]about.me/rafik_naccache
>>
>> 
>>
>
>


Re: Date query question

2016-11-17 Thread Henrik Sarvell
Hi Rafik,

Nice stuff, but I don't need that magic, the goal here is simply adding
humans to projects and displaying the schedule to see who might be
available to do new stuff at some point in time.





On Thu, Nov 17, 2016 at 12:15 PM, Rafik NACCACHE 
wrote:

> HEy Henrik,
>
> Not related by U wrote a project scheduling library and a tasks parser for
> natural language in Clojure,
>
> You might want to take a look on it here:
>
> https://github.com/turbopape/milestones
>
> There is one online dome here:
> http://turbopape.github.io/milestones/
>
> I'll be happy if you can review it (and why not, leave a star on it :) )
>
> If you want any explanationa on the scheduling algorihtm, I'll be more
> than happy to discuss it with you !
>
> Cheers,
>
> Rafik
>
> 2016-11-17 12:05 GMT+01:00 Henrik Sarvell :
>
>> Hi list,
>>
>> I'm trying to build a project scheduler / planner.
>>
>> This is the E/R for a project:
>>
>> (class +Proj +Macropisobj)
>> (rel id (+Key +Number))
>> (rel nm (+Ref +String))
>> (rel sDate (+Ref +String))
>> (rel eDate (+Ref +String))
>>
>> (dm getCurrent> (Sdate Edate)
>>(filter '((P) (or
>> (< Sdate (; P sDate) Edate)
>> (< Sdate (; P eDate) Edate)
>> (< Sdate (; P sDate) (; P eDate) Edate) ) )
>>   (collect 'id This) ) )
>>
>> I haven't decided on whether or not to use +Date yet so the above dates
>> are on the "Y-m-d" format currently.
>>
>> I need to find all projects which are active during a certain time
>> period, for instance between 2016-11-01 and 2016-12-31.
>>
>> Logically that means finding all projects which have either a start date
>> or an end date in the period OR all projects with a start date before the
>> range that also have an end date after the range.
>>
>> I can fairly trivially do a collect and then a filter on the results of
>> the collect as shown above.
>>
>> But how would the above problem be solved with Pilog and select if we
>> have more than "a couple of hundred objects" in the database?
>>
>>
>>
>
>
> --
>
>
> [image: --]
>
> Rafik Naccache
> [image: https://]about.me/rafik_naccache
>
> 
>


Re: Date query question

2016-11-17 Thread Rafik NACCACHE
HEy Henrik,

Not related by U wrote a project scheduling library and a tasks parser for
natural language in Clojure,

You might want to take a look on it here:

https://github.com/turbopape/milestones

There is one online dome here:
http://turbopape.github.io/milestones/

I'll be happy if you can review it (and why not, leave a star on it :) )

If you want any explanationa on the scheduling algorihtm, I'll be more than
happy to discuss it with you !

Cheers,

Rafik

2016-11-17 12:05 GMT+01:00 Henrik Sarvell :

> Hi list,
>
> I'm trying to build a project scheduler / planner.
>
> This is the E/R for a project:
>
> (class +Proj +Macropisobj)
> (rel id (+Key +Number))
> (rel nm (+Ref +String))
> (rel sDate (+Ref +String))
> (rel eDate (+Ref +String))
>
> (dm getCurrent> (Sdate Edate)
>(filter '((P) (or
> (< Sdate (; P sDate) Edate)
> (< Sdate (; P eDate) Edate)
> (< Sdate (; P sDate) (; P eDate) Edate) ) )
>   (collect 'id This) ) )
>
> I haven't decided on whether or not to use +Date yet so the above dates
> are on the "Y-m-d" format currently.
>
> I need to find all projects which are active during a certain time period,
> for instance between 2016-11-01 and 2016-12-31.
>
> Logically that means finding all projects which have either a start date
> or an end date in the period OR all projects with a start date before the
> range that also have an end date after the range.
>
> I can fairly trivially do a collect and then a filter on the results of
> the collect as shown above.
>
> But how would the above problem be solved with Pilog and select if we have
> more than "a couple of hundred objects" in the database?
>
>
>


-- 


[image: --]

Rafik Naccache
[image: https://]about.me/rafik_naccache



Date query question

2016-11-17 Thread Henrik Sarvell
Hi list,

I'm trying to build a project scheduler / planner.

This is the E/R for a project:

(class +Proj +Macropisobj)
(rel id (+Key +Number))
(rel nm (+Ref +String))
(rel sDate (+Ref +String))
(rel eDate (+Ref +String))

(dm getCurrent> (Sdate Edate)
   (filter '((P) (or
(< Sdate (; P sDate) Edate)
(< Sdate (; P eDate) Edate)
(< Sdate (; P sDate) (; P eDate) Edate) ) )
  (collect 'id This) ) )

I haven't decided on whether or not to use +Date yet so the above dates are
on the "Y-m-d" format currently.

I need to find all projects which are active during a certain time period,
for instance between 2016-11-01 and 2016-12-31.

Logically that means finding all projects which have either a start date or
an end date in the period OR all projects with a start date before the
range that also have an end date after the range.

I can fairly trivially do a collect and then a filter on the results of the
collect as shown above.

But how would the above problem be solved with Pilog and select if we have
more than "a couple of hundred objects" in the database?