public void BeforeSemanticOperationTest()
        {
            // test FilterLocation.paramOps & alternativeHosts
            String url1 = "http://dl.acm.org/citation.cfm?id=2063231.2063237&coll=DL";

            // test FilterLocation.stripPrefix
            String url2 = "http://www.amazon.co.uk/gp/bestsellers/books/515344/ref=123";

            // test FilterLocation.Regex
            // added in file products.xml in meta_metadata name="amazon_bestseller_list":
            // <before_semantic_actions>
            //  <filter_location>
            //   <regex match="http://([w]+)\.amazon\.com/gp" replace="http://t$1.gstatic.com/images" />
            //  </filter_location>
            // </before_semantic_actions>
            String url3 = "http://www.amazon.com/gp/bestsellers/books/6";

            SimplTypesScope _repositoryMetadataTranslationScope = RepositoryMetadataTranslationScope.Get();

            SemanticsGlobalScope _semanticsSessionScope = new SemanticsSessionScope(
                                        _repositoryMetadataTranslationScope,
                                        MetaMetadataRepositoryInit.DEFAULT_REPOSITORY_LOCATION);

            Document metadata = _semanticsSessionScope.GetOrConstructDocument(new ParsedUri(url1));

            MetaMetadata metaMetadata = (MetaMetadata)metadata.MetaMetadata;

            SemanticOperationHandler handler = new SemanticOperationHandler(_semanticsSessionScope, null);
            handler.TakeSemanticOperations(metaMetadata, metadata, metaMetadata.BeforeSemanticActions);
        }
Beispiel #2
0
        public void BeforeSemanticOperationTest()// throws SIMPLTranslationException
        {
            // test FilterLocation.paramOps & alternativeHosts
            String url1 = "http://dl.acm.org/citation.cfm?id=2063231.2063237&amp;coll=DL";

            // test FilterLocation.stripPrefix
            String url2 = "http://www.amazon.co.uk/gp/bestsellers/books/515344/ref=123";

            // test FilterLocation.Regex
            // added in file products.xml in meta_metadata name="amazon_bestseller_list":
            // <before_semantic_actions>
            //  <filter_location>
            //   <regex match="http://([w]+)\.amazon\.com/gp" replace="http://t$1.gstatic.com/images" />
            //  </filter_location>
            // </before_semantic_actions>
            String url3 = "http://www.amazon.com/gp/bestsellers/books/6";

            SimplTypesScope _repositoryMetadataTranslationScope = RepositoryMetadataTranslationScope.Get();

            SemanticsGlobalScope _semanticsSessionScope = new SemanticsSessionScope(
                _repositoryMetadataTranslationScope,
                MetaMetadataRepositoryInit.DEFAULT_REPOSITORY_LOCATION);

            Document metadata = _semanticsSessionScope.GetOrConstructDocument(new ParsedUri(url1));

            MetaMetadata metaMetadata = (MetaMetadata)metadata.MetaMetadata;

            SemanticOperationHandler handler = new SemanticOperationHandler(_semanticsSessionScope, null);

            handler.TakeSemanticOperations(metaMetadata, metadata, metaMetadata.BeforeSemanticActions);
        }
Beispiel #3
0
        public void SemanticOperationTest()// throws SIMPLTranslationException
        {
            String collectedExampleUrlMetadata         = @"..\..\..\..\..\MetaMetadataRepository\MmdRepository\testData\collectedExampleUrlMetadata.xml";
            String collectedExampleUrlMetadataNoAuthor = @"..\..\Data\InformationCompositionDeclarationExample.xml";
            String useAuthor = @"..\..\Data\InformationCompositionDeclarationUseAuthor.xml";

            SimplTypesScope _repositoryMetadataTranslationScope = RepositoryMetadataTranslationScope.Get();

            SemanticsGlobalScope _semanticsSessionScope = new SemanticsSessionScope(
                _repositoryMetadataTranslationScope,
                MetaMetadataRepositoryInit.DEFAULT_REPOSITORY_LOCATION);

            InformationCompositionDeclaration doc = (InformationCompositionDeclaration)_repositoryMetadataTranslationScope.DeserializeFile(collectedExampleUrlMetadata, Format.Xml);

            foreach (Metadata metadata in doc.Metadata)
            {
                MetaMetadata metaMetadata = (MetaMetadata)metadata.MetaMetadata;

                SemanticOperationHandler handler = new SemanticOperationHandler(_semanticsSessionScope, null);
                handler.TakeSemanticOperations(metaMetadata, metadata, metaMetadata.SemanticActions);
            }

            Console.WriteLine(SimplTypesScope.Serialize(doc, StringFormat.Xml));
        }
        public void SemanticOperationTest()
        {
            String collectedExampleUrlMetadata = @"..\..\..\..\..\MetaMetadataRepository\MmdRepository\testData\collectedExampleUrlMetadata.xml";
            String collectedExampleUrlMetadataNoAuthor = @"..\..\Data\InformationCompositionDeclarationExample.xml";
            String useAuthor = @"..\..\Data\InformationCompositionDeclarationUseAuthor.xml";

            SimplTypesScope _repositoryMetadataTranslationScope = RepositoryMetadataTranslationScope.Get();

            SemanticsGlobalScope _semanticsSessionScope = new SemanticsSessionScope(
                                        _repositoryMetadataTranslationScope,
                                        MetaMetadataRepositoryInit.DEFAULT_REPOSITORY_LOCATION);

            InformationCompositionDeclaration doc = (InformationCompositionDeclaration)_repositoryMetadataTranslationScope.DeserializeFile(collectedExampleUrlMetadata, Format.Xml);

            foreach (Metadata metadata in doc.Metadata)
            {
                MetaMetadata metaMetadata = (MetaMetadata) metadata.MetaMetadata;

                SemanticOperationHandler handler = new SemanticOperationHandler(_semanticsSessionScope, null);
                handler.TakeSemanticOperations(metaMetadata, metadata, metaMetadata.SemanticActions);
            }

            Console.WriteLine(SimplTypesScope.Serialize(doc, StringFormat.Xml));
        }