예제 #1
0
def testFormulaStores(): 
    pluginname=None
    if __name__=='__main__':
        if len(sys.argv)>1:
            pluginname=sys.argv[1]

    for s in plugin.plugins(pluginname, plugin.Store):
        if not s.getClass().formula_aware: continue

        yield testFormulaStore, s.name
예제 #2
0
def testFormulaStores(): 
    pluginname=None
    if __name__=='__main__':
        if len(sys.argv)>1:
            pluginname=sys.argv[1]

    for s in plugin.plugins(pluginname, plugin.Store):
        if not s.getClass().formula_aware: continue

        yield testFormulaStore, s.name
예제 #3
0
def get_formula_stores_tests():
    pluginname = None

    for s in plugin.plugins(pluginname, plugin.Store):
        if s.name in (
                "Auditable",
                "Concurrent",
                "SPARQLStore",
                "SPARQLUpdateStore",
        ):
            continue
        if not s.getClass().formula_aware:
            continue
        yield checkFormulaStore, s.name
예제 #4
0
def testFormulaStores():
    pluginname = None
    if __name__ == '__main__':
        if len(sys.argv) > 1:
            pluginname = sys.argv[1]

    for s in plugin.plugins(pluginname, plugin.Store):
        if s.name in (
                'Auditable', 'Concurrent',
                'SPARQLStore', 'SPARQLUpdateStore',
                ):
            continue
        if not s.getClass().formula_aware:
            continue
        yield testFormulaStore, s.name
예제 #5
0
    def _init_content_negotiator(self):
        #TODO: use config instead
        default_content_type = "application/ld+json"
        default_accept_params = AcceptParameters(ContentType(default_content_type))
        # rdf types
        rdf_types = set([plugin.name for plugin in plugins(kind=Serializer) if "/" in plugin.name])

        #Blacklisted because mapped to TriX that requires a context-aware store
        blacklisted_types = ["application/xml"]

        #TODO: consider other types
        accepted_types = list(rdf_types.difference(blacklisted_types)) + ["application/json"]
        self._logger.debug("Accepted types: %s" % accepted_types)
        acceptable_params = [default_accept_params] + [AcceptParameters(ContentType(ct)) for ct in accepted_types]

        self._negotiator = ContentNegotiator(default_accept_params, acceptable_params)
예제 #6
0
    def _init_content_negotiator(self):
        #TODO: use config instead
        default_content_type = "application/ld+json"
        default_accept_params = AcceptParameters(
            ContentType(default_content_type))
        # rdf types
        rdf_types = set([
            plugin.name for plugin in plugins(kind=Serializer)
            if "/" in plugin.name
        ])

        #Blacklisted because mapped to TriX that requires a context-aware store
        blacklisted_types = ["application/xml"]

        #TODO: consider other types
        accepted_types = list(
            rdf_types.difference(blacklisted_types)) + ["application/json"]
        self._logger.debug("Accepted types: %s" % accepted_types)
        acceptable_params = [default_accept_params] + [
            AcceptParameters(ContentType(ct)) for ct in accepted_types
        ]

        self._negotiator = ContentNegotiator(default_accept_params,
                                             acceptable_params)
예제 #7
0
                       default=False,
                       help="Don't output the resulting graph " +
                       "(useful for checking validity of input).")

    oparser.add_option(
        '-w',
        '--warn',
        action='store_true',
        default=False,
        help="Output warnings to stderr (by default only critical errors).")

    return oparser


_get_plugin_names = lambda kind: ", ".join(p.name
                                           for p in plugin.plugins(kind=kind))


def main():
    oparser = make_option_parser()
    opts, args = oparser.parse_args()
    if len(args) < 1:
        oparser.print_usage()
        oparser.exit()

    if opts.warn:
        loglevel = logging.WARNING
    else:
        loglevel = logging.CRITICAL
    logging.basicConfig(level=loglevel)
예제 #8
0
파일: ldp.py 프로젝트: whikloj/lakesuperior
from lakesuperior.model.ldp.ldp_factory import LdpFactory
from lakesuperior.model.ldp.ldp_nr import LdpNr
from lakesuperior.model.ldp.ldp_rs import LdpRs
from lakesuperior.model.ldp.ldpr import Ldpr
from lakesuperior.util import toolbox
from lakesuperior.util.toolbox import RequestUtils

DEFAULT_RDF_MIMETYPE = 'text/turtle'
"""
Fallback serialization format used when no acceptable formats are specified.
"""

logger = logging.getLogger(__name__)
rdf_parsable_mimetypes = {
    mt.name
    for mt in plugin.plugins() if mt.kind is parser.Parser and '/' in mt.name
}
"""MIMEtypes that can be parsed into RDF."""

store = env.app_globals.rdf_store

