-
Notifications
You must be signed in to change notification settings - Fork 3
/
test_serializer_turtlestar.py
140 lines (107 loc) · 3.65 KB
/
test_serializer_turtlestar.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
import pytest
from pathlib import Path
from shutil import copyfile
from tempfile import TemporaryDirectory
from rdflib.exceptions import ParserError
from rdflib import Graph
from rdflib.util import guess_format
from rdflib.plugin import register
from rdflib.parser import Parser
from rdflib.serializer import Serializer
import rdflib
from rdflib import URIRef
from rdflib.namespace import RDF
from rdflib.namespace import FOAF
register(
"ttls",
Parser,
"rdflib.plugins.parsers.turtlestar",
"TurtleParser",
)
register(
"trigs",
Parser,
"rdflib.plugins.parsers.trigstar",
"TrigParser",
)
register(
"ttlstar",
Serializer,
"rdflib.plugins.serializers.turtlestar",
"TurtlestarSerializer"
)
register(
"ntstar",
Parser,
"rdflib.plugins.parsers.ntriples-star",
"NtriplesStarParser",
)
# g = Graph()
# g.parse(data="test/turtle-star/test_rdfliteral.ttl", format = "ttl")
# print(g.serialize(format = "ttl"))
# g = Graph()
# g.parse(data="test/turtle-star/test1234.ttl", format = "ttls")
# print(g.serialize(format = "ttlstar"))
g = Graph()
g.parse(data="test/turtle-star/turtle-star-syntax-basic-01.ttl", format = "ttls")
print(g.serialize(format = "ttlstar"))
g = Graph()
g.parse("test/turtle-star/turtle-star-syntax-basic-02.ttl", format = "ttls")
print(g.serialize(format = "ttlstar"))
g = Graph()
g.parse("test/turtle-star/turtle-star-syntax-inside-01.ttl", format = "ttls")
print(g.serialize(format = "ttlstar"))
g = Graph()
g.parse("test/turtle-star/turtle-star-syntax-inside-02.ttl", format = "ttls")
print(g.serialize(format = "ttlstar"))
g = Graph()
g.parse("test/turtle-star/turtle-star-syntax-nested-01.ttl", format = "ttls")
print(g.serialize(format = "ttlstar"))
g = Graph()
g.parse("test/turtle-star/turtle-star-syntax-nested-02.ttl", format = "ttls")
print(g.serialize(format = "ttlstar"))
g = Graph()
g.parse("test/turtle-star/turtle-star-syntax-compound.ttl", format = "ttls")
print(g.serialize(format = "ttlstar"))
g = Graph()
g.parse("test/turtle-star/turtle-star-syntax-bnode-01.ttl", format = "ttls")
print(g.serialize(format = "ttlstar"))
g = Graph()
g.parse("test/turtle-star/turtle-star-syntax-bnode-02.ttl", format = "ttls")
print(g.serialize(format = "ttlstar"))
g = Graph()
g.parse("test/turtle-star/turtle-star-syntax-bnode-03.ttl", format = "ttls")
print(g.serialize(format = "ttlstar"))
g = Graph()
g.parse("test/turtle-star/turtle-star-annotation-1.ttl", format = "ttls")
print(g.serialize(format = "ttlstar"))
g = Graph()
g.parse("test/turtle-star/turtle-star-annotation-2.ttl", format = "ttls")
print(g.serialize(format = "ttlstar"))
g = Graph()
g.parse("test/turtle-star/nt-ttl-star-syntax-1.ttl", format = "ttls")
print(g.serialize(format = "ttlstar"))
g = Graph()
g.parse("test/turtle-star/nt-ttl-star-syntax-2.ttl", format = "ttls")
print(g.serialize(format = "ttlstar"))
g = Graph()
g.parse("test/turtle-star/nt-ttl-star-syntax-3.ttl", format = "ttls")
print(g.serialize(format = "ttlstar"))
g = Graph()
g.parse("test/turtle-star/nt-ttl-star-syntax-4.ttl", format = "ttls")
print(g.serialize(format = "ttlstar"))
g = Graph()
g.parse("test/turtle-star/nt-ttl-star-syntax-5.ttl", format = "ttls")
print(g.serialize(format = "ttlstar"))
g = Graph()
g.parse("test/turtle-star/nt-ttl-star-bnode-1.ttl", format = "ttls")
print(g.serialize(format = "ttlstar"))
g = Graph()
g.parse("test/turtle-star/nt-ttl-star-bnode-2.ttl", format = "ttls")
print(g.serialize(format = "ttlstar"))
g = Graph()
g.parse("test/turtle-star/nt-ttl-star-nested-1.ttl", format = "ttls")
print(g.serialize(format = "ttlstar"))
g = Graph()
g.parse("test/turtle-star/nt-ttl-star-nested-2.ttl", format = "ttls")
print(g.serialize(format = "ttlstar"))