Skip to content

Commit

Permalink
GitHub: New public repository for CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
nishad committed Aug 22, 2022
1 parent 252f563 commit f084a8f
Show file tree
Hide file tree
Showing 15 changed files with 865 additions and 1 deletion.
44 changes: 44 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,46 @@
build.sh

*.orig
*.pyc
*.swp
.env

# .gitignore all "tmp" folders
tmp

/.cargo_home/
/.idea/
/.vscode/
/.nova/
gclient_config.py_entries
/gh-pages/
/target/
/std/hash/_wasm/target
/tools/wpt/manifest.json

# Files that help ensure VSCode can work but we don't want checked into the
# repo
/node_modules
/tsconfig.json

# compiled wasm files
std/wasi/testdata/snapshot_preview1/

# generated v8 coverage files
cli/tests/.test_coverage/

# MacOS generated files
.DS_Store
.DS_Store?

# Flamegraphs
/flamebench*.svg
/flamegraph*.svg

# WPT generated cert files
/tools/wpt/certs/index.txt*
/tools/wpt/certs/serial*

# Logs
logs
*.log
Expand Down Expand Up @@ -102,3 +145,4 @@ dist

# TernJS port file
.tern-port

32 changes: 31 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,32 @@
# yama-cli
A CLI utility to work with YAMA and YAMAML
A CLI utility to work with YAMA and YAMAML files

```bash
usage :

shex
Generate ShEx from YAMA
yama shex -i [path/to/yama/file] -o [path/to/output/shex/file]
rdf
Generate RDF from YAMAML
yama rdf -i [path/to/yama/file] > [path/to/output/rdf/file]
```

To run use Deno runtime:

```bash
deno run --unstable --allow-all --no-check yama.js
```

Compile yama binary using Deno:

```bash
deno compile --unstable --allow-all --no-check --output yama yama.js
```

### YAMA to RDF

![YAMA to RDF](docs/images/yama-to-rdf.png)

### YAMA to ShEx
![YAMA to ShEx](docs/images/yama-to-shex.png)
Binary file added docs/images/yama-to-rdf.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/yama-to-shex.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 44 additions & 0 deletions examples/tbbt/tbbt.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix schema: <http://schema.org/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .


<sheldon-cooper> a foaf:Person ;
foaf:name "Sheldon Cooper"@en ;
foaf:familyName "Cooper"@en ;
foaf:firstName "Sheldon"@en ;
schema:parent <mary-cooper> ;
foaf:knows <leonard-hofstadter> ;
rdfs:seeAlso <http://www.wikidata.org/entity/Q629583> ;
schema:byArtist <jim-parsons> .

<mary-cooper> a foaf:Person ;
foaf:name "Mary Cooper"@en ;
foaf:familyName "Cooper"@en ;
foaf:firstName "Mary"@en ;
schema:children <sheldon-cooper> ;
rdfs:seeAlso <http://www.wikidata.org/entity/Q56322967> ;
schema:byArtist <laurie-metcalf> .

<leonard-hofstadter> a foaf:Person ;
foaf:name "Leonard"@en ;
foaf:familyName "Hofstadter"@en ;
foaf:firstName "Leonard"@en ;
foaf:knows <mary-cooper> ;
rdfs:seeAlso <http://www.wikidata.org/entity/Q512382> ;
schema:byArtist <johnny-galecki> .

<jim-parsons> a foaf:Person ;
schema:name "Jim Parsons"@en ;
rdfs:isDefinedBy <http://www.wikidata.org/entity/Q190972> .

<laurie-metcalf> a foaf:Person ;
schema:name "Laurie Metcalf"@en ;
rdfs:isDefinedBy <http://www.wikidata.org/entity/Q236711> .

<johnny-galecki> a foaf:Person ;
schema:name "Johnny Galecki"@en ;
rdfs:isDefinedBy <http://www.wikidata.org/entity/Q295739> .


233 changes: 233 additions & 0 deletions examples/tbbt/tbbt.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,233 @@
%YAML 1.2
---
base: http://purl.org/yama/examples/2022/tbbt/0.1/

namespaces:
foaf: http://xmlns.com/foaf/0.1/
schema: http://schema.org/
xsd: http://www.w3.org/2001/XMLSchema#
rdfs: http://www.w3.org/2000/01/rdf-schema#

defaults:
mapping:
source: tbbt_characters.csv
type: csv

descriptions:
# Character
character:
a: foaf:Person
label: Character
note: Details of the character
id:
mapping:
source: tbbt_characters.csv
type: csv
path: ID

# Statements in character
statements:
# Name of the character
name:
label: Name
property: foaf:name
min: 1
max: 1
note: Name of the character
type: literal
datatype: xsd:string
mapping:
source: tbbt_characters.csv
type: csv
path: name

# Family name of the character
familyName:
label: Family Name
property: foaf:familyName
min: 1
max: 1
note: Family Name of the character
type: literal
datatype: xsd:string
mapping:
source: tbbt_characters.csv
type: csv
path: familyName

# First name of the character
firstName:
label: First Name
property: foaf:firstName
min: 1
max: 1
note: Firts Name of the character
type: literal
datatype: xsd:string
mapping:
source: tbbt_characters.csv
type: csv
path: firstName

# Additional name of the character
additionalName:
label: Additional Name
property: schema:additionalName
min: 0
max: 1
note: First Name of the character
type: literal
datatype: xsd:string
mapping:
source: tbbt_characters.csv
type: csv
path: additionalName

# Job Title
jobTitle:
label: Job Title
property: schema:jobTitle
min: 0
max: 1
note: Job title of the character
type: literal
datatype: xsd:string
mapping:
source: tbbt_characters.csv
type: csv
path: additionalName

# Parents
parents:
label: Parents
property: schema:parent
min: 0
note: Parents of the character
type: IRI
mapping:
source: tbbt_characters.csv
type: csv
path: parents

# Children
children:
label: Children
property: schema:children
min: 0
note: Children of the character
type: IRI
mapping:
source: tbbt_characters.csv
type: csv
path: children

# Knows
knows:
label: Knows
property: foaf:knows
min: 0
note: This character knows these other characters
type: IRI
mapping:
source: tbbt_characters.csv
type: csv
path: knows
seperator: ","

wikidata:
label: Wikidata
property: rdfs:seeAlso
type: IRI
mapping:
source: tbbt_characters.csv
type: csv
path: wikidata
prepend: http://www.wikidata.org/entity/

# This character is portrayed by
byArtist:
label: Portrayed by
property: schema:byArtist
type: IRI
note: This character is portrayed by
mapping:
source: tbbt_characters.csv
type: csv
path: byArtist

# Description - Address
address:
# Statements in address
statements:
street:
label: Street
property: schema:streetAddress
note: Building and street address
mapping:
source: tbbt_characters.csv
type: csv
path: street

locality:
label: Locality
property: schema:addressLocality
mapping:
source: tbbt_characters.csv
type: csv
path: locality

region:
label: State
property: schema:addressRegion
mapping:
source: tbbt_characters.csv
type: csv
path: region

country:
label: Country
property: schema:addressRegion
mapping:
source: tbbt_characters.csv
type: csv
path: country

postalCode:
label: Postal Code
property: schema:postalCode
mapping:
source: tbbt_characters.csv
type: csv
path: postalCode

# Description - Artist
artist:
# Statements in address
a: foaf:Person
label: Character
note: Details of the character
id:
mapping:
source: tbbt_actors.csv
type: csv
path: ID

statements:
name:
label: Name
property: schema:name
note: Name of Artist
mapping:
source: tbbt_actors.csv
type: csv
path: name

wikidata:
label: Age
property: rdfs:isDefinedBy
type: IRI
mapping:
source: tbbt_actors.csv
type: csv
path: wikidata
prepend: http://www.wikidata.org/entity/
4 changes: 4 additions & 0 deletions examples/tbbt/tbbt_actors.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ID,name,wikidata
jim-parsons,Jim Parsons,Q190972
laurie-metcalf,Laurie Metcalf,Q236711
johnny-galecki,Johnny Galecki,Q295739
4 changes: 4 additions & 0 deletions examples/tbbt/tbbt_characters.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ID,wikidata,name,familyName,firstName,jobTitle,parents,children,knows,byArtist,street,locality,region,country,postalCode
sheldon-cooper,Q629583,Sheldon Cooper,Cooper,Sheldon,Theoretical physicist,mary-cooper,,leonard-hofstadter,jim-parsons,"2311 North Los Robles Avenue, Apartment 4A",Pasadena,CA,US,91104
mary-cooper,Q56322967,Mary Cooper,Cooper,Mary,,,sheldon-cooper,,laurie-metcalf,,,TX,US,
leonard-hofstadter,Q512382,Leonard,Hofstadter,Leonard,Experimental physicist,,,"sheldon-cooper,mary-cooper",johnny-galecki,"2311 North Los Robles Avenue, Apartment 4A",Pasadena,CA,US,91104
Loading

0 comments on commit f084a8f

Please sign in to comment.