Sie sind auf Seite 1von 3

QnAMarkupQuickStart

http://www.qnamarkup.org

QnAisamarkuplanguageforpeoplewithlittleornoprogrammingexperience.Itwasdesignedwith
attorneysinmindandtransformsblocksoftextintointeractivequestionandanswersessions(QnAs).
TheseQnAscanbeusedasstandaloneexpertsystemsorintheaidofrulebaseddocument
construction.Plus,theentireprojectisopensource.Amongotherthings,thatmeansfree.

AFewExamples

QnAusesspeciallyformattedtext(e.g.,aQ:at
thebeginningofaline)todefinehowa
computerwillpresenttext.Thesebitsof
formatingarecalledtags,andQnAonlyhasten.
Letsusetwoofthem(Q&A)torewritethe
decisiontreeontheleft.Ofcourse,tosee
interactiveoutput,youllneedtotypeourtext
intoaQnAeditor/interpreterliketheone
availableattheURLabove.

ThecontentsofQ(question)tagsarerendered
insideleftalignedtextbubbles.ThefirstQtag's
contentisvisibleafterloading.Thecontentof
otherQtagsbecomevisibleafterauserselects
itsprecedingAtag.

Soourdecisiontreebecomessomethinglikethis.

Q:Isthewindblowingnorthbynorthwest?
A:Yes.
Q:No.Yetthereismethodinit.
A:No.
Q:Yes.

IfyouputtheaboveintoaQnAeditorandhitUpdateOutputs,youllseeaninteractiveversionof
thetree.YoullalsoseeasetoftargetidsaddedtoyourQtags.Forexample:

Q(1):Isthewindblowingnorthbynorthwest?
A:Yes.
Q(1.1):No.Yetthereismethodinit.
A:No.
Q(1.2):Yes.

Thesewillbecomeusefulinamoment.

Anyhow,itseasytoseehowyoucouldcontinue
thisformatingforadditionalbranches,and
althoughthisexampledoesntshowit,youcan
includeasmanyAtagsasyoulike.Justremember
indentsareimportant.

Q:Willyouspendmoretimeintransitthan
atyourdestination?
A:Yes.
Q:Isyourtripmotivatedbylove?
A:Yes.
Q:Yes!
A:No.
Q:Probablynot
A:No.
Q:Maybe

Butwhatifwehaveadecisiontreewithbranchesthatdomorethanfork?Whatiftheyjoinbackon
themselves?Noproblem.Takeforexample:

Q(1):IsthedigraphafterC?
A:Yes.
Q(1.1):EbeforeI
A:No.
Q(1.2):IsthedigraphanAsoundas
inneighbororweigh?
A:Yes.
Q(1.2.1):GOTO:1.1
A:No.
Q(1.2.2):ProbablyIbeforeE,
buttherecouldbeanexception.Englishis
WEIRD!

Seewhatwedidwiththosetargetids?Weuseda
GOTOtagtoredirecttheuser.Thisallowsusto
joinbranches.

NowwhataboutthatweirdQRCode?Canweadd
linkstoourQnA?Yes.YoucanaddlinkstoanA
tagbyplacingtheURLinbrackets,likethis:

[...]
Q(1.2.2):ProbablyIbeforeE,buttherecouldbeanexception.EnglishisWEIRD!
A:[http://steve.wagar.com/ibeforee.htm]Seeforyourself.


Ifyouwantuserstotypeananswer,
youllneedanewtag.TheXtagworks
prettymuchliketheAtag,exceptthatit
renderstheanswerasatextfield
insteadofabutton.Thetextfollowing
anXtagbecomesthenameofavariable
containingtheusersanswer.Youllsee
whatthatmeansinaminute.Letssee
whatwecandowiththisdecisiontree?

Forstarters,wellturnGenerate(new)
Xintoaquestion,Whatisyour
workingtitle?Forthefulleffect,youll
wanttodropthistextinaQnAeditor.
Canyoufigureouthowitwillrender?

Q(1):Whatisyourworkingtitle?
X:mytitle
Q(1.1):Hum...Isthereapuninthere?
A:Yes.
Q(1.1.1):GOTO:2
A:No.
Q(1.1.2):Anywordplay?
A:Yes.
Q(1.1.2.1):GOTO:2
A:No.
Q(1.1.2.2):Latin?
A:Yes.
Q(1.1.2.2.1):GOTO:2
A:No.
Q(1.1.2.2.2):Wellthatwon'tdo.Thinkhard.GOTO:1

Q(2):Sinequanon.FeelenTITLEDtouse"<x>mytitle</x>."

Thatsright,usersareaskedtotypeintheirworking
title,andifitpassesallthetests,itisshowntothe
userattheend.Butthatsnotall,youcandomorethan
justsendpeopletowebsitesandparrotbackthingsthey
typed.Youcanstitcheverythingtogethertocreatea
documentbasedonausersanswerstoquestions.You
canfindeverythingyoutobuildyourowndocuments
ontheSyntax&Usagepageat:
http://www.qnamarkup.org/syntax/Youllalsofindan
explinationofalltentags.

Afterthatremember,practicemakesyoubetter.

Das könnte Ihnen auch gefallen