Inheritance: RecordData, IDcProducer
コード例 #1
0
        /// <summary>
        /// Establish a cross-reference between two works
        /// </summary>
        /// <param name="record"></param>
        /// <param name="doi"></param>
        /// <returns> <</returns>
        /// 
        public int CrossReference(dc record, string doi)
        {
            if (record.Doi != null)
            {
                record.ReferenceIndexes.Add(new DcValue(doi));

                var other = Repository.GetByDoi(record.Doi);
                if (other != null)
                {
                    other.ReferencedBy.Add(new DcValue(record.Doi));
                    return 2;
                }
                return 1;
            }
            return 0;
        }
コード例 #2
0
ファイル: Repository.cs プロジェクト: mwidner/bibliopedia
        public void Save(dc item)
        {
            lock (SyncRoot)
            {
                var id = item.ComputeIdentity() as string;
                var result = (from record in _session.Linq<dc>()
                              where record.Id == id
                              select record).FirstOrDefault();

                if (result == null)
                    _session.TransactedSave(item);
                else
                {
                    result.MergeWith(item);
                    _session.TransactedUpdate(result);
                }
            }
        }
コード例 #3
0
        public Document_ Convert(dc input)
        {
            var output = new Document_(MakeUri(input.Id), RdfDocument);

            output.title = new RdfLiteralString(input.title);
            if (input.coverage != null) output.coverage = new RdfLiteralString(input.coverage);
            if (input.description != null) output.AddComment(new RdfLiteralString(input.description));

            output.AddComment(new RdfLiteralString(input.RawText));

            if (input.language != null) output.language_ = CreateResource(input.language, RdfDocument);
            if (input.publisher != null) output.publisher_ = CreateResource(input.publisher, RdfDocument);
            if (input.relation != null) output.relation_ = CreateResource(input.relation, RdfDocument);

            // just escape these things and they'll any repeats will be identical
            if (input.creator != null) output.creator_s = CreateResources(input.creator, RdfDocument);
            if (input.date != null) output.date_s = CreateResources(input.date, RdfDocument);
            if (input.identifier != null) output.identifier_s = CreateResources(input.identifier, RdfDocument);
            if (input.subject != null) output.category_s = CreateResources(input.subject, RdfDocument);
            if (input.type != null) output.format_s = CreateResources(input.type, RdfDocument);

            return output;
        }
コード例 #4
0
ファイル: Domain.cs プロジェクト: jasonyandell/bibliopedia
        public virtual void MergeWith(dc item)
        {
            if (item.relation != null) relation = item.relation;
            if (item.language != null) language = item.language;
            if (item.coverage != null) coverage = item.coverage;
            if (item.publisher != null) publisher = item.publisher;
            if (item.title != null) title = item.title;
            if (item.description != null) description = item.description;

            if (item.creator != null) creator.Union(item.creator);
            if (item.identifier != null) identifier.Union(item.identifier);
            if (item.type != null) type.Union(item.type);
            if (item.date != null) date.Union(item.date);
            if (item.subject != null) subject.Union(item.subject);
            if (item.ReferencedBy != null) ReferencedBy.Union(item.ReferencedBy);
            if (item.ReferenceIndexes != null) ReferenceIndexes.Union(item.ReferenceIndexes);

            item.UpdateDoi();
        }
コード例 #5
0
ファイル: Domain.cs プロジェクト: jasonyandell/bibliopedia
 public static dc TestDc2()
 {
     var dc2 = new dc
     {
         title = "Test :,. Title",
         description = "dc2description"
     };
     dc2.creator = new OrderedSet<DcValue>();
     dc2.creator.Add(new DcValue("Bbb  K"));
     dc2.creator.Add(new DcValue("Aaa.. .nn .n .. J"));
     return dc2;
 }
コード例 #6
0
ファイル: Domain.cs プロジェクト: jasonyandell/bibliopedia
        public static dc TestDc1()
        {
            var dc1 = new dc
            {
                title = "Test Title",
                coverage = "dc1coverage"
            };
            dc1.creator = new OrderedSet<DcValue>();
            dc1.creator.Add(new DcValue("Aaa, J"));
            dc1.creator.Add(new DcValue("Bbb, K"));

            return dc1;
        }
コード例 #7
0
ファイル: Repository.cs プロジェクト: mwidner/bibliopedia
 public void Delete(dc item)
 {
     lock (SyncRoot) _session.TransactedDelete(item);
 }