FMT_XHTML => 'XHTML',
FMT_HTML => 'HTML',
FMT_JSON => 'RDFJSON',
};
use constant {
FMT_RS_XML => 'xml',
FMT_RS_JSON => 'json',
FMT_RS_TEXT => 'txt',
FMT_RS_HTML => 'html',
point. HTTP content negotiation serves up graph data as HTML, Turtle,
RDF/XML, JSON; and query results as HTML, XML, JSON, CSV or tab-delimited data.
WWW::DataWiki is fully RESTful, using HTTP B<GET>
-9-]*[a-z0-9])(?:/[a-z][a-z0-9-]*[a-z0-9])*)';
our $RE_ext = '(\.nt|\.n3|\.ttl|\.x?html|\.xml|\.json|\.txt|\.csv|\.tab)';
our $RE_path = "${RE_page}${RE_ext}?";
our $RE_vid = '(\d{4}(?:\d{2}(?:\d
plication/sparql-update, text/n3, text/turtle, text/plain, application/rdf+xml;q=0.5, application/json;q=0.1, application/xhtml+xml;q=0.1, text/html;q=0.1'});
}
}
action wikipage_PATCH
{
my ($
s.',
{'X-Accept' => 'text/n3, text/turtle, text/plain, application/rdf+xml;q=0.5, application/json;q=0.1, application/xhtml+xml;q=0.1, text/html;q=0.1'});
}
}
action wikipage_DELETE
{
my (
'application/sparql-results+xml', undef, 'utf-8'],
[WWW::DataWiki::FMT_RS_JSON, 0.9, 'application/x-sparql-results+json', undef, 'utf-8'],
[WWW::DataWiki::FMT_RS_TEXT, 0.6, 'text/plain', undef
s+xml',
'.xhtml'=> 'application/xhtml+xml',
'.html' => 'text/html',
'.json' => 'application/x-sparql-results+json',
'.txt' => 'text/plain',
'.csv' => 'text/csv',
'.tab' => 'text/t
s_string_as ($fmt)
{
my $str;
given ($fmt)
{
when (WWW::DataWiki::FMT_RS_JSON) { $str = $self->rs->as_json; }
when (WWW::DataWiki::FMT_RS_XML) { $str = $self->rs->as_xml; }
when (WW
e; charset=utf-8',
'rdf' => 'application/rdf+xml; charset=utf-8',
'json' => 'application/json',
}->{$variant} || 'application/octet-stream';
$headers{'Content-Typ
xml/i) { $parser = RDF::Trine::Parser::RDFXML->new; }
when (/json/i) { $parser = RDF::Trine::Parser::RDFJSON->new; }
when (/text.plain/i) { $parser = RDF::Trine::Parser::NTrip
Triples), application/xhtml+xml (i.e. XHTML+RDFa 1.0), application/rdf+xml and application/json (i.e. RDF/JSON).');
}
}
# Check it's syntactically sound
my $model;
if (
WWW::DataWiki::FMT_NT, 0.6, 'text/plain', undef, 'utf-8'],
[WWW::DataWiki::FMT_JSON, 0.6, 'application/json', undef, 'utf-8'],
[WWW::DataWiki::FMT_XML, 0.6, 'application/rdf+xml',
ation/rdf+xml',
'.xhtml'=> 'application/xhtml+xml',
'.html' => 'text/html',
'.json' => 'application/json',
};
}
method rdf_string_conforms_to ($format)
{
return 1 if $format eq WWW::
pplication/sparql-query, text/n3, text/turtle, text/plain, application/rdf+xml;q=0.5, application/json;q=0.1, application/xhtml+xml;q=0.1, text/html;q=0.1'});
}
}
action container_OPTIONS
{
my
>uri, 'n3'), ')',
' (', a(-rel=>'rel:alternate', -href=>$ver->formatted_page_iri('json')->uri, 'json'), ')',
br(
-property => 'awol:published',
-content => $publ
html\+xml}i;
return WWW::DataWiki->FMT_JSON if $format =~ m{^(RDF[\s_/-]?)?JSON}i;
return WWW::DataWiki->FMT_JSON if $format =~ m{^application/json}i;
return WWW::DataWiki->FMT_XML if