Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add support for reading RDFa

  • Loading branch information...
commit 28996168c390128bba03bf2479c6838589ca55e8 1 parent 5b5af5c
@gklyne authored
Showing with 19 additions and 5 deletions.
  1. +9 −0 TODO
  2. +8 −5 src/asqc/asqc.py
  3. +2 −0  src/asqc/examples/rdfatest.sh
View
9 TODO
@@ -38,6 +38,15 @@ https://github.com/oucs/humfrey/blob/master/humfrey/streaming/srx.py
...
+== Packaging ==
+
+Local:
+python setup.py build
+python setup.py install
+
+Upload to PyPI:
+python setup.py sdist upload
+
== Options ==
View
13 src/asqc/asqc.py
@@ -50,7 +50,7 @@
# Type codes and mapping for RDF and query variable p[arsing and serializing
-RDFTYP = ["RDFXML","N3","TURTLE","NT","JSONLD"]
+RDFTYP = ["RDFXML","N3","TURTLE","NT","JSONLD","RDFA"]
VARTYP = ["JSON","CSV","XML"]
RDFTYPPARSERMAP = (
@@ -59,6 +59,7 @@
, "TURTLE": "n3"
, "NT": "nt"
, "JSONLD": "jsonld"
+ , "RDFA": "rdfa"
})
RDFTYPSERIALIZERMAP = (
@@ -479,8 +480,9 @@ def parseCommandArgs(argv):
parser.add_option("-f", "--format",
dest="format",
default=None,
- help="Format for input and/or output: RDFXML/N3/NT/TURTLE/JSONLD/JSON/CSV/template. "+
- "XML, N3, NT, TURTLE, JSONLD apply to RDF data, others apply to query variable bindings. "+
+ help="Format for input and/or output: RDFXML/N3/NT/TURTLE/JSONLD/RDFA/JSON/CSV/template. "+
+ "XML, N3, NT, TURTLE, JSONLD, RDFA apply to RDF data, "+
+ "others apply to query variable bindings. "+
"Multiple comma-separated values may be specified; "+
"they are applied to RDF or variable bindings as appropriate. "+
"'template' is a python formatting template with '%(var)s' for query variable 'var'. "+
@@ -525,7 +527,7 @@ def parseCommandArgs(argv):
parser.add_option("--format-rdf-in",
dest="format_rdf_in",
default=None,
- help="Format for RDF input data: RDFXML/N3/NT/TURTLE/JSONLD.")
+ help="Format for RDF input data: RDFXML/N3/NT/TURTLE/JSONLD/RDFA.")
parser.add_option("--format-rdf-out",
dest="format_rdf_out",
default=None,
@@ -558,7 +560,8 @@ def pick_next_format_option(s,kws):
if fn in RDFTYP:
if not options.format_rdf_in:
options.format_rdf_in = fn
- options.format_rdf_out = fn
+ if fn in RDFTYPSERIALIZERMAP:
+ options.format_rdf_out = fn
else:
if not options.format_var_in and fn in VARTYP:
options.format_var_in = fn
View
2  src/asqc/examples/rdfatest.sh
@@ -0,0 +1,2 @@
+RDFAFILE=http://examples.tobyinkster.co.uk/hcard
+asq -r "$RDFAFILE" -f rdfa,xml "CONSTRUCT {?s ?p ?o} WHERE { ?s ?p ?o }"
Please sign in to comment.
Something went wrong with that request. Please try again.