Skip to content
Snippets Groups Projects
Select Git revision
  • 751df501d689efa89b51ed1a1e4da6687b05c571
  • master default protected
  • dev protected
  • Issue/3003-stsInstitute
  • gitkeep
  • Issue/2449-GuidPidSlugToProjectSettings
  • Issue/2309-docs
  • Fix/xxxx-updateDependencies
  • Issue/2364-testingKpiParser
  • Issue/2287-guestRole
  • Test/xxxx-pipelineTriggers
  • Issue/2102-gitLabResTypeRCV
  • Issue/2278-gitlabToS
  • Issue/2101-gitLabResTypeUi
  • Issue/1788-extractionCronjob
  • Issue/2183-kpiGeneratorResource
  • Issue/2222-resourceDateCreated
  • Issue/2221-projectDateCreated
  • Issue/1321-pidEnquiryOverhaul
  • Issue/1999-gitlabResourcesLib
  • Issue/1951-quotaImplementation
  • v2.22.0
  • v2.20.0
  • v2.19.1
  • v2.19.0
  • v2.18.0
  • v2.17.0
  • v2.16.2
  • v2.16.1
  • v2.16.0
  • v2.15.0
  • v2.14.0
  • v2.13.0
  • v2.12.1
  • v2.12.0
  • v2.11.1
  • v2.11.0
  • v2.10.1
  • v2.10.0
  • v2.9.1
  • v2.9.0
41 results

ApiTokenModel.cs

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    ProjectStructuralData.cs 10.43 KiB
    using Coscine.Database.DataModel;
    using Coscine.Database.Models;
    using Coscine.Database.Util;
    using VDS.RDF;
    
    namespace SQL2Linked.Implementations
    {
        public class ProjectStructuralData : StructuralData<Project, ProjectModel>
        {
            public readonly Uri org = new("http://www.w3.org/ns/org#");
            public readonly Uri dcat = new("http://www.w3.org/ns/dcat#");
            public readonly Uri dcterms = new("http://purl.org/dc/terms/");
            public readonly Uri foaf = new("http://xmlns.com/foaf/0.1/");
            public readonly Uri vcard = new("http://www.w3.org/2006/vcard/ns#");
            public readonly Uri rdf = new("http://www.w3.org/1999/02/22-rdf-syntax-ns#");
            public readonly Uri cosc = new("https://purl.org/coscine/");
            private VisibilityModel VisibilityModel = new VisibilityModel();
            private ProjectRoleModel ProjectRoleModel = new ProjectRoleModel();
            private ProjectResourceModel ProjectResourceModel = new ProjectResourceModel();
    
            // Override to also receive deleted projects
            public override IEnumerable<Project> GetAll()
            {
                return DatabaseConnection.ConnectToDatabase((db) =>
                {
                    return
                        (from tableEntry in Model.GetITableFromDatabase(db)
                         select tableEntry).ToList();
                });
            }
    
            public override IEnumerable<IGraph> ConvertToLinkedData(IEnumerable<Project> entries)
            {
                IEnumerable<Visibility> visibilities = VisibilityModel.GetAll();
                IEnumerable<ProjectRole> projectRoles = ProjectRoleModel.GetAll();
                IEnumerable<ProjectResource> projectResources = ProjectResourceModel.GetAll();
    
                var graphs = new List<IGraph>();
                var projectUrlHandlePrefix = "https://hdl.handle.net/" + Prefix;
                var projectUrlPrefix = "https://purl.org/coscine/projects";
                var resourceUrlPrefix = "https://purl.org/coscine/resources";
    
                foreach (var entry in entries)
                {
                    var projectGraphName = $"{projectUrlPrefix}/{entry.Id}";
                    var projectHandleName = $"{projectUrlHandlePrefix}/{entry.Id}";
    
                    var graph = new Graph();
                    graph.BaseUri = new Uri(projectGraphName);
    
                    AssertToGraphUriNode(graph, projectGraphName, rdf + "type", dcat + "Catalog");
                    Console.WriteLine($"For project '{entry.DisplayName}' will migrate triple '{projectGraphName} {rdf}type {dcat}Catalog'. ");
    
                    AssertToGraphUriNode(graph, projectGraphName, rdf + "type", org + "OrganizationalCollaboration");
                    Console.WriteLine($"For project '{entry.DisplayName}' will migrate triple '{projectGraphName} {rdf}type {org}OrganizationalCollaboration'. ");
    
                    AssertToGraphUriNode(graph, projectGraphName, rdf + "type", vcard + "Group");
                    Console.WriteLine($"For project '{entry.DisplayName}' will migrate triple '{projectGraphName} {rdf}type {vcard}Group'. ");
    
                    AssertToGraphLiteralNode(graph, projectGraphName, dcterms + "title", entry.ProjectName);
                    Console.WriteLine($"For project '{entry.DisplayName}' will migrate triple '{projectGraphName} {dcterms}title {entry.ProjectName}'. ");
    
                    AssertToGraphLiteralNode(graph, projectGraphName, dcterms + "description", entry.Description);
                    Console.WriteLine($"For project '{entry.DisplayName}' will migrate triple '{projectGraphName} {dcterms}description {entry.Description}'. ");
    
                    AssertToGraphLiteralNode(graph, projectGraphName, dcat + "startDate", entry.StartDate.ToString(), new Uri("http://www.w3.org/2001/XMLSchema#dateTime"));
                    Console.WriteLine($"For project '{entry.DisplayName}' will migrate triple '{projectGraphName} {dcat}startDate {entry.StartDate}'. ");
    
                    AssertToGraphLiteralNode(graph, projectGraphName, dcat + "endDate", entry.EndDate.ToString(), new Uri("http://www.w3.org/2001/XMLSchema#dateTime"));
                    Console.WriteLine($"For project '{entry.DisplayName}' will migrate triple '{projectGraphName} {dcat}endDate {entry.EndDate}'. ");