|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectvs.knowledge.PrologKB
public class PrologKB
Contains all methods that have to call Prolog for their functionality. Do _NOT_ use any call to Prolog anywhere else than here. The idea is that this class provides _the_ interface to Prolog.
Field Summary | |
---|---|
static java.lang.String |
causalityClass
|
static java.lang.String |
createValidatedAction
|
static java.lang.String |
createValidatedEvent
|
static java.lang.String |
fabulaCause
|
static java.lang.String |
fabulaNode
|
static java.lang.String |
getFabulaCharacter
|
static java.lang.String |
getFabulaContents
|
static java.lang.String |
getFabulaContentTruth
|
static java.lang.String |
getSuggestion
|
static java.lang.String |
getSuggestionBody
|
static java.lang.String |
getSuggestionCausers
|
static java.lang.String |
getSuggestionIndividual
|
static java.lang.String |
getSuggestionName
|
static java.lang.String |
getSuggestionType
|
static java.lang.String |
length
|
static java.lang.String |
member
|
static java.lang.String |
nodeClass
|
Method Summary | |
---|---|
java.lang.String |
adaptPlan(java.lang.String character,
java.lang.String intentions,
java.lang.String oldPlan)
Adapts an existing partial-order plan |
static java.lang.String |
addQuotes(java.lang.String input)
|
boolean |
adoptGoal(java.lang.String goal)
Tell Prolog to adopt a goal. |
boolean |
adoptJustifiableGoal(java.lang.String goal)
Tell Prolog to adopt a justifiable goal. |
boolean |
applyOperatorEffects(java.lang.String schema)
Applies operator effects |
boolean |
ask(java.lang.String query)
|
boolean |
call(java.lang.String prologCommand,
java.lang.String input)
|
java.util.Vector<java.lang.String> |
canDo(java.lang.String character,
java.lang.String operator)
Determine which actions given character can pursue |
boolean |
checkSchemaFacts(java.lang.String schema)
Checks whether given schema's preconditions hold, and ignores fabula |
java.util.Vector<RDFtriple> |
conditionToTripleList(java.lang.String condition)
|
boolean |
consult(java.lang.String filename)
consult expects foreward slashes (/) in file names |
boolean |
dropGoal(java.lang.String goal)
Tell Prolog to drop a goal. |
java.util.Vector<java.lang.String> |
executableEvents(java.lang.String plan)
Returns the events in the plan that are executable, i.e. do not depend on the execution of other steps (in terms of causal links) |
java.util.Vector<java.lang.String> |
executableFramingOperators(java.lang.String plan)
Returns the improvisations in the plan that are executable, i.e. do not depend on the execution of other steps (in terms of causal links) |
java.util.Vector<java.lang.String> |
executableInferenceOperators(java.lang.String plan)
Returns the inferences in the plan that are executable, i.e. do not depend on the execution of other steps (in terms of causal links) |
java.util.Vector<java.lang.String> |
executableOperators(java.lang.String plan)
Returns the operators in the plan that are executable, i.e. do not depend on the execution of other steps (in terms of causal links) |
boolean |
finishedPlan(java.lang.String plan)
Determines whether given plan is "finished", i.e., there are no more steps that can be executed |
java.lang.String |
first(java.lang.String tuple)
Get first element of tuple |
static java.lang.String |
fromNrSign(java.lang.String input)
Substring from '#' |
java.util.Vector<java.lang.String> |
getAllResults(jpl.Query q,
jpl.Variable v)
Given a query and a variable occurring in this query, get all resulting binding from the answers |
java.util.Set<java.lang.String> |
getEnablingFabulaElements(GoalSchema gs)
This method returns a number of Strings that represent the URIs of Individuals of fabula elements, that enable the given schema. |
java.util.Set<java.lang.String> |
getEnablingFabulaElements(Operator op)
|
java.lang.String |
getGoalPossibleAfterPlan(java.lang.String character,
java.lang.String goal)
|
java.util.Map<java.lang.String,java.lang.String> |
getGoalsPossibleAfterPlan(java.lang.String character)
|
float |
getGoalUrgency(java.lang.String schema)
|
static PrologKB |
getInstance()
|
java.util.Set<java.lang.String> |
getMotivatingFabulaElements(GoalSchema gs)
This method returns a number of Strings that represent the URIs of Individuals of fabula elements, that motivate the given schema. |
java.lang.String |
getOneResult(jpl.Query q,
jpl.Variable v)
Given a query and a variable occurring in this query, get one resulting binding from the answers |
int |
getOperatorDuration(java.lang.String operator)
|
java.util.Vector<RDFtriple> |
getOperatorEffects(java.lang.String schema)
Retrieve effects of operator schema assumption is that effects can be applied |
java.util.Vector<PlanLink> |
getPlanLinks(java.lang.String plan)
Returns a collection of the plan links of given plan |
java.util.Vector<PlanOrdering> |
getPlanOrderings(java.lang.String plan)
Returns a collection of the plan orderings of given plan |
java.util.Vector<PlanStep> |
getPlanSteps(java.lang.String plan)
|
java.util.Vector<java.lang.String> |
getPossibleGoals(java.lang.String character)
Returns a vector containing all goals that are possible to pursue for given character. |
java.lang.String |
getPrologSingleVariable(java.lang.String prologCommand,
java.lang.String input)
Deprecated. - use getOneResult() in future |
java.util.Vector<java.lang.String> |
getPrologSingleVariableList(java.lang.String prologCommand)
Deprecated. |
java.util.Vector<java.lang.String> |
getPrologSingleVariableList(java.lang.String prologCommand,
java.lang.String input)
Deprecated. - use getAllResults() in future |
java.lang.String |
getQNPF(java.lang.String command,
java.lang.String action)
|
java.lang.String |
getSchemaAgens(java.lang.String schema)
Returns the URI of the agens of given schema (if it has any) |
java.lang.String |
getSchemaClass(java.lang.String schema)
Returns the class of given schema (e.g. action, goal, event, etc) TODO: make in prolog using =.. |
java.lang.String |
getSchemaInstrument(java.lang.String schema)
Returns the URI of the instrument of given schema (if it has any) |
java.lang.String |
getSchemaOpponent(java.lang.String schema)
Returns the URI of the opponent of given schema (if it has any) |
java.lang.String |
getSchemaPatiens(java.lang.String schema)
Returns the URI of the patiens of given schema (if it has any) |
java.lang.String |
getSchemaPreconditions(java.lang.String schema)
Retrieves preconditions of given schema |
java.lang.String |
getSchemaTarget(java.lang.String schema)
Returns the URI of the target of given schema (if it has any) |
java.lang.String |
getSchemaType(java.lang.String schema)
Returns the type of given schema (its corresponding URI in the ontology) |
java.lang.String |
getUntruePreconditionsOfSchema(java.lang.String schema)
|
boolean |
goalFailureConditionsTrue(java.lang.String schema)
Checks whether given goal's failure conditions are true |
java.lang.String |
goalIntention(java.lang.String goalSchema)
|
java.util.Vector<java.lang.String> |
hasAction(java.lang.String character)
Determine which actions given character can pursue |
boolean |
invalidPlan(java.lang.String plan)
Determines whether plan is still valid in given context, i.e., replanning is not needed. |
boolean |
isAdoptedGoal(java.lang.String goal)
|
boolean |
isAdoptedJustifiableGoal(java.lang.String goal)
|
boolean |
isFramingScopeAll(java.lang.String schema)
|
boolean |
isFramingScopeHidden(java.lang.String schema)
|
boolean |
isFramingScopePersonal(java.lang.String schema)
|
boolean |
isSuggestedGoal(java.lang.String goal)
|
static java.lang.String |
listToProlog(java.util.List<RDFtriple> l)
|
boolean |
loadKB(java.lang.String file)
Load RDF/OWL knowledge |
java.lang.String |
narrate(java.lang.String prologString)
Make a narration of given prolog string |
java.util.Vector<java.lang.String> |
necessaryCharacters(java.lang.String thread)
Retrieves characters necessary as a result of plot thread executions (asserted in Prolog) |
java.lang.String |
plan(java.lang.String character,
java.lang.String intentions)
Builds and retrieves a partial-order plan |
java.util.Vector<java.lang.String> |
possibleThreads()
Retrieve plot threads that are now possible |
java.util.Hashtable[] |
prologCall(java.lang.String prologString)
|
java.util.Hashtable[] |
prologCall(java.lang.String prologCommand,
java.lang.String input,
java.util.Vector<java.lang.String> vars)
|
java.util.Hashtable |
prologCallOneSolution(java.lang.String prologString)
|
java.util.List<RDFtriple> |
prologToList(java.lang.String prologTripleList,
boolean truth)
|
RDFtriple |
prologToTriple(java.lang.String prologTriple,
boolean truth)
Builds an RDFtriple object from prolog string representation of an rdf triple TODO: replace getSubject...etc by JPL parsing |
jpl.Query |
query(java.lang.String triple)
RDF query method |
static java.lang.String |
removeQuotes(java.lang.String input)
Remove the single quotes from a Prolog value |
boolean |
saveKB(java.lang.String file)
Save knowledge base. |
java.lang.String |
second(java.lang.String tuple)
Get second element of tuple |
java.util.Vector<java.lang.String> |
selectReactiveActions(java.lang.String character)
Returns a collection of settings based on executed plot threads (asserted in Prolog) |
boolean |
setAgentID(java.lang.String agentID)
Set the character ID for this agent (e.g. ps:leChuck) |
boolean |
suggestGoal(java.lang.String goal)
|
boolean |
tellRDF(java.lang.String term)
|
boolean |
tellRDFtriple(RDFtriple t)
|
java.util.Vector<java.lang.String> |
threadGoals(java.lang.String episode,
java.lang.String characterURI)
Returns a collection of plot thread goals for given character |
java.util.Vector<java.lang.String> |
threadResolveGoals(java.lang.String episode,
java.lang.String characterURI)
Returns a collection of plot thread resolve goals for given character |
java.util.Vector<java.lang.String> |
threadSettings(java.lang.String thread)
Returns a collection of settings based on executed plot threads (asserted in Prolog) |
static java.lang.String |
tripleToProlog(RDFtriple t)
Turns an RDF triple Java object back into a Prolog fact |
boolean |
unifies(java.lang.String lhs,
java.lang.String rhs)
Returns true iff left hand side unifies with right hand side |
boolean |
untellRDF(java.lang.String term)
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String member
public static final java.lang.String length
public static final java.lang.String getSuggestion
public static final java.lang.String getSuggestionName
public static final java.lang.String getSuggestionIndividual
public static final java.lang.String getSuggestionType
public static final java.lang.String getSuggestionCausers
public static final java.lang.String getSuggestionBody
public static final java.lang.String nodeClass
public static final java.lang.String causalityClass
public static final java.lang.String fabulaNode
public static final java.lang.String fabulaCause
public static final java.lang.String getFabulaCharacter
public static final java.lang.String getFabulaContents
public static final java.lang.String getFabulaContentTruth
public static final java.lang.String createValidatedEvent
public static final java.lang.String createValidatedAction
Method Detail |
---|
public static java.lang.String addQuotes(java.lang.String input)
public static java.lang.String fromNrSign(java.lang.String input)
input
- a String containing a '#'
public static PrologKB getInstance()
public static java.lang.String listToProlog(java.util.List<RDFtriple> l)
public static java.lang.String removeQuotes(java.lang.String input)
input
- the string with potential quotes
public static java.lang.String tripleToProlog(RDFtriple t)
t
- the RDF triple in Java
public boolean adoptGoal(java.lang.String goal)
goal
- the Prolog string representing the goal to adoptpublic boolean dropGoal(java.lang.String goal)
goal
- the Prolog string representing the goal to droppublic boolean isAdoptedGoal(java.lang.String goal)
public boolean isAdoptedJustifiableGoal(java.lang.String goal)
public boolean suggestGoal(java.lang.String goal)
public boolean isSuggestedGoal(java.lang.String goal)
public boolean adoptJustifiableGoal(java.lang.String goal)
goal
- the Prolog string representing the goal to justifypublic boolean applyOperatorEffects(java.lang.String schema)
schema
- the operator schema to apply the effects of
public boolean ask(java.lang.String query)
public boolean call(java.lang.String prologCommand, java.lang.String input)
public java.util.Vector<java.lang.String> canDo(java.lang.String character, java.lang.String operator)
character
- the URI of the character
public boolean checkSchemaFacts(java.lang.String schema)
schema
- the schema to validate, as prolog string
public java.util.Vector<RDFtriple> conditionToTripleList(java.lang.String condition)
public boolean consult(java.lang.String filename)
public java.util.Vector<java.lang.String> executableEvents(java.lang.String plan)
plan
- a prolog string representation of a plan
public java.util.Vector<java.lang.String> executableFramingOperators(java.lang.String plan)
plan
- a prolog string representation of a plan
public java.util.Vector<java.lang.String> executableInferenceOperators(java.lang.String plan)
plan
- a prolog string representation of a plan
public java.util.Vector<java.lang.String> executableOperators(java.lang.String plan)
plan
- a prolog string representation of a plan
public boolean finishedPlan(java.lang.String plan)
plan
- Prolog string representing the plan
public boolean invalidPlan(java.lang.String plan)
plan
- a Prolog string representing the plan
public java.lang.String first(java.lang.String tuple)
tuple
- a string representing the tuple
public java.util.Vector<java.lang.String> getAllResults(jpl.Query q, jpl.Variable v)
public java.util.Set<java.lang.String> getEnablingFabulaElements(GoalSchema gs)
gs
- the goal schema under investigation
public java.util.Set<java.lang.String> getEnablingFabulaElements(Operator op)
public java.lang.String getGoalPossibleAfterPlan(java.lang.String character, java.lang.String goal)
public java.util.Map<java.lang.String,java.lang.String> getGoalsPossibleAfterPlan(java.lang.String character)
public float getGoalUrgency(java.lang.String schema)
public java.util.Set<java.lang.String> getMotivatingFabulaElements(GoalSchema gs)
gs
- the Goal schema under investigation
public java.lang.String getOneResult(jpl.Query q, jpl.Variable v)
public java.util.Vector<RDFtriple> getOperatorEffects(java.lang.String schema)
schema
- the schema to retrieve the effects of, in prolog string
public java.util.Vector<PlanLink> getPlanLinks(java.lang.String plan)
plan
- a prolog string representation of a plan
public java.util.Vector<PlanOrdering> getPlanOrderings(java.lang.String plan)
plan
- a prolog string representation of a plan
public java.util.Vector<PlanStep> getPlanSteps(java.lang.String plan)
public java.util.Vector<java.lang.String> getPossibleGoals(java.lang.String character)
character
- the URI of the character agent for which to retrieve possible goals
public java.util.Vector<java.lang.String> selectReactiveActions(java.lang.String character)
public java.lang.String getPrologSingleVariable(java.lang.String prologCommand, java.lang.String input)
@Deprecated public java.util.Vector<java.lang.String> getPrologSingleVariableList(java.lang.String prologCommand)
public java.util.Vector<java.lang.String> getPrologSingleVariableList(java.lang.String prologCommand, java.lang.String input)
public java.lang.String getQNPF(java.lang.String command, java.lang.String action)
public java.lang.String getSchemaAgens(java.lang.String schema)
schema
- the schema as prolog string
public java.lang.String getSchemaClass(java.lang.String schema)
schema
- the schema as Prolog string
public java.lang.String getSchemaInstrument(java.lang.String schema)
schema
- the schema as prolog string
public java.lang.String getSchemaOpponent(java.lang.String schema)
schema
- the schema as prolog string
public int getOperatorDuration(java.lang.String operator)
public java.lang.String getSchemaPatiens(java.lang.String schema)
schema
- the schema as prolog string
public java.lang.String getSchemaPreconditions(java.lang.String schema)
schema
- the schema to retrieve the preconditions of
public java.lang.String getSchemaTarget(java.lang.String schema)
schema
- the schema as prolog string
public java.lang.String getSchemaType(java.lang.String schema)
schema
- the schema as Prolog string
public boolean isFramingScopeAll(java.lang.String schema)
public boolean isFramingScopePersonal(java.lang.String schema)
public boolean isFramingScopeHidden(java.lang.String schema)
public java.lang.String getUntruePreconditionsOfSchema(java.lang.String schema)
public boolean goalFailureConditionsTrue(java.lang.String schema)
schema
- the goal schema
public java.lang.String goalIntention(java.lang.String goalSchema)
public java.util.Vector<java.lang.String> hasAction(java.lang.String character)
character
- the URI of the character
public boolean loadKB(java.lang.String file)
file
- filename of the knowledge base
public java.lang.String narrate(java.lang.String prologString)
prologString
- prolog string representing a narratable structure.
public java.util.Vector<java.lang.String> necessaryCharacters(java.lang.String thread)
public java.lang.String plan(java.lang.String character, java.lang.String intentions)
intentions
- the intentions as prolog list
public java.lang.String adaptPlan(java.lang.String character, java.lang.String intentions, java.lang.String oldPlan)
intentions
- the intentions as prolog list
public java.util.Vector<java.lang.String> possibleThreads()
public java.util.Hashtable[] prologCall(java.lang.String prologString)
public java.util.Hashtable[] prologCall(java.lang.String prologCommand, java.lang.String input, java.util.Vector<java.lang.String> vars)
public java.util.Hashtable prologCallOneSolution(java.lang.String prologString)
public java.util.List<RDFtriple> prologToList(java.lang.String prologTripleList, boolean truth)
public RDFtriple prologToTriple(java.lang.String prologTriple, boolean truth)
prologTriple
- the string representation of the tripletruth
- whether the triple should be interpreted as true or false
public jpl.Query query(java.lang.String triple)
triple
- the RDF triple we want to query Prolog about.
public boolean saveKB(java.lang.String file)
file
- file name to save KB to
public java.lang.String second(java.lang.String tuple)
tuple
- a string representing the tuple
public boolean setAgentID(java.lang.String agentID)
public boolean tellRDF(java.lang.String term)
public boolean tellRDFtriple(RDFtriple t)
public java.util.Vector<java.lang.String> threadGoals(java.lang.String episode, java.lang.String characterURI)
characterURI
- the URI of the character to retrieve plot thread goals for
public java.util.Vector<java.lang.String> threadResolveGoals(java.lang.String episode, java.lang.String characterURI)
characterURI
- the URI of the character to retrieve plot thread goals for
public java.util.Vector<java.lang.String> threadSettings(java.lang.String thread)
public boolean unifies(java.lang.String lhs, java.lang.String rhs)
lhs
- left hand side of the unificationrhs
- right hand side of the unification
public boolean untellRDF(java.lang.String term)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |