Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RDFLib: read remote turtle files (e.g. from web link) #16

Closed
tian3rd opened this issue Dec 21, 2022 · 4 comments · Fixed by #45
Closed

RDFLib: read remote turtle files (e.g. from web link) #16

tian3rd opened this issue Dec 21, 2022 · 4 comments · Fixed by #45
Assignees

Comments

@tian3rd
Copy link
Contributor

tian3rd commented Dec 21, 2022

E.g.,

// ...
Graph g = Graph();
g.parse('http://www.w3.org/People/Berners-Lee/card');
// ...
@tian3rd tian3rd self-assigned this Dec 21, 2022
@tian3rd
Copy link
Contributor Author

tian3rd commented Jan 30, 2023

For test purpose, we can try to parse this link: http://www.w3.org/2002/07/owl#

@zheyxu zheyxu self-assigned this Jul 15, 2024
@zheyxu zheyxu linked a pull request Jul 15, 2024 that will close this issue
@zheyxu
Copy link
Collaborator

zheyxu commented Jul 15, 2024

Made pr #45
The webLink should point to a valid Turtle (.ttl) file to ensure correct parsing.
If the webLink does not point to a .ttl file, it might cause unexpected parsing errors.

@zheyxu
Copy link
Collaborator

zheyxu commented Jul 15, 2024

Check with

  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);```

@zheyxu
Copy link
Collaborator

zheyxu commented Jul 18, 2024

The web link must be end with '.ttl'.
await g.parseTurtleFromWeb('https://www.w3.org/2002/07/owl#') does not work in this case.
But if copy and paste content of 'https://www.w3.org/2002/07/owl#' to a local file, and named it example_ttl_6.dart.
The following code works.

String filePath = 'example/sample_ttl_6.ttl';

  // Read file content to a local String

  String fileContents = await File(filePath).readAsStringSync();

  g.parseTurtle(fileContents);

The difference between String webStr = http.get('https://www.w3.org/2002/07/owl#') and String fileContents = await File(filePath).readAsStringSync(); is the format of empty space.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants