public class SPINFactory extends Object
| Constructor and Description |
|---|
SPINFactory() |
| Modifier and Type | Method and Description |
|---|---|
static Aggregation |
asAggregation(org.apache.jena.rdf.model.Resource resource)
Attempts to cast a given Resource into an Aggregation.
|
static Command |
asCommand(org.apache.jena.rdf.model.Resource resource)
Attempts to cast a given Resource into the most specific
subclass of Command, esp Update or Query.
|
static Element |
asElement(org.apache.jena.rdf.model.Resource resource)
Checks whether a given Resource represents a SPARQL element, and returns
an instance of a subclass of Element if so.
|
static org.apache.jena.rdf.model.RDFNode |
asExpression(org.apache.jena.rdf.model.RDFNode node)
Returns the most specific Java instance for a given RDFNode.
|
static Function |
asFunction(org.apache.jena.rdf.model.Resource resource)
Converts a given Resource into a Function instance.
|
static FunctionCall |
asFunctionCall(org.apache.jena.rdf.model.Resource resource)
Checks if a given Resource might represent a Function call, and if
yes returns the resource as Function.
|
static Query |
asQuery(org.apache.jena.rdf.model.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(org.apache.jena.rdf.model.Resource resource)
Converts a given Resource into a Template instance.
|
static TemplateCall |
asTemplateCall(org.apache.jena.rdf.model.RDFNode node)
Checks whether a given RDFNode can be cast into TemplateCall, and returns
it as a TemplateCall instance if so.
|
static TriplePattern |
asTriplePattern(org.apache.jena.rdf.model.RDFNode node)
Checks whether a given RDFNode can be converted into a TriplePattern, and if yes,
returns an instance of TriplePattern.
|
static Update |
asUpdate(org.apache.jena.rdf.model.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(org.apache.jena.rdf.model.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(org.apache.jena.rdf.model.Model model,
org.apache.jena.rdf.model.Property argProperty,
org.apache.jena.rdf.model.Resource argType,
boolean optional)
Creates an spl:Argument with a given property and value type.
|
static Ask |
createAsk(org.apache.jena.rdf.model.Model model,
ElementList where)
Creates an Ask query for a given WHERE clause.
|
static Attribute |
createAttribute(org.apache.jena.rdf.model.Model model,
org.apache.jena.rdf.model.Property argProperty,
org.apache.jena.rdf.model.Resource argType,
Integer minCount,
Integer maxCount)
Creates a new spl:Attribute as a blank node in a given Model.
|
static Bind |
createBind(org.apache.jena.rdf.model.Model model,
Variable variable,
org.apache.jena.rdf.model.RDFNode expression)
Creates a Bind in a given Model as a blank node.
|
static ElementList |
createElementList(org.apache.jena.rdf.model.Model model,
Element[] elements)
Creates a new ElementList in a given Model.
|
static ElementList |
createElementList(org.apache.jena.rdf.model.Model model,
Iterator<Element> elements)
Creates a new ElementList in a given Model.
|
static Exists |
createExists(org.apache.jena.rdf.model.Model model,
ElementList elements)
Creates a new Exists as a blank node in a given Model.
|
static Filter |
createFilter(org.apache.jena.rdf.model.Model model,
org.apache.jena.rdf.model.RDFNode expression)
Creates a Filter from a given expression.
|
static FunctionCall |
createFunctionCall(org.apache.jena.rdf.model.Model model,
org.apache.jena.rdf.model.Resource function)
Creates a new Function call, which is basically an instance of the
function's class.
|
static Minus |
createMinus(org.apache.jena.rdf.model.Model model,
ElementList elements)
Creates a new Minus as a blank node in a given Model.
|
static NamedGraph |
createNamedGraph(org.apache.jena.rdf.model.Model model,
org.apache.jena.rdf.model.Resource graphNameNode,
org.apache.jena.rdf.model.RDFList elements)
Creates a new NamedGraph element as a blank node in a given Model.
|
static NotExists |
createNotExists(org.apache.jena.rdf.model.Model model,
ElementList elements)
Creates a new NotExists as a blank node in a given Model.
|
static Optional |
createOptional(org.apache.jena.rdf.model.Model model,
ElementList elements)
Creates a new Optional as a blank node in a given Model.
|
static Service |
createService(org.apache.jena.rdf.model.Model model,
org.apache.jena.rdf.model.Resource serviceURI,
ElementList elements) |
static SubQuery |
createSubQuery(org.apache.jena.rdf.model.Model model,
Query subQuery)
Creates a new SubQuery as a blank node in a given Model.
|
static TemplateCall |
createTemplateCall(org.apache.jena.rdf.model.Model model,
org.apache.jena.rdf.model.Resource template)
Creates a new TemplateCall as a blank node instance of a given template.
|
static TriplePath |
createTriplePath(org.apache.jena.rdf.model.Model model,
org.apache.jena.rdf.model.Resource subject,
org.apache.jena.rdf.model.Resource path,
org.apache.jena.rdf.model.RDFNode object)
Creates a new TriplePath as a blank node in a given Model.
|
static TriplePattern |
createTriplePattern(org.apache.jena.rdf.model.Model model,
org.apache.jena.rdf.model.RDFNode subject,
org.apache.jena.rdf.model.Resource predicate,
org.apache.jena.rdf.model.RDFNode object)
Creates a new TriplePattern as a blank node in a given Model.
|
static Union |
createUnion(org.apache.jena.rdf.model.Model model,
ElementList elements)
Creates a new UNION element as a blank node in a given Model.
|
static Values |
createValues(org.apache.jena.rdf.model.Model model,
org.apache.jena.sparql.algebra.Table data,
boolean untyped)
Creates a new Values element.
|
static Variable |
createVariable(org.apache.jena.rdf.model.Model model,
String varName)
Creates a new Variable as a blank node in a given Model.
|
static Attribute |
getAttribute(org.apache.jena.rdf.model.Resource cls,
org.apache.jena.rdf.model.Property property)
Gets an spl:Attribute defined for a given property on a given class.
|
static org.apache.jena.rdf.model.Resource |
getTemplateMetaClass(Command command)
Gets the most appopriate metaclass to wrap a given Command into a
Template.
|
static boolean |
isAbstract(org.apache.jena.rdf.model.Resource module)
Checks whether a given module has been declared abstract using
spin:abstract
|
static boolean |
isElementList(org.apache.jena.rdf.model.Resource resource)
Checks if a given Resource can be cast into an ElementList.
|
static boolean |
isModuleInstance(org.apache.jena.rdf.model.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(org.apache.jena.rdf.model.Property predicate)
Checks if a given Property is spin:query or a sub-property of it.
|
static boolean |
isTemplateCall(org.apache.jena.rdf.model.RDFNode node)
Checks whether a given RDFNode is a TemplateCall.
|
static boolean |
isVariable(org.apache.jena.rdf.model.RDFNode node)
Checks whether a given RDFNode is a variable.
|
public static Aggregation asAggregation(org.apache.jena.rdf.model.Resource resource)
resource - the Resource to castpublic static Command asCommand(org.apache.jena.rdf.model.Resource resource)
resource - the Resource to castpublic static Element asElement(org.apache.jena.rdf.model.Resource resource)
resource - the Resource to checkpublic static org.apache.jena.rdf.model.RDFNode asExpression(org.apache.jena.rdf.model.RDFNode node)
node - the node to castpublic static Function asFunction(org.apache.jena.rdf.model.Resource resource)
resource - the Resource to convertpublic static FunctionCall asFunctionCall(org.apache.jena.rdf.model.Resource resource)
resource - the Resource to testpublic static Query asQuery(org.apache.jena.rdf.model.Resource resource)
resource - the Resource to testpublic static Template asTemplate(org.apache.jena.rdf.model.Resource resource)
resource - the Resource to convertpublic static TemplateCall asTemplateCall(org.apache.jena.rdf.model.RDFNode node)
node - the node to convertpublic static TriplePattern asTriplePattern(org.apache.jena.rdf.model.RDFNode node)
node - the node to testpublic static Update asUpdate(org.apache.jena.rdf.model.Resource resource)
resource - the Resource to castpublic static Variable asVariable(org.apache.jena.rdf.model.RDFNode node)
node - the node to checkpublic static Argument createArgument(org.apache.jena.rdf.model.Model model, org.apache.jena.rdf.model.Property argProperty, org.apache.jena.rdf.model.Resource argType, boolean optional)
model - the ModelargProperty - the property or nullargType - the value type or nulloptional - true if the Argument shall be optionalpublic static Attribute createAttribute(org.apache.jena.rdf.model.Model model, org.apache.jena.rdf.model.Property argProperty, org.apache.jena.rdf.model.Resource argType, Integer minCount, 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 nullpublic static Ask createAsk(org.apache.jena.rdf.model.Model model, ElementList where)
model - the Model to create the Ask (blank node) inwhere - the elements of the WHERE clausepublic static Bind createBind(org.apache.jena.rdf.model.Model model, Variable variable, org.apache.jena.rdf.model.RDFNode expression)
model - the Model to create the Bind invariable - the Variable to assignexpression - the expressionpublic static ElementList createElementList(org.apache.jena.rdf.model.Model model, Element[] elements)
model - the Model to create the ElementList inelements - the elements (may be empty)public static ElementList createElementList(org.apache.jena.rdf.model.Model model, Iterator<Element> elements)
model - the Model to create the ElementList inelements - the elements (may be empty)public static Exists createExists(org.apache.jena.rdf.model.Model model, ElementList elements)
model - the Model to create the EXISTS inelements - the elements of the EXISTSpublic static Filter createFilter(org.apache.jena.rdf.model.Model model, org.apache.jena.rdf.model.RDFNode expression)
model - the Model to create the (blank node) Filter inexpression - the expression node (not null)public static FunctionCall createFunctionCall(org.apache.jena.rdf.model.Model model, org.apache.jena.rdf.model.Resource function)
model - the Model to create the function call infunction - the function class (must be a URI resource)public static Minus createMinus(org.apache.jena.rdf.model.Model model, ElementList elements)
model - the Model to create the MINUS inelements - the elements of the MINUSpublic static NamedGraph createNamedGraph(org.apache.jena.rdf.model.Model model, org.apache.jena.rdf.model.Resource graphNameNode, org.apache.jena.rdf.model.RDFList elements)
model - the Model to generate the NamedGraph ingraphNameNode - the URI resource of the graph nameelements - the elements in the NamedGraphpublic static NotExists createNotExists(org.apache.jena.rdf.model.Model model, ElementList elements)
model - the Model to create the NOT EXISTS inelements - the elements of the NOT EXISTSpublic static Optional createOptional(org.apache.jena.rdf.model.Model model, ElementList elements)
model - the Model to create the OPTIONAL inelements - the elements of the OPTIONALpublic static Service createService(org.apache.jena.rdf.model.Model model, org.apache.jena.rdf.model.Resource serviceURI, ElementList elements)
public static SubQuery createSubQuery(org.apache.jena.rdf.model.Model model, Query subQuery)
model - the Model to create the SubQuery insubQuery - the nested querypublic static TemplateCall createTemplateCall(org.apache.jena.rdf.model.Model model, org.apache.jena.rdf.model.Resource template)
model - the Model to create a template call intemplate - the template classpublic static TriplePath createTriplePath(org.apache.jena.rdf.model.Model model, org.apache.jena.rdf.model.Resource subject, org.apache.jena.rdf.model.Resource path, org.apache.jena.rdf.model.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(org.apache.jena.rdf.model.Model model, org.apache.jena.rdf.model.RDFNode subject, org.apache.jena.rdf.model.Resource predicate, org.apache.jena.rdf.model.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(org.apache.jena.rdf.model.Model model, ElementList elements)
model - the Model to create the Union inelements - the elementspublic static Values createValues(org.apache.jena.rdf.model.Model model, org.apache.jena.sparql.algebra.Table data, boolean untyped)
model - the Model to create the Values indata - the Table providing the actual datapublic static Variable createVariable(org.apache.jena.rdf.model.Model model, String varName)
model - the ModelvarName - the name of the variablepublic static Attribute getAttribute(org.apache.jena.rdf.model.Resource cls, org.apache.jena.rdf.model.Property property)
cls - the classproperty - the propertypublic static org.apache.jena.rdf.model.Resource getTemplateMetaClass(Command command)
command - the Command, cast into the best possible subclasspublic static boolean isAbstract(org.apache.jena.rdf.model.Resource module)
spin:abstract
- Parameters:
module - the module to test
- Returns:
- true if abstract
-
isElementList
public static boolean isElementList(org.apache.jena.rdf.model.Resource resource)
Checks if a given Resource can be cast into an ElementList.
It must be either rdf:nil or an rdf:List where the first
list item is an element using asElement().
- Parameters:
resource - the resource to test
- Returns:
- true if resource is an element list
-
isModuleInstance
public static boolean isModuleInstance(org.apache.jena.rdf.model.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).
- Parameters:
resource - the Resource to check
- Returns:
- true if resource is a Module
-
isQueryProperty
public static boolean isQueryProperty(org.apache.jena.rdf.model.Property predicate)
Checks if a given Property is spin:query or a sub-property of it.
- Parameters:
predicate - the Property to test
- Returns:
- true if predicate is a query property
-
isTemplateCall
public static boolean isTemplateCall(org.apache.jena.rdf.model.RDFNode node)
Checks whether a given RDFNode is a TemplateCall. The condition for this
is stricter than for 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.
- Parameters:
node - the RDFNode to check
- Returns:
- true if node is a TemplateCall
-
isVariable
public static boolean isVariable(org.apache.jena.rdf.model.RDFNode node)
Checks whether a given RDFNode is a variable.
- Parameters:
node - the node to check
- Returns:
- true if node is a variable
Copyright © 2017 TopQuadrant, Inc.. All rights reserved.