Skip to content
Snippets Groups Projects

New: Included metadata in the resource view

5 files
+ 25
6
Compare changes
  • Side-by-side
  • Inline
Files
5
@@ -140,6 +140,25 @@ namespace Coscine.Api.Project.Controllers
var resource = _resourceModel.GetById(Guid.Parse(resourceId));
if (_metadataModel.IsProjectMember(user, resource))
{
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