<div class="gmail_quote">2010/2/24 Sebastian Trüg <span dir="ltr">&lt;<a href="mailto:trueg@kde.org">trueg@kde.org</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<div class="im">&gt;    - if I want to associate, for example, tags in a (python) script, I used</div>
<div class="im">&gt;    to create a Nepomuk::Resource, passing a full file path as argument of<br>
&gt; its constructor, and then call setTags; now, if I do this, nie:url is<br>
&gt; again file:// (as before), and it becomes a different resource from the<br>
&gt; one indexed by Strigi (which has filex://): how can I get the resource<br>
&gt; 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&#39;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 &quot;select ?r where { ?r nie:url &lt;filex://44b1-0599/home/alex/Video/crest-demo.mp4&gt; . }&quot;</div><div>r -&gt; &lt;nepomuk:/res/5122c902-6a93-4017-88a7-456a806d5ae1&gt;</div>

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

<div>p -&gt; &lt;<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>&gt;; o -&gt; &lt;<a href="http://www.semanticdesktop.org/ontologies/nfo#Video">http://www.semanticdesktop.org/ontologies/nfo#Video</a>&gt;                                                                                                              </div>

<div>p -&gt; &lt;<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>&gt;; o -&gt; &lt;<a href="http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#FileDataObject">http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#FileDataObject</a>&gt;                                                                                          </div>

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

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

<div>p -&gt; &lt;<a href="http://www.semanticdesktop.org/ontologies/2007/01/19/nie#title">http://www.semanticdesktop.org/ontologies/2007/01/19/nie#title</a>&gt;; o -&gt; &quot;crest-demo.mp4&quot;^^&lt;<a href="http://www.w3.org/2001/XMLSchema#string">http://www.w3.org/2001/XMLSchema#string</a>&gt;</div>

<div>p -&gt; &lt;<a href="http://www.semanticdesktop.org/ontologies/2007/01/19/nie#lastModified">http://www.semanticdesktop.org/ontologies/2007/01/19/nie#lastModified</a>&gt;; o -&gt; &quot;2009-09-27T17:09:12Z&quot;^^&lt;<a href="http://www.w3.org/2001/XMLSchema#dateTime">http://www.w3.org/2001/XMLSchema#dateTime</a>&gt;</div>

<div>p -&gt; &lt;<a href="http://www.semanticdesktop.org/ontologies/2007/01/19/nie#mimeType">http://www.semanticdesktop.org/ontologies/2007/01/19/nie#mimeType</a>&gt;; o -&gt; &quot;video/mp4&quot;^^&lt;<a href="http://www.w3.org/2001/XMLSchema#string">http://www.w3.org/2001/XMLSchema#string</a>&gt;</div>

<div>p -&gt; &lt;<a href="http://www.semanticdesktop.org/ontologies/2007/01/19/nie#contentSize">http://www.semanticdesktop.org/ontologies/2007/01/19/nie#contentSize</a>&gt;; o -&gt; &quot;6593037&quot;^^&lt;<a href="http://www.w3.org/2001/XMLSchema#int">http://www.w3.org/2001/XMLSchema#int</a>&gt;</div>

<div>p -&gt; &lt;<a href="http://www.semanticdesktop.org/ontologies/2007/01/19/nie#url">http://www.semanticdesktop.org/ontologies/2007/01/19/nie#url</a>&gt;; o -&gt; &lt;filex://44b1-0599/home/alex/Video/crest-demo.mp4&gt;</div>

<div>p -&gt; &lt;<a href="http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#fileName">http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#fileName</a>&gt;; o -&gt; &quot;crest-demo.mp4&quot;^^&lt;<a href="http://www.w3.org/2001/XMLSchema#string">http://www.w3.org/2001/XMLSchema#string</a>&gt;</div>

<div>p -&gt; &lt;<a href="http://www.strigi.org/data#TODO_video.duration">http://www.strigi.org/data#TODO_video.duration</a>&gt;; o -&gt; &quot;303&quot;^^&lt;<a href="http://www.w3.org/2001/XMLSchema#int">http://www.w3.org/2001/XMLSchema#int</a>&gt;</div>

<div>p -&gt; &lt;<a href="http://www.strigi.org/data#media.duration">http://www.strigi.org/data#media.duration</a>&gt;; o -&gt; &quot;302&quot;^^&lt;<a href="http://www.w3.org/2001/XMLSchema#int">http://www.w3.org/2001/XMLSchema#int</a>&gt;</div>

<div>p -&gt; &lt;<a href="http://www.strigi.org/data#media.duration">http://www.strigi.org/data#media.duration</a>&gt;; o -&gt; &quot;303&quot;^^&lt;<a href="http://www.w3.org/2001/XMLSchema#int">http://www.w3.org/2001/XMLSchema#int</a>&gt;</div>

<div>p -&gt; &lt;<a href="http://www.strigi.org/data#image.width">http://www.strigi.org/data#image.width</a>&gt;; o -&gt; &quot;480&quot;^^&lt;<a href="http://www.w3.org/2001/XMLSchema#int">http://www.w3.org/2001/XMLSchema#int</a>&gt;</div>

<div>p -&gt; &lt;<a href="http://www.strigi.org/data#image.height">http://www.strigi.org/data#image.height</a>&gt;; o -&gt; &quot;270&quot;^^&lt;<a href="http://www.w3.org/2001/XMLSchema#int">http://www.w3.org/2001/XMLSchema#int</a>&gt;</div>

<div>p -&gt; &lt;<a href="http://www.strigi.org/data#av.video_codec">http://www.strigi.org/data#av.video_codec</a>&gt;; o -&gt; &quot;avc1&quot;^^&lt;<a href="http://www.w3.org/2001/XMLSchema#string">http://www.w3.org/2001/XMLSchema#string</a>&gt;</div>

<div>p -&gt; &lt;<a href="http://www.strigi.org/data#content.mime_type">http://www.strigi.org/data#content.mime_type</a>&gt;; o -&gt; &quot;video/mp4&quot;^^&lt;<a href="http://www.w3.org/2001/XMLSchema#string">http://www.w3.org/2001/XMLSchema#string</a>&gt;</div>

<div>p -&gt; &lt;<a href="http://www.strigi.org/data#audio.channel_count">http://www.strigi.org/data#audio.channel_count</a>&gt;; o -&gt; &quot;2&quot;^^&lt;<a href="http://www.w3.org/2001/XMLSchema#int">http://www.w3.org/2001/XMLSchema#int</a>&gt;</div>

<div>p -&gt; &lt;<a href="http://www.strigi.org/data#media.sample_format">http://www.strigi.org/data#media.sample_format</a>&gt;; o -&gt; &quot;16 bit int&quot;^^&lt;<a href="http://www.w3.org/2001/XMLSchema#string">http://www.w3.org/2001/XMLSchema#string</a>&gt;</div>

<div>p -&gt; &lt;<a href="http://www.strigi.org/data#media.sample_rate">http://www.strigi.org/data#media.sample_rate</a>&gt;; o -&gt; &quot;44100&quot;^^&lt;<a href="http://www.w3.org/2001/XMLSchema#int">http://www.w3.org/2001/XMLSchema#int</a>&gt;</div>

<div>p -&gt; &lt;<a href="http://www.strigi.org/data#av.audio_codec">http://www.strigi.org/data#av.audio_codec</a>&gt;; o -&gt; &quot;mp4a&quot;^^&lt;<a href="http://www.w3.org/2001/XMLSchema#string">http://www.w3.org/2001/XMLSchema#string</a>&gt;</div>

<div><br></div></div><div>And I used Python and I have done the following:</div><div>res = Nepomuk.Resource(&quot;/home/alex/Video/crest-demo.mp4&quot;)</div><div>tags = [Nepomuk.Tag(&quot;Video&quot;)]</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 &quot;select ?r where { ?r nie:url &lt;file:///home/alex/Video/crest-demo.mp4&gt; . }&quot;</div>

<div>r -&gt; &lt;nepomuk:/res/90905529-b98a-4e25-a725-705c94934a77&gt; </div><div><br></div><div><div>sopranocmd --dbus org.kde.NepomukStorage --model main query &quot;select ?p ?o where { &lt;nepomuk:/res/90905529-b98a-4e25-a725-705c94934a77&gt; ?p ?o . }&quot;</div>

<div>p -&gt; &lt;<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>&gt;; o -&gt; &lt;<a href="http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#FileDataObject">http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#FileDataObject</a>&gt;</div>

<div>p -&gt; &lt;<a href="http://www.semanticdesktop.org/ontologies/2007/08/15/nao#lastModified">http://www.semanticdesktop.org/ontologies/2007/08/15/nao#lastModified</a>&gt;; o -&gt; &quot;2010-02-24T12:03:10.797Z&quot;^^&lt;<a href="http://www.w3.org/2001/XMLSchema#dateTime">http://www.w3.org/2001/XMLSchema#dateTime</a>&gt;</div>

<div>p -&gt; &lt;<a href="http://www.semanticdesktop.org/ontologies/2007/08/15/nao#hasTag">http://www.semanticdesktop.org/ontologies/2007/08/15/nao#hasTag</a>&gt;; o -&gt; &lt;nepomuk:/res/18dde644-cb42-40c4-b6bd-c2602ea0a3a5&gt;</div>

<div>p -&gt; &lt;<a href="http://www.semanticdesktop.org/ontologies/2007/08/15/nao#created">http://www.semanticdesktop.org/ontologies/2007/08/15/nao#created</a>&gt;; o -&gt; &quot;2010-02-24T12:03:10.73Z&quot;^^&lt;<a href="http://www.w3.org/2001/XMLSchema#dateTime">http://www.w3.org/2001/XMLSchema#dateTime</a>&gt;</div>

<div>p -&gt; &lt;<a href="http://www.semanticdesktop.org/ontologies/2007/01/19/nie#url">http://www.semanticdesktop.org/ontologies/2007/01/19/nie#url</a>&gt;; o -&gt; &lt;file:///home/alex/Video/crest-demo.mp4&gt;</div></div>

<div><br></div><div>(sorry for the lenghy mail)</div><div>So I think that there is something wrong here... I&#39;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&#39;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>