-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #48 from anusii/zy/47_parse_multi_line_literals
zy/47 fix multiline issue
- Loading branch information
Showing
4 changed files
with
63 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import 'dart:io'; | ||
|
||
import 'package:rdflib/rdflib.dart'; | ||
|
||
main() async { | ||
String filePath = 'example/sample_ttl_6.ttl'; | ||
// Read file content to a local String. | ||
String fileContents = await File(filePath).readAsStringSync(); | ||
|
||
print('-------Original file-------\n$fileContents'); | ||
|
||
// Create a graph to read turtle file and store info. | ||
Graph g = Graph(); | ||
|
||
// Parse with the new method [Graph.parseTurtle] instead of [Graph.parse] (deprecated). | ||
g.parseTurtle(fileContents); | ||
|
||
// Serialize the Graph for output. | ||
g.serialize(format: 'ttl', abbr: 'short'); | ||
print('-------Serialized String--------\n${g.serializedString}'); | ||
|
||
// Print out full format of triples (will use shorthand in serialization/export). | ||
print('--------All triples in the graph-------'); | ||
for (Triple t in g.triples) { | ||
print(t); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . | ||
@prefix show: <http://example.org/vocab/show/> . | ||
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . | ||
|
||
show:218 rdfs:label "That Seventies Show"^^xsd:string . | ||
show:218 rdfs:label "That Seventies Show"^^<http://www.w3.org/2001/XMLSchema#string> . | ||
show:218 rdfs:label "That Seventies Show" . | ||
show:218 show:localName "That Seventies Show"@en . | ||
show:218 show:localName 'Cette Série des Années Soixante-dix'@fr . | ||
show:218 show:localName "Cette Série des Années Septante"@fr-be . | ||
show:218 show:blurb '''This is a multi-line | ||
literal with many quotes (""""") | ||
and up to two sequential apostrophes ('').'''^^xsd:string . | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters