Click here to Skip to main content
Click here to Skip to main content
Go to top

EventFeed Data Model

, 13 Jul 2012
Rate this:
Please Sign up or sign in to vote.
A data model that captures events, subscribers and topics to provide a core data model for any event registration and timeline system.

As we mentioned in a recent post we are going to be using BrightstarDB to create ready-to-go data models that can be used by developers in building their applications. First up is a data model that captures events, subscribers and topics to provide a core data model for any event registration and timeline system. All the code is available for use in the BrightstarDB github repository.

One requirement we often see for intranet based projects is the notion of an event stream that is personalised for each user. The concept is quite simple, subscribers subscribe to topics. Events occur at a given time and these events are classified by one or more topics. Events can come from many systems, (we don’t go into detail about how these events are captured). A subscriber timeline is a list of all events that are classified by the same topic(s) that a subscriber is interested in. More specifically, the subscriber will only see events that occurred when they were interested in a given topic. Finally, events have associated data. This data can be different for each event. By using BrightstarDB we can combine a typed model for (Event, Subscriber and Topic) and also use dynamic features to capture the event data.

BrightstarDB was a good choice for this model as it allowed us to quickly iterate and try out new model ideas, and make use of the schema-less features of the underlying triple store.

We have defined a EventFeed service object that provides high level access to the functionality. It has the following operations:

public interface IEventFeedService
{
    void AssertSubscriber(string userName, IEnumerable<Uri> topicsOfInterest);

    IEnumerable<IEvent> GetSubscriberTimeline(string userName, DateTime since);
    IEnumerable<IEvent> GetTopicTimeline(string topicId, DateTime since);

    void AssertTopic(Uri topicId, string label, string description);
    dynamic GetEventData(IEvent feedEvent);
    void RaiseEvent(string description, DateTime when, IEnumerable<string> topicIds,
                    Dictionary<string, object> eventProperties = null);
    void RegisterInterest(string userName, string topicId);
    void RemoveInterest(string userName, string topicId);
}

The data model consists of just three types: IEvent, ITopic, and ISubscriber, and is shown in the diagram below.

We hope this model is useful to someone, either as is, or as a starting point for something bigger and better. Also, if you are looking at how dynamic and typed objects can live together then check out the service method for RaiseEvent.

All feedback welcome to contact(at)brightstardb.com, or @brightstardb

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

gramoore

Norway Norway
No Biography provided
Follow on   Twitter

Comments and Discussions

 
-- There are no messages in this forum --
| Advertise | Privacy | Mobile
Web01 | 2.8.140916.1 | Last Updated 13 Jul 2012
Article Copyright 2012 by gramoore
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid