Modified:
/trunk/simplegraph.class.php
=======================================
--- /trunk/simplegraph.class.php Mon Oct 31 09:24:47 2011
+++ /trunk/simplegraph.class.php Thu Dec 1 12:16:52 2011
@@ -737,6 +737,16 @@
}
return $ret;
}
+
+ /**
+ * Tests whether the graph knows the given resource to be of the given
type
+ * @param string s the subject of the triple, either a URI or a blank
node in the format _:name
+ * @param string t the type to check for, either a URI or a blank node
in the format _:name
+ * @return boolean true if a matching type statement exists, false
otherwise
+ */
+ function resource_is_of_type($s, $t) {
+ return has_resource_triple($s, $this->_ns['rdf'].'type', $t);
+ }
/**
* Tests whether the graph contains the given triple
@@ -1357,6 +1367,18 @@
}
return $array;
}
+
+ function get_list_value($list_head) {
+ $values = array();
+ do {
+ $found = $this->get_subject_property_values($list_head,
$this->_ns['rdf'].'first');
+ if (count($found) != 1) { throw new Exception("${list_head} had more
than 'first' property"); }
+ $values[] = $found[0];
+ $next = $this->get_subject_property_values($list_head,
$this->_ns['rdf'].'next');
+ if (count($next) != 1) { throw new Exception("${list_head} had more
than 'next' property"); }
+ } while ($list_head = $next[0]['value'] != $this->_ns['rdf'].'nil');
+ return $values;
+ }
function get_sequence_values($sequenceUri) {
$triples = $this->get_index();