Skip to content

Commit

Permalink
Merge branch 'master' of github.com:dhlab-basel/knora-py
Browse files Browse the repository at this point in the history
  • Loading branch information
subotic committed Jun 5, 2019
2 parents d17aa93 + ef75156 commit 69b94ec
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
5 changes: 5 additions & 0 deletions README.md
Expand Up @@ -14,6 +14,11 @@ To install the latest version published on PyPI run:
$ pip3 install knora
```

To update to the latest version run:
```
$ pip3 install --upgrade knora
```

To install from source, i.e. this repositrory run:
```
$ python3 setup.py install
Expand Down
17 changes: 12 additions & 5 deletions knora/knora.py
Expand Up @@ -1108,7 +1108,7 @@ def create_schema(self, shortcode: str, shortname: str):
:return: Dict with a simple description of the ontology
"""
turtle = self.get_ontology_graph(shortcode, shortname)
# print(turtle)
print(turtle)
g = Graph()
g.parse(format='n3', data=turtle)

Expand Down Expand Up @@ -1152,8 +1152,6 @@ def create_schema(self, shortcode: str, shortname: str):
propindex= {} # we have to keep the order of the properties as given in the ontology....
for row in qres:

# print(row.res.toPython())

nresclass = row.res.toPython()
nresclass = nresclass[nresclass.find('#') + 1:]
if resclass != nresclass:
Expand All @@ -1170,10 +1168,18 @@ def create_schema(self, shortcode: str, shortname: str):
if attr is not None:
attr = attr.split('=')
if propname == npropname:
propcnt -= 1

# process attribute (there might be multiple attributes)
if attr is not None:
propcnt -= 1
if resources[resclass][propcnt]["attr"] is not None: # TODO: why is this necessary???
resources[resclass][propcnt]["attr"][attr[0]] = attr[1].strip('<>')

# process superprop (there might be multiple superprops)
if superprop not in resources[resclass][propcnt]["superprop"]:
resources[resclass][propcnt]["superprop"].append(superprop)
pprint.pprint(resources[resclass])
propcnt += 1
continue
else:
propname = npropname
Expand All @@ -1186,12 +1192,13 @@ def create_schema(self, shortcode: str, shortname: str):
resources[resclass].append({
"propname": propname,
"otype": objtype,
"superpro": superprop,
"superprop": [superprop],
"guiele": guiele,
"attr": {attr[0]: attr[1].strip('<>')} if attr is not None else None,
"card": card,
"cardval": row.cardval.toPython()
})
pprint.pprint(resources[resclass])
if superprop == "hasLinkTo":
link_otypes.append(objtype)
propindex[propname] = propcnt
Expand Down

0 comments on commit 69b94ec

Please sign in to comment.