https://github.com/dcdpr/jsonld-cpp
JSON-LD Implementation for C++
https://github.com/dcdpr/jsonld-cpp
Last synced: 5 months ago
JSON representation
JSON-LD Implementation for C++
- Host: GitHub
- URL: https://github.com/dcdpr/jsonld-cpp
- Owner: dcdpr
- License: bsd-3-clause
- Created: 2019-11-08T20:05:36.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-05-20T23:11:54.000Z (about 2 years ago)
- Last Synced: 2024-05-21T01:12:38.634Z (about 2 years ago)
- Language: C++
- Size: 3.97 MB
- Stars: 4
- Watchers: 3
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# jsonld-cpp
JSON-LD Implementation for C++
This is a C++ implementation of JSON-LD 1.1 Processing Algorithms and API (http://json-ld.org)
Development is still in progress--this library currently only supports the
[```expand()```](https://www.w3.org/TR/json-ld11-api/#expansion-algorithm) and
[```toRdf()```](https://www.w3.org/TR/json-ld11-api/#deserialize-json-ld-to-rdf-algorithm)
processing algorithms.
## Implementation Notes
Some parts of the JSON-LD API spec make note of using Promises to return
API results. This C++ library does not support any Promise-like capability.
The RemoteDocument implementation currently only supports local files, not
documents from arbitrary URLs.
## Building jsonld-cpp
To build jsonld-cpp, you will need:
* cmake
* g++, clang or Visual Studio (community edition)
jsonld-cpp uses [http-link-header-cpp](https://github.com/dcdpr/http-link-header-cpp.git)
and includes it as a submodule. When cloning, use ```git clone --recursive```
to include the submodule.
jsonld-cpp uses a pretty standard cmake build system:
```
mkdir build
cd build
cmake ..
make
```
You can also run all the tests:
```
make test
```
### Installing prerequisites
If the above doesn't work, you probably need to install some
prerequisites. For example, on a fresh Debian 12 ("bookworm") system:
```
$ sudo apt update
$ sudo apt install make cmake g++ libssl-dev
```
Now you can again try to build jsonld-cpp.
## Examples
The ```examples``` directory contains a simple application called
```jsonld2rdf``` that shows how to interface with the library. It can
convert a JSON-LD document into RDF data in NQuads format. As part of
the conversion to RDF, the JSON-LD document is first ```expanded```.
```
$ cd jsonld-cpp/build
$ ./jsonld-cpp-examples-prefix/src/jsonld-cpp-examples-build/jsonld2rdf examples/ex01a.jsonld
.
"Dave Longley" .
.
"Gregg Kellogg" .
"Markus Lanthaler" .
```