public static void Main (string[] args) { BeagleSource source = new BeagleSource (); TestSource (source); //TestEmailThreads (source); //TestReceipients (source); }
public static void Main(string[] args) { BeagleSource source = new BeagleSource(); TestSource(source); //TestEmailThreads (source); //TestReceipients (source); }
private static void TestSource (BeagleSource source) { source.RDFToBeagle = new BeagleSource.RDFToBeagleHook (RDFToBeagle); source.BeagleToRDF = new BeagleSource.BeagleToRDFHook (EmailToEntity); System.Console.Out.WriteLine (); System.Console.Out.WriteLine ("Querying for all Triples with MimeType:"); query (source, new Statement (null, new Entity ("prop:k:beagle:MimeType"), null)); System.Console.Out.WriteLine (); System.Console.Out.WriteLine ("Querying for all Triples with FileSize:"); query (source, new Statement (null, BeagleSource.BeaglePropertyToEntity ("prop:k:fixme:filesize"), null)); System.Console.Out.WriteLine (); System.Console.Out.WriteLine ("Querying for all Triples:"); query (source, Statement.All); }
private static void TestSource(BeagleSource source) { source.RDFToBeagle = new BeagleSource.RDFToBeagleHook(RDFToBeagle); source.BeagleToRDF = new BeagleSource.BeagleToRDFHook(EmailToEntity); System.Console.Out.WriteLine(); System.Console.Out.WriteLine("Querying for all Triples with MimeType:"); query(source, new Statement(null, new Entity("prop:k:beagle:MimeType"), null)); System.Console.Out.WriteLine(); System.Console.Out.WriteLine("Querying for all Triples with FileSize:"); query(source, new Statement(null, BeagleSource.BeaglePropertyToEntity("prop:k:fixme:filesize"), null)); System.Console.Out.WriteLine(); System.Console.Out.WriteLine("Querying for all Triples:"); query(source, Statement.All); }
// WARNING! This will generate all threads, pretty expensive private static void TestEmailThreads (BeagleSource source) { source.BeagleToRDF = new BeagleSource.BeagleToRDFHook (MsgIdToEntity); source.RDFToBeagle = new BeagleSource.RDFToBeagleHook (RDFToBeagle); Entity inthread = BeagleSource.BeaglePropertyToEntity ("inthread"); /* NOTE: change the subject to whatever email subject you wish */ const string Subject = "beagle"; string rules = "@prefix : <http://beagle-project.org/property#>.\n" + "\n" + /* every message is in its own thread */ "{ ?email :prop:t:dc:title \"" + Subject + "\" . ?email :prop:k:fixme:msgid ?msg . } => { ?msg :inthread ?msg } .\n" + /* if any email refers to some email in thread, then this email is also in thread */ "{ ?ref :inthread ?parent . ?email1 :prop:k:fixme:reference ?ref . ?email1 :prop:k:fixme:msgid ?msg .} => {?msg :inthread ?parent} .\n"; Statement msg_in_thread = new Statement (new Variable ("msg"), inthread, new Variable ("parent")); Console.WriteLine ("Proof of 'threads in email with subject :{0}'", Subject); EulerQuery (source, rules, new Statement[] {msg_in_thread}); }
// WARNING! This will generate all threads, pretty expensive private static void TestEmailThreads(BeagleSource source) { source.BeagleToRDF = new BeagleSource.BeagleToRDFHook(MsgIdToEntity); source.RDFToBeagle = new BeagleSource.RDFToBeagleHook(RDFToBeagle); Entity inthread = BeagleSource.BeaglePropertyToEntity("inthread"); /* NOTE: change the subject to whatever email subject you wish */ const string Subject = "beagle"; string rules = "@prefix : <http://beagle-project.org/property#>.\n" + "\n" + /* every message is in its own thread */ "{ ?email :prop:t:dc:title \"" + Subject + "\" . ?email :prop:k:fixme:msgid ?msg . } => { ?msg :inthread ?msg } .\n" + /* if any email refers to some email in thread, then this email is also in thread */ "{ ?ref :inthread ?parent . ?email1 :prop:k:fixme:reference ?ref . ?email1 :prop:k:fixme:msgid ?msg .} => {?msg :inthread ?parent} .\n"; Statement msg_in_thread = new Statement(new Variable("msg"), inthread, new Variable("parent")); Console.WriteLine("Proof of 'threads in email with subject :{0}'", Subject); EulerQuery(source, rules, new Statement[] { msg_in_thread }); }
private static void TestReceipients(BeagleSource source) { source.BeagleToRDF = new BeagleSource.BeagleToRDFHook(EmailToEntity); source.RDFToBeagle = new BeagleSource.RDFToBeagleHook(RDFToBeagle); Entity recvd = BeagleSource.BeaglePropertyToEntity("recvd"); string rules = "@prefix : <http://beagle-project.org/property#>.\n" + "\n" + "{ ?email :prop:t:fixme:from_address ?from . ?email :prop:t:fixme:to_address ?to . } => {?from :recvd ?to .}.\n" + "{ ?email :prop:t:fixme:from_address ?from . ?email :prop:t:fixme:cc_address ?to . } => {?from :recvd ?to .}.\n"; /* NOTE: change the sender to whatever email address you wish */ const string Sender = "*****@*****.**"; Entity from = new Entity("mailto://" + Sender); Variable to = new Variable("recpt"); Statement q = new Statement(from, recvd, to); Console.WriteLine("Proof of 'receipients of emails from :{0}'", Sender); EulerQuery(source, rules, new Statement[] { q }); }
private static void TestReceipients (BeagleSource source) { source.BeagleToRDF = new BeagleSource.BeagleToRDFHook (EmailToEntity); source.RDFToBeagle = new BeagleSource.RDFToBeagleHook (RDFToBeagle); Entity recvd = BeagleSource.BeaglePropertyToEntity ("recvd"); string rules = "@prefix : <http://beagle-project.org/property#>.\n" + "\n" + "{ ?email :prop:t:fixme:from_address ?from . ?email :prop:t:fixme:to_address ?to . } => {?from :recvd ?to .}.\n" + "{ ?email :prop:t:fixme:from_address ?from . ?email :prop:t:fixme:cc_address ?to . } => {?from :recvd ?to .}.\n"; /* NOTE: change the sender to whatever email address you wish */ const string Sender = "*****@*****.**"; Entity from = new Entity ("mailto://" + Sender); Variable to = new Variable ("recpt"); Statement q = new Statement(from, recvd, to); Console.WriteLine ("Proof of 'receipients of emails from :{0}'", Sender); EulerQuery (source, rules, new Statement[] {q}); }