BridgeBase provides methods for adding, querying and deleting
statements from the underlying RDF2Go model.
TODO: be type-safe
RDF Reactor uses the following naming:
resource - instance of an RDF schema class, identified by the
resource ID (an URI or BlankNode), allmost all statements about the resource
use the resource ID as the object
property - a property belongs to a resource, represented by the
predicate of a statement about a resource
value - value of a property of a resource, represented by the object
of the statement with the property as predicate and the resource ID as the
subject
author: mvo
Method Summary
public static void
add(Model model, Resource subject, URI property, Object object) Add a value to a property of a resource.
public static boolean
containsGivenValue(Model model, Resource resource, URI propertyURI, Object value) Check if the resource identified by resourceID, has a property
identidified by propertyURI which has the given value among its values.
getAllValues(Model model, Resource resource, URI propertyURI, java.lang.Class> returnType) Get all values for the given resource and property.
Parameters: model - -the underlying RDF2Go model Parameters: resource - -URI or BlankNode of the resource Parameters: propertyURI - -URI of the property Parameters: returnType - -return the values typed as returnType array of type 'returnType' with 0..n values.
getAllValues_Inverse(Model model, URI propertyURI, Node objectNode, java.lang.Class> returnType) Get all resources having the given property and value.
Parameters: model - -the underlying RDF2Go model Parameters: propertyURI - -URI of the property Parameters: objectNode - -predicate/value of the property Parameters: returnType - -return the values typed as returnType array of type 'returnType' with 0..n values.
getValue(Model model, Resource resourceSubject, URI propertyURI, java.lang.Class> returnType) Return the first x with matching statement (resourceObject, propertyURI,
x) from the given model.
Add a value to a property of a resource.
Parameters: model - -the underlying RDF2Go model Parameters: subject - -URI or BlankNode representing the resource Parameters: property - -URI of the property Parameters: object - -value of the property which is to be added to the resource throws: Exception -
Check if the resource identified by resourceID, has a property
identidified by propertyURI which has the given value among its values.
Parameters: model - -the underlying RDF2Go model Parameters: resource - -must be an URI or a BlankNode Parameters: propertyURI - -URI of the property Parameters: value - -look for this value of the property true if value is among values for the property throws: Exception -
Get all instances of the class in the model.
Parameters: model - -the underlying RDF2Go class Parameters: javaClass - -the requested Java class Array of the given javaClass type instances in the model
Get all values for the given resource and property.
Parameters: model - -the underlying RDF2Go model Parameters: resource - -URI or BlankNode of the resource Parameters: propertyURI - -URI of the property Parameters: returnType - -return the values typed as returnType array of type 'returnType' with 0..n values. Never null. throws: Exception -
Get all resources having the given property and value.
Parameters: model - -the underlying RDF2Go model Parameters: propertyURI - -URI of the property Parameters: objectNode - -predicate/value of the property Parameters: returnType - -return the values typed as returnType array of type 'returnType' with 0..n values. Never null. throws: Exception -
Return a Set with all x matching (resourceObject, propertyURI, x) in the
given model.
Parameters: model - -the underlying model Parameters: resource - -URI or BlankNode of the resource Parameters: propertyURI - -URI of the property Parameters: returnType - -return the found values as the given Java Type Set
Query the model with a SPARQL query.
Parameters: model - -the underlying RDF2GO model Parameters: returnTypes - -cast the values to the types in returnTypes[] Parameters: sparqlSelectQuery - -the SPARQL query java objects, typed as desired by 'returnTypes' throws: Exception -
Return the first x with matching statement (resourceObject, propertyURI,
x) from the given model. If severeal matching statements exist, only the
first is returned.
Parameters: model - -the underlying RDF2Go model Parameters: resourceSubject - -the URI or BlankNode of the resource Parameters: propertyURI - -the URI of the property Parameters: returnType - -return the value from the statement as the given Java Type the first x matching (resourceObject, propertyURI, x) throws: RDFDataException - if more then one value was found throws: ModelRuntimeException -
Remove all values of a property from a resource. (types don't matter
here)
Parameters: model - -the underlying RDF2Go model Parameters: resourceObject - -URI or BlankNode of the resource Parameters: propertyURI - -URI of the property true if any value was present throws: Exception -
Remove a value of a property from a resource.
Parameters: model - -the underlying RDF2Go model Parameters: resource - -URI or BlankNode of the resource Parameters: propertyURI - -URI of the property Parameters: value - -value of the property which is removed true if value could be removed throws: Exception -