Container for collection of EasyRdf_Resources.
Located in /EasyRdf/Graph.php (line 46)
Constructor
If no URI is given then an empty graph is created.
If a URI is supplied, but no data then the data will be fetched from the URI.
The document type is optional and can be specified if it can't be guessed or got from the HTTP headers.
Add data to the graph
The resource can either be a resource or the URI of a resource.
Example: $graph->add("http://www.example.com", 'dc:title', 'Title of Page');
Add a literal value as a property of a resource
The resource can either be a resource or the URI of a resource. The value can either be a single value or an array of values.
Example: $graph->add("http://www.example.com", 'dc:title', 'Title of Page');
Add a resource as a property of another resource
The resource can either be a resource or the URI of a resource.
Example: $graph->add("http://example.com/bob", 'foaf:knows', 'http://example.com/alice');
Add one or more rdf:type properties to a resource
Get all values for a property of a resource
This method will return an empty array if the property does not exist.
Get all literal values for a property of a resource
This method will return an empty array if the resource does not has any literal values for that property.
Get all the resources in the graph of a certain type
If no resources of the type are available and empty array is returned.
Get all resources for a property of a resource
This method will return an empty array if the resource does not has any resources for that property.
Calculates the number of triples in the graph
Delete a property (or optionally just a specific value)
Return a human readable view of all the resources in the graph
This method is intended to be a debugging aid and will return a pretty-print view of all the resources and their properties.
Return a human readable view of the resource and its properties
This method is intended to be a debugging aid and will print a resource and its properties.
Get a single value for a property of a resource
If multiple values are set for a property then the value returned may be arbitrary.
If $property is an array, then the first item in the array that matches a property that exists is returned.
This method will return null if the property does not exist.
Get a single literal value for a property of a resource
If multiple values are set for a property then the value returned may be arbitrary.
This method will return null if there is not literal value for the property.
Get a single resource value for a property of a resource
If multiple values are set for a property then the value returned may be arbitrary.
This method will return null if there is not resource for the property.
Get the URI of the graph
Check to see if a property exists for a resource.
This method will return true if the property exists.
Check if the graph contains any statements
Check if a resource is of the specified type
Concatenate all values for a property of a resource into a string.
The default is to join the values together with a space character. This method will return an empty string if the property does not exist.
Get a human readable label for a resource
This method will check a number of properties for a resource (in the order: skos:prefLabel, rdfs:label, foaf:name, dc:title) and return an approriate first that is available. If no label is available then it will return null.
Load RDF data into the graph.
If a URI is supplied, but no data then the data will be fetched from the URI.
The document type is optional and can be specified if it can't be guessed or got from the HTTP headers.
Create a new blank node in the graph and return it.
If you provide an RDF type and that type is registered with the EasyRdf_TypeMapper, then the resource will be an instance of the class registered.
Create a new unique blank node identifier and return it.
Parse some RDF data into the graph object.
Get the primary topic of the graph
Get a list of all the shortened property names (qnames) for a resource.
This method will return an empty array if the resource has no properties.
Get a list of the full URIs for the properties of a resource.
This method will return an empty array if the resource has no properties.
Get or create a resource stored in a graph
If the resource did not previously exist, then a new resource will be created. If you provide an RDF type and that type is registered with the EasyRdf_TypeMapper, then the resource will be an instance of the class registered.
Get or create a resource stored in a graph
If the resource did not previously exist, then a new resource will be created. If you provide an RDF type and that type is registered with the EasyRdf_TypeMapper, then the resource will be an instance of the class registered.
If URI is null, then the URI of the graph is used.
Get an associative array of all the resources stored in the graph.
The keys of the array is the URI of the EasyRdf_Resource.
Get an arry of resources matching a certain property and value.
For example this routine could be used as a way of getting everyone who is male: $people = $graph->resourcesMatching('foaf:gender', 'male');
Get a list of the full URIs for the properties that point to a resource.
Serialise the graph into RDF
Set value(s) for a property
The new value(s) will replace the existing values for the property. The name of the property should be a string. If you set a property to null or an empty array, then the property will be deleted.
Change the rdf:type property for a resource
Note that if the resource object has already previously been created, then the PHP class of the resource will not change.
Returns the graph as a RDF/PHP associative array
Get the resource type of the graph
The type will be a shortened URI as a string. If the graph has multiple types then the type returned may be arbitrary. This method will return null if the resource has no type.
Get the resource type of the graph as a EasyRdf_Resource
If the graph has multiple types then the type returned may be arbitrary. This method will return null if the resource has no type.
Get a list of types for a resource.
The types will each be a shortened URI as a string. This method will return an empty array if the resource has no types.
If $resource is null, then it will get the types for the URI of the graph.
Magic method to return URI of resource when casted to string
Documentation generated on Wed, 20 Jul 2011 19:54:03 +0100 by phpDocumentor 1.4.3