A literal node
create a literal from another Node
# File rdf/redland/node.rb, line 246 def Literal.from_node(node) lang = Redland.librdf_node_get_literal_value_language(node) if Redland.librdf_node_get_literal_value_language(node) str = Redland.librdf_node_get_literal_value(node) hash_uri = Redland.librdf_node_get_literal_value_datatype_uri(node) hash_uri = Uri.new(Redland.librdf_uri_to_string(hash_uri)) if hash_uri return Literal.new(str,lang,hash_uri) end
create a literal from and xml string
literal = Literal.from_xml('<em>This is emphasized</em>')
# File rdf/redland/node.rb, line 256 def Literal.from_xml(str,lang=nil) return Literal.new(str,lang,nil,true) end
create a new Literal node
literal = Literal.new('Dominic') label = Literal.new('Name','en')
# File rdf/redland/node.rb, line 231 def initialize(str,lang=nil,uri=nil,is_xml=false) @value = str @language = lang is_xml = is_xml==true ? 1 : 0 if uri @node = Redland.librdf_new_node_from_typed_literal($world.world,value,lang,uri.uri) else @node = Redland.librdf_new_node_from_literal($world.world,value,lang,is_xml) end raise RedlandError.new("Node construction failed") if not @node ObjectSpace.define_finalizer(self,Node.create_finalizer(@node)) end
(C) Copyright 2004-2013 Dave Beckett, (C) Copyright 2004-2005 University of Bristol