<div class="gmail_quote">2010/2/24 Sebastian Trüg <span dir="ltr"><<a href="mailto:trueg@kde.org">trueg@kde.org</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">> - if I want to associate, for example, tags in a (python) script, I used</div>
<div class="im">> to create a Nepomuk::Resource, passing a full file path as argument of<br>
> its constructor, and then call setTags; now, if I do this, nie:url is<br>
> again file:// (as before), and it becomes a different resource from the<br>
> one indexed by Strigi (which has filex://): how can I get the resource<br>
> given a file path?<br>
<br>
</div>Normally Nepomuk::Resource should handle this transparently and translate a<br>
file:/ URL into a filex:/ one if the medium in question is mounted.<br>
Could you give me a full example please?<br><br></blockquote><div><br></div><div>Ah, let's see...</div><div>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:</div>
<div><br></div><div>sopranocmd --dbus org.kde.NepomukStorage --model main query "select ?r where { ?r nie:url <filex://44b1-0599/home/alex/Video/crest-demo.mp4> . }"</div><div>r -> <nepomuk:/res/5122c902-6a93-4017-88a7-456a806d5ae1></div>
<div><br></div><div><div>sopranocmd --dbus org.kde.NepomukStorage --model main query "select ?p ?o where { <nepomuk:/res/5122c902-6a93-4017-88a7-456a806d5ae1> ?p ?o . }" </div>
<div>p -> <<a href="http://www.w3.org/1999/02/22-rdf-syntax-ns#type">http://www.w3.org/1999/02/22-rdf-syntax-ns#type</a>>; o -> <<a href="http://www.semanticdesktop.org/ontologies/nfo#Video">http://www.semanticdesktop.org/ontologies/nfo#Video</a>> </div>
<div>p -> <<a href="http://www.w3.org/1999/02/22-rdf-syntax-ns#type">http://www.w3.org/1999/02/22-rdf-syntax-ns#type</a>>; o -> <<a href="http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#FileDataObject">http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#FileDataObject</a>> </div>
<div>p -> <<a href="http://www.semanticdesktop.org/ontologies/2007/08/15/nao#lastModified">http://www.semanticdesktop.org/ontologies/2007/08/15/nao#lastModified</a>>; o -> "2010-02-21T11:10:54.294Z"^^<<a href="http://www.w3.org/2001/XMLSchema#dateTime">http://www.w3.org/2001/XMLSchema#dateTime</a>> </div>
<div>p -> <<a href="http://www.semanticdesktop.org/ontologies/2007/08/15/nao#created">http://www.semanticdesktop.org/ontologies/2007/08/15/nao#created</a>>; o -> "2010-02-17T10:31:32.517Z"^^<<a href="http://www.w3.org/2001/XMLSchema#dateTime">http://www.w3.org/2001/XMLSchema#dateTime</a>> </div>
<div>p -> <<a href="http://www.semanticdesktop.org/ontologies/2007/01/19/nie#title">http://www.semanticdesktop.org/ontologies/2007/01/19/nie#title</a>>; o -> "crest-demo.mp4"^^<<a href="http://www.w3.org/2001/XMLSchema#string">http://www.w3.org/2001/XMLSchema#string</a>></div>
<div>p -> <<a href="http://www.semanticdesktop.org/ontologies/2007/01/19/nie#lastModified">http://www.semanticdesktop.org/ontologies/2007/01/19/nie#lastModified</a>>; o -> "2009-09-27T17:09:12Z"^^<<a href="http://www.w3.org/2001/XMLSchema#dateTime">http://www.w3.org/2001/XMLSchema#dateTime</a>></div>
<div>p -> <<a href="http://www.semanticdesktop.org/ontologies/2007/01/19/nie#mimeType">http://www.semanticdesktop.org/ontologies/2007/01/19/nie#mimeType</a>>; o -> "video/mp4"^^<<a href="http://www.w3.org/2001/XMLSchema#string">http://www.w3.org/2001/XMLSchema#string</a>></div>
<div>p -> <<a href="http://www.semanticdesktop.org/ontologies/2007/01/19/nie#contentSize">http://www.semanticdesktop.org/ontologies/2007/01/19/nie#contentSize</a>>; o -> "6593037"^^<<a href="http://www.w3.org/2001/XMLSchema#int">http://www.w3.org/2001/XMLSchema#int</a>></div>
<div>p -> <<a href="http://www.semanticdesktop.org/ontologies/2007/01/19/nie#url">http://www.semanticdesktop.org/ontologies/2007/01/19/nie#url</a>>; o -> <filex://44b1-0599/home/alex/Video/crest-demo.mp4></div>
<div>p -> <<a href="http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#fileName">http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#fileName</a>>; o -> "crest-demo.mp4"^^<<a href="http://www.w3.org/2001/XMLSchema#string">http://www.w3.org/2001/XMLSchema#string</a>></div>
<div>p -> <<a href="http://www.strigi.org/data#TODO_video.duration">http://www.strigi.org/data#TODO_video.duration</a>>; o -> "303"^^<<a href="http://www.w3.org/2001/XMLSchema#int">http://www.w3.org/2001/XMLSchema#int</a>></div>
<div>p -> <<a href="http://www.strigi.org/data#media.duration">http://www.strigi.org/data#media.duration</a>>; o -> "302"^^<<a href="http://www.w3.org/2001/XMLSchema#int">http://www.w3.org/2001/XMLSchema#int</a>></div>
<div>p -> <<a href="http://www.strigi.org/data#media.duration">http://www.strigi.org/data#media.duration</a>>; o -> "303"^^<<a href="http://www.w3.org/2001/XMLSchema#int">http://www.w3.org/2001/XMLSchema#int</a>></div>
<div>p -> <<a href="http://www.strigi.org/data#image.width">http://www.strigi.org/data#image.width</a>>; o -> "480"^^<<a href="http://www.w3.org/2001/XMLSchema#int">http://www.w3.org/2001/XMLSchema#int</a>></div>
<div>p -> <<a href="http://www.strigi.org/data#image.height">http://www.strigi.org/data#image.height</a>>; o -> "270"^^<<a href="http://www.w3.org/2001/XMLSchema#int">http://www.w3.org/2001/XMLSchema#int</a>></div>
<div>p -> <<a href="http://www.strigi.org/data#av.video_codec">http://www.strigi.org/data#av.video_codec</a>>; o -> "avc1"^^<<a href="http://www.w3.org/2001/XMLSchema#string">http://www.w3.org/2001/XMLSchema#string</a>></div>
<div>p -> <<a href="http://www.strigi.org/data#content.mime_type">http://www.strigi.org/data#content.mime_type</a>>; o -> "video/mp4"^^<<a href="http://www.w3.org/2001/XMLSchema#string">http://www.w3.org/2001/XMLSchema#string</a>></div>
<div>p -> <<a href="http://www.strigi.org/data#audio.channel_count">http://www.strigi.org/data#audio.channel_count</a>>; o -> "2"^^<<a href="http://www.w3.org/2001/XMLSchema#int">http://www.w3.org/2001/XMLSchema#int</a>></div>
<div>p -> <<a href="http://www.strigi.org/data#media.sample_format">http://www.strigi.org/data#media.sample_format</a>>; o -> "16 bit int"^^<<a href="http://www.w3.org/2001/XMLSchema#string">http://www.w3.org/2001/XMLSchema#string</a>></div>
<div>p -> <<a href="http://www.strigi.org/data#media.sample_rate">http://www.strigi.org/data#media.sample_rate</a>>; o -> "44100"^^<<a href="http://www.w3.org/2001/XMLSchema#int">http://www.w3.org/2001/XMLSchema#int</a>></div>
<div>p -> <<a href="http://www.strigi.org/data#av.audio_codec">http://www.strigi.org/data#av.audio_codec</a>>; o -> "mp4a"^^<<a href="http://www.w3.org/2001/XMLSchema#string">http://www.w3.org/2001/XMLSchema#string</a>></div>
<div><br></div></div><div>And I used Python and I have done the following:</div><div>res = Nepomuk.Resource("/home/alex/Video/crest-demo.mp4")</div><div>tags = [Nepomuk.Tag("Video")]</div><div>res.setTags(tags)</div>
<div><br></div><div>and this creates a different resource as follows:</div><div><br></div><div>sopranocmd --dbus org.kde.NepomukStorage --model main query "select ?r where { ?r nie:url <file:///home/alex/Video/crest-demo.mp4> . }"</div>
<div>r -> <nepomuk:/res/90905529-b98a-4e25-a725-705c94934a77> </div><div><br></div><div><div>sopranocmd --dbus org.kde.NepomukStorage --model main query "select ?p ?o where { <nepomuk:/res/90905529-b98a-4e25-a725-705c94934a77> ?p ?o . }"</div>
<div>p -> <<a href="http://www.w3.org/1999/02/22-rdf-syntax-ns#type">http://www.w3.org/1999/02/22-rdf-syntax-ns#type</a>>; o -> <<a href="http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#FileDataObject">http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#FileDataObject</a>></div>
<div>p -> <<a href="http://www.semanticdesktop.org/ontologies/2007/08/15/nao#lastModified">http://www.semanticdesktop.org/ontologies/2007/08/15/nao#lastModified</a>>; o -> "2010-02-24T12:03:10.797Z"^^<<a href="http://www.w3.org/2001/XMLSchema#dateTime">http://www.w3.org/2001/XMLSchema#dateTime</a>></div>
<div>p -> <<a href="http://www.semanticdesktop.org/ontologies/2007/08/15/nao#hasTag">http://www.semanticdesktop.org/ontologies/2007/08/15/nao#hasTag</a>>; o -> <nepomuk:/res/18dde644-cb42-40c4-b6bd-c2602ea0a3a5></div>
<div>p -> <<a href="http://www.semanticdesktop.org/ontologies/2007/08/15/nao#created">http://www.semanticdesktop.org/ontologies/2007/08/15/nao#created</a>>; o -> "2010-02-24T12:03:10.73Z"^^<<a href="http://www.w3.org/2001/XMLSchema#dateTime">http://www.w3.org/2001/XMLSchema#dateTime</a>></div>
<div>p -> <<a href="http://www.semanticdesktop.org/ontologies/2007/01/19/nie#url">http://www.semanticdesktop.org/ontologies/2007/01/19/nie#url</a>>; o -> <file:///home/alex/Video/crest-demo.mp4></div></div>
<div><br></div><div>(sorry for the lenghy mail)</div><div>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).</div>
</div><br>-- <br>Sivieri Alessandro<br><a href="mailto:alessandro.sivieri@gmail.com">alessandro.sivieri@gmail.com</a><br><a href="http://www.chimera-bellerofonte.eu/">http://www.chimera-bellerofonte.eu/</a><br><a href="http://www.poul.org/">http://www.poul.org/</a><br>