Hi Damian
Yes you can do what you want by extracting the value from RELS-EXT, my
suggestion was that there could be a simpler approach.
I'm not sure what your workflow is, so you might have to adapt this, but
essentially:
- When you create your FOXML (or add/update your RELS-EXT datastream), if
your data contains the triple <object> <ns:value> "literal" where literal is
a URL, you would also create a datastream called "IMAGE_URL".
- This datastream would be type "E" - external content, with the
foxml:contentLocation set to the URL - see the FOXML reference example
<https://wiki.duraspace.org/x/MQFM> https://wiki.duraspace.org/x/MQFM
particularly the IMAGE datastream. Also see the REST API method
https://wiki.duraspace.org/display/FCR30/REST+API#RESTAPI-addDatastream -
you would use controlGroup="E" and dsLocation="your URL".
- Thus you would have a datastream, that when accessed, would supply your
image.
- Then, in your Cmodel/sdef/sdep, you would supply that datastream as a
parameter to the ImageManipulation service.
Note that datastreams can be passed by value or by reference ("VALUE",
"URL_REF") - in the former case it is the contents of the datastream that
get "inserted" into the WSDL operation location URL, and in the latter case
the URL of the datastream gets inserted (actually there is a further level
of complexity here that I won't go into).
So the method would call the ImageManipulation service supplying the URL of
your datastream
BTW -> Can object 'support' more than one models?
Yes
Also, since your method for manipulating the image only applies where there
is an ns:value which is an image URL, you would probably only want to add
the content model declaration to your object for the cases where an object
has this URL (and not apply the content models where ns:value is a string,
number etc).
If you want to go down the approach of extracting the value from RELS-EXT, I
don't think it would be necessary to perform a resource index query - you
could extract the value directly from your RELS-EXT datastream.
So you would need
1) an XSLT, which when applied to RELS-EXT, returns the URL value you want,
as a simple text string (*not* as XML). As this XSLT relates to the
implementation of the service I'd suggest storing this in your SDef object.
2) a method which calls the SAXON service, passing in the XSLT datastream
and the RELS_EXT datastream (as URL_REF)
3) at this point you can test your new method to make sure it returns a
simple text string of the URL from RELS-EXT
4) a method that calls the ImageManipulation service using the results of
your saxon disseminator. Note that a method cannot be (currently) used as
an input to another method, so one approach is to "surface" your first
method as an object datastream - this is the approach taken by the
collection demo, where the LIST datastream is used to surface the "list"
method; and where the "view" method uses the "list" method indirectly by
referencing the LIST datastream. I think you would need to pass the
datastream input parameter to the ImageManipulation service as VALUE rather
than URL_REF - as you want to transform the URL returned, rather than
transform the contents of the datastream.
It would seem that your method would not "work" in all cases - as in some
cases your ns:value is not an image URL - again some approach of using
different content models for different "kinds" of data objects could be
used.
Regards
Steve
-----Original Message-----
From: Damian Kaliszan [mailto:dam...@man.poznan.pl]
Sent: 03 November 2010 12:08
To: Steve Bayliss
Cc: fedora-commons-users@lists.sourceforge.net
Subject: Re: Using ImageManip srv to manipulate image with URL stored in
RELS-EXT
Importance: High
Hi Steve,
Yes, you're 100% right.
RELS-EXT content might be taken from my previous email (if it's not enough
I
can send you the xml source of the object)
Subject Predicate Object
-----------------------------------------------------
info:fedora/ns:pid ns:isMemberOf ns:measurements
info:fedora/ns:pid ns:property ns:244
info:fedora/ns:pid ns:device ns:229
info:fedora/ns:pid ns:value
"http://www.google.pl/intl/en_com/images/srpr/logo1w.png"
info:fedora/ns:pid ns:datetime ""1288347628020""
If it's possible what I'm going to do I would need to create Sdep,
SDef like it's done in demo objects demo:27 (Sdef),
demo:28(Sdep) & demo:UVA_STD_IMAGE (CM Object)
This is a fragment taken from demo:28/WSDL
<wsdl:operation name="resizeImage">
<http:operation
location="ImageManipulation?url=(url)&op=resize&newWidth=(width)"/>
<wsdl:input>
<http:urlReplacement/>
</wsdl:input>
<wsdl:output>
<mime:content type="image/gif"/>
<mime:content type="image/jpeg"/>
<mime:content type="image/tiff"/>
<mime:content type="image/png"/>
<mime:content type="image/bmp"/>
</wsdl:output>
</wsdl:operation>
demo:29 is an example object having the model demo:UVA_STD_IMAGE with
separate datastream 'url'.
This is exactly what I'mging to do but instead of separate 'url'
datastream I'd like to take the image url value from
RELS-EXT#ns:value .....
So it would be something like...
<http:operation
location="ImageManipulation?url=(RELS-EXT#ns:value)&op=resize&newWid
th=(width)"/>
Hope you can help....
BTW -> Can object 'support' more than one models?
Best regards,
Damian
W Twoim liście datowanym 3 listopada 2010 (12:47:37) można przeczytać:
> Hi Damian
> Maybe I am misunderstanding what you are trying to do.
> My understanding was:
> 1) Your RELS-EXT datastream contains an image URL
> 2) you want to extract this image URL and pass this to a method (ie
through
> the WSDL of an SDep) so that the imagemanip service can resize it?
> Is that correct?
> If so, can you give me an example of your RELS-EXT which includes the
Image
> URL.
> Regards
> Steve
>> -----Original Message-----
>> From: Damian Kaliszan [mailto:dam...@man.poznan.pl]
>> Sent: 03 November 2010 10:11
>> To: Steve Bayliss
>> Cc: fedora-commons-users@lists.sourceforge.net
>> Subject: Re: Using ImageManip srv to manipulate image with
>> URL stored in RELS-EXT
>> Dear Steve,
>> Thank you for your answer.
>> I was thinking about your answer...
>> The problem is the measurement values come from different sources.
>> Shortly...my model is as follows.
>> I have different devices (collection of devices), described by some
>> properties (collection of properties) and measurements described by
>> (values stored in RELS-EXT):
>> Single measurement's RELS-EXT:
>> -------------------------------
>> info:fedora/ns:pid ns:isMemberOf ns:measurements
>> info:fedora/ns:pid ns:property ns:244
>> info:fedora/ns:pid ns:device ns:229
>> info:fedora/ns:pid ns:value ""10zeg7bdjb2j6""
>> info:fedora/ns:pid ns:datetime ""1288347628020""
>> So as you can see ns:value is "some value" at this point....
>> Once the value might be a temperature, the other time humidity or
>> - if the device is a camera - the value is an URL of the picture....
>> So, at the point of ingesting the object I don't want the repository
>> to know what "type" of value is it - an integer, url of something
>> different.....
>> By creating a datastream it would complicate things a bit.... I
>> think...This datastream would store only one value ...If I could
>> store non-XML data (image url as well) in 'Internal XML
>> data' type datastream and call it
>> - let's say - IMAGE then I could update my SDep (WSDL
>> datastream in
>> measurementsCollectionImpl that provides list of all measurements) so
>> this IMAGE could be referenced as
<http://myserver:port/imagemanip/Imagemanip?url=(IMAGE)&op=> >>
http://myserver:port/imagemanip/Imagemanip?url=(IMAGE)&op=
>> resize...
>> This is clear for me...But it cannot be done because - as the
>> name says - Internal XML data' does not let me save non-xml
>> data inside...
>> Is there any way to do it I described in my previous email? -> values
>> are store in RELS-EXT? But how to reference it
>> later in WSDL of
>> measurementsCollectionImpl?
<http://myserver:port/imagemanip/Imagemanip?url=(RELS-EXT#MY:PR> >>
http://myserver:port/imagemanip/Imagemanip?url=(RELS-EXT#MY:PR
>> ED)&op=resize..
>> ??????
>> Best regards,
>> Damian
>> W Twoim liście datowanym 3 listopada 2010 (10:30:24) można przeczytać:
>> > Hi Damian
>> > One thought, which doesn't directly address your question
>> but might provide
>> > an alternative (possibly simpler?) method to achieve what
>> you want to do:
>> > How about creating a datastream, type "External" or
>> "Redirect" for your
>> > IMAGE_URL - ie a Fedora datastream that acts as a proxy for
>> the IMAGE_URL?
>> > You could then reference this Fedora datastream directly in
>> the method.
>> > Optionally you could reference the Fedora datastream URI (eg
>> > info:fedora/ns:pid/experiment_image) in the RELS_EXT rather than the
>> > external URL.
>> > (this also potentially has the benefit of introducing a level of
>> > indirection, so if for instance you had to change the
>> external service that
>> > is currently providing these images, you would just update
>> what the Fedora
>> > datastream points to).
>> > Regards
>> > Steve
>> >> -----Original Message-----
>> >> From: Damian Kaliszan [mailto:dam...@man.poznan.pl]
>> >> Sent: 03 November 2010 08:58
>> >> To: Steve Bayliss
>> >> Cc: fedora-commons-users@lists.sourceforge.net
>> >> Subject: Using ImageManip srv to manipulate image with URL
>> >> stored in RELS-EXT
>> >>
>> >>
>> >> Dear Steve, All!
>> >>
>> >> I use FC to store some measurements (from real
>> instruments) values.
>> >> One of them is image URL of the experiment. I store
>> this URL in
>> >> RELS-EXT (MY:PID->MY:PRED->IMAGE_URL) datastream
>> >> I'd like to use built-in Imagemanip service to get the
>> original image
>> >> resized/cropped etc.
>> >>
>> >> How to pass IMAGE_URL from RELS_EXT (or DC if it's better) to
>> >> Imagemanip?.....
>> >>
>> >> Similarly as it was done in example CollectionImpl with
>> >> 'list' disseminator
>> >> http://myserver:port/saxon/SaxonServlet?source=(LIST)
<http://myserver:port/saxon/SaxonServlet?source=(LIST)&styl> &styl
>> > e=(XSLT)&clear-stylesheet-cache=(CLEAR_CACHE)"/>
>> > But here LIST & XSLT are different datastreams (called LIST & XSLT)
>> > So.. In my case it would be something like:
>> >
<http://myserver:port/saxon/Imagemanip?url=(RELS-EXT#MY:PRED)&a> >>
http://myserver:port/saxon/Imagemanip?url=(RELS-EXT#MY:PRED)&a
> mp;op=resize..
>> Then, under the method getChangedImage I'd have the appropriate method
>> called from WSDL (that I would have to create of course...like in the
>> Collection example)
<http://myserver:port/fedora/objects/MY:PID/methods/getChangedImage> >>
http://myserver:port/fedora/objects/MY:PID/methods/getChangedImage
>> Is it possible at all? If so, could you please help me with that?
>> Best regards,
>> Damian
------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a
Billion" shares his insights and actions to help propel your
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
Fedora-commons-users mailing list
Fedora-commons-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fedora-commons-users