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);
        }
Example #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);
        }
Example #3
0
 public void FillValues(SemanticsSessionScope semanticsSessionScope, PURLConnection purlConnection, MetaMetadataCompositeField metaMetadata, DocumentClosure documentClosure)
 {
     SemanticsSessionScope = semanticsSessionScope;
     PURLConnection        = purlConnection;
     MetaMetadata          = metaMetadata;
     DocumentClosure       = documentClosure;
 }
        public void InheritValues(Document oldDocument)
        {
            oldDocument.SemanticsSessionScope.GlobalDocumentCollection.Remap(oldDocument, this);

            if (Location == null)
            {
                Location             = oldDocument.Location;
                oldDocument.Location = null;
            }

            this.SemanticsSessionScope = oldDocument.SemanticsSessionScope;

            // TODO semantic inlinks

            List <Metadata> oldMixins = oldDocument.Mixins;

            if (oldMixins != null)
            {
                foreach (Metadata oldMixin in oldMixins)
                {
                    AddMixin(oldMixin);
                }
            }

            List <MetadataParsedURL> oldAdditionalLocations = oldDocument.AdditionalLocations;

            if (oldAdditionalLocations != null)
            {
                foreach (MetadataParsedURL otherLocation in oldAdditionalLocations)
                {
                    AddAdditionalLocation(otherLocation);
                }
            }
        }
Example #5
0
 public MainWindowViewModel()
 {
     _sessionScope = new SemanticsSessionScope(
         RepositoryMetadataTranslationScope.Get(),
         MetaMetadataRepositoryInit.DEFAULT_REPOSITORY_LOCATION
         );
     this._feeds = new ObservableCollection <FeedViewModel>();
 }
 public MainWindowViewModel()
 {
     _sessionScope = new SemanticsSessionScope(
         RepositoryMetadataTranslationScope.Get(),
         MetaMetadataRepositoryInit.DEFAULT_REPOSITORY_LOCATION
         );
     this._feeds = new ObservableCollection<FeedViewModel>();
 }
 public WebViewParser(DocumentClosure closure)
 {
     _closure = closure;
     SemanticsSessionScope = closure.SemanticsSessionScope;
     _webView         = SemanticsSessionScope.WebBrowserPool.Acquire();
     _puri            = closure.PURLConnection.ResponsePURL;
     _requestTimedOut = new DispatcherTimer()
     {
         Interval = EXTRACTION_TIMEOUT
     };
     _requestTimedOut.Tick += ExtractionRequestTimedOut;
 }
        async void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                _semanticsSessionScope = await SemanticsSessionScope.InitAsync(
                    RepositoryMetadataTranslationScope.Get(),
                    MetaMetadataRepositoryInit.DefaultRepositoryLocation);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exeception: " + ex.StackTrace);
            }

            BtnGetMetadata.IsEnabled = true;
        }
        async void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                SimplTypesScope _repositoryMetadataTranslationScope = RepositoryMetadataTranslationScope.Get();

                semanticsSessionScope = await SemanticsSessionScope.InitAsync(
                    _repositoryMetadataTranslationScope,
                    MetaMetadataRepositoryInit.DEFAULT_REPOSITORY_LOCATION);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exeception: " + ex.StackTrace);
            }

            BtnGetMetadata.IsEnabled = true;
        }
        async void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                SimplTypesScope _repositoryMetadataTranslationScope = RepositoryMetadataTranslationScope.Get();

                semanticsSessionScope = await SemanticsSessionScope.InitAsync(
                                            _repositoryMetadataTranslationScope,
                                            MetaMetadataRepositoryInit.DEFAULT_REPOSITORY_LOCATION);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exeception: " + ex.StackTrace);
            }

            BtnGetMetadata.IsEnabled = true;
        }
 async void MainWindow_Loaded(object sender, RoutedEventArgs e)
 {
     try
     {
         _semanticsSessionScope = await SemanticsSessionScope.InitAsync(
                                     RepositoryMetadataTranslationScope.Get(),
                                     MetaMetadataRepositoryInit.DefaultRepositoryLocation);
     
     }
     catch (Exception ex)
     {
         Console.WriteLine("Exeception: " + ex.StackTrace);
         
     }
     
     BtnGetMetadata.IsEnabled = true;
 }
Example #12
0
        public MetadataServicesClient(SimplTypesScope metadatascope, SemanticsSessionScope semanticSessionScope, ParsedUri serviceUri, bool useWebSockets = false)
        {
            SimplTypesScope[] oodssAndMetadataScope = { metadatascope, DefaultServicesTranslations.Get() };

            _metadataTypeScope = SimplTypesScope.Get("MetadataServicesTranslationScope",
                                                     oodssAndMetadataScope,
                                                     typeof(MetadataRequest),
                                                     typeof(MetadataResponse),
                                                     typeof(SemanticServiceError)
                                                     );

            _serviceBaseUri = serviceUri;

            if (useWebSockets)
            {
                _metadataClient = new WebSocketOODSSClient("127.0.0.1", 2018, _metadataTypeScope, semanticSessionScope);
                _metadataClient.StartAsync();
            }
        }
Example #13
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 MetadataDeserializationHookStrategy(SemanticsSessionScope semanticsSessionScope)
 {
     _semanticsSessionScope = semanticsSessionScope;
 }
Example #15
0
 internal DocumentClosure(SemanticsSessionScope semanticsSessionScope, Document document)
 {
     SemanticsSessionScope = semanticsSessionScope;
     Document = document;
 }
Example #16
0
 public DocumentClosureConnectionHelper(SemanticsSessionScope semanticsSessionScope, Document originalDocument, DocumentClosure documentClosure)
 {
     this.semanticsSessionScope = semanticsSessionScope;
     this.originalDocument      = originalDocument;
     this.documentClosure       = documentClosure;
 }
 public WebBrowserPool(SemanticsSessionScope scope)
 {
     SemanticsSessionScope = scope;
     _poolLock             = new Object();
 }
        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));
        }
 public WebBrowserPool(SemanticsSessionScope scope)
 {
     SemanticsSessionScope = scope;
     _poolLock = new Object();
 }