[Nepomuk] About files and nie:url

Alessandro Sivieri alessandro.sivieri at gmail.com
Wed Feb 24 14:41:15 CET 2010


2010/2/24 Sebastian Trüg <trueg at kde.org>

> >    - if I want to associate, for example, tags in a (python) script, I
> used
> >    to create a Nepomuk::Resource, passing a full file path as argument of
> > its constructor, and then call setTags; now, if I do this, nie:url is
> > again file:// (as before), and it becomes a different resource from the
> > one indexed by Strigi (which has filex://): how can I get the resource
> > given a file path?
>
> Normally Nepomuk::Resource should handle this transparently and translate a
> file:/ URL into a filex:/ one if the medium in question is mounted.
> Could you give me a full example please?
>
>
Ah, let's see...
I have a resource file, /home/alex/Video/crest-demo.mp4 (which is _not_ on a
removable media, it is on my hard drive, and I have not enabled the
removable media indexing in system settings), indexed by Strigi as follows:

sopranocmd --dbus org.kde.NepomukStorage --model main query "select ?r where
{ ?r nie:url <filex://44b1-0599/home/alex/Video/crest-demo.mp4> . }"
r -> <nepomuk:/res/5122c902-6a93-4017-88a7-456a806d5ae1>

sopranocmd --dbus org.kde.NepomukStorage --model main query "select ?p ?o
where { <nepomuk:/res/5122c902-6a93-4017-88a7-456a806d5ae1> ?p ?o . }"

p -> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>; o -> <
http://www.semanticdesktop.org/ontologies/nfo#Video>


p -> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>; o -> <
http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#FileDataObject>


p -> <http://www.semanticdesktop.org/ontologies/2007/08/15/nao#lastModified>;
o -> "2010-02-21T11:10:54.294Z"^^<http://www.w3.org/2001/XMLSchema#dateTime>

p -> <http://www.semanticdesktop.org/ontologies/2007/08/15/nao#created>; o
-> "2010-02-17T10:31:32.517Z"^^<http://www.w3.org/2001/XMLSchema#dateTime>

p -> <http://www.semanticdesktop.org/ontologies/2007/01/19/nie#title>; o ->
"crest-demo.mp4"^^<http://www.w3.org/2001/XMLSchema#string>
p -> <http://www.semanticdesktop.org/ontologies/2007/01/19/nie#lastModified>;
o -> "2009-09-27T17:09:12Z"^^<http://www.w3.org/2001/XMLSchema#dateTime>
p -> <http://www.semanticdesktop.org/ontologies/2007/01/19/nie#mimeType>; o
-> "video/mp4"^^<http://www.w3.org/2001/XMLSchema#string>
p -> <http://www.semanticdesktop.org/ontologies/2007/01/19/nie#contentSize>;
o -> "6593037"^^<http://www.w3.org/2001/XMLSchema#int>
p -> <http://www.semanticdesktop.org/ontologies/2007/01/19/nie#url>; o ->
<filex://44b1-0599/home/alex/Video/crest-demo.mp4>
p -> <http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#fileName>; o
-> "crest-demo.mp4"^^<http://www.w3.org/2001/XMLSchema#string>
p -> <http://www.strigi.org/data#TODO_video.duration>; o -> "303"^^<
http://www.w3.org/2001/XMLSchema#int>
p -> <http://www.strigi.org/data#media.duration>; o -> "302"^^<
http://www.w3.org/2001/XMLSchema#int>
p -> <http://www.strigi.org/data#media.duration>; o -> "303"^^<
http://www.w3.org/2001/XMLSchema#int>
p -> <http://www.strigi.org/data#image.width>; o -> "480"^^<
http://www.w3.org/2001/XMLSchema#int>
p -> <http://www.strigi.org/data#image.height>; o -> "270"^^<
http://www.w3.org/2001/XMLSchema#int>
p -> <http://www.strigi.org/data#av.video_codec>; o -> "avc1"^^<
http://www.w3.org/2001/XMLSchema#string>
p -> <http://www.strigi.org/data#content.mime_type>; o -> "video/mp4"^^<
http://www.w3.org/2001/XMLSchema#string>
p -> <http://www.strigi.org/data#audio.channel_count>; o -> "2"^^<
http://www.w3.org/2001/XMLSchema#int>
p -> <http://www.strigi.org/data#media.sample_format>; o -> "16 bit int"^^<
http://www.w3.org/2001/XMLSchema#string>
p -> <http://www.strigi.org/data#media.sample_rate>; o -> "44100"^^<
http://www.w3.org/2001/XMLSchema#int>
p -> <http://www.strigi.org/data#av.audio_codec>; o -> "mp4a"^^<
http://www.w3.org/2001/XMLSchema#string>

And I used Python and I have done the following:
res = Nepomuk.Resource("/home/alex/Video/crest-demo.mp4")
tags = [Nepomuk.Tag("Video")]
res.setTags(tags)

and this creates a different resource as follows:

sopranocmd --dbus org.kde.NepomukStorage --model main query "select ?r where
{ ?r nie:url <file:///home/alex/Video/crest-demo.mp4> . }"
r -> <nepomuk:/res/90905529-b98a-4e25-a725-705c94934a77>

sopranocmd --dbus org.kde.NepomukStorage --model main query "select ?p ?o
where { <nepomuk:/res/90905529-b98a-4e25-a725-705c94934a77> ?p ?o . }"
p -> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>; o -> <
http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#FileDataObject>
p -> <http://www.semanticdesktop.org/ontologies/2007/08/15/nao#lastModified>;
o -> "2010-02-24T12:03:10.797Z"^^<http://www.w3.org/2001/XMLSchema#dateTime>
p -> <http://www.semanticdesktop.org/ontologies/2007/08/15/nao#hasTag>; o ->
<nepomuk:/res/18dde644-cb42-40c4-b6bd-c2602ea0a3a5>
p -> <http://www.semanticdesktop.org/ontologies/2007/08/15/nao#created>; o
-> "2010-02-24T12:03:10.73Z"^^<http://www.w3.org/2001/XMLSchema#dateTime>
p -> <http://www.semanticdesktop.org/ontologies/2007/01/19/nie#url>; o ->
<file:///home/alex/Video/crest-demo.mp4>

(sorry for the lenghy mail)
So I think that there is something wrong here... I'm on 4.4 (Ubuntu flavor)
and the virtuoso db has been created from scratch with 6.1.0, so there are
not legacy entries (or there shouldn't, afaik).

-- 
Sivieri Alessandro
alessandro.sivieri at gmail.com
http://www.chimera-bellerofonte.eu/
http://www.poul.org/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/nepomuk/attachments/20100224/a43aad27/attachment.htm 


More information about the Nepomuk mailing list