rdfa 0.0.7 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,12 @@
1
+ +++ 0.0.8 2007-06-19
2
+ + added some unit tests
3
+ + added the rdfa-generate command
4
+ + refactoring, refactoring and again
5
+ + added a bin rdfa_vocabulary which takes a namespace as argument and parse and return classes and properties... pretty useful
6
+ + the supported vocabularies are now generated
7
+ + dealt with class blank nodes using the rel attribute as Ben said on the rdfa mailing list
8
+ + took out the proxy properties and classes, and refactored into SHORTCUTS
9
+
1
10
  +++ 0.0.7 2007-06-03
2
11
  + added the terminology of scot and foaf.
3
12
  + registering predicates now adds rdfa_link_tos
@@ -1,9 +1,8 @@
1
1
  lib/rdfa.rb
2
2
  lib/rdfa/version.rb
3
- lib/rdfa/classes.rb
4
- lib/rdfa/properties.rb
5
3
  lib/rdfa/base.rb
6
- lib/rdfa/partials.rb
4
+ lib/rdfa/supported_vocabularies.rb
5
+ lib/rdfa/shortcuts.rb
7
6
  History.txt
8
7
  Manifest.txt
9
8
  README.txt
@@ -13,6 +12,8 @@ setup.rb
13
12
  test/test_helper.rb
14
13
  test/test_rdfa.rb
15
14
  bin/rdfa-typo
15
+ bin/rdfa-vocabulary
16
+ bin/rdfa-generate
16
17
  rdfa-typo/CONTRIBUTORS
17
18
  rdfa-typo/about.markdown
18
19
  rdfa-typo/images
data/Rakefile CHANGED
@@ -73,9 +73,10 @@ end
73
73
 
74
74
  desc 'Generate website files'
75
75
  task :website_generate do
