The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Redland RDF Application Framework - Ruby RDoc - Module: Redland::RDFS</title>
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }<\/style>" )
  
  // ]]>
</script>
</head>
<body>
<div class="outerBlock">

<div class="outerHeader">
Go to <a href="/" target="_parent">Redland Home</a> - 
<a href="/bindings/" target="_parent">Language Bindings Home</a> - 
<a href="/docs/ruby.html" target="_parent">Ruby API Home</a>
</div>

<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Module</strong></td>
<td class="class-name-in-header">Redland::RDFS</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td><a href="../../files/rdf/redland/schemas/rdfs_rb.html">rdf/redland/schemas/rdfs.rb</a><br /></td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent"></div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list"><a href="#M000017">add_label</a>&nbsp;&nbsp; <a href="#M000015">comment</a>&nbsp;&nbsp; <a href="#M000016">comment=</a>&nbsp;&nbsp; <a href="#M000018">label</a>&nbsp;&nbsp;</div>
</div>
</div>
<!-- if includes -->
<div id="includes">
<h3 class="section-bar">Included Modules</h3>
<div id="includes-list"><span class="include-name"><a href="../Redland.html">Redland</a></span></div>
</div>
<div id="section">
<div id="constants-list">
<h3 class="section-bar">Constants</h3>
<div class="name-list">
<table summary="Constants">
<tr class="top-aligned-row context-row">
<td class="context-item-name">RDFSNS</td>
<td>=</td>
<td class="context-item-value">Namespace.new("http://www.w3.org/2000/01/rdf-schema#")</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">RDFS_CLASS</td>
<td>=</td>
<td class="context-item-value">RDFSNS["Class"]</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">RDFS_RESOURCE</td>
<td>=</td>
<td class="context-item-value">RDFSNS["Resource"]</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">RDFS_SUBCLASSOF</td>
<td>=</td>
<td class="context-item-value">RDFSNS["subClassOf"]</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">RDFS_SUBPROPERTYOF</td>
<td>=</td>
<td class="context-item-value">RDFSNS["subPropertyOf"]</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">RDFS_ISDEFINEDBY</td>
<td>=</td>
<td class="context-item-value">RDFSNS["isDefinedBy"]</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">RDFS_LABEL</td>
<td>=</td>
<td class="context-item-value">RDFSNS["label"]</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">RDFS_COMMENT</td>
<td>=</td>
<td class="context-item-value">RDFSNS["comment"]</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">RDFS_RANGE</td>
<td>=</td>
<td class="context-item-value">RDFSNS["range"]</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">RDFS_DOMAIN</td>
<td>=</td>
<td class="context-item-value">RDFSNS["domain"]</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">RDFS_LITERAL</td>
<td>=</td>
<td class="context-item-value">RDFSNS["Literal"]</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">RDFS_CONTAINER</td>
<td>=</td>
<td class="context-item-value">RDFSNS["Container"]</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">RDFS_SEEALSO</td>
<td>=</td>
<td class="context-item-value">RDFSNS["seeAlso"]</td>
</tr>
</table>
</div>
</div>
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000017" class="method-detail"><a name="M000017" id="M000017"></a>
<div class="method-heading"><a href="#M000017" class="method-signature"><span class="method-name">add_label</span><span class="method-args">(a_label,lang=nil)</span></a></div>
<div class="method-description">
<p>add a &lsquo;<a href="http://www.w3.org/2000/01/rdf-schema#label">www.w3.org/2000/01/rdf-schema#label</a>&rsquo; to this resource. a <a href="RDFS.html#M000018">label</a> is a literal that can have a language. If a <a href="RDFS.html#M000018">label</a> for a given language is already defined, it replaces the <a href="RDFS.html#M000018">label</a>. If a <a href="RDFS.html#M000018">label</a> is not defined for a language it adds the <a href="RDFS.html#M000018">label</a></p>
<pre>
 res.add_label('my label') # label created
 res.add_label('change label') #label changed to 'change label'
 res.add_label('change again','en') # label added with language English
</pre>
<p><a class="source-toggle" href="#" onclick="toggleCode('M000017-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000017-source">
<pre>
<span class="ruby-comment cmt"># File rdf/redland/schemas/rdfs.rb, line 49</span>
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_label</span>(<span class="ruby-identifier">a_label</span>,<span class="ruby-identifier">lang</span>=<span class="ruby-keyword kw">nil</span>)
    <span class="ruby-identifier">label</span> = <span class="ruby-constant">Literal</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">a_label</span>,<span class="ruby-identifier">lang</span>)
    <span class="ruby-identifier">labels</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">get_properties</span>(<span class="ruby-constant">RDFS_LABEL</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">a_label</span><span class="ruby-operator">|</span> 
      <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">a_label</span>.<span class="ruby-identifier">language</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">lang</span>
        <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">model</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-keyword kw">self</span>,<span class="ruby-constant">RDFS_LABEL</span>,<span class="ruby-identifier">a_label</span>)
      <span class="ruby-keyword kw">end</span>       
    <span class="ruby-keyword kw">end</span>
    <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">add_property</span>(<span class="ruby-constant">RDFS_LABEL</span>,<span class="ruby-identifier">label</span>)
    <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>
  <span class="ruby-keyword kw">end</span>
</pre></div>
</div>
</div>
<div id="method-M000015" class="method-detail"><a name="M000015" id="M000015"></a>
<div class="method-heading"><a href="#M000015" class="method-signature"><span class="method-name">comment</span><span class="method-args">()</span></a></div>
<div class="method-description">
<p>get the object with the following predicate: <a href="http://www.w3.org/2000/01/rdf-schema#comment">www.w3.org/2000/01/rdf-schema#comment</a>&lsquo;</p>
<p><a class="source-toggle" href="#" onclick="toggleCode('M000015-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000015-source">
<pre>
<span class="ruby-comment cmt"># File rdf/redland/schemas/rdfs.rb, line 28</span>
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">comment</span>()
    <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">get_property</span>(<span class="ruby-constant">RDFS_COMMENT</span>).<span class="ruby-identifier">to_s</span>
  <span class="ruby-keyword kw">end</span>
</pre></div>
</div>
</div>
<div id="method-M000016" class="method-detail"><a name="M000016" id="M000016"></a>
<div class="method-heading"><a href="#M000016" class="method-signature"><span class="method-name">comment=</span><span class="method-args">(a_comment)</span></a></div>
<div class="method-description">
<p>same as the following</p>
<pre>
 model.add(this,Resource.new('http://www.w3.org/2000/01/rdf-schema#comment','comment')
</pre>
<p><a class="source-toggle" href="#" onclick="toggleCode('M000016-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000016-source">
<pre>
<span class="ruby-comment cmt"># File rdf/redland/schemas/rdfs.rb, line 34</span>
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">comment=</span>(<span class="ruby-identifier">a_comment</span>)
    <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">a_comment</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">String</span>
      <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">delete_property</span>(<span class="ruby-constant">RDFS_COMMENT</span>)
      <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">add_property</span>(<span class="ruby-constant">RDFS_COMMENT</span>,<span class="ruby-identifier">a_comment</span>)
    <span class="ruby-keyword kw">end</span>
    <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>
  <span class="ruby-keyword kw">end</span>
</pre></div>
</div>
</div>
<div id="method-M000018" class="method-detail"><a name="M000018" id="M000018"></a>
<div class="method-heading"><a href="#M000018" class="method-signature"><span class="method-name">label</span><span class="method-args">(lang=nil)</span></a></div>
<div class="method-description">
<p>return the <a href="RDFS.html#M000018">label</a> for this resource if the lang is defined, return the <a href="RDFS.html#M000018">label</a> for this language if no <a href="RDFS.html#M000018">label</a> found return nil</p>
<p><a class="source-toggle" href="#" onclick="toggleCode('M000018-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000018-source">
<pre>
<span class="ruby-comment cmt"># File rdf/redland/schemas/rdfs.rb, line 63</span>
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">label</span>(<span class="ruby-identifier">lang</span>=<span class="ruby-keyword kw">nil</span>)
    <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">get_properties</span>(<span class="ruby-constant">RDFS_LABEL</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">label</span><span class="ruby-operator">|</span>
      <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">label</span>.<span class="ruby-identifier">language</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">lang</span>
        <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">label</span>
      <span class="ruby-keyword kw">end</span>
    <span class="ruby-keyword kw">end</span>
    <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span>
  <span class="ruby-keyword kw">end</span>
</pre></div>
</div>
</div>
</div>
</div>
<hr />

<div class="outerHeader">
Go to <a href="/" target="_parent">Redland Home</a> - 
<a href="/bindings/" target="_parent">Language Bindings Home</a> - 
<a href="/docs/ruby.html" target="_parent">Ruby API Home</a>
</div>

<p>(C) Copyright 2004-2011 <a href="http://www.dajobe.org/" target="_parent">Dave Beckett</a>, (C) Copyright 2004-2005 <a href="http://www.bristol.ac.uk/" target="_parent">University of Bristol</a></p>

</div> <!-- end outerBlock -->

</body>
</html>