public Label getUriLabel(String uri) { return getResourceLabel(ontModel.getResource(uri)); }
/** * Gets {@link BridgeDefinitions} instance from specified {@link OntModel}. * * @param ontModel * ontology model from which the bridge definitions will be extracted * @return */ public static BridgeDefinitions getBridgeDefinitions(OntModel ontModel) { Resource r = ontModel.getResource(CMSAdapterVocabulary.BRIDGE_DEFINITIONS_RES.getURI()); try { String bridgeStr = r.getProperty(CMSAdapterVocabulary.BRIDGE_DEFINITIONS_CONTENT_PROP) .getString(); return MappingModelParser.deserializeObject(bridgeStr); } catch (Exception e) { return null; } }
public void testListProperty() { System.out.println("--------ListProperty-------\n"); String uri = "http://geni-orca.renci.org/owl/ben.rdf#Renci/Cisco/6509"; Resource rs = ontProcessor.getOntModel().getResource(uri); StmtIterator stit = rs.listProperties(ontProcessor.hasSwitchMatrix); while (stit != null && stit.hasNext()) { Statement st = stit.nextStatement(); System.out.println(st); } }
public OntClass addGroupTypeToOntModel(OntModel ontmodel, String groupType) { OntClass groupTypeRes = ontmodel.createClass(GINCO.getResource( groupType).getURI()); groupTypeRes.addLabel(ontmodel.createLiteral(GINCO.getResource( groupType).getLocalName())); groupTypeRes.addSuperClass(ontmodel.getResource(ISOTHES.CONCEPT_GROUP .getURI())); return groupTypeRes; }
@SuppressWarnings("static-access") public void testGetLayer() { System.out.println("--------GetLayer-------\n"); String uri = "http://geni-orca.renci.org/owl/ben-dtn.rdf#Duke/Infinera/DTN/fB/1/ocgB/1"; System.out.println(ontProcessor.getOntModel().getResource(uri).getLocalName()); ResultSet results = ontProcessor.getLayer(ontProcessor.getOntModel(), uri); String layerName = null; String varName = (String) results.getResultVars().get(0); while (results.hasNext()) { layerName = results.nextSolution().getResource(varName).getLocalName(); System.out.println(layerName); } assertTrue(layerName != null); }
/** * Gets {@link BridgeDefinitions} instance from specified {@link OntModel}. * * @param ontModel * @return */ public static ConnectionInfo getConnectionInfo(OntModel ontModel) { ObjectFactory of = new ObjectFactory(); ConnectionInfo ci = null; Resource ciResource = ontModel.getResource(CMSAdapterVocabulary.CONNECTION_INFO_RES.getURI()); try { ci = of.createConnectionInfo(); ci.setConnectionType(ciResource.getProperty(CMSAdapterVocabulary.CONNECTION_TYPE_PROP) .getString()); ci.setPassword(ciResource.getProperty(CMSAdapterVocabulary.CONNECTION_PASSWORD_PROP).getString()); ci.setUsername(ciResource.getProperty(CMSAdapterVocabulary.CONNECTION_USERNAME_PROP).getString()); ci.setWorkspaceName(ciResource.getProperty(CMSAdapterVocabulary.CONNECTION_WORKSPACE_PROP) .getString()); ci.setRepositoryURL(ciResource.getProperty(CMSAdapterVocabulary.CONNECTION_WORKSPACE_URL_PROP) .getString()); } catch (Exception e) { log.warn("Failed to get connection info from ont model"); return null; } return ci; }