Class: Formula

formula~Formula(statements, constraints, initBindings, optional)

new Formula(statements, constraints, initBindings, optional)

Parameters:
Name Type Description
statements Initial array of statements
constraints initial array of constraints
initBindings initial bindings used in Query
optional optional
Source:

Methods

add(subject, predicate, obbject, graph)

Add a statement from its parts
Parameters:
Name Type Description
subject Node the first part of the statemnt
predicate Node the second part of the statemnt
obbject Node the third part of the statemnt
graph Node the last part of the statemnt
Source:

addStatement(statement)

Add a statment object
Parameters:
Name Type Description
statement Statement an existing constructed statement to add
Source:

any(subject, predicate, object, graph) → {Node}

Follow link from one node, using one wildcard, looking for one For example, any(me, knows, null, profile) - a person I know accoring to my profile . any(me, knows, null, null) - a person I know accoring to anything in store . any(null, knows, me, null) - a person who know me accoring to anything in store .
Parameters:
Name Type Description
subject Node A node to search for as subject, or if null, a wildcard
predicate Node A node to search for as predicate, or if null, a wildcard
object Node A node to search for as object, or if null, a wildcard
graph Node A node to search for as graph, or if null, a wildcard
Source:
Returns:
- A node which match the wildcard position, or null
Type
Node

bottomTypeURIs()

Finds the types in the list which have no *stored* subtypes These are a set of classes which provide by themselves complete information -- the other classes are redundant for those who know the class DAG.
Source:

connectedStatements(subject, doc)

Trace statements which connect directly, or through bnodes
Parameters:
Name Type Description
subject NamedNode The node to start looking for statments
doc NamedNode The document to be searched, or null to search all documents
Source:
Returns:
an array of statements, duplicate statements are suppresssed.

each(subject, predicate, object, graph) → {Array.<Node>}

Follow links from one node, using one wildcard For example, each(me, knows, null, profile) - people I know accoring to my profile . each(me, knows, null, null) - people I know accoring to anything in store . each(null, knows, me, null) - people who know me accoring to anything in store .
Parameters:
Name Type Description
subject Node A node to search for as subject, or if null, a wildcard
predicate Node A node to search for as predicate, or if null, a wildcard
object Node A node to search for as object, or if null, a wildcard
graph Node A node to search for as graph, or if null, a wildcard
Source:
Returns:
- An array of nodes which match the wildcard position
Type
Array.<Node>

findMembersNT()

For thisClass or any subclass, anything which has it is its type or is the object of something which has the type as its range, or subject of something which has the type as its domain We don't bother doing subproperty (yet?)as it doesn't seeem to be used much. Get all the Classes of which we can RDFS-infer the subject is a member
Source:
Returns:
a hash of URIs

findSubClassesNT()

Get all the Classes of which we can RDFS-infer the subject is a superclass Returns a hash table where key is NT of type and value is statement why we think so. Does NOT return terms, returns URI strings. We use NT representations in this version because they handle blank nodes.
Source:

findSuperClassesNT(subject)

Get all the Classes of which we can RDFS-infer the subject is a subclass
Parameters:
Name Type Description
subject NamedNode The thing whose classes are to be found
Source:
Returns:
a hash table where key is NT of type and value is statement why we think so. Does NOT return terms, returns URI strings. We use NT representations in this version because they handle blank nodes.

findTypesNT(subject)

Get all the Classes of which we can RDFS-infer the subject is a member todo: This will loop is there is a class subclass loop (Sublass loops are not illegal)
Parameters:
Name Type Description
subject NamedNode The thing whose classes are to be found
Source:
Returns:
a hash table where key is NT of type and value is statement why we think so. Does NOT return terms, returns URI strings. We use NT representations in this version because they handle blank nodes.

fromNT()

Transforms an NTriples string format into a Node. The bnode bit should not be used on program-external values; designed for internal work such as storing a bnode id in an HTML attribute. This will only parse the strings generated by the vaious toNT() methods.
Source:

NTtoURI(t)

transform a collection of NTriple URIs into their URI strings
Parameters:
Name Type Description
t some iterable colletion of NTriple URI strings
Source:
Returns:
a collection of the URIs as strings todo: explain why it is important to go through NT

statementsMatching(subject, predicate, object, graph, justOne) → {Array.<Node>}

Search the Store This is really a teaching method as to do this properly you would use IndexedFormula
Parameters:
Name Type Description
subject Node A node to search for as subject, or if null, a wildcard
predicate Node A node to search for as predicate, or if null, a wildcard
object Node A node to search for as object, or if null, a wildcard
graph Node A node to search for as graph, or if null, a wildcard
justOne Boolean flag - stop when found one rather than get all of them?
Source:
Returns:
- An array of nodes which match the wildcard position
Type
Array.<Node>

topTypeURIs()

Finds the types in the list which have no *stored* supertypes We exclude the universal class, owl:Things and rdf:Resource, as it is information-free.
Source:

transitiveClosure(seeds, predicate, inverse)

RDFS Inference These are hand-written implementations of a backward-chaining reasoner over the RDFS axioms.
Parameters:
Name Type Description
seeds Object a hash of NTs of classes to start with
predicate The property to trace though
inverse trace inverse direction
Source: