Next: Introduction, Previous: (dir), Up: (dir) [Contents][Index]
This is the cl-ntriples Reference Manual, version 2012.12.16, generated automatically by Declt version 4.0 beta 2 "William Riker" on Mon Aug 15 03:51:53 2022 GMT+0.
Next: Systems, Previous: The cl-ntriples Reference Manual, Up: The cl-ntriples Reference Manual [Contents][Index]
CL-NTRIPLES provides a simple parser for the N-Triples data format as defined by the W3C for storing RDF/Semantic information. N-Triples is a line-based, plain text format for encoding an RDF graph.
Main entry function is PARSE-NT
method that parses N-Triples from the given source. This method accepts a file pathname, an input stream, or a string.
Returns a list of triples consisting of three elements: subject, predicate, object. Subjects can be either an uriref
or a nodeID
. Objects can be of three types: uriref
, nodeID
or a literal
. Depending on the type of the object it is encoded into an association list.
N-Triples data format standard definition is provided in the W3C documents:
Check also the Semantic Web page on CLiki.
CL-NTRIPLES is available through Quicklisp:
(ql:quickload :cl-ntriples)
CL-NTRIPLES was developed for a practical purpose of accessing the wealth of data accumulated by the DBPedia project. For example, let's query information about a Ukrainian city of Chernihiv (wiki, dbpedia):
(defvar page-url "http://dbpedia.org/data/Chernihiv.ntriples")
(defvar *res* (nt:parse-nt (drakma:http-request page-url)))
;; *res* now contains a list of triples, let's query some predicates
;; for brevity, predicates will defined as variables
(defconstant +prop-area-total-km+ "http://dbpedia.org/property/areaTotalKm")
(defconstant +rdf-label+ "http://www.w3.org/2000/01/rdf-schema#label")
;; querying predicates is now reduced to a simple function call:
;; nt:predicate? TRIPLES PREDICATE &key LANG DATA-TYPE
;; what is the city area in km2?
(nt:predicate? *res* +prop-area-total-km+)
=> (("http://dbpedia.org/resource/Chernihiv"
"http://dbpedia.org/property/areaTotalKm"
((:LITERAL-STRING . "79")
(:URIREF . "http://www.w3.org/2001/XMLSchema#int"))))
;; how do Japanese call this city?
(predicate? *res* +rdf-label+ :lang "ja")
=> (("http://dbpedia.org/resource/Chernihiv"
"http://www.w3.org/2000/01/rdf-schema#label"
(:LITERAL-STRING "チェルニーヒウ" :LANG "ja")))
Package provides following functions:
PARSE-NT src
Parses and returns a list of triples
PREDICATE? triples predicate &key lang data-type
filters out triples with matching predicates. Additional parameters (lang and data-type) can be used to limit returned triples to those with matching language and data type specifiers.
LITERAL-STRING triple
returns the literal-string value of the g
Next: Modules, Previous: Introduction, Up: The cl-ntriples Reference Manual [Contents][Index]
The main system appears first, followed by any subsystem dependency.
CL-NTRIPLES is a simple basic parser for Ntriples data.
Victor Anyakin <anyakinvictor@yahoo.com>
BSD
A basic parser and a set of simple utilities to parse N-Triples data.
N-Triples provides a simple format for representation of Semantic Web/W3C RDF semantic data. CL-NTRIPLES provides a simple and easy to use parser for Common Lisp applications.
2012.12.16
alexandria (system).
src (module).
Next: Files, Previous: Systems, Up: The cl-ntriples Reference Manual [Contents][Index]
Modules are listed depth-first from the system components tree.
cl-ntriples (system).
Next: Packages, Previous: Modules, Up: The cl-ntriples Reference Manual [Contents][Index]
Files are sorted by type and then listed depth-first from the systems components trees.
Next: cl-ntriples/src/package.lisp, Previous: Lisp, Up: Lisp [Contents][Index]
cl-ntriples (system).
Next: cl-ntriples/src/nt-parser.lisp, Previous: cl-ntriples/cl-ntriples.asd, Up: Lisp [Contents][Index]
src (module).
Previous: cl-ntriples/src/package.lisp, Up: Lisp [Contents][Index]
package.lisp (file).
src (module).
Next: Definitions, Previous: Files, Up: The cl-ntriples Reference Manual [Contents][Index]
Packages are listed by definition order.
Next: cl-ntriples-asd, Previous: Packages, Up: Packages [Contents][Index]
nt
Previous: cl-ntriples, Up: Packages [Contents][Index]
Next: Indexes, Previous: Packages, Up: The cl-ntriples Reference Manual [Contents][Index]
Definitions are sorted by export status, category, package, and then by lexicographic order.
Next: Internals, Previous: Definitions, Up: Definitions [Contents][Index]
Next: Generic functions, Previous: Public Interface, Up: Public Interface [Contents][Index]
Returns the literal-string value of the triple’s object.
Given the list of triples produced by PARSE-NT returns a list of triples with predicates matching the given one.
Previous: Ordinary functions, Up: Public Interface [Contents][Index]
Parses N-Triples from the given source. This method
accepts a file pathname, a stream, or a string.
Returns a list of triples consisting of three elements: subject, predicate, object. Subjects can be either an ‘uriref’ or a ‘nodeID’. Objects can be of three types: ‘uriref’, ‘nodeID’ or a ‘literal’. Depending on the type of the object it is encoded into a list.
Previous: Public Interface, Up: Definitions [Contents][Index]
Next: Ordinary functions, Previous: Internals, Up: Internals [Contents][Index]
Parse the object literal from the stream.
The triple consists of a: subject, predicate, object. All they are
separated by whitespace. There is also a terminating full stop point
in the end of a tripple.
Returns a list consisting of three elements corresponding to the
tripple.
The syntax is:
triple ::= subject ws+ predicate ws+ object ws* ’.’ ws*
Previous: Definitions, Up: The cl-ntriples Reference Manual [Contents][Index]
Jump to: | C F G L M N P |
---|
Jump to: | C F G L M N P |
---|
Next: Data types, Previous: Functions, Up: Indexes [Contents][Index]
Jump to: | +
C |
---|
Jump to: | +
C |
---|
Jump to: | C F M N P S |
---|
Jump to: | C F M N P S |
---|