/** * Creates ordinal RDF resource out of an integer. * * @param Integer $num * @return object Resource * @access public */ function createOrd($num) { return RDF_Resource::factory(RDF_NAMESPACE_URI . '_' . $num); }
/** * Convert an MDB result to a memory Model. * * Every successful database query returns an MDB result * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! * !!! This method can only be applied to a result with row arrays * !!! containing a representation of the database table: statements, * !!! with an index corresponding to following table columns: * !!! [0] - subject, [1] - predicate, [2] - object, [3] - l_language, * !!! [4] - l_datatype, [5] - subject_is, [6] - object_is * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! * * @param ressource MDB Result * @return object Model_Memory * @access private */ function _convertRecordSetToMemModel($result) { $res =& new RDF_Model_Memory($this->getBaseURI()); while (is_array($row = $this->dbConn->fetchInto($result))) { // subject if ($row[5] == 'r') { $sub =& RDF_Resource::factory($row[0]); } else { $sub =& RDF_BlankNode::factory($row[0]); } // predicate $pred =& RDF_Resource::factory($row[1]); // object if ($row[6] == 'r') { $obj =& RDF_Resource::factory($row[2]); } elseif ($row[6] == 'b') { $obj =& RDF_BlankNode::factory($row[2]); } else { $obj =& RDF_Literal::factory($row[2], $row[3]); if ($row[4]) { $obj->setDatatype($row[4]); } } $statement =& RDF_Statement::factory($sub, $pred, $obj); $res->add($statement); } $this->dbConn->freeResult($result); return $res; }
// ---------------------------------------------------------------------------------- // Dublin Core Vocabulary // ---------------------------------------------------------------------------------- // Version : 0.4 // Authors : Chris Bizer (chris@bizer.de) // Description : Wrapper, defining resources for all terms of the Dublin // Core Vocabulary. For details about DC see: http://dublincore.org/ // Using the wrapper allows you to define all aspects of // the vocabulary in one spot, simplifing implementation and // maintainence. Working with the vocabulary, you should use // these resources as shortcuts in your code. // // define DC namespace define('RDF_DC_NS', 'http://purl.org/dc/elements/1.0/'); // DC concepts $DC_contributor =& RDF_Resource::factory(RDF_DC_NS . 'contributor'); $DC_coverage =& RDF_Resource::factory(RDF_DC_NS . 'coverage'); $DC_creator =& RDF_Resource::factory(RDF_DC_NS . 'creator'); $DC_date =& RDF_Resource::factory(RDF_DC_NS . 'date'); $DC_description =& RDF_Resource::factory(RDF_DC_NS . 'description'); $DC_format =& RDF_Resource::factory(RDF_DC_NS . 'format'); $DC_identifier =& RDF_Resource::factory(RDF_DC_NS . 'identifier'); $DC_language =& RDF_Resource::factory(RDF_DC_NS . 'language'); $DC_publisher =& RDF_Resource::factory(RDF_DC_NS . 'publisher'); $DC_rights =& RDF_Resource::factory(RDF_DC_NS . 'rights'); $DC_source =& RDF_Resource::factory(RDF_DC_NS . 'source'); $DC_subject =& RDF_Resource::factory(RDF_DC_NS . 'subject'); $DC_title =& RDF_Resource::factory(RDF_DC_NS . 'title'); $DC_type =& RDF_Resource::factory(RDF_DC_NS . 'type');
/** * Adds a new statement to the model * This method is called by generateModel(). * * @access private * @param string &$user_data * @param string $subject_type * @param string $subject * @param string $predicate * @param string $ordinal * @param string $object_type * @param string $object * @param string $xml_lang ) * @return object Model_Memory */ function add_statement_to_model(&$user_data, $subject_type, $subject, $predicate, $ordinal, $object_type, $object, $xml_lang, $datatype) { // create subject if ($subject_type == RDF_SUBJECT_TYPE_BNODE) { $objsub =& RDF_BlankNode::factory($subject); } else { $objsub =& RDF_Resource::factory($subject); } // create predicate $objpred =& RDF_Resource::factory($predicate); // create object if ($object_type == RDF_OBJECT_TYPE_RESOURCE || $object_type == RDF_OBJECT_TYPE_BNODE) { if ($object_type == RDF_OBJECT_TYPE_BNODE) { $objobj =& RDF_BlankNode::factory($object); } else { $objobj =& RDF_Resource::factory($object); } } else { $objobj =& RDF_Literal::factory($object); if ($datatype != '') { $objobj->setDatatype($datatype); } elseif ($xml_lang != "") { $objobj->setLanguage($xml_lang); } } // create statement $statement =& RDF_Statement::factory($objsub, $objpred, $objobj); // add statement to model $this->model->add($statement); }
// these resources as shortcuts in your code. // // RDF concepts (constants are defined in constants.php) $RDF_Alt =& RDF_Resource::factory(RDF_NAMESPACE_URI . RDF_ALT); $RDF_Bag =& RDF_Resource::factory(RDF_NAMESPACE_URI . RDF_BAG); $RDF_Property =& RDF_Resource::factory(RDF_NAMESPACE_URI . RDF_PROPERTY); $RDF_Seq =& RDF_Resource::factory(RDF_NAMESPACE_URI . RDF_SEQ); $RDF_Statement =& RDF_Resource::factory(RDF_NAMESPACE_URI . RDF_STATEMENT); $RDF_List =& RDF_Resource::factory(RDF_NAMESPACE_URI . RDF_LIST); $RDF_nil =& RDF_Resource::factory(RDF_NAMESPACE_URI . RDF_NIL); $RDF_type =& RDF_Resource::factory(RDF_NAMESPACE_URI . RDF_TYPE); $RDF_rest =& RDF_Resource::factory(RDF_NAMESPACE_URI . RDF_REST); $RDF_first =& RDF_Resource::factory(RDF_NAMESPACE_URI . RDF_FIRST); $RDF_subject =& RDF_Resource::factory(RDF_NAMESPACE_URI . RDF_SUBJECT); $RDF_predicate =& RDF_Resource::factory(RDF_NAMESPACE_URI . RDF_PREDICATE); $RDF_object =& RDF_Resource::factory(RDF_NAMESPACE_URI . RDF_OBJECT); $RDF_Description =& RDF_Resource::factory(RDF_NAMESPACE_URI . RDF_DESCRIPTION); $RDF_ID =& RDF_Resource::factory(RDF_NAMESPACE_URI . RDF_ID); $RDF_about =& RDF_Resource::factory(RDF_NAMESPACE_URI . RDF_ABOUT); $RDF_aboutEach =& RDF_Resource::factory(RDF_NAMESPACE_URI . RDF_ABOUT_EACH); $RDF_aboutEachPrefix =& RDF_Resource::factory(RDF_NAMESPACE_URI . RDF_ABOUT_EACH_PREFIX); $RDF_bagID =& RDF_Resource::factory(RDF_NAMESPACE_URI . RDF_BAG_ID); $RDF_resource =& RDF_Resource::factory(RDF_NAMESPACE_URI . RDF_RESOURCE); $RDF_parseType =& RDF_Resource::factory(RDF_NAMESPACE_URI . RDF_PARSE_TYPE); $RDF_Literal =& RDF_Resource::factory(RDF_NAMESPACE_URI . RDF_PARSE_TYPE_LITERAL); $RDF_Resource =& RDF_Resource::factory(RDF_NAMESPACE_URI . RDF_PARSE_TYPE_RESOURCE); $RDF_li =& RDF_Resource::factory(RDF_NAMESPACE_URI . RDF_LI); $RDF_nodeID =& RDF_Resource::factory(RDF_NAMESPACE_URI . RDF_NODEID); $RDF_datatype =& RDF_Resource::factory(RDF_NAMESPACE_URI . RDF_DATATYPE); $RDF_seeAlso =& RDF_Resource::factory(RDF_NAMESPACE_URI . RDF_SEEALSO);
/** * Reifies a statement. * Returns a new Model_Memory that is the reification of the statement. * For naming the statement's bNode a Model or bNodeID must be passed to the method. * * @access public * @param mixed &$model_or_bNodeID * @return object model */ function &reify(&$model_or_bNodeID) { if (is_a($model_or_bNodeID, 'RDF_Model_Memory')) { // parameter is model $statementModel =& new RDF_Model_Memory($model_or_bNodeID->getBaseURI()); $thisStatement =& RDF_BlankNode::factory($model_or_bNodeID); } else { // parameter is bNodeID $statementModel =& new RDF_Model_Memory(); $thisStatement =& RDF_BlankNode::factory($model_or_bNodeID); } $RDFstatement =& RDF_Resource::factory(RDF_NAMESPACE_URI . RDF_STATEMENT); $RDFtype =& RDF_Resource::factory(RDF_NAMESPACE_URI . RDF_TYPE); $RDFsubject =& RDF_Resource::factory(RDF_NAMESPACE_URI . RDF_SUBJECT); $RDFpredicate =& RDF_Resource::factory(RDF_NAMESPACE_URI . RDF_PREDICATE); $RDFobject =& RDF_Resource::factory(RDF_NAMESPACE_URI . RDF_OBJECT); $statementModel->add(RDF_Statement::factory($thisStatement, $RDFtype, $RDFstatement)); $statementModel->add(RDF_Statement::factory($thisStatement, $RDFsubject, $this->getSubject())); $statementModel->add(RDF_Statement::factory($thisStatement, $RDFpredicate, $this->getPredicate())); $statementModel->add(RDF_Statement::factory($thisStatement, $RDFobject, $this->getObject())); return $statementModel; }
$VCARD_Pcode =& RDF_Resource::factory(RDF_VCARD_NS . 'Pcode'); $VCARD_Prefix =& RDF_Resource::factory(RDF_VCARD_NS . 'Prefix'); $VCARD_PHOTO =& RDF_Resource::factory(RDF_VCARD_NS . 'PHOTO'); $VCARD_FN =& RDF_Resource::factory(RDF_VCARD_NS . 'FN'); $VCARD_Suffix =& RDF_Resource::factory(RDF_VCARD_NS . 'Suffix'); $VCARD_CLASS =& RDF_Resource::factory(RDF_VCARD_NS . 'CLASS'); $VCARD_ADR =& RDF_Resource::factory(RDF_VCARD_NS . 'ADR'); $VCARD_Region =& RDF_Resource::factory(RDF_VCARD_NS . 'Region'); $VCARD_GEO =& RDF_Resource::factory(RDF_VCARD_NS . 'GEO'); $VCARD_Extadd =& RDF_Resource::factory(RDF_VCARD_NS . 'Extadd'); $VCARD_GROUP =& RDF_Resource::factory(RDF_VCARD_NS . 'GROUP'); $VCARD_EMAIL =& RDF_Resource::factory(RDF_VCARD_NS . 'EMAIL'); $VCARD_Family =& RDF_Resource::factory(RDF_VCARD_NS . 'Family'); $VCARD_TZ =& RDF_Resource::factory(RDF_VCARD_NS . 'TZ'); $VCARD_NAME =& RDF_Resource::factory(RDF_VCARD_NS . 'NAME'); $VCARD_Orgunit =& RDF_Resource::factory(RDF_VCARD_NS . 'Orgunit'); $VCARD_Country =& RDF_Resource::factory(RDF_VCARD_NS . 'Country'); $VCARD_SOUND =& RDF_Resource::factory(RDF_VCARD_NS . 'SOUND'); $VCARD_TITLE =& RDF_Resource::factory(RDF_VCARD_NS . 'TITLE'); $VCARD_MAILER =& RDF_Resource::factory(RDF_VCARD_NS . 'MAILER'); $VCARD_Other =& RDF_Resource::factory(RDF_VCARD_NS . 'Other'); $VCARD_Locality =& RDF_Resource::factory(RDF_VCARD_NS . 'Locality'); $VCARD_Pobox =& RDF_Resource::factory(RDF_VCARD_NS . 'Pobox'); $VCARD_KEY =& RDF_Resource::factory(RDF_VCARD_NS . 'KEY'); $VCARD_PRODID =& RDF_Resource::factory(RDF_VCARD_NS . 'PRODID'); $VCARD_Given =& RDF_Resource::factory(RDF_VCARD_NS . 'Given'); $VCARD_LABEL =& RDF_Resource::factory(RDF_VCARD_NS . 'LABEL'); $VCARD_TEL =& RDF_Resource::factory(RDF_VCARD_NS . 'TEL'); $VCARD_NICKNAME =& RDF_Resource::factory(RDF_VCARD_NS . 'NICKNAME'); $VCARD_ROLE =& RDF_Resource::factory(RDF_VCARD_NS . 'ROLE');
// ---------------------------------------------------------------------------------- // RDF Vocabulary Description Language 1.0: RDF Schema (RDFS) Vocabulary // ---------------------------------------------------------------------------------- // Version : 0.4 // Authors : Daniel Westphal (dawe@gmx.de) // Description : Wrapper, defining resources for all terms of the // RDF Schema (RDFS). // For details about RDF see: http://www.w3.org/TR/rdf-schema/. // Using the wrapper allows you to define all aspects of // the vocabulary in one spot, simplifing implementation and // maintainence. Working with the vocabulary, you should use // these resources as shortcuts in your code. // // RDFS concepts $RDFS_Resource =& RDF_Resource::factory(RDF_SCHEMA_URI . 'Resource'); $RDFS_Literal =& RDF_Resource::factory(RDF_SCHEMA_URI . 'Literal'); $RDFS_Class =& RDF_Resource::factory(RDF_SCHEMA_URI . 'Class'); $RDFS_Datatype =& RDF_Resource::factory(RDF_SCHEMA_URI . 'Datatype'); $RDFS_Container =& RDF_Resource::factory(RDF_SCHEMA_URI . 'Container'); $RDFS_ContainerMembershipProperty =& RDF_Resource::factory(RDF_SCHEMA_URI . 'ContainerMembershipProperty'); $RDFS_subClassOf =& RDF_Resource::factory(RDF_SCHEMA_URI . 'subClassOf'); $RDFS_subPropertyOf =& RDF_Resource::factory(RDF_SCHEMA_URI . 'subPropertyOf'); $RDFS_domain =& RDF_Resource::factory(RDF_SCHEMA_URI . 'domain'); $RDFS_range =& RDF_Resource::factory(RDF_SCHEMA_URI . 'range'); $RDFS_label =& RDF_Resource::factory(RDF_SCHEMA_URI . 'label'); $RDFS_comment =& RDF_Resource::factory(RDF_SCHEMA_URI . 'comment'); $RDFS_member =& RDF_Resource::factory(RDF_SCHEMA_URI . 'member'); $RDFS_seeAlso =& RDF_Resource::factory(RDF_SCHEMA_URI . 'seeAlso'); $RDFS_isDefinedBy =& RDF_Resource::factory(RDF_SCHEMA_URI . 'isDefinedBy');