Re: [Tracker] tracker-sparql dbus sparql results



hi, after struggling with UNIX_FD (dbus type 'h') not really being supported i swithed to JNA using libtracker-sparql (it's much easier anyway...).

i however realized that the rdf datatypes do not work as expected (as far as i understand tracker-cursor simply uses the first value_type for a column and returns it for every row returned).

how to verify :

1. i added the following test to tests/libtracker-sparql/tracker-test.c

static void
test_tracker_sparql_cursor_types (void)
{
GError *error = NULL;

TrackerSparqlCursor *cursor1;
TrackerSparqlConnection *connection;

//const gchar* query = "SELECT ?o ?p WHERE { <file:///home/turnguard/.local/share/applications/netbeans-7.4.desktop> ?p ?o  . }";
const gchar* query = "SELECT ?date WHERE { <file:///home/turnguard/.local/share/applications/netbeans-7.4.desktop> <http://www.tracker-project.org/ontologies/tracker#added> ?date .  } ORDER BY ?date";
connection = tracker_sparql_connection_get (NULL, &error);
g_assert_no_error (error);

cursor1 = tracker_sparql_connection_query (connection, query, 0, &error);
g_assert_no_error (error);
gint n_columns = tracker_sparql_cursor_get_n_columns (cursor1);
g_print("query %s", query);
while (tracker_sparql_cursor_next (cursor1, NULL, NULL)) {
int i = 0;
for (i = 0; i < n_columns ; i++) {
g_print ("=>type of %s is %d ", tracker_sparql_cursor_get_string(cursor1,i,NULL),(int)tracker_sparql_cursor_get_value_type (cursor1, i));
}
g_print("\n");
}
g_object_unref(cursor1);
}
 
....
g_test_add_func ("/libtracker-sparql/tracker/test_tracker_sparql_cursor_types",
                test_tracker_sparql_cursor_types);

2. replace <file://home/turnguard....> with a known entity that has a tracker#added predicate

3. sudo make => ./tracker-test

4. using the first query i get 2 or 1 (depending on ?o ?p or ?p ?o) for the date (tracker#added)

5. using the second query i get 5 for the value_type (correct)

i assume that the cursor takes the value_types of the first row it encounters and takes these value_types for every following row. such behaviour is suitable for the sql world but not for the sparql world. is it really the "g_once_init_leave", can i simply delete g_once_init_leave without sideeffects?

any pointer really appreciated.

wkr turnguard


| Jürgen Jakobitsch,
| Software Developer
| Semantic Web Company GmbH
| Mariahilfer Straße 70 / Neubaugasse 1, Top 8
| A - 1070 Wien, Austria
| Mob +43 676 62 12 710 | Fax +43.1.402 12 35 - 22

COMPANY INFORMATION
| web       : http://www.semantic-web.at/
| foaf      : http://company.semantic-web.at/person/juergen_jakobitsch
PERSONAL INFORMATION
| web       : http://www.turnguard.com
| foaf      : http://www.turnguard.com/turnguard
| g+        : https://plus.google.com/111233759991616358206/posts
| skype     : jakobitsch-punkt
| xmlns:tg  = "http://www.turnguard.com/turnguard#"


2014-04-18 22:17 GMT+02:00 Jürgen Jakobitsch <j jakobitsch semantic-web at>:
philip, thanks for information.. i'll take a closer look at steroids1 dbus...

wkr turnguard

| Jürgen Jakobitsch,
| Software Developer
| Semantic Web Company GmbH
| Mariahilfer Straße 70 / Neubaugasse 1, Top 8
| A - 1070 Wien, Austria
| Mob +43 676 62 12 710 | Fax +43.1.402 12 35 - 22

COMPANY INFORMATION
| web       : http://www.semantic-web.at/
| foaf      : http://company.semantic-web.at/person/juergen_jakobitsch
PERSONAL INFORMATION
| web       : http://www.turnguard.com
| foaf      : http://www.turnguard.com/turnguard
| g+        : https://plus.google.com/111233759991616358206/posts
| skype     : jakobitsch-punkt
| xmlns:tg  = "http://www.turnguard.com/turnguard#"


2014-04-18 22:04 GMT+02:00 Philip Van Hoof <philip codeminded be>:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Hi Jürgen,

In that case you should use the Steroids1 DBus object which works by
passing file descriptors and pipe(). I'm guessing that in Java you can
use the type FileDescriptor to turn that to a InputStream.

https://git.gnome.org/browse/tracker/tree/src/tracker-store/tracker-steroids.vala

Steroid1's protocol that goes over pipe()/vmsplice() already passes
the variable-names and column-types over.

Usage of Resources1 is very slow and on top it's not really a
supported interface. Resources1 is actually only for the GraphUpdated
signal, which is the only officially supported interface that the DBus
object exports.

The Steroids1 DBus object is going to stay and is used for write
queries and fallback for libtracker-sparql in case WAL direct access
mode can't be used.

Kind regards,

Philip


Jürgen Jakobitsch schreef op 18/04/2014 15:53:
> hi philipp,
>
> i'm currently using the dbus resource because i'm writing the
> openrdf repository in java and didn't want to got down the jni, jna
> road...
>
> i already have built in a switch in tracker-resource.vala, about
> here [1], testing the cursor.get_value_type, but the returned
> value_types are not totally correct. for some uris the value is 1
> for other uris the value type is 2... i'm gonna issue a bug report,
> as soon as i have verified, that i'm not doing something wrong..
> also the returned value_types are only 1 or 2.. there are not other
> values (like bnode, double, date...) although the returned string
> suggest they should be used..
>
> wkr turnguard
>
> [1]
> https://git.gnome.org/browse/tracker/tree/src/tracker-store/tracker-resources.vala#n102
>
>  | Jürgen Jakobitsch, | Software Developer | Semantic Web Company
> GmbH | Mariahilfer Straße 70 / Neubaugasse 1, Top 8 | A - 1070
> Wien, Austria | Mob +43 676 62 12 710 | Fax +43.1.402 12 35 - 22
>
> COMPANY INFORMATION | web       : http://www.semantic-web.at/ |
> foaf      :
> http://company.semantic-web.at/person/juergen_jakobitsch PERSONAL
> INFORMATION | web       : http://www.turnguard.com | foaf      :
> http://www.turnguard.com/turnguard | g+        :
> https://plus.google.com/111233759991616358206/posts | skype     :
> jakobitsch-punkt | xmlns:tg  =
> "http://www.turnguard.com/turnguard#"
>
>
> 2014-04-18 11:32 GMT+02:00 Philip Van Hoof <philip codeminded be>:
>
>
> get_value_type and get_variable_name:
>
>
> https://git.gnome.org/browse/tracker/tree/src/libtracker-sparql/tracker-cursor.vala#n126
>
>
>
> https://git.gnome.org/browse/tracker/tree/src/libtracker-sparql/tracker-cursor.vala#n139
>
>  You btw shouldn't use the DBus Resources1 object, but use
> libtracker-sparql instead.
>
>
> Ivan Frade schreef op 17/04/2014 20:14:
>>>> Hi Jürgen,
>>>>
>>>> Yes, tracker does not return bindingNames or types of the
>>>> resulting nodes. It assumes the client takes care of
>>>> interpreting the results of its query.
>>>>
>>>> A workaround would be to parse the SparQL in the wrapper and
>>>> add that information when translating the DBus result set to
>>>> the openrdf format. The binding Names can be added straight
>>>> forward from the SELECT of the query. The type information is
>>>> more complicated to deduce, based on the position in the
>>>> query and/or the rdfs:range of the properties (defined in the
>>>> ontology).
>>>>
>>>> Regards,
>>>>
>>>> Ivan
>>>>
>>>>
>>>> On Thu, Apr 17, 2014 at 10:11 AM, Jürgen Jakobitsch <
>>>> j jakobitsch semantic-web at> wrote:
>>>>
>>>>> hi,
>>>>>
>>>>> i'm currently developing an openrdf [1] repository
>>>>> implementation with a tracker-sparql backend via dbus. this
>>>>> will enable java developers to include tracker-sparql
>>>>> results in any application (or create a sparql endpoint)
>>>>> extremly easily. openrdf's api is quite common in the
>>>>> semweb community..
>>>>>
>>>>> everything is working very nice already  the only trouble
>>>>> i'm having is that i get a vector of vectors containing
>>>>> simple strings as a result object, meaning i need to find
>>>>> out types (literals, uris, bnodes, typed literals)..
>>>>>
>>>>> is there any known way to retrieve some more information in
>>>>> the results given via dbus? also bindingNames are
>>>>> missing...
>>>>>
>>>>> any pointer really appreciated wkr turnguard..
>>>>>
>>>>>
>>>>> [1] http://www.openrdf.org/
>>>>>
>>>>> | Jürgen Jakobitsch, | Software Developer | Semantic Web
>>>>> Company GmbH | Mariahilfer Straße 70 / Neubaugasse 1, Top 8
>>>>> | A - 1070 Wien, Austria | Mob +43 676 62 12 710 | Fax
>>>>> +43.1.402 12 35 - 22
>>>>>
>>>>> COMPANY INFORMATION | web       :
>>>>> http://www.semantic-web.at/ | foaf      :
>>>>> http://company.semantic-web.at/person/juergen_jakobitsch
>>>>> PERSONAL INFORMATION | web       : http://www.turnguard.com
>>>>> | foaf      : http://www.turnguard.com/turnguard | g+
>>>>> : https://plus.google.com/111233759991616358206/posts |
>>>>> skype     : jakobitsch-punkt | xmlns:tg  =
>>>>> "http://www.turnguard.com/turnguard#"
>>>>>
>>>>> _______________________________________________
>>>>> tracker-list mailing list tracker-list gnome org
>>>>> https://mail.gnome.org/mailman/listinfo/tracker-list
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________ tracker-list
>>>> mailing list tracker-list gnome org
>>>> https://mail.gnome.org/mailman/listinfo/tracker-list
>>>>
>
>>
>
>
>
> _______________________________________________ tracker-list
> mailing list tracker-list gnome org
> https://mail.gnome.org/mailman/listinfo/tracker-list
>

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.20 (MingW32)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJTUYVcAAoJEEP2NSGEz4aD1eAH/j59ejV3/wkgPzUR22trrNOj
KqFBT1YRP9631NyZmphdP5q3giRnihBEjkLjF1P46eqOoO6zhRP8jo/qj64amHW8
nUZ96/21ZBPp0kNeKij5vjIq5SxrqSAh6n4e0VQTP/rpwm70OoCz9h/6yKskk9Ln
EUYIHb3b4T1YUPHleuJ2SkFNsDgx71MmT2nXvCzKxf2DSB9XGupOCysPPuPbxEBf
4QofLlZmbyxiftz+Hb0g6PLFm0SFIAxGz1sWVVZHoxy7Ff2+xMrrFl3p+3ktlx6w
kZkqN7cEcqdzxzNqzqGlB7i67wIHfN3OtYMbhaZlt3UsfAsvKSRDbl/LONuilkM=
=D9Uo
-----END PGP SIGNATURE-----




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