private Model parseBodyAsModel ( final InputStream requestBodyStream , final MediaType contentType , final FedoraResource resource ) throws MalformedRdfException { final Lang format = contentTypeToLang ( contentType . toString ( ) ) ; final Model inputModel ; try { inputModel = createDefaultModel ( ) ; inputModel . read ( requestBodyStream , getUri ( resource ) . toString ( ) , format . getName ( ) . toUpperCase ( ) ) ; return inputModel ; } catch ( final RiotException e ) { throw new BadRequestException ( "RDF was not parsable: " + e . getMessage ( ) , e ) ; } catch ( final RuntimeIOException e ) { if ( e . getCause ( ) instanceof JsonParseException ) { throw new MalformedRdfException ( e . getCause ( ) ) ; } throw new RepositoryRuntimeException ( e ) ; } }
Parse the request body as a Model .