76
- Dir['website/**/*.txt'].each do |txt|
77
- sh %{ ruby scripts/txt2html #{txt} > #{txt.gsub(/txt$/,'html')} }
78
- end
76
+ sh %{ cd website; find *.rhtml -exec rdfa-generate '{}' \\;}
77
+ #Dir['website/*.rhtml'].each do |txt|
78
+ # sh %{ ruby scripts/txt2html #{txt} > #{txt.gsub(/txt$/,'html')} }
79
+ #end
79
80
  end
80
81
 
81
82
  desc 'Upload website files to rubyforge'
@@ -0,0 +1,22 @@
1
+ require 'rubygems'
2
+
3
+ require 'action_controller'
4
+ require 'action_view'
5
+
6
+ renderer = ActionView::Base.new("./")
7
+ require 'rdfa'
8
+
9
+ if ARGV.size != 1
10
+ puts "USAGE: rdfa-generate your_template.rhtml"
11
+ exit
12
+ end
13
+
14
+ file = ARGV[0].scan(/(.*)\.rhtml/)[0]
15
+
16
+ template = open("#{file}.rhtml").read.gsub(/<pre>(.*?)<\/pre>/m) {
17
+ "<pre>#{$1.gsub(/</,'&lt;').gsub(/>/,'&gt;')}</pre>"
18
+ }
19
+
20
+ f = open("#{file}.html",'w')
21
+ f.write(renderer.render(:inline => template))
22
+ f.close
@@ -0,0 +1,95 @@
1
+ #!/usr/bin/env ruby
2
+ require 'net/http'
3
+ require 'uri'
4
+
5
+ BNode = /_:(\S*)/
6
+ Resource = /<([^>]*)>/
7
+ Literal = /"([^"]*)"/
8
+ Node = Regexp.union(/_:\S*/,/<[^>]*>/,/"[^"]*"/)
9
+
10
+
11
+ NAME = ARGV[0]
12
+ NAMESPACE = ARGV[1]
13
+ FULLNAME = ARGV[2]
14
+ URL = ARGV[3]
15
+
16
+ RDF = "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
17
+ RDFS = "http://www.w3.org/2000/01/rdf-schema#"
18
+ OWL = "http://www.w3.org/2002/07/owl#"
19
+ DC = "http://purl.org/dc/elements/1.1/"
20
+ TRIPLR = "http://triplr.org/ntriples/#{NAMESPACE}"
21
+
22
+ RDFTYPE = Regexp.new("#{RDF}type")
23
+ RDFPROPERTY = Regexp.new("#{RDF}Property")
24
+ RDFSCLASS = Regexp.new("#{RDFS}Class")
25
+ RDFNAMESPACE = Regexp.new("#{NAMESPACE}")
26
+ OWLCLASS = Regexp.new("#{OWL}Class")
27
+ OWLOBJECTPROPERTY = Regexp.new("#{OWL}ObjectProperty")
28
+ OWLDATAPROPERTY = Regexp.new("#{OWL}DatatypeProperty")
29
+ DESCRIPTION = Regexp.new("#{DC}description")
30
+ COMMENT = Regexp.new("#{RDFS}comment")
31
+
32
+ PROPERTY = Regexp.union(RDFPROPERTY,OWLOBJECTPROPERTY,OWLDATAPROPERTY)
33
+ CLASS = Regexp.union(RDFSCLASS,OWLCLASS)
34
+ TYPE = RDFTYPE
35
+
36
+ ntriples = Net::HTTP.get_response(URI.parse(TRIPLR)).body
37
+
38
+ ntriples = ntriples.select {|t| not t.match /^#/}
39
+ ntriples = ntriples.collect {|t| t.scan(Node)}
40
+
41
+ triples = ntriples.collect {|s,p,o| {:s => s, :p => p, :o => o}}
42
+
43
+ classes = (triples.select {|t| t[:s].match(RDFNAMESPACE) and t[:p].match(TYPE) and t[:o].match(CLASS)}).collect {|t| t[:s]}
44
+ properties = (triples.select {|t| t[:s].match(RDFNAMESPACE) and t[:p].match(TYPE) and t[:o].match(PROPERTY)}).collect {|t| t[:s]}
45
+
46
+ vocabulary = {:classes => {}, :properties => {}}
47
+
48
+ def strip_quotes(st)
49
+ return st.gsub(/\"/,'').gsub(/\\n/,'').gsub(/\\t/,'')
50
+ end
51
+
52
+ def comment(subject, triples)
53
+ co = (triples.select {|t| (t[:s] == subject) and t[:p].match(COMMENT)}).collect {|t| t[:o]}
54
+ co = [""] if (not co) or co.empty?
55
+ co = strip_quotes(co[0])
56
+ s = subject.scan(Regexp.new("#{NAMESPACE}([^>]*)"))[0][0]
57
+ return [s,co]
58
+ end
59
+
60
+ classes.each {|kl| s,c = comment(kl,triples) ; vocabulary[:classes][s] = c }
61
+ properties.each {|pr| s,c = comment(pr,triples) ; vocabulary[:properties][s] = c }
62
+
63
+
64
+ description = (triples.select {|t| t[:s].match(NAMESPACE) and t[:p].match(DESCRIPTION)}).collect {|t| t[:o]}
65
+ description = [""] if (not description) or description.empty?
66
+ description = description[0]
67
+ vocabulary[:description] = strip_quotes(description)
68
+ vocabulary[:fullname] = FULLNAME or ""
69
+ vocabulary[:url] = URL or ""
70
+ vocabulary[:name] = NAME
71
+ vocabulary[:namespace] = NAMESPACE
72
+
73
+
74
+ def rdfa_vocab(v)
75
+ puts " # Vocabulary definition of #{v[:name]}"
76
+ puts " #{v[:name].upcase} = {"
77
+ puts " :name => :#{v[:name].downcase},"
78
+ puts " :fullname => \"#{v[:fullname]}\","
79
+ puts " :description => \"#{v[:description]}\","
80
+ puts " :url => \"#{v[:url]}\","
81
+ puts " :namespace => \"#{v[:namespace]}\","
82
+ puts " :classes => #{v[:classes].inspect},"
83
+ puts " :properties => #{v[:properties].inspect}"
84
+ puts " }"
85
+ end
86
+
87
+ rdfa_vocab(vocabulary)
88
+ #puts triples
89
+
90
+
91
+
92
+
93
+
94
+
95
+
@@ -4,116 +4,22 @@ to the ApplicationHelper of your rails application providing
4
4
  developers with abstractions for the publishing of rdfa data.
5
5
 
6
6
  Here is a simple example of how to use rdfa in your application:
7
- * require 'rdfa' in your application_helper.rb
7
+ * require 'rdfa' in config/environment.rb
8
8
  * in your layout replace <html> by <%= rdfa_html %>
9
9
 
10
10
  =end
11
11
 
12
- module Rdfa
13
- def Rdfa.register_rdfa_namespace name, namespace
14
- $rdfa_namespaces = $rdfa_namespaces.merge "xmlns:#{name}" => namespace
15
- end
16
-
17
- # register_classes generates helpers for classes passed as arguments,
18
- # calling register_classes('sioc', ['Forum','Community']) will generate
19
- # the methods rdfa_sioc_forum and rdfa_sioc_community. The namespace must
20
- # be registered first using register_namespace
21
- def Rdfa.register_rdfa_classes name, classes
22
- classes.each do |klass|
23
- #puts "adding rdfa_#{name}_#{klass.downcase}"
24
- module_eval %{
25
- def rdfa_#{name}_#{klass.downcase} uri, &block
26
- rdfa_class "#{name}:#{klass}", uri, &block
27
- end
28
- }
29
- end
30
- end
31
-
32
- # register_rdfa_properties generates helpers for properties of the namespace
33
- # passed as arguments. Calling register_rdfa_properties('sioc',['author']) will
34
- # generate the rdfa_sioc_author method. The namespace must be registered first
35
- # using register_namespace
36
- def Rdfa.register_rdfa_properties name, properties
37
- properties.each do |property|
38
- #puts "adding rdfa_#{name}_#{property.downcase}"
39
- module_eval %{
40
- def rdfa_#{name}_#{property.downcase} object, subject_uri=nil, &block
41
- rdfa_triple "#{name}:#{property}", object, subject_uri, &block
42
- end
43
- def rdfa_link_to_#{name}_#{property.downcase}(name, options = {}, html_options = {}, *parameters_for_method_reference)
44
- rdfa_link_to("#{name}:#{property}", name, options, html_options, *parameters_for_method_reference)
45
- end
46
- }
47
- end
48
- end
49
- end
50
-
51
-
52
12
  require 'rdfa/base'
53
- require 'rdfa/classes'
54
- require 'rdfa/properties'
55
- require 'rdfa/partials'
56
-
57
- ActionView::Base.send :include, Rdfa
58
- ActionView::Base.send :include, Rdfa::Classes
59
- ActionView::Base.send :include, Rdfa::Properties
60
- ActionView::Base.send :include, Rdfa::Partials
61
-
62
- $rdfa_page_bnode = 0
63
- $rdfa_namespaces = {}
64
-
65
- Rdfa.register_rdfa_namespace :rdfs , 'http://www.w3.org/2000/01/rdf-schema#'
66
- Rdfa.register_rdfa_namespace :dc , 'http://purl.org/dc/elements/1.1/'
67
- Rdfa.register_rdfa_namespace :foaf , 'http://xmlns.com/foaf/0.1/'
68
- Rdfa.register_rdfa_namespace :sioc , 'http://rdfs.org/sioc/ns#'
69
- Rdfa.register_rdfa_namespace :scot , 'http://scot-project.org/scot/ns#'
70
- Rdfa.register_rdfa_namespace :cc , 'http://creativecommons.org/licenses/by/2.5/'
71
-
72
-
73
- # Rdfs classes and properties
74
- Rdfa.register_rdfa_classes :rdfs, ['Resource','Class','Literal','Container',
75
- 'ContainerMembershipProperty','Datatype']
76
- Rdfa.register_rdfa_properties :rdfs, ['subClassOf','subPropertyOf','comment',
77
- 'label','domain','range','seeAlso','isDefinedBy','member']
78
-
79
- # DC classes and Properties
80
- #Rdfa.register_rdfa_classes :dc, ['Forum']
81
- Rdfa.register_rdfa_properties :dc, ['title','creator','subject','description','publisher','contributor','date','type','format',
82
- 'identifier','source','language','relation','coverage','rights']
83
-
84
- # Sioc classes and Properties
85
- Rdfa.register_rdfa_classes :sioc, ['Community','Container','Forum','Item',
86
- 'Post','Role','Space','Site','Thread','User','Usergroup']
87
- Rdfa.register_rdfa_properties :sioc, ['account_of','administrator_of','attachment',
88
- 'avatar','container_of','content','creator_of','email','email_sha1','feed',
89
- 'function_of','has_administrator','has_container','has_creator','has_function',
90
- 'has_host','has_member','has_moderator','has_modifier','has_owner','has_parent',
91
- 'has_reply','has_scope','has_space','has_subscriber','has_usergroup','host_of','id',
92
- 'ip_address','link','links_to','member_of','moderator_of','modifier_of','name',
93
- 'next_by_date','next_version','note','num_replies','num_views','owner_of','parent_of',
94
- 'previous_by_date','previous_version','related_to','reply_of','scope_of','sibling',
95
- 'space_of','subscriber_of','topic','usergroup_of']
96
-
97
- # SCOT classes and Properties
98
- Rdfa.register_rdfa_classes :scot, ["Tag", "Tagcloud", "Cooccurrence", "AFrequency", "RFrequency"]
99
- Rdfa.register_rdfa_properties :scot, ["hasTag", "hasSCOT", "composedOf", "hasLink",
100
- "hasUsergroup", "lastUsedDate", "locatedIn", "name", "frequency", "ownAFrequency",
101
- "ownRFrequency", "cooccurAFrequency", "cooccurRFrequency", "totalTagFrequency",
102
- "totalPosts", "totalTag", "cooccurTag", "cooccurWith", "equivalentTag", "acronym",
103
- "plural", "singular", "synonym", "delimited", "hyphenated", "underscored", "slashed",
104
- "spaced"]
105
-
106
- # Foaf classes and Properties
107
- Rdfa.register_rdfa_classes :foaf, ['Person','Document','Organization','Group','Agent',
108
- 'Project','Image','PersonalProfileDocument','OnlineAccount','OnlineGamingAccount',
109
- 'OnlineEcommerceAccount','OnlineChatAccount']
110
- Rdfa.register_rdfa_properties :foaf, ["mbox", "mbox_sha1sum", "gender", "geekcode",
111
- "dnaChecksum", "sha1", "based_near", "title", "nick", "jabberID", "aimChatID",
112
- "icqChatID", "yahooChatID", "msnChatID", "name", "firstName", "givenname", "surname",
113
- "family_name", "phone", "homepage", "weblog", "tipjar", "plan", "made", "maker", "img",
114
- "depiction", "depicts", "thumbnail", "myersBriggs", "workplaceHomepage",
115
- "workInfoHomepage", "schoolHomepage", "knows", "interest", "topic_interest",
116
- "publications", "currentProject", "pastProject", "fundedBy", "logo", "topic",
117
- "primaryTopic", "isPrimaryTopicOf", "page", "theme", "holdsAccount",
118
- "accountServiceHomepage", "accountName", "member", "membershipClass", "birthday"]
119
-
13
+ require 'rdfa/supported_vocabularies'
14
+ require 'rdfa/shortcuts'
15
+
16
+ Rdfa.register_vocabularies
17
+ Rdfa.register_shortcuts
18
+
19
+ # add the methods to action view if available
20
+ if defined? ActionView
21
+ ActionView::Base.send :include, Rdfa
22
+ #ActionView::Base.send :include, Rdfa::Classes
23
+ #ActionView::Base.send :include, Rdfa::Properties
24
+ #ActionView::Base.send :include, Rdfa::Partials
25
+ end
@@ -1,13 +1,83 @@
1
1
  module Rdfa
2
- def rdfa_class klass, subject_uri, &block
3
- if not subject_uri
4
- $rdfa_page_bnode = $rdfa_page_bnode + 1
5
- subject_uri = "#BNode#{$rdfa_page_bnode}"
2
+
3
+ def Rdfa.namespaces
4
+ return @namespaces
5
+ end
6
+
7
+ def Rdfa.register_rdfa_namespace name, namespace
8
+ @namespaces = {} unless defined? @namespaces
9
+ @namespaces = @namespaces.merge "xmlns:#{name}" => namespace
10
+ end
11
+
12
+ def Rdfa.method_for(namespace, att)
13
+ return "#{namespace}_#{att.to_s.downcase.gsub(/-/,'_')}"
14
+ end
15
+
16
+ # register_classes generates helpers for classes passed as arguments,
17
+ # calling register_classes('sioc', ['Forum','Community']) will generate
18
+ # the methods rdfa_sioc_forum and rdfa_sioc_community. The namespace must
19
+ # be registered first using register_namespace
20
+ def Rdfa.register_rdfa_classes name, classes
21
+ classes.each do |klass|
22
+ #puts "adding rdfa_#{name}_#{klass.downcase}"
23
+ module_eval %{
24
+ def rdfa_#{method_for(name,klass)} uri=nil, &block
25
+ rdfa_class "#{name}:#{klass}", uri, &block
26
+ end
27
+ }
28
+ end
29
+ end
30
+
31
+ # register_rdfa_properties generates helpers for properties of the namespace
32
+ # passed as arguments. Calling register_rdfa_properties('sioc',['author']) will
33
+ # generate the rdfa_sioc_author method. The namespace must be registered first
34
+ # using register_namespace
35
+ def Rdfa.register_rdfa_properties name, properties
36
+ properties.each do |property|
37
+ #puts "adding rdfa_#{name}_#{property.downcase}"
38
+ module_eval %{
39
+ def rdfa_#{method_for(name,property)} object=nil, subject_uri=nil, &block
40
+ rdfa_triple "#{name}:#{property}", object, subject_uri, &block
41
+ end
42
+ def rdfa_link_to_#{method_for(name,property)}(name, options = {}, html_options = {}, *parameters_for_method_reference)
43
+ rdfa_link_to("#{name}:#{property}", name, options, html_options, *parameters_for_method_reference)
44
+ end
45
+ }
46
+ end
47
+ end
48
+
49
+ def Rdfa.register_shortcuts
50
+ (Rdfa::SHORTCUTS[:classes].merge Rdfa::SHORTCUTS[:properties]).each do |name, map|
51
+ module_eval "alias rdfa_#{name} rdfa_#{method_for(map[0],map[1])}"
52
+ end
53
+ Rdfa::SHORTCUTS[:properties].each do |name, map|
54
+ module_eval "alias rdfa_link_to_#{name} rdfa_link_to_#{method_for(map[0],map[1])}"
55
+ end
56
+ end
57
+
58
+ def Rdfa.register_vocabulary voc
59
+ Rdfa.register_rdfa_namespace voc[:name], voc[:namespace]
60
+ Rdfa.register_rdfa_classes voc[:name], voc[:classes].keys
61
+ Rdfa.register_rdfa_properties voc[:name], voc[:properties].keys
62
+ end
63
+
64
+ def Rdfa.register_vocabularies
65
+ Rdfa::VOCABULARIES.each {|voc| Rdfa.register_vocabulary voc}
66
+ end
67
+
68
+ #following methods are tested
69
+
70
+ def rdfa_class klass, subject_uri=nil, &block
71
+ rel = nil
72
+ rel = "rdf:li" unless subject_uri
73
+ if block_given?
74
+ rdfa_write_block :span, {:class => klass, :about => subject_uri, :rel => rel} , &block
75
+ else
76
+ rdfa_write :span, '', {:class => klass, :about => subject_uri, :rel => rel}
6
77
  end
7
- rdfa_write_block :span, {:class => klass, :about => subject_uri} , &block if block_given?
8
78
  end
9
79
 
10
- def rdfa_triple predicate, object, subject_uri=nil, &block
80
+ def rdfa_triple predicate, object=nil, subject_uri=nil, &block
11
81
  if block_given?
12
82
  rdfa_write_block :span, {:property => predicate, :content => object, :about => subject_uri}, &block
13
83
  else
@@ -29,8 +99,7 @@ module Rdfa
29
99
  end
30
100
 
31
101
  def rdfa_html
32
- $rdfa_page_bnode = 0
33
- tag(:html, options = ($rdfa_namespaces.merge :xmlns =>"http://www.w3.org/1999/xhtml") ,true)
102
+ tag(:html, options = (Rdfa.namespaces.merge :xmlns =>"http://www.w3.org/1999/xhtml") ,true)
34
103
  end
35
104
 
36
105
  end
@@ -0,0 +1,38 @@
1
+ module Rdfa
2
+ SHORTCUTS = {
3
+ :classes => {
4
+ :resource => [:rdfs , :resource],
5
+ :list => [:rdf , :list],
6
+ :event => [:dctypes , :event],
7
+ :community => [:sioc , :community],
8
+ :post => [:sioc , :post],
9
+ :forum => [:sioc , :forum],
10
+ :person => [:foaf , :person],
11
+ :project => [:doap , :project],
12
+ },
13
+ :properties => {
14
+ :seealso => [:rdfs , :seealso],
15
+ :label => [:rdfs , :label],
16
+ :comment => [:rdfs , :comment],
17
+ :creator => [:dcel , :creator],
18
+ :title => [:dcel , :title],
19
+ :language => [:dcel , :language],
20
+ :date => [:dcel , :date],
21
+ :description => [:dcel , :description],
22
+ :source => [:dcel , :source],
23
+ :license => [:dcterms , :license],
24
+ :abstract => [:dcterms , :abstract],
25
+ :created => [:dcterms , :created],
26
+ :abstract => [:dcterms , :abstract],
27
+ :content => [:sioc , :content],
28
+ :name => [:foaf , :name],
29
+ :knows => [:foaf , :knows],
30
+ :name => [:foaf , :name],
31
+ :weblog => [:foaf , :weblog],
32
+ :homepage => [:foaf , :homepage],
33
+ :depiction => [:foaf , :depiction],
34
+ :mbox => [:foaf , :mbox],
35
+ :openid => [:foaf , :openid],
36
+ }
37
+ }
38
+ end
@@ -0,0 +1,94 @@
1
+ # Declaration of the lists of classes and properties for each supported vocabulary
2
+ module Rdfa
3
+ # Vocabulary definition of rdfs
4
+ RDFS = {
5
+ :name => :rdfs,
6
+ :fullname => "Resource Description Framework Schema",
7
+ :description => "",
8
+ :url => "http://www.w3.org/TR/rdf-schema/",
9
+ :namespace => "http://www.w3.org/2000/01/rdf-schema#",
10
+ :classes => {"Container"=>"The class of RDF containers.", "Literal"=>"The class of literal values, eg. textual strings and integers.", "ContainerMembershipProperty"=>"The class of container membership properties, rdf:_1, rdf:_2, ..., all of which are sub-properties of 'member'.", "Class"=>"The class of classes.", "Resource"=>"The class resource, everything.", "Datatype"=>"The class of RDF datatypes."},
11
+ :properties => {"isDefinedBy"=>"The defininition of the subject resource.", "subPropertyOf"=>"The subject is a subproperty of a property.", "member"=>"A member of the subject resource.", "domain"=>"A domain of the subject property.", "range"=>"A range of the subject property.", "seeAlso"=>"Further information about the subject resource.", "subClassOf"=>"The subject is a subclass of a class.", "label"=>"A human-readable name for the subject.", "comment"=>"A description of the subject resource."}
12
+ }
13
+ # Vocabulary definition of rdf
14
+ RDF = {
15
+ :name => :rdf,
16
+ :fullname => "Resource Description Framework",
17
+ :description => "This is the RDF Schema for the RDF vocabulary defined in the RDF namespace.",
18
+ :url => "",
19
+ :namespace => "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
20
+ :classes => {"Statement"=>"The class of RDF statements.", "List"=>"The class of RDF Lists.", "Bag"=>"The class of unordered containers.", "Alt"=>"The class of containers of alternatives.", "Seq"=>"The class of ordered containers.", "Property"=>"The class of RDF properties."},
21
+ :properties => {"predicate"=>"The predicate of the subject RDF statement.", "rest"=>"The rest of the subject RDF list after the first item.", "type"=>"The subject is an instance of a class.", "first"=>"The first item in the subject RDF list.", "subject"=>"The subject of the subject RDF statement.", "value"=>"Idiomatic property used for structured values.", "object"=>"The object of the subject RDF statement."}
22
+ }
23
+ # Vocabulary definition of dcel
24
+ DCEL = {
25
+ :name => :dcel,
26
+ :fullname => "Dublin Core Metadata Initiative Elements",
27
+ :description => "The Dublin Core Element Set v1.1 namespace provides URIs for the Dublin Core Elements v1.1. Entries are declared using RDF Schema language to support RDF applications.",
28
+ :url => "http://dublincore.org/",
29
+ :namespace => "http://purl.org/dc/elements/1.1/",
30
+ :classes => {},
31
+ :properties => {"coverage"=>"The spatial or temporal topic of the resource, the spatial applicability of the resource, or the jurisdiction under which the resource is relevant.", "format"=>"The file format, physical medium, or dimensions of the resource.", "creator"=>"An entity primarily responsible for making the resource.", "language"=>"A language of the resource.", "title"=>"A name given to the resource.", "date"=>"A point or period of time associated with an event in the lifecycle of the resource.", "type"=>"The nature or genre of the resource.", "rights"=>"Information about rights held in and over the resource.", "contributor"=>"An entity responsible for making contributions to the resource.", "subject"=>"The topic of the resource.", "relation"=>"A related resource.", "publisher"=>"An entity responsible for making the resource available.", "description"=>"An account of the resource.", "source"=>"The resource from which the described resource is derived.", "identifier"=>"An unambiguous reference to the resource within a given context."}
32
+ }
33
+ # Vocabulary definition of dcterms
34
+ DCTERMS = {
35
+ :name => :dcterms,
36
+ :fullname => "Dublin Core Metadata Initiative Terms",
37
+ :description => "The Dublin Core Terms namespace provides URIs for the Dublin Core Element Set Qualifier Vocabulary. Vocabulary terms are declared using RDF Schema language to support RDF applications. The Dublin Core qualifiers form a richer vocabulary, which is intended to facilitate discovery of resources. It will be updated according to dc-usage decisions.",
38
+ :url => "http://dublincore.org/",
39
+ :namespace => "http://purl.org/dc/terms/",
40
+ :classes => {"Box"=>"The DCMI Box identifies a region of space using its geographic limits.", "URI"=>"A URI Uniform Resource Identifier", "LCC"=>"Library of Congress Classification", "MESH"=>"Medical Subject Headings", "SpatialScheme"=>"A set of geographic place encoding schemes and/or formats", "DCMIType"=>"A list of types used to categorize the nature or genre of the content of the resource.", "DDC"=>"Dewey Decimal Classification", "NLM"=>"National Library of Medicine Classification", "W3CDTF"=>"W3C Encoding rules for dates and times - a profile based on ISO 8601", "SourceScheme"=>"A set of source encoding schemes and/or formats", "RFC3066"=>"Internet RFC 3066 'Tags for the Identification of Languages' specifies a primary subtag whichis a two-letter code taken from ISO 639 part1 or a three-letter code taken from ISO 639part 2, followed optionally by a two-lettercountry code taken from ISO 3166. When alanguage in ISO 639 has both a two-letter andthree-letter code, use the two-letter code;when it has only a three-letter code, use thethree-letter code. This RFC replaces RFC1766.", "Period"=>"A specification of the limits of a time interval.", "TGN"=>"The Getty Thesaurus of Geographic Names", "IMT"=>"The Internet media type of the resource.", "LCSH"=>"Library of Congress Subject Headings", "RelationScheme"=>"A set of resource relation encoding schemes and/or formats", "ISO639-2"=>"ISO 639-2: Codes for the representation of names of languages.", "FormatScheme"=>"A set of format encoding schemes.", "ISO3166"=>"ISO 3166 Codes for the representation of names of countries", "IdentifierScheme"=>"A set of resource identifier encoding schemes and/or formats", "TemporalScheme"=>"A set of encoding schemes for the coverage qualifier \\", "LanguageScheme"=>"A set of language encoding schemes and/or formats.", "DateScheme"=>"A set of date encoding schemes and/or formats ", "Point"=>"The DCMI Point identifies a point in space using its geographic coordinates.", "UDC"=>"Universal Decimal Classification", "TypeScheme"=>"A set of resource type encoding schemes and/or formats", "RFC1766"=>"Internet RFC 1766 'Tags for the identification of Language' specifies a two letter code taken from ISO 639, followed optionally by a two letter country code taken from ISO 3166.", "SubjectScheme"=>"A set of subject encoding schemes and/or formats"},
41
+ :properties => {"isRequiredBy"=>"The described resource is required by the referenced resource, either physically or logically.", "accrualPolicy"=>"The policy governing the addition of items to a collection.", "license"=>"A legal document giving official permission to do something with the resource.", "references"=>"The described resource references, cites, or otherwise points to the referenced resource.", "bibliographicCitation"=>"A bibliographic reference for the resource. ", "isPartOf"=>"The described resource is a physical or logical part of the referenced resource.", "modified"=>"Date on which the resource was changed.", "available"=>"Date (often a range) that the resource will become or did become available.", "abstract"=>"A summary of the content of the resource.", "tableOfContents"=>"A list of subunits of the content of the resource.", "dateAccepted"=>"Date of acceptance of the resource (e.g. of thesisby university department, of article by journal, etc.).", "requires"=>"The described resource requires the referenced resource to support its function, delivery, or coherence of content.", "medium"=>"The material or physical carrier of the resource.", "extent"=>"The size or duration of the resource.", "accrualPeriodicity"=>"The frequency with which items are added to a collection.", "issued"=>"Date of formal issuance (e.g., publication) of the resource.", "provenance"=>"A statement of any changes in ownership and custody of the resource since its creation that are significant for its authenticity, integrity and interpretation. ", "dateSubmitted"=>"Date of submission of the resource (e.g. thesis, articles, etc.).", "dateCopyrighted"=>"Date of a statement of copyright.", "temporal"=>"Temporal characteristics of the intellectual content of the resource.", "hasFormat"=>"The described resource pre-existed the referenced resource, which is essentially the same intellectual content presented in another format.", "isFormatOf"=>"The described resource is the same intellectual content of the referenced resource, but presented in another format.", "hasPart"=>"The described resource includes the referenced resource either physically or logically.", "isReplacedBy"=>"The described resource is supplanted, displaced, or superseded by the referenced resource.", "valid"=>"Date (often a range) of validity of a resource.", "alternative"=>"Any form of the title used as a substitute or alternative to the formal title of the resource.", "rightsHolder"=>"A person or organization owning or managing rights over the resource. ", "instructionalMethod"=>"A process, used to engender knowledge, attitudes and skills, that the resource is designed to support.", "mediator"=>"A class of entity that mediates access to theresource and for whom the resource is intended or useful.", "spatial"=>"Spatial characteristics of the intellectual content of the resource.", "conformsTo"=>"A reference to an established standard to which the resource conforms.", "isReferencedBy"=>"The described resource is referenced, cited, or otherwise pointed to by the referenced resource.", "hasVersion"=>"The described resource has a version, edition, or adaptation, namely, the referenced resource.", "created"=>"Date of creation of the resource.", "audience"=>"A class of entity for whom the resource is intended or useful.", "accrualMethod"=>"The method by which items are added to a collection.", "accessRights"=>"Information about who can access the resource or an indication of its security status. ", "replaces"=>"The described resource supplants, displaces, or supersedes the referenced resource.", "isVersionOf"=>"The described resource is a version, edition, or adaptation of the referenced resource. Changes in version imply substantive changes in content rather than differences in format.", "educationLevel"=>"A general statement describing the education or training context. Alternatively, a more specific statement of the location of the audience in terms of its progression through an education or training context."}
42
+ }
43
+ # Vocabulary definition of dctypes
44
+ DCTYPES = {
45
+ :name => :dctypes,
46
+ :fullname => "Dublin Core Metadata Initiative Types",
47
+ :description => "The Dublin Core Types namespace provides URIs for the entries of the DCMI Type Vocabulary. Entries are declared using RDF Schema language to support RDF applications. The Schema will be updated according to dc-usage decisions.",
48
+ :url => "http://dublincore.org/",
49
+ :namespace => "http://purl.org/dc/dcmitype/",
50
+ :classes => {"MovingImage"=>"A series of visual representations imparting an impression of motion when shown in succession.", "Text"=>"A resource consisting primarily of words for reading.", "PhysicalObject"=>"An inanimate, three-dimensional object or substance.", "Sound"=>"A resource primarily intended to be heard.", "InteractiveResource"=>"A resource requiring interaction from the user to be understood, executed, or experienced.", "Image"=>"A visual representation other than text.", "Dataset"=>"Data encoded in a defined structure.", "Software"=>"A computer program in source or compiled form.", "StillImage"=>"A static visual representation.", "Event"=>"A non-persistent, time-based occurrence.", "Collection"=>"An aggregation of resources.", "Service"=>"A system that provides one or more functions."},
51
+ :properties => {}
52
+ }
53
+ # Vocabulary definition of sioc
54
+ SIOC = {
55
+ :name => :sioc,
56
+ :fullname => "Semantically Interlinked Online Communities",
57
+ :description => "SIOC (Semantically-Interlinked Online Communities) is an ontology for describing the information in online communities. This information can be used to export information from online communities and to link them together. The scope of the application areas that SIOC can be used for includes (and is not limited to) weblogs, message boards, mailing lists and chat channels.",
58
+ :url => "http://sioc-project.org/",
59
+ :namespace => "http://rdfs.org/sioc/ns#",
60
+ :classes => {"Role"=>"A Role is a function of a User within a scope of a particular Forum, Site, etc.", "Container"=>"An area in which content Items are contained.", "Usergroup"=>"A set of User accounts whose owners have a common purpose or interest. Can be used for access control purposes.", "Community"=>"Community is a high-level concept that defines an online community and what it consists of.", "Thread"=>"A container for a series of threaded discussion Posts or Items.", "User"=>"A User account in an online community site.", "Post"=>"An article or message that can be posted to a Forum.", "Forum"=>"A discussion area on which Posts or entries are made.", "Site"=>"A Site can be the location of an online community or set of communities, with Users and Usergroups creating Items in a set of Containers. It can be thought of as a web-accessible data Space.", "Item"=>"A content Item that can be posted to or created within a Container.", "Space"=>"A Space is a place where data resides, e.g., on a website, desktop, fileshare, etc."},
61
+ :properties => {"reference"=>"Links either created explicitly or extracted implicitly on the HTML level from the Post.", "name"=>"The name of a SIOC instance, e.g. a username for a User, group name for a Usergroup, etc.", "has_moderator"=>"A User who is a moderator of this Forum.", "has_creator"=>"This is the User who made this Item.", "next_version"=>"Links to the next revision of this Item or Post.", "has_space"=>"A data Space which this resource is a part of.", "has_administrator"=>"A User who is an administrator of this Site.", "feed"=>"A feed (e.g., RSS, Atom, etc.) pertaining to this resource (e.g., for a Forum, Site, User, etc.).", "usergroup_of"=>"A Space that the Usergroup has access to.", "title"=>"This is the title (subject line) of the Post. Note that for a Post within a threaded discussion that has no parents, it would detail the topic thread.", "sibling"=>"A Post may have a sibling or a twin that exists in a different Forum, but the siblings may differ in some small way (for example, language, category, etc.). The sibling of this Post should be self-describing (that is, it should contain all available information).", "modified_at"=>"When this was modified, in ISO 8601 format.", "has_part"=>"An resource that is a part of this subject.", "subscriber_of"=>"A Container that a User is subscribed to.", "owner_of"=>"A Container owned by a particular User, for example, a weblog or image gallery.", "host_of"=>"A Forum that is hosted on this Site.", "has_owner"=>"A User that this Container is owned by.", "attachment"=>"The URI of a file attached to a Post.", "topic"=>"A topic of interest, linking to the appropriate URI, e.g., in the Open Directory Project or of a SKOS category.", "related_to"=>"Related Posts for this Post, perhaps determined implicitly from topics or references.", "num_replies"=>"The number of replies that this Post has. Useful for when the reply structure is absent.", "has_usergroup"=>"Points to a Usergroup that has certain access to this Space.", "has_parent"=>"A Container or Forum that this Container or Forum is a child of.", "subject"=>"Keyword(s) describing subject of the Post.", "space_of"=>"A resource which belongs to this data Space.", "reply_of"=>"Links to an Item or Post which this Item or Post is a reply to.", "previous_version"=>"Links to a previous revision of this Item or Post.", "parent_of"=>"A child Container or Forum that this Container or Forum is a parent of.", "links_to"=>"Links extracted from hyperlinks within a SIOC concept, e.g., Post or Site.", "id"=>"An identifier of a SIOC concept instance. For example, a user ID. Must be unique for instances of each type of SIOC concept within the same site.", "scope_of"=>"A Role that has a scope of this Forum.", "has_subscriber"=>"A User who is subscribed to this Container.", "has_host"=>"The Site that hosts this Forum.", "has_container"=>"The Container to which this Item belongs.", "description"=>"The content of the Post.", "about"=>"Specifies that this Item is about a particular resource, e.g., a Post describing a book, hotel, etc.", "previous_by_date"=>"Previous Item or Post in a given Container sorted by date.", "part_of"=>"A resource that the subject is a part of.", "note"=>"A note associated with this Post, for example, if it has been edited by a User.", "has_function"=>"A Role that this User has.", "content"=>"The content of the Post in plain text format.", "avatar"=>"An image or depiction used to represent this User.", "link"=>"A URI of a document which contains this SIOC object.", "has_scope"=>"A Forum that this Role applies to.", "function_of"=>"A User who has this Role.", "first_name"=>"First (real) name of this User. Synonyms include given name or christian name.", "email_sha1"=>"An electronic mail address of the User, encoded using SHA1.", "content_encoded"=>"The encoded content of the Post, contained in CDATA areas.", "modifier_of"=>"An Item that this User has modified.", "last_name"=>"Last (real) name of this user. Synonyms include surname or family name.", "has_reply"=>"Points to an Item or Post that is a reply or response to this Item or Post.", "has_member"=>"A User who is a member of this Usergroup.", "administrator_of"=>"A Site that the User is an administrator of.", "account_of"=>"Refers to the foaf:Agent or foaf:Person who owns this sioc:User online account.", "num_views"=>"The number of times this Item, Thread, User profile, etc. has been viewed.", "next_by_date"=>"Next Item or Post in a given Container sorted by date.", "moderator_of"=>"A Forum that User is a moderator of.", "member_of"=>"A Usergroup that this User is a member of.", "ip_address"=>"The IP address used when creating this Item. This can be associated with a creator. Some wiki articles list the IP addresses for the creator or modifiers when the usernames are absent.", "has_modifier"=>"A User who modified this Item.", "email"=>"An electronic mail address of the User.", "creator_of"=>"An Item that the User is a creator of.", "created_at"=>"When this was created, in ISO 8601 format.", "container_of"=>"An Item that this Container contains."}
62
+ }
63
+ # Vocabulary definition of foaf
64
+ FOAF = {
65
+ :name => :foaf,
66
+ :fullname => "Friend Of A Friend",
67
+ :description => "The Friend of a Friend (FOAF) RDF vocabulary, described using W3C RDF Schema and the Web Ontology Language.",
68
+ :url => "http://www.foaf-project.org/",
69
+ :namespace => "http://xmlns.com/foaf/0.1/",
70
+ :classes => {"OnlineEcommerceAccount"=>"An online e-commerce account.", "OnlineGamingAccount"=>"An online gaming account.", "Organization"=>"An organization.", "Group"=>"A class of Agents.", "Person"=>"A person.", "OnlineAccount"=>"An online account.", "Image"=>"An image.", "Agent"=>"An agent (eg. person, group, software or physical artifact).", "OnlineChatAccount"=>"An online chat account.", "Project"=>"A project (a collective endeavour of some kind).", "PersonalProfileDocument"=>"A personal profile RDF document.", "Document"=>"A document."},
71
+ :properties => {"accountServiceHomepage"=>"Indicates a homepage of the service provide for this online account.", "pastProject"=>"A project this person has previously worked on.", "publications"=>"A link to the publications of this person.", "tipjar"=>"A tipjar document for this agent, describing means for payment and reward.", "name"=>"A name for some thing.", "knows"=>"A person known by this person (indicating some level of reciprocated interaction between the parties).", "thumbnail"=>"A derived thumbnail image.", "givenname"=>"The given name of some person.", "membershipClass"=>"Indicates the class of individuals that are a member of a Group", "accountName"=>"Indicates the name (identifier) associated with this online account.", "theme"=>"A theme.", "primaryTopic"=>"The primary topic of some page or document.", "myersBriggs"=>"A Myers Briggs (MBTI) personality classification.", "plan"=>"A .plan comment, in the tradition of finger and '.plan' files.", "aimChatID"=>"An AIM chat ID", "jabberID"=>"A jabber ID for something.", "title"=>"Title (Mr, Mrs, Ms, Dr. etc)", "based_near"=>"A location that something is based near, for some broadly human notion of near.", "isPrimaryTopicOf"=>"A document that this thing is the primary topic of.", "interest"=>"A page about a topic of interest to this person.", "img"=>"An image that can be used to represent some thing (ie. those depictions which are particularly representative of something, eg. one's photo on a homepage).", "made"=>"Something that was made by this agent.", "nick"=>"A short informal nickname characterising an agent (includes login identifiers, IRC and other chat nicknames).", "member"=>"Indicates a member of a Group", "topic"=>"A topic of some page or document.", "logo"=>"A logo representing some thing.", "currentProject"=>"A current project this person works on.", "workplaceHomepage"=>"A workplace homepage of some person; the homepage of an organization they work for.", "fundedBy"=>"An organization funding a project or person.", "weblog"=>"A weblog of some thing (whether person, group, company etc.).", "firstName"=>"The first name of a person.", "msnChatID"=>"An MSN chat ID", "sha1"=>"A sha1sum hash, in hex.", "gender"=>"The gender of this Agent (typically but not necessarily 'male' or 'female').", "mbox_sha1sum"=>"The sha1sum of the URI of an Internet mailbox associated with exactly one owner, the first owner of the mailbox.", "schoolHomepage"=>"A homepage of a school attended by the person.", "workInfoHomepage"=>"A work info homepage of some person; a page about their work for some organization.", "family_name"=>"The family_name of some person.", "geekcode"=>"A textual geekcode for this person, see http://www.geekcode.com/geek.html", "birthday"=>"The birthday of this Agent, represented in mm-dd string form, eg. '12-31'.", "holdsAccount"=>"Indicates an account held by this agent.", "depiction"=>"A depiction of some thing.", "homepage"=>"A homepage for some thing.", "phone"=>"A phone, specified using fully qualified tel: URI scheme (refs: http://www.w3.org/Addressing/schemes.html#tel).", "page"=>"A page or document about this thing.", "topic_interest"=>"A thing of interest to this person.", "depicts"=>"A thing depicted in this representation.", "maker"=>"An agent that made this thing.", "yahooChatID"=>"A Yahoo chat ID", "dnaChecksum"=>"A checksum for the DNA of some thing. Joke.", "mbox"=>"A personal mailbox, ie. an Internet mailbox associated with exactly one owner, the first owner of this mailbox. This is a 'static inverse functional property', in that there is (across time and change) at most one individual that ever has any particular value for foaf:mbox.", "openid"=>"An OpenID for an Agent.", "surname"=>"The surname of some person.", "icqChatID"=>"An ICQ chat ID"}
72
+ }
73
+ # Vocabulary definition of swrc
74
+ SWRC = {
75
+ :name => :swrc,
76
+ :fullname => "Semantic Web for Research Communities",
77
+ :description => "",
78
+ :url => "http://ontoware.org/projects/swrc",
79
+ :namespace => "http://swrc.ontoware.org/ontology#",
80
+ :classes => {"Workshop"=>"", "Booklet"=>"", "AdministrativeStaff"=>"", "Article"=>"", "FullProfessor"=>"", "SoftwareComponent"=>"", "Department"=>"", "Association"=>"", "Misc"=>"", "Enterprise"=>"", "ResearchProject"=>"", "Lecture"=>"", "DevelopmentProject"=>"", "Thesis"=>"", "Publication"=>"", "Organization"=>"", "Proceedings"=>"", "ResearchTopic"=>"", "Lecturer"=>"", "MasterThesis"=>"", "InCollection"=>"", "Institute"=>"", "Person"=>"", "University"=>"", "Graduate"=>"", "PhDStudent"=>"", "Exhibition"=>"", "Meeting"=>"", "Manager"=>"", "ProjectMeeting"=>"", "PhDThesis"=>"", "TechnicalReport"=>"", "ProjectReport"=>"", "TechnicalStaff"=>"", "Undergraduate"=>"", "AcademicStaff"=>"", "SoftwareProject"=>"", "Employee"=>"", "Project"=>"", "InBook"=>"", "InProceedings"=>"", "ResearchGroup"=>"", "Topic"=>"", "Event"=>"", "Product"=>"", "FacultyMember"=>"", "Book"=>"", "Report"=>"", "Student"=>"", "Unpublished"=>"", "Manual"=>"", "AssistantProfessor"=>"", "Conference"=>"", "AssociateProfessor"=>""},
81
+ :properties => {"howpublished"=>"", "eventTitle"=>"", "isWorkedOnBy"=>"", "studiesAt"=>"", "financedBy"=>"", "organization"=>"", "carriedOutBy"=>"", "member"=>"", "date"=>"", "title"=>"", "describesProject"=>"", "school"=>"", "chapter"=>"", "email"=>"", "affiliation"=>"", "supervisor"=>"", "edition"=>"", "phone"=>"", "cite"=>"", "RootRelation"=>"", "isAbout"=>"", "institution"=>"", "memberOfPC"=>"", "price"=>"", "dealtWithIn"=>"", "head"=>"", "hasParts"=>"", "organizerOrChairOf"=>"", "pages"=>"", "editor"=>"", "participant"=>"", "isbn"=>"", "technicalReport"=>"", "author"=>"", "develops"=>"", "month"=>"", "name"=>"", "homepage"=>"", "note"=>"", "product"=>"", "number"=>"", "Root"=>"", "cooperateWith"=>"", "student"=>"", "supervises"=>"", "headOf"=>"", "year"=>"", "series"=>"", "carriesOut"=>"", "developedBy"=>"", "photo"=>"", "journal"=>"", "source"=>"", "headOfGroup"=>"", "publication"=>"", "hasPrice"=>"", "address"=>"", "type"=>"", "fax"=>"", "abstract"=>"", "keywords"=>"", "volume"=>"", "booktitle"=>"", "atEvent"=>"", "publisher"=>"", "employs"=>"", "finances"=>"", "publishes"=>"", "hasPartEvent"=>"", "worksAtProject"=>"", "location"=>"", "givenBy"=>"", "projectInfo"=>"", "citedBy"=>""}
82
+ }
83
+ # Vocabulary definition of doap
84
+ DOAP = {
85
+ :name => :doap,
86
+ :fullname => "Description Of A Project",
87
+ :description => "The Description of a Project (DOAP) vocabulary, described using W3C RDF Schema and the Web Ontology Language.",
88
+ :url => "",
89
+ :namespace => "http://usefulinc.com/ns/doap#",
90
+ :classes => {"ArchRepository"=>"GNU Arch source code repository.", "BKRepository"=>"BitKeeper source code repository.", "Version"=>"Version information of a project release.", "CVSRepository"=>"CVS source code repository.", "Project"=>"A project.", "SVNRepository"=>"Subversion source code repository.", "Repository"=>"Source code repository."},
91
+ :properties => {"file-release"=>"URI of download associated with this release.", "name"=>"A name of something.", "module"=>"Module name of a CVS, BitKeeper or Arch repository.", "license"=>"The URI of an RDF description of the license the software is distributed under.", "category"=>"A category of project.", "tester"=>"A tester or other quality control contributor.", "maintainer"=>"Maintainer of a project, a project leader.", "bug-database"=>"Bug tracker for a project.", "download-page"=>"Web page from which the project software can be downloaded.", "anon-root"=>"Repository for anonymous access.", "repository"=>"Source code repository.", "os"=>"Operating system that a project is limited to. Omit this property if the project is not OS-specific.", "mailing-list"=>"Mailing list home page or email address.", "programming-language"=>"Programming language a project is implemented in or intended for use with.", "revision"=>"Revision identifier of a software release.", "screenshots"=>"Web page with screenshots of project.", "description"=>"Plain text description of a project, of 2-4 sentences in length.", "shortdesc"=>"Short (8 or 9 words) plain text description of a project.", "helper"=>"Project contributor.", "release"=>"A project release.", "homepage"=>"URL of a project's homepage,associated with exactly one project.", "translator"=>"Contributor of translations to the project.", "documenter"=>"Contributor of documentation to the project.", "download-mirror"=>"Mirror of software download web page.", "created"=>"Date when something was created, in YYYY-MM-DD form. e.g. 2004-04-05", "wiki"=>"URL of Wiki for collaborative discussion of project.", "old-homepage"=>"URL of a project's past homepage,associated with exactly one project.", "developer"=>"Developer of software for the project.", "location"=>"Location of a repository.", "browse"=>"Web browser interface to repository."}
92
+ }
93
+ VOCABULARIES = [RDFS,RDF, DCEL, DCTERMS, DCTYPES, SIOC, FOAF, DOAP, SWRC]
94
+ end
@@ -2,7 +2,7 @@ module Rdfa #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 0
5
- TINY = 7
5
+ TINY = 8
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -127,27 +127,25 @@
127
127
  margin: 0 0 3em 0;
128
128
  }
129
129
 
130
- #content .article .title {
130
+ #content .article h1 {
131
131
  font-size: 24px;
132
132
  line-height: 94%;
133
133
  letter-spacing: -1.5px;
134
134
  margin: 0;
135
135
  }
