Package: rdfx
rdfxA small Python utility to convert, merge, and read/persist RDF data in different formats, across different "persistence
systems".How to UseThe command line utility covers merge and conversion functionality, and simplifies certain aspects of this. ThePythonRun therdfx.pyscript with Python having installed the packages required byrequirements.txt.BASH (Linux, Mac etc)To utilise the command line util run:python rdfx.py *argsTo convert a file:python rdfx.py convert myfile.ttl -f nt -o output_dirFor multiple files:python rdfx.py convert myfile1.ttl myfile2.ttl -f nt -o output_dirA directory of files:python rdfx.py convert files_dir -f nt -o output_dirTo merge multiple files:python rdfx.py merge myfile1.ttl myfile2.ttl -f nt -o output_dirTo merge a directory of files:python rdfx.py merge files_dir -f nt -o output_dirTo remove sort and remove unused prefixes in a turtle file:python rdfx.py clean myfile.ttlTo simplify usage of the command line utility at present, the following behaviour has been set:TypeOutput FilenamesMergemerged.{format}Convertfile1.{format} file2.{format} ...That is, when merging, the output filename will be "merged", with the correct file format.
When converting, the output filename will be the same as the input filename, with the correct file format.
This behaviour simplifies input to the command line util, allowing multiple files and directories to be input without
confusion as to which specified filenames are for input or output, and mappings between input and output, especially
directories or multiple files are converted/merged.The python utilities behind the command line tool can be configured to set user specified filenames, for these cases
use Python.SOP / EDG usageThe SOP persistence system can be used to read and write to/from EDG master graphs and workflows. The SOP persistence
system can be instantiated with the following optional parameters:location, defaults to "http://localhost:8083"username, defaults to "Administrator"password, defaults to ""timeout, defaults to 60 seconds
Example instantiation with defaults:from rdfx.persistence_systems import SOP
local_sop_ps = SOP()The following methods are available on instances of the SOP class:MethodParamtersReturnsreadgraph URNrdf_formatlist of commentsRDFLib GraphwriteRDFLib Graphgraph IRIlist of comments (optional)The IRI of the created graphqueryquerygraph_irireturn_formatThe query resultsasset_collection_sizeasset_iriTriples count for the given assetcreate_datagraphdatagraph_name (optional)description (optional)subjectArea (optional)default_namespace (optional)HTTP  headers (optional)datagraph IRIcreate_workflowgraph_iriworkflow_name (optional)HTTP  headers (optional)workflow IRIcreate_manifestmanifest_name (optional)description (optional)subjectArea (optional)default_namespace (optional)HTTP headers (optional)the IRI for the manifestasset_existsgraph_nametrue/falseCommand line tool documentationThese usage notes come from running the help command in the tool, e.g.python rdfx.ph -h:usage:rdfx.py[-h][--format{ttl,turtle,json,json-ld,jsonld,owl,xml,rdf,nt,n3}][-oOUTPUT][--commentsCOMMENTS]{convert,merge}data[data...]positionalarguments:{convert,merge}dataPathtotheRDFfileordirectoryoffilesformergingorconversion.

optionalarguments:-h,--helpshowthishelpmessageandexit--format{ttl,turtle,json,json-ld,jsonld,owl,xml,rdf,nt,n3},-f{ttl,turtle,json,json-ld,jsonld,owl,xml,rdf,nt,n3}TheRDFlibtokenfortheRDFformatyouwanttoconverttheRDFfileto.-oOUTPUT,--outputOUTPUTifset,theoutputlocationformergedorconvertedfiles,defaultstothecurrentworkingdirectory--commentsCOMMENTSCommentstoprependtotheRDF,turtleonly.LicenseLGPL - see theLICENSE filefor detailsDependenciesThis usesRDFlib.ContactOriginal library:Nicholas J. CarData Systems ArchitectSURROUND Australia Pty Ltdnicholas.car@surroundaustralia.comGitHub:nicholascarORCID:https://orcid.org/0000-0002-8742-7730Updates around persistence systems:David HabgoodApplication ArchitectSURROUND Australia Pty Ltddavid.habgood@surroundaustrlaia.comGitHub:nicholascarhttps://orcid.org/0000-0002-3322-1868