org.mindswap.rdfparser.rdf
Class RDFResource

java.lang.Object
  |
  +--org.mindswap.rdfparser.rdf.RDFResource
All Implemented Interfaces:
java.lang.Cloneable, RDFConsts, java.io.Serializable
Direct Known Subclasses:
DAMLResource, RDFClass, RDFProperty, RDFResourceTag

public abstract class RDFResource
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable, RDFConsts

See Also:
Serialized Form

Fields inherited from interface org.mindswap.rdfparser.consts.RDFConsts
OLD_DAMLURL, RDF, RDF_About, RDF_AboutEach, RDF_AboutEachPrefix, RDF_Alt, RDF_Bag, RDF_BagID, RDF_Class, RDF_Comment, RDF_ConstraintProperty, RDF_Description, RDF_Domain, RDF_First, RDF_ID, RDF_IsDefinedBy, RDF_Label, RDF_Li, RDF_Nil, RDF_NodeID, RDF_Object, RDF_ParseType, RDF_Predicate, RDF_Property, RDF_Range, RDF_Resource, RDF_Rest, RDF_SeeAlso, RDF_Seq, RDF_SubClass, RDF_Subject, RDF_SubProperty, RDF_TERMS, RDF_Type, RDF_Value, RDFSURL, RDFURL
 
Constructor Summary
RDFResource()
           
RDFResource(java.lang.String s)
           
 
Method Summary
 void addAttribute(java.lang.String key, java.lang.String value)
          Adds an attribute with specified name and value to this resource.

 void addAttributes(AttributeList list)
          Adds all attributes in the list to this resource.

 void addEquivalentTo(java.lang.String s)
          Adds the id of an equivalent resource to the list of equivalent resources.

 void addNode(RDFResource r)
          Adds a single resource node.

 void addNodes(RDFResourceList l)
          Adds all nodes in the list to this resource.

 java.lang.Object clone()
          Makes a copy of this object.

 boolean equals(java.lang.Object obj)
          Compares to resources for equivalence.

 java.lang.String getAttributeByName(java.lang.String name)
          Returns the value of a specific attribute.

 AttributeList getAttributes()
          Gets the attributes associated with this resource.

 java.lang.String getComment()
          Returns the comment associated with this resource.

 java.util.Vector getEquivalentTos()
          Returns this list of resources this resource is equivalent to.

 java.lang.String getFriendlyId()
          Returns the friendly id (no url, just name) of this resource.

 java.lang.String getFriendlyType()
          Returns the friendly type (no URI) of the resource.

 java.lang.String getId()
          Returns the id of this resource.

 java.lang.String getLabel()
          Returns the label associated with this resource.

 RDFResourceList getNodes()
          Returns all child nodes of this resource.

 org.mindswap.n3.ntriples.NTripleList getNTriples()
          Return a list of NTriples that are equivalent to this resource.

abstract  org.mindswap.n3.ntriples.NTripleList getNTriples(Namespaces ns)
          Return a list of NTriples that are equivalent to this resource.

abstract  org.mindswap.n3.ntriples.NTripleList getNTriples(java.lang.String subject, Namespaces ns)
          Return a list of NTriples that are equivalent to this resource.

 RDFResourceList getResourceByType(java.lang.String type)
          Returns a list of all child resources associated with this resource with the specified type.

 java.util.Vector getTriples(Namespaces ns)
          Return a list of generic Triples that are equivalent to this resource.

 java.util.Vector getTriples(java.lang.String subject, Namespaces ns)
          Return a list of generic Triples that are equivalent to this resource.

abstract  java.lang.String getType()
          Returns the type of this object as a string.

 java.lang.String getURI()
          Returns the URI to the file where this resource is located.

 void removeEquivalentTo(java.lang.String s)
          Removes the id of an equivalent resource from the list of equivalent resources.

 void setAttributes(AttributeList a)
          Sets the attributes associted with this resource.

 void setComment(java.lang.String c)
          Sets the comment associated with this resource.

 void setEquivalentTos(java.util.Vector v)
          Sets the list of equivalent resource.

 void setId(java.lang.String s)
          Sets the Id of this resource.

 void setLabel(java.lang.String l)
          Sets the label associated with this resource.

 java.lang.String toRDF()
          Returns the RDF representation of this class as a String

 java.lang.String toRDF(Namespaces ns)
          Returns the RDF representation of this class as a String

abstract  java.lang.String toRDF(Namespaces ns, int ind)
          Returns the RDF representation of this class as a String

 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RDFResource

public RDFResource()

RDFResource

public RDFResource(java.lang.String s)
Method Detail

getNodes

public RDFResourceList getNodes()
Returns all child nodes of this resource.

Returns:
A list of all child nodes

addNodes

public void addNodes(RDFResourceList l)
Adds all nodes in the list to this resource.

Parameters:
xti - A list of nodes to add
See Also:
addNode(org.mindswap.rdfparser.rdf.RDFResource)

addNode

public void addNode(RDFResource r)
Adds a single resource node.

Parameters:
r - Resource to add

addAttribute

public void addAttribute(java.lang.String key,
                         java.lang.String value)
Adds an attribute with specified name and value to this resource.

Parameters:
key - Attribute name
value - Attribute value

addAttributes

public void addAttributes(AttributeList list)
Adds all attributes in the list to this resource.

