Re: Using RDF queries with beagle

> * For sophisticated RDF query,
>   $ cd RDFAdapter
>   $ ./beagle-semweb-client
>   => this currently lists all triples
> RDFAdapter uses a Semweb [2] adapter to talk to beagle. So, you can create any 
> RDF query structure supported by Semweb (e.g. SPARQL). SemWebClient.cs is a 
> simple app asking for all triples. It should be possible to run any kind of 
> Semweb queries (edit SemwebClient.cs or write your own client using the 
> SelectableSource provided in BeagleSource.cs).
using the BeagleSource, you actually have to use the properties as they
are printed by beagle-dump-index --fields, so for instance

Attached you can find the SemWebClient.cs extended by some example

@dBera: I would suggest to modify the RDFQuery so that it only takes
subject, predicate and object, where the predicate is the one dumped by
beagle-dump-index --fields. The property type can then be derived from
the property name. I know that this exposes the internal property name
but since users of the RDFQuery have to specify Text, Keyword or
Internal anyways, they can take the long property name in the first
place. This makes things easier.

So this would then mean to move BeagleSource.cs line 79-93 into the
RDFQuery constructor. If you agree on this, I will prepare the
respective changes tomorrow.

Enrico M.
Index: SemWebClient.cs
--- SemWebClient.cs	(Revision 4490)
+++ SemWebClient.cs	(Arbeitskopie)
@@ -29,9 +29,23 @@
 public class SemWebClient {
 	public static void Main (string[] args)
+		System.Console.Out.WriteLine();
+		System.Console.Out.WriteLine("Querying for all Triples with MimeType:");
+		query(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(new Statement(null, new Entity("prop:k:fixme:filesize"), null));
+		System.Console.Out.WriteLine();
+		System.Console.Out.WriteLine("Querying for all Triples:");
+		query(Statement.All);
+	}
+	public static void query(Statement filter) {
 		RdfWriter writer = new N3Writer (System.Console.Out);
 		SelectableSource source = new BeagleSource();
-		source.Select (Statement.All, writer);
+		source.Select (filter, writer);
 		writer.Close ();

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]