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);
        }
예제 #2
0
        ///<summary>
        /// If the element is found in the semantic action environment and is not a null pointer, return
        /// true. Otherwise, return false.
        ///</summary>
        public override bool Evaluate(SemanticOperationHandler handler)
        {
            String name = Value;
            Scope<Object> theMap = handler.SemanticOperationVariableMap;

            return theMap.ContainsKey(name) && theMap[name] != null;
        }
예제 #3
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);
        }
 public SemanticOperationExecutionException(SemanticOperation operation, String message)
     : this(operation)
 {
     Debug.WriteLine(message);
     SemanticOperationHandler semanticOperationHandler = operation.SemanticOperationHandler;
     if (semanticOperationHandler != null)
     {
         StackTrace(semanticOperationHandler.SemanticOperationVariableMap);
     }
 }
예제 #5
0
 public override bool Evaluate(SemanticOperationHandler handler)
 {
     bool flag = false;
     if (checks != null)
     {
         foreach (Condition check in checks)
         {
             flag = flag || check.Evaluate(handler);
             if (flag)
                 break;
         }
     }
     return flag;
 }
예제 #6
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));
        }
예제 #8
0
 public virtual bool Evaluate(SemanticOperationHandler handler)
 {
     Debug.WriteLine("Condition.Evaluate() gets called: this should never happen.");
     return false;
 }
예제 #9
0
 public override bool Evaluate(SemanticOperationHandler handler)
 {
     return !check.Evaluate(handler);
 }
 public SemanticOperationHandler GetSemanticOperationHandler()
 {
     SemanticOperationHandler result = this.semanticOperationHandler;
     if (result == null)
     {
         ElementState parentES = Parent;
         if (parentES != null && parentES is SemanticOperation)
         {
             SemanticOperation parent = (SemanticOperation) parentES;
             result	= parent.GetSemanticOperationHandler();
             this.semanticOperationHandler = result;
         }
     }
     return result;
 }