Ejemplo n.º 1
0
def discoverNamespace(namespace):
    if not wikifyNamespace(namespace) in DumpdataProvider.getMembers("") and not wikifyNamespace(namespace) == "":
        raise ResourceNotFoundException()

    response = {
        "classifier": "Namespace",
        "name": namespace,
        "members": [],
    }  # , 'github': DumpdataProvider.getGithub(namespace, '')}

    # gather wiki data
    wikiNS = wikifyNamespace(namespace)
    setWikidata(response, "Namespace", wikiNS)

    response["namespace"] = "Namespace"

    # gather member data
    members = DumpdataProvider.getMembers(namespace)
    for member in members:
        response["members"].append(
            {
                "resource": os.path.join(base_uri, namespace, member).replace(" ", "_"),
                "classifier": "Namespace member",
                "name": member,
            }
        )

    return response
Ejemplo n.º 2
0
def discoverNamespace(namespace):
    if not wikifyNamespace(namespace) in DumpdataProvider.getMembers('') and not wikifyNamespace(namespace) == '':
        raise ResourceNotFoundException()

    response = {'classifier': 'Namespace', 'name': namespace, 'members': []}#, 'github': DumpdataProvider.getGithub(namespace, '')}

    #gather wiki data
    wikiNS = wikifyNamespace(namespace)
    setWikidata(response,'Namespace', wikiNS)

    response['namespace'] = 'Namespace'

    #gather member data
    members = DumpdataProvider.getMembers(namespace)
    for member in members:
        response['members'].append({
            'resource': os.path.join(base_uri, namespace, member).replace(' ', '_'),
            'classifier': 'Namespace member',
            'name'    : member
        })

    #response['endpoint'] = TripledataProvider.getEndpointLink('Namespace', wikiNS)
    #response['sesame']   = TripledataProvider.getSesameLink('namespaces', wikiNS)

    return response
Ejemplo n.º 3
0
def discoverNamespaceMember(namespace, member):
    if not member.decode("utf_8") in DumpdataProvider.getMembers(namespace):
        raise ResourceNotFoundException()

    response = {
        "folders": [],
        "files": [],
        "classifier": "Namespace member",
        "name": member,
        "github": DumpdataProvider.getGithub(namespace, member),
    }

    # gather wiki data
    wikiNS = wikifyNamespace(namespace)
    setWikidata(response, wikiNS, member)

    response["namespace"] = wikiNS

    # gather member data
    dirPath = os.path.join(namespace, member.replace(" ", "_"))
    files, dirs = DumpdataProvider.getDirContent(dirPath)

    for d in dirs:
        response["folders"].append({"resource": os.path.join(base_uri, dirPath, d), "classifier": "Folder", "name": d})

    for f in files:
        response["files"].append({"resource": os.path.join(base_uri, dirPath, f), "classifier": "File", "name": f})

    # response['endpoint'] = TripledataProvider.getEndpointLink(wikiNS, member)
    # response['sesame']   = TripledataProvider.getSesameLink(wikiNS, member)

    if namespace == "modules":
        response["module"] = DumpdataProvider.getModuleDescription(member)

    return response
Ejemplo n.º 4
0
def discoverNamespaceMember(namespace, member):
    if not member.decode('utf_8') in DumpdataProvider.getMembers(namespace):
        raise ResourceNotFoundException()

    response = {
        'folders'   : [],
        'files'     : [],
        'classifier': 'Namespace member',
        'name'      : member,
        'github'    : DumpdataProvider.getGithub(namespace, member)
    }

    #gather wiki data
    wikiNS = wikifyNamespace(namespace)
    setWikidata(response, wikiNS, member)

    response['namespace'] = wikiNS

    #gather member data
    dirPath = os.path.join(namespace, member.replace(' ','_'))
    files, dirs = DumpdataProvider.getDirContent(dirPath)

    for d in dirs:
        response['folders'].append({
            'resource'  : os.path.join(base_uri, dirPath, d),
            'classifier': 'Folder',
            'name'      : d
        })

    for f in files:
        response['files'].append({
            'resource'  : os.path.join(base_uri, dirPath, f),
            'classifier': 'File',
            'name'      : f
            })

    #response['endpoint'] = TripledataProvider.getEndpointLink(wikiNS, member)
    # response['sesame']   = TripledataProvider.getSesameLink(wikiNS, member)

    if namespace == 'modules':
        response['module'] = DumpdataProvider.getModuleDescription(member)

    return response
Ejemplo n.º 5
0
def discoverAllNamespaces():
    response = {'classifier': 'Namespace', 'name': 'Namespace', 'members': []}#, 'github': DumpdataProvider.getGithub('', '')}

    #gather wiki data
    setWikidata(response,'Namespace','Namespace')

    response['namespace'] = 'Namespace'

    #gather member data
    members = DumpdataProvider.getMembers('')
    for member in members:
        response['members'].append({
            'resource'  : os.path.join(base_uri, dewikifyNamespace(member)).replace(' ', '_'),
            'classifier': 'Namespace',
            'name'      : member
        })

    #response['endpoint'] = TripledataProvider.getEndpointLink('Namespace', 'Namespace')
    #response['sesame']   = TripledataProvider.getSesameLink('namespaces', 'Namespace')

    return response
Ejemplo n.º 6
0
def discoverAllNamespaces():
    response = {
        "classifier": "Namespace",
        "name": "Namespace",
        "members": [],
    }  # , 'github': DumpdataProvider.getGithub('', '')}

    # gather wiki data
    setWikidata(response, "Namespace", "Namespace")

    response["namespace"] = "Namespace"

    # gather member data
    members = DumpdataProvider.getMembers("")
    for member in members:
        response["members"].append(
            {
                "resource": os.path.join(base_uri, dewikifyNamespace(member)).replace(" ", "_"),
                "classifier": "Namespace",
                "name": member,
            }
        )

    return response