Swiftpack.co -  kasei/serd-parser as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
An example of using the Serd RDF parsing library in Swift
.package(url: "https://github.com/kasei/serd-parser.git", from: "0.0.3")


This is an example project to show the use of the Serd RDF library to parse N-Triples data in Swift.

From the command line:

% swift build
% ./.build/debug/serd-parse foaf.ttl
<http://kasei.us/about/#greg> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
<http://kasei.us/about/#greg> <http://xmlns.com/foaf/0.1/name> "Gregory Todd Williams" .
<http://kasei.us/about/#greg> <http://xmlns.com/foaf/0.1/nick> "kasei" .
<http://kasei.us/about/#greg> <http://xmlns.com/foaf/0.1/mbox> <mailto://greg@evilfunhouse.com> .
<http://kasei.us/about/#greg> <http://xmlns.com/foaf/0.1/mbox_sha1sum> "f80a0f19d2a0897b89f48647b2fb5ca1f0bc1cb8" .
<http://kasei.us/about/#greg> <http://xmlns.com/foaf/0.1/homepage> <http://kasei.us/> .
<http://kasei.us/about/#greg> <http://xmlns.com/foaf/0.1/img> <http://kasei.us/images/greg.png> .

Or, programatically:

import SerdParser

// extract all foaf:name triples
let parser = SerdParser()
let count = try parser.parse(file: filename) { (s, p, o) in
    if case .iri("http://xmlns.com/foaf/0.1/name") = p {
        print("\(s) has name \(o) .")
print("\(count) triples processed")


Stars: 0
Last commit: 1 week ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Submit a free job ad (while I'm testing this). The analytics numbers for this website are here.


Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics