Skip to content
Snippets Groups Projects
Commit bf7d95fd authored by Benedikt Heinrichs's avatar Benedikt Heinrichs
Browse files

Fix: Add Coscine Graph

parent 64d88729
No related branches found
No related tags found
1 merge request!23Fix: Add Coscine Graph
Pipeline #937016 passed
......@@ -43,6 +43,14 @@ namespace SQL2Linked.Implementations
var projectUrlPrefix = "https://purl.org/coscine/projects";
var resourceUrlPrefix = "https://purl.org/coscine/resources";
var coscineGraph = new Graph
{
BaseUri = cosc
};
AssertToGraphUriNode(coscineGraph, cosc.AbsoluteUri, dcat + "catalog", projectUrlPrefix + "/");
AssertToGraphUriNode(coscineGraph, cosc.AbsoluteUri, dcat + "catalog", resourceUrlPrefix + "/");
graphs.Add(coscineGraph);
foreach (var entry in entries)
{
var projectGraphName = $"{projectUrlPrefix}/{entry.Id}";
......
......@@ -185,36 +185,5 @@ namespace SQL2Linked.Implementations
return graphs;
}
/// <summary>
/// Since Application Profile URL does not have to be the targetClass, resolve it first
/// </summary>
/// <param name="entry"></param>
/// <returns></returns>
private string GetTargetClass(Resource entry)
{
if (_targetClassMap.ContainsKey(entry.ApplicationProfile))
{
return _targetClassMap[entry.ApplicationProfile];
}
var targetClassCmdString = new SparqlParameterizedString
{
CommandText = "SELECT DISTINCT ?targetClass " +
"WHERE { @applicationProfile <http://www.w3.org/ns/shacl#targetClass> ?targetClass }"
};
targetClassCmdString.SetUri("applicationProfile", new Uri(entry.ApplicationProfile));
var targetClassResultSet = WrapRequest(() => RdfStoreConnector.QueryEndpoint.QueryWithResultSet(targetClassCmdString.ToString()));
var targetClass = entry.ApplicationProfile;
foreach (var result in targetClassResultSet)
{
targetClass = result[0].ToString();
}
_targetClassMap.Add(entry.ApplicationProfile, targetClass);
return targetClass;
}
}
}
......@@ -3,7 +3,6 @@ using Coscine.Database.Models;
using Coscine.Metadata;
using Polly;
using VDS.RDF;
using VDS.RDF.Query.Algebra;
namespace SQL2Linked
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment