Skip to content

Commit

Permalink
Added pypi uploads and examples.
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmccu committed Sep 20, 2016
1 parent 06acb52 commit fd2f5bc
Show file tree
Hide file tree
Showing 7 changed files with 151 additions and 3 deletions.
39 changes: 39 additions & 0 deletions example/social-naive.setl.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
@prefix prov: <http://www.w3.org/ns/prov#> .
@prefix dcat: <http://www.w3.org/ns/dcat#> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix void: <http://rdfs.org/ns/void#> .
@prefix setl: <http://purl.org/twc/vocab/setl/> .
@prefix csvw: <http://www.w3.org/ns/csvw#> .
@prefix pv: <http://purl.org/net/provenance/ns#> .
@prefix : <http://example.com/setl/> .

:table a csvw:Table, setl:Table;
csvw:delimiter ",";
prov:wasGeneratedBy [
a setl:Extract;
prov:used <social.csv>;
].


<http://example.com/social> a void:Dataset;
prov:wasGeneratedBy [
a setl:Transform, setl:JSLDT;
prov:used :table;
setl:hasContext '''{
"@vocab" : "http://example.com/ns/"
}''';
prov:value '''[{
"@for" : "p, o in row.iteritems()",
"@do" : {
"@if" : "not isempty(o)",
"@id" : "https://example.com/social/{{name}}",
"http://example.com/ns/{{p}}" : "{{o}}"
}
}]'''].

<social-naive.ttl> a pv:File;
dcterms:format "text/turtle";
prov:wasGeneratedBy [
a setl:Load;
prov:used <http://example.com/social> ;
].
27 changes: 27 additions & 0 deletions example/social-naive.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
@prefix : <http://example.com/ns/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

<https://example.com/social/0> :DOB "1/12/1983" ;
:ID "Alice" ;
:Knows "Bob; Charles" ;
:MarriedTo "Bob" ;
:Name "Alice Smith" .

<https://example.com/social/1> :DOB "3/23/1985" ;
:ID "Bob" ;
:Knows "Alice; Charles" ;
:MarriedTo "Alice" ;
:Name "Bob Smith" .

<https://example.com/social/2> :DOB "12/15/1955" ;
:ID "Charles" ;
:Knows "Alice; Bob" ;
:Name "Charles Brown" .

<https://example.com/social/3> :DOB "4/25/1967" ;
:ID "Dave" ;
:Name "Dave Jones" .

5 changes: 5 additions & 0 deletions example/social.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ID,Name,MarriedTo,Knows,DOB
Alice,Alice Smith,Bob,Bob; Charles,1/12/1983
Bob,Bob Smith,Alice,Alice; Charles,3/23/1985
Charles,Charles Brown,,Alice; Bob,12/15/1955
Dave,Dave Jones,,,4/25/1967
45 changes: 45 additions & 0 deletions example/social.setl.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
@prefix prov: <http://www.w3.org/ns/prov#> .
@prefix dcat: <http://www.w3.org/ns/dcat#> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix void: <http://rdfs.org/ns/void#> .
@prefix setl: <http://purl.org/twc/vocab/setl/> .
@prefix csvw: <http://www.w3.org/ns/csvw#> .
@prefix pv: <http://purl.org/net/provenance/ns#> .
@prefix : <http://example.com/setl/> .

:table a csvw:Table, setl:Table;
csvw:delimiter ",";
prov:wasGeneratedBy [
a setl:Extract;
prov:used <social.csv>;
].


<http://example.com/social> a void:Dataset;
prov:wasGeneratedBy [
a setl:Transform, setl:JSLDT;
prov:used :table;
setl:hasContext '''{
"foaf" : "http://xmlns.com/foaf/0.1/"
}''';
prov:value '''[{
"@id": "https://example.com/social/{{row.ID}}",
"@type": "foaf:Person",
"foaf:name": "{{row.Name}}",
"http://schema.org/spouse": [{
"@if" : "not isempty(row.MarriedTo)",
"@id" : "https://example.com/social/{{row.ID}}"
}],
"foaf:knows": [{
"@if" : "not isempty(row.Knows)",
"@for" : "friend in row.Knows.split('; ')",
"@do" : { "@id" : "https://example.com/social/{{friend}}" }
}]
}]'''].

<social.ttl> a pv:File;
dcterms:format "text/turtle";
prov:wasGeneratedBy [
a setl:Load;
prov:used <http://example.com/social> ;
].
27 changes: 27 additions & 0 deletions example/social.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix ns1: <http://schema.org/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

<https://example.com/social/Dave> a foaf:Person ;
foaf:name "Dave Jones" .

<https://example.com/social/Charles> a foaf:Person ;
foaf:knows <https://example.com/social/Alice>,
<https://example.com/social/Bob> ;
foaf:name "Charles Brown" .

<https://example.com/social/Alice> a foaf:Person ;
ns1:spouse <https://example.com/social/Alice> ;
foaf:knows <https://example.com/social/Bob>,
<https://example.com/social/Charles> ;
foaf:name "Alice Smith" .

<https://example.com/social/Bob> a foaf:Person ;
ns1:spouse <https://example.com/social/Bob> ;
foaf:knows <https://example.com/social/Alice>,
<https://example.com/social/Charles> ;
foaf:name "Bob Smith" .

2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[metadata]
description-file = README.md
9 changes: 6 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import os
from setuptools import setup
from setuptools import setup, find_packages

# Utility function to read the README file.
# Used for the long_description. It's nice, because now 1) we have a top level
Expand All @@ -25,14 +25,17 @@ def read(fname):
'pandas',
'requests',
'toposort',
'requests-testadapter'
'beautifulsoup4',
'jinja2',
'requests-testadapter',
],
entry_points = {
'console_scripts': ['setlr=setlr:main'],
},
packages = find_packages(),
classifiers=[
"Development Status :: 3 - Alpha",
"Topic :: Utilities",
"License :: OSI Approved :: Apache 2.0 License",
"License :: OSI Approved :: Apache Software License",
],
)

0 comments on commit fd2f5bc

Please sign in to comment.