<div dir="ltr">Hi Brian,<div><br></div><div>The location of a bitstream on the server's filesystem is known only to the server, it isn't exposed in the API in any way. As such, it wouldn't be possible to know its server-side path using pydas. Out of curiosity, what's your use case where you would want to know that information?</div>
<div><br></div><div>Thanks,</div><div><br></div><div>Zach</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Oct 30, 2013 at 6:49 PM, BRIAN E CHAPMAN <span dir="ltr"><<a href="mailto:Brian.Chapman@utah.edu" target="_blank">Brian.Chapman@utah.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="font-size:14px;font-family:Calibri,sans-serif;word-wrap:break-word">
<div>
<div>
<div>Hello Midas World,</div>
<div><br>
</div>
<div>In 2012 Patrick posted the following code snippet to identify the location of a bitstream in the file system. Can the equivalent be done in pydas?</div>
<div><br>
</div>
<div>
<pre>Mona,
First, a bit about how items correspond to files. Items are made up of revisions. Most items contain one revision (the head or latest revision). Within each revision are bitstreams. These bitstreams are analogous to the files on the file system. With all that in mind, the following code should get you what you want (I'm going to assume the item ID is in a variable called, appropriately, $itemId.):
// Load our models
$ItemModel = MidasLoader::loadModel('Item');
$ItemRevisionModel = MidasLoader::loadModel('ItemRevision');
$BitstreamModel = MidasLoader::loadModel('Bitstream');
// Get the item and its last revision from the time id
$itemDao = $ItemModel->load($itemId);
$lastRevisionDao = $ItemModel->getLastRevision($itemDao);
// loop through the bitstreams and print their paths
foreach($lastRevisionDao->getBitstreams() as $bitstreamDao)
{
print($bitstreamDao->getPath());
}
Hope that helps!
Thanks,
Patrick Reynolds
Technical Leader
Kitware, Inc.
<a href="tel:919%20869%208848" value="+19198698848" target="_blank">919 869 8848</a></pre>
<pre><br></pre>
</div>
<div>
<div>Brian E. Chapman, Ph.D.</div>
<div>Associate Professor</div>
<div>Department of Radiology</div>
<div>University of Utah</div>
<div><br>
</div>
</div>
</div>
</div>
</div>
<br>_______________________________________________<br>
Midas mailing list<br>
<a href="mailto:Midas@public.kitware.com">Midas@public.kitware.com</a><br>
<a href="http://public.kitware.com/cgi-bin/mailman/listinfo/midas" target="_blank">http://public.kitware.com/cgi-bin/mailman/listinfo/midas</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>Zach Mullen<br>R & D Engineer<br>Kitware Inc.<br>919-869-8858
</div>