private String getJavaName(Resource resource) { // Since java does not allow '-' replace them all with '_' return resource.getLocalName().replaceAll("-", "_"); }
/** Answer the local name of resource r mapped to upper case */ protected String getUCValueName( Resource r ) { StringBuffer buf = new StringBuffer(); String localName = r.getLocalName(); char lastChar = 0; for (int i = 0; i < localName.length(); i++) { char c = localName.charAt(i); if (Character.isLowerCase(lastChar) && Character.isUpperCase(c)) { buf.append( '_' ); } buf.append( Character.toUpperCase(c) ); lastChar = c; } return buf.toString(); }
public String getLocalName() { Resource mr = getJenaResource(); return mr.getLocalName(); }
private String resourceSpelling( Resource r ) { String shorter = nameMap.get( r.getURI() ); return shorter == null ? r.getLocalName() : shorter; }
/** * Do a reverse lookup on node type (NDL -> shortname ) */ public static String reverseNodeTypeLookup(Resource nt) { if (nt == null) return null; for (Iterator<Map.Entry<String, Pair<String>>> it = nodeTypes.entrySet().iterator(); it.hasNext();) { Map.Entry<String, Pair<String>> e = it.next(); // convert to namespace and type in a pair // WARNING: this checks only the type, not the namespace. if (nt.getLocalName().equals(e.getValue().getSecond())) return e.getKey(); } return null; }
public void ndlNetworkConnection(Resource l, OntModel om, long bandwidth, long latency, List<Resource> interfaces) { //should be sliceGraph.add... and/or manifestGraph.add... //manifest.addNetworkConnection(l.toString()); String printStr = "ndlManifest_NetworkConnection: \n\tName: " + l.toString() + " (" + l.getLocalName() + ")"; printStr += "\n\tInterfaces:"; for (Resource r : interfaces){ printStr += "\n\t\t " + r; } LIBNDL.logger().debug(printStr); } public void ndlParseComplete() {
private static void classShortname(Resource r) { r.addProperty(RDF.type, RDFS.Class ); r.addProperty(RDFS.label, r.getLocalName() ); }
public String getLabel() { Statement label = wrapped.getProperty(RDFS.label); return label == null ? wrapped.getLocalName() : label.getObject().toString(); }
protected Specimen createSpecimen(QuerySolution solution, Study study, String targetTaxon1) throws NodeFactoryException { String targetTaxon = solution.get(targetTaxon1).asResource().getLocalName(); String taxonId = targetTaxon.replaceAll("NCBITaxon_", TaxonomyProvider.NCBI.getIdPrefix()); return nodeFactory.createSpecimen(study, new TaxonImpl(null, taxonId)); }
@Test public void ensure_spellings_match_names() { assertEquals( "missingListTail", RDFUtil.Vocab.missingListTail.getLocalName() ); assertEquals( "missingListElement", RDFUtil.Vocab.missingListElement.getLocalName() ); } }
public static Model createReservedModel() { Model result = ModelFactory.createDefaultModel(); for (Resource reserved: allReservedResouces()) { result.add( reserved, API.label, reserved.getLocalName() ); result.add( reserved, RDF.type, RDF.Property ); } return result; }
/** * Process a broadcast link */ public void ndlBroadcastConnection(Resource bl, OntModel om, long bandwidth, List<Resource> interfaces) { LIBNDL.logger().debug("BroadcastConnection: " + bl); Network ol = this.sliceGraph.buildLink(bl.getLocalName()); ndlModel.mapRequestResource2ModelResource(ol, bl); ol.setBandwidth(bandwidth); //ol.setLatency(latency); ol.setLabel(NdlCommons.getLayerLabelLiteral(bl)); }
/** * Process a broadcast link */ public void ndlBroadcastConnection(Resource bl, OntModel om, long bandwidth, List<Resource> interfaces) { LIBNDL.logger().debug("BroadcastConnection: " + bl); Network ol = this.sliceGraph.buildLink(bl.getLocalName()); ndlModel.mapRequestResource2ModelResource(ol, bl); ol.setBandwidth(bandwidth); //ol.setLatency(latency); ol.setLabel(NdlCommons.getLayerLabelLiteral(bl)); }
private APIEndpointSpec getEndpoint(APISpec a, String localName) { for (APIEndpointSpec e: a.getEndpoints()) if (e.getResource().getLocalName().equals(localName)) return e; return null; } }
public String getDomain(RequestResource requestResource) { if(this.getModelResource(requestResource) instanceof com.hp.hpl.jena.rdf.model.impl.ResourceImpl){ //Special case for nodes that are already in the manifest (i.e. are instances of ResourceImpl return RequestGenerator.reverseLookupDomain(NdlCommons.getDomain(this.getModelResource(requestResource))); } //General case for regular resources return NdlCommons.getDomain((Individual)this.getModelResource(requestResource)).getLocalName(); }
@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); }
public Model exportAssociativeRelationshipRoles(Model model, OntModel ontModel) { List<AssociativeRelationshipRole> roles = associativeRelationshipRoleService .getAllAssociationTermRole(); for (AssociativeRelationshipRole role : roles) { String roleSkosLabel = role.getSkosLabel(); ObjectProperty broaderRoleProperty = ontModel .createObjectProperty(GINCO.getResourceURI(roleSkosLabel)); broaderRoleProperty.addLabel(ontModel.createLiteral(GINCO .getResource(roleSkosLabel).getLocalName())); broaderRoleProperty.addProperty(RDFS.subPropertyOf, SKOS.RELATED); } return model; } }
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; }
public APITester( Model model, ModelLoader loader ) { for (ResIterator ri = model.listSubjectsWithProperty(RDF.type, API.API); ri.hasNext();) { Resource api = ri.next(); APISpec spec = new APISpec( EldaFileManager.get(), api, loader ); specifications.put(api.getLocalName(), spec); for (APIEndpointSpec eps : spec.getEndpoints()) { APIEndpoint ep = APIFactory.makeApiEndpoint(eps); register(ep.getURITemplate(), ep); } } }
private void EachEndpointHasItsOwnDefaultSuffix(String expected, String protoSpec ) { String spec = ":my a api:API; api:sparqlEndpoint :spoo." + "\n" + protoSpec; Model m = ModelIOUtils.modelFromTurtle( spec ); Resource root = m.createResource( m.expandPrefix( ":my" ) ); APISpec s = SpecUtil.specFrom( root ); // for (APIEndpointSpec es : s.getEndpoints()) { String localName = es.getResource().getLocalName(); String defaultSuffix = es.getBindings().getAsString("_defaultSuffix", null); assertEquals("suffix should be the same as the local name", localName, defaultSuffix); } }