Given a RDF file, I want to write a python script to validate the file and comment if in wrong format. HOw do I do this with RAptor? or Sax or is there any other library? No luck with w3.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You have two options with raptor:
Option 1: Use the
rappercommand line, this is super fast. The function below is an example in python to wrap up the command. The-coption is to just count the number of triples. The parameterlangis just an option to specify the RDF format ntriples, rdfxml, turtle, … The function checks the return code and throws an exception in case anything went wrong.Option 2: Use the redland Python language bindings. Something like the following would work:
This code has been extracted from example.py, check it out and you’ll see more examples.