/** * Returns an OntModel. * $modelType has to be one of the following constants: * MEMMODEL, DBMODEL, INFMODELF, INFMODELB to create a OntModel * with a new model from defined type. * $vocabulary defines the ontology language. Currently only * RDFS_VOCABULARY is supported. You can supply a model base URI. * * @param constant $modelType * @param constant $vocabulary * @param string $baseURI * @return object OntModel * @access public */ function &getOntModel($modelType, $vocabulary, $baseURI = null) { switch ($modelType) { case DBMODEL: $baseModel = ModelFactory::getDefaultDbModel($baseURI); break; case INFMODELF: $baseModel = ModelFactory::getInfModelF($baseURI); break; case INFMODELB: $baseModel = ModelFactory::getInfModelB($baseURI); break; default: $baseModel = ModelFactory::getMemModel($baseURI); } return ModelFactory::getOntModelForBaseModel($baseModel, $vocabulary); }
<?php define("RDFAPI_INCLUDE_DIR", "../rdfapi-php/api_noSVN/"); include RDFAPI_INCLUDE_DIR . "RdfAPI.php"; require_once RDFAPI_INCLUDE_DIR . 'model/MemModel.php'; require_once RDFAPI_INCLUDE_DIR . 'infModel/InfModel.php'; require_once RDFAPI_INCLUDE_DIR . 'infModel/InfRule.php'; require_once RDFAPI_INCLUDE_DIR . 'infModel/InfStatement.php'; //create a InfmodelF $infModel = ModelFactory::getInfModelF('http://InfModelF.org'); // Load and parse document, posibilities: rdf, n3, nt $infModel->load("../../resources/hello.rdf", "n3"); // Print and save results $infModel->writeAsHtmlTable(); $infModel->saveAs("../../resources/hello_rap_inf.xml");