-
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 #45 from anusii/zy/16_rdflib_read_remote_turtle
Zy/16 rdflib read remote turtle
- Loading branch information
Showing
3 changed files
with
54 additions
and
3 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,21 @@ | ||
import 'package:rdflib/rdflib.dart'; | ||
|
||
main() async { | ||
String webLink = 'https://www.w3.org/TR/turtle/examples/example3.ttl'; | ||
|
||
// Create a graph to read Turtle file and store info. | ||
Graph g = Graph(); | ||
|
||
// Parse the Turtle file from the web. | ||
await g.parseTurtleFromWeb(webLink); | ||
|
||
// 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
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