Example #1
0
        public override StorageContent CreateContent(CatalogContext context)
        {
            PackagePipelineContext pipelineContext = new PackagePipelineContext(GetBaseAddress());

            _pipeline.Execute(_pipelinePackage, pipelineContext);

            _pageContent = ((GraphPackageMetadata)pipelineContext.PageResult).Graph;

            _itemAddress = pipelineContext.Uri;

            JObject frame = context.GetJsonLdContext("context.PackageDetails.json", Schema.DataTypes.PackageDetails);
            string  json  = pipelineContext.Result.ToContent(frame).ToString();

            return(new StringStorageContent(json, "application/json", "no-store"));
        }
        public override StorageContent CreateContent(CatalogContext context)
        {
            IGraph graph = new Graph();
            INode subject = graph.CreateUriNode(GetItemAddress());

            INode catalogEntry = graph.CreateUriNode(_catalogUri);

            graph.Assert(subject, graph.CreateUriNode(Schema.Predicates.Type), graph.CreateUriNode(Schema.DataTypes.Package));
            graph.Assert(subject, graph.CreateUriNode(Schema.Predicates.Type), graph.CreateUriNode(Schema.DataTypes.Permalink));
            graph.Assert(subject, graph.CreateUriNode(Schema.Predicates.CatalogEntry), catalogEntry);
            graph.Assert(subject, graph.CreateUriNode(Schema.Predicates.Registration), graph.CreateUriNode(GetRegistrationAddress()));

            graph.Assert(catalogEntry, graph.CreateUriNode(Schema.Predicates.Published), graph.CreateLiteralNode(GetPublishedDate().ToString("O"), Schema.DataTypes.DateTime));
            graph.Assert(catalogEntry, graph.CreateUriNode(Schema.Predicates.PackageContent), graph.CreateUriNode(GetPackageContentAddress()));

            JObject frame = context.GetJsonLdContext("context.Package.json", Schema.DataTypes.Package);
            return new StringStorageContent(Utils.CreateJson(graph, frame), "application/json", "no-store");
        }
Example #3
0
        public override StorageContent CreateContent(CatalogContext context)
        {
            IGraph graph   = new Graph();
            INode  subject = graph.CreateUriNode(GetItemAddress());

            INode catalogEntry = graph.CreateUriNode(_catalogUri);

            graph.Assert(subject, graph.CreateUriNode(Schema.Predicates.Type), graph.CreateUriNode(Schema.DataTypes.Package));
            graph.Assert(subject, graph.CreateUriNode(Schema.Predicates.Type), graph.CreateUriNode(Schema.DataTypes.Permalink));
            graph.Assert(subject, graph.CreateUriNode(Schema.Predicates.CatalogEntry), catalogEntry);
            graph.Assert(subject, graph.CreateUriNode(Schema.Predicates.Registration), graph.CreateUriNode(GetRegistrationAddress()));

            graph.Assert(catalogEntry, graph.CreateUriNode(Schema.Predicates.Published), graph.CreateLiteralNode(GetPublishedDate().ToString("O"), Schema.DataTypes.DateTime));
            graph.Assert(catalogEntry, graph.CreateUriNode(Schema.Predicates.PackageContent), graph.CreateUriNode(GetPackageContentAddress()));

            JObject frame = context.GetJsonLdContext("context.Package.json", Schema.DataTypes.Package);

            return(new StringStorageContent(Utils.CreateJson(graph, frame), "application/json", "no-store"));
        }