136
136
 
137
- #content .article .title a:link,
138
- #content .article .title a:visited {
137
+ #content .article h1 a:link,
138
+ #content .article h1 a:visited {
139
139
  color: #930;
140
140
  text-decoration: none;
141
141
  }
142
142
 
143
- #content .article .title a:hover,
144
- #content .article .title a:active {
143
+ #content .article h1 a:hover,
144
+ #content .article h1 a:active {
145
145
  color: #000;
146
146
  background: transparent;
147
147
  }
148
148
 
149
- #content .article .title .comment_count { color: #eee; }
150
-
151
149
  #content .article .author {
152
150
  color: #bbb;
153
151
  font: normal 16px/14px "lucidamac bold", "lucida grande", arial, verdana, sans-serif;
@@ -1,11 +1,8 @@
1
- <% rdfa_post article.permalink_url do %>
1
+ <% require 'rdfa' %>
2
+
2
3
  <div class="article" id="article-<%= article.id %>">
3
- <h2 class="title">
4
- <% rdfa_title(article.title) do %>
5
- <%= (controller.action_name.include? 'permalink') ? article.title : link_to(article.title, article.permalink_url) %>
6
- <% end %>
7
- <%= content_tag(:span, article.published_comments.size, :class => 'comment_count') if article.published_comments.size > 0 %>
8
- </h2>
4
+ <% rdfa_post article.permalink_url do %>
5
+ <h1><%= rdfa_link_to_dcel_title(article.title,article.permalink_url) %></h1>
9
6
 
