Comments (3)
Not sure what you consider the problem to be in RDF::Literal
handling languages? Nothing has changed on that in RDF.rb 0.2.1.
If it's just a case of misremembering the RDF specs, the short of it is that languages are attributes of literals (not of strings) just the same way as are datatypes, and that these attributes are mutually exclusive. It is not permitted to have a literal that has both a datatype and a language tag, which means that there can be no xsd:string literal that has a language tag. It's one or the other. This also means that though one could casually (though not according to the spec) consider plain literals to have an implicit xsd:string datatype, this is certainly not the case for language-tagged literals.
In any case, I highly doubt I'm going to want to subclass Ruby's String
class in RDF.rb, but nothing is stopping you from doing any of this in Spira. Experimental/disruptive changes should be done as a set of monkey-patches in other gems, after which it can be discussed what belongs in RDF.rb and what doesn't. Gregg is setting a good example to follow with regards to this strategy.
That said, we could add an RDF::Literal::String
class for xsd:strings specifically, it's just another datatype to support and there are a number of them we haven't got as yet. Just as long as it's understood it has nothing to do with plain or language-tagged literals.
from rdf.
Note that Literal("s", :datatype => RDF::XSD.string) is different that Literal("s"). Also, it is illegal for a literal to have both a datatype and a language, other than for XMLLiteral.
One way I dealt with this is to treat :language congruent to :datatype.
Also, you might simply do an object method to create a :literal on string, rather than create a new subclass.
from rdf.
Well shoot, I learned something today. All of this time I thought that the language was an attribute on XSD.string, with the syntax omitting the explicit datatype just some sugar, but a careful trip to the RDF concepts document has sorted me out. Live and learn.
In this case, RDF::Literal::String for XSD strings won't help me, because what I'm trying to do is come up with a way for language-tagged literals to make the round trip to a Ruby object and back, and I thus need an object which keeps track of a language attribute, but otherwise behaves just like a string--not an RDF::Literal, but something that RDF::Literal returns for #object on language-tagged literals.
Anyways, I see the messiness of including that in RDF.rb proper, and if you're not interested in that tradeoff, well, that's why I asked before I implemented it there. I'll cram it into Spira and we'll see how it goes.
from rdf.
Related Issues (20)
- Is it possible to configure deterministic serialisation? HOT 4
- Support arbitrary vocabs + more robust `expand_pname` HOT 3
- RDF::NTriples::Reader does not `require 'strscan'` HOT 3
- Ruby 2.7.1, URI.decode is obsolete
- bad behaviour in RDF::List HOT 7
- blank nodes reuse memory addresses, causing problems for persistent stores HOT 3
- Is there a "prettier" HOT 1
- Is there a more 'elegant' way to do this? HOT 3
- Strange "file missing" error with 3.1.14 release HOT 6
- Comparing two repositories HOT 2
- Verbose warnings on 2.7+ Ruby HOT 2
- 3.2.1 removes `RDF::Repository::Implementation::SerializedTransaction` HOT 5
- Is it possible to change the standard prefixes? HOT 7
- docmentation: how to create new vocabs, and langage-tagged strings in vocabs HOT 3
- Weird `require 'enumerator'` issue caused by this gem HOT 5
- change from DateTime < Literal to DateTime < Temporal breaks downstream customization HOT 5
- Invalid argument @ rb_sysopen - (Errno:EINVAL) when using local files on Windows HOT 10
- RDF::Vocabulary.find on RDF vocab returns RDF class HOT 5
- Ruby regexp warning: character class has duplicated range HOT 10
- Errno::EINVAL using `each_statement` with a LARGE, local NTriples file HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rdf.