asimov-protocol 25.0.0.dev.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/AUTHORS +1 -0
- data/CHANGES.md +18 -0
- data/README.md +53 -0
- data/UNLICENSE +24 -0
- data/VERSION +1 -0
- data/lib/asimov/protocol/account.rb +77 -0
- data/lib/asimov/protocol/dataset.rb +93 -0
- data/lib/asimov/protocol/directory.rb +52 -0
- data/lib/asimov/protocol/network.rb +6 -0
- data/lib/asimov/protocol/repository.rb +6 -0
- data/lib/asimov/protocol.rb +11 -0
- data/lib/asimov-protocol.rb +3 -0
- metadata +112 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a5637897f9892d6930d04dd05d3fe6729ffaf4aebfcec8ccd63df4444392eccd
|
4
|
+
data.tar.gz: 2afaaf2eb574a0e1d034c8f80a0198fe00314ae52afe7768b99d65bbe51a2bc1
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e721955a3fc53a7ffb4fe9c804a1cba3556bb574f43088399b7d96d9a94163980ada973d4474efa3f1d283cd61657caa2712198fb4d6f17db77f67a3484bd903
|
7
|
+
data.tar.gz: dbe2f0020258552720fe883667a3d9821f1102acae77d39faa9a274e9c0f069a99376cc0a025d52f4d2d0a8f577aebd7b5ba220bf797a529e9b6088da29629b4
|
data/AUTHORS
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
* Arto Bendiken <arto@asimov.so>
|
data/CHANGES.md
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
All notable changes to this project will be documented in this file.
|
4
|
+
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
7
|
+
|
8
|
+
## 25.0.0.dev.4 - 2025-02-15
|
9
|
+
|
10
|
+
## 25.0.0.dev.3 - 2025-02-15
|
11
|
+
|
12
|
+
## 25.0.0.dev.2 - 2025-02-15
|
13
|
+
|
14
|
+
## 25.0.0.dev.1 - 2025-02-12
|
15
|
+
|
16
|
+
## 25.0.0.dev.0 - 2025-02-11
|
17
|
+
|
18
|
+
## 24.0.0.dev.0 - 2024-06-26
|
data/README.md
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
# ASIMOV Software Development Kit (SDK) for Ruby
|
2
|
+
|
3
|
+
[](https://unlicense.org)
|
4
|
+
[](https://rubygems.org/gems/asimov.rb)
|
5
|
+
[](https://rubygems.org/gems/asimov.rb)
|
6
|
+
[](https://rubydoc.info/gems/asimov.rb)
|
7
|
+
|
8
|
+
🚧 _We are building in public. This is presently under heavy construction._
|
9
|
+
|
10
|
+
## ✨ Features
|
11
|
+
|
12
|
+
- 100% free and unencumbered public domain software.
|
13
|
+
|
14
|
+
## 🛠️ Prerequisites
|
15
|
+
|
16
|
+
- [Ruby] 3.2+
|
17
|
+
|
18
|
+
## ⬇️ Installation
|
19
|
+
|
20
|
+
### Installation via RubyGems
|
21
|
+
|
22
|
+
```bash
|
23
|
+
gem install asimov.rb --pre
|
24
|
+
```
|
25
|
+
|
26
|
+
## 👉 Examples
|
27
|
+
|
28
|
+
- [Importing the SDK](#importing-the-sdk)
|
29
|
+
|
30
|
+
### Importing the SDK
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
require 'asimov'
|
34
|
+
```
|
35
|
+
|
36
|
+
## 📚 Reference
|
37
|
+
|
38
|
+
https://rubydoc.info/gems/asimov.rb
|
39
|
+
|
40
|
+
## 👨💻 Development
|
41
|
+
|
42
|
+
```bash
|
43
|
+
git clone https://github.com/asimov-platform/asimov.rb.git
|
44
|
+
```
|
45
|
+
|
46
|
+
- - -
|
47
|
+
|
48
|
+
[](https://twitter.com/share?url=https://github.com/asimov-platform/asimov.rb&text=ASIMOV%20Software%20Development%20Kit%20%28SDK%29%20for%20Ruby)
|
49
|
+
[](https://reddit.com/submit?url=https://github.com/asimov-platform/asimov.rb&title=ASIMOV%20Software%20Development%20Kit%20%28SDK%29%20for%20Ruby)
|
50
|
+
[](https://news.ycombinator.com/submitlink?u=https://github.com/asimov-platform/asimov.rb&t=ASIMOV%20Software%20Development%20Kit%20%28SDK%29%20for%20Ruby)
|
51
|
+
[](https://www.facebook.com/sharer/sharer.php?u=https://github.com/asimov-platform/asimov.rb)
|
52
|
+
|
53
|
+
[Ruby]: https://ruby-lang.org
|
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 <https://unlicense.org/>
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
25.0.0.dev.4
|
@@ -0,0 +1,77 @@
|
|
1
|
+
# This is free and unencumbered software released into the public domain.
|
2
|
+
|
3
|
+
require "asimov/config"
|
4
|
+
require "pathname"
|
5
|
+
|
6
|
+
##
|
7
|
+
# A user account on the ASIMOV Protocol.
|
8
|
+
class ASIMOV::Protocol::Account
|
9
|
+
GRAMMAR = %r{^([^/]+)$}
|
10
|
+
|
11
|
+
##
|
12
|
+
# @param [String, #to_s] id
|
13
|
+
# @return [ASIMOV::Protocol::Account]
|
14
|
+
def self.parse(id)
|
15
|
+
id = id.to_s
|
16
|
+
unless GRAMMAR.match?(id)
|
17
|
+
raise ArgumentError, "invalid account ID: #{id.inspect}"
|
18
|
+
end
|
19
|
+
self.new(id)
|
20
|
+
end
|
21
|
+
|
22
|
+
##
|
23
|
+
# @param [String, #to_s] id
|
24
|
+
# @return [void]
|
25
|
+
def initialize(id)
|
26
|
+
@id = id.to_s
|
27
|
+
end
|
28
|
+
|
29
|
+
##
|
30
|
+
# @return [String]
|
31
|
+
attr_reader :id
|
32
|
+
|
33
|
+
##
|
34
|
+
# @return [ASIMOV::Protocol::Account]
|
35
|
+
def parent
|
36
|
+
return nil unless self.id.include?('.')
|
37
|
+
self.class.new(self.id.split('.').drop(1).join('.'))
|
38
|
+
end
|
39
|
+
|
40
|
+
##
|
41
|
+
# @return [Pathname]
|
42
|
+
def path
|
43
|
+
base_path = ASIMOV::Config.path.join("datasets")
|
44
|
+
base_path.join(*self.id.split('.').reverse)
|
45
|
+
end
|
46
|
+
|
47
|
+
##
|
48
|
+
# @return [String]
|
49
|
+
def to_s
|
50
|
+
self.id
|
51
|
+
end
|
52
|
+
|
53
|
+
##
|
54
|
+
# @param [String, #to_s] base_uri
|
55
|
+
# @return [String]
|
56
|
+
def to_uri(base_uri)
|
57
|
+
"#{base_uri}/#{self.id}"
|
58
|
+
end
|
59
|
+
|
60
|
+
##
|
61
|
+
# @param [String, #to_s] base_uri
|
62
|
+
# @return [RDF::Graph]
|
63
|
+
def to_rdf(base_uri)
|
64
|
+
require "rdf"
|
65
|
+
RDF::Graph.new do |graph|
|
66
|
+
self_uri = RDF::URI.new(self.to_uri(base_uri))
|
67
|
+
# TODO
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
##
|
72
|
+
# @param [String, #to_s] dataset_name
|
73
|
+
# @return [ASIMOV::Protocol::Dataset]
|
74
|
+
def find_dataset(dataset_name)
|
75
|
+
ASIMOV::Protocol::Dataset.new("#{self.id}/#{dataset_name}")
|
76
|
+
end
|
77
|
+
end # ASIMOV::Protocol::Account
|
@@ -0,0 +1,93 @@
|
|
1
|
+
# This is free and unencumbered software released into the public domain.
|
2
|
+
|
3
|
+
##
|
4
|
+
# A dataset of knowledge graphs on the ASIMOV Protocol.
|
5
|
+
class ASIMOV::Protocol::Dataset
|
6
|
+
GRAMMAR = %r{^([^/]+)/([^/]+)$}
|
7
|
+
|
8
|
+
##
|
9
|
+
# @param [String, #to_s] id
|
10
|
+
# @return [ASIMOV::Protocol::Dataset]
|
11
|
+
def self.parse(id)
|
12
|
+
id = id.to_s
|
13
|
+
account, name = case id
|
14
|
+
when ASIMOV::Protocol::Account::GRAMMAR then [$1, nil]
|
15
|
+
when GRAMMAR then [$1, $2]
|
16
|
+
else raise ArgumentError, "invalid dataset ID: #{id.inspect}"
|
17
|
+
end
|
18
|
+
self.new(account, name)
|
19
|
+
end
|
20
|
+
|
21
|
+
##
|
22
|
+
# @param [String, #to_s] account
|
23
|
+
# @param [String, #to_s] name
|
24
|
+
def initialize(account, name)
|
25
|
+
@account, @name = account.to_s, name.to_s
|
26
|
+
end
|
27
|
+
|
28
|
+
##
|
29
|
+
# The account that owns this dataset.
|
30
|
+
#
|
31
|
+
# @return [ASIMOV::Protocol::Account]
|
32
|
+
attr_reader :account
|
33
|
+
def account
|
34
|
+
ASIMOV::Protocol::Account.new(@account)
|
35
|
+
end
|
36
|
+
|
37
|
+
##
|
38
|
+
# The machine-readable name of this dataset.
|
39
|
+
#
|
40
|
+
# @return [String]
|
41
|
+
attr_reader :name
|
42
|
+
|
43
|
+
##
|
44
|
+
# @return [Pathname]
|
45
|
+
def path
|
46
|
+
self.account.path.join(self.name || 'default') # TODO
|
47
|
+
end
|
48
|
+
|
49
|
+
##
|
50
|
+
# @return [void]
|
51
|
+
def each_graph(&block)
|
52
|
+
[].each(&block) # TODO
|
53
|
+
end
|
54
|
+
|
55
|
+
##
|
56
|
+
# @return [String]
|
57
|
+
def to_s
|
58
|
+
[@account, @name].compact.join('/')
|
59
|
+
end
|
60
|
+
alias_method :id, :to_s
|
61
|
+
|
62
|
+
##
|
63
|
+
# @param [String, #to_s] base_uri
|
64
|
+
# @return [String]
|
65
|
+
def to_uri(base_uri)
|
66
|
+
"#{base_uri}/#{self.to_s}"
|
67
|
+
end
|
68
|
+
|
69
|
+
##
|
70
|
+
# @param [String, #to_s] base_uri
|
71
|
+
# @return [RDF::Graph]
|
72
|
+
def to_rdf(base_uri)
|
73
|
+
require 'rdf'
|
74
|
+
require 'rdf/vocab'
|
75
|
+
|
76
|
+
include RDF
|
77
|
+
include RDF::Vocab
|
78
|
+
|
79
|
+
RDF::Graph.new do |graph|
|
80
|
+
self_uri = RDF::URI(self.to_uri(base_uri)).normalize
|
81
|
+
default_graph = RDF::Node.new
|
82
|
+
graph << [self_uri, RDF.type, SD.Service]
|
83
|
+
graph << [self_uri, RDFS.label, self.name]
|
84
|
+
graph << [self_uri, SD.endpoint, self_uri]
|
85
|
+
graph << [self_uri, SD.supportedLanguage, SD.SPARQL11Query]
|
86
|
+
graph << [self_uri, SD.defaultDataset, self_uri]
|
87
|
+
graph << [self_uri, RDF.type, SD.Dataset]
|
88
|
+
graph << [self_uri, SD.defaultGraph, default_graph]
|
89
|
+
graph << [default_graph, RDF.type, SD.Graph]
|
90
|
+
graph << [default_graph, VOID.triples, 0]
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end # ASIMOV::Protocol::Dataset
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# This is free and unencumbered software released into the public domain.
|
2
|
+
|
3
|
+
##
|
4
|
+
# The directory of datasets on the ASIMOV Protocol.
|
5
|
+
class ASIMOV::Protocol::Directory
|
6
|
+
##
|
7
|
+
# @param [Integer, #to_i] block
|
8
|
+
# @param [Boolean] local
|
9
|
+
# @yield [dir]
|
10
|
+
# @yieldparam [ASIMOV::Protocol::Directory] dir
|
11
|
+
# @yieldreturn [void]
|
12
|
+
# @return [ASIMOV::Protocol::Directory]
|
13
|
+
def self.open(block: nil, local: false, &)
|
14
|
+
# TODO: call the registry contract
|
15
|
+
dir = self.new
|
16
|
+
if block_given?
|
17
|
+
yield dir
|
18
|
+
else
|
19
|
+
dir
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
##
|
24
|
+
# @param [String, #to_s] account_id
|
25
|
+
# @return [ASIMOV::Protocol::Account]
|
26
|
+
def find_account(account_id)
|
27
|
+
ASIMOV::Protocol::Account.new(account_id)
|
28
|
+
end
|
29
|
+
|
30
|
+
##
|
31
|
+
# @param [String, #to_s] dataset_id
|
32
|
+
# @return [ASIMOV::Protocol::Dataset]
|
33
|
+
def find_dataset(dataset_id)
|
34
|
+
ASIMOV::Protocol::Dataset.new(dataset_id)
|
35
|
+
end
|
36
|
+
|
37
|
+
##
|
38
|
+
# @yield [dataset]
|
39
|
+
# @yieldparam [ASIMOV::Protocol::Dataset] dataset
|
40
|
+
# @yieldreturn [void]
|
41
|
+
# @return [void]
|
42
|
+
def each_dataset(&block)
|
43
|
+
return enum_for(__method__) unless block_given?
|
44
|
+
self.datasets.each(&block)
|
45
|
+
end
|
46
|
+
|
47
|
+
##
|
48
|
+
# @return [Array<ASIMOV::Protocol::Dataset>]
|
49
|
+
def datasets
|
50
|
+
[] # TODO
|
51
|
+
end
|
52
|
+
end # ASIMOV::Protocol::Directory
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# This is free and unencumbered software released into the public domain.
|
2
|
+
|
3
|
+
module ASIMOV; end
|
4
|
+
|
5
|
+
module ASIMOV::Protocol; end
|
6
|
+
|
7
|
+
require_relative 'protocol/account'
|
8
|
+
require_relative 'protocol/dataset'
|
9
|
+
require_relative 'protocol/directory'
|
10
|
+
require_relative 'protocol/network'
|
11
|
+
require_relative 'protocol/repository'
|
metadata
ADDED
@@ -0,0 +1,112 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: asimov-protocol
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 25.0.0.dev.4
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- ASIMOV Protocol
|
8
|
+
bindir: bin
|
9
|
+
cert_chain: []
|
10
|
+
date: 2025-02-15 00:00:00.000000000 Z
|
11
|
+
dependencies:
|
12
|
+
- !ruby/object:Gem::Dependency
|
13
|
+
name: rake
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
15
|
+
requirements:
|
16
|
+
- - ">="
|
17
|
+
- !ruby/object:Gem::Version
|
18
|
+
version: '13'
|
19
|
+
type: :development
|
20
|
+
prerelease: false
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
22
|
+
requirements:
|
23
|
+
- - ">="
|
24
|
+
- !ruby/object:Gem::Version
|
25
|
+
version: '13'
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: rspec
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '3.12'
|
33
|
+
type: :development
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '3.12'
|
40
|
+
- !ruby/object:Gem::Dependency
|
41
|
+
name: yard
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0.9'
|
47
|
+
type: :development
|
48
|
+
prerelease: false
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0.9'
|
54
|
+
- !ruby/object:Gem::Dependency
|
55
|
+
name: asimov-config
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - '='
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: 25.0.0.dev.4
|
61
|
+
type: :runtime
|
62
|
+
prerelease: false
|
63
|
+
version_requirements: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - '='
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: 25.0.0.dev.4
|
68
|
+
description: ''
|
69
|
+
email: support@asimov.so
|
70
|
+
executables: []
|
71
|
+
extensions: []
|
72
|
+
extra_rdoc_files: []
|
73
|
+
files:
|
74
|
+
- AUTHORS
|
75
|
+
- CHANGES.md
|
76
|
+
- README.md
|
77
|
+
- UNLICENSE
|
78
|
+
- VERSION
|
79
|
+
- lib/asimov-protocol.rb
|
80
|
+
- lib/asimov/protocol.rb
|
81
|
+
- lib/asimov/protocol/account.rb
|
82
|
+
- lib/asimov/protocol/dataset.rb
|
83
|
+
- lib/asimov/protocol/directory.rb
|
84
|
+
- lib/asimov/protocol/network.rb
|
85
|
+
- lib/asimov/protocol/repository.rb
|
86
|
+
homepage: https://sdk.asimov.so
|
87
|
+
licenses:
|
88
|
+
- Unlicense
|
89
|
+
metadata:
|
90
|
+
bug_tracker_uri: https://github.com/asimov-platform/asimov.rb/issues
|
91
|
+
changelog_uri: https://github.com/asimov-platform/asimov.rb/blob/master/CHANGES.md
|
92
|
+
documentation_uri: https://rubydoc.info/gems/asimov-protocol
|
93
|
+
homepage_uri: https://sdk.asimov.so
|
94
|
+
source_code_uri: https://github.com/asimov-platform/asimov.rb
|
95
|
+
rdoc_options: []
|
96
|
+
require_paths:
|
97
|
+
- lib
|
98
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '3.2'
|
103
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
104
|
+
requirements:
|
105
|
+
- - ">="
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
version: '0'
|
108
|
+
requirements: []
|
109
|
+
rubygems_version: 3.6.2
|
110
|
+
specification_version: 4
|
111
|
+
summary: ASIMOV Software Development Kit (SDK) for Ruby
|
112
|
+
test_files: []
|