10
7
  <p class="author">
11
8
  Posted by <cite><%= rdfa_creator author_link(article) %></cite> the
@@ -13,7 +10,7 @@
13
10
  </p>
14
11
 
15
12
  <div class="content">
16
- <%= rdfa_post_content article.html(:body) %>
13
+ <%= rdfa_sioc_content article.html(:body) %>
17
14
 
18
15
  <% if article.extended? -%>
19
16
  <div class="extended">
@@ -31,7 +28,7 @@
31
28
  <!-- content_tag(:li, tag_links(article), :class => 'tags') unless article.tags.empty? -->
32
29
  <li class=tags>Tags
33
30
  <% for tag in article.tags %>
34
- <%= rdfa_link_to_tag tag.display_name, tag.permalink_url %>
31
+ <%= link_to tag.display_name, tag.permalink_url %>
35
32
  <% end %>
36
33
  <li>
37
34
  <li>Meta
@@ -1,2 +1,16 @@
1
+ require 'rubygems'
2
+
3
+ require 'action_controller'
4
+ require 'action_view'
5
+
1
6
  require 'test/unit'
2
7
  require File.dirname(__FILE__) + '/../lib/rdfa'
8
+
9
+
10
+ def render(code)
11
+ @renderer.render(:inline => code)
12
+ end
13
+
14
+ def assert_render(code,test)
15
+ assert_equal render(code), test
16
+ end
@@ -1,11 +1,116 @@
1
1
  require File.dirname(__FILE__) + '/test_helper.rb'
