|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.hp.hpl.jena.util.ResourceUtils
General utility methods that operate on RDF resources, but which are not specific to a given model.
Constructor Summary | |
ResourceUtils()
|
Method Summary | |
static java.util.Collection |
maximalLowerElements(java.util.Collection resources,
Property rel,
boolean inverse)
Answer the maximal lower elements of the given collection, given the partial ordering rel . |
static java.util.Collection |
maximalLowerElements(java.util.Iterator resources,
Property rel,
boolean inverse)
Given a collection of resources, and a relation defining a partial order over those resources, answer the sub-collection that contains only those elements that appear in the maximal generator of the relation. |
static Resource |
renameResource(Resource old,
java.lang.String uri)
Answer a new resource that occupies the same position in the graph as the current resource old , but that has the given URI. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ResourceUtils()
Method Detail |
public static java.util.Collection maximalLowerElements(java.util.Collection resources, Property rel, boolean inverse)
Answer the maximal lower elements of the given collection, given the partial
ordering rel
. See maximalLowerElements( Iterator, Property, boolean )
for details.
resources
- A collection of resourcesrel
- A property defining a partial-ordering on resources
inverse
- If true, we invert the given property (by reversing the order
of the arguments), which allows us to use eg subClassOf as a partial order
operator for both sub-class and super-class relationships
resources
are not
greater than another resource under the partial order.public static java.util.Collection maximalLowerElements(java.util.Iterator resources, Property rel, boolean inverse)
Given a collection of resources, and a relation defining a partial order over
those resources, answer the sub-collection that contains only those elements
that appear in the maximal generator of the relation. Specifically, a resource
x
is excluded from the return value if there is another resource
y
in the input collection such that y Rel x
holds.
resources
- An iterator over a collection of resourcesrel
- A property defining a partial-ordering on resources
inverse
- If true, we invert the given property (by reversing the order
of the arguments), which allows us to use eg subClassOf as a partial order
operator for both sub-class and super-class relationships
resources
are not
greater than another resource under the partial order.public static Resource renameResource(Resource old, java.lang.String uri)
Answer a new resource that occupies the same position in the graph as the current
resource old
, but that has the given URI. In the process, the existing
statements referring to old
are removed. Since Jena does not allow the
identity of a resource to change, this is the closest approximation to a rename operation
that works.
Notes: This method does minimal checking, so renaming a resource
to its own URI is unpredictable. Furthermore, it is a general and simple approach, and
in given applications it may be possible to do this operation more efficiently. Finally,
if res
is a property, existing statements that use the property will not
be renamed, nor will occurrences of res
in other models.
old
- An existing resource in a given modeluri
- A new URI for resource old, or null to rename old to a bNode
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |