Coder Social home page Coder Social logo

zunction / rdfconvert Goto Github PK

View Code? Open in Web Editor NEW

This project forked from wimpessemier/rdfconvert

0.0 1.0 0.0 116 KB

A little python script that converts files and whole directory trees from one RDF serialization into another.

Python 100.00%

rdfconvert's Introduction

rdfconvert

A little python script that converts files and whole directory trees from one RDF serialization into another.

usage: rdfconvert.py [-h] --from
                     {json-ld,trix,ttl,application/rdf+xml,nquads,xml,text/html,rdf-json,rdfa,n3,nt}
                     [--from-ext FROM_EXT [FROM_EXT ...]] [-R]
                     [-o [OUTPUTDIR]] --to
                     {xml,json-ld,trix,pretty-xml,ttl,nquads,n3,nt,rdf-json}
                     [--to-ext TO_EXT] [-f] [-n] [-s] [-v]
                     INPUT [INPUT ...]

Convert one RDF serialization into another.

This script allows you to convert several files at once. It can 
convert individual files or even whole directory trees at once 
(with or without preserving the directory tree structure).
    

positional arguments:
  INPUT                 A list of input files or input directories. When
                        *files* are specified, they will be parsed and
                        converted regardless of their extension. But when
                        *directories* are specified, the script will try to
                        find files inside these directories that match certain
                        extensions (either all default extensions for the
                        input format as specified by the --from flag, or the
                        custom extension(s) as specified directly by the
                        --from-ext flag). Input directories may be searched
                        recursively via the -R flag.

optional arguments:
  -h, --help            show this help message and exit
  --from {json-ld,trix,ttl,application/rdf+xml,nquads,xml,text/html,rdf-json,rdfa,n3,nt}
                        The serialization format of the input files to
                        convert.
  --from-ext FROM_EXT [FROM_EXT ...]
                        The file extensions to match when browsing input
                        directories (could be .owl, .xml, .n3, .jsonld, .rdf,
                        ...). You only have to provide this flag if you're
                        unhappy with the default extensions for the given
                        input format. You can view these default extensions at
                        the end of this help.
  -R, --recursive       When input directories are given, browse them
                        recursively to find and convert files.
  -o [OUTPUTDIR]        The directory to write the output files (omit this
                        flag to print the output to the stdout).
  --to {xml,json-ld,trix,pretty-xml,ttl,nquads,n3,nt,rdf-json}
                        The serialization format of the output.
  --to-ext TO_EXT       The file extension of the output files that will be
                        created (could be .owl, .xml, .n3, .jsonld, .rdf,
                        ...). You only have to provide this flag if you're
                        unhappy with the default extension for the given
                        output format. You can view these default extensions
                        at the end of this help. When the -o flag is not
                        specified, the output will be written the the stdout
                        instead of files, so the --to-ext flag will have no
                        effect. Don't forget to add a dot (.) in front of the
                        extension name (so provide .foo instead of foo).
  -f, --force           Always overwrite existing output files, instead of
                        prompting.
  -n, --no-tree         When given in combination with -R (recursive input
                        file matching), all output files will be written in
                        the same "flat" directory. Without this -n flag, the
                        same directory structure of the input directory will
                        be created (if necessary) and the output files will be
                        written to the corresponding directories of where they
                        were found in the input directories. Only those output
                        directories will be created for the input directories
                        that contain at least one matching input file. If you
                        specify this flag, all output files will be stored in
                        the same directory and you may run into filename
                        collisions!
  -s, --simulate        Do not write any output files, but just print a
                        message for each file that they *would* be written
                        without the -s flag.
  -v, --verbose         Verbosely print some debugging info.

Default extensions for INPUT format:
 - json-ld             : ['.jsonld', '.json-ld']
 - trix                : ['.xml', '.trix']
 - ttl                 : ['.ttl']
 - application/rdf+xml : ['.xml', '.rdf', '.owl']
 - nquads              : ['.nq']
 - xml                 : ['.xml', '.rdf', '.owl']
 - text/html           : ['.html']
 - rdf-json            : ['.json']
 - rdfa                : ['.xhtml', '.html']
 - n3                  : ['.n3']
 - nt                  : ['.nt']

Default extension for OUTPUT format:
 - xml        : '.xml'
 - json-ld    : '.jsonld'
 - trix       : '.xml'
 - pretty-xml : '.xml'
 - ttl        : '.ttl'
 - nquads     : '.nq'
 - n3         : '.n3'
 - nt         : '.nt'
 - rdf-json   : '.json'

rdfconvert's People

Contributors

wimpessemier avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.