Class: RdfContext::Resource
- Inherits:
-
Object
- Object
- RdfContext::Resource
- Defined in:
- lib/rdf_context/resource.rb
Overview
Common super-class for things that are RDF Resources
Class Method Summary collapse
-
.parse(str) ⇒ Object
Parse a string to a resource, in NTriples format.
Instance Method Summary collapse
-
#bnode? ⇒ Boolean
Returns ‘false`, overridden in BNode.
-
#graph? ⇒ Boolean
Returns ‘false`, overridden in BNode.
-
#literal? ⇒ Boolean
Returns ‘false`, overridden in Literal.
-
#resource? ⇒ Boolean
Returns ‘true` to indicate that this value is a resource.
-
#uri? ⇒ Boolean
Returns ‘false`, overridden in URIref.
Class Method Details
.parse(str) ⇒ Object
Parse a string to a resource, in NTriples format
46 47 48 49 50 51 52 53 54 |
# File 'lib/rdf_context/resource.rb', line 46 def self.parse(str) case str when /^_:/ then BNode.parse(str) when /^</ then URIRef.parse(str) when /^http:/ then URIRef.parse(str) when /^\"/ then Literal.parse(str) else Literal.parse(str) end end |
Instance Method Details
#bnode? ⇒ Boolean
Returns ‘false`, overridden in BNode
33 34 35 |
# File 'lib/rdf_context/resource.rb', line 33 def bnode? false end |
#graph? ⇒ Boolean
Returns ‘false`, overridden in BNode
41 42 43 |
# File 'lib/rdf_context/resource.rb', line 41 def graph? false end |
#literal? ⇒ Boolean
Returns ‘false`, overridden in Literal
17 18 19 |
# File 'lib/rdf_context/resource.rb', line 17 def literal? false end |
#resource? ⇒ Boolean
Returns ‘true` to indicate that this value is a resource.
9 10 11 |
# File 'lib/rdf_context/resource.rb', line 9 def resource? true end |
#uri? ⇒ Boolean
Returns ‘false`, overridden in URIref
25 26 27 |
# File 'lib/rdf_context/resource.rb', line 25 def uri? false end |