This package introduces data structures for representing RDF resources, and includes functions for parsing and serialization of RDF data.
For complete documentation see godoc.
RDF library for Go
License: Other
This package introduces data structures for representing RDF resources, and includes functions for parsing and serialization of RDF data.
For complete documentation see godoc.
Right now the decoders all give up parsing when there is some malformed RDF input.
I'd like to also make it possible to ignore errors and try to continue parsing, discarding only the malformed parts. This is easy in line-based formats N-Triples & N-Quads, but more difficult in Turtle & RDF/XML.
Start by adding an ParserOption ("Strict"?), which should indicate the desired behaviour. Default to true
, but if set to false
, it will try to continue, skipping the malformed input.
Maybe also add an option (an io.Writer perhaps, defaults to nil) so consumers can decide where to print errors & warnings.
....so we can get nice prefixes instead of 'ns0' 'ns1' and so on
thanks for this, hugely useful project
The link to the documentation found in the .README file is not working.
Therefore, it's not trivial to understand how to create a .ttl file from an input data.
Is it possible to write kind of guide / supply "how to" guide.
From early coming year godoc will automatically forward to pkg.go.dev which doesn't display your docs due to an unrecognised license (see https://pkg.go.dev/github.com/knakk/rdf).
Do you mind using MIT or similar so that it will still be possible to read your docs?
I have a TTL file format which I want to convert to its relevant structs.
For example:
The following TTL file should be converted to 2 structs Host
and Account
@prefix ns0: <http://example.org/prop#> .
ns0:Host_48d491d1-7998-59d6-b3ed-07a0868d7536_531
a ns0:Host ;
ns0:Exploitable "XXE", "PEC";
ns0:Account ns0:Account_0abb0c18-9fb7-57f2-8bcd-2cb07ffbe865_161 ;
ns0:HostSignificance "3" ;
ns0:ID "48d491d1-7998-59d6-b3ed-07a0868d7536_531" .
ns0:Account_0abb0c18-9fb7-57f2-8bcd-2cb07ffbe865_161
a ns0:Account ;
ns0:GroupName "Administrators" ;
ns0:ID "0abb0c18-9fb7-57f2-8bcd-2cb07ffbe865_161" ;
ns0:Privileges "SeRemoteInteractiveLogonRight" ;
ns0:UserId "161" ;
ns0:Username "administrator" .
I'm running into the TODO-panic message in https://github.com/knakk/rdf/blob/master/encoder.go#L114-L116 , when trying to encode triples into RDF/XML, and was wondering if there are any plans to implement it? :)
(I might have a go at it at some point, but not sure how well that will go)
As far as I can tell there's no licensing information listed. That makes it difficult for others to use this code properly in other projects. Can you please specify a license?
My company makes it much easier to use OSS that has a standard license. Would you consider revising the license from "Do what thou wilt shall be the whole of the Law" to a Apache 2/MIT/etc?
In
Line 272 in 9659d91
xsd:integer
is stripped from values. That's not correct. It was probably confused with xsd:int
.
(see https://stackoverflow.com/questions/15336872/xsd-what-is-the-difference-between-xsinteger-and-xsint)
First of all: thanks for this awesome library!
JSON-LD is one of the more popular serialization formats for RDF, but this library does not yet support it. Unfortunately, parsing JSON-LD is not that simple, but some go libraries exist that might help:
https://github.com/kazarena/json-gold
https://github.com/emersion/go-jsonld
in this particular case
@prefix ns7: <https://domain.com/> .
ns1:Account\_0x41e55600548 ns4:seeAlso ns7: .
ns7: ns4:label "blog" .
the decoder fail with unexpected character \t on ns7: line
the snippet passes validation in a turtle validator
My code is as follows:
Declaration of TripleEncoder:
out := rdf.NewTripleEncoder(os.Stdout, rdf.Turtle)
out.Namespaces = walls.Prefixes
out.GenerateNamespaces = false
Prefixes Declaration (in a different package):
var BNF = "http://wallscope.co.uk/ontology/bnf/"
var BNFRES = "http://wallscope.co.uk/resource/bnf/"
var DBO = "http://dbpedia.org/ontology/"
var DBP = "http://dbpedia.org/property/"
var DBR = "http://dbpedia.org/resource/"
var DC = "http://purl.org/dc/elements/1.1/"
var DCT = "http://purl.org/dc/terms/"
var FOAF = "http://xmlns.com/foaf/0.1/"
var GEO_POS = "http://www.w3.org/2003/01/geo/wgs84_pos#"
var RDF = "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
var RDFS = "http://www.w3.org/2000/01/rdf-schema#"
var SCHEMA = "http://schema.org/"
var SKOS = "http://www.w3.org/2004/02/skos/core#"
var XSD = "http://www.w3.org/2001/XMLSchema#"
var WALLSONT = "http://wallscope.co.uk/ontology/"
var WALLSRES = "http://wallscope.co.uk/resource/"
var Prefixes = map[string]string{
"dbo": DBO,
"dbp": DBP,
"dbr": DBR,
"dc": DC,
"dct": DCT,
"foaf": FOAF,
"geo-pos": GEO_POS,
"rdf": RDF,
"rdfs": RDFS,
"schema": SCHEMA,
"skos": SKOS,
"walls": WALLSONT,
"walls-res": WALLSRES,
"xsd": XSD,
}
log.Println(out.Namespaces)
shows:
map[rdf:http://www.w3.org/1999/02/22-rdf-syntax-ns# dbp:http://dbpedia.org/property/ dbr:http://dbpedia.org/resource/ xsd:http://www.w3.org/2001/XMLSchema# dc:http://purl.org/dc/elements/1.1/ skos:http://www.w3.org/2004/02/skos/core# walls:http://wallscope.co.uk/ontology/ walls-res:http://wallscope.co.uk/resource/ dbo:http://dbpedia.org/ontology/ dct:http://purl.org/dc/terms/ foaf:http://xmlns.com/foaf/0.1/ geo-pos:http://www.w3.org/2003/01/geo/wgs84_pos# rdfs:http://www.w3.org/2000/01/rdf-schema# schema:http://schema.org/]
although the encoder outputs things like http://www.w3.org/2000/01/rdf-schema#label
and http://www.w3.org/2004/02/skos/core#notation
which should become rdfs:label
and skos:notation
respectively.
Am I doing something wrong? I can't find anything in the documentation about this issue
Is there an option to custom the @prefix
being created in the output of the TTL?
Although in the readme, it's not implemented.
I have an n-triples dataset with both integer, string and float literal data types (So, an integer looks like:
"17601"^^<http://www.w3.org/2001/XMLSchema#integer>
).
I was wondering how I can determine what type a value has, in code?
Your license file says:
"Do what thou wilt shall be the whole of the Law."
this is not really a license. It is not explicit in a number of important points, to note: an explicit grant of permission to use, modify and redistribute the software in perpuity, and an explicit liability disclaimer. The former puts potential users of your software at risk, the latter may cause you problems if you ever get sued over this.
For background, see the following articles
http://www.linuxjournal.com/article/6225
https://news.ycombinator.com/item?id=5733245
https://opensource.google.com/docs/using/license/
Would you be willing to change your license to a standard open source license? For example, the MIT license is very permissive, and the Apache 2 license in addition grants you some protection against suits over patents.
xs:integer
...maybe xs:int
While the underscore is in the list of characters to be escaped (
Line 294 in 9659d91
There are some other characters that may also appear (like -,%)
see also: protegeproject/protege#89
So they should remain unescaped in local names. At the very least the user should get a choice.
@hydrarulz
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.