Skip to content

Instantly share code, notes, and snippets.

@gra-moore
gra-moore / sampletriples1.tt
Created February 1, 2012 17:01
Sample triples
@prefix products: <http://www.networkedplanet.com/product/> .
@prefix categories: <http://www.networkedplanet.com/category/> .
@prefix schema: <http://www.networkedplanet.com/schema/> .
products:brightstardb schema:label "BrightstarDB" .
products:brightstardb schema:in-category categories:nosql .
@gra-moore
gra-moore / Entity System Sample Model 1
Created February 1, 2012 17:25
Entity System Sample Model 1
@prefix comp: <http://www.networkedplanet.com/es/component/> .
@prefix entities: <http://www.networkedplanet.com/es/entity/> .
@prefix schema: <http://www.networkedplanet.com/es/schema/> .
entities:e1 a schema:Entity .
comp:c1 a schema:Moveable .
comp:c1 schema:has-entity entities:e1 .
comp:c1 schema:x 0 .
comp:c1 schema:y 0 .
@gra-moore
gra-moore / Entity System Query 1
Created February 1, 2012 17:31
Entity System Query 1
select ?e ?c where {
?c a <http://www.networkedplanet.com/es/schema/Moveable> .
?c <http://www.networkedplanet.com/es/schema/has-entity> ?e1 .
}
@gra-moore
gra-moore / Entity System Sample Model 2
Created February 1, 2012 17:38
Entity System Sample Model 2
@prefix comp: <http://www.networkedplanet.com/es/component/> .
@prefix entities: <http://www.networkedplanet.com/es/entity/> .
@prefix schema: <http://www.networkedplanet.com/es/schema/> .
# define the entity and connect the properties directly to it
entities:e1 a schema:Entity .
entities:e1 schema:X 0 .
entities:e1 schema:Y 0 .
# declare the component and hook it to the entity
@gra-moore
gra-moore / dotNetRdf-Tutorial-Samples.cs
Created April 23, 2012 16:07
Annotated Examples to support a dotNetRdf Tutorial
/**
* This is a set of unit tests that provide a simple walkthrough of dotNetRdf.
* Many samples are taken from or inspired by the User Guide Basic Tutorial.
* The full website is here http://www.dotnetrdf.org/default.asp
*
* This code is made available under the following license:
* http://creativecommons.org/licenses/by/3.0/
*
* Author: Graham Moore
* [email protected]
@gra-moore
gra-moore / IEventFeedService.cs
Created July 7, 2012 16:01
EventFeed Service Interface
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);
@gra-moore
gra-moore / ConnectionString
Created July 9, 2012 05:32
BrightstarDB Connection string
"type=embedded;storesdirectory=c:\brightstar;storename=Test1"
@gra-moore
gra-moore / SampleTest.cs
Created July 9, 2012 05:42
BrightstarDB Sample Test File
[TestClass]
public class EntityContextTests
{
private const string ConnectionString = "type=embedded;storesdirectory=c:\\brightstar";
private static MyEntityContext GetContext(string storeId)
{
return new MyEntityContext(ConnectionString + ";storename=" + storeId);
}
@gra-moore
gra-moore / dynamic-sample.cs
Created July 19, 2012 07:21
BrightstarDB dynamic Sample
// gets a new BrightstarDB DataObjectContext
var dataObjectContext = BrightstarService.GetDataObjectContext();
// create a dynamic context
var dynaContext = new BrightstarDynamicContext(dataObjectContext);
// open a new store
var storeId = "DynamicSample" + Guid.NewGuid().ToString();
var dynaStore = dynaContext.CreateStore(storeId);
@gra-moore
gra-moore / dynamic-system-tests.cs
Created July 19, 2012 08:16
BrightstarDB dynamic system tests
[TestClass]
public class SystemTests
{
private const string ConnectionString = "type=embedded;storesdirectory=c:\\brightstar";
[TestMethod]
public void TestCreateObjectSystem()
{
var storeId = Guid.NewGuid().ToString();
var dos = new DynamicObjectSystem(ConnectionString, storeId);