|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.topbraid.spin.model.SPINFactory
public class SPINFactory
The singleton that is used to convert plain Jena objects into SPIN API resources, and to do corresponding tests.
| Constructor Summary | |
|---|---|
SPINFactory()
|
|
| Method Summary | |
|---|---|
static Command |
asCommand(Resource resource)
Attempts to cast a given Resource into the most specific subclass of Command, esp Update or Query. |
static Element |
asElement(Resource resource)
Checks whether a given Resource represents a SPARQL element, and returns an instance of a subclass of Element if so. |
static RDFNode |
asExpression(RDFNode node)
Returns the most specific Java instance for a given RDFNode. |
static Function |
asFunction(Resource resource)
Converts a given Resource into a Function instance. |
static FunctionCall |
asFunctionCall(Resource resource)
Checks if a given Resource might represent a Function call, and if yes returns the resource as Function. |
static Query |
asQuery(Resource resource)
Checks if a given Resource is a SPIN query, and returns an instance of a subclass of Query if so. |
static Template |
asTemplate(Resource resource)
Converts a given Resource into a Template instance. |
static TemplateCall |
asTemplateCall(RDFNode node)
Checks whether a given RDFNode can be cast into TemplateCall, and returns it as a TemplateCall instance if so. |
static TriplePattern |
asTriplePattern(RDFNode node)
Checks whether a given RDFNode can be converted into a TriplePattern, and if yes, returns an instance of TriplePattern. |
static org.topbraid.spin.model.update.Update |
asUpdate(Resource resource)
Checks if a given Resource is a subclass of sp:Update and casts it into the most specific Java class possible. |
static Variable |
asVariable(RDFNode node)
Checks whether a given RDFNode can be cast into a Variable and - if yes - converts it into an instance of Variable. |
static Argument |
createArgument(Model model,
Property argProperty,
Resource argType,
boolean optional)
Creates an spl:Argument with a given property and value type. |
static Ask |
createAsk(Model model,
ElementList where)
Creates an Ask query for a given WHERE clause. |
static Attribute |
createAttribute(Model model,
Property argProperty,
Resource argType,
java.lang.Integer minCount,
java.lang.Integer maxCount)
Creates a new spl:Attribute as a blank node in a given Model. |
static ElementList |
createElementList(Model model,
Element[] elements)
Creates a new ElementList in a given Model. |
static ElementList |
createElementList(Model model,
java.util.Iterator<Element> elements)
Creates a new ElementList in a given Model. |
static Filter |
createFilter(Model model,
RDFNode expression)
Creates a Filter from a given expression. |
static FunctionCall |
createFunctionCall(Model model,
Resource function)
Creates a new Function call, which is basically an instance of the function's class. |
static Let |
createLet(Model model,
Variable variable,
RDFNode expression)
Creates a Let in a given Model as a blank node. |
static NamedGraph |
createNamedGraph(Model model,
Resource graphNameNode,
RDFList elements)
Creates a new NamedGraph element as a blank node in a given Model. |
static NotExists |
createNotExists(Model model,
ElementList elements)
Creates a new NotExists as a blank node in a given Model. |
static Optional |
createOptional(Model model,
ElementList elements)
Creates a new Optional as a blank node in a given Model. |
static Service |
createService(Model model,
Resource serviceURI,
ElementList elements)
|
static SubQuery |
createSubQuery(Model model,
Query subQuery)
Creates a new SubQuery as a blank node in a given Model. |
static TemplateCall |
createTemplateCall(Model model,
Resource template)
Creates a new TemplateCall as a blank node instance of a given template. |
static TriplePath |
createTriplePath(Model model,
Resource subject,
Resource path,
RDFNode object)
Creates a new TriplePath as a blank node in a given Model. |
static TriplePattern |
createTriplePattern(Model model,
Resource subject,
Resource predicate,
RDFNode object)
Creates a new TriplePattern as a blank node in a given Model. |
static Union |
createUnion(Model model,
ElementList elements)
Creates a new UNION element as a blank node in a given Model. |
static Variable |
createVariable(Model model,
java.lang.String varName)
Creates a new Variable as a blank node in a given Model. |
static Attribute |
getAttribute(Resource cls,
Property property)
Gets an spl:Attribute defined for a given property on a given class. |
static Resource |
getTemplateMetaClass(Command command)
Gets the most appopriate metaclass to wrap a given Command into a Template. |
static boolean |
isAbstract(Resource module)
Checks whether a given module has been declared abstract using spin:abstract
|
static boolean |
isElementList(Resource resource)
Checks if a given Resource can be cast into an ElementList. |
static boolean |
isModuleInstance(Resource resource)
Checks if a given Resource is an instance of a class that has type spin:Module (or its subclasses such as spin:Function). |
static boolean |
isQueryProperty(Property predicate)
Checks if a given Property is spin:query or a sub-property of it. |
static boolean |
isTemplateCall(RDFNode node)
Checks whether a given RDFNode is a TemplateCall. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SPINFactory()
| Method Detail |
|---|
public static Command asCommand(Resource resource)
resource - the Resource to cast
public static Element asElement(Resource resource)
resource - the Resource to check
public static RDFNode asExpression(RDFNode node)
node - the node to cast
public static Function asFunction(Resource resource)
resource - the Resource to convert
public static FunctionCall asFunctionCall(Resource resource)
resource - the Resource to test
public static Query asQuery(Resource resource)
resource - the Resource to test
public static Template asTemplate(Resource resource)
resource - the Resource to convert
public static TemplateCall asTemplateCall(RDFNode node)
node - the node to convert
public static TriplePattern asTriplePattern(RDFNode node)
node - the node to test
public static org.topbraid.spin.model.update.Update asUpdate(Resource resource)
resource - the Resource to cast
public static Variable asVariable(RDFNode node)
node - the node to check
public static Argument createArgument(Model model,
Property argProperty,
Resource argType,
boolean optional)
model - the ModelargProperty - the property or nullargType - the value type or nulloptional - true if the Argument shall be optional
public static Attribute createAttribute(Model model,
Property argProperty,
Resource argType,
java.lang.Integer minCount,
java.lang.Integer maxCount)
model - the Model to create the attribute inargProperty - the predicate or nullargType - the value type or nullminCount - the minimum cardinality or nullmaxCount - the maximum cardinality or null
public static Ask createAsk(Model model,
ElementList where)
model - the Model to create the Ask (blank node) inwhere - the elements of the WHERE clause
public static ElementList createElementList(Model model,
Element[] elements)
model - the Model to create the ElementList inelements - the elements (may be empty)
public static ElementList createElementList(Model model,
java.util.Iterator<Element> elements)
model - the Model to create the ElementList inelements - the elements (may be empty)
public static Filter createFilter(Model model,
RDFNode expression)
model - the Model to create the (blank node) Filter inexpression - the expression node (not null)
public static FunctionCall createFunctionCall(Model model,
Resource function)
model - the Model to create the function call infunction - the function class (must be a URI resource)
public static Let createLet(Model model,
Variable variable,
RDFNode expression)
model - the Model to create the Let invariable - the Variable to assignexpression - the expression on the right hand side
public static NamedGraph createNamedGraph(Model model,
Resource graphNameNode,
RDFList elements)
model - the Model to generate the NamedGraph ingraphNameNode - the URI resource of the graph nameelements - the elements in the NamedGraph
public static NotExists createNotExists(Model model,
ElementList elements)
model - the Model to create the NOT EXISTS inelements - the elements of the NOT EXIST
public static Optional createOptional(Model model,
ElementList elements)
model - the Model to create the OPTIONAL inelements - the elements of the OPTIONAL
public static Service createService(Model model,
Resource serviceURI,
ElementList elements)
public static SubQuery createSubQuery(Model model,
Query subQuery)
model - the Model to create the SubQuery insubQuery - the nested query
public static TemplateCall createTemplateCall(Model model,
Resource template)
model - the Model to create a template call intemplate - the template class
public static TriplePath createTriplePath(Model model,
Resource subject,
Resource path,
RDFNode object)
model - the Model to create the path insubject - the subject (not null)path - the path (not null)object - the object (not null)
public static TriplePattern createTriplePattern(Model model,
Resource subject,
Resource predicate,
RDFNode object)
model - the Model to create the pattern insubject - the subject (not null)predicate - the predicate (not null)object - the object (not null)
public static Union createUnion(Model model,
ElementList elements)
model - the Model to create the Union inelements - the elements
public static Variable createVariable(Model model,
java.lang.String varName)
model - the ModelvarName - the name of the variable
public static Attribute getAttribute(Resource cls,
Property property)
cls - the classproperty - the property
public static Resource getTemplateMetaClass(Command command)
command - the Command, cast into the best possible subclass
public static boolean isAbstract(Resource module)
spin:abstract
- Parameters:
module - the module to test
- Returns:
- true if abstract
public static boolean isElementList(Resource resource)
asElement().
resource - the resource to test
public static boolean isModuleInstance(Resource resource)
resource - the Resource to check
public static boolean isQueryProperty(Property predicate)
predicate - the Property to test
public static boolean isTemplateCall(RDFNode node)
asTemplateCall as the node also must have
a valid template assigned to it, i.e. the type of the node must be an
instance of spin:Template.
node - the RDFNode to check
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||