2

I'm using Mediawiki, with the SMW extension, in a private setting to organize a fictional universe my group is creating. I have some functionality I'd like, and I'd like to know if there is an extension out there, or the possibility of making my own, that would let me do what I want to do.

Basically, in plain english... I want to know what's going on in the universe at a specific point (or duration) in time.

I'd like to give the user an ability to give a date (as simple as a year, or as precise as necessary), or duration, and return every event which has a duration that overlaps.

For example.

  • Event 1 starts ~ 3200 BCE, and ends ~ 198 BCE
  • Event 2 starts ~509 BCE and ends ~ 405 CE
  • Event 3 starts 1/15/419 CE and ends 1/17/419 CE
  • Event 4 starts ~409 BCE and ends on 2/14/2021 CE

User inputs a date (partial, in this instance) 309 BCE. Wiki returns Event 1, and Event 4, as the given date is within the duration of both.

This would allow my creators to query a specific date (and hopefully a duration) and discover what events are already taking place, so they can adjust their works according to what is already established. It's a simple conflict checker.

If there's no extension available that can handle this, is there anything like this anywhere I can research? I've never dealt with dates in PHP. I'm a general business coder, I've never done complex applications.

FEERspreads
  • 71
  • 1
  • 9

1 Answers1

1

There is no built in “duration” data type in SMW, so the easiest approach would probably be to use one date property for the starting date, and one for the ending date (note that it must be BC/AD, not BCE/CE or similar):

[[Event starts at::3200 BC]]
[[Event ends at::198 BC]]

then you can query for each event that has a starting date before, and an ending date after a certain date:

{{#ask:[[Event starts at::<1000 BC]] [[Event ends at::>1000 BC]]}}

Note that > actually means “greater or equal to” in SMW query syntax.

leo
  • 8,106
  • 7
  • 48
  • 80
  • Will this work for BC and AD, or mixed dates. E.g., will SMW be able to compare 1000 BC and January 1st, 1989 AD? – FEERspreads Jan 20 '15 at 19:34