Parameters:
list - A list of attributes to add
See Also:
addAttribute(java.lang.String, java.lang.String)

clone

public java.lang.Object clone()
Makes a copy of this object.

Returns:
A copy of this object

setId

public void setId(java.lang.String s)
Sets the Id of this resource.

Parameters:
s - the new id

getId

public java.lang.String getId()
Returns the id of this resource.

Returns:
Id string, or null if no id

getFriendlyId

public java.lang.String getFriendlyId()
Returns the friendly id (no url, just name) of this resource.

Returns:
friendly id as a string, or null if id is not set

setComment

public void setComment(java.lang.String c)
Sets the comment associated with this resource.

Parameters:
c - the new comment

getComment

public java.lang.String getComment()
Returns the comment associated with this resource.

Returns:
the comment

getLabel

public java.lang.String getLabel()
Returns the label associated with this resource.

Returns:
the label

setLabel

public void setLabel(java.lang.String l)
Sets the label associated with this resource.

Parameters:
l - the new label

getURI

public java.lang.String getURI()
Returns the URI to the file where this resource is located.

Returns:
the URI as a string, or null if none specified

getType

public abstract java.lang.String getType()
Returns the type of this object as a string.

Returns:
the object's type
See Also:
XMLConsts, RDFConsts, DAMLConsts, OWLConsts

getFriendlyType

public java.lang.String getFriendlyType()
Returns the friendly type (no URI) of the resource.

Returns:
the friendly type of the resource or null if no type specified
See Also:
getType()

equals

public boolean equals(java.lang.Object obj)
Compares to resources for equivalence.

Overrides:
equals in class java.lang.Object
Returns:
true of the resources are equal, false otherwise

setAttributes

public void setAttributes(AttributeList a)
Sets the attributes associted with this resource.

Parameters:
a - New set of Attributes

getAttributes

public AttributeList getAttributes()
Gets the attributes associated with this resource.

Returns:
The resource's attributes

getAttributeByName

public java.lang.String getAttributeByName(java.lang.String name)
Returns the value of a specific attribute.

Parameters:
name - Name of attribute to search for
Returns:
The value of the attribute, or null if it does not exist

getResourceByType

public RDFResourceList getResourceByType(java.lang.String type)
Returns a list of all child resources associated with this resource with the specified type.

Parameters:
xti - The type to search for
Returns:
A list of all resources of the specifed type

getEquivalentTos

public java.util.Vector getEquivalentTos()
Returns this list of resources this resource is equivalent to.

Returns:
A vector of string id's of equivalent resources.

addEquivalentTo

public void addEquivalentTo(java.lang.String s)
Adds the id of an equivalent resource to the list of equivalent resources.

Parameters:
xti - Id of equivalent resource

removeEquivalentTo

public void removeEquivalentTo(java.lang.String s)
Removes the id of an equivalent resource from the list of equivalent resources.

Parameters:
xti - Id of equivalent resource

setEquivalentTos

public void setEquivalentTos(java.util.Vector v)
Sets the list of equivalent resource.

Parameters:
xti - list of id's of equivalent resources

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

toRDF

public java.lang.String toRDF()
Returns the RDF representation of this class as a String

Returns:
The string RDF representation
See Also:
toRDF(org.mindswap.xmlparser.Namespaces), toRDF(org.mindswap.xmlparser.Namespaces,int)

toRDF

public java.lang.String toRDF(Namespaces ns)
Returns the RDF representation of this class as a String

Returns:
The string RDF representation
See Also:
toRDF(), toRDF(org.mindswap.xmlparser.Namespaces,int)

toRDF

public abstract java.lang.String toRDF(Namespaces ns,
                                       int ind)
Returns the RDF representation of this class as a String

Returns:
The string RDF representation
See Also:
toRDF(), toRDF(org.mindswap.xmlparser.Namespaces)

getNTriples

public org.mindswap.n3.ntriples.NTripleList getNTriples()
Return a list of NTriples that are equivalent to this resource.

Returns:
The NTriples that correspond to this resource
See Also:
getNTriples(org.mindswap.xmlparser.Namespaces), getNTriples(String, org.mindswap.xmlparser.Namespaces)

getNTriples

public abstract org.mindswap.n3.ntriples.NTripleList getNTriples(Namespaces ns)
Return a list of NTriples that are equivalent to this resource.

Returns:
The NTriples that correspond to this resource
See Also:
getNTriples(), getNTriples(String, org.mindswap.xmlparser.Namespaces)

getNTriples

public abstract org.mindswap.n3.ntriples.NTripleList getNTriples(java.lang.String subject,
                                                                 Namespaces ns)
Return a list of NTriples that are equivalent to this resource.

Returns:
The NTriples that correspond to this resource
See Also:
getNTriples(), getNTriples(org.mindswap.xmlparser.Namespaces)

getTriples

public java.util.Vector getTriples(Namespaces ns)
Return a list of generic Triples that are equivalent to this resource.

Returns:
Triples that correspond to this resource
See Also:
getTriples(String, org.mindswap.xmlparser.Namespaces)

getTriples

public java.util.Vector getTriples(java.lang.String subject,
                                   Namespaces ns)
Return a list of generic Triples that are equivalent to this resource.

Returns:
Triples that correspond to this resource
See Also:
getTriples(org.mindswap.xmlparser.Namespaces)