json-ld 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/AUTHORS +1 -0
- data/README +87 -0
- data/UNLICENSE +24 -0
- data/VERSION +1 -0
- data/lib/json/ld.rb +31 -0
- data/lib/json/ld/format.rb +26 -0
- data/lib/json/ld/reader.rb +11 -0
- data/lib/json/ld/version.rb +18 -0
- data/lib/json/ld/writer.rb +11 -0
- metadata +118 -0
data/AUTHORS
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
* Gregg Kellogg <gregg@kellogg-assoc.com>
|
data/README
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
JSON-LD reader/writer
|
2
|
+
==================================
|
3
|
+
|
4
|
+
[JSON-LD][] reader/writer for [RDF.rb][RDF.rb] .
|
5
|
+
|
6
|
+
Features
|
7
|
+
--------
|
8
|
+
|
9
|
+
JSON::LD parses and serializes [JSON-LD][] into statements or triples.
|
10
|
+
|
11
|
+
Install with `gem install json-ld`
|
12
|
+
|
13
|
+
Examples
|
14
|
+
--------
|
15
|
+
|
16
|
+
require 'rubygems'
|
17
|
+
require 'json/ld'
|
18
|
+
|
19
|
+
Documentation
|
20
|
+
-------------
|
21
|
+
|
22
|
+
<http://rdf.rubyforge.org/json-ld>
|
23
|
+
|
24
|
+
* {JSON::LD}
|
25
|
+
|
26
|
+
Dependencies
|
27
|
+
------------
|
28
|
+
|
29
|
+
* [Ruby](http://ruby-lang.org/) (>= 1.8.7) or (>= 1.8.1 with [Backports][])
|
30
|
+
* [RDF.rb](http://rubygems.org/gems/rdf) (>= 0.3.3)
|
31
|
+
* [JSON](https://rubygems.org/gems/json) (>= 1.5.1)
|
32
|
+
|
33
|
+
Installation
|
34
|
+
------------
|
35
|
+
|
36
|
+
The recommended installation method is via [RubyGems](http://rubygems.org/).
|
37
|
+
To install the latest official release of the `JSON-LD` gem, do:
|
38
|
+
|
39
|
+
% [sudo] gem install json-ld
|
40
|
+
|
41
|
+
Download
|
42
|
+
--------
|
43
|
+
|
44
|
+
To get a local working copy of the development repository, do:
|
45
|
+
|
46
|
+
% git clone git://github.com/gkellogg/json-ld.git
|
47
|
+
|
48
|
+
Mailing List
|
49
|
+
------------
|
50
|
+
|
51
|
+
* <http://lists.w3.org/Archives/Public/public-rdf-ruby/>
|
52
|
+
|
53
|
+
Author
|
54
|
+
------
|
55
|
+
|
56
|
+
* [Gregg Kellogg](http://github.com/gkellogg) - <http://kellogg-assoc.com/>
|
57
|
+
|
58
|
+
|
59
|
+
Contributing
|
60
|
+
------------
|
61
|
+
|
62
|
+
* Do your best to adhere to the existing coding conventions and idioms.
|
63
|
+
* Don't use hard tabs, and don't leave trailing whitespace on any line.
|
64
|
+
* Do document every method you add using [YARD][] annotations. Read the
|
65
|
+
[tutorial][YARD-GS] or just look at the existing code for examples.
|
66
|
+
* Don't touch the `.gemspec`, `VERSION` or `AUTHORS` files. If you need to
|
67
|
+
change them, do so on your private branch only.
|
68
|
+
* Do feel free to add yourself to the `CREDITS` file and the corresponding
|
69
|
+
list in the the `README`. Alphabetical order applies.
|
70
|
+
* Do note that in order for us to merge any non-trivial changes (as a rule
|
71
|
+
of thumb, additions larger than about 15 lines of code), we need an
|
72
|
+
explicit [public domain dedication][PDD] on record from you.
|
73
|
+
|
74
|
+
License
|
75
|
+
-------
|
76
|
+
|
77
|
+
This is free and unencumbered public domain software. For more information,
|
78
|
+
see <http://unlicense.org/> or the accompanying {file:UNLICENSE} file.
|
79
|
+
|
80
|
+
[Ruby]: http://ruby-lang.org/
|
81
|
+
[RDF]: http://www.w3.org/RDF/
|
82
|
+
[YARD]: http://yardoc.org/
|
83
|
+
[YARD-GS]: http://rubydoc.info/docs/yard/file/docs/GettingStarted.md
|
84
|
+
[PDD]: http://lists.w3.org/Archives/Public/public-rdf-ruby/2010May/0013.html
|
85
|
+
[RDF.rb]: http://rdf.rubyforge.org/
|
86
|
+
[Backports]: http://rubygems.org/gems/backports
|
87
|
+
[JSON-LD]: http://json-ld.org/spec/ED/20110507/
|
data/UNLICENSE
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
This is free and unencumbered software released into the public domain.
|
2
|
+
|
3
|
+
Anyone is free to copy, modify, publish, use, compile, sell, or
|
4
|
+
distribute this software, either in source code form or as a compiled
|
5
|
+
binary, for any purpose, commercial or non-commercial, and by any
|
6
|
+
means.
|
7
|
+
|
8
|
+
In jurisdictions that recognize copyright laws, the author or authors
|
9
|
+
of this software dedicate any and all copyright interest in the
|
10
|
+
software to the public domain. We make this dedication for the benefit
|
11
|
+
of the public at large and to the detriment of our heirs and
|
12
|
+
successors. We intend this dedication to be an overt act of
|
13
|
+
relinquishment in perpetuity of all present and future rights to this
|
14
|
+
software under copyright law.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
19
|
+
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
20
|
+
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
21
|
+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
22
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
23
|
+
|
24
|
+
For more information, please refer to <http://unlicense.org/>
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.1
|
data/lib/json/ld.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
$:.unshift(File.expand_path(File.join(File.dirname(__FILE__), '..')))
|
2
|
+
require 'rdf'
|
3
|
+
|
4
|
+
module JSON
|
5
|
+
##
|
6
|
+
# **`JSON::LD`** is a JSON-LD plugin for RDF.rb.
|
7
|
+
#
|
8
|
+
# @example Requiring the `JSON::LD` module
|
9
|
+
# require 'json/ld'
|
10
|
+
#
|
11
|
+
# @example Parsing RDF statements from a JSON-LD file
|
12
|
+
# JSON::LD::Reader.open("etc/foaf.jld") do |reader|
|
13
|
+
# reader.each_statement do |statement|
|
14
|
+
# puts statement.inspect
|
15
|
+
# end
|
16
|
+
# end
|
17
|
+
#
|
18
|
+
# @see http://rdf.rubyforge.org/
|
19
|
+
# @see http://www.w3.org/TR/REC-rdf-syntax/
|
20
|
+
#
|
21
|
+
# @author [Gregg Kellogg](http://greggkellogg.net/)
|
22
|
+
module LD
|
23
|
+
require 'json/ld/format'
|
24
|
+
autoload :Reader, 'json/ld/reader'
|
25
|
+
autoload :VERSION, 'json/ld/version'
|
26
|
+
autoload :Writer, 'json/ld/writer'
|
27
|
+
|
28
|
+
def self.debug?; @debug; end
|
29
|
+
def self.debug=(value); @debug = value; end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module RDF::N3
|
2
|
+
##
|
3
|
+
# RDFa format specification.
|
4
|
+
#
|
5
|
+
# @example Obtaining an Notation3 format class
|
6
|
+
# RDF::Format.for(:jld) #=> JSON::LD::Format
|
7
|
+
# RDF::Format.for("etc/foaf.jld")
|
8
|
+
# RDF::Format.for(:file_name => "etc/foaf.jld")
|
9
|
+
# RDF::Format.for(:file_extension => "jld")
|
10
|
+
# RDF::Format.for(:content_type => "application/json")
|
11
|
+
#
|
12
|
+
# @example Obtaining serialization format MIME types
|
13
|
+
# RDF::Format.content_types #=> {"application/json" => [JSON::LD::Format]}
|
14
|
+
#
|
15
|
+
# @example Obtaining serialization format file extension mappings
|
16
|
+
# RDF::Format.file_extensions #=> {:ttl => "application/json"}
|
17
|
+
#
|
18
|
+
# @see http://www.w3.org/TR/rdf-testcases/#ntriples
|
19
|
+
class Format < RDF::Format
|
20
|
+
content_type 'application/json', :extension => :jld
|
21
|
+
content_encoding 'utf-8'
|
22
|
+
|
23
|
+
reader { RDF::N3::Reader }
|
24
|
+
writer { RDF::N3::Writer }
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module RDF::N3::VERSION
|
2
|
+
VERSION_FILE = File.join(File.expand_path(File.dirname(__FILE__)), "..", "..", "..", "VERSION")
|
3
|
+
MAJOR, MINOR, TINY, EXTRA = File.read(VERSION_FILE).chop.split(".")
|
4
|
+
|
5
|
+
STRING = [MAJOR, MINOR, TINY, EXTRA].compact.join('.')
|
6
|
+
|
7
|
+
##
|
8
|
+
# @return [String]
|
9
|
+
def self.to_s() STRING end
|
10
|
+
|
11
|
+
##
|
12
|
+
# @return [String]
|
13
|
+
def self.to_str() STRING end
|
14
|
+
|
15
|
+
##
|
16
|
+
# @return [Array(Integer, Integer, Integer)]
|
17
|
+
def self.to_a() STRING.split(".") end
|
18
|
+
end
|
metadata
ADDED
@@ -0,0 +1,118 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: json-ld
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.0.1
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Gregg Kellogg
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2011-05-07 00:00:00 -07:00
|
14
|
+
default_executable:
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: rdf
|
18
|
+
prerelease: false
|
19
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
|
+
none: false
|
21
|
+
requirements:
|
22
|
+
- - ~>
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: 0.4.0
|
25
|
+
type: :runtime
|
26
|
+
version_requirements: *id001
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: json
|
29
|
+
prerelease: false
|
30
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
31
|
+
none: false
|
32
|
+
requirements:
|
33
|
+
- - ">="
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: 1.5.1
|
36
|
+
type: :runtime
|
37
|
+
version_requirements: *id002
|
38
|
+
- !ruby/object:Gem::Dependency
|
39
|
+
name: yard
|
40
|
+
prerelease: false
|
41
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 0.6.0
|
47
|
+
type: :development
|
48
|
+
version_requirements: *id003
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
name: rspec
|
51
|
+
prerelease: false
|
52
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
53
|
+
none: false
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: 2.5.0
|
58
|
+
type: :development
|
59
|
+
version_requirements: *id004
|
60
|
+
- !ruby/object:Gem::Dependency
|
61
|
+
name: rdf-spec
|
62
|
+
prerelease: false
|
63
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
64
|
+
none: false
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.4.0
|
69
|
+
type: :development
|
70
|
+
version_requirements: *id005
|
71
|
+
description: JSON-LD reader/writer for Ruby.
|
72
|
+
email: public-rdf-ruby@w3.org
|
73
|
+
executables: []
|
74
|
+
|
75
|
+
extensions: []
|
76
|
+
|
77
|
+
extra_rdoc_files: []
|
78
|
+
|
79
|
+
files:
|
80
|
+
- AUTHORS
|
81
|
+
- README
|
82
|
+
- UNLICENSE
|
83
|
+
- VERSION
|
84
|
+
- lib/json/ld/format.rb
|
85
|
+
- lib/json/ld/reader.rb
|
86
|
+
- lib/json/ld/version.rb
|
87
|
+
- lib/json/ld/writer.rb
|
88
|
+
- lib/json/ld.rb
|
89
|
+
has_rdoc: false
|
90
|
+
homepage: http://rdf.rubyforge.org/json-ld
|
91
|
+
licenses:
|
92
|
+
- Public Domain
|
93
|
+
post_install_message:
|
94
|
+
rdoc_options: []
|
95
|
+
|
96
|
+
require_paths:
|
97
|
+
- lib
|
98
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
99
|
+
none: false
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 1.8.1
|
104
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ">="
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: "0"
|
110
|
+
requirements: []
|
111
|
+
|
112
|
+
rubyforge_project: json-ld
|
113
|
+
rubygems_version: 1.6.2
|
114
|
+
signing_key:
|
115
|
+
specification_version: 3
|
116
|
+
summary: JSON-LD reader/writer for Ruby.
|
117
|
+
test_files: []
|
118
|
+
|