info.sswap.api.model
Interface SSWAPDocument

All Superinterfaces:
SSWAPModel
All Known Subinterfaces:
PDG, RDG, RIG, RQG, RRG, SourceModel, SSWAPProtocol
All Known Implementing Classes:
PDGImpl, ProtocolImpl, RDGImpl, RIGImpl, RQGImpl, RRGImpl, SourceModelImpl

public interface SSWAPDocument
extends SSWAPModel

Represents a document in SSWAP that holds RDF content, such as may be hosted on the web (e.g., an RDG). A SSWAPDocument may contain elements such as individuals and properties, or define types or predicates. Instances of SSWAPDocuments can be read or created by the main SSWAP class.

Author:
Blazej Bulka
See Also:
SSWAP, SSWAPElement

Method Summary
 SSWAPDatatype createAnonymousDatatype()
          Creates an anonymous SSWAPDatatype
 SSWAPType createAnonymousType()
          Creates anonymous type.
 SSWAPIndividual createIndividual()
          Creates an anonymous SSWAPIndividual (blank node).
 SSWAPIndividual createIndividual(java.net.URI uri)
          Creates a SSWAPIndividual representation of a specific resource (URI).
 SSWAPType createIntersectionOf(java.util.Collection<SSWAPType> types)
          Creates a SSWAPType in the specified model that is an intersection of the given types.
 SSWAPList createList()
          Creates an empty list.
 SSWAPLiteral createLiteral(java.lang.String value)
          Creates a literal with the specified value.
 SSWAPLiteral createTypedLiteral(java.lang.String value, java.net.URI datatypeURI)
          Creates a SSWAPElement that is a typed literal with the specified value.
 SSWAPType createUnionOf(java.util.Collection<SSWAPType> types)
          Creates a SSWAPType in the specified model that is a union of the given types.
 SSWAPDatatype getDatatype(java.net.URI uri)
          Gets a named datatype object
 SSWAPPredicate getPredicate(java.net.URI uri)
          Gets a SSWAPPredicate object for the given property URI.
 SSWAPType getType(java.net.URI uri)
          Gets a SSWAPType for an URI.
<T extends SSWAPIndividual>
T
newIndividual(T sourceIndividual)
          Creates a new, anonymous individual, and populates it with data from the sourceIndividual (essentially clones the source individual).
<T extends SSWAPIndividual>
T
newIndividual(T sourceIndividual, java.net.URI targetURI)
          Copies the data from the sourceIndividual into the individual whose URI is passed as targetURI.
 
Methods inherited from interface info.sswap.api.model.SSWAPModel
addImport, checkProfile, dereference, dereference, doClosure, getDocument, getImports, getInputStream, getNsPrefixMap, getReasoningService, getTypeSignature, getURI, isDereferenced, removeImport, removeNsPrefix, serialize, serialize, setNsPrefix, validate
 

Method Detail

getType

SSWAPType getType(java.net.URI uri)
Gets a SSWAPType for an URI.

Parameters:
uri - the URI of the type
Returns:
a SSWAPType for the URI.

createAnonymousType

SSWAPType createAnonymousType()
Creates anonymous type.

Returns:
an anonymous type

createIndividual

SSWAPIndividual createIndividual()
Creates an anonymous SSWAPIndividual (blank node). This method can be used to create a custom individual (i.e., other than the SSWAPNodes like Subject, Object, Resource etc.)

Returns:
the created individual

createIndividual

SSWAPIndividual createIndividual(java.net.URI uri)
Creates a SSWAPIndividual representation of a specific resource (URI). This method can be used to create a custom individual (i.e., other than the SSWAPNodes like Subject, Object, Resource etc.)

Parameters:
uri - the URI of the individual to be created; may be null, in which case an anonymous individual is created
Returns:
the created individual

createList

SSWAPList createList()
Creates an empty list.

Returns:
a list.

createLiteral

SSWAPLiteral createLiteral(java.lang.String value)
Creates a literal with the specified value.

Parameters:
value - the value of the literal
Returns:
the created literal

createTypedLiteral

SSWAPLiteral createTypedLiteral(java.lang.String value,
                                java.net.URI datatypeURI)
                                throws java.lang.IllegalArgumentException
