/** Record a use of the given namespace in the count map */ private void countNamespace( Resource r, Map<String,Integer> nsCount ) { if (!r.isAnon()) { String ns = r.getNameSpace(); // increment the count for this namespace Integer count = nsCount.containsKey( ns ) ? (Integer) nsCount.get( ns ) : new Integer( 0 ); Integer count1 = new Integer( count.intValue() + 1 ); nsCount.put( ns, count1 ); } }
private static String guessNamespace(Model temp) { List<Resource> res = temp.listSubjectsWithProperty(RDF.type, OWL.Ontology).toList(); Map<String, Integer> tempMap = new HashMap<String, Integer>(); for (Resource r : res) { String ns = r.getNameSpace(); tempMap.put(ns, (tempMap.containsKey(ns)) ? (tempMap.get(ns) + 1) : 1); } if (tempMap.size() > 0) return (String) sortByValue(tempMap).keySet().toArray()[0]; else return null; }
return null; String ns = r.getNameSpace(); if (ns == null || ns.trim().length() == 0) ns = null; String prefix = ontModel.getNsURIPrefix(r.getNameSpace()); if (prefix == null || prefix.trim().length() == 0) prefix = null;
String uri = m.asResource().getNameSpace(); logger.debug("service uri: " + uri); if (IdsAndMappings.get(uri) == null) {
private Attribute getSingleAttribute(Model model, Resource att_resource) { String att_id = ""; String att_name = ""; Property has_name_property = model.getProperty(Namespaces.KARMA + "hasName"); // attribute id att_id = att_resource.getLocalName(); logger.debug("attribute id: " + att_id); NodeIterator nodeIterator = null; RDFNode node = null; // attribute name nodeIterator = model.listObjectsOfProperty(att_resource, has_name_property); if (nodeIterator.hasNext() && (node = nodeIterator.next()).isLiteral()) { att_name = node.asLiteral().getString(); logger.debug("attribute name: " + att_name); } else logger.debug("attribute does not have a name."); Attribute att = new Attribute(att_id, att_resource.getNameSpace(), att_name, IOType.NONE, AttributeRequirement.NONE); return att; }
/** Answer the default OntModelSpec for this root, which will be <code>DEFAULT</code> unless <code>root</code> has the JA namespace and a local name which is the name of an OntModelSpec constant (in OntModelSpec), in which case it's that constant's value. */ private OntModelSpec getDefault( Resource root ) { if (root.isURIResource() && root.getNameSpace().equals( JA.uri )) { OntModelSpec oms = getOntModelSpecField( root.getLocalName() ); return oms == null ? DEFAULT : oms; } else { Resource like = getUniqueResource( root, JA.likeBuiltinSpec ); return like == null ? DEFAULT : getRequiredOntModelSpecField( like.getLocalName() ); } }
att = new Attribute(att_id, att_resource.getNameSpace(), att_name, ioType, requirement, att_groundedIn ); else att = new Attribute(att_id, att_resource.getNameSpace(), att_name, ioType, requirement);
e.printStackTrace(); namespace = r.getNameSpace();
predicateNs = node.asResource().getNameSpace(); predicatePrefix = model.getNsURIPrefix(predicateNs);
predicateNs = node.asResource().getNameSpace(); predicatePrefix = model.getNsURIPrefix(predicateNs);
predicateNs = node.asResource().getNameSpace(); predicatePrefix = model.getNsURIPrefix(predicateNs);
while (iterTermType.hasNext()) { RDFNode rnTermType = iterTermType.next(); if (rnTermType.isResource() && rnTermType.asResource().getNameSpace().equals(rrNs)) { String termType = rnTermType.asResource().getLocalName(); log.info("Found rr:termType " + termType); while (iterTermType.hasNext()) { RDFNode rnTermType = iterTermType.next(); if (rnTermType.isResource() && rnTermType.asResource().getNameSpace().equals(rrNs)) { String termType = rnTermType.asResource().getLocalName(); if (verbose) log.info("Found rr:termType " + termType);
predicateNs = node.asResource().getNameSpace(); predicatePrefix = model.getNsURIPrefix(predicateNs);
RDFNode rnDataType = iterDataType.next(); if (xsdNs.equals(rnDataType.asResource().getNameSpace())) { String dataType = rnDataType.asResource().getLocalName(); log.info("Found datatype xsd:" + dataType); while (iterTermType.hasNext()) { //should only be 1 RDFNode rnTermType = iterTermType.next(); if (rnTermType.isResource() && rnTermType.asResource().getNameSpace().equals(rrNs)) { String termType = rnTermType.asResource().getLocalName(); log.info("Found rr:termType " + termType);