public class Client extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Client.CombinedCapabilityInfo
The result of a combined capability query.
|
static class |
Client.TemplateAlreadyExistsException
Exception that can be thrown if trying to add a query template with a name that already has been added.
|
Modifier and Type | Field and Description |
---|---|
static String |
BLUEPRINT_ONTCLASS |
static String |
CAPABILITY_NS
the capability ontology name space url
|
static String |
CAPABILITY_ONTCLASS
The URI of the capability ontology class
|
static String |
COMMON_CONCEPTS_NS
common concepts ontology name space
|
static String |
DEFAULT_RESOURCE_ONTOLOGY_LOCATION
Default location for the resource instance ontology.
|
static String |
DEVICE_COMBINATION_ONTCLASS |
static String |
INDIVIDUAL_DEVICE_ONTCLASS |
static String |
PROCESS_TAXONOMY_NS
The process taxonomy model ontology name space.
|
static String |
RDID_PROPERTY |
static String |
RDURL_PROPERTY |
static String |
REAL_DEVICE_COMBINATION_CLASS_URI |
static String |
RESOURCE_NS
the resource ontology name space url
|
static String |
TEST_DEVICE_COMBINATION_CLASS_URI |
Constructor and Description |
---|
Client()
Create a ontology client using the default ontology defined in RESOURCE_ONTOLOGY_LOCATION
|
Client(String fileName)
creates a ontology client that reads the ontology from the given source
|
Modifier and Type | Method and Description |
---|---|
void |
addResources(InputStream input)
Add new resource instances to clients existing ones.
|
void |
addResources(org.apache.jena.rdf.model.Model resources)
Add new resource instances to clients existing ones.
|
void |
addTemplate(String name,
String template)
Add a query template that can be used with loadTemplate
|
org.apache.jena.ontology.OntModel |
createOntologyModel(InputStream content)
Create memory based OWL model that uses client's own document manager not the global one.
|
org.apache.jena.query.ResultSet |
executeQuery(String file)
Execute the SPARQL query in the given file for the ontology.
|
ParameterObject |
getBasicResourceInformation()
Get basic resource information.
|
Blueprint |
getBlueprint(String name)
Get information about the given blueprint.
|
List<String> |
getBlueprints()
Get the names of all of the device blueprints in the ontology.
|
List<String> |
getBlueprintsByCapability(Capability capability)
List names of blueprints that have the given capability.
|
List<Capability> |
getCapabilities()
Get all capabilities in the ontology.
|
Capability |
getCapability(String name)
get a capability by name
|
CapabilityAssociation |
getCapabilityAssociation(String name)
Deprecated.
always returns null since capability associations no longer have names.
|
List<CapabilityAssociation> |
getCapabilityAssociations()
Deprecated.
Returns always an empty list since associations are no longer listed.
|
org.apache.jena.ontology.OntModel |
getCombinationPossibilitiesForCapability(Capability capability)
Find all device combination possibilities that have the given combined capability and can be formed from the device blueprints in the ontology.
|
org.apache.jena.ontology.OntModel |
getCombinationPossibilitiesForCapability(List<Capability> capabilities,
String fileName,
Predicate<List<String>> filter)
Find all device combination possibilities that have the given combined capability and can be formed from the device blueprints in the ontology.
|
List<Client.CombinedCapabilityInfo> |
getCombinedCapabilities(Collection<Capability> simpleCapabilities)
Gives combined capabilities that can be formed from some of the given capabilities.
|
String |
getDefaultNameSpace()
Get the default name space of the ontology i.e.
|
DeviceCombination |
getDeviceCombination(String name)
Get information about a device combination.
|
List<String> |
getDeviceCombinations()
Get names of all device combinations in the ontology.
|
List<String> |
getDeviceCombinationsByCapability(Capability capability)
Get names of device combinations that have a given capability.
|
List<String> |
getDevicesForBlueprint(String name)
Get list of names of individual devices that are based on the given blueprint.
|
List<String> |
getHighestLevelDeviceCombinations()
Get the names of all highest level device combinations.
|
IndividualDevice |
getIndividualDevice(String name)
Get information about the individual device with the given name.
|
List<String> |
getIndividualDevices()
Get the names of all individual devices in the ontology.
|
List<String> |
getIndividualDevicesByCapability(Capability capability)
Get list of names of individual devices that have the given capability.
|
org.apache.jena.ontology.OntModel |
getOntology()
Returns the Jena ontology model used by the client.
|
String |
getOntologyFile()
Get the file path / URI used in creating this client.
|
String |
getOntologyURI()
Get the URI of the ontology resource defined in the loaded ontology file.
|
Parameter |
getParameter(String name)
Get capability parameter with the given name.
|
ParameterObject |
getParameterObject(String name)
Get the parameter object with the given name.
|
ProcessTaxonomyModel |
getProcessTaxonomyModel()
Get an object that holds information about the process taxonomy model.
|
Set<Capability> |
getSimpleCapabilitiesForDeviceCombination(String device)
get all of the simple capabilities of a device combination
|
boolean |
individualOfClass(String individualURI,
String classURI)
Checks if the ontology has the given individual that belongs to the given class.
|
boolean |
isAllCombinedCapabilityInfo()
Get if getting of some information should be omitted when getting information about devices or device combinations.
|
org.apache.jena.query.QueryExecution |
loadTemplate(String name,
Map<String,Object> params,
boolean usePellet)
gets a query execution that is based on a sparql query in a file.
|
org.apache.jena.query.QueryExecution |
loadTemplate(String name,
Map<String,Object> params,
Map<String,Object> litParams,
boolean usePellet)
gets a query execution that is based on a sparql query in a file.
|
org.apache.jena.ontology.OntModel |
saveAllDeviceCombinations(String file,
org.apache.jena.ontology.OntModel onto)
Calculate combined capabilities and capability parameters for device combinations whose capabilities have not yet been calculated and save them into an ontology file.
|
void |
saveCombinedCapabilities(DeviceCombination device,
String file)
Save device's combined capabilities and their calculated parameters to the given ontology file.
|
void |
saveOntology(OutputStream output)
Writes the client's ontology to the given stream.
|
List<Capability> |
searchCapability(String searchTerm,
fi.tut.mei.resdescapi.util.Util.EnumSearchType type)
Search capability by name.
|
void |
setOntology(org.apache.jena.ontology.OntModel onto) |
void |
setResourceOntology(InputStream input)
Set the resource instance ontology of the client.
|
void |
setResourceOntology(String fileName)
Set the resource instance ontology of the client.
|
List<String> |
viewParameters(String capabilityName)
List all parameters of a capability as list of strings.
|
public static final String RESOURCE_NS
public static final String CAPABILITY_NS
public static final String PROCESS_TAXONOMY_NS
public static final String COMMON_CONCEPTS_NS
public static final String DEFAULT_RESOURCE_ONTOLOGY_LOCATION
public static final String BLUEPRINT_ONTCLASS
public static final String INDIVIDUAL_DEVICE_ONTCLASS
public static final String DEVICE_COMBINATION_ONTCLASS
public static final String TEST_DEVICE_COMBINATION_CLASS_URI
public static final String REAL_DEVICE_COMBINATION_CLASS_URI
public static final String CAPABILITY_ONTCLASS
public static final String RDID_PROPERTY
public static final String RDURL_PROPERTY
public Client()
public Client(String fileName)
fileName
- name of the file containing the ontology. a local file or an urlpublic void setResourceOntology(String fileName)
fileName
- the ontology file or urlpublic void setOntology(org.apache.jena.ontology.OntModel onto)
public org.apache.jena.ontology.OntModel createOntologyModel(InputStream content)
content
- If not null the content is read to the model.public void setResourceOntology(InputStream input)
input
- InputStream containing the new resource instance ontology in the XML/RDF formatpublic void addResources(InputStream input)
input
- InputStream containing a resource instances ontology in the xml/rdf format.public void addResources(org.apache.jena.rdf.model.Model resources)
resources
- a jena model containing a resource instance ontologypublic void saveOntology(OutputStream output)
output
- stream where the client is written topublic Parameter getParameter(String name)
name
- parameter namepublic ParameterObject getParameterObject(String name)
name
- name of a parameter objectpublic List<String> viewParameters(String capabilityName)
capabilityName
- name of a capabilitypublic String getOntologyFile()
public ProcessTaxonomyModel getProcessTaxonomyModel()
public DeviceCombination getDeviceCombination(String name)
saveAllDeviceCombinations(String, OntModel)
methodname
- the name of a device combinationpublic boolean isAllCombinedCapabilityInfo()
public void saveCombinedCapabilities(DeviceCombination device, String file) throws FileNotFoundException
device
- A device combinationfile
- Path to the ontology file where the info will be saved. Can be an existing file or if not a new file will be created.FileNotFoundException
- file not foundpublic org.apache.jena.ontology.OntModel saveAllDeviceCombinations(String file, org.apache.jena.ontology.OntModel onto) throws FileNotFoundException
file
- Name of the file where the information is to be saved. If null information will be not saved into a file.onto
- Ontology model where the information will be added. Can be null in which case a model is created for the information.FileNotFoundException
- file not foundpublic Set<Capability> getSimpleCapabilitiesForDeviceCombination(String device)
device
- the device namepublic Capability getCapability(String name)
name
- capability name@Deprecated public CapabilityAssociation getCapabilityAssociation(String name)
name
- the capability association name@Deprecated public List<CapabilityAssociation> getCapabilityAssociations()
public List<Capability> getCapabilities()
public List<Capability> searchCapability(String searchTerm, fi.tut.mei.resdescapi.util.Util.EnumSearchType type)
searchTerm
- the search termtype
- how to search: capability name starts with, ends with, contains or exactly matches the search term.public List<Client.CombinedCapabilityInfo> getCombinedCapabilities(Collection<Capability> simpleCapabilities)
simpleCapabilities
- capabilities whose combinations are queriedpublic ParameterObject getBasicResourceInformation()
public List<String> getBlueprints()
public List<String> getIndividualDevices()
public List<String> getBlueprintsByCapability(Capability capability)
capability
- A capability.public org.apache.jena.ontology.OntModel getCombinationPossibilitiesForCapability(List<Capability> capabilities, String fileName, Predicate<List<String>> filter)
capabilities
- Combined capabilities that combinations are created for.fileName
- Name of the file where the possibilities ontology will be saved. If null ontology will not be saved to a file.filter
- Allows additional filtering of the created device combinations A filtering function that takes a list of URIs of devices that can be used to form a combination for the capability and returns true if they should form a device combination or false if not. If null no filtering is performed.public org.apache.jena.ontology.OntModel getCombinationPossibilitiesForCapability(Capability capability)
capability
- Combined capability that combinations are created for.public List<String> getDeviceCombinationsByCapability(Capability capability)
saveAllDeviceCombinations(String, OntModel)
can be used to create such an ontology file.capability
- the capabilitypublic List<String> getIndividualDevicesByCapability(Capability capability)
capability
- capabilitypublic Blueprint getBlueprint(String name)
name
- Name of a blueprint.public IndividualDevice getIndividualDevice(String name)
name
- the device namepublic List<String> getDevicesForBlueprint(String name)
name
- The name of a blueprint.public List<String> getDeviceCombinations()
public List<String> getHighestLevelDeviceCombinations()
public boolean individualOfClass(String individualURI, String classURI)
individualURI
- the URI of the individualclassURI
- the URI of the ontology classpublic org.apache.jena.query.ResultSet executeQuery(String file) throws IOException, org.apache.jena.query.QueryParseException
file
- The path to the file containing a SPARQL queryIOException
- If there is a problem in opening the file.org.apache.jena.query.QueryParseException
- If the SPARQL query is invalid.public void addTemplate(String name, String template) throws Client.TemplateAlreadyExistsException
name
- name of the template that is used when loading templatetemplate
- the templateClient.TemplateAlreadyExistsException
- there already is a template with the namepublic org.apache.jena.query.QueryExecution loadTemplate(String name, Map<String,Object> params, boolean usePellet) throws IOException
name
- the name of the query templateparams
- IRI parameters used to replace variables in the template with actual values. Represents resources in the ontology.usePellet
- true use pellet to execute query, false use Jena (no reasoning in query)IOException
- if template file is not foundpublic org.apache.jena.query.QueryExecution loadTemplate(String name, Map<String,Object> params, Map<String,Object> litParams, boolean usePellet) throws IOException
name
- the name of the query template fileparams
- IRI parameters used to replace variables in the template with actual values. Represents resources in the ontology.litParams
- parameters that are literals e.g. strings, numbersusePellet
- true use pellet to execute query, false use Jena (no reasoning in query)IOException
- if template file is not foundpublic org.apache.jena.ontology.OntModel getOntology()
public String getDefaultNameSpace()
public String getOntologyURI()
Copyright © 2021 Tampere University (TAU) / Faculty of Engineering and Natural Sciences (ENS) / Automation Technology and Mechanical Engineering (ATME) / Manufacturing and Production Automation. All rights reserved.