|
From: Charles N. <cha...@ne...> - 2006-02-16 00:10:27
|
Richard Cyganiak wrote :
> Hi Charles,
>
> did you see the $model->getParsedNamespaces() method? Returns an
> associative namespaces from prefixes to namespace URIs. It should do
> what you want.
>
> Richard
Ok. Thank you Tobias and Richard.
Here is my code which is working well.
function GetPrefixFromURi($uri)
{
$namespaces = $this->dbModel->getParsedNamespaces();
foreach($namespaces as $namespace_URI => $namespace_prefix)
{
if($namespace_URI == $uri)
{
$return = $namespace_prefix;
break;
}
}
if(!isset($return)) $return = "";
return $return;
}
Why not include this function directly in RAP (rewritten)? I think
getting the prefix is a very common need (am I wrong?).
Charles Nepote.
> On 8 Feb 2006, at 00:29, Charles Nepote wrote:
>
>> Hi,
>>
>> Using RAP 0.9.3, I would like to know the namespace for a given prefix.
>> For exemple, I would like to know for the string "rdfs" what is the
>> corresponding namespace ; in this exemple the answer should be :
>> "http://www.w3.org/2000/01/rdf-schema#"
>>
>> Is there a ready-to-use method ? I didn't find it...
>>
>> Thanks,
>> Charles Nepote
|