Repository: marmotta Updated Branches: refs/heads/develop b10e21d73 -> c45e4944f
builds now with GCC; fix warnings Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/c45e4944 Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/c45e4944 Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/c45e4944 Branch: refs/heads/develop Commit: c45e4944f0420d0542142cbbb23a1cbfba271a71 Parents: b10e21d Author: Sebastian Schaffert <[email protected]> Authored: Tue Dec 15 20:43:12 2015 +0100 Committer: Sebastian Schaffert <[email protected]> Committed: Tue Dec 15 20:43:12 2015 +0100 ---------------------------------------------------------------------- libraries/ostrich/backend/client/client.cc | 4 ++- libraries/ostrich/backend/parser/rdf_parser.cc | 27 ++++++++++++++++++++ libraries/ostrich/backend/parser/rdf_parser.h | 5 ++++ .../backend/serializer/serializer_proto.cc | 2 ++ .../backend/serializer/serializer_raptor.cc | 2 +- 5 files changed, 38 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/marmotta/blob/c45e4944/libraries/ostrich/backend/client/client.cc ---------------------------------------------------------------------- diff --git a/libraries/ostrich/backend/client/client.cc b/libraries/ostrich/backend/client/client.cc index f2ac286..da875a4 100644 --- a/libraries/ostrich/backend/client/client.cc +++ b/libraries/ostrich/backend/client/client.cc @@ -165,8 +165,10 @@ class MarmottaClient { std::unique_ptr<ClientReader<rdf::proto::Statement> > reader( stub_->GetStatements(&context, pattern.getMessage())); + StatementReader it(reader.get()); + serializer::Serializer serializer("http://www.example.com", format); - serializer.serialize(StatementReader(reader.get()), out); + serializer.serialize(it, out); } void patternDelete(const rdf::Statement &pattern) { http://git-wip-us.apache.org/repos/asf/marmotta/blob/c45e4944/libraries/ostrich/backend/parser/rdf_parser.cc ---------------------------------------------------------------------- diff --git a/libraries/ostrich/backend/parser/rdf_parser.cc b/libraries/ostrich/backend/parser/rdf_parser.cc index 9a1fea3..4706e8b 100644 --- a/libraries/ostrich/backend/parser/rdf_parser.cc +++ b/libraries/ostrich/backend/parser/rdf_parser.cc @@ -43,6 +43,12 @@ Parser::Parser(const rdf::URI& baseUri, Format format) case RDFJSON: parser = raptor_new_parser(world, "json"); break; + case TRIG: + parser = raptor_new_parser(world, "trig"); + break; + case NQUADS: + parser = raptor_new_parser(world, "nquads"); + break; case GUESS: parser = raptor_new_parser(world, "guess"); break; @@ -171,5 +177,26 @@ Format FormatFromString(const std::string &name) { return RDFXML; } +std::string FormatToString(Format fmt) { + switch(fmt) { + case RDFXML: + return "rdf/xml"; + case RDFA: + return "text/xhtml+xml"; + case NTRIPLES: + return "text/n3"; + case TURTLE: + return "text/turtle"; + case RDFJSON: + return "application/rdf+json"; + case GUESS: + return "auto"; + case NQUADS: + return "text/nquads"; + case TRIG: + return "text/trig"; + } + return ""; +} } } http://git-wip-us.apache.org/repos/asf/marmotta/blob/c45e4944/libraries/ostrich/backend/parser/rdf_parser.h ---------------------------------------------------------------------- diff --git a/libraries/ostrich/backend/parser/rdf_parser.h b/libraries/ostrich/backend/parser/rdf_parser.h index ae03bbf..de2ebdf 100644 --- a/libraries/ostrich/backend/parser/rdf_parser.h +++ b/libraries/ostrich/backend/parser/rdf_parser.h @@ -36,6 +36,11 @@ enum Format { */ Format FormatFromString(const std::string& name); +/** + * Return a string representation of the format passed as argument. + */ +std::string FormatToString(Format fmt); + class Parser { public: http://git-wip-us.apache.org/repos/asf/marmotta/blob/c45e4944/libraries/ostrich/backend/serializer/serializer_proto.cc ---------------------------------------------------------------------- diff --git a/libraries/ostrich/backend/serializer/serializer_proto.cc b/libraries/ostrich/backend/serializer/serializer_proto.cc index f11730a..9749919 100644 --- a/libraries/ostrich/backend/serializer/serializer_proto.cc +++ b/libraries/ostrich/backend/serializer/serializer_proto.cc @@ -44,6 +44,8 @@ void ProtoSerializer::close() { google::protobuf::TextFormat::Print( stmts_, dynamic_cast<google::protobuf::io::ZeroCopyOutputStream*>(out_)); break; + default: + throw SerializationError("Proto Serializer: unsupported format"); } stmts_.Clear(); delete coded_output; http://git-wip-us.apache.org/repos/asf/marmotta/blob/c45e4944/libraries/ostrich/backend/serializer/serializer_raptor.cc ---------------------------------------------------------------------- diff --git a/libraries/ostrich/backend/serializer/serializer_raptor.cc b/libraries/ostrich/backend/serializer/serializer_raptor.cc index 42014cb..551ecf2 100644 --- a/libraries/ostrich/backend/serializer/serializer_raptor.cc +++ b/libraries/ostrich/backend/serializer/serializer_raptor.cc @@ -88,7 +88,7 @@ inline std::string raptorFormat(Format format) { case Format::SPARQL_JSON: return "json-triples"; default: - return "rdfxml"; + throw SerializationError("RDF Serializer: unsupported format"); } } } // namespace
