Skip to content
Snippets Groups Projects

New: Included metadata in the resource view

Merged Benedikt Heinrichs requested to merge Product/554-metadataResourceView into Sprint/202000
1 file
+ 20
1
Compare changes
  • Side-by-side
  • Inline
@@ -134,9 +134,28 @@ namespace Coscine.Api.Project.Controllers
var user = _authenticator.GetUser();
var resource = _resourceModel.GetById(Guid.Parse(resourceId));
if (_resourceModel.HasAccess(user, resource, UserRoles.Owner, UserRoles.Member))
{
json[graphName]["http://www.w3.org/1999/02/22-rdf-syntax-ns#type"] = new JArray
{
new JObject
{
["value"] = resource.ApplicationProfile.Substring(0, resource.ApplicationProfile.Length-1),
["type"] = "uri"
}
};
// throw bad request if empty node value is detected
JToken root = json.First.First;
foreach (var node in root)
{
string nodeValue = node.First.First["value"].ToString().ToLower();
if (String.IsNullOrEmpty(nodeValue))
{
throw new ArgumentException("Empty values in application profile are not accepted.");
}
}
var graph = new Graph();
graph.LoadFromString(json.ToString(), new RdfJsonParser());
Loading