using pdf.js in mvc : Convert pdf to gif or jpg Library software class asp.net winforms html ajax GrGenNET-Manual5-part1941

CHAPTER 5
RULELANGUAGE
TherulesetlanguageformsthecoreofGrGen.NET.Rulelesrefertozero
1
ormoregraph
models,andspecifyasetofrewriterules. Therulelanguagecovers s testsandrules,with
apatternspecicationbuiltmainlyfromgraphlets,potentiallywithhomomorphicmatching.
Rewritespecicationsmaybegivennestedinsidearuleintheformofareplaceormodify
block. Attributesofgraphelementscanbecheckedwithinif f clausesandassignedwithin
evalblocks.
Thefollowingrewriterulegivesanimpressionofthebasicconstructsthatwewillcover
inthischapter(attributeexpressionsandassignmentsarecoveredinChapters6and12).
EXAMPLE(5)
1
#using"SomeModel.gm"
2
3
test t(n:Node,k:Node) :(Node){
4
n --> .--> l:Node--> k;
5
hom(l,k);
6
return(l);
7
}
8
9
rule r{
10
n:N-e:E->n;
11
if{n.a<=e.a; }
12
13
replace {
14
n --> m:N;
15
eval {m.a =n.a+ 1; }
16
}
17
}
18
19
rule s(vari:int): (Node, N, int){
20
:N<--n:N--> m:Node;
21
m <-->l:Node-:E-> n;
22
if{n.a<=i;}
23
24
modify{
25
delete(n);
26
return(m,l,n.a+ 1);
27
}
28
}
1
OmittingagraphmetamodelmeansthatGrGen.NETusesadefaultgraphmodel. Thedefaultmodel
consistsofthebasetypeNodeforverticesandthebasetypeEdgeforedges.
37
Convert pdf to gif or jpg - Convert PDF to JPEG images in C#.net, ASP.NET MVC, WinForms, WPF project
How to convert PDF to JPEG using C#.NET PDF to JPEG conversion / converter library control SDK
convert multipage pdf to jpg; best convert pdf to jpg
Convert pdf to gif or jpg - VB.NET PDF Convert to Jpeg SDK: Convert PDF to JPEG images in vb.net, ASP.NET MVC, WinForms, WPF project
Online Tutorial for PDF to JPEG (JPG) Conversion in VB.NET Image Application
convert pdf to jpg file; changing pdf to jpg
38
RuleLanguage
5.1 BuildingBlocks
The GrGen.NET rule set language is case sensitive. . Thelanguagemakes s use of several
identierspecializationsinordertodenominatealltheGrGen.NETentities.
Ident,IdentDecl
Anon-emptycharacter sequenceofarbitrarylengthconsistingofletters,digits,orunder-
scores.Therstcharactermustnotbeadigit.Ident maybeanidentierdenedinagraph
model(seeSection4.1).IdentandIdentDecldierintheirrole:WhileIdentDeclisadening
occurrenceofanidentier,Ident isausing g occurrence. . AnIdentDecl l non-terminalcanbe
annotated. SeeSection25.10forannotationsofdeclarations.
NOTE(19)
As intheGrGen.NETmodellanguage(seenote8) every declarationisalsoadenition.
Usinganidentierbeforedeningitisallowed.Everyusedidentierhastobedenedexactly
once.
ModelIdent,TypeIdent,NodeType,EdgeType
Theseare(semantic)specializationsofIdent.TypeIdent matcheseverytypeidentier,i.e.a
nodetype,anedgetype,anenumerationtypeor aprimitivetype. . Allthetypeidentiers
areactuallytypeexpressions.SeeSection6.7fortheuseoftypeexpressions.
5.1.1 Graphlets
Graphlet
-
GraphletNode
-
Continuation
-
Continuation
-
;
-
Continuation
-
GraphletEdge
-
GraphletNode
-
Continuation
-
Agraphletspeciesaconnectedsubgraph. GrGen.NETprovidesgraphletsasadescriptive
notationtodeneboth,patternstosearchforaswellasthesubgraphsthatreplaceormodify
matchedspotsinahostgraph.Anygraphcanbespeciedpiecewisebyasetofgraphlets.In
Example5,line10,thegraphletn:N -e:E-> nbeginswithanodedeclarationn:N,followed
bythecontinuationgraphlet-e:E-> n,declaringanedgee:E,leadingagaintothenoden,
referencedbyitsname.
All the graph elements of a a graphlet have names. . The e name is s either user-assigned
ora uniqueinternal, non-accessible name. . Inthe e secondcase thegraph elementiscalled
anonymous. Forillustrationpurposeswe e usea $<number> notationtodenote anonymous
graphelements inthis document. . For r example thegraphlet n:N N --> m:Nodecontains s an
anonymousedge;thuscanbeunderstoodasn -$1:Edge-> m.Namesmustnotberedened;
once dened, aname is bound d toa a graph element. . We e use the term \binding of names"
Online Convert Jpeg to PDF file. Best free online export Jpg image
Convert a JPG to PDF. the files, try out some settings and then create the PDF files with we believe in diversity and won't discriminate against gif, bmp, png
convert pdf to jpg c#; conversion pdf to jpg
VB.NET PDF Convert to Images SDK: Convert PDF to png, gif images
Resize converted image files in VB.NET. Convert PDF to Jpg, Png, Bmp, Gif, Tiff and Bitmap in ASP.NET. Embed PDF to image converter in viewer.
change format from pdf to jpg; reader convert pdf to jpg
5.1 BuildingBlocks
39
becauseanamenotonlydenotesagraphelementofagraphletbutalsodenotesthemapping
oftheabstractgraphelementofagraphlettoaconcretegraphelementofahostgraph.So
graphelementsofdierentnamesarepairwisedistinctexceptforhomomorphicallymatched
graphelements(seeSection5.3). Forinstancev:NodeType1 1 -e:EdgeType-> w:NodeType2
selectssomenodeoftypeNodeType1thatis connectedtoanodeoftypeNodeType2byan
edgeoftypeEdgeTypeandbindsthenamesv,w,ande.Ifvandwarenotexplicitlymarked
ashomomorphic,thegraphelementstheybindtoaredistinct.Thebindingofnamesallows
forsplittingasinglegraphletintomultiplegraphletsaswellasdeningcyclicstructures.
EXAMPLE(6)
Thefollowinggraphlet(n1,n2,andn3aredenedsomewhereelse)
1
n1 --> n2 --> n3<--n1;
isequivalentto
1
n2 --> n3;
2
n1 --> n2;
3
n3 <-- n1;
andn1 --> > n3isequivalentton3 3 <-- - n1,ofcourse.
Thevisibilityofnamesisdeterminedbyscopes. Scopescanbenested.Namesofsurrounding
scopes arevisible ininner scopes. . Usuallya a scope is denedby f and g. . InExample 5,
lines13to16,therewritepartusesnfromthesurroundingscope,anddeclaresmthatisnot
availableinthenestingpattern. AndinExample58,lines13to17,thenegativecondition
usesn3fromthesurroundingscopeanddeclaresn4ande1.
GraphletNode
-
Ident
-
.