Creates a SSWAPElement that is a typed literal with the specified value.

Parameters:
value - the value of the literal
datatypeURI - the URI of the datatype
Returns:
the created typed literal
Throws:
java.lang.IllegalArgumentException - if the value is not valid according to the declared datatype URI

createIntersectionOf

SSWAPType createIntersectionOf(java.util.Collection<SSWAPType> types)
Creates a SSWAPType in the specified model that is an intersection of the given types.

Parameters:
types - the types
Returns:
an anonymous type that is an intersection of the the passed types

createUnionOf

SSWAPType createUnionOf(java.util.Collection<SSWAPType> types)
Creates a SSWAPType in the specified model that is a union of the given types.

Parameters:
types - the types
Returns:
an anonymous type that is a union of the given types.

getPredicate

SSWAPPredicate getPredicate(java.net.URI uri)
Gets a SSWAPPredicate object for the given property URI. A non-dereferencable URI will "create" a predicate.

Parameters:
uri - the URI of the property
Returns:
the SSWAPPredicate object

createAnonymousDatatype

SSWAPDatatype createAnonymousDatatype()
Creates an anonymous SSWAPDatatype

Returns:
the datatype

getDatatype

SSWAPDatatype getDatatype(java.net.URI uri)
Gets a named datatype object

Parameters:
uri - the URI of the datatype
Returns:
the datatype

newIndividual

<T extends SSWAPIndividual> T newIndividual(T sourceIndividual)
                                        throws java.lang.IllegalArgumentException
Creates a new, anonymous individual, and populates it with data from the sourceIndividual (essentially clones the source individual). This method is equivalent to newIndividual(sourceIndividual,null);

Type Parameters:
T - the type of the individual
Parameters:
sourceIndividual - the individual to be used as a source of data for populating the new individual
Returns:
a clone of the individual (an anonymous individual)
Throws:
java.lang.IllegalArgumentException - on an attempt to copy a SSWAPNode into a generic SSWAPDocument that is not a SSWAPProtocol document
See Also:
newIndividual(SSWAPIndividual, URI)

newIndividual

<T extends SSWAPIndividual> T newIndividual(T sourceIndividual,
                                            java.net.URI targetURI)
                                        throws java.lang.IllegalArgumentException
Copies the data from the sourceIndividual into the individual whose URI is passed as targetURI. If there is not yet an individual with such a URI, it is created. If targetURI is null, an anonymous individual is created.

Notes:

  1. The copy of the sourceIndividual is a deep copy; i.e., if there are any object properties with anonymous individuals as values, a deep copy is performed on those individuals recursively. If there are any object properties with named individuals as values, those named individual are not copied.
  2. The data being copied includes only types of the individual ( SSWAPType) and its properties (SSWAPProperty). In particular, associations with SSWAPNodes are not copied (e.g., if a SSWAPSubject is being copied, the copy will not contain references to SSWAPObjects or SSWAPGraphs; if desired, these must be made explicitly).
  3. Copying across documents is supported (i.e., passing an individual from a different SSWAPDocument to this method) -- a deep copy will be made across the documents, including named individuals. The restriction specified in (2) still holds (i.e., references to SSWAPNodes are not copied across documents).
  4. SSWAPNodes (e.g., SSWAPResource, SSWAPSubject, SSWAPObject) are supported only in SSWAPProtocol documents (e.g., RDG, RIG, RRG, RQG). An attempt to copy them into a generic SSWAPDocument (e.g., a document containing a definition of SSWAPType or owl:Class) throws an IllegalArgumentException.
  5. Copying types and properties from one individual to another can create logical inconsistencies. The usual precautions when adding types and properties should be observed.

Type Parameters:
T - the type of the individual
Parameters:
sourceIndividual - the individual with the data to be copied
targetURI - the URI of the new individual; may be null for an anonymous individual
Returns:
new individual (with the specified uri)
Throws:
java.lang.IllegalArgumentException - on an attempt to copy a SSWAPNode into a generic SSWAPDocument that is not a SSWAPProtocol document


Copyright (c) 2011, iPlant Collaborative, University of Arizona, Cold Spring Harbor Laboratories, University of Texas at Austin.