Comments (3)
You're right that the DSL doesn't really handle language-tagged literals. The point of the DSL, though, is to create sub-classes of RDF::Vocabulary
(and the DSL is essentially just using the class-methods from RDF::Vocabulary
and RDF::Vocabulary::Term
). It's most easily done using RDF::Vocabulary::Writer
from a graph, which is available through the rdf
CLI. For example, from the rdf-vocab Rakefile
cmd = "bundle exec rdf"
if v[:patch]
File.open("lib/rdf/vocab/#{id}.rb_p", "w") {|f| f.write v[:patch]}
cmd += " patch --patch-file lib/rdf/vocab/#{id}.rb_p"
end
cmd += " serialize --uri '#{v[:uri]}' --output-format vocabulary --ordered"
cmd += " --module-name #{v.fetch(:module_name, "RDF::Vocab")}"
cmd += " --class-name #{v[:class_name] ? v[:class_name] : id.to_s.upcase}"
cmd += " --strict" if v.fetch(:strict, true)
cmd += " --noDoc"
cmd += " --extra #{URI.encode_www_form_component v[:extra].to_json}" if v[:extra]
cmd += " -o lib/rdf/vocab/#{id}.rb_t"
cmd += " '" + v.fetch(:source, v[:uri]) + "'"
puts " #{cmd}"
The DSL for, say .property
, instantiates a new RDF::Vocabulary::Term
, where there are some heuristics to turn option entries into IRI keys and values. String or Symbol values that look like IRIs are used to create an RDF::URI, otherwise, they are either Date
, DateTime
, Integer
, Decimal
, Double
, Boolean
, or Literal
. There isn't anything specific to create a language-tagged literal, but of course, the property option values could be instances of RDF::Literal
, instead.
Given the way RDF::Vocabulary::Term#attribute_value
is implemented, we could interpret an Hash value to be something like a language map. But, that would complicate many other places which use vocabularies and expect simple literal values for accessors such as #comment
and #label
.
In summary, there may be some ripple effects to things which use vocabularies, but something like you suggest is probably feasible, but ambitious.
from rdf.
@wu-lee I added support to this to the develop branch, and will also update the rdf-vocab representation. As this is potentially disruptive (but shouldn't be), I'll give the [email protected] mailing list an opportunity to object before releasing to RubyGems. If that happens, it will end up falling back to an option, at lest until the next dot release. It does affect many vocabularies in rdf-vocab.
from rdf.
Thank you for this. I'll investigate when I get a moment.
from rdf.
Related Issues (20)
- 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
- 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
- RDF::Query#graph_name does not behave has documented HOT 3
- Error when using local files on Windows 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.