-
IdentDecl
-
:
-
NodeType
-
AdvancedNodeTypeConstructs
-
SpeciesanodeoftypeNodeType;thealternativeadvancednodeconstructsareexplainedin
chapter10. The.isananonymousnodeofthebasetypeNode;rememberthateverynode
typehasNodeassupertype.
Graphlet
Meaning
x:NodeType; ThenamexisboundtoanodeoftypeNodeTypeoroneofitssubtypes.
:NodeType; $1:NodeType
.;
$1:Node
x;
Thenodetowhichxisboundto.
C# Image Convert: How to Convert Adobe PDF to Jpeg, Png, Bmp, &
C# sample code for PDF to jpg image conversion. This demo code convert PDF file all pages to gif images. // Define input and output files path.
convert pdf file to jpg online; changing pdf to jpg file
C# Image Convert: How to Convert MS PowerPoint to Jpeg, Png, Bmp
to Jpeg, PowerPoint to Png, PowerPoint to Bmp, and PowerPoint to Gif. RasterEdge. XDoc.PDF.dll. This demo code just convert first Excel page to Jpeg image.
convert pdf image to jpg; convert pdf to jpeg
40
RuleLanguage
GraphletEdge
-
-
-
EdgeRenement
-
->
-
<-
-
EdgeRenement
-
-
-
<-
-
EdgeRenement
-
->
-
?-
-
EdgeRenement
-
-?
-
Redirect
-
EdgeRenement
-
Ident

