You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Andy Seaborne <an...@apache.org> on 2020/05/11 15:34:57 UTC
Re: check the validity of RDF representation
On 11/05/2020 15:54, Siddharth Trikha wrote:
> Hi,
>
> My server would get requests containing various RDF representations like Turtle, RDF/XML, N3, etc and getting a "representation" attribute which tells in what format the RDF is. On the server i need to check the validity of RDF representation such that it each content conforms to the syntax defined by the "representation" attribute.
Use the incoming "Content-Type" HTTP header - that is how HTTP tells the
server what the body contains.
If not HTTP consider using the MIME type as the value of the
"representation".
>
> So I need to check if "representation" says:
>
> RDF/XML then the content conforms to RDF/XML synatx.
> Turtle then the content conforms to TURTLE synatx.
>
> Is there an easy way to do this in Apache Jena ?
Yes.
Lang lang = RDFLanguages.contentTypeToLang(the-content-type)
and use "lang" to parse the data
Andy
>
> I saw SHACL (SHApe Constraint Language) implementation in Jena but that validates like against a Schema.
>
>