rdf_serializable_mimetypes = {
    #mt.name for mt in plugin.plugins()
    #if mt.kind is serializer.Serializer and '/' in mt.name
    'application/ld+json',
    'application/n-triples',
    'application/rdf+xml',
    'text/turtle',
    'text/n3',
}
"""
예제 #9
0
            )

        # remove stuff and make sure the graph is empty again
        self.removeStuff()
        asserte(len(list(c1triples((Any, Any, Any)))), 0)
        asserte(len(list(triples((Any, Any, Any)))), 0)


# dynamically create classes for each registered Store
pluginname = None
if __name__ == "__main__":
    if len(sys.argv) > 1:
        pluginname = sys.argv[1]

tests = 0
for s in plugin.plugins(pluginname, plugin.Store):
    if s.name in (
            "default",
            "IOMemory",
            "Auditable",
            "Concurrent",
            "SPARQLStore",
            "SPARQLUpdateStore",
    ):
        continue  # these are tested by default
    if not s.getClass().context_aware:
        continue

    locals()["t%d" % tests] = type("%sContextTestCase" % s.name,
                                   (ContextTestCase, ), {"store": s.name})
    tests += 1
예제 #10
0
        # remove stuff and make sure the graph is empty again
        self.removeStuff()
        asserte(len(list(c1triples((Any, Any, Any)))), 0)
        asserte(len(list(triples((Any, Any, Any)))), 0)




# dynamically create classes for each registered Store

pluginname = None
if __name__ == '__main__':
    if len(sys.argv) > 1:
        pluginname = sys.argv[1]

tests = 0
for s in plugin.plugins(pluginname, plugin.Store):
    if s.name in ('default', 'IOMemory', 'Auditable',
                  'Concurrent', 'SPARQLStore', 'SPARQLUpdateStore'):
        continue  # these are tested by default
    if not s.getClass().context_aware:
        continue

    locals()["t%d" % tests] = type("%sContextTestCase" % s.name, (
        ContextTestCase,), {"store": s.name})
    tests += 1


if __name__ == '__main__':
    unittest.main()
예제 #11
0
파일: rdfpipe.py 프로젝트: zqhead/rdflib
def _get_plugin_names(kind):
    return ", ".join(p.name for p in plugin.plugins(kind=kind))
예제 #12
0
    oparser.add_option(
        '--no-out',
        action='store_true', default=False,
        help="Don't output the resulting graph " +
             "(useful for checking validity of input).")

    oparser.add_option(
        '-w', '--warn',
        action='store_true', default=False,
        help="Output warnings to stderr (by default only critical errors).")

    return oparser

_get_plugin_names = lambda kind: ", ".join(
    p.name for p in plugin.plugins(kind=kind))


def main():
    oparser = make_option_parser()
    opts, args = oparser.parse_args()
    if len(args) < 1:
        oparser.print_usage()
        oparser.exit()

    if opts.warn:
        loglevel = logging.WARNING
    else:
        loglevel = logging.CRITICAL
    logging.basicConfig(level=loglevel)
예제 #13
0
 def __init__(self):
     self._parser = SCTConverterGateway()
     self.formats = [e.name for e in plugins(kind=Serializer) if '/' not in e.name]
예제 #14
0
    oparser.add_option('--no-guess', dest='guess',
            action='store_false', default=True,
            help="Don't guess format based on file suffix.")

    oparser.add_option('--no-out',
            action='store_true', default=False,
            help="Don't output the resulting graph (useful for checking validity of input).")

    oparser.add_option('-w', '--warn',
            action='store_true', default=False,
            help="Output warnings to stderr (by default only critical errors).")

    return oparser

_get_plugin_names = lambda kind: ", ".join(p.name for p in plugin.plugins(kind=kind))


def main():
    oparser = make_option_parser()
    opts, args = oparser.parse_args()
    if len(args) < 1:
        oparser.print_usage()
        oparser.exit()

    if opts.warn:
        loglevel = logging.WARNING
    else:
        loglevel = logging.CRITICAL
    logging.basicConfig(level=loglevel)
예제 #15
0
    oparser.add_option('--no-guess', dest='guess',
            action='store_false', default=True,
            help="Don't guess format based on file suffix.")

    oparser.add_option('--no-out',
            action='store_true', default=False,
            help="Don't output the resulting graph (useful for checking validity of input).")

    oparser.add_option('-w', '--warn',
            action='store_true', default=False,
            help="Output warnings to stderr (by default only critical errors).")

    return oparser

_get_plugin_names = lambda kind: ", ".join(p.name for p in plugin.plugins(kind=kind))


def main():
    oparser = make_option_parser()
    opts, args = oparser.parse_args()
    if len(args) < 1:
        oparser.print_usage()
        oparser.exit()

    if opts.warn:
        loglevel = logging.WARNING
    else:
        loglevel = logging.CRITICAL
    logging.basicConfig(level=loglevel)
예제 #16
0
파일: rdfpipe.py 프로젝트: RDFLib/rdflib
def _get_plugin_names(kind): return ", ".join(
    p.name for p in plugin.plugins(kind=kind))


def main():