2
2
 
3
+
3
4
  class TestRdfa < Test::Unit::TestCase
4
5
 
5
6
  def setup
7
+ @renderer = ActionView::Base.new("./")
6
8
  end
7
9
 
8
10
  def test_truth
9
11
  assert true
10
12
  end
13
+
14
+ def test_name
15
+ assert_render(%{<%= rdfa_name "cedric" %>},%{<span property="foaf:name">cedric</span>})
16
+ end
17
+
18
+ def test_rdfa_write
19
+ assert_render(%{<%= rdfa_write :tag, :content, :option => :option %>},%{<tag option="option">content</tag>})
20
+ end
21
+
22
+ def test_rdfa_write_block
23
+ assert_render(%{<% rdfa_write_block :tag, :option => :option do %>content<%end%>} , %{<tag option="option">content</tag>})
24
+ end
25
+
26
+ def test_rdfa_link_to
27
+ code = %{<%= rdfa_link_to 'dcel:title', "title", "http://uri.org" %>}
28
+ test = %{<a href="http://uri.org" rel="dcel:title">title</a>}
29
+ #puts render(code)
30
+ assert_render(code,test)
31
+ end
32
+
33
+ def test_rdfa_triple
34
+ # rdfa_triple predicate, object=nil, subject_uri=nil, &block
35
+ code = %{<%= rdfa_triple 'dcel:title' %>}
36
+ test = %{<span property="dcel:title"></span>}
37
+ #puts render(code)
38
+ assert_render(code,test)
39
+ end
40
+
41
+ def test_rdfa_triple_object
42
+ # rdfa_triple predicate, object=nil, subject_uri=nil, &block
43
+ code = %{<%= rdfa_triple 'dcel:title', "title" %>}
44
+ test = %{<span property="dcel:title">title</span>}
45
+ #puts render(code)
46
+ assert_render(code,test)
47
+ end
48
+
49
+ def test_rdfa_triple_object_subject
50
+ # rdfa_triple predicate, object=nil, subject_uri=nil, &block
51
+ code = %{<%= rdfa_triple 'dcel:title', "title", "http://uri.org" %>}
52
+ test = %{<span about="http://uri.org" property="dcel:title">title</span>}
53
+ #puts render(code)
54
+ assert_render(code,test)
55
+ end
56
+
57
+ def test_rdfa_triple_block
58
+ # rdfa_triple predicate, object=nil, subject_uri=nil, &block
59
+ code = %{<% rdfa_triple 'dcel:title' do %>content<%end%>}
60
+ test = %{<span property="dcel:title">content</span>}
61
+ #puts render(code)
62
+ assert_render(code,test)
63
+ end
64
+
65
+ def test_rdfa_triple_object_block
66
+ # rdfa_triple predicate, object=nil, subject_uri=nil, &block
67
+ code = %{<% rdfa_triple 'dcel:title', 'title' do %>content<%end%>}
68
+ test = %{<span content="title" property="dcel:title">content</span>}
69
+ #puts render(code)
70
+ assert_render(code,test)
71
+ end
72
+
73
+ def test_rdfa_triple_object_subject_block
74
+ # rdfa_triple predicate, object=nil, subject_uri=nil, &block
75
+ code = %{<% rdfa_triple 'dcel:title', 'title', "http://uri.org" do %>content<%end%>}
76
+ test = %{<span about="http://uri.org" content="title" property="dcel:title">content</span>}
77
+ #puts render(code)
78
+ assert_render(code,test)
79
+ end
80
+
81
+ def test_rdfa_class
82
+ #rdfa_class klass, subject_uri=nil, &block
83
+ code = %{<%= rdfa_class 'rdfs:Resource' %>}
84
+ test = %{<span class="rdfs:Resource" rel="rdf:li"></span>}
85
+ #puts render(code)
86
+ assert_render(code,test)
87
+ end
88
+
89
+ def test_rdfa_class_subject
90
+ #rdfa_class klass, subject_uri=nil, &block
91
+ code = %{<%= rdfa_class 'rdfs:Resource', "http://uri.org" %>}
92
+ test = %{<span about="http://uri.org" class="rdfs:Resource"></span>}
93
+ #puts render(code)
94
+ assert_render(code,test)
95
+ end
96
+
97
+ def test_rdfa_class_block
98
+ #rdfa_class klass, subject_uri=nil, &block
99
+ code = %{<% rdfa_class 'rdfs:Resource' do %>content<%end%>}
100
+ test = %{<span class="rdfs:Resource" rel="rdf:li">content</span>}
101
+ #puts render(code)
102
+ assert_render(code,test)
103
+ end
104
+
105
+ def test_rdfa_class_subject_block
106
+ #rdfa_class klass, subject_uri=nil, &block
107
+ code = %{<% rdfa_class 'rdfs:Resource', "http://uri.org" do %>content<%end%>}
108
+ test = %{<span about="http://uri.org" class="rdfs:Resource">content</span>}
109
+ #puts render(code)
110
+ assert_render(code,test)
111
+ end
112
+
113
+ def test_name
114
+ assert_render(%{<%= rdfa_name "cedric" %>},%{<span property="foaf:name">cedric</span>})
115
+ end
11
116
  end
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.2
3
3
  specification_version: 1
