Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save anatoly-scherbakov/9fafb2863b877991f56ac7766b7c1bf0 to your computer and use it in GitHub Desktop.
Save anatoly-scherbakov/9fafb2863b877991f56ac7766b7c1bf0 to your computer and use it in GitHub Desktop.
RDFLib: import N3 data with @base IRI which does not include a slash
import rdflib
DOCUMENT = """
@base <local:> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
<class_to_class>
a
rdfs:Class ,
<Category> ;
<color> "blue" ;
<priority> 4 .
"""
def test_no_slash_after_colon():
"""Test @base directive with no slash after colon."""
graph = rdflib.ConjunctiveGraph()
graph.parse(
data=DOCUMENT,
format='n3',
)
# Raises ValueError:
# Base <local:> has no slash after colon - with relative 'class_to_class'.
# But perfectly works if to use <local:/> or <local://> as @base.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment