~kubuntu-members/korundum/4.11

« back to all changes in this revision

Viewing changes to soprano/activerdf-soprano/lib/activerdf_soprano/literal.rb

  • Committer: Ian Monroe
  • Date: 2010-11-21 15:55:01 UTC
  • Revision ID: git-v1:c37670e4e3c59f5eb2ba112f5341a5e706217f6f
Split up Smoke into Qt and KDE directories. 
Move libsmoke stuff into the generator directory
Split up Ruby into qtruby and korundum directories

svn path=/trunk/KDE/kdebindings/ruby/; revision=1199320

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
require 'active_rdf'
2
 
 
3
 
module QtLiteral
4
 
  Namespace.register :xsd, 'http://www.w3.org/2001/XMLSchema#'
5
 
  def xsd_type
6
 
    case self
7
 
    when Qt::ByteArray
8
 
      XSD::base64Binary
9
 
    when Qt::DateTime, Qt::Date, Qt::Time
10
 
      XSD::date
11
 
    end
12
 
  end
13
 
 
14
 
  def self.typed(value, type)
15
 
    case type
16
 
    when XSD::base64Binary
17
 
      Qt::ByteArray.new(value.to_s)
18
 
    when XSD::date
19
 
      Qt::DateTime.parse(value)
20
 
    end
21
 
  end
22
 
 
23
 
  def to_ntriple
24
 
    if $activerdf_without_xsdtype
25
 
      "\"#{to_s}\""
26
 
    else
27
 
      "\"#{to_s}\"^^#{xsd_type}"
28
 
    end
29
 
  end
30
 
end
31
 
 
32
 
class Qt::ByteArray; include QtLiteral; end
33
 
class Qt::DateTime; include QtLiteral; end
34
 
class Qt::Date; include QtLiteral; end
35
 
class Qt::Time; include QtLiteral; end
36