RedlandSerializer Class Reference
Inherits from | RedlandWrappedObject : NSObject |
Declared in | RedlandSerializer.h RedlandSerializer.m |
Overview
A serializer turns a RedlandModel into a serialized format like RDF/XML or NTriples.
Wraps librdf_serializer. It seems you should use a new serializer for every model that you want to serialize because of namespace caching (see issue #18 on redland’s bugtracker: http://bugs.librdf.org/mantis/view.php?id=18))
A category to add convenience methods to the Redland serializer.
RedlandSerializer(Convenience)
Tasks
Other Methods
-
+ serializerWithName:
Returns an autoreleased RedlandSerializer initialized using initWithName:.
-
+ serializerWithName:mimeType:typeURI:
Convenience method which returns an autoreleased RedlandSerializer initialized using initWithName:mimeType:typeURI:.
-
– initWithName:
Initializes a RedlandSerializer with the given name.
-
– initWithName:mimeType:typeURI:
Creates and returns a RedlandSerializer identified by either a name, a MIME type, or a type URI.
-
– wrappedSerializer
Returns the underlying librdf_serializer of the receiver.
-
– serializeModel:toFileName:withBaseURI:
Serializes a model to a file with the specified name.
-
– serializeModel:toFile:withBaseURI:
Serializes a model to a C file handle.
-
– serializeModel:toFileHandle:withBaseURI:
Serializes a model to the given NSFileHandle.
-
– setPrefix:forNamespaceURI:
Sets a namespace/URI prefix mapping.
-
– valueOfFeature:
Returns the value of the serializer feature identified by featureURI.
-
– setValue:ofFeature:
Sets the serializer feature identified by featureURI to a new value.
NamespaceConvenience Methods
-
– addNamespace:
Adds the URI-to-prefix mapping of the specified namespace to the receiver.
Convenience Methods
-
– serializedStringFromModel:withBaseURI:
Returns a serialized string representation of a model using the given base URI.
-
– serializedDataFromModel:withBaseURI:
Returns a serialized data representation of a model using the given base URI.
Class Methods
serializerWithName:
Returns an autoreleased RedlandSerializer initialized using initWithName:.
+ (id)serializerWithName:(NSString *)factoryName
Parameters
- factoryName
The name for the serializer; use one of our Redland…SerializerName constants
Return Value
A new RedlandSerializer instance
Discussion
Returns an autoreleased RedlandSerializer initialized using initWithName:.
Declared In
RedlandSerializer.m
serializerWithName:mimeType:typeURI:
Convenience method which returns an autoreleased RedlandSerializer initialized using initWithName:mimeType:typeURI:.
+ (id)serializerWithName:(NSString *)factoryName mimeType:(NSString *)mimeType typeURI:(RedlandURI *)typeURI
Parameters
- factoryName
The name for the serializer; use one of our Redland…SerializerName constants
- mimeType
The mime-type the serializer should produce
- typeURI
type URI for the type of serialization
Return Value
A new RedlandSerializer instance
Discussion
Convenience method which returns an autoreleased RedlandSerializer initialized using initWithName:mimeType:typeURI:.
Declared In
RedlandSerializer.m
Instance Methods
addNamespace:
Adds the URI-to-prefix mapping of the specified namespace to the receiver.
- (void)addNamespace:(RedlandNamespace *)aNamespace
Discussion
Adds the URI-to-prefix mapping of the specified namespace to the receiver.
Declared In
RedlandNamespace.m
initWithName:
Initializes a RedlandSerializer with the given name.
- (id)initWithName:(NSString *)factoryName
Parameters
- factoryName
The name for the serializer; use one of our Redland…SerializerName constants
Return Value
A new RedlandSerializer instance
Discussion
Initializes a RedlandSerializer with the given name.
Declared In
RedlandSerializer.m
initWithName:mimeType:typeURI:
Creates and returns a RedlandSerializer identified by either a name, a MIME type, or a type URI.
- (id)initWithName:(NSString *)factoryName mimeType:(NSString *)mimeType typeURI:(RedlandURI *)typeURI
Parameters
- factoryName
The name for the serializer; use one of our Redland…SerializerName constants
- mimeType
The mime-type the serializer should produce
- typeURI
type URI for the type of serialization
Return Value
A new RedlandSerializer instance
Discussion
Creates and returns a RedlandSerializer identified by either a name, a MIME type, or a type URI.
Declared In
RedlandSerializer.m
serializeModel:toFile:withBaseURI:
Serializes a model to a C file handle.
- (void)serializeModel:(RedlandModel *)aModel toFile:(FILE *)file withBaseURI:(RedlandURI *)aURI
Parameters
- aModel
The model (RedlandModel instance) to serialize
- file
the C file handle
- aURI
The base-URI to use as RedlandURI
Discussion
Serializes a model to a C file handle.
Declared In
RedlandSerializer.m
serializeModel:toFileHandle:withBaseURI:
Serializes a model to the given NSFileHandle.
- (void)serializeModel:(RedlandModel *)aModel toFileHandle:(NSFileHandle *)fileHandle withBaseURI:(RedlandURI *)aURI
Parameters
- aModel
The model (RedlandModel instance) to serialize
- fileHandle
the filehandle as NSFileHandle to write to
- aURI
The base-URI to use as RedlandURI
Discussion
Serializes a model to the given NSFileHandle.
Declared In
RedlandSerializer.m
serializeModel:toFileName:withBaseURI:
Serializes a model to a file with the specified name.
- (void)serializeModel:(RedlandModel *)aModel toFileName:(NSString *)fileName withBaseURI:(RedlandURI *)aURI
Parameters
- aModel
The model (RedlandModel instance) to serialize
- fileName
the filename to write to as NSString
- aURI
The base-URI to use as RedlandURI
Discussion
Serializes a model to a file with the specified name.
Declared In
RedlandSerializer.m
serializedDataFromModel:withBaseURI:
Returns a serialized data representation of a model using the given base URI.
- (NSData *)serializedDataFromModel:(RedlandModel *)aModel withBaseURI:(RedlandURI *)baseURI
Parameters
- aModel
The model (RedlandModel instance) to serialize
- baseURI
The base-URI to use as RedlandURI
Return Value
NSData
Discussion
Returns a serialized data representation of a model using the given base URI.
Declared In
RedlandSerializer.m
serializedStringFromModel:withBaseURI:
Returns a serialized string representation of a model using the given base URI.
- (NSString *)serializedStringFromModel:(RedlandModel *)aModel withBaseURI:(RedlandURI *)baseURI
Parameters
- aModel
The model (RedlandModel instance) to serialize
- baseURI
The base-URI to use as RedlandURI
Return Value
An NSString
Discussion
Returns a serialized string representation of a model using the given base URI.
Declared In
RedlandSerializer.m
setPrefix:forNamespaceURI:
Sets a namespace/URI prefix mapping.
- (void)setPrefix:(NSString *)aPrefix forNamespaceURI:(RedlandURI *)uri
Discussion
Sets a namespace/URI prefix mapping.
Declared In
RedlandSerializer.m
setValue:ofFeature:
Sets the serializer feature identified by featureURI to a new value.
- (void)setValue:(RedlandNode *)featureValue ofFeature:(id)featureURI
Parameters
- featureValue
A RedlandNode representing the new value
- featureURI
An NSString or a RedlandURI instance
Discussion
Sets the serializer feature identified by featureURI to a new value.
Warning: Raises a RedlandException is no such feature exists.
Declared In
RedlandSerializer.m
valueOfFeature:
Returns the value of the serializer feature identified by featureURI.
- (RedlandNode *)valueOfFeature:(id)featureURI
Parameters
- featureURI
An NSString or a RedlandURI instance
Discussion
Returns the value of the serializer feature identified by featureURI.
Declared In
RedlandSerializer.m