@Override public URI getLiteralType(RDFTerm resource) { if (resource instanceof Literal) { IRI type = ((Literal) resource).getDataType(); return type != null ? XSD.getXsdURI(type) : null; } else { throw new IllegalArgumentException("Value " + resource.toString() + " is not a literal"); } }
/** * Constructor that allows to parse the local name. if <code>null</code> * it uses <code>{@link #name()}{@link String#toLowerCase() .toLoverCase()} * </code> to generate the {@link #getLocalName() localName} * @param localName the local name or <code>null</code> to use * <code>{@link #name()}{@link String#toLowerCase() .toLoverCase()} * </code> */ private XSD(String localName){ this.localName = localName != null ? localName : name().toLowerCase(); this.uriString = namespace+this.localName; this.uri = URI.create(uriString); this.uriRef = new IRI(uriString); } public String getLocalName(){
@Override public RDFTerm createLiteral(String content, Locale language, URI type) { logger.debug("creating literal with content \"{}\", language {}, datatype {}", new Object[] {content, language, type}); if (type == null) { if(language == null){ return new PlainLiteralImpl(content); } else { return new PlainLiteralImpl(content, new Language(language.getLanguage())); } } else { return new TypedLiteralImpl(content, XSD.getXsdIRI(type)); } }
@Override public RDFTerm createLiteral(String content, Locale language, URI type) { logger.debug("creating literal with content \"{}\", language {}, datatype {}", new Object[] {content, language, type}); if (type == null) { if(language == null){ return new PlainLiteralImpl(content); } else { return new PlainLiteralImpl(content, new Language(language.getLanguage())); } } else { return new TypedLiteralImpl(content, XSD.getXsdIRI(type)); } }
/** * Constructor that allows to parse the local name. if <code>null</code> * it uses <code>{@link #name()}{@link String#toLowerCase() .toLoverCase()} * </code> to generate the {@link #getLocalName() localName} * @param localName the local name or <code>null</code> to use * <code>{@link #name()}{@link String#toLowerCase() .toLoverCase()} * </code> */ private XSD(String localName){ this.localName = localName != null ? localName : name().toLowerCase(); this.uriString = namespace+this.localName; this.uri = URI.create(uriString); this.uriRef = new IRI(uriString); } public String getLocalName(){
@Override public URI getLiteralType(RDFTerm resource) { if (resource instanceof Literal) { IRI type = ((Literal) resource).getDataType(); return type != null ? XSD.getXsdURI(type) : null; } else { throw new IllegalArgumentException("Value " + resource.toString() + " is not a literal"); } }