Yes - I am trying to display the raw value in a wiki page.

I will try to look into the code of Semantic Forms again. I know it is possible since SF displays the raw value inside form fields :)

- Laurent


From: "Friederichs, Anja" <Anja.Friederichs@detecon.com>
Sent: Friday, July 24, 2009 9:02 AM
To: laurent@alquier.org, semediawiki-devel@lists.sourceforge.net
Subject: RE: [SMW-devel] Anybody knows how to get all triples of a page inaprogram?


Hi Laurent,

did you try to display your property value in a wikipage again? If I remember correctly a had a quite similar problem. In my code the string had the right content, but the wiki always displayed the encoded string (I'm not sure if it was in this particular case). Did you try to save your property value in a file to show the difference and if there even is any? It's just an idea, but maybe it helps?

Anja  


-----Original Message-----
From: Laurent Alquier [mailto:laurent@alquier.org]
Sent: Fri 24.07.2009 20:40
To: semediawiki-devel@lists.sourceforge.net
Subject: Re: [SMW-devel] Anybody knows how to get all triples of a page inaprogram?

Thanks for both examples - they are very helpful.

One related question : What function should I use to get the raw value of a property ?

Both getShortText and getLongHTMLText interpret the content of the text when I try to display it.

For example, I have a property 'Has URL'. Some values of URLs have %20 in them. I would like to retrieve the raw value of a URL and display it as plain text (and not as a hyperlink).

- Laurent

----------------------------------------
From: "CNIT" <cnit@uniyar.ac.ru>
Sent: Thursday, July 23, 2009 8:14 PM
To: "Jie Bao" <baojie@cs.rpi.edu>
Subject: Re: [SMW-devel] Anybody knows how to get all triples of a page in aprogram?

Jie Bao ?????:
> Thanks Anja. I have a slightly different coding based yours that works:
>
> // return an array of arraies of predicate-value pairs of the page
> function getTriple($title)
> {
>
> $page = SMWDataValueFactory::newTypeIDValue( '_wpg',
> $title->getFullText());
> $semdata = smwfGetStore()->getSemanticData($page->getTitle() );
>
> // build the semantic data
> if ($semdata == null)
> {
> return null;
> }
>
> $s = $title->getFullText();
>
> $arr = array();
>
> foreach($semdata->getProperties() as $key => $property){
> $p = $property->getShortText(false,NULL);
> $p2 = $property->getPropertyID();
> if (!$arr[$p]) $arr[$p] = array();
>
> // http://semantic-mediawiki.org/doc/SMW__SQLStore2_8php-source.html
> if ($p2 == '_MDAT') continue; //time stamp
> else if ($p2 == '_INST') $p = 'rdf:type';
> else if ($p2 == '_SUBC') $p = 'rdfs:subClassOf';
> else if ($p2 == '_SUBP') $p = 'rdfs:subPropertyOf';
> else if ($p2 == '_REDI') $p = 'owl:sameAs';
> else if ($p2 == '_TYPE') $p = 'has_type';
> else { $p = str_replace('Property:','',$p); }
>
> $p[0] = strtoupper($p[0]);
>
> $propvalues = $semdata->getPropertyValues($property);
> foreach ($propvalues as $propvalue) {
> $o=$propvalue->getShortText(false);
> $arr[$p][] =$o;
> }
> }
> return $arr;
> }
>
Aren't strtoupper should be replaced with mb_strtoupper? Lots of "else
if" probably would look better as "switch case", though the later is a
matter of personal taste.
Dmitriy

------------------------------------------------------------------------------
_______________________________________________
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel