/** * Gets the URI Fragment for the selected entity. * @return The fragment, or the empty string if there * is no fragment. */ private String getFragment() { Optional<String> fragment = owlEntity.getIRI().getRemainder(); return fragment.or(""); }
public DefaultSWRLVariableBuiltInArgument(@NonNull IRI variableIRI) { this.variableIRI = variableIRI; com.google.common.base.Optional<String> remainder = variableIRI.getRemainder(); if (remainder.isPresent()) variableName = remainder.get(); else throw new IllegalArgumentException("SWRL variable with IRI " + variableIRI + " has no remainder"); this.builtInResult = null; this.isBound = true; }
@Override public String getShortForm(OWLEntity owlEntity) { IRI iri = owlEntity.getIRI(); Optional<String> name = iri.getRemainder(); if (!name.isPresent()){ String newName = iri.toString(); if (newName.endsWith("/")){ newName = newName.substring(0, newName.length()-1); } int index = newName.lastIndexOf("/"); if (index >= 0){ newName = newName.substring(index+1, newName.length()); } return newName; } return name.get(); }
/** * @return entities with invalid qnames */ public Set<OWLEntity> getEntitiesWithInvalidQNames() { return asUnorderedSet( getEntitiesThatRequireNamespaces().stream().filter(e -> !e.getIRI().getRemainder() .isPresent())); } }
private String getShortForm(IRI uri){ try { Optional<String> rendering = uri.getRemainder(); if (!rendering.isPresent()) { // Get last bit of path String path = uri.toURI().getPath(); if (path == null) { return uri.toString(); } return uri.toURI().getPath().substring(path.lastIndexOf("/") + 1); } return rendering.get(); } catch (Exception e) { return "<Error! " + e.getMessage() + ">"; } }
/** * @return entities with invalid qnames */ public Set<OWLEntity> getEntitiesWithInvalidQNames() { return asUnorderedSet( getEntitiesThatRequireNamespaces().stream().filter(e -> !e.getIRI().getRemainder() .isPresent())); } }
/** * @return entities with invalid qnames */ public Set<OWLEntity> getEntitiesWithInvalidQNames() { return asUnorderedSet( getEntitiesThatRequireNamespaces().stream().filter(e -> !e.getIRI().getRemainder() .isPresent())); } }
@Override public void visit(IRI iri) { Optional<String> remainder = iri.getRemainder(); if(remainder.isPresent()) { write(remainder.get()); } else { write(iri.toString()); } }
private String getShortForm(IRI uri){ try { Optional<String> rendering = uri.getRemainder(); if (!rendering.isPresent()) { // Get last bit of path String path = uri.toURI().getPath(); if (path == null) { return uri.toString(); } return uri.toURI().getPath().substring(path.lastIndexOf("/") + 1); } return rendering.get(); } catch (Exception e) { return "<Error! " + e.getMessage() + ">"; } }
private void processIRI(IRI iri) { String ns = checkNotNull(iri, "iri cannot be null").getNamespace(); if (!(ns.isEmpty() || !iri.getRemainder().isPresent())) { namespaceUtil.getPrefix(ns); } }
/** * @return entities with invalid qnames */ public Set<OWLEntity> getEntitiesWithInvalidQNames() { return asUnorderedSet( getEntitiesThatRequireNamespaces().stream().filter(e -> !e.getIRI().getRemainder() .isPresent())); } }
@NonNull @Override public String visit(@NonNull SWRLVariableBuiltInArgument argument) { IRI variableIRI = argument.getIRI(); com.google.common.base.Optional<String> remainder = variableIRI.getRemainder(); if (remainder.isPresent()) return "?" + remainder.get(); else throw new IllegalArgumentException("SWRL variable with IRI " + variableIRI + " has no remainder"); }
@Override public void visit(IRI iri) { Optional<String> remainder = iri.getRemainder(); if(remainder.isPresent()) { write(remainder.get()); } else { write(iri.toString()); } }
private void processIRI(IRI iri) { String ns = checkNotNull(iri, "iri cannot be null").getNamespace(); if (!(ns.isEmpty() || !iri.getRemainder().isPresent())) { namespaceUtil.getPrefix(ns); } }
private void processIRI(IRI iri) { String ns = checkNotNull(iri, "iri cannot be null").getNamespace(); if (!(ns.isEmpty() || !iri.getRemainder().isPresent())) { namespaceUtil.getPrefix(ns); } }
private void processIRI(IRI iri) { String ns = checkNotNull(iri, "iri cannot be null").getNamespace(); if (!(ns.isEmpty() || !iri.getRemainder().isPresent())) { namespaceUtil.getPrefix(ns); } }
private IRI getBaseIRI(OWLEntity entity) { Optional<String> remainder = entity.getIRI().getRemainder(); if (remainder.isPresent()){ IRI iri = entity.getIRI(); int remainderIndex = iri.toString().lastIndexOf(remainder.get()); if (remainderIndex != -1) { return IRI.create(iri.toString().substring(0, remainderIndex)); } } return entity.getIRI(); }
private IRI getBaseIRI(OWLEntity entity) { Optional<String> remainder = entity.getIRI().getRemainder(); if (remainder.isPresent()){ IRI iri = entity.getIRI(); int remainderIndex = iri.toString().lastIndexOf(remainder.get()); if (remainderIndex != -1) { return IRI.create(iri.toString().substring(0, remainderIndex)); } } return entity.getIRI(); }
public void visit(@Nonnull SWRLVariable swrlVariable) { builder.append("?"); builder.append(swrlVariable.getIRI().getRemainder().or(swrlVariable.getIRI().toString())); }
public void visit(SWRLVariable swrlVariable) { builder.append("?"); builder.append(swrlVariable.getIRI().getRemainder().or(swrlVariable.getIRI().toString())); }