Compare commits
No commits in common. "929a042c95f9bd7dfa31bc236f00aded9db43640" and "280d842f3f0336fbbbbf942d02496aeb5f8c7d24" have entirely different histories.
929a042c95
...
280d842f3f
19
Makefile
19
Makefile
@ -1,17 +1,8 @@
|
||||
all: json rdf python
|
||||
all: build
|
||||
|
||||
.PHONY: json rdf python
|
||||
build:
|
||||
python bundle.py > cic.json
|
||||
|
||||
|
||||
json:
|
||||
make -C schema/json
|
||||
|
||||
rdf:
|
||||
make -C schema/rdf
|
||||
|
||||
python:
|
||||
make -C python
|
||||
|
||||
install: python
|
||||
make -C schema/json install
|
||||
make -C schema/rdf install
|
||||
test: build
|
||||
check-jsonschema --schemafile dist/cic.json test_valid.json
|
||||
|
1
dist/cic.json
vendored
Normal file
1
dist/cic.json
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"$schema": "https://json-schema.org/draft/2020-12/schema", "title": "CIC core metadata container", "$id": "/cic/core", "type": "object", "properties": {"version": {"type": "integer"}, "attachments": {"type": "array", "items": {"$ref": "/mime"}}, "certifications": {"type": "array", "items": {"type": "string", "format": "uri"}, "minItems": 1}, "image_data": {"type": "string", "description": "Raw SVG image data, if you want to generate images on the fly (not recommended). Only use this if you're not including the image parameter.", "contentEncoding": "base64", "contentMediaType": "image/svg+xml"}, "image": {"type": "string", "description": "A URI pointing to a resource with mime type image/* representing the asset to which this NFT represents. Consider making any images at a width between 320 and 1080 pixels and aspect ratio between 1.91:1 and 4:5 inclusive.", "format": "uri"}, "external_url": {"type": "string", "description": "This is the URL that will appear below the asset's image on OpenSea and will allow users to leave OpenSea and view the item on your site.", "format": "uri"}, "attributes": {"type": "array", "description": "These are the attributes for the item, which will show up on the OpenSea page for the item. (see below)", "items": {"type": "object", "properties": {"trait_type": {"type": "string"}, "value": {"oneOf": [{"type": "string"}, {"type": "number"}]}, "display_type": {"type": "string"}}, "required": ["trait_type", "value"]}}, "animation_url": {"type": "string", "description": "Animation_url also supports HTML pages, allowing you to build rich experiences and interactive NFTs using JavaScript canvas, WebGL, and more. Scripts and relative paths within the HTML page are now supported. However, access to browser extensions is not supported.", "format": "uri"}, "name": {"type": "string", "description": "Identifies the asset to which this NFT represents"}, "description": {"type": "string", "description": "Describes the asset to which this NFT represents"}}, "required": ["version", "attachments", "attributes"], "mime": {"$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "/mime", "title": "A single generic attachment for documenting any asset", "type": "object", "properties": {"contentType": {"type": "string", "$comment": "valid mime type"}, "contentTransferEncoding": {"type": "string", "enum": ["BASE64", "QUOTED-PRINTABLE", "8BIT", "7BIT"]}, "subject": {"type": "string", "$comment": "utf-8"}, "body": {"type": "string", "$comment": "uri including dataurl"}, "ref": {"type": "string", "format": "uri"}}, "required": ["contentType", "subject"], "oneOf": [{"required": ["body"]}, {"required": ["ref"]}]}, "oneOf": [{"required": ["image"]}, {"required": ["image_data"]}]}
|
@ -1,3 +0,0 @@
|
||||
.PHONY: all
|
||||
|
||||
all:
|
@ -1 +0,0 @@
|
||||
from .cert import Cert
|
Binary file not shown.
Binary file not shown.
@ -1,17 +0,0 @@
|
||||
# standard imports
|
||||
import sys
|
||||
|
||||
# external imports
|
||||
from rdflib import Graph
|
||||
|
||||
|
||||
class Cert:
|
||||
|
||||
def __init__(self, path):
|
||||
self.g = Graph()
|
||||
self.g.parse(path, format='turtle')
|
||||
|
||||
|
||||
def export(self, w=sys.stdout):
|
||||
v = self.g.serialize(format='xml')
|
||||
w.write(v)
|
@ -1,14 +0,0 @@
|
||||
@base <https://defalsify.org/rdf-eth/0.1/evm.rdfs> .
|
||||
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
|
||||
@prefix rdfs: <https://www.w3.org/TR/rdf-schema/#> .
|
||||
|
||||
<#location> a rdfs:Class .
|
||||
<#tx> a rdfs:Class .
|
||||
<#account> rdfs:subClassOf <#location> .
|
||||
<#contract> rdfs:subClassOf <#location> .
|
||||
<#voucherContract> rdfs:subClassOf <#contract> .
|
||||
<#nftContract> rdfs:subClassOf <#contract> .
|
||||
<#gasTransfer> rdfs:subClassOf <#tx> .
|
||||
<#voucherTransfer> rdfs:subClassOf <#tx> .
|
||||
<#nftTransfer> rdfs:subClassOf <#tx> .
|
||||
<#id> rdfs:Datatype xsd:hexBinary .
|
@ -1,4 +0,0 @@
|
||||
check-jsonschema==0.21.0
|
||||
rdflib==6.2.0
|
||||
jsonschema==4.17.3
|
||||
|
@ -1 +0,0 @@
|
||||
hypothesis==6.68.2
|
@ -1,33 +0,0 @@
|
||||
# standard imports
|
||||
import unittest
|
||||
import json
|
||||
import os
|
||||
|
||||
# external imports
|
||||
from jsonschema import validate as json_validate
|
||||
|
||||
test_dir = os.path.realpath(os.path.dirname(__file__))
|
||||
testdata_dir = os.path.join(test_dir, 'testdata')
|
||||
data_dir = os.path.join(test_dir, '..', 'cic_schema', 'data')
|
||||
|
||||
|
||||
class TestJsonData(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
fp = os.path.join(data_dir, 'cic.json')
|
||||
f = open(fp, 'r')
|
||||
self.schema = json.load(f)
|
||||
f.close()
|
||||
|
||||
|
||||
def test_schema_load(self):
|
||||
fp = os.path.join(testdata_dir, 'test_valid.json')
|
||||
f = open(fp, 'r')
|
||||
o = json.load(f)
|
||||
f.close()
|
||||
validator = json_validate(o, self.schema)
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
@ -1,33 +0,0 @@
|
||||
# standard imports
|
||||
import unittest
|
||||
import json
|
||||
import os
|
||||
|
||||
# external imports
|
||||
from jsonschema import validate as json_validate
|
||||
from rdflib import Graph
|
||||
#from hypothesis import given, strategies
|
||||
|
||||
# local imports
|
||||
from cic_schema import Cert
|
||||
|
||||
test_dir = os.path.realpath(os.path.dirname(__file__))
|
||||
testdata_dir = os.path.join(test_dir, 'testdata')
|
||||
data_dir = os.path.join(test_dir, '..', 'cic_schema', 'data')
|
||||
|
||||
|
||||
class TestNft(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
fp = os.path.join(testdata_dir, 'test_voucher.rdf')
|
||||
self.graph_voucher = Cert(fp)
|
||||
fp = os.path.join(testdata_dir, 'test_tx.rdf')
|
||||
self.graph_tx = Cert(fp)
|
||||
|
||||
|
||||
def test_simplest(self):
|
||||
print(self.graph_tx.export())
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
1
requirements.txt
Normal file
1
requirements.txt
Normal file
@ -0,0 +1 @@
|
||||
check-jsonschema==0.21.0
|
@ -1,12 +0,0 @@
|
||||
all: build
|
||||
|
||||
build:
|
||||
python bundle.py
|
||||
|
||||
|
||||
test: build
|
||||
check-jsonschema --schemafile dist/cic.json test_valid.json
|
||||
|
||||
|
||||
install: build
|
||||
cp -v dist/cic.json ../../python/cic_schema/data/
|
@ -1,5 +0,0 @@
|
||||
all: install
|
||||
|
||||
install:
|
||||
cp -v evm.rdfs ../../python/cic_schema/data/
|
||||
|
@ -1,14 +0,0 @@
|
||||
@base <https://defalsify.org/rdf-eth/0.1/evm.rdfs> .
|
||||
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
|
||||
@prefix rdfs: <https://www.w3.org/TR/rdf-schema/#> .
|
||||
|
||||
<#location> a rdfs:Class .
|
||||
<#tx> a rdfs:Class .
|
||||
<#account> rdfs:subClassOf <#location> .
|
||||
<#contract> rdfs:subClassOf <#location> .
|
||||
<#voucherContract> rdfs:subClassOf <#contract> .
|
||||
<#nftContract> rdfs:subClassOf <#contract> .
|
||||
<#gasTransfer> rdfs:subClassOf <#tx> .
|
||||
<#voucherTransfer> rdfs:subClassOf <#tx> .
|
||||
<#nftTransfer> rdfs:subClassOf <#tx> .
|
||||
<#id> rdfs:Datatype xsd:hexBinary .
|
@ -1,12 +1,13 @@
|
||||
@prefix evm: <https://defalsify.org/rdf-eth/0.1/#> .
|
||||
@prefix evm: <https://defalsify.org/rdf-eth/0.1/> .
|
||||
@prefix cic: <https://cicnet.org/rdf/0.1/> .
|
||||
@prefix ge: <https://grassrootseconomics.net/rdf/0.1/ge#> .
|
||||
@prefix redcross: <https://redcross.com/cic-def/0.1/> .
|
||||
@prefix un: <https://un.com/esg/0.1/> .
|
||||
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
|
||||
|
||||
evm:voucherTransfer
|
||||
evm:id "6f4ed36c11345a9a48353cd2f93f1f92958c96df15f3112a192bc994250e8d03"^^xsd:hexBinary ;
|
||||
evm:tx
|
||||
evm:id "0x6f4ed36c11345a9a48353cd2f93f1f92958c96df15f3112a192bc994250e8d03"^^<http://www.w3.org/2001/XMLSchema#token> ;
|
||||
a cic:fungibleVoucher ;
|
||||
evm:address "0xeb3907ecad74a0013c259d5874ae7f22dcbcc95c"^^<http://www.w3.org/2001/XMLSchema#token> ;
|
||||
ge:approvedActor <URN:uuid:18daebc7-23b9-41e4-af00-2559f7840f78> ;
|
||||
redcross:interest ge:foodforest ;
|
||||
un:esg "deforestation" ;
|
@ -2,13 +2,13 @@
|
||||
@prefix cic: <https://cicnet.org/rdf/0.1/> .
|
||||
@prefix ge: <https://grassrootseconomics.net/rdf/0.1/ge#> .
|
||||
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
|
||||
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
|
||||
|
||||
evm:voucherContract
|
||||
evm:id "01f92958c96df15f3112a192bc994250e8defef93f"^^xsd:hexBinary ;
|
||||
evm:address
|
||||
evm:id "0x1f92958c96df15f3112a192bc994250e8defef93f"^^<http://www.w3.org/2001/XMLSchema#token> ;
|
||||
a cic:fungibleVoucher ;
|
||||
cic:unitOfAccount cic:ref:wampum ;
|
||||
cic:validFrom "2023-03-05T19:04:40+00:00"^^xsd:dateTime ;
|
||||
cic:validUntil "2024-03-05T19:04:40+00:00"^^xsd:dateTime ;
|
||||
cic:validFrom "2023-03-05T19:04:40+00:00"^^<http://www.w3.org/2001/XMLSchema#dateTime> ;
|
||||
cic:validUntil "2024-03-05T19:04:40+00:00"^^<http://www.w3.org/2001/XMLSchema#dateTime> ;
|
||||
foaf:name "John Doe" ;
|
||||
cic:humanDescription <URN:sha256:2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae> ;
|
||||
ge:areaSovereign "Kenya" ;
|
||||
@ -16,9 +16,10 @@ evm:voucherContract
|
||||
ge:areaLesser "Mnarani" ;
|
||||
ge:community "Foo tribe" .
|
||||
|
||||
evm:voucherContract
|
||||
evm:id "058c96df15f3112a192bc994250e8defef93f12345"^^xsd:hexBinary ;
|
||||
evm:address
|
||||
evm:id "0x58c96df15f3112a192bc994250e8defef93f12345"^^<http://www.w3.org/2001/XMLSchema#token> ;
|
||||
a cic:fungibleVoucher ;
|
||||
cic:unitOfAccount "seashells" ;
|
||||
cic:validFrom "2023-03-04T09:34:33+00:00"^^xsd:dateTime ;
|
||||
cic:validFrom "2023-03-04T09:34:33+00:00"^^<http://www.w3.org/2001/XMLSchema#dateTime> ;
|
||||
foaf:name "Busy Bee" ;
|
||||
ge:approvedActor <URN:uuid:18daebc7-23b9-41e4-af00-2559f7840f78> .
|
Loading…
Reference in New Issue
Block a user