-
IdentDecl
-
:
-
EdgeType
-
AdvancedEdgeTypeConstructs
-
A GraphletEdge e species s an edge. . Anonymous s edges s are e speciedby anempty y EdgeRe-
nement clause, , i.e.-->, <--, <-->, --, ?--? ? or r -:T->, , <-:T-, ... . for r anedge e type e T,
respectively. Anon-empty y EdgeRenement t clause e allows for detailededge type specica-
tion. ThealternativeadvancededgeconstructsaswellastheRedirect t clauseareexplained
inchapter10.
Thedierentkindofarrowtipsdistinguishbetweendirected,undirected,andarbitrary
edges(seealsoSection4.1.1). The e arrows-->and<-- areusedfordirectededges witha
denedsource and target. . The e arrow -- is usedfor undirectededges. . The e patternpart
allows for further arrowtips,namely ?--?forarbitrary edges and<-->fordirectededges
withundeneddirection. Notethat<-->isnot t equivalenttothe--> > ; <-- ;statements.
Inordertoproduceamatchfor the arrow <-->,itis sucient thatoneofthe statements
-->, <-- - matches. . If f anedge type is specied(throughthe EdgeRenement t clause), this
typehastocorrespondtothearrowtips,ofcourse.
Graphlet
Meaning
-e:EdgeType-> ; ; The e name e e is s bound d to an edge of type e EdgeType or one e of f its
subtypes.
-:EdgeType-> ;
-$1:EdgeType-> ;
--> ;
-$1:Edge-> ;
<--> ;
-$1:Edge-> ;or<-$1:Edge- ;
-- ;
-$1:UEdge-> ;
?--? ;
-$1:AEdge-> ;
-e-> ;
Theedge,eisboundto.
Astheabovetableshows,edgescanbedenedandusedseparately,i.e.withouttheirincident
nodes.Accidentally\redirecting"anedgeispreventedbycompilerchecks(youmustexplicitly
usetheRedirect clausetoachievethis):Thegraphlets
-e:Edge-> .;
x:Node-e-> y:Node;
are illegal, , because e the edge e e would d have two o destinations: : an n anonymous node and d y.
However,thegraphlets
-e->;
x:Node-e:Edge-> y:Node;
C# Create PDF from images Library to convert Jpeg, png images to
Batch convert PDF documents from multiple image formats, including Jpg, Png, Bmp, Gif, Tiff, Bitmap, .NET Graphics, and REImage.
pdf to jpg; change file from pdf to jpg
JPG to GIF Converter | Convert JPEG to GIF, Convert GIF to JPG
Converter. Convert JPEG (JPG) Images to, from GIF Images on Windows. JPEG to GIF Converter can directly convert GIF files to JPG files.
convert online pdf to jpg; convert pdf to high quality jpg
5.2 RulesandTests
41
areallowed,buttherstgraphlet-e->issuper uous. Inparticularthis s graphlet doesnot
identifyorcreateany \copies",neitherif the graphletoccurs inthe patternpartnorif it
occursintherewritepart.
EXAMPLE(7)
Someattemptstospecifyaloopedge:
Graphlet
Meaning
x:Node -e:Edge-> x;
Theedgeeisaloop.
x:Node -e:Edge-> ; -e-> > x; ; Theedgeeisaloop.
-e:Edge-> x:Node;
Theedgeemayormaynotbealoop.
. -e:Edge-> > .;
Theedgeeiscertainlynotaloop.
NOTE(20)
Althoughboth,thepatternpartandtherewritepartusegraphlets,therearesubtledier-
encesbetweenthem. Mostofthedierencescanbeseeninchapter10wheretheadvanced
constructsareexplained.
5.2 RulesandTests
Thestructureofarulesetleisasfollows:
RuleSet
-
FileHeader
-
ActionDeclaration
-
SubpatternDeclaration
-
RewriteSequenceDenition
-
FunctionDenition
-
ProcedureDenition
-
FilterFunctionDenition
-
PackageDenitionAction
-
FileHeader
-
ModelUsage
-
RulesInclusion
-
GlobalVarDecl
-
C# PDF Convert to Images SDK: Convert PDF to png, gif images in C#
control able to batch convert PDF documents to image formats in C#.NET. Support exporting PDF to multiple image forms, including Jpg, Png, Bmp, Gif, Tiff, Bitmap
change pdf to jpg; .net convert pdf to jpg
C# TIFF: C#.NET Code to Convert JPEG Images to TIFF
string[] imagePaths = { @"C:\demo1.jpg", @"C:\demo2.jpg", @"C:\demo3.jpg" }; // Construct List<REImage> object. Use C# Code to Convert Gif to Tiff.
batch pdf to jpg; convert .pdf to .jpg online
42
RuleLanguage
EXAMPLE(8)
Somegraphlets:
x:Node --> . --> > . . --> > . . --> x;
. <-- - x:Node e --> > .;
. <-- - x x --> > .;
e
1
:stem
e
2
e
3
e
4
e
5
. <-e1:stem- n1:Node -e2:Edge-> . . -e3:Edge-> .
-e4:Edge-> . . -e5:Edge-> n1;
n1 --> n2:Node;
n1 --> n2;
. --> > . . <-- - . . <-- . . --> > .;
e
-e:Edge->
<-- . . <-e- - . --> > ;
Andsomeillegalgraphlets:
. -e:Edge-> > .; . -e-> .; ; Wouldaectredirectingofedgee.
x -e:T-> > y; ; x x -e-> > x;
Wouldaectredirectingofedgee.
<-- --> > ;
Theremustbeatleastanodebetweentheedges.
5.2 RulesandTests
43
ModelUsage
-
#using
-
Filename
-
RulesInclusion
-
#include
-
Filename
-
GlobalVarDecl
-
::
-
IdentDecl
-
:
-
NodeType
-
;
-
-
-
::
-
IdentDecl
-
:
-
EdgeType
-
->
-
;
-
var
-
ref
-
::
-
IdentDecl
-
:
-
VarType
-
;
-
Arule set built on the graphmodels s you are e using g consists s primarily of actions,i.e.
rewrite rules s and d tests, plus further constructs s that t will be e introduced in later r chapters.
Additionallyyoumay include furtherrulelanguageles. . (As s ahintregardingthesyntax
diagrams: pleasenotethatthebottomrailinthe e RuleSet t diagramdepartsbefore e theend
andjoins inafterthe FileHeader, , i.e. . itdenotes s aloopingbackedge(afastforwardedge
wouldhavesplitandjoinpointsatthesamepositionsbutoftheoppositedirection)).
Furthermore, you u may y declare e graph h global variables; ; this s is s a a pure e declaration n that
theywillexistwiththegiventypeduringexecution. Itrendersthemaccessibleintherules
(esp. the e attribute e condition and attribute evaluation), but t you must dene e and d assign
thembefore rule executionoutside of the rules. . They y are made availableto allow for an
easy parameterizationof f entire e transformations, dening the environment; ; other r uses s are
discouraged. SeeChapter9formoreonthis. (Userefforcontainertypesandvarforthe
other(non-nodeoredge)types.)
Incaseofmultiplegraphmodels,GrGen.NETusestheunionofthesemodels. Incase
ofmultiple includes,GrGen.NETuses theunionoftheseactions. . Inthiscasebewareof
con ictingdeclarations.Youmayusepackagesasaremedy,inthemodelforcon ictingdata
units,orintheactionsforcon ictingcomputationunits{oryoumayusenameprexesas
youwoulddointheCprogramminglanguage.
ActionDeclaration
-
TestDeclaration
-
RuleDeclaration
-
TestDeclaration
-
TestModier
-
test
-
ActionSignature
-
f
-
Pattern
-
g
-
FiltersDecl
-
RuleDeclaration
-
RuleModier
-
rule
-
ActionSignature
-
f
-
Pattern
-
Rewrite
-
g
-
FiltersDecl
-
DeclaresasinglerewriterulesuchasSomeRule.Itconsistsofapatternpart(seeSection5.3)
in conjunctionwithits s rewrite part(see Section5.4). . Atest t has s no rewritespecication.
It’sintendedtocheckwhether(andmaybehowmanytimes)apatternoccurs(seeexample
9). ForanexplanationoftheavailablemodiersseeSection10.1,foranexplanationofthe
ltersseeSection15andSection25.4.
44
RuleLanguage
EXAMPLE(9)
WedeneatestSomeCond
1
testSomeCond{
2
n:SeldomNodeType;
3
}
andexecuteinGrShell:
1
execSomeCond &SomeRule
SomeRulewillonlybeexecuted,ifanodeoftypeSeldomNodeTypeexists.Forgraphrewrite
sequencesinGrShellseeSection20.12.
ActionSignature
-
IdentDecl
-
Parameters
-
:
-
ReturnTypes
-
ThesignaturesetsthenameofarewriteruletoIdentDecl andoptionallynamesandtypes
offormalparametersaswellasalistofreturntypes. Parametersandreturntypesprovide
users with h the abilityto exchange graph elements s betweenrules,similar toparameters of
procedurallanguages. Thiswayitispossibletospecifywhere e aruleshouldbeapplied.
Parameters
-
(
-
Parameter
,
-
)
-
Parameter
-
IdentDecl
-
:
-
NodeType
-
InputTypeSpecication
-
-
-
IdentDecl
-
:
-
EdgeType
-
InputTypeSpecication
-
->
-
var
-
ref
-
IdentDecl
-
:
-
VarType
-
InputTypeSpecication
-
<
-
NodeEdgeType
-
null
-
NodeEdgeType
-
+
-
null
-
null
-
+
-
NodeEdgeType
-
>
-
5.2 RulesandTests
45
Withinarule,graphelementparametersaretreatedasgraphelementsofthepattern-
justpredened. Itis s your tasktoensure the elementshandedinsatisfy the interface,i.e.
parameters must not t be e nullandmust be of the type speciedor a subtype of the type
specied(incontrasttosomeoldversions). Ifyouneedmore exibilityandwanttocallthe
rulewithparametersnotfulllingtheinterfaceyoucanappendaninputtypespecication
totherelevant parameters,whichconsists ofthetypetoaccept attheactioninterface,or
null,orboth,enclosedinleftandrightangles. Iftheinputtypespecicationtypeisgiven,
but the more specic patternelement typeis not satised, , matchingsimply y fails. . If f null
is declared in the e input t type e specication and given at t runtime, , the element t is s searched
in the host t graph. . Don’t t use null l parameters s unless you u need them, , because e every y null
parameterdoublesthenumberofmatcherroutineswhichgetgenerated. Non-graphelement
parameters must beprexedby the varor ref-keyword; ; VarTypeis s oneof theattribute
types supportedbyGrGen.NET(cf. 6.1and14.1). . The e primitive typesrequirethevar
prexandarehandedinby-value;thegenerictypesrequiretherefprexandarehandedin
by-reference.Pleasenotethattheeectofassigningtoavar/refparameterineval(see5.4)
isundened(concerningtheparametersaswellastheargument);theyareonlyavailablefor
reading,theby-refparametersadditionallyforset/map-additionandremoval(cf. 11)
EXAMPLE(10)
Thetesttthatcheckswhethernoden1isadjacentton2(connectedbyanundirectededge
orincomingdirectededgeoroutgoingdirectededge)
1
test t(n1:Node<null>,n2:Node<null>) {
2
n1?--? n2;
3
}
isequivalenttothetestst1-t4whicharechosendependentonwhatparametersaredened.
1
testt1(n1:Node, n2:Node) {
2
n1?--? n2;
3
}
4
testt2(n1:Node) {
5
n1?--? n2:Node;
6
}
7
testt3(n2:Node) {
8
n1:Node?--?n2;
9
}
10
testt4{
11
n1:Node?--?n2:Node;
12
}
Soifbothparametersarenotdened,t4ischosen,whichsucceedsassoonastherearetwo
distinctnodesinthegraphconnectedbysomeedge.
ReturnTypes
-
(
-
NodeType
-
EdgeType
-
VarType
,
-
)
-
46
RuleLanguage
Thereturntypes specify edgeand d node typesofgraphelements s that arereturnedbythe
replace/modifypart. Ifreturntypesarespecied,thereturnstatementismandatory.Oth-
erwisenoreturnstatementmustoccur.SeealsoSection5.4,return.
EXAMPLE(11)
We extendSomeRule (Example 58) witha user denednode to matchand wewant it to
returntherewrittengraphelementsn5ande1.
1
ruleSomeRuleExt(varnode:Node):(Node,EdgeTypeB) {
2
n1:NodeTypeA;
3
...
4
5
replace {
6
varnode;
7
...
8
return(n5, e1);
9
eval{
10
...
We donotdene varnode withinthepatternpart becausethis is already coveredby the
parameterspecicationitself.
5.3 PatternPart
Pattern
PatternStatement
-
ReturnStatement
-
A pattern consists of f zero or more e pattern n statements and, , (only) ) in n case of a a test, an
optionalreturnstatement.Allthepatternstatementsmustbefullledbyasubgraphofthe
hostgraphinordertoformamatch.Anemptypatternalwaysproducesexactlyone(empty)
match.Thisiscausedbytheuniquenessofthetotalandtotallyundenedfunction. Foran
explanationofthepatternmodiersdpo,identification,dangling,induced,andexact
seeSection10.1.
Namesdenedfor graphelementsmay be usedbyotherpatternstatementsaswellas
byreplace/modifystatements. Likeallidentierdenitions,suchnamesmaybeusedbefore
theirdeclaration. SeeSection5.1foradetailedexplanationofnamesandgraphlets.
Documents you may be interested
Documents you may be interested