public void TestLoadingPostInheritanceRepository()
        {
            SimplTypesScope.graphSwitch = SimplTypesScope.GRAPH_SWITCH.ON;
            MetadataScalarType.init();

            String workingDirPath = System.IO.Directory.GetCurrentDirectory();
            FileInfo repoFile = new FileInfo(workingDirPath + "\\..\\..\\..\\..\\BigSemanticsWrapperRepository\\BigSemanticsWrappers\\PostInheritanceRepository\\post-inheritance-repository.xml");
            Assert.IsTrue(repoFile.Exists);
            MetaMetadataRepositoryInit repoInit =
                new MetaMetadataRepositoryInit(RepositoryMetadataTypesScope.Get(),
                                               repoFile.FullName,
                                               null);
            Task<MetaMetadataRepository> task = repoInit.LoadRepositoryFromCache(repoFile);
            task.Wait();
            ValidateRepo(task.Result);
        }
        public void TestLoadingPostInheritanceRepository()
        {
            SimplTypesScope.graphSwitch = SimplTypesScope.GRAPH_SWITCH.ON;
            MetadataScalarType.init();

            String   workingDirPath = System.IO.Directory.GetCurrentDirectory();
            FileInfo repoFile       = new FileInfo(workingDirPath + "\\..\\..\\..\\..\\BigSemanticsWrapperRepository\\BigSemanticsWrappers\\PostInheritanceRepository\\post-inheritance-repository.xml");

            Assert.IsTrue(repoFile.Exists);
            MetaMetadataRepositoryInit repoInit =
                new MetaMetadataRepositoryInit(RepositoryMetadataTypesScope.Get(),
                                               repoFile.FullName,
                                               null);
            Task <MetaMetadataRepository> task = repoInit.LoadRepositoryFromCache(repoFile);

            task.Wait();
            ValidateRepo(task.Result);
        }
예제 #3
0
        private MetaMetadataCompositeField GetMetaMetadata()
        {
            MetaMetadataCompositeField mm = _metaMetadata;

            //mm = await MetaMetadataTranslationScope.Get().Deserialize()
            if (_repository == null)
            {
                _repository = MetaMetadataRepositoryInit.GetRepository();
            }

            if (mm == null && _repository != null)
            {
                if (this.MetaMetadataName != null)  // get from saved composition
                {
                    mm = _repository.GetMMByName(this.MetaMetadataName.Value);
                }

                if (mm == null)
                {
                    ParsedUri location = Location == null ? null : Location.Value;
                    if (location != null)
                    {
                        mm = IsImage ? _repository.GetImageMM(location) : _repository.GetDocumentMM(location);

                        // TODO -- also try to resolve by mime type ???
                    }
                    if (mm == null)
                    {
                        mm = _repository.GetByClass(this.GetType());
                    }
                    if (mm == null && MetadataClassDescriptor != null)
                    {
                        mm = _repository.GetMMByName(MetadataClassDescriptor.TagName);
                    }
                }

                if (mm != null)
                {
                    MetaMetadata = mm;
                }
            }
            return(mm);
        }