4
4
  name: rdfa
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.0.7
7
- date: 2007-06-03 00:00:00 +02:00
6
+ version: 0.0.8
7
+ date: 2007-06-19 00:00:00 +02:00
8
8
  summary: description of gem
9
9
  require_paths:
10
10
  - lib
@@ -31,10 +31,9 @@ authors:
31
31
  files:
32
32
  - lib/rdfa.rb
33
33
  - lib/rdfa/version.rb
34
- - lib/rdfa/classes.rb
35
- - lib/rdfa/properties.rb
36
34
  - lib/rdfa/base.rb
37
- - lib/rdfa/partials.rb
35
+ - lib/rdfa/supported_vocabularies.rb
36
+ - lib/rdfa/shortcuts.rb
38
37
  - History.txt
39
38
  - Manifest.txt
40
39
  - README.txt
@@ -44,6 +43,8 @@ files:
44
43
  - test/test_helper.rb
45
44
  - test/test_rdfa.rb
46
45
  - bin/rdfa-typo
46
+ - bin/rdfa-vocabulary
47
+ - bin/rdfa-generate
47
48
  - rdfa-typo/CONTRIBUTORS
48
49
  - rdfa-typo/about.markdown
49
50
  - rdfa-typo/images
@@ -82,6 +83,8 @@ extra_rdoc_files:
82
83
  - README.txt
