public override StorageContent CreateContent(CatalogContext context) { using (IGraph graph = new Graph()) { INode entry = graph.CreateUriNode(GetItemAddress()); // catalog infrastructure fields graph.Assert(entry, graph.CreateUriNode(Schema.Predicates.Type), graph.CreateUriNode(GetItemType())); graph.Assert(entry, graph.CreateUriNode(Schema.Predicates.Type), graph.CreateUriNode(Schema.DataTypes.Permalink)); graph.Assert(entry, graph.CreateUriNode(Schema.Predicates.CatalogTimeStamp), graph.CreateLiteralNode(TimeStamp.ToString("O"), Schema.DataTypes.DateTime)); graph.Assert(entry, graph.CreateUriNode(Schema.Predicates.CatalogCommitId), graph.CreateLiteralNode(CommitId.ToString())); graph.Assert(entry, graph.CreateUriNode(Schema.Predicates.Published), graph.CreateLiteralNode(_published.ToString("O"), Schema.DataTypes.DateTime)); graph.Assert(entry, graph.CreateUriNode(Schema.Predicates.Id), graph.CreateLiteralNode(_id)); graph.Assert(entry, graph.CreateUriNode(Schema.Predicates.OriginalId), graph.CreateLiteralNode(_id)); graph.Assert(entry, graph.CreateUriNode(Schema.Predicates.Version), graph.CreateLiteralNode(_version)); SetIdVersionFromGraph(graph); // create JSON content JObject frame = context.GetJsonLdContext("context.Catalog.json", GetItemType()); StorageContent content = new StringStorageContent(Utils.CreateArrangedJson(graph, frame), "application/json", "no-store"); return content; } }
public override StorageContent CreateContent(CatalogContext context) { // metadata from nuspec using (IGraph graph = CreateContentGraph(context)) { // catalog infrastructure fields INode rdfTypePredicate = graph.CreateUriNode(Schema.Predicates.Type); INode timeStampPredicate = graph.CreateUriNode(Schema.Predicates.CatalogTimeStamp); INode commitIdPredicate = graph.CreateUriNode(Schema.Predicates.CatalogCommitId); Triple resource = graph.GetTriplesWithPredicateObject(rdfTypePredicate, graph.CreateUriNode(GetItemType())).First(); graph.Assert(resource.Subject, timeStampPredicate, graph.CreateLiteralNode(TimeStamp.ToString("O"), Schema.DataTypes.DateTime)); graph.Assert(resource.Subject, commitIdPredicate, graph.CreateLiteralNode(CommitId.ToString())); if (graph.GetTriples(Schema.Predicates.Deprecation).Count() > 1) { throw new ArgumentException("Package catalog items can only have a single deprecation."); } // create JSON content JObject frame = context.GetJsonLdContext("context.PackageDetails.json", GetItemType()); StorageContent content = new StringStorageContent(Utils.CreateArrangedJson(graph, frame), "application/json", "no-store"); return(content); } }
public override StorageContent CreateContent(CatalogContext context) { using (IGraph graph = new Graph()) { INode entry = graph.CreateUriNode(GetItemAddress()); // catalog infrastructure fields graph.Assert(entry, graph.CreateUriNode(Schema.Predicates.Type), graph.CreateUriNode(GetItemType())); graph.Assert(entry, graph.CreateUriNode(Schema.Predicates.Type), graph.CreateUriNode(Schema.DataTypes.Permalink)); graph.Assert(entry, graph.CreateUriNode(Schema.Predicates.CatalogTimeStamp), graph.CreateLiteralNode(TimeStamp.ToString("O"), Schema.DataTypes.DateTime)); graph.Assert(entry, graph.CreateUriNode(Schema.Predicates.CatalogCommitId), graph.CreateLiteralNode(CommitId.ToString())); graph.Assert(entry, graph.CreateUriNode(Schema.Predicates.Published), graph.CreateLiteralNode(_published.ToString("O"), Schema.DataTypes.DateTime)); graph.Assert(entry, graph.CreateUriNode(Schema.Predicates.Id), graph.CreateLiteralNode(_id)); graph.Assert(entry, graph.CreateUriNode(Schema.Predicates.OriginalId), graph.CreateLiteralNode(_id)); graph.Assert(entry, graph.CreateUriNode(Schema.Predicates.Version), graph.CreateLiteralNode(_version)); SetIdVersionFromGraph(graph); // create JSON content JObject frame = context.GetJsonLdContext("context.Catalog.json", GetItemType()); StorageContent content = new StringStorageContent(Utils.CreateArrangedJson(graph, frame), "application/json", "no-store"); return(content); } }
public override StorageContent CreateContent(CatalogContext context) { IGraph graph = new Graph(); INode subject = graph.CreateUriNode(GetItemAddress()); 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), graph.CreateUriNode(_catalogUri)); graph.Assert(subject, graph.CreateUriNode(Schema.Predicates.Registration), graph.CreateUriNode(GetRegistrationAddress())); graph.Assert(subject, graph.CreateUriNode(Schema.Predicates.PackageContent), graph.CreateUriNode(GetPackageContentAddress())); graph.Assert(subject, graph.CreateUriNode(Schema.Predicates.Published), graph.CreateLiteralNode(GetPublishedDate().ToString("O"), Schema.DataTypes.DateTime)); graph.Assert(subject, graph.CreateUriNode(Schema.Predicates.Listed), graph.CreateLiteralNode(_listed.ToString(), Schema.DataTypes.Boolean)); JObject frame = context.GetJsonLdContext("context.Package.json", Schema.DataTypes.Package); return new JTokenStorageContent(Utils.CreateJson(graph, frame), "application/json", "no-store"); }
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()); 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), graph.CreateUriNode(_catalogUri)); graph.Assert(subject, graph.CreateUriNode(Schema.Predicates.Registration), graph.CreateUriNode(GetRegistrationAddress())); graph.Assert(subject, graph.CreateUriNode(Schema.Predicates.PackageContent), graph.CreateUriNode(GetPackageContentAddress())); graph.Assert(subject, graph.CreateUriNode(Schema.Predicates.Published), graph.CreateLiteralNode(GetPublishedDate().ToString("O"), Schema.DataTypes.DateTime)); graph.Assert(subject, graph.CreateUriNode(Schema.Predicates.Listed), graph.CreateLiteralNode(_listed.ToString(), Schema.DataTypes.Boolean)); JObject frame = context.GetJsonLdContext("context.Package.json", Schema.DataTypes.Package); return(new StringStorageContent(Utils.CreateJson(graph, frame), "application/json", "no-store")); }
public override StorageContent CreateContent(CatalogContext context) { // metadata from nuspec using (IGraph graph = CreateContentGraph(context)) { // catalog infrastructure fields INode rdfTypePredicate = graph.CreateUriNode(Schema.Predicates.Type); INode timeStampPredicate = graph.CreateUriNode(Schema.Predicates.CatalogTimeStamp); INode commitIdPredicate = graph.CreateUriNode(Schema.Predicates.CatalogCommitId); Triple resource = graph.GetTriplesWithPredicateObject(rdfTypePredicate, graph.CreateUriNode(GetItemType())).First(); graph.Assert(resource.Subject, timeStampPredicate, graph.CreateLiteralNode(TimeStamp.ToString("O"), Schema.DataTypes.DateTime)); graph.Assert(resource.Subject, commitIdPredicate, graph.CreateLiteralNode(CommitId.ToString())); // create JSON content JObject frame = context.GetJsonLdContext("context.PackageDetails.json", GetItemType()); StorageContent content = new StringStorageContent(Utils.CreateArrangedJson(graph, frame), "application/json", "no-store"); return content; } }