|
1 | | - |
| 1 | + |
| 2 | + |
| 3 | +# RDFLib |
2 | 4 |
|
3 | | -RDFLib |
4 | | -====== |
5 | 5 | [](https://github.com/RDFLib/rdflib/actions?query=branch%3Amain) |
6 | 6 | [](https://rdflib.readthedocs.io/en/latest/?badge=latest) |
7 | 7 | [](https://coveralls.io/r/RDFLib/rdflib?branch=main) |
@@ -31,7 +31,7 @@ The RDFlib community maintains many RDF-related Python code repositories with di |
31 | 31 | * [sparqlwrapper](https://github.com/RDFLib/sparqlwrapper) - a simple Python wrapper around a SPARQL service to remotely execute your queries |
32 | 32 | * [pyLODE](https://github.com/RDFLib/pyLODE) - An OWL ontology documentation tool using Python and templating, based on LODE. |
33 | 33 | * [pyrdfa3](https://github.com/RDFLib/pyrdfa3) - RDFa 1.1 distiller/parser library: can extract RDFa 1.1/1.0 from (X)HTML, SVG, or XML in general. |
34 | | -* [pymicrodata](https://github.com/RDFLib/pymicrodata) - A module to extract RDF from an HTML5 page annotated with microdata. |
| 34 | +* [pymicrodata](https://github.com/RDFLib/pymicrodata) - A module to extract RDF from an HTML5 page annotated with microdata. |
35 | 35 | * [pySHACL](https://github.com/RDFLib/pySHACL) - A pure Python module which allows for the validation of RDF graphs against SHACL graphs. |
36 | 36 | * [OWL-RL](https://github.com/RDFLib/OWL-RL) - A simple implementation of the OWL2 RL Profile which expands the graph with all possible triples that OWL RL defines. |
37 | 37 |
|
@@ -134,18 +134,21 @@ g.add(( |
134 | 134 | Literal("Nick", datatype=XSD.string) |
135 | 135 | )) |
136 | 136 | ``` |
| 137 | + |
137 | 138 | The triple (in n-triples notation) `<http://example.com/person/nick> <http://xmlns.com/foaf/0.1/givenName> "Nick"^^<http://www.w3.org/2001/XMLSchema#string> .` |
138 | 139 | is created where the property `FOAF.givenName` is the URI `<http://xmlns.com/foaf/0.1/givenName>` and `XSD.string` is the |
139 | 140 | URI `<http://www.w3.org/2001/XMLSchema#string>`. |
140 | 141 |
|
141 | 142 | You can bind namespaces to prefixes to shorten the URIs for RDF/XML, Turtle, N3, TriG, TriX & JSON-LD serializations: |
142 | 143 |
|
143 | | - ```python |
| 144 | +```python |
144 | 145 | g.bind("foaf", FOAF) |
145 | 146 | g.bind("xsd", XSD) |
146 | 147 | ``` |
| 148 | + |
147 | 149 | This will allow the n-triples triple above to be serialised like this: |
148 | | - ```python |
| 150 | + |
| 151 | +```python |
149 | 152 | print(g.serialize(format="turtle")) |
150 | 153 | ``` |
151 | 154 |
|
|
0 commit comments