Skip to content

Commit df004c2

Browse files
liss-hbigerl
andauthored
Prepare readme for 0.1 (#359)
Co-authored-by: Alexander Bigerl <alexander@bigerl.eu>
1 parent 29ffc9d commit df004c2

1 file changed

Lines changed: 113 additions & 35 deletions

File tree

README.md

Lines changed: 113 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,151 @@
1-
⚠️ This repo is work-in-progress! Before v0.1.0 all APIs are considered unstable and might be subject to change. ⚠️
1+
[![Read the Docs](https://img.shields.io/readthedocs/rdf4cpp)](https://rdf4cpp.readthedocs.io/en/latest/)
2+
[![Conan](https://img.shields.io/badge/conan-package-blue)](https://conan.dice-research.org/ui/packages/conan:%2F%2Frdf4cpp)
3+
[![GitHub Release](https://img.shields.io/github/v/release/rdf4cpp/rdf4cpp)](https://github.com/rdf4cpp/rdf4cpp/releases)
4+
![GitHub License](https://img.shields.io/github/license/rdf4cpp/rdf4cpp)
5+
26

37
# rdf4cpp
48

5-
rdf4cpp aims to be a stable, modern RDF library for C++, implementing the following standards:
6-
- [W3C XML Schema Definition Language (XSD) 1.1 Part 2: Datatypes](https://www.w3.org/TR/xmlschema11-2/)
7-
- [XPath and XQuery Functions and Operators 3.1 ](https://www.w3.org/TR/xpath-functions-31/)
8-
- [OWL Real and Rational](https://www.w3.org/TR/owl2-syntax/#Datatype_Maps)
9+
_rdf4cpp_ is a modern C++23 library providing basic RDF support.
10+
11+
The focus is **correctness**, **performance** and **ease-of-use** for **basic building blocks** like:
12+
13+
- parsing, validating and writing RDF data ([N-Triples](https://www.w3.org/TR/n-triples/), [Turtle](https://www.w3.org/TR/turtle/), [N-Quads](https://www.w3.org/TR/n-quads/), [TriG](https://www.w3.org/TR/trig/))
14+
- Complete and extensible literal datatypes (validation, functions, operations, subtype and promotion casting, mapping to C++ types, error handling, ...)
15+
- Managing RDF nodes efficiently
16+
- Blank node scoping (e.g., for RDF datasets)
17+
18+
_rdf4cpp_ is **not** a **SPARQL engine** or **reasoning engine**, although it provides very basic support for triple/quad
19+
pattern matching on RDF graphs/datasets. _rdf4cpp_ rather provides the necessary primitives to implement such engines.
20+
21+
We implement the following W3C standards:
922

10-
Current documentation: https://rdf4cpp.readthedocs.io/en/latest/
23+
- [RDF 1.1 Concepts and Abstract Syntax](https://www.w3.org/TR/rdf11-concepts/)
24+
- [XML XSD 1.1 Part 2: Datatypes](https://www.w3.org/TR/xmlschema11-2/) (RDF related parts)
25+
- [OWL Real and Rational](https://www.w3.org/TR/owl2-syntax/#Datatype_Maps)
26+
- [XPath and XQuery Functions and Operators 3.1](https://www.w3.org/TR/xpath-functions-31/) (SPARQL related parts)
27+
28+
## Example
29+
30+
```c++
31+
#include <iostream>
32+
#include <rdf4cpp.hpp>
33+
34+
int main() {
35+
using namespace ::rdf4cpp;
36+
using namespace ::rdf4cpp::shorthands;
37+
using namespace ::rdf4cpp::namespaces;
38+
using namespace ::rdf4cpp::datatypes;
39+
40+
/// 1) basic dataset, graph and RDF node usage
41+
// using namespaces
42+
FOAF foaf{}; // common, predefined namespace
43+
Namespace const ex{"http://example.com/"}; // self-declared namespace
44+
45+
Dataset dataset;
46+
// populate a named graph in the dataset
47+
auto &graph = dataset.graph(IRI{"http://ex.com/MyGraph"}); // IRI constructor
48+
graph.add({"http://example.com/Bob"_iri, "http://example.com/knows"_iri, "http://example.com/Alice"_iri}); // IRI shorthand
49+
graph.add({ex + "Alice", foaf + "knows", ex + "Bob"}); // using namespaces
50+
graph.add({ex + "Bob", foaf + "name", "Bob"_xsd_string}); // Literal datatype shorthand
51+
52+
// serialize the dataset as N-Quads
53+
std::cout << "Dataset as N-Quads: \n"
54+
<< dataset << std::endl;
55+
56+
// 2) Using datatypes and arithmetics
57+
// typed Literal instantiation
58+
auto const d = Literal::make_typed_from_value<xsd::Double>(2.3); // factory function
59+
auto const ui = 42_xsd_uint; // Literal datatype shorthand
60+
auto const dec = "42.1"_xsd_decimal; // infinite precision decimals
61+
62+
// basic arithmetics with automatic result type deduction
63+
auto const r1 = d * dec; // double * decimal → double
64+
auto const r2 = (ui + dec).round(); // round(integer + decimal) → decimal
65+
66+
std::cout << "Using XSD datatypes, functions and operators: \n"
67+
<< std::format("{} * {} = {}\n", d, dec, r1)
68+
<< std::format("ceil({} + {}) = {}", ui, dec, r2) << std::endl;
69+
70+
return 0;
71+
}
72+
```
1173

12-
## Usage
13-
check out the [examples](./examples) directory.
74+
## Using _rdf4cpp_
1475

15-
### As Conan Package
76+
_rdf4cpp_ is consumed via Conan 2 but it is not available via [Conan Center](https://conan.io/center).
77+
Instead, it can be found on the artifactory of the [DICE Research Group](https://dice-research.org/).
1678

17-
Until its first stable release, rdf4cpp will not be available via Conan Center. Instead, it is available via the artifactory of the [DICE Research Group](https://dice-research.org/).
79+
You need the package manager [conan](https://conan.io/downloads.html) installed and set up. You can add the DICE
80+
artifactory with:
1881

19-
You need the [package manager Conan](https://conan.io/downloads.html) installed and set up. You can add the DICE artifactory with:
2082
```shell
2183
conan remote add dice-group https://conan.dice-research.org/artifactory/api/conan/tentris
2284
```
2385

24-
To use rdf4cpp, add it to your `conanfile.txt`:
86+
To use _rdf4cpp_, add it to your `conanfile.txt`:
87+
2588
```
2689
[requires]
27-
rdf4cpp/0.0.58
90+
rdf4cpp/0.1.0
2891
```
2992

30-
Note:
93+
For getting started how to use rdf4cpp, check out the [examples](./examples) directory and refer to our documentation.
3194

32-
If you want to include rdf4cpp without using conan, make sure you also include its dependencies exposed via the rdf4cpp API.
3395

34-
## Build
3596

36-
### Requirements
97+
## Developing _rdf4cpp_
3798

38-
Currently, rdf4cpp builds only on linux with a C++20 compatible compiler.
39-
CI builds and tests rdf4cpp with gcc-{13}, clang-{17,18,19} with libstdc++-13 on ubuntu 22.04.
40-
41-
### Dependencies
42-
It is recommended to include build dependencies via conan. Set up Conan as follows on Ubuntu 22.04+:
43-
```shell
44-
sudo apt install python3-pip
45-
pip3 install --user conan
46-
conan user
47-
conan profile new --detect default
48-
conan profile update settings.compiler.libcxx=libstdc++11 default
49-
conan remote add dice-group https://conan.dice-research.org/artifactory/api/conan/tentris
50-
```
99+
### Compile
51100

101+
_rdf4cpp_ uses CMake and Conan 2. To build it, run:
52102

53-
### Compile
54-
rdf4cpp uses CMake and conan 2. To build it, run:
55103
```shell
56104
wget https://github.com/conan-io/cmake-conan/raw/develop2/conan_provider.cmake -O conan_provider.cmake # download conan provider
57105
cmake -B build_dir -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=conan_provider.cmake # configure and generate
58106
cmake --build build_dir # compile
59107
```
60108

61109
To install it to your system, run afterward:
110+
62111
```shell
63112
cd build_dir
64113
sudo make install
65114
```
66115

67116
### Additional CMake config options:
68117

69-
`-DBUILD_EXAMPLES=ON/OFF [default: OFF]`: Build the examples.
118+
- `-DBUILD_EXAMPLES=ON/OFF [default: OFF]`: Build the examples.
119+
- `-DBUILD_TESTING=ON/OFF [default: OFF]`: Build the tests.
120+
- `-DBUILD_SHARED_LIBS=ON/OFF [default: OFF]`: Build a shared library instead of a static one.
121+
122+
123+
## Supported Platforms
124+
125+
- **Linux distributions (x86_64, AArch64)** (e.g. Ubuntu 22.04+, Fedora 42+, etc.) with:
126+
- GCC 13+ (libstdc++ 13+; used with both GCC and Clang)
127+
- Clang 17+ (except Clang 18 does not work on AArch64)
128+
- glibc 2.35+ or musl 1.2.4+
129+
- **macOS (ARM64)**: macOS Sonoma (14)+ with GCC 13 (via Homebrew)
130+
131+
## Stability
132+
133+
### API Stability
134+
135+
From version 0.1 onwards (before 1.0.0), all high-level public API that the average user is expected to interact with is
136+
considered stable.
137+
This includes basically everything, except what is in the `rdf4cpp::storage` and `rdf4cpp::datatypes::registry`
138+
namespaces.
139+
Should we ever break anything in these high-level interfaces, we will bump the minor version (for example, from 0.1.0 to
140+
0.2.0).
141+
142+
### ABI Stability
143+
144+
ABI stability is not guaranteed.
70145

71-
`-DBUILD_TESTING=ON/OFF [default: OFF]`: Build the tests.
146+
### POBR Stability
72147

73-
`-DBUILD_SHARED_LIBS=ON/OFF [default: OFF]`: Build a shared library instead of a static one.
148+
The POBR (Persisted Object Binary Representation) version tracks on-disk format stability (e.g., with allocators
149+
like [Metall](https://github.com/LLNL/metall)).
150+
This includes everything in `rdf4cpp::storage::identifiers` but nothing else.
151+
The current POBR version can be retrieved via `rdf4cpp::pobr_version`.

0 commit comments

Comments
 (0)