-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathrdf.1
166 lines (140 loc) · 6.32 KB
/
rdf.1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
.TH rdf.sh 1 "10/2017" "version 0.8.0" "USER COMMANDS"
.SH NAME
rdf.sh \- A multi-tool shell script for doing Semantic Web jobs on the command line.
.SH SYNOPSIS
.B rdf
[subcommand]
[option]
.SH DESCRIPTION
The idea of this tool is to provide a fast command line interface to day by day Semantic Web / RDF hacker related jobs.
.PP
This includes inspecting resources and namespaces, listing of schema elements and other tasks.
.SS subcommands
color -- get a html color for a resource URI
count -- count distinct triples
delete -- deletes an existing linked data resource via LDP
desc -- outputs description of the given resource in a given format (default: turtle)
diff -- diff of triples from two RDF files
edit -- edit the content of an existing linked data resource via LDP (GET + PUT)
get -- curls rdf in xml or turtle to stdout (tries accept header)
get-ntriples -- curls rdf and transforms to ntriples
head -- curls only the http header but accepts only rdf
headn -- curls only the http header
help -- outputs the manpage of rdf
list -- list resources which start with the given URI
ns -- curls the namespace from prefix.cc
nscollect -- collects prefix declarations of a list of ttl/n3 files
nsdist -- distributes prefix declarations from one file to a list of other ttl/n3 files
nssort -- sorts the prefix declarations in files, inserting all at the line of the first found prefix
ping -- sends a semantic pingback request from a source to a target or to all possible targets
pingall -- sends a semantic pingback request to all possible targets of a given resource
put -- replaces an existing linked data resource via LDP
split -- split an RDF file into pieces of max X triple and -optional- run a command on each part
turtleize -- outputs an RDF file in turtle, using as much as possible prefix declarations
.TP
Each subcommand outputs a detailed help by using it without parameter:
.B $ rdf count
Syntax: rdf count <file>
(count triples using rapper)
.SH EXAMPLE
.SS namespace lookup (ns)
.TP
rdf.sh allows you to quickly lookup namespaces from prefix.cc:
.B $ rdf ns foaf
http://xmlns.com/foaf/0.1/
.TP
rdf.sh can also output prefix.cc syntax templates:
.B $ rdf ns skos sparql
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
SELECT *
WHERE {
?s ?p ?o .
}
.B $ rdf ns ping n3
@prefix ping: <http://purl.org/net/pingback/> .
.TP
Note: As a result of this subcommand, all other rdf command can get qnames as parameters (e.g. foaf:Person or skos:Concept) which results in a namespace lookup ahead of the used command.
.SS resource description (desc)
.TP
Describe a resource by querying for statements where the resource is the subject. This is extremly useful to fastly check schema details.
.B $ rdf desc foaf:Person
.B $ rdf desc skos:narrower
.SS resource listings (list)
.TP
To get a quick overview of an unknown RDF schema, rdf.sh provides the `list` command which outputs a distinct list of subject resources of the fetched URI:
.B $ rdf list geo:
http://www.w3.org/2003/01/geo/wgs84_pos#
http://www.w3.org/2003/01/geo/wgs84_pos#SpatialThing
http://www.w3.org/2003/01/geo/wgs84_pos#Point
http://www.w3.org/2003/01/geo/wgs84_pos#lat
http://www.w3.org/2003/01/geo/wgs84_pos#location
http://www.w3.org/2003/01/geo/wgs84_pos#long
http://www.w3.org/2003/01/geo/wgs84_pos#alt
http://www.w3.org/2003/01/geo/wgs84_pos#lat_long
.TP
You can also provide a starting sequence to constrain the output
.B $ rdf list skos:C
http://www.w3.org/2004/02/skos/core#Concept
http://www.w3.org/2004/02/skos/core#ConceptScheme
http://www.w3.org/2004/02/skos/core#Collection
http://www.w3.org/2004/02/skos/core#changeNote
http://www.w3.org/2004/02/skos/core#closeMatch
.TP
Note: Here the $GREP_OPTIONS environment applies to the list. In my case, I have a --ignore-case in it, so e.g. skos:changeNote is listed as well.
.TP
This feature only works with schema documents which are available by fetching the namespace URI (optionally with linked data headers to be redirected to an RDF document). Nevertheless, you can use this command also on non schema resources as FOAF profiles and WebIDs:
.B $ rdf list http://haschek.eye48.com/
http://haschek.eye48.com/haschek.rdf
http://haschek.eye48.com/
http://haschek.eye48.com/gelabb/
.SS resources inspection (get, count, head and headn)
.TP
Fetch a resource via linked data and print it to stdout:
.B $ rdf get http://sebastian.tramp.name >me.rdf
.TP
Count all statements of a resource (using rapper):
.B $ rdf count http://sebastian.tramp.name
rapper: Parsing URI http://sebastian.tramp.name with parser guess
rapper: Parsing returned 58 triples
.TP
Inspect the header of a resource. Use `head` for header request with content negotiation suitable for linked data and `headn` for a normal header request as sent by browsers.
.B $ rdf head http://sebastian.tramp.name
HTTP/1.1 302 Found
[...]
Location: http://sebastian.tramp.name/index.rdf
[...]
.B $ rdf ping http://sebastian.tramp.name http://aksw.org/SebastianTramp
server response: Pingback has been registered or updated... Keep spinning the Data Web ;-)
.SH INSTALLATION
.TP
rdf.sh is a single bash shell script so installation is trivial ... :-) Just copy or link it to you path, e.g. with
.B $ sudo ln -s /path/to/rdf.sh /usr/local/bin/rdf
.TP
Required tools currently are:
* roqet -- http://librdf.org/rasqal/roqet.html (from rasqal-utils)
* rapper -- http://librdf.org/raptor/rapper.html (from raptor-utils or raptor2-utils)
* curl -- http://curl.haxx.se/
.TP
Suggested tools are:
* zsh -- http://zsh.sourceforge.net/ (without the autocompletion, it is not the same)
.SH FILES
.B changelog.md
version changelog
.B _rdf
zsh autocompletion file
.B rdf.sh
the script
.B rdf.1
this file
.B $HOME/.cache/rdf.sh/prefix.cache
cached namespace lookup table from prefix.cc
.B $HOME/.config/rdf.sh/prefix.local
user-generated local priority lookup table
.SH AUTHOR
.SS Sebastian Tramp <[email protected]>
.TP
http://sebastian.tramp.name (WebID)
.SH SEE ALSO
.SS https://github.com/seebi/rdf.sh
.TP
The main homepage at github