Java Code Examples for org.openrdf.model.URI#getNamespace()
The following examples show how to use
org.openrdf.model.URI#getNamespace() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JavaNameResolver.java From anno4j with Apache License 2.0 | 5 votes |
public String getMethodName(URI name) { String ns = name.getNamespace(); String localPart = name.getLocalName(); if (prefixes.containsKey(ns)) return word(getMemberPrefix(ns) + initcap(localPart)); return word(localPart); }
Example 2
Source File: JavaNameResolver.java From anno4j with Apache License 2.0 | 5 votes |
public String getPluralParameterName(URI name) { String ns = name.getNamespace(); String localPart = name.getLocalName(); String plural = plural(localPart); if (model.contains(new URIImpl(ns + plural), null, null)) { plural = localPart; } return word(plural); }
Example 3
Source File: JavaNameResolver.java From anno4j with Apache License 2.0 | 5 votes |
public String getPluralPropertyName(URI name) { String ns = name.getNamespace(); String localPart = name.getLocalName(); String plural = plural(localPart); if (model.contains(new URIImpl(ns + plural), null, null)) { plural = localPart; } if (prefixes.containsKey(ns)) return getMemberPrefix(ns) + initcap(plural); return enc(plural); }
Example 4
Source File: JavaNameResolver.java From anno4j with Apache License 2.0 | 5 votes |
public String getSimpleName(URI name) { if ("".equals(name.getLocalName())) { String ns = name.getNamespace(); if (ns.indexOf(':') == ns.length() - 1) { return word(ns.substring(0, ns.length() - 1)); } return getSimpleName(new URIImpl(ns.substring(0, ns.length() - 1))); } return word(name.getLocalName()); }
Example 5
Source File: JavaNameResolver.java From anno4j with Apache License 2.0 | 5 votes |
private String getMemberName(URI name) { String ns = name.getNamespace(); String localPart = name.getLocalName(); if (prefixes.containsKey(ns)) return getMemberPrefix(ns) + initcap(localPart); return enc(localPart); }
Example 6
Source File: OWLCompiler.java From anno4j with Apache License 2.0 | 5 votes |
private Set<String> findUndefinedNamespaces(Model model, ClassLoader cl) { Set<String> unknown = new HashSet<String>(); for (Resource subj : model.filter(null, RDF.TYPE, null).subjects()) { if (subj instanceof URI) { URI uri = (URI) subj; String ns = uri.getNamespace(); if (!mapper.isRecordedConcept(uri, cl) && !literals.isRecordedeType(uri) && !mapper.isRecordedAnnotation(uri)) { unknown.add(ns); } } } return unknown; }
Example 7
Source File: OwlNormalizer.java From anno4j with Apache License 2.0 | 4 votes |
private URI nameAnonymous(Resource clazz) { for (Value eq : ds.match(clazz, OWL.EQUIVALENTCLASS, null).objects()) { if (eq instanceof URI) { nameClass(clazz, (URI) eq); return (URI) eq; } } Resource unionOf = ds.match(clazz, OWL.UNIONOF, null).objectResource(); if (unionOf != null) { return renameClass("", clazz, "Or", new RDFList(ds, unionOf) .asList()); } Resource intersectionOf = ds.match(clazz, OWL.INTERSECTIONOF, null) .objectResource(); if (intersectionOf != null) { return renameClass("", clazz, "And", new RDFList(ds, intersectionOf).asList()); } Resource oneOf = ds.match(clazz, OWL.ONEOF, null).objectResource(); if (oneOf != null) { return renameClass("Is", clazz, "Or", new RDFList(ds, oneOf) .asList()); } Resource complement = ds.match(clazz, OWL.COMPLEMENTOF, null) .objectResource(); if (complement != null) { URI comp = complement instanceof URI ? (URI) complement : null; if (comp == null) { comp = nameAnonymous(complement); if (comp == null) return null; } String name = "Not" + comp.getLocalName(); URI uri = new URIImpl(comp.getNamespace() + name); nameClass(clazz, uri); return uri; } if (ds.contains(clazz, MSG.MATCHING, null)) { return renameClass("", clazz, "Or", ds.match(clazz, MSG.MATCHING, null) .objects()); } return null; }
Example 8
Source File: TestURIExtensionIV.java From database with GNU General Public License v2.0 | 4 votes |
private URIExtensionIV<BigdataURI> newFixture(final URI uri) { final String namespace = uri.getNamespace(); final URI namespaceURI = new URIImpl(namespace); final IV<?, ?> namespaceIV = vocab.get(namespaceURI); if (namespaceIV == null) { fail("Not declared by vocabulary: namespace: " + namespace); } final FullyInlineTypedLiteralIV<BigdataLiteral> localNameIV = new FullyInlineTypedLiteralIV<BigdataLiteral>( uri.getLocalName()); final URIExtensionIV<BigdataURI> iv = new URIExtensionIV<BigdataURI>( localNameIV, namespaceIV); return iv; }
Example 9
Source File: AbstractTripleStore.java From database with GNU General Public License v2.0 | 4 votes |
/** * Substitutes in well know namespaces (rdf, rdfs, etc). */ final private String abbrev(final URI uri) { final String uriString = uri.toString(); // final int index = uriString.lastIndexOf('#'); // // if(index==-1) return uriString; // // final String namespace = uriString.substring(0, index); final String namespace = uri.getNamespace(); final String prefix = uriToPrefix.get(namespace); if (prefix != null) { return prefix + ":" + uri.getLocalName(); } return uriString; }