org.topbraid.spin.inference
Class SPINConstructors

java.lang.Object
  extended by org.topbraid.spin.inference.SPINConstructors

public class SPINConstructors
extends java.lang.Object

Static methods to find and execute spin:constructors for a given set of Resources.

Author:
Holger Knublauch

Constructor Summary
SPINConstructors()
           
 
Method Summary
static void construct(Model queryModel, java.util.List<Resource> instances, Model targetModel, ProgressMonitor monitor)
          Runs the constructors on a List of Resources.
static void construct(Model queryModel, java.util.List<Resource> instances, Model targetModel, java.util.Set<Resource> reached, ProgressMonitor monitor)
          Runs the constructors on a List of Resources.
static void construct(Model queryModel, java.util.List<Resource> instances, Model targetModel, java.util.Set<Resource> reached, SPINExplanations explanations, ProgressMonitor monitor)
          Runs the constructors on a List of Resources.
static void constructAll(Model queryModel, Model targetModel, ProgressMonitor monitor)
          Runs all constructors on all instances in a given model.
static void constructInstance(Model queryModel, Resource instance, Model targetModel, java.util.List<Resource> newResources, SPINExplanations explanations, ProgressMonitor monitor)
          Runs constructors for a single instance.
static void constructInstance(Model queryModel, Resource instance, Resource type, Model targetModel, java.util.List<Resource> newResources, java.util.Set<Resource> reachedTypes, ProgressMonitor monitor)
          Runs all constructors defined for a given type on a given instance.
static void constructInstance(Model queryModel, Resource instance, Resource type, Model targetModel, java.util.List<Resource> newResources, java.util.Set<Resource> reachedTypes, SPINExplanations explanations, ProgressMonitor monitor)
          Runs all constructors defined for a given type on a given instance.
static java.util.Set<Resource> getClassesWithConstructor(Model model)
          Finds all classes that directly have a spin:constructor attached to it.
static boolean hasConstructor(Resource cls)
          Checks whether a given class or a superclass thereof has a constructor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SPINConstructors

public SPINConstructors()
Method Detail

construct

public static void construct(Model queryModel,
                             java.util.List<Resource> instances,
                             Model targetModel,
                             ProgressMonitor monitor)
Runs the constructors on a List of Resources.

Parameters:
queryModel - the model to query over
instances - the instances to run the constructors of
targetModel - the model that shall receive the new triples
monitor - an optional progress monitor

construct

public static void construct(Model queryModel,
                             java.util.List<Resource> instances,
                             Model targetModel,
                             java.util.Set<Resource> reached,
                             ProgressMonitor monitor)
Runs the constructors on a List of Resources.

Parameters:
queryModel - the model to query over
instances - the instances to run the constructors of
targetModel - the model that shall receive the new triples
reached - the Set of already reached Resources
monitor - an optional progress monitor

construct

public static void construct(Model queryModel,
                             java.util.List<Resource> instances,
                             Model targetModel,
                             java.util.Set<Resource> reached,
                             SPINExplanations explanations,
                             ProgressMonitor monitor)
Runs the constructors on a List of Resources.

Parameters:
queryModel - the model to query over
instances - the instances to run the constructors of
targetModel - the model that shall receive the new triples
reached - the Set of already reached Resources
explanations - an (optional) explanations object
monitor - an optional progress monitor

constructInstance

public static void constructInstance(Model queryModel,
                                     Resource instance,
                                     Model targetModel,
                                     java.util.List<Resource> newResources,
                                     SPINExplanations explanations,
                                     ProgressMonitor monitor)
Runs constructors for a single instance.

Parameters:
queryModel - the model to query
instance - the instance to run the constructors of
targetModel - the model that will receive the new triples
newResources - will hold the newly constructed instances
monitor - an optional progress monitor

constructInstance

public static void constructInstance(Model queryModel,
                                     Resource instance,
                                     Resource type,
                                     Model targetModel,
                                     java.util.List<Resource> newResources,
                                     java.util.Set<Resource> reachedTypes,
                                     ProgressMonitor monitor)
Runs all constructors defined for a given type on a given instance.

Parameters:
queryModel - the model to query
instance - the instance to run the constructors of
type - the class to run the constructors of
targetModel - the model that will receive the new triples
newResources - will hold the newly constructed instances
reachedTypes - contains the already reached types
monitor - an optional progress monitor

constructInstance

public static void constructInstance(Model queryModel,
                                     Resource instance,
                                     Resource type,
                                     Model targetModel,
                                     java.util.List<Resource> newResources,
                                     java.util.Set<Resource> reachedTypes,
                                     SPINExplanations explanations,
                                     ProgressMonitor monitor)
Runs all constructors defined for a given type on a given instance.

Parameters:
queryModel - the model to query
instance - the instance to run the constructors of
type - the class to run the constructors of
targetModel - the model that will receive the new triples
newResources - will hold the newly constructed instances
reachedTypes - contains the already reached types
explanations - the explanations (optional)
monitor - an optional progress monitor

constructAll

public static void constructAll(Model queryModel,
                                Model targetModel,
                                ProgressMonitor monitor)
Runs all constructors on all instances in a given model.

Parameters:
queryModel - the query model
targetModel - the model to write the new triples to
monitor - an optional progress monitor

getClassesWithConstructor

public static java.util.Set<Resource> getClassesWithConstructor(Model model)
Finds all classes that directly have a spin:constructor attached to it.

Parameters:
model - the Model to operate on
Returns:
a Set of classes

hasConstructor

public static boolean hasConstructor(Resource cls)
Checks whether a given class or a superclass thereof has a constructor.

Parameters:
cls - the class to check
Returns:
true if cls has a constructor