triple_parser 0.1.9 → 0.1.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -30,6 +30,7 @@ module TripleParser
30
30
 
31
31
 
32
32
  def type_value_from_bracketed_url
33
+
33
34
  if text_after_hash_pattern =~ self
34
35
  type_value_from_text_after_hash_url
35
36
 
@@ -45,6 +46,9 @@ module TripleParser
45
46
  elsif asset_pattern =~ self
46
47
  type_value_for_asset
47
48
 
49
+ elsif pne_pattern =~ self
50
+ type_value_for_pne
51
+
48
52
  else
49
53
  type_value_for_unknown_url
50
54
 
@@ -59,9 +63,7 @@ module TripleParser
59
63
  @after_hash ||= match(text_after_hash_pattern)[1] if match(text_after_hash_pattern)
60
64
  end
61
65
 
62
- def type_value_from_text_after_hash_url
63
-
64
-
66
+ def type_value_from_text_after_hash_url
65
67
  if after_hash == 'id'
66
68
  type_value_for_id_after_hash
67
69
 
@@ -132,7 +134,7 @@ module TripleParser
132
134
  end
133
135
 
134
136
  def ontology_url_pattern
135
- /data\.press\.net\/ontology\/(?:\w+\/)+(\w+)/
137
+ /data\.press\.net\/ontology\/tag\/(\w+)/
136
138
  end
137
139
 
138
140
  def type_value_for_ontology
@@ -164,6 +166,17 @@ module TripleParser
164
166
  }
165
167
  end
166
168
 
169
+ def pne_pattern
170
+ /\/ontology\/event\/([a-zA-Z_]+)/
171
+ end
172
+
173
+ def type_value_for_pne
174
+ {
175
+ :type => 'pne',
176
+ :value => match(pne_pattern)[1]
177
+ }
178
+ end
179
+
167
180
  def type_value_for_unknown_url
168
181
  {
169
182
  :url => get_url
@@ -120,6 +120,10 @@ module TripleParser
120
120
  "<http://www.w3.org/1999/02/22-rdf-syntax-ns##{@third.value}>"
121
121
  end
122
122
 
123
+ def pne
124
+ "<http://data.press.net/ontology/event/#{@third.value}>"
125
+ end
126
+
123
127
  def camelcase(text)
124
128
  while underscore_pos = text.index(/_[a-z]/)
125
129
  letter_after_pos = underscore_pos + 1
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: triple_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.1.10
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: