GithubHelp home page GithubHelp logo

Comments (3)

artob avatar artob commented on May 24, 2024

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.

gkellogg avatar gkellogg commented on May 24, 2024

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.

bhuga avatar bhuga commented on May 24, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.