Giter Site home page Giter Site logo

pynif's People

Contributors

ga11u avatar sandroacoelho avatar wetneb avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

pynif's Issues

nif:OffsetBasedString option is missing

On the current version of pynif, any URI for Contexts and Phrases is represented as a nif:OffsetBasedString . It would be great to also cover the nif:ContextHashBasedString .

I think it can be done ensuring backguard compatibility by adding an optional argument like:

  • NIFContext( hash_uri )
  • NIFPhrase( hash_uri )

Then, their respective def triples(self) functions could have something like:

        if self.hash_uri:
            yield (self.uri, RDF.type, NIF.ContextHashBasedString)
        else:
            yield (self.uri, RDF.type, NIF.OffsetBasedString)

And both NIFContext and NIFPhrase def __init__ could be changed with something like this:

 def __init__( ... , hash_uri = None):
      slef.original_uri = uri if not hash_uri else hash_uri

Order of NIF contexts is random

I have a function that looks something like this:

def print_nif_contexts(filepath: str):
    with open(filepath, "r", encoding="utf8") as file:
        file_content = file.readlines()
        nif_content = "".join(file_content)
        nif_doc = NIFCollection.loads(nif_content)
        for context in nif_doc.contexts:
            print(context.uri)

The order of the contexts is random and differs from run to run.

I would expect the sort order to be the same as in the file from which the contexts are read.

Having the same order in every run would already help, but sorted(nif_doc.contexts) is not supported (TypeError: '<' not supported between instances of 'NIFContext' and 'NIFContext').

Other than that I find the package really useful so far, thanks for making this opensource :)

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.