Search code examples
syntaxsparqlrdfapache-jena

Check RDF file syntax using jena


I have a .ttl file that I have written. I am on mac environment. I was wondering how can I use apache jena to check if the file is valid. What terminal commands are needed to do this? I have downloaded the apache jena packet.


Solution

  • You can use riot with $PATH_TO_JENA/bin/riot --validate $PATH_TO_FILE

    riot [--time] [--check|--noCheck] [--sink] [--base=IRI] [--out=FORMAT] [--compress] file ...
      Parser control
          --sink                 Parse but throw away output
          --syntax=NAME          Set syntax (otherwise syntax guessed from file extension)
          --base=URI             Set the base URI (does not apply to N-triples and N-Quads)
          --check                Addition checking of RDF terms
          --strict               Run with in strict mode
          --validate             Same as --sink --check --strict
          --rdfs=file            Apply some RDFS inference using the vocabulary in the file
          --nocheck              Turn off checking of RDF terms
          --stop                 Stop parsing on encountering a bad RDF term
      Output control
          --output=FMT           Output in the given format, streaming if possible.
          --formatted=FMT        Output, using pretty printing (consumes memory)
          --stream=FMT           Output, using a streaming format
          --compress             Compress the output with gzip
      Time
          --time                 Time the operation
      Symbol definition
          --set                  Set a configuration symbol to a value
      General
          -v   --verbose         Verbose
          -q   --quiet           Run with minimal output
          --debug                Output information for debugging
          --help
          --version              Version information