This class describes a Pedagogical Graph

author bruno
package personalization
subpackage ksources

 Methods

Constructs a new PedagogicalGraph instance, from a url

__construct(string $url, string $a) 

Parameters

$url

string

the url of the knowledge ressource

$a

string

the author of this graph instance

Return a string representation of the graph

__toString() : string

Returns

stringa string with graph properties

Add the node $n to the graph with his parent(s) node(s)

addNode(\PedagogicalRessource $n, \PedagogicalRessource[] $parents) 

Generates a pedagogical graph using the $rs PedagogicalRessources set and the $ps PMDLeProfile set with the rule $rule and the $tgt target value For now, the rule gives a Pedagogicalressource metadata name containning the value of the ressource for this metadata name and the prerequiste value.

generate(\PedagogicalRessource[] $rs, \PMDLeProfile[] $ps, string $rule, string[] $tgt) 

Parameters

$rs

\PedagogicalRessource[]

the PedagogicalRessource set used to build the graph

$ps

\PMDLeProfile[]

the PMDLeProfile set used to build the graph (TODO not used)

$rule

string

the PedagogicalRessource metadata name

$tgt

string[]

the targeted name (index 0) and value (index 1) for the metadata

Returns the edges array

getEdges() : \Edges[]

Returns

\Edges[]the edges array

Returns the nodes array and refresh nodes indexes because some transformations may have built not following indexes

getNodes() : \PedagogicalRessouce[]

Returns

\PedagogicalRessouce[]the node array

Return the KSource url

getURL() : string
Inherited
inherited_from \KSource::getURL()

Returns

stringthe url

It is not yet possible to get internal ressources from a pedagogical ressource This function returns only the url of this ressource TODO: parse the url string and return the pointed node; format = node1/node2/node3

getValueFromPath(string $path, string $d) : string | null

Parameters

$path

string

not used

$d

string

not used

Returns

stringnullthe url

Return a svg string representing the graph

giveSVG() : string

Returns

stringa svg representation of the graph

TODO: not done yet the argument should be a valid XPATH query

matchConstraint(string $c) : int
see \KSource::matchConstraint()

Parameters

$c

string

the constraint string

Returns

inta completion code, if 0: no matches, 1: match, other: error

Create an abstract ressource for rule $rule with value $tgt[1] and prerequiste name = $tgt[0]

createAbstractRessource(string $rule, string[] $tgt, \PedagogicalRessource[] $rs) 

Parameters

$rule

string

the metadata name

$tgt

string[]

a 2-size array where index 0 is the prerequiste name and index 1 the targeted value

$rs

\PedagogicalRessource[]

the pedagogical ressource set to use

Recursive function which build the node for the given ressources and call itself to generate prerequiste dependencies

generatePrerequiste(\PedagogicalResosurce[] $rs, \PedagogicalRessource[] $rss, string $rule, string[] $tgt) 

Parameters

$rs

\PedagogicalResosurce[]

the PedagogicalRessource to work with

$rss

\PedagogicalRessource[]

the available PedagogicalRessource set

$rule

string

the PedagogicalRessource metadata name

$tgt

string[]

the targeted name (index 0) and value (index 1) for the metadata

Process the layer $l and returns the updated layers array

layerProcess(\Edges[] $edges, \PedagogicalRessource[][] $layers, int $l) 

Parameters

$edges

\Edges[]

the edges to check

$l

int

the layer number to process

render a layer in svg

parseNode(\PedagogicalRessource[] $lay, int $x, int $m) 

Parameters

$x

int

starting x position

$m

int

max number of nodes per layer in the whole graph

 Properties

 

$author : string
 

$coords : \int[][]
 

$edges : \Edge[]
 

$height : int
 

$iter : int
 

$limit : int
 

$nHeight : int
 

$nWidth : int
   

$url : \url
Inherited
inherited_from \KSource::$$url
 

$width : int