83
84
  executables:
84
85
  - rdfa-typo
86
+ - rdfa-vocabulary
87
+ - rdfa-generate
85
88
  extensions: []
86
89
 
87
90
  requirements: []
@@ -1,20 +0,0 @@
1
- module Rdfa
2
- module Classes
3
- def rdfa_resource resource_url=nil, &block
4
- rdfa_rdfs_resource resource_url, &block
5
- #rdfa_class "rdfs:Resource", resource_url, &block
6
- end
7
-
8
- def rdfa_post post_url=nil, &block
9
- rdfa_sioc_post post_url, &block
10
- end
11
-
12
- def rdfa_person person_url=nil, &block
13
- rdfa_class("foaf:Person", person_url, &block)
14
- end
15
-
16
- def rdfa_tag tag_url=nil, &block
17
- rdfa_class("scot:Tag", tag_url, &block)
18
- end
19
- end
20
- end
@@ -1,15 +0,0 @@
1
- module Rdfa
2
- module Partials
3
- def rdfa_link_to_tag term, tag_url, rdfa_options = {}
4
- render(:inline => %{
5
- <% rdfa_has_tag "#{tag_url}" do %>
6
- <% rdfa_tag "#{tag_url}" do %>
7
- <% rdfa_label("#{term}") do %>
8
- <%= link_to("#{term}", "#{tag_url}") %>
9
- <%end%>
10
- <% end %>
11
- <% end %>
12
- })
13
- end
14
- end
15
- end
@@ -1,51 +0,0 @@
1
- module Rdfa
2
- module Properties
3
- def rdfa_post_content content, subject_uri=nil, &block
4
- rdfa_sioc_content content, subject_uri, &block
5
- end
6
-
7
- def rdfa_title title, subject_uri=nil, &block
8
- rdfa_dc_title title, subject_uri, &block
9
- end
10
-
11
- def rdfa_creator creator, subject_uri=nil, &block
12
- rdfa_dc_creator creator, subject_uri, &block
13
- end
14
-
15
- def rdfa_label label, subject_uri=nil, &block
16
- rdfa_rdfs_label label, subject_uri, &block
17
- end
18
-
19
- def rdfa_description description, subject_uri=nil, &block
20
- rdfa_rdfs_description description, subject_uri, &block
21
- end
22
-
23
- def rdfa_date date, subject_uri=nil, &block
24
- rdfa_dc_date date, subject_uri, &block
25
- end
26
-
27
- def rdfa_name name, subject_uri=nil, &block
28
- rdfa_foaf_name name, subject_uri, &block
29
- end
30
-
31
- def rdfa_address address, subject_uri=nil, &block
32
- rdfa_foaf_address address, subject_uri, &block
33
- end
34
-
35
- def rdfa_email email, subject_uri=nil, &block
36
- rdfa_foaf_mbox email, subject_uri, &block
37
- end
38
-
39
- def rdfa_knows person_url, subject_uri=nil, &block
40
- rdfa_foaf_knows person_url, subject_uri, &block
41
- end
42
-
43
- def rdfa_has_tag tag_url, subject_uri=nil, &block
44
- rdfa_scot_hastag tag_url, subject_uri, &block
45
- end
46
-
47
- def rdfa_license license_url, subject_uri=nil, &block
48
- rdfa_triple "cc:license", license_url, subject_uri, &block
49
- end
50
- end
51
- end