Giter Site home page Giter Site logo

rdf's Introduction

rdf

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's People

Contributors

boutros avatar tzapu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

rdf's Issues

fails decoding a turtle rdf with just namespace and no id

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

Question: how to convert a TTL file to Golang structs?

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" .

Decoders: better error handling on malformed input

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.

Lack of documentation + full example

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.

No license information

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?

'_' may appear in turtle local names

While the underscore is in the list of characters to be escaped (

rdf/encoder.go

Line 294 in 9659d91

case '_', '~', '.', '-', '!', '$', '&', '\'', '(', ')', '*', '+', ',', ';', '=', '/', '?', '#', '@', '%':
) they actually may appear in turtle local names (see rule 164s in https://www.w3.org/TR/turtle/#grammar-production-PN_CHARS_U)

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

Custom namespace functionality not working

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

Question: How to get XML Schema data type of literal?

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?

License

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?

Add a real license?

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.

Request to standardize 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?

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.