You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@clerezza.apache.org by Oliver Strässer <ol...@getunik.com> on 2010/07/05 12:12:28 UTC
@reto AW: Language in ssp
Hi Reto
I tried our code with tsuy and hasan, but the code wouldn't work.
so we used the following function:
def returnLangValue(iter: CollectedIter[RichGraphNode], lang: Language) =
try {
if((iter).length > 0){
var nodeBuffer = new NodeBuffer;
for(item <- iter) yield {
ifx(item.getNode.asInstanceOf[PlainLiteral].getLanguage == lang) {
nodeBuffer :+ item*
item*
}
}
nodeBuffer.toSeq
} else {
""
}
} catch {case e:Exception => ""}
val lang = new Language(language)
that works very fine, if I wouldn't output the content in an html element:
<li class="tx-line">
<label for={PET_.title}>Title</label>
{returnLangValue(res/dct("title"), lang)} <!-- woks -->
<input type="text" id={PET_.title} name={PET_.title} value={returnLangValue(res/dct("title"), lang)} /> <!-- works not (output is: <input type="text" id="title" name="title" value= /> )
</li>
whats the problem and the solution ;-)
can you help me please ?
thanks
ol
--getunik ag-------------------------------------------
oliver straesser oliver.straesser@getunik.com
hardturmstrasse 101 fon: +41 (0)44 388 55 88
ch-8005 zuerich fax: +41 (0)44 388 55 89
--aktuelles getunik projekt-------------------------
Agieren Sie lokal! Geo Marketing für Ihre E-Mail Kampagne: www.geomarketing.com
--best of swiss web awards 2009------------------
Gold & Silber für Connect2Earth / Bronze für WWF UK
we make the web a better place - www.getunik.com
*****************************************************************
Bitte drucken Sie dieses E-Mail nur bei Bedarf aus. Die Umwelt dankt es Ihnen.
*****************************************************************
-----Ursprüngliche Nachricht-----
Von: Reto Bachmann-Gmuer [mailto:reto.bachmann@trialox.org]
Gesendet: Dienstag, 29. Juni 2010 20:46
An: clerezza-dev@incubator.apache.org
Betreff: Re: Language in ssp
There's no specific support for this, but something like the following
should work
val lang = new Language("en")
(res/dct("title")).find(l
=>(l!).asInstanceOf[PlainLiteral].getLanguage == lang))
reto
On Mon, Jun 28, 2010 at 11:35 AM, Oliver Strässer
<ol...@getunik.com> wrote:
> is there a possibility to retrieve the specific language tagged literal in ssp?
>
> somthing like: res/dct("title" , "en")
>
> cheers oli
>
> --getunik ag-------------------------------------------
> oliver straesser oliver.straesser@getunik.com<ma...@getunik.com>
> hardturmstrasse 101 fon: +41 (0)44 388 55 88
> ch-8005 zuerich fax: +41 (0)44 388 55 89
>
> --aktuelles getunik projekt-------------------------
> Agieren Sie lokal! Geo Marketing für Ihre E-Mail Kampagne: www.geomarketing.com<http://www.geomarketing.com/>
>
> --best of swiss web awards 2009------------------
> Gold & Silber für Connect2Earth / Bronze für WWF UK
>
> we make the web a better place - www.getunik.com<http://www.getunik.com/>
>
>
>
>
> *****************************************************************
> P Bitte drucken Sie dieses E-Mail nur bei Bedarf aus. Die Umwelt dankt es Ihnen.
> *****************************************************************
>
>
Re: @reto AW: Language in ssp
Posted by Reto Bachmann-Gmuer <re...@trialox.org>.
ok, the free-style code in my original mail had an unbalanced bracket and
was missing the invocation of get. I added an example/test to
RichGraphNodeTest.scala:
def literalLanguage = {
node = new GraphNode(greetingsUri, mGraph)
val lang = new Language("en")
val enValue =
(node/RDF.value).find(l=>(l!).asInstanceOf[PlainLiteral].getLanguage ==
lang).get
Assert.assertEquals("hello", enValue*)
}
In real life you would probably have a case-statement instead of the get.
Cheers,
reto
PS: please do not change the title of the mails in a thread unless you
change the topic, the @reto is pointless as you'd probably be equally happy
with the answer of someone else
On Wed, Jul 7, 2010 at 9:13 AM, Oliver Strässer <
oliver.straesser@getunik.com> wrote:
> can you give me source example?
>
> because we tried this on friday already
>
> thank you
>
> --getunik ag-------------------------------------------
> oliver straesser oliver.straesser@getunik.com
> hardturmstrasse 101 fon: +41 (0)44 388 55 88
> ch-8005 zuerich fax: +41 (0)44 388 55 89
>
> --aktuelles getunik projekt-------------------------
> Agieren Sie lokal! Geo Marketing für Ihre E-Mail Kampagne:
> www.geomarketing.com
>
> --best of swiss web awards 2009------------------
> Gold & Silber für Connect2Earth / Bronze für WWF UK
>
> we make the web a better place - www.getunik.com
>
>
>
>
> *****************************************************************
> Bitte drucken Sie dieses E-Mail nur bei Bedarf aus. Die Umwelt dankt es
> Ihnen.
> *****************************************************************
>
>
> -----Ursprüngliche Nachricht-----
> Von: Reto Bachmann-Gmuer [mailto:reto.bachmann@trialox.org]
> Gesendet: Montag, 5. Juli 2010 12:38
> An: clerezza-dev@incubator.apache.org
> Betreff: Re: @reto AW: Language in ssp
>
> Hi Oli
>
> as returnLangValue returns object I'm surprise you're not getting an
> exception. try creating a String either on nodeBuffer.toSeq (with mkString)
> or invoking toString on the value set as attribute.
>
> Cheers,
> reto
>
>
>
> On Mon, Jul 5, 2010 at 12:12 PM, Oliver Strässer <
> oliver.straesser@getunik.com> wrote:
>
> > Hi Reto
> >
> >
> > I tried our code with tsuy and hasan, but the code wouldn't work.
> >
> >
> > so we used the following function:
> >
> > def returnLangValue(iter: CollectedIter[RichGraphNode], lang: Language) =
> > try {
> > if((iter).length > 0){
> > var nodeBuffer = new NodeBuffer;
> > for(item <- iter) yield {
> > ifx(item.getNode.asInstanceOf[PlainLiteral].getLanguage ==
> lang)
> > {
> > nodeBuffer :+ item*
> > item*
> > }
> > }
> > nodeBuffer.toSeq
> > } else {
> > ""
> > }
> > } catch {case e:Exception => ""}
> >
> >
> >
> > val lang = new Language(language)
> >
> >
> >
> > that works very fine, if I wouldn't output the content in an html
> element:
> >
> > <li class="tx-line">
> > <label for={PET_.title}>Title</label>
> > {returnLangValue(res/dct("title"), lang)} <!-- woks -->
> > <input type="text" id={PET_.title} name={PET_.title}
> > value={returnLangValue(res/dct("title"), lang)} /> <!-- works not
> (output
> > is: <input type="text" id="title" name="title" value= /> )
> > </li>
> >
> > whats the problem and the solution ;-)
> > can you help me please ?
> >
> > thanks
> > ol
> >
> >
> >
> >
> > --getunik ag-------------------------------------------
> > oliver straesser oliver.straesser@getunik.com
> > hardturmstrasse 101 fon: +41 (0)44 388 55 88
> > ch-8005 zuerich fax: +41 (0)44 388 55 89
> >
> > --aktuelles getunik projekt-------------------------
> > Agieren Sie lokal! Geo Marketing für Ihre E-Mail Kampagne:
> > www.geomarketing.com
> >
> > --best of swiss web awards 2009------------------
> > Gold & Silber für Connect2Earth / Bronze für WWF UK
> >
> > we make the web a better place - www.getunik.com
> >
> >
> >
> >
> > *****************************************************************
> > Bitte drucken Sie dieses E-Mail nur bei Bedarf aus. Die Umwelt dankt es
> > Ihnen.
> > *****************************************************************
> >
> >
> > -----Ursprüngliche Nachricht-----
> > Von: Reto Bachmann-Gmuer [mailto:reto.bachmann@trialox.org]
> > Gesendet: Dienstag, 29. Juni 2010 20:46
> > An: clerezza-dev@incubator.apache.org
> > Betreff: Re: Language in ssp
> >
> > There's no specific support for this, but something like the following
> > should work
> >
> > val lang = new Language("en")
> > (res/dct("title")).find(l
> > =>(l!).asInstanceOf[PlainLiteral].getLanguage == lang))
> >
> > reto
> >
> > On Mon, Jun 28, 2010 at 11:35 AM, Oliver Strässer
> > <ol...@getunik.com> wrote:
> > > is there a possibility to retrieve the specific language tagged literal
> > in ssp?
> > >
> > > somthing like: res/dct("title" , "en")
> > >
> > > cheers oli
> > >
> > > --getunik ag-------------------------------------------
> > > oliver straesser oliver.straesser@getunik.com<mailto:
> > oliver.straesser@getunik.com>
> > > hardturmstrasse 101 fon: +41 (0)44 388 55 88
> > > ch-8005 zuerich fax: +41 (0)44 388 55 89
> > >
> > > --aktuelles getunik projekt-------------------------
> > > Agieren Sie lokal! Geo Marketing für Ihre E-Mail Kampagne:
> > www.geomarketing.com<http://www.geomarketing.com/>
> > >
> > > --best of swiss web awards 2009------------------
> > > Gold & Silber für Connect2Earth / Bronze für WWF UK
> > >
> > > we make the web a better place - www.getunik.com<
> http://www.getunik.com/
> > >
> > >
> > >
> > >
> > >
> > > *****************************************************************
> > > P Bitte drucken Sie dieses E-Mail nur bei Bedarf aus. Die Umwelt dankt
> es
> > Ihnen.
> > > *****************************************************************
> > >
> > >
> >
>
AW: @reto AW: Language in ssp
Posted by Oliver Strässer <ol...@getunik.com>.
can you give me source example?
because we tried this on friday already
thank you
--getunik ag-------------------------------------------
oliver straesser oliver.straesser@getunik.com
hardturmstrasse 101 fon: +41 (0)44 388 55 88
ch-8005 zuerich fax: +41 (0)44 388 55 89
--aktuelles getunik projekt-------------------------
Agieren Sie lokal! Geo Marketing für Ihre E-Mail Kampagne: www.geomarketing.com
--best of swiss web awards 2009------------------
Gold & Silber für Connect2Earth / Bronze für WWF UK
we make the web a better place - www.getunik.com
*****************************************************************
Bitte drucken Sie dieses E-Mail nur bei Bedarf aus. Die Umwelt dankt es Ihnen.
*****************************************************************
-----Ursprüngliche Nachricht-----
Von: Reto Bachmann-Gmuer [mailto:reto.bachmann@trialox.org]
Gesendet: Montag, 5. Juli 2010 12:38
An: clerezza-dev@incubator.apache.org
Betreff: Re: @reto AW: Language in ssp
Hi Oli
as returnLangValue returns object I'm surprise you're not getting an
exception. try creating a String either on nodeBuffer.toSeq (with mkString)
or invoking toString on the value set as attribute.
Cheers,
reto
On Mon, Jul 5, 2010 at 12:12 PM, Oliver Strässer <
oliver.straesser@getunik.com> wrote:
> Hi Reto
>
>
> I tried our code with tsuy and hasan, but the code wouldn't work.
>
>
> so we used the following function:
>
> def returnLangValue(iter: CollectedIter[RichGraphNode], lang: Language) =
> try {
> if((iter).length > 0){
> var nodeBuffer = new NodeBuffer;
> for(item <- iter) yield {
> ifx(item.getNode.asInstanceOf[PlainLiteral].getLanguage == lang)
> {
> nodeBuffer :+ item*
> item*
> }
> }
> nodeBuffer.toSeq
> } else {
> ""
> }
> } catch {case e:Exception => ""}
>
>
>
> val lang = new Language(language)
>
>
>
> that works very fine, if I wouldn't output the content in an html element:
>
> <li class="tx-line">
> <label for={PET_.title}>Title</label>
> {returnLangValue(res/dct("title"), lang)} <!-- woks -->
> <input type="text" id={PET_.title} name={PET_.title}
> value={returnLangValue(res/dct("title"), lang)} /> <!-- works not (output
> is: <input type="text" id="title" name="title" value= /> )
> </li>
>
> whats the problem and the solution ;-)
> can you help me please ?
>
> thanks
> ol
>
>
>
>
> --getunik ag-------------------------------------------
> oliver straesser oliver.straesser@getunik.com
> hardturmstrasse 101 fon: +41 (0)44 388 55 88
> ch-8005 zuerich fax: +41 (0)44 388 55 89
>
> --aktuelles getunik projekt-------------------------
> Agieren Sie lokal! Geo Marketing für Ihre E-Mail Kampagne:
> www.geomarketing.com
>
> --best of swiss web awards 2009------------------
> Gold & Silber für Connect2Earth / Bronze für WWF UK
>
> we make the web a better place - www.getunik.com
>
>
>
>
> *****************************************************************
> Bitte drucken Sie dieses E-Mail nur bei Bedarf aus. Die Umwelt dankt es
> Ihnen.
> *****************************************************************
>
>
> -----Ursprüngliche Nachricht-----
> Von: Reto Bachmann-Gmuer [mailto:reto.bachmann@trialox.org]
> Gesendet: Dienstag, 29. Juni 2010 20:46
> An: clerezza-dev@incubator.apache.org
> Betreff: Re: Language in ssp
>
> There's no specific support for this, but something like the following
> should work
>
> val lang = new Language("en")
> (res/dct("title")).find(l
> =>(l!).asInstanceOf[PlainLiteral].getLanguage == lang))
>
> reto
>
> On Mon, Jun 28, 2010 at 11:35 AM, Oliver Strässer
> <ol...@getunik.com> wrote:
> > is there a possibility to retrieve the specific language tagged literal
> in ssp?
> >
> > somthing like: res/dct("title" , "en")
> >
> > cheers oli
> >
> > --getunik ag-------------------------------------------
> > oliver straesser oliver.straesser@getunik.com<mailto:
> oliver.straesser@getunik.com>
> > hardturmstrasse 101 fon: +41 (0)44 388 55 88
> > ch-8005 zuerich fax: +41 (0)44 388 55 89
> >
> > --aktuelles getunik projekt-------------------------
> > Agieren Sie lokal! Geo Marketing für Ihre E-Mail Kampagne:
> www.geomarketing.com<http://www.geomarketing.com/>
> >
> > --best of swiss web awards 2009------------------
> > Gold & Silber für Connect2Earth / Bronze für WWF UK
> >
> > we make the web a better place - www.getunik.com<http://www.getunik.com/
> >
> >
> >
> >
> >
> > *****************************************************************
> > P Bitte drucken Sie dieses E-Mail nur bei Bedarf aus. Die Umwelt dankt es
> Ihnen.
> > *****************************************************************
> >
> >
>
Re: @reto AW: Language in ssp
Posted by Reto Bachmann-Gmuer <re...@trialox.org>.
Hi Oli
as returnLangValue returns object I'm surprise you're not getting an
exception. try creating a String either on nodeBuffer.toSeq (with mkString)
or invoking toString on the value set as attribute.
Cheers,
reto
On Mon, Jul 5, 2010 at 12:12 PM, Oliver Strässer <
oliver.straesser@getunik.com> wrote:
> Hi Reto
>
>
> I tried our code with tsuy and hasan, but the code wouldn't work.
>
>
> so we used the following function:
>
> def returnLangValue(iter: CollectedIter[RichGraphNode], lang: Language) =
> try {
> if((iter).length > 0){
> var nodeBuffer = new NodeBuffer;
> for(item <- iter) yield {
> ifx(item.getNode.asInstanceOf[PlainLiteral].getLanguage == lang)
> {
> nodeBuffer :+ item*
> item*
> }
> }
> nodeBuffer.toSeq
> } else {
> ""
> }
> } catch {case e:Exception => ""}
>
>
>
> val lang = new Language(language)
>
>
>
> that works very fine, if I wouldn't output the content in an html element:
>
> <li class="tx-line">
> <label for={PET_.title}>Title</label>
> {returnLangValue(res/dct("title"), lang)} <!-- woks -->
> <input type="text" id={PET_.title} name={PET_.title}
> value={returnLangValue(res/dct("title"), lang)} /> <!-- works not (output
> is: <input type="text" id="title" name="title" value= /> )
> </li>
>
> whats the problem and the solution ;-)
> can you help me please ?
>
> thanks
> ol
>
>
>
>
> --getunik ag-------------------------------------------
> oliver straesser oliver.straesser@getunik.com
> hardturmstrasse 101 fon: +41 (0)44 388 55 88
> ch-8005 zuerich fax: +41 (0)44 388 55 89
>
> --aktuelles getunik projekt-------------------------
> Agieren Sie lokal! Geo Marketing für Ihre E-Mail Kampagne:
> www.geomarketing.com
>
> --best of swiss web awards 2009------------------
> Gold & Silber für Connect2Earth / Bronze für WWF UK
>
> we make the web a better place - www.getunik.com
>
>
>
>
> *****************************************************************
> Bitte drucken Sie dieses E-Mail nur bei Bedarf aus. Die Umwelt dankt es
> Ihnen.
> *****************************************************************
>
>
> -----Ursprüngliche Nachricht-----
> Von: Reto Bachmann-Gmuer [mailto:reto.bachmann@trialox.org]
> Gesendet: Dienstag, 29. Juni 2010 20:46
> An: clerezza-dev@incubator.apache.org
> Betreff: Re: Language in ssp
>
> There's no specific support for this, but something like the following
> should work
>
> val lang = new Language("en")
> (res/dct("title")).find(l
> =>(l!).asInstanceOf[PlainLiteral].getLanguage == lang))
>
> reto
>
> On Mon, Jun 28, 2010 at 11:35 AM, Oliver Strässer
> <ol...@getunik.com> wrote:
> > is there a possibility to retrieve the specific language tagged literal
> in ssp?
> >
> > somthing like: res/dct("title" , "en")
> >
> > cheers oli
> >
> > --getunik ag-------------------------------------------
> > oliver straesser oliver.straesser@getunik.com<mailto:
> oliver.straesser@getunik.com>
> > hardturmstrasse 101 fon: +41 (0)44 388 55 88
> > ch-8005 zuerich fax: +41 (0)44 388 55 89
> >
> > --aktuelles getunik projekt-------------------------
> > Agieren Sie lokal! Geo Marketing für Ihre E-Mail Kampagne:
> www.geomarketing.com<http://www.geomarketing.com/>
> >
> > --best of swiss web awards 2009------------------
> > Gold & Silber für Connect2Earth / Bronze für WWF UK
> >
> > we make the web a better place - www.getunik.com<http://www.getunik.com/
> >
> >
> >
> >
> >
> > *****************************************************************
> > P Bitte drucken Sie dieses E-Mail nur bei Bedarf aus. Die Umwelt dankt es
> Ihnen.
> > *****************************************************************
> >
> >
>